From f50272512016ce55e9a4ff33e8d46861ffcd11d3 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 5 Dec 2020 21:59:42 +0900 Subject: [PATCH] Fix slice bound error on extremely narrow screen --- src/terminal.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/terminal.go b/src/terminal.go index 83b3a7b5..4ddc6bae 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -1116,6 +1116,7 @@ func (t *Terminal) displayWidthWithLimit(runes []rune, prefixWidth int, limit in } func (t *Terminal) trimLeft(runes []rune, width int) ([]rune, int32) { + width = util.Max(0, width) var trimmed int32 // Assume that each rune takes at least one column on screen if len(runes) > width {