mirror of https://github.com/rivo/tview.git
Added ScrollToBeginning() and ScrollToEnd() to TextView
This commit is contained in:
parent
38d663c267
commit
3442b13a04
15
textview.go
15
textview.go
|
@ -249,6 +249,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
|
||||||
|
|
Loading…
Reference in New Issue