aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/find.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-09-02 09:31:52 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2020-09-02 09:31:52 -0400
commitf95573558f3a418b000884c585c34211d682582c (patch)
tree5d1eb8c66105d9e325b11923570bd4c1ab22472f /modules/textadept/find.lua
parent8fc13fadfb7e7d962bc8737517586148ef8d6104 (diff)
downloadtextadept-f95573558f3a418b000884c585c34211d682582c.tar.gz
textadept-f95573558f3a418b000884c585c34211d682582c.zip
First scroll find results into view, then vertically center the caret.
Otherwise, find results on long lines will not be displayed.
Diffstat (limited to 'modules/textadept/find.lua')
-rw-r--r--modules/textadept/find.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 9654c988..c5c3118d 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -201,6 +201,7 @@ local function find(text, next, flags, no_wrap, wrapped)
local f = next and buffer.search_next or buffer.search_prev
local pos = f(buffer, flags, text)
view:ensure_visible_enforce_policy(buffer:line_from_position(pos))
+ view:scroll_range(buffer.anchor, buffer.current_pos)
view:vertical_center_caret()
-- Track find text and found text for "replace all" and incremental find.
find_text, found_text = text, buffer:get_sel_text()