Improve check for `find-replace` commands using `has_unique_selection`

This commit is contained in:
Guldoman 2021-10-16 03:02:42 +02:00
parent ef60b24f63
commit 780c8c6d0d
No known key found for this signature in database
GPG Key ID: C08A498EC7F1AFDD
1 changed files with 2 additions and 2 deletions

View File

@ -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