Skip to content

Commit 6f8f733

Browse files
committed
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Problem: Closing a popup window with CTRL-C interrupts 'statusline' if it calls a function. Solution: Reset got_int while redrawing. (closes #6675)
1 parent bf61fdd commit 6f8f733

4 files changed

Lines changed: 44 additions & 0 deletions

File tree

src/popupwin.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3209,7 +3209,14 @@ popup_do_filter(int c)
32093209
res = invoke_popup_filter(wp, c);
32103210

32113211
if (must_redraw > was_must_redraw)
3212+
{
3213+
int save_got_int = got_int;
3214+
3215+
// Reset got_int to avoid a function used in the statusline aborts.
3216+
got_int = FALSE;
32123217
redraw_after_callback(FALSE);
3218+
got_int |= save_got_int;
3219+
}
32133220
recursive = FALSE;
32143221
KeyTyped = save_KeyTyped;
32153222
return res;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
> +0&#ffffff0@36||+1&&| +0&&@36
2+
|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35
3+
|~| @35||+1#0000000&|~+0#4040ff13&| @35
4+
|~| @35||+1#0000000&|~+0#4040ff13&| @35
5+
|~| @35||+1#0000000&|~+0#4040ff13&| @35
6+
|~| @35||+1#0000000&|~+0#4040ff13&| @35
7+
|~| @35||+1#0000000&|~+0#4040ff13&| @35
8+
|~| @35||+1#0000000&|~+0#4040ff13&| @35
9+
|[+3#0000000&|N|o| |N|a|m|e|]| @9|0|,|0|-|1| @9|A|l@1| |[+1&&|N|o| |N|a|m|e|]| @9|0|,|0|-|1| @9|A|l@1
10+
| +0&&@74

src/testdir/test_popupwin.vim

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3479,6 +3479,31 @@ func Test_popupwin_filter_input_multibyte()
34793479
unlet g:bytes
34803480
endfunc
34813481

3482+
func Test_popupwin_filter_close_ctrl_c()
3483+
CheckScreendump
3484+
3485+
let lines =<< trim END
3486+
vsplit
3487+
set laststatus=2
3488+
set statusline=%!Statusline()
3489+
3490+
function Statusline() abort
3491+
return '%<%f %h%m%r%=%-14.(%l,%c%V%) %P'
3492+
endfunction
3493+
3494+
call popup_create('test test test test...', {'filter': {-> 0}})
3495+
END
3496+
call writefile(lines, 'XtestPopupCtrlC')
3497+
3498+
let buf = RunVimInTerminal('-S XtestPopupCtrlC', #{rows: 10})
3499+
3500+
call term_sendkeys(buf, "\<C-C>")
3501+
call VerifyScreenDump(buf, 'Test_popupwin_ctrl_c', {})
3502+
3503+
call StopVimInTerminal(buf)
3504+
call delete('XtestPopupCorners')
3505+
endfunc
3506+
34823507
func Test_popupwin_atcursor_far_right()
34833508
new
34843509

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1415,
757759
/**/
758760
1414,
759761
/**/

0 commit comments

Comments
 (0)