zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Zle history feature like that of many IRC clients?
Date: Tue, 20 Dec 2011 08:24:38 -0800	[thread overview]
Message-ID: <111220082438.ZM10913@torch.brasslantern.com> (raw)
In-Reply-To: <111219191758.ZM9817@torch.brasslantern.com>

An additional twist occurred to me overnight:

On Dec 19,  7:17pm, Bart Schaefer wrote:
:
:     down-or-fake-accept-line() {
:       (( HISTNO == HISTCMD )) && zle fake-accept-line
:       zle .down-line-or-history "$@"                     
:     }

That's going to call fake-accept-line a bit too soon if you are in a
multi-line buffer.  The fix is pretty simple:

    down-or-fake-accept-line() {
      if (( HISTNO == HISTCMD )) && [[ "$RBUFFER" != *$'\n'* ]];
      then
        zle fake-accept-line
      fi
      zle .down-line-or-history "$@"                     
    }

(Rewritten as an "if" to avoid line wrap.)  This assumes that if there
are newlines to the right of the cursor, then we're somewhere in the
middle of a multi-line buffer and should keep moving down.

If you wanted down-history instead of down-line-or-history, then the
original test would be correct (but you should change which widget is
called at the end).


  reply	other threads:[~2011-12-20 16:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19 22:39 milk
2011-12-20  3:17 ` Bart Schaefer
2011-12-20 16:24   ` Bart Schaefer [this message]
2011-12-21  6:33     ` milk
2011-12-21  9:07       ` Bart Schaefer

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=111220082438.ZM10913@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).