patch 9.2.1189: CTRL-W command fails when CursorHold triggers

Problem:  When CursorHold triggers while waiting for the key after
          CTRL-W, the CTRL-W command fails with a beep(Emilien Breton).
Solution: Do not trigger CursorHold while getting the keys of a CTRL-W
          command (Hirohito Higashi).

fixes:  #21481
closes: #21485

Assisted-by: Claude
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Hirohito Higashi authored and Christian Brabandt committed 2026-10-14 18:50:26 +00:00
1 parent c10f972446
commit 16b6f55eb6
3 files changed
+29

No files matched your search

+1
View File
@@ -279,6 +279,7 @@ getcount:
*ctrl_w = TRUE;
cap->opcount = cap->count0; // remember first count
cap->count0 = 0;
did_cursorhold = TRUE;
++no_mapping;
++allow_keys; // no mapping for nchar, but keys
c = plain_vgetc(); // get next character
+26
View File
@@ -124,6 +124,32 @@ if has('timers')
set updatetime&
endfunc
func Test_cursorhold_normal_ctrl_w()
au CursorHold * :
set updatetime=20
new
let bnr = bufnr()
call timer_start(100, { -> feedkeys("w", 't') })
call feedkeys("\<C-w>", 'tx!')
sleep 200m
call assert_equal(2, winnr())
" <C-w> with count
new
let bnr2 = bufnr()
call timer_start(100, { -> feedkeys("w", 't') })
call feedkeys("\<C-w>3", 'tx!')
sleep 200m
call assert_equal(3, winnr())
call feedkeys(":\<C-B>\"\<CR>", 'xt')
call assert_equal('"', @:)
exe 'bwipe!' bnr2
exe 'bwipe!' bnr
au! CursorHold
set updatetime&
endfunc
func Test_OptionSet_modeline()
call test_override('starting', 1)
au! OptionSet
+2
View File
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1189,
/**/
1188,
/**/