diff src/evalfunc.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 f1b7d308de2f
children b9a4e49a3f7c
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4061,7 +4061,7 @@ common_function(typval_T *argvars, typva
 	     * also be called from another script. Using trans_function_name()
 	     * would also work, but some plugins depend on the name being
 	     * printable text. */
-	    sprintf(sid_buf, "<SNR>%ld_", (long)current_SID);
+	    sprintf(sid_buf, "<SNR>%ld_", (long)current_sctx.sc_sid);
 	    name = alloc((int)(STRLEN(sid_buf) + STRLEN(s + off) + 1));
 	    if (name != NULL)
 	    {
@@ -7618,7 +7618,8 @@ get_maparg(typval_T *argvars, typval_T *
 	dict_add_number(dict, "noremap", mp->m_noremap ? 1L : 0L);
 	dict_add_number(dict, "expr", mp->m_expr ? 1L : 0L);
 	dict_add_number(dict, "silent", mp->m_silent ? 1L : 0L);
-	dict_add_number(dict, "sid", (long)mp->m_script_ID);
+	dict_add_number(dict, "sid", (long)mp->m_script_ctx.sc_sid);
+	dict_add_number(dict, "lnum", (long)mp->m_script_ctx.sc_lnum);
 	dict_add_number(dict, "buffer", (long)buffer_local);
 	dict_add_number(dict, "nowait", mp->m_nowait ? 1L : 0L);
 	dict_add_string(dict, "mode", mapmode);