[BusyBox] [PATCH] Add CTRL-K support to cmdedit.c
Jim Treadway
jim at stardot-tech.com
Wed Mar 27 19:55:03 UTC 2002
On Wed, 27 Mar 2002, Vladimir N. Oleynik wrote:
> > The following patch adds support for CTRL-K (clear to end of line),
>
> Thanks. I like this part.
The "if (cursor) { ... }" block should be removed or it won't work if you
are on the start of the line.
I must have been tired or something, sorry. ;)
So it should look like this (with your correction to the CTRL-L portion
applied, against busybox.stable):
--- ./cmdedit.c.orig Wed Mar 27 18:52:53 2002
+++ ./cmdedit.c Wed Mar 27 18:49:31 2002
@@ -1263,15 +1263,17 @@
input_tab(&lastWasTab);
#endif
break;
+ case 11:
+ /* Control-k -- clear to end of line */
+ *(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[H");
+ put_prompt();
+ redraw(cmdedit_y, 0);
break;
case 14:
/* Control-n -- Get next command in history */
More information about the busybox
mailing list