From 833810a154b0c37cbf81ba09c19520c0d350ac1b Mon Sep 17 00:00:00 2001 From: tg Date: Fri, 8 Jan 2010 22:21:06 +0000 Subject: [PATCH] While we were supposed to use Ctrl-Arrowkey for wordwise jumping, some idiotic terminal emulators and/or people seem to use the es- cape codes normally denoting Alt-Arrowkey instead so let's simply bind them to the vt_hack as well... (untested) --- check.t | 4 ++-- edit.c | 15 ++++++++++++--- mksh.1 | 10 +++++----- sh.h | 6 +++--- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/check.t b/check.t index b114eef..df87488 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.353 2010/01/04 21:08:00 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.354 2010/01/08 22:21:03 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 2010/01/01 + @(#)MIRBSD KSH R39 2010/01/08 description: Check version of shell. stdin: diff --git a/edit.c b/edit.c index 59e3225..30112fd 100644 --- a/edit.c +++ b/edit.c @@ -4,7 +4,7 @@ /* $OpenBSD: vi.c,v 1.26 2009/06/29 22:50:19 martynas Exp $ */ /*- - * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 + * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 * Thorsten Glaser * * Provided that these terms and disclaimer and all copyright notices @@ -25,7 +25,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.187 2009/12/12 22:27:05 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.188 2010/01/08 22:21:04 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -2219,9 +2219,18 @@ x_vt_hack(int c) } /* XXX x_e_ungetc is one-octet only */ - if ((c = x_e_getc()) != '5') + if ((c = x_e_getc()) != '5' && c != '3') goto unwind_err; + /*- + * At this point, we have read the following octets so far: + * - ESC+[ or ESC+O or Ctrl-X (Præfix 2) + * - 1 (vt_hack) + * - ; + * - 5 (Ctrl key combiner) or 3 (Alt key combiner) + * We can now accept one more octet designating the key. + */ + switch ((c = x_e_getc())) { case 'C': return (x_mv_fword(c)); diff --git a/mksh.1 b/mksh.1 index ee82eaf..601fa9c 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,7 +1,7 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.205 2010/01/06 18:29:01 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.206 2010/01/08 22:21:05 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 +.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 .\" Thorsten Glaser .\" .\" Provided that these terms and disclaimer and all copyright notices @@ -71,7 +71,7 @@ .\" with -mandoc, it might implement .Mx itself, but we want to .\" use our own definition. And .Dd must come *first*, always. .\" -.Dd $Mdocdate: January 6 2010 $ +.Dd $Mdocdate: January 8 2010 $ .\" .\" Check which macro package we use .\" @@ -4961,7 +4961,7 @@ Moves the cursor backward characters. .It Xo backward\-word: .Op Ar n -.No \*(ha[b , ANSI-Ctrl-CurLeft +.No \*(ha[b , ANSI-Ctrl-CurLeft , ANSI-Alt-CurLeft .Xc Moves the cursor backward to the beginning of the word; words consist of alphanumerics, underscore @@ -5112,7 +5112,7 @@ Moves the cursor forward characters. .It Xo forward\-word: .Op Ar n -.No \*(ha[f , ANSI-Ctrl-CurRight +.No \*(ha[f , ANSI-Ctrl-CurRight , ANSI-Alt-CurRight .Xc Moves the cursor forward to the end of the .Ar n Ns th diff --git a/sh.h b/sh.h index 5235b4d..b4481a7 100644 --- a/sh.h +++ b/sh.h @@ -9,7 +9,7 @@ /* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */ /*- - * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 + * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 * Thorsten Glaser * * Provided that these terms and disclaimer and all copyright notices @@ -148,9 +148,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.372 2010/01/01 17:44:10 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.373 2010/01/08 22:21:06 tg Exp $"); #endif -#define MKSH_VERSION "R39 2010/01/01" +#define MKSH_VERSION "R39 2010/01/08" #ifndef MKSH_INCLUDES_ONLY