changeset 294:1c1cbdc42f75 v7.0077

updated for version 7.0077
author vimboss
date Tue, 31 May 2005 22:22:17 +0000
parents f811be6fa9b5
children 0751d70bd137
files runtime/doc/starting.txt runtime/doc/todo.txt runtime/doc/various.txt runtime/doc/version7.txt runtime/syntax/logtalk.vim src/eval.c src/ex_cmds.c src/ex_cmds2.c src/gui_gtk_x11.c src/main.c src/option.c src/option.h src/proto/ex_cmds2.pro src/proto/hashtable.pro src/syntax.c src/testdir/Makefile src/testdir/test55.in src/ui.c
diffstat 18 files changed, 212 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -1,4 +1,4 @@
-*starting.txt*  For Vim version 7.0aa.  Last change: 2005 Apr 18
+*starting.txt*  For Vim version 7.0aa.  Last change: 2005 May 31
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -312,6 +312,11 @@ a slash.  Thus "-R" means recovery and "
 		for reading or writing a viminfo file.  Can be used to find
 		out what is happening upon startup and exit.  {not in Vi}
 
+-V[N]{filename}
+		Like -V and set 'verbosefile' to {filename}.  The result is
+		that messages are not displayed but written to the file
+		{filename}.  {filename} must not start with a digit.
+
 							*-D*
 -D		Debugging.  Go to debugging mode when executing the first
 		command from a script. |debug-mode|
@@ -706,6 +711,8 @@ 1. Set the 'shell' and 'term' option		*S
 2. Process the arguments
 	The options and file names from the command that start Vim are
 	inspected.  Buffers are created for all files (but not loaded yet).
+	The |-V| argument can be used to display or log what happens next,
+	useful for debugging the initializations.
 
 3. Execute Ex commands, from environment variables and/or files
 	An environment variable is read as one Ex command line, where multiple
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2005 May 25
+*todo.txt*      For Vim version 7.0aa.  Last change: 2005 May 31
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -30,28 +30,18 @@ be worked on, but only if you sponsor Vi
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
-GTK: Hang for "gvim </tmp/tt >&/tmp/ttt".  Ready to read char from stdin but
-it's never read.
-Namsh also has a problem with a hang, coming from the added char_avail() call.
-Temporary fix: check "gui.starting".
-
-Make option like 'verbose' that writes output into a file?  Should make it
-possible to see what's happening without messing up the display.
-
-Errors when compiling with Cygwin (Thomas).
-
-":sort n" sort on decimal number (skipping white space)
-":sort x" sort on hex number
-":sort o" sort on octal number
-Docs: doesn't work well together with :global.
-
-split(): splitting into chars doesn't work.
-
 ":qtag" command: make list of matching tags and use like quickfix list.
 This changes the stack of quickfix lists.  Make another list and use ":qnext",
 ":qprev", etc.?  Do allow other commands for quickfix list, such as quickfix
 window.
 
+Win32: Balloon text can't contain line break.
+    Hints for multiline tooltips from Alexei Alexandrov (2005 Mar 26)
+    Patch from Sergey Khorev, 2005 Apr 11
+    Add has("balloon_multiline")
+
+Patch in if_cscope.c also in 6.3?  (Froloff)
+
 Mac unicode patch (Da Woon Jung):
 - selecting proportional font breaks display
 - UTF-8 text causes display problems.  Font replacement causes this.
@@ -72,11 +62,6 @@ autoload:
     helpfile doc/myscript.txt
   For the "helpfile" item ":helptags" is run.
 
-Win32: Balloon text can't contain line break.
-    Hints for multiline tooltips from Alexei Alexandrov (2005 Mar 26)
-    Patch from Sergey Khorev, 2005 Apr 11
-    Add has("balloon_multiline")
-
 Patch to alternate fold highlighting.  (Anthony Iano-Fletcher, 2005 May 12)
 More levels?
 
@@ -121,7 +106,7 @@ PLANNED FOR VERSION 7.0:
 	add word to private dict: wrong and OK (in popup menu for evim)
 	    :spell good <word>	    zg
 	    :spell wrong <word>	    zw
