aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@ipost.com>2021-09-06 13:33:40 -0700
committerBart Schaefer <schaefer@ipost.com>2021-09-06 13:33:40 -0700
commit35c87f0b3bc0ce5a22a6bf3b0f2b2a14a3993cea (patch)
tree3df14b0b25121d0d006176221380f3a2e2f2290e
parent7000b04e766376890e597ffe7d6cf26c444fce53 (diff)
downloadzsh-35c87f0b3bc0ce5a22a6bf3b0f2b2a14a3993cea.tar.gz
zsh-35c87f0b3bc0ce5a22a6bf3b0f2b2a14a3993cea.tar.xz
zsh-35c87f0b3bc0ce5a22a6bf3b0f2b2a14a3993cea.zip
unposted (cf. 49202 and 49217): insertlastword ignores blank/missing history entries when repeating
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_hist.c9
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 31beb268e..fdaea5678 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2021-09-06 Bart Schaefer <schaefer@zsh.org>
+ * unposted (cf. 49202 and 49217): Src/Zle/zle_hist.c: insertlastword
+ ignores blank/missing history entries when repeating
+
* 49196: Src/Modules/db_gdbm.c: gdbm keys not present in the
database appear unset in tied hashes
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;
}