From 27d1493340d714e7be6e08c0a8f43e48276149c4 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 29 Mar 2025 22:52:37 +0000 Subject: [PATCH] snapshot of project "ncurses", label v6_5_20250329 --- NEWS | 12 +++++++++- VERSION | 2 +- dist.mk | 4 ++-- include/nc_win32.h | 3 ++- misc/terminfo.src | 10 +++++--- ncurses/tinfo/MKfallback.sh | 8 +++---- ncurses/tinfo/lib_win32con.c | 40 ++++++++++++++++---------------- ncurses/tinfo/parse_entry.c | 4 +++- ncurses/tinfo/tinfo_driver.c | 18 +++++++++++--- ncurses/win32con/win32_driver.c | 8 +++---- ncurses/win32con/win_driver.c | 8 +++---- 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 +- 18 files changed, 84 insertions(+), 55 deletions(-) diff --git a/NEWS b/NEWS index e5c6b7e5..a358c581 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.4264 2025/03/22 23:18:22 tom Exp $ +-- $Id: NEWS,v 1.4267 2025/03/29 22:52:37 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,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. +20250329 + + add XM/xm to ms-terminal, to enable mouse with experimental Windows + driver -TD + + add -x option to infocmp in MKfallback.sh + + improve experimental Windows driver by restoring the scroll buffer + and console mode, e.g., when reset_prog_mode or endwin is called + (patch by Daniel Starke). + + add a buffer-limit check in postprocess_termcap (report/testcase by + Yifan Zhang). + 20250322 + add a null pointer check in mouse-initialization, for the experimental Windows driver (patch by Daniel Starke). diff --git a/VERSION b/VERSION index 7df27c94..c01d0677 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.5 20250322 +5:0:10 6.5 20250329 diff --git a/dist.mk b/dist.mk index af38ae05..9ed0b934 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.1661 2025/03/22 10:41:37 tom Exp $ +# $Id: dist.mk,v 1.1662 2025/03/29 11:09:16 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 = 5 -NCURSES_PATCH = 20250322 +NCURSES_PATCH = 20250329 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/nc_win32.h b/include/nc_win32.h index edfb84f0..3bc022c0 100644 --- a/include/nc_win32.h +++ b/include/nc_win32.h @@ -31,7 +31,7 @@ * Author: Thomas Dickey, 2008-on * ****************************************************************************/ -/* $Id: nc_win32.h,v 1.16 2025/03/08 14:21:17 tom Exp $ */ +/* $Id: nc_win32.h,v 1.17 2025/03/29 16:45:33 Daniel.Starke Exp $ */ #ifndef NC_WIN32_H #define NC_WIN32_H 1 @@ -109,6 +109,7 @@ extern NCURSES_EXPORT(int) _nc_console_testmouse(const SCREEN *,HANDLE,int EV extern NCURSES_EXPORT(int) _nc_console_keyok(int keycode,int flag); extern NCURSES_EXPORT(bool) _nc_console_keyExist(int keycode); extern NCURSES_EXPORT(bool) _nc_console_checkinit(bool initFlag, bool assumeTermInfo); +extern NCURSES_EXPORT(bool) _nc_console_restore(void); extern NCURSES_EXPORT(int) _nc_console_vt_supported(void); #ifdef _NC_CHECK_MINTTY diff --git a/misc/terminfo.src b/misc/terminfo.src index 039837ee..75677a25 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src @@ -6,8 +6,8 @@ # Report bugs and new terminal descriptions to # bug-ncurses@gnu.org # -# $Revision: 1.1175 $ -# $Date: 2025/03/01 21:54:30 $ +# $Revision: 1.1176 $ +# $Date: 2025/03/29 22:49:47 $ # # The original header is preserved below for reference. It is noted that there # is a "newer" version which differs in some cosmetic details (but actually @@ -4760,7 +4760,7 @@ ms+terminal|building block for Windows terminal, use=bracketed+paste, use=xterm+pcfkeys, use=ansi+rep, use=xterm+sm+1006, use=ecma+index, use=ecma+italics, use=ecma+strikeout, use=vt420+lrmm, use=xterm-basic, - use=xterm+focus, use=xterm+tmux, + use=xterm+focus, use=xterm+tmux, use=xterm+sm+1003, #### Visual Studio # Visual Studio Code 1.45.0 uses xterm.js 12.8.1 (see https://xtermjs.org/). @@ -27808,4 +27808,8 @@ v3220|LANPAR Vision II model 3220/3221/3222, # + add color to vt525 (Branden Robinson) # + add vt520-w and vt525-w (Branden Robinson) # +# 2025-03-29 +# + add XM/xm to ms-terminal, to enable mouse with experimental Windows +# driver -TD +# ######## SHANTIH! SHANTIH! SHANTIH! diff --git a/ncurses/tinfo/MKfallback.sh b/ncurses/tinfo/MKfallback.sh index cfdfa7da..97f35d82 100755 --- a/ncurses/tinfo/MKfallback.sh +++ b/ncurses/tinfo/MKfallback.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# Copyright 2020,2023 Thomas E. Dickey # +# Copyright 2020-2023,2025 Thomas E. Dickey # # Copyright 1998-2019,2020 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -27,7 +27,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: MKfallback.sh,v 1.28 2024/12/21 18:45:15 tom Exp $ +# $Id: MKfallback.sh,v 1.29 2025/03/29 22:48:05 tom Exp $ # # MKfallback.sh -- create fallback table for entry reads # @@ -95,7 +95,7 @@ EOF for x in "$@" do echo "/* $x */" - "$infocmp_path" -E "$x" | sed -e 's/[ ]short[ ]/ NCURSES_INT2 /g' + "$infocmp_path" -x -E "$x" | sed -e 's/[ ]short[ ]/ NCURSES_INT2 /g' done cat < -MODULE_ID("$Id: lib_win32con.c,v 1.19 2025/03/08 14:20:11 tom Exp $") +MODULE_ID("$Id: lib_win32con.c,v 1.21 2025/03/29 19:36:13 tom Exp $") #if defined(_NC_WINDOWS) @@ -259,36 +259,20 @@ _nc_console_setmode(HANDLE hdl, const TTY * arg) T(("lib_win32con:_nc_console_setmode %s", _nc_trace_ttymode(arg))); if (hdl == WINCONSOLE.inp) { dwFlag = arg->dwFlagIn | ENABLE_MOUSE_INPUT | VT_FLAG_IN; - if (WINCONSOLE.isTermInfoConsole) - dwFlag |= (VT_FLAG_IN); - else - dwFlag &= (DWORD) ~ (VT_FLAG_IN); TRCTTYIN(dwFlag); SetConsoleMode(hdl, dwFlag); alt = OutHandle(); dwFlag = arg->dwFlagOut; - if (WINCONSOLE.isTermInfoConsole) - dwFlag |= (VT_FLAG_OUT); - else - dwFlag |= (VT_FLAG_OUT); TRCTTYOUT(dwFlag); SetConsoleMode(alt, dwFlag); } else { dwFlag = arg->dwFlagOut; - if (WINCONSOLE.isTermInfoConsole) - dwFlag |= (VT_FLAG_OUT); - else - dwFlag |= (VT_FLAG_OUT); TRCTTYOUT(dwFlag); SetConsoleMode(hdl, dwFlag); alt = WINCONSOLE.inp; dwFlag = arg->dwFlagIn | ENABLE_MOUSE_INPUT; - if (WINCONSOLE.isTermInfoConsole) - dwFlag |= (VT_FLAG_IN); - else - dwFlag &= (DWORD) ~ (VT_FLAG_IN); TRCTTYIN(dwFlag); SetConsoleMode(alt, dwFlag); T(("effective mode set %s", _nc_trace_ttymode(&TRCTTY))); @@ -404,7 +388,6 @@ save_original_screen(void) return result; } -#if 0 static bool restore_original_screen(void) { @@ -426,7 +409,7 @@ restore_original_screen(void) bufferCoord, &save_region)) { result = TRUE; - mvcur(-1, -1, LINES - 2, 0); + SetConsoleCursorPosition(WINCONSOLE.hdl, WINCONSOLE.save_SBI.dwCursorPosition); T(("... restore original screen contents ok %dx%d (%d,%d - %d,%d)", WINCONSOLE.save_size.Y, WINCONSOLE.save_size.X, @@ -439,7 +422,6 @@ restore_original_screen(void) } return result; } -#endif static bool read_screen_data(void) @@ -1248,4 +1230,22 @@ _nc_console_checkinit(bool initFlag, bool assumeTermInfo) returnBool(res); } +NCURSES_EXPORT(bool) +_nc_console_restore(void) +{ + bool res = FALSE; + + T((T_CALLED("lib_win32con::_nc_console_restore"))); + if (WINCONSOLE.hdl != INVALID_HANDLE_VALUE) { + res = TRUE; + if (!WINCONSOLE.buffered) { + _nc_console_set_scrollback(TRUE, &WINCONSOLE.save_SBI); + if (!restore_original_screen()) + res = FALSE; + } + SetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI); + } + returnBool(res); +} + #endif // _NC_WINDOWS diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c index a2278c07..c551c780 100644 --- a/ncurses/tinfo/parse_entry.c +++ b/ncurses/tinfo/parse_entry.c @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: parse_entry.c,v 1.115 2025/02/20 09:11:49 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.116 2025/03/24 22:27:29 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -990,6 +990,8 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base) bp = tp->Strings[from_ptr->nte_index]; if (VALID_STRING(bp)) { for (dp = buf2; *bp; bp++) { + if ((size_t) (dp - buf2) >= (sizeof(buf2) - sizeof(TERMTYPE2))) + break; if (bp[0] == '$' && bp[1] == '<') { while (*bp && *bp != '>') { ++bp; diff --git a/ncurses/tinfo/tinfo_driver.c b/ncurses/tinfo/tinfo_driver.c index 3bdd8124..e22d7640 100644 --- a/ncurses/tinfo/tinfo_driver.c +++ b/ncurses/tinfo/tinfo_driver.c @@ -52,7 +52,7 @@ # endif #endif -MODULE_ID("$Id: tinfo_driver.c,v 1.79 2025/02/20 01:30:20 tom Exp $") +MODULE_ID("$Id: tinfo_driver.c,v 1.82 2025/03/29 19:28:44 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -489,7 +489,8 @@ drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp) /* * If environment variables are used, update them. */ - if ((sp == NULL || !sp->_filtered) && _nc_getenv_num("LINES") > 0) { + if ((sp == NULL || !sp->_filtered) + && _nc_getenv_num("LINES") > 0) { _nc_setenv_num("LINES", *linep); } if (_nc_getenv_num("COLUMNS") > 0) { @@ -604,6 +605,8 @@ drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) AssertTCB(); sp = TCB->csp; + T((T_CALLED("tinfo:drv_mode(%p,%d,%d)"), (void *) sp, progFlag, defFlag)); + if (progFlag) /* prog mode */ { if (defFlag) { @@ -628,6 +631,10 @@ drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) if (sp->_keypad_on) _nc_keypad(sp, TRUE); } +#if defined(EXP_WIN32_DRIVER) + if (!WINCONSOLE.buffered) + _nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI); +#endif code = OK; } } @@ -656,9 +663,13 @@ drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) NCURSES_SP_NAME(_nc_flush) (sp); } code = drv_sgmode(TCB, TRUE, &(_term->Ottyb)); +#if defined(EXP_WIN32_DRIVER) + if (!_nc_console_restore()) + code = ERR; +#endif } } - return (code); + returnCode(code); } static void @@ -1540,6 +1551,7 @@ _nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret) #endif if (strcmp(DriverTable[i].name, res->td_name(TCB)) == 0) { if (res->td_CanHandle(TCB, name, errret)) { + T(("matched driver %s with TERM=%s", DriverTable[i].name, name)); use = res; break; } diff --git a/ncurses/win32con/win32_driver.c b/ncurses/win32con/win32_driver.c index 9a62856e..4bc75c16 100644 --- a/ncurses/win32con/win32_driver.c +++ b/ncurses/win32con/win32_driver.c @@ -48,7 +48,7 @@ #define CUR TerminalType(my_term). -MODULE_ID("$Id: win32_driver.c,v 1.7 2025/03/01 14:26:14 tom Exp $") +MODULE_ID("$Id: win32_driver.c,v 1.8 2025/03/29 19:31:07 tom Exp $") #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE) #define EXP_OPTIMIZE 0 @@ -762,12 +762,12 @@ wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) TERMINAL *_term = (TERMINAL *) TCB; int code = ERR; + T((T_CALLED("win32con::wcon_mode(%p, progFlag=%d, defFlag=%d)"), + TCB, progFlag, defFlag)); + if (validateConsoleHandle()) { sp = TCB->csp; - T((T_CALLED("win32con::wcon_mode(%p, progFlag=%d, defFlag=%d)"), - TCB, progFlag, defFlag)); - WINCONSOLE.progMode = progFlag; WINCONSOLE.lastOut = progFlag ? WINCONSOLE.hdl : WINCONSOLE.out; SetConsoleActiveScreenBuffer(WINCONSOLE.lastOut); diff --git a/ncurses/win32con/win_driver.c b/ncurses/win32con/win_driver.c index 98714ef1..82c419a4 100644 --- a/ncurses/win32con/win_driver.c +++ b/ncurses/win32con/win_driver.c @@ -57,7 +57,7 @@ #define CONTROL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) -MODULE_ID("$Id: win_driver.c,v 1.81 2025/03/01 17:17:46 tom Exp $") +MODULE_ID("$Id: win_driver.c,v 1.82 2025/03/29 19:31:24 tom Exp $") #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE) @@ -1015,12 +1015,12 @@ wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) TERMINAL *_term = (TERMINAL *) TCB; int code = ERR; + T((T_CALLED("win32con::wcon_mode(%p, prog=%d, def=%d)"), + TCB, progFlag, defFlag)); + if (okConsoleHandle(TCB)) { sp = TCB->csp; - T((T_CALLED("win32con::wcon_mode(%p, prog=%d, def=%d)"), - TCB, progFlag, defFlag)); - CON.progMode = progFlag; CON.lastOut = progFlag ? CON.hdl : CON.out; SetConsoleActiveScreenBuffer(CON.lastOut); diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 5b220987..1bf98f19 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6td (6.5+20250322) unstable; urgency=low +ncurses6td (6.5+20250329) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 22 Mar 2025 06:41:37 -0400 + -- Thomas E. Dickey Sat, 29 Mar 2025 07:09:16 -0400 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 5b220987..1bf98f19 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6td (6.5+20250322) unstable; urgency=low +ncurses6td (6.5+20250329) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 22 Mar 2025 06:41:37 -0400 + -- Thomas E. Dickey Sat, 29 Mar 2025 07:09:16 -0400 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index 0a493be1..7c179a65 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6td (6.5+20250322) unstable; urgency=low +ncurses6td (6.5+20250329) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 22 Mar 2025 06:41:37 -0400 + -- Thomas E. Dickey Sat, 29 Mar 2025 07:09:16 -0400 ncurses6 (5.9+20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index b199e08a..eea39be3 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.695 2025/03/22 10:41:37 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.696 2025/03/29 11:09:16 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "5" !define VERSION_YYYY "2025" -!define VERSION_MMDD "0322" +!define VERSION_MMDD "0329" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 14e11669..d6ef661f 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.5 -Release: 20250322 +Release: 20250329 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncurses.spec b/package/ncurses.spec index 54534c97..afb40fae 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.5 -Release: 20250322 +Release: 20250329 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncursest.spec b/package/ncursest.spec index 9dd689b0..c1673b7b 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.5 -Release: 20250322 +Release: 20250329 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz