mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 03:32:24 +00:00
Expose --histreedit and --histverify options (re: 921bbcae
)
This adds two long-form shell options that modify history expansion (-H/--histexpand). If --histreedit is on and a history expansion fails, the command line is reloaded into the next prompt's edit buffer, allowing corrections. If --histverify is on, the results of a history expansion are not immediately executed but instead loaded into the next prompt's edit buffer, allowing further changes. SH_HISTREEDIT and SH_HISTVERIFY were already handled all along in slowread() in io.c and via 'reedit' arguments to functions called there, but could not be turned on as they were only ever exposed as shopt options in the removed bash compatibility mode (in theory only, as it failed to compile). I had overlooked them until now. So, since the code is there, let's expose these options through the normal long options interface. They're working fine, and activating them actually makes history expansion tolerable to use. src/cmd/ksh93/data/options.c: - Make these options available as "histreedit" and "histverify". src/cmd/ksh93/data/builtins.c, src/cmd/ksh93/sh.1: - Document the "new" options. src/cmd/ksh93/include/defs.h: - Remove unused SH_HISTAPPEND and SH_HISTORY2 macros which were part of the removed bash compatibility code. Note that ksh does not need a histappend option as it never overwrites the history file (in the bash mode, this shopt option was a no-op).
This commit is contained in:
parent
2d4a787564
commit
a5700d3937
8 changed files with 47 additions and 11 deletions
11
ANNOUNCE
11
ANNOUNCE
|
@ -1,4 +1,4 @@
|
|||
Announcing: KornShell 93u+m 1.0.0-beta.2
|
||||
Announcing: KornShell 93u+m 1.0.0-beta.(unreleased)
|
||||
https://github.com/ksh93/ksh
|
||||
|
||||
In May 2020, when every KornShell (ksh93) development project was
|
||||
|
@ -56,6 +56,15 @@ New features in built-in commands:
|
|||
Note that to use these options the operating system must support the
|
||||
corresponding resource limit.
|
||||
|
||||
New features in shell options:
|
||||
|
||||
- The new --histreedit and --histverify options modify history expansion
|
||||
(--histexpand). If --histreedit is on and a history expansion fails, the
|
||||
command line is reloaded into the next prompt's edit buffer, allowing
|
||||
corrections. If --histverify is on, the results of a history expansion are
|
||||
not immediately executed but instead loaded into the next prompt's edit
|
||||
buffer, allowing further changes.
|
||||
|
||||
### MAIN CHANGES between 1.0.0-beta.1 and 1.0.0-beta.2 ###
|
||||
|
||||
New features in built-in commands:
|
||||
|
|
9
NEWS
9
NEWS
|
@ -1,8 +1,13 @@
|
|||
This documents significant changes in the 93u+m branch of AT&T ksh93.
|
||||
For full details, see the git log at: https://github.com/ksh93/ksh
|
||||
This documents significant changes in the 1.0 branch of ksh 93u+m.
|
||||
For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0
|
||||
|
||||
Any uppercase BUG_* names are modernish shell bug IDs.
|
||||
|
||||
2022-01-12:
|
||||
|
||||
- Added bash-inspired --histreedit and --histverify options that modify history
|
||||
expansion (--histexpand), allowing editing on failure or before execution.
|
||||
|
||||
2022-01-04:
|
||||
|
||||
- Fixed an issue in vi mode that caused tab completion to fail if the
|
||||
|
|
|
@ -88,6 +88,8 @@ The options have the following defaults and meanings:
|
|||
systems that can support case-insensitive file systems.
|
||||
|
||||
HISTEXPAND on Enable !-style history expansion similar to csh(1).
|
||||
This is turned on by the -H/--histexpand shell option and
|
||||
can be modified using --histreedit and --histverify.
|
||||
|
||||
KIA off Allow generation of shell cross-reference database with -R.
|
||||
As of 2021-05-10, no tool that can parse this database is
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1982-2012 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -228,6 +228,13 @@ const char sh_set[] =
|
|||
#endif
|
||||
#if SHOPT_HISTEXPAND
|
||||
"[+histexpand?Equivalent to \b-H\b.]"
|
||||
"[+histreedit?If a history expansion (see \bhistexpand\b) "
|
||||
"fails, the command line is reloaded into the next "
|
||||
"prompt's edit buffer, allowing corrections.]"
|
||||
"[+histverify?The results of a history expansion (see "
|
||||
"\bhistexpand\b) are not immediately executed. "
|
||||
"Instead, the expanded line is loaded into the next "
|
||||
"prompt's edit buffer, allowing further changes.]"
|
||||
#endif
|
||||
"[+ignoreeof?Prevents an interactive shell from exiting on "
|
||||
"reading an end-of-file.]"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1982-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -52,6 +52,8 @@ const Shtable_t shtab_options[] =
|
|||
#endif
|
||||
#if SHOPT_HISTEXPAND
|
||||
"histexpand", SH_HISTEXPAND,
|
||||
"histreedit", SH_HISTREEDIT,
|
||||
"histverify", SH_HISTVERIFY,
|
||||
#endif
|
||||
"ignoreeof", SH_IGNOREEOF,
|
||||
"interactive", SH_INTERACTIVE|SH_COMMANDLINE,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1982-2012 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -104,9 +104,7 @@ extern char* sh_setenviron(const char*);
|
|||
#define SH_TYPE_RESTRICTED 040
|
||||
|
||||
#if SHOPT_HISTEXPAND
|
||||
# define SH_HISTAPPEND 60
|
||||
# define SH_HISTEXPAND 43
|
||||
# define SH_HISTORY2 44
|
||||
# define SH_HISTREEDIT 61
|
||||
# define SH_HISTVERIFY 62
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1982-2012 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -21,8 +21,8 @@
|
|||
|
||||
#define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */
|
||||
#define SH_RELEASE_SVER "1.0.0-beta.2" /* semantic version number: https://semver.org */
|
||||
#define SH_RELEASE_DATE "2022-01-04" /* must be in this format for $((.sh.version)) */
|
||||
#define SH_RELEASE_CPYR "(c) 2020-2021 Contributors to ksh " SH_RELEASE_FORK
|
||||
#define SH_RELEASE_DATE "2022-01-12" /* must be in this format for $((.sh.version)) */
|
||||
#define SH_RELEASE_CPYR "(c) 2020-2022 Contributors to ksh " SH_RELEASE_FORK
|
||||
|
||||
/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */
|
||||
/* Arithmetic $((.sh.version)) uses the last 10 chars, so the date must be at the end. */
|
||||
|
|
|
@ -7129,6 +7129,19 @@ style in-line editor for command entry.
|
|||
Same as
|
||||
.BR \-H .
|
||||
.TP 8
|
||||
.B histreedit
|
||||
If a history expansion (see
|
||||
.BR histexpand )
|
||||
fails, the command line is reloaded
|
||||
into the next prompt's edit buffer, allowing corrections.
|
||||
.TP 8
|
||||
.B histverify
|
||||
The results of a history expansion (see
|
||||
.BR histexpand )
|
||||
are not immediately executed.
|
||||
Instead, the expanded line is loaded into the next prompt's edit buffer,
|
||||
allowing further changes.
|
||||
.TP 8
|
||||
.B ignoreeof
|
||||
An interactive shell will not exit on end-of-file.
|
||||
The command
|
||||
|
|
Loading…
Reference in a new issue