Patch 8.2.1886

6 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 22, 2020, 7:45:45 AM10/22/20
to vim...@googlegroups.com

Patch 8.2.1886
Problem: Using ":silent!" in a popup filter has unexpected effect.
Solution: Use did_emsg instead of called_emsg. (closes #7178)
Files: src/popupwin.c, src/testdir/test_popupwin.vim


*** ../vim-8.2.1885/src/popupwin.c 2020-10-17 19:29:47.522935804 +0200
--- src/popupwin.c 2020-10-22 13:43:03.330797108 +0200
***************
*** 3149,3155 ****
typval_T argv[3];
char_u buf[NUMBUFLEN];
linenr_T old_lnum = wp->w_cursor.lnum;
! int prev_called_emsg = called_emsg;

// Emergency exit: CTRL-C closes the popup.
if (c == Ctrl_C)
--- 3149,3155 ----
typval_T argv[3];
char_u buf[NUMBUFLEN];
linenr_T old_lnum = wp->w_cursor.lnum;
! int prev_did_emsg = did_emsg;

// Emergency exit: CTRL-C closes the popup.
if (c == Ctrl_C)
***************
*** 3193,3204 ****
if (win_valid_popup(wp) && old_lnum != wp->w_cursor.lnum)
popup_highlight_curline(wp);

! // If an error was given always return FALSE, so that keys are not
! // consumed and the user can type something.
// If we get three errors in a row then close the popup. Decrement the
// error count by 1/10 if there are no errors, thus allowing up to 1 in
// 10 calls to cause an error.
! if (win_valid_popup(wp) && called_emsg > prev_called_emsg)
{
wp->w_filter_errors += 10;
if (wp->w_filter_errors >= 30)
--- 3193,3204 ----
if (win_valid_popup(wp) && old_lnum != wp->w_cursor.lnum)
popup_highlight_curline(wp);

! // If an error message was given always return FALSE, so that keys are
! // not consumed and the user can type something.
// If we get three errors in a row then close the popup. Decrement the
// error count by 1/10 if there are no errors, thus allowing up to 1 in
// 10 calls to cause an error.
! if (win_valid_popup(wp) && did_emsg > prev_did_emsg)
{
wp->w_filter_errors += 10;
if (wp->w_filter_errors >= 30)
*** ../vim-8.2.1885/src/testdir/test_popupwin.vim 2020-10-15 19:10:53.203606791 +0200
--- src/testdir/test_popupwin.vim 2020-10-22 13:42:36.166870381 +0200
***************
*** 2158,2163 ****
--- 2158,2164 ----
endfunc
func Popup_filter(winid, key)
if a:key == 'j'
+ silent! this_throws_an_error_but_is_ignored
let line = popup_getoptions(a:winid).firstline
let nlines = line('$', a:winid)
let newline = line < nlines ? (line + 1) : nlines
*** ../vim-8.2.1885/src/version.c 2020-10-22 12:33:29.016790371 +0200
--- src/version.c 2020-10-22 13:44:19.554591482 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1886,
/**/

--
hundred-and-one symptoms of being an internet addict:
107. When using your phone you forget that you don't have to use your
keyboard.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages