summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-10-22 13:44:54 +0200
committerBram Moolenaar <Bram@vim.org>2020-10-22 13:44:54 +0200
commit371806e1642bbe17792f1e0fc7abe2ae13794635 (patch)
tree83c5331288d8659f55c4940dfb12f7814535880f
parent2733779a1a36c06f5f900666ac94bfe4c25ea39b (diff)
patch 8.2.1886: using ":silent!" in a popup filter has unexpected effectv8.2.1886
Problem: Using ":silent!" in a popup filter has unexpected effect. Solution: Use did_emsg instead of called_emsg. (closes #7178)
-rw-r--r--src/popupwin.c8
-rw-r--r--src/testdir/test_popupwin.vim1
-rw-r--r--src/version.c2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 2868a9da39..ed964568dc 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -3149,7 +3149,7 @@ invoke_popup_filter(win_T *wp, int c)
typval_T argv[3];
char_u buf[NUMBUFLEN];
linenr_T old_lnum = wp->w_cursor.lnum;
- int prev_called_emsg = called_emsg;
+ int prev_did_emsg = did_emsg;
// Emergency exit: CTRL-C closes the popup.
if (c == Ctrl_C)
@@ -3193,12 +3193,12 @@ invoke_popup_filter(win_T *wp, int c)
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 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) && called_emsg > prev_called_emsg)
+ if (win_valid_popup(wp) && did_emsg > prev_did_emsg)
{
wp->w_filter_errors += 10;
if (wp->w_filter_errors >= 30)
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 1524e78563..435873ec6a 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2158,6 +2158,7 @@ func Test_popup_scrollbar()
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
diff --git a/src/version.c b/src/version.c
index 0716ca1e91..0933697495 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1886,
+/**/
1885,
/**/
1884,