diff src/testdir/test_substitute.vim @ 29002:48d74a5822eb v8.2.5023

patch 8.2.5023: substitute overwrites allocated buffer Commit: https://github.com/vim/vim/commit/338f1fc0ee3ca929387448fe464579d6113fa76a Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 26 15:56:23 2022 +0100 patch 8.2.5023: substitute overwrites allocated buffer Problem: Substitute overwrites allocated buffer. Solution: Disallow undo when in a substitute command.
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 May 2022 17:00:05 +0200
parents 1890fa76a634
children e150d0e4701f
line wrap: on
line diff
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -1013,6 +1013,28 @@ func Test_sub_change_window()
   delfunc Repl
 endfunc
 
+" This was undoign a change in between computing the length and using it.
+func Do_Test_sub_undo_change()
+  new
+  norm o0000000000000000000000000000000000000000000000000000
+  silent! s/\%')/\=Repl()
+  bwipe!
+endfunc
+
+func Test_sub_undo_change()
+  func Repl()
+    silent! norm g-
+  endfunc
+  call Do_Test_sub_undo_change()
+
+  func! Repl()
+    silent earlier
+  endfunc
+  call Do_Test_sub_undo_change()
+
+  delfunc Repl
+endfunc
+
 " Test for the 2-letter and 3-letter :substitute commands
 func Test_substitute_short_cmd()
   new