summaryrefslogtreecommitdiffstats
path: root/src/structs.h
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/structs.h
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/structs.h')
-rw-r--r--src/structs.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/structs.h b/src/structs.h
index ee56bd3e40..f978f61b79 100644
--- 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' */