changeset 435:73f016dbb279

updated for version 7.0112
author vimboss
date Thu, 21 Jul 2005 21:08:21 +0000
parents 9595cf1d80a7
children a1c5a6cb2675
files runtime/doc/autocmd.txt runtime/doc/eval.txt runtime/doc/options.txt runtime/doc/spell.txt runtime/doc/tags runtime/menu.vim src/Make_cyg.mak src/ex_getln.c src/gui_w32.c src/po/Make_mvc.mak src/search.c src/version.h
diffstat 12 files changed, 368 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt*   For Vim version 7.0aa.  Last change: 2005 Mar 04
+*autocmd.txt*   For Vim version 7.0aa.  Last change: 2005 Jul 21
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -542,6 +542,18 @@ QuickFixCmdPre						*QuickFixCmdPre*
 QuickFixCmdPost						*QuickFixCmdPost*
 				like QuickFixCmdPre, but after a quickfix
 				command is run.
+							*MenuPopup*
+MenuPopup			Just before showing the popup menu (under the
+				right mouse button).  Useful for adjusting the
+				menu for what is under the cursor or mouse
+				pointer.
+				The pattern is matched against a single
+				character representing the mode:
+					n	Normal
+					v	Visual
+					o	Operator-pending
+					i	Insert
+					c	Commmand line
 							*UserGettingBored*
 UserGettingBored		When the user hits CTRL-C.  Just kidding! :-)
 							*User*
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Jul 18
+*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Jul 21
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1511,6 +1511,8 @@ foreground( )			Number	bring the Vim win
 function( {name})		Funcref reference to function {name}
 get( {list}, {idx} [, {def}])	any	get item {idx} from {list} or {def}
 get( {dict}, {key} [, {def}])	any	get item {key} from {dict} or {def}
+getbufline( {expr}, {lnum} [, {end}])
+				List	lines {lnum} to {end} of buffer {expr}
 getchar( [expr])		Number	get one character from the user
 getcharmod( )			Number	modifiers for the last typed character
 getbufvar( {expr}, {varname})		variable {varname} in buffer {expr}
@@ -2409,6 +2411,35 @@ get({dict}, {key} [, {default}])
 		item is not available return {default}.  Return zero when
 		{default} is omitted.
 
+							*getbufline()*
+getbufline({expr}, {lnum} [, {end}])
+		Return the lines starting from {lnum} to {end} in the buffer
+		{expr} as a List. If {end} is omitted, only the line {lnum}
+		is returned.
+
+		For the use of {expr}, see |bufname()| above.
+
+		When {lnum} is a String that doesn't start with a
+		digit, line() is called to translate the String into a Number.
+
+		{end} is used in the same way as {lnum}.
+
+		When {lnum} is smaller than 1 or bigger than the number of
+		lines in the buffer, an empty List is returned.
+
+		When {end} is greater than the number of lines in the buffer,
+		it is treated as {end} is set to the number of lines in the
+		buffer.
+
+		When non-existing line ranges are specified, an empty List is
+		returned.  When {end} is before {lnum} an empty List is
+		returned.
+
+		This function works only for loaded buffers. For unloaded and
+		non-existing buffers, an empty List is returned.
+
+		Example: >
+			:let lines = getbufline(bufnr("myfile"), 1, "$")
 
 getbufvar({expr}, {varname})				*getbufvar()*
 		The result is the value of option or local buffer variable
@@ -2572,7 +2603,7 @@ getline({lnum} [, {end}])
 		including line {end}.
 		{end} is used in the same way as {lnum}.
 		Non-existing lines are silently omitted.
-		When {end} is before {lnum} an error is given.
+		When {end} is before {lnum} an empty List is returned.
 		Example: >
 			:let start = line('.')
 			:let end = search("^$") - 1
@@ -4290,6 +4321,7 @@ arabic			Compiled with Arabic support |A
 arp			Compiled with ARP support (Amiga).
 autocmd			Compiled with autocommands support.
 balloon_eval		Compiled with |balloon-eval| support.
+balloon_multiline	GUI supports multiline balloons.
 beos			BeOS version of Vim.
 browse			Compiled with |:browse| support, and browse() will
 			work.
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2005 Jul 18
+*options.txt*	For Vim version 7.0aa.  Last change: 2005 Jul 21
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -1013,7 +1013,7 @@ A jump table for the options with a shor
 	The evaluation of the expression must not have side effects!
 	Example: >
     function! MyBalloonExpr()
-	return 'Cursor is at line ' . v:beval_lnum . 
+	return 'Cursor is at line ' . v:beval_lnum .
 		\', column ' . v:beval_col .
 		\ ' of file ' .  bufname(v:beval_bufnr) .
 		\ ' on word "' . v:beval_text . '"'
@@ -1026,6 +1026,9 @@ A jump table for the options with a shor
 	Vim does not try to send a message to an external debugger (Netbeans
 	or Sun Workshop).
 
+	To check wether line breaks in the balloon text work use this check: >
+		if has("balloon_multiline")
+<
 				     *'binary'* *'bin'* *'nobinary'* *'nobin'*
 'binary' 'bin'		boolean	(default off)
 			local to buffer
--- a/runtime/doc/spell.txt
+++ b/runtime/doc/spell.txt
@@ -1,4 +1,4 @@
-*spell.txt*	For Vim version 7.0aa.  Last change: 2005 Jul 05
+*spell.txt*	For Vim version 7.0aa.  Last change: 2005 Jul 21
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -33,6 +33,11 @@ The words that are not recognized are hi
 
 Vim only checks words for spelling, there is no grammar check.
 
