From b3367bca431aecf5759c688324b97d1458c8754f Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 25 Oct 2010 21:25:38 -0400 Subject: Speed up find in files; modules/textadept/find.lua --- modules/textadept/find.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/textadept/find.lua') 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 -- cgit v1.2.3