]> granicus.if.org Git - vim/commitdiff
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline' v8.2.1415
authorBram Moolenaar <Bram@vim.org>
Mon, 10 Aug 2020 19:19:23 +0000 (21:19 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 10 Aug 2020 19:19:23 +0000 (21:19 +0200)
Problem:    Closing a popup window with CTRL-C interrupts 'statusline' if it
            calls a function.
Solution:   Reset got_int while redrawing. (closes #6675)

src/popupwin.c
src/testdir/dumps/Test_popupwin_ctrl_c.dump [new file with mode: 0644]
src/testdir/test_popupwin.vim
src/version.c

index cc0843bfc2c638a4bc751485701739f3ebdf4f5a..ff9e810044555c4e906e8d6320e361c6694151f4 100644 (file)
@@ -3209,7 +3209,14 @@ popup_do_filter(int c)
            res = invoke_popup_filter(wp, c);
 
     if (must_redraw > was_must_redraw)
+    {
+       int save_got_int = got_int;
+
+       // Reset got_int to avoid a function used in the statusline aborts.
+       got_int = FALSE;
        redraw_after_callback(FALSE);
+       got_int |= save_got_int;
+    }
     recursive = FALSE;
     KeyTyped = save_KeyTyped;
     return res;
diff --git a/src/testdir/dumps/Test_popupwin_ctrl_c.dump b/src/testdir/dumps/Test_popupwin_ctrl_c.dump
new file mode 100644 (file)
index 0000000..d6636ae
--- /dev/null
@@ -0,0 +1,10 @@
+> +0&#ffffff0@36||+1&&| +0&&@36
+|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|[+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
+| +0&&@74
index f13a7e057c13ed4e1565de763cdccfbfcb3f9eab..6ec4ef252967f88c90e6a3ff59a839c054565396 100644 (file)
@@ -3479,6 +3479,31 @@ func Test_popupwin_filter_input_multibyte()
   unlet g:bytes
 endfunc
 
+func Test_popupwin_filter_close_ctrl_c()
+  CheckScreendump
+
+  let lines =<< trim END
+      vsplit
+      set laststatus=2
+      set statusline=%!Statusline()
+
+      function Statusline() abort
+         return '%<%f %h%m%r%=%-14.(%l,%c%V%) %P'
+      endfunction
+
+      call popup_create('test test test test...', {'filter': {-> 0}})
+  END
+  call writefile(lines, 'XtestPopupCtrlC')
+
+  let buf = RunVimInTerminal('-S XtestPopupCtrlC', #{rows: 10})
+
+  call term_sendkeys(buf, "\<C-C>")
+  call VerifyScreenDump(buf, 'Test_popupwin_ctrl_c', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XtestPopupCorners')
+endfunc
+
 func Test_popupwin_atcursor_far_right()
   new
 
index 38dc86fa477e9188bc1df31754544d694df69ef9..e7a10397147bf1b6d48360894094c8aa3d2640f5 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1415,
 /**/
     1414,
 /**/