@@ -3155,31 +3155,33 @@ invoke_popup_filter(win_T *wp, int c)
31553155 if (call_callback (& wp -> w_filter_cb , -1 , & rettv , 2 , argv ) == FAIL )
31563156 {
31573157 // Cannot call the function, close the popup to avoid that the filter
3158- // eats keys and the user can't get out .
3158+ // eats keys and the user is stuck. Might as well eat the key .
31593159 popup_close_with_retval (wp , -1 );
3160- return 1 ;
3161- }
3162-
3163- if (win_valid_popup (wp ) && old_lnum != wp -> w_cursor .lnum )
3164- popup_highlight_curline (wp );
3165-
3166- // If an error was given always return FALSE, so that keys are not
3167- // consumed and the user can type something.
3168- // If we get three errors in a row then close the popup. Decrement the
3169- // error count by 1/10 if there are no errors, thus allowing up to 1 in
3170- // 10 calls to cause an error.
3171- if (win_valid_popup (wp ) && called_emsg > prev_called_emsg )
3172- {
3173- wp -> w_filter_errors += 10 ;
3174- if (wp -> w_filter_errors >= 30 )
3175- popup_close_with_retval (wp , -1 );
3176- res = FALSE;
3160+ res = TRUE;
31773161 }
31783162 else
31793163 {
3180- if (win_valid_popup (wp ) && wp -> w_filter_errors > 0 )
3181- -- wp -> w_filter_errors ;
3182- res = tv_get_bool (& rettv );
3164+ if (win_valid_popup (wp ) && old_lnum != wp -> w_cursor .lnum )
3165+ popup_highlight_curline (wp );
3166+
3167+ // If an error was given always return FALSE, so that keys are not
3168+ // consumed and the user can type something.
3169+ // If we get three errors in a row then close the popup. Decrement the
3170+ // error count by 1/10 if there are no errors, thus allowing up to 1 in
3171+ // 10 calls to cause an error.
3172+ if (win_valid_popup (wp ) && called_emsg > prev_called_emsg )
3173+ {
3174+ wp -> w_filter_errors += 10 ;
3175+ if (wp -> w_filter_errors >= 30 )
3176+ popup_close_with_retval (wp , -1 );
3177+ res = FALSE;
3178+ }
3179+ else
3180+ {
3181+ if (win_valid_popup (wp ) && wp -> w_filter_errors > 0 )
3182+ -- wp -> w_filter_errors ;
3183+ res = tv_get_bool (& rettv );
3184+ }
31833185 }
31843186
31853187 vim_free (argv [1 ].vval .v_string );
0 commit comments