From a9f6d85ead8c83ce210e5ffb05f84361e029f419 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 12 Jun 2014 21:18:13 -0400 Subject: Lua code cleanup. --- modules/textadept/find.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules/textadept/find.lua') 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 -- cgit v1.2.3