fix(picker): do not record consecutive duplicate history (#2040)

## Description

Before this fix, identical items are added to history repeatedly. This
PR fixes this by only adding an item to history if it's different from
the last recorded value.

This doesn't completely remove duplicate entries in the history, it only
prevents consecutive identical entries.
This commit is contained in:
Jakub F. Bortlík 2025-10-20 15:40:09 +02:00 committed by GitHub
parent 19ff343a16
commit d0a5310417
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,6 +53,10 @@ function M:is_current()
end
function M:record(value)
-- don't record value if it's identical to the last recorded value
if vim.deep_equal(self.kv:get(math.max(self.idx - 1, 1)), value) then
return
end
self.kv:set(self.idx, value)
end