fix(picker): only trim space in the title if it's preceded by a word like character (skips icons)

This commit is contained in:
Folke Lemaitre 2025-10-26 20:12:59 +01:00
parent a249c86cf1
commit 2439c493a5
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -421,7 +421,7 @@ function M:update_titles()
text = text:gsub("{flags}", "")
has_flags = true
end
text = vim.trim(Snacks.picker.util.tpl(text, data)):gsub("%s+", " ")
text = vim.trim(Snacks.picker.util.tpl(text, data)):gsub("([%w%p])%s+", "%1 ")
if text ~= "" then
-- HACK: add extra space when last char is non word like an icon
text = text:sub(-1):match("[%w%p]") and text or text .. " "