+If the 'mousemodel' option is set to "popup" and the cursor is on a badly
+spelled word or it is "popup_setpos" and the mouse pointer is on a badly
+spelled word, then the popup menu will contain an submenu to replace the bad
+word.  Note: this slows down the appearance of the popup menu.
+
 To search for the next misspelled word:
 
 							*]s* *E756*
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -3827,6 +3827,7 @@ Mac-format	editing.txt	/*Mac-format*
 Mac-format-write	editing.txt	/*Mac-format-write*
 Macintosh	os_mac.txt	/*Macintosh*
 Mark	motion.txt	/*Mark*
+MenuPopup	autocmd.txt	/*MenuPopup*
 MiNT	os_mint.txt	/*MiNT*
 Moolenaar	intro.txt	/*Moolenaar*
 MorphOS	os_amiga.txt	/*MorphOS*
@@ -5014,6 +5015,7 @@ garbagecollect()	eval.txt	/*garbagecolle
 gd	pattern.txt	/*gd*
 ge	motion.txt	/*ge*
 get()	eval.txt	/*get()*
+getbufline()	eval.txt	/*getbufline()*
 getbufvar()	eval.txt	/*getbufvar()*
 getchar()	eval.txt	/*getchar()*
 getcharmod()	eval.txt	/*getcharmod()*
--- a/runtime/menu.vim
+++ b/runtime/menu.vim
@@ -2,7 +2,7 @@
 " You can also use this as a start for your own set of menus.
 "
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2005 Jul 08
+" Last Change:	2005 Jul 21
 
 " Note that ":an" (short for ":anoremenu") is often used to make a menu work
 " in all modes and avoid side effects from mappings defined by the user.
@@ -873,6 +873,61 @@ noremenu  <script> <silent> 1.100 PopUp.
 inoremenu <script> <silent> 1.100 PopUp.Select\ &All	<C-O>:call <SID>SelectAll()<CR>
 cnoremenu <script> <silent> 1.100 PopUp.Select\ &All	<C-U>call <SID>SelectAll()<CR>
 
+if has("spell")
+  " Spell suggestions in the popup menu.  Note that this will slow down the
+  " appearance of the menu!
+  func! <SID>SpellPopup()
+    if exists("s:changeitem") && s:changeitem != ''
+      call <SID>SpellDel()
+    endif
+
+    let curcol = col('.')
+    let w = spellbadword()
+    if col('.') > curcol		" don't use word after the cursor
+      let w = ''
+      call cursor(0, curcol)	" put the cursor back where it was
+    endif
+    if w != ''
+      let s:suglist = spellsuggest(w, 10)
+      if len(s:suglist) <= 0
+	call cursor(0, curcol)	" put the cursor back where it was
+      else
+	let s:changeitem = 'change\ "' . escape(w, ' .'). '"\ to'
+	let s:fromword = w
+	let pri = 1
+	for sug in s:suglist
+	  exe 'amenu 1.5.' . pri . ' PopUp.' . s:changeitem . '.' . escape(sug, ' .')
+		\ . ' :call <SID>SpellReplace(' . pri . ')<CR>'
+	  let pri += 1
+	endfor
+
+	let s:additem = 'add\ "' . escape(w, ' .') . '"\ to\ word\ list'
+	exe 'amenu 1.6 PopUp.' . s:additem . ' :spellgood ' . w . '<CR>'
+
+	let s:ignoreitem = 'ignore\ "' . escape(w, ' .') . '"'
+	exe 'amenu 1.7 PopUp.' . s:ignoreitem . ' :spellgood! ' . w . '<CR>'
+
+	amenu 1.8 PopUp.-SpellSep- :
+      endif
+    endif
+  endfunc
+
+  func! <SID>SpellReplace(n)
+    let l = getline('.')
+    call setline('.', strpart(l, 0, col('.') - 1) . s:suglist[a:n - 1]
+	  \ . strpart(l, col('.') + len(s:fromword) - 1))
+  endfunc
+
+  func! <SID>SpellDel()
+    exe "aunmenu PopUp." . s:changeitem
+    exe "aunmenu PopUp." . s:additem
+    exe "aunmenu PopUp." . s:ignoreitem
+    aunmenu PopUp.-SpellSep-
+    let s:changeitem = ''
+  endfun
+
+  au! MenuPopup * call <SID>SpellPopup()
+endif
 
 " The GUI toolbar (for MS-Windows and GTK)
 if has("toolbar")
--- a/src/Make_cyg.mak
+++ b/src/Make_cyg.mak
@@ -353,7 +353,7 @@ EXE = gvim$(DEBUG_SUFFIX).exe
 OUTDIR = gobj$(DEBUG_SUFFIX)
 DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
 EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
-EXTRA_LIBS += -mwindows -lcomctl32
+EXTRA_LIBS += -mwindows -lcomctl32 -lversion
 else
 EXE = vim$(DEBUG_SUFFIX).exe
 OUTDIR = obj$(DEBUG_SUFFIX)
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -92,6 +92,7 @@ static void	redrawcmdprompt __ARGS((void
 static void	cursorcmd __ARGS((void));
 static int	ccheck_abbr __ARGS((int));
 static int	nextwild __ARGS((expand_T *xp, int type, int options));
+static void	escape_fname __ARGS((char_u **pp));
 static int	showmatches __ARGS((expand_T *xp, int wildmenu));
 static void	set_expand_context __ARGS((expand_T *xp));
 static int	ExpandFromContext __ARGS((expand_T *xp, char_u *, int *, char_u ***, int));
@@ -3365,18 +3366,14 @@ ExpandEscape(xp, str, numfiles, files, o
 		/* If 'str' starts with "\~", replace "~" at start of
 		 * files[i] with "\~". */
 		if (str[0] == '\\' && str[1] == '~' && files[i][0] == '~')
-		{
-		    p = alloc((unsigned)(STRLEN(files[i]) + 2));
-		    if (p != NULL)
-		    {
-			p[0] = '\\';
-			STRCPY(p + 1, files[i]);
-			vim_free(files[i]);
-			files[i] = p;
-		    }
-		}
+		    escape_fname(&files[i]);
 	    }
 	    xp->xp_backslash = XP_BS_NONE;
