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.77 by root, Wed Jan 11 00:59:58 2006 UTC vs.
Revision 1.86 by root, Thu Jan 12 05:22:47 2006 UTC

84 84
85Displays a digital clock using the built-in overlay. 85Displays a digital clock using the built-in overlay.
86 86
87=item mark-urls 87=item mark-urls
88 88
89Uses per-line display filtering (C<on_line_update>) to underline urls. 89Uses per-line display filtering (C<on_line_update>) to underline urls and
90make them clickable. When middle-clicked, the program specified in the
91resource C<urlLauncher> (default C<x-www-browser>) will be started.
90 92
91=item block-graphics-to-ascii 93=item block-graphics-to-ascii
92 94
93A not very useful example of filtering all text output to the terminal, 95A not very useful example of filtering all text output to the terminal,
94by replacing all line-drawing characters (U+2500 .. U+259F) by a 96by replacing all line-drawing characters (U+2500 .. U+259F) by a
123=over 4 125=over 4
124 126
125=item $text 127=item $text
126 128
127Rxvt-unicodes special way of encoding text, where one "unicode" character 129Rxvt-unicodes special way of encoding text, where one "unicode" character
128always represents one screen cell. See L<row_t> for a discussion of this format. 130always represents one screen cell. See L<ROW_t> for a discussion of this format.
129 131
130=item $string 132=item $string
131 133
132A perl text string, with an emphasis on I<text>. It can store all unicode 134A perl text string, with an emphasis on I<text>. It can store all unicode
133characters and is to be distinguished with text encoded in a specific 135characters and is to be distinguished with text encoded in a specific
228=item on_sel_extend $term 230=item on_sel_extend $term
229 231
230Called whenever the user tries to extend the selection (e.g. with a double 232Called whenever the user tries to extend the selection (e.g. with a double
231click) and is either supposed to return false (normal operation), or 233click) and is either supposed to return false (normal operation), or
232should extend the selection itelf and return true to suppress the built-in 234should extend the selection itelf and return true to suppress the built-in
233processing. 235processing. This can happen multiple times, as long as the callback
236returns true, it will be called on every further click by the user and is
237supposed to enlarge the selection more and more, if possible.
234 238
235See the F<selection> example extension. 239See the F<selection> example extension.
236 240
237=item on_view_change $term, $offset 241=item on_view_change $term, $offset
238 242
385 389
386=item $urxvt::TERM 390=item $urxvt::TERM
387 391
388The current terminal. This variable stores the current C<urxvt::term> 392The current terminal. This variable stores the current C<urxvt::term>
389object, whenever a callback/hook is executing. 393object, whenever a callback/hook is executing.
390
391=item
392 394
393=back 395=back
394 396
395=head2 Functions in the C<urxvt> Package 397=head2 Functions in the C<urxvt> Package
396 398
496 $msg .= "\n" 498 $msg .= "\n"
497 unless $msg =~ /\n$/; 499 unless $msg =~ /\n$/;
498 urxvt::warn ($msg); 500 urxvt::warn ($msg);
499 }; 501 };
500 502
503 # %ENV is the original startup environment
501 delete $ENV{IFS}; 504 delete $ENV{IFS};
502 delete $ENV{CDPATH}; 505 delete $ENV{CDPATH};
503 delete $ENV{BASH_ENV}; 506 delete $ENV{BASH_ENV};
504 $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin"; 507 $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin";
505} 508}
594 if ($@) { 597 if ($@) {
595 $TERM->ungrab; # better to lose the grab than the session 598 $TERM->ungrab; # better to lose the grab than the session
596 warn $@; 599 warn $@;
597 } 600 }
598 } 601 }
602
603 verbose 11, "$HOOKNAME[$htype] returning <$retval>"
604 if $verbosity >= 11;
599 } 605 }
600 606
601 if ($htype == 1) { # DESTROY 607 if ($htype == 1) { # DESTROY
602 if (my $hook = delete $TERM->{_hook}) { 608 if (my $hook = delete $TERM->{_hook}) {
603 for my $htype (0..$#$hook) { 609 for my $htype (0..$#$hook) {
612 # clear package 618 # clear package
613 %$TERM = (); 619 %$TERM = ();
614 } 620 }
615 621
616 $retval 622 $retval
623}
624
625sub exec_async(@) {
626 my $pid = fork;
627
628 return
629 if !defined $pid or $pid;
630
631 %ENV = %{ $TERM->env };
632
633 exec @_;
634 _exit 255;
617} 635}
618 636
619# urxvt::term::extension 637# urxvt::term::extension
620 638
621package urxvt::term::extension; 639package urxvt::term::extension;
782} 800}
783 801
784=item $term = new urxvt::term $envhashref, $rxvtname, [arg...] 802=item $term = new urxvt::term $envhashref, $rxvtname, [arg...]
785 803
786Creates a new terminal, very similar as if you had started it with system 804Creates a new terminal, very similar as if you had started it with system
787C<$rxvtname, arg...>. C<$envhashref> must be a reference to a %ENV>-like 805C<$rxvtname, arg...>. C<$envhashref> must be a reference to a C<%ENV>-like
788C<hash which defines the environment of the new terminal. 806hash which defines the environment of the new terminal.
789 807
790Croaks (and probably outputs an error message) if the new instance 808Croaks (and probably outputs an error message) if the new instance
791couldn't be created. Returns C<undef> if the new instance didn't 809couldn't be created. Returns C<undef> if the new instance didn't
792initialise perl, and the terminal object otherwise. The C<init> and 810initialise perl, and the terminal object otherwise. The C<init> and
793C<start> hooks will be called during this call. 811C<start> hooks will be called during this call.
862 my ($self, $name) = (shift, shift); 880 my ($self, $name) = (shift, shift);
863 unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); 881 unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0);
864 &urxvt::term::_resource 882 &urxvt::term::_resource
865} 883}
866 884
885=item $value = $term->x_resource ($pattern)
886
887Returns the X-Resource for the given pattern, excluding the program or
888class name, i.e. C<< $term->x_resource ("boldFont") >> should return the
889same value as used by this instance of rxvt-unicode. Returns C<undef> if no
890resource with that pattern exists.
891
892This method should only be called during the C<on_start> hook, as there is
893only one resource database per display, and later invocations might return
894the wrong resources.
895
867=item $success = $term->parse_keysym ($keysym_spec, $command_string) 896=item $success = $term->parse_keysym ($keysym_spec, $command_string)
868 897
869Adds a keymap translation exactly as specified via a resource. See the 898Adds a keymap translation exactly as specified via a resource. See the
870C<keysym> resource in the @@RXVT_NAME@@(1) manpage. 899C<keysym> resource in the @@RXVT_NAME@@(1) manpage.
871 900
886=item ($row, $col) = $term->selection_end ([$row, $col]) 915=item ($row, $col) = $term->selection_end ([$row, $col])
887 916
888Return the current values of the selection mark, begin or end positions, 917Return the current values of the selection mark, begin or end positions,
889and optionally set them to new values. 918and optionally set them to new values.
890 919
920=item $term->selection_make ($eventtime[, $rectangular])
921
922Tries to make a selection as set by C<selection_beg> and
923C<selection_end>. If C<$rectangular> is true (default: false), a
924rectangular selection will be made. This is the prefered function to make
925a selection.
926
891=item $success = $term->selection_grab ($eventtime) 927=item $success = $term->selection_grab ($eventtime)
892 928
893Try to request the primary selection from the server (for example, as set 929Try to request the primary selection text from the server (for example, as
894by the next method). 930set by the next method). No visual feedback will be given. This function
931is mostly useful from within C<on_sel_grab> hooks.
895 932
896=item $oldtext = $term->selection ([$newtext]) 933=item $oldtext = $term->selection ([$newtext])
897 934
898Return the current selection text and optionally replace it by C<$newtext>. 935Return the current selection text and optionally replace it by C<$newtext>.
899 936
992Convert the given locale-encoded octets into a perl string. 1029Convert the given locale-encoded octets into a perl string.
993 1030
994=item $term->scr_xor_span ($beg_row, $beg_col, $end_row, $end_col[, $rstyle]) 1031=item $term->scr_xor_span ($beg_row, $beg_col, $end_row, $end_col[, $rstyle])
995 1032
996XORs the rendition values in the given span with the provided value 1033XORs the rendition values in the given span with the provided value
997(default: C<RS_RVid>). Useful in refresh hooks to provide effects similar 1034(default: C<RS_RVid>), which I<MUST NOT> contain font styles. Useful in
998to the selection. 1035refresh hooks to provide effects similar to the selection.
999 1036
1000=item $term->scr_xor_rect ($beg_row, $beg_col, $end_row, $end_col[, $rstyle1[, $rstyle2]]) 1037=item $term->scr_xor_rect ($beg_row, $beg_col, $end_row, $end_col[, $rstyle1[, $rstyle2]])
1001 1038
1002Similar to C<scr_xor_span>, but xors a rectangle instead. Trailing 1039Similar to C<scr_xor_span>, but xors a rectangle instead. Trailing
1003whitespace will additionally be xored with the C<$rstyle2>, which defaults 1040whitespace will additionally be xored with the C<$rstyle2>, which defaults
1004to C<RS_RVid | RS_Uline>, which removes reverse video again and underlines 1041to C<RS_RVid | RS_Uline>, which removes reverse video again and underlines
1005it instead. 1042it instead. Both styles I<MUST NOT> contain font styles.
1006 1043
1007=item $term->scr_bell 1044=item $term->scr_bell
1008 1045
1009Ring the bell! 1046Ring the bell!
1010 1047
1194Return the row number of the first/last row of the line, respectively. 1231Return the row number of the first/last row of the line, respectively.
1195 1232
1196=item $offset = $line->offset_of ($row, $col) 1233=item $offset = $line->offset_of ($row, $col)
1197 1234
1198Returns the character offset of the given row|col pair within the logical 1235Returns the character offset of the given row|col pair within the logical
1199line. 1236line. Works for rows outside the line, too, and returns corresponding
1237offsets outside the string.
1200 1238
1201=item ($row, $col) = $line->coord_of ($offset) 1239=item ($row, $col) = $line->coord_of ($offset)
1202 1240
1203Translates a string offset into terminal coordinates again. 1241Translates a string offset into terminal coordinates again.
1204 1242
1441 my ($self) = @_; 1479 my ($self) = @_;
1442 1480
1443 delete $self->{term}{_destroy}{$self}; 1481 delete $self->{term}{_destroy}{$self};
1444 $self->{term}->ungrab; 1482 $self->{term}->ungrab;
1445} 1483}
1484
1485=back
1446 1486
1447=head2 The C<urxvt::timer> Class 1487=head2 The C<urxvt::timer> Class
1448 1488
1449This class implements timer watchers/events. Time is represented as a 1489This class implements timer watchers/events. Time is represented as a
1450fractional number of seconds since the epoch. Example: 1490fractional number of seconds since the epoch. Example:
1557 1597
1558=item == 0 - fatal messages 1598=item == 0 - fatal messages
1559 1599
1560=item >= 3 - script loading and management 1600=item >= 3 - script loading and management
1561 1601
1562=item >=10 - all events received 1602=item >=10 - all called hooks
1603
1604=item >=11 - hook reutrn values
1563 1605
1564=back 1606=back
1565 1607
1566=head1 AUTHOR 1608=head1 AUTHOR
1567 1609

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines