slackbuilds_ponce/system/ksh-openbsd/patches/03-ksh-vi-Ctrl-l-in-insert-mode-to-clear-the-screen.diff
Daniel LEVAI 7fc7de8808 system/ksh-openbsd: Renamed from "ksh" and updated to 20110909
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
2011-10-08 20:29:28 -05:00

45 lines
1.1 KiB
Diff

From 13ef2cd4206ed541fe1dae46c91a339fba5cf5cf Mon Sep 17 00:00:00 2001
From: Alexander Polakov <polachok@gmail.com>
Date: Sun, 29 May 2011 15:12:31 +0400
Subject: [PATCH 3/8] ksh/vi: Ctrl-l in insert mode to clear the screen.
Why: typing "clear" is too slow.
---
ksh.1 | 3 +++
vi.c | 6 ++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git ksh.1 ksh.1
index f4b5815..01130ea 100644
--- ksh.1
+++ ksh.1
@@ -5215,6 +5215,9 @@ List all the commands or files that match the current big-word.
Macro expansion.
Execute the commands found in the alias
.Ar c .
+.It ^L
+Clear the screen leaving the current line at the top of the
+screen.
.El
.Pp
Intra-line movement commands:
diff --git vi.c vi.c
index e4173c7..d0de478 100644
--- vi.c
+++ vi.c
@@ -646,6 +646,12 @@ vi_insert(int ch)
return redo_insert(lastac - 1);
/* { Begin nonstandard vi commands */
+ case Ctrl('l'):
+ /* Use ANSI escape codes to clear the screen */
+ x_puts("\033[2J\033[0;0H");
+ redraw_line(0);
+ break;
+
case Ctrl('x'):
expand_word(0);
break;
--
1.7.5