changeset 2324:0a258a67051d vim73

In Visual mode with 'showcmd' display the number of bytes and characters.
author Bram Moolenaar <bram@vim.org>
date Sat, 17 Jul 2010 12:47:16 +0200
parents 1a6c5a3ff687
children f177a6431514
files runtime/doc/ft_ada.txt runtime/doc/ft_sql.txt runtime/doc/map.txt runtime/doc/options.txt runtime/doc/os_vms.txt runtime/doc/tags runtime/doc/todo.txt runtime/doc/various.txt src/normal.c
diffstat 9 files changed, 53 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/ft_ada.txt
+++ b/runtime/doc/ft_ada.txt
@@ -176,11 +176,11 @@ g:gnat.Make()
 
 							     *g:gnat.Pretty()*
 g:gnat.Pretty()
-		Calls|g:gnat.Pretty_Command|
+		Calls|g:gnat.Pretty_Program|
 
 							       *g:gnat.Find()*
 g:gnat.Find()
-		Calls|g:gnat.Find_Command|
+		Calls|g:gnat.Find_Program|
 
 							       *g:gnat.Tags()*
 g:gnat.Tags()
@@ -237,8 +237,8 @@ DEC ADA OBJECT ~
 
 							     *g:decada.Make()*
 g:decada.Make()		function
-		Calls|g:decada.Make_Command|and displays the result inside a
-               |quickfix| window.
+		Calls |g:decada.Make_Command| and displays the result inside a
+		|quickfix| window.
 
 							*g:decada.Unit_Name()*
 g:decada.Unit_Name()	function
@@ -246,7 +246,7 @@ g:decada.Unit_Name()	function
 
 						       *g:decada.Make_Command*
 g:decada.Make_Command	string
-		External command used for|g:decadat.Make()| (|'makeprg'|).
+		External command used for |g:decada.Make()| (|'makeprg'|).
 
 						       *g:decada.Error_Format*
 g:decada.Error_Format|	string
@@ -406,15 +406,15 @@ 5.3 Variables ~
 g:gnat			    object
 		Control object which manages GNAT compiles.  The object
 		is created when the first Ada source code is loaded provided
-		that |g:ada_default_compiler|is set to 'gnat'. See|gnat_members|
-		for details.
+		that |g:ada_default_compiler|is set to 'gnat'. See
+		|gnat_members| for details.
 
 								    *g:decada*
 g:decada		      object
 		Control object which manages Dec Ada compiles.	The object
 		is created when the first Ada source code is loaded provided
 		that |g:ada_default_compiler|is set to 'decada'. See
-	       |decada_members|for details.
+	        |decada_members| for details.
 
 ------------------------------------------------------------------------------
 5.4 Constants ~
--- a/runtime/doc/ft_sql.txt
+++ b/runtime/doc/ft_sql.txt
@@ -1,4 +1,4 @@
-*sql.txt*	For Vim version 7.3a.  Last change: 2009 Nov 03
+*ft_sql.txt*	For Vim version 7.3a.  Last change: 2009 Nov 03
 
 by David Fishburn
 
@@ -632,7 +632,7 @@ your |vimrc|: >
 		   MYTABLENAME --> M
 
     omni_sql_ignorecase
-<	- Default: Current setting for|ignorecase|
+<	- Default: Current setting for 'ignorecase'
 	- Valid settings are 0 or 1.
 	- When entering a few letters before initiating completion, the list
 	  will be filtered to display only the entries which begin with the
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -594,7 +594,7 @@ otherwise you would not be able to use t
 suggestions:
 - Function keys <F2>, <F3>, etc..  Also the shifted function keys <S-F1>,
   <S-F2>, etc.  Note that <F1> is already used for the help command.
-- Meta-keys (with the ALT key pressed).  Depending on your keybord accented
+- Meta-keys (with the ALT key pressed).  Depending on your keyboard accented
   characters may be used as well. |:map-alt-keys|
 - Use the '_' or ',' character and then any other character.  The "_" and ","
   commands do exist in Vim (see |_| and |,|), but you probably never use them.
@@ -767,7 +767,7 @@ g@{motion}		Call the function set by the
 			The function is called with one String argument:
 			    "line"	{motion} was |linewise|
 			    "char"	{motion} was |characterwise|
