changeset 533:c8b6b7e1005d v7.0150

updated for version 7.0150
author vimboss
date Sun, 25 Sep 2005 22:20:24 +0000
parents 7052f11a3dc9
children c6296b0ad9ea
files runtime/compiler/rubyunit.vim runtime/doc/todo.txt runtime/doc/version7.txt runtime/spell/en/en_US.diff src/eval.c src/ex_cmds.c src/menu.c src/testdir/test58.in
diffstat 8 files changed, 204 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/runtime/compiler/rubyunit.vim
@@ -0,0 +1,41 @@
+" Vim compiler file
+" Language:	Test::Unit - Ruby Unit Testing Framework
+" Maintainer:	Doug Kearns <djkea2 at gus.gscit.monash.edu.au>
+" Info:		$Id$
+" URL:		http://vim-ruby.sourceforge.net
+" Anon CVS:	See above site
+" Licence:	GPL (http://www.gnu.org)
+" Disclaimer:
+"    This program is distributed in the hope that it will be useful,
+"    but WITHOUT ANY WARRANTY; without even the implied warranty of
+"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+"    GNU General Public License for more details.
+" ----------------------------------------------------------------------------
+
+if exists("current_compiler")
+  finish
+endif
+let current_compiler = "rubyunit"
+
+if exists(":CompilerSet") != 2		" older Vim always used :setlocal
+  command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=testrb
+
+CompilerSet errorformat=\%W\ %\\+%\\d%\\+)\ Failure:,
+			\%C%m\ [%f:%l]:,
+		        \%E\ %\\+%\\d%\\+)\ Error:,
+			\%C%m:,
+			\%C\ \ \ \ %f:%l:%.%#,
+			\%C%m,
+			\%Z\ %#,
+			\%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8 ff=unix:
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2005 Sep 20
+*todo.txt*      For Vim version 7.0aa.  Last change: 2005 Sep 25
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -30,21 +30,19 @@ be worked on, but only if you sponsor Vi
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
-Test11 fails sometimes. (athena, huge features)
-
-ml_get errors: :%s/^\_s\+$//gc
-And: Insert mode in one window, long file, click in other window, short file.
-
-'scrolljump' negative used as a percentage, e.g. -50 is 50% of window height?
+Spelling:
+- Suggestions for "the the" includes "thee the" but not "the thee"?
+- CTRL-X s doesn't consider 'spellcapcheck'.
+- Spellbadword() returns a list with bad word and reason it's bad.
+  This doesn't work when highlighting is the same for some mistakes.
+- spellsuggest() needs a way to require a capital.  A flag or context?
 
-Spelling:
-- suggestion for "a an" includes "an an", which is marked bad.  Check
-  suggestions for not being a bad word (when split)?
-- CTRL-X s doesn't consider 'spellcapcheck'.
-- Have spellbadword() return a list with bad word and reason it's bad?
-  (rare/local/bad/caps)
-- spellsuggest() needs a way to require a capital.  A flag or context?
-- Underscore in REP items stands for space.
+Win32: Composing char appears on next position. (Tony Mechelynck)
+
+Support subdirectories in plugin directory?  (Nikolai Weibull)
+
+Change 'include' so that it can match the file name when \zs and \ze are
+included. (docs already done tentatively).
 
 ccomplete:
 - How to use a popup menu?
@@ -594,8 +592,7 @@ 7   Add an option to add one pixel colum
     Opposite of 'linespace': 'columnspace'.
 7   At the hit-enter prompt scrolling now no longer works.  Need to use the
     keyboard to get around this.  Pretend <CR> was hit when the user tries to
-    scroll?  Need to be able to get out of hit-enter prompt with the mouse
-    anyway.
+    scroll?
 7   Scrollbar width doesn't change when selecting other windows appearance.
     Also background color of Toolbar and rectangle below vert. scrollbar.
 7   "!start /min cmd" should run in a minimized window, instead of using
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2005 Sep 15
+*version7.txt*  For Vim version 7.0aa.  Last change: 2005 Sep 23
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -600,6 +600,9 @@ When 'verbose' is set the output of the 
 "1gd" can be used like "gd" but ignores matches in a {} block that ends before
 the cursor position.  Likewise for "1gD" and "gD".
 
