1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-04-25 11:25:14 +02:00

48073: Add fc -s as POSIX way of rerunning command without starting editor

This commit is contained in:
Martijn Dekker 2021-02-16 18:34:41 +00:00 committed by Peter Stephenson
parent 326d9c203b
commit 9c0533931c
3 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2021-02-17 Peter Stephenson <p.stephenson@samsung.com>
* 48073: Martijn Dekker: Doc/Zsh/builtins.yo, Src/builtin.c: fc
-s is POSIX version of fc -e -.
2021-02-16 Peter Stephenson <p.stephenson@samsung.com>
* 47876: Justtine Tunney: Src/exec.c: Add more cases where

View File

@ -736,7 +736,7 @@ findex(fc)
cindex(history, editing)
cindex(editing history)
redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi( )))
xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-LI) ] [ tt(-m) var(match) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-s) ] [ tt(-LI) ] [ tt(-m) var(match) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
xitem(tt(fc -l )[ tt(-LI) ] [ tt(-nrdfEiD) ] [ tt(-t) var(timefmt) ] [ tt(-m) var(match) ])
xitem(SPACES()[ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
xitem(tt(fc -p )[ tt(-a) ] [ var(filename) [ var(histsize) [ var(savehistsize) ] ] ])
@ -783,6 +783,7 @@ the parameter tt(EDITOR) is used; if that is not set a builtin default,
usually `tt(vi)' is used. If var(ename) is `tt(-)', no editor is invoked.
When editing is complete, the edited command is executed.
The flag `tt(-s)' is equivalent to `tt(-e -)'.
The flag tt(-r) reverses the order of the events and the
flag tt(-n) suppresses event numbers when listing.

View File

@ -71,7 +71,7 @@ static struct builtin builtins[] =
* But that's actually not useful, so it's more consistent to
* cause an error.
*/
BUILTIN("fc", 0, bin_fc, 0, -1, BIN_FC, "aAdDe:EfiIlLmnpPrRt:W", NULL),
BUILTIN("fc", 0, bin_fc, 0, -1, BIN_FC, "aAdDe:EfiIlLmnpPrRst:W", NULL),
BUILTIN("fg", 0, bin_fg, 0, -1, BIN_FG, NULL, NULL),
BUILTIN("float", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "E:%F:%HL:%R:%Z:%ghlp:%rtux", "E"),
BUILTIN("functions", BINF_PLUSOPTS, bin_functions, 0, -1, 0, "ckmMstTuUWx:z", NULL),
@ -1643,7 +1643,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
if (!fclist(out, ops, first, last, asgf, pprog, 1)) {
char *editor;
if (func == BIN_R)
if (func == BIN_R || OPT_ISSET(ops, 's'))
editor = "-";
else if (OPT_HASARG(ops, 'e'))
editor = OPT_ARG(ops, 'e');