zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: history-incremental-search-backward weird behavior for multiline commands in 5.0.x
Date: Wed, 16 Jul 2014 09:10:07 -0700	[thread overview]
Message-ID: <140716091007.ZM2526@torch.brasslantern.com> (raw)
In-Reply-To: <CAPLqtWJr3LtGiqEioH0E-wje7VZi-yE6wCwkr2=r=+BK1RAoqQ@mail.gmail.com>

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.


  reply	other threads:[~2014-07-16 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16 12:48 Augie Fackler
2014-07-16 16:10 ` Bart Schaefer [this message]
2014-07-16 16:30   ` Peter Stephenson
2014-07-16 17:54     ` Bart Schaefer
2014-07-16 18:59       ` Peter Stephenson
2014-07-17 13:02         ` Augie Fackler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=140716091007.ZM2526@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).