mirror of https://github.com/mpv-player/mpv
terminal-unix: ignore unhandled mouse CSI sequences
21d434d2db
attempted to ignore unknown
CSI sequences with a specific termination rule. This however does not
apply to mouse CSI sequences which can have characters out of that
range. Fix this by throwing away the whole sequence when an unhandled
mouse sequence is detected.
This commit is contained in:
parent
9ae58ba186
commit
cbc3fb104d
|
@ -240,6 +240,13 @@ static void process_input(struct input_ctx *input_ctx, bool timeout)
|
|||
int mods = 0;
|
||||
if (buf.b[0] == '\033') {
|
||||
if (buf.len > 1 && buf.b[1] == '[') {
|
||||
// Throw away unrecognized mouse CSI sequences.
|
||||
// Cannot be handled by the loop below since the bytes
|
||||
// afterwards can be out of that range.
|
||||
if (buf.len > 2 && buf.b[2] == 'M') {
|
||||
skip_buf(&buf, buf.len);
|
||||
continue;
|
||||
}
|
||||
// unknown CSI sequence. wait till it completes
|
||||
for (int i = 2; i < buf.len; i++) {
|
||||
if (buf.b[i] >= 0x40 && buf.b[i] <= 0x7E) {
|
||||
|
|
Loading…
Reference in New Issue