Karsten Hopp ddfcc6
To: vim_dev@googlegroups.com
Karsten Hopp ddfcc6
Subject: Patch 7.3.320
Karsten Hopp ddfcc6
Fcc: outbox
Karsten Hopp ddfcc6
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ddfcc6
Mime-Version: 1.0
Karsten Hopp ddfcc6
Content-Type: text/plain; charset=UTF-8
Karsten Hopp ddfcc6
Content-Transfer-Encoding: 8bit
Karsten Hopp ddfcc6
------------
Karsten Hopp ddfcc6
Karsten Hopp ddfcc6
Patch 7.3.320
Karsten Hopp ddfcc6
Problem:    When a 0xa0 character is in a sourced file the error message for
Karsten Hopp ddfcc6
	    unrecognized command does not show the problem.
Karsten Hopp ddfcc6
Solution:   Display 0xa0 as <a0>.
Karsten Hopp ddfcc6
Files:	    src/ex_docmd.c
Karsten Hopp ddfcc6
Karsten Hopp ddfcc6
Karsten Hopp ddfcc6
*** ../vim-7.3.319/src/ex_docmd.c	2011-07-20 16:36:35.000000000 +0200
Karsten Hopp ddfcc6
--- src/ex_docmd.c	2011-09-21 19:02:15.000000000 +0200
Karsten Hopp ddfcc6
***************
Karsten Hopp ddfcc6
*** 61,66 ****
Karsten Hopp ddfcc6
--- 61,67 ----
Karsten Hopp ddfcc6
  static char_u	*do_one_cmd __ARGS((char_u **, int, char_u *(*fgetline)(int, void *, int), void *cookie));
Karsten Hopp ddfcc6
  static int	if_level = 0;		/* depth in :if */
Karsten Hopp ddfcc6
  #endif
Karsten Hopp ddfcc6
+ static void	append_command __ARGS((char_u *cmd));
Karsten Hopp ddfcc6
  static char_u	*find_command __ARGS((exarg_T *eap, int *full));
Karsten Hopp ddfcc6
  
Karsten Hopp ddfcc6
  static void	ex_abbreviate __ARGS((exarg_T *eap));
Karsten Hopp ddfcc6
***************
Karsten Hopp ddfcc6
*** 2136,2145 ****
Karsten Hopp ddfcc6
  	{
Karsten Hopp ddfcc6
  	    STRCPY(IObuff, _("E492: Not an editor command"));
Karsten Hopp ddfcc6
  	    if (!sourcing)
Karsten Hopp ddfcc6
! 	    {
Karsten Hopp ddfcc6
! 		STRCAT(IObuff, ": ");
Karsten Hopp ddfcc6
! 		STRNCAT(IObuff, *cmdlinep, 40);
Karsten Hopp ddfcc6
! 	    }
Karsten Hopp ddfcc6
  	    errormsg = IObuff;
Karsten Hopp ddfcc6
  	}
Karsten Hopp ddfcc6
  	goto doend;
Karsten Hopp ddfcc6
--- 2137,2143 ----
Karsten Hopp ddfcc6
  	{
Karsten Hopp ddfcc6
  	    STRCPY(IObuff, _("E492: Not an editor command"));
Karsten Hopp ddfcc6
  	    if (!sourcing)
Karsten Hopp ddfcc6
! 		append_command(*cmdlinep);
Karsten Hopp ddfcc6
  	    errormsg = IObuff;
Karsten Hopp ddfcc6
  	}
Karsten Hopp ddfcc6
  	goto doend;
Karsten Hopp ddfcc6
***************
Karsten Hopp ddfcc6
*** 2708,2715 ****
Karsten Hopp ddfcc6
  		STRCPY(IObuff, errormsg);
Karsten Hopp ddfcc6
  		errormsg = IObuff;
Karsten Hopp ddfcc6
  	    }
Karsten Hopp ddfcc6
! 	    STRCAT(errormsg, ": ");
Karsten Hopp ddfcc6
! 	    STRNCAT(errormsg, *cmdlinep, IOSIZE - STRLEN(IObuff) - 1);
Karsten Hopp ddfcc6
  	}
Karsten Hopp ddfcc6
  	emsg(errormsg);
Karsten Hopp ddfcc6
      }
Karsten Hopp ddfcc6
--- 2706,2712 ----
Karsten Hopp ddfcc6
  		STRCPY(IObuff, errormsg);
Karsten Hopp ddfcc6
  		errormsg = IObuff;
