Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: curses tweaks, maybe
- X-seq: zsh-workers 23969
- From: Clint Adams <clint@xxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: PATCH: curses tweaks, maybe
- Date: Tue, 16 Oct 2007 23:29:55 -0400
- Cc: Zsh Hackers' List <zsh-workers@xxxxxxxxxx>
- In-reply-to: <20071016094040.4a48a750@news01>
- Mail-followup-to: Peter Stephenson <pws@xxxxxxx>, Zsh Hackers' List <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20071016094040.4a48a750@news01>
On Tue, Oct 16, 2007 at 09:40:40AM +0100, Peter Stephenson wrote:
> Also, a refresh() is needed after deleting a window, otherwise nothing
> works when you add a new one. It's not clear where this should be,
> however. If the intent is that the user can stack up commands before
> refreshing we would need that as a user command, but we might well
> need to ensure that it got called anyway before things got too hopefully
> messed up (e.g. it would probably need to be called just before, or
> presumably in place of, a wrefresh() for a new window). So this will do
> for now.
I think we should provide refresh() as zcurses -R. Apparently (at least
according to http://invisible-island.net/ncurses/ncurses-intro.html ;
I've not tried it) we can do an endwin() with zcurses -e, mess around with
normal shell output, then redraw with refresh() and resume where we've
left off.
> I think I've tracked it down to this: if zsh/curses gets loaded here,
> onclr is turned off; if zsh/curses was already loaded then it's OK.
> Presumably the difference is that from the command line zsh is doing it's
> sanity checks (but I don't quite understand why they don't happen after the
> above). This is from initscr(). The functions nonl() / nl() seem to
> control this in curses, but they docs suggest the setting isn't changed
> automatically, which seems to be wrong.
I think I just read somewhere (though I can't find it now) that nl() is
the default and that nonl() provides speed benefits if you don't need
the translation. Maybe we should unconditionally run nonl() after
initscr(), since we don't support (yet?) any curses input functionality
and anyone passing a literal newline to zcurses -s (does this work for
you either?) can probably be bothered to pass a CR too.
> Perhaps to be safe we should be requiring all use of curses to be between
> commands such as zcurses -i and zcurses -e, as below? After all, it's
> reasonable to suppose this doesn't fit in with normal shell line-by-line
> character handling. This fixes Bart's gripe about clearing the screen.
We could; maybe they could take arguments and initialize/delete
multiple terminals/screens if we want to support that as well (and skip
initscr() altogether).
> Even with this code I only got it to work by both saving the terminal state
> from before zcurses -i, and when I restore it on zcurses -e ensuring that
> shttyinfo is the same---this seems a bit hairy. (I had a panic attack that
> shttyinfo.winsize would be screwed up, too, but
> settyinfo() doesn't alter that.)
I wonder why this is necessary.
> This seemed to work. Probably zcurses -e, if it stays, should do more
> work, such as deleting any remaining windows. (That could fix up the
> refresh() issue mentioned at the top in the case where we delete all
> windows.)
Maybe zcurses -d with no arguments could delete all, or we could have a
separate endwin()-only command for use in the endwin()/refresh() trick
described up top.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author