Module Name: src
Committed By: blymn
Date: Thu Dec 5 04:08:12 UTC 2024
Modified Files:
src/lib/libcurses: curses.expsym curses.h curses_scroll.3 scroll.c
shlib_version
Log Message:
Fixes PR lib/58823
Implement the ncurses extension wgetscrreg which returns the
scrolling region of the given window. Also implement getscrreg to
get the scrolling region of stdscr which appears to be missing from
ncurses but does follow the convention of having a non w prefixed
function that applies to stdscr.
Due to the addtion of a new function a minor library version bump has
been done.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libcurses/curses.expsym
cvs rdiff -u -r1.132 -r1.133 src/lib/libcurses/curses.h
cvs rdiff -u -r1.4 -r1.5 src/lib/libcurses/curses_scroll.3
cvs rdiff -u -r1.27 -r1.28 src/lib/libcurses/scroll.c
cvs rdiff -u -r1.47 -r1.48 src/lib/libcurses/shlib_version
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libcurses/curses.expsym
diff -u src/lib/libcurses/curses.expsym:1.1 src/lib/libcurses/curses.expsym:1.2
--- src/lib/libcurses/curses.expsym:1.1 Thu Nov 21 19:47:43 2024
+++ src/lib/libcurses/curses.expsym Thu Dec 5 04:08:12 2024
@@ -184,6 +184,7 @@ getn_wstr
getnstr
getparx
getpary
+getscrreg
getstr
gettmode
getwin
@@ -453,6 +454,7 @@ wgetbkgrnd
wgetch
wgetn_wstr
wgetnstr
+wgetscrreg
wgetstr
whline
whline_set
Index: src/lib/libcurses/curses.h
diff -u src/lib/libcurses/curses.h:1.132 src/lib/libcurses/curses.h:1.133
--- src/lib/libcurses/curses.h:1.132 Fri May 17 23:32:50 2024
+++ src/lib/libcurses/curses.h Thu Dec 5 04:08:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: curses.h,v 1.132 2024/05/17 23:32:50 uwe Exp $ */
+/* $NetBSD: curses.h,v 1.133 2024/12/05 04:08:12 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -561,6 +561,7 @@ int echochar(const chtype);
int erase(void);
int getch(void);
int getnstr(char *, int);
+int getscrreg(int *, int *);
int getstr(char *);
chtype inch(void);
int inchnstr(chtype *, int);
@@ -800,6 +801,7 @@ int wechochar(WINDOW *, const chtype);
int werase(WINDOW *);
int wgetch(WINDOW *);
int wgetnstr(WINDOW *, char *, int);
+int wgetscrreg(WINDOW *, int *, int *);
int wgetstr(WINDOW *, char *);
int whline(WINDOW *, chtype, int);
chtype winch(WINDOW *);
Index: src/lib/libcurses/curses_scroll.3
diff -u src/lib/libcurses/curses_scroll.3:1.4 src/lib/libcurses/curses_scroll.3:1.5
--- src/lib/libcurses/curses_scroll.3:1.4 Wed Apr 16 13:35:01 2003
+++ src/lib/libcurses/curses_scroll.3 Thu Dec 5 04:08:12 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: curses_scroll.3,v 1.4 2003/04/16 13:35:01 wiz Exp $
+.\" $NetBSD: curses_scroll.3,v 1.5 2024/12/05 04:08:12 blymn Exp $
.\"
.\" Copyright (c) 2002
.\" Brett Lymn ([email protected], [email protected])
@@ -35,11 +35,13 @@
.Os
.Sh NAME
.Nm curses_scroll ,
+.Nm getscrreg ,
.Nm scrl ,
.Nm wscrl
.Nm scroll ,
.Nm scrollok ,
.Nm setscrreg ,
+.Nm wgetscrreg
.Nm wsetscrreg
.Nd curses window scrolling routines
.Sh LIBRARY
@@ -47,6 +49,8 @@
.Sh SYNOPSIS
.In curses.h
.Ft int
+.Fn getscrreg "int *top" "int *bottom"
+.Ft int
.Fn scrl "int n"
.Ft int
.Fn wscrl "WINDOW *win" "int n"
@@ -57,8 +61,16 @@
.Ft int
.Fn setscrreg "int top" "int bottom"
.Ft int
+.Fn wgetscrreg "WINDOW *win" "int *top" "int *bottom"
+.Ft int
.Fn wsetscrreg "WINDOW *win" "int top" "int bottom"
.Sh DESCRIPTION
+The
+.Fn setscrreg
+function gets the software scrolling region lines on
+.Dv stdscr
+which defines a region of the screen that will be scrolled.
+.Pp
These functions scroll areas on
.Dv stdscr
or on the specified window.
@@ -130,6 +142,14 @@ The scrolling of this region is also con
function.
.Pp
The
+.Fn wgetscrreg
+function does the same as the
+.Fn getscrreg
+function, except that the scrolling region is retrieved from the window
+specified by
+.Fa win .
+.Pp
+The
.Fn wsetscrreg
function does the same as the
.Fn setscrreg
Index: src/lib/libcurses/scroll.c
diff -u src/lib/libcurses/scroll.c:1.27 src/lib/libcurses/scroll.c:1.28
--- src/lib/libcurses/scroll.c:1.27 Mon Sep 6 07:03:50 2021
+++ src/lib/libcurses/scroll.c Thu Dec 5 04:08:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: scroll.c,v 1.27 2021/09/06 07:03:50 rin Exp $ */
+/* $NetBSD: scroll.c,v 1.28 2024/12/05 04:08:12 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: scroll.c,v 1.27 2021/09/06 07:03:50 rin Exp $");
+__RCSID("$NetBSD: scroll.c,v 1.28 2024/12/05 04:08:12 blymn Exp $");
#endif
#endif /* not lint */
@@ -76,6 +76,17 @@ setscrreg(int top, int bottom)
return wsetscrreg(stdscr, top, bottom);
}
+/*
+ * getscrreg --
+ * Get the top and bottom of the scrolling region for stdscr.
+ */
+int
+getscrreg(int *top, int *bottom)
+{
+
+ return wgetscrreg(stdscr, top, bottom);
+}
+
#endif
/*
@@ -124,6 +135,18 @@ wsetscrreg(WINDOW *win, int top, int bot
}
/*
+ * wgetscrreg --
+ * Get the top and bottom of the scrolling region for win.
+ */
+int
+wgetscrreg(WINDOW *win, int *top, int *bottom)
+{
+ *top = win->scr_t;
+ *bottom = win->scr_b;
+ return OK;
+}
+
+/*
* has_ic --
* Does the terminal have insert- and delete-character?
*/
Index: src/lib/libcurses/shlib_version
diff -u src/lib/libcurses/shlib_version:1.47 src/lib/libcurses/shlib_version:1.48
--- src/lib/libcurses/shlib_version:1.47 Tue Apr 12 07:03:04 2022
+++ src/lib/libcurses/shlib_version Thu Dec 5 04:08:12 2024
@@ -1,7 +1,7 @@
-# $NetBSD: shlib_version,v 1.47 2022/04/12 07:03:04 blymn Exp $
+# $NetBSD: shlib_version,v 1.48 2024/12/05 04:08:12 blymn Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
# Remember to increment the major numbers of libform, libmenu and
# libpanel when the libcurses major number increments.
#
major=9
-minor=1
+minor=2