diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-08-28 14:39:20 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-08-28 14:39:20 -0300 |
commit | e0d812ab649c40b8cc0efbfbe5214fb5dd407e8f (patch) | |
tree | ed4bf469e4e2c71120d8bc2df60c0bd2f077bdf7 /src/nvim/os/input.c | |
parent | 7f9ec6c04f3949e6d666c1586efc20a4a79be257 (diff) | |
parent | dd90dbeeba15af4ef401327ba3996caccd34f719 (diff) | |
download | rneovim-e0d812ab649c40b8cc0efbfbe5214fb5dd407e8f.tar.gz rneovim-e0d812ab649c40b8cc0efbfbe5214fb5dd407e8f.tar.bz2 rneovim-e0d812ab649c40b8cc0efbfbe5214fb5dd407e8f.zip |
Merge PR #1060 'Implement --embedded-mode command-line option'
Diffstat (limited to 'src/nvim/os/input.c')
-rw-r--r-- | src/nvim/os/input.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 15aebdbf3d..53024d1389 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -6,6 +6,7 @@ #include "nvim/os/input.h" #include "nvim/os/event.h" +#include "nvim/os/signal.h" #include "nvim/os/rstream_defs.h" #include "nvim/os/rstream.h" #include "nvim/ascii.h" @@ -34,6 +35,10 @@ static bool eof = false, started_reading = false; void input_init(void) { + if (embedded_mode) { + return; + } + read_stream = rstream_new(read_cb, READ_BUFFER_SIZE, NULL, NULL); rstream_set_file(read_stream, read_cmd_fd); } @@ -41,18 +46,30 @@ void input_init(void) // Listen for input void input_start(void) { + if (embedded_mode) { + return; + } + rstream_start(read_stream); } // Stop listening for input void input_stop(void) { + if (embedded_mode) { + return; + } + rstream_stop(read_stream); } // Copies (at most `count`) of was read from `read_cmd_fd` into `buf` uint32_t input_read(char *buf, uint32_t count) { + if (embedded_mode) { + return 0; + } + return rstream_read(read_stream, buf, count); } @@ -129,6 +146,11 @@ bool os_isatty(int fd) static bool input_poll(int32_t ms) { + if (embedded_mode) { + EventSource input_sources[] = { signal_event_source(), NULL }; + return event_poll(ms, input_sources); + } + EventSource input_sources[] = { rstream_event_source(read_stream), NULL |