We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02a2aca commit 928d859Copy full SHA for 928d859
Project/Src/Gui/TextView.cs
@@ -43,8 +43,9 @@ public int FirstVisibleLine
43
get => textArea.Document.GetFirstLogicalLine(textArea.VirtualTop.Y/FontHeight);
44
set
45
{
46
- if (FirstVisibleLine != value)
47
- textArea.VirtualTop = new Point(textArea.VirtualTop.X, textArea.Document.GetVisibleLine(value)*FontHeight);
+ int clampedValue = Math.Max(0, Math.Min(value, textArea.Document.TotalNumberOfLines - textArea.TextView.VisibleLineCount + 1));
+ if (FirstVisibleLine != clampedValue)
48
+ textArea.VirtualTop = new Point(textArea.VirtualTop.X, textArea.Document.GetVisibleLine(clampedValue) * FontHeight);
49
}
50
51
0 commit comments