diff options
-rw-r--r-- | doc/manual.md | 5 | ||||
-rw-r--r-- | modules/textadept/find.lua | 19 |
2 files changed, 15 insertions, 9 deletions
diff --git a/doc/manual.md b/doc/manual.md index fd12b37a..61ec80d3 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -1868,6 +1868,9 @@ FILTER |Renamed |[default\_filter][] dir\_foreach() |Changed |[dir\_foreach()][] _(changed args)_ **ui** | | SILENT\_PRINT |Renamed |[silent\_print][] +**ui.find** | | +FILTER |Renamed |[find\_in\_files\_filter][] +find\_in\_files(dir) |Changed |[find\_in\_files][](dir, filter) **textadept.editing** | | AUTOPAIR |Replaced|[auto\_pairs][] TYPEOVER\_CHARS |Replaced|[typeover\_chars][] @@ -1880,6 +1883,8 @@ braces |Replaced|[brace\_matches][] [default\_filter]: api.html#lfs.default_filter [dir\_foreach()]: api.html#lfs.dir_foreach [silent\_print]: api.html#ui.silent_print +[find\_in\_files\_filter]: api.html#ui.find.find_in_files_filter +[find\_in\_files]: api.html#ui.find.find_in_files [quick\_open]: api.html#io.quick_open [quick\_open\_filters]: api.html#io.quick_open_filters [quick\_open\_max]: api.html#io.quick_open_max diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index 2b88b3c7..561cae5b 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -106,8 +106,8 @@ local preferred_view -- @see find_in_files -- @see lfs.default_filter -- @class table --- @name FILTER -M.FILTER = lfs.default_filter +-- @name find_in_files_filter +M.find_in_files_filter = lfs.default_filter -- Text escape sequences with their associated characters and vice-versa. -- @class table @@ -240,16 +240,17 @@ end --- -- Searches directory *dir* or the user-specified directory for files that match --- search text and search options, and prints the results to a buffer titled --- "Files Found". +-- search text and search options (subject to optional filter *filter*), and +-- prints the results to a buffer titled "Files Found". -- Use the `find_text`, `match_case`, `whole_word`, and `lua` fields to set the --- search text and option flags, respectively. Use `FILTER` to set the search --- filter. +-- search text and option flags, respectively. -- @param dir Optional directory path to search. If `nil`, the user is prompted -- for one. --- @see FILTER +-- @param filter Optional filter for files and directories to exclude. The +-- default value is `ui.find.find_in_files_filter`. +-- @see find_in_files_filter -- @name find_in_files -function M.find_in_files(dir) +function M.find_in_files(dir, filter) dir = dir or ui.dialogs.fileselect{ title = _L['Find in Files'], select_only_directories = true, with_directory = io.get_project_root() or @@ -310,7 +311,7 @@ function M.find_in_files(dir) line_num = line_num + 1 end f:close() - end, M.FILTER) + end, filter or M.find_in_files_filter) if not found then buffer:append_text(_L['No results found']) end ui._print(_L['[Files Found Buffer]'], '') -- goto end, set save pos, etc. end |