mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
vim-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 vim/vim#3362) Also display the line number with ":verbose set".
f29c1c6aa3
This commit is contained in:
@@ -103,7 +103,7 @@ typedef struct AutoCmd {
|
||||
bool once; // "One shot": removed after execution
|
||||
char nested; // If autocommands nest here
|
||||
char last; // last command in list
|
||||
scid_T scriptID; // script ID where defined
|
||||
sctx_T script_ctx; // script context where defined
|
||||
struct AutoCmd *next; // Next AutoCmd in list
|
||||
} AutoCmd;
|
||||
|
||||
@@ -5422,20 +5422,25 @@ static void show_autocmd(AutoPat *ap, event_T event)
|
||||
if (ac->cmd == NULL) { /* skip removed commands */
|
||||
continue;
|
||||
}
|
||||
if (msg_col >= 14)
|
||||
if (msg_col >= 14) {
|
||||
msg_putchar('\n');
|
||||
}
|
||||
msg_col = 14;
|
||||
if (got_int)
|
||||
if (got_int) {
|
||||
return;
|
||||
}
|
||||
msg_outtrans(ac->cmd);
|
||||
if (p_verbose > 0)
|
||||
last_set_msg(ac->scriptID);
|
||||
if (got_int)
|
||||
if (p_verbose > 0) {
|
||||
last_set_msg(ac->script_ctx);
|
||||
}
|
||||
if (got_int) {
|
||||
return;
|
||||
}
|
||||
if (ac->next != NULL) {
|
||||
msg_putchar('\n');
|
||||
if (got_int)
|
||||
if (got_int) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6241,7 +6246,8 @@ static int do_autocmd_event(event_T event, char_u *pat, bool once, int nested,
|
||||
prev_ac = &ac->next;
|
||||
ac = xmalloc(sizeof(AutoCmd));
|
||||
ac->cmd = vim_strsave(cmd);
|
||||
ac->scriptID = current_SID;
|
||||
ac->script_ctx = current_sctx;
|
||||
ac->script_ctx.sc_lnum += sourcing_lnum;
|
||||
ac->next = NULL;
|
||||
*prev_ac = ac;
|
||||
ac->once = once;
|
||||
@@ -6675,7 +6681,6 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
|
||||
static int nesting = 0;
|
||||
AutoPatCmd patcmd;
|
||||
AutoPat *ap;
|
||||
scid_T save_current_SID;
|
||||
void *save_funccalp;
|
||||
char_u *save_cmdarg;
|
||||
long save_cmdbang;
|
||||
@@ -6860,7 +6865,7 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
|
||||
save_sourcing_lnum = sourcing_lnum;
|
||||
sourcing_lnum = 0; /* no line number here */
|
||||
|
||||
save_current_SID = current_SID;
|
||||
const sctx_T save_current_sctx = current_sctx;
|
||||
|
||||
if (do_profiling == PROF_YES)
|
||||
prof_child_enter(&wait_time); /* doesn't count for the caller itself */
|
||||
@@ -6954,7 +6959,7 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
|
||||
autocmd_fname = save_autocmd_fname;
|
||||
autocmd_bufnr = save_autocmd_bufnr;
|
||||
autocmd_match = save_autocmd_match;
|
||||
current_SID = save_current_SID;
|
||||
current_sctx = save_current_sctx;
|
||||
restore_funccal(save_funccalp);
|
||||
if (do_profiling == PROF_YES)
|
||||
prof_child_exit(&wait_time);
|
||||
@@ -7147,7 +7152,7 @@ char_u *getnextac(int c, void *cookie, int indent)
|
||||
au_del_cmd(ac);
|
||||
}
|
||||
autocmd_nested = ac->nested;
|
||||
current_SID = ac->scriptID;
|
||||
current_sctx = ac->script_ctx;
|
||||
if (ac->last) {
|
||||
acp->nextcmd = NULL;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user