Patch from vodz to implement ^L (clear screen)
authorEric Andersen <andersen@codepoet.org>
Fri, 21 Dec 2001 11:20:15 +0000 (11:20 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 21 Dec 2001 11:20:15 +0000 (11:20 -0000)
shell/cmdedit.c

index b908915876384e975bab371b91da0fad5d4d08c2..d4d6264d0fb018ce27f4676b5b5713590c4ce044 100644 (file)
@@ -1263,6 +1263,16 @@ prepare_to_die:
                        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();
+                       }
+                       break;
                case 14:
                        /* Control-n -- Get next command in history */
                        if (hp && hp->n && hp->n->s) {
@@ -1288,7 +1298,6 @@ prepare_to_die:
                                redraw(cmdedit_y, len -= cursor);
                        }
                        break;
-
                case ESC:{
                        /* escape sequence follows */
                        if (safe_read(0, &c, 1) < 1)