diff --git a/csi.c b/csi.c index fb1e886c..09d76d52 100644 --- a/csi.c +++ b/csi.c @@ -614,8 +614,7 @@ csi_dispatch(struct terminal *term, uint8_t final) break; case 1015: - LOG_WARN("unimplemented: URXVT mosue"); - /* term->mouse_reporting = MOUSE_URXVT; */ + term->mouse_reporting = MOUSE_URXVT; break; case 1049: diff --git a/terminal.c b/terminal.c index 118878e1..52eed5e8 100644 --- a/terminal.c +++ b/terminal.c @@ -426,28 +426,30 @@ static void report_mouse_click(struct terminal *term, int encoded_button, int row, int col, bool release) { + char response[128]; + switch (term->mouse_reporting) { - case MOUSE_NORMAL: { - char response[16]; + case MOUSE_NORMAL: snprintf(response, sizeof(response), "\033[M%c%c%c", 32 + (release ? 3 : encoded_button), 32 + col + 1, 32 + row + 1); - write(term->ptmx, response, strlen(response)); break; - } - case MOUSE_SGR: { - char response[128]; + case MOUSE_SGR: snprintf(response, sizeof(response), "\033[<%d;%d;%d%c", encoded_button, col + 1, row + 1, release ? 'm' : 'M'); - write(term->ptmx, response, strlen(response)); 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_URXVT: /* Unimplemented */ - break; + return; } + + write(term->ptmx, response, strlen(response)); } static void