Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: _mpc breaks when folder contains spaces
- X-seq: zsh-users 22849
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Oliver Schmidhauser <oli@xxxxxxx>
- Subject: Re: _mpc breaks when folder contains spaces
- Date: Tue, 22 Aug 2017 17:57:57 +0200
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1503417483; bh=IYTxhqhEMY+Wl/xuLtqqDr24n+4yB3upxnNp1D/glEQ=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=SBJqVZsoYdD/52AX0PhLUmxi/8MrDRLkyv7x3Yo1/iUfxx/AKtrAekCHJEOBVf0g7/TSsnsfYfbJ1msYYp8REF5Y4HV3NK9mObWv5KWgNrvtpqqMxAyO5tCvQDnmKKzemnsHykonrTXnTgUvDpE4Zvh6B46eZ7kfCBHpfM/5+DIPKQroerAs/t50F06lqWAhE6ea0Ih2HdS/ITu25ltHm9CaU62Cx4cTsbM4Ba/0jwzdjGsbQDwodszAw3dt4dCf/O8p7B+ssirIzGoK/7Rbc0di13XezTPFQtn52YYC++5sqKq3mNow2ybk4Ne73zltANooNPDyt7xHkmsXKwDvrg==
- In-reply-to: <20170822111229.GA28217@localhost>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20170822111229.GA28217@localhost>
Oliver Schmidhauser wrote:
>
> I have a problem with mpc and the completion function.
> mpc add Electronic/Laserkraft\ 3D/mpd error: No such directory
> I've attached a .patch for _mpc which fixes this issue, as in it
> replaced `\ ` with ` ` before it is being passed to `mpc tab`. This
> probably doesn't fix the root of the issue, why `$word[CURRENT]`
> contains "Electronic/Laserkraft\ 3D" instead of "Electronic/Laserkraft
> 3D". It probably also breaks when a folder actually contains `\ `.
It looks like you forgot to include the attachment. Does it resemble the
following patch? I believe it is the correct fix.
> The second issue I have is `mpc tab` outputing errors while I am
> trying to autocomplete, breaking the current prompt so that I have to
> `Ctrl+C` and restart.
I'll take a look at that and post a patch to -workers later. The mpc
function should be using _call_program in the many places when calling
out to mpc. That takes care of redirecting stderr among other things.
Oliver
diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc
index e0c6888b0..d4073c3cd 100644
--- a/Completion/Unix/Command/_mpc
+++ b/Completion/Unix/Command/_mpc
@@ -147,7 +147,7 @@ _mpc_helper_files() {
list=( ${${(f)"$(mpc listall)"}%%/*})
_wanted files expl file compadd -qS/ -a list
else
- list=(${(f)"$(mpc tab $words[CURRENT])"})
+ list=(${(f)"$(mpc tab ${(Q)words[CURRENT]})"})
_wanted files expl file _multi_parts / list
fi
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author