From 541eaf598c25e0b853ef441b57c9f7d1bbf3450c Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Thu, 27 Nov 2014 12:54:26 -0300 Subject: ui: Remove ui_inchar/ui_char_avail Also: - Remove NO_CONSOLE_INPUT/NO_CONSULE preprocessor conditionals - Remove ctrl_c_interrupts variable, check for mapped_ctrl_c directly in process_interrupts() - Move ui_inchar profiling to input_poll which is where Nvim blocks for input. --- src/nvim/os/input.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/nvim/os/input.c') diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index d10d20b20e..d413921a5f 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -17,6 +17,7 @@ #include "nvim/keymap.h" #include "nvim/mbyte.h" #include "nvim/fileio.h" +#include "nvim/ex_cmds2.h" #include "nvim/getchar.h" #include "nvim/term.h" @@ -184,7 +185,16 @@ size_t input_enqueue(String keys) static bool input_poll(int ms) { + if (do_profiling == PROF_YES && ms) { + prof_inchar_enter(); + } + event_poll_until(ms, input_ready()); + + if (do_profiling == PROF_YES && ms) { + prof_inchar_exit(); + } + return input_ready(); } @@ -282,7 +292,7 @@ static void convert_input(void) static void process_interrupts(void) { - if (!ctrl_c_interrupts) { + if (mapped_ctrl_c) { return; } -- cgit From bf6bb27e79f53646309ba075655465919bc2e60c Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Thu, 27 Nov 2014 14:58:04 -0300 Subject: ui: Remove redundant ui.h includes Also move read_error_exit to os/input.c --- src/nvim/os/input.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/os/input.c') diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index d413921a5f..686fe1f06d 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -20,6 +20,8 @@ #include "nvim/ex_cmds2.h" #include "nvim/getchar.h" #include "nvim/term.h" +#include "nvim/main.h" +#include "nvim/misc1.h" #define READ_BUFFER_SIZE 0xfff #define INPUT_BUFFER_SIZE (READ_BUFFER_SIZE * 4) @@ -336,3 +338,11 @@ static bool input_ready(void) (!embedded_mode && eof); // Stdin closed } +// Exit because of an input read error. +static void read_error_exit(void) +{ + if (silent_mode) /* Normal way to exit for "ex -s" */ + getout(0); + STRCPY(IObuff, _("Vim: Error reading input, exiting...\n")); + preserve_exit(); +} -- cgit