aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/main.c20
-rw-r--r--src/nvim/tui/input.c5
2 files changed, 12 insertions, 13 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index b19dc9ca09..8ff873e127 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -316,15 +316,9 @@ int main(int argc, char **argv)
// Set the break level after the terminal is initialized.
debug_break_level = params.use_debug_break_level;
- //
// Read ex-commands if invoked with "-es".
- //
- bool reading_excmds = !params.input_isatty
- && silent_mode
- && exmode_active == EXMODE_NORMAL;
- if (reading_excmds) {
- int fd = STDIN_FILENO;
- input_start(fd);
+ if (!params.input_isatty && silent_mode && exmode_active == EXMODE_NORMAL) {
+ input_start(STDIN_FILENO);
}
// open terminals when opening files that start with term://
@@ -356,19 +350,19 @@ int main(int argc, char **argv)
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");
+ TIME_MSG("waiting for UI to make request");
if (use_remote_ui) {
remote_ui_wait_for_attach();
} else {
ui_builtin_start();
}
- TIME_MSG("done waiting for user interface");
+ TIME_MSG("done waiting for UI");
// prepare screen now, so external UIs can display messages
starting = NO_BUFFERS;
screenclear();
early_ui = true;
- TIME_MSG("initialized screen early for user interface");
+ TIME_MSG("initialized screen early for UI");
}
// Execute --cmd arguments.
@@ -465,8 +459,8 @@ int main(int argc, char **argv)
setmouse(); // may start using the mouse
if (exmode_active || early_ui) {
- // Don't clear the screen when starting in Ex mode, or when an
- // embedding UI might have displayed messages
+ // Don't clear the screen when starting in Ex mode, or when a UI might have
+ // displayed messages.
redraw_later(VALID);
} else {
screenclear(); // clear screen
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index f08f659d12..7a725df0a1 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -48,6 +48,10 @@ void tinput_init(TermInput *input, Loop *loop)
int curflags = termkey_get_canonflags(input->tk);
termkey_set_canonflags(input->tk, curflags | TERMKEY_CANON_DELBS);
+
+ // If stdin is not a pty, switch to stderr. For cases like:
+ // echo q | nvim -es
+ // ls *.md | xargs nvim
#ifdef WIN32
if (!os_isatty(0)) {
const HANDLE conin_handle = CreateFile("CONIN$",
@@ -63,6 +67,7 @@ void tinput_init(TermInput *input, Loop *loop)
input->in_fd = 2;
}
#endif
+
// setup input handle
rstream_init_fd(loop, &input->read_stream, input->in_fd, 0xfff);
// initialize a timer handle for handling ESC with libtermkey