]> granicus.if.org Git - vim/commitdiff
patch 8.2.3146: Vim9: line number wrong for :execute argument v8.2.3146
authorBram Moolenaar <Bram@vim.org>
Sun, 11 Jul 2021 14:52:45 +0000 (16:52 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 11 Jul 2021 14:52:45 +0000 (16:52 +0200)
Problem:    Vim9: line number wrong for :execute argument.
Solution:   Use the line number of the :execute command itself. (closes #8537)

src/eval.c
src/testdir/test_vim9_script.vim
src/version.c

index 6537ffea41e877cf0b652fcefaf5b9573dd1fd41..5dc1642a169aeaf64a97704e881f9471e71e1270 100644 (file)
@@ -6191,6 +6191,7 @@ ex_execute(exarg_T *eap)
     char_u     *p;
     garray_T   ga;
     int                len;
+    long       start_lnum = SOURCING_LNUM;
 
     ga_init2(&ga, 1, 80);
 
@@ -6244,6 +6245,9 @@ ex_execute(exarg_T *eap)
 
     if (ret != FAIL && ga.ga_data != NULL)
     {
+       // use the first line of continuation lines for messages
+       SOURCING_LNUM = start_lnum;
+
        if (eap->cmdidx == CMD_echomsg || eap->cmdidx == CMD_echoerr)
        {
            // Mark the already saved text as finishing the line, so that what
index ab0c031c544c0909d773f3e78bb3ff8d39a92dbb..0602b2ae5baf5e4e0dea3f6d6ef07a9d4ca543ce 100644 (file)
@@ -4167,6 +4167,16 @@ def Test_option_modifier()
   set hlsearch&
 enddef
 
+" This must be called last, it may cause following :def functions to fail
+def Test_xxx_echoerr_line_number()
+  var lines =<< trim END
+      echoerr 'some'
+         .. ' error'
+         .. ' continued'
+  END
+  CheckDefExecAndScriptFailure(lines, 'some error continued', 1)
+enddef
+
 def ProfiledFunc()
   var n = 3
   echo [[1, 2], [3, 4]]->filter((_, l) => l[0] == n)
index 82d2d1fa0ff7bbf2c1b746e5fcf4691638435543..8e1d88e3e9634b68ca97478e07d45988da968713 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3146,
 /**/
     3145,
 /**/