mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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.
This commit is contained in:
@@ -8221,6 +8221,7 @@ compile_mult_expr(char_u *arg, int cmdidx, cctx_T *cctx)
|
||||
char_u *p = arg;
|
||||
char_u *prev = arg;
|
||||
int count = 0;
|
||||
int start_ctx_lnum = cctx->ctx_lnum;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@@ -8235,6 +8236,11 @@ compile_mult_expr(char_u *arg, int cmdidx, cctx_T *cctx)
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
long save_lnum = cctx->ctx_lnum;
|
||||
|
||||
// Use the line number where the command started.
|
||||
cctx->ctx_lnum = start_ctx_lnum;
|
||||
|
||||
if (cmdidx == CMD_echo || cmdidx == CMD_echon)
|
||||
generate_ECHO(cctx, cmdidx == CMD_echo, count);
|
||||
else if (cmdidx == CMD_execute)
|
||||
@@ -8243,6 +8249,8 @@ compile_mult_expr(char_u *arg, int cmdidx, cctx_T *cctx)
|
||||
generate_MULT_EXPR(cctx, ISN_ECHOMSG, count);
|
||||
else
|
||||
generate_MULT_EXPR(cctx, ISN_ECHOERR, count);
|
||||
|
||||
cctx->ctx_lnum = save_lnum;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
Reference in New Issue
Block a user