Open triplejam opened 5 years ago
Hello James, yes that is an unsolved issue. As I've suggested in the comments it would be perfect to do the search directly in the filecontent (independent of textadept's buffers). Also there should be the possibility to search for regex expressions. GNU Grep has regex search functionality, but it's also a quite heavy (in comparisson to textadept) tool that can do many other things. Also I don't know if we should use different preinstalled tools from every operating system (what about OSx ?) As I think, for textadept it would be sufficient to have a c-function like this: 'find_pattern_in_text' ; Arguments: (single_textfile_content, single_regex_pattern) ; Return values: List of (Position, Linenumber) I believe the bottleneck is the search within one single file, not the multiple calls of many files. The calls could be done in Lua.
And as I've seen, the other tool ack is written in Perl, I don't know if Mitchell would enter a dependence on this.
I think this functionality should be provided by textadept itself. Maybe you can ask Mitchell if he is interested in your implementation of the interface for GNU greb? I will also think more about this and ask him too.
A better search would affect many functions: 'find_in_files' (and therefore also 'find_in_project' and 'find_in_libs'), goto_keyline and goto_related_keyline. For goto_keyline and goto_related_keyline it's necessary to have regex.
BTW, yesterday I did some bugfixing (switch_print_buffers, find_replace_in_project and in the run-commands). Also I changed the keybinding 'switch_print_buffers' from 'Escape' to 'Ctrl+Alt+Enter'. With this there is no collision with the default behaviour by hitting Escape (i.e. hide search pane, escape multiple cursors).
Cheers, Johannes
The function find_in_project as your comments imply is pretty inefficient. I do not know if acceptable efficiency for this is possible in Lua. One solution is to have an external interface to a much faster program such as GNU grep. I have written a basic interface to grep for Textadept. I will share it if you would be interested. The other common program is ack. For Windows its "find" command is its equivalent I believe. A more extreme solution would be a loadable C module which would implement the functionality.