--- rxvt-unicode/src/urxvt.pm 2006/01/03 20:47:36 1.24 +++ rxvt-unicode/src/urxvt.pm 2006/01/04 21:37:55 1.32 @@ -41,8 +41,10 @@ =item selection -Intelligent selection. This etxension tries to be more intelligent when the user -extends selections (double-click). +Intelligent selection. This extension tries to be more intelligent when +the user extends selections (double-click). Right now, it tries to select +urls and complete shell-quoted arguments, which is very convenient, too, +if your F supports C<--quoting-style=shell>. It also offers the following bindable event: @@ -172,6 +174,19 @@ Called whenever the program(s) running in the urxvt window send output. +=item on_osc_seq $term, $string + +Called whenever the B command sequence (OSC = +operating system command) is processed. Cursor position and other state +information is up-to-date when this happens. For interoperability, the +string should start with the extension name and a colon, to distinguish +it from commands for other extensions, and this might be enforced in the +future. + +Be careful not ever to trust (in a security sense) the data you receive, +as its source can not easily be controleld (e-mail content, messages from +other users on the same system etc.). + =item on_refresh_begin $term Called just before the screen gets redrawn. Can be used for overlay @@ -353,6 +368,8 @@ } } +our $retval; # return value for urxvt + # called by the rxvt core sub invoke { local $TERM = shift; @@ -361,7 +378,7 @@ if ($htype == 0) { # INIT my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl"); - for my $ext (split /:/, $TERM->resource ("perl_ext")) { + for my $ext (map { split /:/, $TERM->resource ("perl_ext_$_") } 1, 2) { my @files = grep -f $_, map "$_/$ext", @dirs; if (@files) { @@ -370,35 +387,45 @@ warn "perl extension '$ext' not found in perl library search path\n"; } } + } + + $retval = undef; - } elsif ($htype == 1) { # DESTROY + if (my $cb = $TERM->{_hook}[$htype]) { + verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" + if $verbosity >= 10; + + keys %$cb; + + while (my ($pkg, $cb) = each %$cb) { + $retval = $cb->( + $TERM->{_pkg}{$pkg} ||= do { + my $proxy = bless { }, urxvt::term::proxy::; + Scalar::Util::weaken ($proxy->{term} = $TERM); + $proxy + }, + @_, + ) and last; + } + } + + if ($htype == 1) { # DESTROY + # remove hooks if unused if (my $hook = $TERM->{_hook}) { for my $htype (0..$#$hook) { $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } or set_should_invoke $htype, 0; } } - } - my $cb = $TERM->{_hook}[$htype] - or return; + # clear package objects + %$_ = () for values %{ $TERM->{_pkg} }; - verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" - if $verbosity >= 10; - - while (my ($pkg, $cb) = each %$cb) { - return 1 - if $cb->( - $TERM->{$pkg} ||= do { - my $proxy = bless { }, urxvt::term::proxy::; - Scalar::Util::weaken ($proxy->{term} = $TERM); - $proxy - }, - @_, - ); + # clear package + %$TERM = (); } - 0 + $retval } sub urxvt::term::proxy::AUTOLOAD { @@ -446,7 +473,7 @@ display_name embed ext_bwidth fade font geometry hold iconName imFont imLocale inputMethod insecure int_bwidth intensityStyles italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier - mouseWheelScrollPage name pastableTabs path perl_eval perl_ext + mouseWheelScrollPage name pastableTabs path perl_eval perl_ext_1 perl_ext_2 perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput @@ -462,6 +489,16 @@ goto &urxvt::term::_resource; } +=item $rend = $term->screen_rstyle ([$new_rstyle]) + +Return and optionally change the current rendition. Text thta is output by +the temrianl application will use this style. + +=item ($row, $col) = $term->screen_cur ([$row, $col]) + +Return the current coordinates of the text cursor position and optionally +set it (which is usually bad as applications don't expect that). + =item ($row, $col) = $term->selection_mark ([$row, $col]) =item ($row, $col) = $term->selection_beg ([$row, $col]) @@ -555,16 +592,31 @@ pass characters instead of octets, you should convert your strings first to the locale-specific encoding using C<< $term->locale_encode >>. -=item $nrow = $term->nrow +=item $window_width = $term->width + +=item $window_height = $term->height + +=item $font_width = $term->fwidth + +=item $font_height = $term->fheight + +=item $font_ascent = $term->fbase + +=item $terminal_rows = $term->nrow + +=item $terminal_columns = $term->ncol + +=item $has_focus = $term->focus + +=item $is_mapped = $term->mapped -=item $ncol = $term->ncol +=item $max_scrollback = $term->saveLines -Return the number of rows/columns of the terminal window (i.e. as -specified by C<-geometry>, excluding any scrollback). +=item $nrow_plus_saveLines = $term->total_rows -=item $nsaved = $term->nsaved +=item $lines_in_scrollback = $term->nsaved -Returns the number of lines in the scrollback buffer. +Return various integers describing terminal characteristics. =item $view_start = $term->view_start ([$newvalue]) @@ -848,11 +900,11 @@ =over 4 -=item 0 - only fatal messages +=item =0 - only fatal messages -=item 3 - script loading and management +=item =3 - script loading and management -=item 10 - all events received +=item =10 - all events received =back