aboutsummaryrefslogtreecommitdiff
path: root/core/ui.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-10-18 12:05:32 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-10-18 12:05:32 -0400
commit20c4fb3baaac9d176e029e3680cc0c8e8101e44c (patch)
tree785ad6aefe188739ffe8560cd6138e8309425f9c /core/ui.lua
parent8f682b9de06785cd20b9fb6e18460a1e53fd1ca1 (diff)
downloadtextadept-20c4fb3baaac9d176e029e3680cc0c8e8101e44c.tar.gz
textadept-20c4fb3baaac9d176e029e3680cc0c8e8101e44c.zip
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`.
Diffstat (limited to 'core/ui.lua')
-rw-r--r--core/ui.lua22
1 files changed, 7 insertions, 15 deletions
diff --git a/core/ui.lua b/core/ui.lua
index 67a8a661..9a1bd5a4 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -123,7 +123,7 @@ function ui.switch_buffer()
local filename = buffer.filename or buffer._type or _L['Untitled']
filename = filename:iconv('UTF-8', _CHARSET)
local basename = buffer.filename and filename:match('[^/\\]+$') or filename
- items[#items + 1] = (buffer.dirty and '*' or '')..basename
+ items[#items + 1] = (buffer.modify and '*' or '')..basename
items[#items + 1] = filename
end
local button, i = ui.dialogs.filteredlist{
@@ -261,20 +261,12 @@ local function set_title()
filename = filename:iconv('UTF-8', _CHARSET)
local basename = buffer.filename and filename:match('[^/\\]+$') or filename
ui.title = string.format('%s %s Textadept (%s)', basename,
- buffer.dirty and '*' or '-', filename)
+ buffer.modify and '*' or '-', filename)
end
--- Changes Textadept title to show the buffer as being "clean".
-events_connect(events.SAVE_POINT_REACHED, function()
- buffer.dirty = false
- set_title()
-end)
-
--- Changes Textadept title to show thee buffer as "dirty".
-events_connect(events.SAVE_POINT_LEFT, function()
- buffer.dirty = true
- set_title()
-end)
+-- Changes Textadept title to show the buffer as being "clean" or "dirty".
+events_connect(events.SAVE_POINT_REACHED, set_title)
+events_connect(events.SAVE_POINT_LEFT, set_title)
-- Open uri(s).
events_connect(events.URI_DROPPED, function(utf8_uris)
@@ -355,11 +347,11 @@ events_connect(events.VIEW_AFTER_SWITCH, update_bars)
events_connect(events.RESET_AFTER,
function() ui.statusbar_text = 'Lua reset' end)
--- Prompts for confirmation if any buffers are dirty.
+-- Prompts for confirmation if any buffers are modified.
events_connect(events.QUIT, function()
local list = {}
for _, buffer in ipairs(_BUFFERS) do
- if buffer.dirty then
+ if buffer.modify then
local filename = buffer.filename or buffer._type or _L['Untitled']
list[#list + 1] = filename:iconv('UTF-8', _CHARSET)
end