summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-07-28 22:36:45 +0000
committerBram Moolenaar <Bram@vim.org>2005-07-28 22:36:45 +0000
commit661b1820956743fd67f957f8dbbc45a93fe38dc9 (patch)
tree5c1a259895d6a8af91b166c0c103706eb8233096 /src/eval.c
parentcfc7d63267e68168b5fb068d8ee1e763ed4aa6a0 (diff)
downloadvim-git-661b1820956743fd67f957f8dbbc45a93fe38dc9.tar.gz
updated for version 7.0118v7.0118
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c
index f2cc2a0b7..ae36e6f30 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -643,6 +643,7 @@ static void init_tv __ARGS((typval_T *varp));
static long get_tv_number __ARGS((typval_T *varp));
static long get_tv_number_chk __ARGS((typval_T *varp, int *denote));
static linenr_T get_tv_lnum __ARGS((typval_T *argvars));
+static linenr_T get_tv_lnum_buf __ARGS((typval_T *argvars, buf_T *buf));
static char_u *get_tv_string __ARGS((typval_T *varp));
static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
static char_u *get_tv_string_chk __ARGS((typval_T *varp));
@@ -9187,11 +9188,12 @@ f_getbufline(argvars, rettv)
buf = get_buf_tv(&argvars[0]);
--emsg_off;
- lnum = get_tv_lnum(&argvars[1]);
+ lnum = get_tv_lnum_buf(&argvars[1], buf);
if (argvars[2].v_type == VAR_UNKNOWN)
end = lnum;
else
- end = get_tv_lnum(&argvars[2]);
+ end = get_tv_lnum_buf(&argvars[2], buf);
+
get_buffer_lines(buf, lnum, end, TRUE, rettv);
}
@@ -15651,7 +15653,8 @@ get_tv_number_chk(varp, denote)
}
/*
- * Get the lnum from the first argument. Also accepts ".", "$", etc.
+ * Get the lnum from the first argument.
+ * Also accepts ".", "$", etc., but that only works for the current buffer.
* Returns -1 on error.
*/
static linenr_T
@@ -15673,6 +15676,24 @@ get_tv_lnum(argvars)
}
/*
+ * Get the lnum from the first argument.
+ * Also accepts "$", then "buf" is used.
+ * Returns 0 on error.
+ */
+ static linenr_T
+get_tv_lnum_buf(argvars, buf)
+ typval_T *argvars;
+ buf_T *buf;
+{
+ if (argvars[0].v_type == VAR_STRING
+ && argvars[0].vval.v_string != NULL
+ && argvars[0].vval.v_string[0] == '$'
+ && buf != NULL)
+ return buf->b_ml.ml_line_count;
+ return get_tv_number_chk(&argvars[0], NULL);
+}
+
+/*
* Get the string value of a variable.
* If it is a Number variable, the number is converted into a string.
* get_tv_string() uses a single, static buffer. YOU CAN ONLY USE IT ONCE!
@@ -18678,6 +18699,23 @@ store_session_globals(fd)
}
#endif
+/*
+ * Display script name where an item was last set.
+ * Should only be invoked when 'verbose' is non-zero.
+ */
+ void
+last_set_msg(scriptID)
+ scid_T scriptID;
+{
+ if (scriptID != 0)
+ {
+ verbose_enter();
+ MSG_PUTS(_("\n\tLast set from "));
+ MSG_PUTS(get_scriptname(scriptID));
+ verbose_leave();
+ }
+}
+
#endif /* FEAT_EVAL */
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) || defined(PROTO)