From f5b3fb0a57f4a3c4e8228edc2f7c06ce1b3dba5f Mon Sep 17 00:00:00 2001 From: familyfriendlymikey Date: Sun, 4 Sep 2022 20:20:05 -0400 Subject: [PATCH] implement item-wise history deletion --- app/api.imba | 4 +++- app/components/app-bang.imba | 9 +++++++++ app/db.imba | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/api.imba b/app/api.imba index 444d959..af79bdc 100644 --- a/app/api.imba +++ b/app/api.imba @@ -257,7 +257,9 @@ export default new class api catch e err "updating bang history", e - def delete_bang_history_item text + def delete_bang_history_item + let text = sorted_bang_history[state.bang_selection_index] + return unless text let i = bang.history.indexOf(text) return unless i > -1 bang.history.splice(i, 1) diff --git a/app/components/app-bang.imba b/app/components/app-bang.imba index bb3fd70..8a26d39 100644 --- a/app/components/app-bang.imba +++ b/app/components/app-bang.imba @@ -23,6 +23,15 @@ tag app-bang <.tip-hotkey> "Return" <.tip-content> "Search" + if state.bang_selection_index > -1 + result.push <> + <.tip + @click=api.delete_bang_history_item + @hotkey('shift+backspace').capture.if(!state.loading)=api.delete_bang_history_item + > + <.tip-hotkey> "Shift + Backspace" + <.tip-content> "Delete History Item" + result.push <> <.tip.ellipsis @click=api.handle_add_link diff --git a/app/db.imba b/app/db.imba index 48460c0..83c4e1e 100644 --- a/app/db.imba +++ b/app/db.imba @@ -31,7 +31,7 @@ db.version(3).stores({ link.url = api.parse_url(link.url).href db.version(4).stores({ - links: "++id,display_name,name,is_bang,is_pinned,url,frequency,icon" + links: "++id,display_name,name,is_bang,is_pinned,url,frequency,history,icon" }).upgrade! do |trans| p "upgrading to fuzzyhome db version 4" trans.links.toCollection!.modify! do |link|