Minor additions to pull request #30. Resolves #28.

This commit is contained in:
Oliver 2018-01-14 13:35:57 +01:00
parent f26cdc84a2
commit 8bc6a3f684
1 changed files with 11 additions and 2 deletions

View File

@ -286,16 +286,25 @@ func (t *TextView) SetDoneFunc(handler func(key tcell.Key)) *TextView {
return t
}
// ScrollToBeginning scrolls to the top left corner of the text.
// ScrollToBeginning scrolls to the top left corner of the text if the text view
// is scrollable.
func (t *TextView) ScrollToBeginning() *TextView {
if !t.scrollable {
return t
}
t.trackEnd = false
t.lineOffset = 0
t.columnOffset = 0
return t
}
// ScrollToEnd scrolls to the bottom left corner of the text.
// ScrollToEnd scrolls to the bottom left corner of the text if the text view
// is scrollable. Adding new rows to the end of the text view will cause it to
// scroll with the new data.
func (t *TextView) ScrollToEnd() *TextView {
if !t.scrollable {
return t
}
t.trackEnd = true
t.columnOffset = 0
return t