mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(picker.format): correcter max_width for truncpath
This commit is contained in:
parent
a54477b0ac
commit
a5d29646e5
2 changed files with 7 additions and 3 deletions
|
|
@ -480,8 +480,8 @@ function M:format(item)
|
|||
local ctx = {
|
||||
picker = self.picker,
|
||||
item = item,
|
||||
offset = vim.api.nvim_strwidth(text),
|
||||
max_width = vim.api.nvim_win_get_width(self.win.win) - 5,
|
||||
offset = 0,
|
||||
max_width = vim.api.nvim_win_get_width(self.win.win),
|
||||
}
|
||||
line = Snacks.picker.highlight.resolve(line, ctx)
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,11 @@ function M._filename(ctx)
|
|||
end
|
||||
|
||||
local truncate = picker.opts.formatters.file.truncate
|
||||
path = Snacks.picker.util.truncpath(path, ctx.max_width, { cwd = picker:cwd(), kind = truncate })
|
||||
path = Snacks.picker.util.truncpath(
|
||||
path,
|
||||
ctx.max_width - Snacks.picker.highlight.offset(ret),
|
||||
{ cwd = picker:cwd(), kind = truncate }
|
||||
)
|
||||
|
||||
local base_hl = item.dir and "SnacksPickerDirectory" or "SnacksPickerFile"
|
||||
local function is(prop)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue