diff src/eval.c @ 448:dd9db57ee7ce v7.0118

updated for version 7.0118
author vimboss
date Thu, 28 Jul 2005 22:36:45 +0000
parents 7472c565592a
children 3709cf52b9b5
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -643,6 +643,7 @@ static void init_tv __ARGS((typval_T *va
 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)