snapshot of project "ncurses", label v6_5_20250830

This commit is contained in:
Thomas E. Dickey 2025-08-30 22:47:12 +00:00
parent ec918320a4
commit 5f58399b2d
No known key found for this signature in database
GPG Key ID: CC2AF4472167BE03
20 changed files with 306 additions and 519 deletions

8
NEWS
View File

@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.4332 2025/08/23 22:57:13 tom Exp $
-- $Id: NEWS,v 1.4336 2025/08/30 21:02:17 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.
20250830
+ in-progress work to merge MinGW/Windows port.
+ build-fix for experimental Windows configuration (report by Kirill
Makurin).
+ improve pattern used for configure --with-xterm-kbs option.
20250823
+ improve style of MKterminfo.sh script (patches by Branden Robinson).
+ improve formatting/style of manpages (patches by Branden Robinson).

View File

@ -1 +1 @@
5:0:10 6.5 20250823
5:0:10 6.5 20250830

54
aclocal.m4 vendored
View File

@ -29,7 +29,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: aclocal.m4,v 1.1116 2025/08/09 00:45:30 tom Exp $
dnl $Id: aclocal.m4,v 1.1118 2025/08/28 00:35:59 tom Exp $
dnl Macros used in NCURSES auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
@ -10250,6 +10250,58 @@ fi
AC_SUBST(no_x11_rgb)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_XTERM_KBS version: 2 updated: 2025/08/27 20:35:59
dnl -----------------
dnl Configure-option with platform-defaults for the "xterm+kbs" building block
dnl in the terminfo file.
dnl
dnl The terminfo "kbs" value corresponds to "stty erase", and is conventionally
dnl assigned to the key which has
dnl
dnl a "Backspace" label and/or
dnl a backarrow symbol.
dnl
dnl See XTerm FAQ "Why doesn't my delete key work?"
dnl https://invisible-island.net/xterm/xterm.faq.html#xterm_erase
AC_DEFUN([CF_WITH_XTERM_KBS],[
case $host_os in
(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnuabielfv*|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc|linux*musl|openbsd*|darwin*)
want_xterm_kbs=DEL
;;
(*)
want_xterm_kbs=BS
;;
esac
AC_MSG_CHECKING(if xterm backspace-key sends BS or DEL)
AC_ARG_WITH(xterm-kbs,
[[ --with-xterm-kbs[=XXX] specify if xterm backspace-key sends BS or DEL]],
[with_xterm_kbs=$withval],
[with_xterm_kbs=auto])
case x$with_xterm_kbs in
(xyes|xno|xBS|xbs|x8)
with_xterm_kbs=BS
;;
(xDEL|xdel|x127)
with_xterm_kbs=DEL
;;
(xauto)
with_xterm_kbs=$want_xterm_kbs
;;
(*)
with_xterm_kbs=$withval
;;
esac
AC_MSG_RESULT($with_xterm_kbs)
XTERM_KBS=$with_xterm_kbs
AC_SUBST(XTERM_KBS)
if test "x$with_xterm_kbs" != "x$want_xterm_kbs"
then
AC_MSG_WARN([expected --with-xterm-kbs=$want_xterm_kbs for $host_os, have $with_xterm_kbs])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_XOPEN_SOURCE version: 69 updated: 2025/07/26 14:09:49
dnl ---------------
dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,

10
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Revision: 1.807 .
# From configure.in Revision: 1.808 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by Autoconf 2.52.20250126.
#
@ -778,7 +778,7 @@ Fine-Tuning Your Configuration:
--with-tic-path=XXX specify path of tic for fallbacks
--with-infocmp-path=XXX specify path of infocmp for fallbacks
--without-xterm-new specify if xterm terminfo should be old version
--with-xterm-kbs[=XXX] specify if xterm backspace sends BS or DEL
--with-xterm-kbs[=XXX] specify if xterm backspace-key sends BS or DEL
--with-terminfo-dirs=XXX specify list of terminfo directories (default: DATADIR/terminfo)
--with-default-terminfo-dir=DIR default terminfo directory (default: DATADIR/terminfo)
--disable-big-core assume machine has little memory
@ -9794,7 +9794,7 @@ echo "${ECHO_T}$with_xterm_new" >&6
WHICH_XTERM=$with_xterm_new
case $host_os in
(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnuabielfv*|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc|linux*musl)
(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnuabielfv*|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc|linux*musl|openbsd*|darwin*)
want_xterm_kbs=DEL
;;
(*)
@ -9802,8 +9802,8 @@ case $host_os in
;;
esac
echo "$as_me:9805: checking if xterm backspace sends BS or DEL" >&5
echo $ECHO_N "checking if xterm backspace sends BS or DEL... $ECHO_C" >&6
echo "$as_me:9805: checking if xterm backspace-key sends BS or DEL" >&5
echo $ECHO_N "checking if xterm backspace-key sends BS or DEL... $ECHO_C" >&6
# Check whether --with-xterm-kbs or --without-xterm-kbs was given.
if test "${with_xterm_kbs+set}" = set; then

View File

@ -29,7 +29,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: configure.in,v 1.807 2025/08/09 19:49:48 tom Exp $
dnl $Id: configure.in,v 1.808 2025/08/27 08:18:27 tom Exp $
dnl Process this file with autoconf to produce a configure script.
dnl
dnl For additional information, see
@ -38,7 +38,7 @@ dnl https://invisible-island.net/autoconf/my-autoconf.html
dnl
dnl ---------------------------------------------------------------------------
AC_PREREQ(2.52.20210101)
AC_REVISION($Revision: 1.807 $)
AC_REVISION($Revision: 1.808 $)
AC_INIT(ncurses/base/lib_initscr.c)
AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
@ -657,42 +657,7 @@ AC_MSG_RESULT($with_xterm_new)
WHICH_XTERM=$with_xterm_new
AC_SUBST(WHICH_XTERM)
case $host_os in
(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnuabielfv*|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc|linux*musl)
want_xterm_kbs=DEL
;;
(*)
want_xterm_kbs=BS
;;
esac
AC_MSG_CHECKING(if xterm backspace sends BS or DEL)
AC_ARG_WITH(xterm-kbs,
[[ --with-xterm-kbs[=XXX] specify if xterm backspace sends BS or DEL]],
[with_xterm_kbs=$withval],
[with_xterm_kbs=auto])
case x$with_xterm_kbs in
(xyes|xno|xBS|xbs|x8)
with_xterm_kbs=BS
;;
(xDEL|xdel|x127)
with_xterm_kbs=DEL
;;
(xauto)
with_xterm_kbs=$want_xterm_kbs
;;
(*)
with_xterm_kbs=$withval
;;
esac
AC_MSG_RESULT($with_xterm_kbs)
XTERM_KBS=$with_xterm_kbs
AC_SUBST(XTERM_KBS)
if test "x$with_xterm_kbs" != "x$want_xterm_kbs"
then
AC_MSG_WARN([expected --with-xterm-kbs=$want_xterm_kbs for $host_os, have $with_xterm_kbs])
fi
CF_WITH_XTERM_KBS
MAKE_TERMINFO=
if test "$use_database" = no ; then

View File

@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.1684 2025/08/23 09:36:22 tom Exp $
# $Id: dist.mk,v 1.1685 2025/08/30 11:23:23 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 = 20250823
NCURSES_PATCH = 20250830
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -31,7 +31,7 @@
* Author: Thomas Dickey, 2008-on *
****************************************************************************/
/* $Id: nc_win32.h.in,v 1.9 2025/08/23 19:30:11 tom Exp $ */
/* $Id: nc_win32.h.in,v 1.10 2025/08/30 20:58:58 tom Exp $ */
#ifndef NC_WIN32_H
#define NC_WIN32_H 1
@ -99,15 +99,10 @@ extern NCURSES_EXPORT(int) _nc_wcwidth(uint32_t);
#ifdef EVENTLIST_2nd /* test.priv.h just needs the preceding */
extern NCURSES_EXPORT(void) _nc_console_size(int* Lines, int* Cols);
extern NCURSES_EXPORT(HANDLE) _nc_console_handle(int fd);
extern NCURSES_EXPORT(int) _nc_console_isatty(int fd);
extern NCURSES_EXPORT(int) _nc_console_test(int fd);
extern NCURSES_EXPORT(int) _nc_console_read(SCREEN *sp,HANDLE hdl,int *buf);
extern NCURSES_EXPORT(int) _nc_console_twait(const SCREEN *sp, HANDLE hdl,int mode,int msec,int *left EVENTLIST_2nd(_nc_eventlist * evl));
extern NCURSES_EXPORT(WORD) _nc_console_MapColor(bool fore, int color);
extern NCURSES_EXPORT(void) _nc_console_selectActiveHandle(void);
extern NCURSES_EXPORT(bool) _nc_console_get_SBI(void);
extern NCURSES_EXPORT(void) _nc_console_set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info);
extern NCURSES_EXPORT(int) _nc_console_testmouse(const SCREEN *,HANDLE,int EVENTLIST_2nd(_nc_eventlist*));
extern NCURSES_EXPORT(int) _nc_console_keyok(int keycode,int flag);

View File

@ -44,7 +44,7 @@
#define NEED_KEY_EVENT
#include <curses.priv.h>
MODULE_ID("$Id: lib_getch.c,v 1.150 2025/03/09 00:43:49 tom Exp $")
MODULE_ID("$Id: lib_getch.c,v 1.151 2025/08/30 19:12:05 tom Exp $")
#include <fifo_defs.h>
@ -317,9 +317,9 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
} else
# elif defined(_NC_WINDOWS_NATIVE)
if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && IsCbreak(sp))
n = _nc_mingw_console_read(sp,
_nc_get_handle(sp->_ifd),
&buf);
n = _nc_console_read(sp,
_nc_get_handle(sp->_ifd),
&buf);
else
# endif /* EXP_WIN32_DRIVER */
n = CallDriver_1(sp, td_read, &buf);

