aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimura Kazuto <glagol15@gmail.com>2023-01-31 01:00:48 +0800
committerGitHub <noreply@github.com>2023-01-30 13:00:48 -0400
commit0a0754d1c3c4b77dd2a3d3f5739ca2dae583e75e (patch)
treed50e9e00d8b4215f9fa2241cb09941652e957754
parent719540e73db7caf84116b7779c23297b262fa045 (diff)
downloadlite-xl-0a0754d1c3c4b77dd2a3d3f5739ca2dae583e75e.tar.gz
lite-xl-0a0754d1c3c4b77dd2a3d3f5739ca2dae583e75e.zip
Replace globally when replacing from selection (#1331)
-rw-r--r--data/core/commands/findreplace.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/data/core/commands/findreplace.lua b/data/core/commands/findreplace.lua
index 4a456aae..0125a0a1 100644
--- a/data/core/commands/findreplace.lua
+++ b/data/core/commands/findreplace.lua
@@ -211,6 +211,7 @@ command.add("core.docview!", {
["find-replace:replace"] = function()
local l1, c1, l2, c2 = doc():get_selection()
local selected_text = doc():get_text(l1, c1, l2, c2)
+ doc():set_selection(l2, c2, l2, c2)
replace("Text", l1 == l2 and selected_text or "", function(text, old, new)
if not find_regex then
return text:gsub(old:gsub("%W", "%%%1"), new:gsub("%%", "%%%%"), nil)