From: Bart Schaefer <schaefer@brasslantern.com>
To: Pier Paolo Grassi <pierpaolog@gmail.com>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: commit to history
Date: Fri, 27 Aug 2021 14:59:18 -0700 [thread overview]
Message-ID: <CAH+w=7ae2r+M6R=dJy6Qz6g3U6VKhvU8S1-ehsZ+OoWhHUni5A@mail.gmail.com> (raw)
In-Reply-To: <CAP+y1xDexsPTAy_BvMD1drybBMFA7BYxVq+7z6LJGSeYjhzrkg@mail.gmail.com>
On Fri, Aug 27, 2021 at 2:15 PM Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
>
> the send-break widget returns a status code 1, and since I have a precmd that displays the last status code, I was wondering if it is in some way possibile to suppress that return status.
The short answer is no, there is not. There was a long thread about
this on zsh-workers earlier this year, search "curious incident of the
feep".
As written your widget discards multi-line structures if invoked at
the PS2 prompt. If that's intentional you can replace with:
commit_to_history() {
print -rs -- ${(q)${(z)BUFFER}}
BUFFER=''
if [[ -n $PREBUFFER ]]
then zle accept-line
else zle send-break
fi
}
If you would prefer to capture multi-line structure at PS2,
commit_to_history() {
local fullbuffer="$PREBUFFER$BUFFER"
print -rs -- ${(q)${(z)fullbuffer}}
BUFFER=''
if [[ -n $PREBUFFER ]]
then zle accept-line
else zle send-break
fi
}
next prev parent reply other threads:[~2021-08-27 22:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 21:14 Pier Paolo Grassi
2021-08-27 21:59 ` Bart Schaefer [this message]
2021-08-28 19:34 ` Pier Paolo Grassi
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='CAH+w=7ae2r+M6R=dJy6Qz6g3U6VKhvU8S1-ehsZ+OoWhHUni5A@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=pierpaolog@gmail.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).