mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.1.2331: the option.c file is still very big
Problem: The option.c file is still very big. Solution: Move a few functions to where they fit better. (Yegappan Lakshmanan, closes #4895)
This commit is contained in:
@@ -52,6 +52,8 @@ static int ccheck_abbr(int);
|
||||
|
||||
#ifdef FEAT_CMDWIN
|
||||
static int open_cmdwin(void);
|
||||
|
||||
static int cedit_key INIT(= -1); // key value of 'cedit' option
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2459,6 +2461,60 @@ getcmdline_prompt(
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read the 'wildmode' option, fill wim_flags[].
|
||||
*/
|
||||
int
|
||||
check_opt_wim(void)
|
||||
{
|
||||
char_u new_wim_flags[4];
|
||||
char_u *p;
|
||||
int i;
|
||||
int idx = 0;
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
new_wim_flags[i] = 0;
|
||||
|
||||
for (p = p_wim; *p; ++p)
|
||||
{
|
||||
for (i = 0; ASCII_ISALPHA(p[i]); ++i)
|
||||
;
|
||||
if (p[i] != NUL && p[i] != ',' && p[i] != ':')
|
||||
return FAIL;
|
||||
if (i == 7 && STRNCMP(p, "longest", 7) == 0)
|
||||
new_wim_flags[idx] |= WIM_LONGEST;
|
||||
else if (i == 4 && STRNCMP(p, "full", 4) == 0)
|
||||
new_wim_flags[idx] |= WIM_FULL;
|
||||
else if (i == 4 && STRNCMP(p, "list", 4) == 0)
|
||||
new_wim_flags[idx] |= WIM_LIST;
|
||||
else if (i == 8 && STRNCMP(p, "lastused", 8) == 0)
|
||||
new_wim_flags[idx] |= WIM_BUFLASTUSED;
|
||||
else
|
||||
return FAIL;
|
||||
p += i;
|
||||
if (*p == NUL)
|
||||
break;
|
||||
if (*p == ',')
|
||||
{
|
||||
if (idx == 3)
|
||||
return FAIL;
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
|
||||
/* fill remaining entries with last flag */
|
||||
while (idx < 3)
|
||||
{
|
||||
new_wim_flags[idx + 1] = new_wim_flags[idx];
|
||||
++idx;
|
||||
}
|
||||
|
||||
/* only when there are no errors, wim_flags[] is changed */
|
||||
for (i = 0; i < 4; ++i)
|
||||
wim_flags[i] = new_wim_flags[i];
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE when the text must not be changed and we can't switch to
|
||||
* another window or buffer. Used when editing the command line, evaluating
|
||||
@@ -4027,6 +4083,27 @@ get_list_range(char_u **str, int *num1, int *num2)
|
||||
}
|
||||
|
||||
#if defined(FEAT_CMDWIN) || defined(PROTO)
|
||||
/*
|
||||
* Check value of 'cedit' and set cedit_key.
|
||||
* Returns NULL if value is OK, error message otherwise.
|
||||
*/
|
||||
char *
|
||||
check_cedit(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (*p_cedit == NUL)
|
||||
cedit_key = -1;
|
||||
else
|
||||
{
|
||||
n = string_to_key(p_cedit, FALSE);
|
||||
if (vim_isprintc(n))
|
||||
return e_invarg;
|
||||
cedit_key = n;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a window on the current command line and history. Allow editing in
|
||||
* the window. Returns when the window is closed.
|
||||
|
Reference in New Issue
Block a user