forked from aniani/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 #3362) Also display the line number with ":verbose set".
This commit is contained in:
@@ -74,6 +74,19 @@ typedef struct terminal_S term_T;
|
||||
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' */
|
||||
|
Reference in New Issue
Block a user