Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.12] gh-107008: Document the curses module variables LINES and COLS (GH-107011) #107057

Merged
merged 1 commit into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Doc/library/curses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@

.. function:: filter()

The :func:`.filter` routine, if used, must be called before :func:`initscr` is

Check warning on line 179 in Doc/library/curses.rst

View workflow job for this annotation

GitHub Actions / Docs

'envvar' reference target not found: LINES
called. The effect is that, during those calls, :envvar:`LINES` is set to ``1``; the
capabilities ``clear``, ``cup``, ``cud``, ``cud1``, ``cuu1``, ``cuu``, ``vpa`` are disabled; and the ``home``
string is set to the value of ``cr``. The effect is that the cursor is confined to
Expand Down Expand Up @@ -546,7 +546,7 @@

.. function:: setupterm(term=None, fd=-1)

Initialize the terminal. *term* is a string giving

Check warning on line 549 in Doc/library/curses.rst

View workflow job for this annotation

GitHub Actions / Docs

'envvar' reference target not found: TERM
the terminal name, or ``None``; if omitted or ``None``, the value of the
:envvar:`TERM` environment variable will be used. *fd* is the
file descriptor to which any initialization sequences will be sent; if not
Expand Down Expand Up @@ -575,7 +575,7 @@

.. function:: termname()

Return the value of the environment variable :envvar:`TERM`, as a bytes object,

Check warning on line 578 in Doc/library/curses.rst

View workflow job for this annotation

GitHub Actions / Docs

'envvar' reference target not found: TERM
truncated to 14 characters.


Expand Down Expand Up @@ -641,7 +641,8 @@

.. 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 All @@ -665,7 +666,7 @@

.. function:: use_env(flag)

If used, this function should be called before :func:`initscr` or newterm are

Check warning on line 669 in Doc/library/curses.rst

View workflow job for this annotation

GitHub Actions / Docs

'envvar' reference target not found: LINES

Check warning on line 669 in Doc/library/curses.rst

View workflow job for this annotation

GitHub Actions / Docs

'envvar' reference target not found: COLUMNS

Check warning on line 669 in Doc/library/curses.rst

View workflow job for this annotation

GitHub Actions / Docs

'envvar' reference target not found: LINES

Check warning on line 669 in Doc/library/curses.rst

View workflow job for this annotation

GitHub Actions / Docs

'envvar' reference target not found: COLUMNS
called. When *flag* is ``False``, the values of lines and columns specified in the
terminfo database will be used, even if environment variables :envvar:`LINES`
and :envvar:`COLUMNS` (used by default) are set, or if curses is running in a
Expand Down Expand Up @@ -1342,10 +1343,27 @@
.. 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 @@ -178,7 +178,7 @@
>>> async def coro():
... return 'spam'

Inside a coroutine function, the new :keyword:`await` expression can be used

Check warning on line 181 in Doc/whatsnew/3.5.rst

View workflow job for this annotation

GitHub Actions / Docs

py:meth reference target not found: __await__
to suspend coroutine execution until the result is available. Any object
can be *awaited*, as long as it implements the :term:`awaitable` protocol by
defining the :meth:`__await__` method.
Expand Down Expand Up @@ -271,7 +271,7 @@
PEP 465 - A dedicated infix operator for matrix multiplication
--------------------------------------------------------------

:pep:`465` adds the ``@`` infix operator for matrix multiplication.

Check warning on line 274 in Doc/whatsnew/3.5.rst

View workflow job for this annotation

GitHub Actions / Docs

py:meth reference target not found: __matmul__

Check warning on line 274 in Doc/whatsnew/3.5.rst

View workflow job for this annotation

GitHub Actions / Docs

py:meth reference target not found: __rmatmul__
Currently, no builtin Python types implement the new operator, however, it
can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`,
and :meth:`__imatmul__` for regular, reflected, and in-place matrix
Expand Down Expand Up @@ -1045,8 +1045,8 @@
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`.