0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.1239: key with byte sequence containing CSI does not work

Problem:    Key with byte sequence containing CSI does not work.
Solution:   Do not recognize CSI as special unless the GUI is active. (Ken
            Takata, closes #4318)
This commit is contained in:
Bram Moolenaar
2019-04-29 21:58:41 +02:00
parent a0e67fc166
commit a9dd2d3c75
2 changed files with 19 additions and 13 deletions

View File

@@ -1604,7 +1604,7 @@ vgetc(void)
// Get two extra bytes for special keys // Get two extra bytes for special keys
if (c == K_SPECIAL if (c == K_SPECIAL
#ifdef FEAT_GUI #ifdef FEAT_GUI
|| c == CSI || (gui.in_use && c == CSI)
#endif #endif
) )
{ {
@@ -1659,19 +1659,23 @@ vgetc(void)
} }
#endif #endif
#ifdef FEAT_GUI #ifdef FEAT_GUI
// Handle focus event here, so that the caller doesn't need to if (gui.in_use)
// know about it. Return K_IGNORE so that we loop once (needed {
// if 'lazyredraw' is set). // Handle focus event here, so that the caller doesn't
// need to know about it. Return K_IGNORE so that we loop
// once (needed if 'lazyredraw' is set).
if (c == K_FOCUSGAINED || c == K_FOCUSLOST) if (c == K_FOCUSGAINED || c == K_FOCUSLOST)
{ {
ui_focus_change(c == K_FOCUSGAINED); ui_focus_change(c == K_FOCUSGAINED);
c = K_IGNORE; c = K_IGNORE;
} }
// Translate K_CSI to CSI. The special key is only used to // Translate K_CSI to CSI. The special key is only used
// avoid it being recognized as the start of a special key. // to avoid it being recognized as the start of a special
// key.
if (c == K_CSI) if (c == K_CSI)
c = CSI; c = CSI;
}
#endif #endif
} }
// a keypad or special function key was not mapped, use it like // a keypad or special function key was not mapped, use it like
@@ -1749,7 +1753,7 @@ vgetc(void)
buf[i] = vgetorpeek(TRUE); buf[i] = vgetorpeek(TRUE);
if (buf[i] == K_SPECIAL if (buf[i] == K_SPECIAL
#ifdef FEAT_GUI #ifdef FEAT_GUI
|| buf[i] == CSI || (gui.in_use && buf[i] == CSI)
#endif #endif
) )
{ {

View File

@@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1239,
/**/ /**/
1238, 1238,
/**/ /**/