From 35c87f0b3bc0ce5a22a6bf3b0f2b2a14a3993cea Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 6 Sep 2021 13:33:40 -0700 Subject: unposted (cf. 49202 and 49217): insertlastword ignores blank/missing history entries when repeating --- Src/Zle/zle_hist.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Src/Zle/zle_hist.c') diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c index 581ca4979..cfaa70dae 100644 --- a/Src/Zle/zle_hist.c +++ b/Src/Zle/zle_hist.c @@ -683,8 +683,13 @@ insertlastword(char **args) } nwords = countlinknodes(l); } else { - /* Some stored line. */ - if (!(he = quietgethist(evhist)) || !he->nwords) { + /* Some stored line. By default, search for a non-empty line. */ + while ((he = quietgethist(evhist)) && histstep == -1 && !*args) { + if (he->nwords) + break; + evhist = addhistnum(evhist, histstep, HIST_FOREIGN); + } + if (!he || !he->nwords) { unmetafy_line(); return 1; } -- cgit 1.4.1