mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 9.0.0575: the getchar() function behaves strangely with bracketed paste
Problem: The getchar() function behaves strangely with bracketed paste. Solution: Do not handle paste-start in getchar(). (issue #11172)
This commit is contained in:
@@ -1720,6 +1720,8 @@ vgetc(void)
|
|||||||
{
|
{
|
||||||
int did_inc = FALSE;
|
int did_inc = FALSE;
|
||||||
|
|
||||||
|
// No mapping after modifier has been read, using an input method
|
||||||
|
// and when a popup window has disabled mapping.
|
||||||
if (mod_mask
|
if (mod_mask
|
||||||
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
||||||
|| im_is_preediting()
|
|| im_is_preediting()
|
||||||
@@ -1729,10 +1731,10 @@ vgetc(void)
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// no mapping after modifier has been read
|
|
||||||
++no_mapping;
|
++no_mapping;
|
||||||
++allow_keys;
|
++allow_keys;
|
||||||
did_inc = TRUE; // mod_mask may change value
|
// mod_mask value may change, remember we did the increment
|
||||||
|
did_inc = TRUE;
|
||||||
}
|
}
|
||||||
c = vgetorpeek(TRUE);
|
c = vgetorpeek(TRUE);
|
||||||
if (did_inc)
|
if (did_inc)
|
||||||
@@ -1988,9 +1990,10 @@ safe_vgetc(void)
|
|||||||
/*
|
/*
|
||||||
* Like safe_vgetc(), but loop to handle K_IGNORE.
|
* Like safe_vgetc(), but loop to handle K_IGNORE.
|
||||||
* Also ignore scrollbar events.
|
* Also ignore scrollbar events.
|
||||||
|
* Does not handle bracketed paste - do not use the result for commands.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
plain_vgetc(void)
|
plain_vgetc_nopaste(void)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@@ -1999,6 +2002,17 @@ plain_vgetc(void)
|
|||||||
while (c == K_IGNORE
|
while (c == K_IGNORE
|
||||||
|| c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR
|
|| c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR
|
||||||
|| c == K_MOUSEMOVE);
|
|| c == K_MOUSEMOVE);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Like safe_vgetc(), but loop to handle K_IGNORE.
|
||||||
|
* Also ignore scrollbar events.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
plain_vgetc(void)
|
||||||
|
{
|
||||||
|
int c = plain_vgetc_nopaste();
|
||||||
|
|
||||||
if (c == K_PS)
|
if (c == K_PS)
|
||||||
// Only handle the first pasted character. Drop the rest, since we
|
// Only handle the first pasted character. Drop the rest, since we
|
||||||
@@ -2107,7 +2121,7 @@ getchar_common(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
if (argvars[0].v_type == VAR_UNKNOWN)
|
if (argvars[0].v_type == VAR_UNKNOWN)
|
||||||
// getchar(): blocking wait.
|
// getchar(): blocking wait.
|
||||||
n = plain_vgetc();
|
n = plain_vgetc_nopaste();
|
||||||
else if (tv_get_bool_chk(&argvars[0], &error))
|
else if (tv_get_bool_chk(&argvars[0], &error))
|
||||||
// getchar(1): only check if char avail
|
// getchar(1): only check if char avail
|
||||||
n = vpeekc_any();
|
n = vpeekc_any();
|
||||||
|
@@ -699,6 +699,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 */
|
||||||
|
/**/
|
||||||
|
575,
|
||||||
/**/
|
/**/
|
||||||
574,
|
574,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user