+'scrolljump' can be set to a negative number to scroll a percentage of the
+window height.
+
 ==============================================================================
 IMPROVEMENTS						*improvements-7*
 
@@ -817,6 +820,9 @@ closing a fold with the mouse by clickin
 input() takes an optional completion argument to specify the type of
 completion supported for the input. (Yegappan Lakshmanan)
 
+"dp" works with more than two buffers in diff mode if there is only one where
+'modifiable' is set.
+
 ==============================================================================
 COMPILE TIME CHANGES					*compile-changes-7*
 
--- a/runtime/spell/en/en_US.diff
+++ b/runtime/spell/en/en_US.diff
@@ -195,7 +195,7 @@
 + REP an_a a
 + REP a_an an
 *** en_US.orig.dic	Fri Apr 15 13:20:36 2005
---- en_US.dic	Tue Aug 16 17:03:31 2005
+--- en_US.dic	Wed Sep 21 11:36:06 2005
 ***************
 *** 5944,5946 ****
   bk
@@ -565,12 +565,16 @@
   Zubenelgenubi/M
 ***************
 *** 62077 ****
---- 62077,62084 ----
+--- 62077,62088 ----
   zymurgy/S
 + nd
 + the the/!
 + a a/!
++ an an/!
 + a an/!
 + an a/!
-+ an an/!
++ the a/!
++ the an/!
++ a the/!
++ an the/!
 + PayPal
