diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2020-02-24 01:37:08 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2020-02-24 01:37:08 +0900 |
commit | ec75d16ea8f28768336f6f4a6992e3f838bc18fd (patch) | |
tree | c0d0661d884334f6c9ab8228b4fccf5daae18719 /src/tui | |
parent | 5cae8ea733e8663eae96480b5e6d4c94afcdb3bd (diff) |
Fix panic on unexpected escape sequences
Diffstat (limited to 'src/tui')
-rw-r--r-- | src/tui/light.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tui/light.go b/src/tui/light.go index c32a1baa..02f12d0f 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -467,7 +467,7 @@ func (r *LightRenderer) escSequence(sz *int) Event { } } // Bracketed paste mode: \e[200~ ... \e[201~ - if r.buffer[3] == '0' && (r.buffer[4] == '0' || r.buffer[4] == '1') && r.buffer[5] == '~' { + if len(r.buffer) > 5 && r.buffer[3] == '0' && (r.buffer[4] == '0' || r.buffer[4] == '1') && r.buffer[5] == '~' { // Immediately discard the sequence from the buffer and reread input r.buffer = r.buffer[6:] *sz = 0 |