Mercurial > vim
diff src/fileio.c @ 14700:0a3b9ecf7cb8 v8.1.0362
patch 8.1.0362: cannot get the script line number when executing a function
commit https://github.com/vim/vim/commit/f29c1c6aa3f365c025890fab5fb9efbe88eb1761
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 10 21:05:02 2018 +0200
patch 8.1.0362: cannot get the script line number when executing a function
Problem: Cannot get the script line number when executing a function.
Solution: Store the line number besides the script ID. (Ozaki Kiichi,
closes #3362) Also display the line number with ":verbose set".
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 10 Sep 2018 21:15:07 +0200 |
parents | c8f07e8b273e |
children | 193471015e1a |
line wrap: on
line diff
--- a/src/fileio.c +++ b/src/fileio.c @@ -7700,7 +7700,7 @@ typedef struct AutoCmd char nested; /* If autocommands nest here */ char last; /* last command in list */ #ifdef FEAT_EVAL - scid_T scriptID; /* script ID where defined */ + sctx_T script_ctx; /* script context where defined */ #endif struct AutoCmd *next; /* Next AutoCmd in list */ } AutoCmd; @@ -7962,7 +7962,7 @@ show_autocmd(AutoPat *ap, event_T event) msg_outtrans(ac->cmd); #ifdef FEAT_EVAL if (p_verbose > 0) - last_set_msg(ac->scriptID); + last_set_msg(ac->script_ctx); #endif if (got_int) return; @@ -8845,7 +8845,8 @@ do_autocmd_event( return FAIL; ac->cmd = vim_strsave(cmd); #ifdef FEAT_EVAL - ac->scriptID = current_SID; + ac->script_ctx = current_sctx; + ac->script_ctx.sc_lnum += sourcing_lnum; #endif if (ac->cmd == NULL) { @@ -9412,7 +9413,7 @@ apply_autocmds_group( AutoPatCmd patcmd; AutoPat *ap; #ifdef FEAT_EVAL - scid_T save_current_SID; + sctx_T save_current_sctx; void *save_funccalp; char_u *save_cmdarg; long save_cmdbang; @@ -9621,7 +9622,7 @@ apply_autocmds_group( sourcing_lnum = 0; /* no line number here */ #ifdef FEAT_EVAL - save_current_SID = current_SID; + save_current_sctx = current_sctx; # ifdef FEAT_PROFILE if (do_profiling == PROF_YES) @@ -9725,7 +9726,7 @@ apply_autocmds_group( autocmd_bufnr = save_autocmd_bufnr; autocmd_match = save_autocmd_match; #ifdef FEAT_EVAL - current_SID = save_current_SID; + current_sctx = save_current_sctx; restore_funccal(save_funccalp); # ifdef FEAT_PROFILE if (do_profiling == PROF_YES) @@ -9949,7 +9950,7 @@ getnextac(int c UNUSED, void *cookie, in retval = vim_strsave(ac->cmd); autocmd_nested = ac->nested; #ifdef FEAT_EVAL - current_SID = ac->scriptID; + current_sctx = ac->script_ctx; #endif if (ac->last) acp->nextcmd = NULL;