From: root Date: Fri, 20 Jan 2006 15:40:39 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=132eef98d8c56b7681adaf5041af44e123328ce2;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/src/perl/tabbed b/src/perl/tabbed index ecc9db32..c646775d 100644 --- a/src/perl/tabbed +++ b/src/perl/tabbed @@ -8,33 +8,36 @@ sub refresh { my $text = " " x $ncol; my $rend = [(urxvt::DEFAULT_RSTYLE | urxvt::RS_RVid) x $ncol]; - my $txt; - my $ofs = 0; my @ofs; + substr $text, 0, 7, "[NEW] |"; + @$rend[0 .. 5] = (urxvt::OVERLAY_RSTYLE) x 6; + push @ofs, [0, 6, sub { $_[0]->new_tab }]; + + my $ofs = 7; + my $idx = 0; + for my $tab (@{ $self->{tabs} }) { - my $txt = " $tab->{name} "; + $idx++; + + my $txt = " $idx "; my $len = length $txt; substr $text, $ofs, $len + 1, "$txt|"; - @$rend[$ofs .. $ofs + $len - 1] = (urxvt::OVERLAY_RSTYLE) x $len; + @$rend[$ofs .. $ofs + $len - 1] = (urxvt::OVERLAY_RSTYLE) x $len + if $tab == $self->{cur}; - push @ofs, [ - $ofs, - $ofs + $len, - sub { - my ($self, $event) = @_; - $self->make_current ($tab); - }, - ]; + push @ofs, [ $ofs, $ofs + $len, sub { $_[0]->make_current ($tab) } ]; $ofs += $len + 1; } $self->{tabofs} = \@ofs; - $self->ROW_t (0, $text); - $self->ROW_r (0, $rend); + $self->ROW_t (0, $text, 0, 0, $ncol); + $self->ROW_r (0, $rend, 0, 0, $ncol); + + $self->want_refresh; } sub new_tab { @@ -95,16 +98,15 @@ sub make_current { my ($self, $tab) = @_; if (my $cur = $self->{cur}) { - $cur->XUnmapWindow ($cur->parent) - if $cur->mapped; + $cur->XUnmapWindow ($cur->parent) if $cur->mapped; + $cur->focus_out; } $self->{cur} = $tab; $self->configure; - + $tab->focus_in; $tab->XMapWindow ($tab->parent); - $self->refresh; () @@ -156,9 +158,6 @@ sub on_start { $self->{tabheight} = $self->int_bwidth + $self->fheight + $self->lineSpace; - $self->cmd_parse ("\x1b[?25l\x1b[?7l"); - $self->new_tab; - $self->new_tab; $self->new_tab; () @@ -185,7 +184,7 @@ sub tab_start { push @{ $self->{tabs} }, $tab; - $tab->{name} ||= scalar @{ $self->{tabs} }; +# $tab->{name} ||= scalar @{ $self->{tabs} }; $self->make_current ($tab); () @@ -200,6 +199,8 @@ sub tab_destroy { if ($self->{cur} == $tab) { delete $self->{cur}; $self->make_current ($self->{tabs}[-1]); + } else { + $self->refresh; } } else { # delay destruction a tiny bit diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index 5150efd1..eb0ebe6d 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -1205,6 +1205,12 @@ rxvt_term::view_start (int newval = 1) OUTPUT: RETVAL +void +rxvt_term::focus_in () + +void +rxvt_term::focus_out () + void rxvt_term::want_refresh () CODE: @@ -1237,7 +1243,7 @@ rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start int len = min (wcslen (wstr) - start_ofs, max_len); - if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) + if (start_col < 0 || start_col + len > THIS->ncol) { free (wstr); croak ("new_text extends beyond horizontal margins"); @@ -1281,7 +1287,7 @@ rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start AV *av = (AV *)SvRV (new_rend); int len = min (AvFILL (av) + 1 - start_ofs, max_len); - if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) + if (start_col < 0 || start_col + len > THIS->ncol) croak ("new_rend array extends beyond horizontal margins"); for (int col = start_col; col < start_col + len; col++)