aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2016-04-18 22:39:55 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2016-04-18 22:39:55 -0400
commit0e09011405ce16817c73cc3deae88125e9f4aebe (patch)
treecb18c91057254fdf4f79b5e89069f32b3528b3a6
parentbc763f8042a55ed87eb733fa79cf9abfc2ac6fd6 (diff)
Reverted r2149 (center found text in the view); 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 a7ca40a0..78b83d4f 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -139,6 +139,7 @@ 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.
@@ -177,6 +178,7 @@ 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,15 +189,13 @@ 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)