diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-02-13 12:05:54 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-02-16 23:17:38 -0300 |
commit | d225349dc67a21982308078207786d65518d2c6c (patch) | |
tree | ce39854b5a27dc4f8b5e268b81fe196bb7d69469 | |
parent | e17f92eb29de90e793ec14857fc5609f53cc863d (diff) | |
download | rneovim-d225349dc67a21982308078207786d65518d2c6c.tar.gz rneovim-d225349dc67a21982308078207786d65518d2c6c.tar.bz2 rneovim-d225349dc67a21982308078207786d65518d2c6c.zip |
input: Remove input_buffer_{save,restore}
The input buffer is only used for data that really came from another process and
is only visible to os/input.c. Remove the input_buffer_{save,restore} functions,
they are not necessary(Also can result in problems if data comes while the
typeahead is saved).
-rw-r--r-- | src/nvim/getchar.c | 2 | ||||
-rw-r--r-- | src/nvim/os/input.c | 21 |
2 files changed, 0 insertions, 23 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index d97c983133..dba36cd814 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1203,7 +1203,6 @@ void save_typeahead(tasave_T *tp) readbuf1.bh_first.b_next = NULL; tp->save_readbuf2 = readbuf2; readbuf2.bh_first.b_next = NULL; - tp->save_inputbuf = input_buffer_save(); } /* @@ -1224,7 +1223,6 @@ void restore_typeahead(tasave_T *tp) readbuf1 = tp->save_readbuf1; free_buff(&readbuf2); readbuf2 = tp->save_readbuf2; - input_buffer_restore(tp->save_inputbuf); } /* diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index d5e29900e9..66b59d425d 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -157,27 +157,6 @@ bool os_isatty(int fd) return uv_guess_handle(fd) == UV_TTY; } -/// Return the contents of the input buffer and make it empty. The returned -/// pointer must be passed to `input_buffer_restore()` later. -String input_buffer_save(void) -{ - size_t inbuf_size = rbuffer_pending(input_buffer); - String rv = { - .data = xmemdup(rbuffer_read_ptr(input_buffer), inbuf_size), - .size = inbuf_size - }; - rbuffer_consumed(input_buffer, inbuf_size); - return rv; -} - -/// Restore the contents of the input buffer and free `str` -void input_buffer_restore(String str) -{ - rbuffer_consumed(input_buffer, rbuffer_pending(input_buffer)); - rbuffer_write(input_buffer, str.data, str.size); - free(str.data); -} - size_t input_enqueue(String keys) { char *ptr = keys.data, *end = ptr + keys.size; |