Closed quite closed 8 years ago
On Mon, 2016-09-05 at 01:21:37 -0700, Daniel Lublin wrote:
I always end up checking that I have around 75-95 columns in my terminal after resizing the font. It would be great if the number of columns that the new font size results in would be displayed after a resize. Assuming it's feasible to get hold of this value. Urxvt has some kind of overlay text system that might be used for this, right? Only flashing the number for a second or so would be ideal I think.
Maybe it can be added to the URxvt.resize-font.show
display which
currently shows what size the font is at?
It's bound to ^?
by default.
Aha, well, not needing another keypress would be sweet ;)
$COLUMNS
and/or $LINES
didn't work.
Neither did stty size
.
Investigating the proper way using the Perl API now.
After thinking about this, I won't add this feature. It has "nothing" to do with resizing the font. If more people request it, I might change my mind.
How ever, I had much fun in coding this feature, so here is the code for a very small extension for doing exactly what you want. Just save this as show-size
and load it:
# vim:ft=perl:fenc=utf-8
# Re-bind to another key with:
# URxvt.keysym.C-9: perl:show-size:show
sub on_init {
my ($self) = @_;
$self->bind_action("C-9" => "%:show") or warn "Can't bind defaults";
()
}
# sub on_user_command {
sub on_action {
my ($self, $string) = @_;
if ($string eq "show") {
my $term = $self->{'term'};
my $rows = $self->nrow();
my $columns = $self->ncol();
$term->{'show-size'}{'overlay'} = {
ov => $term->overlay_simple(0, -1, "Columns: $columns Lines: $rows\n"),
to => urxvt::timer
->new
->start(urxvt::NOW + 1)
->cb(sub {
delete $term->{'show-size'}{'overlay'};
}),
};
}
()
}
Tack :)
I always end up checking that I have around 75-95 columns in my terminal after resizing the font. It would be great if the number of columns that the new font size results in would be displayed after a resize. Assuming it's feasible to get hold of this value. Urxvt has some kind of overlay text system that might be used for this, right? Only flashing the number for a second or so would be ideal I think.