aboutsummaryrefslogtreecommitdiff
path: root/src/nvim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-08-06 02:44:15 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-08-06 04:22:45 +0200
commit3827d5bc713d9ed149bc793f411debb5b89a4eba (patch)
treefc61484a30532ef89f24c5b60534dccc56408d17 /src/nvim
parentd801ce70c1fb8dd8b3735ca9e06158aaf48203ba (diff)
downloadrneovim-3827d5bc713d9ed149bc793f411debb5b89a4eba.tar.gz
rneovim-3827d5bc713d9ed149bc793f411debb5b89a4eba.tar.bz2
rneovim-3827d5bc713d9ed149bc793f411debb5b89a4eba.zip
input: skip dialogs if no UI is active
Treat dialogs in the same way as "silent mode" (`nvim -es`). References #1984 References #3901
Diffstat (limited to 'src/nvim')
-rw-r--r--src/nvim/main.c15
-rw-r--r--src/nvim/message.c8
-rw-r--r--src/nvim/misc1.c2
-rw-r--r--src/nvim/testdir/test49.vim3
4 files changed, 13 insertions, 15 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 7dcf00c26b..a46c1a58f8 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -98,10 +98,8 @@ typedef struct {
bool input_isatty; // stdin is a terminal
bool output_isatty; // stdout is a terminal
bool err_isatty; // stderr is a terminal
- bool headless; // Dont try to start an user interface
- // or read/write to stdio(unless
- // embedding)
- int no_swap_file; /* "-n" argument used */
+ bool headless; // Do not start the builtin UI.
+ int no_swap_file; // "-n" argument used
int use_debug_break_level;
int window_count; /* number of windows to use */
int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */
@@ -932,10 +930,11 @@ static void command_line_scan(mparm_T *parmp)
break;
case 's':
- if (exmode_active) /* "-s" silent (batch) mode */
- silent_mode = TRUE;
- else /* "-s {scriptin}" read from script file */
- want_argument = TRUE;
+ if (exmode_active) { // "-es" silent (batch) mode
+ silent_mode = true;
+ } else { // "-s {scriptin}" read from script file
+ want_argument = true;
+ }
break;
case 't': /* "-t {tag}" or "-t{tag}" jump to tag */
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 36f9ca84ed..28c88f5a14 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2722,9 +2722,11 @@ do_dialog (
int c;
int i;
- /* Don't output anything in silent mode ("ex -s") */
- if (silent_mode)
- return dfltbutton; /* return default option */
+ if (silent_mode // No dialogs in silent mode ("ex -s")
+ || !ui_active() // Without a UI Nvim waits for input forever.
+ ) {
+ return dfltbutton; // return default option
+ }
oldState = State;
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 835b9c7b20..5270687a4d 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -2203,7 +2203,7 @@ change_warning (
set_vim_var_string(VV_WARNINGMSG, _(w_readonly), -1);
msg_clr_eos();
(void)msg_end();
- if (msg_silent == 0 && !silent_mode) {
+ if (msg_silent == 0 && !silent_mode && ui_active()) {
ui_flush();
os_delay(1000L, true); /* give the user time to think about it */
}
diff --git a/src/nvim/testdir/test49.vim b/src/nvim/testdir/test49.vim
index a0e170dea4..467abcd9b9 100644
--- a/src/nvim/testdir/test49.vim
+++ b/src/nvim/testdir/test49.vim
@@ -481,12 +481,9 @@ function! ExtraVim(...)
bwipeout
let g:Xpath = g:Xpath + sum
- " FIXME(nvim): delete() of a file used by a subprocess hangs TSAN build on travis CI.
- if !empty($TRAVIS)
" Delete the extra script and the resultfile.
call delete(extra_script)
call delete(resultfile)
- endif
" Switch back to the buffer that was active when this function was entered.
exec "buffer" current_buffnr