[PATCH] lib: readline support ctrl-l to clear screen

Du Huanpeng u74147 at gmail.com
Sat Nov 14 03:29:20 PST 2015


maybe it is easier to press ctrl-l to clear the screen than type
'clear' command.

Signed-off-by: Du Huanpeng <u74147 at gmail.com>
---
 lib/readline.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/readline.c b/lib/readline.c
index 14dd311..679d78f 100644
--- a/lib/readline.c
+++ b/lib/readline.c
@@ -262,6 +262,10 @@ int readline(const char *prompt, char *buf, int len)
 				eol_num--;
 			}
 			break;
+		case CTL_CH('l'):
+			printf(ANSI_CLEAR_SCREEN);
+			printf("%s%s", prompt, buf);
+			break;
 		case BB_KEY_ERASE_TO_EOL:
 			ERASE_TO_EOL();
 			break;
-- 
1.9.1




More information about the barebox mailing list