termiointernals: handle mouse wheel with alt + tests

terminology-1.4
Boris Faure 4 years ago
parent 42c9cb1842
commit 61a56ae029
  1. 10
      src/bin/termiointernals.c
  2. 6
      tests/mouse_reporting_mode_all_ext_none.sh
  3. 4
      tests/mouse_reporting_mode_all_ext_utf8.sh
  4. 4
      tests/mouse_reporting_mode_mouse_move_pressed_ext_none.sh
  5. 4
      tests/mouse_reporting_mode_mouse_move_pressed_ext_utf8.sh
  6. 4
      tests/mouse_reporting_mode_normal_ext_none.sh
  7. 4
      tests/mouse_reporting_mode_normal_ext_utf8.sh
  8. 4
      tests/mouse_reporting_mode_x10_ext_none.sh
  9. 4
      tests/mouse_reporting_mode_x10_ext_utf8.sh
  10. 12
      tests/tests.results

@ -2127,10 +2127,12 @@ termio_internal_mouse_wheel(Termio *sd,
else
{
int cx = 0, cy = 0;
int meta;
termio_cursor_to_xy(sd, ev->canvas.x, ev->canvas.y, &cx, &cy);
if (sd->pty->mouse_mode == MOUSE_X10)
return;
meta = (modifiers.alt) ? 8 : 0;
switch (sd->pty->mouse_ext)
{
@ -2142,7 +2144,7 @@ termio_internal_mouse_wheel(Termio *sd,
buf[0] = 0x1b;
buf[1] = '[';
buf[2] = 'M';
buf[3] = btn + ' ';
buf[3] = (btn | meta) + ' ';
buf[4] = (cx > 94) ? ' ' : cx + 1 + ' ';
buf[5] = (cy > 94) ? ' ' : cy + 1 + ' ';
buf[6] = 0;
@ -2157,7 +2159,7 @@ termio_internal_mouse_wheel(Termio *sd,
buf[0] = 0x1b;
buf[1] = '[';
buf[2] = 'M';
buf[3] = btn;
buf[3] = btn | meta;
i = 4;
v = cx + 1 + ' ';
if (v <= 127) buf[i++] = v;
@ -2181,7 +2183,7 @@ termio_internal_mouse_wheel(Termio *sd,
{
int btn = (ev->z >= 0) ? 1 + 64 : 64;
snprintf(buf, sizeof(buf), "%c[<%i;%i;%iM", 0x1b,
btn, cx + 1, cy + 1);
btn | meta, cx + 1, cy + 1);
termpty_write(sd->pty, buf, strlen(buf));
}
break;
@ -2189,7 +2191,7 @@ termio_internal_mouse_wheel(Termio *sd,
{
int btn = (ev->z >= 0) ? 1 + 64 : 64;
snprintf(buf, sizeof(buf), "%c[%i;%i;%iM", 0x1b,
btn + ' ',
(btn | meta) + ' ',
cx + 1, cy + 1);
termpty_write(sd->pty, buf, strlen(buf));
}

@ -179,12 +179,14 @@ printf '\033}tr\0'
sleep 0.2
## WHEEL
# prints ^[[M`=)^[[M+e)
# prints ^[[M`=)^[[Ma=)^[[M`e)^[[Mae)
# move cursor
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tu;480;130;0;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
sleep 0.2

@ -184,7 +184,9 @@ sleep 0.2
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tu;480;130;0;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
sleep 0.2

@ -184,7 +184,9 @@ sleep 0.2
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tu;480;130;0;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
sleep 0.2

@ -184,7 +184,9 @@ sleep 0.2
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tu;480;130;0;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
sleep 0.2

@ -158,7 +158,9 @@ sleep 0.2
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tu;480;130;0;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
sleep 0.2

@ -171,7 +171,9 @@ sleep 0.2
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tu;480;130;0;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
sleep 0.2

@ -156,7 +156,9 @@ sleep 0.2
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tu;480;130;0;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
sleep 0.2

@ -157,7 +157,9 @@ sleep 0.2
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tu;480;130;0;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
sleep 0.2

@ -103,11 +103,11 @@ selection_box_to_paragraph.sh 7b918d2af64eef1ecb39a0f45cf72f2d
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 56cb28ca5427a0b0a97642ccdba5464d
mouse_reporting_mode_mouse_move_pressed_ext_none.sh a7e5706a2225653e5d0764d68ef01c0b
mouse_reporting_mode_all_ext_none.sh 69de2da01fe8332fb024b036509fff14
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_x10_ext_utf8.sh c503d835cde7b0d147ae7a61e1b44fd1
mouse_reporting_mode_normal_ext_utf8.sh 7acfea21b2fd997436d4fbee7610a9f9
mouse_reporting_mode_mouse_move_pressed_ext_utf8.sh e5169c67f10ccc035089bf49ba9e1fa2
mouse_reporting_mode_all_ext_utf8.sh 2d828e122ff45b29fa99094208164f27
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_x10_ext_sgr.sh 82517b141a920771f5324bb1648c4cd2

Loading…
Cancel
Save