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 {
my ($self, $dir) = @_;
my ($self, $dir, $pattern) = @_;
my ($cr, $cc) = $self->screen_cur();
my $line = $self->line($cr);
my $found = 0;
$pattern = "\Q$self->{move_char}\E" unless $pattern;
if ($dir > 0 && $self->{offset} < $line->l - 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;
$found = 1;
}
} elsif ($dir < 0 && $self->{offset} > 0) {
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);
$found = 1;
}
@ -328,7 +330,7 @@ sub status_area {
}
$stat = "$extra $stat" if $extra;
$stat_len = length($stat) + 2;
$stat_len = length($stat);
if (!$self->{overlay} || $self->{overlay_len} != $stat_len) {
delete $self->{overlay} if $self->{overlay};
@ -337,7 +339,7 @@ sub status_area {
$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();
()

View File

@ -239,7 +239,7 @@ sub status_area {
($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) {
delete $self->{overlay} if $self->{overlay};
@ -248,7 +248,7 @@ sub status_area {
$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();
()