diff --git a/BootRoot/YardBox.pm b/BootRoot/YardBox.pm index 4099aae..bd1501e 100644 --- a/BootRoot/YardBox.pm +++ b/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 { - } }