From 5a9357d0bff9059f547906d8d03b31bca7215af1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 3 Oct 2021 16:22:05 +0100 Subject: patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U" Problem: CursorHoldI event interferes with "CTRL-G U". (Naohiro Ono) Solution: Restore the flag for "CTRL-G U" after triggering CursorHoldI. (closes #8937) --- src/edit.c | 3 +++ src/testdir/test_autocmd.vim | 16 ++++++++++++++++ src/version.c | 2 ++ 3 files changed, 21 insertions(+) diff --git a/src/edit.c b/src/edit.c index 070d84c60..4f8e37401 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1057,6 +1057,9 @@ doESCkey: case K_CURSORHOLD: // Didn't type something for a while. ins_apply_autocmds(EVENT_CURSORHOLDI); did_cursorhold = TRUE; + // If CTRL-G U was used apply it to the next typed key. + if (dont_sync_undo == TRUE) + dont_sync_undo = MAYBE; break; #ifdef FEAT_GUI_MSWIN diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index f769eec17..db1efba12 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -100,6 +100,22 @@ if has('timers') set updatetime& endfunc + func Test_cursorhold_insert_ctrl_g_U() + au CursorHoldI * : + set updatetime=20 + new + call timer_start(100, { -> feedkeys("\foo\", 't') }) + call feedkeys("i()\U", 'tx!') + sleep 200m + call assert_equal('(foo)', getline(1)) + undo + call assert_equal('', getline(1)) + + bwipe! + au! CursorHoldI + set updatetime& + endfunc + func Test_OptionSet_modeline() call test_override('starting', 1) au! OptionSet diff --git a/src/version.c b/src/version.c index 080170408..410776742 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3467, /**/ 3466, /**/ -- cgit v1.2.1