From 3b487bf51115bfb9a0f85667a5608fc57788107c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 1 Oct 2023 19:13:16 -0600 Subject: cli: Allow command completion to be disabled When inputting text outside the command line we don't want to use tab for command completion. Add an option to control this. Signed-off-by: Simon Glass --- common/cli_readline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common/cli_readline.c') diff --git a/common/cli_readline.c b/common/cli_readline.c index fa8f525d3a4..23913a857a9 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -389,7 +389,7 @@ int cread_line_process_ch(struct cli_line_state *cls, char ichar) } break; case '\t': - if (IS_ENABLED(CONFIG_AUTO_COMPLETE)) { + if (IS_ENABLED(CONFIG_AUTO_COMPLETE) && cls->cmd_complete) { int num2, col; /* do not autocomplete when in the middle */ @@ -440,6 +440,7 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, cls->prompt = prompt; cls->buf = buf; cls->history = true; + cls->cmd_complete = true; if (init_len) cread_add_str(buf, init_len, 1, &cls->num, &cls->eol_num, buf, -- cgit