From 1f474475aab29bc166012819129d46c70320efdc Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 19 Oct 2021 00:28:18 +0000 Subject: [PATCH] ncurses 6.2 - patch 20211018 + check for screen size-change in scr_init() and scr_restore(), in case a screen dump does not match the current screen dimensions (report by Frank Tkalcevic). --- NEWS | 7 +++++- VERSION | 2 +- dist.mk | 4 +-- ncurses/base/lib_screen.c | 43 ++++++++++++++++++++++++-------- 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 +- 11 files changed, 53 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index 92aceb00..13e67f39 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.3729 2021/10/17 15:11:55 tom Exp $ +-- $Id: NEWS,v 1.3730 2021/10/18 22:51:28 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. +20211018 + + check for screen size-change in scr_init() and scr_restore(), in case + a screen dump does not match the current screen dimensions (report by + Frank Tkalcevic). + 20211017 + amend change for pkg-config to account for "none" being returned in the libdir-path result rather than "no" (report by Gabriele Balducci). diff --git a/VERSION b/VERSION index 477411b6..ea487977 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.2 20211017 +5:0:10 6.2 20211018 diff --git a/dist.mk b/dist.mk index c521e145..40f835df 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.1441 2021/10/17 14:58:11 tom Exp $ +# $Id: dist.mk,v 1.1442 2021/10/18 23:31:58 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 = 2 -NCURSES_PATCH = 20211017 +NCURSES_PATCH = 20211018 # 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_screen.c b/ncurses/base/lib_screen.c index 67fb421c..eacb03a6 100644 --- a/ncurses/base/lib_screen.c +++ b/ncurses/base/lib_screen.c @@ -42,7 +42,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_screen.c,v 1.101 2021/06/26 20:43:19 tom Exp $") +MODULE_ID("$Id: lib_screen.c,v 1.103 2021/10/18 22:40:48 tom Exp $") #define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */ @@ -200,7 +200,7 @@ read_txt(FILE *fp) if (ch == '\n') { result[--used] = '\0'; - T(("READ:%s", result)); + TR(TRACE_IEVENT, ("READ:%s", result)); } else if (used == 0) { free(result); result = 0; @@ -214,7 +214,7 @@ decode_attr(char *source, attr_t *target, int *color) { bool found = FALSE; - T(("decode_attr '%s'", source)); + TR(TRACE_IEVENT, ("decode_attr '%s'", source)); while (*source) { if (source[0] == MARKER && source[1] == L_CURL) { @@ -272,7 +272,7 @@ decode_char(char *source, int *target) int base = 16; const char digits[] = "0123456789abcdef"; - T(("decode_char '%s'", source)); + TR(TRACE_IEVENT, ("decode_char '%s'", source)); *target = ' '; switch (*source) { case MARKER: @@ -329,7 +329,7 @@ decode_chtype(char *source, chtype fillin, chtype *target) int color = PAIR_NUMBER((int) attr); int value; - T(("decode_chtype '%s'", source)); + TR(TRACE_IEVENT, ("decode_chtype '%s'", source)); source = decode_attr(source, &attr, &color); source = decode_char(source, &value); *target = (ChCharOf(value) | attr | (chtype) COLOR_PAIR(color)); @@ -347,7 +347,7 @@ decode_cchar(char *source, cchar_t *fillin, cchar_t *target) int append = 0; int value = 0; - T(("decode_cchar '%s'", source)); + TR(TRACE_IEVENT, ("decode_cchar '%s'", source)); *target = blank; #if NCURSES_EXT_COLORS color = fillin->ext_color; @@ -940,6 +940,31 @@ putwin(WINDOW *win, FILE *filep) returnCode(code); } +/* + * Replace a window covering the whole screen, i.e., newscr or curscr. + */ +static WINDOW * +replace_window(WINDOW *target, FILE *source) +{ + WINDOW *result = getwin(source); +#if NCURSES_EXT_FUNCS + if (result != NULL) { + if (getmaxx(result) != getmaxx(target) + || getmaxy(result) != getmaxy(target)) { + int code = wresize(result, + 1 + getmaxy(target), + 1 + getmaxx(target)); + if (code != OK) { + delwin(result); + result = NULL; + } + } + } +#endif + delwin(target); + return result; +} + NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (NCURSES_SP_DCLx const char *file) { @@ -950,8 +975,7 @@ NCURSES_SP_NAME(scr_restore) (NCURSES_SP_DCLx const char *file) if (_nc_access(file, R_OK) >= 0 && (fp = safe_fopen(file, BIN_R)) != 0) { - delwin(NewScreen(SP_PARM)); - NewScreen(SP_PARM) = getwin(fp); + NewScreen(SP_PARM) = replace_window(NewScreen(SP_PARM), fp); #if !USE_REENTRANT newscr = NewScreen(SP_PARM); #endif @@ -1008,8 +1032,7 @@ NCURSES_SP_NAME(scr_init) (NCURSES_SP_DCLx const char *file) if (_nc_access(file, R_OK) >= 0 && (fp = safe_fopen(file, BIN_R)) != 0) { - delwin(CurScreen(SP_PARM)); - CurScreen(SP_PARM) = getwin(fp); + CurScreen(SP_PARM) = replace_window(CurScreen(SP_PARM), fp); #if !USE_REENTRANT curscr = CurScreen(SP_PARM); #endif diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 729ccb35..776ac825 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20211017) unstable; urgency=low +ncurses6 (6.2+20211018) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 17 Oct 2021 10:58:11 -0400 + -- Thomas E. Dickey Mon, 18 Oct 2021 19:31:58 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 729ccb35..776ac825 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20211017) unstable; urgency=low +ncurses6 (6.2+20211018) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 17 Oct 2021 10:58:11 -0400 + -- Thomas E. Dickey Mon, 18 Oct 2021 19:31:58 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index d59c231b..4f42d238 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20211017) unstable; urgency=low +ncurses6 (6.2+20211018) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 17 Oct 2021 10:58:11 -0400 + -- Thomas E. Dickey Mon, 18 Oct 2021 19:31:58 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 7fa33938..a9592e27 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.483 2021/10/17 14:58:11 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.484 2021/10/18 23:31:58 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "2" !define VERSION_YYYY "2021" -!define VERSION_MMDD "1017" +!define VERSION_MMDD "1018" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index b907a567..c7d7428d 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.2 -Release: 20211017 +Release: 20211018 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 9e9767b3..40457320 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.2 -Release: 20211017 +Release: 20211018 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index 51ab385c..f5da76c0 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.2 -Release: 20211017 +Release: 20211018 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz -- 2.44.0