bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoiding clearing the screen


From: Dan Nelson
Subject: Re: Avoiding clearing the screen
Date: Mon, 24 Dec 2007 10:35:40 -0600
User-agent: Mutt/1.5.17 (2007-11-01)

In the last episode (Dec 24), Thomas Dickey said:
> On Thu, Dec 20, 2007 at 09:03:01AM +0100, Christer Enfors wrote:
> > Now, my problem is that the entire screen is cleared when I press a key to 
> > go up or down in the menu, which causes some terminals to flicker terribly. 
> > I was expecting ncurses to only redraw a subsection of the menu - the menu 
> > item that was previously selected, and the new one. That the entire screen 
> > is cleared is strange to me, because I don't clear the entire screen - I 
> > only clear one of my windows (which takes up the bottom fifth of the 
> > screen).
> 
> > The function that causes the screen to be cleared is doupdate().
> ...
> >  while (done == 0)
> >    {
> >      switch (getch()) /* User presses j or KEY_DOWN here. */
> 
> By the way, getch does a refresh, which in turn calls doupdate().
> 
> >  wclear(win); /* Clear the bottom fifth of the screen. This is the
> >             * only part of the relevant code where any type of
> >             * clear function is called.
> >             */
> 
> Looking at the code for 'refresh', I see the problem:
> 
>     if (win->_clear) {
>         win->_clear = FALSE;
>         newscr->_clear = TRUE;
>     }
> 
> ...which is telling it that if any window does wclear(), then the working
> window 'newscr' is cleared.  If you use werase() you should get the
> expected result.

This is also documented in the wclear/wearse manpage:

       The clear and wclear routines are like erase and werase, but
       they also call clearok, so that the screen is cleared completely
       on the next call to wrefresh for that window and repainted from
       scratch.

-- 
        Dan Nelson
        address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]