View File

@ -35,7 +35,7 @@
****************************************************************************/
/*
* $Id: curses.priv.h,v 1.713 2025/08/16 14:40:02 tom Exp $
* $Id: curses.priv.h,v 1.717 2025/08/30 22:47:12 tom Exp $
*
* curses.priv.h
*
@ -2551,9 +2551,7 @@ extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
#ifdef USE_TERM_DRIVER
#if defined(USE_WIN32CON_DRIVER)
extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
extern NCURSES_EXPORT(int) _nc_mingw_console_read(SCREEN *sp, HANDLE fd, int *buf);
extern NCURSES_EXPORT(int) _nc_mingw_isatty(int fd);
extern NCURSES_EXPORT(int) _nc_mingw_isconsole(int fd);
extern NCURSES_EXPORT(int) _nc_mingw_tcflush(int fd, int queue);
extern NCURSES_EXPORT(int) _nc_mingw_tcgetattr(int fd, struct termios *arg);
extern NCURSES_EXPORT(int) _nc_mingw_testmouse(SCREEN *sp, HANDLE fd, int delay EVENTLIST_2nd(_nc_eventlist*));
@ -2563,6 +2561,14 @@ extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
#endif /* USE_TERM_DRIVER */
#endif /* EXP_WIN32_DRIVER */
#ifdef _NC_WINDOWS
extern NCURSES_EXPORT(WORD) _nc_console_MapColor(bool fore, int color);
extern NCURSES_EXPORT(bool) _nc_console_get_SBI(void);
extern NCURSES_EXPORT(int) _nc_console_read(SCREEN *sp, HANDLE fd, int *buf);
extern NCURSES_EXPORT(int) _nc_console_test(int fd);
extern NCURSES_EXPORT(void) _nc_console_size(int *Lines, int *Cols);
#endif
#if defined(USE_TERM_DRIVER) && defined(EXP_WIN32_DRIVER)
#define NC_ISATTY(fd) (0 != _nc_console_isatty(fd))
#elif defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER)
@ -2585,7 +2591,7 @@ extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
# if defined(EXP_WIN32_DRIVER)
# define IsTermInfoOnConsole(sp) (IsTermInfo(sp) && _nc_console_test(TerminalOf(sp)->Filedes))
# elif defined(USE_WIN32CON_DRIVER)
# define IsTermInfoOnConsole(sp) (IsTermInfo(sp) && _nc_mingw_isconsole(TerminalOf(sp)->Filedes))
# define IsTermInfoOnConsole(sp) (IsTermInfo(sp) && _nc_console_test(TerminalOf(sp)->Filedes))
# else
# define IsTermInfoOnConsole(sp) FALSE
# endif

View File

