mirror of
https://github.com/ThomasDickey/ncurses-snapshots.git
synced 2026-01-26 11:04:35 +00:00
snapshot of project "ncurses", label v6_3_20220521
This commit is contained in:
parent
71ec874d21
commit
305626e7bb
8
NEWS
8
NEWS
@ -26,7 +26,7 @@
|
||||
-- sale, use or other dealings in this Software without prior written --
|
||||
-- authorization. --
|
||||
-------------------------------------------------------------------------------
|
||||
-- $Id: NEWS,v 1.3807 2022/05/14 22:56:52 tom Exp $
|
||||
-- $Id: NEWS,v 1.3809 2022/05/21 21:10:54 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.
|
||||
|
||||
20220521
|
||||
+ improve memory-leak checking in several test-programs.
|
||||
+ set trailing null on string passed from winsnstr() to wins_nwstr().
|
||||
+ modify del_curterm() to fix memory-leak introduced by change to
|
||||
copy_termtype().
|
||||
|
||||
20220514
|
||||
+ further improvements to test/test_mouse.c; compare with ncurses test
|
||||
program menu A/a.
|
||||
|
||||
4
dist.mk
4
dist.mk
@ -26,7 +26,7 @@
|
||||
# use or other dealings in this Software without prior written #
|
||||
# authorization. #
|
||||
##############################################################################
|
||||
# $Id: dist.mk,v 1.1480 2022/05/14 13:23:05 tom Exp $
|
||||
# $Id: dist.mk,v 1.1481 2022/05/21 15:40:09 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 = 3
|
||||
NCURSES_PATCH = 20220514
|
||||
NCURSES_PATCH = 20220521
|
||||
|
||||
# We don't append the patch to the version, since this only applies to releases
|
||||
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2018,2020 Thomas E. Dickey *
|
||||
* Copyright 2018-2020,2022 Thomas E. Dickey *
|
||||
* Copyright 2004-2009,2016 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
@ -41,7 +41,7 @@
|
||||
#include <curses.priv.h>
|
||||
#include <ctype.h>
|
||||
|
||||
MODULE_ID("$Id: lib_insnstr.c,v 1.7 2020/02/02 23:34:34 tom Exp $")
|
||||
MODULE_ID("$Id: lib_insnstr.c,v 1.8 2022/05/21 17:35:15 tom Exp $")
|
||||
|
||||
NCURSES_EXPORT(int)
|
||||
winsnstr(WINDOW *win, const char *s, int n)
|
||||
@ -70,6 +70,7 @@ winsnstr(WINDOW *win, const char *s, int n)
|
||||
init_mb(state);
|
||||
n3 = mbstowcs(buffer, s, nn);
|
||||
if (n3 != (size_t) (-1)) {
|
||||
buffer[n3] = '\0';
|
||||
code = wins_nwstr(win, buffer, (int) n3);
|
||||
}
|
||||
free(buffer);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2020 Thomas E. Dickey *
|
||||
* Copyright 2020,2022 Thomas E. Dickey *
|
||||
* Copyright 1999-2011,2017 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
@ -43,12 +43,12 @@
|
||||
|
||||
#include <tic.h>
|
||||
|
||||
MODULE_ID("$Id: free_ttype.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
|
||||
MODULE_ID("$Id: free_ttype.c,v 1.20 2022/05/15 12:42:13 tom Exp $")
|
||||
|
||||
static void
|
||||
really_free_termtype(TERMTYPE2 *ptr, bool freeStrings)
|
||||
{
|
||||
T(("_nc_free_termtype(%s)", ptr->term_names));
|
||||
T(("really_free_termtype(%s) %d", ptr->term_names, freeStrings));
|
||||
|
||||
if (freeStrings) {
|
||||
FreeIfNeeded(ptr->str_table);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2020,2021 Thomas E. Dickey *
|
||||
,* Copyright 2020-2021,2022 Thomas E. Dickey *
|
||||
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
@ -41,7 +41,7 @@
|
||||
#include <termcap.h> /* ospeed */
|
||||
#include <tic.h> /* VALID_STRING */
|
||||
|
||||
MODULE_ID("$Id: lib_cur_term.c,v 1.45 2021/11/20 23:19:41 tom Exp $")
|
||||
MODULE_ID("$Id: lib_cur_term.c,v 1.48 2022/05/21 22:58:20 tom Exp $")
|
||||
|
||||
#undef CUR
|
||||
#define CUR TerminalType(termp).
|
||||
@ -147,7 +147,11 @@ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL *termp)
|
||||
);
|
||||
|
||||
#if NCURSES_EXT_NUMBERS
|
||||
#if NCURSES_EXT_COLORS
|
||||
_nc_free_termtype(&termp->type);
|
||||
#else
|
||||
_nc_free_termtype2(&termp->type);
|
||||
#endif
|
||||
#endif
|
||||
_nc_free_termtype2(&TerminalType(termp));
|
||||
if (termp == cur)
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.3+20220514) unstable; urgency=low
|
||||
ncurses6 (6.3+20220521) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 May 2022 09:23:05 -0400
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 15 May 2022 08:43:22 -0400
|
||||
|
||||
ncurses6 (5.9-20131005) unstable; urgency=low
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.3+20220514) unstable; urgency=low
|
||||
ncurses6 (6.3+20220521) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 May 2022 09:23:05 -0400
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 15 May 2022 08:43:22 -0400
|
||||
|
||||
ncurses6 (5.9-20131005) unstable; urgency=low
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.3+20220514) unstable; urgency=low
|
||||
ncurses6 (6.3+20220521) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 May 2022 09:23:05 -0400
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 15 May 2022 08:43:22 -0400
|
||||
|
||||
ncurses6 (5.9-20120608) unstable; urgency=low
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
; $Id: mingw-ncurses.nsi,v 1.520 2022/05/14 13:23:05 tom Exp $
|
||||
; $Id: mingw-ncurses.nsi,v 1.521 2022/05/21 15:40:09 tom Exp $
|
||||
|
||||
; TODO add examples
|
||||
; TODO bump ABI to 6
|
||||
@ -10,7 +10,7 @@
|
||||
!define VERSION_MAJOR "6"
|
||||
!define VERSION_MINOR "3"
|
||||
!define VERSION_YYYY "2022"
|
||||
!define VERSION_MMDD "0514"
|
||||
!define VERSION_MMDD "0521"
|
||||
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
|
||||
|
||||
!define MY_ABI "5"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
Summary: shared libraries for terminal handling
|
||||
Name: mingw32-ncurses6
|
||||
Version: 6.3
|
||||
Release: 20220514
|
||||
Release: 20220521
|
||||
License: X11
|
||||
Group: Development/Libraries
|
||||
Source: ncurses-%{version}-%{release}.tgz
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: shared libraries for terminal handling
|
||||
Name: ncurses6
|
||||
Version: 6.3
|
||||
Release: 20220514
|
||||
Release: 20220521
|
||||
License: X11
|
||||
Group: Development/Libraries
|
||||
Source: ncurses-%{version}-%{release}.tgz
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: Curses library with POSIX thread support.
|
||||
Name: ncursest6
|
||||
Version: 6.3
|
||||
Release: 20220514
|
||||
Release: 20220521
|
||||
License: X11
|
||||
Group: Development/Libraries
|
||||
Source: ncurses-%{version}-%{release}.tgz
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: color_content.c,v 1.13 2022/04/16 18:26:40 tom Exp $
|
||||
* $Id: color_content.c,v 1.14 2022/05/21 20:00:04 tom Exp $
|
||||
*/
|
||||
|
||||
#define NEED_TIME_H
|
||||
@ -328,5 +328,6 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
|
||||
finish_test();
|
||||
}
|
||||
|
||||
free(expected);
|
||||
ExitProgram(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2021 Thomas E. Dickey *
|
||||
* Copyright 2021,2022 Thomas E. Dickey *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the *
|
||||
@ -26,13 +26,14 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: combine.c,v 1.17 2021/12/18 21:04:00 tom Exp $
|
||||
* $Id: combine.c,v 1.19 2022/05/21 23:19:31 tom Exp $
|
||||
*/
|
||||
|
||||
#include <test.priv.h>
|
||||
|
||||
#if USE_WIDEC_SUPPORT
|
||||
|
||||
#include <wctype.h>
|
||||
#include <dump_window.h>
|
||||
#include <popup_msg.h>
|
||||
|
||||
@ -252,8 +253,10 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
|
||||
case 'd':
|
||||
if (log_option)
|
||||
dump_window(stdscr);
|
||||
#if HAVE_SCR_DUMP
|
||||
else
|
||||
scr_dump(dump_log);
|
||||
#endif
|
||||
break;
|
||||
case 'h':
|
||||
if (left_at > ' ')
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2019-2020,2021 Thomas E. Dickey *
|
||||
* Copyright 2019-2021,2022 Thomas E. Dickey *
|
||||
* Copyright 2003-2016,2017 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
@ -27,7 +27,7 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: demo_menus.c,v 1.73 2021/05/08 19:41:08 tom Exp $
|
||||
* $Id: demo_menus.c,v 1.76 2022/05/15 13:54:48 tom Exp $
|
||||
*
|
||||
* Demonstrate a variety of functions from the menu library.
|
||||
* Thomas Dickey - 2005/4/9
|
||||
@ -308,7 +308,7 @@ menu_create(ITEM ** items, int count, int ncols, MenuNo number)
|
||||
}
|
||||
|
||||
static void
|
||||
menu_destroy(MENU * m)
|
||||
menu_destroy(MENU * m, int itemsToo)
|
||||
{
|
||||
Trace(("menu_destroy %p", (void *) m));
|
||||
if (m != 0) {
|
||||
@ -331,18 +331,18 @@ menu_destroy(MENU * m)
|
||||
Trace(("freeing blob %p", blob));
|
||||
free((void *) blob);
|
||||
}
|
||||
free(items);
|
||||
items = 0;
|
||||
}
|
||||
#ifdef TRACE
|
||||
if ((count > 0) && (m == mpTrace)) {
|
||||
ITEM **ip = items;
|
||||
if (ip != 0) {
|
||||
while (*ip)
|
||||
free(*ip++);
|
||||
if (count > 0 && itemsToo) {
|
||||
if (itemsToo & 1) {
|
||||
ITEM **ip = items;
|
||||
if (ip != 0) {
|
||||
while (*ip)
|
||||
free_item(*ip++);
|
||||
}
|
||||
}
|
||||
if (itemsToo & 2)
|
||||
free(items);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -932,12 +932,12 @@ perform_menus(void)
|
||||
static void
|
||||
destroy_menus(void)
|
||||
{
|
||||
menu_destroy(mpFile);
|
||||
menu_destroy(mpSelect);
|
||||
menu_destroy(mpFile, 1);
|
||||
menu_destroy(mpSelect, 3);
|
||||
#ifdef TRACE
|
||||
menu_destroy(mpTrace);
|
||||
menu_destroy(mpTrace, 1);
|
||||
#endif
|
||||
menu_destroy(mpBanner);
|
||||
menu_destroy(mpBanner, 1);
|
||||
}
|
||||
|
||||
#if HAVE_RIPOFFLINE
|
||||
@ -1004,6 +1004,7 @@ main(int argc, char *argv[])
|
||||
int c;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
START_TRACE();
|
||||
|
||||
while ((c = getopt(argc, argv, "fht:")) != -1) {
|
||||
switch (c) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2019,2020 Thomas E. Dickey *
|
||||
* Copyright 2019-2020,2022 Thomas E. Dickey *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the *
|
||||
@ -29,10 +29,11 @@
|
||||
/*
|
||||
* Author: Thomas E. Dickey
|
||||
*
|
||||
* $Id: demo_tabs.c,v 1.5 2020/02/02 23:34:34 tom Exp $
|
||||
* $Id: demo_tabs.c,v 1.6 2022/05/15 13:04:57 tom Exp $
|
||||
*
|
||||
* A simple demo of tabs in curses.
|
||||
*/
|
||||
#define USE_CURSES
|
||||
#define USE_TINFO
|
||||
#include "test.priv.h"
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2020,2021 Thomas E. Dickey *
|
||||
* Copyright 2020-2021,2022 Thomas E. Dickey *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the *
|
||||
@ -26,9 +26,9 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: dup_field.c,v 1.2 2021/03/27 23:41:57 tom Exp $
|
||||
* $Id: dup_field.c,v 1.6 2022/05/21 20:59:26 tom Exp $
|
||||
*
|
||||
* Demonstrate move_field().
|
||||
* Demonstrate dup_field().
|
||||
*/
|
||||
|
||||
#include <test.priv.h>
|
||||
@ -38,7 +38,8 @@
|
||||
#include <edit_field.h>
|
||||
#include <popup_msg.h>
|
||||
|
||||
#define MY_DEMO EDIT_FIELD('f')
|
||||
#define DO_DEMO CTRL('F') /* actual key for toggling demo-mode */
|
||||
#define MY_DEMO EDIT_FIELD('f') /* internal request-code */
|
||||
|
||||
static char empty[] = "";
|
||||
static FIELD *all_fields[100];
|
||||
@ -51,7 +52,6 @@ static struct {
|
||||
{ CTRL('A'), REQ_BEG_FIELD, "go to beginning of field" },
|
||||
{ CTRL('D'), REQ_DOWN_FIELD, "move downward to field" },
|
||||
{ CTRL('E'), REQ_END_FIELD, "go to end of field" },
|
||||
{ CTRL('G'), MY_DEMO, "move current field with cursor keys" },
|
||||
{ CTRL('H'), REQ_DEL_PREV, "delete previous character" },
|
||||
{ CTRL('I'), REQ_NEXT_FIELD, "go to next field" },
|
||||
{ CTRL('K'), REQ_CLR_EOF, "clear to end of field" },
|
||||
@ -72,7 +72,8 @@ static struct {
|
||||
{ KEY_NEXT, REQ_NEXT_FIELD, "go to next field" },
|
||||
{ KEY_PREVIOUS, REQ_PREV_FIELD, "go to previous field" },
|
||||
{ KEY_RIGHT, REQ_RIGHT_CHAR, "move right 1 character" },
|
||||
{ KEY_UP, REQ_UP_CHAR, "move up 1 character" }
|
||||
{ KEY_UP, REQ_UP_CHAR, "move up 1 character" },
|
||||
{ DO_DEMO, MY_DEMO, "duplicate current field" }
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
@ -108,11 +109,6 @@ my_help_edit_field(void)
|
||||
free(msgs);
|
||||
}
|
||||
|
||||
static void
|
||||
do_demo(FORM *form)
|
||||
{
|
||||
}
|
||||
|
||||
static FIELD *
|
||||
make_label(const char *label, int frow, int fcol)
|
||||
{
|
||||
@ -147,28 +143,6 @@ erase_form(FORM *f)
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(s);
|
||||
delwin(w);
|
||||
}
|
||||
|
||||
static int
|
||||
my_form_driver(FORM *form, int c)
|
||||
{
|
||||
switch (c) {
|
||||
case MY_QUIT:
|
||||
if (form_driver(form, REQ_VALIDATION) == E_OK)
|
||||
return (TRUE);
|
||||
break;
|
||||
case MY_HELP:
|
||||
my_help_edit_field();
|
||||
break;
|
||||
case MY_DEMO:
|
||||
do_demo(form);
|
||||
break;
|
||||
default:
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
static FieldAttrs *
|
||||
@ -291,6 +265,55 @@ my_edit_field(FORM *form, int *result)
|
||||
return status;
|
||||
}
|
||||
|
||||
static FIELD **
|
||||
copy_fields(FIELD **source, FIELD *extra, size_t length)
|
||||
{
|
||||
FIELD **target = typeCalloc(FIELD *, length + 1);
|
||||
memcpy(target, source, length * sizeof(FIELD *));
|
||||
target[length] = extra;
|
||||
return target;
|
||||
}
|
||||
|
||||
static void
|
||||
do_demo(FORM *form)
|
||||
{
|
||||
int count = field_count(form);
|
||||
FIELD *my_field = current_field(form);
|
||||
FIELD **old_fields = form_fields(form);
|
||||
|
||||
if (count > 0 && old_fields != NULL && my_field != NULL) {
|
||||
FIELD **new_fields = copy_fields(old_fields,
|
||||
dup_field(my_field,
|
||||
form_field_row(my_field)
|
||||
+ 1,
|
||||
form_field_col(my_field)),
|
||||
(size_t) count);
|
||||
if (new_fields != NULL)
|
||||
set_form_fields(form, new_fields);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
my_form_driver(FORM *form, int c)
|
||||
{
|
||||
switch (c) {
|
||||
case MY_QUIT:
|
||||
if (form_driver(form, REQ_VALIDATION) == E_OK)
|
||||
return (TRUE);
|
||||
break;
|
||||
case MY_HELP:
|
||||
my_help_edit_field();
|
||||
break;
|
||||
case MY_DEMO:
|
||||
do_demo(form);
|
||||
break;
|
||||
default:
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_forms(void)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2020,2021 Thomas E. Dickey *
|
||||
* Copyright 2020-2021,2022 Thomas E. Dickey *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the *
|
||||
@ -26,7 +26,7 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: move_field.c,v 1.9 2021/06/12 21:30:34 tom Exp $
|
||||
* $Id: move_field.c,v 1.13 2022/05/21 20:59:46 tom Exp $
|
||||
*
|
||||
* Demonstrate move_field().
|
||||
*/
|
||||
@ -38,14 +38,6 @@
|
||||
#include <edit_field.h>
|
||||
#include <popup_msg.h>
|
||||
|
||||
#ifdef HAVE_NETBSD_FORM_H
|
||||
#define form_field_row(field) (field)->form_row
|
||||
#define form_field_col(field) (field)->form_col
|
||||
#else /* e.g., SVr4, ncurses */
|
||||
#define form_field_row(field) (field)->frow
|
||||
#define form_field_col(field) (field)->fcol
|
||||
#endif
|
||||
|
||||
#define DO_DEMO CTRL('F') /* actual key for toggling demo-mode */
|
||||
#define MY_DEMO EDIT_FIELD('f') /* internal request-code */
|
||||
|
||||
@ -151,7 +143,6 @@ erase_form(FORM *f)
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(s);
|
||||
delwin(w);
|
||||
}
|
||||
|
||||
static FieldAttrs *
|
||||
@ -277,7 +268,7 @@ my_edit_field(FORM *form, int *result)
|
||||
static FIELD **
|
||||
copy_fields(FIELD **source, size_t length)
|
||||
{
|
||||
FIELD **target = calloc(length + 1, sizeof(FIELD *));
|
||||
FIELD **target = typeCalloc(FIELD *, length + 1);
|
||||
memcpy(target, source, length * sizeof(FIELD *));
|
||||
return target;
|
||||
}
|
||||
@ -309,13 +300,13 @@ do_demo(FORM *form)
|
||||
{
|
||||
int count = field_count(form);
|
||||
FIELD *my_field = current_field(form);
|
||||
FIELD **old_fields = form_fields(form);
|
||||
|
||||
if (count > 0 && my_field != NULL) {
|
||||
if (count > 0 && old_fields != NULL && my_field != NULL) {
|
||||
size_t needed = (size_t) count;
|
||||
FIELD **old_fields = copy_fields(form_fields(form), needed);
|
||||
FIELD **new_fields = copy_fields(form_fields(form), needed);
|
||||
FIELD **new_fields = copy_fields(old_fields, needed);
|
||||
|
||||
if (old_fields != NULL && new_fields != NULL) {
|
||||
if (new_fields != NULL) {
|
||||
bool found = FALSE;
|
||||
int ch;
|
||||
|
||||
@ -395,7 +386,6 @@ do_demo(FORM *form)
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
free(old_fields);
|
||||
free(new_fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2019-2020,2021 Thomas E. Dickey *
|
||||
* Copyright 2019-2021,2022 Thomas E. Dickey *
|
||||
* Copyright 2017 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
@ -29,7 +29,7 @@
|
||||
/*
|
||||
* clone of view.c, using pads
|
||||
*
|
||||
* $Id: padview.c,v 1.18 2021/06/12 23:16:31 tom Exp $
|
||||
* $Id: padview.c,v 1.19 2022/05/15 14:36:23 tom Exp $
|
||||
*/
|
||||
|
||||
#include <test.priv.h>
|
||||
@ -45,6 +45,7 @@ static GCC_NORETURN void finish(int sig);
|
||||
|
||||
#define my_pair 1
|
||||
|
||||
static WINDOW *global_pad;
|
||||
static int shift = 0;
|
||||
static bool try_color = FALSE;
|
||||
|
||||
@ -69,6 +70,8 @@ static void
|
||||
finish(int sig)
|
||||
{
|
||||
endwin();
|
||||
if (global_pad != NULL)
|
||||
delwin(global_pad);
|
||||
ExitProgram(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@ -372,7 +375,8 @@ main(int argc, char *argv[])
|
||||
* Do this after starting color, otherwise the pad's background will be
|
||||
* uncolored after the ncurses 6.1.20181208 fixes.
|
||||
*/
|
||||
my_pad = read_file(fname = argv[optind]);
|
||||
global_pad =
|
||||
my_pad = read_file(fname = argv[optind]);
|
||||
|
||||
my_row = 0;
|
||||
while (!done) {
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: pair_content.c,v 1.15 2022/04/16 18:27:24 tom Exp $
|
||||
* $Id: pair_content.c,v 1.16 2022/05/15 15:46:28 tom Exp $
|
||||
*/
|
||||
|
||||
#define NEED_TIME_H
|
||||
@ -62,13 +62,20 @@ static struct timeval initial_time;
|
||||
static struct timeval finish_time;
|
||||
#endif
|
||||
|
||||
static void
|
||||
finish(int code)
|
||||
{
|
||||
free(expected);
|
||||
ExitProgram(code);
|
||||
}
|
||||
|
||||
static void
|
||||
failed(const char *msg)
|
||||
{
|
||||
printw("%s", msg);
|
||||
getch();
|
||||
endwin();
|
||||
ExitProgram(EXIT_FAILURE);
|
||||
finish(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#if USE_EXTENDED_COLOR
|
||||
@ -231,7 +238,7 @@ usage(void)
|
||||
size_t n;
|
||||
for (n = 0; n < SIZEOF(msg); n++)
|
||||
fprintf(stderr, "%s\n", msg[n]);
|
||||
ExitProgram(EXIT_FAILURE);
|
||||
finish(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int
|
||||
@ -314,5 +321,5 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
|
||||
finish_test();
|
||||
}
|
||||
|
||||
ExitProgram(EXIT_SUCCESS);
|
||||
finish(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
/****************************************************************************
|
||||
* Author: Thomas E. Dickey 1996-on *
|
||||
****************************************************************************/
|
||||
/* $Id: test.priv.h,v 1.199 2022/04/09 21:32:05 tom Exp $ */
|
||||
/* $Id: test.priv.h,v 1.201 2022/05/21 20:37:38 tom Exp $ */
|
||||
|
||||
#ifndef __TEST_PRIV_H
|
||||
#define __TEST_PRIV_H 1
|
||||
@ -553,8 +553,12 @@ extern int optind;
|
||||
/* workaround, to build against NetBSD's variant of the form library */
|
||||
#ifdef HAVE_NETBSD_FORM_H
|
||||
#define form_getyx(form, y, x) y = (int)current_field(form)->cursor_ypos, x = (int)current_field(form)->cursor_xpos
|
||||
#else
|
||||
#define form_field_row(field) (field)->form_row
|
||||
#define form_field_col(field) (field)->form_col
|
||||
#else /* e.g., SVr4, ncurses */
|
||||
#define form_getyx(form, y, x) y = (int)(form)->currow, x = (int)(form)->curcol
|
||||
#define form_field_row(field) (field)->frow
|
||||
#define form_field_col(field) (field)->fcol
|
||||
#endif
|
||||
|
||||
/* workaround, to build against NetBSD's variant of the form library */
|
||||
@ -928,7 +932,7 @@ extern int TABSIZE;
|
||||
|
||||
#if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H
|
||||
#include <nc_alloc.h>
|
||||
#if HAVE_EXIT_TERMINFO && (defined(USE_TERMINFO) || defined(USE_TINFO))
|
||||
#if HAVE_EXIT_TERMINFO && !defined(USE_CURSES) && (defined(USE_TERMINFO) || defined(USE_TINFO))
|
||||
#undef ExitProgram
|
||||
#define ExitProgram(code) exit_terminfo(code)
|
||||
#elif HAVE_EXIT_CURSES
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: test_mouse.c,v 1.18 2022/05/15 00:20:27 tom Exp $
|
||||
* $Id: test_mouse.c,v 1.19 2022/05/15 16:41:20 tom Exp $
|
||||
*
|
||||
* Author: Leonid S Usov
|
||||
*
|
||||
@ -194,9 +194,9 @@ main(int argc, char *argv[])
|
||||
unsigned btn;
|
||||
mmask_t events;
|
||||
#if NCURSES_MOUSE_VERSION > 1
|
||||
const int max_btn = 5;
|
||||
const unsigned max_btn = 5;
|
||||
#else
|
||||
const int max_btn = 4;
|
||||
const unsigned max_btn = 4;
|
||||
#endif
|
||||
const mmask_t btn_mask = (NCURSES_BUTTON_RELEASED |
|
||||
NCURSES_BUTTON_PRESSED |
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2020 Thomas E. Dickey *
|
||||
* Copyright 2020,2022 Thomas E. Dickey *
|
||||
* Copyright 2015,2016 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
@ -30,7 +30,7 @@
|
||||
/*
|
||||
* Author: Thomas E. Dickey
|
||||
*
|
||||
* $Id: test_setupterm.c,v 1.10 2020/02/02 23:34:34 tom Exp $
|
||||
* $Id: test_setupterm.c,v 1.12 2022/05/15 16:36:00 tom Exp $
|
||||
*
|
||||
* A simple demo of setupterm/restartterm.
|
||||
*/
|
||||
@ -43,6 +43,46 @@ static bool f_opt = FALSE;
|
||||
static bool n_opt = FALSE;
|
||||
static bool r_opt = FALSE;
|
||||
|
||||
#if NO_LEAKS
|
||||
static TERMINAL **saved_terminals;
|
||||
static size_t num_saved;
|
||||
static size_t max_saved;
|
||||
|
||||
static void
|
||||
finish(int code)
|
||||
{
|
||||
size_t n;
|
||||
for (n = 0; n < num_saved; ++n)
|
||||
del_curterm(saved_terminals[n]);
|
||||
free(saved_terminals);
|
||||
ExitProgram(code);
|
||||
}
|
||||
|
||||
static void
|
||||
save_curterm(void)
|
||||
{
|
||||
size_t n;
|
||||
bool found = FALSE;
|
||||
for (n = 0; n < num_saved; ++n) {
|
||||
if (saved_terminals[n] == cur_term) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (num_saved + 1 >= max_saved) {
|
||||
max_saved += 100;
|
||||
saved_terminals = typeRealloc(TERMINAL *, max_saved, saved_terminals);
|
||||
}
|
||||
saved_terminals[num_saved++] = cur_term;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#define finish(code) ExitProgram(code)
|
||||
#define save_curterm() /* nothing */
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_rc(NCURSES_CONST char *name, int actual_rc, int actual_err)
|
||||
{
|
||||
@ -104,6 +144,7 @@ test_setupterm(NCURSES_CONST char *name)
|
||||
#endif
|
||||
rc = setupterm(name, 0, f_opt ? NULL : &err);
|
||||
test_rc(name, rc, err);
|
||||
save_curterm();
|
||||
}
|
||||
|
||||
static void
|
||||
@ -128,7 +169,7 @@ usage(void)
|
||||
for (n = 0; n < SIZEOF(msg); ++n) {
|
||||
fprintf(stderr, "%s\n", msg[n]);
|
||||
}
|
||||
ExitProgram(EXIT_FAILURE);
|
||||
finish(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int
|
||||
@ -182,6 +223,7 @@ main(int argc, char *argv[])
|
||||
if (r_opt) {
|
||||
newterm("ansi", stdout, stdin);
|
||||
reset_shell_mode();
|
||||
save_curterm();
|
||||
}
|
||||
|
||||
if (a_opt) {
|
||||
@ -203,7 +245,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
ExitProgram(EXIT_SUCCESS);
|
||||
finish(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#else /* !HAVE_TIGETSTR */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright 2020 Thomas E. Dickey *
|
||||
* Copyright 2020,2022 Thomas E. Dickey *
|
||||
* Copyright 2017 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
@ -27,11 +27,12 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: test_termattrs.c,v 1.3 2020/02/02 23:34:34 tom Exp $
|
||||
* $Id: test_termattrs.c,v 1.4 2022/05/15 15:55:30 tom Exp $
|
||||
*
|
||||
* Demonstrate the termattrs and term_attrs functions.
|
||||
*/
|
||||
|
||||
#define USE_CURSES
|
||||
#define USE_TINFO
|
||||
#include <test.priv.h>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user