aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/man_spec.lua
diff options
context:
space:
mode:
authorArsham Shirvani <arshamshirvani@gmail.com>2022-05-13 15:49:08 +0100
committerGitHub <noreply@github.com>2022-05-13 07:49:08 -0700
commitf6ba7d69be2c57f80c9ee95276733e949aceb009 (patch)
treee01e8ad790bb33b42e31064d5aa660b5a311380c /test/functional/plugin/man_spec.lua
parenteb4b337d9eb8bf15cf0b832f46ea9cff14d6adce (diff)
downloadrneovim-f6ba7d69be2c57f80c9ee95276733e949aceb009.tar.gz
rneovim-f6ba7d69be2c57f80c9ee95276733e949aceb009.tar.bz2
rneovim-f6ba7d69be2c57f80c9ee95276733e949aceb009.zip
fix(man.vim): q in "$MANPAGER mode" does not quit #18443
Problem: q in "$MANPAGER mode" does not quit Nvim. This is because ftplugin/man.vim creates its own mapping: nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c which overrides the one set by the autoload file when using :Man! ("$MANPAGER mode") Solution: Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the mapping correctly. Fixes #18281 Ref #17791 Helped-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Diffstat (limited to 'test/functional/plugin/man_spec.lua')
-rw-r--r--test/functional/plugin/man_spec.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua
index e5b2e7dc1f..c8da5a711f 100644
--- a/test/functional/plugin/man_spec.lua
+++ b/test/functional/plugin/man_spec.lua
@@ -2,13 +2,19 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local command, eval, rawfeed = helpers.command, helpers.eval, helpers.rawfeed
local clear = helpers.clear
+local funcs = helpers.funcs
+local nvim_prog = helpers.nvim_prog
+local matches = helpers.matches
describe(':Man', function()
+ before_each(function()
+ clear()
+ end)
+
describe('man.lua: highlight_line()', function()
local screen
before_each(function()
- clear()
command('syntax on')
command('set filetype=man')
command('syntax off') -- Ignore syntax groups
@@ -137,4 +143,10 @@ describe(':Man', function()
]])
end)
end)
+
+ it('q quits in "$MANPAGER mode" (:Man!) #18281', function()
+ -- This will hang if #18281 regresses.
+ local args = {nvim_prog, '--headless', '+autocmd VimLeave * echo "quit works!!"', '+Man!', '+call nvim_input("q")'}
+ matches('quit works!!', funcs.system(args, {'manpage contents'}))
+ end)
end)