Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] Crash when accessing WIDGETSTYLE from SIGINT trap
- X-seq: zsh-workers 44910
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: [BUG] Crash when accessing WIDGETSTYLE from SIGINT trap
- Date: Tue, 12 Nov 2019 15:56:25 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8dGH/gtxCRA+zawF5TVdjior+mU5uDrZd4ftyJOaTN0=; b=UWCGitYW6y7/jVIvRSPWc/MWaiAaqU+MsofKu/r75xU7YMOqiK5oEq2m4PBnod9AOV Kc9IERNxvE+/7Iz3tN5gNd9zgAPBNZZ/rIAkQyKfqTnrWNFqcuU3WfAJLRL9GBJYqzVU n97I2AJFJtqyE1kmG8rOaD90zVPGFlrKaxHMsCvuxKT5qO7H4t3JDBXOep1SGxxm4MBK JFgQuMITt0iUEFZe3y5cZSHTJX4EOHsvZZYDpE8O6U7akq38S4OZBYgLm8de21HUIbtb 6wxFKNsKTi5yJbzuKBmMy5a7C1IJzSIm5sBnK/GMYliOD+zQ2TYKuB8BTm3ohZSVe4XC ajCQ==
- In-reply-to: <CAN=4vMp55vKoDiFDD4kijNc_xBJLve6GUifTQJVfCEecadyMCA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20191111143952eucas1p2784d9821f292f2c9c136b19da5a56ade@eucas1p2.samsung.com> <CAN=4vMoahC2c4XHV9vE+Ohkx9rO00unZ0rC=E39yWfoSm4KKiw@mail.gmail.com> <1573484293.4561.8.camel@samsung.com> <CAN=4vMp55vKoDiFDD4kijNc_xBJLve6GUifTQJVfCEecadyMCA@mail.gmail.com>
On 11/11/19, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> On Mon, Nov 11, 2019 at 3:58 PM Peter Stephenson
> <p.stephenson@xxxxxxxxxxx> wrote:
>>
>> On Mon, 2019-11-11 at 15:38 +0100, Roman Perepelitsa wrote:
>> > Crash at zle_params.c:436 due to bindk being null:
>> >
>> > Widget widget = bindk->widget;
>>
>> Looks to me like returning the empty string in that case would be fine?
>
> I don't know. I haven't sent a patch because I'm not sure whether the
> fix should be right there in get_widgetstyle or somewhere earlier so
> that bindk is not null to begin with.
>
> I should've explained what I'm trying to do. I want to use a long
> prompt for the current command line and a short prompt for complete
> commands. Sort of like transient_rprompt option but instead of hiding
> just right prompt I want to hide most of left prompt too. Here's a
> short demo:
> https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/transient-prompt.gif.
>
> Here's how I'm doing it:
>
> - Set long prompt in precmd.
> - Set short prompt in zle-line-finish and on SIGINT.
>
> The code:
>
> set-long-prompt() { PROMPT='%~%# ' }
> precmd_functions=(set-long-prompt)
>
> set-short-prompt() {
> if [[ $PROMPT != '%# ' ]]; then
> PROMPT='%# '
> zle .reset-prompt
> fi
> }
>
> zle-line-finish() { set-short-prompt }
> zle -N zle-line-finish
>
> trap 'set-short-prompt; return 130' INT
>
> One issue with this code is that after hitting Ctrl-C, set-long-prompt
> doesn't get called, so I end up with a short current prompt.
Have you tried restoring the long prompt in zle-line-init instead?
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author