changeset 701:4cf1c5977c35

updated for version 7.0212
author vimboss
date Thu, 02 Mar 2006 22:40:52 +0000
parents c78d973dce9e
children 8a99b25de218
files runtime/doc/Makefile runtime/doc/os_vms.txt src/INSTALLvms.txt src/buffer.c src/spell.c
diffstat 5 files changed, 200 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/Makefile
+++ b/runtime/doc/Makefile
@@ -393,6 +393,7 @@ os_risc.txt:
 os_win32.txt:
 	touch os_win32.txt
 
+# Note that $< works with GNU make while $> works for BSD make.
 vim-fr.UTF-8.1: vim-fr.1
 	iconv -f latin1 -t utf-8 $< >$@
 
--- a/runtime/doc/os_vms.txt
+++ b/runtime/doc/os_vms.txt
@@ -1,4 +1,4 @@
-*os_vms.txt*    For Vim version 7.0aa.  Last change: 2005 Jul 12
+*os_vms.txt*    For Vim version 7.0aa.  Last change: 2006 Mar 02
 
 
 		  VIM REFERENCE MANUAL
@@ -56,11 +56,14 @@ To use the precompiled binary version, y
   vim-XX-exe-vax-gui.zip	VAX GUI executables
   vim-XX-exe-vax-term.zip       VAX console executables
 
-and of course
+and of course (optional)
   vim-XX-runtime.zip		runtime files
 
 The binary archives contain: vim.exe, ctags.exe, xxd.exe files.
 
+For GTK executables you will need GTKLIB that is available for 
+Alpha and IA64 platform.
+
 ==============================================================================
 
 3. Compiling						*vms-compiling*
@@ -121,10 +124,10 @@ Vim uses a special directory structure t
     |- vim57
     |----- doc
     |----- syntax
-    |- vim60
+    |- vim62
     |----- doc
     |----- syntax
-    |- vim61
+    |- vim64
     |----- doc
     |----- syntax
     vimrc    (system rc files)
@@ -239,6 +242,17 @@ and to the SYS$STARTUP:SYLOGIN.COM >
 
 It will set up a normal Vim work environment for every user on the system.
 
+IMPORTANT: Vim on OpenVMS (and on other case insensitive system) command line
+parameters are assumed to be lowecase. In order to indicate that a command
+line parameter is uppercase "/" sign must be used.
+
+Examples:
+  >
+	vim -R  filename  ! means: -r List swap files and exit
+        vim -/r filename  ! means: -R Readonly mode (like "view")
+        vim -u  <vimrc>   ! means: -u Use <vimrc> instead of any .vimrc   
+        vim -/u <gvimrc>  ! means: -U Use <gvimrc> instead of any .gvimrc
+                  
 ==============================================================================
 
 7. GUI mode questions					*vms-gui*
@@ -653,7 +667,10 @@ start it with: >
 
 9. VMS related changes					*vms-changes*
 
-Version 7.0
+Version 7
+- Improved low level char input (affects just console mode)
+
+Version 6.4 (2005 Oct 15)
 - GTKLIB and Vim build on IA64
 - colors in terminal mode
 - syntax highlighting in terminal mode
--- a/src/INSTALLvms.txt
+++ b/src/INSTALLvms.txt
@@ -1,7 +1,7 @@
 INSTALLvms.txt - Installation of Vim on OpenVMS
 
 Maintainer:   Zoltan Arpadffy <arpadffy@polarhome.com>
-Last change:  2005 Jul 12
+Last change:  2006 Mar 02
 
 This file contains instructions for compiling Vim on Openvms.
 If you already have an executable version of Vim, you don't need this.
@@ -143,7 +143,6 @@ 2.2  Edit vim-X.X/src/Make_vms.mms to cu
 			  Uncommented - build without support.
 	Default		: Uncommented
 
-
 	Parameter name	: VIM_XIM
 	Description	: X Input Method. For entering special languages
 			  like chinese and Japanese. Please define just
@@ -304,9 +303,20 @@ 7.2  GTK
      You need also the OpenVMS Porting Library:
      http://www.openvms.compaq.com/openvms/products/ips/porting.html
 
