Skip to content

Commit ce41316

Browse files
committed
updated for version 7.3.320
Problem: When a 0xa0 character is in a sourced file the error message for unrecognized command does not show the problem. Solution: Display 0xa0 as <a0>.
1 parent 7b66728 commit ce41316

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

src/ex_docmd.c

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ static char_u *do_one_cmd __ARGS((char_u **, int, struct condstack *, char_u *(*
6161
static char_u *do_one_cmd __ARGS((char_u **, int, char_u *(*fgetline)(int, void *, int), void *cookie));
6262
static int if_level = 0; /* depth in :if */
6363
#endif
64+
static void append_command __ARGS((char_u *cmd));
6465
static char_u *find_command __ARGS((exarg_T *eap, int *full));
6566

6667
static void ex_abbreviate __ARGS((exarg_T *eap));
@@ -2136,10 +2137,7 @@ do_one_cmd(cmdlinep, sourcing,
21362137
{
21372138
STRCPY(IObuff, _("E492: Not an editor command"));
21382139
if (!sourcing)
2139-
{
2140-
STRCAT(IObuff, ": ");
2141-
STRNCAT(IObuff, *cmdlinep, 40);
2142-
}
2140+
append_command(*cmdlinep);
21432141
errormsg = IObuff;
21442142
}
21452143
goto doend;
@@ -2708,8 +2706,7 @@ do_one_cmd(cmdlinep, sourcing,
27082706
STRCPY(IObuff, errormsg);
27092707
errormsg = IObuff;
27102708
}
2711-
STRCAT(errormsg, ": ");
2712-
STRNCAT(errormsg, *cmdlinep, IOSIZE - STRLEN(IObuff) - 1);
2709+
append_command(*cmdlinep);
27132710
}
27142711
emsg(errormsg);
27152712
}
@@ -2796,6 +2793,42 @@ checkforcmd(pp, cmd, len)
27962793
return FALSE;
27972794
}
27982795

2796+
/*
2797+
* Append "cmd" to the error message in IObuff.
2798+
* Takes care of limiting the length and handling 0xa0, which would be
2799+
* invisible otherwise.
2800+
*/
2801+
static void
2802+
append_command(cmd)
2803+
char_u *cmd;
2804+
{
2805+
char_u *s = cmd;
2806+
char_u *d;
2807+
2808+
STRCAT(IObuff, ": ");
2809+
d = IObuff + STRLEN(IObuff);
2810+
while (*s != NUL && d - IObuff < IOSIZE - 7)
2811+
{
2812+
if (
2813+
#ifdef FEAT_MBYTE
2814+
enc_utf8 ? (s[0] == 0xc2 && s[1] == 0xa0) :
2815+
#endif
2816+
*s == 0xa0)
2817+
{
2818+
s +=
2819+
#ifdef FEAT_MBYTE
2820+
enc_utf8 ? 2 :
2821+
#endif
2822+
1;
2823+
STRCPY(d, "<a0>");
2824+
d += 4;
2825+
}
2826+
else
2827+
MB_COPY_CHAR(s, d);
2828+
}
2829+
*d = NUL;
2830+
}
2831+
27992832
/*
28002833
* Find an Ex command by its name, either built-in or user.
28012834
* Start of the name can be found at eap->cmd.

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,8 @@ static char *(features[]) =
709709

710710
static int included_patches[] =
711711
{ /* Add new patch number below this line */
712+
/**/
713+
320,
712714
/**/
713715
319,
714716
/**/

0 commit comments

Comments
 (0)