neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 896968cad1ea853521ea71a9fef854337a21843c
parent 994444571ee75b30be4c7581a9afcc95f427c255
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Thu, 15 Jan 2026 09:00:55 +0800

refactor(event/stream.c): fix confusing indent (#37398)


Diffstat:
Msrc/nvim/event/stream.c | 28++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c @@ -44,7 +44,7 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream) FUNC_ATTR_NONNULL_ARG(2) { // The underlying stream is either a file or an existing uv stream. - assert(uvstream == NULL ? fd >= 0 : fd < 0); + assert(uvstream == NULL ? fd >= 0 && loop != NULL : fd < 0 && loop == NULL); stream->uvstream = uvstream; if (fd >= 0) { @@ -57,26 +57,22 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream) // processed between reads. uv_idle_init(&loop->uv, &stream->uv.idle); stream->uv.idle.data = stream; - } else { - assert(type == UV_NAMED_PIPE || type == UV_TTY); #ifdef MSWIN - if (type == UV_TTY) { - uv_tty_init(&loop->uv, &stream->uv.tty, fd, 0); - uv_tty_set_mode(&stream->uv.tty, UV_TTY_MODE_RAW); - DWORD dwMode; - if (GetConsoleMode(stream->uv.tty.handle, &dwMode)) { - dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT; - SetConsoleMode(stream->uv.tty.handle, dwMode); - } - stream->uvstream = (uv_stream_t *)&stream->uv.tty; - } else { + } else if (type == UV_TTY) { + uv_tty_init(&loop->uv, &stream->uv.tty, fd, 0); + uv_tty_set_mode(&stream->uv.tty, UV_TTY_MODE_RAW); + DWORD dwMode; + if (GetConsoleMode(stream->uv.tty.handle, &dwMode)) { + dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT; + SetConsoleMode(stream->uv.tty.handle, dwMode); + } + stream->uvstream = (uv_stream_t *)&stream->uv.tty; #endif + } else { + assert(type == UV_NAMED_PIPE || type == UV_TTY); uv_pipe_init(&loop->uv, &stream->uv.pipe, 0); uv_pipe_open(&stream->uv.pipe, fd); stream->uvstream = (uv_stream_t *)&stream->uv.pipe; -#ifdef MSWIN - } -#endif } }