Added a scroll function to TextView. Resolves #124

This commit is contained in:
Oliver 2018-05-28 21:27:25 +02:00
parent bb80ad41aa
commit 71ecf1f429
1 changed files with 10 additions and 0 deletions

View File

@ -270,6 +270,16 @@ func (t *TextView) SetDoneFunc(handler func(key tcell.Key)) *TextView {
return t return t
} }
// ScrollTo scrolls to the specified row and column (both starting with 0).
func (t *TextView) ScrollTo(row, column int) *TextView {
if !t.scrollable {
return t
}
t.lineOffset = row
t.columnOffset = column
return t
}
// ScrollToBeginning scrolls to the top left corner of the text if the text view // ScrollToBeginning scrolls to the top left corner of the text if the text view
// is scrollable. // is scrollable.
func (t *TextView) ScrollToBeginning() *TextView { func (t *TextView) ScrollToBeginning() *TextView {