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