-    - Update option window for 'spell' and 'spelllang'.
+    - Update option window for 'verbosefile', 'spell' and 'spelllang'.
     - Distribution: Need wordlists for many languages; "language pack"
       Put them on the ftp site, ready to download.  Include README for
       copyrights.
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt*   For Vim version 7.0aa.  Last change: 2005 Apr 01
+*various.txt*   For Vim version 7.0aa.  Last change: 2005 May 31
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -392,6 +392,8 @@ N  *+X11*		Unix only: can restore window
 			To stop the messages and commands from being echoed to
 			the screen, put the commands in a function and call it
 			with ":silent call Function()".
+			An alternative is to use the 'verbosefile' option,
+			this can be used in combination with ":redir".
 			{not in Vi}
 
 :redi[r] >> {file}	Redirect messages to file {file}.  Append if {file}
@@ -475,6 +477,8 @@ N  *+X11*		Unix only: can restore window
 				:4verbose set verbose | set verbose
 <				  verbose=4 ~
 				  verbose=0 ~
+			For logging verbose messages in a file use the
+			'verbosefile' option.
 
 							*K*
 K			Run a program to lookup the keyword under the
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2005 May 22
+*version7.txt*  For Vim version 7.0aa.  Last change: 2005 May 31
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -296,6 +296,7 @@ Options: ~
 			(idea by Hugo Haas)
 'spell'			switch spell checking on/off
 'spelllang'		languages to check spelling for
+'verbosefile'		Log messages in a file.
 
 
 Ex commands: ~
@@ -584,6 +585,10 @@ invalid characters after the register na
 
 ":redir @{a-z}>>" appends to register a to z.
 
+The 'verbosefile' option can be used to log messages in a file.  Verbose
+messages are not displayed then.  The "-V{filename}" argument can be used to
+log startup messages.
+
 ":let g:" lists global variables.
 ":let b:" lists buffer-local variables.
 ":let w:" lists window-local variables.
--- a/runtime/syntax/logtalk.vim
+++ b/runtime/syntax/logtalk.vim
@@ -2,7 +2,7 @@
 "
 " Language:	Logtalk
 " Maintainer:	Paulo Moura <pmoura@logtalk.org>
-" Last Change:	April 5, 2005
+" Last Change:	May 30, 2005
 
 
 " Quit when a syntax file was already loaded:
@@ -89,14 +89,10 @@ syn region	logtalkDir		matchgroup=logtal
 
 " Logtalk built-in predicates
 
-syn match	logtalkBuiltIn		"\<current_\(object\|protocol\|category\)\ze("
-
-syn match	logtalkBuiltIn		"\<create_\(object\|protocol\|category\)\ze("
+syn match	logtalkBuiltIn		"\<\(abolish\|c\(reate\|urrent\)\)_\(object\|protocol\|category\)\ze("
 
 syn match	logtalkBuiltIn		"\<\(object\|protocol\|category\)_property\ze("
 
-syn match	logtalkBuiltIn		"\<abolish_\(object\|protocol\|category\)\ze("
-
 syn match	logtalkBuiltIn		"\<extends_\(object\|protocol\)\ze("
 syn match	logtalkBuiltIn		"\<imp\(orts_category\|lements_protocol\)\ze("
 syn match	logtalkBuiltIn		"\<\(instantiates\|specializes\)_class\ze("
@@ -120,11 +116,9 @@ syn match	logtalkBuiltInMethod	"\<this\z
 syn match	logtalkBuiltInMethod	"\<current_predicate\ze("
 syn match	logtalkBuiltInMethod	"\<predicate_property\ze("
 
-syn match	logtalkBuiltInMethod	"\<abolish\ze("
-syn match	logtalkBuiltInMethod	"\<assert\(a\|z\)\ze("
+syn match	logtalkBuiltInMethod	"\<a\(bolish\|ssert\(a\|z\)\)\ze("
 syn match	logtalkBuiltInMethod	"\<clause\ze("
-syn match	logtalkBuiltInMethod	"\<retract\ze("
-syn match	logtalkBuiltInMethod	"\<retractall\ze("
+syn match	logtalkBuiltInMethod	"\<retract\(all\)\?\ze("
 
 syn match	logtalkBuiltInMethod	"\<\(bag\|set\)of\ze("
 syn match	logtalkBuiltInMethod	"\<f\(ind\|or\)all\ze("
@@ -165,10 +159,9 @@ syn match	logtalkOperator		"\\="
 " Term testing
 
 syn match	logtalkKeyword		"\<var\ze("
-syn match	logtalkKeyword		"\<atom\ze("
+syn match	logtalkKeyword		"\<atom\(ic\)\?\ze("
 syn match	logtalkKeyword		"\<integer\ze("
 syn match	logtalkKeyword		"\<float\ze("
