bug-ncurses
[Top][All Lists]
Advanced

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

Bug in refresh() ? :(


From: Yonglin ma
Subject: Bug in refresh() ? :(
Date: Thu, 30 Aug 2001 03:23:07 -0700 (PDT)

Linux 7.1
curses 5.2

Here is the sample program 15-4.c from <<Linux
Programing Bible>>.

#include <curses.h>

int main(void)
{
        initscr(); cbreak(); noecho();
        start_color();
        clear();
        
        if(!has_colors())
        {
                printw("I'm sorry, but your terminal does not allow
color changes.\n");
                doexit(255);
        }
        
        init_pair(1, COLOR_RED, COLOR_BLACK);
        attrset(COLOR_PAIR(1));
        printw("Here's something in a nice red. Maybe useful
for a warning\n");
        printw("message.\n\n");

        attrset(COLOR_PAIR(0));
        printw("Press any key to watch what happens when a
pair is redefined.\n");
        refresh();
        getch();

        init_pair(1, COLOR_GREEN, COLOR_BLACK);
        attrset(COLOR_PAIR(1));
        printw("Notice the existing text printed to the
screen with this\n");
        printw("pair is not modified, but this new text has
the new color.\n");
        
        attrset(A_NORMAL);

        doexit(0);
}


But the program doesn't run as expected! the existing
text with COLOR_PAIR(1) modified (repaint with the new
color)!

Anyone can provide any infomation ?
thank you.


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com



reply via email to

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