… | |
… | |
153 | additionally stores the first match in the current line into the primary |
153 | additionally stores the first match in the current line into the primary |
154 | selection. |
154 | selection. |
155 | |
155 | |
156 | =item readline (enabled by default) |
156 | =item readline (enabled by default) |
157 | |
157 | |
158 | A support package that tries to make editing with readline easier. At the |
158 | A support package that tries to make editing with readline easier. At |
159 | moment, it reacts to clicking with the left mouse button by trying to |
159 | the moment, it reacts to clicking shift-left mouse button by trying to |
160 | move the text cursor to this position. It does so by generating as many |
160 | move the text cursor to this position. It does so by generating as many |
161 | cursor-left or cursor-right keypresses as required (the this only works |
161 | cursor-left or cursor-right keypresses as required (the this only works |
162 | for programs that correctly support wide characters). |
162 | for programs that correctly support wide characters). |
163 | |
163 | |
164 | To avoid too many false positives, this is only done when: |
164 | To avoid too many false positives, this is only done when: |
… | |
… | |
368 | |
368 | |
369 | =back |
369 | =back |
370 | |
370 | |
371 | =head2 Extension Objects |
371 | =head2 Extension Objects |
372 | |
372 | |
373 | Very perl extension is a perl class. A separate perl object is created |
373 | Every perl extension is a perl class. A separate perl object is created |
374 | for each terminal and each extension and passed as the first parameter to |
374 | for each terminal and each extension and passed as the first parameter to |
375 | hooks. So extensions can use their C<$self> object without having to think |
375 | hooks. So extensions can use their C<$self> object without having to think |
376 | about other extensions, with the exception of methods and members that |
376 | about other extensions, with the exception of methods and members that |
377 | begin with an underscore character C<_>: these are reserved for internal |
377 | begin with an underscore character C<_>: these are reserved for internal |
378 | use. |
378 | use. |
… | |
… | |
493 | |
493 | |
494 | It is called before lines are scrolled out (so rows 0 .. min ($lines - 1, |
494 | It is called before lines are scrolled out (so rows 0 .. min ($lines - 1, |
495 | $nrow - 1) represent the lines to be scrolled out). C<$saved> is the total |
495 | $nrow - 1) represent the lines to be scrolled out). C<$saved> is the total |
496 | number of lines that will be in the scrollback buffer. |
496 | number of lines that will be in the scrollback buffer. |
497 | |
497 | |
|
|
498 | =item on_osc_seq $term, $op, $args |
|
|
499 | |
|
|
500 | Called on every OSC sequence and can be used to suppress it or modify its |
|
|
501 | behaviour. The default should be to return an empty list. A true value |
|
|
502 | suppresses execution of the request completely. Make sure you don't get |
|
|
503 | confused by recursive invocations when you output an osc sequence within |
|
|
504 | this callback. |
|
|
505 | |
|
|
506 | C<on_osc_seq_perl> should be used for new behaviour. |
|
|
507 | |
498 | =item on_osc_seq $term, $string |
508 | =item on_osc_seq_perl $term, $string |
499 | |
509 | |
500 | Called whenever the B<ESC ] 777 ; string ST> command sequence (OSC = |
510 | Called whenever the B<ESC ] 777 ; string ST> command sequence (OSC = |
501 | operating system command) is processed. Cursor position and other state |
511 | operating system command) is processed. Cursor position and other state |
502 | information is up-to-date when this happens. For interoperability, the |
512 | information is up-to-date when this happens. For interoperability, the |
503 | string should start with the extension name and a colon, to distinguish |
513 | string should start with the extension name and a colon, to distinguish |
… | |
… | |
897 | |
907 | |
898 | if (my $cb = $TERM->{_hook}[$htype]) { |
908 | if (my $cb = $TERM->{_hook}[$htype]) { |
899 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
909 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
900 | if $verbosity >= 10; |
910 | if $verbosity >= 10; |
901 | |
911 | |
902 | keys %$cb; |
912 | for my $pkg (keys %$cb) { |
903 | |
|
|
904 | while (my ($pkg, $cb) = each %$cb) { |
|
|
905 | my $retval_ = eval { $cb->($TERM->{_pkg}{$pkg}, @_) }; |
913 | my $retval_ = eval { $cb->{$pkg}->($TERM->{_pkg}{$pkg}, @_) }; |
906 | $retval ||= $retval_; |
914 | $retval ||= $retval_; |
907 | |
915 | |
908 | if ($@) { |
916 | if ($@) { |
909 | $TERM->ungrab; # better to lose the grab than the session |
917 | $TERM->ungrab; # better to lose the grab than the session |
910 | warn $@; |
918 | warn $@; |
… | |
… | |
1474 | =item $env = $term->env |
1482 | =item $env = $term->env |
1475 | |
1483 | |
1476 | Returns a copy of the environment in effect for the terminal as a hashref |
1484 | Returns a copy of the environment in effect for the terminal as a hashref |
1477 | similar to C<\%ENV>. |
1485 | similar to C<\%ENV>. |
1478 | |
1486 | |
|
|
1487 | =item @envv = $term->envv |
|
|
1488 | |
|
|
1489 | Returns the environment as array of strings of the form C<VAR=VALUE>. |
|
|
1490 | |
|
|
1491 | =item @argv = $term->argv |
|
|
1492 | |
|
|
1493 | Return the argument vector as this terminal, similar to @ARGV, but |
|
|
1494 | includes the program name as first element. |
|
|
1495 | |
1479 | =cut |
1496 | =cut |
1480 | |
1497 | |
1481 | sub env { |
1498 | sub env { |
1482 | if (my $env = $_[0]->_env) { |
|
|
1483 | +{ map /^([^=]+)(?:=(.*))?$/s && ($1 => $2), @$env } |
1499 | +{ map /^([^=]+)(?:=(.*))?$/s && ($1 => $2), $_[0]->envv } |
1484 | } else { |
|
|
1485 | +{ %ENV } |
|
|
1486 | } |
|
|
1487 | } |
1500 | } |
1488 | |
1501 | |
1489 | =item $modifiermask = $term->ModLevel3Mask |
1502 | =item $modifiermask = $term->ModLevel3Mask |
1490 | |
1503 | |
1491 | =item $modifiermask = $term->ModMetaMask |
1504 | =item $modifiermask = $term->ModMetaMask |