From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10183 invoked by alias); 23 Sep 2013 22:00:14 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17995 Received: (qmail 8796 invoked from network); 23 Sep 2013 22:00:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at spodhuis.org designates 94.142.241.89 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201210; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=kuOfkM9gK/ZE9IQ0tDVSzlUPJSy2Jt7RjmBw58lfNJ4=; b=ki2QGcJPY/hgmhGZSAE78phP4BLRZPdVOUoIVcrabNdblPbVi6fH5Ftp1icj6oG/gaXdOOMZ11zpV4z+MY44+/tMDYGg6TZuS5MFhsK1w2Y5LErDGxQL5AZ7pDqFDU1+FjTLQoNCr3j+OWrn91XLzUMWohMq5YxsmQtdlWh2Fh0=; Date: Mon, 23 Sep 2013 15:00:02 -0700 From: Phil Pennock To: Bart Schaefer Cc: "zsh-users@zsh.org" Subject: Re: Colored-character displayed on CTRL-C ? Message-ID: <20130923220002.GB49013@redoubt.spodhuis.org> Mail-Followup-To: Bart Schaefer , "zsh-users@zsh.org" References: <130923130204.ZM20058@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <130923130204.ZM20058@torch.brasslantern.com> OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/0x3903637F.asc 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