summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-06-06 00:23:58 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-06-06 00:23:58 +0900
commit1616ed543dd250f68852007a5e2e44d8937e4302 (patch)
treec3ae1376d4c5b6a8207f0b3eb039a55cd0ad4ee0
parentdc73fba188353155f203e1cb005447e410349af0 (diff)
Fix index out of bounds error caused by outdated offset
-rw-r--r--src/terminal.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 60cc6f33..7846e662 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -4574,7 +4574,7 @@ func (t *Terminal) constrain() {
maxLines := t.maxItems()
// May need to try again after adjusting the offset
- t.offset = util.Max(0, t.offset) // Prevent -1
+ t.offset = util.Constrain(t.offset, 0, count)
for tries := 0; tries < maxLines; tries++ {
numItems := maxLines
// How many items can be fit on screen including the current item?