remove the "set -o sh" option (dummy anyway),
"set +o emacs-usemeta" and "set -o vi-show8" which are always on now, since we have proper internationalisation (i.e. utf-8) support, and assume the user either has a 'C' locale and can't enter 8-bit chars, his terminal is 8bit-transparent, or he has a 'UTF-8' locale.
This commit is contained in:
parent
8a4b64fde3
commit
98e9111bbc
65
edit.c
65
edit.c
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.73 2006/11/12 14:58:13 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.74 2006/11/19 20:43:12 tg Exp $");
|
||||||
|
|
||||||
/* tty driver characters we are interested in */
|
/* tty driver characters we are interested in */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1022,9 +1022,6 @@ static Area aedit;
|
||||||
|
|
||||||
#define MKCTRL(x) ((x) == '?' ? 0x7F : (x) & 0x1F) /* ASCII */
|
#define MKCTRL(x) ((x) == '?' ? 0x7F : (x) & 0x1F) /* ASCII */
|
||||||
#define UNCTRL(x) ((x) ^ 0x40) /* ASCII */
|
#define UNCTRL(x) ((x) ^ 0x40) /* ASCII */
|
||||||
#define META(x) ((x) & 0x7f)
|
|
||||||
#define ISMETA(x) (!Flag(FUTFHACK) && Flag(FEMACSUSEMETA) && ((x) & 0x80))
|
|
||||||
|
|
||||||
|
|
||||||
/* values returned by keyboard functions */
|
/* values returned by keyboard functions */
|
||||||
#define KSTD 0
|
#define KSTD 0
|
||||||
|
@ -1480,10 +1477,6 @@ x_emacs(char *buf, size_t len)
|
||||||
if ((c = x_e_getc()) < 0)
|
if ((c = x_e_getc()) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (ISMETA(c)) {
|
|
||||||
c = META(c);
|
|
||||||
x_curprefix = 1;
|
|
||||||
}
|
|
||||||
f = x_curprefix == -1 ? XFUNC_insert :
|
f = x_curprefix == -1 ? XFUNC_insert :
|
||||||
x_tab[x_curprefix][c & CHARMASK];
|
x_tab[x_curprefix][c & CHARMASK];
|
||||||
if (f & 0x80) {
|
if (f & 0x80) {
|
||||||
|
@ -2674,8 +2667,6 @@ x_init_emacs(void)
|
||||||
for (i = 1; i < X_NTABS; i++)
|
for (i = 1; i < X_NTABS; i++)
|
||||||
for (j = 0; j < X_TABSZ; j++)
|
for (j = 0; j < X_TABSZ; j++)
|
||||||
x_atab[i][j] = NULL;
|
x_atab[i][j] = NULL;
|
||||||
|
|
||||||
Flag(FEMACSUSEMETA) = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3384,7 +3375,7 @@ static void ed_mov_opt(int, char *);
|
||||||
static int expand_word(int);
|
static int expand_word(int);
|
||||||
static int complete_word(int, int);
|
static int complete_word(int, int);
|
||||||
static int print_expansions(struct edstate *, int);
|
static int print_expansions(struct edstate *, int);
|
||||||
static int char_len(int);
|
#define char_len(c) ((c) < ' ' || (c) == 0x7F ? 2 : 1)
|
||||||
static void x_vi_zotc(int);
|
static void x_vi_zotc(int);
|
||||||
static void vi_error(void);
|
static void vi_error(void);
|
||||||
static void vi_macro_reset(void);
|
static void vi_macro_reset(void);
|
||||||
|
@ -3758,13 +3749,6 @@ vi_hook(int ch)
|
||||||
vi_error();
|
vi_error();
|
||||||
else {
|
else {
|
||||||
locpat[srchlen++] = ch;
|
locpat[srchlen++] = ch;
|
||||||
if ((ch & 0x80) && Flag(FVISHOW8)) {
|
|
||||||
if (es->linelen + 2 > es->cbufsize)
|
|
||||||
vi_error();
|
|
||||||
es->cbuf[es->linelen++] = 'M';
|
|
||||||
es->cbuf[es->linelen++] = '-';
|
|
||||||
ch &= 0x7f;
|
|
||||||
}
|
|
||||||
if (ch < ' ' || ch == 0x7f) {
|
if (ch < ' ' || ch == 0x7f) {
|
||||||
if (es->linelen + 2 > es->cbufsize)
|
if (es->linelen + 2 > es->cbufsize)
|
||||||
vi_error();
|
vi_error();
|
||||||
|
@ -5112,30 +5096,20 @@ display(char *wb1, char *wb2, int leftside)
|
||||||
while (col < winwidth && cur < es->linelen) {
|
while (col < winwidth && cur < es->linelen) {
|
||||||
if (cur == es->cursor && leftside)
|
if (cur == es->cursor && leftside)
|
||||||
ncol = col + pwidth;
|
ncol = col + pwidth;
|
||||||
if ((ch = es->cbuf[cur]) == '\t') {
|
if ((ch = es->cbuf[cur]) == '\t')
|
||||||
do {
|
do {
|
||||||
*twb1++ = ' ';
|
*twb1++ = ' ';
|
||||||
} while (++col < winwidth && (col & 7) != 0);
|
} while (++col < winwidth && (col & 7) != 0);
|
||||||
} else {
|
else if (col < winwidth) {
|
||||||
if ((ch & 0x80) && Flag(FVISHOW8)) {
|
if (ch < ' ' || ch == 0x7f) {
|
||||||
*twb1++ = 'M';
|
*twb1++ = '^';
|
||||||
if (++col < winwidth) {
|
if (++col < winwidth) {
|
||||||
*twb1++ = '-';
|
*twb1++ = ch ^ '@';
|
||||||
col++;
|
|
||||||
}
|
|
||||||
ch &= 0x7f;
|
|
||||||
}
|
|
||||||
if (col < winwidth) {
|
|
||||||
if (ch < ' ' || ch == 0x7f) {
|
|
||||||
*twb1++ = '^';
|
|
||||||
if (++col < winwidth) {
|
|
||||||
*twb1++ = ch ^ '@';
|
|
||||||
col++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
*twb1++ = ch;
|
|
||||||
col++;
|
col++;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
*twb1++ = ch;
|
||||||
|
col++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cur == es->cursor && !leftside)
|
if (cur == es->cursor && !leftside)
|
||||||
|
@ -5395,29 +5369,10 @@ print_expansions(struct edstate *est, int cmd __attribute__((unused)))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* How long is char when displayed (not counting tabs) */
|
|
||||||
static int
|
|
||||||
char_len(int c)
|
|
||||||
{
|
|
||||||
int len = 1;
|
|
||||||
|
|
||||||
if ((c & 0x80) && Flag(FVISHOW8)) {
|
|
||||||
len += 2;
|
|
||||||
c &= 0x7f;
|
|
||||||
}
|
|
||||||
if (c < ' ' || c == 0x7f)
|
|
||||||
len++;
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Similar to x_zotc(emacs.c), but no tab weirdness */
|
/* Similar to x_zotc(emacs.c), but no tab weirdness */
|
||||||
static void
|
static void
|
||||||
x_vi_zotc(int c)
|
x_vi_zotc(int c)
|
||||||
{
|
{
|
||||||
if (Flag(FVISHOW8) && (c & 0x80)) {
|
|
||||||
x_puts((const u_char *)"M-");
|
|
||||||
c &= 0x7f;
|
|
||||||
}
|
|
||||||
if (c < ' ' || c == 0x7f) {
|
if (c < ' ' || c == 0x7f) {
|
||||||
x_putc('^');
|
x_putc('^');
|
||||||
c ^= '@';
|
c ^= '@';
|
||||||
|
|
9
misc.c
9
misc.c
|
@ -6,7 +6,7 @@
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.43 2006/11/16 13:35:07 tg Exp $\t"
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.44 2006/11/19 20:43:13 tg Exp $\t"
|
||||||
MKSH_SH_H_ID);
|
MKSH_SH_H_ID);
|
||||||
|
|
||||||
#undef USE_CHVT
|
#undef USE_CHVT
|
||||||
|
@ -108,7 +108,6 @@ const struct option options[] = {
|
||||||
{ "bgnice", 0, OF_ANY },
|
{ "bgnice", 0, OF_ANY },
|
||||||
{ NULL, 'c', OF_CMDLINE },
|
{ NULL, 'c', OF_CMDLINE },
|
||||||
{ "emacs", 0, OF_ANY },
|
{ "emacs", 0, OF_ANY },
|
||||||
{ "emacs-usemeta", 0, OF_ANY }, /* non-standard */
|
|
||||||
{ "errexit", 'e', OF_ANY },
|
{ "errexit", 'e', OF_ANY },
|
||||||
{ "gmacs", 0, OF_ANY },
|
{ "gmacs", 0, OF_ANY },
|
||||||
{ "ignoreeof", 0, OF_ANY },
|
{ "ignoreeof", 0, OF_ANY },
|
||||||
|
@ -128,14 +127,12 @@ const struct option options[] = {
|
||||||
{ "posix", 0, OF_ANY }, /* non-standard */
|
{ "posix", 0, OF_ANY }, /* non-standard */
|
||||||
{ "privileged", 'p', OF_ANY },
|
{ "privileged", 'p', OF_ANY },
|
||||||
{ "restricted", 'r', OF_CMDLINE },
|
{ "restricted", 'r', OF_CMDLINE },
|
||||||
{ "sh", 0, OF_ANY }, /* non-standard */
|
|
||||||
{ "stdin", 's', OF_CMDLINE }, /* pseudo non-standard */
|
{ "stdin", 's', OF_CMDLINE }, /* pseudo non-standard */
|
||||||
{ "trackall", 'h', OF_ANY },
|
{ "trackall", 'h', OF_ANY },
|
||||||
{ "utf8-hack", 'U', OF_ANY }, /* non-standard */
|
{ "utf8-hack", 'U', OF_ANY }, /* non-standard */
|
||||||
{ "verbose", 'v', OF_ANY },
|
{ "verbose", 'v', OF_ANY },
|
||||||
{ "vi", 0, OF_ANY },
|
{ "vi", 0, OF_ANY },
|
||||||
{ "viraw", 0, OF_ANY }, /* no effect */
|
{ "viraw", 0, OF_ANY }, /* no effect */
|
||||||
{ "vi-show8", 0, OF_ANY }, /* non-standard */
|
|
||||||
{ "vi-tabcomplete", 0, OF_ANY }, /* non-standard */
|
{ "vi-tabcomplete", 0, OF_ANY }, /* non-standard */
|
||||||
{ "vi-esccomplete", 0, OF_ANY }, /* non-standard */
|
{ "vi-esccomplete", 0, OF_ANY }, /* non-standard */
|
||||||
{ "xtrace", 'x', OF_ANY },
|
{ "xtrace", 'x', OF_ANY },
|
||||||
|
@ -233,10 +230,6 @@ change_flag(enum sh_flag f,
|
||||||
{
|
{
|
||||||
int oldval;
|
int oldval;
|
||||||
|
|
||||||
/* limited pdksh compatibility (FSH stays always off) */
|
|
||||||
if (f == FSH)
|
|
||||||
return;
|
|
||||||
|
|
||||||
oldval = Flag(f);
|
oldval = Flag(f);
|
||||||
Flag(f) = newval;
|
Flag(f) = newval;
|
||||||
if (f == FMONITOR) {
|
if (f == FMONITOR) {
|
||||||
|
|
19
mksh.1
19
mksh.1
|
@ -1,4 +1,4 @@
|
||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.69 2006/11/19 17:00:32 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.70 2006/11/19 20:43:13 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.116 2006/07/26 10:13:25 jmc Exp $
|
.\" $OpenBSD: ksh.1,v 1.116 2006/07/26 10:13:25 jmc Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd November 19, 2006
|
.Dd November 19, 2006
|
||||||
|
@ -3301,14 +3301,6 @@ If disabled, tilde expansion after an equals sign is disabled as a side effect.
|
||||||
.It Ic emacs
|
.It Ic emacs
|
||||||
Enable BRL emacs-like command-line editing (interactive shells only); see
|
Enable BRL emacs-like command-line editing (interactive shells only); see
|
||||||
.Sx Emacs editing mode .
|
.Sx Emacs editing mode .
|
||||||
.It Ic emacs-usemeta
|
|
||||||
In emacs command-line editing, use the 8th bit as meta (^[) prefix.
|
|
||||||
This is disabled by default, so you can use high-bit7 characters in pathnames.
|
|
||||||
If this option is not set, characters in the range 128\-160 are printed as is,
|
|
||||||
which may cause problems in some locales.
|
|
||||||
This option has no effect if the
|
|
||||||
.Ic utf8-hack
|
|
||||||
option is enabled.
|
|
||||||
.It Ic gmacs
|
.It Ic gmacs
|
||||||
Enable gmacs-like command-line editing (interactive shells only).
|
Enable gmacs-like command-line editing (interactive shells only).
|
||||||
Currently identical to emacs editing except that transpose-chars (^T) acts
|
Currently identical to emacs editing except that transpose-chars (^T) acts
|
||||||
|
@ -3376,10 +3368,6 @@ mode when turned on, which can be turned back on manually.
|
||||||
The shell is a restricted shell.
|
The shell is a restricted shell.
|
||||||
This option can only be used when the shell is invoked.
|
This option can only be used when the shell is invoked.
|
||||||
See above for a description of what this means.
|
See above for a description of what this means.
|
||||||
.It Ic sh
|
|
||||||
This flag only exists for
|
|
||||||
.Nm pdksh
|
|
||||||
compatibility and cannot be turned on.
|
|
||||||
.It Ic vi
|
.It Ic vi
|
||||||
Enable
|
Enable
|
||||||
.Xr vi 1 Ns -like
|
.Xr vi 1 Ns -like
|
||||||
|
@ -3387,11 +3375,6 @@ command-line editing (interactive shells only).
|
||||||
.It Ic vi-esccomplete
|
.It Ic vi-esccomplete
|
||||||
In vi command-line editing, do command and file name completion when escape
|
In vi command-line editing, do command and file name completion when escape
|
||||||
(^[) is entered in command mode.
|
(^[) is entered in command mode.
|
||||||
.It Ic vi-show8
|
|
||||||
Prefix characters with the eighth bit set with
|
|
||||||
.Sq M- .
|
|
||||||
If this option is not set, characters in the range 128\-160 are printed as is,
|
|
||||||
which may cause problems in some locales.
|
|
||||||
.It Ic vi-tabcomplete
|
.It Ic vi-tabcomplete
|
||||||
In vi command-line editing, do command and file name completion when tab (^I)
|
In vi command-line editing, do command and file name completion when tab (^I)
|
||||||
is entered in insert mode.
|
is entered in insert mode.
|
||||||
|
|
5
sh.h
5
sh.h
|
@ -8,7 +8,7 @@
|
||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||||
|
|
||||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.85 2006/11/19 16:43:43 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.86 2006/11/19 20:43:14 tg Exp $"
|
||||||
#define MKSH_VERSION "R29 2006/11/19"
|
#define MKSH_VERSION "R29 2006/11/19"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
|
@ -266,7 +266,6 @@ enum sh_flag {
|
||||||
FBGNICE, /* bgnice */
|
FBGNICE, /* bgnice */
|
||||||
FCOMMAND, /* -c: (invocation) execute specified command */
|
FCOMMAND, /* -c: (invocation) execute specified command */
|
||||||
FEMACS, /* emacs command editing */
|
FEMACS, /* emacs command editing */
|
||||||
FEMACSUSEMETA, /* use 8th bit as meta */
|
|
||||||
FERREXIT, /* -e: quit on error */
|
FERREXIT, /* -e: quit on error */
|
||||||
FGMACS, /* gmacs command editing */
|
FGMACS, /* gmacs command editing */
|
||||||
FIGNOREEOF, /* eof does not exit */
|
FIGNOREEOF, /* eof does not exit */
|
||||||
|
@ -286,14 +285,12 @@ enum sh_flag {
|
||||||
FPOSIX, /* -o posix (try to be more compatible) */
|
FPOSIX, /* -o posix (try to be more compatible) */
|
||||||
FPRIVILEGED, /* -p: use suid_profile */
|
FPRIVILEGED, /* -p: use suid_profile */
|
||||||
FRESTRICTED, /* -r: restricted shell */
|
FRESTRICTED, /* -r: restricted shell */
|
||||||
FSH, /* -o sh (dummy, for pdksh compatibility) */
|
|
||||||
FSTDIN, /* -s: (invocation) parse stdin */
|
FSTDIN, /* -s: (invocation) parse stdin */
|
||||||
FTRACKALL, /* -h: create tracked aliases for all commands */
|
FTRACKALL, /* -h: create tracked aliases for all commands */
|
||||||
FUTFHACK, /* -U: utf-8 hack for command line editing */
|
FUTFHACK, /* -U: utf-8 hack for command line editing */
|
||||||
FVERBOSE, /* -v: echo input */
|
FVERBOSE, /* -v: echo input */
|
||||||
FVI, /* vi command editing */
|
FVI, /* vi command editing */
|
||||||
FVIRAW, /* always read in raw mode (ignored) */
|
FVIRAW, /* always read in raw mode (ignored) */
|
||||||
FVISHOW8, /* display chars with 8th bit set as is (versus M-) */
|
|
||||||
FVITABCOMPLETE, /* enable tab as file name completion char */
|
FVITABCOMPLETE, /* enable tab as file name completion char */
|
||||||
FVIESCCOMPLETE, /* enable ESC as file name completion in command mode */
|
FVIESCCOMPLETE, /* enable ESC as file name completion in command mode */
|
||||||
FXTRACE, /* -x: execution trace */
|
FXTRACE, /* -x: execution trace */
|
||||||
|
|
Loading…
Reference in New Issue