mirror of https://github.com/rivo/tview.git
Added a scroll function to TextView. Resolves #124
This commit is contained in:
parent
bb80ad41aa
commit
71ecf1f429
10
textview.go
10
textview.go
|
@ -270,6 +270,16 @@ func (t *TextView) SetDoneFunc(handler func(key tcell.Key)) *TextView {
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ScrollTo scrolls to the specified row and column (both starting with 0).
|
||||||
|
func (t *TextView) ScrollTo(row, column int) *TextView {
|
||||||
|
if !t.scrollable {
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
t.lineOffset = row
|
||||||
|
t.columnOffset = column
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
// ScrollToBeginning scrolls to the top left corner of the text if the text view
|
// ScrollToBeginning scrolls to the top left corner of the text if the text view
|
||||||
// is scrollable.
|
// is scrollable.
|
||||||
func (t *TextView) ScrollToBeginning() *TextView {
|
func (t *TextView) ScrollToBeginning() *TextView {
|
||||||
|
|
Loading…
Reference in New Issue