aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/find.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2014-06-12 21:18:13 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2014-06-12 21:18:13 -0400
commita9f6d85ead8c83ce210e5ffb05f84361e029f419 (patch)
treed7fcd5c957e3170f396eb515b94927174ad955d1 /modules/textadept/find.lua
parentd3e1bd0272a6ac75d927e0c7d5fcfde91d90bcc4 (diff)
downloadtextadept-a9f6d85ead8c83ce210e5ffb05f84361e029f419.tar.gz
textadept-a9f6d85ead8c83ce210e5ffb05f84361e029f419.zip
Lua code cleanup.
Diffstat (limited to 'modules/textadept/find.lua')
-rw-r--r--modules/textadept/find.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index bd9c8825..e293a7c4 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -231,7 +231,7 @@ function M.find_in_files(dir)
local text = M.find_entry_text
if not M.lua then text = text:gsub('([().*+?^$%%[%]-])', '%%%1') end
if not M.match_case then text = text:lower() end
- if M.whole_word then text = '%f[%w_]'..text..'%f[^%w_]' end
+ if M.whole_word then text = '%f[%w_]'..text..'%f[^%w_]' end -- TODO: wordchars
local matches = {_L['Find:']..' '..text}
lfs.dir_foreach(dir, function(file)
local match_case = M.match_case
@@ -271,8 +271,7 @@ local function replace(rtext)
end
local ok, rtext = pcall(rtext.gsub, rtext, '%%(%b())', function(code)
code = code:gsub('[\a\b\f\n\r\t\v\\]', escapes)
- local ok, result = pcall(load('return '..code))
- assert(ok, result)
+ local result = assert(load('return '..code))()
return result:gsub('\\[abfnrtv\\]', escapes)
end)
if ok then