Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: r problem
- X-seq: zsh-workers 15806
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: r problem
- Date: Thu, 13 Sep 2001 11:37:58 -0700 (PDT)
- Cc: <zsh-workers@xxxxxxxxxx>
- In-reply-to: <1010912160325.ZM25844@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
On Wed, 12 Sep 2001, Bart Schaefer wrote:
> This looks like a bug in gethistent().
It was actually a problem with addhistnum() in how it was choosing to
return boundary values. I changed this, and then checked everything
that was calling addhistnum() to ensure that they should be able to
handle the new behavior.
> Another bug (?) is that the "r" command itself gets entered in the history
> even when hist_no_store is set.
Yes, I hadn't remembered to add that to the hist_no_store check.
> On the other hand, "history" and "fc" get left out of the history with
> hist_no_store even when they've been redefined as functions that have
> nothing to do with the history.
They are no longer omitted if you alias them, so that is a better way
to go at the moment. With the advent of my HIST_TMPSTORE flag, I could
change the builtins to set this value and get rid of the command-line
scan. I'll look into this later to see if I think this is a good idea.
..wayne..
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index: Src/builtin.c
--- Src/builtin.c 2001/08/13 17:43:04 1.51
+++ Src/builtin.c 2001/09/13 18:12:12
@@ -1299,8 +1299,8 @@
if (last == -1)
last = ops['l']? addhistnum(curline.histnum,-1,0) : first;
if (first < firsthist())
- first = firsthist();
- if (last == -1)
+ first = firsthist() - (first == last);
+ if (last > curhist)
last = (minflag) ? curhist : first;
else if (last < first)
last = first;
@@ -1368,7 +1368,7 @@
if ((cmd = atoi(s))) {
if (cmd < 0)
cmd = addhistnum(curline.histnum,cmd,HIST_FOREIGN);
- if (cmd >= curline.histnum) {
+ if (cmd < firsthist()) {
zwarnnam("fc", "bad history number: %d", 0, cmd);
return -1;
}
Index: Src/hist.c
--- Src/hist.c 2001/08/07 19:53:19 1.31
+++ Src/hist.c 2001/09/13 18:12:13
@@ -845,7 +845,7 @@
if (n)
he = movehistent(he, n, xflags);
if (!he)
- return dir < 0? firsthist() : curhist;
+ return dir < 0? firsthist() - 1 : curhist + 1;
return he->histnum;
}
@@ -993,6 +993,8 @@
b += 8;
if (*b == 'h' && strncmp(b, "history", 7) == 0
&& (!b[7] || b[7] == ' '))
+ return 1;
+ if (*b == 'r' && (!b[1] || b[1] == ' '))
return 1;
if (*b == 'f' && b[1] == 'c' && b[2] == ' ' && b[3] == '-') {
b += 3;
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Messages sorted by:
Reverse Date,
Date,
Thread,
Author