changeset 189:504c627f7474

updated for version 7.0057
author vimboss
date Mon, 07 Mar 2005 23:16:51 +0000
parents 041a413d626d
children a1f18bd133d6
files runtime/doc/eval.txt runtime/doc/options.txt runtime/doc/tags src/auto/configure src/configure.in src/gui_mac.c src/gui_w32.c src/proto/gui_gtk.pro src/proto/netbeans.pro src/proto/workshop.pro src/quickfix.c src/regexp.c src/workshop.c
diffstat 13 files changed, 196 insertions(+), 211 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Mar 04
+*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Mar 07
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1105,6 +1105,32 @@ variables for each buffer.  Use local bu
 
 Predefined Vim variables:			*vim-variable* *v:var*
 
+					*v:beval_col* *beval_col-variable*
+v:beval_col	The number of the column, over which the mouse pointer is.
+		This is the byte index in the |v:beval_lnum| line.
+		Only valid while evaluating the 'balloonexpr' option.
+
+					*v:beval_bufnr* *beval_bufnr-variable*
+v:beval_bufnr	The number of the buffer, over which the mouse pointer is. Only
+		valid while evaluating the 'balloonexpr' option.
+
+					*v:beval_lnum* *beval_lnum-variable*
+v:beval_lnum	The number of the line, over which the mouse pointer is. Only
+		valid while evaluating the 'balloonexpr' option.
+
+					*v:beval_text* *beval_text-variable*
+v:beval_text	The text under or after the mouse pointer.  Usually a word as it is
+		useful for debugging a C program.  'iskeyword' applies, but a
+		dot and "->" before the position is included.  When on a ']'
+		the text before it is used, including the matching '[' and
+		word before it.  When on a Visual area within one line the
+		highlighted text is used.
+		Only valid while evaluating the 'balloonexpr' option.
+
+					*v:beval_winnr* *beval_winnr-variable*
+v:beval_winnr	The number of the window, over which the mouse pointer is. Only
+		valid while evaluating the 'balloonexpr' option.
+
 			*v:charconvert_from* *charconvert_from-variable*
 v:charconvert_from
 		The name of the character encoding of a file to be converted.
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2005 Mar 06
+*options.txt*	For Vim version 7.0aa.  Last change: 2005 Mar 07
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -992,9 +992,40 @@ A jump table for the options with a shor
 			global
 			{not in Vi}
 			{only available when compiled with the |+balloon_eval|
-			and |+sun_workshop| or |+netbeans_intg| features}
+			feature}
 	Switch on the |balloon-eval| functionality.
 
+						     *'balloonexpr'* *'bexpr'*
+'balloonexpr' 'bexpr'	string	(default "")
+			global
+			{not in Vi}
+			{only available when compiled with the |+balloon_eval|
+			feature}
+	Expression to show in evaluation balloon.  It is only used when
+	'ballooneval' is on.  These variables can be used:
+
+	v:beval_bufnr	number of the buffer in which balloon is going to show
+	v:beval_winnr	number of the window
+	v:beval_lnum	line number
+	v:beval_col	column number (byte index)
+	v:beval_text	word under or after the mouse pointer
+
+	The evaluation of the expression must not have side effects!
+	Example: >
+    function! MyBalloonExpr()
+	return 'Cursor is at line ' . v:beval_lnum . 
+		\', column ' . v:beval_col .
+		\ ' of file ' .  bufname(v:beval_bufnr) .
+		\ ' on word "' . v:beval_text . '"'
+    endfunction
+    set bexpr=MyBalloonExpr()
+    set ballooneval
+<
+	NOTE: The balloon is displayed only if the cursor is on a text
+	character.  If the result of evaluating 'balloonexpr' is not empty,
+	Vim does not try to send a message to an external debugger (Netbeans
+	or Sun Workshop).
+
 				     *'binary'* *'bin'* *'nobinary'* *'nobin'*
 'binary' 'bin'		boolean	(default off)
 			local to buffer
