Mercurial > vim
comparison src/ex_getln.c @ 30645:101f08b49ed3 v9.0.0657
patch 9.0.0657: too many #ifdefs
Commit: https://github.com/vim/vim/commit/7904fa420eb577274c4c3711295240100167d495
Author: Martin Tournoij <martin@arp242.net>
Date: Tue Oct 4 16:28:45 2022 +0100
patch 9.0.0657: too many #ifdefs
Problem: Too many #ifdefs.
Solution: Graduate the +cmdwin feature. Now the tiny and small builds are
equal, drop the small build. (Martin Tournoij, closes #11268)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 04 Oct 2022 17:30:06 +0200 |
parents | 8496a2c45962 |
children | 33ca088dbd3e |
comparison
equal
deleted
inserted
replaced
30644:0c102a723b9a | 30645:101f08b49ed3 |
---|---|
50 static void save_cmdline(cmdline_info_T *ccp); | 50 static void save_cmdline(cmdline_info_T *ccp); |
51 static void restore_cmdline(cmdline_info_T *ccp); | 51 static void restore_cmdline(cmdline_info_T *ccp); |
52 static int cmdline_paste(int regname, int literally, int remcr); | 52 static int cmdline_paste(int regname, int literally, int remcr); |
53 static void redrawcmdprompt(void); | 53 static void redrawcmdprompt(void); |
54 static int ccheck_abbr(int); | 54 static int ccheck_abbr(int); |
55 static int open_cmdwin(void); | |
55 #ifdef FEAT_SEARCH_EXTRA | 56 #ifdef FEAT_SEARCH_EXTRA |
56 static int empty_pattern_magic(char_u *pat, size_t len, magic_T magic_val); | 57 static int empty_pattern_magic(char_u *pat, size_t len, magic_T magic_val); |
57 #endif | 58 #endif |
58 | 59 |
59 #ifdef FEAT_CMDWIN | |
60 static int open_cmdwin(void); | |
61 | |
62 static int cedit_key = -1; // key value of 'cedit' option | 60 static int cedit_key = -1; // key value of 'cedit' option |
63 #endif | |
64 | |
65 | 61 |
66 static void | 62 static void |
67 trigger_cmd_autocmd(int typechar, int evt) | 63 trigger_cmd_autocmd(int typechar, int evt) |
68 { | 64 { |
69 char_u typestr[2]; | 65 char_u typestr[2]; |
1920 goto returncmd; // back to cmd mode | 1916 goto returncmd; // back to cmd mode |
1921 c = Ctrl_BSL; // backslash key not processed by | 1917 c = Ctrl_BSL; // backslash key not processed by |
1922 // cmdline_handle_backslash_key() | 1918 // cmdline_handle_backslash_key() |
1923 } | 1919 } |
1924 | 1920 |
1925 #ifdef FEAT_CMDWIN | |
1926 if (c == cedit_key || c == K_CMDWIN) | 1921 if (c == cedit_key || c == K_CMDWIN) |
1927 { | 1922 { |
1928 // TODO: why is ex_normal_busy checked here? | 1923 // TODO: why is ex_normal_busy checked here? |
1929 if ((c == K_CMDWIN || ex_normal_busy == 0) && got_int == FALSE) | 1924 if ((c == K_CMDWIN || ex_normal_busy == 0) && got_int == FALSE) |
1930 { | 1925 { |
1933 */ | 1928 */ |
1934 c = open_cmdwin(); | 1929 c = open_cmdwin(); |
1935 some_key_typed = TRUE; | 1930 some_key_typed = TRUE; |
1936 } | 1931 } |
1937 } | 1932 } |
1938 # ifdef FEAT_DIGRAPHS | 1933 #ifdef FEAT_DIGRAPHS |
1939 else | 1934 else |
1940 # endif | |
1941 #endif | |
1942 #ifdef FEAT_DIGRAPHS | |
1943 c = do_digraph(c); | 1935 c = do_digraph(c); |
1944 #endif | 1936 #endif |
1945 | 1937 |
1946 if (c == '\n' || c == '\r' || c == K_KENTER || (c == ESC | 1938 if (c == '\n' || c == '\r' || c == K_KENTER || (c == ESC |
1947 && (!KeyTyped || vim_strchr(p_cpo, CPO_ESC) != NULL))) | 1939 && (!KeyTyped || vim_strchr(p_cpo, CPO_ESC) != NULL))) |
2685 * 'balloonexpr', etc. | 2677 * 'balloonexpr', etc. |
2686 */ | 2678 */ |
2687 int | 2679 int |
2688 text_locked(void) | 2680 text_locked(void) |
2689 { | 2681 { |
2690 #ifdef FEAT_CMDWIN | |
2691 if (cmdwin_type != 0) | 2682 if (cmdwin_type != 0) |
2692 return TRUE; | 2683 return TRUE; |
2693 #endif | |
2694 return textlock != 0; | 2684 return textlock != 0; |
2695 } | 2685 } |
2696 | 2686 |
2697 /* | 2687 /* |
2698 * Give an error message for a command that isn't allowed while the cmdline | 2688 * Give an error message for a command that isn't allowed while the cmdline |
2705 } | 2695 } |
2706 | 2696 |
2707 char * | 2697 char * |
2708 get_text_locked_msg(void) | 2698 get_text_locked_msg(void) |
2709 { | 2699 { |
2710 #ifdef FEAT_CMDWIN | |
2711 if (cmdwin_type != 0) | 2700 if (cmdwin_type != 0) |
2712 return e_invalid_in_cmdline_window; | 2701 return e_invalid_in_cmdline_window; |
2713 #endif | |
2714 return e_not_allowed_to_change_text_or_change_window; | 2702 return e_not_allowed_to_change_text_or_change_window; |
2715 } | 2703 } |
2716 | 2704 |
2717 /* | 2705 /* |
2718 * Check for text, window or buffer locked. | 2706 * Check for text, window or buffer locked. |
4078 get_cmdline_info(void) | 4066 get_cmdline_info(void) |
4079 { | 4067 { |
4080 return &ccline; | 4068 return &ccline; |
4081 } | 4069 } |
4082 | 4070 |
4083 #if defined(FEAT_EVAL) || defined(FEAT_CMDWIN) || defined(PROTO) | |
4084 /* | 4071 /* |
4085 * Get pointer to the command line info to use. save_cmdline() may clear | 4072 * Get pointer to the command line info to use. save_cmdline() may clear |
4086 * ccline and put the previous value in prev_ccline. | 4073 * ccline and put the previous value in prev_ccline. |
4087 */ | 4074 */ |
4088 static cmdline_info_T * | 4075 static cmdline_info_T * |
4094 return &ccline; | 4081 return &ccline; |
4095 if (prev_ccline_used && prev_ccline.cmdbuff != NULL) | 4082 if (prev_ccline_used && prev_ccline.cmdbuff != NULL) |
4096 return &prev_ccline; | 4083 return &prev_ccline; |
4097 return NULL; | 4084 return NULL; |
4098 } | 4085 } |
4099 #endif | 4086 |
4100 | |
4101 #if defined(FEAT_EVAL) || defined(FEAT_CMDWIN) | |
4102 /* | 4087 /* |
4103 * Get the current command-line type. | 4088 * Get the current command-line type. |
4104 * Returns ':' or '/' or '?' or '@' or '>' or '-' | 4089 * Returns ':' or '/' or '?' or '@' or '>' or '-' |
4105 * Only works when the command line is being edited. | 4090 * Only works when the command line is being edited. |
4106 * Returns NUL when something is wrong. | 4091 * Returns NUL when something is wrong. |
4118 (p->input_fn) ? '@' : | 4103 (p->input_fn) ? '@' : |
4119 # endif | 4104 # endif |
4120 '-'; | 4105 '-'; |
4121 return p->cmdfirstc; | 4106 return p->cmdfirstc; |
4122 } | 4107 } |
4123 #endif | |
4124 | 4108 |
4125 #if defined(FEAT_EVAL) || defined(PROTO) | 4109 #if defined(FEAT_EVAL) || defined(PROTO) |
4126 /* | 4110 /* |
4127 * Get the current command line in allocated memory. | 4111 * Get the current command line in allocated memory. |
4128 * Only works when the command line is being edited. | 4112 * Only works when the command line is being edited. |
4363 else if (first) // only one number given | 4347 else if (first) // only one number given |
4364 *num2 = *num1; | 4348 *num2 = *num1; |
4365 return OK; | 4349 return OK; |
4366 } | 4350 } |
4367 | 4351 |
4368 #if defined(FEAT_CMDWIN) || defined(PROTO) | |
4369 /* | 4352 /* |
4370 * Check value of 'cedit' and set cedit_key. | 4353 * Check value of 'cedit' and set cedit_key. |
4371 * Returns NULL if value is OK, error message otherwise. | 4354 * Returns NULL if value is OK, error message otherwise. |
4372 */ | 4355 */ |
4373 char * | 4356 char * |
4692 int | 4675 int |
4693 is_in_cmdwin(void) | 4676 is_in_cmdwin(void) |
4694 { | 4677 { |
4695 return cmdwin_type != 0 && get_cmdline_type() == NUL; | 4678 return cmdwin_type != 0 && get_cmdline_type() == NUL; |
4696 } | 4679 } |
4697 #endif // FEAT_CMDWIN | |
4698 | 4680 |
4699 /* | 4681 /* |
4700 * Used for commands that either take a simple command string argument, or: | 4682 * Used for commands that either take a simple command string argument, or: |
4701 * cmd << endmarker | 4683 * cmd << endmarker |
4702 * {script} | 4684 * {script} |