Skip to content

Commit a42ad57

Browse files
committed
patch 8.0.1299: bracketed paste does not work well in terminal window
Problem: Bracketed paste does not work well in terminal window. Solution: Send translated string to job right away. (Ozaki Kiichi, closes #2341)
1 parent 58a8f17 commit a42ad57

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

src/terminal.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
* TODO:
4141
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
4242
* Higashi, 2017 Sep 19)
43-
* - double click in Window toolbar starts Visual mode (but not always?).
4443
* - Shift-Tab does not work.
4544
* - after resizing windows overlap. (Boris Staletic, #2164)
4645
* - Redirecting output does not work on MS-Windows, Test_terminal_redir_file()
@@ -732,7 +731,7 @@ term_convert_key(term_T *term, int c, char *buf)
732731
VTerm *vterm = term->tl_vterm;
733732
VTermKey key = VTERM_KEY_NONE;
734733
VTermModifier mod = VTERM_MOD_NONE;
735-
int mouse = FALSE;
734+
int other = FALSE;
736735

737736
switch (c)
738737
{
@@ -809,22 +808,22 @@ term_convert_key(term_T *term, int c, char *buf)
809808
key = VTERM_KEY_UP; break;
810809
case TAB: key = VTERM_KEY_TAB; break;
811810

812-
case K_MOUSEUP: mouse = term_send_mouse(vterm, 5, 1); break;
813-
case K_MOUSEDOWN: mouse = term_send_mouse(vterm, 4, 1); break;
811+
case K_MOUSEUP: other = term_send_mouse(vterm, 5, 1); break;
812+
case K_MOUSEDOWN: other = term_send_mouse(vterm, 4, 1); break;
814813
case K_MOUSELEFT: /* TODO */ return 0;
815814
case K_MOUSERIGHT: /* TODO */ return 0;
816815

817816
case K_LEFTMOUSE:
818-
case K_LEFTMOUSE_NM: mouse = term_send_mouse(vterm, 1, 1); break;
819-
case K_LEFTDRAG: mouse = term_send_mouse(vterm, 1, 1); break;
817+
case K_LEFTMOUSE_NM: other = term_send_mouse(vterm, 1, 1); break;
818+
case K_LEFTDRAG: other = term_send_mouse(vterm, 1, 1); break;
820819
case K_LEFTRELEASE:
821-
case K_LEFTRELEASE_NM: mouse = term_send_mouse(vterm, 1, 0); break;
822-
case K_MIDDLEMOUSE: mouse = term_send_mouse(vterm, 2, 1); break;
823-
case K_MIDDLEDRAG: mouse = term_send_mouse(vterm, 2, 1); break;
824-
case K_MIDDLERELEASE: mouse = term_send_mouse(vterm, 2, 0); break;
825-
case K_RIGHTMOUSE: mouse = term_send_mouse(vterm, 3, 1); break;
826-
case K_RIGHTDRAG: mouse = term_send_mouse(vterm, 3, 1); break;
827-
case K_RIGHTRELEASE: mouse = term_send_mouse(vterm, 3, 0); break;
820+
case K_LEFTRELEASE_NM: other = term_send_mouse(vterm, 1, 0); break;
821+
case K_MIDDLEMOUSE: other = term_send_mouse(vterm, 2, 1); break;
822+
case K_MIDDLEDRAG: other = term_send_mouse(vterm, 2, 1); break;
823+
case K_MIDDLERELEASE: other = term_send_mouse(vterm, 2, 0); break;
824+
case K_RIGHTMOUSE: other = term_send_mouse(vterm, 3, 1); break;
825+
case K_RIGHTDRAG: other = term_send_mouse(vterm, 3, 1); break;
826+
case K_RIGHTRELEASE: other = term_send_mouse(vterm, 3, 0); break;
828827
case K_X1MOUSE: /* TODO */ return 0;
829828
case K_X1DRAG: /* TODO */ return 0;
830829
case K_X1RELEASE: /* TODO */ return 0;
@@ -858,8 +857,12 @@ term_convert_key(term_T *term, int c, char *buf)
858857
#ifdef FEAT_AUTOCMD
859858
case K_CURSORHOLD: return 0;
860859
#endif
861-
case K_PS: vterm_keyboard_start_paste(vterm); return 0;
862-
case K_PE: vterm_keyboard_end_paste(vterm); return 0;
860+
case K_PS: vterm_keyboard_start_paste(vterm);
861+
other = TRUE;
862+
break;
863+
case K_PE: vterm_keyboard_end_paste(vterm);
864+
other = TRUE;
865+
break;
863866
}
864867

865868
/*
@@ -871,7 +874,7 @@ term_convert_key(term_T *term, int c, char *buf)
871874
if (key != VTERM_KEY_NONE)
872875
/* Special key, let vterm convert it. */
873876
vterm_keyboard_key(vterm, key, mod);
874-
else if (!mouse)
877+
else if (!other)
875878
/* Normal character, let vterm convert it. */
876879
vterm_keyboard_unichar(vterm, c, mod);
877880

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ static char *(features[]) =
766766

767767
static int included_patches[] =
768768
{ /* Add new patch number below this line */
769+
/**/
770+
1299,
769771
/**/
770772
1298,
771773
/**/

0 commit comments

Comments
 (0)