--- a/src/eval.c
+++ b/src/eval.c
@@ -409,7 +409,8 @@ static listitem_T *list_find __ARGS((lis
 static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
 static void list_append __ARGS((list_T *l, listitem_T *item));
 static int list_append_tv __ARGS((list_T *l, typval_T *tv));
-static int list_append_string __ARGS((list_T *l, char_u *str));
+static int list_append_string __ARGS((list_T *l, char_u *str, int len));
+static int list_append_number __ARGS((list_T *l, varnumber_T n));
 static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
 static int list_extend __ARGS((list_T	*l1, list_T *l2, listitem_T *bef));
 static int list_concat __ARGS((list_T *l1, list_T *l2, typval_T *tv));
@@ -2551,7 +2552,6 @@ set_var_lval(lp, endp, rettv, copy, op)
     char_u	*op;
 {
     int		cc;
-    listitem_T	*ni;
     listitem_T	*ri;
     dictitem_T	*di;
 
@@ -2603,16 +2603,11 @@ set_var_lval(lp, endp, rettv, copy, op)
 	    if (lp->ll_li->li_next == NULL)
 	    {
 		/* Need to add an empty item. */
-		ni = listitem_alloc();
-		if (ni == NULL)
+		if (list_append_number(lp->ll_list, 0) == FAIL)
 		{
 		    ri = NULL;
 		    break;
 		}
-		ni->li_tv.v_type = VAR_NUMBER;
-		ni->li_tv.v_lock = 0;
-		ni->li_tv.vval.v_number = 0;
-		list_append(lp->ll_list, ni);
 	    }
 	    lp->ll_li = lp->ll_li->li_next;
 	    ++lp->ll_n1;
@@ -3598,6 +3593,7 @@ typedef enum
  * Handle zero level expression.
  * This calls eval1() and handles error message and nextcmd.
  * Put the result in "rettv" when returning OK and "evaluate" is TRUE.
+ * Note: "rettv.v_lock" is not set.
  * Return OK or FAIL.
  */
     static int
@@ -3638,6 +3634,8 @@ eval0(arg, rettv, nextcmd, evaluate)
  * "arg" must point to the first non-white of the expression.
  * "arg" is advanced to the next non-white after the recognized expression.
  *
+ * Note: "rettv.v_lock" is not set.
+ *
  * Return OK or FAIL.
  */
     static int
@@ -5557,12 +5555,14 @@ list_append_dict(list, dict)
 
 /*
  * Make a copy of "str" and append it as an item to list "l".
+ * When "len" >= 0 use "str[len]".
  * Returns FAIL when out of memory.
  */
     static int
-list_append_string(l, str)
+list_append_string(l, str, len)
     list_T	*l;
     char_u	*str;
+    int		len;
 {
     listitem_T *li = listitem_alloc();
 
@@ -5571,12 +5571,34 @@ list_append_string(l, str)
     list_append(l, li);
     li->li_tv.v_type = VAR_STRING;
     li->li_tv.v_lock = 0;
-    if ((li->li_tv.vval.v_string = vim_strsave(str)) == NULL)
+    if ((li->li_tv.vval.v_string = len >= 0 ? vim_strnsave(str, len)
+						  : vim_strsave(str)) == NULL)
 	return FAIL;
     return OK;
 }
 
 /*
+ * Append "n" to list "l".
+ * Returns FAIL when out of memory.
+ */
+    static int
+list_append_number(l, n)
+    list_T	*l;
+    varnumber_T	n;
+{
+    listitem_T	*li;
+
+    li = listitem_alloc();
+    if (li == NULL)
+	return FAIL;
+    li->li_tv.v_type = VAR_NUMBER;
+    li->li_tv.v_lock = 0;
+    li->li_tv.vval.v_number = n;
+    list_append(l, li);
+    return OK;
+}
+
+/*
  * Insert typval_T "tv" in list "l" before "item".
  * If "item" is NULL append at the end.
  * Return FAIL when out of memory.
@@ -6864,7 +6886,7 @@ static struct fst
     {"simplify",	1, 1, f_simplify},
     {"sort",		1, 2, f_sort},
     {"soundfold",	1, 1, f_soundfold},
-    {"spellbadword",	0, 0, f_spellbadword},
+    {"spellbadword",	0, 1, f_spellbadword},
     {"spellsuggest",	1, 2, f_spellsuggest},
     {"split",		1, 3, f_split},
 #ifdef HAVE_STRFTIME
@@ -8842,6 +8864,7 @@ filter_map_one(tv, expr, map, remp)
     {
 	/* map(): replace the list item value */
 	clear_tv(tv);
+	rettv.v_lock = 0;
 	*tv = rettv;
     }
     else
@@ -9261,7 +9284,8 @@ get_buffer_lines(buf, start, end, retlis
 	if (end > buf->b_ml.ml_line_count)
 	    end = buf->b_ml.ml_line_count;
 	while (start <= end)
-	    if (list_append_string(l, ml_get_buf(buf, start++, FALSE)) == FAIL)
+	    if (list_append_string(l, ml_get_buf(buf, start++, FALSE), -1)
+								      == FAIL)
 		break;
     }
 }
@@ -10855,25 +10879,25 @@ f_input(argvars, rettv)
 	    defstr = get_tv_string_buf_chk(&argvars[1], buf);
 	    if (defstr != NULL)
 		stuffReadbuffSpec(defstr);
-	}
-
-	if (argvars[2].v_type != VAR_UNKNOWN)
-	{
-	    char_u	*xp_name;
-	    int		xp_namelen;
-	    long	argt;
-
-	    rettv->vval.v_string = NULL;
-
-	    xp_name = get_tv_string_buf_chk(&argvars[2], buf);
-	    if (xp_name == NULL)
-		return;
-
-	    xp_namelen = STRLEN(xp_name);
-
-	    if (parse_compl_arg(xp_name, xp_namelen, &xp_type, &argt, &xp_arg)
-								      == FAIL)
-		return;
+
+	    if (argvars[2].v_type != VAR_UNKNOWN)
+	    {
+		char_u	*xp_name;
+		int		xp_namelen;
+		long	argt;
+
+		rettv->vval.v_string = NULL;
+
+		xp_name = get_tv_string_buf_chk(&argvars[2], buf);
+		if (xp_name == NULL)
+		    return;
+
+		xp_namelen = STRLEN(xp_name);
+
+		if (parse_compl_arg(xp_name, xp_namelen, &xp_type, &argt,
+							     &xp_arg) == FAIL)
+		    return;
+	    }
 	}
 
 	if (defstr != NULL)
