Hello community, here is the log from the commit of package urxvt-perls for openSUSE:Factory checked in at 2015-11-28 15:19:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/urxvt-perls (Old) and /work/SRC/openSUSE:Factory/.urxvt-perls.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "urxvt-perls" Changes: -------- --- /work/SRC/openSUSE:Factory/urxvt-perls/urxvt-perls.changes 2014-11-15 12:29:40.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.urxvt-perls.new/urxvt-perls.changes 2015-11-28 15:19:30.000000000 +0100 @@ -1,0 +2,6 @@ +Thu Nov 19 16:34:44 UTC 2015 - [email protected] + +- Version bump 2.2, no upstream changelog, see: + https://github.com/muennich/urxvt-perls/compare/2.1...2.2 + +------------------------------------------------------------------- Old: ---- 2.1.tar.gz New: ---- 2.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ urxvt-perls.spec ++++++ --- /var/tmp/diff_new_pack.Cs7ny4/_old 2015-11-28 15:19:30.000000000 +0100 +++ /var/tmp/diff_new_pack.Cs7ny4/_new 2015-11-28 15:19:30.000000000 +0100 @@ -17,7 +17,7 @@ Name: urxvt-perls -Version: 2.1 +Version: 2.2 Release: 0 Summary: Perl extensions for the rxvt-unicode terminal emulator License: GPL-2.0 ++++++ 2.1.tar.gz -> 2.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urxvt-perls-2.1/README.md new/urxvt-perls-2.2/README.md --- old/urxvt-perls-2.1/README.md 2014-01-21 22:26:25.000000000 +0100 +++ new/urxvt-perls-2.2/README.md 2015-03-28 13:53:30.000000000 +0100 @@ -2,9 +2,10 @@ Installation ------------ -Simply place the scripts you want to install in the /usr/lib/urxvt/perl/ folder -for system-wide availability. You can also put them in a folder of your -choice, but then you have to add this line to your .Xdefaults/.Xresources: +Simply place the scripts you want to install in /usr/lib/urxvt/perl/ for +system-wide availability or in ~/.urxvt/ext/ for user-only availability. +You can also put them in a folder of your choice, but then you have to add this +line to your .Xdefaults/.Xresources: URxvt.perl-lib: /your/folder/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urxvt-perls-2.1/clipboard new/urxvt-perls-2.2/clipboard --- old/urxvt-perls-2.1/clipboard 2014-01-21 22:26:25.000000000 +0100 +++ new/urxvt-perls-2.2/clipboard 2015-03-28 13:53:30.000000000 +0100 @@ -86,6 +86,12 @@ () } +sub on_action { + my ($self, $action) = @_; + + on_user_command($self, "clipboard:" . $action); +} + sub on_user_command { my ($self, $cmd) = @_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urxvt-perls-2.1/keyboard-select new/urxvt-perls-2.2/keyboard-select --- old/urxvt-perls-2.1/keyboard-select 2014-01-21 22:26:25.000000000 +0100 +++ new/urxvt-perls-2.2/keyboard-select 2015-03-28 13:53:30.000000000 +0100 @@ -40,6 +40,13 @@ } +sub on_action { + my ($self, $action) = @_; + + on_user_command($self, "keyboard-select:" . $action); +} + + sub on_user_command { my ($self, $cmd) = @_; @@ -59,7 +66,9 @@ my ($self, $event, $keysym, $char) = @_; my $key = chr($keysym); - if ($self->{search}) { + if (lc($key) eq 'c' && $event->{state} & urxvt::ControlMask) { + deactivate($self); + } elsif ($self->{search}) { if ($keysym == 0xff1b) { if ($self->{search_mode}) { deactivate($self); @@ -83,6 +92,7 @@ delete $self->{pattern}; } $self->{search} = ''; + $self->screen_cur($self->{srhcr}, $self->{srhcc}); if (not find_next($self)) { if ($self->{search_mode}) { deactivate($self); @@ -92,6 +102,15 @@ } } elsif (length($char) > 0) { $self->{search} .= $self->locale_decode($char); + my $txt = substr($self->{search}, 1); + if ($txt) { + $self->{pattern} = ($txt =~ m/[[:upper:]]/) ? qr/\Q$txt\E/ : + qr/\Q$txt\E/i; + } elsif ($self->{pattern}) { + delete $self->{pattern}; + } + $self->screen_cur($self->{srhcr}, $self->{srhcc}); + find_next($self); status_area($self); } } elsif ($self->{move_to}) { @@ -159,6 +178,7 @@ } elsif ($key eq '/' || $key eq '?') { $self->{search} = $key; $self->{search_dir} = $key eq '?' ? -1 : 1; + ($self->{srhcr}, $self->{srhcc}) = $self->screen_cur(); status_area($self); } elsif (lc($key) eq 'n') { find_next($self, $self->{search_dir} * ($key eq 'N' ? -1 : 1)); @@ -420,6 +440,7 @@ } ($self->{oldcr}, $self->{oldcc}) = $self->screen_cur(); + ($self->{srhcr}, $self->{srhcc}) = $self->screen_cur(); $self->{old_view_start} = $self->view_start(); $self->{old_pty_ev_events} = $self->pty_ev_events(urxvt::EV_NONE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urxvt-perls-2.1/url-select new/urxvt-perls-2.2/url-select --- old/urxvt-perls-2.1/url-select 2014-01-21 22:26:25.000000000 +0100 +++ new/urxvt-perls-2.2/url-select 2015-03-28 13:53:30.000000000 +0100 @@ -27,6 +27,10 @@ use strict; +# The custom rendition bit to use for marking the cell as being underlined +# by us so we can unset it again after a line has changed. +use constant UNDERLINED => 1<<3; # arbitrarily chosen in hope of no collision + sub on_start { my ($self) = @_; @@ -62,18 +66,25 @@ if ($self->x_resource('matcher.pattern')) { @{$self->{pattern}} = ($self->x_resource('matcher.pattern')); - } elsif ($self->x_resource('matcher.pattern.1')) { - my $current = 1; + } elsif ($self->x_resource('matcher.pattern.0')) { + my $current = 0; - while ($self->x_resource("matcher.pattern.$current")) { - push @{$self->{pattern}}, $self->x_resource("matcher.pattern.$current"); + while (defined (my $res = $self->x_resource("matcher.pattern.$current"))) { + $res = $self->locale_decode($res); + utf8::encode $res; + push @{$self->{pattern}}, qr($res)x; $current++; } } else { - @{$self->{pattern}} = qr{( - (?:https?://|ftp://|news://|git://|mailto:|file://|www\.) - [\w\-\@;\/?:&=%\$_.+!*\x27(),~#]+[\w\-\@;\/?&=%\$_+!*\x27()~] - )}x; + @{$self->{pattern}} = qr{ + (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) + [\w\-\@;\/?:&=%\$.+!*\x27,~#]* + ( + \([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\) # Allow a pair of matched parentheses + | # + [\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic) + )+ + }x; } () @@ -87,22 +98,39 @@ my $text = $line->t; my $rend = $line->r; + # clear all underlines that were set by us + for (@$rend) { + if (urxvt::GET_CUSTOM($_) & UNDERLINED) { + $_ = urxvt::SET_CUSTOM($_, urxvt::GET_CUSTOM($_) & ~UNDERLINED) & + ~urxvt::RS_Uline; + } + } + for my $pattern (@{$self->{pattern}}) { while ($text =~ /$pattern/g) { my $url = $&; - my ($beg, $end) = ($-[1], $+[1] - 1); - --$end if $url =~ /["')]$/; + my ($beg, $end) = ($-[0], $+[0] - 1); for (@{$rend}[$beg .. $end]) { - $_ |= urxvt::RS_Uline; + unless ($_ & urxvt::RS_Uline) { + $_ = urxvt::SET_CUSTOM($_, urxvt::GET_CUSTOM($_) | UNDERLINED); + $_ |= urxvt::RS_Uline; + } } - $line->r($rend); } } + $line->r($rend); + () } +sub on_action { + my ($self, $action) = @_; + + on_user_command($self, "url-select:" . $action); +} + sub on_user_command { my ($self, $cmd) = @_; @@ -122,7 +150,8 @@ my ($self, $event, $keysym) = @_; my $char = chr($keysym); - if ($keysym == 0xff1b || lc($char) eq 'q') { + if ($keysym == 0xff1b || lc($char) eq 'q' || + (lc($char) eq 'c' && $event->{state} & urxvt::ControlMask)) { deactivate($self); } elsif ($keysym == 0xff0d || $char eq 'o') { $self->exec_async(@{$self->{browser}}, ${$self->{found}[$self->{n}]}[4]); @@ -160,9 +189,25 @@ urxvt::ShiftMask | urxvt::ControlMask; if ($event->{button} == $self->{button} && ($event->{state} & $mask) == $self->{state}) { - $self->{button_pressed} = 1; - $self->{button_col} = $event->{col}; - $self->{button_row} = $event->{row}; + my $col = $event->{col}; + my $row = $event->{row}; + my $line = $self->line($row); + my $text = $line->t; + + for my $pattern (@{$self->{pattern}}) { + while ($text =~ /$pattern/g) { + my ($url, $beg, $end) = ($&, $-[0], $+[0]); + --$end if $url =~ s/["')]$//; + + if ($col >= $beg && $col <= $end) { + $self->{button_pressed} = 1; + $self->{button_col} = $col; + $self->{button_row} = $row; + $self->{button_url} = $url; + return 1; + } + } + } } () @@ -178,20 +223,8 @@ $self->{button_pressed} = 0; if ($col == $self->{button_col} && $row == $self->{button_row}) { - my $line = $self->line($row); - my $text = $line->t; - - for my $pattern (@{$self->{pattern}}) { - while ($text =~ /$pattern/g) { - my ($url, $beg, $end) = ($&, $-[0], $+[0]); - --$end if $url =~ s/["')]$//; - - if ($col >= $beg && $col <= $end) { - $self->exec_async(@{$self->{browser}}, $url); - return 1; - } - } - } + $self->exec_async(@{$self->{browser}}, $self->{button_url}); + return 1; } } @@ -221,7 +254,7 @@ } while (($dir < 0 && $row > $self->top_row) || - ($dir > 0 && $row < $self->nrow - 1)) { + ($dir > 0 && $row < $self->nrow - 1)) { my $line = $self->line($row); $row = ($dir < 0 ? $line->beg : $line->end) + $dir; $line = $self->line($row); @@ -233,7 +266,6 @@ do { my ($beg, $end) = ($-[0], $+[0]); - --$end if $& =~ /['")]$/; push @{$self->{found}}, [$line->coord_of($beg), $line->coord_of($end), substr($text, $beg, $end - $beg)]; } while ($text =~ /$pattern/g);
