--- rxvt-unicode/src/urxvt.pm 2014/12/26 21:26:37 1.249 +++ rxvt-unicode/src/urxvt.pm 2019/09/17 20:38:14 1.258 @@ -47,11 +47,10 @@ Extensions may add additional resources and C, i.e., methods which can be bound to a key and invoked by the user. An extension can -define the resources it support and also default bindings for one or -more actions it provides using so called META comments, described -below. Similarly to builtin resources, extension resources can also be -specified on the command line as long options (with C<.> replaced by -C<->), in which case the corresponding extension is loaded +define the resources it support using so called META comments, +described below. Similarly to builtin resources, extension resources +can also be specified on the command line as long options (with C<.> +replaced by C<->), in which case the corresponding extension is loaded automatically. For this to work the extension B define META comments for its resources. @@ -118,9 +117,11 @@ =head2 META comments Rxvt-unicode recognizes special meta comments in extensions that define -different types of metadata. +different types of metadata. These comments are scanned whenever a +terminal is created and are typically used to autoload extensions when +their resources or command line parameters are used. -Currently, it recxognises only one such comment: +Currently, it recognises only one such comment: =over 4 @@ -130,6 +131,9 @@ C is the resource name, C is the resource type, C or C, and C is the resource description. +The extension will be autoloaded when this resource is specified or used +as a command line parameter. + =back =head2 Hooks @@ -515,6 +519,18 @@ Various constants for use in X calls and event processing. +=item urxvt::PrivMode_132, PrivMode_132OK, PrivMode_rVideo, PrivMode_relOrigin, +PrivMode_Screen, PrivMode_Autowrap, PrivMode_aplCUR, PrivMode_aplKP, +PrivMode_HaveBackSpace, PrivMode_BackSpace, PrivMode_ShiftKeys, +PrivMode_VisibleCursor, PrivMode_MouseX10, PrivMode_MouseX11, +PrivMode_scrollBar, PrivMode_TtyOutputInh, PrivMode_Keypress, +PrivMode_smoothScroll, PrivMode_vt52, PrivMode_LFNL, PrivMode_MouseBtnEvent, +PrivMode_MouseAnyEvent, PrivMode_BracketPaste, PrivMode_ExtModeMouse, +PrivMode_ExtMouseRight, PrivMode_BlinkingCursor, PrivMode_mouse_report, +PrivMode_Default + +Constants for checking DEC private modes. + =back =head2 RENDITION @@ -591,6 +607,8 @@ $term->scan_extensions; + # iterating over all resources has quadratic time overhead + # overall, maybe this could be optimised? my $r = $term->{meta}{resource}; keys %$r; # reset iterator while (my ($k, $v) = each %$r) { @@ -607,6 +625,8 @@ push @{ $term->{perl_ext_3} }, $v->[0]; + return 1 unless $isarg; + if ($v->[1] eq "boolean") { $term->put_option_db ($name, $flag ? "true" : "false"); return 1; @@ -1137,7 +1157,7 @@ return if exists $self->{meta}; my @urxvtdirs = perl_libdirs $self; - my @cpandirs = grep -d, map "$_/URxvt/Ext", @INC; +# my @cpandirs = grep -d, map "$_/URxvt/Ext", @INC; $self->{meta} = \my %meta; @@ -1184,13 +1204,16 @@ } }; - $gather->($_, 0) for @cpandirs; +# $gather->($_, 0) for @cpandirs; $gather->($_, 1) for @urxvtdirs; # and now merge resources + + $meta{resource} = \my %resource; + while (my ($k, $v) = each %{ $meta{ext} }) { #TODO: should check for extensions overriding each other - %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} }); + %resource = (%resource, %{ $v->{resource} }); } } @@ -1346,14 +1369,19 @@ $res =~ /^\s*(?:true|yes|on|1)\s*$/i ? 1 : defined $res && 0 } +=item $action = $term->lookup_keysym ($keysym, $state) + +Returns the action bound to key combination C<($keysym, $state)>, +if a binding for it exists, and C otherwise. + =item $success = $term->bind_action ($key, $action) Adds a key binding exactly as specified via a C resource. See the C resource in the urxvt(1) manpage. -To add default bindings for an extension, the extension should call C<< -->bind_action >> on it's C hook for every such binding. Doing it -in the C hook allows users the override or remove the the binding +To add default bindings for actions, an extension should call C<< +->bind_action >> in its C hook for every such binding. Doing it +in the C hook allows users to override or remove the binding again. Example: the C by default binds itself @@ -1612,31 +1640,32 @@ Deliver various fake events to to terminal. -=item $window_width = $term->width +=item $window_width = $term->width ([$new_value]) -=item $window_height = $term->height +=item $window_height = $term->height ([$new_value]) -=item $font_width = $term->fwidth +=item $font_width = $term->fwidth ([$new_value]) -=item $font_height = $term->fheight +=item $font_height = $term->fheight ([$new_value]) -=item $font_ascent = $term->fbase +=item $font_ascent = $term->fbase ([$new_value]) -=item $terminal_rows = $term->nrow +=item $terminal_rows = $term->nrow ([$new_value]) -=item $terminal_columns = $term->ncol +=item $terminal_columns = $term->ncol ([$new_value]) -=item $has_focus = $term->focus +=item $has_focus = $term->focus ([$new_value]) -=item $is_mapped = $term->mapped +=item $is_mapped = $term->mapped ([$new_value]) -=item $max_scrollback = $term->saveLines +=item $max_scrollback = $term->saveLines ([$new_value]) -=item $nrow_plus_saveLines = $term->total_rows +=item $nrow_plus_saveLines = $term->total_rows ([$new_value]) -=item $topmost_scrollback_row = $term->top_row +=item $topmost_scrollback_row = $term->top_row ([$new_value]) -Return various integers describing terminal characteristics. +Return various integers describing terminal characteristics. If an +argument is given, changes the value and returns the previous one. =item $x_display = $term->display_id @@ -1683,6 +1712,16 @@ Returns whether the cursor is currently hidden or not. +=item $priv_modes = $term->priv_modes + +Returns a bitset with the state of DEC private modes. + +Example: + + if ($term->priv_modes & urxvt::PrivMode_mouse_report) { + # mouse reporting is turned on + } + =item $view_start = $term->view_start ([$newvalue]) Returns the row number of the topmost displayed line. Maximum value is @@ -1697,6 +1736,10 @@ Used after changing terminal contents to display them. +=item $term->refresh_check + +Checks if a refresh has been requested and, if so, schedules one. + =item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) Returns the text of the entire row with number C<$row_number>. Row C<< $term->top_row >>