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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
#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 /* not lint */
@ -47,9 +47,9 @@ __RCSID("$NetBSD: addbytes.c,v 1.51 2019/05/20 22:17:41 blymn Exp $");
#endif
#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_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
@ -94,7 +94,7 @@ int
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 _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':
*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;
}
}
@ -364,12 +362,10 @@ _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);
@ -512,7 +508,6 @@ _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
@ -602,11 +597,10 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
}
lp = &win->alines[*y]->line[0];
(*lnp) = win->alines[*y];
win->curx = win->ocurx = *x;
win->cury = win->ocury = *y;
win->curx = *x;
win->cury = *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.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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)addch.c 8.2 (Berkeley) 5/4/94";
#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 /* not lint */
@ -74,7 +74,7 @@ int
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 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.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == 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);
_cursesi_wmove(win, oy, ox, 1);
wmove(win, oy, ox);
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)addnstr.c 8.2 (Berkeley) 5/4/94";
#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 /* 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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#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 */
#include <ctype.h>
@ -119,7 +119,7 @@ int copywin(const WINDOW *srcwin, WINDOW *dstwin,
* background character
*/
if ((dooverlay && !isspace(sp->ch)) || !dooverlay) {
_cursesi_wmove(dstwin, dminrow, dcol, 0);
wmove(dstwin, dminrow, dcol);
#ifdef DEBUG
__CTRACE(__CTRACE_WINDOW, "copywin: dcol = %d\n", dcol);
#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
@ -111,7 +111,6 @@ 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. */
@ -352,7 +351,6 @@ 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.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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)delch.c 8.2 (Berkeley) 5/4/94";
#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 /* not lint */
@ -72,7 +72,7 @@ mvdelch(int y, int x)
int
mvwdelch(WINDOW *win, int y, int x)
{
if (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)erase.c 8.2 (Berkeley) 5/4/94";
#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 /* 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);
_cursesi_wmove(win, 0, 0, 0);
wmove(win, 0, 0);
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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == 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 )) {
_cursesi_wmove( win, win->cury, win->curx - 1, 0 );
wmove( win, win->cury, win->curx - 1);
wdelch( win );
}
} 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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == 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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == 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);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
wmove(win, win->cury, win->curx - 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);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
wmove(win, win->cury, win->curx - 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);
_cursesi_wmove(win, win->cury, oldx, 1);
wmove(win, win->cury, oldx);
}
} 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);
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
wmove(win, win->cury, win->curx - 1);
wstr--;
if (n != -1)
/* We're counting chars */
remain++;
}
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
/* getch() displays the kill character */
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) {
/* get_wch() displays these characters */
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 {
if (remain) {
wstr++;
remain--;
} else {
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#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 /* not lint */
@ -716,7 +716,7 @@ mvgetch(int y, int x)
int
mvwgetch(WINDOW *win, int y, int x)
{
if (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
return wgetch(win);
@ -821,24 +821,25 @@ wgetch(WINDOW *win)
if (is_wintouched(win))
wrefresh(win);
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
__CTRACE(__CTRACE_INPUT, "wgetch: ocury %d cury %d ocurx %d curx %d\n",
win->ocury, win->cury, win->ocurx, win->curx);
__CTRACE(__CTRACE_INPUT, "wgetch: curscr cury %d cury %d curscr curx %d curx %d\n",
_cursesi_screen->curscr->cury, win->begy + win->cury,
_cursesi_screen->curscr->curx, win->begx + 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);
mvcur(_cursesi_screen->curscr->cury,
_cursesi_screen->curscr->curx,
win->cury + win->begy, win->curx + win->begx);
_cursesi_screen->curscr->cury =
win->cury + _cursesi_screen->curscr->begy;
win->cury + win->begy;
_cursesi_screen->curscr->curx =
win->curx + _cursesi_screen->curscr->begx;
win->ocurx = win->curx;
win->ocury = win->cury;
win->curx + win->begx;
}
}

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
@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)getstr.c 8.2 (Berkeley) 5/4/94";
#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 /* 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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == 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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == 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)
_cursesi_wmove(win, win->cury, xpos - 1, 1);
wmove(win, win->cury, xpos - 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)
_cursesi_wmove(win, win->cury, xpos - 1, 1);
wmove(win, win->cury, xpos - 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,
' ');
_cursesi_wmove(win, win->cury, oldx, 1);
wmove(win, win->cury, oldx);
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,
' ');
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
wmove(win, win->cury, win->curx - 1);
str--;
if (n != -1)
/* We're counting chars */
remain++;
}
mvwaddch(win, win->cury, win->curx - 1, ' ');
_cursesi_wmove(win, win->cury, win->curx - 1, 1);
wmove(win, win->cury, win->curx - 1);
} else
/* getch() displays the kill character */
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) {
/* getch() displays these characters */
mvwaddch(win, win->cury, xpos, ' ');
_cursesi_wmove(win, win->cury, xpos, 1);
wmove(win, win->cury, xpos);
} 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, ' ');
_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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#include "curses.h"
@ -87,7 +87,7 @@ __warn_references(mvwin_wchstr,
int
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 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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#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 */
#include "curses.h"
@ -69,7 +69,7 @@ chtype
mvwinch(WINDOW *win, int y, int x)
{
if (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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.
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#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 */
#include "curses.h"
@ -95,7 +95,7 @@ int
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 winchstr(win, chstr);
@ -105,7 +105,7 @@ int
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 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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == 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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)insch.c 8.2 (Berkeley) 5/4/94";
#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 /* not lint */
@ -76,7 +76,7 @@ int
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 winsch(stdscr, ch);
@ -126,7 +126,6 @@ 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.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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#include <string.h>
@ -100,7 +100,7 @@ int
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 winsstr(stdscr, str);
@ -114,7 +114,7 @@ int
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 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.
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#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 */
#include "curses.h"
@ -92,7 +92,7 @@ __warn_references(mvwinstr,
int
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 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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#include "curses.h"
@ -87,7 +87,7 @@ __warn_references(mvwinwstr,
int
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 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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == ERR)
return ERR;
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
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#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 */
#include <string.h>
@ -71,7 +71,7 @@ int
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 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);
_cursesi_wmove(win, win->cury, ocurx, 1);
wmove(win, win->cury, ocurx);
return OK;
#else
cchar_t cch, *cchp;
@ -143,7 +143,7 @@ int
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 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);
_cursesi_wmove(win, ocury, ocurx, 1);
wmove(win, ocury, ocurx);
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 ( _cursesi_wmove( win, y , x , 0) == ERR )
if ( wmove( win, y , x ) == 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);
}
_cursesi_wmove(win, win->cury, ocurx, 1);
wmove(win, win->cury, ocurx);
__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 (_cursesi_wmove(win, y, x, 0) == ERR)
if (wmove(win, y, x) == 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 */
}
_cursesi_wmove(win, ocury, ocurx, 1);
wmove(win, ocury, ocurx);
__sync(win);
return OK;
#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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94";
#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 /* not lint */
@ -50,7 +50,7 @@ int
move(int y, int x)
{
return _cursesi_wmove(stdscr, y, x, 1);
return wmove(stdscr, y, x);
}
#endif
@ -62,21 +62,8 @@ 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, "_cursesi_wmove: (%d, %d), keep_old: %d\n", y, x, keep_old);
__CTRACE(__CTRACE_MISC, "wmove: (%d, %d)\n", y, x);
#endif
if (x < 0 || y < 0)
return ERR;
@ -85,10 +72,6 @@ _cursesi_wmove(WINDOW *win, int y, int x, int keep_old)
win->curx = x;
win->cury = y;
if (keep_old == 0) {
win->ocurx = x;
win->ocury = y;
}
return OK;
}
@ -98,8 +81,8 @@ wcursyncup(WINDOW *win)
{
while (win->orig) {
_cursesi_wmove(win->orig, win->cury + win->begy - win->orig->begy,
win->curx + win->begx - win->orig->begx, 0);
wmove(win->orig, win->cury + win->begy - win->orig->begy,
win->curx + win->begx - win->orig->begx);
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
#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 /* 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 = win->ocurx = win->ocury = 0;
win->cury = win->curx = 0;
win->maxy = nlines;
win->maxx = ncols;
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)printw.c 8.3 (Berkeley) 5/4/94";
#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 /* not lint */
@ -102,7 +102,7 @@ mvwprintw(WINDOW * win, int y, int x, const char *fmt,...)
va_list ap;
int ret;
if (_cursesi_wmove(win, y, x, 0) != OK)
if (wmove(win, y, x) != OK)
return ERR;
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94";
#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 /* not lint */
@ -270,7 +270,8 @@ _wnoutrefresh(WINDOW *win, int begy, int begx, int wbegy, int wbegx,
continue;
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
"_wnoutrefresh: line is dirty\n");
"_wnoutrefresh: line y_off %d (dy_off %d) is dirty\n",
y_off, dy_off);
#endif
wlp = swin->alines[wy];
@ -1435,8 +1436,8 @@ domvcur(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 );
__CTRACE(__CTRACE_REFRESH, "domvcur: (%d,%d)=>(%d,%d) win 0x%p\n",
oy, ox, ny, nx, win );
#endif /* DEBUG */
__unsetattr(1);
@ -1452,10 +1453,6 @@ domvcur(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.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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94";
#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 /* not lint */
@ -102,7 +102,7 @@ wscrl(WINDOW *win, int nlines)
#endif
wmove(win, win->scr_t, 1);
winsdelln(win, 0 - nlines);
_cursesi_wmove(win, oy, ox, 1);
wmove(win, oy, ox);
if (win == curscr) {
__cputchar('\n');