Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Test for __ISPASTEOL when moving the cursor an...



details:   https://anonhg.NetBSD.org/src/rev/6173cba93dd6
branches:  trunk
changeset: 820463:6173cba93dd6
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Jan 10 09:32:01 2017 +0000

description:
Test for __ISPASTEOL when moving the cursor and it hasn't moved.
Unset __ISPASTEOL when moving the cursor during refresh.

diffstat:

 lib/libcurses/refresh.c |  47 +++++++++++++++++++++++++++++------------------
 1 files changed, 29 insertions(+), 18 deletions(-)

diffs (132 lines):

diff -r 262256fa430f -r 6173cba93dd6 lib/libcurses/refresh.c
--- a/lib/libcurses/refresh.c   Tue Jan 10 08:57:39 2017 +0000
+++ b/lib/libcurses/refresh.c   Tue Jan 10 09:32:01 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: refresh.c,v 1.83 2017/01/06 13:53:18 roy Exp $ */
+/*     $NetBSD: refresh.c,v 1.84 2017/01/10 09:32:01 roy Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c  8.7 (Berkeley) 8/13/94";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.83 2017/01/06 13:53:18 roy Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.84 2017/01/10 09:32:01 roy Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -45,7 +45,7 @@
 #include "curses.h"
 #include "curses_private.h"
 
-static void    domvcur(int, int, int, int);
+static void    domvcur(const WINDOW *, int, int, int, int);
 static int     makech(int);
 static void    quickch(void);
 static void    scrolln(int, int, int, int, int);
@@ -668,9 +668,7 @@
 #endif /* DEBUG */
                if (!_cursesi_screen->curwin)
                        curscr->alines[wy]->hash = wlp->hash;
-               if ((wlp->flags & __ISDIRTY) ||
-                   (wlp->flags & __ISFORCED))
-               {
+               if (wlp->flags & __ISDIRTY || wlp->flags & __ISFORCED) {
 #ifdef DEBUG
                        __CTRACE(__CTRACE_REFRESH,
                            "doupdate: [ISDIRTY]wy:%d\tf:%d\tl:%d\n", wy,
@@ -722,14 +720,14 @@
 #endif /* DEBUG */
 
        if (_cursesi_screen->curwin)
-               domvcur(_cursesi_screen->ly, _cursesi_screen->lx,
+               domvcur(win, _cursesi_screen->ly, _cursesi_screen->lx,
                        win->cury, win->curx);
        else {
                if (win->flags & __LEAVEOK) {
                        curscr->cury = _cursesi_screen->ly;
                        curscr->curx = _cursesi_screen->lx;
                } else {
-                       domvcur(_cursesi_screen->ly, _cursesi_screen->lx,
+                       domvcur(win, _cursesi_screen->ly, _cursesi_screen->lx,
                                win->cury, win->curx);
                        curscr->cury = win->cury;
                        curscr->curx = win->curx;
@@ -823,7 +821,7 @@
 #endif /* DEBUG */
        /* Is the cursor still on the end of the last line? */
        if (wy > 0 && curscr->alines[wy - 1]->flags & __ISPASTEOL) {
-               domvcur(_cursesi_screen->ly, _cursesi_screen->lx,
+               domvcur(win, _cursesi_screen->ly, _cursesi_screen->lx,
                        _cursesi_screen->ly + 1, 0);
                _cursesi_screen->ly++;
                _cursesi_screen->lx = 0;
@@ -931,7 +929,7 @@
                        break;
                }
 #endif /* HAVE_WCHAR */
-               domvcur(_cursesi_screen->ly, _cursesi_screen->lx, wy, wx);
+               domvcur(win, _cursesi_screen->ly, _cursesi_screen->lx, wy, wx);
 
 #ifdef DEBUG
                __CTRACE(__CTRACE_REFRESH, "makech: 1: wx = %d, ly= %d, "
@@ -1238,9 +1236,10 @@
 #endif /* HAVE_WCHAR */
                                        }
                                        if (wx < curscr->maxx) {
-                                               domvcur(_cursesi_screen->ly, wx,
-                                                   (int) (win->maxy - 1),
-                                                   (int) (win->maxx - 1));
+                                               domvcur(win,
+                                                   _cursesi_screen->ly, wx,
+                                                   (int)(win->maxy - 1),
+                                                   (int)(win->maxx - 1));
                                        }
                                        _cursesi_screen->ly = win->maxy - 1;
                                        _cursesi_screen->lx = win->maxx - 1;
@@ -1297,10 +1296,11 @@
                        _cursesi_screen->lx = COLS - 1;
                else
                        if (wx >= win->maxx) {
-                               domvcur(_cursesi_screen->ly,
+                               domvcur(win,
+                                       _cursesi_screen->ly,
                                        _cursesi_screen->lx,
                                        _cursesi_screen->ly,
-                                       (int) (win->maxx - 1));
+                                       (int)(win->maxx - 1));
                                _cursesi_screen->lx = win->maxx - 1;
                        }
 #ifdef DEBUG
@@ -1340,16 +1340,27 @@
  *     Do a mvcur, leaving attributes if necessary.
  */
 static void
-domvcur(int oy, int ox, int ny, int nx)
+domvcur(const WINDOW *win, int oy, int ox, int ny, int nx)
 {
 
 #ifdef DEBUG
        __CTRACE(__CTRACE_REFRESH, "domvcur: (%x,%d)=>(%d,%d)\n",
            oy, ox, ny, nx );
 #endif /* DEBUG */
+
        __unsetattr(1);
-       if ( oy == ny && ox == nx )
-               return;
+
+       /* Don't move the cursor unless we need to. */
+       if (oy == ny && ox == nx) {
+               /* Check EOL. */
+               if (!(win->alines[oy]->flags & __ISPASTEOL))
+                       return;
+       }
+
+       /* Clear EOL flags. */
+       win->alines[oy]->flags &= ~__ISPASTEOL;
+       win->alines[ny]->flags &= ~__ISPASTEOL;
+
        __mvcur(oy, ox, ny, nx, 1);
 }
 



Home | Main Index | Thread Index | Old Index