about summary refs log tree commit diff
path: root/Functions/Chpwd
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-07-20 18:59:15 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-07-20 18:59:15 +0000
commitc42ae31a190834df88af3339465e4ee2429b7592 (patch)
tree92f9307b5b76cae36cce58d07178db7fe6b7507b /Functions/Chpwd
parentbaee5347e4b099ae2306cd119cba4d5059b8b6f3 (diff)
downloadzsh-c42ae31a190834df88af3339465e4ee2429b7592.tar.gz
zsh-c42ae31a190834df88af3339465e4ee2429b7592.tar.xz
zsh-c42ae31a190834df88af3339465e4ee2429b7592.zip
28081: cdr tweaks
Diffstat (limited to 'Functions/Chpwd')
-rw-r--r--Functions/Chpwd/chpwd_recent_filehandler19
1 files changed, 12 insertions, 7 deletions
diff --git a/Functions/Chpwd/chpwd_recent_filehandler b/Functions/Chpwd/chpwd_recent_filehandler
index b80e7f681..688612be7 100644
--- a/Functions/Chpwd/chpwd_recent_filehandler
+++ b/Functions/Chpwd/chpwd_recent_filehandler
@@ -7,8 +7,8 @@ emulate -L zsh
 setopt extendedglob
 
 integer max
-local file
-local -a files
+local file line
+local -a files dir
 local default=${ZDOTDIR:-$HOME}/.chpwd-recent-dirs
 
 if zstyle -a ':chpwd:' recent-dirs-file files; then
@@ -33,10 +33,15 @@ else
   reply=()
   for file in $files; do
     [[ -r $file ]] || continue
-    reply+=(${(Q)${(f)"$(<$file)"}})
-    if (( max > 0 && ${#reply} >= max )); then
-      reply=(${reply[1,max]})
-      break
-    fi
+    # Strip anything after the directory from the line.
+    # At the moment there isn't anything, but we'll make this
+    # future proof.
+    for line in ${(f)"$(<$file)"}; do
+      dir=(${(z)line})
+      reply+=(${(Q)${dir[1]}})
+      if (( max > 0 && ${#reply} == max )); then
+	break 2
+      fi
+    done
   done
 fi