Back out incorrect fix for PR 53617 and fix it in a different way.

Keep track of the cursor location, if getch is called without a refresh
and without pending updates (dirty windows) then move the cursor to the
correct location directly.  Doing this prevents unnecessary refreshes.
This commit is contained in:
blymn 2019-05-20 22:17:41 +00:00
parent 147918d081
commit e2cfd49c61
34 changed files with 205 additions and 149 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: add_wch.c,v 1.7 2019/04/24 07:09:44 blymn Exp $ */
/* $NetBSD: add_wch.c,v 1.8 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: add_wch.c,v 1.7 2019/04/24 07:09:44 blymn Exp $");
__RCSID("$NetBSD: add_wch.c,v 1.8 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -76,7 +76,7 @@ mvadd_wch(int y, int x, const cchar_t *wch)
int
mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wadd_wch(win, wch);
@ -92,11 +92,12 @@ mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch)
int
wadd_wch(WINDOW *win, const cchar_t *wch)
{
int x = win->curx, y = win->cury;
int y = win->cury;
__LINE *lnp = NULL;
#ifdef DEBUG
int i;
int x = win->curx;
for (i = 0; i < win->maxy; i++) {
assert(win->alines[i]->sentinel == SENTINEL_VALUE);
@ -105,5 +106,5 @@ wadd_wch(WINDOW *win, const cchar_t *wch)
win, x, y);
#endif
lnp = win->alines[y];
return _cursesi_addwchar(win, &lnp, &y, &x, wch, 1);
return _cursesi_addwchar(win, &lnp, &(win->cury), &(win->curx), wch, 1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: add_wchstr.c,v 1.6 2018/11/22 22:16:45 uwe Exp $ */
/* $NetBSD: add_wchstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: add_wchstr.c,v 1.6 2018/11/22 22:16:45 uwe Exp $");
__RCSID("$NetBSD: add_wchstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -120,7 +120,7 @@ mvadd_wchnstr(int y, int x, const cchar_t *wchstr, int n)
int
mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wchstr, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wadd_wchnstr(win, wchstr, n);

View File

@ -1,4 +1,4 @@
/* $NetBSD: addbytes.c,v 1.50 2019/05/12 02:29:00 blymn Exp $ */
/* $NetBSD: addbytes.c,v 1.51 2019/05/20 22:17:41 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.50 2019/05/12 02:29:00 blymn Exp $");
__RCSID("$NetBSD: addbytes.c,v 1.51 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -47,9 +47,9 @@ __RCSID("$NetBSD: addbytes.c,v 1.50 2019/05/12 02:29:00 blymn Exp $");
#endif
#define SYNCH_IN {y = win->cury; x = win->curx;}
#define SYNCH_OUT {win->cury = y; win->curx = x;}
#define SYNCH_OUT {win->cury = y; win->curx = x; win->ocury = y; win->ocurx = x;}
#define PSYNCH_IN {*y = win->cury; *x = win->curx;}
#define PSYNCH_OUT {win->cury = *y; win->curx = *x;}
#define PSYNCH_OUT {win->cury = *y; win->curx = *x; win->ocury = *y; win->ocurx = *x;}
#ifndef _CURSES_USE_MACROS
@ -94,7 +94,7 @@ int
mvwaddbytes(WINDOW *win, int y, int x, const char *bytes, int count)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return _cursesi_waddbytes(win, bytes, count, 0, 1);
@ -241,12 +241,14 @@ _cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c,
case '\r':
*x = 0;
win->curx = *x;
win->ocurx = *x;
return OK;
case '\b':
if (--(*x) < 0)
*x = 0;
win->curx = *x;
win->ocurx = *x;
return OK;
}
}
@ -362,10 +364,12 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
if (--*x < 0)
*x = 0;
win->curx = *x;
win->ocurx = *x;
return OK;
case L'\r':
*x = 0;
win->curx = *x;
win->ocurx = *x;
return OK;
case L'\n':
wclrtoeol(win);
@ -508,6 +512,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
(*lnp) = win->alines[*y];
}
win->cury = *y;
win->ocury = *y;
/* add spacing character */
#ifdef DEBUG
@ -597,10 +602,11 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
}
lp = &win->alines[*y]->line[0];
(*lnp) = win->alines[*y];
win->curx = *x;
win->cury = *y;
win->curx = win->ocurx = *x;
win->cury = win->ocury = *y;
} else {
win->curx = *x;
win->ocurx = *x;
/* clear the remining of the current characer */
if (*x && *x < win->maxx) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: addch.c,v 1.19 2018/10/29 01:19:54 uwe Exp $ */
/* $NetBSD: addch.c,v 1.20 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)addch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addch.c,v 1.19 2018/10/29 01:19:54 uwe Exp $");
__RCSID("$NetBSD: addch.c,v 1.20 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -74,7 +74,7 @@ int
mvwaddch(WINDOW *win, int y, int x, chtype ch)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return waddch(win, ch);

View File

@ -1,4 +1,4 @@
/* $NetBSD: addchnstr.c,v 1.6 2013/11/09 11:16:59 blymn Exp $ */
/* $NetBSD: addchnstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: addchnstr.c,v 1.6 2013/11/09 11:16:59 blymn Exp $");
__RCSID("$NetBSD: addchnstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -111,7 +111,7 @@ mvaddchnstr(int y, int x, const chtype *chstr, int n)
int
mvwaddchnstr(WINDOW *win, int y, int x, const chtype *chstr, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return waddchnstr(win, chstr, n);
@ -180,6 +180,6 @@ waddchnstr(WINDOW *win, const chtype *chstr, int n)
*cp = '\0';
ret = _cursesi_waddbytes(win, start, i, attr, 0);
free(ocp);
wmove(win, oy, ox);
_cursesi_wmove(win, oy, ox, 1);
return ret;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: addnstr.c,v 1.15 2017/01/06 13:53:18 roy Exp $ */
/* $NetBSD: addnstr.c,v 1.16 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)addnstr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addnstr.c,v 1.15 2017/01/06 13:53:18 roy Exp $");
__RCSID("$NetBSD: addnstr.c,v 1.16 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -115,7 +115,7 @@ mvaddnstr(int y, int x, const char *str, int count)
int
mvwaddnstr(WINDOW *win, int y, int x, const char *str, int count)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return waddnstr(win, str, count);

View File

@ -1,4 +1,4 @@
/* $NetBSD: addwstr.c,v 1.4 2018/11/22 22:16:45 uwe Exp $ */
/* $NetBSD: addwstr.c,v 1.5 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: addwstr.c,v 1.4 2018/11/22 22:16:45 uwe Exp $");
__RCSID("$NetBSD: addwstr.c,v 1.5 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <string.h>
@ -114,7 +114,7 @@ mvaddnwstr(int y, int x, const wchar_t *str, int count)
int
mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *str, int count)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return waddnwstr(win, str, count);

View File

@ -1,4 +1,4 @@
/* $NetBSD: copywin.c,v 1.17 2017/01/06 13:53:18 roy Exp $ */
/* $NetBSD: copywin.c,v 1.18 2019/05/20 22:17:41 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: copywin.c,v 1.17 2017/01/06 13:53:18 roy Exp $");
__RCSID("$NetBSD: copywin.c,v 1.18 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <ctype.h>
@ -119,7 +119,7 @@ int copywin(const WINDOW *srcwin, WINDOW *dstwin,
* background character
*/
if ((dooverlay && !isspace(sp->ch)) || !dooverlay) {
wmove(dstwin, dminrow, dcol);
_cursesi_wmove(dstwin, dminrow, dcol, 0);
#ifdef DEBUG
__CTRACE(__CTRACE_WINDOW, "copywin: dcol = %d\n", dcol);
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: cr_put.c,v 1.33 2017/03/20 18:19:34 christos Exp $ */
/* $NetBSD: cr_put.c,v 1.34 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cr_put.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: cr_put.c,v 1.33 2017/03/20 18:19:34 christos Exp $");
__RCSID("$NetBSD: cr_put.c,v 1.34 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -75,7 +75,7 @@ __mvcur(int ly, int lx, int y, int x, int in_refresh)
{
#ifdef DEBUG
__CTRACE(__CTRACE_OUTPUT,
"mvcur: moving cursor from (%d, %d) to (%d, %d)\n", ly, lx, y, x);
"mvcur: moving cursor from (%d, %d) to (%d, %d) in refresh %d\n", ly, lx, y, x, in_refresh);
#endif
destcol = x;
destline = y;

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses_private.h,v 1.69 2019/04/01 11:39:15 roy Exp $ */
/* $NetBSD: curses_private.h,v 1.70 2019/05/20 22:17:41 blymn Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@ -111,6 +111,7 @@ struct __window { /* Window structure. */
struct __window *nextp, *orig; /* Subwindows list and parent. */
int begy, begx; /* Window home. */
int cury, curx; /* Current x, y coordinates. */
int ocury, ocurx; /* Previous x, y coordinates. */
int maxy, maxx; /* Maximum values for curx, cury. */
int reqy, reqx; /* Size requested when created */
int ch_off; /* x offset for firstch/lastch. */
@ -351,6 +352,7 @@ void _cursesi_reset_wacs(SCREEN *);
#endif /* HAVE_WCHAR */
void _cursesi_resetterm(SCREEN *);
int _cursesi_setterm(char *, SCREEN *);
int _cursesi_wmove(WINDOW *, int, int, int);
int __delay(void);
unsigned int __hash_more(const void *, size_t, unsigned int);
#define __hash(s, len) __hash_more((s), (len), 0u)

View File

@ -1,4 +1,4 @@
/* $NetBSD: delch.c,v 1.24 2017/01/06 13:53:18 roy Exp $ */
/* $NetBSD: delch.c,v 1.25 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)delch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: delch.c,v 1.24 2017/01/06 13:53:18 roy Exp $");
__RCSID("$NetBSD: delch.c,v 1.25 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -72,7 +72,7 @@ mvdelch(int y, int x)
int
mvwdelch(WINDOW *win, int y, int x)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wdelch(win);

View File

@ -1,4 +1,4 @@
/* $NetBSD: erase.c,v 1.26 2017/01/06 13:53:18 roy Exp $ */
/* $NetBSD: erase.c,v 1.27 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)erase.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: erase.c,v 1.26 2017/01/06 13:53:18 roy Exp $");
__RCSID("$NetBSD: erase.c,v 1.27 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -105,6 +105,6 @@ werase(WINDOW *win)
* windows - this will result in the (intended) clearing of the
* screen over the area covered by the window. */
__touchwin(win);
wmove(win, 0, 0);
_cursesi_wmove(win, 0, 0, 0);
return OK;
}

View File

@ -1,6 +1,6 @@
/*
* Do not edit! Automatically generated file:
* from: NetBSD: shlib_version,v 1.42 2017/01/02 12:38:16 roy Exp
* from: NetBSD: shlib_version,v 1.43 2018/11/16 10:12:00 blymn Exp
* by : NetBSD: genfileioh.awk,v 1.2 2008/05/02 11:13:02 martin Exp
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: get_wch.c,v 1.21 2019/03/14 00:36:06 rin Exp $ */
/* $NetBSD: get_wch.c,v 1.22 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: get_wch.c,v 1.21 2019/03/14 00:36:06 rin Exp $");
__RCSID("$NetBSD: get_wch.c,v 1.22 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <errno.h>
@ -473,7 +473,7 @@ mvget_wch(int y, int x, wint_t *ch)
int
mvwget_wch(WINDOW *win, int y, int x, wint_t *ch)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wget_wch(win, ch);
@ -608,7 +608,7 @@ wget_wch(WINDOW *win, wint_t *ch)
( inp == KEY_DC ||
inp == KEY_BACKSPACE ||
inp == KEY_LEFT )) {
wmove( win, win->cury, win->curx - 1 );
_cursesi_wmove( win, win->cury, win->curx - 1, 0 );
wdelch( win );
}
} else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: get_wstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $ */
/* $NetBSD: get_wstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: get_wstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $");
__RCSID("$NetBSD: get_wstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include "curses.h"
@ -98,7 +98,7 @@ mvget_wstr(int y, int x, wchar_t *wstr)
int
mvwgetn_wstr(WINDOW *win, int y, int x, wchar_t *wstr, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wgetn_wstr(win, wstr, n);
@ -113,7 +113,7 @@ __warn_references(mvget_wstr,
int
mvwget_wstr(WINDOW *win, int y, int x, wchar_t *wstr)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wget_wstr(win, wstr);
@ -188,7 +188,7 @@ __wgetn_wstr(WINDOW *win, wchar_t *wstr, int n)
if ((wchar_t)wc == ec) {
mvwadd_wch(win, win->cury,
win->curx, &cc);
wmove(win, win->cury, win->curx - 1);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
}
if (wc == KEY_BACKSPACE || wc == KEY_LEFT) {
/* getch() displays the key sequence */
@ -196,7 +196,7 @@ __wgetn_wstr(WINDOW *win, wchar_t *wstr, int n)
win->curx - 1, &cc);
mvwadd_wch(win, win->cury,
win->curx - 2, &cc);
wmove(win, win->cury, win->curx - 1);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
}
wstr--;
if (n != -1) {
@ -208,7 +208,7 @@ __wgetn_wstr(WINDOW *win, wchar_t *wstr, int n)
/* getch() displays the other keys */
mvwadd_wch(win, win->cury,
win->curx - 1, &cc);
wmove(win, win->cury, oldx);
_cursesi_wmove(win, win->cury, oldx, 1);
}
} else if (wc == kc) {
*wstr = L'\0';
@ -219,29 +219,29 @@ __wgetn_wstr(WINDOW *win, wchar_t *wstr, int n)
while (wstr != ostr) {
mvwadd_wch(win, win->cury,
win->curx - 1, &cc);
wmove(win, win->cury, win->curx - 1);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
wstr--;
if (n != -1)
/* We're counting chars */
remain++;
}
mvwadd_wch(win, win->cury, win->curx - 1, &cc);
wmove(win, win->cury, win->curx - 1);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
} else
/* getch() displays the kill character */
mvwadd_wch( win, win->cury, oldx, &cc );
wmove(win, win->cury, oldx);
_cursesi_wmove(win, win->cury, oldx, 0);
} else if (wc >= KEY_MIN && wc <= KEY_MAX) {
/* get_wch() displays these characters */
mvwadd_wch( win, win->cury, win->curx - 1, &cc );
wmove(win, win->cury, win->curx - 1);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
} else {
if (remain) {
wstr++;
remain--;
} else {
mvwadd_wch(win, win->cury, win->curx - 1, &cc);
wmove(win, win->cury, win->curx - 1);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: getch.c,v 1.71 2019/03/14 00:36:06 rin Exp $ */
/* $NetBSD: getch.c,v 1.72 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: getch.c,v 1.71 2019/03/14 00:36:06 rin Exp $");
__RCSID("$NetBSD: getch.c,v 1.72 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -716,7 +716,7 @@ mvgetch(int y, int x)
int
mvwgetch(WINDOW *win, int y, int x)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wgetch(win);
@ -820,6 +820,28 @@ wgetch(WINDOW *win)
if (is_wintouched(win))
wrefresh(win);
else {
if ((win->ocury != win->cury) || (win->ocurx != win->curx)) {
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT, "wgetch: ocury %d cury %d ocurx %d curx %d\n",
win->ocury, win->cury, win->ocurx, win->curx);
#endif
/*
* Just in case the window is not dirty but the
* cursor was moved, check and update the
* cursor location.
*/
mvcur(win->ocury + win->begy, win->ocurx + win->begx,
win->cury + win->begy, win->curx + win->begx);
_cursesi_screen->curscr->cury =
win->cury + _cursesi_screen->curscr->begy;
_cursesi_screen->curscr->curx =
win->curx + _cursesi_screen->curscr->begx;
win->ocurx = win->curx;
win->ocury = win->cury;
}
}
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT, "wgetch: __echoit = %d, "
"__rawmode = %d, __nl = %d, flags = %#.4x, delay = %d\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: getstr.c,v 1.25 2019/02/24 20:20:18 roy Exp $ */
/* $NetBSD: getstr.c,v 1.26 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)getstr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: getstr.c,v 1.25 2019/02/24 20:20:18 roy Exp $");
__RCSID("$NetBSD: getstr.c,v 1.26 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -98,7 +98,7 @@ mvgetstr(int y, int x, char *str)
int
mvwgetnstr(WINDOW *win, int y, int x, char *str, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wgetnstr(win, str, n);
@ -113,7 +113,7 @@ __warn_references(mvgetstr,
int
mvwgetstr(WINDOW *win, int y, int x, char *str)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wgetstr(win, str);
@ -188,7 +188,7 @@ __wgetnstr(WINDOW *win, char *str, int n)
mvwaddch(win, win->cury,
xpos - 1, ' ');
if (win->curx > xpos - 1)
wmove(win, win->cury, xpos - 1);
_cursesi_wmove(win, win->cury, xpos - 1, 1);
xpos--;
}
if (c == KEY_BACKSPACE || c == KEY_LEFT) {
@ -198,7 +198,7 @@ __wgetnstr(WINDOW *win, char *str, int n)
mvwaddch(win, win->cury, win->curx - 1,
' ');
if (win->curx > xpos)
wmove(win, win->cury, xpos - 1);
_cursesi_wmove(win, win->cury, xpos - 1, 1);
xpos--;
}
str--;
@ -211,7 +211,7 @@ __wgetnstr(WINDOW *win, char *str, int n)
if (win->curx > oldx)
mvwaddch(win, win->cury, win->curx - 1,
' ');
wmove(win, win->cury, oldx);
_cursesi_wmove(win, win->cury, oldx, 1);
xpos = oldx;
}
} else if (c == kc) {
@ -223,22 +223,22 @@ __wgetnstr(WINDOW *win, char *str, int n)
while (str != ostr) {
mvwaddch(win, win->cury, win->curx - 1,
' ');
wmove(win, win->cury, win->curx - 1);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
str--;
if (n != -1)
/* We're counting chars */
remain++;
}
mvwaddch(win, win->cury, win->curx - 1, ' ');
wmove(win, win->cury, win->curx - 1);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
} else
/* getch() displays the kill character */
mvwaddch(win, win->cury, oldx, ' ');
wmove(win, win->cury, oldx);
_cursesi_wmove(win, win->cury, oldx, 1);
} else if (c >= KEY_MIN && c <= KEY_MAX) {
/* getch() displays these characters */
mvwaddch(win, win->cury, xpos, ' ');
wmove(win, win->cury, xpos);
_cursesi_wmove(win, win->cury, xpos, 1);
} else {
if (remain) {
if (iscntrl((unsigned char)c))
@ -248,7 +248,7 @@ __wgetnstr(WINDOW *win, char *str, int n)
remain--;
} else
mvwaddch(win, win->cury, xpos, ' ');
wmove(win, win->cury, xpos);
_cursesi_wmove(win, win->cury, xpos, 1);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_wch.c,v 1.5 2018/11/22 22:16:45 uwe Exp $ */
/* $NetBSD: in_wch.c,v 1.6 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: in_wch.c,v 1.5 2018/11/22 22:16:45 uwe Exp $");
__RCSID("$NetBSD: in_wch.c,v 1.6 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include "curses.h"
@ -69,7 +69,7 @@ mvin_wch(int y, int x, cchar_t *wcval)
int
mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return win_wch(win, wcval);

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_wchstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $ */
/* $NetBSD: in_wchstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: in_wchstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $");
__RCSID("$NetBSD: in_wchstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include "curses.h"
@ -87,7 +87,7 @@ __warn_references(mvwin_wchstr,
int
mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wchstr)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return win_wchstr(win, wchstr);
@ -96,7 +96,7 @@ mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wchstr)
int
mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wchstr, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return win_wchnstr(win, wchstr, n);

View File

@ -1,4 +1,4 @@
/* $NetBSD: inch.c,v 1.12 2018/11/18 22:34:32 uwe Exp $ */
/* $NetBSD: inch.c,v 1.13 2019/05/20 22:17:41 blymn Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: inch.c,v 1.12 2018/11/18 22:34:32 uwe Exp $");
__RCSID("$NetBSD: inch.c,v 1.13 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include "curses.h"
@ -69,7 +69,7 @@ chtype
mvwinch(WINDOW *win, int y, int x)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winch(win);

View File

@ -1,4 +1,4 @@
/* $NetBSD: inchstr.c,v 1.8 2019/02/24 20:20:18 roy Exp $ */
/* $NetBSD: inchstr.c,v 1.9 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: inchstr.c,v 1.8 2019/02/24 20:20:18 roy Exp $");
__RCSID("$NetBSD: inchstr.c,v 1.9 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include "curses.h"
@ -95,7 +95,7 @@ int
mvwinchstr(WINDOW *win, int y, int x, chtype *chstr)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winchstr(win, chstr);
@ -105,7 +105,7 @@ int
mvwinchnstr(WINDOW *win, int y, int x, chtype *chstr, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winchnstr(win, chstr, n);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ins_wch.c,v 1.12 2018/11/22 22:16:45 uwe Exp $ */
/* $NetBSD: ins_wch.c,v 1.13 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ins_wch.c,v 1.12 2018/11/22 22:16:45 uwe Exp $");
__RCSID("$NetBSD: ins_wch.c,v 1.13 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <string.h>
@ -72,7 +72,7 @@ mvins_wch(int y, int x, const cchar_t *wch)
int
mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wins_wch(stdscr, wch);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ins_wstr.c,v 1.12 2018/11/22 22:16:45 uwe Exp $ */
/* $NetBSD: ins_wstr.c,v 1.13 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ins_wstr.c,v 1.12 2018/11/22 22:16:45 uwe Exp $");
__RCSID("$NetBSD: ins_wstr.c,v 1.13 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <string.h>
@ -93,7 +93,7 @@ mvins_nwstr(int y, int x, const wchar_t *wstr, int n)
int
mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wins_wstr(stdscr, wstr);
@ -106,7 +106,7 @@ mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr)
int
mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wins_nwstr(stdscr, wstr, n);

View File

@ -1,4 +1,4 @@
/* $NetBSD: insch.c,v 1.23 2017/01/06 13:53:18 roy Exp $ */
/* $NetBSD: insch.c,v 1.24 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)insch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: insch.c,v 1.23 2017/01/06 13:53:18 roy Exp $");
__RCSID("$NetBSD: insch.c,v 1.24 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -76,7 +76,7 @@ int
mvwinsch(WINDOW *win, int y, int x, chtype ch)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winsch(stdscr, ch);
@ -126,6 +126,7 @@ winsch(WINDOW *win, chtype ch)
wrefresh(win);
scroll(win);
win->cury--;
win->ocury = win->cury;
} else
return ERR;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: insstr.c,v 1.5 2017/01/06 13:53:18 roy Exp $ */
/* $NetBSD: insstr.c,v 1.6 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: insstr.c,v 1.5 2017/01/06 13:53:18 roy Exp $");
__RCSID("$NetBSD: insstr.c,v 1.6 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <string.h>
@ -100,7 +100,7 @@ int
mvwinsstr(WINDOW *win, int y, int x, const char *str)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winsstr(stdscr, str);
@ -114,7 +114,7 @@ int
mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winsnstr(stdscr, str, n);

View File

@ -1,4 +1,4 @@
/* $NetBSD: instr.c,v 1.5 2019/02/24 20:20:18 roy Exp $ */
/* $NetBSD: instr.c,v 1.6 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: instr.c,v 1.5 2019/02/24 20:20:18 roy Exp $");
__RCSID("$NetBSD: instr.c,v 1.6 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include "curses.h"
@ -92,7 +92,7 @@ __warn_references(mvwinstr,
int
mvwinstr(WINDOW *win, int y, int x, char *str)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winstr(win, str);
@ -101,7 +101,7 @@ mvwinstr(WINDOW *win, int y, int x, char *str)
int
mvwinnstr(WINDOW *win, int y, int x, char *str, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winnstr(win, str, n);

View File

@ -1,4 +1,4 @@
/* $NetBSD: inwstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $ */
/* $NetBSD: inwstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: inwstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $");
__RCSID("$NetBSD: inwstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include "curses.h"
@ -87,7 +87,7 @@ __warn_references(mvwinwstr,
int
mvwinwstr(WINDOW *win, int y, int x, wchar_t *wstr)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winwstr(win, wstr);
@ -96,7 +96,7 @@ mvwinwstr(WINDOW *win, int y, int x, wchar_t *wstr)
int
mvwinnwstr(WINDOW *win, int y, int x, wchar_t *wstr, int n)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return winnwstr(win, wstr, n);

View File

@ -1,4 +1,4 @@
/* $NetBSD: line.c,v 1.9 2017/01/06 13:53:18 roy Exp $ */
/* $NetBSD: line.c,v 1.10 2019/05/20 22:17:41 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: line.c,v 1.9 2017/01/06 13:53:18 roy Exp $");
__RCSID("$NetBSD: line.c,v 1.10 2019/05/20 22:17:41 blymn Exp $");
#endif /* not lint */
#include <string.h>
@ -71,7 +71,7 @@ int
mvwhline(WINDOW *win, int y, int x, chtype ch, int count)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return whline(win, ch, count);
@ -97,7 +97,7 @@ whline(WINDOW *win, chtype ch, int count)
for (i = 0; i < n; i++)
mvwaddch(win, win->cury, ocurx + i, ch);
wmove(win, win->cury, ocurx);
_cursesi_wmove(win, win->cury, ocurx, 1);
return OK;
#else
cchar_t cch, *cchp;
@ -143,7 +143,7 @@ int
mvwvline(WINDOW *win, int y, int x, chtype ch, int count)
{
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wvline(win, ch, count);
@ -170,7 +170,7 @@ wvline(WINDOW *win, chtype ch, int count)
for (i = 0; i < n; i++)
mvwaddch(win, ocury + i, ocurx, ch);
wmove(win, ocury, ocurx);
_cursesi_wmove(win, ocury, ocurx, 1);
return OK;
#else
cchar_t cch, *cchp;
@ -208,7 +208,7 @@ int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n)
#ifndef HAVE_WCHAR
return ERR;
#else
if ( wmove( win, y , x ) == ERR )
if ( _cursesi_wmove( win, y , x , 0) == ERR )
return ERR;
return whline_set( win, wch, n );
@ -245,7 +245,7 @@ int whline_set(WINDOW *win, const cchar_t *wch, int n)
mvwadd_wch(win, win->cury, ocurx + i * cw, &cc);
}
wmove(win, win->cury, ocurx);
_cursesi_wmove(win, win->cury, ocurx, 1);
__sync(win);
return OK;
#endif /* HAVE_WCHAR */
@ -274,7 +274,7 @@ int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n)
#ifndef HAVE_WCHAR
return ERR;
#else
if (wmove(win, y, x) == ERR)
if (_cursesi_wmove(win, y, x, 0) == ERR)
return ERR;
return wvline_set(win, wch, n);
@ -307,7 +307,7 @@ int wvline_set(WINDOW *win, const cchar_t *wch, int n)
#endif /* DEBUG */
}
wmove(win, ocury, ocurx);
_cursesi_wmove(win, ocury, ocurx, 1);
__sync(win);
return OK;
#endif /* HAVE_WCHAR */

