changeset 18827:f98368dd6615 v8.1.2401

patch 8.1.2401: :cexpr does not handle | in expression Commit: https://github.com/vim/vim/commit/88a3e2b2ac33e3bb4b7cf9132eb75db051e8f4ed Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 6 21:11:39 2019 +0100 patch 8.1.2401: :cexpr does not handle | in expression Problem: :cexpr does not handle | in expression. Solution: Remove EX_TRLBAR and set nextcmd pointer.
author Bram Moolenaar <Bram@vim.org>
date Fri, 06 Dec 2019 21:15:04 +0100
parents b2b4d46cdb1f
children ac753285efc2
files src/ex_cmds.h src/quickfix.c src/testdir/test_quickfix.vim src/version.c
diffstat 4 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -254,7 +254,7 @@ EXCMD(CMD_caddbuffer,	"caddbuffer",	ex_c
 	EX_RANGE|EX_WORD1|EX_TRLBAR,
 	ADDR_OTHER),
 EXCMD(CMD_caddexpr,	"caddexpr",	ex_cexpr,
-	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM|EX_TRLBAR,
+	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM,
 	ADDR_NONE),
 EXCMD(CMD_caddfile,	"caddfile",	ex_cfile,
 	EX_TRLBAR|EX_FILE1,
@@ -296,7 +296,7 @@ EXCMD(CMD_center,	"center",	ex_align,
 	EX_TRLBAR|EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_MODIFY,
 	ADDR_LINES),
 EXCMD(CMD_cexpr,	"cexpr",	ex_cexpr,
-	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM|EX_TRLBAR|EX_BANG,
+	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM|EX_BANG,
 	ADDR_NONE),
 EXCMD(CMD_cfile,	"cfile",	ex_cfile,
 	EX_TRLBAR|EX_FILE1|EX_BANG,
@@ -314,7 +314,7 @@ EXCMD(CMD_cgetbuffer,	"cgetbuffer",	ex_c
 	EX_RANGE|EX_WORD1|EX_TRLBAR,
 	ADDR_OTHER),
 EXCMD(CMD_cgetexpr,	"cgetexpr",	ex_cexpr,
-	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM|EX_TRLBAR,
+	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM,
 	ADDR_NONE),
 EXCMD(CMD_chdir,	"chdir",	ex_cd,
 	EX_BANG|EX_FILE1|EX_TRLBAR|EX_CMDWIN,
@@ -746,7 +746,7 @@ EXCMD(CMD_language,	"language",	ex_langu
 	EX_EXTRA|EX_TRLBAR|EX_CMDWIN,
 	ADDR_NONE),
 EXCMD(CMD_laddexpr,	"laddexpr",	ex_cexpr,
-	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM|EX_TRLBAR,
+	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM,
 	ADDR_NONE),
 EXCMD(CMD_laddbuffer,	"laddbuffer",	ex_cbuffer,
 	EX_RANGE|EX_WORD1|EX_TRLBAR,
@@ -797,7 +797,7 @@ EXCMD(CMD_let,		"let",		ex_let,
 	EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN,
 	ADDR_NONE),
 EXCMD(CMD_lexpr,	"lexpr",	ex_cexpr,
-	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM|EX_TRLBAR|EX_BANG,
+	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM|EX_BANG,
 	ADDR_NONE),
 EXCMD(CMD_lfile,	"lfile",	ex_cfile,
 	EX_TRLBAR|EX_FILE1|EX_BANG,
@@ -815,7 +815,7 @@ EXCMD(CMD_lgetbuffer,	"lgetbuffer",	ex_c
 	EX_RANGE|EX_WORD1|EX_TRLBAR,
 	ADDR_OTHER),
 EXCMD(CMD_lgetexpr,	"lgetexpr",	ex_cexpr,
-	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM|EX_TRLBAR,
+	EX_NEEDARG|EX_WORD1|EX_NOTRLCOM,
 	ADDR_NONE),
 EXCMD(CMD_lgrep,	"lgrep",	ex_make,
 	EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -7548,7 +7548,7 @@ ex_cexpr(exarg_T *eap)
 
     // Evaluate the expression.  When the result is a string or a list we can
     // use it to fill the errorlist.
-    tv = eval_expr(eap->arg, NULL);
+    tv = eval_expr(eap->arg, &eap->nextcmd);
     if (tv != NULL)
     {
 	if ((tv->v_type == VAR_STRING && tv->vval.v_string != NULL)
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -100,7 +100,7 @@ func XlistTests(cchar)
   " Populate the list and then try
   Xgetexpr ['non-error 1', 'Xtestfile1:1:3:Line1',
 		  \ 'non-error 2', 'Xtestfile2:2:2:Line2',
-		  \ 'non-error 3', 'Xtestfile3:3:1:Line3']
+		  \ 'non-error| 3', 'Xtestfile3:3:1:Line3']
 
   " List only valid entries
   let l = split(execute('Xlist', ''), "\n")
@@ -112,7 +112,7 @@ func XlistTests(cchar)
   let l = split(execute('Xlist!', ''), "\n")
   call assert_equal([' 1: non-error 1', ' 2 Xtestfile1:1 col 3: Line1',
 		   \ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2',
-		   \ ' 5: non-error 3', ' 6 Xtestfile3:3 col 1: Line3'], l)
+		   \ ' 5: non-error| 3', ' 6 Xtestfile3:3 col 1: Line3'], l)
 
   " List a range of errors
   let l = split(execute('Xlist 3,6', ''), "\n")
@@ -556,7 +556,7 @@ func Xtest_browse(cchar)
   Xexpr ""
   call assert_equal(0, g:Xgetlist({'idx' : 0}).idx)
   call assert_equal(0, g:Xgetlist({'size' : 0}).size)
-  Xaddexpr ['foo', 'bar', 'baz', 'quux', 'shmoo']
+  Xaddexpr ['foo', 'bar', 'baz', 'quux', 'sh|moo']
   call assert_equal(5, g:Xgetlist({'size' : 0}).size)
   Xlast
   call assert_equal(5, g:Xgetlist({'idx' : 0}).idx)
@@ -4650,13 +4650,13 @@ func Test_search_in_dirstack()
 	      \ "Xfile3:1:X3_L1\n" .
 	      \ "Entering dir c\n" .
 	      \ "Xfile4:2:X4_L2\n" .
-	      \ "Leaving dir c\n" .
-	      \ "Leaving dir Xtestdir\n"
+	      \ "Leaving dir c\n"
   set efm=%DEntering\ dir\ %f,%XLeaving\ dir\ %f,%f:%l:%m
-  cexpr lines
+  cexpr lines .. "Leaving dir Xtestdir|\n" | let next = 1
   call assert_equal(11, getqflist({'size' : 0}).size)
   call assert_equal(4, getqflist({'idx' : 0}).idx)
   call assert_equal('X2_L2', getline('.'))
+  call assert_equal(1, next)
   cnext
   call assert_equal(6, getqflist({'idx' : 0}).idx)
   call assert_equal('X1_L2', getline('.'))
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2401,
+/**/
     2400,
 /**/
     2399,