diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | runtime/autoload/provider/clipboard.vim | 12 | ||||
-rw-r--r-- | runtime/doc/deprecated.txt | 1 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 16 | ||||
-rw-r--r-- | runtime/doc/provider.txt | 5 | ||||
-rw-r--r-- | runtime/doc/various.txt | 11 | ||||
-rw-r--r-- | src/nvim/edit.c | 3 | ||||
-rw-r--r-- | src/nvim/message.c | 7 | ||||
-rw-r--r-- | test/functional/eval/input_spec.lua | 42 | ||||
-rw-r--r-- | test/functional/ex_cmds/cmd_map_spec.lua | 34 | ||||
-rw-r--r-- | test/functional/ex_cmds/swapfile_preserve_recover_spec.lua | 8 |
11 files changed, 111 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 26a6529fcd..15718c94cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,10 @@ cmake_minimum_required(VERSION 2.8.12) project(nvim C) if(POLICY CMP0059) - cmake_policy(SET CMP0059 OLD) # Needed until cmake 2.8.12. #4389 + # Needed for use of DEFINITIONS variable, which is used to collect the + # compilation flags for reporting in "nvim --version" + # https://github.com/neovim/neovim/pull/8558#issuecomment-398033140 + cmake_policy(SET CMP0059 OLD) endif() # Point CMake at any custom modules we may ship @@ -389,6 +392,7 @@ main(void) return MSGPACK_OBJECT_FLOAT32; } " MSGPACK_HAS_FLOAT32) +unset(CMAKE_REQUIRED_LIBRARIES) if(MSGPACK_HAS_FLOAT32) add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32) endif() @@ -410,6 +414,8 @@ if(FEAT_TUI) return unibi_num_from_var(unibi_var_from_num(0)); } " UNIBI_HAS_VAR_FROM) + unset(CMAKE_REQUIRED_INCLUDES) + unset(CMAKE_REQUIRED_LIBRARIES) if(UNIBI_HAS_VAR_FROM) add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM) endif() diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 0c65198d78..0ddfdf7e49 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -77,18 +77,18 @@ function! provider#clipboard#Executable() abort let s:copy['*'] = 'wl-copy --foreground --primary' let s:paste['*'] = 'wl-paste --no-newline --primary' return 'wl-copy' - elseif exists('$DISPLAY') && executable('xsel') && s:cmd_ok('xsel -o -b') - let s:copy['+'] = 'xsel --nodetach -i -b' - let s:paste['+'] = 'xsel -o -b' - let s:copy['*'] = 'xsel --nodetach -i -p' - let s:paste['*'] = 'xsel -o -p' - return 'xsel' elseif exists('$DISPLAY') && executable('xclip') let s:copy['+'] = 'xclip -quiet -i -selection clipboard' let s:paste['+'] = 'xclip -o -selection clipboard' let s:copy['*'] = 'xclip -quiet -i -selection primary' let s:paste['*'] = 'xclip -o -selection primary' return 'xclip' + elseif exists('$DISPLAY') && executable('xsel') && s:cmd_ok('xsel -o -b') + let s:copy['+'] = 'xsel --nodetach -i -b' + let s:paste['+'] = 'xsel -o -b' + let s:copy['*'] = 'xsel --nodetach -i -p' + let s:paste['*'] = 'xsel -o -p' + return 'xsel' elseif executable('lemonade') let s:copy['+'] = 'lemonade copy' let s:paste['+'] = 'lemonade paste' diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 92a6bd6b4f..4369ad7894 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -37,6 +37,7 @@ Functions ~ *file_readable()* Obsolete name for |filereadable()|. *highlight_exists()* Obsolete name for |hlexists()|. *highlightID()* Obsolete name for |hlID()|. +*inputdialog()* Use |input()| instead. *jobclose()* Obsolete name for |chanclose()| *jobsend()* Obsolete name for |chansend()| *last_buffer_nr()* Obsolete name for bufnr("$"). diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 91986a9442..9bd73df7fe 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2137,8 +2137,6 @@ index({list}, {expr} [, {start} [, {ic}]]) Number index in {list} where {expr} appears input({prompt} [, {text} [, {completion}]]) String get input from the user -inputdialog({prompt} [, {text} [, {completion}]]) - String like input() but in a GUI dialog inputlist({textlist}) Number let the user pick from a choice list inputrestore() Number restore typeahead inputsave() Number save and clear typeahead @@ -4915,20 +4913,6 @@ input({opts}) : call inputrestore() :endfunction -inputdialog({prompt} [, {text} [, {cancelreturn}]]) *inputdialog()* -inputdialog({opts}) - Like |input()|, but when the GUI is running and text dialogs - are supported, a dialog window pops up to input the text. - Example: > - :let n = inputdialog("value for shiftwidth", shiftwidth()) - :if n != "" - : let &sw = n - :endif -< When the dialog is cancelled {cancelreturn} is returned. When - omitted an empty string is returned. - Hitting <Enter> works like pressing the OK button. Hitting - <Esc> works like pressing the Cancel button. - inputlist({textlist}) *inputlist()* {textlist} must be a |List| of strings. This |List| is displayed, one string per line. The user will be prompted to diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt index 058e0546cd..4de411a60e 100644 --- a/runtime/doc/provider.txt +++ b/runtime/doc/provider.txt @@ -150,9 +150,10 @@ The presence of a working clipboard tool implicitly enables the '+' and '*' registers. Nvim looks for these clipboard tools, in order of priority: - |g:clipboard| - - pbcopy/pbpaste (macOS) - - xsel (if $DISPLAY is set) + - pbcopy, pbpaste (macOS) + - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set) - xclip (if $DISPLAY is set) + - xsel (if $DISPLAY is set) - lemonade (for SSH) https://github.com/pocke/lemonade - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ - win32yank (Windows) diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 5f40ccf2ec..d78dd90f18 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -517,14 +517,9 @@ m *+xim* X input method |xim| :silent! /^begin :if v:errmsg != "" : ... pattern was not found -< ":silent" will also avoid the hit-enter prompt. When - using this for an external command, this may cause the - screen to be messed up. Use |CTRL-L| to clean it up - then. - ":silent menu ..." defines a menu that will not echo a - Command-line command. The command will still produce - messages though. Use ":silent" in the command itself - to avoid that: ":silent menu .... :silent command". +< ":silent" also skips the hit-enter prompt. + Dialogs that prompt for user input (|confirm()|, + 'swapfile', …) are never silent. *:uns* *:unsilent* :uns[ilent] {command} Execute {command} not silently. Only makes a diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 451d19b8e3..c04190eaba 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3195,7 +3195,8 @@ static bool ins_compl_prep(int c) /* Ignore end of Select mode mapping and mouse scroll buttons. */ if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP - || c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_EVENT) { + || c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_EVENT + || c == K_COMMAND) { return retval; } diff --git a/src/nvim/message.c b/src/nvim/message.c index 37828f7ad3..6de81a8aaf 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2825,7 +2825,6 @@ do_dialog ( Ex command */ ) { - int oldState; int retval = 0; char_u *hotkeys; int c; @@ -2838,7 +2837,10 @@ do_dialog ( } - oldState = State; + int save_msg_silent = msg_silent; + int oldState = State; + + msg_silent = 0; // If dialog prompts for input, user needs to see it! #8788 State = CONFIRM; setmouse(); @@ -2891,6 +2893,7 @@ do_dialog ( xfree(hotkeys); + msg_silent = save_msg_silent; State = oldState; setmouse(); --no_wait_return; diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 8c65297ac6..e774b939f7 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -8,6 +8,7 @@ local clear = helpers.clear local source = helpers.source local command = helpers.command local exc_exec = helpers.exc_exec +local nvim_async = helpers.nvim_async local screen @@ -59,6 +60,7 @@ before_each(function() RBP3={background=Screen.colors.Green}, RBP4={background=Screen.colors.Blue}, SEP={bold = true, reverse = true}, + CONFIRM={bold = true, foreground = Screen.colors.SeaGreen4}, }) end) @@ -439,3 +441,43 @@ describe('inputdialog()', function() ]]) end) end) + +describe('confirm()', function() + it("shows dialog even if :silent #8788", function() + command("autocmd BufNewFile * call confirm('test')") + + local function check_and_clear(edit_line) + screen:expect([[ + | + {SEP: }| + ]]..edit_line..[[ + {CONFIRM:test} | + {CONFIRM:[O]k: }^ | + ]]) + feed('<cr>') + command('redraw') + command('bdelete!') + end + + -- With shortmess-=F + command('set shortmess-=F') + feed(':edit foo<cr>') + check_and_clear('"foo" [New File] |\n') + + -- With shortmess+=F + command('set shortmess+=F') + feed(':edit foo<cr>') + check_and_clear(':edit foo |\n') + + -- With :silent + feed(':silent edit foo<cr>') + check_and_clear(':silent edit foo |\n') + + -- With API (via eval/VimL) call and shortmess+=F + feed(':call nvim_command("edit x")<cr>') + check_and_clear(':call nvim_command("edit |\n') + + nvim_async('command', 'edit x') + check_and_clear(' |\n') + end) +end) diff --git a/test/functional/ex_cmds/cmd_map_spec.lua b/test/functional/ex_cmds/cmd_map_spec.lua index 67b3ab49d6..a5ce1abff7 100644 --- a/test/functional/ex_cmds/cmd_map_spec.lua +++ b/test/functional/ex_cmds/cmd_map_spec.lua @@ -29,6 +29,9 @@ describe('mappings with <Cmd>', function() [5] = {background = Screen.colors.LightGrey}, [6] = {foreground = Screen.colors.Blue1}, [7] = {bold = true, reverse = true}, + [8] = {background = Screen.colors.WebGray}, + [9] = {background = Screen.colors.LightMagenta}, + [10] = {foreground = Screen.colors.Red}, }) screen:attach() @@ -656,6 +659,37 @@ describe('mappings with <Cmd>', function() eq('n', eval('mode(1)')) end) + it('works in insert completion (Ctrl-X) mode', function() + feed('os<c-x><c-n>') + screen:expect([[ + some short lines | + some^ | + {8:some } | + {9:short }{1: }| + {1:~ }| + {1:~ }| + {1:~ }| + {4:-- Keyword Local completion (^N^P) }{3:match 1 of 2} | + ]]) + + feed('<f3>') + eq('ic', eval('m')) + + -- ensure a redraw, this would have moved the cursor + -- instead if CTRL-X mode was left. + feed('<up>') + screen:expect([[ + some short lines | + some^ | + {9:some } | + {9:short }{1: }| + {1:~ }| + {1:~ }| + {1:~ }| + {4:-- Keyword Local completion (^N^P) }{10:Back at original} | + ]]) + end) + it('works in cmdline mode', function() feed(':text<F3>') eq('c', eval('m')) diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua index 577a26178a..3fcffd422f 100644 --- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua +++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -11,6 +11,7 @@ local ok = helpers.ok local rmdir = helpers.rmdir local set_session = helpers.set_session local spawn = helpers.spawn +local nvim_async = helpers.nvim_async describe(':recover', function() before_each(clear) @@ -150,5 +151,12 @@ describe('swapfile detection', function() feed('e') -- Chose "Edit" at the swap dialog. feed('<c-c>') screen2:expect(expected_no_dialog) + + -- With API call and shortmess+=F + nvim_async('command', 'edit %') + screen2:expect{any=[[Found a swap file by the name ".*]] + ..[[Xtest_swapdialog_dir[/\].*]]..testfile..[[%.swp"]]} + feed('e') -- Chose "Edit" at the swap dialog. + feed('<c-c>') end) end) |