Neovim plugin improving access to clipboard history (mirror)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: broken sql behavior for insert when both " and ' are found in a yanked line

+7 -9
+7 -9
lua/yankbank/persistence/sql.lua
··· 31 31 if self:count() > 0 then 32 32 db:with_open(function() 33 33 -- check if entry exists in db 34 - local res = db:select("bank", { 35 - where = { 36 - yank_text = yank_text, 37 - reg_type = reg_type, 38 - }, 39 - }) 34 + local res = db:eval( 35 + "SELECT * FROM bank WHERE yank_text = :yank_text and reg_type = :reg_type", 36 + { yank_text = yank_text, reg_type = reg_type } 37 + ) 40 38 41 - -- if result is empty, proceed to insertion 42 - if #res == 0 then 39 + -- if result is empty (eval returns boolean), proceed to insertion 40 + if type(res) == "boolean" then 43 41 return 44 42 end 45 43 ··· 72 70 end 73 71 74 72 --- trim database size if it exceeds max_entries option 73 + --- WARN: if all entries are pinned, behavior is undefined 75 74 function data:trim_size() 76 75 if self:count() > max_entries then 77 76 -- remove the oldest entry 78 77 local e = db:with_open(function() 79 - -- TODO: figure out what to do if all entries are pinned 80 78 return db:select("bank", { 81 79 where = { pinned = 0 }, 82 80 order_by = { asc = "rowid" },