Add a hack input function for VT100-style key sequences; support
Ctrl-CurLeft and Ctrl-CurRight (not quite ANSI, but fits the scheme)
This commit is contained in:
parent
08ec9ca3ab
commit
1ea1096a4e
4
check.t
4
check.t
|
@ -1,4 +1,4 @@
|
|||
# $MirOS: src/bin/mksh/check.t,v 1.307 2009/09/19 21:54:42 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.308 2009/09/20 17:23:49 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
|
@ -25,7 +25,7 @@
|
|||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R39 2009/09/19
|
||||
@(#)MIRBSD KSH R39 2009/09/20
|
||||
description:
|
||||
Check version of shell.
|
||||
stdin:
|
||||
|
|
43
edit.c
43
edit.c
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.179 2009/09/20 17:18:53 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.180 2009/09/20 17:23:50 tg Exp $");
|
||||
|
||||
/* tty driver characters we are interested in */
|
||||
typedef struct {
|
||||
|
@ -1191,7 +1191,7 @@ static struct x_defbindings const x_defbindings[] = {
|
|||
{ XFUNC_mv_forw, 2, 'C' },
|
||||
{ XFUNC_mv_back, 2, 'D' },
|
||||
#ifndef MKSH_SMALL
|
||||
{ XFUNC_mv_begin | 0x80, 2, '1' },
|
||||
{ XFUNC_vt_hack, 2, '1' },
|
||||
{ XFUNC_mv_begin | 0x80, 2, '7' },
|
||||
{ XFUNC_mv_begin, 2, 'H' },
|
||||
{ XFUNC_mv_end | 0x80, 2, '4' },
|
||||
|
@ -2401,6 +2401,45 @@ x_error(int c __unused)
|
|||
return (KSTD);
|
||||
}
|
||||
|
||||
#ifndef MKSH_SMALL
|
||||
/* special VT100 style key sequence hack */
|
||||
static int
|
||||
x_vt_hack(int c)
|
||||
{
|
||||
/* we only support PF2-'1' for now */
|
||||
if (c != (2 << 8 | '1'))
|
||||
return (x_error(c));
|
||||
|
||||
/* what's the next character? */
|
||||
switch ((c = x_e_getc())) {
|
||||
case '~':
|
||||
x_arg = 1;
|
||||
x_arg_defaulted = 1;
|
||||
return (x_mv_begin(0));
|
||||
case ';':
|
||||
/* "interesting" sequence detected */
|
||||
break;
|
||||
default:
|
||||
goto unwind_err;
|
||||
}
|
||||
|
||||
/* XXX x_e_ungetc is one-octet only */
|
||||
if ((c = x_e_getc()) != '5')
|
||||
goto unwind_err;
|
||||
|
||||
switch ((c = x_e_getc())) {
|
||||
case 'C':
|
||||
return (x_mv_fword(c));
|
||||
case 'D':
|
||||
return (x_mv_bword(c));
|
||||
}
|
||||
|
||||
unwind_err:
|
||||
x_e_ungetc(c);
|
||||
return (x_error(c));
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *
|
||||
x_mapin(const char *cp, Area *ap)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#if defined(EMACSFN_DEFNS)
|
||||
__RCSID("$MirOS: src/bin/mksh/emacsfn.h,v 1.2 2009/09/20 17:00:53 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/emacsfn.h,v 1.3 2009/09/20 17:23:51 tg Exp $");
|
||||
#define FN(cname,sname,flags) static int x_##cname(int);
|
||||
#elif defined(EMACSFN_ENUMS)
|
||||
#define FN(cname,sname,flags) XFUNC_##cname,
|
||||
|
@ -74,6 +74,9 @@ FN(set_arg, set-arg, XF_NOBIND)
|
|||
FN(set_mark, set-mark-command, 0)
|
||||
FN(transpose, transpose-chars, 0)
|
||||
FN(version, version, 0)
|
||||
#ifndef MKSH_SMALL
|
||||
FN(vt_hack, vt100-hack, XF_ARG)
|
||||
#endif
|
||||
FN(xchg_point_mark, exchange-point-and-mark, 0)
|
||||
FN(yank, yank, 0)
|
||||
|
||||
|
|
6
mksh.1
6
mksh.1
|
@ -1,4 +1,4 @@
|
|||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.190 2009/09/20 16:40:56 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.191 2009/09/20 17:23:51 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.129 2009/05/28 06:09:06 jmc Exp $
|
||||
.\"-
|
||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
|
@ -4841,7 +4841,7 @@ Moves the cursor backward
|
|||
characters.
|
||||
.It Xo backward\-word:
|
||||
.Op Ar n
|
||||
.No \*(ha[b
|
||||
.No \*(ha[b , ANSI-Ctrl-CurLeft
|
||||
.Xc
|
||||
Moves the cursor backward to the beginning of the word; words consist of
|
||||
alphanumerics, underscore
|
||||
|
@ -4992,7 +4992,7 @@ Moves the cursor forward
|
|||
characters.
|
||||
.It Xo forward\-word:
|
||||
.Op Ar n
|
||||
.No \*(ha[f
|
||||
.No \*(ha[f , ANSI-Ctrl-CurRight
|
||||
.Xc
|
||||
Moves the cursor forward to the end of the
|
||||
.Ar n Ns th
|
||||
|
|
4
sh.h
4
sh.h
|
@ -134,9 +134,9 @@
|
|||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.345 2009/09/20 16:40:57 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.346 2009/09/20 17:23:52 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R39 2009/09/19"
|
||||
#define MKSH_VERSION "R39 2009/09/20"
|
||||
|
||||
#ifndef MKSH_INCLUDES_ONLY
|
||||
|
||||
|
|
Loading…
Reference in New Issue