To: vim_dev@googlegroups.com Subject: Patch 7.4.1574 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1574 Problem: ":undo 0" does not work. (Florent Fayolle) Solution: Make it undo all the way. (closes #688) Files: src/undo.c, src/testdir/test_undolevels.vim, src/testdir/test_ex_undo.vim, src/testdir/test_alot.vim *** ../vim-7.4.1573/src/undo.c 2016-02-23 14:52:31.901232005 +0100 --- src/undo.c 2016-03-15 17:31:58.033185863 +0100 *************** *** 2286,2292 **** * Init "closest" to a value we can't reach. */ if (absolute) { ! target = step; closest = -1; } else --- 2286,2299 ---- * Init "closest" to a value we can't reach. */ if (absolute) { ! if (step == 0) ! { ! /* target 0 does not exist, got to 1 and above it. */ ! target = 1; ! above = TRUE; ! } ! else ! target = step; closest = -1; } else *** ../vim-7.4.1573/src/testdir/test_undolevels.vim 2015-11-30 21:37:23.596219585 +0100 --- src/testdir/test_undolevels.vim 2016-03-15 17:21:09.339914272 +0100 *************** *** 1,7 **** " Tests for 'undolevels' - set nocompatible viminfo+=nviminfo - func FillBuffer() for i in range(1,13) put=i --- 1,5 ---- *** ../vim-7.4.1573/src/testdir/test_ex_undo.vim 2016-03-15 17:41:19.563363217 +0100 --- src/testdir/test_ex_undo.vim 2016-03-15 17:38:37.393044650 +0100 *************** *** 0 **** --- 1,19 ---- + " Tests for :undo + + func Test_ex_undo() + new ex-undo + setlocal ul=10 + exe "normal ione\n\" + setlocal ul=10 + exe "normal itwo\n\" + setlocal ul=10 + exe "normal ithree\n\" + call assert_equal(4, line('$')) + undo + call assert_equal(3, line('$')) + undo 1 + call assert_equal(2, line('$')) + undo 0 + call assert_equal(1, line('$')) + quit! + endfunc *** ../vim-7.4.1573/src/testdir/test_alot.vim 2016-03-15 17:10:12.302713149 +0100 --- src/testdir/test_alot.vim 2016-03-15 17:37:53.829496347 +0100 *************** *** 4,9 **** --- 4,10 ---- source test_assign.vim source test_cursor_func.vim source test_delete.vim + source test_ex_undo.vim source test_expand.vim source test_feedkeys.vim source test_file_perm.vim *** ../vim-7.4.1573/src/version.c 2016-03-15 17:10:12.306713108 +0100 --- src/version.c 2016-03-15 17:39:57.560213441 +0100 *************** *** 745,746 **** --- 745,748 ---- { /* Add new patch number below this line */ + /**/ + 1574, /**/ -- The real trick is this: to keep the lines as short as possible and keep the size the same yet free from the need for hyphena- Dammit!! (Matthew Winn) /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///