Karsten Hopp ddfcc6
  	    }
Karsten Hopp ddfcc6
! 	    append_command(*cmdlinep);
Karsten Hopp ddfcc6
  	}
Karsten Hopp ddfcc6
  	emsg(errormsg);
Karsten Hopp ddfcc6
      }
Karsten Hopp ddfcc6
***************
Karsten Hopp ddfcc6
*** 2797,2802 ****
Karsten Hopp ddfcc6
--- 2794,2835 ----
Karsten Hopp ddfcc6
  }
Karsten Hopp ddfcc6
  
Karsten Hopp ddfcc6
  /*
Karsten Hopp ddfcc6
+  * Append "cmd" to the error message in IObuff.
Karsten Hopp ddfcc6
+  * Takes care of limiting the length and handling 0xa0, which would be
Karsten Hopp ddfcc6
+  * invisible otherwise.
Karsten Hopp ddfcc6
+  */
Karsten Hopp ddfcc6
+     static void
Karsten Hopp ddfcc6
+ append_command(cmd)
Karsten Hopp ddfcc6
+     char_u *cmd;
Karsten Hopp ddfcc6
+ {
Karsten Hopp ddfcc6
+     char_u *s = cmd;
Karsten Hopp ddfcc6
+     char_u *d;
Karsten Hopp ddfcc6
+ 
Karsten Hopp ddfcc6
+     STRCAT(IObuff, ": ");
Karsten Hopp ddfcc6
+     d = IObuff + STRLEN(IObuff);
Karsten Hopp ddfcc6
+     while (*s != NUL && d - IObuff < IOSIZE - 7)
Karsten Hopp ddfcc6
+     {
Karsten Hopp ddfcc6
+ 	if (
Karsten Hopp ddfcc6
+ #ifdef FEAT_MBYTE
Karsten Hopp ddfcc6
+ 		enc_utf8 ? (s[0] == 0xc2 && s[1] == 0xa0) :
Karsten Hopp ddfcc6
+ #endif
Karsten Hopp ddfcc6
+ 		*s == 0xa0)
Karsten Hopp ddfcc6
+ 	{
Karsten Hopp ddfcc6
+ 	    s +=
Karsten Hopp ddfcc6
+ #ifdef FEAT_MBYTE
Karsten Hopp ddfcc6
+ 		enc_utf8 ? 2 :
Karsten Hopp ddfcc6
+ #endif
Karsten Hopp ddfcc6
+ 		1;
Karsten Hopp ddfcc6
+ 	    STRCPY(d, "<a0>");
Karsten Hopp ddfcc6
+ 	    d += 4;
Karsten Hopp ddfcc6
+ 	}
Karsten Hopp ddfcc6
+ 	else
Karsten Hopp ddfcc6
+ 	    MB_COPY_CHAR(s, d);
Karsten Hopp ddfcc6
+     }
Karsten Hopp ddfcc6
+     *d = NUL;
Karsten Hopp ddfcc6
+ }
Karsten Hopp ddfcc6
+ 
Karsten Hopp ddfcc6
+ /*
Karsten Hopp ddfcc6
   * Find an Ex command by its name, either built-in or user.
Karsten Hopp ddfcc6
   * Start of the name can be found at eap->cmd.
Karsten Hopp ddfcc6
   * Returns pointer to char after the command name.
Karsten Hopp ddfcc6
*** ../vim-7.3.319/src/version.c	2011-09-21 18:23:02.000000000 +0200
Karsten Hopp ddfcc6
--- src/version.c	2011-09-21 19:04:35.000000000 +0200
Karsten Hopp ddfcc6
***************
Karsten Hopp ddfcc6
*** 711,712 ****
Karsten Hopp ddfcc6
--- 711,714 ----
Karsten Hopp ddfcc6
  {   /* Add new patch number below this line */
Karsten Hopp ddfcc6
+ /**/
Karsten Hopp ddfcc6
+     320,
Karsten Hopp ddfcc6
  /**/
Karsten Hopp ddfcc6
Karsten Hopp ddfcc6
-- 
Karsten Hopp ddfcc6
hundred-and-one symptoms of being an internet addict:
Karsten Hopp ddfcc6
28. You have comandeered your teenager's phone line for the net and even his
Karsten Hopp ddfcc6
    friends know not to call on his line anymore.
Karsten Hopp ddfcc6
Karsten Hopp ddfcc6
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ddfcc6
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ddfcc6
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp ddfcc6
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///