aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/events.lua8
-rw-r--r--core/ext/command_entry.lua6
-rw-r--r--core/ext/find.lua2
-rw-r--r--core/ext/keys.lua2
-rw-r--r--core/ext/mime_types.lua6
-rw-r--r--core/ext/pm/file_browser.lua2
-rw-r--r--core/ext/pm/modules_browser.lua4
-rw-r--r--core/ext/pm/project_browser.lua4
-rw-r--r--core/file_io.lua12
-rw-r--r--core/init.lua2
-rw-r--r--init.lua4
-rw-r--r--modules/lua/commands.lua4
-rw-r--r--modules/textadept/editing.lua2
-rwxr-xr-xscripts/gen_iface.lua2
14 files changed, 30 insertions, 30 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
diff --git a/init.lua b/init.lua
index 34bbd0fc..4159e1c3 100644
--- a/init.lua
+++ b/init.lua
@@ -44,7 +44,7 @@ if not RESETTING then
end
-- process command line arguments
- if MAC and arg[1] and arg[1]:match('^%-psn_0') then
+ if MAC and arg[1] and arg[1]:find('^%-psn_0') then
table.remove(arg, 1)
end
if #arg == 0 then
@@ -53,7 +53,7 @@ if not RESETTING then
local base_dir = arg[0]:match('^.+/') or ''
local filepath
for _, filename in ipairs(arg) do
- if not filename:match('^~?/') then
+ if not filename:find('^~?/') then
textadept.io.open(base_dir..filename)
else
textadept.io.open(filename)
diff --git a/modules/lua/commands.lua b/modules/lua/commands.lua
index 9427e8cc..0b918087 100644
--- a/modules/lua/commands.lua
+++ b/modules/lua/commands.lua
@@ -28,9 +28,9 @@ function try_to_autocomplete_end()
local line_num = buffer:line_from_position(buffer.current_pos)
local line = buffer:get_line(line_num - 1)
for _, patt in ipairs(control_structure_patterns) do
- if line:match(patt) then
+ if line:find(patt) then
local indent = buffer.line_indentation[line_num - 1]
- buffer:add_text(patt:match('repeat') and '\nuntil' or '\nend')
+ buffer:add_text(patt:find('repeat') and '\nuntil' or '\nend')
buffer.line_indentation[line_num + 1] = indent
buffer.line_indentation[line_num] = indent + buffer.indent
buffer:line_up()
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 069135b2..972b52d8 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -136,7 +136,7 @@ function autocomplete_word_from_dict(dict)
if not f then return end
local c_list = {}
for line in f:lines() do
- if line:match('^'..root) then c_list[#c_list + 1] = line end
+ if line:find('^'..root) then c_list[#c_list + 1] = line end
end
f:close()
if #c_list > 0 then buffer:auto_c_show(#root, table.concat(c_list, ' ')) end
diff --git a/scripts/gen_iface.lua b/scripts/gen_iface.lua
index c968131d..63508c37 100755
--- a/scripts/gen_iface.lua
+++ b/scripts/gen_iface.lua
@@ -21,7 +21,7 @@ out = out..'textadept.constants = {\n'
-- {"constant", value}
for item in constants:sub(2, -2):gmatch('%b{}') do
local name, value = item:match('^{"(.-)",(.-)}')
- if not name:match('^IDM_') then
+ if not name:find('^IDM_') then
if name == 'SC_MASK_FOLDERS' then value = '-33554432' end
local line = (" %s = %s,\n"):format(name, value)
out = out..line