[Solved] How to get EditorWindow client rect?

I want to create a simple console-like custom EditorWindow in Unity. There is a bunch of lables (console lines).

I’m using GUILayout.Begi/EndScrollView to position all the labels in one column. The problem is that it places all the content inside the rectangle that matches label bounds, not EditowWindow bounds. As a result, I see weird placed scrollbars.

I would be happy to recalculate ScrollView bounds, but can’t find any clue in documentation how to make so. Here is my code:

using UnityEditor;
using UnityEngine;
using System;

public class MyEditorWindow : EditorWindow
{
   Vector2 scrollPosition = Vector2.zero;

   [MenuItem("Window/MyEditorWindow")]
   public static void ShowExample()
   {
       var wnd = GetWindow<MyEditorWindow>();
       wnd.titleContent = new GUIContent("MyEditorWindow");
   }

   private void OnGUI()
   {
       scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(position.width), GUILayout.Height(position.height));

       var elapsed = new TimeSpan();
       for (int i = 0; i < 100; i++)
       {
           elapsed = elapsed.Add(TimeSpan.FromSeconds(1));
       }

       for (int i = 0; i < 100; i++)
       {
           GUILayout.Label("Some long long long long text");
       }

       GUI.EndScrollView();
   }
}

What is the proper way of making scrolbars which bound to the edges of the EditorWindow?

Turns out I used GUI.EndScrollView(), not GUILayout.EndScrollView().