]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1866: undo is synced after character find v9.0.1866
authorzeertzjq <zeertzjq@outlook.com>
Mon, 4 Sep 2023 20:25:07 +0000 (22:25 +0200)
committerChristian Brabandt <cb@256bit.org>
Mon, 4 Sep 2023 20:25:07 +0000 (22:25 +0200)
Problem:  Undo is synced after character find.
Solution: Set no_u_sync when calling gotchars_nop().

closes: #13022
closes: #13024

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
src/normal.c
src/testdir/test_undo.vim
src/version.c

index b73afd32128a023b3bab5eab379bdfae3caa1a31..86b8740f8a465fedf9d965397655875bcb1213d4 100644 (file)
@@ -570,7 +570,9 @@ normal_cmd_get_more_chars(
            // but when replaying a recording the next key is already in the
            // typeahead buffer, so record a <Nop> before that to prevent the
            // vpeekc() above from applying wrong mappings when replaying.
+           ++no_u_sync;
            gotchars_nop();
+           --no_u_sync;
        }
     }
     --no_mapping;
index 368ebbe916c2ce37a543c0798c5313c9fd8195d0..58563bde63472ecc43b0e8dbf6372d108ea19ecd 100644 (file)
@@ -862,5 +862,15 @@ func Test_undo_after_write()
   call delete('Xtestfile.txt')
 endfunc
 
+func Test_undo_range_normal()
+  new
+  call setline(1, ['asa', 'bsb'])
+  let &l:undolevels = &l:undolevels
+  %normal dfs
+  call assert_equal(['a', 'b'], getline(1, '$'))
+  undo
+  call assert_equal(['asa', 'bsb'], getline(1, '$'))
+  bwipe!
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab
index c4b793f5069d11e44f1b5aced98415d486eaa995..5eb9c59ab12a6e0d56a16181fd7e8c86385068d3 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1866,
 /**/
     1865,
 /**/