lineedit: disable completion and fancy prompts if no shells are selected
function old new delta get_previous_history 51 56 +5 get_next_history 47 52 +5 null_str 1 - -1 beep 10 - -10 bb_msg_unknown 10 - -10 bb_internal_setpwent 24 - -24 remove_chunk 30 - -30 goto_new_line 33 - -33 bb_internal_endpwent 36 - -36 deinit_S 51 - -51 free_tab_completion_data 54 - -54 read_line_input 3171 3114 -57 rewind 68 - -68 add_match 70 - -70 complete_username 77 - -77 quote_special_chars 78 - -78 build_match_prefix 557 - -557 complete_cmd_dir_file 697 - -697 parse_and_put_prompt 823 53 -770 input_tab 926 - -926 ------------------------------------------------------------------------------ (add/remove: 0/17 grow/shrink: 2/2 up/down: 10/-3549) Total: -3539 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
1d180cd749
commit
a97a795dcb
@ -57,12 +57,23 @@
|
|||||||
#if ENABLE_FEATURE_EDITING
|
#if ENABLE_FEATURE_EDITING
|
||||||
|
|
||||||
|
|
||||||
|
#if !ENABLE_SHELL_ASH && !ENABLE_SHELL_HUSH
|
||||||
|
/* so far only shells use these features */
|
||||||
|
# undef ENABLE_FEATURE_EDITING_FANCY_PROMPT
|
||||||
|
# undef ENABLE_FEATURE_TAB_COMPLETION
|
||||||
|
# undef ENABLE_FEATURE_USERNAME_COMPLETION
|
||||||
|
# define ENABLE_FEATURE_EDITING_FANCY_PROMPT 0
|
||||||
|
# define ENABLE_FEATURE_TAB_COMPLETION 0
|
||||||
|
# define ENABLE_FEATURE_USERNAME_COMPLETION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define ENABLE_USERNAME_OR_HOMEDIR \
|
#define ENABLE_USERNAME_OR_HOMEDIR \
|
||||||
(ENABLE_FEATURE_USERNAME_COMPLETION || ENABLE_FEATURE_EDITING_FANCY_PROMPT)
|
(ENABLE_FEATURE_USERNAME_COMPLETION || ENABLE_FEATURE_EDITING_FANCY_PROMPT)
|
||||||
#define IF_USERNAME_OR_HOMEDIR(...)
|
|
||||||
#if ENABLE_USERNAME_OR_HOMEDIR
|
#if ENABLE_USERNAME_OR_HOMEDIR
|
||||||
# undef IF_USERNAME_OR_HOMEDIR
|
|
||||||
# define IF_USERNAME_OR_HOMEDIR(...) __VA_ARGS__
|
# define IF_USERNAME_OR_HOMEDIR(...) __VA_ARGS__
|
||||||
|
#else
|
||||||
|
# define IF_USERNAME_OR_HOMEDIR(...) /*nothing*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -743,11 +754,11 @@ static unsigned path_parse(char ***p)
|
|||||||
char *tmp;
|
char *tmp;
|
||||||
char **res;
|
char **res;
|
||||||
|
|
||||||
#if EDITING_HAS_path_lookup
|
# if EDITING_HAS_path_lookup
|
||||||
if (state->flags & WITH_PATH_LOOKUP)
|
if (state->flags & WITH_PATH_LOOKUP)
|
||||||
pth = state->path_lookup;
|
pth = state->path_lookup;
|
||||||
else
|
else
|
||||||
#endif
|
# endif
|
||||||
pth = getenv("PATH");
|
pth = getenv("PATH");
|
||||||
|
|
||||||
/* PATH="" or PATH=":"? */
|
/* PATH="" or PATH=":"? */
|
||||||
@ -1885,9 +1896,7 @@ static void parse_and_put_prompt(const char *prmt_ptr)
|
|||||||
{
|
{
|
||||||
int prmt_size = 0;
|
int prmt_size = 0;
|
||||||
char *prmt_mem_ptr = xzalloc(1);
|
char *prmt_mem_ptr = xzalloc(1);
|
||||||
# if ENABLE_USERNAME_OR_HOMEDIR
|
|
||||||
char *cwd_buf = NULL;
|
char *cwd_buf = NULL;
|
||||||
# endif
|
|
||||||
char flg_not_length = '[';
|
char flg_not_length = '[';
|
||||||
char cbuf[2];
|
char cbuf[2];
|
||||||
|
|
||||||
@ -1954,11 +1963,9 @@ static void parse_and_put_prompt(const char *prmt_ptr)
|
|||||||
c = *prmt_ptr++;
|
c = *prmt_ptr++;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
# if ENABLE_USERNAME_OR_HOMEDIR
|
|
||||||
case 'u':
|
case 'u':
|
||||||
pbuf = user_buf ? user_buf : (char*)"";
|
pbuf = user_buf ? user_buf : (char*)"";
|
||||||
break;
|
break;
|
||||||
# endif
|
|
||||||
case 'H':
|
case 'H':
|
||||||
case 'h':
|
case 'h':
|
||||||
pbuf = free_me = safe_gethostname();
|
pbuf = free_me = safe_gethostname();
|
||||||
@ -1976,7 +1983,6 @@ static void parse_and_put_prompt(const char *prmt_ptr)
|
|||||||
strftime_HHMMSS(timebuf, sizeof(timebuf), NULL)[-3] = '\0';
|
strftime_HHMMSS(timebuf, sizeof(timebuf), NULL)[-3] = '\0';
|
||||||
pbuf = timebuf;
|
pbuf = timebuf;
|
||||||
break;
|
break;
|
||||||
# if ENABLE_USERNAME_OR_HOMEDIR
|
|
||||||
case 'w': /* current dir */
|
case 'w': /* current dir */
|
||||||
case 'W': /* basename of cur dir */
|
case 'W': /* basename of cur dir */
|
||||||
if (!cwd_buf) {
|
if (!cwd_buf) {
|
||||||
@ -2003,7 +2009,6 @@ static void parse_and_put_prompt(const char *prmt_ptr)
|
|||||||
if (cp)
|
if (cp)
|
||||||
pbuf = (char*)cp + 1;
|
pbuf = (char*)cp + 1;
|
||||||
break;
|
break;
|
||||||
# endif
|
|
||||||
// bb_process_escape_sequence does this now:
|
// bb_process_escape_sequence does this now:
|
||||||
// case 'e': case 'E': /* \e \E = \033 */
|
// case 'e': case 'E': /* \e \E = \033 */
|
||||||
// c = '\033';
|
// c = '\033';
|
||||||
@ -2064,10 +2069,8 @@ static void parse_and_put_prompt(const char *prmt_ptr)
|
|||||||
free(free_me);
|
free(free_me);
|
||||||
} /* while */
|
} /* while */
|
||||||
|
|
||||||
# if ENABLE_USERNAME_OR_HOMEDIR
|
|
||||||
if (cwd_buf != (char *)bb_msg_unknown)
|
if (cwd_buf != (char *)bb_msg_unknown)
|
||||||
free(cwd_buf);
|
free(cwd_buf);
|
||||||
# endif
|
|
||||||
/* see comment (above this function) about multiline prompt redrawing */
|
/* see comment (above this function) about multiline prompt redrawing */
|
||||||
cmdedit_prompt = prompt_last_line = prmt_mem_ptr;
|
cmdedit_prompt = prompt_last_line = prmt_mem_ptr;
|
||||||
prmt_ptr = strrchr(cmdedit_prompt, '\n');
|
prmt_ptr = strrchr(cmdedit_prompt, '\n');
|
||||||
@ -2075,7 +2078,7 @@ static void parse_and_put_prompt(const char *prmt_ptr)
|
|||||||
prompt_last_line = prmt_ptr + 1;
|
prompt_last_line = prmt_ptr + 1;
|
||||||
put_prompt();
|
put_prompt();
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* FEATURE_EDITING_FANCY_PROMPT */
|
||||||
|
|
||||||
#if ENABLE_FEATURE_EDITING_WINCH
|
#if ENABLE_FEATURE_EDITING_WINCH
|
||||||
static void cmdedit_setwidth(void)
|
static void cmdedit_setwidth(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user