View File

@ -1,4 +1,4 @@
/* $NetBSD: move.c,v 1.19 2018/09/26 18:51:45 kamil Exp $ */
/* $NetBSD: move.c,v 1.20 2019/05/20 22:17:41 blymn 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.19 2018/09/26 18:51:45 kamil Exp $");
__RCSID("$NetBSD: move.c,v 1.20 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -50,7 +50,7 @@ int
move(int y, int x)
{
return wmove(stdscr, y, x);
return _cursesi_wmove(stdscr, y, x, 1);
}
#endif
@ -61,21 +61,35 @@ move(int y, int x)
*/
int
wmove(WINDOW *win, int y, int x)
{
return _cursesi_wmove(win, y, x, 1);
}
/*
* _cursesi_wmove:
* Moves the cursor to the given point, if keep_old == 0 then
* update the old cursor position.
*/
int
_cursesi_wmove(WINDOW *win, int y, int x, int keep_old)
{
#ifdef DEBUG
__CTRACE(__CTRACE_MISC, "wmove: (%d, %d)\n", y, x);
__CTRACE(__CTRACE_MISC, "_cursesi_wmove: (%d, %d), keep_old: %d\n", y, x, keep_old);
#endif
if (x < 0 || y < 0)
return ERR;
if (x >= win->maxx || y >= win->maxy)
return ERR;
win->curx = x;
win->alines[win->cury]->flags &= ~__ISPASTEOL;
win->alines[win->cury]->flags |= __ISDIRTY;
win->cury = y;
win->alines[y]->flags &= ~__ISPASTEOL;
win->alines[y]->flags |= __ISDIRTY;
if (keep_old == 0) {
win->ocurx = x;
win->ocury = y;
}
return OK;
}
@ -84,8 +98,8 @@ wcursyncup(WINDOW *win)
{
while (win->orig) {
wmove(win->orig, win->cury + win->begy - win->orig->begy,
win->curx + win->begx - win->orig->begx);
_cursesi_wmove(win->orig, win->cury + win->begy - win->orig->begy,
win->curx + win->begx - win->orig->begx, 0);
win = win->orig;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: newwin.c,v 1.55 2019/04/01 11:39:15 roy Exp $ */
/* $NetBSD: newwin.c,v 1.56 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
#else
__RCSID("$NetBSD: newwin.c,v 1.55 2019/04/01 11:39:15 roy Exp $");
__RCSID("$NetBSD: newwin.c,v 1.56 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -375,7 +375,7 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub,
__CTRACE(__CTRACE_WINDOW, "makenew: ncols = %d\n", ncols);
#endif
win->screen = screen;
win->cury = win->curx = 0;
win->cury = win->curx = win->ocurx = win->ocury = 0;
win->maxy = nlines;
win->maxx = ncols;
win->reqy = nlines;

View File

@ -1,4 +1,4 @@
/* $NetBSD: printw.c,v 1.27 2019/04/01 11:39:15 roy Exp $ */
/* $NetBSD: printw.c,v 1.28 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)printw.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: printw.c,v 1.27 2019/04/01 11:39:15 roy Exp $");
__RCSID("$NetBSD: printw.c,v 1.28 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -102,7 +102,7 @@ mvwprintw(WINDOW * win, int y, int x, const char *fmt,...)
va_list ap;
int ret;
if (wmove(win, y, x) != OK)
if (_cursesi_wmove(win, y, x, 0) != OK)
return ERR;
va_start(ap, fmt);

View File

@ -1,4 +1,4 @@
/* $NetBSD: putchar.c,v 1.22 2017/01/06 13:53:18 roy Exp $ */
/* $NetBSD: putchar.c,v 1.23 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: putchar.c,v 1.22 2017/01/06 13:53:18 roy Exp $");
__RCSID("$NetBSD: putchar.c,v 1.23 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -48,7 +48,7 @@ __cputchar(int ch)
#ifdef DEBUG
__CTRACE(__CTRACE_OUTPUT, "__cputchar: %s\n", unctrl(ch));
#endif
return putc(ch, _cursesi_screen->outfd);
return __cputchar_args(ch, _cursesi_screen->outfd);
}
/*
@ -60,12 +60,15 @@ int
__cputchar_args(int ch, void *args)
{
FILE *outfd = (FILE *)args;
int status;
#ifdef DEBUG
__CTRACE(__CTRACE_OUTPUT, "__cputchar_args: %s on fd %d\n",
unctrl(ch), outfd->_file);
#endif
return putc(ch, outfd);
status = putc(ch, outfd);
fflush(outfd);
return status;
}
#ifdef HAVE_WCHAR
@ -75,7 +78,7 @@ __cputwchar(wchar_t wch)
#ifdef DEBUG
__CTRACE(__CTRACE_OUTPUT, "__cputwchar: 0x%x\n", wch);
#endif
return putwc(wch, _cursesi_screen->outfd);
return __cputwchar_args(wch, _cursesi_screen->outfd);
}
/*
@ -87,11 +90,14 @@ int
__cputwchar_args(wchar_t wch, void *args)
{
FILE *outfd = (FILE *)args;
int status;
#ifdef DEBUG
__CTRACE(__CTRACE_OUTPUT, "__cputwchar_args: 0x%x on fd %d\n",
wch, outfd->_file);
#endif
return putwc(wch, outfd);
status = putwc(wch, outfd);
fflush(outfd);
return status;
}
#endif /* HAVE_WCHAR */

View File

@ -1,4 +1,4 @@
/* $NetBSD: refresh.c,v 1.109 2019/05/12 02:19:23 blymn Exp $ */
/* $NetBSD: refresh.c,v 1.110 2019/05/20 22:17:41 blymn 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.109 2019/05/12 02:19:23 blymn Exp $");
__RCSID("$NetBSD: refresh.c,v 1.110 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -45,7 +45,7 @@ __RCSID("$NetBSD: refresh.c,v 1.109 2019/05/12 02:19:23 blymn Exp $");
#include "curses.h"
#include "curses_private.h"
static void domvcur(const WINDOW *, int, int, int, int);
static void domvcur(WINDOW *, int, int, int, int);
static void putattr(__LDATA *);
static void putattr_out(__LDATA *);
static int putch(__LDATA *, __LDATA *, int, int);
@ -1431,7 +1431,7 @@ makech(int wy)
* Do a mvcur, leaving attributes if necessary.
*/
static void
domvcur(const WINDOW *win, int oy, int ox, int ny, int nx)
domvcur(WINDOW *win, int oy, int ox, int ny, int nx)
{
#ifdef DEBUG
@ -1452,6 +1452,10 @@ domvcur(const WINDOW *win, int oy, int ox, int ny, int nx)
win->alines[oy]->flags &= ~__ISPASTEOL;
win->alines[ny]->flags &= ~__ISPASTEOL;
/* Update old cursor positions to current location */
win->ocury = ny;
win->ocurx = nx;
__mvcur(oy, ox, ny, nx, 1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: scroll.c,v 1.24 2017/02/10 06:25:28 blymn Exp $ */
/* $NetBSD: scroll.c,v 1.25 2019/05/20 22:17:41 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: scroll.c,v 1.24 2017/02/10 06:25:28 blymn Exp $");
__RCSID("$NetBSD: scroll.c,v 1.25 2019/05/20 22:17:41 blymn Exp $");
#endif
#endif /* not lint */
@ -100,9 +100,9 @@ wscrl(WINDOW *win, int nlines)
#ifdef DEBUG
__CTRACE(__CTRACE_WINDOW, "wscrl: y=%d\n", oy);
#endif
wmove(win, win->scr_t, 0);
wmove(win, win->scr_t, 1);
winsdelln(win, 0 - nlines);
wmove(win, oy, ox);
_cursesi_wmove(win, oy, ox, 1);
if (win == curscr) {
__cputchar('\n');