… | |
… | |
366 | |
366 | |
367 | $pkg |
367 | $pkg |
368 | } |
368 | } |
369 | } |
369 | } |
370 | |
370 | |
|
|
371 | our $retval; # return value for urxvt |
|
|
372 | |
371 | # called by the rxvt core |
373 | # called by the rxvt core |
372 | sub invoke { |
374 | sub invoke { |
373 | local $TERM = shift; |
375 | local $TERM = shift; |
374 | my $htype = shift; |
376 | my $htype = shift; |
375 | |
377 | |
… | |
… | |
383 | register_package script_package $files[0]; |
385 | register_package script_package $files[0]; |
384 | } else { |
386 | } else { |
385 | warn "perl extension '$ext' not found in perl library search path\n"; |
387 | warn "perl extension '$ext' not found in perl library search path\n"; |
386 | } |
388 | } |
387 | } |
389 | } |
|
|
390 | } |
388 | |
391 | |
|
|
392 | $retval = undef; |
|
|
393 | |
|
|
394 | if (my $cb = $TERM->{_hook}[$htype]) { |
|
|
395 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
|
|
396 | if $verbosity >= 10; |
|
|
397 | |
|
|
398 | keys %$cb; |
|
|
399 | |
|
|
400 | while (my ($pkg, $cb) = each %$cb) { |
|
|
401 | $retval = $cb->( |
|
|
402 | $TERM->{_pkg}{$pkg} ||= do { |
|
|
403 | my $proxy = bless { }, urxvt::term::proxy::; |
|
|
404 | Scalar::Util::weaken ($proxy->{term} = $TERM); |
|
|
405 | $proxy |
|
|
406 | }, |
|
|
407 | @_, |
|
|
408 | ) and last; |
|
|
409 | } |
|
|
410 | } |
|
|
411 | |
389 | } elsif ($htype == 1) { # DESTROY |
412 | if ($htype == 1) { # DESTROY |
|
|
413 | # remove hooks if unused |
390 | if (my $hook = $TERM->{_hook}) { |
414 | if (my $hook = $TERM->{_hook}) { |
391 | for my $htype (0..$#$hook) { |
415 | for my $htype (0..$#$hook) { |
392 | $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } |
416 | $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } |
393 | or set_should_invoke $htype, 0; |
417 | or set_should_invoke $htype, 0; |
394 | } |
418 | } |
395 | } |
419 | } |
|
|
420 | |
|
|
421 | # clear package objects |
|
|
422 | %$_ = () for values %{ $TERM->{_pkg} }; |
|
|
423 | |
|
|
424 | # clear package |
|
|
425 | %$TERM = (); |
396 | } |
426 | } |
397 | |
427 | |
398 | my $cb = $TERM->{_hook}[$htype] |
428 | $retval |
399 | or return; |
|
|
400 | |
|
|
401 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
|
|
402 | if $verbosity >= 10; |
|
|
403 | |
|
|
404 | keys %$cb; |
|
|
405 | |
|
|
406 | while (my ($pkg, $cb) = each %$cb) { |
|
|
407 | return 1 |
|
|
408 | if $cb->( |
|
|
409 | $TERM->{$pkg} ||= do { |
|
|
410 | my $proxy = bless { }, urxvt::term::proxy::; |
|
|
411 | Scalar::Util::weaken ($proxy->{term} = $TERM); |
|
|
412 | $proxy |
|
|
413 | }, |
|
|
414 | @_, |
|
|
415 | ); |
|
|
416 | } |
|
|
417 | |
|
|
418 | 0 |
|
|
419 | } |
429 | } |
420 | |
430 | |
421 | sub urxvt::term::proxy::AUTOLOAD { |
431 | sub urxvt::term::proxy::AUTOLOAD { |
422 | $urxvt::term::proxy::AUTOLOAD =~ /:([^:]+)$/ |
432 | $urxvt::term::proxy::AUTOLOAD =~ /:([^:]+)$/ |
423 | or die "FATAL: \$AUTOLOAD '$urxvt::term::proxy::AUTOLOAD' unparsable"; |
433 | or die "FATAL: \$AUTOLOAD '$urxvt::term::proxy::AUTOLOAD' unparsable"; |
… | |
… | |
477 | my ($self, $name) = (shift, shift); |
487 | my ($self, $name) = (shift, shift); |
478 | unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); |
488 | unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); |
479 | goto &urxvt::term::_resource; |
489 | goto &urxvt::term::_resource; |
480 | } |
490 | } |
481 | |
491 | |
|
|
492 | =item $rend = $term->screen_rstyle ([$new_rstyle]) |
|
|
493 | |
|
|
494 | Return and optionally change the current rendition. Text thta is output by |
|
|
495 | the temrianl application will use this style. |
|
|
496 | |
|
|
497 | =item ($row, $col) = $term->screen_cur ([$row, $col]) |
|
|
498 | |
|
|
499 | Return the current coordinates of the text cursor position and optionally |
|
|
500 | set it (which is usually bad as applications don't expect that). |
|
|
501 | |
482 | =item ($row, $col) = $term->selection_mark ([$row, $col]) |
502 | =item ($row, $col) = $term->selection_mark ([$row, $col]) |
483 | |
503 | |
484 | =item ($row, $col) = $term->selection_beg ([$row, $col]) |
504 | =item ($row, $col) = $term->selection_beg ([$row, $col]) |
485 | |
505 | |
486 | =item ($row, $col) = $term->selection_end ([$row, $col]) |
506 | =item ($row, $col) = $term->selection_end ([$row, $col]) |
… | |
… | |
570 | |
590 | |
571 | Write the octets given in C<$data> to the tty (i.e. as program input). To |
591 | Write the octets given in C<$data> to the tty (i.e. as program input). To |
572 | pass characters instead of octets, you should convert your strings first |
592 | pass characters instead of octets, you should convert your strings first |
573 | to the locale-specific encoding using C<< $term->locale_encode >>. |
593 | to the locale-specific encoding using C<< $term->locale_encode >>. |
574 | |
594 | |
|
|
595 | =item $window_width = $term->width |
|
|
596 | |
|
|
597 | =item $window_height = $term->height |
|
|
598 | |
|
|
599 | =item $font_width = $term->fwidth |
|
|
600 | |
|
|
601 | =item $font_height = $term->fheight |
|
|
602 | |
|
|
603 | =item $font_ascent = $term->fbase |
|
|
604 | |
575 | =item $nrow = $term->nrow |
605 | =item $terminal_rows = $term->nrow |
576 | |
606 | |
577 | =item $ncol = $term->ncol |
607 | =item $terminal_columns = $term->ncol |
578 | |
608 | |
579 | Return the number of rows/columns of the terminal window (i.e. as |
609 | =item $has_focus = $term->focus |
580 | specified by C<-geometry>, excluding any scrollback). |
|
|
581 | |
610 | |
582 | =item $nsaved = $term->nsaved |
611 | =item $is_mapped = $term->mapped |
583 | |
612 | |
584 | Returns the number of lines in the scrollback buffer. |
613 | =item $max_scrollback = $term->saveLines |
|
|
614 | |
|
|
615 | =item $nrow_plus_saveLines = $term->total_rows |
|
|
616 | |
|
|
617 | =item $lines_in_scrollback = $term->nsaved |
|
|
618 | |
|
|
619 | Return various integers describing terminal characteristics. |
585 | |
620 | |
586 | =item $view_start = $term->view_start ([$newvalue]) |
621 | =item $view_start = $term->view_start ([$newvalue]) |
587 | |
622 | |
588 | Returns the negative row number of the topmost line. Minimum value is |
623 | Returns the negative row number of the topmost line. Minimum value is |
589 | C<0>, which displays the normal terminal contents. Larger values scroll |
624 | C<0>, which displays the normal terminal contents. Larger values scroll |