-syn match	logtalkKeyword		"\<atomic\ze("
 syn match	logtalkKeyword		"\<compound\ze("
 syn match	logtalkKeyword		"\<n\(onvar\|umber\)\ze("
 
@@ -208,8 +201,7 @@ syn match	logtalkOperator		">="
 
 " Stream selection and control
 
-syn match	logtalkKeyword		"\<current_\(input\|output\)\ze("
-syn match	logtalkKeyword		"\<set_\(input\|output\)\ze("
+syn match	logtalkKeyword		"\<\(current\|set\)_\(in\|out\)put\ze("
 syn match	logtalkKeyword		"\<open\ze("
 syn match	logtalkKeyword		"\<close\ze("
 syn match	logtalkKeyword		"\<flush_output\ze("
@@ -222,22 +214,17 @@ syn match	logtalkKeyword		"\<set_stream_
 
 " Character and byte input/output
 
-syn match	logtalkKeyword		"\<\(get\|peek\|put\)_\(char\|code\|byte\)\ze("
+syn match	logtalkKeyword		"\<\(get\|p\(eek\|ut\)\)_\(c\(har\|ode\)\|byte\)\ze("
 syn match	logtalkKeyword		"\<nl\ze("
 syn match	logtalkKeyword		"\<nl\>"
 
 
 " Term input/output
 
-syn match	logtalkKeyword		"\<read_term\ze("
-syn match	logtalkKeyword		"\<read\ze("
-syn match	logtalkKeyword		"\<write\ze("
-syn match	logtalkKeyword		"\<writeq\ze("
-syn match	logtalkKeyword		"\<write_\(canonical\|term\)\ze("
-syn match	logtalkKeyword		"\<op\ze("
-syn match	logtalkKeyword		"\<current_op\ze("
-syn match	logtalkKeyword		"\<char_conversion\ze("
-syn match	logtalkKeyword		"\<current_char_conversion\ze("
+syn match	logtalkKeyword		"\<read\(_term\)\?\ze("
+syn match	logtalkKeyword		"\<write\(q\|_\(canonical\|term\)\)\?\ze("
+syn match	logtalkKeyword		"\<\(current_\)\?op\ze("
+syn match	logtalkKeyword		"\<\(current\)\?char_conversion\ze("
 
 
 " Logic and control
@@ -249,10 +236,10 @@ syn match	logtalkKeyword		"\<repeat\>"
 
 " Atomic term processing
 
-syn match	logtalkKeyword		"\<atom_\(length\|concat\|chars\|codes\)\ze("
+syn match	logtalkKeyword		"\<atom_\(length\|c\(hars\|o\(ncat\|des\)\)\)\ze("
 syn match	logtalkKeyword		"\<sub_atom\ze("
 syn match	logtalkKeyword		"\<char_code\ze("
-syn match	logtalkKeyword		"\<number_\(chars\|codes\)\ze("
+syn match	logtalkKeyword		"\<number_\(c\(hars\|odes\)\)\ze("
 
 
 " Implementation defined hooks functions
@@ -269,17 +256,14 @@ syn match	logtalkOperator		"-"
 syn match	logtalkOperator		"\*"
 syn match	logtalkOperator		"//"
 syn match	logtalkOperator		"/"
-syn match	logtalkKeyword		"\<rem(?=[(])"
+syn match	logtalkKeyword		"\<r\(ound\|em\)\ze("
 syn match	logtalkKeyword		"\<rem\>"
 syn match	logtalkKeyword		"\<mod\ze("
 syn match	logtalkKeyword		"\<mod\>"
 syn match	logtalkKeyword		"\<abs\ze("
 syn match	logtalkKeyword		"\<sign\ze("
-syn match	logtalkKeyword		"\<float_\(integer\|fractional\)_part\ze("
-syn match	logtalkKeyword		"\<float\ze("
-syn match	logtalkKeyword		"\<floor\ze("
+syn match	logtalkKeyword		"\<flo\(or\|at\(_\(integer\|fractional\)_part\)\?\)\ze("
 syn match	logtalkKeyword		"\<truncate\ze("
-syn match	logtalkKeyword		"\<round\ze("
 syn match	logtalkKeyword		"\<ceiling\ze("
 
 
