zsh-users
 help / color / mirror / code / Atom feed
From: Marc Chantreux <eiro@phear.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: read options to slurp empty lines ?
Date: Sun, 3 Jun 2018 00:06:29 +0200	[thread overview]
Message-ID: <20180602220629.GA8646@prometheus.u-strasbg.fr> (raw)
In-Reply-To: <CAH+w=7bUdOB2DjCZmf5zWhL-9dM0ScSt6zPzuAmJK3EmEDsiyQ@mail.gmail.com>

hello Bart,

> slurp() {
>   local REPLY
>   IFS= read -d '' &&
>   set -A ${1:-reply} "${(@f)REPLY}"
> }

i added this code in uze.zsh and spotted a bug thanks to my test
suite (https://github.com/zsh-uze/uze/blob/master/t/100_dump.t)
the thing is the first line doesn't survive to the (@f) modifier
so:

    print -l '' a '' b | read -r -d '' lines
    for it ( "${(@f)lines}" ) l "* ($it)"

got:

    * (a)
    * ()
    * (b)

expected:

    * ()
    * (a)
    * ()
    * (b)

so i reverted the code for the moment waiting for
the moment i can use a code closer than yours.

regards
marc


      parent reply	other threads:[~2018-06-02 22:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 21:47 Marc Chantreux
2018-06-02  1:17 ` Bart Schaefer
2018-06-02  6:58   ` Marc Chantreux
2018-06-02 22:06   ` Marc Chantreux [this message]

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=20180602220629.GA8646@prometheus.u-strasbg.fr \
    --to=eiro@phear.org \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@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).