+     Source code for GTK and porting library that is used to build 
+     VMS executables at polarhome.com are at
+     http://www.polarhome.com/vim/files/source/vms/
+
      Enable GTK in make_vms.mms file with GTK = YES
      Define GTK_ROOT that points to your GTK root directory.
 
+     You will need to edit GTKDIR variable in order to point
+     to GTK header files and libraries.
+
+     GTK_DIR  = ALPHA$DKA0:[GTK128.]
+
+     ".]" at the end is very important.
+
      Build it as normally.
 
      Used sharable images are:
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4454,12 +4454,16 @@ ex_buffer_all(eap)
 			? wp->w_height + wp->w_status_height < Rows - p_ch
 			: wp->w_width != Columns)
 #endif
+#ifdef FEAT_WINDOWS
+		    || (had_tab > 0 && wp != firstwin)
+#endif
 		    )
 	    {
 		win_close(wp, FALSE);
 #ifdef FEAT_AUTOCMD
 		wpnext = firstwin;	/* just in case an autocommand does
 					   something strange with windows */
+		tpnext = first_tabpage;	/* start all over...*/
 		open_wins = 0;
 #endif
 	    }
@@ -4471,12 +4475,6 @@ ex_buffer_all(eap)
 	/* Without the ":tab" modifier only do the current tab page. */
 	if (had_tab == 0 || tpnext == NULL)
 	    break;
-
-# ifdef FEAT_AUTOCMD
-	/* check if autocommands removed the next tab page */
-	if (!valid_tabpage(tpnext))
-	    tpnext = first_tabpage;	/* start all over...*/
-# endif
 	goto_tabpage_tp(tpnext);
     }
 #endif
@@ -4500,14 +4498,28 @@ ex_buffer_all(eap)
 	if ((!all && buf->b_ml.ml_mfp == NULL) || !buf->b_p_bl)
 	    continue;
 
