about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Commands/_history_complete_word2
-rw-r--r--Src/Zle/zle_tricky.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Completion/Commands/_history_complete_word b/Completion/Commands/_history_complete_word
index 99be0017e..f459046d2 100644
--- a/Completion/Commands/_history_complete_word
+++ b/Completion/Commands/_history_complete_word
@@ -23,8 +23,8 @@ else
     _description -V expl 'history word'
   fi
   compgen "$expl[@]" -Q -H 0 ''
-  compstate[insert]=1
   if [[ -n "$compconfig[history_stop]" ]]; then
+    compstate[insert]=1
     _hist_menu_length="$compstate[nmatches]"
     _hist_menu_end=''
   fi
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e3b503265..d77301517 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -6932,7 +6932,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	/* Now search the history. */
 	while (n-- && he) {
 	    int iwords;
-	    for (iwords = 0; iwords < he->nwords; iwords++) {
+	    for (iwords = he->nwords - 1; iwords >= 0; iwords--) {
 		h = he->text + he->words[iwords*2];
 		e = he->text + he->words[iwords*2+1];
 		hpatsav = *e;