From: Bart Schaefer <schaefer@brasslantern.com>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: $history[@] doesn't contain last element from $HISTFILE
Date: Fri, 14 Oct 2016 12:10:20 -0700 [thread overview]
Message-ID: <CAH+w=7b3pY7-c18oGH7MS=nfyX0s6dssQ5nLQkfALCf9cRNrnQ@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVCPb8gXtLF3Sy6O4Hkens_BTLG+wxkhC42nf-sjL1epDQ@mail.gmail.com>
On Fri, Oct 14, 2016 at 11:35 AM, Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> It's fine if it's not an unpredictable thing, I can stick to the
> workaround (now not actually a workaround), not having to do an
> is-at-least call in return. Although I'm not sure if by
> $history[$HISTNO] you mean $history[$size], if there is something
> unexpected there, it would be a problem.
$history is not an array, it's a hash whose keys are the history event
numbers. So (( $#history < HISTSIZE )) is always true but (( HISTNO >
HISTSIZE )) is possible. The largest possible defined index into
$history is $HISTNO, but of course that's only valid inside ZLE.
If you're manipulating history in an "fc -p" scope or the like there's
really only $(( ${${(k)history[@]}[1]} + 1)) to get the equivalent,
which does seem like an oversight.
prev parent reply other threads:[~2016-10-14 19:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 16:32 Sebastian Gniazdowski
2016-10-14 17:44 ` Bart Schaefer
2016-10-14 18:35 ` Sebastian Gniazdowski
2016-10-14 19:10 ` Bart Schaefer [this message]
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=7b3pY7-c18oGH7MS=nfyX0s6dssQ5nLQkfALCf9cRNrnQ@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=sgniazdowski@gmail.com \
--cc=zsh-workers@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).