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

Re: [PATCH] Fix loading of multi-line history entires from disk



On Thu, 17 Jul 2014 08:58:41 -0400
Augie Fackler <raf@xxxxxxxxxxx> wrote:
> Fixes the issue I posted about yesterday with
> history-incremental-search-backward. I have no idea as to the
> correctness of the fix, but my history file is written out in a way
> that matches 4.3.x with this patch applied, and the behavior matches
> again.

You're right, it does work in both cases.

The change that introduced this was to fix lines ending in two
backslashes.  That presumably needs something more sophisticated.  But
I'm not sure what --- the traditional doubling of backslashes to
indicate a continuation line isn't syntactically unique, so I don't see
how you can tell, short of checking for an extendedhistory introduction
on the next line if that option's set, and obviously there's no
guarantee it is.

Specifically, for a continuation line

% echo foo \
> bar \
> rod

I get

: 1405625973:0;echo foo \\
bar \\
rod

and for three separate lines

% echo foo \\
% echo bar \\
% echo rod \\

I get

: 1405626360:0;echo foo \\
: 1405626364:0;echo bar \\
: 1405626453:0;echo rod \\

So I think we're stuck without breaking backward compatibility.

Doubling all backslashes and looking for an odd number at the end would
have worked better.

pws



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