aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2019-05-02 16:45:48 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2019-05-02 16:45:48 -0400
commit155731041ae1889b471476006293a4a671dcf9f3 (patch)
tree339a36ac4c039687a481b8ca7d0042e5dd323e51
parent3c83fd9f7297461ac6ba060d5630b4e3ff8f98e8 (diff)
downloadtextadept-155731041ae1889b471476006293a4a671dcf9f3.tar.gz
textadept-155731041ae1889b471476006293a4a671dcf9f3.zip
Do not advance the caret on failed incremental find.
-rw-r--r--modules/textadept/find.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index a86a990c..e356351a 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -167,6 +167,7 @@ local incremental_start
-- @param anchor Flag indicating whether or not to search from the current
-- position.
local function find_incremental(text, next, anchor)
+ local orig_pos = buffer.current_pos
if anchor then
incremental_start = buffer:position_relative(buffer.current_pos,
next and 1 or -1)
@@ -176,6 +177,7 @@ local function find_incremental(text, next, anchor)
-- default handler has one, so make use of it.
events.emit(events.FIND, text, next,
M.match_case and buffer.FIND_MATCHCASE or 0)
+ if buffer.selection_empty and anchor then buffer:goto_pos(orig_pos) end
end
---