diff options
Diffstat (limited to 'Src/Zle/zle_hist.c')
-rw-r--r-- | Src/Zle/zle_hist.c | 9 |
1 files changed, 7 insertions, 2 deletions
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; } |