Zsh Mailing List Archive
Messages sorted by:
Re: up-line-or-search question
- X-seq: zsh-workers 16914
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- Subject: Re: up-line-or-search question
- Date: Wed, 27 Mar 2002 16:30:03 +0000
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <20020327125931.GA5046@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20020326192340.GA12802@xxxxxxxxxx> <Pine.LNX.4.44.0203261140300.13204-100000@xxxxxxxxxxxxxxxx> <20020327125931.GA5046@xxxxxxxxxx>
On Mar 27, 12:59pm, Oliver Kiddle wrote:
} Subject: Re: up-line-or-search question
} On Tue, Mar 26, 2002 at 11:51:01AM -0800, Bart Schaefer wrote:
} > I'd rather have it feep at the end of the history. Moving down a line
} > when the search fails means I lose my context and have to re-establish
} > it before I can e.g. reverse the direction of the search.
} In the case of this function, re-establishing the context is
} merely a case of pressing the up cursor which I don't think is
} that much of a problem.
The problem I was concerned about was this one:
} I did get it slightly wrong in the last function though
} because if the h-b-s-f fails and the subsequent d-l-o-h does a
} down history instead of down line, it is not good. So it
} [[ $RBUFFER = *$'\n'* ]] || return
} before the fi.
So if you've made that change, it shoudl be OK.
} > Don't test [[ $LASTWIDGET = $__searching ]], test [[ -n $__searching ]].
} > And name the cursor-saving variable something less generic, there may be
} > other functions that want to save and restore the cursor ...
} That doesn't help. It also means that the cursor position for
} searches is then fixed forever after for that shell instance.
Not exactly -- __searching will get cleared as soon as a search fails and
a simple up/down motion is done -- but you're right, the test should be
[[ $__searching = *-line-or-search && $LASTWIDGET = *-line-or-search ]]
or something along those lines.
Incidentally, a (possibly better) alternative to saving $CURSOR is to
save $LBUFFER and use it:
if [[ ... ]]; then
zle .history-beginning-search-forward $__last_search
} I think I've got it working now but am not sure why or whether
} there was something peculiar with the history list I had
} yesterday. Do we want to include the cursor movement in
} the examples in the distribution - it is more like up-line-or-
} search? Perhaps we need to use styles to configure it?
Styles are always nice; I'd be inclined to put the cursor movement in
and have a style to turn it off.
Bart Schaefer Brass Lantern Enterprises
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by: