zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _describe and literal \n
@ 2016-07-23 18:04 Daniel Shahaf
  2016-07-23 20:00 ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Shahaf @ 2016-07-23 18:04 UTC (permalink / raw)
  To: zsh-workers

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?


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-10-08  7:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-23 18:04 [PATCH] _describe and literal \n Daniel Shahaf
2016-07-23 20:00 ` Bart Schaefer
2016-07-23 21:23   ` Daniel Shahaf
2016-07-23 23:27     ` Oliver Kiddle
2016-07-24  1:27       ` Bart Schaefer
2016-07-24 21:30       ` Daniel Shahaf
2016-09-27 20:32         ` Oliver Kiddle
2016-09-29 14:11           ` Daniel Shahaf
2016-09-29 14:28             ` Daniel Shahaf
2016-10-07 13:50             ` Daniel Shahaf
2016-10-07 14:53               ` Bart Schaefer
2016-10-08  7:42                 ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).