1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-20 05:53:52 +01:00

Fixed a just-introduced bug in prepnexthistent() when curline is in

the list.
This commit is contained in:
Wayne Davison 2002-02-18 19:25:25 +00:00
parent becf65dd7f
commit 3b3bafac80

@ -947,6 +947,7 @@ putoldhistentryontop(short keep_going)
Histent Histent
prepnexthistent(void) prepnexthistent(void)
{ {
Histent he;
int curline_in_ring = hist_ring == &curline; int curline_in_ring = hist_ring == &curline;
if (curline_in_ring) if (curline_in_ring)
@ -957,7 +958,7 @@ prepnexthistent(void)
} }
if (histlinect < histsiz) { if (histlinect < histsiz) {
Histent he = (Histent)zcalloc(sizeof *he); he = (Histent)zcalloc(sizeof *he);
if (!hist_ring) if (!hist_ring)
hist_ring = he->up = he->down = he; hist_ring = he->up = he->down = he;
else { else {
@ -970,12 +971,12 @@ prepnexthistent(void)
} }
else { else {
putoldhistentryontop(0); putoldhistentryontop(0);
freehistdata(hist_ring, 0); freehistdata(he = hist_ring, 0);
} }
hist_ring->histnum = ++curhist; he->histnum = ++curhist;
if (curline_in_ring) if (curline_in_ring)
linkcurline(); linkcurline();
return hist_ring; return he;
} }
/* A helper function for hend() */ /* A helper function for hend() */