diff options
-rw-r--r-- | core/file_io.lua | 4 | ||||
-rw-r--r-- | core/ui.lua | 9 | ||||
-rw-r--r-- | modules/textadept/bookmarks.lua | 11 |
3 files changed, 14 insertions, 10 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{ diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index ded52fa4..24eea717 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -53,13 +53,14 @@ function M.goto_mark(next) if current_buffer_first and _BUFFERS[i] == buffer or not current_buffer_first and _BUFFERS[i] ~= buffer then local buffer = _BUFFERS[i] - local filename = (buffer.filename or buffer._type or - _L['Untitled']):match('[^/\\]+$') + local basename = (buffer.filename or ''):match('[^/\\]+$') or + buffer._type or _L['Untitled'] + if buffer.filename then + basename = basename:iconv('UTF-8', _CHARSET) + end local line = buffer:marker_next(0, 2^M.MARK_BOOKMARK) while line >= 0 do - local mark = string.format('%s:%d: %s', - filename:iconv('UTF-8', _CHARSET), - line + 1, + local mark = string.format('%s:%d: %s', basename, line + 1, buffer:get_line(line):match('^[^\r\n]*')) utf8_list[#utf8_list + 1], buffers[#utf8_list + 1] = mark, i line = buffer:marker_next(line + 1, 2^M.MARK_BOOKMARK) |