@@ -11713,14 +11737,11 @@ find_some_match(argvars, rettv, type)
 		{
 		    if (regmatch.endp[i] == NULL)
 			break;
-		    li = listitem_alloc();
-		    if (li == NULL)
+		    if (list_append_string(rettv->vval.v_list,
+				regmatch.startp[i],
+				(int)(regmatch.endp[i] - regmatch.startp[i]))
+			    == FAIL)
 			break;
-		    li->li_tv.v_type = VAR_STRING;
-		    li->li_tv.v_lock = 0;
-		    li->li_tv.vval.v_string = vim_strnsave(regmatch.startp[i],
-				(int)(regmatch.endp[i] - regmatch.startp[i]));
-		    list_append(rettv->vval.v_list, li);
 		}
 	    }
 	    else if (type == 2)
@@ -12112,7 +12133,6 @@ f_range(argvars, rettv)
     long	stride = 1;
     long	i;
     list_T	*l;
-    listitem_T	*li;
     int		error = FALSE;
 
     start = get_tv_number_chk(&argvars[0], &error);
@@ -12145,15 +12165,8 @@ f_range(argvars, rettv)
 	    ++l->lv_refcount;
 
 	    for (i = start; stride > 0 ? i <= end : i >= end; i += stride)
-	    {
-		li = listitem_alloc();
-		if (li == NULL)
+		if (list_append_number(l, (varnumber_T)i) == FAIL)
 		    break;
-		li->li_tv.v_type = VAR_NUMBER;
-		li->li_tv.v_lock = 0;
-		li->li_tv.vval.v_number = i;
-		list_append(l, li);
-	    }
 	}
     }
 }
@@ -13887,17 +13900,57 @@ f_spellbadword(argvars, rettv)
     typval_T	*argvars;
     typval_T	*rettv;
 {
+    char_u	*word = (char_u *)"";
+#ifdef FEAT_SYN_HL
     int		len;
-
-    rettv->vval.v_string = NULL;
-    rettv->v_type = VAR_STRING;
+    int		attr = 0;
+    list_T	*l;
+#endif
+
+    l = list_alloc();
+    if (l == NULL)
+	return;
+    rettv->v_type = VAR_LIST;
+    rettv->vval.v_list = l;
+    ++l->lv_refcount;
 
 #ifdef FEAT_SYN_HL
-    /* Find the start and length of the badly spelled word. */
-    len = spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL);
-    if (len != 0)
-	rettv->vval.v_string = vim_strnsave(ml_get_cursor(), len);
-#endif
+    if (argvars[0].v_type == VAR_UNKNOWN)
+    {
+	/* Find the start and length of the badly spelled word. */
+	len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr);
+	if (len != 0)
+	    word = ml_get_cursor();
+    }
+    else if (curwin->w_p_spell && *curbuf->b_p_spl != NUL)
+    {
+	char_u	*str = get_tv_string_chk(&argvars[0]);
+	int	capcol = -1;
+
+	if (str != NULL)
+	{
+	    /* Check the argument for spelling. */
+	    while (*str != NUL)
+	    {
+		len = spell_check(curwin, str, &attr, &capcol);
+		if (attr != 0)
+		{
+		    word = str;
+		    break;
+		}
+		str += len;
+	    }
+	}
+    }
+#endif
+
+    list_append_string(l, word, len);
+    list_append_string(l, (char_u *)(
+		    attr == highlight_attr[HLF_SPB] ? "bad" :
+		    attr == highlight_attr[HLF_SPR] ? "rare" :
+		    attr == highlight_attr[HLF_SPL] ? "local" :
+		    attr == highlight_attr[HLF_SPC] ? "caps" :
+		    ""), -1);
 }
 
 /*
@@ -13969,7 +14022,6 @@ f_split(argvars, rettv)
     char_u	patbuf[NUMBUFLEN];
     char_u	*save_cpo;
     int		match;
-    listitem_T	*ni;
     list_T	*l;
     colnr_T	col = 0;
     int		keepempty = FALSE;
@@ -14017,13 +14069,8 @@ f_split(argvars, rettv)
 	    if (keepempty || end > str || (l->lv_len > 0 && *str != NUL
 					  && match && end < regmatch.endp[0]))
 	    {
-		ni = listitem_alloc();
-		if (ni == NULL)
+		if (list_append_string(l, str, (int)(end - str)) == FAIL)
 		    break;
-		ni->li_tv.v_type = VAR_STRING;
-		ni->li_tv.v_lock = 0;
-		ni->li_tv.vval.v_string = vim_strnsave(str, end - str);
-		list_append(l, ni);
 	    }
 	    if (!match)
 		break;
@@ -14583,7 +14630,7 @@ f_tagfiles(argvars, rettv)
     get_tagfname(TRUE, NULL);
     for (;;)
 	if (get_tagfname(FALSE, fname) == FAIL
-		|| list_append_string(l, fname) == FAIL)
+		|| list_append_string(l, fname, -1) == FAIL)
 	    break;
 }
 
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4520,6 +4520,14 @@ do_sub(eap)
 		sublen = vim_regsub_multi(&regmatch, sub_firstlnum,
 				    sub, sub_firstline, FALSE, p_magic, TRUE);
 
+		/* When the match included the "$" of the last line it may
+		 * include one line too much. */
+		if (nmatch > curbuf->b_ml.ml_line_count - sub_firstlnum + 1)
+		{
+		    nmatch = curbuf->b_ml.ml_line_count - sub_firstlnum + 1;
+		    skip_match = TRUE;
+		}
+
 		/* Need room for:
 		 * - result so far in new_start (not for first sub in line)
 		 * - original text up to match
--- a/src/menu.c
+++ b/src/menu.c
@@ -2109,7 +2109,11 @@ ex_emenu(eap)
 
     /* Found the menu, so execute.
      * Use the Insert mode entry when returning to Insert mode. */
