aboutsummaryrefslogtreecommitdiff
path: root/system/ksh-openbsd/patches/03-ksh-vi-Ctrl-l-in-insert-mode-to-clear-the-screen.diff
blob: 21a57ffb424e41159ae41ab591ea721fba2f1abf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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