diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/prompt.c | 53 |
2 files changed, 50 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog index d5a506fec..f34d38134 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2002-01-31 Oliver Kiddle <opk@zsh.org> + * Derek Peschel: 16494: Src/prompt.c: extract outermost words with + negative arguments to %_ prompt expansion and add %^ for a reverse + ordered status list + * Derek Peschel: 16493: Src/params.c: correct typos * Derek Peschel: 16492: Src/params.c, Src/input.c, Doc/Zsh/params.yo: diff --git a/Src/prompt.c b/Src/prompt.c index 9b6edfcc6..06dd2e5a9 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -574,15 +574,54 @@ putpromptchar(int doprint, int endchar) case 'E': tsetcap(TCCLEAREOL, 1); break; + case '^': + if (cmdsp) { + if (arg >= 0) { + if (arg > cmdsp || arg == 0) + arg = cmdsp; + for (t0 = cmdsp - 1; arg--; t0--) { + stradd(cmdnames[cmdstack[t0]]); + if (arg) { + addbufspc(1); + *bp++=' '; + } + } + } else { + arg = -arg; + if (arg > cmdsp) + arg = cmdsp; + for (t0 = arg - 1; arg--; t0--) { + stradd(cmdnames[cmdstack[t0]]); + if (arg) { + addbufspc(1); + *bp++=' '; + } + } + } + } + break; case '_': if (cmdsp) { - if (arg > cmdsp || arg <= 0) - arg = cmdsp; - for (t0 = cmdsp - arg; arg--; t0++) { - stradd(cmdnames[cmdstack[t0]]); - if (arg) { - addbufspc(1); - *bp++=' '; + if (arg >= 0) { + if (arg > cmdsp || arg == 0) + arg = cmdsp; + for (t0 = cmdsp - arg; arg--; t0++) { + stradd(cmdnames[cmdstack[t0]]); + if (arg) { + addbufspc(1); + *bp++=' '; + } + } + } else { + arg = -arg; + if (arg > cmdsp) + arg = cmdsp; + for (t0 = 0; arg--; t0++) { + stradd(cmdnames[cmdstack[t0]]); + if (arg) { + addbufspc(1); + *bp++=' '; + } } } } |