diff options
author | 2020-05-25 21:16:01 -0400 | |
---|---|---|
committer | 2020-05-25 21:16:01 -0400 | |
commit | f2374c4aba53fa462dc88d4104e10d8cb97e61ba (patch) | |
tree | 5e5a9d26a5ad8915c0e12187dd059b1109fcf22d /modules/textadept/find.lua | |
parent | effc636745e8d9c680c3acf42e8e25eed10cd903 (diff) | |
download | textadept-f2374c4aba53fa462dc88d4104e10d8cb97e61ba.tar.gz textadept-f2374c4aba53fa462dc88d4104e10d8cb97e61ba.zip |
Allow views to be used as buffers and update API.
This allows for a superficial separation of buffer- and view-specific Scintilla
functionality. buffers and views can now be used interchangeably for the most
part, and the APIs are guidance, not hard requirements. User scripts do not
require any modification and will continue to function normally.
Diffstat (limited to 'modules/textadept/find.lua')
-rw-r--r-- | modules/textadept/find.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index d15558fb..e98b1403 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -122,7 +122,7 @@ local function find(text, next, flags, no_wrap, wrapped) if text == '' then return end if not flags then flags = get_flags() end if flags >= 1 << 31 then M.find_in_files() return end -- not performed here - local first_visible_line = buffer.first_visible_line -- for 'no results found' + local first_visible_line = view.first_visible_line -- for 'no results found' -- If text is selected, assume it is from the current search and move the -- caret appropriately for the next search. @@ -132,8 +132,8 @@ local function find(text, next, flags, no_wrap, wrapped) buffer:search_anchor() local f = next and buffer.search_next or buffer.search_prev local pos = f(buffer, flags, text) - buffer:ensure_visible_enforce_policy(buffer:line_from_position(pos)) - buffer:scroll_range(buffer.anchor, buffer.current_pos) + view:ensure_visible_enforce_policy(buffer:line_from_position(pos)) + view:scroll_range(buffer.anchor, buffer.current_pos) find_text, found_text = text, buffer:get_sel_text() -- track for "replace all" -- If nothing was found, wrap the search. @@ -144,7 +144,7 @@ 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) + view:line_scroll(0, first_visible_line - view.first_visible_line) buffer:goto_pos(anchor) end elseif not wrapped then |