From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4771 invoked by alias); 16 Jul 2014 16:10:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32871 Received: (qmail 17119 invoked from network); 16 Jul 2014 16:09:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140716091007.ZM2526@torch.brasslantern.com> Date: Wed, 16 Jul 2014 09:10:07 -0700 In-reply-to: Comments: In reply to Augie Fackler "history-incremental-search-backward weird behavior for multiline commands in 5.0.x" (Jul 16, 8:48am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: history-incremental-search-backward weird behavior for multiline commands in 5.0.x MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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 \\ bar 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 bar 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 matter.