diff -Naur mc-4.7.0-pre1~/edit/editcmd.c mc-4.7.0-pre1/edit/editcmd.c
old
|
new
|
|
2271 | 2271 | GString *temp; |
2272 | 2272 | mc_search_t *srch; |
2273 | 2273 | |
| 2274 | long last_byte = start; |
| 2275 | |
2274 | 2276 | srch = mc_search_new(match_expr, -1); |
2275 | 2277 | if (srch == NULL) |
2276 | 2278 | return 0; |
… |
… |
|
2280 | 2282 | srch->search_fn = edit_search_cmd_callback; |
2281 | 2283 | |
2282 | 2284 | /* collect max MAX_WORD_COMPLETIONS completions */ |
2283 | | start--; |
| 2285 | start = -1; |
2284 | 2286 | while (*num < MAX_WORD_COMPLETIONS) { |
2285 | 2287 | /* get next match */ |
2286 | | if (mc_search_run (srch, (void *) edit, start+1, edit->last_byte, &len) == FALSE) |
| 2288 | if (mc_search_run (srch, (void *) edit, start+1, last_byte, &len) == FALSE) |
2287 | 2289 | break; |
2288 | 2290 | start = srch->normal_offset; |
2289 | 2291 | |
… |
… |
|
2305 | 2307 | (char *) &temp->str[word_len], |
2306 | 2308 | max (len, compl[i].len) - word_len |
2307 | 2309 | ) == 0) { |
| 2310 | struct selection this = compl[i]; |
| 2311 | for (++i; i < *num; i++) { |
| 2312 | compl[i - 1] = compl[i]; |
| 2313 | } |
| 2314 | compl[*num - 1] = this; |
2308 | 2315 | skip = 1; |
2309 | 2316 | break; /* skip it, already added */ |
2310 | 2317 | } |
… |
… |
|
2348 | 2355 | bufpos = &edit->buffers1[word_start >> S_EDIT_BUF_SIZE] |
2349 | 2356 | [word_start & M_EDIT_BUF_SIZE]; |
2350 | 2357 | |
2351 | | match_expr = g_strdup_printf ("(^|\\s)%.*s[^\\s\\.=\\+\\{\\}\\[\\]\\(\\)\\\\\\!\\,<>\\?\\/@#\\$%%\\^&\\*\\~\\|\\\"'\\:\\;]+", word_len, bufpos); |
| 2358 | match_expr = g_strdup_printf ("\\b%.*s[a-zA-Z_0-9]+", word_len, bufpos); |
2352 | 2359 | |
2353 | 2360 | /* collect the possible completions */ |
2354 | 2361 | /* start search from begin to end of file */ |
2355 | 2362 | max_len = |
2356 | | edit_collect_completions (edit, 0, word_len, match_expr, |
| 2363 | edit_collect_completions (edit, word_start, word_len, match_expr, |
2357 | 2364 | (struct selection *) &compl, &num_compl); |
2358 | 2365 | |
2359 | 2366 | if (num_compl > 0) { |
diff -Naur mc-4.7.0-pre1~/edit/editcmd_dialogs.c mc-4.7.0-pre1/edit/editcmd_dialogs.c
old
|
new
|
|
296 | 296 | add_widget (compl_dlg, compl_list); |
297 | 297 | |
298 | 298 | /* fill the listbox with the completions */ |
299 | | for (i = 0; i < num_compl; i++) |
| 299 | for (i = num_compl - 1; i >= 0; i--) /* reverse order */ |
300 | 300 | listbox_add_item (compl_list, LISTBOX_APPEND_AT_END, 0, (char *) compl[i].text, NULL); |
301 | 301 | |
302 | 302 | /* pop up the dialog */ |