+4
-3
data/core/commands/findreplace.lua
+4
-3
data/core/commands/findreplace.lua
···
45
else
46
core.error("Couldn't find %q", text)
47
dv.doc:set_selection(table.unpack(sel))
48
end
49
50
end, function(text)
51
local ok, line1, col1, line2, col2 = pcall(search_fn, dv.doc, sel[1], sel[2], text)
52
-
if text == "" then
53
-
dv.doc:set_selection(table.unpack(sel))
54
-
elseif ok and line1 then
55
dv.doc:set_selection(line2, col2, line1, col1)
56
dv:scroll_to_line(line2, true)
57
found = true
58
else
59
found = false
60
end
61
62
end, function(explicit)
63
if explicit then
64
dv.doc:set_selection(table.unpack(sel))
65
end
66
end)
67
end
···
45
else
46
core.error("Couldn't find %q", text)
47
dv.doc:set_selection(table.unpack(sel))
48
+
dv:scroll_to_make_visible(sel[1], sel[2])
49
end
50
51
end, function(text)
52
local ok, line1, col1, line2, col2 = pcall(search_fn, dv.doc, sel[1], sel[2], text)
53
+
if ok and line1 and text ~= "" then
54
dv.doc:set_selection(line2, col2, line1, col1)
55
dv:scroll_to_line(line2, true)
56
found = true
57
else
58
+
dv.doc:set_selection(table.unpack(sel))
59
found = false
60
end
61
62
end, function(explicit)
63
if explicit then
64
dv.doc:set_selection(table.unpack(sel))
65
+
dv:scroll_to_make_visible(sel[1], sel[2])
66
end
67
end)
68
end