term: report_mouse_click(): legacy mode only supports rows/cols up to 223.

In the legacy mouse reporting mode, line and column numbers are
limited to 223 (255-32). In case the current coordinate falls outside
this, simply ignore it (don't report it).
This commit is contained in:
Daniel Eklöf 2019-11-18 11:31:21 +01:00
parent 2d0c4928ee
commit 7ff5a8027a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -1268,10 +1268,16 @@ report_mouse_click(struct terminal *term, int encoded_button, int row, int col,
char response[128];
switch (term->mouse_reporting) {
case MOUSE_NORMAL:
case MOUSE_NORMAL: {
int encoded_col = 32 + col + 1;
int encoded_row = 32 + row + 1;
if (encoded_col > 255 || encoded_row > 255)
return;
snprintf(response, sizeof(response), "\033[M%c%c%c",
32 + (release ? 3 : encoded_button), 32 + col + 1, 32 + row + 1);
32 + (release ? 3 : encoded_button), encoded_col, encoded_row);
break;
}
case MOUSE_SGR:
snprintf(response, sizeof(response), "\033[<%d;%d;%d%c",