Width calculation logic in nui and builtin selects ignores prompt size. This makes it very easy to lose crucial information required to make a decision.
For example, here's what I see when running LspStart with the vtsls language server with master of stevearc/dressing.nvim:
And here's what I see with this PR:
Description
Initialize max_width (builtin) or line_width (nui) to the prompt length if it exists. Otherwise fallback to previous value of 1.
Test Plan
Used the manual select test with the following configuration:
-- Run this test with :source %
local function run_test(backend)
local config = require("dressing.config")
local prev_backend = config.select.backend
config.select.backend = backend
vim.ui.select({
"first",
"second",
"third",
}, {
prompt = "Make a very informed selection after having collected all data and considered all viewpoints and opinions: ",
kind = "test",
}, function(item, lnum)
if item and lnum then
vim.notify(string.format("selected '%s' (idx %d)", item, lnum), vim.log.levels.INFO)
else
vim.notify("Selection canceled", vim.log.levels.INFO)
end
config.select.backend = prev_backend
end)
end
-- Replace this with the desired backend to test
run_test("builtin")
--run_test("nui")
Context
Width calculation logic in nui and builtin selects ignores prompt size. This makes it very easy to lose crucial information required to make a decision.
For example, here's what I see when running
LspStart
with thevtsls
language server with master ofstevearc/dressing.nvim
:And here's what I see with this PR:
Description
Initialize
max_width
(builtin) orline_width
(nui) to the prompt length if it exists. Otherwise fallback to previous value of 1.Test Plan
Used the manual select test with the following configuration:
Before
After