Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: $history[@] doesn't contain last element from $HISTFILE
- X-seq: zsh-workers 39641
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: $history[@] doesn't contain last element from $HISTFILE
- Date: Fri, 14 Oct 2016 12:10:20 -0700
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+JLBK1Lv5XI65snHnFwKSU6lPjIdMIXhb1EJGUA4K6Q=; b=fpz0rqwnbA6BV4pK2jl1ENlogxE4U545ffj7AuX4pBOVH/zYTPEkXcYWC/hkZMp7wt 67HIWJC1mDmEQilDqqS/+gAaDP6341IbNSzf2lM72uX+2tSvqh7PsZst1WQTMOgt2ed7 E4NGR9kK7YXXGhLPoJbdIDfjQ+8dAMaH+Z9OLO5gwYLy7R2LS5SulHhR0aXhRoMORera wTiLigkTGLKof2BKN6/FmH8wyl/q4Es1PWqV4oCTb/E55OJDhmVeYmJTd6+4tiPyezjq q/9fZolm9tsyenUmdDt/IHFGWuloqXl3ideatZAl0hkbw34GVGcM5y4peNCWcBDzdewh eXPA==
- In-reply-to: <CAKc7PVCPb8gXtLF3Sy6O4Hkens_BTLG+wxkhC42nf-sjL1epDQ@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVDE94RMgquJtPU5hgBoC0TUSNHzfocZV7DXgajtJME2jg@mail.gmail.com> <CAH+w=7bxHu3D1O5JPOAOi0mokXtzJY7iFCTJrV90izqmemAH1w@mail.gmail.com> <CAKc7PVCPb8gXtLF3Sy6O4Hkens_BTLG+wxkhC42nf-sjL1epDQ@mail.gmail.com>
On Fri, Oct 14, 2016 at 11:35 AM, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author