@ -1,4 +1,4 @@
# $Id: modules,v 1.128 2025/08/08 23:39:20 tom Exp $
# $Id: modules,v 1.130 2025/08/30 19:22:37 tom Exp $
##############################################################################
# Copyright 2019-2020,2025 Thomas E. Dickey #
# Copyright 1998-2013,2017 Free Software Foundation, Inc. #
@ -238,12 +238,15 @@ lib_driver lib $(base) $(HEADER_DEPS)
# MinGW
@ port_win32con
gettimeofday lib $(win32con) $(HEADER_DEPS)
lib_win32con lib $(tinfo) $(HEADER_DEPS)
lib_win32util lib $(tinfo) $(HEADER_DEPS)
wcwidth lib $(win32con) $(HEADER_DEPS)
widechars lib $(wide) $(HEADER_DEPS)
win_driver lib $(win32con) $(HEADER_DEPS)
# MinGW-W64
@ port_win32
gettimeofday lib $(win32con) $(HEADER_DEPS)
lib_win32con lib $(tinfo) $(HEADER_DEPS)
lib_win32util lib $(tinfo) $(HEADER_DEPS)
wcwidth lib $(win32con) $(HEADER_DEPS)

View File

@ -36,13 +36,18 @@
* TODO - GetMousePos(POINT * result) from ntconio.c
*/
#define TTY int /* FIXME: TTY originalMode */
#include <curses.priv.h>
MODULE_ID("$Id: lib_win32con.c,v 1.29 2025/08/23 20:28:35 tom Exp $")
MODULE_ID("$Id: lib_win32con.c,v 1.30 2025/08/30 20:53:42 tom Exp $")
#if defined(_NC_WINDOWS)
#define CONTROL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)
#if defined(EXP_WIN32_DRIVER)
static bool read_screen_data(void);
#endif
#define GenMap(vKey,key) MAKELONG(key, vKey)
/* *INDENT-OFF* */
@ -59,6 +64,7 @@ static const LONG keylist[] =
GenMap(VK_DELETE, KEY_DC),
GenMap(VK_INSERT, KEY_IC)
};
#if defined(EXP_WIN32_DRIVER)
static const LONG ansi_keys[] =
{
GenMap(VK_PRIOR, 'I'),
@ -72,12 +78,14 @@ static const LONG ansi_keys[] =
GenMap(VK_DELETE, 'S'),
GenMap(VK_INSERT, 'R')
};
#endif
/* *INDENT-ON* */
#define array_length(a) (sizeof(a)/sizeof(a[0]))
#define N_INI ((int)array_length(keylist))
#define FKEYS 24
#define MAPSIZE (FKEYS + N_INI)
#if defined(EXP_WIN32_DRIVER)
/* A process can only have a single console, so it is safe
to maintain all the information about it in a single
static structure.
@ -120,6 +128,9 @@ _nc_console_vt_supported(void)
}
returnCode(res);
}
#else
#define EnsureInit() /* nothing */
#endif
NCURSES_EXPORT(void)
_nc_console_size(int *Lines, int *Cols)
@ -138,6 +149,7 @@ _nc_console_size(int *Lines, int *Cols)
}
}
#if defined(EXP_WIN32_DRIVER)
/* Convert a file descriptor into a HANDLE
That's not necessarily a console HANDLE
*/
@ -321,6 +333,7 @@ _nc_console_flush(HANDLE hdl)
}
returnCode(code);
}
#endif
NCURSES_EXPORT(WORD)
_nc_console_MapColor(bool fore, int color)
@ -337,6 +350,7 @@ _nc_console_MapColor(bool fore, int color)
return (WORD) a;
}
#if defined(EXP_WIN32_DRIVER)
/*
* Attempt to save the screen contents. PDCurses does this if
* PDC_RESTORE_SCREEN is set, giving the same visual appearance on
@ -453,6 +467,7 @@ read_screen_data(void)
return result;
}
#endif
NCURSES_EXPORT(bool)
_nc_console_get_SBI(void)
@ -488,6 +503,7 @@ _nc_console_get_SBI(void)
return rc;
}
#if defined(EXP_WIN32_DRIVER)
#define MIN_WIDE 80
#define MIN_HIGH 24
@ -565,7 +581,9 @@ _nc_console_set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info)
}
returnVoid;
}
#endif
#if defined(EXP_WIN32_DRIVER)
static ULONGLONG
tdiff(FILETIME fstart, FILETIME fend)
{
@ -592,6 +610,7 @@ Adjust(int milliseconds, int diff)
}
return milliseconds;
}
#endif
#define BUTTON_MASK (FROM_LEFT_1ST_BUTTON_PRESSED | \
FROM_LEFT_2ND_BUTTON_PRESSED | \
@ -674,6 +693,7 @@ handle_mouse(SCREEN *sp, MOUSE_EVENT_RECORD mer)
return result;
}
#if defined(EXP_WIN32_DRIVER)
static int
rkeycompare(const void *el1, const void *el2)
{
@ -682,6 +702,7 @@ rkeycompare(const void *el1, const void *el2)
return ((key1 < key2) ? -1 : ((key1 == key2) ? 0 : 1));
}
#endif
static int
keycompare(const void *el1, const void *el2)
@ -744,6 +765,7 @@ AnsiKey(WORD vKey)
return code;
}
#if defined(EXP_WIN32_DRIVER)
NCURSES_EXPORT(int)
_nc_console_keyok(int keycode, int flag)
{
@ -982,6 +1004,7 @@ _nc_console_testmouse(
}
return rc;
}
#endif // EXP_WIN32_DRIVER
NCURSES_EXPORT(int)
_nc_console_read(
@ -1033,6 +1056,16 @@ _nc_console_read(
ungetch('\0');
*buf = AnsiKey(vk);
}
} else if (vk == VK_BACK) {
if (!(inp_rec.Event.KeyEvent.dwControlKeyState
& (SHIFT_PRESSED | CONTROL_PRESSED))) {
*buf = KEY_BACKSPACE;
}
} else if (vk == VK_TAB) {
if ((inp_rec.Event.KeyEvent.dwControlKeyState
& (SHIFT_PRESSED | CONTROL_PRESSED))) {
*buf = KEY_BTAB;
}
}
break;
} else if (inp_rec.EventType == MOUSE_EVENT) {
@ -1048,6 +1081,7 @@ _nc_console_read(
returnCode(rc);
}
#if defined(EXP_WIN32_DRIVER)
/* Our replacement for the systems _isatty to include also
a test for mintty. This is called from the NC_ISATTY macro
defined in curses.priv.h
@ -1232,4 +1266,6 @@ _nc_console_restore(void)
returnBool(res);
}
#endif // EXP_WIN32_DRIVER
#endif // _NC_WINDOWS

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2023 Thomas E. Dickey *
* Copyright 2020-2023,2025 Thomas E. Dickey *
* Copyright 2008-2010,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,16 +27,11 @@
* authorization. *
****************************************************************************/
#ifdef WINVER
# undef WINVER
#endif
#define WINVER 0x0501
#include <curses.priv.h>
#include <windows.h>
MODULE_ID("$Id: gettimeofday.c,v 1.7 2023/02/25 20:05:36 tom Exp $")
MODULE_ID("$Id: gettimeofday.c,v 1.8 2025/08/30 17:59:42 tom Exp $")
#if HAVE_GETTIMEOFDAY == 2
#define JAN1970 116444736000000000LL /* the value for 01/01/1970 00:00 */

