summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoretienne2001-11-28 15:34:16 +0000
committeretienne2001-11-28 15:34:16 +0000
commit60423f7b8096f3abb75ea60276814dc5725c843a (patch)
treec80d9376cad6ae1e487dbf080cde9b562dcdd954 /src
parentff91f93ab2e588f2c3ce248b8f61dd80cdf96821 (diff)
downloadivymon-60423f7b8096f3abb75ea60276814dc5725c843a.zip
ivymon-60423f7b8096f3abb75ea60276814dc5725c843a.tar.gz
ivymon-60423f7b8096f3abb75ea60276814dc5725c843a.tar.bz2
ivymon-60423f7b8096f3abb75ea60276814dc5725c843a.tar.xz
* Recherche par expression reguliere
m Recherche a la volee
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ivymon72
1 files changed, 61 insertions, 11 deletions
diff --git a/src/ivymon b/src/ivymon
index 1e32d3a..9802399 100755
--- a/src/ivymon
+++ b/src/ivymon
@@ -22,6 +22,7 @@ my $minH = 768;
my $ivy_port; # undef:=> default value is treated by ivy-perl
my $history = 100000;
my $casesensitiveflag = 1;
+my $regexpflag = 0;
# misc
my %connectedClients;
my %bindings;
@@ -32,6 +33,7 @@ my %msgToSend;
my %msgToSendIndex;
my $msgToSendFlag = 0;
my $searchIndex;
+my $searchString;
my %searchHistory;
my @searchHistory;
@@ -474,13 +476,22 @@ $searchEntry->bind('<Down>' => [\&searchNextExpression]);
$searchEntry->bind('<Control-n>' => [\&searchNextExpression]);
$searchEntry->bind('<Up>' => [\&searchPrevExpression]);
$searchEntry->bind('<Control-p>' => [\&searchPrevExpression]);
+$searchEntry->bind('<Key>' => [\&searchOnTheFly]);
+my $checkbutt_fm =
+ $search_fm->Frame()->grid(-column => 1,
+ -row => 2,
+ -columnspan => 3);
my $casesensitive_cb =
- $search_fm->Checkbutton(-text => 'Case sensitive',
+ $checkbutt_fm->Checkbutton(-text => 'Case sens.',
-variable => \$casesensitiveflag
)->grid(-column => 1,
- -row => 2,
- -columnspan => 3);
+ -row => 1);
+my $regexp_cb =
+ $checkbutt_fm->Checkbutton(-text => 'Regexp',
+ -variable => \$regexpflag
+ )->grid(-column => 2,
+ -row => 1);
my $searchPrev =
$search_fm->Button(-text => 'Prev',
@@ -1202,6 +1213,7 @@ sub clearSearch {
$searchEntry->delete(0, 'end');
&highlightStringOff;
$searchIndex = undef;
+ $searchString = undef;
} # end clearSearch
@@ -1214,26 +1226,59 @@ sub searchHistoryGenList {
} # end searchHistoryGenList
+sub searchOnTheFly {
+ my $string = $searchEntry->get;
+ my $strlen;
+ return unless $string;
+ print "string=$string\n";
+ my $index0;
+ if ($searchString) {
+ if ($string ne $searchString) {
+ $index0 = $searchIndex;
+ } else {
+ return;
+ }
+ } else {
+ $index0 = '0.0';
+ }
+ &highlightStringOff;
+ my @searchopts = (-count => \$strlen, -forwards);
+ push(@searchopts, -nocase) unless ($casesensitiveflag);
+ push(@searchopts, -regexp) if ($regexpflag);
+ my $index = $messagesText->search(@searchopts, $string, $index0);
+ if ($index) {
+ &highlightStringOff if $searchString and $string eq $searchString;
+ $searchString = $messagesText->get($index, "$index + $strlen chars");
+ $searchIndex = $index;
+ &highlightString($index, "$index + $strlen chars");
+ $messagesText->see($index);
+ } else {
+ &warning2($messagesText);
+ }
+
+} # end searchOnTheFly
sub searchNext {
my $string = $searchEntry->get;
- my $strlen = length($string);
+ my $strlen;
return unless $string;
my $index0 = ($searchIndex) ? "$searchIndex + 1 chars": '0.0';
- my @searchopts = (-forwards);
+ my @searchopts = (-count => \$strlen, -forwards);
push(@searchopts, -nocase) unless ($casesensitiveflag);
+ push(@searchopts, -regexp) if ($regexpflag);
my $index = $messagesText->search(@searchopts, $string, $index0);
#print "index=$index searchIndex=$searchIndex\n";
&highlightStringOff;
if ($index) {
&highlightString($index, "$index + $strlen chars");
$messagesText->see($index);
+ $searchString = $messagesText->get($index, "$index + $strlen chars");
+ $searchIndex = $index;
&warning1($messagesText) if defined($searchIndex) and
$messagesText->compare($index, "<=" ,$searchIndex);
} else {
&warning2($messagesText);
}
- $searchIndex = $index;
$searchHistoryIndex = -1;
&searchHistoryGenList($string);
@@ -1242,23 +1287,25 @@ sub searchNext {
sub searchPrev {
my $string = $searchEntry->get;
- my $strlen = length($string);
+ my $strlen ;
return unless $string;
#my $index0 = ($searchIndex) ? "$searchIndex - 1 chars": '0.0';
my $index0 = ($searchIndex) ? $searchIndex : '0.0';
- my @searchopts = (-backwards);
+ my @searchopts = (-count => \$strlen, -backwards);
push(@searchopts, -nocase) unless ($casesensitiveflag);
+ push(@searchopts, -regexp) if ($regexpflag);
my $index = $messagesText->search(@searchopts, $string, $index0);
&highlightStringOff;
if ($index) {
&highlightString($index, "$index + $strlen chars");
$messagesText->see($index);
+ $searchString = $messagesText->get($index, "$index + $strlen chars");
+ $searchIndex = $index;
&warning1($messagesText) if defined($searchIndex) and
$messagesText->compare($index, ">=" ,$searchIndex);
} else {
&warning2($messagesText);
}
- $searchIndex = $index;
$searchHistoryIndex = -1;
&searchHistoryGenList($string);
@@ -1268,15 +1315,16 @@ sub searchPrev {
sub searchAll {
&highlightStringOff;
my $string = $searchEntry->get;
- my $strlen = length($string);
+ my $strlen;
return unless $string;
$messagesText->tagConfigure('found',
-background => 'sienna',
-foreground => 'ivory');
my $index = '0.0';
my $found = 0;
- my @searchopts = (-forwards);
+ my @searchopts = (-count => \$strlen, -forwards);
push(@searchopts, -nocase) unless ($casesensitiveflag);
+ push(@searchopts, -regexp) if ($regexpflag);
while ($index) {
$index = $messagesText->search(@searchopts, $string, $index, 'end');
@@ -1288,6 +1336,8 @@ sub searchAll {
&warning2($messagesText) unless ($found);
$searchHistoryIndex = -1;
&searchHistoryGenList($string);
+ $searchString = undef;
+ $searchIndex = undef;
} # end searchAll