zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] _describe and literal \n
Date: Sat, 23 Jul 2016 18:04:30 +0000	[thread overview]
Message-ID: <20160723180430.GA22451@tarsus.local2> (raw)

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?


             reply	other threads:[~2016-07-23 18:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-23 18:04 Daniel Shahaf [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160723180430.GA22451@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).