Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add the set_escdelay(3) and set_tabsize(3) ncurses extensions.
details: https://anonhg.NetBSD.org/src/rev/80baae0e165a
branches: trunk
changeset: 350136:80baae0e165a
user: roy <roy%NetBSD.org@localhost>
date: Thu Jan 05 20:31:37 2017 +0000
description:
Add the set_escdelay(3) and set_tabsize(3) ncurses extensions.
diffstat:
distrib/sets/lists/comp/mi | 8 +++++++-
lib/libcurses/Makefile | 3 ++-
lib/libcurses/curses.3 | 9 +++++++--
lib/libcurses/curses.h | 4 +++-
lib/libcurses/curses_input.3 | 21 +++++++++++++++++++--
lib/libcurses/curses_private.h | 5 ++++-
lib/libcurses/curses_screen.3 | 22 +++++++++++++++++++---
lib/libcurses/get_wch.c | 13 +++++++------
lib/libcurses/getch.c | 24 +++++++++++++++++++-----
lib/libcurses/setterm.c | 25 +++++++++++++++++++++----
10 files changed, 108 insertions(+), 26 deletions(-)
diffs (truncated from 452 to 300 lines):
diff -r 131d3e2d3afc -r 80baae0e165a distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Thu Jan 05 16:35:33 2017 +0000
+++ b/distrib/sets/lists/comp/mi Thu Jan 05 20:31:37 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.2095 2017/01/05 13:45:51 wiz Exp $
+# $NetBSD: mi,v 1.2096 2017/01/05 20:31:37 roy Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
./etc/mtree/set.comp comp-sys-root
@@ -8841,6 +8841,7 @@
./usr/share/man/cat3/set_current_field.0 comp-c-catman .cat
./usr/share/man/cat3/set_current_item.0 comp-c-catman .cat
./usr/share/man/cat3/set_curterm.0 comp-c-catman .cat
+./usr/share/man/cat3/set_escdelay.0 comp-c-catman .cat
./usr/share/man/cat3/set_field_back.0 comp-c-catman .cat
./usr/share/man/cat3/set_field_buffer.0 comp-c-catman .cat
./usr/share/man/cat3/set_field_fore.0 comp-c-catman .cat
@@ -8884,6 +8885,7 @@
./usr/share/man/cat3/set_menu_win.0 comp-c-catman .cat
./usr/share/man/cat3/set_new_page.0 comp-c-catman .cat
./usr/share/man/cat3/set_panel_userptr.0 comp-c-catman .cat
+./usr/share/man/cat3/set_tabsize.0 comp-c-catman .cat
./usr/share/man/cat3/set_term.0 comp-c-catman .cat
./usr/share/man/cat3/set_top_row.0 comp-c-catman .cat
./usr/share/man/cat3/setbuf.0 comp-c-catman .cat
@@ -16148,6 +16150,7 @@
./usr/share/man/html3/set_current_field.html comp-c-htmlman html
./usr/share/man/html3/set_current_item.html comp-c-htmlman html
./usr/share/man/html3/set_curterm.html comp-c-htmlman html
+./usr/share/man/html3/set_escdelay.html comp-c-htmlman html
./usr/share/man/html3/set_field_back.html comp-c-htmlman html
./usr/share/man/html3/set_field_buffer.html comp-c-htmlman html
./usr/share/man/html3/set_field_fore.html comp-c-htmlman html
@@ -16191,6 +16194,7 @@
./usr/share/man/html3/set_menu_win.html comp-c-htmlman html
./usr/share/man/html3/set_new_page.html comp-c-htmlman html
./usr/share/man/html3/set_panel_userptr.html comp-c-htmlman html
+./usr/share/man/html3/set_tabsize.html comp-c-htmlman html
./usr/share/man/html3/set_term.html comp-c-htmlman html
./usr/share/man/html3/set_top_row.html comp-c-htmlman html
./usr/share/man/html3/setbuf.html comp-c-htmlman html
@@ -23458,6 +23462,7 @@
./usr/share/man/man3/set_current_field.3 comp-c-man .man
./usr/share/man/man3/set_current_item.3 comp-c-man .man
./usr/share/man/man3/set_curterm.3 comp-c-man .man
+./usr/share/man/man3/set_escdelay.3 comp-c-man .man
./usr/share/man/man3/set_field_back.3 comp-c-man .man
./usr/share/man/man3/set_field_buffer.3 comp-c-man .man
./usr/share/man/man3/set_field_fore.3 comp-c-man .man
@@ -23501,6 +23506,7 @@
./usr/share/man/man3/set_menu_win.3 comp-c-man .man
./usr/share/man/man3/set_new_page.3 comp-c-man .man
./usr/share/man/man3/set_panel_userptr.3 comp-c-man .man
+./usr/share/man/man3/set_tabsize.3 comp-c-man .man
./usr/share/man/man3/set_term.3 comp-c-man .man
./usr/share/man/man3/set_top_row.3 comp-c-man .man
./usr/share/man/man3/setbuf.3 comp-c-man .man
diff -r 131d3e2d3afc -r 80baae0e165a lib/libcurses/Makefile
--- a/lib/libcurses/Makefile Thu Jan 05 16:35:33 2017 +0000
+++ b/lib/libcurses/Makefile Thu Jan 05 20:31:37 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.78 2017/01/03 13:21:40 roy Exp $
+# $NetBSD: Makefile,v 1.79 2017/01/05 20:31:37 roy Exp $
# @(#)Makefile 8.2 (Berkeley) 1/2/94
.include <bsd.own.mk>
@@ -145,6 +145,7 @@
curses_scroll.3 scrl.3 curses_scroll.3 scroll.3 \
curses_scroll.3 scrollok.3 curses_scroll.3 setscrreg.3 \
curses_cursor.3 setsyx.3 \
+ curses_input.3 set_escdelay.3 curses_screen.3 set_tabsize.3 \
curses_screen.3 set_term.3 curses_screen.3 setterm.3 \
curses_standout.3 standend.3 curses_standout.3 standout.3 \
curses_color.3 start_color.3 curses_pad.3 subpad.3 \
diff -r 131d3e2d3afc -r 80baae0e165a lib/libcurses/curses.3
--- a/lib/libcurses/curses.3 Thu Jan 05 16:35:33 2017 +0000
+++ b/lib/libcurses/curses.3 Thu Jan 05 20:31:37 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: curses.3,v 1.63 2012/04/21 12:27:27 roy Exp $
+.\" $NetBSD: curses.3,v 1.64 2017/01/05 20:31:37 roy Exp $
.\"
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)curses.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd April 5, 2012
+.Dd January 5, 2017
.Dt CURSES 3
.Os
.Sh NAME
@@ -221,6 +221,8 @@
.It scrl Ta Xr curses_scroll 3
.It scroll Ta Xr curses_scroll 3
.It scrollok Ta Xr curses_scroll 3
+.It set_escdelay Ta Xr curses_input 3
+.It set_tabsize Ta Xr curses_screen 3
.It set_term Ta Xr curses_screen 3
.It setscrreg Ta Xr curses_scroll 3
.It setterm Ta Xr curses_screen 3
@@ -309,6 +311,9 @@
keystrokes (such are arrow keys) where the adjacent characters are considered
part of the same multi-character sequence.
The default is 300 milliseconds.
+.It TABSIZE
+The number of spaces making up a tab.
+The default is 8 if not specified by the terminal description.
.It LINES
The number of lines in the terminal if set.
is usually automatically configured by querying the kernel.
diff -r 131d3e2d3afc -r 80baae0e165a lib/libcurses/curses.h
--- a/lib/libcurses/curses.h Thu Jan 05 16:35:33 2017 +0000
+++ b/lib/libcurses/curses.h Thu Jan 05 20:31:37 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses.h,v 1.115 2017/01/04 03:51:29 roy Exp $ */
+/* $NetBSD: curses.h,v 1.116 2017/01/05 20:31:37 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -749,6 +749,8 @@
int scroll(WINDOW *);
int scrollok(WINDOW *, bool);
int setterm(char *);
+int set_escdelay(int);
+int set_tabsize(int);
SCREEN *set_term(SCREEN *);
int start_color(void);
WINDOW *subpad(WINDOW *, int, int, int, int);
diff -r 131d3e2d3afc -r 80baae0e165a lib/libcurses/curses_input.3
--- a/lib/libcurses/curses_input.3 Thu Jan 05 16:35:33 2017 +0000
+++ b/lib/libcurses/curses_input.3 Thu Jan 05 20:31:37 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: curses_input.3,v 1.23 2017/01/01 03:06:06 roy Exp $
+.\" $NetBSD: curses_input.3,v 1.24 2017/01/05 20:31:37 roy Exp $
.\"
.\" Copyright (c) 2002
.\" Brett Lymn (blymn%NetBSD.org@localhost, brett_lymn%yahoo.com.au@localhost)
@@ -55,7 +55,8 @@
.Nm timeout ,
.Nm wtimeout ,
.Nm nodelay ,
-.Nm ungetch
+.Nm ungetch ,
+.Nm set_escdelay
.Nd curses input stream routines
.Sh LIBRARY
.Lb libcurses
@@ -103,6 +104,8 @@
.Fn nodelay "WINDOW *win" "boolf flag"
.Ft int
.Fn ungetch "int c"
+.Ft int
+.Fn set_escdelay "int escdelay"
.Pp
.Va extern int ESCDELAY ;
.Sh DESCRIPTION
@@ -385,6 +388,13 @@
into an unsigned char and push that character back onto the input stream.
Only one character of push-back is guaranteed to work, more may be possible
depending on system resources.
+.Pp
+The
+.Fn set_escdelay
+function sets the
+.Va ESCDELAY
+value of the current screen to
+.Fa escdelay.
.Sh RETURN VALUES
The functions
.Fn getch ,
@@ -592,3 +602,10 @@
.Sh HISTORY
The Curses package appeared in
.Bx 4.0 .
+The
+.Fn set_tabsize
+function is a
+.Em ncurses
+extension to the Curses library and was added in
+.Nx 8.0 .
+
diff -r 131d3e2d3afc -r 80baae0e165a lib/libcurses/curses_private.h
--- a/lib/libcurses/curses_private.h Thu Jan 05 16:35:33 2017 +0000
+++ b/lib/libcurses/curses_private.h Thu Jan 05 20:31:37 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses_private.h,v 1.55 2017/01/03 12:42:06 roy Exp $ */
+/* $NetBSD: curses_private.h,v 1.56 2017/01/05 20:31:37 roy Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@@ -201,7 +201,10 @@
int lx, ly; /* loop parameters for refresh */
int COLS; /* Columns on the screen. */
int LINES; /* Lines on the screen. */
+ int ESCDELAY; /* Delay between keys in esc seq's. */
+#define ESCDELAY_DEFAULT 300 /* milliseconds. */
int TABSIZE; /* Size of a tab. */
+#define TABSIZE_DEFAULT 8 /* spaces. */
int COLORS; /* Maximum colors on the screen */
int COLOR_PAIRS; /* Maximum color pairs on the screen */
int My_term; /* Use Def_term regardless. */
diff -r 131d3e2d3afc -r 80baae0e165a lib/libcurses/curses_screen.3
--- a/lib/libcurses/curses_screen.3 Thu Jan 05 16:35:33 2017 +0000
+++ b/lib/libcurses/curses_screen.3 Thu Jan 05 20:31:37 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: curses_screen.3,v 1.19 2017/01/05 12:35:41 wiz Exp $
+.\" $NetBSD: curses_screen.3,v 1.20 2017/01/05 20:31:37 roy Exp $
.\"
.\" Copyright (c) 2002
.\" Brett Lymn (blymn%NetBSD.org@localhost, brett_lymn%yahoo.com.au@localhost)
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\"
-.Dd December 30, 2016
+.Dd January 5, 2017
.Dt CURSES_SCREEN 3
.Os
.Sh NAME
@@ -44,7 +44,8 @@
.Nm initscr ,
.Nm isendwin ,
.Nm resizeterm ,
-.Nm setterm
+.Nm setterm ,
+.Nm set_tabsize
.Nd curses terminal and screen routines
.Sh LIBRARY
.Lb libcurses
@@ -70,6 +71,8 @@
.Fn resizeterm "int lines" "int cols"
.Ft int
.Fn setterm "char *name"
+.Ft int
+.Fn set_tabsize "int value"
.Pp
.Va extern int LINES ;
.Pp
@@ -209,6 +212,13 @@
.Fn newterm ,
or
.Fn setupterm .
+.Pp
+The
+.Fn set_tabsize
+function will set
+.Va TABSIZE
+of the current screen to
+.Va tabsize .
.Sh RETURN VALUES
Functions returning pointers will return
.Dv NULL
@@ -241,3 +251,9 @@
.Em ncurses
extension to the Curses library and was added in
.Nx 1.6 .
+The
+.Fn set_tabsize
+function is a
+.Em ncurses
+extension to the Curses library and was added in
+.Nx 8.0 .
diff -r 131d3e2d3afc -r 80baae0e165a lib/libcurses/get_wch.c
--- a/lib/libcurses/get_wch.c Thu Jan 05 16:35:33 2017 +0000
+++ b/lib/libcurses/get_wch.c Thu Jan 05 20:31:37 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: get_wch.c,v 1.10 2012/06/29 10:40:29 blymn Exp $ */
+/* $NetBSD: get_wch.c,v 1.11 2017/01/05 20:31:37 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: get_wch.c,v 1.10 2012/06/29 10:40:29 blymn Exp $");
+__RCSID("$NetBSD: get_wch.c,v 1.11 2017/01/05 20:31:37 roy Exp $");
#endif /* not lint */
#include <string.h>
@@ -91,6 +91,7 @@
*working = &_cursesi_screen->cbuf_cur,
*end = &_cursesi_screen->cbuf_tail;
char *inbuf = &_cursesi_screen->cbuf[ 0 ];
+ int escdelay = _cursesi_screen->ESCDELAY;
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT, "inkey (%p, %d, %d)\n", wc, to, delay);
@@ -139,11 +140,11 @@
} else if (wstate == INKEY_ASSEMBLING) {
/* assembling a key sequence */
if (delay) {
- if (__timeout(to ? (ESCDELAY / 100) : delay)
+ if (__timeout(to ? (escdelay / 100) : delay)
== ERR)
return ERR;
} else {
- if (to && (__timeout(ESCDELAY / 100) == ERR))
+ if (to && (__timeout(escdelay / 100) == ERR))
Home |
Main Index |
Thread Index |
Old Index