From 4e55b247304ebc962d59ffa61d8788df802b0d6a Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 16 Jun 2016 23:29:56 -0400 Subject: Changed arguments to `ui.goto_view()` and `view:goto_buffer()`. They can accept either objects or relative numbers now. They do not accept absolute indices anymore. --- core/file_io.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core/file_io.lua') diff --git a/core/file_io.lua b/core/file_io.lua index c4aecfe3..84f0287f 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -104,7 +104,7 @@ function io.open_file(filenames) local filename = lfs.abspath((filenames[i]:gsub('^file://', ''))) for j = 1, #_BUFFERS do if filename == _BUFFERS[j].filename then - view:goto_buffer(j) -- already open + view:goto_buffer(_BUFFERS[j]) -- already open goto continue end end @@ -234,10 +234,10 @@ end -- @see io.save_file -- @name save_all_files function io.save_all_files() - local current_buffer = _BUFFERS[buffer] + local current_buffer = buffer for i = 1, #_BUFFERS do if _BUFFERS[i].filename and _BUFFERS[i].modify then - view:goto_buffer(i) + view:goto_buffer(_BUFFERS[i]) io.save_file() end end @@ -272,7 +272,7 @@ end -- @name close_all_buffers function io.close_all_buffers() while #_BUFFERS > 1 do - view:goto_buffer(#_BUFFERS) + view:goto_buffer(_BUFFERS[#_BUFFERS]) if not io.close_buffer() then return false end end return io.close_buffer() -- the last one @@ -311,7 +311,7 @@ end) events_connect(events.FILE_OPENED, function() local buf = _BUFFERS[1] if #_BUFFERS == 2 and not (buf.filename or buf._type or buf.modify) then - view:goto_buffer(1) + view:goto_buffer(_BUFFERS[1]) io.close_buffer() end end) -- cgit v1.2.3