@@ -302,33 +286,34 @@ syn match	logtalkOperator		"\\/"
 syn match	logtalkOperator		"\\"
 
 
+" Logtalk list operator
+
+syn match	logtalkOperator		"|"
+
+
+" Logtalk numbers 
+
+syn match	logtalkNumber		"\<\d\+\>"
+syn match	logtalkNumber		"\<\d\+\.\d\+\>"
+syn match	logtalkNumber		"\<\d\+[eE][-+]\=\d\+\>"
+syn match	logtalkNumber		"\<\d\+\.\d\+[eE][-+]\=\d\+\>"
+syn match	logtalkNumber		"\<0'[0-9a-zA-Z]\>"
+syn match	logtalkNumber		"\<0b[0-1]\+\>"
+syn match	logtalkNumber		"\<0o[0-7]\+\>"
+syn match	logtalkNumber		"\<0x\x\+\>"
+
+
 " Logtalk end-of-clause
 
 syn match	logtalkOperator		"\."
 
 
-" Logtalk list operator
-
-syn match	logtalkOperator		"|"
-
-
 " Logtalk comments
 
 syn region	logtalkBlockComment	start="/\*"	end="\*/"
 syn match	logtalkLineComment	"%.*"
 
 
-" Logtalk numbers
-
-syn match	logtalkNumber		"\<[0-9]\+\>"
-syn match	logtalkNumber		"\<[0-9]\+\.[0-9]\+\>"
-syn match	logtalkNumber		"\<[0-9]\+\.[0-9]\+[eE][-+][0-9]+\>"
-syn match	logtalkNumber		"\<0'[0-9a-zA-Z]\>"
-syn match	logtalkNumber		"\<0b[0-1]\+\>"
-syn match	logtalkNumber		"\<0o[0-7]\+\>"
-syn match	logtalkNumber		"\<0x[0-9a-fA-F]\+\>"
-
-
 syn sync ccomment logtalkBlockComment maxlines=50
 
 
@@ -343,7 +328,7 @@ if version >= 508 || !exists("did_logtal
 	else
 		command -nargs=+ HiLink hi def link <args>
 	endif
-
+	
 	HiLink	logtalkBlockComment	Comment
 	HiLink	logtalkLineComment	Comment
 
--- a/src/eval.c
+++ b/src/eval.c
@@ -10071,7 +10071,7 @@ f_inputrestore(argvars, rettv)
     }
     else if (p_verbose > 1)
     {
-	msg((char_u *)_("called inputrestore() more often than inputsave()"));
+	verb_msg((char_u *)_("called inputrestore() more often than inputsave()"));
 	rettv->vval.v_number = 1; /* Failed */
     }
 }
@@ -12786,7 +12786,8 @@ f_split(argvars, rettv)
 		end = regmatch.startp[0];
 	    else
 		end = str + STRLEN(str);
