Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID
	autolearn=ham autolearn_force=no version=3.4.0
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==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:date:in-reply-to:comments
         :references:to:subject:mime-version:content-type;
        bh=hdVbCfMxRueszPXVAqLFgY7dkdfeUmAF0mZHVJpiU+g=;
        b=Bwqq2KXIIqbx1ewFhOrew7OQ9kSOcmDurrQinMavAHTdEljKauCccM2TvicWUVDcIZ
         tgZPPCEcs2fX05r/T/I7RtjPVfpk1EFY5Hy7XUs/k5uWT0WrE3FiZ8l/pD9WW2tnm1j/
         BfpyDkMiqEtxHvr9blNhKQxpsTAWkHxwHY6I2ndAwhm8/dIemkW2to/j6+KcLdYDZ515
         nL9d7I3kYQONmru1RMJDkKh7BamsbSOf8e45CZQOG43mTVGnBZxCozhJvXttb2Bf8gcL
         YEjIFPH5DUrE6jGJaC9CLncu+OjO/v9xXkKIolRF797Co4+sG314uD/DjDbXggz28l1m
         TefA==
X-Gm-Message-State: ALoCoQmHhf2R/HdVdoMrp8YmfW3df3pUnVabaXlvpRW28Hxa2LYL8FkMeb+0KyUcdBj4YGfysC8ZvrBYrLcs6ZItrhOLX3UgKA==
X-Received: by 10.98.64.27 with SMTP id n27mr63128726pfa.58.1453403058556;
        Thu, 21 Jan 2016 11:04:18 -0800 (PST)
From: Bart Schaefer <schaefer@brasslantern.com>
Message-Id: <160121110449.ZM25615@torch.brasslantern.com>
Date: Thu, 21 Jan 2016 11:04:49 -0800
In-Reply-To: <20160121124620.GB21104@cventin.lip.ens-lyon.fr>
Comments: In reply to Vincent Lefevre <vincent@vinc17.net>
        "Re: zle-line-finish behavior and documentation" (Jan 21,  1:46pm)
References: <20160114145631.GB12351@cventin.lip.ens-lyon.fr> 
	<160114182256.ZM18156@torch.brasslantern.com> 
	<20160121124620.GB21104@cventin.lip.ens-lyon.fr>
X-Mailer: OpenZMail Classic (0.9.2 24April2005)
To: zsh-workers@zsh.org
Subject: Re: zle-line-finish behavior and documentation
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Seq: zsh-workers 37723

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
  }

