… | |
… | |
780 | |
780 | |
781 | bless { |
781 | bless { |
782 | term => $self, |
782 | term => $self, |
783 | beg => $beg, |
783 | beg => $beg, |
784 | end => $end, |
784 | end => $end, |
|
|
785 | ncol => $self->ncol, |
785 | len => ($end - $beg) * $self->ncol + $self->ROW_l ($end), |
786 | len => ($end - $beg) * $self->ncol + $self->ROW_l ($end), |
786 | }, urxvt::line:: |
787 | }, urxvt::line:: |
787 | } |
788 | } |
788 | |
789 | |
789 | sub urxvt::line::t { |
790 | sub urxvt::line::t { |
790 | my ($self) = @_; |
791 | my ($self) = @_; |
791 | |
792 | |
|
|
793 | if (@_ > 1) |
|
|
794 | { |
|
|
795 | $self->{term}->ROW_t ($_, $_[1], 0, ($_ - $self->{beg}) * $self->{ncol}, $self->{ncol}) |
|
|
796 | for $self->{beg} .. $self->{end}; |
|
|
797 | } |
|
|
798 | |
|
|
799 | defined wantarray && |
792 | substr +(join "", map $self->{term}->ROW_t ($_), $self->{beg} .. $self->{end}), |
800 | substr +(join "", map $self->{term}->ROW_t ($_), $self->{beg} .. $self->{end}), |
793 | 0, $self->{len} |
801 | 0, $self->{len} |
794 | } |
802 | } |
795 | |
803 | |
796 | sub urxvt::line::r { |
804 | sub urxvt::line::r { |
797 | my ($self) = @_; |
805 | my ($self) = @_; |
798 | |
806 | |
|
|
807 | if (@_ > 1) |
|
|
808 | { |
|
|
809 | $self->{term}->ROW_r ($_, $_[1], 0, ($_ - $self->{beg}) * $self->{ncol}, $self->{ncol}) |
|
|
810 | for $self->{beg} .. $self->{end}; |
|
|
811 | } |
|
|
812 | |
|
|
813 | if (defined wantarray) { |
799 | my $rend = [ |
814 | my $rend = [ |
800 | map @{ $self->{term}->ROW_r ($_) }, $self->{beg} .. $self->{end} |
815 | map @{ $self->{term}->ROW_r ($_) }, $self->{beg} .. $self->{end} |
801 | ]; |
816 | ]; |
802 | $#$rend = $self->{len} - 1; |
817 | $#$rend = $self->{len} - 1; |
803 | $rend |
818 | return $rend; |
|
|
819 | } |
|
|
820 | |
|
|
821 | () |
804 | } |
822 | } |
805 | |
823 | |
806 | sub urxvt::line::beg { $_[0]{beg} } |
824 | sub urxvt::line::beg { $_[0]{beg} } |
807 | sub urxvt::line::end { $_[0]{end} } |
825 | sub urxvt::line::end { $_[0]{end} } |
808 | sub urxvt::line::l { $_[0]{len} } |
826 | sub urxvt::line::l { $_[0]{len} } |
809 | |
827 | |
810 | sub urxvt::line::offset_of { |
828 | sub urxvt::line::offset_of { |
811 | my ($self, $row, $col) = @_; |
829 | my ($self, $row, $col) = @_; |
812 | |
830 | |
813 | ($row - $self->{beg}) * $self->{term}->ncol + $col |
831 | ($row - $self->{beg}) * $self->{ncol} + $col |
814 | } |
832 | } |
815 | |
833 | |
816 | sub urxvt::line::coord_of { |
834 | sub urxvt::line::coord_of { |
817 | my ($self, $offset) = @_; |
835 | my ($self, $offset) = @_; |
818 | |
836 | |
819 | use integer; |
837 | use integer; |
820 | |
838 | |
821 | ( |
839 | ( |
822 | $offset / $self->{term}->ncol + $self->{beg}, |
840 | $offset / $self->{ncol} + $self->{beg}, |
823 | $offset % $self->{term}->ncol |
841 | $offset % $self->{ncol} |
824 | ) |
842 | ) |
825 | } |
843 | } |
826 | |
844 | |
827 | =item ($row, $col) = $line->coord_of ($offset) |
845 | =item ($row, $col) = $line->coord_of ($offset) |
828 | =item $text = $term->special_encode $string |
846 | =item $text = $term->special_encode $string |