Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: $history[@] doesn't contain last element from $HISTFILE



On 14 October 2016 at 19:44, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> This is a side-effect of the implementation of history, specifically
> that even with HISTSIZE=0 there is always one line (the immediately
> previous command) available for recall with up-history.  Hence that
> final line is not actually "committed" into the history until the NEXT
> line is read, at which time it either goes into the history "for real"
> or is discarded.
>
> I pass no judgement at this time on Sebastian's assertion of whether
> the contents of $history[@] "should be" different, though it is
> potentially unexpected that $history[$HISTNO] is special-cased.

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.

Best regards,
Sebastian Gniazdowski



Messages sorted by: Reverse Date, Date, Thread, Author