changeset 539:b13dbb7b797c

updated for version 7.0153
author vimboss
date Mon, 03 Oct 2005 21:52:09 +0000
parents aa6caa23a4b8
children 2df7f3a5eb96
files runtime/autoload/csscomplete.vim runtime/doc/message.txt runtime/optwin.vim runtime/spell/fr/main.aap src/Make_bc5.mak src/Make_ivc.mak src/Make_mvc.mak src/main.aap src/message.c src/normal.c src/proto.h src/spell.c src/vim.h
diffstat 13 files changed, 130 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/autoload/csscomplete.vim
+++ b/runtime/autoload/csscomplete.vim
@@ -1,7 +1,7 @@
 " Vim completion script
 " Language:	CSS 2.1
 " Maintainer:	Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change:	2005 Sep 27
+" Last Change:	2005 Oct 02
 
 function! csscomplete#CompleteCSS(findstart, base)
 if a:findstart
@@ -179,7 +179,7 @@ else
 		elseif prop == 'font-family'
 			let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"]
 		elseif prop == 'font-size'
-			return []
+			 let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"]
 		elseif prop == 'font-style'
 			let values = ["normal", "italic", "oblique"]
 		elseif prop == 'font-variant'
@@ -187,7 +187,7 @@ else
 		elseif prop == 'font-weight'
 			let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"]
 		elseif prop == 'font'
-			let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "sans-serif", "serif", "monospace", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"]
+			let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller", "sans-serif", "serif", "monospace", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"]
 		elseif prop =~ '^\(height\|width\)$'
 			let values = ["auto"]
 		elseif prop =~ '^\(left\|rigth\)$'
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -1,4 +1,4 @@
-*message.txt*   For Vim version 7.0aa.  Last change: 2005 Sep 25
+*message.txt*   For Vim version 7.0aa.  Last change: 2005 Oct 02
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -768,6 +768,9 @@ To reduce the number of hit-enter prompt
 - Add flags to 'shortmess'.
 - Reset 'showcmd' and/or 'ruler'.
 
+If your script causes the hit-enter prompt and you don't know why, you may
+find the |v:scrollstart| variable useful.
+
 Also see 'mouse'.  The hit-enter message is highlighted with the |hl-Question|
 group.
 
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
 " These commands create the option window.
 "
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2005 Sep 13
+" Last Change:	2005 Oct 02
 
 " If there already is an option window, jump to that one.
 if bufwinnr("option-window") > 0
