Browse Source

Now case-insensitive works. Everything works, but a dialog which pops up when

the end or beginning has been reached, and another dialog when nothing is found.
master
freesource 24 years ago
parent
commit
f06430c4c8
  1. 57
      BootRoot/YardBox.pm

57
BootRoot/YardBox.pm

@ -1190,34 +1190,47 @@ sub search {
if ($search_backwards->active) {
if (!$offset) {
$offset = rindex($changed_text_from_template, $keywords);
if($case_sensitive->active) {
my ($tmp_ct, $tmp_k);
($tmp_ct = $changed_text_from_template) =~ tr/A-Z/a-z/;
($tmp_k = $keywords) =~ tr/A-Z/a-z/;
$offset = rindex($tmp_ct, $tmp_k);
}
else {
$offset = rindex($changed_text_from_template,
$keywords);
}
if ($offset != -1) {
my $length = length($keywords);
$text->set_position($offset);
$text->get_chars($offset, $length);
$length = $length + $offset;
$text->select_region($offset, $length);
#print "$offset && $length\n";
}
else {
}
}
else {
$offset = $offset - 1;
$offset = rindex($changed_text_from_template, $keywords,
$offset);
if($case_sensitive->active) {
my ($tmp_ct, $tmp_k);
($tmp_ct = $changed_text_from_template) =~ tr/A-Z/a-z/;
($tmp_k = $keywords) =~ tr/A-Z/a-z/;
$offset = rindex($tmp_ct, $tmp_k, $offset);
}
else {
$offset = rindex($changed_text_from_template,
$keywords, $offset);
}
if ($offset != -1) {
my $length = length($keywords);
$text->set_position($offset);
$text->get_chars($offset, $length);
$length = $length + $offset;
$text->select_region($offset,$length);
#print "$offset && $length\n";
}
else {
}
}
@ -1226,7 +1239,17 @@ sub search {
# index
else {
if (!$offset) {
$offset = index($changed_text_from_template, $keywords);
if($case_sensitive->active) {
my ($tmp_ct, $tmp_k);
($tmp_ct = $changed_text_from_template) =~ tr/A-Z/a-z/;
($tmp_k = $keywords) =~ tr/A-Z/a-z/;
$offset = index($tmp_ct, $tmp_k);
}
else {
$offset = index($changed_text_from_template,
$keywords);
}
if ($offset != -1) {
my $length = length($keywords);
$text->set_position($offset);
@ -1240,8 +1263,17 @@ sub search {
}
else {
$offset = $offset + 1;
$offset = index($changed_text_from_template, $keywords,
$offset);
if($case_sensitive->active) {
my ($tmp_ct, $tmp_k);
($tmp_ct = $changed_text_from_template) =~ tr/A-Z/a-z/;
($tmp_k = $keywords) =~ tr/A-Z/a-z/;
$offset = index($tmp_ct, $tmp_k, $offset);
}
else {
$offset = index($changed_text_from_template,
$keywords, $offset);
}
if ($offset != -1) {
my $length = length($keywords);
$text->set_position($offset);
@ -1251,7 +1283,6 @@ sub search {
}
else {
}
}

Loading…
Cancel
Save