4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Crash when doing spell completion in an empty line and pressing
13 Solution: Check for a zero pointer. (James Vega)
14 Also handle a situation without a matching pattern better, report
15 "No matches" instead of remaining in undefined CTRL-X mode. And
16 get out of CTRL-X mode when typing a letter.
20 *** ../vim-7.0.022/src/edit.c Sat May 13 15:27:57 2006
21 --- src/edit.c Thu Jun 22 16:44:01 2006
24 #ifdef FEAT_INS_EXPAND
26 * Special handling of keys while the popup menu is visible or wanted
27 ! * and the cursor is still in the completed word.
29 ! if (compl_started && pum_wanted() && curwin->w_cursor.col >= compl_col)
31 /* BS: Delete one character from "compl_leader". */
32 if ((c == K_BS || c == Ctrl_H)
34 #ifdef FEAT_INS_EXPAND
36 * Special handling of keys while the popup menu is visible or wanted
37 ! * and the cursor is still in the completed word. Only when there is
38 ! * a match, skip this when no matches were found.
42 ! && curwin->w_cursor.col >= compl_col
43 ! && (compl_shown_match == NULL
44 ! || compl_shown_match != compl_shown_match->cp_next))
46 /* BS: Delete one character from "compl_leader". */
47 if ((c == K_BS || c == Ctrl_H)
52 ptr = compl_orig_text;
53 ! p = compl_orig_text;
54 ! for (temp = 0; p[temp] != NUL && p[temp] == ptr[temp]; ++temp)
58 ! temp -= (*mb_head_off)(compl_orig_text, p + temp);
60 ! for (p += temp; *p != NUL; mb_ptr_adv(p))
61 ! AppendCharToRedobuff(K_BS);
62 ! AppendToRedobuffLit(ptr + temp, -1);
69 ptr = compl_orig_text;
70 ! if (compl_orig_text != NULL)
72 ! p = compl_orig_text;
73 ! for (temp = 0; p[temp] != NUL && p[temp] == ptr[temp];
78 ! temp -= (*mb_head_off)(compl_orig_text, p + temp);
80 ! for (p += temp; *p != NUL; mb_ptr_adv(p))
81 ! AppendCharToRedobuff(K_BS);
84 ! AppendToRedobuffLit(ptr + temp, -1);
90 (int)STRLEN(compl_pattern), curs_col);
91 if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
92 || compl_xp.xp_context == EXPAND_NOTHING)
94 ! startcol = (int)(compl_xp.xp_pattern - compl_pattern);
95 ! compl_col = startcol;
96 ! compl_length = curs_col - startcol;
98 else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
101 (int)STRLEN(compl_pattern), curs_col);
102 if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
103 || compl_xp.xp_context == EXPAND_NOTHING)
105 ! compl_col = curs_col;
107 ! vim_free(compl_pattern);
108 ! compl_pattern = NULL;
112 ! startcol = (int)(compl_xp.xp_pattern - compl_pattern);
113 ! compl_col = startcol;
114 ! compl_length = curs_col - startcol;
117 else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
122 compl_col = spell_word_start(startcol);
123 if (compl_col >= (colnr_T)startcol)
125 ! spell_expand_check_cap(compl_col);
126 /* Need to obtain "line" again, it may have become invalid. */
127 line = ml_get(curwin->w_cursor.lnum);
128 - compl_length = (int)curs_col - compl_col;
129 compl_pattern = vim_strnsave(line + compl_col, compl_length);
130 if (compl_pattern == NULL)
134 compl_col = spell_word_start(startcol);
135 if (compl_col >= (colnr_T)startcol)
138 ! compl_col = curs_col;
142 ! spell_expand_check_cap(compl_col);
143 ! compl_length = (int)curs_col - compl_col;
145 /* Need to obtain "line" again, it may have become invalid. */
146 line = ml_get(curwin->w_cursor.lnum);
147 compl_pattern = vim_strnsave(line + compl_col, compl_length);
148 if (compl_pattern == NULL)
150 *** ../vim-7.0.022/src/version.c Tue Jun 20 21:08:02 2006
151 --- src/version.c Thu Jun 22 16:34:42 2006
155 { /* Add new patch number below this line */
161 BEDEVERE: Look! It's the old man from scene 24 - what's he Doing here?
162 ARTHUR: He is the keeper of the Bridge. He asks each traveler five
164 GALAHAD: Three questions.
165 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
167 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
168 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
169 \\\ download, build and distribute -- http://www.A-A-P.org ///
170 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///