about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2002-02-08 08:30:42 +0000
committerClint Adams <clint@users.sourceforge.net>2002-02-08 08:30:42 +0000
commit841e51076d8ee00e0b4e49dd94d1f0f86f5d9330 (patch)
tree32f1bb57f5b682cd923208d6a47a5b860d1cc99a
parente8b50bdf0f8871359cd97c503604a9a2ed588e1d (diff)
downloadzsh-841e51076d8ee00e0b4e49dd94d1f0f86f5d9330.tar.gz
zsh-841e51076d8ee00e0b4e49dd94d1f0f86f5d9330.tar.xz
zsh-841e51076d8ee00e0b4e49dd94d1f0f86f5d9330.zip
16590: use a prefix match instead of a "fuzzy-exact" match.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_dict_words17
2 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f5bc65dbf..7bb4c9151 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-02-08  Clint Adams  <clint@zsh.org>
+
+       * Matt Zimmerman: 16590: Completion/Unix/Type/_dict_words:
+       use a prefix match instead of a "fuzzy-exact" match.
+
 2002-02-07  Clint Adams  <clint@zsh.org>
 
         * unposted: Functions/Prompts/.distfiles,
diff --git a/Completion/Unix/Type/_dict_words b/Completion/Unix/Type/_dict_words
new file mode 100644
index 000000000..770319036
--- /dev/null
+++ b/Completion/Unix/Type/_dict_words
@@ -0,0 +1,17 @@
+#autoload
+
+local dict dictresult dictwords j expl
+
+[[ -z $words[CURRENT] ]] && return 1
+
+dictresults=(${${(f)${"$(dict -m -s prefix $words[CURRENT])":gs/    
+  / /}}:#[0-9]*matches found})
+
+for j in ${dictresults}
+do
+  dict=${j%%:*}
+  dictwords=(${(z)j#*:})
+
+  _wanted $dict expl "words from $dict" \
+       compadd -M 'm:{a-zA-Z}={A-Za-z} r:|=*' -a "$@" - dictwords
+done