-	/* Check if this buffer already has a window */
-	for (wp = firstwin; wp != NULL; wp = wp->w_next)
-	    if (wp->w_buffer == buf)
-		break;
-	/* If the buffer already has a window, move it */
-	if (wp != NULL)
-	    win_move_after(wp, curwin);
-	else if (split_ret == OK)
+#ifdef FEAT_WINDOWS
+	if (had_tab != 0)
+	{
+	    /* With the ":tab" modifier don't move the window. */
+	    if (buf->b_nwindows > 0)
+		wp = lastwin;	    /* buffer has a window, skip it */
+	    else
+		wp = NULL;
+	}
+	else
+#endif
+	{
+	    /* Check if this buffer already has a window */
+	    for (wp = firstwin; wp != NULL; wp = wp->w_next)
+		if (wp->w_buffer == buf)
+		    break;
+	    /* If the buffer already has a window, move it */
+	    if (wp != NULL)
+		win_move_after(wp, curwin);
+	}
+
+	if (wp == NULL && split_ret == OK)
 	{
 	    /* Split the window and put the buffer in it */
 	    p_ea_save = p_ea;
--- a/src/spell.c
+++ b/src/spell.c
@@ -904,8 +904,8 @@ static int spell_edit_score_limit __ARGS
 #ifdef FEAT_MBYTE
 static int spell_edit_score_limit_w __ARGS((slang_T *slang, char_u *badword, char_u *goodword, int limit));
 #endif
-static void dump_word __ARGS((slang_T *slang, char_u *word, int round, int flags, linenr_T lnum));
-static linenr_T dump_prefixes __ARGS((slang_T *slang, char_u *word, int round, int flags, linenr_T startlnum));
+static void dump_word __ARGS((slang_T *slang, char_u *word, char_u *pat, int *dir, int round, int flags, linenr_T lnum));
+static linenr_T dump_prefixes __ARGS((slang_T *slang, char_u *word, char_u *pat, int *dir, int round, int flags, linenr_T startlnum));
 static buf_T *open_spellbuf __ARGS((void));
 static void close_spellbuf __ARGS((buf_T *buf));
 
@@ -14808,16 +14808,48 @@ pop:
 
 #define DUMPFLAG_KEEPCASE   1	/* round 2: keep-case tree */
 #define DUMPFLAG_COUNT	    2	/* include word count */
+#define DUMPFLAG_ICASE	    4	/* ignore case when finding matches */
 
 /*
  * ":spelldump"
  */
-/*ARGSUSED*/
     void
 ex_spelldump(eap)
     exarg_T *eap;
 {
     buf_T	*buf = curbuf;
+
+    if (no_spell_checking(curwin))
+	return;
+
+    /* Create a new empty buffer by splitting the window. */
+    do_cmdline_cmd((char_u *)"new");
+    if (!bufempty() || !buf_valid(buf))
+	return;
+
+    spell_dump_compl(buf, NULL, 0, NULL, eap->forceit ? DUMPFLAG_COUNT : 0);
+
+    /* Delete the empty line that we started with. */
+    if (curbuf->b_ml.ml_line_count > 1)
+	ml_delete(curbuf->b_ml.ml_line_count, FALSE);
+
+    redraw_later(NOT_VALID);
+}
+
+/*
+ * Go through all possible words and:
+ * 1. When "pat" is NULL: dump a list of all words in the current buffer.
+ *	"ic" and "dir" are not used.
+ * 2. When "pat" is not NULL: add matching words to insert mode completion.
+ */
+    void
+spell_dump_compl(buf, pat, ic, dir, dumpflags_arg)
+    buf_T	*buf;	    /* buffer with spell checking */
+    char_u	*pat;	    /* leading part of the word */
+    int		ic;	    /* ignore case */
+    int		*dir;	    /* direction for adding matches */
+    int		dumpflags_arg;	/* DUMPFLAG_* */
+{
     langp_T	*lp;
     slang_T	*slang;
     idx_T	arridx[MAXWLEN];
@@ -14835,15 +14867,11 @@ ex_spelldump(eap)
     int		do_region = TRUE;	    /* dump region names and numbers */
     char_u	*p;
     int		lpi;
-    int		dumpflags;
-
-    if (no_spell_checking(curwin))
-	return;
-
-    /* Create a new empty buffer by splitting the window. */
-    do_cmdline_cmd((char_u *)"new");
-    if (!bufempty() || !buf_valid(buf))
-	return;
+    int		dumpflags = dumpflags_arg;
+    int		patlen;
+
+    if (ic)
+	dumpflags |= DUMPFLAG_ICASE;
 
     /* Find out if we can support regions: All languages must support the same
      * regions or none at all. */
@@ -14865,8 +14893,11 @@ ex_spelldump(eap)
 
     if (do_region && region_names != NULL)
     {
-	vim_snprintf((char *)IObuff, IOSIZE, "/regions=%s", region_names);
-	ml_append(lnum++, IObuff, (colnr_T)0, FALSE);
+	if (pat == NULL)
+	{
+	    vim_snprintf((char *)IObuff, IOSIZE, "/regions=%s", region_names);
+	    ml_append(lnum++, IObuff, (colnr_T)0, FALSE);
+	}
     }
     else
 	do_region = FALSE;
@@ -14881,8 +14912,18 @@ ex_spelldump(eap)
 	if (slang->sl_fbyts == NULL)	    /* reloading failed */
 	    continue;
 
-	vim_snprintf((char *)IObuff, IOSIZE, "# file: %s", slang->sl_fname);
-	ml_append(lnum++, IObuff, (colnr_T)0, FALSE);
+	if (pat == NULL)
+	{
+	    vim_snprintf((char *)IObuff, IOSIZE, "# file: %s", slang->sl_fname);
+	    ml_append(lnum++, IObuff, (colnr_T)0, FALSE);
+	}
+
+	/* When matching with a pattern and there are no prefixes only use
+	 * parts of the tree that match "pat". */
+	if (pat != NULL && slang->sl_pbyts == NULL)
+	    patlen = STRLEN(pat);
+	else
+	    patlen = 0;
 
 	/* round 1: case-folded tree
 	 * round 2: keep-case tree */
@@ -14890,26 +14931,24 @@ ex_spelldump(eap)
 	{
 	    if (round == 1)
 	    {
-		dumpflags = 0;
+		dumpflags &= ~DUMPFLAG_KEEPCASE;
 		byts = slang->sl_fbyts;
 		idxs = slang->sl_fidxs;
 	    }
 	    else
 	    {
-		dumpflags = DUMPFLAG_KEEPCASE;
+		dumpflags |= DUMPFLAG_KEEPCASE;
 		byts = slang->sl_kbyts;
 		idxs = slang->sl_kidxs;
 	    }
 	    if (byts == NULL)
 		continue;		/* array is empty */
 
-	    if (eap->forceit)
-		dumpflags |= DUMPFLAG_COUNT;
-
 	    depth = 0;
 	    arridx[0] = 0;
 	    curi[0] = 1;
-	    while (depth >= 0 && !got_int)
+	    while (depth >= 0 && !got_int
+				       && (pat == NULL || !compl_interrupted))
 	    {
 		if (curi[depth] > byts[arridx[depth]])
 		{
@@ -14945,13 +14984,17 @@ ex_spelldump(eap)
 			     * when it's the first one. */
 			    c = (unsigned)flags >> 24;
 			    if (c == 0 || curi[depth] == 2)
-				dump_word(slang, word, dumpflags,
-							       flags, lnum++);
+			    {
+				dump_word(slang, word, pat, dir,
+						      dumpflags, flags, lnum);
+				if (pat == NULL)
+				    ++lnum;
+			    }
 
 			    /* Apply the prefix, if there is one. */
 			    if (c != 0)
-				lnum = dump_prefixes(slang, word, dumpflags,
-								 flags, lnum);
+				lnum = dump_prefixes(slang, word, pat, dir,
+						      dumpflags, flags, lnum);
 			}
 		    }
 		    else
@@ -14960,26 +15003,30 @@ ex_spelldump(eap)
 			word[depth++] = c;
 			arridx[depth] = idxs[n];
 			curi[depth] = 1;
+
+			/* Check if this characters matches with the pattern.
+			 * If not skip the whole tree below it.
+			 * TODO ignorecase
+			 * TODO: multi-byte */
+			if (depth <= patlen && STRNCMP(word, pat, depth) != 0)
+			    --depth;
 		    }
 		}
 	    }
 	}
     }
