diff options
author | Du Huanpeng <u74147@gmail.com> | 2015-11-15 09:01:19 +0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-17 09:14:17 +0100 |
commit | 405c6e09dd4b7179573a64563be95ca47686c1ef (patch) | |
tree | ffe743960b93b143b96f27b06421512a2f5f155b /lib/readline.c | |
parent | 13226470af5e0aef45b9f323efb4872b8f1357e4 (diff) | |
download | barebox-405c6e09dd4b7179573a64563be95ca47686c1ef.tar.gz |
lib: readline support ctrl-l to clear screen
maybe it is easier to press ctrl-l to clear the screen than type
'clear' command.
Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib/readline.c')
-rw-r--r-- | lib/readline.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/readline.c b/lib/readline.c index 14dd31171d..c007e10f50 100644 --- a/lib/readline.c +++ b/lib/readline.c @@ -262,6 +262,14 @@ int readline(const char *prompt, char *buf, int len) eol_num--; } break; + case CTL_CH('l'): + printf(ANSI_CLEAR_SCREEN); + buf[eol_num] = 0; + printf("%s%s", prompt, buf); + wlen = eol_num - num; + while (wlen--) + getcmd_putch(CTL_BACKSPACE); + break; case BB_KEY_ERASE_TO_EOL: ERASE_TO_EOL(); break; |