From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id d5801cd0 for ; Thu, 28 Mar 2019 11:21:30 +0000 (UTC) Received: (qmail 3026 invoked by alias); 28 Mar 2019 11:21:17 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44189 Received: (qmail 28643 invoked by uid 1010); 28 Mar 2019 11:21:17 -0000 X-Qmail-Scanner-Diagnostics: from mailout1.w1.samsung.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.1/25398. spamassassin: 3.4.2. Clear:RC:0(210.118.77.11):SA:0(-7.0/5.0):. Processed in 3.944428 secs); 28 Mar 2019 11:21:17 -0000 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.samsung.com designates 210.118.77.11 as permitted sender) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190328112031euoutp0180148df90643da8bd4c791c5f553b314~QG25AWUag1474514745euoutp01q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553772031; bh=5nt9DG7kumgkvAPMX6FHQmwp34cYnalspGgOkg6EqWg=; h=Subject:From:To:Date:In-Reply-To:References:From; b=sO65RVj1vnbWcw4n3VRqFfG0E6dvtaP7LhsnMCw/sxpuWagTgdqm83fkzcJTEhYWj 56sfU5UY7a1WdHWSrbuh1b0/eT4gIZ9EHAdS5SLvCx/JZB8PM+c1cesNDk2eLn3MoF EgxJUKhJBqXyDTq//A0Ar7PaMmZErOSeaBQkaDE8= X-AuditID: cbfec7f4-12dff70000001119-ca-5c9cadfecf0c Message-ID: <1553772029.5713.10.camel@samsung.com> Subject: Re: Proposal (with code) to fix breaking of history widgets on reset-prompt From: Peter Stephenson To: Date: Thu, 28 Mar 2019 11:20:29 +0000 In-Reply-To: X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPIsWRmVeSWpSXmKPExsWy7djP87r/1s6JMfix28biYPNDJgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZZw69Jq14IxYxfYHHWwNjNuFuhg5OSQETCSu377H1MXIxSEk sIJR4kLzSRYIp49JYseqj1CZXiaJfz8uMMK0NE2bxA6RWA7UMglJ1bnJZ6AyZxglVh04yArh XGCUWNB5Fqifg4NXwEii/6clyChhgTCJDR27mUFsNgFDiambZoOtEBGQlLjWfBrMZhFQlZjQ 1wxWwykQKPFhy0pWiDM0JDbcPMYEYvMKCEqcnPmEBcRmFpCXaN46mxlkr4TAYzaJp3+/MEM0 uEjMWH+CCcIWlnh1fAs7hC0j8X/nfCaIhnZGiTWTXrNDOD2MEpuO3oH62lqi7/ZFsA+YBTQl 1u/Shwg7Shyd+oEdJCwhwCdx460gxBF8EpO2TWeGCPNKdLRBQ1tNYkfTVkaIsIzE0zUKExiV ZiH5YBaSD2YhrFrAyLyKUTy1tDg3PbXYKC+1XK84Mbe4NC9dLzk/dxMjMBmc/nf8yw7GXX+S DjEKcDAq8fAq5M+OEWJNLCuuzD3EKMHBrCTCe2vlnBgh3pTEyqrUovz4otKc1OJDjNIcLEri vNUMD6KFBNITS1KzU1MLUotgskwcnFINjA7HLq4P23SRZ0K996SUHtewXR/t2ni8WH7PO7Eh cluVmcGRF+zHsz7Ni4o5wbfkstDcnX6GotLPJwe5bPZb8fM85wy/a7V7mu75dTg1n4+I2cxs 6Dql5M+RyonT2Cz/Mj0NTH8ayms5y/G158SaM/9mlnK7ru3Z8oj/VHysxpEpOxIDwvqDZimx FGckGmoxFxUnAgCc5LTzAgMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42I5/e/4Pd1/a+fEGEw6xm9xsPkhkwOjx6qD H5gCGKP0bIryS0tSFTLyi0tslaINLYz0DC0t9IxMLPUMjc1jrYxMlfTtbFJSczLLUov07RL0 Mk4des1acEasYvuDDrYGxu1CXYycHBICJhJN0yaxdzFycQgJLGWUeNp5mAkiISPx6cpHdghb WOLPtS42iKJuJonz01dAOWcYJXY//c0K4VxglPj44QqQw8HBK2Ak0f/TEqRbWCBMYkPHbmYQ m03AUGLqptmMILaIgKTEtebTYDaLgKrEhL5msBpOgUCJD1tWssKddLJhCVgRs4CmROv231An aUhsuHkM7FReAUGJkzOfsEDUyEs0b53NPIFRaBaSlllIymYhKVvAyLyKUSS1tDg3PbfYUK84 Mbe4NC9dLzk/dxMjMPy3Hfu5eQfjpY3BhxgFOBiVeHgV8mfHCLEmlhVX5h5ilOBgVhLhvbVy TowQb0piZVVqUX58UWlOavEhRlOgjyYyS4km5wNjM68k3tDU0NzC0tDc2NzYzEJJnPe8QWWU kEB6YklqdmpqQWoRTB8TB6dUA2OTdqrU4flyinLz4xrvZW1YdLTNe2qP+s11iZkqeXpa2e8n 3Fzw7BjLVkffqSFCM3dMFLQ5JbX5qY7tCcnNxX22UwNkrT/IvVp+/q/cHvnGLT8j+ov4Qrbo nOgtvbsp5YfvbwZ5k+PXG4uOSW9MC5eTLTtoxOzYzfnGTJLbo+XLmX8dS3YwzFRiKc5INNRi LipOBAClOLhRlQIAAA== X-CMS-MailID: 20190328112030eucas1p2f137af7373291a5c3cfa1bd666ed796c X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190323131052epcas1p4ee9c963395adaa3c2bb560e1a290f6bd X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190323131052epcas1p4ee9c963395adaa3c2bb560e1a290f6bd References: > By the way, any chance you could take a look at > https://www.zsh.org/mla/workers//2019/msg00204.html or ping someone who > might? On Sat, 2019-03-23 at 14:09 +0100, Roman Perepelitsa wrote: > If your [up] key is bound to up-line-or-beginning-search, like most people > have it, try the following experiment. Type sleep 6& and hit [enter]. Then > quickly press [up] and wait for the job to finish. Once it finishes, press > [up] again. Oh no! History doesn’t work. You are supposed to see the > command you’d typed before sleep 6& but you are likely still seeing sleep 6& > . > > Here’s what’s going on. When jobs finish, zle .reset-prompt is called to > re-expand and display prompt. This sets LASTWIDGET to .reset-prompt. When > you press [up] after that, up-line-or-beginning-search will behave as if > you’ve typed sleep 6& in your prompt and then pressed [up]. That is, it’ll > search for the previous command in your history that starts with sleep > 6&. >... > One potential fix for this issue is to change reset-prompt widget so that > it keeps LASTWIDGET unchanged. I’ve implemented this change in > https://github.com/romkatv/zsh/tree/gentle-reset-prompt. Diff against > upstream: > https://github.com/zsh-users/zsh/compare/master...romkatv:gentle-reset-prompt > . Don't see any problem with doing that.  I suppose we really need a list of widgets that should have this behaviour. Ideally, this would be encapsulated as anything that happens not as part of a user command --- in your example, that's the code executed at the end of the job (I think as a result of setting "resetneeded" in trahszle()) that calls last-prompt, rather than last-prompt itself.  But that could be more major surgery, with largely the same effect since it's that widget that's causing the problem.  So I'm perfectly happy to get this fixed by the present means. If you can produce this as a single change (with appropriate use of rebase -i or whatever) we can apply it.  A patch to the list would be fine, since other people get to see it, but I don't mind cherry-picking / rebasing from your repo if it's a single squashed change somewhere. > The same branch also adds -W option to zle widget command. This option > instructs zle to keep LASTWIDGET unchanged. I added it because it’s a > natural extension of what I’ve done with .reset-prompt and because it has > solved a long-standing issue I had in my zsh config. The functionality certainly seems useful. It might be easier simply to make LASTWIDGET read-write.  Then you could do   local LASTWIDGET=$LASTWIDGET (you only need the assignment if you expect something down below to look at it) and no new syntax is needed.  The save/restore just uses existing mechanisms intended for doing that with variables, which seems more efficient, too. pws