Module Name:    src
Committed By:   jdc
Date:           Tue Oct  6 20:03:27 UTC 2009

Modified Files:
        src/lib/libcurses: inch.c

Log Message:
Return the same information whether or not we have wide characters.
Problem pointed out by Rhialto on current-users.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libcurses/inch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcurses/inch.c
diff -u src/lib/libcurses/inch.c:1.9 src/lib/libcurses/inch.c:1.10
--- src/lib/libcurses/inch.c:1.9	Wed Jul 22 16:57:14 2009
+++ src/lib/libcurses/inch.c	Tue Oct  6 20:03:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: inch.c,v 1.9 2009/07/22 16:57:14 roy Exp $	*/
+/*	$NetBSD: inch.c,v 1.10 2009/10/06 20:03:27 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: inch.c,v 1.9 2009/07/22 16:57:14 roy Exp $");
+__RCSID("$NetBSD: inch.c,v 1.10 2009/10/06 20:03:27 jdc Exp $");
 #endif				/* not lint */
 
 #include "curses.h"
@@ -81,13 +81,14 @@
 chtype
 winch(WINDOW *win)
 {
-#ifndef HAVE_WCHAR
-	chtype	 ch;
+	chtype	ch;
+	attr_t	attr;
 
-	ch = (chtype) (((win)->alines[(win)->cury]->line[(win)->curx].ch & __CHARTEXT) |
-	  (chtype) ((win)->alines[(win)->cury]->line[(win)->curx].attr & __ATTRIBUTES));
-	return (ch);
-#else
-	return ( chtype )win->alines[ win->cury ]->line[ win->curx ].ch;
-#endif /* HAVE_WCHAR */
+	ch = (chtype) ((win)->alines[(win)->cury]->line[(win)->curx].ch &
+	    __CHARTEXT);
+	attr = (attr_t) ((win)->alines[(win)->cury]->line[(win)->curx].attr &
+	    __ATTRIBUTES);
+	if (__using_color && ((attr & __COLOR) == __default_color))
+		attr &= ~__default_color;
+	return (ch | attr);
 }

Reply via email to