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 be6183dCopy full SHA for be6183d
Project/Src/Gui/TextView.cs
@@ -43,8 +43,10 @@ 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);
+ // Clamp the value in order to avoid scrolling the text out of view
+ int clampedValue = Math.Max(0, Math.Min(value, textArea.Document.TotalNumberOfLines - textArea.TextView.VisibleLineCount + 1));
48
+ if (FirstVisibleLine != clampedValue)
49
+ textArea.VirtualTop = new Point(textArea.VirtualTop.X, textArea.Document.GetVisibleLine(clampedValue) * FontHeight);
50
}
51
52
0 commit comments