Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [bug] escaping spaces in _canonical_paths
- X-seq: zsh-workers 40811
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "Philipp G. Haselwarter" <philipp@xxxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: [bug] escaping spaces in _canonical_paths
- Date: Thu, 9 Mar 2017 21:48:20 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=tcrphyY+AbZb/myym68pmcTfpJRhk9WrgZ5WARXiScs=; b=hIs6hFFZbtZLycc/0oj0A/AoTedC2XJgqGWbybhso0BUwRkP10kOX/2xtTOqgbilaU aNNRTzARW3b4IUhMdkr26epGXichjoybvvRoY8pURV+dywQwVnpWhiKUC8WZ41xhkqVY JAdPBOzLJCTA3R2XzzQT/s2rqSmXOOB/qO3TKe9yivvqsmkpsuVEyPSR897Vp0HC9lvz lbmbogX0PACVde6tdfajAdOgF7LNceIRTo92a5Yj2Q+/e+w6Xd9nIulc/PBExPiyVuvV wHMtzB1rmeTyEonoKgwBAhFv8Z/o/VcPHFFDTyPZ3w2Ou2LG4NSxlOVqObbWJp5bnQEy TT8Q==
- In-reply-to: <87a88yk32i.fsf@mure.haselwarter.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <87a88yk32i.fsf@mure.haselwarter.org>
On Mar 6, 10:16am, Philipp G. Haselwarter wrote:
}
} however, if I cd into /mnt and then try to umount the relative path
}
} # cd /mnt
} # umount nam
}
} it gets completed to
}
} # umount name with spaces
}
} with no escapes for the spaces.
This seems to do it, although I haven't figured out why it is necessary
to do the quote manipulation in the shell code here when it is not needed
in the other (absolute-path) branch.
diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths
index 6eab7b6..630907b 100644
--- a/Completion/Unix/Type/_canonical_paths
+++ b/Completion/Unix/Type/_canonical_paths
@@ -41,7 +41,11 @@ _canonical_paths_add_paths () {
# ### Ideally, this codepath would do what the 'if' above does,
# ### but telling compadd to pretend the "word on the command line"
# ### is ${"the word on the command line"/$origpref/$canpref}.
- matches+=(${${(M)files:#$canpref*}/$canpref/$origpref})
+ if [[ -z $compstate[quote] ]]; then
+ matches+=(${(q)${(M)files:#$canpref*}/$canpref/$origpref})
+ else
+ matches+=(${${(M)files:#$canpref*}/$canpref/$origpref})
+ fi
fi
for subdir in $expref?*(@); do
@@ -84,7 +88,7 @@ _canonical_paths() {
files+=($@:P)
fi
- local base=$PREFIX
+ local base=${(Q)PREFIX}
typeset -i blimit
_canonical_paths_add_paths $base
Messages sorted by:
Reverse Date,
Date,
Thread,
Author