diff --git a/ANNOUNCE b/ANNOUNCE index 1eda087fe..9b7830e2d 100644 --- a/ANNOUNCE +++ b/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: diff --git a/NEWS b/NEWS index fa127e7e9..9f305ca35 100644 --- a/NEWS +++ b/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 diff --git a/src/cmd/ksh93/README b/src/cmd/ksh93/README index 3eed19540..489816f0e 100644 --- a/src/cmd/ksh93/README +++ b/src/cmd/ksh93/README @@ -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 diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 3dd0122ec..dcef8229c 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -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.]" diff --git a/src/cmd/ksh93/data/options.c b/src/cmd/ksh93/data/options.c index fc6bfd5ba..fb2576341 100644 --- a/src/cmd/ksh93/data/options.c +++ b/src/cmd/ksh93/data/options.c @@ -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, diff --git a/src/cmd/ksh93/include/defs.h b/src/cmd/ksh93/include/defs.h index 37db83fe5..96c26af56 100644 --- a/src/cmd/ksh93/include/defs.h +++ b/src/cmd/ksh93/include/defs.h @@ -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 diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index f507d5dee..73a26de77 100644 --- a/src/cmd/ksh93/include/version.h +++ b/src/cmd/ksh93/include/version.h @@ -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. */ diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 9e9e4fde8..a2d4c657e 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -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