Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Strange behaviour of setopt and binkey in a widget



2010/4/20 Peter Stephenson <pws@xxxxxxx>:
> On Tue, 20 Apr 2010 11:02:29 +0200
> Mike Perdide <mike.perdide@xxxxxxxxx> wrote:
>> [22:49] :~$ zsh
>> north.~% <CTRL-O> <CTRL-D>
>> zsh: use 'exit' to exit.
>> north.~% <CTRL-D>not really exiting
>>           !!! First strange behaviour : the prompt is not redrawn. At
>> this point I press <ENTER> to get my prompt back :
>
> This isn't actually strange at all if you consider that all widg0 done is
> echo "not really exiting" to the screen.  You haven't told the shell to
> redraw the prompt.  The way to do this is tell ZLE you're taking over the
> display for a bit, so that when the widget exits it will redraw the prompt
> below:
>
> widg0() {
>  zle -I
>  echo "not really exiting"
> }
Thanks for that -I option, I wouldn't have guess it's utility : ). It
works like I wanted, althought it seems to take some time to be active
:
[22:15] :~$ zsh
north.~% <CTRL-O> # Bind widg0 to ^D
north.~% <CTRL-D>
zsh: use 'exit' to exit.
north.~% <CTRL-D>
Deactivating ...

>> north.~% <CTRL-P> <CTRL-D>
>> !!! The previous ligne is rewritten with these two :
>> [22:53] :~$
>> zsh: use 'exit' to exit
>
> This actually did exit the shell for me (which is what you want, although
> I'm not sure now much I expected it given the ^D wasn't bound to anything
> any more and it's being processed by zsh, not handled directly as EOF which
> zsh has to synthesise).  Does "stty -a" show that ^D is the EOF character?
It does : "eof = ^D;"
It exits the shell for me too, but prints this message "zsh: use
'exit" to exit", so I'm guessing I'm still doing something wrong.

Moreover, I manage to get a segfault error by using virtualenwrapper
and wigets, but that's another story.

Thanks fo your help !



Messages sorted by: Reverse Date, Date, Thread, Author