implement Message-ID: <20081004171903.GA14184@boetes.org>
in a somewhat hackish way, and it’s still quite different from zsh, but probably closer to a desired functionality XXX this makes state by abusing 「modified」 and 「xmp」 (“the mark”).
This commit is contained in:
parent
78a49e8faf
commit
27ee1866fe
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.226 2008/09/30 19:36:15 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.227 2008/10/04 23:08:01 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 $
|
||||
@ -7,7 +7,7 @@
|
||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R35 2008/09/30
|
||||
@(#)MIRBSD KSH R35 2008/10/04
|
||||
description:
|
||||
Check version of shell.
|
||||
stdin:
|
||||
|
20
edit.c
20
edit.c
@ -5,7 +5,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.135 2008/09/30 19:28:12 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.136 2008/10/04 23:08:03 tg Exp $");
|
||||
|
||||
/* tty driver characters we are interested in */
|
||||
typedef struct {
|
||||
@ -3176,6 +3176,8 @@ x_edit_line(int c __unused)
|
||||
* command and inserts it into the current edit line. If a
|
||||
* numeric arg is supplied then the n'th word from the
|
||||
* start of the previous command is used.
|
||||
* As a side effect, trashes the mark in order to achieve
|
||||
* being called in a repeatable fashion.
|
||||
*
|
||||
* Bound to M-.
|
||||
*
|
||||
@ -3186,11 +3188,20 @@ static int
|
||||
x_prev_histword(int c __unused)
|
||||
{
|
||||
char *rcp, *cp;
|
||||
char **xhp;
|
||||
int m;
|
||||
|
||||
cp = *histptr;
|
||||
if (!cp)
|
||||
if (xmp && modified > 1)
|
||||
x_kill_region(0);
|
||||
m = modified ? modified : 1;
|
||||
xhp = histptr - (m - 1);
|
||||
if ((xhp < history) || !(cp = *xhp)) {
|
||||
x_e_putc2(7);
|
||||
else if (x_arg_defaulted) {
|
||||
x_modified();
|
||||
return (KSTD);
|
||||
}
|
||||
x_set_mark(0);
|
||||
if (x_arg_defaulted) {
|
||||
rcp = &cp[strlen(cp) - 1];
|
||||
/*
|
||||
* ignore white-space after the last word
|
||||
@ -3225,6 +3236,7 @@ x_prev_histword(int c __unused)
|
||||
x_ins(cp);
|
||||
*rcp = ch;
|
||||
}
|
||||
modified = m + 1;
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
|
7
mksh.1
7
mksh.1
@ -1,4 +1,4 @@
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.138 2008/09/30 18:48:01 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.139 2008/10/04 23:08:03 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.122 2008/05/17 23:31:52 sobrado Exp $
|
||||
.\"-
|
||||
.\" Try to make GNU groff and AT&T nroff more compatible
|
||||
@ -30,7 +30,7 @@
|
||||
.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
|
||||
..
|
||||
.\"-
|
||||
.Dd $Mdocdate: September 30 2008 $
|
||||
.Dd $Mdocdate: October 4 2008 $
|
||||
.Dt MKSH 1
|
||||
.Os MirBSD
|
||||
.Sh NAME
|
||||
@ -4804,6 +4804,9 @@ Introduces a 2-character command sequence.
|
||||
The last
|
||||
.Pq Ar n Ns th
|
||||
word of the previous command is inserted at the cursor.
|
||||
On repeated execution, goes back the history.
|
||||
Use of this editing command trashes the mark.
|
||||
If this
|
||||
.It quote: \*(ha\*(ha , \*(haV
|
||||
The following character is taken literally rather than as an editing command.
|
||||
.It redraw: \*(haL
|
||||
|
4
sh.h
4
sh.h
@ -100,9 +100,9 @@
|
||||
#define __SCCSID(x) __IDSTRING(sccsid,x)
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.236 2008/09/30 19:25:51 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.237 2008/10/04 23:08:04 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R35 2008/09/30"
|
||||
#define MKSH_VERSION "R35 2008/10/04"
|
||||
|
||||
#ifndef MKSH_INCLUDES_ONLY
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user