summaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-09-10 21:05:02 +0200
committerBram Moolenaar <Bram@vim.org>2018-09-10 21:05:02 +0200
commitf29c1c6aa3f365c025890fab5fb9efbe88eb1761 (patch)
tree3cd43ee75a7e0fbdce4902426512ae804b1c7ff0 /src/fileio.c
parent6b0b83f768cf536b34ce4d3f2de6bf62324229aa (diff)
patch 8.1.0362: cannot get the script line number when executing a functionv8.1.0362
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".
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/fileio.c b/src/fileio.c
index d00dc5e47b..056ac914d7 100644
--- 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, int indent UNUSED)
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;