bug-ncurses
[Top][All Lists]
Advanced

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

Re: Trying to preserve original screen


From: Thomas Dickey
Subject: Re: Trying to preserve original screen
Date: Mon, 9 Feb 2004 21:01:48 -0500 (EST)

On Mon, 9 Feb 2004, Scott Bronson wrote:

> Hello.  I would like to pop up a 4 line x 80 column status window
> at the bottom of the screen during a file transfer, then have the
> original screen restored exactly as it was when the transfer is
> complete.
>
> I've been trying to do this with ncurses.  The problem is that
> ncurses clears the entire screen when refresh is called (thanks
> to initscr or newterm).  I need the entire screen to be preserved,
> except for the bottom 4 lines.
>
> Is there any way to restrict initscr to the bottom 4 lines of the
> screen?  Or, is there a way of getting initscr to preserve the
> entire screen, then creating a window to manipulate the bottom 4
> lines?

Not really - there's no portable method for getting the screen contents,
and (also for portability) curses clears the screen on initialization.
Some terminals (xterm for instance) can pretend to restore the screen
by switching between normal and alternate screens.

Generally you'd have to do something like this by managing the screen
with curses that you wanted to restore.

>
> Thank you very much for any hints you might offer.
>
>
>
>
>
> Restricting the clear to a smaller window doesn't work:
>
> #include <curses.h>
>
> int main()
> {
>     WINDOW *win;
>     WINDOW *w;
>
>     win = initscr();
>     keypad(stdscr, TRUE);
>     nonl();
>     cbreak();
>     noecho();
>
>     w = newwin(6, 40, 20, 20);
>     wprintw(w, "Hello World");
>     wrefresh(w);
>     sleep(1);
>
>     endwin();
>     return 0;
> }
>
>
>
> Calling clearok doesn't work:
>
> #include <curses.h>
>
> int main()
> {
>     WINDOW *win;
>
>     win = initscr();
>     keypad(stdscr, TRUE);
>     nonl();
>     cbreak();
>     noecho();
>
>     printw("Hello World");
>     clearok(win, 0);
>     refresh();
>     sleep(1);
>
>     endwin();
>     return 0;
> }
>
>
>
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-ncurses
>

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

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