Mercurial > vim
comparison src/edit.c @ 707:111b7dcc8a17
updated for version 7.0213
author | vimboss |
---|---|
date | Fri, 03 Mar 2006 22:56:30 +0000 |
parents | 2fae45239fb3 |
children | 2e887dfa8917 |
comparison
equal
deleted
inserted
replaced
706:ef3b59af4207 | 707:111b7dcc8a17 |
---|---|
127 static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int icase)); | 127 static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int icase)); |
128 static int ins_compl_make_cyclic __ARGS((void)); | 128 static int ins_compl_make_cyclic __ARGS((void)); |
129 static void ins_compl_upd_pum __ARGS((void)); | 129 static void ins_compl_upd_pum __ARGS((void)); |
130 static void ins_compl_del_pum __ARGS((void)); | 130 static void ins_compl_del_pum __ARGS((void)); |
131 static int pum_wanted __ARGS((void)); | 131 static int pum_wanted __ARGS((void)); |
132 static int pum_two_or_more __ARGS((void)); | 132 static int pum_enough_matches __ARGS((void)); |
133 static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int flags, int thesaurus)); | 133 static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int flags, int thesaurus)); |
134 static void ins_compl_files __ARGS((int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir)); | 134 static void ins_compl_files __ARGS((int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir)); |
135 static char_u *find_line_end __ARGS((char_u *ptr)); | 135 static char_u *find_line_end __ARGS((char_u *ptr)); |
136 static void ins_compl_free __ARGS((void)); | 136 static void ins_compl_free __ARGS((void)); |
137 static void ins_compl_clear __ARGS((void)); | 137 static void ins_compl_clear __ARGS((void)); |
2345 * Return TRUE if the popup menu should be displayed. | 2345 * Return TRUE if the popup menu should be displayed. |
2346 */ | 2346 */ |
2347 static int | 2347 static int |
2348 pum_wanted() | 2348 pum_wanted() |
2349 { | 2349 { |
2350 /* 'completeopt' must contain "menu" */ | 2350 /* 'completeopt' must contain "menu" or "menuone" */ |
2351 if (vim_strchr(p_cot, 'm') == NULL) | 2351 if (vim_strchr(p_cot, 'm') == NULL) |
2352 return FALSE; | 2352 return FALSE; |
2353 | 2353 |
2354 /* The display looks bad on a B&W display. */ | 2354 /* The display looks bad on a B&W display. */ |
2355 if (t_colors < 8 | 2355 if (t_colors < 8 |
2361 return TRUE; | 2361 return TRUE; |
2362 } | 2362 } |
2363 | 2363 |
2364 /* | 2364 /* |
2365 * Return TRUE if there are two or more matches to be shown in the popup menu. | 2365 * Return TRUE if there are two or more matches to be shown in the popup menu. |
2366 * One if 'completopt' contains "menuone". | |
2366 */ | 2367 */ |
2367 static int | 2368 static int |
2368 pum_two_or_more() | 2369 pum_enough_matches() |
2369 { | 2370 { |
2370 compl_T *compl; | 2371 compl_T *compl; |
2371 int i; | 2372 int i; |
2372 | 2373 |
2373 /* Don't display the popup menu if there are no matches or there is only | 2374 /* Don't display the popup menu if there are no matches or there is only |
2380 || ((compl->cp_flags & ORIGINAL_TEXT) == 0 && ++i == 2)) | 2381 || ((compl->cp_flags & ORIGINAL_TEXT) == 0 && ++i == 2)) |
2381 break; | 2382 break; |
2382 compl = compl->cp_next; | 2383 compl = compl->cp_next; |
2383 } while (compl != compl_first_match); | 2384 } while (compl != compl_first_match); |
2384 | 2385 |
2386 if (strstr((char *)p_cot, "menuone") != NULL) | |
2387 return (i >= 1); | |
2385 return (i >= 2); | 2388 return (i >= 2); |
2386 } | 2389 } |
2387 | 2390 |
2388 /* | 2391 /* |
2389 * Show the popup menu for the list of matches. | 2392 * Show the popup menu for the list of matches. |
2399 int i; | 2402 int i; |
2400 int cur = -1; | 2403 int cur = -1; |
2401 colnr_T col; | 2404 colnr_T col; |
2402 int lead_len = 0; | 2405 int lead_len = 0; |
2403 | 2406 |
2404 if (!pum_wanted() || !pum_two_or_more()) | 2407 if (!pum_wanted() || !pum_enough_matches()) |
2405 return; | 2408 return; |
2406 | 2409 |
2407 /* Update the screen before drawing the popup menu over it. */ | 2410 /* Update the screen before drawing the popup menu over it. */ |
2408 update_screen(0); | 2411 update_screen(0); |
2409 | 2412 |