Patch 9.0.0788
Problem: ModeChanged autocmd not executed when Visual mode is ended with
CTRL-C.
Solution: Do not trigger the autocmd when got_int is set. (closes #11394)
Files: src/misc1.c, src/testdir/test_autocmd.vim
*** ../vim-9.0.0787/src/misc1.c 2022-09-12 17:50:42.782378262 +0100
--- src/misc1.c 2022-10-18 15:09:11.581334365 +0100
***************
*** 330,335 ****
--- 330,336 ----
/*
* Return the number of window lines occupied by buffer line "lnum".
+ * Includes any filler lines.
*/
int
plines(linenr_T lnum)
***************
*** 349,354 ****
--- 350,359 ----
return plines_win_nofill(wp, lnum, winheight) + diff_check_fill(wp, lnum);
}
+ /*
+ * Return the number of window lines occupied by buffer line "lnum".
+ * Does not include filler lines.
+ */
int
plines_nofill(linenr_T lnum)
{
***************
*** 2754,2760 ****
char_u curr_mode[MODE_MAX_LENGTH];
char_u pattern_buf[2 * MODE_MAX_LENGTH];
! if (!has_modechanged())
return;
get_mode(curr_mode);
--- 2759,2767 ----
char_u curr_mode[MODE_MAX_LENGTH];
char_u pattern_buf[2 * MODE_MAX_LENGTH];
! // Skip this when got_int is set, the autocommand will not be executed.
! // Better trigger it next time.
! if (!has_modechanged() || got_int)
return;
get_mode(curr_mode);
*** ../vim-9.0.0787/src/testdir/test_autocmd.vim 2022-10-05
11:24:42.228494178 +0100
--- src/testdir/test_autocmd.vim 2022-10-18 15:06:14.113741691 +0100
***************
*** 3429,3434 ****
--- 3429,3446 ----
unlet g:n_to_c
unlet g:c_to_n
+ let g:n_to_v = 0
+ au ModeChanged n:v let g:n_to_v += 1
+ let g:v_to_n = 0
+ au ModeChanged v:n let g:v_to_n += 1
+ let g:mode_seq += ['v', 'n']
+ call feedkeys("v\<C-C>", 'tnix')
+ call assert_equal(len(g:mode_seq) - 1, g:index)
+ call assert_equal(1, g:n_to_v)
+ call assert_equal(1, g:v_to_n)
+ unlet g:n_to_v
+ unlet g:v_to_n
+
au! ModeChanged
delfunc TestMode
unlet! g:mode_seq
*** ../vim-9.0.0787/src/version.c 2022-10-18 13:33:22.148927173 +0100
--- src/version.c 2022-10-18 15:00:34.698819366 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 788,
/**/
--
Living on Earth includes an annual free trip around the Sun.
/// 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/20221018141108.6A5A11C20D5%40moolenaar.net.