diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2020-05-25 21:16:01 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2020-05-25 21:16:01 -0400 |
commit | f2374c4aba53fa462dc88d4104e10d8cb97e61ba (patch) | |
tree | 5e5a9d26a5ad8915c0e12187dd059b1109fcf22d /core/file_io.lua | |
parent | effc636745e8d9c680c3acf42e8e25eed10cd903 (diff) |
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 'core/file_io.lua')
-rw-r--r-- | core/file_io.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 7a7d841b..f90c51ab 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -167,7 +167,7 @@ end local function reload(buffer) if not buffer then buffer = _G.buffer end if not buffer.filename then return end - local pos, first_visible_line = buffer.current_pos, buffer.first_visible_line + local pos, first_visible_line = buffer.current_pos, view.first_visible_line local f = assert(io.open(buffer.filename, 'rb')) local text = f:read('a') f:close() @@ -177,14 +177,14 @@ local function reload(buffer) buffer.mod_time = lfs.attributes(buffer.filename, 'modification') if buffer == _G.buffer then buffer:goto_pos(pos) - buffer.first_visible_line = first_visible_line + view.first_visible_line = first_visible_line end end -- LuaDoc is in core/.buffer.luadoc. local function set_encoding(buffer, encoding) assert_type(encoding, 'string/nil', 1) - local pos, first_visible_line = buffer.current_pos, buffer.first_visible_line + local pos, first_visible_line = buffer.current_pos, view.first_visible_line local text = buffer:get_text() if buffer.encoding then text = text:iconv(buffer.encoding, 'UTF-8') @@ -193,7 +193,7 @@ local function set_encoding(buffer, encoding) if encoding then text = text:iconv('UTF-8', encoding) end buffer:set_text(text) buffer:goto_pos(pos) - buffer.first_visible_line = first_visible_line + view.first_visible_line = first_visible_line buffer.encoding = encoding buffer.code_page = buffer.encoding and buffer.CP_UTF8 or 0 end |