-	    if (keepempty || end > str || (l->lv_len > 0 && *str != NUL))
+	    if (keepempty || end > str || (l->lv_len > 0 && *str != NUL
+					  && match && end < regmatch.endp[0]))
 	    {
 		ni = listitem_alloc();
 		if (ni == NULL)
@@ -16930,7 +16931,8 @@ call_user_func(fp, argcount, argvars, re
 	if (p_verbose >= 12)
 	{
 	    ++no_wait_return;
-	    msg_scroll = TRUE;	    /* always scroll up, don't overwrite */
+	    verbose_enter_scroll();
+
 	    smsg((char_u *)_("calling %s"), sourcing_name);
 	    if (p_verbose >= 14)
 	    {
@@ -16956,7 +16958,8 @@ call_user_func(fp, argcount, argvars, re
 		msg_puts((char_u *)")");
 	    }
 	    msg_puts((char_u *)"\n");   /* don't overwrite this either */
-	    cmdline_row = msg_row;
+
+	    verbose_leave_scroll();
 	    --no_wait_return;
 	}
     }
@@ -17015,7 +17018,7 @@ call_user_func(fp, argcount, argvars, re
     if (p_verbose >= 12)
     {
 	++no_wait_return;
-	msg_scroll = TRUE;	    /* always scroll up, don't overwrite */
+	verbose_enter_scroll();
 
 	if (aborting())
 	    smsg((char_u *)_("%s aborted"), sourcing_name);
@@ -17037,7 +17040,8 @@ call_user_func(fp, argcount, argvars, re
 	    vim_free(tofree);
 	}
 	msg_puts((char_u *)"\n");   /* don't overwrite this either */
-	cmdline_row = msg_row;
+
+	verbose_leave_scroll();
 	--no_wait_return;
     }
 
@@ -17053,10 +17057,12 @@ call_user_func(fp, argcount, argvars, re
     if (p_verbose >= 12 && sourcing_name != NULL)
     {
 	++no_wait_return;
-	msg_scroll = TRUE;	    /* always scroll up, don't overwrite */
+	verbose_enter_scroll();
+
 	smsg((char_u *)_("continuing in %s"), sourcing_name);
 	msg_puts((char_u *)"\n");   /* don't overwrite this either */
-	cmdline_row = msg_row;
+
+	verbose_leave_scroll();
 	--no_wait_return;
     }
 
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -266,6 +266,14 @@ linelen(has_tab)
 static char_u	*sortbuf;
 
 static int	sort_ic;		/* ignore case */
+static int	sort_nr;		/* sort on number */
+
+/* Struct to store info to be sorted. */
+typedef struct
+{
+    linenr_T	lnum;			/* line number */
+    long	col_nr;			/* column number or number */
+} sorti_T;
 
 static int
 #ifdef __BORLANDC__
@@ -281,14 +289,19 @@ sort_compare(s1, s2)
     const void	*s1;
     const void	*s2;
 {
-    lpos_T	l1 = *(lpos_T *)s1;
-    lpos_T	l2 = *(lpos_T *)s2;
+    sorti_T	l1 = *(sorti_T *)s1;
+    sorti_T	l2 = *(sorti_T *)s2;
     char_u	*s;
 
+    /* When sorting numbers "col_nr" is the number, not the column number. */
+    if (sort_nr)
+	return l1.col_nr - l2.col_nr;
+
     /* We need to copy one line into "sortbuf", because there is no guarantee
      * that the first pointer becomes invalid when obtaining the second one. */
-    STRCPY(sortbuf, ml_get(l1.lnum) + l1.col);
-    s = ml_get(l2.lnum) + l2.col;
+    STRCPY(sortbuf, ml_get(l1.lnum) + l1.col_nr);
+    s = ml_get(l2.lnum) + l2.col_nr;
+
     return sort_ic ? STRICMP(sortbuf, s) : STRCMP(sortbuf, s);
 }
 
@@ -303,28 +316,39 @@ ex_sort(eap)
     int		len;
     linenr_T	lnum;
     long	maxlen = 0;
-    lpos_T	*nrs;
+    sorti_T	*nrs;
     size_t	count = eap->line2 - eap->line1 + 1;
-    int		i;
+    size_t	i;
     char_u	*p;
     char_u	*s;
     int		unique = FALSE;
     long	deleted;
+    colnr_T	col;
+    int		sort_oct;		/* sort on octal number */
+    int		sort_hex;		/* sort on hex number */
 
     if (u_save((linenr_T)(eap->line1 - 1), (linenr_T)(eap->line2 + 1)) == FAIL)
 	return;
     sortbuf = NULL;
     regmatch.regprog = NULL;
-    nrs = (lpos_T *)lalloc((long_u)(count * sizeof(lpos_T)), TRUE);
+    nrs = (sorti_T *)lalloc((long_u)(count * sizeof(sorti_T)), TRUE);
     if (nrs == NULL)
 	goto theend;
 
+    sort_ic = sort_nr = sort_oct = sort_hex = 0;
+
     for (p = eap->arg; *p != NUL; ++p)
     {
 	if (vim_iswhite(*p))
 	    ;
 	else if (*p == 'i')
 	    sort_ic = TRUE;
+	else if (*p == 'n')
+	    sort_nr = 2;
+	else if (*p == 'o')
+	    sort_oct = 2;
+	else if (*p == 'x')
+	    sort_hex = 2;
 	else if (*p == 'u')
 	    unique = TRUE;
 	else if (*p == '"')	/* comment start */
@@ -356,31 +380,60 @@ ex_sort(eap)
 	}
     }
 
+    /* Can only have one of 'n', 'o' and 'x'. */
+    if (sort_nr + sort_oct + sort_hex > 2)
+    {
+	EMSG(_(e_invarg));
+	goto theend;
+    }
+
+    /* From here on "sort_nr" is used as a flag for any number sorting. */
+    sort_nr += sort_oct + sort_hex;
+
     /*
-     * Make an array with all line numbers, so that we don't have to copy all
+     * Make an array with all line numbers.  This avoids having to copy all
      * the lines into allocated memory.
-     * Also get the longest line length.
+     * When sorting on strings "col_nr" is de offset in the line, for numbers
+     * sorting it's the number to sort on.  This means the pattern matching
+     * and number conversion only has to be done once per line.
+     * Also get the longest line length for allocating "sortbuf".
      */
     for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
     {
-	nrs[lnum - eap->line1].lnum = lnum;
-	nrs[lnum - eap->line1].col = 0;
-
 	s = ml_get(lnum);
-	if (regmatch.regprog != NULL && vim_regexec(&regmatch, s, 0))
-	    nrs[lnum - eap->line1].col = regmatch.endp[0] - s;
-
 	len = STRLEN(s);
 	if (maxlen < len)
 	    maxlen = len;
+
+	if (regmatch.regprog != NULL && vim_regexec(&regmatch, s, 0))
+	    col = regmatch.endp[0] - s;
+	else
+	    col = 0;
+
+	if (sort_nr)
+	{
+	    /* Sorting on number: Store the number itself. */
+	    if (sort_hex)
+		s = skiptohex(s + col);
+	    else
+		s = skiptodigit(s + col);
+	    vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
+					&nrs[lnum - eap->line1].col_nr, NULL);
+	}
+	else
+	    /* Store the column to sort at. */
+	    nrs[lnum - eap->line1].col_nr = col;
+
+	nrs[lnum - eap->line1].lnum = lnum;
     }
 
+    /* Allocate a buffer that can hold the longest line. */
     sortbuf = alloc((unsigned)maxlen + 1);
     if (sortbuf == NULL)
 	goto theend;
 
     /* sort the array of line numbers */
-    qsort((void *)nrs, count, sizeof(lpos_T), sort_compare);
+    qsort((void *)nrs, count, sizeof(sorti_T), sort_compare);
 
     /* Insert the lines in the sorted order below the last one. */
     lnum = eap->line2;
@@ -392,7 +445,8 @@ ex_sort(eap)
 	{
 	    if (ml_append(lnum++, s, (colnr_T)0, FALSE) == FAIL)
 		break;
-	    STRCPY(sortbuf, s);
+	    if (unique)
+		STRCPY(sortbuf, s);
 	}
     }
 
@@ -403,12 +457,14 @@ ex_sort(eap)
     else
 	count = 0;
 
+    /* Adjust marks for deleted (or added) lines and prepare for displaying. */
     deleted = count - (lnum - eap->line2);
     if (deleted > 0)
 	mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted);
     else if (deleted < 0)
 	mark_adjust(eap->line2, MAXLNUM, -deleted, 0L);
     changed_lines(eap->line1, 0, eap->line2 + 1, -deleted);
