[BusyBox] [PATCH] Add CTRL-K support to cmdedit.c
Jim Treadway
jim at stardot-tech.com
Thu Mar 21 00:11:06 UTC 2002
The following patch adds support for CTRL-K (clear to end of line), and
makes CTRL-L always clear the screen. It's against the stable branch; I
can generate a diff against the development branch if needed.
Jim
--- busybox/cmdedit.c.orig Wed Mar 20 23:04:37 2002
+++ busybox/cmdedit.c Wed Mar 20 23:05:11 2002
@@ -1263,15 +1263,19 @@
input_tab(&lastWasTab);
#endif
break;
+ case 11:
+ /* Control-k -- clear to end of line */
+ if (cursor) {
+ *(command + cursor) = 0;
+ len = cursor;
+ redraw(cmdedit_y, 0);
+ }
+ break;
case 12:
- /* Control-l -- clear screen
- * if the len=0 and no chars in edit line */
- if (len == 0) {
- printf("\033[H\033[J");
- put_prompt();
- } else {
- beep();
- }
+ /* Control-l -- clear screen */
+ printf("\033[2J");
+ put_prompt();
+ redraw(cmdedit_y, 0);
break;
case 14:
/* Control-n -- Get next command in history */
More information about the busybox
mailing list