Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: command recall
On Sat, Feb 6, 2021 at 3:12 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2021-02-06 2:08 p.m., Bart Schaefer wrote:
> >
> > ... it doesn't update
> > the shared history until the current local history is ready to be
> > written.
> Still, hitting the up arrow is doing something is it not?
To go into too much detail, there's an unsaved dummy history entry at
the bottom of the internal list, to represent the command the prompt
is waiting for, and the history file isn't consulted until that dummy
entry is either discarded (accept-line on empty buffer) or ready to be
merged with the file contents. There are all sorts of reasons for
this, including being able to have a stable numbering scheme (keys in
the $history hash table) during computation of zle widgets.
> '$ history' is up to the second
That's because the order of operations is
1) You accept-line, so the pinocchio entry is ready to become a real boy
2) Consequently, the history gets merged
3) The "history" command executes
Messages sorted by:
Reverse Date,
Date,
Thread,
Author