aboutsummaryrefslogtreecommitdiff
path: root/core/ui.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-04-05 20:45:51 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2016-04-05 20:45:51 -0400
commit6e086c1310caa4182e919a9ba6fe35f6c3bf3725 (patch)
treec5cef2a2e66bb50c45d67f4a487e5f2a977300c7 /core/ui.lua
parentc2e9e198fbfa1553411f79ff35b8d972dd417658 (diff)
downloadtextadept-6e086c1310caa4182e919a9ba6fe35f6c3bf3725.tar.gz
textadept-6e086c1310caa4182e919a9ba6fe35f6c3bf3725.zip
Only convert filenames from `_CHARSET` to UTF-8, not UTF-8-encoded buffer names.
Diffstat (limited to 'core/ui.lua')
-rw-r--r--core/ui.lua9
1 files changed, 6 insertions, 3 deletions
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{