diff options
-rw-r--r-- | runtime/plugin/netrwPlugin.vim | 8 | ||||
-rw-r--r-- | src/nvim/eval.c | 2 | ||||
-rw-r--r-- | src/nvim/message.c | 6 | ||||
-rw-r--r-- | test/functional/api/server_requests_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/api/vim_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/core/channels_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/core/job_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/helpers.lua | 21 | ||||
-rw-r--r-- | test/functional/legacy/file_perm_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ui/messages_spec.lua | 34 | ||||
-rw-r--r-- | test/functional/ui/mode_spec.lua | 2 | ||||
-rw-r--r-- | test/helpers.lua | 9 |
12 files changed, 63 insertions, 35 deletions
diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index e39bde88a7..2d67f6a4e4 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -47,9 +47,9 @@ augroup Network au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>")) au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>")) au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>")) - try + try au SourceCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) - catch /^Vim\%((\a\+)\)\=:E216/ + catch /^Vim\%((\a\+)\)\=:E216/ au SourcePre ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) endtry augroup END @@ -81,7 +81,7 @@ if !exists("g:netrw_nogx") if !hasmapto('<Plug>NetrwBrowseX') nmap <unique> gx <Plug>NetrwBrowseX endif - nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<cr> + nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr> endif if maparg('gx','v') == "" if !hasmapto('<Plug>NetrwBrowseXVis') @@ -103,7 +103,7 @@ fun! s:LocalBrowse(dirname) " Unfortunate interaction -- only DechoMsg debugging calls can be safely used here. " Otherwise, the BufEnter event gets triggered when attempts to write to " the DBG buffer are made. - + if !exists("s:vimentered") " If s:vimentered doesn't exist, then the VimEnter event hasn't fired. It will, " and so s:VimEnter() will then be calling this routine, but this time with s:vimentered defined. diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a50474a55a..fa9777b651 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -20894,7 +20894,7 @@ void ex_echo(exarg_T *eap) char *tofree = encode_tv2echo(&rettv, NULL); if (*tofree != NUL) { msg_ext_set_kind("echo"); - msg_multiline_attr(tofree, echo_attr); + msg_multiline_attr(tofree, echo_attr, true); } xfree(tofree); } diff --git a/src/nvim/message.c b/src/nvim/message.c index ac731210d7..b5a5f656a0 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -222,12 +222,12 @@ int msg_attr(const char *s, const int attr) } /// similar to msg_outtrans_attr, but support newlines and tabs. -void msg_multiline_attr(const char *s, int attr) +void msg_multiline_attr(const char *s, int attr, bool check_int) FUNC_ATTR_NONNULL_ALL { const char *next_spec = s; - while (next_spec != NULL) { + while (next_spec != NULL && (!check_int || !got_int)) { next_spec = strpbrk(s, "\t\n\r"); if (next_spec != NULL) { @@ -306,7 +306,7 @@ bool msg_attr_keep(char_u *s, int attr, bool keep, bool multiline) s = buf; if (multiline) { - msg_multiline_attr((char *)s, attr); + msg_multiline_attr((char *)s, attr, false); } else { msg_outtrans_attr(s, attr); } diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index ddd044a10f..a20667de40 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -180,7 +180,7 @@ describe('server -> client', function() end) describe('recursive (child) nvim client', function() - if helpers.isCI('travis') and helpers.os_name() == 'osx' then + if helpers.isCI('travis') and helpers.is_os('mac') then -- XXX: Hangs Travis macOS since e9061117a5b8f195c3f26a5cb94e18ddd7752d86. pending("[Hangs on Travis macOS. #5002]", function() end) return @@ -339,7 +339,7 @@ describe('server -> client', function() describe('connecting to its own pipe address', function() it('does not deadlock', function() - if not helpers.isCI('travis') and helpers.os_name() == 'osx' then + if not helpers.isCI('travis') and helpers.is_os('mac') then -- It does, in fact, deadlock on QuickBuild. #6851 pending("deadlocks on QuickBuild", function() end) return diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 07c0c5c8f3..b80b1c87af 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -11,7 +11,7 @@ local iswin = helpers.iswin local meth_pcall = helpers.meth_pcall local meths = helpers.meths local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed -local os_name = helpers.os_name +local is_os = helpers.is_os local parse_context = helpers.parse_context local request = helpers.request local source = helpers.source @@ -83,7 +83,7 @@ describe('API', function() nvim('command', 'w') local f = io.open(fname) ok(f ~= nil) - if os_name() == 'windows' then + if is_os('win') then eq('testing\r\napi\r\n', f:read('*a')) else eq('testing\napi\n', f:read('*a')) diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua index 852d9808f5..1ef34c7318 100644 --- a/test/functional/core/channels_spec.lua +++ b/test/functional/core/channels_spec.lua @@ -7,7 +7,7 @@ local sleep = helpers.sleep local spawn, nvim_argv = helpers.spawn, helpers.nvim_argv local set_session = helpers.set_session local nvim_prog = helpers.nvim_prog -local os_name = helpers.os_name +local is_os = helpers.is_os local retry = helpers.retry local expect_twostreams = helpers.expect_twostreams @@ -140,7 +140,7 @@ describe('channels', function() command("call chansend(id, 'incomplet\004')") local is_bsd = not not string.find(uname(), 'bsd') - local bsdlike = is_bsd or (os_name() == "osx") + local bsdlike = is_bsd or is_os('mac') local extra = bsdlike and "^D\008\008" or "" expect_twoline(id, "stdout", "incomplet"..extra, "[1, ['incomplet'], 'stdin']", true) diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 88951e5b51..94b34ef05b 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -206,7 +206,7 @@ describe('jobs', function() it("will not buffer data if it doesn't end in newlines", function() if helpers.isCI('travis') and os.getenv('CC') == 'gcc-4.9' - and helpers.os_name() == "osx" then + and helpers.is_os('mac') then -- XXX: Hangs Travis macOS since e9061117a5b8f195c3f26a5cb94e18ddd7752d86. pending("[Hangs on Travis macOS. #5002]", function() end) return diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index c34849b439..cf9f5f9858 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -15,6 +15,7 @@ local check_logs = global_helpers.check_logs local dedent = global_helpers.dedent local eq = global_helpers.eq local filter = global_helpers.filter +local is_os = global_helpers.is_os local map = global_helpers.map local ok = global_helpers.ok local sleep = global_helpers.sleep @@ -271,22 +272,6 @@ function module.eval(expr) return module.request('nvim_eval', expr) end -module.os_name = (function() - local name = nil - return (function() - if not name then - if module.eval('has("win32")') == 1 then - name = 'windows' - elseif module.eval('has("macunix")') == 1 then - name = 'osx' - else - name = 'unix' - end - end - return name - end) -end)() - -- Executes a VimL function. -- Fails on VimL error, but does not update v:errmsg. function module.call(name, ...) @@ -609,7 +594,7 @@ local function do_rmdir(path) -- Try Nvim delete(): it handles `readonly` attribute on Windows, -- and avoids Lua cross-version/platform incompatibilities. if -1 == module.call('delete', abspath) then - local hint = (module.os_name() == 'windows' + local hint = (is_os('win') and ' (hint: try :%bwipeout! before rmdir())' or '') error('delete() failed'..hint..': '..abspath) end @@ -626,7 +611,7 @@ end function module.rmdir(path) local ret, _ = pcall(do_rmdir, path) - if not ret and module.os_name() == "windows" then + if not ret and is_os('win') then -- Maybe "Permission denied"; try again after changing the nvim -- process to the top-level directory. module.command([[exe 'cd '.fnameescape(']]..start_dir.."')") diff --git a/test/functional/legacy/file_perm_spec.lua b/test/functional/legacy/file_perm_spec.lua index d61fdc9b83..8fdee95e91 100644 --- a/test/functional/legacy/file_perm_spec.lua +++ b/test/functional/legacy/file_perm_spec.lua @@ -21,7 +21,7 @@ describe('Test getting and setting file permissions', function() eq(9, call('len', call('getfperm', tempfile))) eq(1, call('setfperm', tempfile, 'rwx------')) - if helpers.os_name() == 'windows' then + if helpers.is_os('win') then eq('rw-rw-rw-', call('getfperm', tempfile)) else eq('rwx------', call('getfperm', tempfile)) diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index ed65c4526f..a6b9ef9387 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -1052,3 +1052,37 @@ describe('ui/msg_puts_printf', function() os.execute('cmake -E remove_directory '..test_build_dir..'/share') end) end) + +describe('pager', function() + local screen + + before_each(function() + clear() + screen = Screen.new(25, 5) + screen:attach() + screen:set_default_attr_ids({ + [1] = {bold = true, foreground = Screen.colors.Blue1}, + [4] = {bold = true, foreground = Screen.colors.SeaGreen4}, + }) + end) + + it('can be quit', function() + command("set more") + feed(':echon join(map(range(0, &lines*2), "v:val"), "\\n")<cr>') + screen:expect{grid=[[ + 0 | + 1 | + 2 | + 3 | + {4:-- More --}^ | + ]]} + feed('q') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + end) +end) diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua index a09df075aa..200f6eecdb 100644 --- a/test/functional/ui/mode_spec.lua +++ b/test/functional/ui/mode_spec.lua @@ -62,7 +62,7 @@ describe('ui mode_change event', function() ]], mode="normal"} command("set showmatch") - command("set matchtime=1") -- tenths of seconds + command("set matchtime=2") -- tenths of seconds feed('a(stuff') screen:expect{grid=[[ word(stuff^ | diff --git a/test/helpers.lua b/test/helpers.lua index 779d33e3b1..c2a708197f 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -190,6 +190,15 @@ module.uname = (function() end) end)() +function module.is_os(s) + if not (s == 'win' or s == 'mac' or s == 'unix') then + error('unknown platform: '..tostring(s)) + end + return ((s == 'win' and module.iswin()) + or (s == 'mac' and module.uname() == 'darwin') + or (s == 'unix')) +end + local function tmpdir_get() return os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP') end |