aboutsummaryrefslogtreecommitdiff
path: root/data/core/commands
diff options
context:
space:
mode:
Diffstat (limited to 'data/core/commands')
-rw-r--r--data/core/commands/findreplace.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/data/core/commands/findreplace.lua b/data/core/commands/findreplace.lua
index 902623be..c5f2bf07 100644
--- a/data/core/commands/findreplace.lua
+++ b/data/core/commands/findreplace.lua
@@ -160,8 +160,14 @@ local function select_next(all)
end
command.add(has_unique_selection, {
- ["find-replace:select-next"] = function() select_next(false) end,
- ["find-replace:select-all"] = function() select_next(true) end
+ ["find-replace:select-next"] = function()
+ local l1, c1, l2, c2 = doc():get_selection(true)
+ local text = doc():get_text(l1, c1, l2, c2)
+ l1, c1, l2, c2 = search.find(doc(), l2, c2, text, { wrap = true })
+ if l2 then doc():set_selection(l2, c2, l1, c1) end
+ end,
+ ["find-replace:select-add-next"] = function() select_next(false) end,
+ ["find-replace:select-add-all"] = function() select_next(true) end
})
command.add("core.docview", {