History

terminal-unix: ignore unhandled mouse CSI sequences

21d434d2dbadf91d7bd2089ca1ca92c2d918b114 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.

nanahi committed 2 years ago

Commit cbc3fb11 parent 9ae58ba1 file · +7 −0Browse files

Unified · Split

osdep/terminal-unix.c+7−0
@@ -240,6 +240,13 @@ static void process_input(struct input_ctx *input_ctx, bool timeout) · 239 unmodified lines
240 int mods = 0;240 int mods = 0;
241 if (buf.b[0] == '\033') {241 if (buf.b[0] == '\033') {
242 if (buf.len > 1 && buf.b[1] == '[') {242 if (buf.len > 1 && buf.b[1] == '[') {
243 // Throw away unrecognized mouse CSI sequences.
244 // Cannot be handled by the loop below since the bytes
245 // afterwards can be out of that range.
246 if (buf.len > 2 && buf.b[2] == 'M') {
247 skip_buf(&buf, buf.len);
248 continue;
249 }
243 // unknown CSI sequence. wait till it completes250 // unknown CSI sequence. wait till it completes
244 for (int i = 2; i < buf.len; i++) {251 for (int i = 2; i < buf.len; i++) {
245 if (buf.b[i] >= 0x40 && buf.b[i] <= 0x7E) {252 if (buf.b[i] >= 0x40 && buf.b[i] <= 0x7E) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t