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

pull/40/head
Oliver 6 years ago
parent f26cdc84a2
commit 8bc6a3f684

@ -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

Loading…
Cancel
Save