]> git.pld-linux.org Git - packages/vim.git/blame - 7.1.145
- updated to 7.1.285
[packages/vim.git] / 7.1.145
CommitLineData
25f687b8
AM
1To: vim-dev@vim.org
2Subject: Patch 7.1.145
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=ISO-8859-1
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.1.145
11Problem: 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.
17Solution: 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
20 separator.
21 For omni completion stay in completion mode even if completing
22 with empty string.
23Files: src/edit.c
24
25
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
28***************
29*** 129,134 ****
30--- 129,135 ----
31
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));
38***************
39*** 754,761 ****
40 continue;
41 }
42
43! /* A printable, non-white character: Add to "compl_leader". */
44! if (vim_isprintc(c) && !vim_iswhite(c))
45 {
46 ins_compl_addleader(c);
47 continue;
48--- 755,763 ----
49 continue;
50 }
51
52! /* A non-white character that fits in with the current
53! * completion: Add to "compl_leader". */
54! if (ins_compl_accept_char(c))
55 {
56 ins_compl_addleader(c);
57 continue;
58***************
59*** 2053,2058 ****
60--- 2055,2094 ----
61 }
62
63 /*
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
66+ * is visible.
67+ */
68+ static int
69+ ins_compl_accept_char(c)
70+ int c;
71+ {
72+ if (ctrl_x_mode & CTRL_X_WANT_IDENT)
73+ /* When expanding an identifier only accept identifier chars. */
74+ return vim_isIDc(c);
75+
76+ switch (ctrl_x_mode)
77+ {
78+ case CTRL_X_FILES:
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);
83+
84+ case CTRL_X_CMDLINE:
85+ case CTRL_X_OMNI:
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);
89+
90+ case CTRL_X_WHOLE_LINE:
91+ /* For while line completion a space can be part of the line. */
92+ return vim_isprintc(c);
93+ }
94+ return vim_iswordc(c);
95+ }
96+
97+ /*
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
101***************
102*** 3128,3135 ****
103 p = line + curwin->w_cursor.col;
104 mb_ptr_back(line, p);
105
106! /* Stop completion when the whole word was deleted. */
107! if ((int)(p - line) - (int)compl_col <= 0)
108 return K_BS;
109
110 /* Deleted more than what was used to find matches or didn't finish
111--- 3164,3174 ----
112 p = line + curwin->w_cursor.col;
113 mb_ptr_back(line, p);
114
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))
120 return K_BS;
121
122 /* Deleted more than what was used to find matches or didn't finish
123***************
124*** 4591,4604 ****
125 curs_col = curwin->w_cursor.col;
126 compl_pending = 0;
127
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
131! * "compl_startpos"
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)
138 {
139--- 4630,4642 ----
140 curs_col = curwin->w_cursor.col;
141 compl_pending = 0;
142
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)
152 {
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
155***************
156*** 668,669 ****
157--- 668,671 ----
158 { /* Add new patch number below this line */
159+ /**/
160+ 145,
161 /**/
162
163--
164Micro$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?
167
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 ///
This page took 0.057181 seconds and 4 git commands to generate.