Rework previous fix for getch cursor position when cursor is moved

without refresh.  If the window is not dirty but the window cursor
position does not match curscr then move the cursor.  This fixes
the issues seen in PR lib/54263.
This commit is contained in:
blymn 2019-06-09 07:40:14 +00:00
parent dbb56f6daa
commit 2a780e62ed
31 changed files with 144 additions and 172 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: add_wch.c,v 1.8 2019/05/20 22:17:41 blymn Exp $ */ /* $NetBSD: add_wch.c,v 1.9 2019/06/09 07:40:14 blymn Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation Inc. * Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: add_wch.c,v 1.8 2019/05/20 22:17:41 blymn Exp $"); __RCSID("$NetBSD: add_wch.c,v 1.9 2019/06/09 07:40:14 blymn Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -76,7 +76,7 @@ mvadd_wch(int y, int x, const cchar_t *wch)
int int
mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch) mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch)
{ {
if (_cursesi_wmove(win, y, x, 0) == ERR) if (wmove(win, y, x) == ERR)
return ERR; return ERR;
return wadd_wch(win, wch); return wadd_wch(win, wch);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
/* $NetBSD: move.c,v 1.20 2019/05/20 22:17:41 blymn Exp $ */ /* $NetBSD: move.c,v 1.21 2019/06/09 07:40:14 blymn Exp $ */
/* /*
* Copyright (c) 1981, 1993, 1994 * Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94"; static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94";
#else #else
__RCSID("$NetBSD: move.c,v 1.20 2019/05/20 22:17:41 blymn Exp $"); __RCSID("$NetBSD: move.c,v 1.21 2019/06/09 07:40:14 blymn Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -50,7 +50,7 @@ int
move(int y, int x) move(int y, int x)
{ {
return _cursesi_wmove(stdscr, y, x, 1); return wmove(stdscr, y, x);
} }
#endif #endif
@ -62,21 +62,8 @@ move(int y, int x)
int int
wmove(WINDOW *win, int y, int x) 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 #ifdef DEBUG
__CTRACE(__CTRACE_MISC, "_cursesi_wmove: (%d, %d), keep_old: %d\n", y, x, keep_old); __CTRACE(__CTRACE_MISC, "wmove: (%d, %d)\n", y, x);
#endif #endif
if (x < 0 || y < 0) if (x < 0 || y < 0)
return ERR; return ERR;
@ -85,10 +72,6 @@ _cursesi_wmove(WINDOW *win, int y, int x, int keep_old)
win->curx = x; win->curx = x;
win->cury = y; win->cury = y;
if (keep_old == 0) {
win->ocurx = x;
win->ocury = y;
}
return OK; return OK;
} }
@ -98,8 +81,8 @@ wcursyncup(WINDOW *win)
{ {
while (win->orig) { while (win->orig) {
_cursesi_wmove(win->orig, win->cury + win->begy - win->orig->begy, wmove(win->orig, win->cury + win->begy - win->orig->begy,
win->curx + win->begx - win->orig->begx, 0); win->curx + win->begx - win->orig->begx);
win = win->orig; win = win->orig;
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: newwin.c,v 1.56 2019/05/20 22:17:41 blymn Exp $ */ /* $NetBSD: newwin.c,v 1.57 2019/06/09 07:40:14 blymn Exp $ */
/* /*
* Copyright (c) 1981, 1993, 1994 * Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94"; static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
#else #else
__RCSID("$NetBSD: newwin.c,v 1.56 2019/05/20 22:17:41 blymn Exp $"); __RCSID("$NetBSD: newwin.c,v 1.57 2019/06/09 07:40:14 blymn Exp $");
#endif #endif
#endif /* not lint */ #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); __CTRACE(__CTRACE_WINDOW, "makenew: ncols = %d\n", ncols);
#endif #endif
win->screen = screen; win->screen = screen;
win->cury = win->curx = win->ocurx = win->ocury = 0; win->cury = win->curx = 0;
win->maxy = nlines; win->maxy = nlines;
win->maxx = ncols; win->maxx = ncols;
win->reqy = nlines; win->reqy = nlines;

View File

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

View File

@ -1,4 +1,4 @@
/* $NetBSD: refresh.c,v 1.110 2019/05/20 22:17:41 blymn Exp $ */ /* $NetBSD: refresh.c,v 1.111 2019/06/09 07:40:14 blymn Exp $ */
/* /*
* Copyright (c) 1981, 1993, 1994 * Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94"; static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94";
#else #else
__RCSID("$NetBSD: refresh.c,v 1.110 2019/05/20 22:17:41 blymn Exp $"); __RCSID("$NetBSD: refresh.c,v 1.111 2019/06/09 07:40:14 blymn Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -270,7 +270,8 @@ _wnoutrefresh(WINDOW *win, int begy, int begx, int wbegy, int wbegx,
continue; continue;
#ifdef DEBUG #ifdef DEBUG
__CTRACE(__CTRACE_REFRESH, __CTRACE(__CTRACE_REFRESH,
"_wnoutrefresh: line is dirty\n"); "_wnoutrefresh: line y_off %d (dy_off %d) is dirty\n",
y_off, dy_off);
#endif #endif
wlp = swin->alines[wy]; wlp = swin->alines[wy];
@ -1435,8 +1436,8 @@ domvcur(WINDOW *win, int oy, int ox, int ny, int nx)
{ {
#ifdef DEBUG #ifdef DEBUG
__CTRACE(__CTRACE_REFRESH, "domvcur: (%x,%d)=>(%d,%d)\n", __CTRACE(__CTRACE_REFRESH, "domvcur: (%d,%d)=>(%d,%d) win 0x%p\n",
oy, ox, ny, nx ); oy, ox, ny, nx, win );
#endif /* DEBUG */ #endif /* DEBUG */
__unsetattr(1); __unsetattr(1);
@ -1452,10 +1453,6 @@ domvcur(WINDOW *win, int oy, int ox, int ny, int nx)
win->alines[oy]->flags &= ~__ISPASTEOL; win->alines[oy]->flags &= ~__ISPASTEOL;
win->alines[ny]->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); __mvcur(oy, ox, ny, nx, 1);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: scroll.c,v 1.25 2019/05/20 22:17:41 blymn Exp $ */ /* $NetBSD: scroll.c,v 1.26 2019/06/09 07:40:14 blymn Exp $ */
/* /*
* Copyright (c) 1981, 1993, 1994 * Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94"; static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94";
#else #else
__RCSID("$NetBSD: scroll.c,v 1.25 2019/05/20 22:17:41 blymn Exp $"); __RCSID("$NetBSD: scroll.c,v 1.26 2019/06/09 07:40:14 blymn Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -102,7 +102,7 @@ wscrl(WINDOW *win, int nlines)
#endif #endif
wmove(win, win->scr_t, 1); wmove(win, win->scr_t, 1);
winsdelln(win, 0 - nlines); winsdelln(win, 0 - nlines);
_cursesi_wmove(win, oy, ox, 1); wmove(win, oy, ox);
if (win == curscr) { if (win == curscr) {
__cputchar('\n'); __cputchar('\n');