fix: take into account prompt size in nui and builtin selects (#135)

This commit is contained in:
Alexandre Fonseca 2024-01-14 17:30:26 +00:00 committed by GitHub
parent 2caff86e8b
commit d7dde6afff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ M.select = function(config, items, opts, on_choice)
end
local lines = {}
local highlights = {}
local max_width = 1
local max_width = opts.prompt and vim.api.nvim_strwidth(opts.prompt) or 1
for idx, item in ipairs(items) do
local prefix = ""
if config.show_numbers then

View File

@ -8,7 +8,7 @@ M.select = function(config, items, opts, on_choice)
local Menu = require("nui.menu")
local event = require("nui.utils.autocmd").event
local lines = {}
local line_width = 1
local line_width = opts.prompt and vim.api.nvim_strwidth(opts.prompt) or 1
for i, item in ipairs(items) do
local line = opts.format_item(item)
line_width = math.max(line_width, vim.api.nvim_strwidth(line))