aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tui
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-05-30 12:59:02 +0200
committerbfredl <bjorn.linse@gmail.com>2024-05-31 15:01:13 +0200
commitc13c50b752dca322a5ec77dea6188c9e3694549b (patch)
tree048342b08d13f6df0b9c29b9b0b5d470322e6a0c /src/nvim/tui
parent6566a59b3a6c8dabfa40f8debd0de96d875825e9 (diff)
downloadrneovim-c13c50b752dca322a5ec77dea6188c9e3694549b.tar.gz
rneovim-c13c50b752dca322a5ec77dea6188c9e3694549b.tar.bz2
rneovim-c13c50b752dca322a5ec77dea6188c9e3694549b.zip
refactor(io): separate types for read and write streams
This is a structural refactor with no logical changes, yet. Done in preparation for simplifying rstream/rbuffer which will require more state inline in RStream. The initial idea was to have RStream and WStream as sub-types symetrically but that doesn't work, as sockets are both reading and writing. Also there is very little write-specific state to start with, so the benefit of a separate WStream struct is a lot smaller. Just document what fields in `Stream` are write specific.
Diffstat (limited to 'src/nvim/tui')
-rw-r--r--src/nvim/tui/input.c4
-rw-r--r--src/nvim/tui/input.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index f1594dfcb9..588fed2d90 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -167,7 +167,7 @@ void tinput_destroy(TermInput *input)
map_destroy(int, &kitty_key_map);
rbuffer_free(input->key_buffer);
uv_close((uv_handle_t *)&input->timer_handle, NULL);
- stream_close(&input->read_stream, NULL, NULL);
+ rstream_may_close(&input->read_stream);
termkey_destroy(input->tk);
}
@@ -737,7 +737,7 @@ static void handle_raw_buffer(TermInput *input, bool force)
}
}
-static void tinput_read_cb(Stream *stream, RBuffer *buf, size_t count_, void *data, bool eof)
+static void tinput_read_cb(RStream *stream, RBuffer *buf, size_t count_, void *data, bool eof)
{
TermInput *input = data;
diff --git a/src/nvim/tui/input.h b/src/nvim/tui/input.h
index bf6d0f2978..646fbdd16a 100644
--- a/src/nvim/tui/input.h
+++ b/src/nvim/tui/input.h
@@ -33,7 +33,7 @@ typedef struct {
TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn; ///< libtermkey terminfo hook
uv_timer_t timer_handle;
Loop *loop;
- Stream read_stream;
+ RStream read_stream;
RBuffer *key_buffer;
TUIData *tui_data;
} TermInput;