aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/file_io.lua4
-rw-r--r--core/ui.lua9
2 files changed, 8 insertions, 5 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index 709bf1c8..9884cdf5 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -266,10 +266,10 @@ end
-- @name close_buffer
function io.close_buffer()
local filename = buffer.filename or buffer._type or _L['Untitled']
+ if buffer.filename then filename = filename:iconv('UTF-8', _CHARSET) end
local confirm = not buffer.modify or ui.dialogs.msgbox{
title = _L['Close without saving?'],
- text = _L['There are unsaved changes in'],
- informative_text = filename:iconv('UTF-8', _CHARSET),
+ text = _L['There are unsaved changes in'], informative_text = filename,
icon = 'gtk-dialog-question', button1 = _L['_Cancel'],
button2 = _L['Close _without saving']
} == 2
diff --git a/core/ui.lua b/core/ui.lua
index 9c13c42a..1392876f 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -160,7 +160,7 @@ function ui.switch_buffer()
for i = 1, #_BUFFERS do
local buffer = _BUFFERS[i]
local filename = buffer.filename or buffer._type or _L['Untitled']
- filename = filename:iconv('UTF-8', _CHARSET)
+ if buffer.filename then filename = filename:iconv('UTF-8', _CHARSET) end
local basename = buffer.filename and filename:match('[^/\\]+$') or filename
utf8_list[#utf8_list + 1] = (buffer.modify and '*' or '')..basename
utf8_list[#utf8_list + 1] = filename
@@ -304,7 +304,7 @@ end)
-- Sets the title of the Textadept window to the buffer's filename.
local function set_title()
local filename = buffer.filename or buffer._type or _L['Untitled']
- filename = filename:iconv('UTF-8', _CHARSET)
+ if buffer.filename then filename = filename:iconv('UTF-8', _CHARSET) end
local basename = buffer.filename and filename:match('[^/\\]+$') or filename
ui.title = string.format('%s %s Textadept (%s)', basename,
buffer.modify and '*' or '-', filename)
@@ -427,7 +427,10 @@ events_connect(events.QUIT, function()
if _BUFFERS[i].modify then
local filename = _BUFFERS[i].filename or _BUFFERS[i]._type or
_L['Untitled']
- utf8_list[#utf8_list + 1] = filename:iconv('UTF-8', _CHARSET)
+ if _BUFFERS[i].filename then
+ filename = filename:iconv('UTF-8', _CHARSET)
+ end
+ utf8_list[#utf8_list + 1] = filename
end
end
local cancel = #utf8_list > 0 and ui.dialogs.msgbox{