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

Re: history-incremental-search-backward weird behavior for multiline commands in 5.0.x

On Jul 16,  8:48am, Augie Fackler wrote:
} $ echo foo \
} >  bar
} foo bar
} $ ^R bar
} # finds the full command
} but then in a new shell:
} $ ^R bar
} # finds only the word bar, not the full echo command.

Hmm, it looks like history loading may be mis-handling the case of an
INTENTIONAL backslash-newline pair.  This gets stored in the history
file as e.g.

echo foo \\

This is then re-loaded as the two lines

echo foo \\

(note the backslash is still doubled, though it was not when it was
originally input) and


which obviously is wrong.  I'm not sure whether the fix is to store
it with three backslashes, or to parse it differently on load, or both.

By contrast, if you had used quotes or a multi-line loop construct, each
line would have ended with a single backslash which is reloaded correctly.

} Am I missing something obvious? setopt hist_lex_words didn't make a
} difference, and I tried turning off hist_save_no_dups and
} inc_append_history.

hist_lex_words would need to be set very early, i.e., before the history
is loaded, in order to make any difference, but in this case it doesn't

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