To: vim_dev@googlegroups.com Subject: Patch 8.1.0224 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.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) Files: src/edit.c *** ../vim-8.1.0223/src/edit.c 2018-07-08 16:50:33.103216858 +0200 --- src/edit.c 2018-07-28 23:11:32.282300523 +0200 *************** *** 9685,9706 **** 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; for (;;) { ! /* When the end is not defined read everything. */ if (end == NULL && vpeekc() == NUL) break; ! c = plain_vgetc(); #ifdef FEAT_MBYTE if (has_mbyte) idx += (*mb_char2bytes)(c, buf + idx); --- 9685,9715 ---- int ret_char = -1; int save_allow_keys = allow_keys; int save_paste = p_paste; /* 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; ! 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 there is. if (end == NULL && vpeekc() == NUL) break; ! 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,9770 **** --no_mapping; allow_keys = save_allow_keys; ! p_paste = save_paste; ! curbuf->b_p_ai = save_ai; return ret_char; } --- 9772,9779 ---- --no_mapping; allow_keys = save_allow_keys; ! if (!save_paste) ! set_option_value((char_u *)"paste", FALSE, NULL, 0); return ret_char; } *** ../vim-8.1.0223/src/version.c 2018-07-28 19:20:09.787586245 +0200 --- src/version.c 2018-07-28 23:08:55.583319931 +0200 *************** *** 800,801 **** --- 800,803 ---- { /* Add new patch number below this line */ + /**/ + 224, /**/ -- Computers are not intelligent. They only think they are. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///