comparison src/ex_getln.c @ 2849:b0190e93e601 v7.3.198

updated for version 7.3.198 Problem: No completion for ":lang". Solution: Get locales to complete from. (Dominique Pelle)
author Bram Moolenaar <bram@vim.org>
date Thu, 19 May 2011 18:26:40 +0200
parents e1c5f69de95b
children e3bb93df6c34
comparison
equal deleted inserted replaced
2848:d9e5f15a6a36 2849:b0190e93e601
4569 static struct expgen 4569 static struct expgen
4570 { 4570 {
4571 int context; 4571 int context;
4572 char_u *((*func)__ARGS((expand_T *, int))); 4572 char_u *((*func)__ARGS((expand_T *, int)));
4573 int ic; 4573 int ic;
4574 int escaped;
4574 } tab[] = 4575 } tab[] =
4575 { 4576 {
4576 {EXPAND_COMMANDS, get_command_name, FALSE}, 4577 {EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
4577 {EXPAND_BEHAVE, get_behave_arg, TRUE}, 4578 {EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
4578 #ifdef FEAT_USR_CMDS 4579 #ifdef FEAT_USR_CMDS
4579 {EXPAND_USER_COMMANDS, get_user_commands, FALSE}, 4580 {EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE},
4580 {EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE}, 4581 {EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
4581 {EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE}, 4582 {EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE, TRUE},
4582 {EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE}, 4583 {EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE, TRUE},
4583 #endif 4584 #endif
4584 #ifdef FEAT_EVAL 4585 #ifdef FEAT_EVAL
4585 {EXPAND_USER_VARS, get_user_var_name, FALSE}, 4586 {EXPAND_USER_VARS, get_user_var_name, FALSE, TRUE},
4586 {EXPAND_FUNCTIONS, get_function_name, FALSE}, 4587 {EXPAND_FUNCTIONS, get_function_name, FALSE, TRUE},
4587 {EXPAND_USER_FUNC, get_user_func_name, FALSE}, 4588 {EXPAND_USER_FUNC, get_user_func_name, FALSE, TRUE},
4588 {EXPAND_EXPRESSION, get_expr_name, FALSE}, 4589 {EXPAND_EXPRESSION, get_expr_name, FALSE, TRUE},
4589 #endif 4590 #endif
4590 #ifdef FEAT_MENU 4591 #ifdef FEAT_MENU
4591 {EXPAND_MENUS, get_menu_name, FALSE}, 4592 {EXPAND_MENUS, get_menu_name, FALSE, TRUE},
4592 {EXPAND_MENUNAMES, get_menu_names, FALSE}, 4593 {EXPAND_MENUNAMES, get_menu_names, FALSE, TRUE},
4593 #endif 4594 #endif
4594 #ifdef FEAT_SYN_HL 4595 #ifdef FEAT_SYN_HL
4595 {EXPAND_SYNTAX, get_syntax_name, TRUE}, 4596 {EXPAND_SYNTAX, get_syntax_name, TRUE, TRUE},
4596 #endif 4597 #endif
4597 {EXPAND_HIGHLIGHT, get_highlight_name, TRUE}, 4598 {EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE},
4598 #ifdef FEAT_AUTOCMD 4599 #ifdef FEAT_AUTOCMD
4599 {EXPAND_EVENTS, get_event_name, TRUE}, 4600 {EXPAND_EVENTS, get_event_name, TRUE, TRUE},
4600 {EXPAND_AUGROUP, get_augroup_name, TRUE}, 4601 {EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE},
4601 #endif 4602 #endif
4602 #ifdef FEAT_CSCOPE 4603 #ifdef FEAT_CSCOPE
4603 {EXPAND_CSCOPE, get_cscope_name, TRUE}, 4604 {EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE},
4604 #endif 4605 #endif
4605 #ifdef FEAT_SIGNS 4606 #ifdef FEAT_SIGNS
4606 {EXPAND_SIGN, get_sign_name, TRUE}, 4607 {EXPAND_SIGN, get_sign_name, TRUE, TRUE},
4607 #endif 4608 #endif
4608 #ifdef FEAT_PROFILE 4609 #ifdef FEAT_PROFILE
4609 {EXPAND_PROFILE, get_profile_name, TRUE}, 4610 {EXPAND_PROFILE, get_profile_name, TRUE, TRUE},
4610 #endif 4611 #endif
4611 #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ 4612 #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
4612 && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) 4613 && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
4613 {EXPAND_LANGUAGE, get_lang_arg, TRUE}, 4614 {EXPAND_LANGUAGE, get_lang_arg, TRUE, FALSE},
4614 #endif 4615 {EXPAND_LOCALES, get_locales, TRUE, FALSE},
4615 {EXPAND_ENV_VARS, get_env_name, TRUE}, 4616 #endif
4617 {EXPAND_ENV_VARS, get_env_name, TRUE, TRUE},
4616 }; 4618 };
4617 int i; 4619 int i;
4618 4620
4619 /* 4621 /*
4620 * Find a context in the table and call the ExpandGeneric() with the 4622 * Find a context in the table and call the ExpandGeneric() with the
4624 for (i = 0; i < (int)(sizeof(tab) / sizeof(struct expgen)); ++i) 4626 for (i = 0; i < (int)(sizeof(tab) / sizeof(struct expgen)); ++i)
4625 if (xp->xp_context == tab[i].context) 4627 if (xp->xp_context == tab[i].context)
4626 { 4628 {
4627 if (tab[i].ic) 4629 if (tab[i].ic)
4628 regmatch.rm_ic = TRUE; 4630 regmatch.rm_ic = TRUE;
4629 ret = ExpandGeneric(xp, &regmatch, num_file, file, tab[i].func); 4631 ret = ExpandGeneric(xp, &regmatch, num_file, file,
4632 tab[i].func, tab[i].escaped);
4630 break; 4633 break;
4631 } 4634 }
4632 } 4635 }
4633 4636
4634 vim_free(regmatch.regprog); 4637 vim_free(regmatch.regprog);
4646 * program. Matching strings are copied into an array, which is returned. 4649 * program. Matching strings are copied into an array, which is returned.
4647 * 4650 *
4648 * Returns OK when no problems encountered, FAIL for error (out of memory). 4651 * Returns OK when no problems encountered, FAIL for error (out of memory).
4649 */ 4652 */
4650 int 4653 int
4651 ExpandGeneric(xp, regmatch, num_file, file, func) 4654 ExpandGeneric(xp, regmatch, num_file, file, func, escaped)
4652 expand_T *xp; 4655 expand_T *xp;
4653 regmatch_T *regmatch; 4656 regmatch_T *regmatch;
4654 int *num_file; 4657 int *num_file;
4655 char_u ***file; 4658 char_u ***file;
4656 char_u *((*func)__ARGS((expand_T *, int))); 4659 char_u *((*func)__ARGS((expand_T *, int)));
4657 /* returns a string from the list */ 4660 /* returns a string from the list */
4661 int escaped;
4658 { 4662 {
4659 int i; 4663 int i;
4660 int count = 0; 4664 int count = 0;
4661 int round; 4665 int round;
4662 char_u *str; 4666 char_u *str;
4677 4681
4678 if (vim_regexec(regmatch, str, (colnr_T)0)) 4682 if (vim_regexec(regmatch, str, (colnr_T)0))
4679 { 4683 {
4680 if (round) 4684 if (round)
4681 { 4685 {
4682 str = vim_strsave_escaped(str, (char_u *)" \t\\."); 4686 if (escaped)
4687 str = vim_strsave_escaped(str, (char_u *)" \t\\.");
4688 else
4689 str = vim_strsave(str);
4683 (*file)[count] = str; 4690 (*file)[count] = str;
4684 #ifdef FEAT_MENU 4691 #ifdef FEAT_MENU
4685 if (func == get_menu_names && str != NULL) 4692 if (func == get_menu_names && str != NULL)
4686 { 4693 {
4687 /* test for separator added by get_menu_names() */ 4694 /* test for separator added by get_menu_names() */