Make sure we copy the relevant cell (and not the first cell) for
each line that we copy. We also need to touch the destination window here. Fixes display bug in atc(6). Bug reported by and fix tested by David Holland.
This commit is contained in:
parent
52cd399dde
commit
55f0d59917
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: copywin.c,v 1.13 2007/05/28 15:01:54 blymn Exp $ */
|
||||
/* $NetBSD: copywin.c,v 1.14 2007/11/08 06:39:31 jdc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998-1999 Brett Lymn
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: copywin.c,v 1.13 2007/05/28 15:01:54 blymn Exp $");
|
||||
__RCSID("$NetBSD: copywin.c,v 1.14 2007/11/08 06:39:31 jdc Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
@ -104,43 +104,32 @@ int copywin(const WINDOW *srcwin, WINDOW *dstwin,
|
||||
for (; dminrow <= dmaxrow; sminrow++, dminrow++) {
|
||||
sp = &srcwin->lines[sminrow]->line[smincol];
|
||||
end = sp + dmaxcol - dmincol;
|
||||
#ifdef HAVE_WCHAR
|
||||
cc.vals[ 0 ] = sp->ch;
|
||||
cc.attributes = sp->attr;
|
||||
cc.elements = 1;
|
||||
np = sp->nsp;
|
||||
if (np) {
|
||||
while ( np && cc.elements <= CURSES_CCHAR_MAX ) {
|
||||
cc.vals[ cc.elements++ ] = np->ch;
|
||||
np = np->next;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_WCHAR */
|
||||
if (dooverlay) {
|
||||
for (dcol = dmincol; sp <= end; dcol++, sp++) {
|
||||
/* XXX: Perhaps this should check for the
|
||||
* background character
|
||||
*/
|
||||
if (!isspace(sp->ch)) {
|
||||
wmove(dstwin, dminrow, dcol);
|
||||
#ifndef HAVE_WCHAR
|
||||
__waddch(dstwin, sp);
|
||||
#else
|
||||
wadd_wch( dstwin, &cc );
|
||||
#endif /* HAVE_WCHAR */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wmove(dstwin, dminrow, dmincol);
|
||||
for (; sp <= end; sp++) {
|
||||
for (dcol = dmincol; sp <= end; dcol++, sp++) {
|
||||
/* XXX: Perhaps this should check for the
|
||||
* background character
|
||||
*/
|
||||
if ((dooverlay && !isspace(sp->ch)) || !dooverlay) {
|
||||
wmove(dstwin, dminrow, dcol);
|
||||
#ifndef HAVE_WCHAR
|
||||
__waddch(dstwin, sp);
|
||||
#else
|
||||
wadd_wch( dstwin, &cc );
|
||||
cc.vals[0] = sp->ch;
|
||||
cc.attributes = sp->attr;
|
||||
cc.elements = 1;
|
||||
np = sp->nsp;
|
||||
if (np) {
|
||||
while (np && cc.elements <=
|
||||
CURSES_CCHAR_MAX) {
|
||||
cc.vals[cc.elements++] = np->ch;
|
||||
np = np->next;
|
||||
}
|
||||
}
|
||||
wadd_wch(dstwin, &cc);
|
||||
#endif /* HAVE_WCHAR */
|
||||
}
|
||||
}
|
||||
}
|
||||
__touchwin(dstwin);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user