Skip to content

Commit

Permalink
fix(bar): escape percent signs in symbol_t component names (#128)
Browse files Browse the repository at this point in the history
* fix(bar): escape percent signs in symbol_t component names

* Add comment
  • Loading branch information
pynappo authored Jan 17, 2024
1 parent 982d728 commit b1b5979
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/dropbar/bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,10 @@ function dropbar_symbol_t:cat(plain)
self.cache.plain_str = self.icon .. self.name
return self.cache.plain_str
end
-- Escape `%` characters to prevent unintended statusline evaluation
local escaped_name = self.name:gsub('%%', '%%%%')
local icon_highlighted = hl(self.icon, self.icon_hl)
local name_highlighted = hl(self.name, self.name_hl)
local name_highlighted = hl(escaped_name, self.name_hl)
if self.on_click and self.bar_idx then
self.cache.decorated_str = make_clickable(
icon_highlighted .. name_highlighted,
Expand Down

0 comments on commit b1b5979

Please sign in to comment.