Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: HIST_IGNORE_DUPS ignores lines which differ by a different number of spaces



On Thu, 18 Apr 2013 21:04:11 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> My best guess is it's got something to do with freehistdata(), which
> appears to be the only way the hash table can affect the history ring.

Revised theory: when the new node gets added, it retrieves the old node
(addhistnode() in hashtable.c).  Because of the name mangling it
retrieves the previous line if that's the same up to (any, even
significant) white space, even if HIST_IGNORE_DUPS isn't set.  (This is
what's bamboozling me the most.)  Because there's an old node (at all,
even if it doesn't match completely) it gets marked as HIST_DUP by
addhistnode().  Then logic elsewhere removes it.

It's just occurred to me that while it might get *marked* with HIST_DUP
undconditionally, the logic to remove duplicates only kicks in if
HIST_IGNORE_DUPS is set.  That might explain why NO_HIST_IGNORE_DUPS
works at all.

Is this jogging any memories?  The code is (by strong zsh tradition)
undocumented.

pws



Messages sorted by: Reverse Date, Date, Thread, Author