Skip to content

Commit

Permalink
Revert "feat: defer sqlite insert to avoid highligth blink (#99)" (#178)
Browse files Browse the repository at this point in the history
This reverts commit 0dc8e0f.
  • Loading branch information
gbprod committed May 18, 2024
1 parent ec43533 commit 396ff7e
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lua/yanky/storage/sqlite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,18 @@ function sqlite.setup()
end

function sqlite.push(item)
vim.schedule(function()
sqlite.db:with_open(function()
sqlite.db:eval(
"INSERT INTO history (filetype, regcontents, regtype) VALUES (:filetype, :regcontents, :regtype)",
item
)
sqlite.db:with_open(function()
sqlite.db:eval(
"INSERT INTO history (filetype, regcontents, regtype) VALUES (:filetype, :regcontents, :regtype)",
item
)

sqlite.db:eval(
string.format(
"DELETE FROM history WHERE id NOT IN (SELECT id FROM history ORDER BY id DESC LIMIT %s)",
sqlite.config.history_length
)
sqlite.db:eval(
string.format(
"DELETE FROM history WHERE id NOT IN (SELECT id FROM history ORDER BY id DESC LIMIT %s)",
sqlite.config.history_length
)
end)
)
end)
end

Expand Down

0 comments on commit 396ff7e

Please sign in to comment.