]>
Commit | Line | Data |
---|---|---|
6f27073b AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.023 | |
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.023 | |
11 | Problem: Crash when doing spell completion in an empty line and pressing | |
12 | CTRL-E. | |
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. | |
17 | Files: src/edit.c | |
18 | ||
19 | ||
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 | |
22 | *************** | |
23 | *** 719,727 **** | |
24 | #ifdef FEAT_INS_EXPAND | |
25 | /* | |
26 | * Special handling of keys while the popup menu is visible or wanted | |
27 | ! * and the cursor is still in the completed word. | |
28 | */ | |
29 | ! if (compl_started && pum_wanted() && curwin->w_cursor.col >= compl_col) | |
30 | { | |
31 | /* BS: Delete one character from "compl_leader". */ | |
32 | if ((c == K_BS || c == Ctrl_H) | |
33 | --- 721,734 ---- | |
34 | #ifdef FEAT_INS_EXPAND | |
35 | /* | |
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. | |
39 | */ | |
40 | ! if (compl_started | |
41 | ! && pum_wanted() | |
42 | ! && curwin->w_cursor.col >= compl_col | |
43 | ! && (compl_shown_match == NULL | |
44 | ! || compl_shown_match != compl_shown_match->cp_next)) | |
45 | { | |
46 | /* BS: Delete one character from "compl_leader". */ | |
47 | if ((c == K_BS || c == Ctrl_H) | |
48 | *************** | |
49 | *** 3393,3408 **** | |
50 | ptr = compl_leader; | |
51 | else | |
52 | ptr = compl_orig_text; | |
53 | ! p = compl_orig_text; | |
54 | ! for (temp = 0; p[temp] != NUL && p[temp] == ptr[temp]; ++temp) | |
55 | ! ; | |
56 | #ifdef FEAT_MBYTE | |
57 | ! if (temp > 0) | |
58 | ! temp -= (*mb_head_off)(compl_orig_text, p + temp); | |
59 | #endif | |
60 | ! for (p += temp; *p != NUL; mb_ptr_adv(p)) | |
61 | ! AppendCharToRedobuff(K_BS); | |
62 | ! AppendToRedobuffLit(ptr + temp, -1); | |
63 | } | |
64 | ||
65 | #ifdef FEAT_CINDENT | |
66 | --- 3401,3421 ---- | |
67 | ptr = compl_leader; | |
68 | else | |
69 | ptr = compl_orig_text; | |
70 | ! if (compl_orig_text != NULL) | |
71 | ! { | |
72 | ! p = compl_orig_text; | |
73 | ! for (temp = 0; p[temp] != NUL && p[temp] == ptr[temp]; | |
74 | ! ++temp) | |
75 | ! ; | |
76 | #ifdef FEAT_MBYTE | |
77 | ! if (temp > 0) | |
78 | ! temp -= (*mb_head_off)(compl_orig_text, p + temp); | |
79 | #endif | |
80 | ! for (p += temp; *p != NUL; mb_ptr_adv(p)) | |
81 | ! AppendCharToRedobuff(K_BS); | |
82 | ! } | |
83 | ! if (ptr != NULL) | |
84 | ! AppendToRedobuffLit(ptr + temp, -1); | |
85 | } | |
86 | ||
87 | #ifdef FEAT_CINDENT | |
88 | *************** | |
89 | *** 4650,4659 **** | |
90 | (int)STRLEN(compl_pattern), curs_col); | |
91 | if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL | |
92 | || compl_xp.xp_context == EXPAND_NOTHING) | |
93 | ! return FAIL; | |
94 | ! startcol = (int)(compl_xp.xp_pattern - compl_pattern); | |
95 | ! compl_col = startcol; | |
96 | ! compl_length = curs_col - startcol; | |
97 | } | |
98 | else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI) | |
99 | { | |
100 | --- 4663,4680 ---- | |
101 | (int)STRLEN(compl_pattern), curs_col); | |
102 | if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL | |
103 | || compl_xp.xp_context == EXPAND_NOTHING) | |
104 | ! { | |
105 | ! compl_col = curs_col; | |
106 | ! compl_length = 0; | |
107 | ! vim_free(compl_pattern); | |
108 | ! compl_pattern = NULL; | |
109 | ! } | |
110 | ! else | |
111 | ! { | |
112 | ! startcol = (int)(compl_xp.xp_pattern - compl_pattern); | |
113 | ! compl_col = startcol; | |
114 | ! compl_length = curs_col - startcol; | |
115 | ! } | |
116 | } | |
117 | else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI) | |
118 | { | |
119 | *************** | |
120 | *** 4707,4717 **** | |
121 | else | |
122 | compl_col = spell_word_start(startcol); | |
123 | if (compl_col >= (colnr_T)startcol) | |
124 | ! return FAIL; | |
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) | |
131 | #endif | |
132 | --- 4728,4744 ---- | |
133 | else | |
134 | compl_col = spell_word_start(startcol); | |
135 | if (compl_col >= (colnr_T)startcol) | |
136 | ! { | |
137 | ! compl_length = 0; | |
138 | ! compl_col = curs_col; | |
139 | ! } | |
140 | ! else | |
141 | ! { | |
142 | ! spell_expand_check_cap(compl_col); | |
143 | ! compl_length = (int)curs_col - compl_col; | |
144 | ! } | |
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) | |
149 | #endif | |
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 | |
152 | *************** | |
153 | *** 668,669 **** | |
154 | --- 668,671 ---- | |
155 | { /* Add new patch number below this line */ | |
156 | + /**/ | |
157 | + 23, | |
158 | /**/ | |
159 | ||
160 | -- | |
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 | |
163 | questions ... | |
164 | GALAHAD: Three questions. | |
165 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
166 | ||
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 /// |