Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses Make sure we don't use wide char routines when...
details: https://anonhg.NetBSD.org/src/rev/be7e38bdd121
branches: trunk
changeset: 379871:be7e38bdd121
user: blymn <blymn%NetBSD.org@localhost>
date: Thu Jun 24 05:53:05 2021 +0000
description:
Make sure we don't use wide char routines when DISABLE_WCHAR is in
effect.
diffstat:
lib/libcurses/slk.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diffs (67 lines):
diff -r dd1b41f540cc -r be7e38bdd121 lib/libcurses/slk.c
--- a/lib/libcurses/slk.c Thu Jun 24 01:23:16 2021 +0000
+++ b/lib/libcurses/slk.c Thu Jun 24 05:53:05 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: slk.c,v 1.9 2021/06/22 07:26:45 blymn Exp $ */
+/* $NetBSD: slk.c,v 1.10 2021/06/24 05:53:05 blymn Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: slk.c,v 1.9 2021/06/22 07:26:45 blymn Exp $");
+__RCSID("$NetBSD: slk.c,v 1.10 2021/06/24 05:53:05 blymn Exp $");
#endif /* not lint */
#include <ctype.h>
@@ -818,9 +818,11 @@ static int
{
const struct __slk_label *l;
int retval, inc, lcnt, tx;
+ char ts[MB_CUR_MAX];
+#ifdef HAVE_WCHAR
cchar_t cc;
wchar_t wc[2];
- char ts[MB_CUR_MAX];
+#endif
if (screen->slk_hidden)
return OK;
@@ -855,23 +857,35 @@ static int
__CTRACE(__CTRACE_INPUT, "__slk_draw: label len %d, wcwidth %d\n",
screen->slk_label_len, wcwidth(l->label[lcnt]));
#endif
+#ifdef HAVE_WCHAR
wc[0] = l->label[lcnt];
wc[1] = L'\0';
if (setcchar(&cc, wc,
screen->slk_window->wattr, 0,
NULL) == ERR)
return ERR;
+#endif
if (l->x + wcwidth(l->label[lcnt] + tx) >=
screen->slk_label_len) {
/* last character that will fit
* so insert it to avoid scroll
*/
+#ifdef HAVE_WCHAR
retval = mvwins_wch(screen->slk_window,
0, l->x + tx, &cc);
+#else
+ retval = mvwinsch(screen->slk_window,
+ 0, l->x + tx, l->label[lcnt]);
+#endif
} else {
+#ifdef HAVE_WCHAR
retval = mvwadd_wch(screen->slk_window,
0, l->x + tx, &cc);
+#else
+ retval = mvwaddch(screen->slk_window,
+ 0, l->x + tx, l->label[lcnt]);
+#endif
}
tx += wcwidth(l->label[lcnt]);
lcnt += inc;
Home |
Main Index |
Thread Index |
Old Index