made status area more compact

This commit is contained in:
Bert 2010-08-20 20:02:41 +02:00
parent e7a100229b
commit 07623a60fc
2 changed files with 12 additions and 10 deletions

View File

@ -179,20 +179,22 @@ sub move_cursor {
sub move_to { sub move_to {
my ($self, $dir) = @_; my ($self, $dir, $pattern) = @_;
my ($cr, $cc) = $self->screen_cur(); my ($cr, $cc) = $self->screen_cur();
my $line = $self->line($cr); my $line = $self->line($cr);
my $found = 0; my $found = 0;
$pattern = "\Q$self->{move_char}\E" unless $pattern;
if ($dir > 0 && $self->{offset} < $line->l - 1) { if ($dir > 0 && $self->{offset} < $line->l - 1) {
my $text = substr($line->t, $self->{offset} + 1); my $text = substr($line->t, $self->{offset} + 1);
if ($text =~ m/\Q$self->{move_char}\E/) { if ($text =~ m/$pattern/) {
$self->{offset} += $-[0] + 1; $self->{offset} += $-[0] + 1;
$found = 1; $found = 1;
} }
} elsif ($dir < 0 && $self->{offset} > 0) { } elsif ($dir < 0 && $self->{offset} > 0) {
my $text = substr($line->t, 0, $self->{offset}); my $text = substr($line->t, 0, $self->{offset});
if ($text =~ m/.*(\Q$self->{move_char}\E)/) { if ($text =~ m/.*($pattern)/) {
$self->{offset} += $-[1] - length($text); $self->{offset} += $-[1] - length($text);
$found = 1; $found = 1;
} }
@ -313,7 +315,7 @@ sub status_area {
my ($stat, $stat_len); my ($stat, $stat_len);
if ($self->{select}) { if ($self->{select}) {
$stat = "-V" . ($self->{select} ne 'n' ? uc($self->{select}) : "") . "- "; $stat = "-V" . ($self->{select} ne 'n' ? uc($self->{select}) : "") . "- ";
} }
if ($self->top_row == 0) { if ($self->top_row == 0) {
@ -327,8 +329,8 @@ sub status_area {
($self->top_row - $self->view_start) * 100 / $self->top_row); ($self->top_row - $self->view_start) * 100 / $self->top_row);
} }
$stat = "$extra $stat" if $extra; $stat = "$extra $stat" if $extra;
$stat_len = length($stat) + 2; $stat_len = length($stat);
if (!$self->{overlay} || $self->{overlay_len} != $stat_len) { if (!$self->{overlay} || $self->{overlay_len} != $stat_len) {
delete $self->{overlay} if $self->{overlay}; delete $self->{overlay} if $self->{overlay};
@ -337,7 +339,7 @@ sub status_area {
$self->{overlay_len} = $stat_len; $self->{overlay_len} = $stat_len;
} }
$self->{overlay}->set(1, 0, $self->special_encode($stat)); $self->{overlay}->set(0, 0, $self->special_encode($stat));
$self->{overlay}->show(); $self->{overlay}->show();
() ()

View File

@ -226,7 +226,7 @@ sub status_area {
my $row = $self->{row} < 0 ? my $row = $self->{row} < 0 ?
$self->{row} - $self->top_row : abs($self->top_row) + $self->{row}; $self->{row} - $self->top_row : abs($self->top_row) + $self->{row};
my $text = sprintf("%d,%d ", $row + 1, $self->{n} + 1); my $text = sprintf("%d,%d ", $row + 1, $self->{n} + 1);
if ($self->top_row == 0) { if ($self->top_row == 0) {
$text .= "All"; $text .= "All";
@ -239,7 +239,7 @@ sub status_area {
($self->top_row - $self->view_start) * 100 / $self->top_row); ($self->top_row - $self->view_start) * 100 / $self->top_row);
} }
my $text_len = length($text) + 2; my $text_len = length($text);
if ($self->{overlay_len} != $text_len) { if ($self->{overlay_len} != $text_len) {
delete $self->{overlay} if $self->{overlay}; delete $self->{overlay} if $self->{overlay};
@ -248,7 +248,7 @@ sub status_area {
$self->{overlay_len} = $text_len; $self->{overlay_len} = $text_len;
} }
$self->{overlay}->set(1, 0, $self->special_encode($text)); $self->{overlay}->set(0, 0, $self->special_encode($text));
$self->{overlay}->show(); $self->{overlay}->show();
() ()