diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/events.lua | 8 | ||||
-rw-r--r-- | core/ext/command_entry.lua | 6 | ||||
-rw-r--r-- | core/ext/find.lua | 2 | ||||
-rw-r--r-- | core/ext/keys.lua | 2 | ||||
-rw-r--r-- | core/ext/mime_types.lua | 6 | ||||
-rw-r--r-- | core/ext/pm/file_browser.lua | 2 | ||||
-rw-r--r-- | core/ext/pm/modules_browser.lua | 4 | ||||
-rw-r--r-- | core/ext/pm/project_browser.lua | 4 | ||||
-rw-r--r-- | core/file_io.lua | 12 | ||||
-rw-r--r-- | core/init.lua | 2 |
10 files changed, 24 insertions, 24 deletions
diff --git a/core/events.lua b/core/events.lua index d7897c6d..9922b438 100644 --- a/core/events.lua +++ b/core/events.lua @@ -214,7 +214,7 @@ add_handler('view_new', buffer.property['lexer.lua.home'] = _HOME..'/lexers/' buffer.property['lexer.lua.script'] = _HOME..'/lexers/lexer.lua' if _THEME and #_THEME > 0 then - if not _THEME:match('[/\\]') then + if not _THEME:find('[/\\]') then -- use a lexer theme from Textadept's themes, not scintilla-st's buffer.property['lexer.lua.color.theme'] = _HOME..'/themes/'.._THEME..'/lexer.lua' @@ -240,7 +240,7 @@ add_handler('view_new', if _THEME and #_THEME > 0 then local ret, errmsg - if not _THEME:match('[/\\]') then + if not _THEME:find('[/\\]') then ret, errmsg = pcall(dofile, _HOME..'/themes/'.._THEME..'/view.lua') else -- _THEME is a folder path ret, errmsg = pcall(dofile, _THEME..'/view.lua') @@ -318,7 +318,7 @@ add_handler('buffer_new', if _THEME and #_THEME > 0 then local ret, errmsg - if not _THEME:match('[/\\]') then + if not _THEME:find('[/\\]') then ret, errmsg = pcall(dofile, _HOME..'/themes/'.._THEME..'/buffer.lua') else -- _THEME is a folder path ret, errmsg = pcall(dofile, _THEME..'/buffer.lua') @@ -410,7 +410,7 @@ add_handler('uri_dropped', function(uris) local lfs = require 'lfs' for uri in uris:gmatch('[^\r\n\f]+') do - if uri:match('^file://') then + if uri:find('^file://') then uri = uri:match('^file://([^\r\n\f]+)') uri = uri:gsub('%%20', ' ') -- sub back for spaces if WIN32 then uri = uri:sub(2, -1) end -- ignore leading '/' diff --git a/core/ext/command_entry.lua b/core/ext/command_entry.lua index 29e38bb6..c583dc06 100644 --- a/core/ext/command_entry.lua +++ b/core/ext/command_entry.lua @@ -16,18 +16,18 @@ function ce.get_completions_for(command) if type(tbl) ~= 'table' then return end local cmpls = {} for k in pairs(tbl) do - if type(k) == 'string' and k:match('^'..prefix) then + if type(k) == 'string' and k:find('^'..prefix) then cmpls[#cmpls + 1] = k end end if path == 'buffer' then if o == ':' then for f in pairs(textadept.buffer_functions) do - if f:match('^'..prefix) then cmpls[#cmpls + 1] = f end + if f:find('^'..prefix) then cmpls[#cmpls + 1] = f end end else for p in pairs(textadept.buffer_properties) do - if p:match('^'..prefix) then cmpls[#cmpls + 1] = p end + if p:find('^'..prefix) then cmpls[#cmpls + 1] = p end end end end diff --git a/core/ext/find.lua b/core/ext/find.lua index 0b26ba45..e6f7f529 100644 --- a/core/ext/find.lua +++ b/core/ext/find.lua @@ -102,7 +102,7 @@ function find.find(text, next, flags, nowrap, wrapped) end function search_dir(directory) for file in lfs.dir(directory) do - if not file:match('^%.') then + if not file:find('^%.') then local path = directory..'/'..file local type = lfs.attributes(path).mode if type == 'directory' then diff --git a/core/ext/keys.lua b/core/ext/keys.lua index 466a74c2..1a276861 100644 --- a/core/ext/keys.lua +++ b/core/ext/keys.lua @@ -151,7 +151,7 @@ local function keypress(code, shift, control, alt) if MAC and not shift and not control and not alt then local ch = string_char(code) -- work around native GTK-OSX's handling of Alt key - if ch:match('[^A-Za-z ]') and #keychain == 0 then + if ch:find('[^A-Za-z ]') and #keychain == 0 then buffer:add_text(ch) textadept.events.handle('char_added', ch) return true diff --git a/core/ext/mime_types.lua b/core/ext/mime_types.lua index 8ee41c7c..b35ee151 100644 --- a/core/ext/mime_types.lua +++ b/core/ext/mime_types.lua @@ -274,7 +274,7 @@ end -- [Local function] Sets the buffer's lexer language based on a shebang line. local function set_lexer_from_sh_bang() local line = buffer:get_line(0) - if line:match('^#!') then + if line:find('^#!') then line = line:gsub('[\\/]', ' ') for word in line:gmatch('%S+') do if shebangs[word] then @@ -291,7 +291,7 @@ end local function set_lexer_from_pattern() local line = buffer:get_line(0) for patt, lexer in pairs(patterns) do - if line:match(patt) then + if line:find(patt) then buffer:set_lexer_language(lexer) return true end @@ -310,7 +310,7 @@ local function load_language_module_from_filename(filename) local ret, err = pcall(require, lang) if ret then _m[lang].set_buffer_properties() - elseif not ret and not err:match("^module '"..lang.."' not found:") then + elseif not ret and not err:find("^module '"..lang.."' not found:") then textadept.events.error(err) end end diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua index 87d4b8e6..7c03518a 100644 --- a/core/ext/pm/file_browser.lua +++ b/core/ext/pm/file_browser.lua @@ -23,7 +23,7 @@ function get_contents_for(full_path) local dir = {} local dirpath = table.concat(full_path, '/') for name in lfs.dir(dirpath) do - if not name:match('^%.') then + if not name:find('^%.') then dir[name] = { text = name } if lfs.attributes(dirpath..'/'..name, 'mode') == 'directory' then dir[name].parent = true diff --git a/core/ext/pm/modules_browser.lua b/core/ext/pm/modules_browser.lua index 757e7d93..5cf93d25 100644 --- a/core/ext/pm/modules_browser.lua +++ b/core/ext/pm/modules_browser.lua @@ -88,7 +88,7 @@ function get_contents_for(full_path) local dir = {} local dirpath = table.concat(full_path, '/') for name in lfs.dir(dirpath) do - if not name:match('^%.') then + if not name:find('^%.') then dir[name] = { text = name } if lfs.attributes(dirpath..'/'..name, 'mode') == 'directory' then dir[name].parent = true @@ -173,7 +173,7 @@ function perform_menu_action(menu_item, menu_id, selected_item) }) == '1' then local function remove_directory(dirpath) for name in lfs.dir(dirpath) do - if not name:match('^%.%.?$') then os.remove(dirpath..'/'..name) end + if not name:find('^%.%.?$') then os.remove(dirpath..'/'..name) end end lfs.rmdir(dirpath) end diff --git a/core/ext/pm/project_browser.lua b/core/ext/pm/project_browser.lua index 0219839e..9a6c078a 100644 --- a/core/ext/pm/project_browser.lua +++ b/core/ext/pm/project_browser.lua @@ -52,7 +52,7 @@ function get_contents_for(full_path) else local dirpath = full_path[#full_path] for name in lfs.dir(dirpath) do - if not name:match('^%.') then -- ignore hidden files + if not name:find('^%.') then -- ignore hidden files local filepath = dirpath..'/'..name contents[filepath] = { text = name } if lfs.attributes(dirpath..'/'..name, 'mode') == 'directory' then @@ -322,7 +322,7 @@ function perform_menu_action(menu_item, menu_id, selected_item) else local function remove_directory(dirpath) for name in lfs.dir(dirpath) do - if not name:match('^%.%.?$') then os.remove(dirpath..'/'..name) end + if not name:find('^%.%.?$') then os.remove(dirpath..'/'..name) end end lfs.rmdir(dirpath) end diff --git a/core/file_io.lua b/core/file_io.lua index 3adb9d89..86c2c6c0 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -193,7 +193,7 @@ function load_session(filename, only_pm) if f then for line in f:lines() do if not only_pm then - if line:match('^buffer:') then + if line:find('^buffer:') then local anchor, current_pos, first_visible_line, filename = line:match('^buffer: (%d+) (%d+) (%d+) (.+)$') textadept.io.open(filename or '') @@ -207,25 +207,25 @@ function load_session(filename, only_pm) buffer:line_scroll(0, buffer:visible_from_doc_line(first_visible_line)) buffer:set_sel(anchor, current_pos) - elseif line:match('^%s*split%d:') then + elseif line:find('^%s*split%d:') then local level, num, type, size = line:match('^(%s*)split(%d): (%S+) (%d+)') local view = splits[#level] and splits[#level][tonumber(num)] or view splits[#level + 1] = { view:split(type == 'true') } splits[#level + 1][1].size = tonumber(size) -- could be 1 or 2 - elseif line:match('^%s*view%d:') then + elseif line:find('^%s*view%d:') then local level, num, buf_idx = line:match('^(%s*)view(%d): (%d+)$') local view = splits[#level][tonumber(num)] or view view:goto_buffer(tonumber(buf_idx)) - elseif line:match('^current_view:') then + elseif line:find('^current_view:') then local view_idx, buf_idx = line:match('^current_view: (%d+)') current_view = tonumber(view_idx) or 1 end end - if line:match('^size:') then + if line:find('^size:') then local width, height = line:match('^size: (%d+) (%d+)$') if width and height then textadept.size = { width, height } end - elseif line:match('^pm:') then + elseif line:find('^pm:') then local width, text = line:match('^pm: (%d+) (.+)$') textadept.pm.width = width or 0 textadept.pm.entry_text = text or '' diff --git a/core/init.lua b/core/init.lua index 7b547334..1df0f514 100644 --- a/core/init.lua +++ b/core/init.lua @@ -91,7 +91,7 @@ function cocoa_dialog(kind, opts) local args = { kind } for k, v in pairs(opts) do args[#args + 1] = '--'..k - if k == 'items' and kind:match('dropdown') then + if k == 'items' and kind:find('dropdown') then if not MAC then for item in v:gmatch('"(.-)"%s+') do args[#args + 1] = item end else |