Merge remote branch 'origin/master'

Conflicts:
	keyboard-select
This commit is contained in:
Bert 2010-09-12 20:51:34 +02:00
commit 161a9d3eac

View File

@ -158,8 +158,7 @@ sub move_cursor {
} elsif ($key eq 'j' && $line->end < $self->nrow - 1) { } elsif ($key eq 'j' && $line->end < $self->nrow - 1) {
$cr = $line->end + 1; $cr = $line->end + 1;
} elsif ($key eq 'h' && $self->{offset} > 0) { } elsif ($key eq 'h' && $self->{offset} > 0) {
$self->{offset} = $line->l - 1 if $self->{offset} >= $line->l; $self->{offset} = $line->offset_of($cr, $cc) - 1;
--$self->{offset};
$self->{dollar} = 0; $self->{dollar} = 0;
} elsif ($key eq 'l' && $self->{offset} < $line->l - 1) { } elsif ($key eq 'l' && $self->{offset} < $line->l - 1) {
++$self->{offset}; ++$self->{offset};
@ -188,8 +187,9 @@ sub move_cursor {
$self->{offset} = $ltxt =~ m/^ +/ ? $+[0] : 0; $self->{offset} = $ltxt =~ m/^ +/ ? $+[0] : 0;
$self->{dollar} = 0; $self->{dollar} = 0;
} elsif ($key eq '$') { } elsif ($key eq '$') {
my $co = $line->offset_of($cr, $cc);
$self->{dollar} = $co + 1;
$self->{offset} = $line->l - 1; $self->{offset} = $line->l - 1;
$self->{dollar} = 1;
} elsif ($key eq 'H') { } elsif ($key eq 'H') {
$cr = $self->view_start(); $cr = $self->view_start();
} elsif ($key eq 'M') { } elsif ($key eq 'M') {
@ -199,9 +199,9 @@ sub move_cursor {
} }
$line = $self->line($cr); $line = $self->line($cr);
$self->{offset} = $line->l - 1 if $self->{dollar} or $cc = $self->{dollar} || $self->{offset} >= $line->l ? $line->l - 1 :
$self->{offset} >= $line->l; $self->{offset};
$self->screen_cur($line->coord_of($self->{offset})); $self->screen_cur($line->coord_of($cc));
status_area($self); status_area($self);
$self->want_refresh(); $self->want_refresh();
@ -335,11 +335,14 @@ sub refresh {
if ($self->{select} eq 'b') { if ($self->{select} eq 'b') {
delete $self->{selection} if $self->{selection}; delete $self->{selection} if $self->{selection};
my $co = $self->line($cr)->offset_of($cr, $cc);
my $dollar = $self->{dollar} && $co >= $self->{dollar} - 1;
my $r = $br; my $r = $br;
while ($r <= $er) { while ($r <= $er) {
my $line = $self->line($r); my $line = $self->line($r);
if ($bc < $line->l) { if ($bc < $line->l) {
$ec = $line->l if $self->{dollar}; $ec = $line->l if $dollar;
$self->{selection} .= substr($line->t, $bc, $ec - $bc); $self->{selection} .= substr($line->t, $bc, $ec - $bc);
my ($br, $bc) = $line->coord_of($bc); my ($br, $bc) = $line->coord_of($bc);
my ($er, $ec) = $line->coord_of($ec <= $line->l ? $ec : $line->l); my ($er, $ec) = $line->coord_of($ec <= $line->l ? $ec : $line->l);