patch 8.2.2775: Vim9: wrong line number used for some commands
Problem: Vim9: wrong line number used for some commands.
Solution: For :exe, :echo and the like use the line number of the start of
the command. When calling a function set the line number in the
script context.
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 2f2fc9c..1810c5b 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -3848,6 +3848,37 @@
CheckScriptFailure(['vim9script'] + lines, 'E1100:')
enddef
+def Test_mapping_line_number()
+ var lines =<< trim END
+ vim9script
+ def g:FuncA()
+ # Some comment
+ FuncB(0)
+ enddef
+ # Some comment
+ def FuncB(
+ # Some comment
+ n: number
+ )
+ exe 'nno '
+ # Some comment
+ .. '<F3> a'
+ .. 'b'
+ .. 'c'
+ enddef
+ END
+ CheckScriptSuccess(lines)
+ var res = execute('verbose nmap <F3>')
+ assert_match('No mapping found', res)
+
+ g:FuncA()
+ res = execute('verbose nmap <F3>')
+ assert_match(' <F3> .* abc.*Last set from .*XScriptSuccess\d\+ line 11', res)
+
+ nunmap <F3>
+ delfunc g:FuncA
+enddef
+
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new