mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #17199 from glacambre/fix_9358
fix(--headless): do not block on press-enter prompts when no UI
This commit is contained in:
commit
cee944e3ee
@ -1094,6 +1094,10 @@ void wait_return(int redraw)
|
||||
return;
|
||||
}
|
||||
|
||||
if (headless_mode && !ui_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* When inside vgetc(), we can't wait for a typed character at all.
|
||||
* With the global command (and some others) we only need one return at
|
||||
|
@ -333,6 +333,7 @@ describe('API', function()
|
||||
|
||||
describe('nvim_command_output', function()
|
||||
it('does not induce hit-enter prompt', function()
|
||||
nvim("ui_attach", 80, 20, {})
|
||||
-- Induce a hit-enter prompt use nvim_input (non-blocking).
|
||||
nvim('command', 'set cmdheight=1')
|
||||
nvim('input', [[:echo "hi\nhi2"<CR>]])
|
||||
@ -1093,7 +1094,20 @@ describe('API', function()
|
||||
eq({mode='n', blocking=false}, nvim("get_mode"))
|
||||
end)
|
||||
|
||||
it("during press-enter prompt without UI returns blocking=false", function()
|
||||
eq({mode='n', blocking=false}, nvim("get_mode"))
|
||||
command("echom 'msg1'")
|
||||
command("echom 'msg2'")
|
||||
command("echom 'msg3'")
|
||||
command("echom 'msg4'")
|
||||
command("echom 'msg5'")
|
||||
eq({mode='n', blocking=false}, nvim("get_mode"))
|
||||
nvim("input", ":messages<CR>")
|
||||
eq({mode='n', blocking=false}, nvim("get_mode"))
|
||||
end)
|
||||
|
||||
it("during press-enter prompt returns blocking=true", function()
|
||||
nvim("ui_attach", 80, 20, {})
|
||||
eq({mode='n', blocking=false}, nvim("get_mode"))
|
||||
command("echom 'msg1'")
|
||||
command("echom 'msg2'")
|
||||
@ -1117,6 +1131,7 @@ describe('API', function()
|
||||
|
||||
-- TODO: bug #6247#issuecomment-286403810
|
||||
it("batched with input", function()
|
||||
nvim("ui_attach", 80, 20, {})
|
||||
eq({mode='n', blocking=false}, nvim("get_mode"))
|
||||
command("echom 'msg1'")
|
||||
command("echom 'msg2'")
|
||||
|
Loading…
Reference in New Issue
Block a user