+
+	    /* If the first file starts with a '+' escape it.  Otherwise it
+	     * could be seen as "+cmd". */
+	    if (*files[0] == '+')
+		escape_fname(&files[0]);
 	}
 	else if (xp->xp_context == EXPAND_TAGS)
 	{
@@ -3398,6 +3395,25 @@ ExpandEscape(xp, str, numfiles, files, o
 }
 
 /*
+ * Put a backslash before the file name in "pp", which is in allocated memory.
+ */
+    static void
+escape_fname(pp)
+    char_u **pp;
+{
+    char_u	*p;
+
+    p = alloc((unsigned)(STRLEN(*pp) + 2));
+    if (p != NULL)
+    {
+	p[0] = '\\';
+	STRCPY(p + 1, *pp);
+	vim_free(*pp);
+	*pp = p;
+    }
+}
+
+/*
  * For each file name in files[num_files]:
  * If 'orig_pat' starts with "~/", replace the home directory with "~".
  */
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -188,8 +188,61 @@ static VOID CALLBACK BevalTimerProc __AR
 static BalloonEval  *cur_beval = NULL;
 static UINT	    BevalTimerId = 0;
 static DWORD	    LastActivity = 0;
+
+/*
+ * excerpts from headers since this may not be presented
+ * in the extremelly old compilers
+ */
+#include <pshpack1.h>
+
+typedef struct _DllVersionInfo
+{
+    DWORD cbSize;
+    DWORD dwMajorVersion;
+    DWORD dwMinorVersion;
+    DWORD dwBuildNumber;
+    DWORD dwPlatformID;
+} DLLVERSIONINFO;
+
+typedef struct tagTOOLINFOA_NEW
+{
+	UINT cbSize;
+	UINT uFlags;
+	HWND hwnd;
+	UINT uId;
+	RECT rect;
+	HINSTANCE hinst;
+	LPSTR lpszText;
+	LPARAM lParam;
+} TOOLINFO_NEW;
+
+typedef struct tagNMTTDISPINFO_NEW
+{
+    NMHDR      hdr;
+    LPTSTR     lpszText;
+    char       szText[80];
+    HINSTANCE  hinst;
+    UINT       uFlags;
+    LPARAM     lParam;
+} NMTTDISPINFO_NEW;
+
+#include <poppack.h>
+
+typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
+#ifndef TTM_SETMAXTIPWIDTH
+# define TTM_SETMAXTIPWIDTH	 (WM_USER+24)
 #endif
 
+#ifndef TTF_DI_SETITEM
+# define TTF_DI_SETITEM          0x8000
+#endif
+
+#ifndef TTN_GETDISPINFO
+# define TTN_GETDISPINFO        (TTN_FIRST - 0)
+#endif
+
+#endif /* defined(FEAT_BEVAL) */
+
 /* Local variables: */
 
 #ifdef FEAT_MENU
@@ -4021,13 +4074,93 @@ gui_mch_destroy_sign(sign)
  * 5) WM_NOTOFY:TTN_POP destroys created tooltip
  */
 
