Patch 8.2.2519
Problem:    Vim9: no reason to keep strange Vi behavior.
Solution:   ":3" and ":3|" both go to line 3. ":|" does not print the line.
            (closes #7840)
Files:      src/ex_docmd.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.2518/src/ex_docmd.c      2021-02-14 14:07:31.369787927 +0100
--- src/ex_docmd.c      2021-02-15 21:23:33.783116189 +0100
***************
*** 1957,1968 ****
        /*
         * strange vi behaviour:
         * ":3"         jumps to line 3
!        * ":3|..."     prints line 3
!        * ":|"         prints current line
         */
        if (ea.skip)        // skip this if inside :if
            goto doend;
!       if (*ea.cmd == '|' || (exmode_active && ea.line1 != ea.line2))
        {
            ea.cmdidx = CMD_print;
            ea.argt = EX_RANGE+EX_COUNT+EX_TRLBAR;
--- 1957,1972 ----
        /*
         * strange vi behaviour:
         * ":3"         jumps to line 3
!        * ":3|..."     prints line 3  (not in Vim9 script)
!        * ":|"         prints current line  (not in Vim9 script)
         */
        if (ea.skip)        // skip this if inside :if
            goto doend;
!       if ((*ea.cmd == '|' || (exmode_active && ea.line1 != ea.line2))
! #ifdef FEAT_EVAL
!               && !vim9script
! #endif
!          )
        {
            ea.cmdidx = CMD_print;
            ea.argt = EX_RANGE+EX_COUNT+EX_TRLBAR;
*** ../vim-8.2.2518/src/testdir/test_vim9_script.vim    2021-02-14 
22:40:53.233969130 +0100
--- src/testdir/test_vim9_script.vim    2021-02-15 21:28:58.798307833 +0100
***************
*** 22,27 ****
--- 22,38 ----
    :3
    list
    assert_equal('three$', Screenline(&lines))
+ 
+   # missing command does not print the line
+   var lines =<< trim END
+     vim9script
+     :1|
+     assert_equal('three$', Screenline(&lines))
+     :|
+     assert_equal('three$', Screenline(&lines))
+   END
+   CheckScriptSuccess(lines)
+ 
    bwipe!
  
    # won't generate anything
*** ../vim-8.2.2518/src/version.c       2021-02-15 20:37:58.461374530 +0100
--- src/version.c       2021-02-15 21:25:40.162798991 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2519,
  /**/

-- 
The early bird gets the worm. The second mouse gets the cheese.

 /// 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/202102152035.11FKZKLl1754175%40masaka.moolenaar.net.

Raspunde prin e-mail lui