-			    "block"	{motion} was |blockwise-visual||
+			    "block"	{motion} was |blockwise-visual|
 			Although "block" would rarely appear, since it can
 			only result from Visual mode where "g@" is not useful.
 			{not available when compiled without the +eval
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -6065,6 +6065,8 @@ A jump table for the options with a shor
 	option off if your terminal is slow.
 	In Visual mode the size of the selected area is shown:
 	- When selecting characters within a line, the number of characters.
+	  If the number of bytes is different it is also displayed: "2-6"
+	  means two characters and six bytes.
 	- When selecting more than one line, the number of lines.
 	- When selecting a block, the size in screen characters:
 	  {lines}x{columns}.
--- a/runtime/doc/os_vms.txt
+++ b/runtime/doc/os_vms.txt
@@ -639,7 +639,7 @@ 8.13 Allow '$' in C keywords
 
 DEC C uses many identifiers with '$' in them.  This is not allowed in ANSI C,
 and Vim recognises the '$' as the end of the identifier.  You can change this
-with the |iskeyword|command.
+with the 'iskeyword' option.
 Add this command to your .vimrc file: >
 
     autocmd FileType c,cpp,cs  set iskeyword+=$
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -5638,6 +5638,7 @@ ft-xml-omni	insert.txt	/*ft-xml-omni*
 ft-xml-syntax	syntax.txt	/*ft-xml-syntax*
 ft-xpm-syntax	syntax.txt	/*ft-xpm-syntax*
 ft_ada.txt	ft_ada.txt	/*ft_ada.txt*
+ft_sql.txt	ft_sql.txt	/*ft_sql.txt*
 ftdetect	filetype.txt	/*ftdetect*
 ftp	pi_netrw.txt	/*ftp*
 ftplugin	usr_41.txt	/*ftplugin*
@@ -7504,7 +7505,6 @@ sql-object-motions	ft_sql.txt	/*sql-obje
 sql-predefined-objects	ft_sql.txt	/*sql-predefined-objects*
 sql-type-default	ft_sql.txt	/*sql-type-default*
 sql-types	ft_sql.txt	/*sql-types*
-sql.txt	ft_sql.txt	/*sql.txt*
 sql.vim	syntax.txt	/*sql.vim*
 sqlanywhere	ft_sql.txt	/*sqlanywhere*
 sqlanywhere.vim	syntax.txt	/*sqlanywhere.vim*
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1155,7 +1155,7 @@ More patches:
 -   Patch for adding "space" item in 'listchars'. (Jérémie Roquet, 2009 Oct 29,
     Docs patch Oct 30)
 -   Patch for supporting #rrggbb in color terminals.  (Matt Wozniski)
-    Where is a recent version of this patch?
+    Where is a recent version of this patch?  Or use CSApprox plugin?
 -   Replace ccomplete.vim by cppcomplete.vim from www.vim.org?  script 1520 by
     Vissale Neang.  (Martin Stubenschrott) Asked Vissale to make the scripts
     more friendly for the Vim distribution.
@@ -3013,7 +3013,7 @@ 9   With ":set tags=./tags,../tags" and 
 8   For 'tags' wildcard in the file name is not supported, only in the path.
     This is due to it using |file-searching|. Suboptimal solution would be to
     make the filename or the whole option use |wildcards| globing, better
-    would be to merge the 2 kinds of globing. originall (Erik Falor, 2008
+    would be to merge the 2 kinds of globing. originally (Erik Falor, 2008
     April 18), updated (Ian Kelling, 2008 July 4)
 8   Use a mechanism similar to omni completion to figure out the kind of tab
     for CTRL-] and jump to the appropriate matching tag (if there are
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -294,7 +294,7 @@ N  *+cmdline_compl*	command line complet
 N  *+cmdline_hist*	command line history |cmdline-history|
 N  *+cmdline_info*	|'showcmd'| and |'ruler'|
 N  *+comments*		|'comments'| support
-m  *+conceal*		"conceal" support, see ||conceal|| |:syn-conceal| etc.
+m  *+conceal*		"conceal" support, see |conceal| |:syn-conceal| etc.
 N  *+cryptv*		encryption support |encryption|
 B  *+cscope*		|cscope| support
 m  *+cursorbind*	|'cursorbind'| support
--- a/src/normal.c
+++ b/src/normal.c
@@ -3756,9 +3756,40 @@ clear_showcmd()
 	else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum)
 	    sprintf((char *)showcmd_buf, "%ld", lines);
 	else
-	    sprintf((char *)showcmd_buf, "%ld", (long)(cursor_bot
-		    ? curwin->w_cursor.col - VIsual.col
-		    : VIsual.col - curwin->w_cursor.col) + (*p_sel != 'e'));
+	{
+	    char_u  *s, *e;
+	    int	    l;
+	    int	    bytes = 0;
+	    int	    chars = 0;
+
+	    if (cursor_bot)
+	    {
+		s = ml_get_pos(&VIsual);
+		e = ml_get_cursor();
+	    }
+	    else
+	    {
+		s = ml_get_cursor();
+		e = ml_get_pos(&VIsual);
+	    }
+	    while ((*p_sel != 'e') ? s <= e : s < e)
+	    {
+		l = (*mb_ptr2len)(s);
+		if (l == 0)
+		{
+		    ++bytes;
+		    ++chars;
+		    break;  /* end of line */
+		}
+		bytes += l;
+		++chars;
+		s += l;
+	    }
+	    if (bytes == chars)
+		sprintf((char *)showcmd_buf, "%d", chars);
+	    else
+		sprintf((char *)showcmd_buf, "%d-%d", chars, bytes);
+	}
 	showcmd_buf[SHOWCMD_COLS] = NUL;	/* truncate */
 	showcmd_visual = TRUE;
     }