--- rxvt-unicode/src/urxvt.pm 2006/01/04 00:12:12 1.29 +++ rxvt-unicode/src/urxvt.pm 2006/01/04 21:37:55 1.32 @@ -368,6 +368,8 @@ } } +our $retval; # return value for urxvt + # called by the rxvt core sub invoke { local $TERM = shift; @@ -376,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) { @@ -385,37 +387,45 @@ warn "perl extension '$ext' not found in perl library search path\n"; } } + } + + $retval = undef; + + 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; + } + } - } elsif ($htype == 1) { # DESTROY + 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; - - verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" - if $verbosity >= 10; - keys %$cb; + # clear package objects + %$_ = () for values %{ $TERM->{_pkg} }; - 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 { @@ -463,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 @@ -479,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]) @@ -572,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])