Page 1 of 1

"Find All" in Search Results window.

Posted: Sun Jan 13, 2008 11:12 am
by Cloink
This has been touched on before, but no poll.

I come from a mainframe/Roscoe (command line-based editor) background where the command "INCL" (include) is ubiquitous - which as you might guess, displays a list of all lines containing the string you specify.

If the Find dialogue had an option to send 'Find All' lines to the Search Results window, á là 'Find in Files', that would be much appreciated and close to my INCL command.

In the meantime, anyone wanting this ability with one click/keypress could achieve it with a Tool that calls something (e.g. a Perl script) to do it for you (will need to use the $Sel or $SelWord tool parameter macro) - only diff being that output would end up in the Tool/Command Output window instead. Then of course you can assign the Tool a shortcut key.

By the way, I've already got a perl tool that searches for keywords which will be easily adapted to take a parameter-word instead of using the keywords table. I've posted that before here:-
http://forums.textpad.com/viewtopic.php?t=7672

In fact, I'm going to do this for myself right now...

See here too:-
http://forums.textpad.com/viewtopic.php?t=7471
http://forums.textpad.com/viewtopic.php?t=4872

Posted: Tue Jan 22, 2008 8:43 pm
by Cloink
Here it is. Create a tool that execs your perl file with two params:-

Code: Select all

[path]\INCL.pl $File $SelWord
Note that "$SelWord" either selects the word around the cursor if there isn't already a selection made, else it uses the selection as is.

The INCL.pl file contains:-

Code: Select all

#!perl

my $f    = $ARGV[0];
my $srch = $ARGV[1];

my $i;

open IN, $f || die "Can't open $f" ;
while( <IN> ){
    if( /$srch/i ){ # case insensitive
        $i = index( $_, $srch );
        printf( "%5.5u,%3.3u %s", $., ++$i, $_ );
    }
}
close IN;

1;
Obviously you need Perl installed!