+/*
+ * determine whether installed Common Controls support multiline tooltips
+ * (i.e. their version is >= 4.70
+ */
+    int
+multiline_balloon_available(void)
+{
+    HINSTANCE hDll;
+    static char comctl_dll[] = "comctl32.dll";
+    static int multiline_tip = MAYBE;
+
+    if (multiline_tip != MAYBE)
+	return multiline_tip;
+
+    hDll = GetModuleHandle(comctl_dll);
+    if (hDll != NULL)
+    {
+        DLLGETVERSIONPROC pGetVer;
+        pGetVer = (DLLGETVERSIONPROC)GetProcAddress(hDll, "DllGetVersion");
+
+        if (pGetVer != NULL)
+        {
+            DLLVERSIONINFO dvi;
+            HRESULT hr;
+
+            ZeroMemory(&dvi, sizeof(dvi));
+            dvi.cbSize = sizeof(dvi);
+
+            hr = (*pGetVer)(&dvi);
+
+            if (SUCCEEDED(hr)
+		    && (dvi.dwMajorVersion > 4
+		    || (dvi.dwMajorVersion == 4 && dvi.dwMinorVersion >= 70)))
+	    {
+		multiline_tip = TRUE;
+		return multiline_tip;
+	    }
+        }
+	else
+	{
+	    /* there is chance we have ancient CommCtl 4.70
+	       which doesn't export DllGetVersion */
+	    DWORD dwHandle = 0;
+	    DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle);
+	    if (len > 0)
+	    {
+		VS_FIXEDFILEINFO *ver;
+		UINT vlen = 0;
+		void *data = alloc(len);
+
+		if (data != NULL
+			&& GetFileVersionInfo(comctl_dll, 0, len, data)
+			&& VerQueryValue(data, "\\", (void **)&ver, &vlen)
+			&& vlen
+			&& HIWORD(ver->dwFileVersionMS) > 4
+			|| (HIWORD(ver->dwFileVersionMS) == 4
+			    && LOWORD(ver->dwFileVersionMS) >= 70))
+		{
+		    vim_free(data);
+		    multiline_tip = TRUE;
+		    return multiline_tip;
+		}
+		vim_free(data);
+	    }
+	}
+    }
+    multiline_tip = FALSE;
+    return multiline_tip;
+}
+
     static void
 make_tooltip(beval, text, pt)
     BalloonEval *beval;
     char *text;
     POINT pt;
 {
-    TOOLINFO	ti;
+    TOOLINFO	*pti;
+    int		ToolInfoSize;
+
+    if (multiline_balloon_available() == TRUE)
+	ToolInfoSize = sizeof(TOOLINFO_NEW);
+    else
+	ToolInfoSize = sizeof(TOOLINFO);
+
+    pti = (TOOLINFO *)alloc(ToolInfoSize);
+    if (pti == NULL)
+	return;
 
     beval->balloon = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS,
 	    NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
@@ -4037,20 +4170,32 @@ make_tooltip(beval, text, pt)
     SetWindowPos(beval->balloon, HWND_TOPMOST, 0, 0, 0, 0,
 	    SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
 
-    ti.cbSize = sizeof(TOOLINFO);
-    ti.uFlags = TTF_SUBCLASS;
-    ti.hwnd = beval->target;
-    ti.hinst = 0; /* Don't use string resources */
-    ti.uId = ID_BEVAL_TOOLTIP;
-    ti.lpszText = text;
+    pti->cbSize = ToolInfoSize;
+    pti->uFlags = TTF_SUBCLASS;
+    pti->hwnd = beval->target;
+    pti->hinst = 0; /* Don't use string resources */
+    pti->uId = ID_BEVAL_TOOLTIP;
+
+    if (multiline_balloon_available() == TRUE)
+    {
+	RECT rect;
+	TOOLINFO_NEW *ptin = (TOOLINFO_NEW *)pti;
+	pti->lpszText = LPSTR_TEXTCALLBACK;
+	ptin->lParam = (LPARAM)text;
+	if (GetClientRect(s_textArea, &rect)) /* switch multiline tooltips on */
+	    SendMessage(beval->balloon, TTM_SETMAXTIPWIDTH, 0,
+		    (LPARAM)rect.right);
+    }
+    else
+	pti->lpszText = text; /* do this old way */
 
     /* Limit ballooneval bounding rect to CursorPos neighbourhood */
-    ti.rect.left = pt.x - 3;
-    ti.rect.top = pt.y - 3;
-    ti.rect.right = pt.x + 3;
-    ti.rect.bottom = pt.y + 3;
-
-    SendMessage(beval->balloon, TTM_ADDTOOL, 0, (LPARAM)&ti);
+    pti->rect.left = pt.x - 3;
+    pti->rect.top = pt.y - 3;
+    pti->rect.right = pt.x + 3;
+    pti->rect.bottom = pt.y + 3;
+
+    SendMessage(beval->balloon, TTM_ADDTOOL, 0, (LPARAM)pti);
     /* Make tooltip appear sooner */
     SendMessage(beval->balloon, TTM_SETDELAYTIME, TTDT_INITIAL, 10);
     /*
@@ -4059,6 +4204,7 @@ make_tooltip(beval, text, pt)
      */
     mouse_event(MOUSEEVENTF_MOVE, 1, 1, 0, 0);
     mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0);
+    vim_free(pti);
 }
 
     static void
@@ -4187,7 +4333,6 @@ gui_mch_create_beval_area(target, mesg, 
 	beval->clientData = clientData;
 
 	InitCommonControls();
-
 	cur_beval = beval;
 
 	if (p_beval)
@@ -4208,19 +4353,28 @@ Handle_WM_Notify(hwnd, pnmh)
 
     if (cur_beval != NULL)
     {
-	if (pnmh->code == TTN_SHOW)
+	switch (pnmh->code)
 	{
+	case TTN_SHOW:
 	    // TRACE0("TTN_SHOW {{{");
 	    // TRACE0("TTN_SHOW }}}");
-	}
-	else if (pnmh->code == TTN_POP) /* Before tooltip disappear */
-	{
+	    break;
+	case TTN_POP: /* Before tooltip disappear */
 	    // TRACE0("TTN_POP {{{");
 	    delete_tooltip(cur_beval);
 	    gui_mch_enable_beval_area(cur_beval);
 	    // TRACE0("TTN_POP }}}");
 
 	    cur_beval->showState = ShS_NEUTRAL;
+	    break;
+	case TTN_GETDISPINFO:
+	{
+	    /* if you get there then we have new common controls */
+	    NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh;
+	    info->lpszText = (LPSTR)info->lParam;
+	    info->uFlags |= TTF_DI_SETITEM;
+	}
+	    break;
 	}
     }
 }
