2
0
mirror of https://github.com/junegunn/fzf synced 2024-11-10 13:10:44 +00:00

Fix panic on unexpected escape sequences

This commit is contained in:
Junegunn Choi 2020-02-24 01:37:08 +09:00
parent 5cae8ea733
commit ec75d16ea8
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -467,7 +467,7 @@ func (r *LightRenderer) escSequence(sz *int) Event {
} }
} }
// Bracketed paste mode: \e[200~ ... \e[201~ // 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 // Immediately discard the sequence from the buffer and reread input
r.buffer = r.buffer[6:] r.buffer = r.buffer[6:]
*sz = 0 *sz = 0