Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses Fix _cursesi_addwchar so that it performs line...
details: https://anonhg.NetBSD.org/src/rev/01dd627edfdd
branches: trunk
changeset: 456524:01dd627edfdd
user: blymn <blymn%NetBSD.org@localhost>
date: Sun May 12 02:29:00 2019 +0000
description:
Fix _cursesi_addwchar so that it performs line wrap. SUSv2 says
add_wch line wraps and updates position. Since wrap is done we are
not past EOL.
diffstat:
lib/libcurses/addbytes.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
diffs (66 lines):
diff -r 515dbaf1850d -r 01dd627edfdd lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c Sun May 12 02:19:23 2019 +0000
+++ b/lib/libcurses/addbytes.c Sun May 12 02:29:00 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: addbytes.c,v 1.49 2018/11/15 03:17:51 uwe Exp $ */
+/* $NetBSD: addbytes.c,v 1.50 2019/05/12 02:29:00 blymn 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.49 2018/11/15 03:17:51 uwe Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.50 2019/05/12 02:29:00 blymn Exp $");
#endif
#endif /* not lint */
@@ -564,6 +564,7 @@
lp->nsp);
__CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: add rest columns (%d:%d)\n",
sx + 1, sx + cw - 1);
+ __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: *x = %d, win->maxx = %d\n", *x, win->maxx);
#endif /* DEBUG */
for (tp = lp + 1, *x = sx + 1; *x - sx <= cw - 1; tp++, (*x)++) {
if (tp->nsp) {
@@ -577,12 +578,27 @@
}
if (*x == win->maxx) {
- (*lnp)->flags |= __ISPASTEOL;
+#ifdef DEBUG
+ __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: do line wrap\n");
+#endif /* DEBUG */
newx = win->maxx - 1 + win->ch_off;
if (newx > *(*lnp)->lastchp)
*(*lnp)->lastchp = newx;
__touchline(win, *y, sx, (int) win->maxx - 1);
- *x = win->curx = sx;
+ *x = sx = 0;
+ if (*y == win->scr_b) {
+ if (!(win->flags & __SCROLLOK))
+ return ERR;
+ PSYNCH_OUT;
+ scroll(win);
+ PSYNCH_IN;
+ } else {
+ (*y)++;
+ }
+ lp = &win->alines[*y]->line[0];
+ (*lnp) = win->alines[*y];
+ win->curx = *x;
+ win->cury = *y;
} else {
win->curx = *x;
@@ -612,7 +628,8 @@
}
#ifdef DEBUG
- __CTRACE(__CTRACE_INPUT, "add_wch: %d : 0x%x\n", lp->ch, lp->attr);
+ __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: %d : 0x%x\n", lp->ch, lp->attr);
+ __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: *x = %d, *y = %d, win->maxx = %d\n", *x, *y, win->maxx);
#endif /* DEBUG */
__sync(win);
return OK;
Home |
Main Index |
Thread Index |
Old Index