Skip to content

Commit

Permalink
pythongh-107008: Document the curses module variables LINES and COLS
Browse files Browse the repository at this point in the history
LINES and COLS referred in curses.update_lines_cols() documentations are
the module variables, not the environment variables.
  • Loading branch information
serhiy-storchaka committed Jul 22, 2023
1 parent 6acd85d commit cdfc146
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
20 changes: 19 additions & 1 deletion Doc/library/curses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,8 @@ The module :mod:`curses` defines the following functions:

.. function:: update_lines_cols()

Update :envvar:`LINES` and :envvar:`COLS`. Useful for detecting manual screen resize.
Update the :const:`LINES` and :const:`COLS` module variables.
Useful for detecting manual screen resize.

.. versionadded:: 3.5

Expand Down Expand Up @@ -1342,10 +1343,27 @@ The :mod:`curses` module defines the following data members:
.. data:: COLORS

The maximum number of colors the terminal can support.
It is defined only after the call to :func:`start_color`.

.. data:: COLOR_PAIRS

The maximum number of color pairs the terminal can support.
It is defined only after the call to :func:`start_color`.

.. data:: COLS

The width of the screen, i.e., the number of columns.
It is defined only after the call to :func:`initscr`.
Updated by :func:`update_lines_cols`, :func:`resizeterm` and
:func:`resize_term`.

.. data:: LINES

The height of the screen, i.e., the number of lines.
It is defined only after the call to :func:`initscr`.
Updated by :func:`update_lines_cols`, :func:`resizeterm` and
:func:`resize_term`.


Some constants are available to specify character cell attributes.
The exact constants available are system dependent.
Expand Down
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,8 @@ not just sequences. (Contributed by Serhiy Storchaka in :issue:`23171`.)
curses
------

The new :func:`~curses.update_lines_cols` function updates the :envvar:`LINES`
and :envvar:`COLS` environment variables. This is useful for detecting
The new :func:`~curses.update_lines_cols` function updates the :data:`LINES`
and :data:`COLS` module variables. This is useful for detecting
manual screen resizing. (Contributed by Arnon Yaari in :issue:`4254`.)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document the :mod:`curses` module variables :const:`~curses.LINES` and
:const:`~curses.COLS`.

0 comments on commit cdfc146

Please sign in to comment.