From: Wayne Davison <wayned@users.sourceforge.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: <zsh-workers@sunsite.dk>
Subject: Re: r problem
Date: Thu, 13 Sep 2001 11:37:58 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.33L2.0109131129400.18383-100000@phong.blorf.net> (raw)
In-Reply-To: <1010912160325.ZM25844@candle.brasslantern.com>
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---
next prev parent reply other threads:[~2001-09-13 18:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-12 11:07 Tanaka Akira
2001-09-12 16:03 ` Bart Schaefer
2001-09-13 18:37 ` Wayne Davison [this message]
2001-09-14 0:52 ` Wayne Davison
2001-09-15 4:49 ` Bart Schaefer
2001-09-15 6:26 ` Wayne Davison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.33L2.0109131129400.18383-100000@phong.blorf.net \
--to=wayned@users.sourceforge.net \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).