Property ScrollOffset
ScrollOffset
Gets the horizontal scroll offset, representing the index of the first visible text element.
public int ScrollOffset { get; }
Property Value
- int
A 0-based index into the text elements indicating which element appears at the left edge of the viewport.
Remarks
When the text is longer than the viewport width, this property tracks how far the view has scrolled. The Terminal.Gui.Views.TextField.Adjust() method automatically updates this value to keep the cursor visible.
Relationship to cursor positioning:
- InsertionPoint: Absolute position in the text (0 to text length)
- ScrollOffset: Index of first visible character
- Screen column = InsertionPoint - ScrollOffset (approximately, adjusted for wide chars)
Example: For text "Hello World" with viewport width 5:
- ScrollOffset = 0: Shows "Hello"
- ScrollOffset = 6: Shows "World"
- See Also