From 93a25e612357a867e902114ee3842a638ced303f Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Mon, 4 Mar 2019 23:19:41 +0100 Subject: [PATCH] termiointernals: report alt on mouse move + tests --- src/bin/termiointernals.c | 15 +++++++++------ tests/tests.results | 8 ++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/bin/termiointernals.c b/src/bin/termiointernals.c index 8a8b581c..93fb7220 100644 --- a/src/bin/termiointernals.c +++ b/src/bin/termiointernals.c @@ -1744,11 +1744,12 @@ _rep_mouse_up(Termio *sd, Evas_Event_Mouse_Up *ev, } static Eina_Bool -_rep_mouse_move(Termio *sd, int cx, int cy) +_rep_mouse_move(Termio *sd, int cx, int cy, Termio_Modifiers modifiers) { char buf[64]; Eina_Bool ret = EINA_FALSE; int btn; + int meta = 0; if ((sd->pty->mouse_mode == MOUSE_OFF) || (sd->pty->mouse_mode == MOUSE_X10) || @@ -1757,6 +1758,8 @@ _rep_mouse_move(Termio *sd, int cx, int cy) if ((!sd->mouse.button) && (sd->pty->mouse_mode == MOUSE_NORMAL_BTN_MOVE)) return EINA_FALSE; + if (modifiers.alt) + meta = 8; btn = sd->mouse.button - 1; @@ -1767,7 +1770,7 @@ _rep_mouse_move(Termio *sd, int cx, int cy) buf[0] = 0x1b; buf[1] = '['; buf[2] = 'M'; - buf[3] = btn + 32 + ' '; + buf[3] = btn + meta + 32 + ' '; buf[4] = (cx > 94) ? ' ' : cx + 1 + ' '; buf[5] = (cy > 94) ? ' ' : cy + 1 + ' '; buf[6] = 0; @@ -1782,7 +1785,7 @@ _rep_mouse_move(Termio *sd, int cx, int cy) buf[0] = 0x1b; buf[1] = '['; buf[2] = 'M'; - buf[3] = btn + 32 + ' '; + buf[3] = btn + meta + 32 + ' '; i = 4; v = cx + 1 + ' '; if (v <= 127) buf[i++] = v; @@ -1806,7 +1809,7 @@ _rep_mouse_move(Termio *sd, int cx, int cy) case MOUSE_EXT_SGR: // ESC.[.<.NUM.;.NUM.;.NUM.M { snprintf(buf, sizeof(buf), "%c[<%i;%i;%iM", 0x1b, - btn + 32, cx + 1, cy + 1); + btn + meta + 32, cx + 1, cy + 1); termpty_write(sd->pty, buf, strlen(buf)); ret = EINA_TRUE; } @@ -1814,7 +1817,7 @@ _rep_mouse_move(Termio *sd, int cx, int cy) case MOUSE_EXT_URXVT: // ESC.[.NUM.;.NUM.;.NUM.M { snprintf(buf, sizeof(buf), "%c[%i;%i;%iM", 0x1b, - btn + 32 + ' ', + btn + meta + 32 + ' ', cx + 1, cy + 1); termpty_write(sd->pty, buf, strlen(buf)); ret = EINA_TRUE; @@ -2028,7 +2031,7 @@ termio_internal_mouse_move(Termio *sd, sd->mouse.cy = cy; if (!modifiers.shift && !modifiers.ctrl) { - if (_rep_mouse_move(sd, cx, cy)) + if (_rep_mouse_move(sd, cx, cy, modifiers)) { /* Mouse move already been taken care of */ return; diff --git a/tests/tests.results b/tests/tests.results index 952f8795..f44aab2e 100644 --- a/tests/tests.results +++ b/tests/tests.results @@ -104,11 +104,11 @@ selection_invalidation_line_removed.sh 8d689636f976b044dfbf6af6b3333093 resize_window_no_content_change.sh 28d45fe49c686c8c98631cce8e4bd368 mouse_reporting_mode_x10_ext_none.sh b56ef7d0e2cc236e31ff2e149528833b mouse_reporting_mode_normal_ext_none.sh f93ea2ac6acb8d36cac9e37e06ed9bd8 -mouse_reporting_mode_mouse_move_pressed_ext_none.sh f733c0b36c0086719e85ec1d998d0762 -mouse_reporting_mode_all_ext_none.sh b48a73bf07c6438510f709e87faa4dc0 +mouse_reporting_mode_mouse_move_pressed_ext_none.sh 517ee04a059dfd9400fdcd633a7a5d5c +mouse_reporting_mode_all_ext_none.sh 3f0e5432b989c044687627e1ee134571 mouse_reporting_mode_x10_ext_utf8.sh c503d835cde7b0d147ae7a61e1b44fd1 mouse_reporting_mode_normal_ext_utf8.sh 2f615fa516bbf2ad4233f522a0f007d9 -mouse_reporting_mode_mouse_move_pressed_ext_utf8.sh 5b463446271bcbf765f4620e74a11806 -mouse_reporting_mode_all_ext_utf8.sh 006c317e1efd1c5abd0e4ee1830470f5 +mouse_reporting_mode_mouse_move_pressed_ext_utf8.sh dd7265c391b830e5efa2496bfd7f6d36 +mouse_reporting_mode_all_ext_utf8.sh 21fd1fe0a68f7695d0a6b3c519131808 mouse_reporting_mode_x10_ext_sgr.sh 82517b141a920771f5324bb1648c4cd2 mouse_reporting_mode_normal_ext_sgr.sh 6599bde2c0edfc462c85762fd9d7ce34