summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-07-28 23:12:05 +0200
committerBram Moolenaar <Bram@vim.org>2018-07-28 23:12:05 +0200
commitfdd7155fab3447b38280035c66178330f8f041e7 (patch)
tree7ecc4f84e7f5ef2b63ad2d22a2994f3e72c110be /src
parent6ab9e429da18f4d784222a9f7dfafb7c0218b7eb (diff)
patch 8.1.0224: hang in bracketed paste mode when t_PE not encounteredv8.1.0224
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)
Diffstat (limited to 'src')
-rw-r--r--src/edit.c23
-rw-r--r--src/version.c2
2 files changed, 18 insertions, 7 deletions
diff --git a/src/edit.c b/src/edit.c
index 657bd2c864..e121506239 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -9685,22 +9685,31 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
int ret_char = -1;
int save_allow_keys = allow_keys;
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 (STRLEN(end) >= NUMBUFLEN)
end = NULL;
++no_mapping;
allow_keys = 0;
- p_paste = TRUE;
- curbuf->b_p_ai = FALSE;
+ if (!p_paste)
+ // Also have the side effects of setting 'paste' to make it work much
+ // faster.
+ set_option_value((char_u *)"paste", TRUE, NULL, 0);
for (;;)
{
- /* When the end is not defined read everything. */
+ // When the end is not defined read everything there is.
if (end == NULL && vpeekc() == NUL)
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
if (has_mbyte)
idx += (*mb_char2bytes)(c, buf + idx);
@@ -9763,8 +9772,8 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
--no_mapping;
allow_keys = save_allow_keys;
- p_paste = save_paste;
- curbuf->b_p_ai = save_ai;
+ if (!save_paste)
+ set_option_value((char_u *)"paste", FALSE, NULL, 0);
return ret_char;
}
diff --git a/src/version.c b/src/version.c
index e646a2b432..ab58a5c179 100644
--- a/src/version.c
+++ b/src/version.c
@@ -799,6 +799,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 224,
+/**/
223,
/**/
222,