-
-    /* Delete the empty line that we started with. */
-    if (curbuf->b_ml.ml_line_count > 1)
-	ml_delete(curbuf->b_ml.ml_line_count, FALSE);
-
-    redraw_later(NOT_VALID);
 }
 
 /*
  * Dump one word: apply case modifications and append a line to the buffer.
- */
-    static void
-dump_word(slang, word, dumpflags, flags, lnum)
+ * When "lnum" is zero add insert mode completion.
+ */
+    static void
+dump_word(slang, word, pat, dir, dumpflags, flags, lnum)
     slang_T	*slang;
     char_u	*word;
+    char_u	*pat;
+    int		*dir;
     int		dumpflags;
     int		flags;
     linenr_T	lnum;
@@ -15007,50 +15054,66 @@ dump_word(slang, word, dumpflags, flags,
     }
     tw = p;
 
-    /* Add flags and regions after a slash. */
-    if ((flags & (WF_BANNED | WF_RARE | WF_REGION)) || keepcap)
-    {
-	STRCPY(badword, p);
-	STRCAT(badword, "/");
-	if (keepcap)
-	    STRCAT(badword, "=");
-	if (flags & WF_BANNED)
-	    STRCAT(badword, "!");
-	else if (flags & WF_RARE)
-	    STRCAT(badword, "?");
-	if (flags & WF_REGION)
-	    for (i = 0; i < 7; ++i)
-		if (flags & (0x10000 << i))
-		    sprintf((char *)badword + STRLEN(badword), "%d", i + 1);
-	p = badword;
-    }
-
-    if (dumpflags & DUMPFLAG_COUNT)
-    {
-	hashitem_T  *hi;
-
-	/* Include the word count for ":spelldump!". */
-	hi = hash_find(&slang->sl_wordcount, tw);
-	if (!HASHITEM_EMPTY(hi))
-	{
-	    vim_snprintf((char *)IObuff, IOSIZE, "%s\t%d",
+    if (pat == NULL)
+    {
+	/* Add flags and regions after a slash. */
+	if ((flags & (WF_BANNED | WF_RARE | WF_REGION)) || keepcap)
+	{
+	    STRCPY(badword, p);
+	    STRCAT(badword, "/");
+	    if (keepcap)
+		STRCAT(badword, "=");
+	    if (flags & WF_BANNED)
+		STRCAT(badword, "!");
+	    else if (flags & WF_RARE)
+		STRCAT(badword, "?");
+	    if (flags & WF_REGION)
+		for (i = 0; i < 7; ++i)
+		    if (flags & (0x10000 << i))
+			sprintf((char *)badword + STRLEN(badword), "%d", i + 1);
+	    p = badword;
+	}
+
+	if (dumpflags & DUMPFLAG_COUNT)
+	{
+	    hashitem_T  *hi;
+
+	    /* Include the word count for ":spelldump!". */
+	    hi = hash_find(&slang->sl_wordcount, tw);
+	    if (!HASHITEM_EMPTY(hi))
+	    {
+		vim_snprintf((char *)IObuff, IOSIZE, "%s\t%d",
 						     tw, HI2WC(hi)->wc_count);
-	    p = IObuff;
-	}
-    }
-
-    ml_append(lnum, p, (colnr_T)0, FALSE);
+		p = IObuff;
+	    }
+	}
+
+	ml_append(lnum, p, (colnr_T)0, FALSE);
+    }
+    else
+    {
+	/* TODO: ignore case, multi-byte */
+	if (STRNCMP(p, pat, STRLEN(pat)) == 0
+		&& ins_compl_add_infercase(p, (int)STRLEN(p),
+					  dumpflags & DUMPFLAG_ICASE,
+					  NULL, *dir, 0) == OK)
+	    /* if dir was BACKWARD then honor it just once */
+	    *dir = FORWARD;
+    }
 }
 
 /*
  * For ":spelldump": Find matching prefixes for "word".  Prepend each to
  * "word" and append a line to the buffer.
+ * When "lnum" is zero add insert mode completion.
  * Return the updated line number.
  */
     static linenr_T
