Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zle-line-finish behavior and documentation
- X-seq: zsh-workers 37723
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: zle-line-finish behavior and documentation
- Date: Thu, 21 Jan 2016 11:04:49 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;        h=from:message-id:date:in-reply-to:comments:references:to:subject         :mime-version:content-type;        bh=hdVbCfMxRueszPXVAqLFgY7dkdfeUmAF0mZHVJpiU+g=;        b=J8ysS9IWP8rBlTsWT6U1yQOykTuvICnT77rCiUqH6mXNWni1/L0KTOi7ZK3uFHhJ0g         gRMUk88ZKDpbFuXo5xB6wtuNclvlIyZaMcQbnCv+a9oHzd6MFnSCyuCttfeP2OlqLxqM         rTzSN36oCt00h7WFI+RVJ6rIzfWu91ekFm3mC/14V1tMOtalVCNgieit4cLrXawaqY/x         WEVkjz/+GNGiz+FSCUhcdZajbMss0p+uAh5CA7jGSTL1rJCRjlckmAcTEsAhteK7p3nC         sJWB511gTd4fXFUas0Ymuic+IHTFsX81TyOifCHcc1PFN6x84A7k06hUEhWPwDEXtRTm         1a/A==
- In-reply-to: <20160121124620.GB21104@cventin.lip.ens-lyon.fr>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20160114145631.GB12351@cventin.lip.ens-lyon.fr> 	<160114182256.ZM18156@torch.brasslantern.com> 	<20160121124620.GB21104@cventin.lip.ens-lyon.fr>
On Jan 21,  1:46pm, Vincent Lefevre wrote:
}
} OK, but if the goal is to reset the previous prompt, that's too late.
I guess the assumption was that if you're aborting the line there's no
reason to update the previous prompt.
} There would also be other two problems:
} 1) $ZLE_LINE_ABORTED gets empty when one does Ctrl-C on an empty line.
} 2) $ZLE_LINE_ABORTED is not reset when a command line is not aborted.
Hmm.  I think it *should* work to do e.g. this:
  zle-line-init() {
    (( $+ZLE_LINE_ABORTED )) && RPS1=ABORT || unset RPS1
    unset ZLE_LINE_ABORTED
    zle reset-prompt
  }
And indeed ZLE_LINE_ABORTED is set-but-emtpy after an interrupt on a blank
command line, and is unset after an accept-line.  For some reason, though,
reset-prompt doesn't redraw the right prompt until the second consecutive
interrupt.
The PS1 prompt does get updated on reset-prompt, it works with:
  PS1="%1v$PS1"
  zle-line-init () {
    (( $+ZLE_LINE_ABORTED )) && psvar[1]='ABORT ' || psvar[1]=''
    unset ZLE_LINE_ABORTED
    zle reset-prompt
  }
Messages sorted by:
Reverse Date,
Date,
Thread,
Author