diff --git a/src/nvim/message.c b/src/nvim/message.c index 175e3b5d03..0f1afee4a1 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2713,7 +2713,7 @@ static bool do_more_prompt(int typed_char) // If headless mode is enabled and no input is required, this variable // will be true. However If server mode is enabled, the message "--more--" // should be displayed. - bool no_need_more = headless_mode && !embedded_mode; + bool no_need_more = headless_mode && !embedded_mode && !ui_active(); // We get called recursively when a timer callback outputs a message. In // that case don't show another prompt. Also when at the hit-Enter prompt diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 09a02ebfcb..297a7e6fb0 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -775,18 +775,23 @@ describe('treesitter highlighting (C)', function() declarator: (pointer_declarator) @variable.parameter) ]] - exec_lua([[ + exec_lua( + [[ local query = ... vim.treesitter.query.set('c', 'highlights', query) vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c')) - ]], query) + ]], + query + ) - screen:expect{grid=[[ + screen:expect { + grid = [[ void foo(int {4:*}{11:bar}); | ^ | {1:~ }|*15 | - ]]} + ]], + } end) end) diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index a4ed7268f4..6b71d85861 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear, feed = helpers.clear, helpers.feed local eval = helpers.eval local eq = helpers.eq +local neq = helpers.neq local command = helpers.command local set_method_error = helpers.set_method_error local api = helpers.api @@ -15,6 +16,7 @@ local exc_exec = helpers.exc_exec local exec_lua = helpers.exec_lua local poke_eventloop = helpers.poke_eventloop local assert_alive = helpers.assert_alive +local retry = helpers.retry local is_os = helpers.is_os local is_ci = helpers.is_ci local fn = helpers.fn @@ -2497,3 +2499,47 @@ aliquip ex ea commodo consequat.]] } end) end) + +it('pager works in headless mode with UI attached', function() + skip(is_os('win')) + clear() + local child_server = assert(helpers.new_pipename()) + fn.jobstart({ nvim_prog, '--clean', '--headless', '--listen', child_server }) + retry(nil, nil, function() + neq(nil, vim.uv.fs_stat(child_server)) + end) + + local child_session = helpers.connect(child_server) + local child_screen = Screen.new(40, 6) + child_screen:attach(nil, child_session) + + child_session:notify('nvim_command', [[echo range(100)->join("\n")]]) + child_screen:expect([[ + 0 | + 1 | + 2 | + 3 | + 4 | + -- More --^ | + ]]) + + child_session:request('nvim_input', 'G') + child_screen:expect([[ + 95 | + 96 | + 97 | + 98 | + 99 | + Press ENTER or type command to continue^ | + ]]) + + child_session:request('nvim_input', 'g') + child_screen:expect([[ + 0 | + 1 | + 2 | + 3 | + 4 | + -- More --^ | + ]]) +end)