summaryrefslogtreecommitdiffstats
path: root/src/eval.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/eval.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/eval.c')
-rw-r--r--src/eval.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/eval.c b/src/eval.c
index 3a275213cb..358217a824 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1495,8 +1495,8 @@ list_vim_vars(int *first)
static void
list_script_vars(int *first)
{
- if (current_SID > 0 && current_SID <= ga_scripts.ga_len)
- list_hashtable_vars(&SCRIPT_VARS(current_SID),
+ if (current_sctx.sc_sid > 0 && current_sctx.sc_sid <= ga_scripts.ga_len)
+ list_hashtable_vars(&SCRIPT_VARS(current_sctx.sc_sid),
(char_u *)"s:", FALSE, first);
}
@@ -7202,7 +7202,7 @@ find_var_in_ht(
/* Must be something like "s:", otherwise "ht" would be NULL. */
switch (htname)
{
- case 's': return &SCRIPT_SV(current_SID)->sv_var;
+ case 's': return &SCRIPT_SV(current_sctx.sc_sid)->sv_var;
case 'g': return &globvars_var;
case 'v': return &vimvars_var;
case 'b': return &curbuf->b_bufvar;
@@ -7286,8 +7286,8 @@ find_var_ht(char_u *name, char_u **varname)
if (*name == 'l') /* l: local function variable */
return get_funccal_local_ht();
if (*name == 's' /* script variable */
- && current_SID > 0 && current_SID <= ga_scripts.ga_len)
- return &SCRIPT_VARS(current_SID);
+ && current_sctx.sc_sid > 0 && current_sctx.sc_sid <= ga_scripts.ga_len)
+ return &SCRIPT_VARS(current_sctx.sc_sid);
return NULL;
}
@@ -8729,20 +8729,25 @@ store_session_globals(FILE *fd)
* Should only be invoked when 'verbose' is non-zero.
*/
void
-last_set_msg(scid_T scriptID)
+last_set_msg(sctx_T script_ctx)
{
char_u *p;
- if (scriptID != 0)
+ if (script_ctx.sc_sid != 0)
{
- p = home_replace_save(NULL, get_scriptname(scriptID));
+ p = home_replace_save(NULL, get_scriptname(script_ctx.sc_sid));
if (p != NULL)
{
verbose_enter();
MSG_PUTS(_("\n\tLast set from "));
MSG_PUTS(p);
- vim_free(p);
+ if (script_ctx.sc_lnum > 0)
+ {
+ MSG_PUTS(_(" line "));
+ msg_outnum((long)script_ctx.sc_lnum);
+ }
verbose_leave();
+ vim_free(p);
}
}
}