]>
Commit | Line | Data |
---|---|---|
be561239 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.3.023 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.3.023 | |
11 | Problem: When the "to" part of a mapping starts with its "from" part, | |
12 | abbreviations for the same characters is not possible. For | |
13 | example, when <Space> is mapped to something that starts with a | |
14 | space, typing <Space> does not expand abbreviations. | |
15 | Solution: Only disable expanding abbreviations when a mapping is not | |
16 | remapped, don't disable it when the RHS of a mapping starts with | |
17 | the LHS. | |
18 | Files: src/getchar.c, src/vim.h | |
19 | ||
20 | ||
21 | *** ../vim-6.3.022/src/getchar.c Wed Jun 9 14:56:25 2004 | |
22 | --- src/getchar.c Sat Sep 4 18:16:26 2004 | |
23 | *************** | |
24 | *** 100,105 **** | |
25 | --- 100,106 ---- | |
26 | #define RM_YES 0 /* tb_noremap: remap */ | |
27 | #define RM_NONE 1 /* tb_noremap: don't remap */ | |
28 | #define RM_SCRIPT 2 /* tb_noremap: remap local script mappings */ | |
29 | + #define RM_ABBR 4 /* tb_noremap: don't remap, do abbrev. */ | |
30 | ||
31 | /* typebuf.tb_buf has three parts: room in front (for result of mappings), the | |
32 | * middle for typeahead and room for new characters (which needs to be 3 * | |
33 | *************** | |
34 | *** 896,901 **** | |
35 | --- 897,904 ---- | |
36 | * | |
37 | * If noremap is REMAP_YES, new string can be mapped again. | |
38 | * If noremap is REMAP_NONE, new string cannot be mapped again. | |
39 | + * If noremap is REMAP_SKIP, fist char of new string cannot be mapped again, | |
40 | + * but abbreviations are allowed. | |
41 | * If noremap is REMAP_SCRIPT, new string cannot be mapped again, except for | |
42 | * script-local mappings. | |
43 | * If noremap is > 0, that many characters of the new string cannot be mapped. | |
44 | *************** | |
45 | *** 993,998 **** | |
46 | --- 996,1003 ---- | |
47 | /* If noremap == REMAP_SCRIPT: do remap script-local mappings. */ | |
48 | if (noremap == REMAP_SCRIPT) | |
49 | val = RM_SCRIPT; | |
50 | + else if (noremap == REMAP_SKIP) | |
51 | + val = RM_ABBR; | |
52 | else | |
53 | val = RM_NONE; | |
54 | ||
55 | *************** | |
56 | *** 1004,1010 **** | |
57 | * If noremap > 0: "noremap" characters are not remappable, the rest | |
58 | * mappable | |
59 | */ | |
60 | ! if (noremap < 0) | |
61 | nrm = addlen; | |
62 | else | |
63 | nrm = noremap; | |
64 | --- 1009,1017 ---- | |
65 | * If noremap > 0: "noremap" characters are not remappable, the rest | |
66 | * mappable | |
67 | */ | |
68 | ! if (noremap == REMAP_SKIP) | |
69 | ! nrm = 1; | |
70 | ! else if (noremap < 0) | |
71 | nrm = addlen; | |
72 | else | |
73 | nrm = noremap; | |
74 | *************** | |
75 | *** 1856,1863 **** | |
76 | && (no_zero_mapping == 0 || c1 != '0') | |
77 | && (typebuf.tb_maplen == 0 | |
78 | || (p_remap | |
79 | ! && typebuf.tb_noremap[typebuf.tb_off] | |
80 | ! != RM_NONE)) | |
81 | && !(p_paste && (State & (INSERT + CMDLINE))) | |
82 | && !(State == HITRETURN && (c1 == CAR || c1 == ' ')) | |
83 | && State != ASKMORE | |
84 | --- 1863,1870 ---- | |
85 | && (no_zero_mapping == 0 || c1 != '0') | |
86 | && (typebuf.tb_maplen == 0 | |
87 | || (p_remap | |
88 | ! && (typebuf.tb_noremap[typebuf.tb_off] | |
89 | ! & (RM_NONE|RM_ABBR)) == 0)) | |
90 | && !(p_paste && (State & (INSERT + CMDLINE))) | |
91 | && !(State == HITRETURN && (c1 == CAR || c1 == ' ')) | |
92 | && State != ASKMORE | |
93 | *************** | |
94 | *** 1973,1979 **** | |
95 | * remapped, skip the entry. | |
96 | */ | |
97 | for (n = mlen; --n >= 0; ) | |
98 | ! if (*s++ == RM_NONE) | |
99 | break; | |
100 | if (n >= 0) | |
101 | continue; | |
102 | --- 1980,1986 ---- | |
103 | * remapped, skip the entry. | |
104 | */ | |
105 | for (n = mlen; --n >= 0; ) | |
106 | ! if (*s++ & (RM_NONE|RM_ABBR)) | |
107 | break; | |
108 | if (n >= 0) | |
109 | continue; | |
110 | *************** | |
111 | *** 2132,2138 **** | |
112 | + typebuf.tb_off, 1); | |
113 | } | |
114 | KeyNoremap = (typebuf.tb_noremap[ | |
115 | ! typebuf.tb_off] != REMAP_YES); | |
116 | del_typebuf(1, 0); | |
117 | } | |
118 | break; /* got character, break for loop */ | |
119 | --- 2139,2146 ---- | |
120 | + typebuf.tb_off, 1); | |
121 | } | |
122 | KeyNoremap = (typebuf.tb_noremap[ | |
123 | ! typebuf.tb_off] | |
124 | ! & (RM_NONE|RM_SCRIPT)); | |
125 | del_typebuf(1, 0); | |
126 | } | |
127 | break; /* got character, break for loop */ | |
128 | *************** | |
129 | *** 2233,2239 **** | |
130 | /* | |
131 | * Insert the 'to' part in the typebuf.tb_buf. | |
132 | * If 'from' field is the same as the start of the | |
133 | ! * 'to' field, don't remap the first character. | |
134 | * If m_noremap is set, don't remap the whole 'to' | |
135 | * part. | |
136 | */ | |
137 | --- 2241,2248 ---- | |
138 | /* | |
139 | * Insert the 'to' part in the typebuf.tb_buf. | |
140 | * If 'from' field is the same as the start of the | |
141 | ! * 'to' field, don't remap the first character (but do | |
142 | ! * allow abbreviations). | |
143 | * If m_noremap is set, don't remap the whole 'to' | |
144 | * part. | |
145 | */ | |
146 | *************** | |
147 | *** 2241,2248 **** | |
148 | mp->m_noremap != REMAP_YES | |
149 | ? mp->m_noremap | |
150 | : STRNCMP(mp->m_str, mp->m_keys, | |
151 | ! (size_t)keylen) | |
152 | ! ? REMAP_YES : 1, | |
153 | 0, TRUE, cmd_silent || mp->m_silent) == FAIL) | |
154 | { | |
155 | c = -1; | |
156 | --- 2250,2257 ---- | |
157 | mp->m_noremap != REMAP_YES | |
158 | ? mp->m_noremap | |
159 | : STRNCMP(mp->m_str, mp->m_keys, | |
160 | ! (size_t)keylen) != 0 | |
161 | ! ? REMAP_YES : REMAP_SKIP, | |
162 | 0, TRUE, cmd_silent || mp->m_silent) == FAIL) | |
163 | { | |
164 | c = -1; | |
165 | *** ../vim-6.3.022/src/vim.h Wed Jun 9 14:56:26 2004 | |
166 | --- src/vim.h Sat Sep 4 18:17:00 2004 | |
167 | *************** | |
168 | *** 726,731 **** | |
169 | --- 726,732 ---- | |
170 | #define REMAP_YES 0 /* allow remapping */ | |
171 | #define REMAP_NONE -1 /* no remapping */ | |
172 | #define REMAP_SCRIPT -2 /* remap script-local mappings only */ | |
173 | + #define REMAP_SKIP -3 /* no remapping for first char */ | |
174 | ||
175 | /* Values for mch_call_shell() second argument */ | |
176 | #define SHELL_FILTER 1 /* filtering text */ | |
177 | *** ../vim-6.3.022/src/version.c Sat Sep 4 16:28:02 2004 | |
178 | --- src/version.c Sat Sep 4 18:20:40 2004 | |
179 | *************** | |
180 | *** 643,644 **** | |
181 | --- 643,646 ---- | |
182 | { /* Add new patch number below this line */ | |
183 | + /**/ | |
184 | + 23, | |
185 | /**/ | |
186 | ||
187 | -- | |
188 | TALL KNIGHT: We shall say Ni! again to you if you do not appease us. | |
189 | ARTHUR: All right! What do you want? | |
190 | TALL KNIGHT: We want ... a shrubbery! | |
191 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
192 | ||
193 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
194 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
195 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
196 | \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html /// |