1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Document history expansion and fix a few loose ends

src/cmd/ksh93/sh.1:
- Add a new section on history expansion mostly adapted from the
  "History substitution" section from the tcsh(1) man page. This
  has the standard BSD license which is already in the COPYRIGHT
  file. Inapplicable stuff was removed, some new stuff added.

src/cmd/ksh93/edit/hexpand.c,
src/cmd/ksh93/sh/io.c:
- Set '#' as the default history comment character as on bash;
  no longer disable it by default.
- Add the 'a' modifier as a synonym for 'g', as on bash.
- Remove pointless static keyword from np variable; since the
  value from previous calls is never used it can just be local.
- Use NV_NOADD flag with nv_open() to avoid pointlessly creating
  the node if the variable doesn't exist yet.
- Fix a bug in history expansion where the 'p' modifier had no
  effect if the 'histverify' option is on.
  Reproducer:
    $ set -H -o histv
    $ true a b c
    $ !!:p
    $ true a b c▁  <= instead of printed, the line is re-edited
  Expected:
    $ set -H -o histv
    $ true a b c
    $ !!:p
    true a b c
    $ ▁
  This is fixed by making 'p' remove the HIST_EVENT bit from the
  returned flag bits in hist_expand(), leaving only the HIST_PRINT
  flag, then adding special handling for this case to slowread()
  in io.c (print the line, then instead of executing it, continue
  and read the next line).
This commit is contained in:
Martijn Dekker 2022-01-25 03:16:53 +00:00
parent cda8fc916f
commit 41ee12a527
4 changed files with 279 additions and 6 deletions

10
NEWS
View file

@ -8,6 +8,16 @@ Any uppercase BUG_* names are modernish shell bug IDs.
- Fixed a crashing bug in history expansion that could occur when using the "&"
modifier to repeat a substitution while there was no previous substitution.
- History expansion is now documented in the ksh(1) manual page.
- In history expansion, the history comment character '#' is now enabled by
default, as it is on bash.
- In history expansion, the 'a' modifier is now a synonym for 'g', as on bash.
- Fixed a bug in history expansion where the 'p' modifier had no effect if
the 'histverify' option is on.
2022-01-20:
- Disallow out-of-range event numbers in history expansion (-H/-o histexpand).