Skip to contentSkip to conversation

lib: readline support ctrl-l to clear screen

PATCH New Du Huanpeng 1 participant 1 message Nov 14, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: readline support ctrl-l to clear screen

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

---
 lib/readline.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/readline.c +4 -0
index 14dd311..679d78f 100644
@@ -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;
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox