https://github.com/python/cpython/commit/b373a386f97b12add50f8d236df4347280ef91a6 commit: b373a386f97b12add50f8d236df4347280ef91a6 branch: 3.14 author: Serhiy Storchaka <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2026-10-22T11:38:39Z summary:
[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 97d361116f27d9a53ff735151ba26f5bcb463b74) Co-authored-by: Vyron Vasileiadis <[email protected]> files: M Doc/library/curses.rst diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst index 41b67e3dc56545..16a411290aa91b 100644 --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -305,9 +305,11 @@ The module :mod:`!curses` defines the following functions: Used for half-delay mode, which is similar to cbreak mode in that characters typed by the user are immediately available to the program. However, after - blocking for *tenths* tenths of seconds, raise an exception if nothing has - been typed. The value of *tenths* must be a number between ``1`` and ``255``. Use - :func:`nocbreak` to leave half-delay mode. + blocking for *tenths* tenths of seconds, if nothing has been typed, + :meth:`~window.getch` returns ``-1``, while :meth:`~window.getkey` and + :meth:`~window.get_wch` raise :exc:`curses.error`. + The value of *tenths* must be a number between ``1`` and ``255``. + Use :func:`nocbreak` to leave half-delay mode. .. function:: init_color(color_number, r, g, b) @@ -642,8 +644,10 @@ The module :mod:`!curses` defines the following functions: .. function:: termname() - Return the value of the environment variable :envvar:`TERM`, as a bytes object, - truncated to 14 characters. + Return the name of the terminal in use, as a bytes object. + This is the name passed to :func:`setupterm`, + or the value of the :envvar:`TERM` environment variable if none was given. + Some curses libraries truncate it to 14 characters. .. function:: tigetflag(capname) @@ -1151,7 +1155,8 @@ Window objects Insert character *ch* with attributes *attr* before the character under the cursor, or at ``(y, x)`` if specified. All characters to the right of the cursor are shifted one position right, with the rightmost character on the - line being lost. The cursor position does not change. + line being lost. + The cursor position does not change (after moving to *y*, *x*, if specified). .. method:: window.insdelln(nlines) @@ -1173,8 +1178,8 @@ Window objects window.insnstr(y, x, str, n[, attr]) Insert a character string (as many characters as will fit on the line) before - the character under the cursor, up to *n* characters. If *n* is zero or - negative, the entire string is inserted. All characters to the right of the + the character under the cursor, up to *n* characters. If *n* is negative, + the entire string is inserted. All characters to the right of the cursor are shifted right, with the rightmost characters on the line being lost. The cursor position does not change (after moving to *y*, *x*, if specified). @@ -1348,8 +1353,9 @@ Window objects .. method:: window.scroll([lines=1]) Scroll the screen or scrolling region. Scroll upward by *lines* lines if - *lines* is positive, or downward if it is negative. Scrolling has no effect - unless it has been enabled for the window with :meth:`scrollok`. + *lines* is positive, or downward if it is negative. + Raise :exc:`curses.error` unless scrolling has been enabled for the window + with :meth:`scrollok`. .. method:: window.scrollok(flag) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
