Skip to content

Commit 97d3611

Browse files
authored
gh-157140: Fix inaccuracies in the curses documentation (GH-157141)
Correct the descriptions of halfdelay(), termname(), window.scroll(), window.insnstr() and window.insch().
1 parent b7790f1 commit 97d3611

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
@@ -274,9 +274,11 @@ Input options
274274

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

281283
.. function:: meta(flag)
282284

@@ -893,8 +895,10 @@ Querying the terminal
893895

894896
.. function:: termname()
895897

896-
Return the value of the environment variable :envvar:`TERM`, as a bytes object,
897-
truncated to 14 characters.
898+
Return the name of the terminal in use, as a bytes object.
899+
This is the name passed to :func:`newterm` or
900+
:func:`setupterm`, or the value of the :envvar:`TERM` environment variable
901+
if none was given. Some curses libraries truncate it to 14 characters.
898902

899903
.. function:: longname()
900904

@@ -1227,7 +1231,8 @@ Adding and inserting text
12271231
Insert character *ch* with attributes *attr* before the character under the
12281232
cursor, or at ``(y, x)`` if specified. All characters to the right of the
12291233
cursor are shifted one position right, with the rightmost character on the
1230-
line being lost. The cursor position does not change.
1234+
line being lost.
1235+
The cursor position does not change (after moving to *y*, *x*, if specified).
12311236

12321237
.. versionchanged:: 3.16
12331238
Wide and combining characters, and :class:`complexchar` cells, are now
@@ -1251,8 +1256,8 @@ Adding and inserting text
12511256
window.insnstr(y, x, str, n[, attr])
12521257

12531258
Insert a character string (as many characters as will fit on the line) before
1254-
the character under the cursor, up to *n* characters. If *n* is zero or
1255-
negative, the entire string is inserted. All characters to the right of the
1259+
the character under the cursor, up to *n* characters. If *n* is negative,
1260+
the entire string is inserted. All characters to the right of the
12561261
cursor are shifted right, with the rightmost characters on the line being lost.
12571262
The cursor position does not change (after moving to *y*, *x*, if specified).
12581263

@@ -1871,8 +1876,9 @@ Output options
18711876
.. method:: window.scroll([lines=1])
18721877

18731878
Scroll the screen or scrolling region. Scroll upward by *lines* lines if
1874-
*lines* is positive, or downward if it is negative. Scrolling has no effect
1875-
unless it has been enabled for the window with :meth:`scrollok`.
1879+
*lines* is positive, or downward if it is negative.
1880+
Raise :exc:`curses.error` unless scrolling has been enabled for the window
1881+
with :meth:`scrollok`.
18761882

18771883
.. method:: window.setscrreg(top, bottom)
18781884

0 commit comments

Comments
 (0)