mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
csi: implement URXVT style mouse event reporting
This commit is contained in:
parent
450f6c7dcc
commit
c76e620d71
2 changed files with 13 additions and 12 deletions
3
csi.c
3
csi.c
|
|
@ -614,8 +614,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1015:
|
case 1015:
|
||||||
LOG_WARN("unimplemented: URXVT mosue");
|
term->mouse_reporting = MOUSE_URXVT;
|
||||||
/* term->mouse_reporting = MOUSE_URXVT; */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1049:
|
case 1049:
|
||||||
|
|
|
||||||
22
terminal.c
22
terminal.c
|
|
@ -426,28 +426,30 @@ static void
|
||||||
report_mouse_click(struct terminal *term, int encoded_button, int row, int col,
|
report_mouse_click(struct terminal *term, int encoded_button, int row, int col,
|
||||||
bool release)
|
bool release)
|
||||||
{
|
{
|
||||||
|
char response[128];
|
||||||
|
|
||||||
switch (term->mouse_reporting) {
|
switch (term->mouse_reporting) {
|
||||||
case MOUSE_NORMAL: {
|
case MOUSE_NORMAL:
|
||||||
char response[16];
|
|
||||||
snprintf(response, sizeof(response), "\033[M%c%c%c",
|
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), 32 + col + 1, 32 + row + 1);
|
||||||
write(term->ptmx, response, strlen(response));
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case MOUSE_SGR: {
|
case MOUSE_SGR:
|
||||||
char response[128];
|
|
||||||
snprintf(response, sizeof(response), "\033[<%d;%d;%d%c",
|
snprintf(response, sizeof(response), "\033[<%d;%d;%d%c",
|
||||||
encoded_button, col + 1, row + 1, release ? 'm' : 'M');
|
encoded_button, col + 1, row + 1, release ? 'm' : 'M');
|
||||||
write(term->ptmx, response, strlen(response));
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
case MOUSE_URXVT:
|
||||||
|
snprintf(response, sizeof(response), "\033[%d;%d;%dM",
|
||||||
|
32 + (release ? 3 : encoded_button), col + 1, row + 1);
|
||||||
|
break;
|
||||||
|
|
||||||
case MOUSE_UTF8:
|
case MOUSE_UTF8:
|
||||||
case MOUSE_URXVT:
|
|
||||||
/* Unimplemented */
|
/* Unimplemented */
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write(term->ptmx, response, strlen(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue