Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading