From 2db461ea0b1b29c142e3000d830b520c946e385b Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 3 May 2020 02:00:56 +0000 Subject: [PATCH] ncurses 6.2 - patch 20200502 + add details on the change to Linux SGR 21 in 2018 -TD + add xterm-direct16 and xterm-direct256 -TD + modify lib_mouse.c to check for out-of-range button numbers, convert those to position reports. --- NEWS | 8 ++++- VERSION | 2 +- dist.mk | 4 +-- include/Caps-ncurses | 3 +- misc/terminfo.src | 58 ++++++++++++++++++++++++++++---- ncurses/base/lib_mouse.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 +- 13 files changed, 114 insertions(+), 26 deletions(-) diff --git a/NEWS b/NEWS index b5e9dfe8..e1487689 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.3479 2020/04/26 00:40:38 tom Exp $ +-- $Id: NEWS,v 1.3482 2020/05/02 23:42:21 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,12 @@ 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. +20200502 + + add details on the change to Linux SGR 21 in 2018 -TD + + add xterm-direct16 and xterm-direct256 -TD + + modify lib_mouse.c to check for out-of-range button numbers, convert + those to position reports. + 20200425 + use vt100+fnkeys in putty -TD + fix a typo in tput.1; "columns" should be "cols". diff --git a/VERSION b/VERSION index 9dabf2ac..45f3b190 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.2 20200425 +5:0:10 6.2 20200502 diff --git a/dist.mk b/dist.mk index 539b68ee..6619b40c 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.1347 2020/04/25 09:36:39 tom Exp $ +# $Id: dist.mk,v 1.1348 2020/05/02 09:32:34 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 = 20200425 +NCURSES_PATCH = 20200502 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/Caps-ncurses b/include/Caps-ncurses index a1aef0d5..48956d0e 100644 --- a/include/Caps-ncurses +++ b/include/Caps-ncurses @@ -28,7 +28,7 @@ # # Author: Thomas E. Dickey # -# $Id: Caps-ncurses,v 1.8 2020/02/02 23:34:34 tom Exp $ +# $Id: Caps-ncurses,v 1.9 2020/05/02 23:35:12 tom Exp $ # ############################################################################# # @@ -342,6 +342,7 @@ infoalias ksel kslt IBM key_select # are not listed here. # used_by ncurses +userdef CO num n number of indexed colors overlaying RGB space userdef E3 str - clears the terminal's scrollback buffer. userdef RGB bool - use direct colors with 1/3 of color-pair bits per color. userdef RGB num n use direct colors with given number of bits per color. diff --git a/misc/terminfo.src b/misc/terminfo.src index 48f4b23f..83b490af 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.790 $ -# $Date: 2020/04/26 00:38:36 $ +# $Revision: 1.795 $ +# $Date: 2020/05/02 23:39:49 $ # # 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 @@ -1131,7 +1131,17 @@ fbterm|FbTerm for Linux with framebuffer, # (but nonstandard) SGR 21, which was supported in the Linux console since 1992 # as an equivalent for SGR 22. Long after (early 2018), someone modified the # console driver to make it ignore SGR 21 because the ECMA-48 standard -# suggested a different use for that particular code. +# suggested a different use for that particular code: +# +# https://github.com/torvalds/linux/commit/65d9982d7e523a1a8e7c9af012da0d166f72fc56#diff-7da3c215d12c9f6b88e1a37d38b116f0 +# +# Two years later, someone (unfamiliar with ECMA-48 this time) documented it: +# +# https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man4/console_codes.4?id=a133a6bc03d751a424fe0a4adea2198757599615 +# +# For background, refer to the report on bug-ncurses: +# +# https://lists.gnu.org/archive/html/bug-ncurses/2019-10/msg00059.html linux-16color|linux console with 16 colors, colors#16, ncv#42, pairs#0x100, setab=\E[4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m, @@ -4873,7 +4883,7 @@ xterm-88color|xterm with 88 colors, # for numeric capabilities provided in ncurses 6.1: xterm+direct2|xterm with direct-color indexing, RGB, - colors#0x1000000, pairs#0x10000, + colors#0x1000000, pairs#0x10000, CO#8, initc@, op=\E[39;49m, setab=\E[%?%p1%{8}%<%t4%p1%d%e48\:2\:%p1%{65536}%/%d\:%p1 %{256}%/%{255}%&%d\:%p1%{255}%&%d%;m, @@ -4888,7 +4898,7 @@ xterm-direct2|xterm with direct-color indexing (old), # identifier" parameter. This version provides for that parameter: xterm+direct|xterm with direct-color indexing, RGB, - colors#0x1000000, pairs#0x10000, + colors#0x1000000, pairs#0x10000, CO#8, initc@, op=\E[39;49m, setab=\E[%?%p1%{8}%<%t4%p1%d%e48\:2\:\:%p1%{65536}%/%d\:%p1 %{256}%/%{255}%&%d\:%p1%{255}%&%d%;m, @@ -4927,7 +4937,7 @@ vte-direct|vte with direct-color indexing, nsterm-direct|nsterm with direct-color indexing, use=xterm+indirect, use=nsterm, -# As for others: +# As for others (commenting at the time of release for ncurses 6.1): # + Apple's Terminal.app does not recognize either form of the direct-color # sequences. # + Cygwin's mintty recognizes xterm's original implementation, does okay with @@ -4939,6 +4949,36 @@ nsterm-direct|nsterm with direct-color indexing, # + terminology 0.91 recognizes xterm's original implementation, but does # nothing useful with it. +# Other variants are possible, e.g., by using more of xterm's indexed color +# palette, though the intrusion of indexed colors on the direct-color space +# would be more noticeable. + +xterm+direct16|xterm with direct-color indexing, + CO#16, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%?%p1%{16}%<%t%p1%{92}%+%e48\: + 2\:\:%p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255} + %&%d%;%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%?%p1%{16}%<%t%p1%'R'%+%e38\:2 + \:\:%p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255} + %&%d%;%;m, + setb@, setf@, use=xterm+direct, + +xterm-direct16|xterm with direct-colors and 16 indexed colors, + use=xterm, use=xterm+direct16, + +xterm+direct256|xterm with direct-color indexing, + CO#0x100, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e%? + %p1%{256}%<%t48;5;%p1%d%e48\:2\:\:%p1%{65536}%/%d\:%p1 + %{256}%/%{255}%&%d\:%p1%{255}%&%d%;%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e%? + %p1%{256}%<%t38;5;%p1%d%e38\:2\:\:%p1%{65536}%/%d\:%p1 + %{256}%/%{255}%&%d\:%p1%{255}%&%d%;%;m, + setb@, setf@, use=xterm+direct, + +xterm-direct256|xterm with direct-colors and 256 indexed colors, + use=xterm, use=xterm+direct256, + #### XTERM Features # This chunk is based on suggestions by Ailin Nemui and Nicholas Marriott, who @@ -24545,6 +24585,8 @@ v3220|LANPAR Vision II model 3220/3221/3222, # This was implemented for the Hurd. # rmxx/smxx describes the ECMA-48 strikeout/crossed-out attributes, as an # experimental feature of tmux. +# CO gives the number of indexed ("ANSI") colors which overlay an RGB color +# space. # E3 clears the terminal's scrollback buffer. This was implemented in the # Linux 3.0 kernel as a security feature. It matches a feature which was # added in xterm patch #107. @@ -26488,4 +26530,8 @@ v3220|LANPAR Vision II model 3220/3221/3222, # 2020-04-25 # + use vt100+fnkeys in putty -TD # +# 2020-05-02 +# + add details on the change to Linux SGR 21 in 2018 -TD +# + add xterm-direct16 and xterm-direct256 -TD +# ######## SHANTIH! SHANTIH! SHANTIH! diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index 2530dec5..8705a39a 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -85,7 +85,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_mouse.c,v 1.184 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.186 2020/05/02 21:13:04 tom Exp $") #include @@ -142,19 +142,29 @@ make an error #define MASK_RESERVED_EVENT(x) (mmask_t) NCURSES_MOUSE_MASK(x, 040) #if NCURSES_MOUSE_VERSION == 1 + #define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED) #define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED) #define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED | BUTTON4_RELEASED) #define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED) #define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED) + #define MAX_BUTTONS 4 + #else + #define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED | BUTTON5_CLICKED) #define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED | BUTTON5_PRESSED) #define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED | BUTTON4_RELEASED | BUTTON5_RELEASED) #define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED | BUTTON5_DOUBLE_CLICKED) #define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED | BUTTON5_TRIPLE_CLICKED) + +#if NCURSES_MOUSE_VERSION == 2 #define MAX_BUTTONS 5 +#else +#define MAX_BUTTONS 11 +#endif + #endif #define INVALID_EVENT -1 @@ -928,7 +938,7 @@ handle_wheel(SCREEN *sp, MEVENT * eventp, int button, int wheel) break; case 1: if (wheel) { -#if NCURSES_MOUSE_VERSION == 2 +#if NCURSES_MOUSE_VERSION >= 2 eventp->bstate = MASK_PRESS(5); /* See comment above for button 4 */ #else @@ -953,10 +963,24 @@ static bool decode_X10_bstate(SCREEN *sp, MEVENT * eventp, unsigned intro) { bool result; + int button; + int wheel = (intro & 96) == 96; eventp->bstate = 0; - if (!handle_wheel(sp, eventp, (int) intro, (intro & 96) == 96)) { + if (intro >= 96) { + if (intro >= 160) { + button = (intro - 152); /* buttons 8-11 */ + } else if (intro >= 96) { + button = (intro - 92); /* buttons 4-7 */ + } + } else { + button = (intro & 3); + } + + if (button > MAX_BUTTONS) { + eventp->bstate = REPORT_MOUSE_POSITION; + } else if (!handle_wheel(sp, eventp, (int) intro, wheel)) { /* * Release events aren't reported for individual buttons, just for @@ -1261,10 +1285,21 @@ decode_xterm_SGR1006(SCREEN *sp, MEVENT * eventp) if (read_SGR(sp, &data)) { int b = data.params[0]; int b3 = 1 + (b & 3); + int wheel = ((b & 64) == 64); + + if (b >= 132) { + b3 = MAX_BUTTONS + 1; + } else if (b >= 128) { + b3 = (b - 120); /* buttons 8-11 */ + } else if (b >= 64) { + b3 = (b - 60); /* buttons 6-7 */ + } eventp->id = NORMAL_EVENT; if (data.final == 'M') { - (void) handle_wheel(sp, eventp, b, (b & 64) == 64); + (void) handle_wheel(sp, eventp, b, wheel); + } else if (b3 > MAX_BUTTONS) { + eventp->bstate = REPORT_MOUSE_POSITION; } else { mmask_t pressed = (mmask_t) NCURSES_MOUSE_MASK(b3, NCURSES_BUTTON_PRESSED); mmask_t release = (mmask_t) NCURSES_MOUSE_MASK(b3, NCURSES_BUTTON_RELEASED); diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 9203623a..bdda0d6c 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20200425) unstable; urgency=low +ncurses6 (6.2+20200502) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 25 Apr 2020 05:36:39 -0400 + -- Thomas E. Dickey Sat, 02 May 2020 05:32:34 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 9203623a..bdda0d6c 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20200425) unstable; urgency=low +ncurses6 (6.2+20200502) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 25 Apr 2020 05:36:39 -0400 + -- Thomas E. Dickey Sat, 02 May 2020 05:32:34 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index a9bd71ce..d11aa131 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20200425) unstable; urgency=low +ncurses6 (6.2+20200502) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 25 Apr 2020 05:36:39 -0400 + -- Thomas E. Dickey Sat, 02 May 2020 05:32:34 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 166a63df..79c16b45 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.391 2020/04/25 09:36:39 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.392 2020/05/02 09:32:34 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 "2020" -!define VERSION_MMDD "0425" +!define VERSION_MMDD "0502" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 76409537..776a3c33 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: 20200425 +Release: 20200502 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index fe5e58c4..55e764cc 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: 20200425 +Release: 20200502 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index 6ca39612..15788ba9 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: 20200425 +Release: 20200502 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz -- 2.44.0