diff options
author | 2011-09-25 22:37:24 -0400 | |
---|---|---|
committer | 2011-09-25 22:37:24 -0400 | |
commit | f10a48801dd09bb6cb058b4f783f879720d22bf0 (patch) | |
tree | 8b22a252a4b6f60cc7cb8acf862d5c770be8a28a /core/file_io.lua | |
parent | 8461d29251895160755695b74ca6356a9cd8e6f3 (diff) | |
download | textadept-f10a48801dd09bb6cb058b4f783f879720d22bf0.tar.gz textadept-f10a48801dd09bb6cb058b4f783f879720d22bf0.zip |
Refactored textadept.c and changed Lua interface a bit.
'_BUFFERS' and '_VIEWS' now also have buffer and view keys with index values;
'buffer.doc_pointer', 'view.doc_pointer', and 'gui.focused_doc_pointer' are no
longer used; 'buffer:check_global()' replaces 'gui.check_focused_buffer()';
Added 'view.buffer' field; 'view:goto_buffer()' and 'gui.goto_view()' arguments
changed to make more sense.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r-- | core/file_io.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 750f0827..a5c42a20 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -188,7 +188,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function reload(buffer) if not buffer then buffer = _G.buffer end - gui.check_focused_buffer(buffer) + buffer:check_global() if not buffer.filename then return end local pos, first_visible_line = buffer.current_pos, buffer.first_visible_line local filename = buffer.filename:iconv(_CHARSET, 'UTF-8') @@ -209,7 +209,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function set_encoding(buffer, encoding) - gui.check_focused_buffer(buffer) + buffer:check_global() if not buffer.encoding then error(L('Cannot change binary file encoding')) end local pos, first_visible_line = buffer.current_pos, buffer.first_visible_line local text = buffer:get_text(buffer.length) @@ -226,7 +226,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function save(buffer) if not buffer then buffer = _G.buffer end - gui.check_focused_buffer(buffer) + buffer:check_global() if not buffer.filename then return buffer:save_as() end events.emit(events.FILE_BEFORE_SAVE, buffer.filename) local text = buffer:get_text(buffer.length) @@ -248,7 +248,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function save_as(buffer, utf8_filename) if not buffer and not utf8_filename then buffer = _G.buffer end - gui.check_focused_buffer(buffer) + buffer:check_global() if not utf8_filename then utf8_filename = gui.dialog('filesave', '--title', L('Save'), @@ -281,7 +281,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function close(buffer) if not buffer then buffer = _G.buffer end - gui.check_focused_buffer(buffer) + buffer:check_global() if buffer.dirty and gui.dialog('msgbox', '--title', L('Close without saving?'), @@ -353,7 +353,7 @@ end) events.connect(events.FILE_OPENED, function(utf8_filename) local b = _BUFFERS[1] if #_BUFFERS == 2 and not (b.filename or b._type or b.dirty) then - view:goto_buffer(1, true) + view:goto_buffer(1) buffer:close() end end) |