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: using CTRL-L to add an extra character
12 also deselects the current match, making it impossible to use
14 Solution: Keep the current match. Also make CTRL-L work at the original
15 text, using the first displayed match.
19 *** ../vim-7.0.012/src/edit.c Wed May 10 15:22:49 2006
20 --- src/edit.c Thu May 11 10:38:54 2006
26 ! /* Pressing CTRL-Y selects the current match. Shen
27 * compl_enter_selects is set the Enter key does the same. */
28 if (c == Ctrl_Y || (compl_enter_selects
29 && (c == CAR || c == K_KENTER || c == NL)))
34 ! /* Pressing CTRL-Y selects the current match. When
35 * compl_enter_selects is set the Enter key does the same. */
36 if (c == Ctrl_Y || (compl_enter_selects
37 && (c == CAR || c == K_KENTER || c == NL)))
41 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
42 compl_used_match = FALSE;
43 - compl_enter_selects = FALSE;
46 ins_compl_set_original_text(compl_leader);
51 compl_restarting = FALSE;
54 + #if 0 /* disabled, made CTRL-L, BS and typing char jump to original text. */
55 if (!compl_used_match)
57 /* Go to the original text, since none of the matches is inserted. */
61 compl_curr_match = compl_shown_match;
62 compl_shows_dir = compl_direction;
65 + compl_enter_selects = !compl_used_match;
67 /* Show the popup menu with a different set of matches. */
72 int len = curwin->w_cursor.col - compl_col;
75 p = compl_shown_match->cp_str;
76 if ((int)STRLEN(p) <= len) /* the match is too short */
83 int len = curwin->w_cursor.col - compl_col;
87 p = compl_shown_match->cp_str;
88 if ((int)STRLEN(p) <= len) /* the match is too short */
90 ! /* When still at the original match use the first entry that matches
92 ! if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
95 ! for (cp = compl_shown_match->cp_next; cp != NULL
96 ! && cp != compl_first_match; cp = cp->cp_next)
98 ! if (ins_compl_equal(cp, compl_leader,
99 ! (int)STRLEN(compl_leader)))
105 ! if (p == NULL || (int)STRLEN(p) <= len)
117 && compl_shown_match->cp_next != NULL
118 && compl_shown_match->cp_next != compl_first_match)
119 compl_shown_match = compl_shown_match->cp_next;
121 + /* If we didn't find it searching forward, and compl_shows_dir is
122 + * backward, find the last match. */
123 + if (compl_shows_dir == BACKWARD
124 + && !ins_compl_equal(compl_shown_match,
125 + compl_leader, (int)STRLEN(compl_leader))
126 + && (compl_shown_match->cp_next == NULL
127 + || compl_shown_match->cp_next == compl_first_match))
129 + while (!ins_compl_equal(compl_shown_match,
130 + compl_leader, (int)STRLEN(compl_leader))
131 + && compl_shown_match->cp_prev != NULL
132 + && compl_shown_match->cp_prev != compl_first_match)
133 + compl_shown_match = compl_shown_match->cp_prev;
137 if (allow_get_expansion && insert_match
138 *** ../vim-7.0.012/src/version.c Thu May 11 19:30:09 2006
139 --- src/version.c Fri May 12 19:03:32 2006
143 { /* Add new patch number below this line */
149 I'm writing a book. I've got the page numbers done.
151 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
152 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
153 \\\ download, build and distribute -- http://www.A-A-P.org ///
154 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///