--- a/src/po/Make_mvc.mak
+++ b/src/po/Make_mvc.mak
@@ -6,11 +6,53 @@
 # Please read README_mvc.txt before using this file.
 #
 
-LANGUAGES =	af ca cs de en_GB es fr ga it ja ko no pl ru sk sv uk vi zh_TW \
-		zh_TW.UTF-8 zh_CN zh_CN.UTF-8
-MOFILES =	af.mo ca.mo cs.mo de.mo en_GB.mo es.mo fr.mo ga.mo it.mo ja.mo \
-		ko.mo no.mo pl.mo ru.mo sk.mo sv.mo uk.mo vi.mo \
-		zh_TW.mo zh_TW.UTF-8.mo zh_CN.mo zh_CN.UTF-8.mo
+LANGUAGES = \
+		af \
+		ca \
+		cs \
+		de \
+		en_GB \
+		es \
+		fr \
+		ga \
+		it \
+		ja \
+		ko \
+		no \
+		pl \
+		ru \
+		sk \
+		sv \
+		uk \
+		vi \
+		zh_CN \
+		zh_CN.UTF-8 \
+		zh_TW \
+		zh_TW.UTF-8 \
+
+MOFILES = \
+		af.mo \
+		ca.mo \
+		cs.mo \
+		de.mo \
+		en_GB.mo \
+		es.mo \
+		fr.mo \
+		ga.mo \
+		it.mo \
+		ja.mo \
+		ko.mo \
+		no.mo \
+		pl.mo \
+		ru.mo \
+		sk.mo \
+		sv.mo \
+		uk.mo \
+		vi.mo \
+		zh_CN.UTF-8.mo \
+		zh_CN.mo \
+		zh_TW.UTF-8.mo \
+		zh_TW.mo \
 
 PACKAGE = vim
 
--- a/src/search.c
+++ b/src/search.c
@@ -3666,7 +3666,7 @@ current_tagblock(oap, count_arg, include
     old_start = old_end;
 
     /*
-     * If we start on "<aaa>" use the whole block inclusive.
+     * If we start on "<aaa>" select that block.
      */
 #ifdef FEAT_VISUAL
     if (!VIsual_active || equalpos(VIsual, curwin->w_cursor))
@@ -3713,7 +3713,7 @@ again:
      */
     for (n = 0; n < count; ++n)
     {
-	if (do_searchpair((char_u *)"<[^ \t>/!]\\+\\%(\\_s\\_[^>]\\{-}[^/]>\\|$\\|>\\)",
+	if (do_searchpair((char_u *)"<[^ \t>/!]\\+\\%(\\_s\\_[^>]\\{-}[^/]>\\|$\\|\\_s\\=>\\)",
 		    (char_u *)"",
 		    (char_u *)"</[^>]*>", BACKWARD, (char_u *)"", 0) <= 0)
 	{
@@ -3791,9 +3791,9 @@ again:
 	    }
 	curwin->w_cursor = end_pos;
 
-	/* If we now have the same start as before reset "do_include" and try
+	/* If we now have the same text as before reset "do_include" and try
 	 * again. */
-	if (equalpos(start_pos, old_start))
+	if (equalpos(start_pos, old_start) && equalpos(end_pos, old_end))
 	{
 	    do_include = TRUE;
 	    curwin->w_cursor = old_start;
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
 #define VIM_VERSION_NODOT	"vim70aa"
 #define VIM_VERSION_SHORT	"7.0aa"
 #define VIM_VERSION_MEDIUM	"7.0aa ALPHA"
-#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 20)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 20, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 21)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 21, compiled "