Index: Src/Zle/zle_hist.c --- Src/Zle/zle_hist.c 2000/02/23 15:18:49 1.1.1.14 +++ Src/Zle/zle_hist.c 2001/05/26 06:36:02 @@ -252,7 +252,7 @@ if (!(he = movehistent(quietgethist(histline), 1, HIST_FOREIGN))) return 1; - zpushnode(bufstack, ztrdup(ZLETEXT(he))); + zpushnode(bufstack, ztrdup(he->text)); done = 1; stackhist = he->histnum; return 0; @@ -891,23 +891,29 @@ kungetct = savekeys; } +static Histent +infernexthist(Histent he, char **args) +{ + for (he = movehistent(he, -2, HIST_FOREIGN); + he; he = movehistent(he, -1, HIST_FOREIGN)) { + if (!metadiffer(he->text, (char *) line, ll)) + return movehistent(he, 1, HIST_FOREIGN); + } + return NULL; +} + /**/ int acceptandinfernexthistory(char **args) { Histent he; + if (!(he = infernexthist(hist_ring, args))) + return 1; + zpushnode(bufstack, ztrdup(he->text)); done = 1; - for (he = movehistent(quietgethist(histline), -2, HIST_FOREIGN); - he; he = movehistent(he, -1, HIST_FOREIGN)) { - if (!metadiffer(ZLETEXT(he), (char *) line, ll)) { - he = movehistent(he, 1, HIST_FOREIGN); - zpushnode(bufstack, ztrdup(ZLETEXT(he))); - stackhist = he->histnum; - return 0; - } - } - return 1; + stackhist = he->histnum; + return 0; } /**/ @@ -916,15 +922,10 @@ { Histent he; - for (he = movehistent(quietgethist(histline), -2, HIST_FOREIGN); - he; he = movehistent(he, -1, HIST_FOREIGN)) { - if (!metadiffer(ZLETEXT(he), (char *) line, ll)) { - he = movehistent(he, 1, HIST_FOREIGN); - zle_setline(he); - return 0; - } - } - return 1; + if (!(he = infernexthist(quietgethist(histline), args))) + return 1; + zle_setline(he); + return 0; } /**/