1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +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:
Martijn Dekker 2022-01-12 14:55:02 +00:00
parent 2d4a787564
commit a5700d3937
8 changed files with 47 additions and 11 deletions

View file

@ -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: