diff options
author | 2008-12-30 19:31:34 -0500 | |
---|---|---|
committer | 2008-12-30 19:31:34 -0500 | |
commit | 020ad62aa38e87f2fe8bb5faab496e3e1ca99733 (patch) | |
tree | 2dfb9f92124a567f0fcb9c523b3f7386f440f7c4 | |
parent | 9cb41cfba6d7f96fbdcb781c3188858e6615a2ff (diff) | |
download | textadept-020ad62aa38e87f2fe8bb5faab496e3e1ca99733.tar.gz textadept-020ad62aa38e87f2fe8bb5faab496e3e1ca99733.zip |
Fixes to recognize Windows path separators.
-rw-r--r-- | core/events.lua | 2 | ||||
-rw-r--r-- | core/ext/mime_types.lua | 4 | ||||
-rw-r--r-- | core/ext/pm/buffer_browser.lua | 2 | ||||
-rw-r--r-- | core/ext/pm/project_browser.lua | 2 | ||||
-rw-r--r-- | core/file_io.lua | 6 |
5 files changed, 8 insertions, 8 deletions
diff --git a/core/events.lua b/core/events.lua index 6236c25c..e443c529 100644 --- a/core/events.lua +++ b/core/events.lua @@ -369,7 +369,7 @@ local function set_title(buffer) local buffer = buffer local filename = buffer.filename or 'Untitled' local d = buffer.dirty and ' * ' or ' - ' - textadept.title = filename:match('[^/]+$')..d..'Textadept ('..filename..')' + textadept.title = filename:match('[^/\\]+$')..d..'Textadept ('..filename..')' end add_handler('save_point_reached', diff --git a/core/ext/mime_types.lua b/core/ext/mime_types.lua index ef848cb1..f54eb602 100644 --- a/core/ext/mime_types.lua +++ b/core/ext/mime_types.lua @@ -261,7 +261,7 @@ local patterns = { local function set_lexer_from_filename(filename) local lexer if filename then - local ext = filename:match('[^/]+$'):match('[^.]+$') + local ext = filename:match('[^/\\]+$'):match('[^.]+$') lexer = extensions[ext] end buffer:set_lexer_language(lexer or 'container') @@ -302,7 +302,7 @@ end -- @param filename The filename used to load a language module from. local function load_language_module_from_filename(filename) if not filename then return end - local ext = filename:match('[^/]+$'):match('[^.]+$') + local ext = filename:match('[^/\\]+$'):match('[^.]+$') local lang = extensions[ext] if lang then local ret, err = pcall(require, lang) diff --git a/core/ext/pm/buffer_browser.lua b/core/ext/pm/buffer_browser.lua index d894da49..6c292200 100644 --- a/core/ext/pm/buffer_browser.lua +++ b/core/ext/pm/buffer_browser.lua @@ -15,7 +15,7 @@ function get_contents_for() index = string.format("%02i", index) contents[index] = { pixbuf = buffer.dirty and 'gtk-edit' or 'gtk-file', - text = (buffer.filename or 'Untitled'):match('[^/]+$') + text = (buffer.filename or 'Untitled'):match('[^/\\]+$') } end return contents diff --git a/core/ext/pm/project_browser.lua b/core/ext/pm/project_browser.lua index 4e96dab9..0b47a3b2 100644 --- a/core/ext/pm/project_browser.lua +++ b/core/ext/pm/project_browser.lua @@ -154,7 +154,7 @@ function perform_menu_action(menu_item, selected_item) -- If the user is saving to a different folder than was selected, -- caution them about unexpected behavior and ask to save in the -- project root instead. - if dir and file:match('^(.+)/') ~= dir then + if dir and file:match('^(.+)[/\\]') ~= dir then local ret = cocoa_dialog( 'yesno-msgbox', { text = 'Add to Project Root Instead?', ['informative-text'] = 'You are adding a new file to a live '.. diff --git a/core/file_io.lua b/core/file_io.lua index 21082f11..252afef2 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -50,7 +50,7 @@ function open(filenames) -- in Windows, dialog:get_filenames() is unavailable; only allow single -- selection ['select-multiple'] = not WIN32 or nil, - ['with-directory'] = (buffer.filename or ''):match('.+/') + ['with-directory'] = (buffer.filename or ''):match('.+[/\\]') } ) for filename in filenames:gmatch('[^\n]+') do open_helper(filename) end end @@ -104,8 +104,8 @@ function save_as(buffer, filename) if not filename then filename = cocoa_dialog( 'filesave', { title = 'Save', - ['with-directory'] = (buffer.filename or ''):match('.+/'), - ['with-file'] = (buffer.filename or ''):match('[^/]+$'), + ['with-directory'] = (buffer.filename or ''):match('.+[/\\]'), + ['with-file'] = (buffer.filename or ''):match('[^/\\]+$'), ['no-newline'] = true } ) end |