Module Name:    src
Committed By:   joerg
Date:           Tue Jul  7 13:10:02 UTC 2009

Modified Files:
        src/lib/libcurses: chgat.c curses_chgat.3

Log Message:
Be strict on xcurses support:
- Do not perform wrapping at all by setting the line flags.
- Do not alter the cursor position, even for mv(w)chgat.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libcurses/chgat.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libcurses/curses_chgat.3

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/chgat.c
diff -u src/lib/libcurses/chgat.c:1.1 src/lib/libcurses/chgat.c:1.2
--- src/lib/libcurses/chgat.c:1.1	Mon Jul  6 15:19:49 2009
+++ src/lib/libcurses/chgat.c	Tue Jul  7 13:10:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: chgat.c,v 1.1 2009/07/06 15:19:49 joerg Exp $	*/
+/*	$NetBSD: chgat.c,v 1.2 2009/07/07 13:10:02 joerg Exp $	*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: chgat.c,v 1.1 2009/07/06 15:19:49 joerg Exp $");
+__RCSID("$NetBSD: chgat.c,v 1.2 2009/07/07 13:10:02 joerg Exp $");
 
 #include "curses.h"
 #include "curses_private.h"
@@ -49,49 +49,39 @@
 }
 
 int
-mvwchgat(WINDOW *win , int y, int x, int n, attr_t attr, short color,
-    const void *opts)
+wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts)
 {
-	if (wmove(win, y, x) == ERR)
-		return ERR;
-
-	return wchgat(win, n, attr, color, opts);
+	return mvwchgat(win, win->cury, win->curx, n, attr, color, opts);
 }
 
 int
-wchgat(WINDOW *win, int count, attr_t attr, short color, const void *opts)
+mvwchgat(WINDOW *win , int y, int x, int count, attr_t attr, short color,
+    const void *opts)
 {
 	__LINE *lp;
 	__LDATA *lc;
-	int newx;
 
 	attr = (attr & ~__COLOR) | COLOR_PAIR(color);
 
-	if (count < 0 || count > win->maxx - win->curx)
-		count = win->maxx - win->curx;
+	if (count < 0 || count > win->maxx - x)
+		count = win->maxx - x;
 
-	lp = win->lines[win->cury];
-	lc = &lp->line[win->curx];
-	newx = win->curx + win->ch_off;
-	win->curx += count;
-	if (win->curx == win->maxx) {
-		lp->flags |= __ISPASTEOL;
-		--win->curx;
-	}
+	lp = win->lines[y];
+	lc = &lp->line[x];
+
+	if (x + win->ch_off < *lp->firstchp)
+		*lp->firstchp = x + win->ch_off;
+	if (x + win->ch_off + count > *lp->lastchp)
+		*lp->lastchp = x + win->ch_off + count;
 
 	while (count-- > 0) {
 		lp->flags |= __ISDIRTY;
-		if (newx < *lp->firstchp)
-			*lp->firstchp = newx;
-		if (newx > *lp->lastchp)
-			*lp->lastchp = newx;
 #ifdef HAVE_WCHAR
 		lc->attr = (lc->attr & ~WA_ATTRIBUTES) | attr;
 #else
 		lc->attr = attr;
 #endif
 		++lc;
-		++newx;
 	}
 
 	return OK;

Index: src/lib/libcurses/curses_chgat.3
diff -u src/lib/libcurses/curses_chgat.3:1.2 src/lib/libcurses/curses_chgat.3:1.3
--- src/lib/libcurses/curses_chgat.3:1.2	Tue Jul  7 11:53:43 2009
+++ src/lib/libcurses/curses_chgat.3	Tue Jul  7 13:10:02 2009
@@ -81,12 +81,13 @@
 .Fn chgat
 and
 .Fn wchgat
-functions, respectively, excepting that
-.Fn wmove
-is called to mvoe the cursor to the position specified by
+functions, respectively, excepting that they operate from the position
+specified by
 .Fa y ,
-.Fa x
-before the attributes are changed.
+.Fa x .
+.Pp
+These functions do not perform wrapping. They do not update
+the cursor position.
 .Sh RETURN VALUES
 The functions that return an int will return one of the following
 values:

Reply via email to