From: Bart Schaefer <schaefer@brasslantern.com>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Cc: Langbart <Langbart@protonmail.com>
Subject: Re: Foreign Commands Not Appearing in 'history' Array When 'sharehistory' Option is Enabled Until a Command is Entered
Date: Mon, 28 Oct 2024 11:14:46 -0700 [thread overview]
Message-ID: <CAH+w=7ZQJFXb5Te1DVxrn7kFUH9jgc=XfrOODKCDLFhRrFEnUQ@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMpYBhtKqh1BVTe01k4ssrsJYU-p8sXC=_kz6xPs_3M6yw@mail.gmail.com>
On Mon, Oct 28, 2024 at 10:35 AM Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> I believe the OP is saying that after you execute a command in one
> terminal and press ENTER in another terminal, within that second
> terminal all widgets that operate on history, such as
> history-incremental-search-backward, will see the command, but the
> `history` array won't contain it.
That would seem to be pretty nearly impossible, because $history is
populated by calling the same methods that the widgets use, it's not
pre-generated/cached.
However, I notice that the OP is doing this:
printf "%s\t%s\n" "${(kv)history[@]}" | head -5
The left hand side of that pipe is going to be forked off and might
not see the same history list as the parent shell. However, also note
from my "longer answer":
> First, a history position (the "next" number) has already been allocated for expansion of the %h prompt escape, and loading from the shared history would have to somehow fit "above" that.
The history number isn't incremented on an empty command, so this
situation remains. I just re-read the OP and I don't find the
"widgets that operate on history ... will see the command" part? What
have I missed?
next prev parent reply other threads:[~2024-10-28 18:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 15:06 Langbart
2024-10-28 16:42 ` Bart Schaefer
2024-10-28 17:35 ` Roman Perepelitsa
2024-10-28 18:14 ` Bart Schaefer [this message]
2024-10-28 18:22 ` Roman Perepelitsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7ZQJFXb5Te1DVxrn7kFUH9jgc=XfrOODKCDLFhRrFEnUQ@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=Langbart@protonmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).