aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/find.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-04-10 16:27:41 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2016-04-10 16:27:41 -0400
commitad837af2486fc3c79ab23129bf2a61f517d4e6b2 (patch)
tree538bdf3127a90134c0188876790c7021c21bd2d2 /modules/textadept/find.lua
parentf6319f01dece433f0e66aff19b2e1de5cbfc17b5 (diff)
downloadtextadept-ad837af2486fc3c79ab23129bf2a61f517d4e6b2.tar.gz
textadept-ad837af2486fc3c79ab23129bf2a61f517d4e6b2.zip
Center found text in the view; modules/textadept/find.lua
Diffstat (limited to 'modules/textadept/find.lua')
-rw-r--r--modules/textadept/find.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 85903bc5..7c126e0b 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -137,7 +137,6 @@ local function find(text, next, flags, no_wrap, wrapped)
if M.in_files then flags = flags + 16 end
end
if flags >= 16 then M.find_in_files() return end -- not performed here
- local first_visible_line = buffer.first_visible_line -- for 'no results found'
-- If text is selected, assume it is from the current search and increment the
-- caret appropriately for the next search.
@@ -176,7 +175,6 @@ local function find(text, next, flags, no_wrap, wrapped)
buffer:set_sel(e, pos)
end
end
- buffer:scroll_range(buffer.anchor, buffer.current_pos)
-- If nothing was found, wrap the search.
if pos == -1 and not no_wrap then
@@ -187,13 +185,15 @@ local function find(text, next, flags, no_wrap, wrapped)
pos = find(text, next, flags, true, true)
if pos == -1 then
ui.statusbar_text = _L['No results found']
- buffer:line_scroll(0, first_visible_line - buffer.first_visible_line)
buffer:goto_pos(anchor)
end
elseif not wrapped then
ui.statusbar_text = ''
end
+ buffer:vertical_centre_caret()
+ buffer:scroll_range(buffer.anchor, buffer.current_pos)
+
return pos
end
events.connect(events.FIND, find)