Skip to content

Commit

Permalink
fix: make search_count work with nohlsearch. Fixes #217
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Nov 13, 2022
1 parent d5594a8 commit 80ec5b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lua/noice/ui/msg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ end
function M.on_clear()
State.clear("msg_show")
M.last = nil
local message = M.get(M.events.show, M.kinds.search_count)
Manager.remove(message)
end

-- mode like recording...
Expand Down
4 changes: 2 additions & 2 deletions lua/noice/util/hacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ end
-- Clears search count and stops timer when hlsearch==0
function M.fix_nohlsearch()
M.fix_nohlsearch = Util.interval(30, function()
if vim.v.hlsearch == 0 then
if vim.o.hlsearch and vim.v.hlsearch == 0 then
local m = require("noice.ui.msg").get("msg_show", "search_count")
require("noice.message.manager").remove(m)
end
end, {
enabled = function()
return vim.v.hlsearch == 1
return vim.o.hlsearch and vim.v.hlsearch == 1
end,
})
M.fix_nohlsearch()
Expand Down

0 comments on commit 80ec5b8

Please sign in to comment.