From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6129 invoked from network); 24 Aug 2022 15:25:45 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Aug 2022 15:25:45 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1661354745; b=KEziMM5yZn8L767EEkLiiOqjJnlsVMBd3/KksMUVkMK/znOTVv0cMPP8ttcMuj/pPCkiZF61XY HFNB0w1ijQSyd/cXQ33xeb5LBQE7vz/Pdp/OUcbjoVpHu5lVU8GrxM09EhedQzpyAUm2vsGjnP ilzZlYBGRUIp7QrgjKl8sRV0jeTr9BKqzsPpAOUIhYe+NTiXhkLV7jaOd9rk2xPVvQyWu+OmSb kJK8dnq1Ii80bBW3PhjzOtu2yoIaBlvJrAYUo3yEeKbLu3bqNZyzlMhu/UZiAIlE2xYQiBXORq x4y7q4s/73DKyCE4WM4aaQOcFmpqKougcaf+bWj1IZPqyw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (ambassador.madduck.net) smtp.remote-ip=188.174.253.166; dkim=pass header.d=madduck.net header.s=2015-11-14 header.a=rsa-sha256; dmarc=pass header.from=madduck.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1661354745; bh=Wa49/1YiU6gam1BVSoZRcWp67MFgxIW93qc7z+tOGPY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:MIME-Version:Message-ID:Subject:To:From:Date: DKIM-Signature:DKIM-Signature; b=dPI1U39vgLWMOtqw+xPvTunPsN1CpWXlf3uv21YcQFcTyPrBvu15qvPCLHBGqTxyPMKWhDluSs iSO1xZjX2QvH3KB93RFhGnw8ZkEhrNqrVXmchrN473VJA3C0jTJMFrtkNhbvgoOYhVeGTZlr53 1Fic0oSxv+C651TukIPTnMsAWLIWqTAnFaQKmQrUbh8x/mEp2dLS+ORFmO3ViZ7Kbm1S3mFSV1 qJkXHMfnmy/Z48zJ1uQ/wGzWGEhMiVOksfR2XqjzJi5ug2Dvsdv6EjHQ+4CPL2KefjZJV/ro8A vCx2EBqe6Nk5zgqvU2GXNRaFwqiRUJHt6IpPk7wK0bWhBA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=qwCciFG/mmhBixda1qzXkbYd2Z8cSI4+CuKBk6+fKiM=; b=aJx7JTETQ5rEE/aNVF2SbuCVYS JQO1lAaMLZuHEVxD6BU9zAESpT9HPa+Wlg1ltXQRw2ScriZowQHBp5KPcQfbQV9rdMsgUTxcBRygC cSx3jHElo1qIay5wYjVKm7UP7TDxFvPxxyCX7p3DhV7nnzYa7NIhQDHfnE4WAj5JgrKXg99+0jkaF 6fZ3Z8GiBRZKKZtRtMtXYAIHv+SIUT3Ty9HZHC/YeRryE9ih6SXDQ5hkV8FIz9B2pUuXK66DYaQm7 gvckSd2jhbksGEMgs8Hx0nPihbe3JkoqrfDo+U9dZnH8pGLX5zZ+k4bN9V91sTKQESASfn2OT7J7o qKuPambg==; Received: from authenticated user by zero.zsh.org with local id 1oQsGG-0005rz-FV; Wed, 24 Aug 2022 15:25:44 +0000 Authentication-Results: zsh.org; iprev=pass (ambassador.madduck.net) smtp.remote-ip=188.174.253.166; dkim=pass header.d=madduck.net header.s=2015-11-14 header.a=rsa-sha256; dmarc=pass header.from=madduck.net; arc=none Received: from ambassador.madduck.net ([188.174.253.166]:55014) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oQsB7-0005Ox-NB; Wed, 24 Aug 2022 15:20:26 +0000 X-MadduckNet-Submission: from lotus.rw.madduck.net (unknown [IPv6:2001:871:48:5624:8c5a:fa72:d493:633]); Creds Client CN "lotus.rw.madduck.net", Issuer "R3" (not verified) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=madduck.net; s=2015-11-14; t=1661354424; bh=Wa49/1YiU6gam1BVSoZRcWp67MFgxIW93qc7z+tOGPY=; h=Date:From:To:Subject:From; b=NZD50zgU00HHFnTPsd8xGTeY3k/2/z0NS/S1OEOaDQuaMVaCmxeD/rkxF5uApVz1z 416oYyFAEtrNyqE0SVuaxxxcyyj/nZyRUm55sU1fcUnCG62kEmK+03oDTF3clwWjOM npP/wEf8sfrcffs7DsX6SNl+vEnZL0+Df037RExM= X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.6 at ambassador.madduck.net Date: Wed, 24 Aug 2022 17:20:23 +0200 From: martin f krafft To: zsh-workers@zsh.org Subject: Re-reading history from ZLE Message-ID: Mail-Followup-To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="VeaLMV9cuc7CcMdJ" Content-Disposition: inline X-OS: Debian GNU/Linux bookworm/sid kernel 5.18.0-2-amd64 x86_64 X-Motto: Keep the good times rollin' X-Subliminal-Message: debian/rules! X-Spamtrap: madduck.bogus@madduck.net X-Seq: 50504 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --VeaLMV9cuc7CcMdJ Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Disposition: inline Folks, If a user widget modifies the history, e.g. appends a line using `print -s`, then the current ZLE instance does not find out about it: history expansion won't have access to it, and the `up-history` command doesn't "find" it. ``` % _test_hist() { print -s "echo foo" zle -M "The last line of history is now 'echo foo' zle reset-prompt } % zle -N _test_hist % bindkey '\et' _test_hist # now hit esc-t % _ The last line of history is now 'echo foo' ``` The cursor is indicated by the underscore. If I execute `up-history`, I get the `bindkey` command line. `!$` will contain "_test_hist". Curiously, `!!` will run `echo foo`. I suspect this is due to those being different ways to access history for historical reasons, but it's an inconsistency nonetheless. Is there a reason why `reset-prompt` shouldn't re-initialise ZLE's understanding of history? Thanks, -- @martinkrafft | https://matrix.to/#/#madduck:madduck.net "the worst part of being old is remembering when you was young." -- alvin straight (the straight story) spamtraps: madduck.bogus@madduck.net --VeaLMV9cuc7CcMdJ Content-Type: text/html; charset=utf-8 Content-Disposition: inline

Body

Folks,

If a user widget modifies the history, e.g. appends a line using print -s, then the current ZLE instance does not find out about it: history expansion won't have access to it, and the up-history command doesn't "find" it.

% _test_hist() {  
    print -s "echo foo"  
    zle -M "The last line of history is now 'echo foo'  
    zle reset-prompt  
  }
% zle -N _test_hist  
% bindkey '\et' _test_hist  

  # now hit esc-t  
% _  
The last line of history is now 'echo foo'  

The cursor is indicated by the underscore. If I execute up-history, I get the bindkey command line. !$ will contain "_test_hist". Curiously, !! will run echo foo. I suspect this is due to those being different ways to access history for historical reasons, but it's an inconsistency nonetheless.

Is there a reason why reset-prompt shouldn't re-initialise ZLE's understanding of history?

Thanks,

--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net  
 
"the worst part of being old is remembering when you was young."  
                              -- alvin straight (the straight story)  
 
spamtraps: madduck.bogus@madduck.net  
--VeaLMV9cuc7CcMdJ--