ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/selection
(Generate patch)

Comparing rxvt-unicode/src/perl/selection (file contents):
Revision 1.25 by root, Thu Jan 12 23:30:51 2006 UTC vs.
Revision 1.31 by root, Thu Jan 19 09:47:15 2006 UTC

12sub on_init { 12sub on_init {
13 my ($self) = @_; 13 my ($self) = @_;
14 14
15 for (my $idx = 0; defined (my $res = $self->x_resource ("selection.pattern-$idx")); $idx++) { 15 for (my $idx = 0; defined (my $res = $self->x_resource ("selection.pattern-$idx")); $idx++) {
16 no re 'eval'; # just to be sure 16 no re 'eval'; # just to be sure
17 $res = $self->locale_decode ($res);
18 utf8::encode $res;
17 push @{ $self->{patterns} }, qr/$res/; 19 push @{ $self->{patterns} }, qr/$res/;
18 } 20 }
19 21
20 () 22 ()
21} 23}
65 my $curlen = $line->offset_of ($self->selection_end) 67 my $curlen = $line->offset_of ($self->selection_end)
66 - $line->offset_of ($self->selection_beg); 68 - $line->offset_of ($self->selection_beg);
67 69
68 my @matches; 70 my @matches;
69 71
72 # not doing matches in unicode mode helps speed
73 # enourmously here. working in utf-8 should be
74 # equivalent due to the magic of utf-8 encoding.
75 utf8::encode $text;
76 study $text; # _really_ helps, too :)
77
70 for my $regex (@mark_patterns, @{ $self->{patterns} }) { 78 for my $regex (@mark_patterns, @{ $self->{patterns} }) {
71 while ($text =~ /$regex/g) { 79 while ($text =~ /$regex/g) {
72 if ($-[1] <= $markofs and $markofs <= $+[1]) { 80 if ($-[1] <= $markofs and $markofs <= $+[1]) {
73 my $ofs = $-[1]; 81 my $ofs = $-[1];
74 my $match = $1; 82 my $match = $1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines