4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
18 Files: src/getchar.c, src/vim.h
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
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. */
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 *
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.
47 /* If noremap == REMAP_SCRIPT: do remap script-local mappings. */
48 if (noremap == REMAP_SCRIPT)
50 + else if (noremap == REMAP_SKIP)
57 * If noremap > 0: "noremap" characters are not remappable, the rest
65 * If noremap > 0: "noremap" characters are not remappable, the rest
68 ! if (noremap == REMAP_SKIP)
70 ! else if (noremap < 0)
76 && (no_zero_mapping == 0 || c1 != '0')
77 && (typebuf.tb_maplen == 0
79 ! && typebuf.tb_noremap[typebuf.tb_off]
81 && !(p_paste && (State & (INSERT + CMDLINE)))
82 && !(State == HITRETURN && (c1 == CAR || c1 == ' '))
85 && (no_zero_mapping == 0 || c1 != '0')
86 && (typebuf.tb_maplen == 0
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 == ' '))
95 * remapped, skip the entry.
97 for (n = mlen; --n >= 0; )
98 ! if (*s++ == RM_NONE)
103 * remapped, skip the entry.
105 for (n = mlen; --n >= 0; )
106 ! if (*s++ & (RM_NONE|RM_ABBR))
112 + typebuf.tb_off, 1);
114 KeyNoremap = (typebuf.tb_noremap[
115 ! typebuf.tb_off] != REMAP_YES);
118 break; /* got character, break for loop */
120 + typebuf.tb_off, 1);
122 KeyNoremap = (typebuf.tb_noremap[
124 ! & (RM_NONE|RM_SCRIPT));
127 break; /* got character, break for loop */
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'
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'
148 mp->m_noremap != REMAP_YES
150 : STRNCMP(mp->m_str, mp->m_keys,
153 0, TRUE, cmd_silent || mp->m_silent) == FAIL)
157 mp->m_noremap != REMAP_YES
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)
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
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 */
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
182 { /* Add new patch number below this line */
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
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 ///