summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-02-15 21:30:30 +0100
committerBram Moolenaar <Bram@vim.org>2021-02-15 21:30:30 +0100
commitb8554304c3673b081e9b5996f009fd0e4307e482 (patch)
tree9ac90afb26ddcf64266c051ea7d67881bc4662c2
parenteed9d46293f0842aad0d50ff3a526f9a48b12421 (diff)
downloadvim-git-b8554304c3673b081e9b5996f009fd0e4307e482.tar.gz
patch 8.2.2519: Vim9: no reason to keep strange Vi behaviorv8.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)
-rw-r--r--src/ex_docmd.c10
-rw-r--r--src/testdir/test_vim9_script.vim11
-rw-r--r--src/version.c2
3 files changed, 20 insertions, 3 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 0dd21eb01..f4bdf7b15 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1957,12 +1957,16 @@ do_one_cmd(
/*
* strange vi behaviour:
* ":3" jumps to line 3
- * ":3|..." prints line 3
- * ":|" prints current line
+ * ":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))
+ 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;
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 0becc7d1b..922080d9c 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -22,6 +22,17 @@ def Test_range_only()
: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
diff --git a/src/version.c b/src/version.c
index 774ff529e..02abac975 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2519,
+/**/
2518,
/**/
2517,