Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses curses: Fix werase(3) wide character support
details: https://anonhg.NetBSD.org/src/rev/ef9dbf5a5e57
branches: trunk
changeset: 970081:ef9dbf5a5e57
user: roy <roy%NetBSD.org@localhost>
date: Wed Mar 11 23:47:40 2020 +0000
description:
curses: Fix werase(3) wide character support
We need to consider erasing all attributes, not just WA_ATTRIBUTES.
Fixes PR lib/23910.
While here, make the function a little more readable.
diffstat:
lib/libcurses/erase.c | 42 +++++++++++++++++++++++-------------------
1 files changed, 23 insertions(+), 19 deletions(-)
diffs (67 lines):
diff -r c9bce5710450 -r ef9dbf5a5e57 lib/libcurses/erase.c
--- a/lib/libcurses/erase.c Wed Mar 11 21:33:38 2020 +0000
+++ b/lib/libcurses/erase.c Wed Mar 11 23:47:40 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: erase.c,v 1.28 2019/06/09 07:40:14 blymn Exp $ */
+/* $NetBSD: erase.c,v 1.29 2020/03/11 23:47:40 roy 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.28 2019/06/09 07:40:14 blymn Exp $");
+__RCSID("$NetBSD: erase.c,v 1.29 2020/03/11 23:47:40 roy Exp $");
#endif
#endif /* not lint */
@@ -79,27 +79,31 @@
for (y = 0; y < win->maxy; y++) {
start = win->alines[y]->line;
end = &start[win->maxx];
- for (sp = start; sp < end; sp++)
+ for (sp = start; sp < end; sp++) {
#ifndef HAVE_WCHAR
- if (sp->ch != win->bch || sp->attr != 0) {
+ if (sp->ch == win->bch && sp->attr == 0)
+ continue;
#else
- if (sp->ch != ( wchar_t )btowc(( int ) win->bch ) ||
- (sp->attr & WA_ATTRIBUTES) != 0 || sp->nsp) {
+ if (sp->ch == (wchar_t)btowc((int)win->bch) &&
+ sp->attr == 0 &&
+ sp->nsp == NULL)
+ continue;
+#endif
+ if (sp->attr & __ALTCHARSET)
+ sp->attr = attr | __ALTCHARSET;
+ else
+ sp->attr = attr;
+#ifndef HAVE_WCHAR
+ sp->ch = win->bch;
+#else
+ sp->ch = (wchar_t)btowc((int)win->bch);
+ if (_cursesi_copy_nsp(win->bnsp, sp) == ERR)
+ return ERR;
+ SET_WCOL(*sp, 1);
#endif /* HAVE_WCHAR */
- if (sp->attr & __ALTCHARSET)
- sp->attr = attr | __ALTCHARSET;
- else
- sp->attr = attr;
-#ifdef HAVE_WCHAR
- sp->ch = ( wchar_t )btowc(( int ) win->bch);
- if (_cursesi_copy_nsp(win->bnsp, sp) == ERR)
- return ERR;
- SET_WCOL( *sp, 1 );
-#else
- sp->ch = win->bch;
-#endif /* HAVE_WCHAR */
- }
+ }
}
+
/*
* Mark the whole window as changed in case we have overlapping
* windows - this will result in the (intended) clearing of the
Home |
Main Index |
Thread Index |
Old Index