aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/input.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-10-17 09:17:12 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-10-18 08:42:49 -0300
commit68de5d79a243fecc9ef256d9d0356f8541aa3821 (patch)
tree41250bef42d81344a36d6056f211d761be6e876d /src/nvim/os/input.c
parent56ef9e86688e79dc6a6bffe73c505eaaddf3be2d (diff)
downloadrneovim-68de5d79a243fecc9ef256d9d0356f8541aa3821.tar.gz
rneovim-68de5d79a243fecc9ef256d9d0356f8541aa3821.tar.bz2
rneovim-68de5d79a243fecc9ef256d9d0356f8541aa3821.zip
rstream: Extract some RStream functionality to RBuffer
RBuffer instances represent the internal buffer used by RStreams. This changes RStream constructor to receive RBuffer pointers and adds a set of RBuffer methods that expose the lower level buffer manipulation to consumers of the RStream API.
Diffstat (limited to 'src/nvim/os/input.c')
-rw-r--r--src/nvim/os/input.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 53024d1389..511dfd7b07 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -39,7 +39,10 @@ void input_init(void)
return;
}
- read_stream = rstream_new(read_cb, READ_BUFFER_SIZE, NULL, NULL);
+ read_stream = rstream_new(read_cb,
+ rbuffer_new(READ_BUFFER_SIZE),
+ NULL,
+ NULL);
rstream_set_file(read_stream, read_cmd_fd);
}
@@ -167,7 +170,7 @@ static InbufPollResult inbuf_poll(int32_t ms)
}
if (input_poll(ms)) {
- return eof && rstream_available(read_stream) == 0 ?
+ return eof && rstream_pending(read_stream) == 0 ?
kInputEof :
kInputAvail;
}
@@ -227,6 +230,6 @@ static int push_event_key(uint8_t *buf, int maxlen)
// Check if there's pending input
bool input_ready(void)
{
- return rstream_available(read_stream) > 0 || eof;
+ return rstream_pending(read_stream) > 0 || eof;
}