allow backslash escapes for bind for ^ and \ o̲n̲l̲y̲; also more EBCDIC-friendly
This commit is contained in:
parent
fba6940ba4
commit
1c6b2d1cb8
22
edit.c
22
edit.c
@ -28,7 +28,7 @@
|
||||
|
||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.332 2017/04/28 03:28:17 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.333 2017/04/28 03:37:43 tg Exp $");
|
||||
|
||||
/*
|
||||
* in later versions we might use libtermcap for this, but since external
|
||||
@ -2394,18 +2394,18 @@ x_mapin(const char *cp, Area *ap)
|
||||
strdupx(news, cp, ap);
|
||||
op = news;
|
||||
while (*cp) {
|
||||
/* XXX -- should handle \^ escape? */
|
||||
if (*cp == '^') {
|
||||
switch (*cp) {
|
||||
case '^':
|
||||
cp++;
|
||||
/*XXX or ^^ escape? this is ugly. */
|
||||
if (rtt2asc(*cp) >= 0x3FU)
|
||||
*op++ = ksh_toctrl(*cp);
|
||||
else {
|
||||
*op++ = '^';
|
||||
cp--;
|
||||
}
|
||||
} else
|
||||
*op++ = ksh_toctrl(*cp);
|
||||
break;
|
||||
case '\\':
|
||||
if (cp[1] == '\\' || cp[1] == '^')
|
||||
++cp;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
*op++ = *cp;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
*op = '\0';
|
||||
|
7
mksh.1
7
mksh.1
@ -1,4 +1,4 @@
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.445 2017/04/27 23:33:19 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.446 2017/04/28 03:37:44 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
||||
.\"-
|
||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
@ -76,7 +76,7 @@
|
||||
.\" with -mandoc, it might implement .Mx itself, but we want to
|
||||
.\" use our own definition. And .Dd must come *first*, always.
|
||||
.\"
|
||||
.Dd $Mdocdate: April 27 2017 $
|
||||
.Dd $Mdocdate: April 28 2017 $
|
||||
.\"
|
||||
.\" Check which macro package we use, and do other -mdoc setup.
|
||||
.\"
|
||||
@ -3164,7 +3164,8 @@ other trailing character will be processed afterwards.
|
||||
.Pp
|
||||
Control characters may be written using caret notation
|
||||
i.e. \*(haX represents Ctrl-X.
|
||||
Note that although only two prefix characters (usually ESC and \*(haX)
|
||||
The caret itself can be escaped by a backslash, which also escapes itself.
|
||||
Note that although only three prefix characters (usually ESC, \*(haX and NUL)
|
||||
are supported, some multi-character sequences can be supported.
|
||||
.Pp
|
||||
The following default bindings show how the arrow keys, the home, end and
|
||||
|
Loading…
Reference in New Issue
Block a user