Added ScrollToBeginning() and ScrollToEnd() to TextView

This commit is contained in:
Jakob Maier 2018-01-14 11:36:27 +01:00
parent 38d663c267
commit 3442b13a04
1 changed files with 15 additions and 0 deletions

View File

@ -249,6 +249,21 @@ func (t *TextView) SetDoneFunc(handler func(key tcell.Key)) *TextView {
return t
}
// ScrollToBeginning scrolls to the top left corner of the text.
func (t *TextView) ScrollToBeginning() *TextView {
t.trackEnd = false
t.lineOffset = 0
t.columnOffset = 0
return t
}
// ScrollToEnd scrolls to the bottom left corner of the text.
func (t *TextView) ScrollToEnd() *TextView {
t.trackEnd = true
t.columnOffset = 0
return t
}
// Clear removes all text from the buffer.
func (t *TextView) Clear() *TextView {
t.buffer = nil