]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_scroll.3x
6dee97c50ba2013ba571ba17db1fe8d7c556f8f6
[ncurses.git] / man / curs_scroll.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 Thomas E. Dickey                                *
3 .\" Copyright 1998-2006,2010 Free Software Foundation, Inc.                  *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_scroll.3x,v 1.45 2024/05/25 20:16:27 tom Exp $
31 .TH curs_scroll 3X 2024-05-25 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
32 .ie \n(.g \{\
33 .ds `` \(lq
34 .ds '' \(rq
35 .\}
36 .el \{\
37 .ie t .ds `` ``
38 .el   .ds `` ""
39 .ie t .ds '' ''
40 .el   .ds '' ""
41 .\}
42 .
43 .de bP
44 .ie n  .IP \(bu 4
45 .el    .IP \(bu 2
46 ..
47 .SH NAME
48 \fB\%scroll\fP,
49 \fB\%scrl\fP,
50 \fB\%wscrl\fP \-
51 scroll a \fIcurses\fP window
52 .SH SYNOPSIS
53 .nf
54 \fB#include <curses.h>
55 .PP
56 \fBint scroll(WINDOW * \fIwin\fP);
57 .PP
58 \fBint scrl(int \fIn\fP);
59 \fBint wscrl(WINDOW * \fIwin\fP, int \fIn\fP);
60 .fi
61 .SH DESCRIPTION
62 .B scroll
63 scrolls the given window up one line.
64 That is,
65 every visible line we might number
66 .I i
67 becomes line
68 .IR i "\-1."
69 The text of the top line in the window disappears and the bottom line
70 is populated with blank characters;
71 see \fB\%bkgd\fP(3X) or \fB\%bkgrnd\fP(3X).
72 As an optimization,
73 if the scrolling region of the window is the entire screen,
74 the physical screen may be scrolled at the same time;
75 see \fB\%curscr\fP(3X).
76 .PP
77 .B \%scrl
78 and
79 .B \%wscrl
80 scroll
81 .B \%stdscr
82 or the specified window up or down depending on the sign of
83 .IR n "."
84 .bP
85 For positive
86 .IR n ","
87 line
88 .IR i + n
89 becomes
90 .I i
91 (scrolling up);
92 .bP
93 for negative
94 .IR n ","
95 line
96 .IR i \- n
97 becomes
98 .I i
99 (scrolling down).
100 .PP
101 The cursor does not move.
102 These functions perform no operation unless scrolling is enabled for the
103 window via \fB\%scrollok\fP(3X).
104 .SH "RETURN VALUE"
105 These functions return
106 .B ERR
107 upon failure and
108 .B OK
109 upon success.
110 .PP
111 .I \%ncurses
112 returns
113 .B ERR
114 if scrolling is not enabled in the window,
115 for example with \fB\%scrollok\fP(3X),
116 or if the
117 .I \%WINDOW
118 pointer is null.
119 .SH NOTES
120 .B \%scrl
121 and
122 .B \%wscrl
123 may be implemented as macros.
124 .PP
125 Unusually,
126 there is no
127 .B \%wscroll
128 function;
129 .B scroll
130 behaves as one would expect
131 .B \%wscroll
132 to,
133 accepting a
134 .I \%WINDOW
135 pointer argument.
136 .SH PORTABILITY
137 X/Open Curses,
138 Issue 4 describes these functions.
139 It defines no error conditions.
140 .PP
141 SVr4 specifies only
142 \*(``an integer value other than
143 .BR ERR \*(''
144 as a successful return value.
145 .PP
146 SVr4 indicates that the optimization of physically scrolling immediately
147 if the scroll region is the entire screen \*(``is\*('' performed,
148 not \*(``may be\*('' performed.
149 .I \%ncurses
150 deliberately does not guarantee that this will occur,
151 to leave open the possibility of smarter optimization of multiple scroll
152 actions on the next update.
153 .PP
154 Neither SVr4
155 .I curses
156 nor X/Open Curses specify whether the current attribute or current color
157 pair of blanks generated by the scroll function are zeroed.
158 .I \%ncurses
159 does so.
160 .SH SEE ALSO
161 \fB\%curses\fP(3X),
162 \fB\%curs_outopts\fP(3X)