From f2374c4aba53fa462dc88d4104e10d8cb97e61ba Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 25 May 2020 21:16:01 -0400 Subject: 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. --- modules/textadept/session.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/textadept/session.lua') diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua index b446ca54..43bb9e08 100644 --- a/modules/textadept/session.lua +++ b/modules/textadept/session.lua @@ -62,7 +62,7 @@ function M.load(filename) if lfs.attributes(buf.filename) then io.open_file(buf.filename) buffer:set_sel(buf.anchor, buf.current_pos) - buffer:line_scroll(0, buf.top_line - buffer.first_visible_line) + view:line_scroll(0, buf.top_line - view.first_visible_line) for _, line in ipairs(buf.bookmarks) do buffer:marker_add(line, textadept.bookmarks.MARK_BOOKMARK) end @@ -165,7 +165,7 @@ function M.save(filename) filename = buffer.filename or buffer._type, anchor = current and buffer.anchor or buffer._anchor, current_pos = current and buffer.current_pos or buffer._current_pos, - top_line = current and buffer.first_visible_line or buffer._top_line, + top_line = current and view.first_visible_line or buffer._top_line, } local bookmarks = {} local BOOKMARK_BIT = 1 << textadept.bookmarks.MARK_BOOKMARK - 1 -- cgit v1.2.3