View File

@ -42,25 +42,22 @@
#define TTY int /* FIXME: TTY originalMode */
#include <curses.priv.h>
#define PSAPI_VERSION 2
#include <psapi.h>
#define CUR TerminalType(my_term).
#define CONTROL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)
MODULE_ID("$Id: win_driver.c,v 1.90 2025/08/23 20:31:46 tom Exp $")
MODULE_ID("$Id: win_driver.c,v 1.94 2025/08/30 20:50:55 tom Exp $")
#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
#define EXP_OPTIMIZE 0
extern NCURSES_EXPORT(WORD) _nc_console_MapColor(bool fore, int color);
#define array_length(a) (sizeof(a)/sizeof(a[0]))
static bool InitConsole(void);
static bool okConsoleHandle(TERMINAL_CONTROL_BLOCK *);
#define AssertTCB() assert(TCB != NULL && (TCB->magic == WINMAGIC))
#define validateConsoleHandle() (AssertTCB(), console_initialized || \
InitConsole())
#define SetSP() assert(TCB->csp != NULL); sp = TCB->csp; (void) sp
#define GenMap(vKey,key) MAKELONG(key, vKey)
@ -108,23 +105,7 @@ static const LONG ansi_keys[] =
NCURSES_EXPORT_VAR(ConsoleInfo) _nc_CONSOLE;
static BOOL console_initialized = FALSE;
static WORD
MapColor(bool fore, int color)
{
static const int _cmap[] =
{0, 4, 2, 6, 1, 5, 3, 7};
int a;
if (color < 0 || color > 7)
a = fore ? 7 : 0;
else
a = _cmap[color];
if (!fore)
a = a << 4;
return (WORD) a;
}
#define RevAttr(attr) \
(WORD) (((attr) & 0xff00) | \
#define RevAttr(attr) (WORD) (((attr) & 0xff00) | \
((((attr) & 0x07) << 4) | \
(((attr) & 0x70) >> 4)))
@ -393,7 +374,7 @@ find_next_change(SCREEN *sp, int row, int col)
win->_line[row].lastchar = _NOCHANGE
static void
selectActiveHandle(void)
_nc_console_selectActiveHandle(void)
{
if (WINCONSOLE.lastOut != WINCONSOLE.hdl) {
WINCONSOLE.lastOut = WINCONSOLE.hdl;
@ -451,7 +432,7 @@ wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
SCREEN *sp;
T((T_CALLED("win32con::wcon_doupdate(%p)"), TCB));
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
SetSP();
Width = screen_columns(sp);
@ -578,7 +559,7 @@ wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
CurScreen(sp)->_cury,
CurScreen(sp)->_curx);
}
selectActiveHandle();
_nc_console_selectActiveHandle();
result = OK;
}
returnCode(result);
@ -637,8 +618,10 @@ wcon_CanHandle(TERMINAL_CONTROL_BLOCK * TCB,
}
if (!code) {
if (_nc_mingw_isconsole(0))
if (_nc_console_test(0)) {
T(("isTermInfoConsole=TRUE"));
WINCONSOLE.isTermInfoConsole = TRUE;
}
}
returnBool(code);
}
@ -663,7 +646,7 @@ wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
SMALL_RECT this_region;
COORD bufferCoord;
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
SetSP();
this_region.Top = WINCONSOLE.SBI.srWindow.Top;
this_region.Left = WINCONSOLE.SBI.srWindow.Left;
@ -733,51 +716,18 @@ wcon_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB,
return (code);
}
static bool
get_SBI(void)
{
bool rc = FALSE;
if (GetConsoleScreenBufferInfo(WINCONSOLE.hdl, &(WINCONSOLE.SBI))) {
T(("GetConsoleScreenBufferInfo"));
T(("... buffer(X:%d Y:%d)",
WINCONSOLE.SBI.dwSize.X,
WINCONSOLE.SBI.dwSize.Y));
T(("... window(X:%d Y:%d)",
WINCONSOLE.SBI.dwMaximumWindowSize.X,
WINCONSOLE.SBI.dwMaximumWindowSize.Y));
T(("... cursor(X:%d Y:%d)",
WINCONSOLE.SBI.dwCursorPosition.X,
WINCONSOLE.SBI.dwCursorPosition.Y));
T(("... display(Top:%d Bottom:%d Left:%d Right:%d)",
WINCONSOLE.SBI.srWindow.Top,
WINCONSOLE.SBI.srWindow.Bottom,
WINCONSOLE.SBI.srWindow.Left,
WINCONSOLE.SBI.srWindow.Right));
if (WINCONSOLE.buffered) {
WINCONSOLE.origin.X = 0;
WINCONSOLE.origin.Y = 0;
} else {
WINCONSOLE.origin.X = WINCONSOLE.SBI.srWindow.Left;
WINCONSOLE.origin.Y = WINCONSOLE.SBI.srWindow.Top;
}
rc = TRUE;
} else {
T(("GetConsoleScreenBufferInfo ERR"));
}
return rc;
}
static void
wcon_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
int fore,
int color,
int (*outc) (SCREEN *, int) GCC_UNUSED)
{
if (okConsoleHandle(TCB)) {
WORD a = MapColor(fore, color);
(void) TCB;
if (validateConsoleHandle()) {
WORD a = _nc_console_MapColor(fore, color);
a |= (WORD) ((WINCONSOLE.SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f));
SetConsoleTextAttribute(WINCONSOLE.hdl, a);
get_SBI();
_nc_console_get_SBI();
}
}
@ -786,10 +736,11 @@ wcon_rescol(TERMINAL_CONTROL_BLOCK * TCB)
{
bool res = FALSE;
if (okConsoleHandle(TCB)) {
(void) TCB;
if (validateConsoleHandle()) {
WORD a = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN;
SetConsoleTextAttribute(WINCONSOLE.hdl, a);
get_SBI();
_nc_console_get_SBI();
res = TRUE;
}
return res;
@ -814,18 +765,9 @@ wcon_size(TERMINAL_CONTROL_BLOCK * TCB, int *Lines, int *Cols)
T((T_CALLED("win32con::wcon_size(%p)"), TCB));
if (okConsoleHandle(TCB) &&
Lines != NULL &&
Cols != NULL) {
if (WINCONSOLE.buffered) {
*Lines = (int) (WINCONSOLE.SBI.dwSize.Y);
*Cols = (int) (WINCONSOLE.SBI.dwSize.X);
} else {
*Lines = (int) (WINCONSOLE.SBI.srWindow.Bottom + 1 -
WINCONSOLE.SBI.srWindow.Top);
*Cols = (int) (WINCONSOLE.SBI.srWindow.Right + 1 -
WINCONSOLE.SBI.srWindow.Left);
}
if (validateConsoleHandle() &&
(Lines != NULL) && (Cols != NULL)) {
_nc_console_size(Lines, Cols);
result = OK;
}
returnCode(result);
@ -848,7 +790,9 @@ wcon_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf)
tcflag_t lflag;
int result = ERR;
if (buf != NULL && okConsoleHandle(TCB)) {
T((T_CALLED("win32con::wcon_sgmode(TCB=(%p),setFlag=%d,TTY=(%p)"),
TCB, setFlag, buf));
if (buf != NULL && validateConsoleHandle()) {
if (setFlag) {
iflag = buf->c_iflag;
@ -904,7 +848,7 @@ wcon_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf)
}
result = OK;
}
return result;
returnCode(result);
}
#define MIN_WIDE 80
@ -914,13 +858,13 @@ wcon_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf)
* In "normal" mode, reset the buffer- and window-sizes back to their original values.
*/
static void
set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info)
_nc_console_set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info)
{
SMALL_RECT rect;
COORD coord;
bool changed = FALSE;
T((T_CALLED("win32con::set_scrollback(%s)"),
T((T_CALLED("win32con::_nc_console_set_scrollback(%s)"),
(normal
? "normal"
: "application")));
@ -980,7 +924,7 @@ set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info)
rect.Bottom, rect.Right));
SetConsoleScreenBufferSize(WINCONSOLE.hdl, coord); /* dwSize */
SetConsoleWindowInfo(WINCONSOLE.hdl, TRUE, &rect); /* srWindow */
get_SBI();
_nc_console_get_SBI();
}
returnVoid;
}
@ -992,10 +936,10 @@ 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)"),
T((T_CALLED("win32con::wcon_mode(%p, progFlag=%d, defFlag=%d)"),
TCB, progFlag, defFlag));
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
sp = TCB->csp;
WINCONSOLE.progMode = progFlag;
@ -1016,14 +960,13 @@ wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
_nc_keypad(sp, TRUE);
}
if (!WINCONSOLE.buffered) {
set_scrollback(FALSE, &WINCONSOLE.SBI);
_nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI);
}
code = OK;
}
}
T(("... buffered:%d, clear:%d",
WINCONSOLE.buffered,
CurScreen(sp)->_clear));
WINCONSOLE.buffered, CurScreen(sp)->_clear));
} else { /* shell mode */
if (defFlag) {
/* def_shell_mode */
@ -1038,7 +981,7 @@ wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
}
code = wcon_sgmode(TCB, TRUE, &(_term->Ottyb));
if (!WINCONSOLE.buffered) {
set_scrollback(TRUE, &WINCONSOLE.save_SBI);
_nc_console_set_scrollback(TRUE, &WINCONSOLE.save_SBI);
if (!restore_original_screen())
code = ERR;
}
@ -1101,29 +1044,6 @@ MapKey(WORD vKey)
return code;
}
static int
AnsiKey(WORD vKey)
{
WORD nKey = 0;
void *res;
LONG key = GenMap(vKey, 0);
int code = -1;
res = bsearch(&key,
WINCONSOLE.ansi_map,
(size_t) (N_INI + FKEYS),
sizeof(keylist[0]),
keycompare);
if (res) {
key = *((LONG *) res);
nKey = LOWORD(key);
code = (int) (nKey & 0x7fff);
if (nKey & 0x8000)
code = -code;
}
return code;
}
static void
wcon_release(TERMINAL_CONTROL_BLOCK * TCB)
{
@ -1260,12 +1180,14 @@ wcon_initpair(TERMINAL_CONTROL_BLOCK * TCB,
{
SCREEN *sp;
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
SetSP();
if ((pair > 0) && (pair < CON_NUMPAIRS) && (f >= 0) && (f < 8)
&& (b >= 0) && (b < 8)) {
WINCONSOLE.pairs[pair] = MapColor(true, f) | MapColor(false, b);
WINCONSOLE.pairs[pair] =
_nc_console_MapColor(true, f) |
_nc_console_MapColor(false, b);
}
}
}
@ -1302,11 +1224,14 @@ wcon_initmouse(TERMINAL_CONTROL_BLOCK * TCB)
{
SCREEN *sp;
if (okConsoleHandle(TCB)) {
T((T_CALLED("win32con::wcon_initmouse(%p)"), TCB));
if (validateConsoleHandle()) {
SetSP();
sp->_mouse_type = M_TERM_DRIVER;
}
returnVoid;
}
static int
@ -1317,7 +1242,8 @@ wcon_testmouse(TERMINAL_CONTROL_BLOCK * TCB,
int rc = 0;
SCREEN *sp;
if (okConsoleHandle(TCB)) {
T((T_CALLED("win32con::wcon_testmouse(%p)"), TCB));
if (validateConsoleHandle()) {
SetSP();
if (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
@ -1331,7 +1257,7 @@ wcon_testmouse(TERMINAL_CONTROL_BLOCK * TCB,
}
}
return rc;
returnCode(rc);
}
static int
@ -1340,7 +1266,9 @@ wcon_mvcur(TERMINAL_CONTROL_BLOCK * TCB,
int y, int x)
{
int ret = ERR;
if (okConsoleHandle(TCB)) {
(void) TCB;
if (validateConsoleHandle()) {
COORD loc;
loc.X = (short) x;
loc.Y = (short) (y + AdjustY());
@ -1425,7 +1353,7 @@ wcon_initacs(TERMINAL_CONTROL_BLOCK * TCB,
unsigned n;
SCREEN *sp;
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
SetSP();
for (n = 0; n < SIZEOF(table); ++n) {
@ -1508,13 +1436,13 @@ decode_mouse(SCREEN *sp, int mask)
}
static int
console_twait(
SCREEN *sp,
HANDLE fd,
int mode,
int milliseconds,
int *timeleft
EVENTLIST_2nd(_nc_eventlist * evl))
_nc_console_twait(
SCREEN *sp,
HANDLE fd,
int mode,
int milliseconds,
int *timeleft
EVENTLIST_2nd(_nc_eventlist * evl))
{
INPUT_RECORD inp_rec;
BOOL b;
@ -1591,7 +1519,7 @@ console_twait(
/* e.g., FOCUS_EVENT */
default:
CONSUME();
selectActiveHandle();
_nc_console_selectActiveHandle();
continue;
}
}
@ -1629,61 +1557,18 @@ wcon_twait(TERMINAL_CONTROL_BLOCK * TCB,
SCREEN *sp;
int code = 0;
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
SetSP();
code = console_twait(sp,
WINCONSOLE.inp,
mode,
milliseconds,
timeleft EVENTLIST_2nd(evl));
code = _nc_console_twait(sp,
WINCONSOLE.inp,
mode,
milliseconds,
timeleft EVENTLIST_2nd(evl));
}
return code;
}
static bool
handle_mouse(SCREEN *sp, MOUSE_EVENT_RECORD mer)
{
MEVENT work;
bool result = FALSE;
assert(sp);
sp->_drv_mouse_old_buttons = sp->_drv_mouse_new_buttons;
sp->_drv_mouse_new_buttons = mer.dwButtonState & BUTTON_MASK;
/*
* We're only interested if the button is pressed or released.
* FIXME: implement continuous event-tracking.
*/
if (sp->_drv_mouse_new_buttons != sp->_drv_mouse_old_buttons) {
memset(&work, 0, sizeof(work));
if (sp->_drv_mouse_new_buttons) {
work.bstate |= decode_mouse(sp, sp->_drv_mouse_new_buttons);
} else {
/* cf: BUTTON_PRESSED, BUTTON_RELEASED */
work.bstate |= (decode_mouse(sp,
sp->_drv_mouse_old_buttons)
>> 1);
result = TRUE;
}
work.x = mer.dwMousePosition.X;
work.y = mer.dwMousePosition.Y - AdjustY();
sp->_drv_mouse_fifo[sp->_drv_mouse_tail] = work;
sp->_drv_mouse_tail += 1;
}
return result;
}
static int
wcon_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
{
@ -1693,10 +1578,10 @@ wcon_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
T((T_CALLED("win32con::wcon_read(%p)"), TCB));
assert(buf);
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
SetSP();
n = _nc_mingw_console_read(sp, WINCONSOLE.inp, buf);
n = _nc_console_read(sp, WINCONSOLE.inp, buf);
}
returnCode(n);
}
@ -1715,7 +1600,7 @@ wcon_cursorSet(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int mode)
int res = -1;
T((T_CALLED("win32con:wcon_cursorSet(%d)"), mode));
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
CONSOLE_CURSOR_INFO this_CI = WINCONSOLE.save_CI;
switch (mode) {
case 0:
@ -1763,7 +1648,7 @@ wcon_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag GCC_UNUSED)
T((T_CALLED("win32con::wcon_kpad(%p, %d)"), TCB, flag));
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
SetSP();
if (sp) {
@ -1787,7 +1672,7 @@ wcon_keyok(TERMINAL_CONTROL_BLOCK * TCB,
T((T_CALLED("win32con::wcon_keyok(%p, %d, %d)"), TCB, keycode, flag));
if (okConsoleHandle(TCB)) {
if (validateConsoleHandle()) {
SetSP();
if (sp) {
@ -1858,72 +1743,6 @@ get_handle(int fd)
return (HANDLE) value;
}
#if WINVER >= 0x0600
/* This function tests, whether or not the ncurses application
is running as a descendant of MSYS2/cygwin mintty terminal
application. mintty doesn't use Windows Console for its screen
I/O, so the native Windows _isatty doesn't recognize it as
character device. But we can discover we are at the end of an
Pipe and can query to server side of the pipe, looking whether
or not this is mintty.
*/
static int
_ismintty(int fd, LPHANDLE pMinTTY)
{
HANDLE handle = get_handle(fd);
DWORD dw;
int code = 0;
T((T_CALLED("win32con::_ismintty(%d, %p)"), fd, pMinTTY));
if (handle != INVALID_HANDLE_VALUE) {
dw = GetFileType(handle);
if (dw == FILE_TYPE_PIPE) {
if (GetNamedPipeInfo(handle, 0, 0, 0, 0)) {
ULONG pPid;
/* Requires NT6 */
if (GetNamedPipeServerProcessId(handle, &pPid)) {
TCHAR buf[MAX_PATH];
DWORD len = 0;
/* These security attributes may allow us to
create a remote thread in mintty to manipulate
the terminal state remotely */
HANDLE pHandle = OpenProcess(
PROCESS_CREATE_THREAD
| PROCESS_QUERY_INFORMATION
| PROCESS_VM_OPERATION
| PROCESS_VM_WRITE
| PROCESS_VM_READ,
FALSE,
pPid);
if (pMinTTY)
*pMinTTY = INVALID_HANDLE_VALUE;
if (pHandle != INVALID_HANDLE_VALUE) {
if ((len = GetProcessImageFileName(
pHandle,
buf,
(DWORD)
array_length(buf)))) {
TCHAR *pos = _tcsrchr(buf, _T('\\'));
if (pos) {
pos++;
if (_tcsnicmp(pos, _TEXT("mintty.exe"), 10)
== 0) {
if (pMinTTY)
*pMinTTY = pHandle;
code = 1;
}
}
}
}
}
}
}
}
returnCode(code);
}
#endif
/* Borrowed from ansicon project.
Check whether or not an I/O handle is associated with
a Windows console.
@ -1955,7 +1774,7 @@ _nc_mingw_isatty(int fd)
result = 1;
} else {
#if WINVER >= 0x0600
result = _ismintty(fd, NULL);
result = _nc_console_checkmintty(fd, NULL);
#endif
}
return result;
@ -1968,12 +1787,12 @@ _nc_mingw_isatty(int fd)
terminfo.
*/
NCURSES_EXPORT(int)
_nc_mingw_isconsole(int fd)
_nc_console_test(int fd)
{
HANDLE hdl = get_handle(fd);
int code = 0;
T((T_CALLED("win32con::_nc_mingw_isconsole(%d)"), fd));
T((T_CALLED("win32con::_nc_console_test(%d)"), fd));
code = (int) IsConsoleHandle(hdl);
@ -2002,7 +1821,7 @@ _nc_mingw_tcsetattr(
{
TC_PROLOGUE(fd);
if (_nc_mingw_isconsole(fd)) {
if (_nc_console_test(fd)) {
DWORD dwFlag = 0;
HANDLE ofd = get_handle(fd);
if (ofd != INVALID_HANDLE_VALUE) {
@ -2038,7 +1857,7 @@ _nc_mingw_tcgetattr(int fd, struct termios *arg)
{
TC_PROLOGUE(fd);
if (_nc_mingw_isconsole(fd)) {
if (_nc_console_test(fd)) {
if (arg)
*arg = term->Nttyb;
}
@ -2050,7 +1869,7 @@ _nc_mingw_tcflush(int fd, int queue)
{
int code = ERR;
if (_nc_mingw_isconsole(fd)) {
if (_nc_console_test(fd)) {
if (queue == TCIFLUSH) {
code = (FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE))
? OK
@ -2074,201 +1893,111 @@ _nc_mingw_testmouse(
if (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
rc = TW_MOUSE;
} else {
rc = console_twait(sp,
fd,
TWAIT_MASK,
delay,
(int *) 0
EVENTLIST_2nd(evl));
rc = _nc_console_twait(sp,
fd,
TWAIT_MASK,
delay,
(int *) 0
EVENTLIST_2nd(evl));
}
return rc;
}
NCURSES_EXPORT(int)
_nc_mingw_console_read(
SCREEN *sp,
HANDLE fd,
int *buf)
{
int rc = -1;
INPUT_RECORD inp_rec;
BOOL b;
DWORD nRead;
WORD vk;
assert(sp);
assert(buf);
memset(&inp_rec, 0, sizeof(inp_rec));
T((T_CALLED("_nc_mingw_console_read(%p)"), sp));
while ((b = read_keycode(fd, &inp_rec, 1, &nRead))) {
if (b && nRead > 0) {
if (rc < 0)
rc = 0;
rc = rc + (int) nRead;
if (inp_rec.EventType == KEY_EVENT) {
if (!inp_rec.Event.KeyEvent.bKeyDown)
continue;
*buf = (int) inp_rec.Event.KeyEventChar;
vk = inp_rec.Event.KeyEvent.wVirtualKeyCode;
/*
* There are 24 virtual function-keys (defined in winuser.h),
* and typically 12 function-keys on a keyboard. Use the
* shift-modifier to provide the remaining keys.
*/
if (vk >= VK_F1 && vk <= VK_F12) {
if (inp_rec.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED) {
vk = (WORD) (vk + 12);
}
}
if (*buf == 0) {
int key = MapKey(vk);
if (key < 0)
continue;
if (sp->_keypad_on) {
*buf = key;
} else {
ungetch('\0');
*buf = AnsiKey(vk);
}
} else if (vk == VK_BACK) {
if (!(inp_rec.Event.KeyEvent.dwControlKeyState
& (SHIFT_PRESSED | CONTROL_PRESSED))) {
*buf = KEY_BACKSPACE;
}
} else if (vk == VK_TAB) {
if ((inp_rec.Event.KeyEvent.dwControlKeyState
& (SHIFT_PRESSED | CONTROL_PRESSED))) {
*buf = KEY_BTAB;
}
}
break;
} else if (inp_rec.EventType == MOUSE_EVENT) {
if (handle_mouse(sp,
inp_rec.Event.MouseEvent)) {
*buf = KEY_MOUSE;
break;
}
}
continue;
}
}
returnCode(rc);
}
static bool
InitConsole(void)
{
/* initialize once, or not at all */
if (!console_initialized) {
int i;
DWORD num_buttons;
WORD a;
BOOL buffered = TRUE;
BOOL b;
{
/* initialize once, or not at all */
if (!console_initialized) {
int i;
DWORD num_buttons;
WORD a;
BOOL buffered = TRUE;
BOOL b;
START_TRACE();
START_TRACE();
WINCONSOLE.map = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE);
WINCONSOLE.rmap = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE);
WINCONSOLE.ansi_map = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE);
WINCONSOLE.map = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE);
WINCONSOLE.rmap = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE);
WINCONSOLE.ansi_map = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE);
for (i = 0; i < (N_INI + FKEYS); i++) {
if (i < N_INI) {
WINCONSOLE.rmap[i] = WINCONSOLE.map[i] =
(DWORD) keylist[i];
WINCONSOLE.ansi_map[i] = (DWORD) ansi_keys[i];
for (i = 0; i < (N_INI + FKEYS); i++) {
if (i < N_INI) {
WINCONSOLE.rmap[i] = WINCONSOLE.map[i] =
(DWORD) keylist[i];
WINCONSOLE.ansi_map[i] = (DWORD) ansi_keys[i];
} else {
WINCONSOLE.rmap[i] = WINCONSOLE.map[i] =
(DWORD) GenMap((VK_F1 + (i - N_INI)),
(KEY_F(1) + (i - N_INI)));
WINCONSOLE.ansi_map[i] =
(DWORD) GenMap((VK_F1 + (i - N_INI)),
(';' + (i - N_INI)));
}
}
qsort(WINCONSOLE.ansi_map,
(size_t) (MAPSIZE),
sizeof(keylist[0]),
keycompare);
qsort(WINCONSOLE.map,
(size_t) (MAPSIZE),
sizeof(keylist[0]),
keycompare);
qsort(WINCONSOLE.rmap,
(size_t) (MAPSIZE),
sizeof(keylist[0]),
rkeycompare);
if (GetNumberOfConsoleMouseButtons(&num_buttons)) {
WINCONSOLE.numButtons = (int) num_buttons;
} else {
WINCONSOLE.rmap[i] = WINCONSOLE.map[i] =
(DWORD) GenMap((VK_F1 + (i - N_INI)),
(KEY_F(1) + (i - N_INI)));
WINCONSOLE.ansi_map[i] =
(DWORD) GenMap((VK_F1 + (i - N_INI)),
(';' + (i - N_INI)));
WINCONSOLE.numButtons = 1;
}
}
qsort(WINCONSOLE.ansi_map,
(size_t) (MAPSIZE),
sizeof(keylist[0]),
keycompare);
qsort(WINCONSOLE.map,
(size_t) (MAPSIZE),
sizeof(keylist[0]),
keycompare);
qsort(WINCONSOLE.rmap,
(size_t) (MAPSIZE),
sizeof(keylist[0]),
rkeycompare);
if (GetNumberOfConsoleMouseButtons(&num_buttons)) {
WINCONSOLE.numButtons = (int) num_buttons;
} else {
WINCONSOLE.numButtons = 1;
}
a = _nc_console_MapColor(true, COLOR_WHITE) |
_nc_console_MapColor(false, COLOR_BLACK);
for (i = 0; i < CON_NUMPAIRS; i++)
WINCONSOLE.pairs[i] = a;
a = MapColor(true, COLOR_WHITE) | MapColor(false, COLOR_BLACK);
for (i = 0; i < CON_NUMPAIRS; i++)
WINCONSOLE.pairs[i] = a;
{
b = AllocConsole();
b = AllocConsole();
if (!b)
b = AttachConsole(ATTACH_PARENT_PROCESS);
if (!b)
b = AttachConsole(ATTACH_PARENT_PROCESS);
WINCONSOLE.inp = GetDirectHandle("CONIN$", FILE_SHARE_READ);
WINCONSOLE.out = GetDirectHandle("CONOUT$", FILE_SHARE_WRITE);
WINCONSOLE.inp = GetDirectHandle("CONIN$", FILE_SHARE_READ);
WINCONSOLE.out = GetDirectHandle("CONOUT$", FILE_SHARE_WRITE);
if (getenv("NCGDB") || getenv("NCURSES_CONSOLE2")) {
T(("... will not buffer console"));
buffered = FALSE;
WINCONSOLE.hdl = WINCONSOLE.out;
} else {
T(("... creating console buffer"));
WINCONSOLE.hdl = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CONSOLE_TEXTMODE_BUFFER,
NULL);
}
if (getenv("NCGDB") || getenv("NCURSES_CONSOLE2")) {
T(("... will not buffer console"));
buffered = FALSE;
WINCONSOLE.hdl = WINCONSOLE.out;
} else {
T(("... creating console buffer"));
WINCONSOLE.hdl = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CONSOLE_TEXTMODE_BUFFER,
NULL);
}
if (WINCONSOLE.hdl != INVALID_HANDLE_VALUE) {
WINCONSOLE.buffered = buffered;
get_SBI();
WINCONSOLE.save_SBI = WINCONSOLE.SBI;
if (!buffered) {
save_original_screen();
set_scrollback(FALSE, &WINCONSOLE.SBI);
if (WINCONSOLE.hdl != INVALID_HANDLE_VALUE) {
WINCONSOLE.buffered = buffered;
_nc_console_get_SBI();
WINCONSOLE.save_SBI = WINCONSOLE.SBI;
if (!buffered) {
save_original_screen();
_nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI);
}
GetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI);
T(("... initial cursor is %svisible, %d%%",
(WINCONSOLE.save_CI.bVisible ? "" : "not-"),
(int) WINCONSOLE.save_CI.dwSize));
}
}
GetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI);
T(("... initial cursor is %svisible, %d%%",
(WINCONSOLE.save_CI.bVisible ? "" : "not-"),
(int) WINCONSOLE.save_CI.dwSize));
}
console_initialized = TRUE;
console_initialized = TRUE;
}
}
return (WINCONSOLE.hdl != INVALID_HANDLE_VALUE);
}
static bool
okConsoleHandle(TERMINAL_CONTROL_BLOCK * TCB)
{
return ((TCB != NULL) &&
(TCB->magic == WINMAGIC) &&
InitConsole());
}
/*
* While a constructor would ensure that this module is initialized, that will
* interfere with applications that may combine this with GUI interfaces.
*/
#if 0
static
__attribute__((constructor))
void _enter_console(void)
{
(void) InitConsole();
}
#endif

View File

@ -1,8 +1,8 @@
ncurses6td (6.5+20250823) unstable; urgency=low
ncurses6td (6.5+20250830) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 23 Aug 2025 05:36:22 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Wed, 27 Aug 2025 03:58:36 -0400
ncurses6 (5.9+20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6td (6.5+20250823) unstable; urgency=low
ncurses6td (6.5+20250830) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 23 Aug 2025 05:36:22 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Wed, 27 Aug 2025 03:58:36 -0400
ncurses6 (5.9+20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6td (6.5+20250823) unstable; urgency=low
ncurses6td (6.5+20250830) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 23 Aug 2025 05:36:22 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Wed, 27 Aug 2025 03:58:36 -0400
ncurses6 (5.9+20120608) unstable; urgency=low

View File

@ -1,4 +1,4 @@
; $Id: mingw-ncurses.nsi,v 1.718 2025/08/23 09:36:22 tom Exp $
; $Id: mingw-ncurses.nsi,v 1.719 2025/08/27 07:58:36 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 "0823"
!define VERSION_MMDD "0830"
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
!define MY_ABI "5"

View File

@ -3,7 +3,7 @@
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 6.5
Release: 20250823
Release: 20250830
License: X11 License Distribution Modification Variant
Group: Development/Libraries
URL: https://invisible-island.net/ncurses/
@ -144,8 +144,8 @@ popd
%changelog
* Sat Aug 23 2025 Thomas E. Dickey
- testing ncurses 6.5-20250823
* Sat Aug 30 2025 Thomas E. Dickey
- testing ncurses 6.5-20250830
* Sat Feb 25 2023 Thomas Dickey
- amend URLs per rpmlint

View File

@ -1,7 +1,7 @@
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 6.5
Release: 20250823
Release: 20250830
License: X11 License Distribution Modification Variant
Group: Development/Libraries
URL: https://invisible-island.net/ncurses/
@ -134,8 +134,8 @@ rm -f test/ncurses
%changelog
* Sat Aug 23 2025 Thomas E. Dickey
- testing ncurses 6.5-20250823
* Sat Aug 30 2025 Thomas E. Dickey
- testing ncurses 6.5-20250830
* Sat Feb 25 2023 Thomas Dickey
- amend URLs per rpmlint

View File

@ -1,7 +1,7 @@
Summary: Curses library with POSIX thread support.
Name: ncursest6
Version: 6.5
Release: 20250823
Release: 20250830
License: X11 License Distribution Modification Variant
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
@ -142,8 +142,8 @@ exit 0
%changelog
* Sat Aug 23 2025 Thomas E. Dickey
- testing ncurses 6.5-20250823
* Sat Aug 30 2025 Thomas E. Dickey
- testing ncurses 6.5-20250830
* Tue Dec 24 2019 Thomas Dickey
- drop custom CC_NORMAL warning flags because setting CFLAGS interferes with