* A couple history bugfixes
@ 2001-05-19 2:04 Wayne Davison
0 siblings, 0 replies; only message in thread
From: Wayne Davison @ 2001-05-19 2:04 UTC (permalink / raw)
To: Zsh Workers
[-- 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));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-05-19 8:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-19 2:04 A couple history bugfixes Wayne Davison
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).