summaryrefslogtreecommitdiff
path: root/lib/libcurses/base/lib_chgat.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcurses/base/lib_chgat.c')
-rw-r--r--lib/libcurses/base/lib_chgat.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/libcurses/base/lib_chgat.c b/lib/libcurses/base/lib_chgat.c
index d48c9aba297..5762785c207 100644
--- a/lib/libcurses/base/lib_chgat.c
+++ b/lib/libcurses/base/lib_chgat.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_chgat.c,v 1.2 2001/01/22 18:01:37 millert Exp $ */
+/* $OpenBSD: lib_chgat.c,v 1.3 2010/01/12 23:22:05 nicm Exp $ */
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -31,6 +31,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Sven Verdoolaege 2001 *
+ * and: Thomas E. Dickey 2005 *
****************************************************************************/
/*
@@ -42,22 +44,25 @@
#include <curses.priv.h>
-MODULE_ID("$From: lib_chgat.c,v 1.4 2000/12/10 02:43:26 tom Exp $")
+MODULE_ID("$Id: lib_chgat.c,v 1.3 2010/01/12 23:22:05 nicm Exp $")
NCURSES_EXPORT(int)
-wchgat
-(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED)
+wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED)
{
int i;
T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color));
if (win) {
+ struct ldat *line = &(win->_line[win->_cury]);
+
toggle_attr_on(attr, COLOR_PAIR(color));
- for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++)
- win->_line[win->_cury].text[i]
- = TextOf(win->_line[win->_cury].text[i]) | attr;
+ for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) {
+ SetAttr(line->text[i], attr);
+ SetPair(line->text[i], color);
+ CHANGED_CELL(line, i);
+ }
returnCode(OK);
} else