+
     curwin->w_cursor.lnum = eap->line1;
     beginline(BL_WHITE | BL_FIX);
 
@@ -1532,11 +1588,15 @@ read_viminfo(file, want_info, want_marks
     fp = mch_fopen((char *)fname, READBIN);
 
     if (p_verbose > 0)
+    {
+	verbose_enter();
 	smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
 		fname,
 		want_info ? _(" info") : "",
 		want_marks ? _(" marks") : "",
 		fp == NULL ? _(" FAILED") : "");
+	verbose_leave();
+    }
 
     vim_free(fname);
     if (fp == NULL)
@@ -1760,7 +1820,11 @@ write_viminfo(file, forceit)
     }
 
     if (p_verbose > 0)
+    {
+	verbose_enter();
 	smsg((char_u *)_("Writing viminfo file \"%s\""), fname);
+	verbose_leave();
+    }
 
     viminfo_errcnt = 0;
     do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2467,8 +2467,12 @@ do_in_runtimepath(name, all, callback, c
     if (buf != NULL && rtp_copy != NULL)
     {
 	if (p_verbose > 1)
+	{
+	    verbose_enter();
 	    smsg((char_u *)_("Searching for \"%s\" in \"%s\""),
 						 (char *)name, (char *)p_rtp);
+	    verbose_leave();
+	}
 
 	/* Loop over all entries in 'runtimepath'. */
 	rtp = rtp_copy;
@@ -2490,7 +2494,11 @@ do_in_runtimepath(name, all, callback, c
 								       "\t ");
 
 		    if (p_verbose > 2)
+		    {
+			verbose_enter();
 			smsg((char_u *)_("Searching for \"%s\""), buf);
+			verbose_leave();
+		    }
 
 		    /* Expand wildcards, invoke the callback for each match. */
 		    if (gen_expand_wildcards(1, &buf, &num_files, &files,
@@ -2512,7 +2520,11 @@ do_in_runtimepath(name, all, callback, c
     vim_free(buf);
     vim_free(rtp_copy);
     if (p_verbose > 0 && !did_one)
+    {
+	verbose_enter();
 	smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name);
+	verbose_leave();
+    }
 
 #ifdef AMIGA
     proc->pr_WindowPtr = save_winptr;
@@ -2759,11 +2771,13 @@ do_source(fname, check_other, is_vimrc)
     {
 	if (p_verbose > 0)
 	{
+	    verbose_enter();
 	    if (sourcing_name == NULL)
 		smsg((char_u *)_("could not source \"%s\""), fname);
 	    else
 		smsg((char_u *)_("line %ld: could not source \"%s\""),
 							sourcing_lnum, fname);
+	    verbose_leave();
 	}
 	goto theend;
     }
@@ -2775,11 +2789,13 @@ do_source(fname, check_other, is_vimrc)
      */
     if (p_verbose > 1)
     {
+	verbose_enter();
 	if (sourcing_name == NULL)
 	    smsg((char_u *)_("sourcing \"%s\""), fname);
 	else
 	    smsg((char_u *)_("line %ld: sourcing \"%s\""),
 							sourcing_lnum, fname);
+	verbose_leave();
     }
     if (is_vimrc)
 	vimrc_found();
@@ -2961,9 +2977,11 @@ do_source(fname, check_other, is_vimrc)
     sourcing_lnum = save_sourcing_lnum;
     if (p_verbose > 1)
     {
+	verbose_enter();
 	smsg((char_u *)_("finished sourcing %s"), fname);
 	if (sourcing_name != NULL)
 	    smsg((char_u *)_("continuing in %s"), sourcing_name);
+	verbose_leave();
     }
 #ifdef STARTUPTIME
     vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -6132,7 +6132,11 @@ clip_mch_request_selection(VimClipboard 
 	/* Got something */
 	clip_yank_selection(MCHAR, buffer, (long)nbytes, cbd);
 	if (p_verbose > 0)
+	{
+	    verbose_enter();
 	    smsg((char_u *)_("Used CUT_BUFFER0 instead of empty selection"));
+	    verbose_leave();
+	}
     }
     if (buffer != NULL)
 	XFree(buffer);
--- a/src/main.c
+++ b/src/main.c
@@ -813,6 +813,12 @@ main
 	    case 'V':		/* "-V{N}"	Verbose level */
 		/* default is 10: a little bit verbose */
 		p_verbose = get_number_arg((char_u *)argv[0], &argv_idx, 10);
+		if (argv[0][argv_idx] != NUL)
+		{
+		    set_option_value((char_u *)"verbosefile", 0L,
+					     (char_u *)argv[0] + argv_idx, 0);
+		    argv_idx = STRLEN(argv[0]);
+		}
 		break;
 
 	    case 'v':		/* "-v"  Vi-mode (as if called "vi") */
--- a/src/option.c
+++ b/src/option.c
@@ -2259,6 +2259,9 @@ static struct vimoption
     {"verbose",	    "vbs",  P_NUM|P_VI_DEF,
 			    (char_u *)&p_verbose, PV_NONE,
 			    {(char_u *)0L, (char_u *)0L}},
+    {"verbosefile", "vfile", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
+			    (char_u *)&p_vfile, PV_NONE,
+			    {(char_u *)"", (char_u *)0L}},
     {"viewdir",     "vdir", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
 #ifdef FEAT_SESSION
 			    (char_u *)&p_vdir, PV_NONE,
@@ -3731,8 +3734,10 @@ do_set(arg, opt_flags)
 		    {
 			if (options[opt_idx].scriptID != 0)
 			{
+			    verbose_enter();
 			    MSG_PUTS(_("\n\tLast set from "));
 			    MSG_PUTS(get_scriptname(options[opt_idx].scriptID));
+			    verbose_leave();
 			}
 		    }
 #endif
@@ -5316,6 +5321,14 @@ did_set_string_option(opt_idx, varp, new
     }
 #endif
 
+    /* 'verbosefile' */
+    else if (varp == &p_vfile)
+    {
+	verbose_stop();
+	if (*p_vfile != NUL && verbose_open() == FAIL)
+	    errmsg = e_invarg;
+    }
+
 #ifdef FEAT_VIMINFO
     /* 'viminfo' */
     else if (varp == &p_viminfo)
--- a/src/option.h
+++ b/src/option.h
@@ -804,6 +804,7 @@ static char *(p_ve_values[]) = {"block",
 # define VE_ALL		4
 #endif
 EXTERN long	p_verbose;	/* 'verbose' */
+EXTERN char_u	*p_vfile;	/* 'verbosefile' */
 EXTERN int	p_warn;		/* 'warn' */
 #ifdef FEAT_CMDL_COMPL
 EXTERN char_u	*p_wop;		/* 'wildoptions' */
--- a/src/proto/ex_cmds2.pro
+++ b/src/proto/ex_cmds2.pro
@@ -54,7 +54,7 @@ void ex_listdo __ARGS((exarg_T *eap));
 void ex_compiler __ARGS((exarg_T *eap));
 void ex_runtime __ARGS((exarg_T *eap));
 int cmd_runtime __ARGS((char_u *name, int all));
-int do_in_runtimepath __ARGS((char_u *name, int all, void (*callback)(char_u *fname, void *cookie), void *cookie));
+int do_in_runtimepath __ARGS((char_u *name, int all, void (*callback)(char_u *fname, void *ck), void *cookie));
 void ex_options __ARGS((exarg_T *eap));
 void ex_source __ARGS((exarg_T *eap));
 linenr_T *source_breakpoint __ARGS((void *cookie));
--- a/src/proto/hashtable.pro
+++ b/src/proto/hashtable.pro
@@ -1,5 +1,4 @@
 /* hashtable.c */
-hashtab_T *hash_create __ARGS((void));
 void hash_init __ARGS((hashtab_T *ht));
 void hash_clear __ARGS((hashtab_T *ht));
 hashitem_T *hash_find __ARGS((hashtab_T *ht, char_u *key));
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3127,8 +3127,8 @@ syntax_clear(buf)
 {
     int i;
 
-    curbuf->b_syn_ic = FALSE;	    /* Use case, by default */
-    curbuf->b_syn_containedin = FALSE;
+    buf->b_syn_ic = FALSE;	    /* Use case, by default */
+    buf->b_syn_containedin = FALSE;
 
     /* free the keywords */
     clear_keywtab(&buf->b_keywtab);
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -14,7 +14,7 @@ SCRIPTS = test1.out test2.out test3.out 
 		test38.out test39.out test40.out test41.out test42.out \
 		test43.out test44.out test45.out test46.out test47.out \
 		test48.out test49.out test51.out test52.out test53.out \
-		test54.out test55.out test56.out
+		test54.out test55.out test56.out test57.out
 
 SCRIPTS_GUI = test16.out
 
--- a/src/testdir/test55.in
+++ b/src/testdir/test55.in
@@ -274,6 +274,8 @@ STARTTEST
 :$put =string(split(':aa::bb:', ':', 0))
 :$put =string(split(':aa::bb:', ':', 1))
 :$put =string(split('aa,,bb, cc,', ',\s*', 1))
+:$put =string(split('abc', '\zs'))
+:$put =string(split('abc', '\zs', 1))
 :"
 :endfun
 :call Test(1, 2, [3, 4], {5: 6})  " This may take a while
--- a/src/ui.c
+++ b/src/ui.c
@@ -1696,7 +1696,13 @@ fill_input_buf(exit_on_error)
 #endif
 
 #ifdef FEAT_GUI
-    if (gui.in_use)
+    if (gui.in_use
+# ifdef NO_CONSOLE_INPUT
+    /* Don't use the GUI input when the window hasn't been opened yet.
+     * We get here from ui_inchar() when we should try reading from stdin. */
+	    && !no_console_input()
+# endif
+       )
     {
 	gui_mch_update();
 	return;
@@ -2140,7 +2146,7 @@ clip_x11_request_selection(myShell, dpy,
 	clip_yank_selection(MCHAR, buffer, (long)nbytes, cbd);
 	XFree((void *)buffer);
 	if (p_verbose > 0)
-	    MSG(_("Used CUT_BUFFER0 instead of empty selection"));
+	    verb_msg((char_u *)_("Used CUT_BUFFER0 instead of empty selection"));
     }
 }