Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses Fix color pair handling. color_pair argument ...
details: https://anonhg.NetBSD.org/src/rev/7d797ec127f1
branches: trunk
changeset: 446020:7d797ec127f1
user: uwe <uwe%NetBSD.org@localhost>
date: Tue Nov 20 17:48:19 2018 +0000
description:
Fix color pair handling. color_pair argument is a pair number.
diffstat:
lib/libcurses/cchar.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r 120c1baf9d90 -r 7d797ec127f1 lib/libcurses/cchar.c
--- a/lib/libcurses/cchar.c Tue Nov 20 15:16:43 2018 +0000
+++ b/lib/libcurses/cchar.c Tue Nov 20 17:48:19 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cchar.c,v 1.6 2017/01/06 13:53:18 roy Exp $ */
+/* $NetBSD: cchar.c,v 1.7 2018/11/20 17:48:19 uwe Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: cchar.c,v 1.6 2017/01/06 13:53:18 roy Exp $");
+__RCSID("$NetBSD: cchar.c,v 1.7 2018/11/20 17:48:19 uwe Exp $");
#endif /* not lint */
#include <string.h>
@@ -70,7 +70,10 @@
return ERR;
if (len > 0) {
*attrs = wcval->attributes;
- *color_pair = COLOR_PAIR(wcval ->attributes);
+ if (__using_color)
+ *color_pair = PAIR_NUMBER(wcval->attributes);
+ else
+ *color_pair = 0;
wmemcpy(wch, wcval->vals, (unsigned)len);
wch[len] = L'\0';
}
@@ -110,7 +113,9 @@
memset(wcval, 0, sizeof(*wcval));
if (len != 0) {
- wcval->attributes = attrs | color_pair;
+ wcval->attributes = attrs & ~__COLOR;
+ if (__using_color && color_pair)
+ wcval->attributes |= COLOR_PAIR(color_pair);
wcval->elements = 1;
memcpy(&wcval->vals, wch, len * sizeof(wchar_t));
}
Home |
Main Index |
Thread Index |
Old Index