made status area more compact
This commit is contained in:
parent
e7a100229b
commit
07623a60fc
@ -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;
|
||||||
}
|
}
|
||||||
@ -328,7 +330,7 @@ sub status_area {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$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();
|
||||||
|
|
||||||
()
|
()
|
||||||
|
@ -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();
|
||||||
|
|
||||||
()
|
()
|
||||||
|
Loading…
Reference in New Issue
Block a user