mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
patch 8.1.0224: hang in bracketed paste mode when t_PE not encountered
Problem: Hang in bracketed paste mode when t_PE not encountered. Solution: Break out of the loop when got_int is set. (suggested by Christian Brabandt, closes #3146)
This commit is contained in:
23
src/edit.c
23
src/edit.c
@@ -9685,22 +9685,31 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
|
|||||||
int ret_char = -1;
|
int ret_char = -1;
|
||||||
int save_allow_keys = allow_keys;
|
int save_allow_keys = allow_keys;
|
||||||
int save_paste = p_paste;
|
int save_paste = p_paste;
|
||||||
int save_ai = curbuf->b_p_ai;
|
|
||||||
|
|
||||||
/* If the end code is too long we can't detect it, read everything. */
|
/* If the end code is too long we can't detect it, read everything. */
|
||||||
if (STRLEN(end) >= NUMBUFLEN)
|
if (STRLEN(end) >= NUMBUFLEN)
|
||||||
end = NULL;
|
end = NULL;
|
||||||
++no_mapping;
|
++no_mapping;
|
||||||
allow_keys = 0;
|
allow_keys = 0;
|
||||||
p_paste = TRUE;
|
if (!p_paste)
|
||||||
curbuf->b_p_ai = FALSE;
|
// Also have the side effects of setting 'paste' to make it work much
|
||||||
|
// faster.
|
||||||
|
set_option_value((char_u *)"paste", TRUE, NULL, 0);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* When the end is not defined read everything. */
|
// When the end is not defined read everything there is.
|
||||||
if (end == NULL && vpeekc() == NUL)
|
if (end == NULL && vpeekc() == NUL)
|
||||||
break;
|
break;
|
||||||
c = plain_vgetc();
|
do
|
||||||
|
{
|
||||||
|
c = vgetc();
|
||||||
|
} while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR);
|
||||||
|
if (c == NUL || got_int)
|
||||||
|
// When CTRL-C was encountered the typeahead will be flushed and we
|
||||||
|
// won't get the end sequence.
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
idx += (*mb_char2bytes)(c, buf + idx);
|
idx += (*mb_char2bytes)(c, buf + idx);
|
||||||
@@ -9763,8 +9772,8 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
|
|||||||
|
|
||||||
--no_mapping;
|
--no_mapping;
|
||||||
allow_keys = save_allow_keys;
|
allow_keys = save_allow_keys;
|
||||||
p_paste = save_paste;
|
if (!save_paste)
|
||||||
curbuf->b_p_ai = save_ai;
|
set_option_value((char_u *)"paste", FALSE, NULL, 0);
|
||||||
|
|
||||||
return ret_char;
|
return ret_char;
|
||||||
}
|
}
|
||||||
|
@@ -798,6 +798,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 */
|
||||||
|
/**/
|
||||||
|
224,
|
||||||
/**/
|
/**/
|
||||||
223,
|
223,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user