Mercurial > vim
diff src/structs.h @ 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 | 195e8b1fcbbf |
children | 1ae9c8a1b3bf |
line wrap: on
line diff
--- a/src/structs.h +++ b/src/structs.h @@ -75,6 +75,19 @@ typedef struct VimMenu vimmenu_T; #endif /* + * SCript ConteXt (SCTX): identifies a script script line. + * When sourcing a script "sc_lnum" is zero, "sourcing_lnum" is the current + * line number. When executing a user function "sc_lnum" is the line where the + * function was defined, "sourcing_lnum" is the line number inside the + * function. When stored with a function, mapping, option, etc. "sc_lnum" is + * the line number in the script "sc_sid". + */ +typedef struct { + scid_T sc_sid; // script ID + linenr_T sc_lnum; // line number +} sctx_T; + +/* * Reference to a buffer that stores the value of buf_free_count. * bufref_valid() only needs to check "buf" when the count differs. */ @@ -278,8 +291,8 @@ typedef struct #endif #ifdef FEAT_EVAL - int wo_scriptID[WV_COUNT]; /* SIDs for window-local options */ -# define w_p_scriptID w_onebuf_opt.wo_scriptID + sctx_T wo_script_ctx[WV_COUNT]; /* SCTXs for window-local options */ +# define w_p_script_ctx w_onebuf_opt.wo_script_ctx #endif } winopt_T; @@ -541,7 +554,7 @@ typedef struct expand int xp_pattern_len; /* bytes in xp_pattern before cursor */ #if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) char_u *xp_arg; /* completion function */ - int xp_scriptID; /* SID for completion function */ + sctx_T xp_script_ctx; /* SCTX for completion function */ #endif int xp_backslash; /* one of the XP_BS_ values */ #ifndef BACKSLASH_IN_FILENAME @@ -1071,7 +1084,7 @@ struct mapblock char m_nowait; /* <nowait> used */ #ifdef FEAT_EVAL char m_expr; /* <expr> used, m_str is an expression */ - scid_T m_script_ID; /* ID of script where map was defined */ + sctx_T m_script_ctx; /* SCTX where map was defined */ #endif }; @@ -1361,7 +1374,7 @@ typedef struct int uf_tml_idx; /* index of line being timed; -1 if none */ int uf_tml_execed; /* line being timed was executed */ #endif - scid_T uf_script_ID; /* ID of script where function was defined, + sctx_T uf_script_ctx; /* SCTX where function was defined, used for s: variables */ int uf_refcount; /* reference count, see func_name_refcount() */ funccall_T *uf_scoped; /* l: local variables for closure */ @@ -2123,7 +2136,7 @@ struct file_buffer int b_p_initialized; /* set when options initialized */ #ifdef FEAT_EVAL - int b_p_scriptID[BV_COUNT]; /* SIDs for buffer-local options */ + sctx_T b_p_script_ctx[BV_COUNT]; /* SCTXs for buffer-local options */ #endif int b_p_ai; /* 'autoindent' */