-dump_prefixes(slang, word, dumpflags, flags, startlnum)
+dump_prefixes(slang, word, pat, dir, dumpflags, flags, startlnum)
     slang_T	*slang;
     char_u	*word;	    /* case-folded word */
+    char_u	*pat;
+    int		*dir;
     int		dumpflags;
     int		flags;	    /* flags with prefix ID */
     linenr_T	startlnum;
@@ -15117,9 +15180,11 @@ dump_prefixes(slang, word, dumpflags, fl
 		    if (c != 0)
 		    {
 			vim_strncpy(prefix + depth, word, MAXWLEN - depth - 1);
-			dump_word(slang, prefix, dumpflags,
+			dump_word(slang, prefix, pat, dir, dumpflags,
 				(c & WF_RAREPFX) ? (flags | WF_RARE)
-							     : flags, lnum++);
+							       : flags, lnum);
+			if (lnum != 0)
+			    ++lnum;
 		    }
 
 		    /* Check for prefix that matches the word when the
@@ -15133,9 +15198,11 @@ dump_prefixes(slang, word, dumpflags, fl
 			{
 			    vim_strncpy(prefix + depth, word_up,
 							 MAXWLEN - depth - 1);
-			    dump_word(slang, prefix, dumpflags,
+			    dump_word(slang, prefix, pat, dir, dumpflags,
 				    (c & WF_RAREPFX) ? (flags | WF_RARE)
-							     : flags, lnum++);
+							       : flags, lnum);
+			    if (lnum != 0)
+				++lnum;
 			}
 		    }
 		}