Patch 8.2.1954

7 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 4, 2020, 12:03:22 PM11/4/20
to vim...@googlegroups.com

Patch 8.2.1954
Problem: Vim9: not all command modifiers are tested.
Solution: Add tests for "keep" modifiers. Fix that marks are lost even
though ":lockmarks" is used.
Files: src/ex_cmds.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.1953/src/ex_cmds.c 2020-11-01 13:57:37.551988657 +0100
--- src/ex_cmds.c 2020-11-04 16:51:56.559534507 +0100
***************
*** 1254,1259 ****
--- 1254,1269 ----
if (read_linecount >= linecount)
// move all marks from old lines to new lines
mark_adjust(line1, line2, linecount, 0L);
+ else if (save_cmod_flags & CMOD_LOCKMARKS)
+ {
+ // Move marks from the lines below the new lines down by
+ // the number of lines lost.
+ // Move marks from the lines that will be deleted to the
+ // new lines and below.
+ mark_adjust(line2 + 1, (linenr_T)MAXLNUM,
+ linecount - read_linecount, 0L);
+ mark_adjust(line1, line2, linecount, 0L);
+ }
else
{
// move marks from old lines to new lines, delete marks
*** ../vim-8.2.1953/src/testdir/test_vim9_cmd.vim 2020-11-02 21:08:43.118288911 +0100
--- src/testdir/test_vim9_cmd.vim 2020-11-04 18:01:48.189523391 +0100
***************
*** 439,451 ****
DoTest(false, true, true)
DoTest(true, true, true)
set cpo&vim
endif

! # TODO
! # lockmarks
! # keepalt
! # keeppatterns
! # keepjumps
enddef

def Test_command_modifier_other()
--- 439,480 ----
DoTest(false, true, true)
DoTest(true, true, true)
set cpo&vim
+
+ new
+ setline(1, ['one', 'two', 'three', 'four'])
+ assert_equal(4, line("$"))
+ normal 1Gma
+ normal 2Gmb
+ normal 3Gmc
+ lockmarks :1,2!wc
+ # line is deleted, marks don't move
+ assert_equal(3, line("$"))
+ assert_equal('four', getline(3))
+ assert_equal(1, line("'a"))
+ assert_equal(2, line("'b"))
+ assert_equal(3, line("'c"))
+ quit!
endif

! edit Xone
! edit Xtwo
! assert_equal('Xone', expand('#'))
! keepalt edit Xthree
! assert_equal('Xone', expand('#'))
!
! normal /a*b*
! assert_equal('a*b*', histget("search"))
! keeppatterns normal /c*d*
! assert_equal('a*b*', histget("search"))
!
! new
! setline(1, range(10))
! :10
! normal gg
! assert_equal(10, getpos("''")[1])
! keepjumps normal 5G
! assert_equal(10, getpos("''")[1])
! quit!
enddef

def Test_command_modifier_other()
*** ../vim-8.2.1953/src/version.c 2020-11-04 15:07:13.057780706 +0100
--- src/version.c 2020-11-04 16:30:22.830696052 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1954,
/**/

--
% cat /usr/include/sys/errno.h
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
[...]
#define EMACS 666 /* Too many macros */
%

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages