Home Explore Blog CI



neovim

30th chunk of `runtime/doc/luvref.txt`
41d5358ef4a6d1f7d91174d86f3d049f018b2c8357ee39850000000100000fa4
 TTY stream with the given file descriptor.
                Usually the file descriptor will be:

                 - 0 - stdin
                 - 1 - stdout
                 - 2 - stderr

                On Unix this function will determine the path of the fd of the
                terminal using ttyname_r(3), open it, and use it if the passed
                file descriptor refers to a TTY. This lets libuv put the tty
                in non-blocking mode without affecting other processes that
                share the tty.

                This function is not thread safe on systems that don’t support
                ioctl TIOCGPTN or TIOCPTYGNAME, for instance OpenBSD and
                Solaris.

                Returns: `uv_tty_t userdata` or `fail`

                Note: If reopening the TTY fails, libuv falls back to blocking
                writes.

uv.tty_set_mode({tty}, {mode})                               *uv.tty_set_mode()*

                > method form `tty:set_mode(mode)`

                Parameters:
                - `tty`: `uv_tty_t userdata`
                - `mode`: `string` or `integer`

                Set the TTY using the specified terminal mode.

                See |luv-constants| for supported TTY mode input values.

                Returns: `0` or `fail`

uv.tty_reset_mode()                                        *uv.tty_reset_mode()*

                To be called when the program exits. Resets TTY settings to
                default values for the next process to take over.

                This function is async signal-safe on Unix platforms but can
                fail with error code `EBUSY` if you call it when execution is
                inside |uv.tty_set_mode()|.

                Returns: `0` or `fail`

uv.tty_get_winsize({tty})                                 *uv.tty_get_winsize()*

                > method form `tty:get_winsize()`

                Parameters:
                - `tty`: `uv_tty_t userdata`

                Gets the current Window width and height.

                Returns: `integer, integer` or `fail`

uv.tty_set_vterm_state({state})                       *uv.tty_set_vterm_state()*

                Parameters:
                - `state`: `string`

                Controls whether console virtual terminal sequences are
                processed by libuv or console. Useful in particular for
                enabling ConEmu support of ANSI X3.64 and Xterm 256 colors.
                Otherwise Windows10 consoles are usually detected
                automatically. State should be one of: `"supported"` or
                `"unsupported"`.

                This function is only meaningful on Windows systems. On Unix
                it is silently ignored.

                Returns: none

uv.tty_get_vterm_state()                              *uv.tty_get_vterm_state()*

                Get the current state of whether console virtual terminal
                sequences are handled by libuv or the console. The return
                value is `"supported"` or `"unsupported"`.

                This function is not implemented on Unix, where it returns
                `ENOTSUP`.

                Returns: `string` or `fail`

==============================================================================
`uv_udp_t` — UDP handle                                  *luv-udp-handle* *uv_udp_t*

> |uv_handle_t| functions also apply.

UDP handles encapsulate UDP communication for both clients and servers.

uv.new_udp([{flags}])                                             *uv.new_udp()*

                Parameters:
                - `flags`: `table` or `nil`
                  - `family`: `string` or `nil`
                  - `mmsgs`: `integer` or `nil` (default: `1`)

                Creates and initializes a new |uv_udp_t|. Returns the Lua
                userdata wrapping it. The actual socket is created lazily.

                See |luv-constants| for supported address `family` input values.

          

Title: Libuv TTY and UDP Functions: Mode Setting, Resetting, Window Size, and Virtual Terminal State
Summary
This section details functions for managing TTY (teletypewriter) devices and UDP (User Datagram Protocol) sockets in libuv. It covers `uv.tty_set_mode()` for setting the terminal mode, `uv.tty_reset_mode()` for restoring default TTY settings, `uv.tty_get_winsize()` for retrieving window dimensions, and `uv.tty_set_vterm_state()` and `uv.tty_get_vterm_state()` for controlling virtual terminal sequence processing on Windows. It also introduces `uv.new_udp()`, used for creating and initializing a UDP handle.