--- rxvt-unicode/src/perl/selection 2006/01/25 13:24:45 1.35 +++ rxvt-unicode/src/perl/selection 2006/05/20 18:17:38 1.38 @@ -1,6 +1,6 @@ #! perl -sub on_keyboard_command { +sub on_user_command { my ($self, $cmd) = @_; $cmd eq "selection:rot13" @@ -23,6 +23,12 @@ push @{ $self->{patterns} }, qr/$res/; } + $self->{enabled} = 1; + + push @{ $self->{term}{option_popup_hook} }, sub { + ("new selection" => $self->{enabled}, sub { $self->{enabled} = shift }) + }; + () } @@ -40,7 +46,7 @@ # urls, just a heuristic qr{( - (?:https?|ftp|news|mailto|file)://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~]+ + (?:https?://|ftp://|news://|mailto:|file://)[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~]+ [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~] # exclude some trailing characters (heuristic) )}x, @@ -64,6 +70,9 @@ sub on_sel_extend { my ($self, $time) = @_; + $self->{enabled} + or return; + my ($row, $col) = $self->selection_mark; my $line = $self->line ($row); my $text = $line->t;