@@ -4160,6 +4191,20 @@ A jump table for the options with a shor
 	other memory to be freed.  Maximum value 2000000.  Use this to work
 	without a limit.  Also see 'maxmemtot'.
 
+						*'maxmempattern'* *'mmp'*
+'maxmempattern' 'mmp'	number	(default 1000)
+			global
+			{not in Vi}
+	Maximum amount of memory (in Kbyte) to use for pattern matching.
+	Maximum value 2000000.  Use this to work without a limit.
+							*E363*
+	When Vim runs into the limit it gives an error message mostly behaves
+	like CTRL-C was typed.
+	Running into the limit often means that the pattern is very
+	inefficient or too complex.  This may already happen with the pattern
+	"\(.\)*" on a very long line.  ".*" works much better.
+	Vim may run out of memory before hitting the 'maxmempattern' limit.
+
 						*'maxmemtot'* *'mmt'*
 'maxmemtot' 'mmt'	number	(default between 2048 and 10240 (system
 				 dependent) or half the amount of memory
@@ -6345,6 +6390,8 @@ A jump table for the options with a shor
 				"s"  = button state
 				"c"  = column plus 33
 				"r"  = row plus 33
+	   		This only works up to 223 columns!  See "dec" for a
+			solution.
 	   xterm2	Works like "xterm", but with the xterm reporting the
 			mouse position while the mouse is dragged.  This works
 			much faster and more precise.  Your xterm must at
@@ -6358,6 +6405,8 @@ A jump table for the options with a shor
 							*dec-mouse*
 	   dec		DEC terminal mouse handling.  The mouse generates a
 			rather complex sequence, starting with "<Esc>[".
+			This is also available for an Xterm, if it was
+			configured with "--enable-dec-locator".
 							*jsbterm-mouse*
 	   jsbterm	JSB term mouse handling.
 							*pterm-mouse*
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -59,11 +59,13 @@
 'backupskip'	options.txt	/*'backupskip'*
 'balloondelay'	options.txt	/*'balloondelay'*
 'ballooneval'	options.txt	/*'ballooneval'*
+'balloonexpr'	options.txt	/*'balloonexpr'*
 'bdir'	options.txt	/*'bdir'*
 'bdlay'	options.txt	/*'bdlay'*
 'beautify'	vi_diff.txt	/*'beautify'*
 'beval'	options.txt	/*'beval'*
 'bex'	options.txt	/*'bex'*
+'bexpr'	options.txt	/*'bexpr'*
 'bf'	vi_diff.txt	/*'bf'*
 'bg'	options.txt	/*'bg'*
 'bh'	options.txt	/*'bh'*
@@ -351,6 +353,7 @@
 'maxfuncdepth'	options.txt	/*'maxfuncdepth'*
 'maxmapdepth'	options.txt	/*'maxmapdepth'*
 'maxmem'	options.txt	/*'maxmem'*
+'maxmempattern'	options.txt	/*'maxmempattern'*
 'maxmemtot'	options.txt	/*'maxmemtot'*
 'mef'	options.txt	/*'mef'*
 'menuitems'	options.txt	/*'menuitems'*
@@ -362,6 +365,7 @@
 'mls'	options.txt	/*'mls'*
 'mm'	options.txt	/*'mm'*
 'mmd'	options.txt	/*'mmd'*
+'mmp'	options.txt	/*'mmp'*
 'mmt'	options.txt	/*'mmt'*
 'mod'	options.txt	/*'mod'*
 'modeline'	options.txt	/*'modeline'*
@@ -1065,6 +1069,7 @@
 +perl	various.txt	/*+perl*
 +postscript	various.txt	/*+postscript*
 +printer	various.txt	/*+printer*
++profile	various.txt	/*+profile*
 +python	various.txt	/*+python*
 +quickfix	various.txt	/*+quickfix*
 +rightleft	various.txt	/*+rightleft*
@@ -2770,6 +2775,7 @@ 90.5	usr_90.txt	/*90.5*
 <register>	map.txt	/*<register>*
 <sfile>	cmdline.txt	/*<sfile>*
 <xCSI>	intro.txt	/*<xCSI>*
+<xDown>	term.txt	/*<xDown>*
 <xEnd>	term.txt	/*<xEnd>*
 <xEnd>-xterm	term.txt	/*<xEnd>-xterm*
 <xF1>	term.txt	/*<xF1>*
@@ -2782,6 +2788,9 @@ 90.5	usr_90.txt	/*90.5*
 <xF4>-xterm	term.txt	/*<xF4>-xterm*
 <xHome>	term.txt	/*<xHome>*
 <xHome>-xterm	term.txt	/*<xHome>-xterm*
+<xLeft>	term.txt	/*<xLeft>*
+<xRight>	term.txt	/*<xRight>*
+<xUp>	term.txt	/*<xUp>*
 =	change.txt	/*=*
 ==	change.txt	/*==*
 >	change.txt	/*>*
@@ -3249,9 +3258,8 @@ E358	options.txt	/*E358*
 E359	term.txt	/*E359*
 E36	windows.txt	/*E36*
 E360	various.txt	/*E360*
-E361	pattern.txt	/*E361*
 E362	term.txt	/*E362*
-E363	pattern.txt	/*E363*
+E363	options.txt	/*E363*
 E364	eval.txt	/*E364*
 E365	print.txt	/*E365*
 E366	options.txt	/*E366*
@@ -4182,6 +4190,11 @@ beos-timeout	os_beos.txt	/*beos-timeout*
 beos-unicode	os_beos.txt	/*beos-unicode*
 beos-utf8	os_beos.txt	/*beos-utf8*
 beos-vimdir	os_beos.txt	/*beos-vimdir*
+beval_bufnr-variable	eval.txt	/*beval_bufnr-variable*
+beval_col-variable	eval.txt	/*beval_col-variable*
+beval_lnum-variable	eval.txt	/*beval_lnum-variable*
+beval_text-variable	eval.txt	/*beval_text-variable*
+beval_winnr-variable	eval.txt	/*beval_winnr-variable*
 blockwise-examples	visual.txt	/*blockwise-examples*
 blockwise-operators	visual.txt	/*blockwise-operators*
 blockwise-register	change.txt	/*blockwise-register*
@@ -6614,6 +6627,11 @@ utf-8-in-xwindows	mbyte.txt	/*utf-8-in-x
 utf-8-typing	mbyte.txt	/*utf-8-typing*
 utf8	mbyte.txt	/*utf8*
 v	visual.txt	/*v*
+v:beval_bufnr	eval.txt	/*v:beval_bufnr*
+v:beval_col	eval.txt	/*v:beval_col*
+v:beval_lnum	eval.txt	/*v:beval_lnum*
+v:beval_text	eval.txt	/*v:beval_text*
+v:beval_winnr	eval.txt	/*v:beval_winnr*
 v:charconvert_from	eval.txt	/*v:charconvert_from*
 v:charconvert_to	eval.txt	/*v:charconvert_to*
 v:cmdarg	eval.txt	/*v:cmdarg*
@@ -6967,6 +6985,7 @@ xterm-copy-paste	term.txt	/*xterm-copy-p
 xterm-cursor-keys	term.txt	/*xterm-cursor-keys*
 xterm-end-home-keys	term.txt	/*xterm-end-home-keys*
 xterm-function-keys	term.txt	/*xterm-function-keys*
+xterm-modifier-keys	term.txt	/*xterm-modifier-keys*
 xterm-mouse	options.txt	/*xterm-mouse*
 xterm-mouse-wheel	scroll.txt	/*xterm-mouse-wheel*
 xterm-save-screen	tips.txt	/*xterm-save-screen*
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -4629,7 +4629,7 @@ fi
   if test "X$vi_cv_path_ruby" != "X"; then
     echo "$as_me:$LINENO: checking Ruby version" >&5
 echo $ECHO_N "checking Ruby version... $ECHO_C" >&6
-    if $vi_cv_path_ruby -e 'VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
+    if $vi_cv_path_ruby -e 'RUBY_VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
       echo "$as_me:$LINENO: result: OK" >&5
 echo "${ECHO_T}OK" >&6
       echo "$as_me:$LINENO: checking Ruby header files" >&5
--- a/src/configure.in
+++ b/src/configure.in
@@ -807,7 +807,7 @@ if test "$enable_rubyinterp" = "yes"; th
   AC_PATH_PROG(vi_cv_path_ruby, ruby)
   if test "X$vi_cv_path_ruby" != "X"; then
     AC_MSG_CHECKING(Ruby version)
-    if $vi_cv_path_ruby -e 'VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
+    if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
       AC_MSG_RESULT(OK)
       AC_MSG_CHECKING(Ruby header files)
       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -3879,6 +3879,12 @@ gui_mch_init_font(font_name, fontset)
     TextSize(font >> 16);
     TextFont(font & 0xFFFF);
 
+    GetFontInfo(&font_info);
+
+    gui.char_ascent = font_info.ascent;
+    gui.char_width  = CharWidth('_');
+    gui.char_height = font_info.ascent + font_info.descent + p_linespace;
+
 #ifdef USE_ATSUI_DRAWING
     ATSUFontID			fontID;
     Fixed			fontSize;
@@ -3927,12 +3933,6 @@ gui_mch_init_font(font_name, fontset)
     }
 #endif
 
-    GetFontInfo(&font_info);
-
-    gui.char_ascent = font_info.ascent;
-    gui.char_width  = CharWidth('_');
-    gui.char_height = font_info.ascent + font_info.descent + p_linespace;
-
     return OK;
 
 }
@@ -4313,11 +4313,6 @@ gui_mch_draw_string(row, col, s, len, fl
     int		len;
     int		flags;
 {
-#if defined(FEAT_GUI) && defined(MACOS_X)
-#ifndef USE_ATSUI_DRAWING
-    SInt32	sys_version;
-#endif
-#endif
 #ifdef FEAT_MBYTE
 #ifdef USE_ATSUI_DRAWING
     /* ATSUI requires utf-16 strings */
@@ -4342,10 +4337,7 @@ gui_mch_draw_string(row, col, s, len, fl
     /*
      * On OS X, try using Quartz-style text antialiasing.
      */
-    sys_version = 0;
-
-    Gestalt(gestaltSystemVersion, &sys_version);
-    if (sys_version >= 0x1020)
+    if (gMacSystemVersion >= 0x1020)
     {
 	/* Quartz antialiasing is available only in OS 10.2 and later. */
 	UInt32 qd_flags = (p_antialias ?
@@ -4366,7 +4358,7 @@ gui_mch_draw_string(row, col, s, len, fl
 #ifdef USE_ATSUI_DRAWING
     if ((flags & DRAW_TRANSP) == 0)
 #else
-    if (((sys_version >= 0x1020 && p_antialias) || p_linespace != 0)
+    if (((gMacSystemVersion >= 0x1020 && p_antialias) || p_linespace != 0)
 	    && !(flags & DRAW_TRANSP))
 #endif
     {
@@ -4394,7 +4386,7 @@ gui_mch_draw_string(row, col, s, len, fl
     }
 
 #ifndef USE_ATSUI_DRAWING
-    if (sys_version >= 0x1020 && p_antialias)
+    if (gMacSystemVersion >= 0x1020 && p_antialias)
     {
 	StyleParameter face;
 
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -3947,7 +3947,7 @@ gui_mch_destroy_sign(sign)
 /* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS.
  *  Added by Sergey Khorev <sergey.khorev@gmail.com>
  *
- * The only reused thing is gui_beval.h and gui_mch_get_beval_info()
+ * The only reused thing is gui_beval.h and get_beval_info()
  * from gui_beval.c (note it uses x and y of the BalloonEval struct
  * to get current mouse position).
  *
--- a/src/proto/gui_gtk.pro
+++ b/src/proto/gui_gtk.pro
@@ -14,7 +14,6 @@ void gui_mch_destroy_scrollbar __ARGS((s
 char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter));
 char_u *gui_mch_browsedir __ARGS((char_u *title, char_u *initdir));
 int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield));
-int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield));
 void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu));
 void gui_make_popup __ARGS((char_u *path_name));
 void gui_mch_find_dialog __ARGS((exarg_T *eap));
--- a/src/proto/netbeans.pro
+++ b/src/proto/netbeans.pro
@@ -1,9 +1,11 @@
 /* netbeans.c */
+void netbeans_w32_connect __ARGS((void));
 void messageFromNetbeansW32 __ARGS((void));
 int isNetbeansBuffer __ARGS((buf_T *bufp));
 int isNetbeansModified __ARGS((buf_T *bufp));
 void netbeans_end __ARGS((void));
 void ex_nbkey __ARGS((exarg_T *eap));
+void netbeans_beval_cb __ARGS((BalloonEval *beval, int state));
 void netbeans_startup_done __ARGS((void));
 void netbeans_send_disconnect __ARGS((void));
 void netbeans_frame_moved __ARGS((int new_x, int new_y));
--- a/src/proto/workshop.pro
+++ b/src/proto/workshop.pro
@@ -44,5 +44,6 @@ int workshop_test_getcursorcol __ARGS((v
 char *workshop_test_getcursorrowtext __ARGS((void));
 char *workshop_test_getselectedtext __ARGS((void));
 void workshop_save_sensitivity __ARGS((char *filename));
+void workshop_beval_cb __ARGS((BalloonEval *beval, int state));
 void findYourself __ARGS((char *argv0));
 /* vim: set ft=c : */
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2418,27 +2418,6 @@ ex_vimgrep(eap)
 	else
 	{
 	    found_match = FALSE;
-#if 0
-#ifdef HAVE_SETJMP_H
-	    /*
-	     * Matching with a regexp may cause a very deep recursive call of
-	     * regmatch().  Vim will crash when running out of stack space.
-	     * Catch this here if the system supports it.
-	     * It's a bit slow, thus do it outside of the loop.
-	     */
-	    mch_startjmp();
-	    if (SETJMP(lc_jump_env) != 0)
-	    {
-		mch_didjmp();
-# ifdef SIGHASARG
-		if (lc_signal != SIGINT)
-# endif
-		    EMSG(_(e_complex));
-		got_int = TRUE;
-		goto jumpend;
-	    }
-#endif
-#endif
 	    /* Try for a match in all lines of the buffer. */
 	    for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
 	    {
@@ -2477,12 +2456,6 @@ ex_vimgrep(eap)
 		if (got_int)
 		    break;
 	    }
-#if 0
-#ifdef HAVE_SETJMP_H
-jumpend:
-	    mch_endjmp();
-#endif
-#endif
 
 	    if (using_dummy)
 	    {
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -3184,49 +3184,21 @@ vim_regexec_multi(rmp, win, buf, lnum, c
     return r;
 }
 
-#if 0	/* disabled, no longer needed now that regmatch() is not recursive */
-# ifdef HAVE_SETJMP_H
-#  define USE_SETJMP
-# endif
-# ifdef HAVE_TRY_EXCEPT
-#  define USE_TRY_EXCEPT
-# endif
-#endif
-
 /*
  * Match a regexp against a string ("line" points to the string) or multiple
  * lines ("line" is NULL, use reg_getline()).
  */
-#ifdef USE_SETJMP
-    static long
-vim_regexec_both(line_arg, col_arg)
-    char_u	*line_arg;
-    colnr_T	col_arg;	/* column to start looking for match */
-#else
     static long
 vim_regexec_both(line, col)
     char_u	*line;
     colnr_T	col;		/* column to start looking for match */
-#endif
 {
     regprog_T	*prog;
     char_u	*s;
-    long	retval;
-#ifdef USE_SETJMP
-    char_u	*line;
-    colnr_T	col;
-    int		did_mch_startjmp = FALSE;
-#endif
+    long	retval = 0L;
 
     reg_tofree = NULL;
 
-#ifdef USE_SETJMP
-    /* Trick to avoid "might be clobbered by `longjmp'" warning from gcc. */
-    line = line_arg;
-    col = col_arg;
-#endif
-    retval = 0L;
-
     if (REG_MULTI)
     {
 	prog = reg_mmatch->regprog;
@@ -3312,36 +3284,6 @@ vim_regexec_both(line, col)
 	    goto theend;
     }
 
-#ifdef USE_TRY_EXCEPT
-    __try
-    {
-#endif
-
-#ifdef USE_SETJMP
-    /*
-     * Matching with a regexp may cause a very deep recursive call of
-     * regmatch().  Vim will crash when running out of stack space.  Catch
-     * this here if the system supports it.
-     * It's a bit slow, do it after the check for "regmust".
-     * Don't do it if the caller already set it up.
-     */
-    if (!lc_active)
-    {
-	did_mch_startjmp = TRUE;
-	mch_startjmp();
-	if (SETJMP(lc_jump_env) != 0)
-	{
-	    mch_didjmp();
-# ifdef SIGHASARG
-	    if (lc_signal != SIGINT)
-# endif
-		EMSG(_(e_complex));
-	    retval = 0L;
-	    goto inner_end;
-	}
-    }
-#endif
-
     regline = line;
     reglnum = 0;
 
@@ -3414,26 +3356,6 @@ vim_regexec_both(line, col)
 	}
     }
 
-#ifdef USE_SETJMP
-inner_end:
-    if (did_mch_startjmp)
-	mch_endjmp();
-#endif
-#ifdef USE_TRY_EXCEPT
-    }
-    __except(EXCEPTION_EXECUTE_HANDLER)
-    {
-	if (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW)
-	{
-	    RESETSTKOFLW();
-	    EMSG(_(e_outofstack));
-	}
-	else
-	    EMSG(_(e_complex));
-	retval = 0L;
-    }
-#endif
-
 theend:
     /* Didn't find a match. */
     vim_free(reg_tofree);
@@ -3505,68 +3427,67 @@ regtry(prog, col)
 	need_clear_zsubexpr = TRUE;
 #endif
 
-    if (regmatch(prog->program + 1))
+    if (regmatch(prog->program + 1) == 0)
+	return 0;
+
+    cleanup_subexpr();
+    if (REG_MULTI)
     {
-	cleanup_subexpr();
-	if (REG_MULTI)
+	if (reg_startpos[0].lnum < 0)
 	{
-	    if (reg_startpos[0].lnum < 0)
-	    {
-		reg_startpos[0].lnum = 0;
-		reg_startpos[0].col = col;
-	    }
-	    if (reg_endpos[0].lnum < 0)
-	    {
-		reg_endpos[0].lnum = reglnum;
-		reg_endpos[0].col = (int)(reginput - regline);
-	    }
-	    else
-		/* Use line number of "\ze". */
-		reglnum = reg_endpos[0].lnum;
+	    reg_startpos[0].lnum = 0;
+	    reg_startpos[0].col = col;
+	}
+	if (reg_endpos[0].lnum < 0)
+	{
+	    reg_endpos[0].lnum = reglnum;
+	    reg_endpos[0].col = (int)(reginput - regline);
 	}
 	else
-	{
-	    if (reg_startp[0] == NULL)
-		reg_startp[0] = regline + col;
-	    if (reg_endp[0] == NULL)
-		reg_endp[0] = reginput;
-	}
+	    /* Use line number of "\ze". */
+	    reglnum = reg_endpos[0].lnum;
+    }
+    else
+    {
+	if (reg_startp[0] == NULL)
+	    reg_startp[0] = regline + col;
+	if (reg_endp[0] == NULL)
+	    reg_endp[0] = reginput;
+    }
 #ifdef FEAT_SYN_HL
-	/* Package any found \z(...\) matches for export. Default is none. */
-	unref_extmatch(re_extmatch_out);
-	re_extmatch_out = NULL;
-
-	if (prog->reghasz == REX_SET)
+    /* Package any found \z(...\) matches for export. Default is none. */
+    unref_extmatch(re_extmatch_out);
+    re_extmatch_out = NULL;
+
+    if (prog->reghasz == REX_SET)
+    {
+	int		i;
+
+	cleanup_zsubexpr();
+	re_extmatch_out = make_extmatch();
+	for (i = 0; i < NSUBEXP; i++)
 	{
-	    int		i;
-
-	    cleanup_zsubexpr();
-	    re_extmatch_out = make_extmatch();
-	    for (i = 0; i < NSUBEXP; i++)
+	    if (REG_MULTI)
 	    {
-		if (REG_MULTI)
-		{
-		    /* Only accept single line matches. */
-		    if (reg_startzpos[i].lnum >= 0
-			    && reg_endzpos[i].lnum == reg_startzpos[i].lnum)
-			re_extmatch_out->matches[i] =
-			    vim_strnsave(reg_getline(reg_startzpos[i].lnum)
+		/* Only accept single line matches. */
+		if (reg_startzpos[i].lnum >= 0
+			&& reg_endzpos[i].lnum == reg_startzpos[i].lnum)
+		    re_extmatch_out->matches[i] =
+			vim_strnsave(reg_getline(reg_startzpos[i].lnum)
 						       + reg_startzpos[i].col,
-				    reg_endzpos[i].col - reg_startzpos[i].col);
-		}
-		else
-		{
-		    if (reg_startzp[i] != NULL && reg_endzp[i] != NULL)
-			re_extmatch_out->matches[i] =
+				   reg_endzpos[i].col - reg_startzpos[i].col);
+	    }
+	    else
+	    {
+		if (reg_startzp[i] != NULL && reg_endzp[i] != NULL)
+		    re_extmatch_out->matches[i] =
 			    vim_strnsave(reg_startzp[i],
-				    (int)(reg_endzp[i] - reg_startzp[i]));
-		}
+					(int)(reg_endzp[i] - reg_startzp[i]));
 	    }
 	}
+    }
 #endif
-	return 1 + reglnum;
-    }
-    return 0;
+    return 1 + reglnum;
 }
 
 #ifdef FEAT_MBYTE
@@ -4601,7 +4522,12 @@ regmatch(scan)
 		    /* It could match.  Prepare for trying to match what
 		     * follows.  The code is below.  Parameters are stored in
 		     * a regstar_T on the regstack. */
-		    if (ga_grow(&regstack, sizeof(regstar_T)) == FAIL)
+		    if (((unsigned)regstack.ga_len >> 10) >= p_mmp)
+		    {
+			EMSG(_(e_maxmempat));
+			status = RA_FAIL;
+		    }
+		    else if (ga_grow(&regstack, sizeof(regstar_T)) == FAIL)
 			status = RA_FAIL;
 		    else
 		    {
@@ -4641,7 +4567,12 @@ regmatch(scan)
 	  case BEHIND:
 	  case NOBEHIND:
 	    /* Need a bit of room to store extra positions. */
-	    if (ga_grow(&regstack, sizeof(regbehind_T)) == FAIL)
+	    if (((unsigned)regstack.ga_len >> 10) >= p_mmp)
+	    {
+		EMSG(_(e_maxmempat));
+		status = RA_FAIL;
+	    }
+	    else if (ga_grow(&regstack, sizeof(regbehind_T)) == FAIL)
 		status = RA_FAIL;
 	    else
 	    {
@@ -5029,7 +4960,7 @@ regmatch(scan)
 	    break;
     }
 
-    /* May want to continue with the inner loop. */
+    /* May need to continue with the inner loop, starting at "scan". */
     if (status == RA_CONT)
 	continue;
 
@@ -5050,6 +4981,8 @@ regmatch(scan)
 	    printf("Premature EOL\n");
 #endif
 	}
+	if (status == RA_FAIL)
+	    got_int = TRUE;
 	return (status == RA_MATCH);
     }
 
@@ -5071,6 +5004,11 @@ regstack_push(regstack, state, scan, sta
 {
     regitem_T	*rp;
 
+    if (((unsigned)regstack->ga_len >> 10) >= p_mmp)
+    {
+	EMSG(_(e_maxmempat));
+	return NULL;
+    }
     if (ga_grow(regstack, sizeof(regitem_T)) == FAIL)
 	return NULL;
 
--- a/src/workshop.c
+++ b/src/workshop.c
@@ -58,7 +58,7 @@ static void	 load_buffer_by_number(int, 
 static void	 load_window(char *, int lnum);
 static void	 warp_to_pc(int);
 #ifdef FEAT_BEVAL
-static void	 bevalCB(BalloonEval *, int);
+void		workshop_beval_cb(BalloonEval *, int);
 #endif
 static char	*fixAccelText(char *);
 static void	 addMenu(char *, char *, char *);
@@ -74,7 +74,6 @@ static int	 tbpri;			/* ToolBar priority
 int		 usingSunWorkShop = 0;	/* set if -ws flag is used */
 char		 curMenuName[BUFSIZ];
 char		 curMenuPriority[BUFSIZ];
-BalloonEval	*balloonEval;
 
 static Boolean	 workshopInitDone = False;
 static Boolean	 workshopHotKeysEnabled = False;
@@ -220,21 +219,7 @@ workshop_load_file(
 #endif
 
 #ifdef FEAT_BEVAL
-    if (balloonEval == NULL)
-    {
-	/*
-	 * Set up the Balloon Expression Evaluation area.
-	 * It's enabled by default.  Disable it when 'ballooneval' is off.
-	 */
-# ifdef FEAT_GUI_GTK
-	balloonEval = gui_mch_create_beval_area(gui.drawarea, NULL,
-							      &bevalCB, NULL);
-# else
-	balloonEval = gui_mch_create_beval_area(textArea, NULL, bevalCB, NULL);
-# endif
-	if (!p_beval)
-	    gui_mch_disable_beval_area(balloonEval);
-    }
+    bevalServers |= BEVAL_WORKSHOP;
 #endif
 
     load_window(filename, line);
@@ -1566,15 +1551,15 @@ fixAccelText(
 }
 
 #ifdef FEAT_BEVAL
-    static void
-bevalCB(
+    void
+workshop_beval_cb(
 	BalloonEval	*beval,
 	int		 state)
 {
-    char_u	*filename;
+    win_T	*wp;
     char_u	*text;
     int		 type;
-    int		 line;
+    linenr_T	 lnum;
     int		 col;
     int		 idx;
     char	 buf[MAXPATHLEN * 2];
@@ -1583,7 +1568,7 @@ bevalCB(
     if (!p_beval)
 	return;
 
-    if (gui_mch_get_beval_info(beval, &filename, &line, &text, &col) == OK)
+    if (get_beval_info(beval, FALSE, &wp, &lnum, &text, &col) == OK)
     {
 	if (text && text[0])
 	{
@@ -1606,7 +1591,7 @@ bevalCB(
 	    idx = computeIndex(col, text, beval->ts);
 	    if (idx > 0)
 	    {
-		line = 0;
+		lnum = 0;
 
 		/*
 		 * If successful, it will respond with a balloon cmd.
@@ -1623,9 +1608,10 @@ bevalCB(
 
 		/* Send request to dbx */
 		sprintf(buf, "toolVerb debug.balloonEval "
-			"%s %d,0 %d,0 %d,%d %d %s\n", (char *) filename,
-			line, idx, type, serialNo++,
-			strlen((char *) text), (char *) text);
+			"%s %ld,0 %d,0 %d,%d %ld %s\n",
+			(char *)wp->w_buffer->b_ffname,
+			(long)lnum, idx, type, serialNo++,
+			(long)strlen((char *)text), (char *)text);
 		balloonEval = beval;
 		workshop_send_message(buf);
 	    }