Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] _describe and literal \n
- X-seq: zsh-workers 38925
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] _describe and literal \n
- Date: Sat, 23 Jul 2016 18:04:30 +0000
- 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
Current behaviour:
[[[
$ zsh -f
% autoload compinit
% compinit
% _f() { a=( $'foo:hello\nworld' $'bar:lorem\nipsum' ); _describe descr a }
% compdef _f f
% f <TAB>
bar -- lorem
ipsum
foo -- hello
world
]]]
Proposed patch:
[[[
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index e8f0a6f..9e3ea3c 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -531,7 +531,7 @@ cd_init(char *nam, char *hide, char *mlen, char *sep,
tmp++;
if (*tmp)
- str->desc = ztrdup(rembslash(tmp + 1));
+ str->desc = nicedup(rembslash(tmp + 1), 0 /* heap? */);
else
str->desc = NULL;
*tmp = '\0';
]]]
Gives:
[[[
% f <TAB>
bar -- lorem\nipsum
foo -- hello\nworld
]]]
Is this fix correct?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author