-    if (restart_edit && !current_SID)
+    if (restart_edit
+#ifdef FEAT_EVAL
+	    && !current_SID
+#endif
+	    )
     {
 	mode = (char_u *)"Insert";
 	idx = MENU_INDEX_INSERT;
@@ -2168,10 +2172,12 @@ ex_emenu(eap)
     {
 	/* When executing a script or function execute the commands right now.
 	 * Otherwise put them in the typeahead buffer. */
+#ifdef FEAT_En
 	if (current_SID != 0)
 	    exec_normal_cmd(menu->strings[idx], menu->noremap[idx],
 							   menu->silent[idx]);
 	else
+#endif
 	    ins_typebuf(menu->strings[idx], menu->noremap[idx], 0,
 						     TRUE, menu->silent[idx]);
     }
--- a/src/testdir/test58.in
+++ b/src/testdir/test58.in
@@ -29,7 +29,7 @@ STARTTEST
   normal 0f:]s
   let prevbad = ''
   while 1
-    let bad = spellbadword()
+    let [bad, a] = spellbadword()
     if bad == '' || bad == prevbad || bad == 'badend'
       break
     endif
@@ -60,31 +60,31 @@ gg:/^addstart/+1,/^addend/-1w! Xtest.lat
 :mkspell! Xtest.latin1.add.spl Xtest.latin1.add
 :set spellfile=Xtest.latin1.add
 /^test2:
-]s:let str = spellbadword()
+]s:let [str, a] = spellbadword()
 :$put =str
 :set spl=Xtest_us.latin1.spl
 /^test2:
-]smm:let str = spellbadword()
+]smm:let [str, a] = spellbadword()
 :$put =str
-`m]s:let str = spellbadword()
+`m]s:let [str, a] = spellbadword()
 :$put =str
 :set spl=Xtest_gb.latin1.spl
 /^test2:
-]smm:let str = spellbadword()
+]smm:let [str, a] = spellbadword()
 :$put =str
-`m]s:let str = spellbadword()
+`m]s:let [str, a] = spellbadword()
 :$put =str
 :set spl=Xtest_nz.latin1.spl
 /^test2:
-]smm:let str = spellbadword()
+]smm:let [str, a] = spellbadword()
 :$put =str
-`m]s:let str = spellbadword()
+`m]s:let [str, a] = spellbadword()
 :$put =str
 :set spl=Xtest_ca.latin1.spl
 /^test2:
-]smm:let str = spellbadword()
+]smm:let [str, a] = spellbadword()
 :$put =str
-`m]s:let str = spellbadword()
+`m]s:let [str, a] = spellbadword()
 :$put =str
 :"
 :" Postponed prefixes