diff options
author | erw7 <erw7.github@gmail.com> | 2019-04-10 21:02:21 +0900 |
---|---|---|
committer | erw7 <erw7.github@gmail.com> | 2019-06-04 08:47:52 +0900 |
commit | 402b4e8fbe32c2ee1de0c39ab84c43b600db0495 (patch) | |
tree | 3ec68ca40e7eb9a4eb06d0ef0c0bb7a5d5603349 | |
parent | 5fced444bb1af5dec3284f2f3e0f8f10a9852a4a (diff) | |
download | rneovim-402b4e8fbe32c2ee1de0c39ab84c43b600db0495.tar.gz rneovim-402b4e8fbe32c2ee1de0c39ab84c43b600db0495.tar.bz2 rneovim-402b4e8fbe32c2ee1de0c39ab84c43b600db0495.zip |
main.c: Change TUI to initialize like GUI
-rw-r--r-- | src/nvim/main.c | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index ef424e08a8..059b8762e5 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -317,26 +317,13 @@ int main(int argc, char **argv) debug_break_level = params.use_debug_break_level; // - // Read user-input if any TTY is connected. // Read ex-commands if invoked with "-es". // - bool reading_tty = !headless_mode - && !embedded_mode - && !silent_mode - && (params.input_isatty || params.output_isatty - || params.err_isatty); bool reading_excmds = !params.input_isatty && silent_mode && exmode_active == EXMODE_NORMAL; - if (reading_tty || reading_excmds) { - // One of the startup commands (arguments, sourced scripts or plugins) may - // prompt the user, so start reading from a tty now. + if (reading_excmds) { int fd = STDIN_FILENO; - if (!silent_mode - && (!params.input_isatty || params.edit_type == EDIT_STDIN)) { - // Use stderr or stdout since stdin is being used to read commands. - fd = params.err_isatty ? fileno(stderr) : fileno(stdout); - } input_start(fd); } @@ -366,24 +353,23 @@ int main(int argc, char **argv) // startup. This allows an external UI to show messages and prompts from // --cmd and buffer loading (e.g. swap files) bool early_ui = false; - if (embedded_mode && !headless_mode) { - TIME_MSG("waiting for embedder to make request"); - remote_ui_wait_for_attach(); - TIME_MSG("done waiting for embedder"); + bool use_remote_ui = (embedded_mode && !headless_mode); + bool use_builtin_ui = (!headless_mode && !embedded_mode && !silent_mode); + if (use_remote_ui || use_builtin_ui) { + TIME_MSG("waiting for user interface to make request"); + if (use_remote_ui) + { + remote_ui_wait_for_attach(); + } else { + ui_builtin_start(); + } + TIME_MSG("done waiting for user interface"); // prepare screen now, so external UIs can display messages starting = NO_BUFFERS; screenclear(); early_ui = true; - TIME_MSG("initialized screen early for embedder"); - } - - if (!headless_mode && !embedded_mode && !silent_mode) { - input_stop(); // Stop reading input, let the UI take over. - ui_builtin_start(); - starting = NO_BUFFERS; - screenclear(); - early_ui = true; + TIME_MSG("initialized screen early for user interface"); } // Execute --cmd arguments. @@ -477,14 +463,6 @@ int main(int argc, char **argv) read_stdin(); } - if (reading_tty && (need_wait_return || msg_didany)) { - // Because there's no UI yet, error messages would have been printed to - // stdout. Before starting we need confirmation that the user has seen the - // messages and that is done with a call to wait_return. - TIME_MSG("waiting for return"); - wait_return(true); - } - setmouse(); // may start using the mouse if (exmode_active || early_ui) { |