@@ -698,9 +698,11 @@ call append("$", "formatlistpat\tpattern
 call append("$", "\t(local to buffer)")
 call <SID>OptionL("flp")
 if has("insert_expand")
-  call append("$", "complete\tspecifies how Insert mode completion works")
+  call append("$", "complete\tspecifies how Insert mode completion works for CTRL-N and CTRL-P")
   call append("$", "\t(local to buffer)")
   call <SID>OptionL("cpt")
+  call append("$", "completeopt\twhether to use a popup menu for Insert mode completion")
+  call <SID>OptionG("cot", &cot)
   call append("$", "completefunc\tuser defined function for Insert mode completion")
   call append("$", "\t(local to buffer)")
   call <SID>OptionL("cfu")
--- a/runtime/spell/fr/main.aap
+++ b/runtime/spell/fr/main.aap
@@ -19,7 +19,7 @@ all: $SPELLDIR/fr.latin1.spl $SPELLDIR/f
         :sys env LANG=fr_FR.UTF-8
 		$VIM -u NONE -e -c "mkspell! $SPELLDIR/fr fr_FR" -c q
 
-../README_fr.txt : README_fr_FR.txt lisez-moi.txt
+../README_fr.txt : README_fr_FR.txt
         :cat $source >!$target
 
 #
--- a/src/Make_bc5.mak
+++ b/src/Make_bc5.mak
@@ -561,6 +561,7 @@ vimobj =  \
 	$(OBJDIR)\normal.obj \
 	$(OBJDIR)\ops.obj \
 	$(OBJDIR)\option.obj \
+	$(OBJDIR)\popupmenu.obj \
 	$(OBJDIR)\quickfix.obj \
 	$(OBJDIR)\regexp.obj \
 	$(OBJDIR)\screen.obj \
--- a/src/Make_ivc.mak
+++ b/src/Make_ivc.mak
@@ -241,6 +241,7 @@ LINK32_OBJS= \
 	"$(INTDIR)/option.obj" \
 	"$(INTDIR)/os_mswin.obj" \
 	"$(INTDIR)/os_win32.obj" \
+	"$(INTDIR)/popupmenu.obj" \
 	"$(INTDIR)/quickfix.obj" \
 	"$(INTDIR)/regexp.obj" \
 	"$(INTDIR)/screen.obj" \
@@ -597,6 +598,10 @@ SOURCE=.\os_win32.c
 # End Source File
 # Begin Source File
 
+SOURCE=.\popupmenu.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\quickfix.c
 # End Source File
 # Begin Source File
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -402,6 +402,7 @@ OBJ = \
 	$(OUTDIR)\os_mswin.obj \
 	$(OUTDIR)\os_win32.obj \
 	$(OUTDIR)\pathdef.obj \
+	$(OUTDIR)\popupmenu.obj \
 	$(OUTDIR)\quickfix.obj \
 	$(OUTDIR)\regexp.obj \
 	$(OUTDIR)\screen.obj \
@@ -896,6 +897,8 @@ if_perl.c : if_perl.xs typemap
 $(OUTDIR)/pathdef.obj:	$(OUTDIR) auto/pathdef.c  $(INCL)
 	$(CC) $(CFLAGS) auto/pathdef.c
 
+$(OUTDIR)/popupmenu.obj:	$(OUTDIR) popupmenu.c  $(INCL)
+
 $(OUTDIR)/quickfix.obj:	$(OUTDIR) quickfix.c  $(INCL)
 
 $(OUTDIR)/regexp.obj:	$(OUTDIR) regexp.c  $(INCL)
@@ -986,6 +989,7 @@ proto.h: \
 	proto/option.pro \
 	proto/os_mswin.pro \
 	proto/os_win32.pro \
+	proto/popupmenu.pro \
 	proto/quickfix.pro \
 	proto/regexp.pro \
 	proto/screen.pro \
--- a/src/main.aap
+++ b/src/main.aap
@@ -256,6 +256,7 @@ Source =
         option.c
         os_unix.c
         auto/pathdef.c
+        popupmenu.c
         quickfix.c
         regexp.c
         screen.c
--- a/src/message.c
+++ b/src/message.c
@@ -27,6 +27,7 @@ static char_u *screen_puts_mbyte __ARGS(
 static void msg_puts_attr_len __ARGS((char_u *str, int maxlen, int attr));
 static void msg_puts_display __ARGS((char_u *str, int maxlen, int attr, int recurse));
 static void msg_scroll_up __ARGS((void));
+static void inc_msg_scrolled __ARGS((void));
 static void store_sb_text __ARGS((char_u **sb_str, char_u *s, int attr, int *sb_col, int finish));
 static void t_puts __ARGS((int *t_col, char_u *t_s, char_u *s, int attr));
 static void msg_puts_printf __ARGS((char_u *str, int maxlen));
@@ -207,7 +208,7 @@ msg_strtrunc(s, force)
 			       && !exmode_active && msg_silent == 0) || force)
     {
 	len = vim_strsize(s);
-	if (msg_scrolled)
+	if (msg_scrolled != 0)
 	    /* Use all the columns. */
 	    room = (int)(Rows - msg_row) * Columns - 1;
 	else
@@ -634,7 +635,7 @@ emsg(s)
     emsg_on_display = TRUE;	/* remember there is an error message */
     ++msg_scroll;		/* don't overwrite a previous message */
     attr = hl_attr(HLF_E);	/* set highlight mode for error messages */
-    if (msg_scrolled)
+    if (msg_scrolled != 0)
 	need_wait_return = TRUE;    /* needed in case emsg() is called after
 				     * wait_return has reset need_wait_return
 				     * and a redraw is expected because
@@ -1762,7 +1763,7 @@ msg_puts_attr_len(str, maxlen, attr)
      * need_wait_return after some prompt, and then outputting something
      * without scrolling
      */
-    if (msg_scrolled && !msg_scrolled_ign)
+    if (msg_scrolled != 0 && !msg_scrolled_ign)
 	need_wait_return = TRUE;
     msg_didany = TRUE;		/* remember that something was outputted */
 
@@ -1875,7 +1876,7 @@ msg_puts_display(str, maxlen, attr, recu
 		/* store text for scrolling back */
 		store_sb_text(&sb_str, s, attr, &sb_col, TRUE);
 
-	    ++msg_scrolled;
+	    inc_msg_scrolled();
 	    need_wait_return = TRUE; /* may need wait_return in main() */
 	    if (must_redraw < VALID)
 		must_redraw = VALID;
@@ -1899,6 +1900,15 @@ msg_puts_display(str, maxlen, attr, recu
 		if (quit_more)
 		    return;
 	    }
+
+	    /* When we displayed a char in last column need to check if there
+	     * is still more. */
+	    if (*s >= ' '
+#ifdef FEAT_RIGHTLEFT
+		    && !cmdmsg_rl
+#endif
+	       )
+		continue;
 	}
 
 	wrap = *s == '\n'
@@ -2044,6 +2054,41 @@ msg_scroll_up()
 }
 
 /*
+ * Increment "msg_scrolled".
+ */
+    static void
+inc_msg_scrolled()
+{
+#ifdef FEAT_EVAL
+    if (*get_vim_var_str(VV_SCROLLSTART) == NUL)
+    {
+	char_u	    *p = sourcing_name;
+	char_u	    *tofree = NULL;
+	int	    len;
+
+	/* v:scrollstart is empty, set it to the script/function name and line
+	 * number */
+	if (p == NULL)
+	    p = (char_u *)_("Unknown");
+	else
+	{
+	    len = STRLEN(p) + 40;
+	    tofree = alloc(len);
+	    if (tofree != NULL)
+	    {
+		vim_snprintf((char *)tofree, len, _("%s line %ld"),
+						      p, (long)sourcing_lnum);
+		p = tofree;
+	    }
+	}
+	set_vim_var_string(VV_SCROLLSTART, p, -1);
+	vim_free(tofree);
+    }
+#endif
+    ++msg_scrolled;
+}
+
+/*
  * To be able to scroll back at the "more" and "hit-enter" prompts we need to
  * store the displayed text and remember where screen lines start.
  */
