oksh-noxz

[fork] Portable OpenBSD ksh, based on the Public Domain Korn Shell (pdksh).
git clone https://noxz.tech/git/oksh-noxz.git
oksh-noxz

commit: a41ee4b7fd945bc52c8a3835f1c06b86f738c0de
parent: 31c55eccca0a4008884e234a23f4bfec475dda7f
author: Brian Callahan <bcallah@openbsd.org>
date:   Thu, 11 Mar 2021 22:50:25 -0500
Pull in another OpenBSD commit originally reported by @netzbasis

CVSROOT:	/cvs
Module name:	src
Changes by:	millert@cvs.openbsd.org	2021/03/11 19:10:25

Modified files:
	bin/ksh        : vi.c

Log message:
Provide definition of CTRL in vi.c like we do for emacs.c.
Fixes a portability issue.  From Benjamin Baier
MCVS/Entries8++++----
Mksh.18+++++---
Moksh.18+++++---
Mvi.c12++++++------
4 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/CVS/Entries b/CVS/Entries
@@ -39,8 +39,8 @@
 /tty.h/1.6/Sat Mar  6 16:35:13 2021//
 /var.c/1.72/Result of merge//
 /version.c/1.12/Sat Mar  6 16:35:13 2021//
-/Makefile/1.39/Wed Mar 10 21:24:19 2021//
-/README/1.16/Wed Mar 10 21:24:19 2021//
-/ksh.1/1.212/Wed Mar 10 21:24:19 2021//
-/vi.c/1.58/Result of merge//
+/Makefile/1.39/Fri Mar 12 03:48:27 2021//
+/README/1.16/Fri Mar 12 03:48:27 2021//
+/ksh.1/1.214/Fri Mar 12 03:48:27 2021//
+/vi.c/1.60/Result of merge+Fri Mar 12 03:48:27 2021//
 D
diff --git a/ksh.1 b/ksh.1
@@ -1,8 +1,8 @@
-.\"	$OpenBSD: ksh.1,v 1.212 2021/03/08 06:20:50 jsg Exp $
+.\"	$OpenBSD: ksh.1,v 1.214 2021/03/11 07:04:12 jmc Exp $
 .\"
 .\"	Public Domain
 .\"
-.Dd $Mdocdate: March 8 2021 $
+.Dd $Mdocdate: March 11 2021 $
 .Dt KSH 1
 .Os
 .Sh NAME
@@ -5060,6 +5060,8 @@ See the
 command in
 .Sx Emacs editing mode
 for more information.
+.It ^R
+Redraw the current line.
 .It ^V
 Literal next.
 The next character typed is not treated specially (can be used
@@ -5570,7 +5572,7 @@ Privileged shell profile.
 .Rs
 .\" 4.4BSD USD:3
 .%A S. R. Bourne
-.%T An Introduction to the UNIX Shell
+.%T \&An Introduction to the UNIX Shell
 .%I AT&T Bell Laboratories
 .%R Computing Science Technical Report
 .%N 70
diff --git a/oksh.1 b/oksh.1
@@ -1,8 +1,8 @@
-.\"	$OpenBSD: ksh.1,v 1.212 2021/03/08 06:20:50 jsg Exp $
+.\"	$OpenBSD: ksh.1,v 1.214 2021/03/11 07:04:12 jmc Exp $
 .\"
 .\"	Public Domain
 .\"
-.Dd $Mdocdate: March 8 2021 $
+.Dd $Mdocdate: March 11 2021 $
 .Dt OKSH 1
 .Os
 .Sh NAME
@@ -5060,6 +5060,8 @@ See the
 command in
 .Sx Emacs editing mode
 for more information.
+.It ^R
+Redraw the current line.
 .It ^V
 Literal next.
 The next character typed is not treated specially (can be used
@@ -5570,7 +5572,7 @@ Privileged shell profile.
 .Rs
 .\" 4.4BSD USD:3
 .%A S. R. Bourne
-.%T An Introduction to the UNIX Shell
+.%T \&An Introduction to the UNIX Shell
 .%I AT&T Bell Laboratories
 .%R Computing Science Technical Report
 .%N 70
diff --git a/vi.c b/vi.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: vi.c,v 1.58 2021/03/10 20:06:04 millert Exp $	*/
+/*	$OpenBSD: vi.c,v 1.60 2021/03/12 02:10:25 millert Exp $	*/
 
 /*
  *	vi command editing
@@ -22,12 +22,8 @@
 #include "sh.h"
 #include "edit.h"
 
-#if !defined(CTRL) || defined(__FreeBSD__)
-#ifdef __FreeBSD__
 #undef CTRL
-#endif
-#define CTRL(c)	(c & 0x1f)
-#endif /* !CTRL || __FreeBSD__ */
+#define	CTRL(x)		((x) & 0x1F)	/* ASCII */
 
 struct edstate {
 	char	*cbuf;		/* main buffer to build the command line */
@@ -665,6 +661,10 @@ vi_insert(int ch)
 		do_clear_screen();
 		break;
 
+	case CTRL('r'):
+		redraw_line(1, 0);
+		break;
+
 	case CTRL('i'):
 		if (Flag(FVITABCOMPLETE)) {
 			complete_word(0, 0);