From fe04a14d6f411207899cdf9b2e9e40d952938199 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 12 Jun 2022 18:14:27 +0000 Subject: [PATCH] ncurses 6.3 - patch 20220612 + modify waddch_literal() to allow for double-width base character when merging a combining character (report by Gavin Troy). + improve _tracecchar_t2() formatting of base+combining character. --- NEWS | 7 ++++++- VERSION | 2 +- dist.mk | 4 ++-- ncurses/base/lib_addch.c | 33 ++++++++++++++++++++------------ ncurses/base/lib_addstr.c | 14 ++++++++------ ncurses/trace/lib_traceatr.c | 21 ++++++++++---------- package/debian-mingw/changelog | 4 ++-- package/debian-mingw64/changelog | 4 ++-- package/debian/changelog | 4 ++-- package/mingw-ncurses.nsi | 4 ++-- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- package/ncursest.spec | 2 +- 13 files changed, 60 insertions(+), 43 deletions(-) diff --git a/NEWS b/NEWS index b68ca23f..36fa566c 100644 --- a/NEWS +++ b/NEWS @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3815 2022/06/04 23:17:01 tom Exp $ +-- $Id: NEWS,v 1.3818 2022/06/12 10:22:30 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,11 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20220612 + + modify waddch_literal() to allow for double-width base character when + merging a combining character (report by Gavin Troy). + + improve _tracecchar_t2() formatting of base+combining character. + 20220604 + add note on portable memory-leak checking in man/curs_memleaks.3x + remove u6-u9 from teken-2018 -TD diff --git a/VERSION b/VERSION index e63acbb8..fb2ccc3c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.3 20220604 +5:0:10 6.3 20220612 diff --git a/dist.mk b/dist.mk index 5a6d8ea1..bd757b7f 100644 --- a/dist.mk +++ b/dist.mk @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1484 2022/06/04 10:24:10 tom Exp $ +# $Id: dist.mk,v 1.1486 2022/06/12 10:22:30 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -38,7 +38,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 3 -NCURSES_PATCH = 20220604 +NCURSES_PATCH = 20220612 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/base/lib_addch.c b/ncurses/base/lib_addch.c index a1443289..a14bfd3b 100644 --- a/ncurses/base/lib_addch.c +++ b/ncurses/base/lib_addch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 2019-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,7 +37,7 @@ #include #include -MODULE_ID("$Id: lib_addch.c,v 1.138 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: lib_addch.c,v 1.141 2022/06/12 15:16:41 tom Exp $") static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); @@ -321,20 +321,29 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch) int len = _nc_wacs_width(CharOf(ch)); int i; int j; - wchar_t *chars; if (len == 0) { /* non-spacing */ if ((x > 0 && y >= 0) || (win->_maxx >= 0 && win->_cury >= 1)) { - if (x > 0 && y >= 0) - chars = (win->_line[y].text[x - 1].chars); - else - chars = (win->_line[y - 1].text[win->_maxx].chars); + NCURSES_CH_T *dst; + wchar_t *chars; + if (x > 0 && y >= 0) { + for (j = x - 1; j >= 0; --j) { + if (!isWidecExt(win->_line[y].text[j])) { + win->_curx = (NCURSES_SIZE_T) j; + break; + } + } + dst = &(win->_line[y].text[j]); + } else { + dst = &(win->_line[y - 1].text[win->_maxx]); + } + chars = dst->chars; for (i = 0; i < CCHARW_MAX; ++i) { if (chars[i] == 0) { TR(TRACE_VIRTPUT, - ("added non-spacing %d: %x", - x, (int) CharOf(ch))); + ("adding non-spacing %s (level %d)", + _tracech_t(CHREF(ch)), i)); chars[i] = CharOf(ch); break; } @@ -410,9 +419,9 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch) testwrapping: ); - TR(TRACE_VIRTPUT, ("cell (%ld, %ld..%d) = %s", - (long) win->_cury, (long) win->_curx, x - 1, - _tracech_t(CHREF(ch)))); + TR(TRACE_VIRTPUT, ("cell (%d, %d..%d) = %s", + win->_cury, win->_curx, x - 1, + _tracech_t(CHREF(line->text[win->_curx])))); if (x > win->_maxx) { return wrap_to_next_line(win); diff --git a/ncurses/base/lib_addstr.c b/ncurses/base/lib_addstr.c index a1e8829d..ea449794 100644 --- a/ncurses/base/lib_addstr.c +++ b/ncurses/base/lib_addstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2020,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -45,7 +45,7 @@ #include -MODULE_ID("$Id: lib_addstr.c,v 1.57 2020/12/05 20:06:19 tom Exp $") +MODULE_ID("$Id: lib_addstr.c,v 1.58 2022/06/11 20:12:04 tom Exp $") NCURSES_EXPORT(int) waddnstr(WINDOW *win, const char *astr, int n) @@ -59,10 +59,11 @@ waddnstr(WINDOW *win, const char *astr, int n) TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(WINDOW_ATTRS(win)))); code = OK; + + TR(TRACE_VIRTPUT, ("str is not null, length = %d", + ((n > 0) ? n : (int) strlen(str)))); if (n < 0) n = INT_MAX; - - TR(TRACE_VIRTPUT, ("str is not null, length = %d", n)); while ((*str != '\0') && (n-- > 0)) { NCURSES_CH_T ch; TR(TRACE_VIRTPUT, ("*str = %#o", UChar(*str))); @@ -231,10 +232,11 @@ waddnwstr(WINDOW *win, const wchar_t *str, int n) TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(WINDOW_ATTRS(win)))); code = OK; + + TR(TRACE_VIRTPUT, ("str is not null, length = %d", + ((n > 0) ? n : (int) wcslen(str)))); if (n < 0) n = INT_MAX; - - TR(TRACE_VIRTPUT, ("str is not null, length = %d", n)); while ((*str != L('\0')) && (n-- > 0)) { NCURSES_CH_T ch; TR(TRACE_VIRTPUT, ("*str[0] = %#lx", (unsigned long) *str)); diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c index 94026275..d397fb21 100644 --- a/ncurses/trace/lib_traceatr.c +++ b/ncurses/trace/lib_traceatr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2018-2020,2022 Thomas E. Dickey * * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_traceatr.c,v 1.94 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.95 2022/06/11 22:40:56 tom Exp $") #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) @@ -369,14 +369,15 @@ _tracecchar_t2(int bufnum, const cchar_t *ch) _nc_wacs_width(ch->chars[PUTC_i]), (unsigned long) ch->chars[PUTC_i]); (void) _nc_trace_bufcat(bufnum, temp); - break; - } - for (n = 0; n < PUTC_n; n++) { - if (n) - (void) _nc_trace_bufcat(bufnum, ", "); - (void) _nc_trace_bufcat(bufnum, - _nc_tracechar(CURRENT_SCREEN, - UChar(PUTC_buf[n]))); + attr &= ~A_CHARTEXT; /* ignore WidecExt(ch) */ + } else { + for (n = 0; n < PUTC_n; n++) { + if (n) + (void) _nc_trace_bufcat(bufnum, ", "); + (void) _nc_trace_bufcat(bufnum, + _nc_tracechar(CURRENT_SCREEN, + UChar(PUTC_buf[n]))); + } } } (void) _nc_trace_bufcat(bufnum, " }"); diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 55e3a0fe..f0eb8aa9 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220604) unstable; urgency=low +ncurses6 (6.3+20220612) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Jun 2022 06:24:10 -0400 + -- Thomas E. Dickey Sun, 12 Jun 2022 06:22:30 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 55e3a0fe..f0eb8aa9 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220604) unstable; urgency=low +ncurses6 (6.3+20220612) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Jun 2022 06:24:10 -0400 + -- Thomas E. Dickey Sun, 12 Jun 2022 06:22:30 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index 51d93ddb..e550922f 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220604) unstable; urgency=low +ncurses6 (6.3+20220612) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Jun 2022 06:24:10 -0400 + -- Thomas E. Dickey Sun, 12 Jun 2022 06:22:30 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 76234c42..241fa075 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.524 2022/06/04 10:24:10 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.526 2022/06/12 10:22:30 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "3" !define VERSION_YYYY "2022" -!define VERSION_MMDD "0604" +!define VERSION_MMDD "0612" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 970e53c0..a3dfd187 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.3 -Release: 20220604 +Release: 20220612 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 783aea24..04ac5b18 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.3 -Release: 20220604 +Release: 20220612 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index 120f068c..7260ba20 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.3 -Release: 20220604 +Release: 20220612 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz -- 2.45.0