ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/urxvt.pm
(Generate patch)

Comparing rxvt-unicode/src/urxvt.pm (file contents):
Revision 1.23 by root, Tue Jan 3 19:42:53 2006 UTC vs.
Revision 1.28 by root, Wed Jan 4 00:09:12 2006 UTC

39 39
40=over 4 40=over 4
41 41
42=item selection 42=item selection
43 43
44Intelligent selection. This etxension tries to be more intelligent when the user 44Intelligent selection. This extension tries to be more intelligent when
45extends selections (double-click). 45the user extends selections (double-click). Right now, it tries to select
46urls and complete shell-quoted arguments, which is very convenient, too,
47if your F<ls> supports C<--quoting-style=shell>.
46 48
47It also offers the following bindable event: 49It also offers the following bindable event:
48 50
49=over 4 51=over 4
50 52
169number of lines that will be in the scrollback buffer. 171number of lines that will be in the scrollback buffer.
170 172
171=item on_tty_activity $term *NYI* 173=item on_tty_activity $term *NYI*
172 174
173Called whenever the program(s) running in the urxvt window send output. 175Called whenever the program(s) running in the urxvt window send output.
176
177=item on_osc_seq $term, $string
178
179Called whenever the B<ESC ] 777 ; string ST> command sequence is
180processed. Cursor position and other state information is up-to-date when
181this happens. For interoperability, the string should start with the
182extension name and a colon, to distinguish it from commands for other
183extensions, and this might be enforced in the future.
174 184
175=item on_refresh_begin $term 185=item on_refresh_begin $term
176 186
177Called just before the screen gets redrawn. Can be used for overlay 187Called just before the screen gets redrawn. Can be used for overlay
178or similar effects by modify terminal contents in refresh_begin, and 188or similar effects by modify terminal contents in refresh_begin, and
383 my $cb = $TERM->{_hook}[$htype] 393 my $cb = $TERM->{_hook}[$htype]
384 or return; 394 or return;
385 395
386 verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" 396 verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")"
387 if $verbosity >= 10; 397 if $verbosity >= 10;
398
399 keys %$cb;
388 400
389 while (my ($pkg, $cb) = each %$cb) { 401 while (my ($pkg, $cb) = each %$cb) {
390 return 1 402 return 1
391 if $cb->( 403 if $cb->(
392 $TERM->{$pkg} ||= do { 404 $TERM->{$pkg} ||= do {
405 $urxvt::term::proxy::AUTOLOAD =~ /:([^:]+)$/ 417 $urxvt::term::proxy::AUTOLOAD =~ /:([^:]+)$/
406 or die "FATAL: \$AUTOLOAD '$urxvt::term::proxy::AUTOLOAD' unparsable"; 418 or die "FATAL: \$AUTOLOAD '$urxvt::term::proxy::AUTOLOAD' unparsable";
407 419
408 eval qq{ 420 eval qq{
409 sub $urxvt::term::proxy::AUTOLOAD { 421 sub $urxvt::term::proxy::AUTOLOAD {
410 unshift \@_, shift->{term}; 422 my \$proxy = shift;
411 goto &urxvt::term::$1; 423 \$proxy->{term}->$1 (\@_)
412 } 424 }
413 1 425 1
414 } or die "FATAL: unable to compile method forwarder: $@"; 426 } or die "FATAL: unable to compile method forwarder: $@";
415 427
416 goto &$urxvt::term::proxy::AUTOLOAD; 428 goto &$urxvt::term::proxy::AUTOLOAD;
583=item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) 595=item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]])
584 596
585Returns the text of the entire row with number C<$row_number>. Row C<0> 597Returns the text of the entire row with number C<$row_number>. Row C<0>
586is the topmost terminal line, row C<< $term->$ncol-1 >> is the bottommost 598is the topmost terminal line, row C<< $term->$ncol-1 >> is the bottommost
587terminal line. The scrollback buffer starts at line C<-1> and extends to 599terminal line. The scrollback buffer starts at line C<-1> and extends to
588line C<< -$term->nsaved >>. 600line C<< -$term->nsaved >>. Nothing will be returned if a nonexistent line
601is requested.
589 602
590If C<$new_text> is specified, it will replace characters in the current 603If C<$new_text> is specified, it will replace characters in the current
591line, starting at column C<$start_col> (default C<0>), which is useful 604line, starting at column C<$start_col> (default C<0>), which is useful
592to replace only parts of a line. The font index in the rendition will 605to replace only parts of a line. The font index in the rendition will
593automatically be updated. 606automatically be updated.
615 628
616See the section on RENDITION, above. 629See the section on RENDITION, above.
617 630
618=item $length = $term->ROW_l ($row_number[, $new_length]) 631=item $length = $term->ROW_l ($row_number[, $new_length])
619 632
620Returns the number of screen cells that are in use ("the line length"). If 633Returns the number of screen cells that are in use ("the line
621it is C<-1>, then the line is part of a multiple-row logical "line", which 634length"). Unlike the urxvt core, this returns C<< $term->ncol >> if the
622means all characters are in use and it is continued on the next row. 635line is joined with the following one.
623 636
637=item $bool = $term->is_longer ($row_number)
638
639Returns true if the row is part of a multiple-row logical "line" (i.e.
640joined with the following row), which means all characters are in use
641and it is continued on the next row (and possibly a continuation of the
642previous row(s)).
643
644=item $line = $term->line ($row_number)
645
646Create and return a new C<urxvt::line> object that stores information
647about the logical line that row C<$row_number> is part of. It supports the
648following methods:
649
650=over 4
651
652=item $text = $line->t
653
654Returns the full text of the line, similar to C<ROW_t>
655
656=item $rend = $line->r
657
658Returns the full rendition array of the line, similar to C<ROW_r>
659
660=item $length = $line->l
661
662Returns the length of the line in cells, similar to C<ROW_l>.
663
664=item $rownum = $line->beg
665
666=item $rownum = $line->end
667
668Return the row number of the first/last row of the line, respectively.
669
670=item $offset = $line->offset_of ($row, $col)
671
672Returns the character offset of the given row|col pair within the logical
673line.
674
675=item ($row, $col) = $line->coord_of ($offset)
676
677Translates a string offset into terminal coordinates again.
678
679=back
680
681=cut
682
683sub urxvt::term::line {
684 my ($self, $row) = @_;
685
686 my $maxrow = $self->nrow - 1;
687
688 my ($beg, $end) = ($row, $row);
689
690 --$beg while $self->ROW_is_longer ($beg - 1);
691 ++$end while $self->ROW_is_longer ($end) && $end < $maxrow;
692
693 bless {
694 term => $self,
695 beg => $beg,
696 end => $end,
697 len => ($end - $beg) * $self->ncol + $self->ROW_l ($end),
698 }, urxvt::line::
699}
700
701sub urxvt::line::t {
702 my ($self) = @_;
703
704 substr +(join "", map $self->{term}->ROW_t ($_), $self->{beg} .. $self->{end}),
705 0, $self->{len}
706}
707
708sub urxvt::line::r {
709 my ($self) = @_;
710
711 my $rend = [
712 map @{ $self->{term}->ROW_r ($_) }, $self->{beg} .. $self->{end}
713 ];
714 $#$rend = $self->{len} - 1;
715 $rend
716}
717
718sub urxvt::line::beg { $_[0]{beg} }
719sub urxvt::line::end { $_[0]{end} }
720sub urxvt::line::l { $_[0]{len} }
721
722sub urxvt::line::offset_of {
723 my ($self, $row, $col) = @_;
724
725 ($row - $self->{beg}) * $self->{term}->ncol + $col
726}
727
728sub urxvt::line::coord_of {
729 my ($self, $offset) = @_;
730
731 use integer;
732
733 (
734 $offset / $self->{term}->ncol + $self->{beg},
735 $offset % $self->{term}->ncol
736 )
737}
738
739=item ($row, $col) = $line->coord_of ($offset)
624=item $text = $term->special_encode $string 740=item $text = $term->special_encode $string
625 741
626Converts a perl string into the special encoding used by rxvt-unicode, 742Converts a perl string into the special encoding used by rxvt-unicode,
627where one character corresponds to one screen cell. See 743where one character corresponds to one screen cell. See
628C<< $term->ROW_t >> for details. 744C<< $term->ROW_t >> for details.
742This variable controls the verbosity level of the perl extension. Higher 858This variable controls the verbosity level of the perl extension. Higher
743numbers indicate more verbose output. 859numbers indicate more verbose output.
744 860
745=over 4 861=over 4
746 862
747=item 0 - only fatal messages 863=item =0 - only fatal messages
748 864
749=item 3 - script loading and management 865=item =3 - script loading and management
750 866
751=item 10 - all events received 867=item =10 - all events received
752 868
753=back 869=back
754 870
755=head1 AUTHOR 871=head1 AUTHOR
756 872

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines