]>
Commit | Line | Data |
---|---|---|
6f27073b AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.035 | |
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 7.0.035 | |
11 | Problem: Insert mode completion works when typed but not when replayed from | |
12 | a register. (Hari Krishna Dara) | |
13 | Also: Mappings for Insert mode completion don't always work. | |
14 | Solution: When finding a non-completion key in the input don't interrupt | |
15 | completion when it wasn't typed. | |
16 | Do use mappings when checking for typeahead while still finding | |
17 | completions. Avoids that completion is interrupted too soon. | |
18 | Use "compl_pending" in a different way. | |
19 | Files: src/edit.c | |
20 | ||
21 | ||
22 | *** ../vim-7.0.034/src/edit.c Fri Jun 23 17:59:26 2006 | |
23 | --- src/edit.c Fri Jun 23 21:32:42 2006 | |
24 | *************** | |
25 | *** 4166,4173 **** | |
26 | { | |
27 | if (compl_shows_dir == FORWARD && compl_shown_match->cp_next != NULL) | |
28 | { | |
29 | - if (compl_pending != 0) | |
30 | - --compl_pending; | |
31 | compl_shown_match = compl_shown_match->cp_next; | |
32 | found_end = (compl_first_match != NULL | |
33 | && (compl_shown_match->cp_next == compl_first_match | |
34 | --- 4166,4171 ---- | |
35 | *************** | |
36 | *** 4176,4189 **** | |
37 | else if (compl_shows_dir == BACKWARD | |
38 | && compl_shown_match->cp_prev != NULL) | |
39 | { | |
40 | - if (compl_pending != 0) | |
41 | - ++compl_pending; | |
42 | found_end = (compl_shown_match == compl_first_match); | |
43 | compl_shown_match = compl_shown_match->cp_prev; | |
44 | found_end |= (compl_shown_match == compl_first_match); | |
45 | } | |
46 | else | |
47 | { | |
48 | if (advance) | |
49 | { | |
50 | if (compl_shows_dir == BACKWARD) | |
51 | --- 4174,4197 ---- | |
52 | else if (compl_shows_dir == BACKWARD | |
53 | && compl_shown_match->cp_prev != NULL) | |
54 | { | |
55 | found_end = (compl_shown_match == compl_first_match); | |
56 | compl_shown_match = compl_shown_match->cp_prev; | |
57 | found_end |= (compl_shown_match == compl_first_match); | |
58 | } | |
59 | else | |
60 | { | |
61 | + if (!allow_get_expansion) | |
62 | + { | |
63 | + if (advance) | |
64 | + { | |
65 | + if (compl_shows_dir == BACKWARD) | |
66 | + compl_pending -= todo + 1; | |
67 | + else | |
68 | + compl_pending += todo + 1; | |
69 | + } | |
70 | + return -1; | |
71 | + } | |
72 | + | |
73 | if (advance) | |
74 | { | |
75 | if (compl_shows_dir == BACKWARD) | |
76 | *************** | |
77 | *** 4191,4204 **** | |
78 | else | |
79 | ++compl_pending; | |
80 | } | |
81 | - if (!allow_get_expansion) | |
82 | - return -1; | |
83 | ||
84 | /* Find matches. */ | |
85 | num_matches = ins_compl_get_exp(&compl_startpos); | |
86 | ! if (compl_pending != 0 && compl_direction == compl_shows_dir | |
87 | && advance) | |
88 | ! compl_shown_match = compl_curr_match; | |
89 | found_end = FALSE; | |
90 | } | |
91 | if ((compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0 | |
92 | --- 4199,4225 ---- | |
93 | else | |
94 | ++compl_pending; | |
95 | } | |
96 | ||
97 | /* Find matches. */ | |
98 | num_matches = ins_compl_get_exp(&compl_startpos); | |
99 | ! | |
100 | ! /* handle any pending completions */ | |
101 | ! while (compl_pending != 0 && compl_direction == compl_shows_dir | |
102 | && advance) | |
103 | ! { | |
104 | ! if (compl_pending > 0 && compl_shown_match->cp_next != NULL) | |
105 | ! { | |
106 | ! compl_shown_match = compl_shown_match->cp_next; | |
107 | ! --compl_pending; | |
108 | ! } | |
109 | ! if (compl_pending < 0 && compl_shown_match->cp_prev != NULL) | |
110 | ! { | |
111 | ! compl_shown_match = compl_shown_match->cp_prev; | |
112 | ! ++compl_pending; | |
113 | ! } | |
114 | ! else | |
115 | ! break; | |
116 | ! } | |
117 | found_end = FALSE; | |
118 | } | |
119 | if ((compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0 | |
120 | *************** | |
121 | *** 4307,4315 **** | |
122 | return; | |
123 | count = 0; | |
124 | ||
125 | ! ++no_mapping; | |
126 | c = vpeekc_any(); | |
127 | - --no_mapping; | |
128 | if (c != NUL) | |
129 | { | |
130 | if (vim_is_ctrl_x_key(c) && c != Ctrl_X && c != Ctrl_R) | |
131 | --- 4328,4336 ---- | |
132 | return; | |
133 | count = 0; | |
134 | ||
135 | ! /* Check for a typed key. Do use mappings, otherwise vim_is_ctrl_x_key() | |
136 | ! * can't do its work correctly. */ | |
137 | c = vpeekc_any(); | |
138 | if (c != NUL) | |
139 | { | |
140 | if (vim_is_ctrl_x_key(c) && c != Ctrl_X && c != Ctrl_R) | |
141 | *************** | |
142 | *** 4319,4330 **** | |
143 | (void)ins_compl_next(FALSE, ins_compl_key2count(c), | |
144 | c != K_UP && c != K_DOWN); | |
145 | } | |
146 | ! else if (c != Ctrl_R) | |
147 | ! compl_interrupted = TRUE; | |
148 | } | |
149 | if (compl_pending != 0 && !got_int) | |
150 | ! (void)ins_compl_next(FALSE, compl_pending > 0 | |
151 | ! ? compl_pending : -compl_pending, TRUE); | |
152 | } | |
153 | ||
154 | /* | |
155 | --- 4340,4366 ---- | |
156 | (void)ins_compl_next(FALSE, ins_compl_key2count(c), | |
157 | c != K_UP && c != K_DOWN); | |
158 | } | |
159 | ! else | |
160 | ! { | |
161 | ! /* Need to get the character to have KeyTyped set. We'll put it | |
162 | ! * back with vungetc() below. */ | |
163 | ! c = safe_vgetc(); | |
164 | ! | |
165 | ! /* Don't interrupt completion when the character wasn't typed, | |
166 | ! * e.g., when doing @q to replay keys. */ | |
167 | ! if (c != Ctrl_R && KeyTyped) | |
168 | ! compl_interrupted = TRUE; | |
169 | ! | |
170 | ! vungetc(c); | |
171 | ! } | |
172 | } | |
173 | if (compl_pending != 0 && !got_int) | |
174 | ! { | |
175 | ! int todo = compl_pending > 0 ? compl_pending : -compl_pending; | |
176 | ! | |
177 | ! compl_pending = 0; | |
178 | ! (void)ins_compl_next(FALSE, todo, TRUE); | |
179 | ! } | |
180 | } | |
181 | ||
182 | /* | |
183 | *** ../vim-7.0.034/src/version.c Fri Jun 23 17:59:26 2006 | |
184 | --- src/version.c Fri Jun 23 21:35:39 2006 | |
185 | *************** | |
186 | *** 668,669 **** | |
187 | --- 668,671 ---- | |
188 | { /* Add new patch number below this line */ | |
189 | + /**/ | |
190 | + 35, | |
191 | /**/ | |
192 | ||
193 | -- | |
194 | So when I saw the post to comp.editors, I rushed over to the FTP site to | |
195 | grab it. So I yank apart the tarball, light x candles, where x= the | |
196 | vim version multiplied by the md5sum of the source divided by the MAC of | |
197 | my NIC (8A3FA78155A8A1D346C3C4A), put on black robes, dim the lights, | |
198 | wave a dead chicken over the hard drive, and summon the power of GNU GCC | |
199 | with the magic words "make config ; make!". | |
200 | [Jason Spence, compiling Vim 5.0] | |
201 | ||
202 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
203 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
204 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
205 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |