zsh-users
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: Colored-character displayed on CTRL-C ?
Date: Mon, 23 Sep 2013 15:00:02 -0700	[thread overview]
Message-ID: <20130923220002.GB49013@redoubt.spodhuis.org> (raw)
In-Reply-To: <130923130204.ZM20058@torch.brasslantern.com>

On 2013-09-23 at 13:02 -0700, Bart Schaefer wrote:
> This should do it for you:
> 
>     autoload -Uz colors
>     colors
>     handle-interrupt() {
>       print -n "$bg_bold[yellow]${(V)KEYS:-^C}$reset_color"
>       zle -I && zle .kill-buffer
>     }
>     zle -N handle-interrupt
>     TRAPINT() { zle && zle handle-interrupt }

This seems to interact poorly with vared, resulting in vared not being
left until enter is pressed, and the value of the variable being blanked
out as a result.  Also, in bck-i-search (^R) the prompt is re-shown,
and the mode is still in bck-i-search (although the current selected
value is blanked out, but typing continues the search).

It seems that handling these requires the TRAPINT to return non-zero,
but doing so interacts with the widget above to double-prompt (badly).

I like the widget (which is why I found these issues).  :)  Just can't
figure out how to fix these issues.

Ideally, I'd be able to set $? after this, so a manual invocation of
precmd would correct the prompt variables, since precmd() isn't invoked
normally, given that widget, whereas it is with a straight Ctrl-C
without TRAPINT (albeit with $? set to 1).

-Phil


  reply	other threads:[~2013-09-23 22:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23 17:37 Larry Schrof
2013-09-23 19:26 ` Phil Pennock
2013-09-23 21:10   ` Phil Pennock
2013-09-24  2:58     ` Bart Schaefer
2013-09-23 20:02 ` Bart Schaefer
2013-09-23 22:00   ` Phil Pennock [this message]
2013-09-24  6:24     ` Bart Schaefer
2013-09-23 21:36 ` Hauke Petersen

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=20130923220002.GB49013@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.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).