From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5406 invoked from network); 17 Oct 2007 03:30:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Oct 2007 03:30:14 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 46752 invoked from network); 17 Oct 2007 03:30:07 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Oct 2007 03:30:07 -0000 Received: (qmail 17351 invoked by alias); 17 Oct 2007 03:30:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23969 Received: (qmail 17311 invoked from network); 17 Oct 2007 03:30:02 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Oct 2007 03:30:02 -0000 Received: (qmail 46142 invoked from network); 17 Oct 2007 03:30:02 -0000 Received: from acolyte.scowler.net (216.254.112.45) by a.mx.sunsite.dk with SMTP; 17 Oct 2007 03:29:56 -0000 Received: by acolyte.scowler.net (Postfix, from userid 1000) id 6317E5C614; Tue, 16 Oct 2007 23:29:55 -0400 (EDT) Date: Tue, 16 Oct 2007 23:29:55 -0400 From: Clint Adams To: Peter Stephenson Cc: Zsh Hackers' List Subject: Re: PATCH: curses tweaks, maybe Message-ID: <20071017032955.GA25480@scowler.net> Mail-Followup-To: Peter Stephenson , Zsh Hackers' List References: <20071016094040.4a48a750@news01> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071016094040.4a48a750@news01> User-Agent: Mutt/1.5.16 (2007-06-11) 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.