From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10729 invoked by alias); 20 Dec 2011 16:25:04 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16655 Received: (qmail 22034 invoked from network); 20 Dec 2011 16:24:53 -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 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <111220082438.ZM10913@torch.brasslantern.com> Date: Tue, 20 Dec 2011 08:24:38 -0800 In-reply-to: <111219191758.ZM9817@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: Zle history feature like that of many IRC clients?" (Dec 19, 7:17pm) References: <111219191758.ZM9817@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Zle history feature like that of many IRC clients? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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).