zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Felix Rosencrantz <f_rosencrantz@yahoo.com>,
	zsh-users <zsh-users@sunsite.auc.dk>
Subject: Re: Using buffer for history-incremental-search-backward
Date: Tue, 3 Jul 2001 08:34:38 +0000	[thread overview]
Message-ID: <1010703083438.ZM8632@candle.brasslantern.com> (raw)
In-Reply-To: <20010703073028.44609.qmail@web10402.mail.yahoo.com>

On Jul 3, 12:30am, Felix Rosencrantz wrote:
} Subject: Using buffer for history-incremental-search-backward
}
} I'm trying to figure out how to use history-incremental-search-backward.
} 
} host% sleep 5
} ^Recho
} host% echo
} 
} So why doesn't the control-R register?

While `sleep' is running, zle is inactive and the regular tty driver is
in control of the interpretation of input characters.  Chances are you
have `stty ^R redisplay' or the like (probably as a default, rather than
explicitly in any of your init files), so the tty driver consumes the ^R
before zle gets started again.

} I tried to write a widget that can be dropped in the
} place of the builtin h-i-s-b.  The problem I've been having is how to
} determine if this is the initial call of h-i-s-b, or if it is in the
} middle of a search in progress.

Ordinarily that's what the LASTWIDGET parameter is for, but the behavior
after you already have started an incremental search is not what you'd
expect:  your widget has not been assigned to LASTWIDGET yet because the
(internal C) function for `zle history-incremental-search-backward' has
not yet returned!  So you have to fudge that yourself.

Then there's the additional problem that there is a limited set of key
bindings during the incremental search, and the binding for the h-i-s-b
widget is not one of them -- so you have to actually *name* your widget
`history-increment-search-backward', and refer to the real widget by its
"safe" name (with a leading dot) in the `zle' calls.

    history-increment-search-backward () {
        setopt localoptions unset
	if [[ -n "$doing_hisb" ]]; then
	    zle .history-incremental-search-backward
	else
	    local doing_hisb=yes
	    zle .history-incremental-search-backward "$BUFFER"
	fi
    }

Both of these things could be considered bugs.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2001-07-03  8:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-03  7:30 Felix Rosencrantz
2001-07-03  8:34 ` Bart Schaefer [this message]
2001-07-04  6:14   ` Felix Rosencrantz
2001-07-04 14:39     ` Bart Schaefer
2001-07-06  6:32 Felix Rosencrantz
2001-07-06  8:24 ` 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=1010703083438.ZM8632@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=f_rosencrantz@yahoo.com \
    --cc=zsh-users@sunsite.auc.dk \
    /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).