Skip to content

Commit

Permalink
fix: entry_display width 1, followup to #2508 (#2530)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conni2461 authored May 24, 2023
1 parent dda9a39 commit 9609686
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lua/telescope/pickers/entry_display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,18 @@ entry_display.create = function(configuration)
local generator = {}
for _, v in ipairs(configuration.items) do
if v.width then
-- dumb workaround, because resolve_width now resolves 1 as percentage and no longer as absolute number
if v.width == 1 then
v.width = 1.001
end
local justify = v.right_justify
local width
table.insert(generator, function(item)
if width == nil then
local status = state.get_status(vim.F.if_nil(configuration.prompt_bufnr, vim.api.nvim_get_current_buf()))
local s = {}
s[1] = vim.api.nvim_win_get_width(status.results_win) - #status.picker.selection_caret
s[2] = vim.api.nvim_win_get_height(status.results_win)
width = resolve.resolve_width(v.width)(nil, s[1], s[2])
local s1 = vim.api.nvim_win_get_width(status.results_win) - #status.picker.selection_caret
local s2 = vim.api.nvim_win_get_height(status.results_win)
width = math.floor(resolve.resolve_width(v.width)(nil, s1, s2))
end
if type(item) == "table" then
return strings.align_str(entry_display.truncate(item[1], width), width, justify), item[2]
Expand Down

0 comments on commit 9609686

Please sign in to comment.