From c42ae31a190834df88af3339465e4ee2429b7592 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 20 Jul 2010 18:59:15 +0000 Subject: 28081: cdr tweaks --- Functions/Chpwd/chpwd_recent_filehandler | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'Functions/Chpwd') 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 -- cgit 1.4.1