[BusyBox] [PATCH] Add CTRL-K support to cmdedit.c

Vladimir N. Oleynik dzo at simtreas.ru
Fri Mar 29 04:56:03 UTC 2002


Jim,
 
> Oops. :)  How about this one?
> 
> --- ./cmdedit.c.orig    Thu Mar 28 04:46:47 2002
> +++ ./cmdedit.c Thu Mar 28 17:33:08 2002
> @@ -1263,16 +1263,20 @@
>                         input_tab(&lastWasTab);
>  #endif
>                         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();
> -                       }
> +               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 */
> +                       int old_cursor = cursor;
> +                       printf("\033[H");
> +                       cursor = 0;
> +                       redraw(0, len-old_cursor);
> +                       break;
> +               }

It is possible to remove also cursor=0 :). 
I all the same can not write down it in CVS.  


--w
vodz



More information about the busybox mailing list