Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Foreign Commands Not Appearing in 'history' Array When 'sharehistory' Option is Enabled Until a Command is Entered
- X-seq: zsh-users 30114
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-users@xxxxxxx
- Cc: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: Foreign Commands Not Appearing in 'history' Array When 'sharehistory' Option is Enabled Until a Command is Entered
- Date: Tue, 26 Nov 2024 10:13:27 +0100
- Archived-at: <https://zsh.org/users/30114>
- In-reply-to: <CAH+w=7bRCMzHTGcHc16ayJYN0KJuMshybCoK=8+dvhmL08O+5A@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <mwXIqemfp6p2u5-5ApP-6mjA8aw0SthwcBYnYnkHh13e_46s4ThESPJANCAKlEr2n9VBhClb1JwW_5IiYgljeAv9hJzfculpb9J6QF_lqQY=@protonmail.com> <CAH+w=7ZOwgzV9gb-Zfn-NxWmpa0yPLvevLrApMSYK9S_qAdK-g@mail.gmail.com> <CAN=4vMpYBhtKqh1BVTe01k4ssrsJYU-p8sXC=_kz6xPs_3M6yw@mail.gmail.com> <CAH+w=7ZQJFXb5Te1DVxrn7kFUH9jgc=XfrOODKCDLFhRrFEnUQ@mail.gmail.com> <CAN=4vMoM+D99FBnQUds4r5750X9A-6otixayM92_RQnzu7eApA@mail.gmail.com> <CAN=4vMrcghV97=X7hV6y9FxzmghU0xWHZHWFR1-PBYK1uDR5Mw@mail.gmail.com> <CAH+w=7bRCMzHTGcHc16ayJYN0KJuMshybCoK=8+dvhmL08O+5A@mail.gmail.com>
On Mon, Nov 25, 2024 at 9:12 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Nov 23, 2024 at 11:41 PM Roman Perepelitsa
> <roman.perepelitsa@xxxxxxxxx> wrote:
> >
> > Expected:
> >
> > adam% : 2
> > : 2
> >
> > Actual:
> >
> > adam% : 2
> > : 1
> >
> > We can see that `zle up-history` sees the last history event, which
> > was written by Terminal 2, but `history` does not have it.
>
> Change the prompt to display %h (history event number) and change the
> test function to
>
> function test-history() {
> zle up-history
> zle -M -- "$HISTNO $#history ${history[${#history}]}"
> }
>
> This will demonstrate what's happening: The event shared from
> Terminal 2 is being placed in the "current event" slot ($HISTNO) which
> is not committed to the full history until a non-empty command is
> executed. I believe this in turn is because the test-history widget
> is (by program logic) being executed "during editing of the current
> event" and consequently that edit is considered unfinished.
>
> I don't have availability to chase this any further any time soon, nor
> any clues as to how difficult it would be to alter this behavior in
> the face of shared history. The logic about when to commit the
> "current event" is pretty deeply ingrained.
Another consequence of this is
https://www.zsh.org/mla/workers/2021/msg01087.html
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author