From 780c8c6d0d7ac42e5e502fb7f6d5b40ef5a30837 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sat, 16 Oct 2021 03:02:42 +0200 Subject: [PATCH] Improve check for `find-replace` commands using `has_unique_selection` --- data/core/commands/findreplace.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/core/commands/findreplace.lua b/data/core/commands/findreplace.lua index 67aa90d5..5d27aa69 100644 --- a/data/core/commands/findreplace.lua +++ b/data/core/commands/findreplace.lua @@ -15,7 +15,7 @@ local found_expression local function doc() local is_DocView = core.active_view:is(DocView) and not core.active_view:is(CommandView) - return is_DocView and core.active_view.doc or last_view.doc + return is_DocView and core.active_view.doc or (last_view and last_view.doc) end local function get_find_tooltip() @@ -117,7 +117,7 @@ local function has_selection() end local function has_unique_selection() - if not core.active_view:is(DocView) then return false end + if not doc() then return false end local text = nil for idx, line1, col1, line2, col2 in doc():get_selections(true, true) do if line1 == line2 and col1 == col2 then return false end