Skip to content

Commit b373a38

Browse files
[3.14] gh-157140: Fix inaccuracies in the curses documentation (GH-157141) (GH-160236)
Correct the descriptions of halfdelay(), termname(), window.scroll(), window.insnstr() and window.insch(). (cherry picked from commit 97d3611) Co-authored-by: Vyron Vasileiadis <hi@fedonman.com>
1 parent 0edb915 commit b373a38

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

‎Doc/library/curses.rst‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,11 @@ The module :mod:`!curses` defines the following functions:
305305

306306
Used for half-delay mode, which is similar to cbreak mode in that characters
307307
typed by the user are immediately available to the program. However, after
308-
blocking for *tenths* tenths of seconds, raise an exception if nothing has
309-
been typed. The value of *tenths* must be a number between ``1`` and ``255``. Use
310-
:func:`nocbreak` to leave half-delay mode.
308+
blocking for *tenths* tenths of seconds, if nothing has been typed,
309+
:meth:`~window.getch` returns ``-1``, while :meth:`~window.getkey` and
310+
:meth:`~window.get_wch` raise :exc:`curses.error`.
311+
The value of *tenths* must be a number between ``1`` and ``255``.
312+
Use :func:`nocbreak` to leave half-delay mode.
311313

312314

313315
.. function:: init_color(color_number, r, g, b)
@@ -642,8 +644,10 @@ The module :mod:`!curses` defines the following functions:
642644

643645
.. function:: termname()
644646

645-
Return the value of the environment variable :envvar:`TERM`, as a bytes object,
646-
truncated to 14 characters.
647+
Return the name of the terminal in use, as a bytes object.
648+
This is the name passed to :func:`setupterm`,
649+
or the value of the :envvar:`TERM` environment variable if none was given.
650+
Some curses libraries truncate it to 14 characters.
647651

648652

649653
.. function:: tigetflag(capname)
@@ -1151,7 +1155,8 @@ Window objects
11511155
Insert character *ch* with attributes *attr* before the character under the
11521156
cursor, or at ``(y, x)`` if specified. All characters to the right of the
11531157
cursor are shifted one position right, with the rightmost character on the
1154-
line being lost. The cursor position does not change.
1158+
line being lost.
1159+
The cursor position does not change (after moving to *y*, *x*, if specified).
11551160

11561161

11571162
.. method:: window.insdelln(nlines)
@@ -1173,8 +1178,8 @@ Window objects
11731178
window.insnstr(y, x, str, n[, attr])
11741179

11751180
Insert a character string (as many characters as will fit on the line) before
1176-
the character under the cursor, up to *n* characters. If *n* is zero or
1177-
negative, the entire string is inserted. All characters to the right of the
1181+
the character under the cursor, up to *n* characters. If *n* is negative,
1182+
the entire string is inserted. All characters to the right of the
11781183
cursor are shifted right, with the rightmost characters on the line being lost.
11791184
The cursor position does not change (after moving to *y*, *x*, if specified).
11801185

@@ -1348,8 +1353,9 @@ Window objects
13481353
.. method:: window.scroll([lines=1])
13491354

13501355
Scroll the screen or scrolling region. Scroll upward by *lines* lines if
1351-
*lines* is positive, or downward if it is negative. Scrolling has no effect
1352-
unless it has been enabled for the window with :meth:`scrollok`.
1356+
*lines* is positive, or downward if it is negative.
1357+
Raise :exc:`curses.error` unless scrolling has been enabled for the window
1358+
with :meth:`scrollok`.
13531359

13541360

13551361
.. method:: window.scrollok(flag)

0 commit comments

Comments
 (0)