Skip to content

Commit

Permalink
fix: skip invalid regex in truncate_name (#841)
Browse files Browse the repository at this point in the history
* skip invalid regex in truncate_name

* skip invalid regex in truncate_name
  • Loading branch information
jackielii committed Dec 8, 2023
1 parent 6c456b8 commit ac788fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/bufferline/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function M.truncate_name(name, word_limit)
-- truncate nicely by seeing if we can drop the extension first
-- to make things fit if not then truncate abruptly
local ext = fn.fnamemodify(name, ":e")
if ext ~= "" then
if ext ~= "" and ext:match("^%w+$") then
local truncated = name:gsub("%." .. ext, "", 1)
if strwidth(truncated) < word_limit then return truncated .. constants.ELLIPSIS end
end
Expand Down

0 comments on commit ac788fb

Please sign in to comment.