summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-21 22:14:18 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-21 22:14:18 +0100
commit7bae0b1bc84a95d565ffab38cf7f82ad21c656b6 (patch)
tree2d724ddd855892ef212f14924e2cc04feafa5abe /src/ex_getln.c
parent94d9f4fa65bce6f116cf89bfdabdf5a06509056f (diff)
patch 8.1.2331: the option.c file is still very bigv8.1.2331
Problem: The option.c file is still very big. Solution: Move a few functions to where they fit better. (Yegappan Lakshmanan, closes #4895)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 5cc1c34897..7d2efcac42 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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
@@ -2460,6 +2462,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
* 'balloonexpr', etc.
@@ -4028,6 +4084,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.
* Returns: