From b116355ab2af379e49fd0be31bdd440fc14fd902 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 11 May 2019 22:31:51 +0000 Subject: [PATCH] ncurses 6.1 - patch 20190511 + fix a spurious blank line seen with "infocmp -1fx xterm+x11mouse" + add checks in repair_subwindows() to keep the current position and scroll-margins inside the resized subwindow. + add a limit check in newline_forces_scroll() for the case where the row is inside scroll-margins, but not at the end (report by Toshio Kuratomi, cf: 20170729). + corrected a warning message in tic for extended capabilities versus number of parameters. --- NEWS | 12 ++++++++- VERSION | 2 +- dist.mk | 4 +-- ncurses/Makefile.in | 4 ++- ncurses/base/lib_addch.c | 6 +++-- ncurses/base/wresize.c | 42 +++++++++++++++++++++----------- ncurses/build.priv.h | 6 ++--- 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 +- progs/dump_entry.c | 31 +++++++++++++++++++++-- progs/tic.c | 4 +-- 16 files changed, 94 insertions(+), 39 deletions(-) diff --git a/NEWS b/NEWS index b461acde..50bc9c48 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3314 2019/05/04 20:55:23 tom Exp $ +-- $Id: NEWS,v 1.3317 2019/05/11 21:20:49 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,16 @@ 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. +20190511 + + fix a spurious blank line seen with "infocmp -1fx xterm+x11mouse" + + add checks in repair_subwindows() to keep the current position and + scroll-margins inside the resized subwindow. + + add a limit check in newline_forces_scroll() for the case where the + row is inside scroll-margins, but not at the end (report by Toshio + Kuratomi, cf: 20170729). + + corrected a warning message in tic for extended capabilities versus + number of parameters. + 20190504 + improve workaround for Solaris wcwidth versus line-drawing characters (report by Pavel Stehule). diff --git a/VERSION b/VERSION index b1e46f6a..b529c225 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.1 20190504 +5:0:10 6.1 20190511 diff --git a/dist.mk b/dist.mk index f247558d..f6e7d5c3 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1281 2019/05/04 10:02:52 tom Exp $ +# $Id: dist.mk,v 1.1282 2019/05/10 20:55:16 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 1 -NCURSES_PATCH = 20190504 +NCURSES_PATCH = 20190511 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/Makefile.in b/ncurses/Makefile.in index 5e528243..a81500ed 100644 --- a/ncurses/Makefile.in +++ b/ncurses/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.160 2019/03/09 23:39:14 tom Exp $ +# $Id: Makefile.in,v 1.161 2019/05/11 14:15:21 tom Exp $ ############################################################################## # Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. # # # @@ -233,11 +233,13 @@ keys.list : $(tinfo)/MKkeys_list.sh AWK=$(AWK) $(SHELL) $(tinfo)/MKkeys_list.sh $(CAPLIST) | LC_ALL=C sort >$@ make_keys$(BUILD_EXEEXT) : \ + build.priv.h \ $(tinfo)/make_keys.c \ names.c $(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(tinfo)/make_keys.c $(BUILD_LDFLAGS) $(BUILD_LIBS) make_hash$(BUILD_EXEEXT) : \ + build.priv.h \ $(tinfo)/make_hash.c \ ../include/hashsize.h $(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(tinfo)/make_hash.c $(BUILD_LDFLAGS) $(BUILD_LIBS) diff --git a/ncurses/base/lib_addch.c b/ncurses/base/lib_addch.c index 7c70fa63..fdb26415 100644 --- a/ncurses/base/lib_addch.c +++ b/ncurses/base/lib_addch.c @@ -36,7 +36,7 @@ #include #include -MODULE_ID("$Id: lib_addch.c,v 1.132 2019/05/04 20:46:24 tom Exp $") +MODULE_ID("$Id: lib_addch.c,v 1.133 2019/05/11 19:51:02 tom Exp $") static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); @@ -125,7 +125,7 @@ newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T *ypos) if (*ypos == win->_regbottom) { *ypos = win->_regbottom; result = TRUE; - } else { + } else if (*ypos < win->_maxy) { *ypos = (NCURSES_SIZE_T) (*ypos + 1); } } else if (*ypos < win->_maxy) { @@ -343,6 +343,7 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch) return ERR; x = win->_curx; y = win->_cury; + CHECK_POSITION(win, x, y); line = win->_line + y; } /* @@ -447,6 +448,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch) */ x = win->_curx; y = win->_cury; + CHECK_POSITION(win, x, y); switch (t) { case '\t': diff --git a/ncurses/base/wresize.c b/ncurses/base/wresize.c index bc6b5732..ee059403 100644 --- a/ncurses/base/wresize.c +++ b/ncurses/base/wresize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,13 +33,13 @@ #include -MODULE_ID("$Id: wresize.c,v 1.35 2011/05/21 18:55:07 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.38 2019/05/11 20:15:15 tom Exp $") static int cleanup_lines(struct ldat *data, int length) { while (--length >= 0) - free(data[length].text); + FreeAndNull(data[length].text); free(data); return ERR; } @@ -65,15 +65,29 @@ repair_subwindows(WINDOW *cmp) if (tst->_parent == cmp) { - if (tst->_pary > cmp->_maxy) - tst->_pary = cmp->_maxy; - if (tst->_parx > cmp->_maxx) - tst->_parx = cmp->_maxx; +#define REPAIR1(field, limit) \ + if (tst->field > cmp->limit) \ + tst->field = cmp->limit - if (tst->_maxy + tst->_pary > cmp->_maxy) - tst->_maxy = (NCURSES_SIZE_T) (cmp->_maxy - tst->_pary); - if (tst->_maxx + tst->_parx > cmp->_maxx) - tst->_maxx = (NCURSES_SIZE_T) (cmp->_maxx - tst->_parx); + REPAIR1(_pary, _maxy); + REPAIR1(_parx, _maxx); + +#define REPAIR2(field, limit) \ + if (tst->limit + tst->field > cmp->limit) \ + tst->limit = (NCURSES_SIZE_T) (cmp->limit - tst->field) + + REPAIR2(_pary, _maxy); + REPAIR2(_parx, _maxx); + +#define REPAIR3(field, limit) \ + if (tst->field > tst->limit) \ + tst->field = tst->limit + + REPAIR3(_cury, _maxy); + REPAIR3(_curx, _maxx); + + REPAIR3(_regtop, _maxy); + REPAIR3(_regbottom, _maxy); for (row = 0; row <= tst->_maxy; ++row) { tst->_line[row].text = &pline[tst->_pary + row].text[tst->_parx]; @@ -204,16 +218,16 @@ wresize(WINDOW *win, int ToLines, int ToCols) if (!(win->_flags & _SUBWIN)) { if (ToCols == size_x) { for (row = ToLines + 1; row <= size_y; row++) { - free(win->_line[row].text); + FreeAndNull(win->_line[row].text); } } else { for (row = 0; row <= size_y; row++) { - free(win->_line[row].text); + FreeAndNull(win->_line[row].text); } } } - free(win->_line); + FreeAndNull(win->_line); win->_line = new_lines; /* diff --git a/ncurses/build.priv.h b/ncurses/build.priv.h index 096a4431..84e4c52a 100644 --- a/ncurses/build.priv.h +++ b/ncurses/build.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2010-2012,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ ****************************************************************************/ /* - * $Id: build.priv.h,v 1.9 2012/02/22 22:17:02 tom Exp $ + * $Id: build.priv.h,v 1.10 2019/05/11 14:14:00 tom Exp $ * * build.priv.h * @@ -77,7 +77,7 @@ extern "C" { #define EXIT_FAILURE 1 #endif -#define FreeAndNull(p) free(p); p = 0 +#define FreeAndNull(p) do { free(p); p = 0; } while (0) #define UChar(c) ((unsigned char)(c)) #define SIZEOF(v) (sizeof(v) / sizeof(v[0])) diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index bce2e0f5..dcc0002d 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20190504) unstable; urgency=low +ncurses6 (6.1+20190511) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 May 2019 06:02:52 -0400 + -- Thomas E. Dickey Fri, 10 May 2019 16:55:16 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index bce2e0f5..dcc0002d 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20190504) unstable; urgency=low +ncurses6 (6.1+20190511) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 May 2019 06:02:52 -0400 + -- Thomas E. Dickey Fri, 10 May 2019 16:55:16 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index e5f12789..bae1d1b6 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20190504) unstable; urgency=low +ncurses6 (6.1+20190511) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 May 2019 06:02:52 -0400 + -- Thomas E. Dickey Fri, 10 May 2019 16:55:16 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 2c248594..a191ee9a 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.327 2019/05/04 10:02:52 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.328 2019/05/10 20:55:16 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "1" !define VERSION_YYYY "2019" -!define VERSION_MMDD "0504" +!define VERSION_MMDD "0511" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index bf86325d..8751d636 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.1 -Release: 20190504 +Release: 20190511 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 79510b61..034c4c96 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.1 -Release: 20190504 +Release: 20190511 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index 77bb65f0..49ee05a6 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.1 -Release: 20190504 +Release: 20190511 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 66b250b9..d0e420ec 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -39,7 +39,7 @@ #include "termsort.c" /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.172 2019/04/20 18:54:48 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.173 2019/05/11 21:02:24 tom Exp $") #define DISCARD(string) string = ABSENT_STRING #define PRINTF (void) printf @@ -718,6 +718,33 @@ indent_DYN(DYNBUF * buffer, int level) strncpy_DYN(buffer, "\t", (size_t) 1); } +/* + * Check if the current line which was begun consists only of a tab and the + * given leading text. + */ +static bool +leading_DYN(DYNBUF * buffer, const char *leading) +{ + bool result = FALSE; + size_t need = strlen(leading); + if (buffer->used > need) { + need = buffer->used - need; + if (!strcmp(buffer->text + need, leading)) { + result = TRUE; + while (--need != 0) { + if (buffer->text[need] == '\n') { + break; + } + if (buffer->text[need] != '\t') { + result = FALSE; + break; + } + } + } + } + return result; +} + bool has_params(const char *src) { @@ -821,7 +848,7 @@ fmt_complex(TERMTYPE2 *tterm, const char *capability, char *src, int level) } break; case 'p': - if (percent && params) { + if (percent && params && !leading_DYN(&tmpbuf, "%")) { tmpbuf.text[tmpbuf.used - 1] = '\n'; indent_DYN(&tmpbuf, level + 1); strncpy_DYN(&tmpbuf, "%", (size_t) 1); diff --git a/progs/tic.c b/progs/tic.c index e0dab070..1d403462 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.275 2019/05/04 14:41:06 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.276 2019/05/10 21:00:25 tom Exp $") #define STDIN_NAME "" @@ -1939,7 +1939,7 @@ check_params(TERMTYPE2 *tp, const char *name, char *value, int extended) #if NCURSES_XNAMES if (extended) { int check = is_user_capability(name); - if (check != actual) { + if (check != actual && (check >= 0 && actual >= 0)) { _nc_warning("extended %s capability has %d parameters, expected %d", name, actual, check); } else if (debug_level > 1) { -- 2.44.0