unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54607: ncurses attrset colour pair ignored in favour of bkgd
@ 2022-03-28 12:00 Roman Riabenko
  2022-03-29 12:29 ` Liliana Marie Prikler
  0 siblings, 1 reply; 4+ messages in thread
From: Roman Riabenko @ 2022-03-28 12:00 UTC (permalink / raw)
  To: 54607

[-- Attachment #1: Type: text/plain, Size: 1709 bytes --]

Hello

With ncurses, the "attrset" colour pair is ignored when the background
colour pair is set with "bkgd".

I ran into this issue when compiling robotfindskitten, but it is not
specific to that program and can be reproduced with the attached small
test code. When compiled with "gcc test.c -lncurses", "./a.out" is
expected to display the sample text in yellow (the brownish curses
equivalent of yellow), which is set with "attrset". It does so when
compiled as usual without guix. If compiled in guix, the sample text is
blue instead, which is set with "bkgd" for background and for some
reason is not overridden by "attrset". If the "bkgd" line is removed,
"attrset" works as usual.

This affects software compiled in a guix shell (guix environment), or
on a guix system, or with "guix build" and "guix install".

It does not seem to be caused by the terminal properties or environment
variables because it can be reproduced on the same Debian machine after
compiling (1) with guix (in a guix environment) and (2) without guix.

I tried compiling with guix having ncurses 6.2.20210619 (current guix)
and 6.2.20200212 (from the older guix image from the website and in
Debian bullseye). I tried compiling without guix on Debian with
development packages for ncurses 6.2+20201114-2 (bullseye) and 6.3-2
(bookworm) and on Fedora with its development package for ncurses
6.2.20210508.

I was pointed in a forum to "render_char" function in lib_addch.c, [1]
which defines how colour is applied. But there seem to be no
modifications to that in guix as far as I can see.

[1]:
https://github.com/ThomasDickey/ncurses-snapshots/blob/6b3112c16ee04882a512f9aa967e34dba5e362e1/ncurses/base/lib_addch.c#L57

Roman

[-- Attachment #2: test.c --]
[-- Type: text/x-csrc, Size: 289 bytes --]

#include <ncurses.h>

int main() {
       	initscr();
	start_color();
	init_pair ( 1, COLOR_BLUE, COLOR_BLACK );
	init_pair ( 2, COLOR_YELLOW, COLOR_BLACK );
	bkgd ( (chtype) COLOR_PAIR(1) );
	attrset ( COLOR_PAIR(2) );
	printw ( "NO WAR!" );
	refresh();
	getch();
	endwin();
	return 0;
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-07 12:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 12:00 bug#54607: ncurses attrset colour pair ignored in favour of bkgd Roman Riabenko
2022-03-29 12:29 ` Liliana Marie Prikler
2022-04-07 12:50   ` Roman Riabenko
2022-04-07 12:52     ` Liliana Marie Prikler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).