4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Insert mode completion: When using the popup menu, after
12 completing a word and typing a non-word character Vim is still
13 completing the same word, following CTRL-N doesn't work.
14 Insert mode Completion: When using CTRL-X O and there is only
15 "struct." before the cursor, typing one char to reduce the
16 matches, then BS completion stops.
17 Solution: When typing a character that is not part of the item being
18 completed, stop complete mode. For whole line completion also
19 accept a space. For file name completion stop at a path
21 For omni completion stay in completion mode even if completing
26 *** ../vim-7.1.144/src/edit.c Thu Sep 13 18:25:08 2007
27 --- src/edit.c Fri Oct 19 16:04:38 2007
32 static void ins_ctrl_x __ARGS((void));
33 static int has_compl_option __ARGS((int dict_opt));
34 + static int ins_compl_accept_char __ARGS((int c));
35 static int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags, int adup));
36 static int ins_compl_equal __ARGS((compl_T *match, char_u *str, int len));
37 static void ins_compl_longest_match __ARGS((compl_T *match));
43 ! /* A printable, non-white character: Add to "compl_leader". */
44 ! if (vim_isprintc(c) && !vim_iswhite(c))
46 ins_compl_addleader(c);
52 ! /* A non-white character that fits in with the current
53 ! * completion: Add to "compl_leader". */
54 ! if (ins_compl_accept_char(c))
56 ins_compl_addleader(c);
64 + * Return TRUE when character "c" is part of the item currently being
65 + * completed. Used to decide whether to abandon complete mode when the menu
69 + ins_compl_accept_char(c)
72 + if (ctrl_x_mode & CTRL_X_WANT_IDENT)
73 + /* When expanding an identifier only accept identifier chars. */
74 + return vim_isIDc(c);
76 + switch (ctrl_x_mode)
79 + /* When expanding file name only accept file name chars. But not
80 + * path separators, so that "proto/<Tab>" expands files in
81 + * "proto", not "proto/" as a whole */
82 + return vim_isfilec(c) && !vim_ispathsep(c);
84 + case CTRL_X_CMDLINE:
86 + /* Command line and Omni completion can work with just about any
87 + * printable character, but do stop at white space. */
88 + return vim_isprintc(c) && !vim_iswhite(c);
90 + case CTRL_X_WHOLE_LINE:
91 + /* For while line completion a space can be part of the line. */
92 + return vim_isprintc(c);
94 + return vim_iswordc(c);
98 * This is like ins_compl_add(), but if 'ic' and 'inf' are set, then the
99 * case of the originally typed text is used, and the case of the completed
100 * text is inferred, ie this tries to work out what case you probably wanted
103 p = line + curwin->w_cursor.col;
104 mb_ptr_back(line, p);
106 ! /* Stop completion when the whole word was deleted. */
107 ! if ((int)(p - line) - (int)compl_col <= 0)
110 /* Deleted more than what was used to find matches or didn't finish
112 p = line + curwin->w_cursor.col;
113 mb_ptr_back(line, p);
115 ! /* Stop completion when the whole word was deleted. For Omni completion
116 ! * allow the word to be deleted, we won't match everything. */
117 ! if ((int)(p - line) - (int)compl_col < 0
118 ! || ((int)(p - line) - (int)compl_col == 0
119 ! && (ctrl_x_mode & CTRL_X_OMNI) == 0))
122 /* Deleted more than what was used to find matches or didn't finish
125 curs_col = curwin->w_cursor.col;
128 ! /* if this same ctrl_x_mode has been interrupted use the text from
129 * "compl_startpos" to the cursor as a pattern to add a new word
130 * instead of expand the one before the cursor, in word-wise if
132 ! * is not in the same line as the cursor then fix it (the line has
133 ! * been split because it was longer than 'tw'). if SOL is set then
134 ! * skip the previous pattern, a word at the beginning of the line has
135 ! * been inserted, we'll look for that -- Acevedo. */
136 if ((compl_cont_status & CONT_INTRPT) == CONT_INTRPT
137 && compl_cont_mode == ctrl_x_mode)
140 curs_col = curwin->w_cursor.col;
143 ! /* If this same ctrl_x_mode has been interrupted use the text from
144 * "compl_startpos" to the cursor as a pattern to add a new word
145 * instead of expand the one before the cursor, in word-wise if
146 ! * "compl_startpos" is not in the same line as the cursor then fix it
147 ! * (the line has been split because it was longer than 'tw'). if SOL
148 ! * is set then skip the previous pattern, a word at the beginning of
149 ! * the line has been inserted, we'll look for that -- Acevedo. */
150 if ((compl_cont_status & CONT_INTRPT) == CONT_INTRPT
151 && compl_cont_mode == ctrl_x_mode)
153 *** ../vim-7.1.144/src/version.c Fri Oct 19 18:57:33 2007
154 --- src/version.c Fri Oct 19 20:38:21 2007
158 { /* Add new patch number below this line */
164 Micro$oft: where do you want to go today?
165 Linux: where do you want to go tomorrow?
166 FreeBSD: are you guys coming, or what?
168 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
169 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
170 \\\ download, build and distribute -- http://www.A-A-P.org ///
171 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///