From bacbf5155bc1730dd9be27f4558bc0eb3621ba3c Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 18 Oct 2019 13:56:45 +0200 Subject: [PATCH] Wrong comparator led to wrong scrolling behaviour. Fixes #341, resolves #342 --- textview.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/textview.go b/textview.go index 6430a93..cac80a9 100644 --- a/textview.go +++ b/textview.go @@ -188,7 +188,8 @@ func NewTextView() *TextView { } // SetScrollable sets the flag that decides whether or not the text view is -// scrollable. If true, text is kept in a buffer and can be navigated. +// scrollable. If true, text is kept in a buffer and can be navigated. If false, +// the last line will always be visible. func (t *TextView) SetScrollable(scrollable bool) *TextView { t.scrollable = scrollable if !scrollable { @@ -947,7 +948,7 @@ func (t *TextView) Draw(screen tcell.Screen) { // If this view is not scrollable, we'll purge the buffer of lines that have // scrolled out of view. if !t.scrollable && t.lineOffset > 0 { - if t.lineOffset <= len(t.index) { + if t.lineOffset >= len(t.index) { t.buffer = nil } else { t.buffer = t.buffer[t.index[t.lineOffset].Line:]