* PS1 or PS2
@ 1999-06-29 10:54 Andrej Borsenkow
0 siblings, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 1999-06-29 10:54 UTC (permalink / raw)
To: ZSH workers mailing list
I already wrote about this: when on PS2 up-line-or-history moves to previous
history event instead of previous line of current event. It just occured to me,
that something like
if we-are-on-PS2
zle .push-line-or-edit
zle .up-line-or-history
would do quite nicely ... but how can I find out (in user defined widget) that I
am on PS2? The info is available (push-line-or-edit has it) - is it possible to
make it available to user widgets as well?
/andrej
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PS1 or PS2
1999-06-29 13:09 ` Andrej Borsenkow
@ 1999-06-29 15:24 ` Bart Schaefer
0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 1999-06-29 15:24 UTC (permalink / raw)
To: Andrej Borsenkow, Sven Wischnowsky, zsh-workers
On Jun 29, 5:09pm, Andrej Borsenkow wrote:
} Subject: RE: PS1 or PS2
}
} >
} > It almost works ...
} >
} > bor@itsrm2:~%> _Fn-up-line-or-history () {
} > function> [[ -n "$PREBUFFER" ]] && zle .push-line-or-edit
} > function> zle .up-line-or-history
} > function> }
}
} After zle .push-line-or-edit both BUFFER and PREBUFFER are empty. Are they
} static values computed on the entry into widget or do they reflect real ZLE
} buffers?
I think they reflect real ZLE buffers. The "problem" is with the way that
push-input/get-line (and consequently push-line-or-edit) are implemented:
They do something similar to
print -z "$BUFFER"
BUFFER=""
and then wait for zle_refresh() to come around and yank the buffer back.
So if you're entirely inside a zle widget (or a bindkey -s), you can't do
anything to the pushed input; it simply isn't there anymore until zsh has
a chance to print a prompt again.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: PS1 or PS2
1999-06-29 11:41 ` Andrej Borsenkow
@ 1999-06-29 13:09 ` Andrej Borsenkow
1999-06-29 15:24 ` Bart Schaefer
0 siblings, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 1999-06-29 13:09 UTC (permalink / raw)
To: Sven Wischnowsky, zsh-workers
>
> It almost works ...
>
> bor@itsrm2:~%> _Fn-up-line-or-history () {
> function> [[ -n "$PREBUFFER" ]] && zle .push-line-or-edit
> function> zle .up-line-or-history
> function> }
After zle .push-line-or-edit both BUFFER and PREBUFFER are empty. Are they
static values computed on the entry into widget or do they reflect real ZLE
buffers?
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: PS1 or PS2
1999-06-29 11:16 Sven Wischnowsky
@ 1999-06-29 11:41 ` Andrej Borsenkow
1999-06-29 13:09 ` Andrej Borsenkow
0 siblings, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 1999-06-29 11:41 UTC (permalink / raw)
To: Sven Wischnowsky, zsh-workers
> >
> > would do quite nicely ... but how can I find out (in user defined
> widget) that I
> > am on PS2? The info is available (push-line-or-edit has it) - is it
> possible to
> > make it available to user widgets as well?
>
> I haven't tried, but [[ -z "$PREBUFFER" ]] should work.
>
It almost works ...
bor@itsrm2:~%> _Fn-up-line-or-history () {
function> [[ -n "$PREBUFFER" ]] && zle .push-line-or-edit
function> zle .up-line-or-history
function> }
bor@itsrm2:~%> zle -N up-line-or-history _Fn-up-line-or-history
bor@itsrm2:~%> while true
while> <CursorUp>
beeps and I get
bor@itsrm2:~%> while true
<<< cursor here
That is, zle .up-line-or-history seems to be never executed.
/andrej
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PS1 or PS2
@ 1999-06-29 11:16 Sven Wischnowsky
1999-06-29 11:41 ` Andrej Borsenkow
0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 1999-06-29 11:16 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> I already wrote about this: when on PS2 up-line-or-history moves to previous
> history event instead of previous line of current event. It just occured to me,
> that something like
>
> if we-are-on-PS2
> zle .push-line-or-edit
> zle .up-line-or-history
>
> would do quite nicely ... but how can I find out (in user defined widget) that I
> am on PS2? The info is available (push-line-or-edit has it) - is it possible to
> make it available to user widgets as well?
I haven't tried, but [[ -z "$PREBUFFER" ]] should work.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1999-06-29 15:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-29 10:54 PS1 or PS2 Andrej Borsenkow
1999-06-29 11:16 Sven Wischnowsky
1999-06-29 11:41 ` Andrej Borsenkow
1999-06-29 13:09 ` Andrej Borsenkow
1999-06-29 15:24 ` Bart Schaefer
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).