bug-ncurses
[Top][All Lists]
Advanced

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

Re: Colors in copywin()/overlay()


From: Thomas Dickey
Subject: Re: Colors in copywin()/overlay()
Date: Wed, 7 Dec 2005 17:24:04 -0500 (EST)

On Wed, 7 Dec 2005, William McBrine wrote:

I noticed a difference in the way copywin() and its derivatives are handled by ncurses vs. PDCurses. When overlaying text, ncurses takes attributes like A_BOLD from the original window, but it takes the colors from the destination window. PDCurses takes all attributes, including colors, from the source window. (You can see this in the "testcurs" demo program.)

ncurses' behavior matches that of (at least) Solaris' and NetBSD's curses. However, the Single UNIX Specification, Version 2, seems to me to specify the behavior seen in PDCurses. It says:

I recall that PDCurses color model was supposed to be SVr3 - so there
might be some differences just from that.

The overwrite() function copies characters as though a sequence of
win_wch() and wadd_wch() were performed with the destination window's
attributes and background attributes cleared.

The overlay() function does the same thing, except that, whenever a
character to be copied is the background character of the source window,
overlay() does not copy the character but merely moves the destination
cursor the width of the source background character.

So, which is wrong: the spec, the implementations, or my understanding? :-)

The spec is flawed in several places since it was reworded from manpages by people who apparently had no specific expertise in the area. So I tend to look at existing implementations (more than one, of course), and weight the results with the spec. NetBSD is further downstream than ncurses - I don't know that it's been tested independently of ncurses. Solaris is (usually) better but none of the work was done by Sun - it was all inherited from AT&T. It's probably best to bring in a test-case that's run on Tru64 (which appears to have been independently developed by people who understood the spec ;-)

I don't have a test-program at hand. When we were thrashing out the behavior of background character, I wrote a test program to do addch's and read back the data. But I didn't do one for overlay(), myself.

short: the spec might be ambiguous but make sense in the light of other code.

(If no one submits a test program and results, this'll go on my to-do list)

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




reply via email to

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