Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcurses whline_set - save/restore the y coordinate too.



details:   https://anonhg.NetBSD.org/src/rev/bd3b71752631
branches:  trunk
changeset: 973431:bd3b71752631
user:      uwe <uwe%NetBSD.org@localhost>
date:      Tue Jun 30 21:02:24 2020 +0000

description:
whline_set - save/restore the y coordinate too.
Reaching the right side of the screen can cause a line wrap.
PR lib/55434

diffstat:

 lib/libcurses/line.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 2100a9a4d433 -r bd3b71752631 lib/libcurses/line.c
--- a/lib/libcurses/line.c      Tue Jun 30 20:32:10 2020 +0000
+++ b/lib/libcurses/line.c      Tue Jun 30 21:02:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: line.c,v 1.11 2019/06/09 07:40:14 blymn Exp $  */
+/*     $NetBSD: line.c,v 1.12 2020/06/30 21:02:24 uwe Exp $    */
 
 /*-
  * Copyright (c) 1998-1999 Brett Lymn
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: line.c,v 1.11 2019/06/09 07:40:14 blymn Exp $");
+__RCSID("$NetBSD: line.c,v 1.12 2020/06/30 21:02:24 uwe Exp $");
 #endif                         /* not lint */
 
 #include <string.h>
@@ -220,7 +220,7 @@
 #ifndef HAVE_WCHAR
        return ERR;
 #else
-       int ocurx, wcn, i, cw;
+       int ocury, ocurx, wcn, i, cw;
        cchar_t cc;
 
        cw = wcwidth( wch->vals[ 0 ]);
@@ -232,6 +232,7 @@
 #ifdef DEBUG
        __CTRACE(__CTRACE_LINE, "whline_set: line of %d\n", wcn);
 #endif /* DEBUG */
+       ocury = win->cury;
        ocurx = win->curx;
 
        memcpy( &cc, wch, sizeof( cchar_t ));
@@ -240,12 +241,12 @@
        for (i = 0; i < wcn; i++ ) {
 #ifdef DEBUG
                __CTRACE(__CTRACE_LINE, "whline_set: (%d,%d)\n",
-                  win->cury, ocurx + i * cw);
+                  ocury, ocurx + i * cw);
 #endif /* DEBUG */
-               mvwadd_wch(win, win->cury, ocurx + i * cw, &cc);
+               mvwadd_wch(win, ocury, ocurx + i * cw, &cc);
        }
 
-       wmove(win, win->cury, ocurx);
+       wmove(win, ocury, ocurx);
        __sync(win);
        return OK;
 #endif /* HAVE_WCHAR */



Home | Main Index | Thread Index | Old Index