Skip to content

Commit

Permalink
fix: take into account prompt size in nui and builtin selects (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexJF committed Jan 14, 2024
1 parent 2caff86 commit d7dde6a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/dressing/select/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lua/dressing/select/nui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit d7dde6a

Please sign in to comment.