Patch 9.0.0082 (after 9.0.0051)
Problem:    Cannot interrupt global command from command line.
Solution:   Reset got_int in another place. (closes #10739)
Files:      src/ex_getln.c, src/testdir/test_ex_mode.vim,
            src/testdir/test_global.vim


*** ../vim-9.0.0081/src/ex_getln.c      2022-07-14 17:06:06.660997005 +0100
--- src/ex_getln.c      2022-07-26 17:47:39.680269449 +0100
***************
*** 1786,1793 ****
                                // that occurs while typing a command should
                                // cause the command not to be executed.
  
-       got_int = FALSE;        // avoid infinite Ctrl-C loop in Ex mode
- 
        // Trigger SafeState if nothing is pending.
        may_trigger_safestate(xpc.xp_numfiles <= 0);
  
--- 1786,1791 ----
***************
*** 1850,1856 ****
                && firstc != '@'
  #endif
  #ifdef FEAT_EVAL
!               && !break_ctrl_c
  #endif
                && !global_busy)
            got_int = FALSE;
--- 1848,1855 ----
                && firstc != '@'
  #endif
  #ifdef FEAT_EVAL
!               // do clear got_int in Ex mode to avoid infinite Ctrl-C loop
!               && (!break_ctrl_c || exmode_active)
  #endif
                && !global_busy)
            got_int = FALSE;
*** ../vim-9.0.0081/src/testdir/test_ex_mode.vim        2022-07-14 
17:06:06.660997005 +0100
--- src/testdir/test_ex_mode.vim        2022-07-26 17:42:49.105410745 +0100
***************
*** 156,161 ****
--- 156,162 ----
    call term_sendkeys(buf, "append\<CR>")
    call WaitForAssert({-> assert_match(':  append', term_getline(buf, 5))}, 
1000)
    call term_sendkeys(buf, "\<C-C>")
+   " Wait for input to be flushed
    call term_wait(buf)
    call term_sendkeys(buf, "foo\<CR>")
    call WaitForAssert({-> assert_match('foo', term_getline(buf, 5))}, 1000)
*** ../vim-9.0.0081/src/testdir/test_global.vim 2022-03-04 21:31:43.000000000 
+0000
--- src/testdir/test_global.vim 2022-07-26 17:42:49.105410745 +0100
***************
*** 1,6 ****
--- 1,7 ----
  " Test for :global and :vglobal
  
  source check.vim
+ source term_util.vim
  
  func Test_yank_put_clipboard()
    new
***************
*** 107,110 ****
--- 108,138 ----
    call assert_fails('g x^bxd', 'E146:')
  endfunc
  
+ " Test for interrupting :global using Ctrl-C
+ func Test_interrupt_global()
+   CheckRunVimInTerminal
+   let lines =<< trim END
+     cnoremap ; <Cmd>sleep 10<CR>
+     call setline(1, repeat(['foo'], 5))
+   END
+   call writefile(lines, 'Xtest_interrupt_global')
+   let buf = RunVimInTerminal('-S Xtest_interrupt_global', {'rows': 6})
+ 
+   call term_sendkeys(buf, ":g/foo/norm :\<C-V>;\<CR>")
+   " Wait for :sleep to start
+   call term_wait(buf)
+   call term_sendkeys(buf, "\<C-C>")
+   call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 6))}, 
1000)
+ 
+   " Also test in Ex mode
+   call term_sendkeys(buf, "gQg/foo/norm :\<C-V>;\<CR>")
+   " Wait for :sleep to start
+   call term_wait(buf)
+   call term_sendkeys(buf, "\<C-C>")
+   call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 5))}, 
1000)
+ 
+   call StopVimInTerminal(buf)
+   call delete('Xtest_interrupt_global')
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0081/src/version.c       2022-07-26 17:23:35.813981753 +0100
--- src/version.c       2022-07-26 17:43:12.549318601 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     82,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
137. You decide to stay in college for an additional year or two,
     just so you can have the free Internet access.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220726164847.976581C07D3%40moolenaar.net.

Raspunde prin e-mail lui