From 20c4fb3baaac9d176e029e3680cc0c8e8101e44c Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Fri, 18 Oct 2013 12:05:32 -0400 Subject: The buffer API applies to all buffers now, not just the global one. Created a "dummy" Scintilla view for operating on non-global documents. Removed `buffer:check_global()` and replaced `buffer.dirty` with Scintilla's `buffer.modify`. --- core/file_io.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/file_io.lua') diff --git a/core/file_io.lua b/core/file_io.lua index ad8f677f..cfd0967f 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -254,7 +254,7 @@ function io.save_all_files() local current_buffer = _BUFFERS[buffer] for i, buffer in ipairs(_BUFFERS) do view:goto_buffer(i) - if buffer.filename and buffer.dirty then io.save_file() end + if buffer.filename and buffer.modify then io.save_file() end end view:goto_buffer(current_buffer) end @@ -266,7 +266,7 @@ end -- @name close_buffer function io.close_buffer() local filename = buffer.filename or buffer._type or _L['Untitled'] - if buffer.dirty and ui.dialogs.msgbox{ + if buffer.modify and ui.dialogs.msgbox{ title = _L['Close without saving?'], text = _L['There are unsaved changes in'], informative_text = filename:iconv('UTF-8', _CHARSET), @@ -319,7 +319,7 @@ events_connect(events.VIEW_AFTER_SWITCH, update_modified_file) -- Closes the initial "Untitled" buffer. events_connect(events.FILE_OPENED, function(filename) local buf = _BUFFERS[1] - if #_BUFFERS == 2 and not (buf.filename or buf._type or buf.dirty) then + if #_BUFFERS == 2 and not (buf.filename or buf._type or buf.modify) then view:goto_buffer(1) io.close_buffer() end -- cgit v1.2.3