diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2024-06-06 00:23:58 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-06-06 00:23:58 +0900 |
commit | 1616ed543dd250f68852007a5e2e44d8937e4302 (patch) | |
tree | c3ae1376d4c5b6a8207f0b3eb039a55cd0ad4ee0 | |
parent | dc73fba188353155f203e1cb005447e410349af0 (diff) |
Fix index out of bounds error caused by outdated offset
-rw-r--r-- | src/terminal.go | 2 |
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? |