diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-11-18 10:31:21 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-11-18 10:31:21 +0000 |
| commit | 7ff5a8027a9f5b520132f5c85d3d22cb9c1db084 (patch) | |
| tree | 0cb7e5b608e1fcc4f78afe101387874262728bbf | |
| parent | csi: add debug logs for the various mouse reporting modes (diff) | |
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).
| -rw-r--r-- | terminal.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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", |
