mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(scratch): use icon[1] when icon is a table to avoid table.concat error (#2242)
## Description
Problem: opts.icon can be a table {icon, icon_hl} but the code inserts
opts.icon directly into filekey and later does table.concat(filekey,
"|"). That crashes when an element is a table.
Fix: use the first element of opts.icon when opts.icon is a table
(fallback to opts.icon or "").
## Related Issue(s)
N/A
## Screenshots
This happens when scratch.opts.icon is a table per documentation
<img width="1453" height="159" alt="image"
src="https://github.com/user-attachments/assets/c22cf58e-517d-400d-87d4-d05830df530d"
/>
This commit is contained in:
parent
cd68f196fe
commit
ba90011a14
1 changed files with 1 additions and 1 deletions
|
|
@ -180,7 +180,7 @@ function M.open(opts)
|
|||
|
||||
local filekey = {
|
||||
opts.filekey.count and tostring(vim.v.count1) or "",
|
||||
opts.icon or "",
|
||||
(type(opts.icon) == "table" and opts.icon[1]) or opts.icon or "",
|
||||
opts.name:gsub("|", " "),
|
||||
opts.filekey.cwd and svim.fs.normalize(assert(uv.cwd())) or "",
|
||||
branch,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue