Closed desdic closed 10 months ago
vim.ui.input
opens a floating window. actions.close
closes the telescope window, and then sets the focus back to the original window you were in before opening telescope. Dressing is configured to automatically cancel the input if your focus leaves the input window. You can fix this by reordering the calls.
actions.close(newprompt_bufnr)
-- input is always nil and the prompt is never trigger
vim.ui.input({ prompt = "Enter description: ", default = "testing" }, function(input)
print(vim.inspect(input))
end)
ah oki .. but I really wanted the same behavior as the default so the telescope would stay in the background while typing the description. This makes it hard for plugin developers to use vim.ui.input if the behavior changes because the dev has no control if it works for the enduser or not.
If you want it to close after input, put the close action after the input completes
-- input is always nil and the prompt is never trigger
vim.ui.input({ prompt = "Enter description: ", default = "testing" }, function(input)
print(vim.inspect(input))
actions.close(newprompt_bufnr)
end)
vim.ui.input
is designed to be asynchronous. The default implementation uses vim.fn.input
, which is synchronous, but this is a side effect and not part of the intended design.
Describe the bug
If you use vim.ui.input just after a telescope picker it just closes. It never prompts and even when setting the default value its just nil. If I disable dressing vim.ui.input prompts and prints the value I entered.
System information
To Reproduce
Steps to reproduce the behavior:
The example is a bit on the large side but I wanted to show it in an reproducable way. When starting with telescope starts, pick any and press enter and you'll the se bug or .. its visible via messages
NVIM_APPNAME="dressing" nvim
and pressing