1 |
root |
1.1 |
NAME |
2 |
|
|
rxvtperl - rxvt-unicode's embedded perl interpreter |
3 |
|
|
|
4 |
|
|
SYNOPSIS |
5 |
root |
1.3 |
# create a file grab_test in $HOME: |
6 |
root |
1.1 |
|
7 |
|
|
sub on_sel_grab { |
8 |
|
|
warn "you selected ", $_[0]->selection; |
9 |
|
|
() |
10 |
|
|
} |
11 |
|
|
|
12 |
root |
1.3 |
# start a rxvt using it: |
13 |
|
|
|
14 |
|
|
rxvt --perl-lib $HOME -pe grab_test |
15 |
root |
1.1 |
|
16 |
|
|
DESCRIPTION |
17 |
root |
1.2 |
Everytime a terminal object gets created, scripts specified via the |
18 |
root |
1.3 |
"perl" resource are loaded and associated with it. |
19 |
|
|
|
20 |
|
|
Scripts are compiled in a 'use strict' and 'use utf8' environment, and |
21 |
|
|
thus must be encoded as UTF-8. |
22 |
root |
1.1 |
|
23 |
|
|
Each script will only ever be loaded once, even in rxvtd, where scripts |
24 |
root |
1.5 |
will be shared (but not enabled) for all terminals. |
25 |
root |
1.1 |
|
26 |
root |
1.5 |
Prepackaged Extensions |
27 |
root |
1.4 |
This section describes the extensiosn delivered with this version. You |
28 |
|
|
can find them in /opt/rxvt/lib/urxvt/perl/. |
29 |
|
|
|
30 |
|
|
You can activate them like this: |
31 |
|
|
|
32 |
|
|
rxvt -pe <extensionname> |
33 |
|
|
|
34 |
|
|
selection |
35 |
root |
1.8 |
Intelligent selection. This extension tries to be more intelligent |
36 |
|
|
when the user extends selections (double-click). Right now, it tries |
37 |
|
|
to select urls and complete shell-quoted arguments, which is very |
38 |
|
|
convenient, too, if your ls supports "--quoting-style=shell". |
39 |
root |
1.7 |
|
40 |
|
|
It also offers the following bindable event: |
41 |
root |
1.4 |
|
42 |
|
|
rot13 |
43 |
|
|
Rot-13 the selection when activated. Used via keyboard trigger: |
44 |
|
|
|
45 |
|
|
URxvt.keysym.C-M-r: perl:selection:rot13 |
46 |
|
|
|
47 |
|
|
digital-clock |
48 |
root |
1.6 |
Displays a digital clock using the built-in overlay. |
49 |
|
|
|
50 |
|
|
example-refresh-hooks |
51 |
root |
1.4 |
Displays a very simple digital clock in the upper right corner of |
52 |
|
|
the window. Illustrates overwriting the refresh callbacks to create |
53 |
|
|
your own overlays or changes. |
54 |
|
|
|
55 |
root |
1.1 |
General API Considerations |
56 |
|
|
All objects (such as terminals, time watchers etc.) are typical |
57 |
|
|
reference-to-hash objects. The hash can be used to store anything you |
58 |
|
|
like. All members starting with an underscore (such as "_ptr" or |
59 |
root |
1.7 |
"_hook") are reserved for internal uses and MUST NOT be accessed or |
60 |
root |
1.1 |
modified). |
61 |
|
|
|
62 |
|
|
When objects are destroyed on the C++ side, the perl object hashes are |
63 |
|
|
emptied, so its best to store related objects such as time watchers and |
64 |
|
|
the like inside the terminal object so they get destroyed as soon as the |
65 |
|
|
terminal is destroyed. |
66 |
|
|
|
67 |
|
|
Hooks |
68 |
|
|
The following subroutines can be declared in loaded scripts, and will be |
69 |
|
|
called whenever the relevant event happens. |
70 |
|
|
|
71 |
root |
1.7 |
The first argument passed to them is an object private to each terminal |
72 |
|
|
and extension package. You can call all "urxvt::term" methods on it, but |
73 |
|
|
its not a real "urxvt::term" object. Instead, the real "urxvt::term" |
74 |
|
|
object that is shared between all packages is stored in the "term" |
75 |
|
|
member. |
76 |
|
|
|
77 |
root |
1.1 |
All of them must return a boolean value. If it is true, then the event |
78 |
|
|
counts as being *consumed*, and the invocation of other hooks is |
79 |
|
|
skipped, and the relevant action might not be carried out by the C++ |
80 |
|
|
code. |
81 |
|
|
|
82 |
|
|
When in doubt, return a false value (preferably "()"). |
83 |
|
|
|
84 |
|
|
on_init $term |
85 |
|
|
Called after a new terminal object has been initialized, but before |
86 |
|
|
windows are created or the command gets run. |
87 |
|
|
|
88 |
|
|
on_reset $term |
89 |
|
|
Called after the screen is "reset" for any reason, such as resizing |
90 |
|
|
or control sequences. Here is where you can react on changes to |
91 |
|
|
size-related variables. |
92 |
|
|
|
93 |
|
|
on_start $term |
94 |
|
|
Called at the very end of initialisation of a new terminal, just |
95 |
|
|
before returning to the mainloop. |
96 |
|
|
|
97 |
|
|
on_sel_make $term, $eventtime |
98 |
|
|
Called whenever a selection has been made by the user, but before |
99 |
|
|
the selection text is copied, so changes to the beginning, end or |
100 |
|
|
type of the selection will be honored. |
101 |
|
|
|
102 |
|
|
Returning a true value aborts selection making by urxvt, in which |
103 |
|
|
case you have to make a selection yourself by calling |
104 |
|
|
"$term->selection_grab". |
105 |
|
|
|
106 |
|
|
on_sel_grab $term, $eventtime |
107 |
|
|
Called whenever a selection has been copied, but before the |
108 |
|
|
selection is requested from the server. The selection text can be |
109 |
|
|
queried and changed by calling "$term->selection". |
110 |
|
|
|
111 |
|
|
Returning a true value aborts selection grabbing. It will still be |
112 |
|
|
hilighted. |
113 |
|
|
|
114 |
root |
1.7 |
on_sel_extend $term |
115 |
|
|
Called whenever the user tries to extend the selection (e.g. with a |
116 |
|
|
double click) and is either supposed to return false (normal |
117 |
|
|
operation), or should extend the selection itelf and return true to |
118 |
|
|
suppress the built-in processing. |
119 |
|
|
|
120 |
|
|
See the selection example extension. |
121 |
|
|
|
122 |
root |
1.1 |
on_focus_in $term |
123 |
|
|
Called whenever the window gets the keyboard focus, before urxvt |
124 |
|
|
does focus in processing. |
125 |
|
|
|
126 |
|
|
on_focus_out $term |
127 |
|
|
Called wheneever the window loses keyboard focus, before urxvt does |
128 |
|
|
focus out processing. |
129 |
|
|
|
130 |
|
|
on_view_change $term, $offset |
131 |
|
|
Called whenever the view offset changes, i..e the user or program |
132 |
|
|
scrolls. Offset 0 means display the normal terminal, positive values |
133 |
|
|
show this many lines of scrollback. |
134 |
|
|
|
135 |
|
|
on_scroll_back $term, $lines, $saved |
136 |
|
|
Called whenever lines scroll out of the terminal area into the |
137 |
|
|
scrollback buffer. $lines is the number of lines scrolled out and |
138 |
|
|
may be larger than the scroll back buffer or the terminal. |
139 |
|
|
|
140 |
|
|
It is called before lines are scrolled out (so rows 0 .. min ($lines |
141 |
|
|
- 1, $nrow - 1) represent the lines to be scrolled out). $saved is |
142 |
|
|
the total number of lines that will be in the scrollback buffer. |
143 |
|
|
|
144 |
|
|
on_tty_activity $term *NYI* |
145 |
|
|
Called whenever the program(s) running in the urxvt window send |
146 |
|
|
output. |
147 |
|
|
|
148 |
root |
1.9 |
on_osc_seq $term, $string |
149 |
|
|
Called whenever the ESC ] 777 ; string ST command sequence (OSC = |
150 |
|
|
operating system command) is processed. Cursor position and other |
151 |
|
|
state information is up-to-date when this happens. For |
152 |
|
|
interoperability, the string should start with the extension name |
153 |
|
|
and a colon, to distinguish it from commands for other extensions, |
154 |
|
|
and this might be enforced in the future. |
155 |
|
|
|
156 |
|
|
Be careful not ever to trust (in a security sense) the data you |
157 |
|
|
receive, as its source can not easily be controleld (e-mail content, |
158 |
|
|
messages from other users on the same system etc.). |
159 |
|
|
|
160 |
root |
1.1 |
on_refresh_begin $term |
161 |
|
|
Called just before the screen gets redrawn. Can be used for overlay |
162 |
|
|
or similar effects by modify terminal contents in refresh_begin, and |
163 |
|
|
restoring them in refresh_end. The built-in overlay and selection |
164 |
|
|
display code is run after this hook, and takes precedence. |
165 |
|
|
|
166 |
|
|
on_refresh_end $term |
167 |
|
|
Called just after the screen gets redrawn. See "on_refresh_begin". |
168 |
|
|
|
169 |
root |
1.3 |
on_keyboard_command $term, $string |
170 |
|
|
Called whenever the user presses a key combination that has a |
171 |
|
|
"perl:string" action bound to it (see description of the keysym |
172 |
|
|
resource in the rxvt(1) manpage). |
173 |
|
|
|
174 |
root |
1.7 |
Variables in the "urxvt" Package |
175 |
|
|
$urxvt::TERM |
176 |
|
|
The current terminal. Whenever a callback/Hook is bein executed, |
177 |
|
|
this variable stores the current "urxvt::term" object. |
178 |
|
|
|
179 |
root |
1.1 |
Functions in the "urxvt" Package |
180 |
|
|
urxvt::fatal $errormessage |
181 |
|
|
Fatally aborts execution with the given error message. Avoid at all |
182 |
|
|
costs! The only time this is acceptable is when the terminal process |
183 |
|
|
starts up. |
184 |
|
|
|
185 |
|
|
urxvt::warn $string |
186 |
|
|
Calls "rxvt_warn" with the given string which should not include a |
187 |
|
|
newline. The module also overwrites the "warn" builtin with a |
188 |
|
|
function that calls this function. |
189 |
|
|
|
190 |
|
|
Using this function has the advantage that its output ends up in the |
191 |
|
|
correct place, e.g. on stderr of the connecting urxvtc client. |
192 |
|
|
|
193 |
|
|
$time = urxvt::NOW |
194 |
|
|
Returns the "current time" (as per the event loop). |
195 |
|
|
|
196 |
root |
1.6 |
RENDITION |
197 |
|
|
Rendition bitsets contain information about colour, font, font styles |
198 |
|
|
and similar information for each screen cell. |
199 |
|
|
|
200 |
|
|
The following "macros" deal with changes in rendition sets. You should |
201 |
|
|
never just create a bitset, you should always modify an existing one, as |
202 |
|
|
they contain important information required for correct operation of |
203 |
|
|
rxvt-unicode. |
204 |
|
|
|
205 |
|
|
$rend = urxvt::DEFAULT_RSTYLE |
206 |
|
|
Returns the default rendition, as used when the terminal is starting |
207 |
|
|
up or being reset. Useful as a base to start when creating |
208 |
|
|
renditions. |
209 |
|
|
|
210 |
|
|
$rend = urxvt::OVERLAY_RSTYLE |
211 |
|
|
Return the rendition mask used for overlays by default. |
212 |
|
|
|
213 |
|
|
$rendbit = urxvt::RS_Bold, RS_Italic, RS_Blink, RS_RVid, RS_Uline |
214 |
|
|
Return the bit that enabled bold, italic, blink, reverse-video and |
215 |
|
|
underline, respectively. To enable such a style, just logically OR |
216 |
|
|
it into the bitset. |
217 |
|
|
|
218 |
|
|
$foreground = urxvt::GET_BASEFG $rend |
219 |
|
|
$background = urxvt::GET_BASEBG $rend |
220 |
|
|
Return the foreground/background colour index, respectively. |
221 |
|
|
|
222 |
|
|
$rend = urxvt::SET_FGCOLOR ($rend, $new_colour) |
223 |
|
|
$rend = urxvt::SET_BGCOLOR ($rend, $new_colour) |
224 |
|
|
Replace the foreground/background colour in the rendition mask with |
225 |
|
|
the specified one. |
226 |
|
|
|
227 |
|
|
$value = urxvt::GET_CUSTOM ($rend) |
228 |
|
|
Return the "custom" value: Every rendition has 5 bits for use by |
229 |
|
|
extensions. They can be set and changed as you like and are |
230 |
|
|
initially zero. |
231 |
|
|
|
232 |
|
|
$rend = urxvt::SET_CUSTOM ($rend, $new_value) |
233 |
|
|
Change the custom value. |
234 |
|
|
|
235 |
root |
1.1 |
The "urxvt::term" Class |
236 |
|
|
$value = $term->resource ($name[, $newval]) |
237 |
|
|
Returns the current resource value associated with a given name and |
238 |
|
|
optionally sets a new value. Setting values is most useful in the |
239 |
|
|
"init" hook. Unset resources are returned and accepted as "undef". |
240 |
|
|
|
241 |
|
|
The new value must be properly encoded to a suitable character |
242 |
|
|
encoding before passing it to this method. Similarly, the returned |
243 |
|
|
value may need to be converted from the used encoding to text. |
244 |
|
|
|
245 |
|
|
Resource names are as defined in src/rsinc.h. Colours can be |
246 |
|
|
specified as resource names of the form "color+<index>", e.g. |
247 |
|
|
"color+5". (will likely change). |
248 |
|
|
|
249 |
|
|
Please note that resource strings will currently only be freed when |
250 |
|
|
the terminal is destroyed, so changing options frequently will eat |
251 |
|
|
memory. |
252 |
|
|
|
253 |
|
|
Here is a a likely non-exhaustive list of resource names, not all of |
254 |
|
|
which are supported in every build, please see the source to see the |
255 |
|
|
actual list: |
256 |
|
|
|
257 |
|
|
answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont |
258 |
|
|
borderLess color cursorBlink cursorUnderline cutchars delete_key |
259 |
|
|
display_name embed ext_bwidth fade font geometry hold iconName |
260 |
|
|
imFont imLocale inputMethod insecure int_bwidth intensityStyles |
261 |
root |
1.2 |
italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier |
262 |
root |
1.10 |
mouseWheelScrollPage name pastableTabs path perl_eval perl_ext_1 perl_ext_2 |
263 |
root |
1.1 |
perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd |
264 |
|
|
reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating |
265 |
|
|
scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput |
266 |
|
|
scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle |
267 |
|
|
shade term_name title transparent transparent_all tripleclickwords |
268 |
|
|
utmpInhibit visualBell |
269 |
|
|
|
270 |
root |
1.11 |
$rend = $term->screen_rstyle ([$new_rstyle]) |
271 |
|
|
Return and optionally change the current rendition. Text thta is |
272 |
|
|
output by the temrianl application will use this style. |
273 |
|
|
|
274 |
|
|
($row, $col) = $term->screen_cur ([$row, $col]) |
275 |
|
|
Return the current coordinates of the text cursor position and |
276 |
|
|
optionally set it (which is usually bad as applications don't expect |
277 |
|
|
that). |
278 |
|
|
|
279 |
root |
1.1 |
($row, $col) = $term->selection_mark ([$row, $col]) |
280 |
|
|
($row, $col) = $term->selection_beg ([$row, $col]) |
281 |
|
|
($row, $col) = $term->selection_end ([$row, $col]) |
282 |
|
|
Return the current values of the selection mark, begin or end |
283 |
|
|
positions, and optionally set them to new values. |
284 |
|
|
|
285 |
|
|
$success = $term->selection_grab ($eventtime) |
286 |
|
|
Try to request the primary selection from the server (for example, |
287 |
|
|
as set by the next method). |
288 |
|
|
|
289 |
|
|
$oldtext = $term->selection ([$newtext]) |
290 |
|
|
Return the current selection text and optionally replace it by |
291 |
|
|
$newtext. |
292 |
|
|
|
293 |
root |
1.6 |
#=item $term->overlay ($x, $y, $text) # #Create a simple multi-line |
294 |
|
|
overlay box. See the next method for details. # #=cut |
295 |
|
|
|
296 |
|
|
sub urxvt::term::scr_overlay { die; my ($self, $x, $y, $text) = @_; |
297 |
|
|
|
298 |
|
|
my @lines = split /\n/, $text; |
299 |
root |
1.1 |
|
300 |
root |
1.6 |
my $w = 0; |
301 |
|
|
for (map $self->strwidth ($_), @lines) { |
302 |
|
|
$w = $_ if $w < $_; |
303 |
|
|
} |
304 |
|
|
|
305 |
|
|
$self->scr_overlay_new ($x, $y, $w, scalar @lines); |
306 |
|
|
$self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines; |
307 |
|
|
} |
308 |
|
|
|
309 |
|
|
$term->overlay ($x, $y, $width, $height[, $rstyle[, $border]]) |
310 |
root |
1.1 |
Create a new (empty) overlay at the given position with the given |
311 |
root |
1.6 |
width/height. $rstyle defines the initial rendition style (default: |
312 |
|
|
"OVERLAY_RSTYLE"). |
313 |
|
|
|
314 |
|
|
If $border is 2 (default), then a decorative border will be put |
315 |
|
|
around the box. |
316 |
|
|
|
317 |
|
|
If either $x or $y is negative, then this is counted from the |
318 |
|
|
right/bottom side, respectively. |
319 |
|
|
|
320 |
|
|
This method returns an urxvt::overlay object. The overlay will be |
321 |
|
|
visible as long as the perl object is referenced. |
322 |
root |
1.1 |
|
323 |
root |
1.7 |
The methods currently supported on "urxvt::overlay" objects are: |
324 |
root |
1.6 |
|
325 |
root |
1.7 |
$overlay->set ($x, $y, $text, $rend) |
326 |
|
|
Similar to "$term->ROW_t" and "$term->ROW_r" in that it puts |
327 |
|
|
text in rxvt-unicode's special encoding and an array of |
328 |
|
|
rendition values at a specific position inside the overlay. |
329 |
|
|
|
330 |
|
|
$overlay->hide |
331 |
|
|
If visible, hide the overlay, but do not destroy it. |
332 |
|
|
|
333 |
|
|
$overlay->show |
334 |
|
|
If hidden, display the overlay again. |
335 |
root |
1.1 |
|
336 |
|
|
$cellwidth = $term->strwidth $string |
337 |
|
|
Returns the number of screen-cells this string would need. Correctly |
338 |
|
|
accounts for wide and combining characters. |
339 |
|
|
|
340 |
|
|
$octets = $term->locale_encode $string |
341 |
|
|
Convert the given text string into the corresponding locale |
342 |
|
|
encoding. |
343 |
|
|
|
344 |
|
|
$string = $term->locale_decode $octets |
345 |
|
|
Convert the given locale-encoded octets into a perl string. |
346 |
|
|
|
347 |
|
|
$term->tt_write ($octets) |
348 |
|
|
Write the octets given in $data to the tty (i.e. as program input). |
349 |
root |
1.4 |
To pass characters instead of octets, you should convert your |
350 |
|
|
strings first to the locale-specific encoding using |
351 |
|
|
"$term->locale_encode". |
352 |
|
|
|
353 |
root |
1.11 |
$window_width = $term->width |
354 |
|
|
$window_height = $term->height |
355 |
|
|
$font_width = $term->fwidth |
356 |
|
|
$font_height = $term->fheight |
357 |
|
|
$font_ascent = $term->fbase |
358 |
|
|
$terminal_rows = $term->nrow |
359 |
|
|
$terminal_columns = $term->ncol |
360 |
|
|
$has_focus = $term->focus |
361 |
|
|
$is_mapped = $term->mapped |
362 |
|
|
$max_scrollback = $term->saveLines |
363 |
|
|
$nrow_plus_saveLines = $term->total_rows |
364 |
|
|
$lines_in_scrollback = $term->nsaved |
365 |
|
|
Return various integers describing terminal characteristics. |
366 |
root |
1.4 |
|
367 |
|
|
$view_start = $term->view_start ([$newvalue]) |
368 |
|
|
Returns the negative row number of the topmost line. Minimum value |
369 |
|
|
is 0, which displays the normal terminal contents. Larger values |
370 |
|
|
scroll this many lines into the scrollback buffer. |
371 |
|
|
|
372 |
|
|
$term->want_refresh |
373 |
|
|
Requests a screen refresh. At the next opportunity, rxvt-unicode |
374 |
|
|
will compare the on-screen display with its stored representation. |
375 |
|
|
If they differ, it redraws the differences. |
376 |
|
|
|
377 |
|
|
Used after changing terminal contents to display them. |
378 |
|
|
|
379 |
|
|
$text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) |
380 |
|
|
Returns the text of the entire row with number $row_number. Row 0 is |
381 |
|
|
the topmost terminal line, row "$term->$ncol-1" is the bottommost |
382 |
|
|
terminal line. The scrollback buffer starts at line -1 and extends |
383 |
root |
1.7 |
to line "-$term->nsaved". Nothing will be returned if a nonexistent |
384 |
|
|
line is requested. |
385 |
root |
1.4 |
|
386 |
|
|
If $new_text is specified, it will replace characters in the current |
387 |
|
|
line, starting at column $start_col (default 0), which is useful to |
388 |
root |
1.6 |
replace only parts of a line. The font index in the rendition will |
389 |
root |
1.4 |
automatically be updated. |
390 |
|
|
|
391 |
|
|
$text is in a special encoding: tabs and wide characters that use |
392 |
|
|
more than one cell when displayed are padded with urxvt::NOCHAR |
393 |
|
|
characters ("chr 65535"). Characters with combining characters and |
394 |
|
|
other characters that do not fit into the normal tetx encoding will |
395 |
|
|
be replaced with characters in the private use area. |
396 |
|
|
|
397 |
|
|
You have to obey this encoding when changing text. The advantage is |
398 |
|
|
that "substr" and similar functions work on screen cells and not on |
399 |
|
|
characters. |
400 |
|
|
|
401 |
|
|
The methods "$term->special_encode" and "$term->special_decode" can |
402 |
|
|
be used to convert normal strings into this encoding and vice versa. |
403 |
|
|
|
404 |
|
|
$rend = $term->ROW_r ($row_number[, $new_rend[, $start_col]]) |
405 |
|
|
Like "$term->ROW_t", but returns an arrayref with rendition bitsets. |
406 |
|
|
Rendition bitsets contain information about colour, font, font |
407 |
|
|
styles and similar information. See also "$term->ROW_t". |
408 |
|
|
|
409 |
|
|
When setting rendition, the font mask will be ignored. |
410 |
|
|
|
411 |
root |
1.6 |
See the section on RENDITION, above. |
412 |
root |
1.4 |
|
413 |
|
|
$length = $term->ROW_l ($row_number[, $new_length]) |
414 |
|
|
Returns the number of screen cells that are in use ("the line |
415 |
root |
1.7 |
length"). Unlike the urxvt core, this returns "$term->ncol" if the |
416 |
|
|
line is joined with the following one. |
417 |
|
|
|
418 |
|
|
$bool = $term->is_longer ($row_number) |
419 |
|
|
Returns true if the row is part of a multiple-row logical "line" |
420 |
|
|
(i.e. joined with the following row), which means all characters are |
421 |
|
|
in use and it is continued on the next row (and possibly a |
422 |
|
|
continuation of the previous row(s)). |
423 |
|
|
|
424 |
|
|
$line = $term->line ($row_number) |
425 |
|
|
Create and return a new "urxvt::line" object that stores information |
426 |
|
|
about the logical line that row $row_number is part of. It supports |
427 |
|
|
the following methods: |
428 |
|
|
|
429 |
|
|
$text = $line->t |
430 |
|
|
Returns the full text of the line, similar to "ROW_t" |
431 |
|
|
|
432 |
|
|
$rend = $line->r |
433 |
|
|
Returns the full rendition array of the line, similar to "ROW_r" |
434 |
|
|
|
435 |
|
|
$length = $line->l |
436 |
|
|
Returns the length of the line in cells, similar to "ROW_l". |
437 |
|
|
|
438 |
|
|
$rownum = $line->beg |
439 |
|
|
$rownum = $line->end |
440 |
|
|
Return the row number of the first/last row of the line, |
441 |
|
|
respectively. |
442 |
|
|
|
443 |
|
|
$offset = $line->offset_of ($row, $col) |
444 |
|
|
Returns the character offset of the given row|col pair within |
445 |
|
|
the logical line. |
446 |
|
|
|
447 |
|
|
($row, $col) = $line->coord_of ($offset) |
448 |
|
|
Translates a string offset into terminal coordinates again. |
449 |
root |
1.4 |
|
450 |
root |
1.7 |
($row, $col) = $line->coord_of ($offset) =item $text = |
451 |
|
|
$term->special_encode $string |
452 |
root |
1.4 |
Converts a perl string into the special encoding used by |
453 |
|
|
rxvt-unicode, where one character corresponds to one screen cell. |
454 |
|
|
See "$term->ROW_t" for details. |
455 |
|
|
|
456 |
|
|
$string = $term->special_decode $text |
457 |
|
|
Converts rxvt-unicodes text reprsentation into a perl string. See |
458 |
|
|
"$term->ROW_t" for details. |
459 |
|
|
|
460 |
root |
1.1 |
The "urxvt::timer" Class |
461 |
|
|
This class implements timer watchers/events. Time is represented as a |
462 |
|
|
fractional number of seconds since the epoch. Example: |
463 |
|
|
|
464 |
root |
1.6 |
$term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); |
465 |
root |
1.1 |
$term->{timer} = urxvt::timer |
466 |
|
|
->new |
467 |
root |
1.6 |
->interval (1) |
468 |
root |
1.1 |
->cb (sub { |
469 |
root |
1.6 |
$term->{overlay}->set (0, 0, |
470 |
|
|
sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
471 |
|
|
}); |
472 |
root |
1.1 |
|
473 |
|
|
$timer = new urxvt::timer |
474 |
root |
1.6 |
Create a new timer object in started state. It is scheduled to fire |
475 |
|
|
immediately. |
476 |
root |
1.1 |
|
477 |
|
|
$timer = $timer->cb (sub { my ($timer) = @_; ... }) |
478 |
|
|
Set the callback to be called when the timer triggers. |
479 |
|
|
|
480 |
|
|
$tstamp = $timer->at |
481 |
|
|
Return the time this watcher will fire next. |
482 |
|
|
|
483 |
|
|
$timer = $timer->set ($tstamp) |
484 |
|
|
Set the time the event is generated to $tstamp. |
485 |
|
|
|
486 |
root |
1.6 |
$timer = $timer->interval ($interval) |
487 |
|
|
Normally (and when $interval is 0), the timer will automatically |
488 |
|
|
stop after it has fired once. If $interval is non-zero, then the |
489 |
|
|
timer is automatically rescheduled at the given intervals. |
490 |
|
|
|
491 |
root |
1.1 |
$timer = $timer->start |
492 |
|
|
Start the timer. |
493 |
|
|
|
494 |
|
|
$timer = $timer->start ($tstamp) |
495 |
|
|
Set the event trigger time to $tstamp and start the timer. |
496 |
|
|
|
497 |
|
|
$timer = $timer->stop |
498 |
|
|
Stop the timer. |
499 |
|
|
|
500 |
|
|
The "urxvt::iow" Class |
501 |
|
|
This class implements io watchers/events. Example: |
502 |
|
|
|
503 |
|
|
$term->{socket} = ... |
504 |
|
|
$term->{iow} = urxvt::iow |
505 |
|
|
->new |
506 |
|
|
->fd (fileno $term->{socket}) |
507 |
|
|
->events (1) # wait for read data |
508 |
|
|
->start |
509 |
|
|
->cb (sub { |
510 |
|
|
my ($iow, $revents) = @_; |
511 |
|
|
# $revents must be 1 here, no need to check |
512 |
|
|
sysread $term->{socket}, my $buf, 8192 |
513 |
|
|
or end-of-file; |
514 |
|
|
}); |
515 |
|
|
|
516 |
|
|
$iow = new urxvt::iow |
517 |
|
|
Create a new io watcher object in stopped state. |
518 |
|
|
|
519 |
|
|
$iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) |
520 |
|
|
Set the callback to be called when io events are triggered. |
521 |
|
|
$reventmask is a bitset as described in the "events" method. |
522 |
|
|
|
523 |
|
|
$iow = $iow->fd ($fd) |
524 |
|
|
Set the filedescriptor (not handle) to watch. |
525 |
|
|
|
526 |
|
|
$iow = $iow->events ($eventmask) |
527 |
|
|
Set the event mask to watch. Bit #0 (value 1) enables watching for |
528 |
|
|
read data, Bit #1 (value 2) enables watching for write data. |
529 |
|
|
|
530 |
|
|
$iow = $iow->start |
531 |
|
|
Start watching for requested events on the given handle. |
532 |
|
|
|
533 |
|
|
$iow = $iow->stop |
534 |
|
|
Stop watching for events on the given filehandle. |
535 |
|
|
|
536 |
|
|
ENVIRONMENT |
537 |
|
|
URXVT_PERL_VERBOSITY |
538 |
|
|
This variable controls the verbosity level of the perl extension. Higher |
539 |
|
|
numbers indicate more verbose output. |
540 |
|
|
|
541 |
root |
1.8 |
=0 - only fatal messages |
542 |
|
|
=3 - script loading and management |
543 |
|
|
=10 - all events received |
544 |
root |
1.1 |
|
545 |
|
|
AUTHOR |
546 |
|
|
Marc Lehmann <pcg@goof.com> |
547 |
|
|
http://software.schmorp.de/pkg/rxvt-unicode |
548 |
|
|
|