Patch 8.2.1801
Problem: Undo file not found when using ":args" or ":next".
Solution: Handle like editing another file. (closes #7072)
Files: src/ex_cmds.c, src/testdir/test_undo.vim
*** ../vim-8.2.1800/src/ex_cmds.c 2020-08-15 16:33:24.497747330 +0200
--- src/ex_cmds.c 2020-10-04 19:56:00.319991178 +0200
***************
*** 2849,2857 ****
new_name = NULL;
set_bufref(&bufref, buf);
! if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur)
{
- // Save all the text, so that the reload can be undone.
// Sync first so that this is a separate undo-able action.
u_sync(FALSE);
if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE)
--- 2849,2860 ----
new_name = NULL;
set_bufref(&bufref, buf);
! // If the buffer was used before, store the current contents so that
! // the reload can be undone. Do not do this if the (empty) buffer is
! // being re-used for another file.
! if (!(curbuf->b_flags & BF_NEVERLOADED)
! && (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur))
{
// Sync first so that this is a separate undo-able action.
u_sync(FALSE);
if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE)
*** ../vim-8.2.1800/src/testdir/test_undo.vim 2020-04-12 13:50:22.832171856
+0200
--- src/testdir/test_undo.vim 2020-10-04 18:03:19.690176432 +0200
***************
*** 396,401 ****
--- 396,421 ----
call delete('Xundofile')
endfunc
+ func Test_undofile_next()
+ set undofile
+ new Xfoo.txt
+ execute "norm ix\<c-g>uy\<c-g>uz\<Esc>"
+ write
+ bwipe
+
+ next Xfoo.txt
+ call assert_equal('xyz', getline(1))
+ silent undo
+ call assert_equal('xy', getline(1))
+ silent undo
+ call assert_equal('x', getline(1))
+ bwipe!
+
+ call delete('Xfoo.txt')
+ call delete('.Xfoo.txt.un~')
+ set undofile&
+ endfunc
+
" Test for undo working properly when executing commands from a register.
" Also test this in an empty buffer.
func Test_cmd_in_reg_undo()
*** ../vim-8.2.1800/src/version.c 2020-10-04 17:24:24.705711322 +0200
--- src/version.c 2020-10-04 18:02:48.954270297 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1801,
/**/
--
If you put 7 of the most talented OSS developers in a room for a week
and asked them to fix a bug in a spreadsheet program, in 1 week
you'd have 2 new mail readers and a text-based web browser.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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/202010041759.094HxKqY2187317%40masaka.moolenaar.net.