From a9f3079c9062f44f95134299db42c181b8296c9c Mon Sep 17 00:00:00 2001 From: rxi Date: Fri, 1 May 2020 19:32:02 +0100 Subject: [PATCH] Added `refresh` command (`f5`) to projectsearch plugin's ResultView --- data/plugins/projectsearch.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/data/plugins/projectsearch.lua b/data/plugins/projectsearch.lua index 63b60dd4..baa876de 100644 --- a/data/plugins/projectsearch.lua +++ b/data/plugins/projectsearch.lua @@ -40,6 +40,7 @@ end function ResultsView:begin_search(text, fn) + self.search_args = { text, fn } self.results = {} self.last_file_idx = 1 self.query = text @@ -55,7 +56,14 @@ function ResultsView:begin_search(text, fn) end self.searching = false core.redraw = true - end, self) + end, self.results) + + self.scroll.to.y = 0 +end + + +function ResultsView:refresh() + self:begin_search(table.unpack(self.search_args)) end @@ -245,9 +253,14 @@ command.add(ResultsView, { ["project-search:open-selected"] = function() core.active_view:open_selected_result() end, + + ["project-search:refresh"] = function() + core.active_view:refresh() + end, }) keymap.add { + ["f5"] = "project-search:refresh", ["ctrl+shift+f"] = "project-search:find", ["up"] = "project-search:select-previous", ["down"] = "project-search:select-next",