From: Wayne Davison <wayned@users.sourceforge.net>
To: Zsh Workers <zsh-workers@sunsite.dk>
Subject: A couple history bugfixes
Date: Fri, 18 May 2001 19:04:38 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.33L2.0105181854380.4777-200000@phong.blorf.net> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 586 bytes --]
I noticed that the code that merges identical, adjacent entries could
merge a HIST_TMPSTORE entry with the previous line if it only differed
by the leading spacing, so I fixed this.
Also, if the delayed-drop line is a dup of an older entry (ignoring
leading spaces, as the duplicate-detection code does) and you have
hist_find_no_dups on, history searching would not find the delayed-
drop line. My fix is to never call addhistnode() or removehashnode()
on a HIST_TMPSTORE item, so the line is never marked as a dup (and is
also never entered into the history hash table).
..wayne..
[-- Attachment #2: Bugfixes --]
[-- Type: TEXT/PLAIN, Size: 1586 bytes --]
Index: Src/hashtable.c
@@ -1480,7 +1480,7 @@
HashNode oldnode = addhashnode2(ht, nam, nodeptr);
Histent he = (Histent)nodeptr;
if (oldnode && oldnode != (HashNode)nodeptr) {
- if (he->flags & (HIST_MAKEUNIQUE | HIST_TMPSTORE)
+ if (he->flags & HIST_MAKEUNIQUE
|| (he->flags & HIST_FOREIGN && (Histent)oldnode == he->up)) {
(void) addhashnode2(ht, oldnode->nam, oldnode); /* restore hash */
he->flags |= HIST_DUP;
@@ -1511,7 +1511,7 @@
if (!he)
return;
- if (!(he->flags & HIST_DUP))
+ if (!(he->flags & (HIST_DUP | HIST_TMPSTORE)))
removehashnode(histtab, he->text);
zsfree(he->text);
Index: Src/hist.c
@@ -1096,8 +1096,8 @@
histreduceblanks();
}
newflags = save > 0? 0 : HIST_OLD | HIST_TMPSTORE;
- if ((isset(HISTIGNOREDUPS) || isset(HISTIGNOREALLDUPS)) && hist_ring
- && histstrcmp(chline, hist_ring->text) == 0) {
+ if ((isset(HISTIGNOREDUPS) || isset(HISTIGNOREALLDUPS)) && save > 0
+ && hist_ring && histstrcmp(chline, hist_ring->text) == 0) {
/* This history entry compares the same as the previous.
* In case minor changes were made, we overwrite the
* previous one with the current one. This also gets the
@@ -1119,7 +1119,8 @@
he->words = (short *)zalloc(chwordpos * sizeof(short));
memcpy(he->words, chwords, chwordpos * sizeof(short));
}
- addhistnode(histtab, he->text, he);
+ if (!(newflags & HIST_TMPSTORE))
+ addhistnode(histtab, he->text, he);
}
zfree(chline, hlinesz);
zfree(chwords, chwordlen*sizeof(short));
reply other threads:[~2001-05-19 8:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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.0105181854380.4777-200000@phong.blorf.net \
--to=wayned@users.sourceforge.net \
--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).