Fix handling of bracketed paste mode

fzf should immediately continue consuming the buffer after discarding
bracketed paste mode sequence.

Close #951
This commit is contained in:
Junegunn Choi 2017-06-22 02:35:57 +09:00
parent bf92862459
commit 0c66521b23
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -411,10 +411,12 @@ func (r *LightRenderer) escSequence(sz *int) Event {
return Event{F12, 0, nil}
}
}
// Bracketed paste mode \e[200~ / \e[201
if r.buffer[3] == 48 && (r.buffer[4] == 48 || r.buffer[4] == 49) && r.buffer[5] == 126 {
*sz = 6
return Event{Invalid, 0, nil}
// Bracketed paste mode: \e[200~ ... \e[201~
if 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
return r.GetChar()
}
return Event{Invalid, 0, nil} // INS
case 51: