Revert most of rev 1.27 of addbytes.c and associated changes.

Posix requires that adding '\n' does clrtoeol() and 'x = 0'.
(Making "\r\n" erase the text that has just been displayed.)
Remove __NONL test from addbytes, __NONL is a property of the output device.
This commit is contained in:
dsl 2003-08-10 07:37:11 +00:00
parent 792f9a7f05
commit b176defcde
3 changed files with 12 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: addbytes.c,v 1.28 2003/08/07 16:44:18 agc Exp $ */
/* $NetBSD: addbytes.c,v 1.29 2003/08/10 07:37:11 dsl Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addbytes.c,v 1.28 2003/08/07 16:44:18 agc Exp $");
__RCSID("$NetBSD: addbytes.c,v 1.29 2003/08/10 07:37:11 dsl Exp $");
#endif
#endif /* not lint */
@ -135,9 +135,9 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
#endif
if (lp->flags & __ISPASTEOL) {
x = 0;
newline:
lp->flags &= ~(__ISPASTEOL | __ISAFTERCR);
x = 0;
lp->flags &= ~__ISPASTEOL;
if (y == win->scr_b) {
#ifdef DEBUG
__CTRACE("ADDBYTES - on bottom "
@ -204,29 +204,18 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
#endif
break;
case '\n':
if (!(lp->flags & (__ISPASTEOL | __ISAFTERCR))) {
SYNCH_OUT;
wclrtoeol(win);
SYNCH_IN;
}
if (!__NONL)
x = 0;
SYNCH_OUT;
wclrtoeol(win);
SYNCH_IN;
goto newline;
case '\r':
if (!(lp->flags & __ISAFTERCR)) {
SYNCH_OUT;
wclrtoeol(win);
SYNCH_IN;
}
x = 0;
lp->flags |= __ISAFTERCR;
continue;
case '\b':
if (--x < 0)
x = 0;
break;
}
lp->flags &= ~__ISAFTERCR;
}
SYNCH_OUT;

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses_private.h,v 1.33 2003/07/31 10:36:00 dsl Exp $ */
/* $NetBSD: curses_private.h,v 1.34 2003/08/10 07:37:11 dsl Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@ -87,7 +87,6 @@ struct __line {
#endif
#define __ISDIRTY 0x01 /* Line is dirty. */
#define __ISPASTEOL 0x02 /* Cursor is past end of line */
#define __ISAFTERCR 0x04 /* Last char was <cr> */
unsigned int flags;
unsigned int hash; /* Hash value for the line. */
int *firstchp, *lastchp; /* First and last chngd columns ptrs */

View File

@ -1,4 +1,4 @@
/* $NetBSD: move.c,v 1.13 2003/08/07 16:44:22 agc Exp $ */
/* $NetBSD: move.c,v 1.14 2003/08/10 07:37:11 dsl Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: move.c,v 1.13 2003/08/07 16:44:22 agc Exp $");
__RCSID("$NetBSD: move.c,v 1.14 2003/08/10 07:37:11 dsl Exp $");
#endif
#endif /* not lint */
@ -70,8 +70,8 @@ wmove(WINDOW *win, int y, int x)
if (x >= win->maxx || y >= win->maxy)
return (ERR);
win->curx = x;
win->lines[win->cury]->flags &= ~(__ISPASTEOL | __ISAFTERCR);
win->lines[win->cury]->flags &= ~__ISPASTEOL;
win->cury = y;
win->lines[y]->flags &= ~(__ISPASTEOL | __ISAFTERCR);
win->lines[y]->flags &= ~__ISPASTEOL;
return (OK);
}