about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-17 09:20:50 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-17 09:20:50 +0000
commit1f9bd5bcebff8f47fcc2397cd665d62765608968 (patch)
tree01a41d699d1e6f2d8f8eca05fee84d30acae09a5
parent97a5dfa4f3ae2a6929b73ed62f14d6ecd2ea7735 (diff)
downloadzsh-1f9bd5bcebff8f47fcc2397cd665d62765608968.tar.gz
zsh-1f9bd5bcebff8f47fcc2397cd665d62765608968.tar.xz
zsh-1f9bd5bcebff8f47fcc2397cd665d62765608968.zip
zsh-workers/7900
-rw-r--r--Completion/Commands/_history_complete_word29
-rw-r--r--Doc/Zsh/compsys.yo7
2 files changed, 32 insertions, 4 deletions
diff --git a/Completion/Commands/_history_complete_word b/Completion/Commands/_history_complete_word
index 76cad470f..99be0017e 100644
--- a/Completion/Commands/_history_complete_word
+++ b/Completion/Commands/_history_complete_word
@@ -2,9 +2,30 @@
 
 local expl
 
-if [[ -n "$compconfig[history_sort]" ]]; then
-  _description expl 'history word'
+if [[ -n "$compstate[old_list]" && -n "$compconfig[history_stop]" ]]; then
+  if [[ -z "$_hist_menu_end" &&
+        compstate[old_insert] -lt _hist_menu_length ]]; then
+    compstate[old_list]=keep
+    compstate[insert]=$((compstate[old_insert]+1))
+  else
+    _hist_menu_end=yes
+    if [[ "$compconfig[history_stop]" = verbose ]]; then
+      _message 'end of history reached'
+    else
+      compstate[old_list]=keep
+      compstate[insert]=_hist_menu_length
+    fi
+  fi
 else
-  _description -V expl 'history word'
+  if [[ -n "$compconfig[history_sort]" ]]; then
+    _description expl 'history word'
+  else
+    _description -V expl 'history word'
+  fi
+  compgen "$expl[@]" -Q -H 0 ''
+  compstate[insert]=1
+  if [[ -n "$compconfig[history_stop]" ]]; then
+    _hist_menu_length="$compstate[nmatches]"
+    _hist_menu_end=''
+  fi
 fi
-compgen "$expl[@]" -Q -H 0 ''
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 9b86781f4..970b958a6 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1467,6 +1467,13 @@ generate words from the history as possible matches sort these words
 alphabetically instead of keeping them in the order in which they
 appear in the history (from youngest to oldest).
 )
+item(tt(history_stop))(
+If this is set to a non-empty string, the tt(_history_complete_word)
+bindable command will always insert matches as if menu-completion were 
+started and it will stop when the last match is inserted. If this key
+is set to tt(verbose) a message will be displayed when the last match
+is reached.
+)
 item(tt(cvs_disable_stat))(
 This is used by the completion function for the tt(cvs) command. If it 
 is set to a non-empty value, this function will not try to use the