From 6e086c1310caa4182e919a9ba6fe35f6c3bf3725 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 5 Apr 2016 20:45:51 -0400 Subject: Only convert filenames from `_CHARSET` to UTF-8, not UTF-8-encoded buffer names. --- core/file_io.lua | 4 ++-- core/ui.lua | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'core') 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{ -- cgit v1.2.3