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".
diff --git a/src/main.c b/src/main.c
index d3a509b..cb0676c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2912,13 +2912,13 @@
curwin->w_cursor.lnum = 0; /* just in case.. */
sourcing_name = (char_u *)_("pre-vimrc command line");
# ifdef FEAT_EVAL
- current_SID = SID_CMDARG;
+ current_sctx.sc_sid = SID_CMDARG;
# endif
for (i = 0; i < cnt; ++i)
do_cmdline_cmd(cmds[i]);
sourcing_name = NULL;
# ifdef FEAT_EVAL
- current_SID = 0;
+ current_sctx.sc_sid = 0;
# endif
TIME_MSG("--cmd commands");
}
@@ -2942,7 +2942,7 @@
curwin->w_cursor.lnum = 0;
sourcing_name = (char_u *)"command line";
#ifdef FEAT_EVAL
- current_SID = SID_CARG;
+ current_sctx.sc_sid = SID_CARG;
#endif
for (i = 0; i < parmp->n_commands; ++i)
{
@@ -2952,7 +2952,7 @@
}
sourcing_name = NULL;
#ifdef FEAT_EVAL
- current_SID = 0;
+ current_sctx.sc_sid = 0;
#endif
if (curwin->w_cursor.lnum == 0)
curwin->w_cursor.lnum = 1;
@@ -3159,7 +3159,7 @@
char_u *save_sourcing_name;
linenr_T save_sourcing_lnum;
#ifdef FEAT_EVAL
- scid_T save_sid;
+ sctx_T save_current_sctx;
#endif
if ((initstr = mch_getenv(env)) != NULL && *initstr != NUL)
@@ -3171,14 +3171,15 @@
sourcing_name = env;
sourcing_lnum = 0;
#ifdef FEAT_EVAL
- save_sid = current_SID;
- current_SID = SID_ENV;
+ save_current_sctx = current_sctx;
+ current_sctx.sc_sid = SID_ENV;
+ current_sctx.sc_lnum = 0;
#endif
do_cmdline_cmd(initstr);
sourcing_name = save_sourcing_name;
sourcing_lnum = save_sourcing_lnum;
#ifdef FEAT_EVAL
- current_SID = save_sid;
+ current_sctx = save_current_sctx;
#endif
return OK;
}