mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
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:
parent
2d0c4928ee
commit
7ff5a8027a
1 changed files with 8 additions and 2 deletions
10
terminal.c
10
terminal.c
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue