summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.320
blob: 3b957c2901ed685960b8941be2547fb094ac4041 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
To: vim_dev@googlegroups.com
Subject: Patch 7.3.320
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 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>.
Files:	    src/ex_docmd.c


*** ../vim-7.3.319/src/ex_docmd.c	2011-07-20 16:36:35.000000000 +0200
--- src/ex_docmd.c	2011-09-21 19:02:15.000000000 +0200
***************
*** 61,66 ****
--- 61,67 ----
  static char_u	*do_one_cmd __ARGS((char_u **, int, char_u *(*fgetline)(int, void *, int), void *cookie));
  static int	if_level = 0;		/* depth in :if */
  #endif
+ static void	append_command __ARGS((char_u *cmd));
  static char_u	*find_command __ARGS((exarg_T *eap, int *full));
  
  static void	ex_abbreviate __ARGS((exarg_T *eap));
***************
*** 2136,2145 ****
  	{
  	    STRCPY(IObuff, _("E492: Not an editor command"));
  	    if (!sourcing)
! 	    {
! 		STRCAT(IObuff, ": ");
! 		STRNCAT(IObuff, *cmdlinep, 40);
! 	    }
  	    errormsg = IObuff;
  	}
  	goto doend;
--- 2137,2143 ----
  	{
  	    STRCPY(IObuff, _("E492: Not an editor command"));
  	    if (!sourcing)
! 		append_command(*cmdlinep);
  	    errormsg = IObuff;
  	}
  	goto doend;
***************
*** 2708,2715 ****
  		STRCPY(IObuff, errormsg);
  		errormsg = IObuff;
  	    }
! 	    STRCAT(errormsg, ": ");
! 	    STRNCAT(errormsg, *cmdlinep, IOSIZE - STRLEN(IObuff) - 1);
  	}
  	emsg(errormsg);
      }
--- 2706,2712 ----
  		STRCPY(IObuff, errormsg);
  		errormsg = IObuff;
  	    }
! 	    append_command(*cmdlinep);
  	}
  	emsg(errormsg);
      }
***************
*** 2797,2802 ****
--- 2794,2835 ----
  }
  
  /*
+  * Append "cmd" to the error message in IObuff.
+  * Takes care of limiting the length and handling 0xa0, which would be
+  * invisible otherwise.
+  */
+     static void
+ append_command(cmd)
+     char_u *cmd;
+ {
+     char_u *s = cmd;
+     char_u *d;
+ 
+     STRCAT(IObuff, ": ");
+     d = IObuff + STRLEN(IObuff);
+     while (*s != NUL && d - IObuff < IOSIZE - 7)
+     {
+ 	if (
+ #ifdef FEAT_MBYTE
+ 		enc_utf8 ? (s[0] == 0xc2 && s[1] == 0xa0) :
+ #endif
+ 		*s == 0xa0)
+ 	{
+ 	    s +=
+ #ifdef FEAT_MBYTE
+ 		enc_utf8 ? 2 :
+ #endif
+ 		1;
+ 	    STRCPY(d, "<a0>");
+ 	    d += 4;
+ 	}
+ 	else
+ 	    MB_COPY_CHAR(s, d);
+     }
+     *d = NUL;
+ }
+ 
+ /*
   * Find an Ex command by its name, either built-in or user.
   * Start of the name can be found at eap->cmd.
   * Returns pointer to char after the command name.
*** ../vim-7.3.319/src/version.c	2011-09-21 18:23:02.000000000 +0200
--- src/version.c	2011-09-21 19:04:35.000000000 +0200
***************
*** 711,712 ****
--- 711,714 ----
  {   /* Add new patch number below this line */
+ /**/
+     320,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
28. You have comandeered your teenager's phone line for the net and even his
    friends know not to call on his line anymore.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///