patch 9.0.1850: Vim9: wrong line number where options set

Commit: 
https://github.com/vim/vim/commit/32f3461465a26192172734584c4cbab6e55e2b7f
Author: LemonBoy <thatle...@gmail.com>
Date:   Sat Sep 2 21:52:05 2023 +0200

    patch 9.0.1850: Vim9: wrong line number where options set
    
    Problem:  Vim9: wrong line number where options set
    Solution: Set source line number earlier
    
    closes: #13006
    closes: #13013
    
    Signed-off-by: Christian Brabandt <c...@256bit.org>
    Co-authored-by: LemonBoy <thatle...@gmail.com>

diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 338167e7b..656185ada 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -4332,6 +4332,23 @@ def Test_option_set()
   set foldlevel&
 enddef
 
+def Test_option_set_line_number()
+  var lines =<< trim END
+      vim9script
+      # line2
+      # line3
+      def F()
+          # line5
+          &foldlevel = -128
+      enddef
+      F()
+  END
+  v9.CheckScriptSuccess(lines)
+
+  var res = execute('verbose set foldlevel')
+  assert_match('  foldlevel.*Last set from .*XScriptSuccess\d\+ line 6', res)
+enddef
+
 def Test_option_modifier()
   # legacy script allows for white space
   var lines =<< trim END
diff --git a/src/version.c b/src/version.c
index c94a450d0..517e0504e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1850,
 /**/
     1849,
 /**/
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 2fbce780f..c29873c89 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -3836,6 +3836,7 @@ exec_instructions(ectx_T *ectx)
                    char_u      *tofree = NULL;
 
                    --ectx->ec_stack.ga_len;
+                   SOURCING_LNUM = iptr->isn_lnum;
                    tv = STACK_TV_BOT(0);
                    if (tv->v_type == VAR_STRING)
                    {
@@ -3845,7 +3846,6 @@ exec_instructions(ectx_T *ectx)
                    }
                    else if (iptr->isn_type == ISN_STOREFUNCOPT)
                    {
-                       SOURCING_LNUM = iptr->isn_lnum;
                        // If the option can be set to a function reference or
                        // a lambda and the passed value is a function
                        // reference, then convert it to the name (string) of

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qcWmr-00CTx6-MU%40256bit.org.

Raspunde prin e-mail lui