comparison src/ex_getln.c @ 18679:fd95d4dbeb37 v8.1.2331

patch 8.1.2331: the option.c file is still very big Commit: https://github.com/vim/vim/commit/7bae0b1bc84a95d565ffab38cf7f82ad21c656b6 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 21 22:14:18 2019 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Nov 2019 22:15:03 +0100
parents 18d7337b6837
children d7c47e45bcc3
comparison
equal deleted inserted replaced
18678:cb4a4b71df4a 18679:fd95d4dbeb37
50 static void redrawcmdprompt(void); 50 static void redrawcmdprompt(void);
51 static int ccheck_abbr(int); 51 static int ccheck_abbr(int);
52 52
53 #ifdef FEAT_CMDWIN 53 #ifdef FEAT_CMDWIN
54 static int open_cmdwin(void); 54 static int open_cmdwin(void);
55
56 static int cedit_key INIT(= -1); // key value of 'cedit' option
55 #endif 57 #endif
56 58
57 59
58 static void 60 static void
59 trigger_cmd_autocmd(int typechar, int evt) 61 trigger_cmd_autocmd(int typechar, int evt)
2458 return s; 2460 return s;
2459 } 2461 }
2460 #endif 2462 #endif
2461 2463
2462 /* 2464 /*
2465 * Read the 'wildmode' option, fill wim_flags[].
2466 */
2467 int
2468 check_opt_wim(void)
2469 {
2470 char_u new_wim_flags[4];
2471 char_u *p;
2472 int i;
2473 int idx = 0;
2474
2475 for (i = 0; i < 4; ++i)
2476 new_wim_flags[i] = 0;
2477
2478 for (p = p_wim; *p; ++p)
2479 {
2480 for (i = 0; ASCII_ISALPHA(p[i]); ++i)
2481 ;
2482 if (p[i] != NUL && p[i] != ',' && p[i] != ':')
2483 return FAIL;
2484 if (i == 7 && STRNCMP(p, "longest", 7) == 0)
2485 new_wim_flags[idx] |= WIM_LONGEST;
2486 else if (i == 4 && STRNCMP(p, "full", 4) == 0)
2487 new_wim_flags[idx] |= WIM_FULL;
2488 else if (i == 4 && STRNCMP(p, "list", 4) == 0)
2489 new_wim_flags[idx] |= WIM_LIST;
2490 else if (i == 8 && STRNCMP(p, "lastused", 8) == 0)
2491 new_wim_flags[idx] |= WIM_BUFLASTUSED;
2492 else
2493 return FAIL;
2494 p += i;
2495 if (*p == NUL)
2496 break;
2497 if (*p == ',')
2498 {
2499 if (idx == 3)
2500 return FAIL;
2501 ++idx;
2502 }
2503 }
2504
2505 /* fill remaining entries with last flag */
2506 while (idx < 3)
2507 {
2508 new_wim_flags[idx + 1] = new_wim_flags[idx];
2509 ++idx;
2510 }
2511
2512 /* only when there are no errors, wim_flags[] is changed */
2513 for (i = 0; i < 4; ++i)
2514 wim_flags[i] = new_wim_flags[i];
2515 return OK;
2516 }
2517
2518 /*
2463 * Return TRUE when the text must not be changed and we can't switch to 2519 * Return TRUE when the text must not be changed and we can't switch to
2464 * another window or buffer. Used when editing the command line, evaluating 2520 * another window or buffer. Used when editing the command line, evaluating
2465 * 'balloonexpr', etc. 2521 * 'balloonexpr', etc.
2466 */ 2522 */
2467 int 2523 int
4026 return OK; 4082 return OK;
4027 } 4083 }
4028 4084
4029 #if defined(FEAT_CMDWIN) || defined(PROTO) 4085 #if defined(FEAT_CMDWIN) || defined(PROTO)
4030 /* 4086 /*
4087 * Check value of 'cedit' and set cedit_key.
4088 * Returns NULL if value is OK, error message otherwise.
4089 */
4090 char *
4091 check_cedit(void)
4092 {
4093 int n;
4094
4095 if (*p_cedit == NUL)
4096 cedit_key = -1;
4097 else
4098 {
4099 n = string_to_key(p_cedit, FALSE);
4100 if (vim_isprintc(n))
4101 return e_invarg;
4102 cedit_key = n;
4103 }
4104 return NULL;
4105 }
4106
4107 /*
4031 * Open a window on the current command line and history. Allow editing in 4108 * Open a window on the current command line and history. Allow editing in
4032 * the window. Returns when the window is closed. 4109 * the window. Returns when the window is closed.
4033 * Returns: 4110 * Returns:
4034 * CR if the command is to be executed 4111 * CR if the command is to be executed
4035 * Ctrl_C if it is to be abandoned 4112 * Ctrl_C if it is to be abandoned