mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 01:08:20 +00:00
input: skip dialogs if no UI is active
Treat dialogs in the same way as "silent mode" (`nvim -es`). References #1984 References #3901
This commit is contained in:
@@ -53,7 +53,7 @@ filename One or more file names. The first one will be the current
|
|||||||
< Starting in Ex mode: >
|
< Starting in Ex mode: >
|
||||||
nvim -e -
|
nvim -e -
|
||||||
nvim -E
|
nvim -E
|
||||||
< Start editing in silent mode. See |-s-ex|.
|
< Start editing in |silent-mode|.
|
||||||
|
|
||||||
*-t* *-tag*
|
*-t* *-tag*
|
||||||
-t {tag} A tag. "tag" is looked up in the tags file, the associated
|
-t {tag} A tag. "tag" is looked up in the tags file, the associated
|
||||||
@@ -200,7 +200,7 @@ argument.
|
|||||||
*-E*
|
*-E*
|
||||||
-E Start Vim in improved Ex mode |gQ|.
|
-E Start Vim in improved Ex mode |gQ|.
|
||||||
|
|
||||||
*-s-ex*
|
*-s-ex* *silent-mode*
|
||||||
-s Silent or batch mode. Only when "-s" is preceded by the "-e"
|
-s Silent or batch mode. Only when "-s" is preceded by the "-e"
|
||||||
argument. Otherwise see |-s|, which does take an argument
|
argument. Otherwise see |-s|, which does take an argument
|
||||||
while this use of "-s" doesn't. To be used when Vim is used
|
while this use of "-s" doesn't. To be used when Vim is used
|
||||||
@@ -221,7 +221,7 @@ argument.
|
|||||||
Initializations are skipped (except the ones given with the
|
Initializations are skipped (except the ones given with the
|
||||||
"-u" argument).
|
"-u" argument).
|
||||||
Example: >
|
Example: >
|
||||||
vim -e -s < thefilter thefile
|
vim -es < thefilter thefile
|
||||||
<
|
<
|
||||||
*-b*
|
*-b*
|
||||||
-b Binary mode. File I/O will only recognize <NL> to separate
|
-b Binary mode. File I/O will only recognize <NL> to separate
|
||||||
@@ -351,6 +351,7 @@ argument.
|
|||||||
|
|
||||||
*--headless*
|
*--headless*
|
||||||
--headless Do not start the built-in UI.
|
--headless Do not start the built-in UI.
|
||||||
|
See also |silent-mode|, which does start a (limited) UI.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
2. Initialization *initialization* *startup*
|
2. Initialization *initialization* *startup*
|
||||||
|
@@ -98,10 +98,8 @@ typedef struct {
|
|||||||
bool input_isatty; // stdin is a terminal
|
bool input_isatty; // stdin is a terminal
|
||||||
bool output_isatty; // stdout is a terminal
|
bool output_isatty; // stdout is a terminal
|
||||||
bool err_isatty; // stderr is a terminal
|
bool err_isatty; // stderr is a terminal
|
||||||
bool headless; // Dont try to start an user interface
|
bool headless; // Do not start the builtin UI.
|
||||||
// or read/write to stdio(unless
|
int no_swap_file; // "-n" argument used
|
||||||
// embedding)
|
|
||||||
int no_swap_file; /* "-n" argument used */
|
|
||||||
int use_debug_break_level;
|
int use_debug_break_level;
|
||||||
int window_count; /* number of windows to use */
|
int window_count; /* number of windows to use */
|
||||||
int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */
|
int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */
|
||||||
@@ -932,10 +930,11 @@ static void command_line_scan(mparm_T *parmp)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
if (exmode_active) /* "-s" silent (batch) mode */
|
if (exmode_active) { // "-es" silent (batch) mode
|
||||||
silent_mode = TRUE;
|
silent_mode = true;
|
||||||
else /* "-s {scriptin}" read from script file */
|
} else { // "-s {scriptin}" read from script file
|
||||||
want_argument = TRUE;
|
want_argument = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't': /* "-t {tag}" or "-t{tag}" jump to tag */
|
case 't': /* "-t {tag}" or "-t{tag}" jump to tag */
|
||||||
|
@@ -2722,9 +2722,11 @@ do_dialog (
|
|||||||
int c;
|
int c;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Don't output anything in silent mode ("ex -s") */
|
if (silent_mode // No dialogs in silent mode ("ex -s")
|
||||||
if (silent_mode)
|
|| !ui_active() // Without a UI Nvim waits for input forever.
|
||||||
return dfltbutton; /* return default option */
|
) {
|
||||||
|
return dfltbutton; // return default option
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
oldState = State;
|
oldState = State;
|
||||||
|
@@ -2203,7 +2203,7 @@ change_warning (
|
|||||||
set_vim_var_string(VV_WARNINGMSG, _(w_readonly), -1);
|
set_vim_var_string(VV_WARNINGMSG, _(w_readonly), -1);
|
||||||
msg_clr_eos();
|
msg_clr_eos();
|
||||||
(void)msg_end();
|
(void)msg_end();
|
||||||
if (msg_silent == 0 && !silent_mode) {
|
if (msg_silent == 0 && !silent_mode && ui_active()) {
|
||||||
ui_flush();
|
ui_flush();
|
||||||
os_delay(1000L, true); /* give the user time to think about it */
|
os_delay(1000L, true); /* give the user time to think about it */
|
||||||
}
|
}
|
||||||
|
@@ -481,12 +481,9 @@ function! ExtraVim(...)
|
|||||||
bwipeout
|
bwipeout
|
||||||
let g:Xpath = g:Xpath + sum
|
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.
|
" Delete the extra script and the resultfile.
|
||||||
call delete(extra_script)
|
call delete(extra_script)
|
||||||
call delete(resultfile)
|
call delete(resultfile)
|
||||||
endif
|
|
||||||
|
|
||||||
" Switch back to the buffer that was active when this function was entered.
|
" Switch back to the buffer that was active when this function was entered.
|
||||||
exec "buffer" current_buffnr
|
exec "buffer" current_buffnr
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
|
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
|
||||||
local iswin, set_shell_powershell = helpers.iswin, helpers.set_shell_powershell
|
local iswin = helpers.iswin
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
@@ -124,12 +124,9 @@ describe("'wildmenu'", function()
|
|||||||
-- must wait the full timeout. So make it reasonable.
|
-- must wait the full timeout. So make it reasonable.
|
||||||
screen.timeout = 1000
|
screen.timeout = 1000
|
||||||
|
|
||||||
if iswin() then
|
if not iswin() then
|
||||||
set_shell_powershell()
|
command('set shell=sh') -- Need a predictable "$" prompt.
|
||||||
else
|
|
||||||
command('set shell=sh')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
command('set laststatus=0')
|
command('set laststatus=0')
|
||||||
command('vsplit')
|
command('vsplit')
|
||||||
command('term')
|
command('term')
|
||||||
@@ -137,7 +134,7 @@ describe("'wildmenu'", function()
|
|||||||
-- Check for a shell prompt to verify that the terminal loaded.
|
-- Check for a shell prompt to verify that the terminal loaded.
|
||||||
retry(nil, nil, function()
|
retry(nil, nil, function()
|
||||||
if iswin() then
|
if iswin() then
|
||||||
eq('PS', eval("matchstr(join(getline(1, '$')), 'PS')"))
|
eq('Microsoft', eval("matchstr(join(getline(1, '$')), 'Microsoft')"))
|
||||||
else
|
else
|
||||||
eq('$', eval([[matchstr(getline(1), '\$')]]))
|
eq('$', eval([[matchstr(getline(1), '\$')]]))
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user