NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/23910 (libcurses: bug in redraw()?)
The following reply was made to PR lib/23910; it has been noted by GNATS.
From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: lib/23910 (libcurses: bug in redraw()?)
Date: Sun, 11 Nov 2018 03:07:25 +0300
I was wrong. The following program should demonstrate the bug. My
curses is rusty, so I might be missing something, so please double
check, but I get the expected result with ncurses.
With ncurses I get the screen filled with background color and the
left border painted white-on-red, with A and Z at the top and at the
bottom.
With our curses the A and Z are correct, but the rest of the left
border is not painted.
#include <curses.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main()
{
const char *errmsg = NULL;
int err;
#define CHECKERR(_msg) \
do { \
if (err != OK) { \
errmsg = _msg " failed"; \
goto out; \
} \
} while (0)
WINDOW *scrw = initscr();
if (scrw == NULL)
errx(EXIT_FAILURE, "initscr failed\n");
if (!has_colors()) {
errmsg = "no colors";
goto out;
}
err = start_color();
CHECKERR("start_color");
err = init_pair(2, COLOR_WHITE, COLOR_RED);
CHECKERR("init_pair");
int maxy, maxx;
getmaxyx(stdscr, maxy, maxx);
WINDOW *lborder = newwin(maxy - 1, 1, 0, 0);
if (lborder == NULL) {
errmsg = "newwin failed";
goto out;
}
wbkgdset(lborder, COLOR_PAIR(2));
werase(lborder);
mvwaddstr(lborder, 0, 0, "A");
mvwaddstr(lborder, maxy - 2, 0, "Z");
wnoutrefresh(stdscr);
wnoutrefresh(lborder);
doupdate();
sleep(5);
out:
endwin();
if (err != OK) {
if (errmsg == NULL)
errmsg = "unknown error";
fprintf(stderr, "%s\n", errmsg);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
-uwe
Home |
Main Index |
Thread Index |
Old Index