aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2010-10-25 21:25:38 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2010-10-25 21:25:38 -0400
commitb3367bca431aecf5759c688324b97d1458c8754f (patch)
treed7d742f90cc5950e067261081b18cdd1715ac944 /modules
parent4c4ca5b03f5c5d2cc8a2d5a98b2afef183f8201c (diff)
downloadtextadept-b3367bca431aecf5759c688324b97d1458c8754f.tar.gz
textadept-b3367bca431aecf5759c688324b97d1458c8754f.zip
Speed up find in files; modules/textadept/find.lua
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/find.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index ba46d485..db34358c 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -33,7 +33,7 @@ function find.find_in_files(utf8_dir)
if find.whole_word then text = '[^%W_]'..text..'[^%W_]' end
local match_case = find.match_case
local whole_word = find.whole_word
- local format = string.format
+ local string_find, format = string.find, string.format
local matches = { 'Find: '..text }
function search_file(file)
local line_num = 1
@@ -41,7 +41,7 @@ function find.find_in_files(utf8_dir)
local optimized_line = line
if not match_case then optimized_line = line:lower() end
if whole_word then optimized_line = ' '..line..' ' end
- if string.find(optimized_line, text) then
+ if string_find(optimized_line, text) then
file = file:iconv('UTF-8', _CHARSET)
matches[#matches + 1] = format('%s:%s:%s', file, line_num, line)
end