url-select: more suitable & vi-like mappings

This commit is contained in:
Bert 2010-08-03 22:15:07 +02:00
parent 8379775412
commit cee2040344

View File

@ -13,8 +13,8 @@
# - URxvt.keysym.M-u: perl:url-select:select_next # - URxvt.keysym.M-u: perl:url-select:select_next
# Use Meta-u to activate URL selection mode, then use the following keys: # Use Meta-u to activate URL selection mode, then use the following keys:
# - 'n': select next URL (also with Meta-u) # - 'k': select next upward URL (also with Meta-u)
# - 'N': select previous URL # - 'j': select next downward URL
# - Return: open selected URL in browser and quit selection mode # - Return: open selected URL in browser and quit selection mode
# - 'y': copy (yank) selected URL and quit selection mode # - 'y': copy (yank) selected URL and quit selection mode
# - Escape: cancel URL selection mode # - Escape: cancel URL selection mode
@ -91,11 +91,6 @@ sub on_user_command {
sub key_press { sub key_press {
return 1;
}
sub key_release {
my ($self, $event, $keysym) = @_; my ($self, $event, $keysym) = @_;
my $char = chr($keysym); my $char = chr($keysym);
@ -113,10 +108,10 @@ sub key_release {
$self->selection_grab($event->{time}); $self->selection_grab($event->{time});
deactivate($self); deactivate($self);
return 1; return 1;
} elsif ($char eq 'n') { } elsif ($char eq 'k') {
select_next($self, -1); select_next($self, -1);
return 1; return 1;
} elsif ($char eq 'N') { } elsif ($char eq 'j') {
select_next($self, 1); select_next($self, 1);
return 1; return 1;
} }
@ -232,6 +227,7 @@ sub refresh {
() ()
} }
sub activate { sub activate {
my ($self) = @_; my ($self) = @_;
@ -244,7 +240,6 @@ sub activate {
$self->enable( $self->enable(
key_press => \&key_press, key_press => \&key_press,
key_release => \&key_release,
refresh_begin => \&refresh, refresh_begin => \&refresh,
refresh_end => \&refresh, refresh_end => \&refresh,
); );
@ -256,7 +251,7 @@ sub activate {
sub deactivate { sub deactivate {
my ($self) = @_; my ($self) = @_;
$self->disable("key_press", "key_release", "refresh_begin", "refresh_end"); $self->disable("key_press", "refresh_begin", "refresh_end");
$self->view_start($self->{view_start}); $self->view_start($self->{view_start});
$self->pty_ev_events($self->{pty_ev_events}); $self->pty_ev_events($self->{pty_ev_events});