Skip to content

Commit

Permalink
feat(labeler): reuse only lowercase labels by default. See #11
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 21, 2023
1 parent 17d85f0 commit 8f0b9ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lua/flash/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ local defaults = {
before = false, ---@type boolean|number[]
-- position of the label extmark
style = "overlay", ---@type "eol" | "overlay" | "right_align" | "inline"
-- flash tries to re-use labels that were already assigned to a position,
-- when typing more characters. By default only lower-case labels are re-used.
reuse = "lowercase", ---@type "lowercase" | "all"
},
-- show a backdrop with hl FlashBackdrop
backdrop = true,
Expand Down
4 changes: 3 additions & 1 deletion lua/flash/labeler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ function M:label(m, used)
end
if label and self:valid(label) then
self:use(label)
self.used[pos] = label
if self.state.opts.highlight.label.reuse ~= "lowercase" or label:lower() == label then
self.used[pos] = label
end
m.label = label
end
return #self.labels > 0
Expand Down

0 comments on commit 8f0b9ed

Please sign in to comment.