summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2002-02-22 21:59:43 +0000
committerWayne Davison <wayned@users.sourceforge.net>2002-02-22 21:59:43 +0000
commit8fc5ffa60ace49934ef3f2ab32e4d9d28a02639e (patch)
tree7d23b529461457703301fe0fee74d1dffd053af5
parentIn putoldhistentryontop(), ensure that we can't return with "next" set to (diff)
downloadzsh-8fc5ffa60ace49934ef3f2ab32e4d9d28a02639e.tar
zsh-8fc5ffa60ace49934ef3f2ab32e4d9d28a02639e.tar.gz
zsh-8fc5ffa60ace49934ef3f2ab32e4d9d28a02639e.tar.bz2
zsh-8fc5ffa60ace49934ef3f2ab32e4d9d28a02639e.tar.lz
zsh-8fc5ffa60ace49934ef3f2ab32e4d9d28a02639e.tar.xz
zsh-8fc5ffa60ace49934ef3f2ab32e4d9d28a02639e.tar.zst
zsh-8fc5ffa60ace49934ef3f2ab32e4d9d28a02639e.zip
Improved the output of the "history" command with a 1-line history buffer,
and also improved the error handling of explicitly-specified first/last values.
-rw-r--r--Src/builtin.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 2165b1864..564edfb46 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1308,18 +1308,23 @@ bin_fc(char *nam, char **argv, char *ops, int func)
return 1;
}
/* default values of first and last, and range checking */
+ if (last == -1) {
+ if (ops['l'] && first < curhist) {
+ last = addhistnum(curline.histnum,-1,0);
+ if (last < firsthist())
+ last = firsthist();
+ }
+ else
+ last = first;
+ }
if (first == -1) {
first = ops['l']? addhistnum(curline.histnum,-16,0)
- : addhistnum(curline.histnum,-1,0);
+ : addhistnum(curline.histnum,-1,0);
+ if (first < 1)
+ first = 1;
+ if (last < first)
+ last = first;
}
- if (last == -1)
- last = ops['l']? addhistnum(curline.histnum,-1,0) : first;
- if (first < firsthist())
- first = firsthist() - (last < firsthist());
- if (last > curhist)
- last = curhist;
- else if (last < first)
- last = first;
if (ops['l']) {
/* list the required part of the history */
retval = fclist(stdout, !ops['n'], ops['r'], ops['D'],