@@ -2527,7 +2572,7 @@ do_more_prompt(typed_char)
 		{
 		    /* scroll up, display line at bottom */
 		    msg_scroll_up();
-		    ++msg_scrolled;
+		    inc_msg_scrolled();
 		    screen_fill((int)Rows - 2, (int)Rows - 1, 0,
 						   (int)Columns, ' ', ' ', 0);
 		    mp_last = disp_sb_line((int)Rows - 2, mp_last);
--- a/src/normal.c
+++ b/src/normal.c
@@ -3984,14 +3984,15 @@ find_decl(ptr, len, locally, thisblock, 
     {
 	setpcmark();			/* Set in findpar() otherwise */
 	curwin->w_cursor.lnum = 1;
+	par_pos = curwin->w_cursor;
     }
     else
     {
+	par_pos = curwin->w_cursor;
 	while (curwin->w_cursor.lnum > 1 && *skipwhite(ml_get_curline()) != NUL)
 	    --curwin->w_cursor.lnum;
     }
     curwin->w_cursor.col = 0;
-    par_pos = curwin->w_cursor;
 
     /* Search forward for the identifier, ignore comment lines. */
     found_pos.lnum = 0;
--- a/src/proto.h
+++ b/src/proto.h
@@ -143,6 +143,7 @@ void qsort __ARGS((void *base, size_t el
 # include "normal.pro"
 # include "ops.pro"
 # include "option.pro"
+# include "popupmenu.pro"
 # include "quickfix.pro"
 # include "regexp.pro"
 # include "screen.pro"
@@ -243,7 +244,7 @@ extern char *vim_SelFile __ARGS((Widget 
 # endif
 
 /*
- * The perl include files pollute the namespace, therfore proto.h must be
+ * The perl include files pollute the namespace, therefore proto.h must be
  * included before the perl include files.  But then CV is not defined, which
  * is used in if_perl.pro.  To get around this, the perl prototype files are
  * not included here for the perl files.  Use a dummy define for CV for the
--- a/src/spell.c
+++ b/src/spell.c
@@ -10035,19 +10035,38 @@ suggest_try_change(su)
 		    sp->ts_state = STATE_FINAL;
 		    break;
 		}
+
+		/* Don't swap if the first character is not a word character.
+		 * SWAP3 etc. also don't make sense then. */
+		if (!spell_iswordp(p, curbuf))
+		{
+		    sp->ts_state = STATE_REP_INI;
+		    break;
+		}
+
 #ifdef FEAT_MBYTE
 		if (has_mbyte)
 		{
 		    n = mb_cptr2len(p);
 		    c = mb_ptr2char(p);
-		    c2 = mb_ptr2char(p + n);
+		    if (!spell_iswordp(p + n, curbuf))
+			c2 = c; /* don't swap non-word char */
+		    else
+			c2 = mb_ptr2char(p + n);
 		}
 		else
 #endif
-		    c2 = p[1];
+		{
+		    if (!spell_iswordp(p + 1, curbuf))
+			c2 = c; /* don't swap non-word char */
+		    else
+			c2 = p[1];
+		}
+
+		/* When characters are identical, swap won't do anything.
+		 * Also get here if the second char is not a word character. */
 		if (c == c2)
 		{
-		    /* Characters are identical, swap won't do anything. */
 		    sp->ts_state = STATE_SWAP3;
 		    break;
 		}
@@ -10107,20 +10126,28 @@ suggest_try_change(su)
 		    c = mb_ptr2char(p);
 		    fl = mb_cptr2len(p + n);
 		    c2 = mb_ptr2char(p + n);
-		    c3 = mb_ptr2char(p + n + fl);
+		    if (!spell_iswordp(p + n + fl, curbuf))
+			c3 = c;	/* don't swap non-word char */
+		    else
+			c3 = mb_ptr2char(p + n + fl);
 		}
 		else
 #endif
 		{
 		    c = *p;
 		    c2 = p[1];
-		    c3 = p[2];
+		    if (!spell_iswordp(p + 2, curbuf))
+			c3 = c;	/* don't swap non-word char */
+		    else
+			c3 = p[2];
 		}
 
 		/* When characters are identical: "121" then SWAP3 result is
 		 * identical, ROT3L result is same as SWAP: "211", ROT3L
 		 * result is same as SWAP on next char: "112".  Thus skip all
-		 * swapping.  Also skip when c3 is NUL.  */
+		 * swapping.  Also skip when c3 is NUL.
+		 * Also get here when the third character is not a word
+		 * character.  Second character may any char: "a.b" -> "b.a" */
 		if (c == c3 || c3 == NUL)
 		{
 		    sp->ts_state = STATE_REP_INI;
@@ -10165,6 +10192,7 @@ suggest_try_change(su)
 		    mch_memmove(p + fl + tl, p, n);
 		    mb_char2bytes(c, p);
 		    mb_char2bytes(c2, p + tl);
+		    p = p + tl;
 		}
 		else
 #endif
@@ -10172,6 +10200,16 @@ suggest_try_change(su)
 		    c = *p;
 		    *p = p[2];
 		    p[2] = c;
+		    ++p;
+		}
+
+		if (!spell_iswordp(p, curbuf))
+		{
+		    /* Middle char is not a word char, skip the rotate.
+		     * First and third char were already checked at swap
+		     * and swap3. */
+		    sp->ts_state = STATE_REP_INI;
+		    break;
 		}
 
 		/* Rotate three characters left: "123" -> "231".  We change
--- a/src/vim.h
+++ b/src/vim.h
@@ -1150,13 +1150,19 @@ typedef enum
     , HLF_SPC	    /* SpellCap */
     , HLF_SPR	    /* SpellRare */
     , HLF_SPL	    /* SpellLocal */
+    , HLF_PNI	    /* popup menu normal item */
+    , HLF_PSI	    /* popup menu selected item */
+    , HLF_PSB	    /* popup menu scrollbar */
+    , HLF_PST	    /* popup menu scrollbar thumb */
     , HLF_COUNT	    /* MUST be the last one */
 } hlf_T;
 
 /* the HL_FLAGS must be in the same order as the HLF_ enums! */
 #define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \
 		  'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
-		  'f', 'F', 'A', 'C', 'D', 'T', '>', 'B', 'P', 'R', 'L'}
+		  'f', 'F', 'A', 'C', 'D', 'T', '>', \
+		  'B', 'P', 'R', 'L', \
+		  '+', '=', 'x', 'X'}
 
 /*
  * Boolean constants
@@ -1566,7 +1572,8 @@ int vim_memcmp __ARGS((void *, void *, s
 #define VV_BEVAL_LNUM	41
 #define VV_BEVAL_COL	42
 #define VV_BEVAL_TEXT	43
-#define VV_LEN		44	/* number of v: vars */
+#define VV_SCROLLSTART	44
+#define VV_LEN		45	/* number of v: vars */
 
 #ifdef FEAT_CLIPBOARD