diff options
author | Soumendra Ganguly <67527439+8vasu@users.noreply.github.com> | 2021-08-27 02:56:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-27 02:56:26 (GMT) |
commit | ae224bb566301d3602e9b090e37c1dcf5a48c914 (patch) | |
tree | c309b7ead3677cb719de7b97b85715956a3e798c /Doc/library/termios.rst | |
parent | 969ae7f7356584e30667b4e490ffa2ffa1810429 (diff) | |
download | cpython-ae224bb566301d3602e9b090e37c1dcf5a48c914.zip cpython-ae224bb566301d3602e9b090e37c1dcf5a48c914.tar.gz cpython-ae224bb566301d3602e9b090e37c1dcf5a48c914.tar.bz2 |
bpo-41818: Add termios.tcgetwinsize(), termios.tcsetwinsize(). (GH-23686)
* Add termios.tcgetwinsize(), termios.tcsetwinsize(). Update docs.
* Add TIOCGSIZE support to termios.tcgetwinsize()
* Add TIOCSSIZE support to termios.tcsetwinsize()
Authored-by: Soumendra Ganguly <soumendraganguly@gmail.com>
* termios.tcgetwinsize() and termios.tcsetwinsize() should return/accept two-item tuples instead of lists.
* Refactor tcsetwinsize to share common code and accept any two item sequence, with overflow checking.
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
Diffstat (limited to 'Doc/library/termios.rst')
-rw-r--r-- | Doc/library/termios.rst | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst index d75a87c..8ced0bb 100644 --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -74,6 +74,22 @@ The module defines the following functions: output, :const:`TCIOFF` to suspend input, or :const:`TCION` to restart input. +.. function:: tcgetwinsize(fd) + + Return a tuple ``(ws_row, ws_col)`` containing the tty window size for file + descriptor *fd*. Requires :const:`termios.TIOCGWINSZ` or + :const:`termios.TIOCGSIZE`. + + +.. function:: tcsetwinsize(fd, winsize) + + Set the tty window size for file descriptor *fd* from *winsize*, which is + a two-item tuple ``(ws_row, ws_col)`` like the one returned by + :func:`tcgetwinsize`. Requires at least one of the pairs + (:const:`termios.TIOCGWINSZ`, :const:`termios.TIOCSWINSZ`); + (:const:`termios.TIOCGSIZE`, :const:`termios.TIOCSSIZE`) to be defined. + + .. seealso:: Module :mod:`tty` |