mirror of
https://github.com/fspc/gbootroot.git
synced 2025-04-04 07:43:22 -04:00
This is experimental stuff with the search. It would be nice to figure out how
to have mouse-like selection, but for now color is just inserted.
This commit is contained in:
parent
987611be9f
commit
f147d66954
@ -45,6 +45,7 @@ my $search_window;
|
||||
my $Shortcuts;
|
||||
my @entry;
|
||||
my $file_dialog;
|
||||
my $blue; # for search
|
||||
|
||||
#my $filesystem_type = "ext2";
|
||||
#my $inode_size = 8192;
|
||||
@ -961,7 +962,8 @@ sub yard_box {
|
||||
#_______________________________________
|
||||
# Create the GtkText widget
|
||||
$text = new Gtk::Text( undef, undef );
|
||||
##Gtk::Text->signal_connect_after("key-press-event" => \&Gtk::false);
|
||||
##Gtk::Text->signal_connect_after("key-press-event" => \&Gtk::false);
|
||||
$blue = Gtk::Gdk::Color->parse_color("blue");
|
||||
$text->set_editable($true);
|
||||
$text->signal_connect("activate", sub {
|
||||
my $new_length = $text->get_length();
|
||||
@ -1196,15 +1198,41 @@ sub search {
|
||||
if ($search_backwards->active) {
|
||||
|
||||
}
|
||||
|
||||
# index
|
||||
else {
|
||||
if (!$offset) {
|
||||
$offset = index($changed_text_from_template, $keywords);
|
||||
if ($offset != -1) {
|
||||
$text->set_point($offset);
|
||||
my $length = length($keywords);
|
||||
$text->forward_delete( $length );
|
||||
$text->insert( undef, $blue, undef, $keywords );
|
||||
|
||||
$length = $length + ($offset - 1);
|
||||
my $stuff = $text->get_chars($offset, $length);
|
||||
print "$offset && $length\n";
|
||||
#Gtk::Widget::drag_begin(widget, targets, actions, button, event)
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
$offset = $offset + 1;
|
||||
$offset = index($changed_text_from_template, $keywords,
|
||||
$offset);
|
||||
if ($offset != -1) {
|
||||
$text->set_point($offset);
|
||||
my $length = length($keywords);
|
||||
$text->forward_delete( $length );
|
||||
$text->insert( undef, $blue, undef, $keywords );
|
||||
|
||||
$length = $length + ($offset - 1);
|
||||
$text->get_chars($offset, $length);
|
||||
print "$offset && $length\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
print "$offset\n" if $offset;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user