Improve check for `find-replace` commands using `has_unique_selection`
This commit is contained in:
parent
ef60b24f63
commit
780c8c6d0d
|
@ -15,7 +15,7 @@ local found_expression
|
||||||
|
|
||||||
local function doc()
|
local function doc()
|
||||||
local is_DocView = core.active_view:is(DocView) and not core.active_view:is(CommandView)
|
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
|
end
|
||||||
|
|
||||||
local function get_find_tooltip()
|
local function get_find_tooltip()
|
||||||
|
@ -117,7 +117,7 @@ local function has_selection()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function has_unique_selection()
|
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
|
local text = nil
|
||||||
for idx, line1, col1, line2, col2 in doc():get_selections(true, true) do
|
for idx, line1, col1, line2, col2 in doc():get_selections(true, true) do
|
||||||
if line1 == line2 and col1 == col2 then return false end
|
if line1 == line2 and col1 == col2 then return false end
|
||||||
|
|
Loading…
Reference in New Issue