Merge pull request #30 from maja42/TextViewScrolling

Thanks. I will make some modifications to this. You might want to check them out.
This commit is contained in:
rivo 2018-01-14 13:32:08 +01:00 committed by GitHub
commit f26cdc84a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -286,6 +286,21 @@ func (t *TextView) SetDoneFunc(handler func(key tcell.Key)) *TextView {
return t 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. // Clear removes all text from the buffer.
func (t *TextView) Clear() *TextView { func (t *TextView) Clear() *TextView {
t.buffer = nil t.buffer = nil