From f06430c4c86a177ffa226a1dbddf27302a7c7bf6 Mon Sep 17 00:00:00 2001 From: freesource Date: Tue, 28 Aug 2001 03:38:09 +0000 Subject: [PATCH] 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. --- BootRoot/YardBox.pm | 57 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 13 deletions(-) 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 { - } }