1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 21:44:11 +01:00

Fixed an obscure local-history bug that could make the "history"

command output something that was slightly wrong. (14304)
This commit is contained in:
Wayne Davison 2001-05-10 23:06:54 +00:00
parent 69f010c8c9
commit 6066bd7eeb

@ -1067,8 +1067,6 @@ hend(Eprog prog)
Histent he; Histent he;
int keepflags; int keepflags;
for (he = hist_ring; he && he->flags & hist_skip_flags;
he = up_histent(he)) ;
#ifdef DEBUG #ifdef DEBUG
/* debugging only */ /* debugging only */
if (chwordpos%2) { if (chwordpos%2) {
@ -1083,13 +1081,14 @@ hend(Eprog prog)
if (isset(HISTREDUCEBLANKS)) if (isset(HISTREDUCEBLANKS))
histreduceblanks(); histreduceblanks();
} }
if ((isset(HISTIGNOREDUPS) || isset(HISTIGNOREALLDUPS)) && he if ((isset(HISTIGNOREDUPS) || isset(HISTIGNOREALLDUPS)) && hist_ring
&& histstrcmp(chline, he->text) == 0) { && histstrcmp(chline, hist_ring->text) == 0) {
/* This history entry compares the same as the previous. /* This history entry compares the same as the previous.
* In case minor changes were made, we overwrite the * In case minor changes were made, we overwrite the
* previous one with the current one. This also gets the * previous one with the current one. This also gets the
* timestamp right. Perhaps, preserve the HIST_OLD flag. * timestamp right. Perhaps, preserve the HIST_OLD flag.
*/ */
he = hist_ring;
keepflags = he->flags & HIST_OLD; /* Avoid re-saving */ keepflags = he->flags & HIST_OLD; /* Avoid re-saving */
freehistdata(he, 0); freehistdata(he, 0);
curline.histnum = curhist; curline.histnum = curhist;