src/rxvtperl.xs
src/perl/example-refresh-hooks
-src/perl/example-filter-input
+src/perl/block-graphics-to-ascii
src/perl/digital-clock
src/perl/selection
src/perl/mark-urls
--- /dev/null
+#! perl
+
+# ─━│┃┄┅┆┇┈┉┊┋┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏
+my $rep = "--||--||--||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--||"
+# ═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲ ╳╴╵╶╷╸╹╺╻╼╽╾╿▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟
+ . "=|+++++++++++++++++++++++++++++++/\\X-|-|-|-|-|-|#____#######|||||###~###########";
+
+sub on_add_lines {
+ my ($term, $str) = @_;
+
+ $str =~ s/([\x{2500}-\x{259f}])/substr $rep, (ord $1) - 0x2500, 1/ge;
+ $term->scr_add_lines ($str);
+
+ 1
+}
+
+++ /dev/null
-#! perl
-
-# same url as used in "selection"
-my $url =
- qr{(
- (?:https?|ftp|news|mailto|file)://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~]+
- [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27(),~] # do not include a trailing dot, its wrong too often
- )}x;
-
-sub on_add_lines {
- my ($term, $str) = @_;
-
- while ($str =~ $url) {
- # found a url, first output preceding text
- $term->scr_add_lines (substr $str, 0, $-[1], "");
- # then toggle underline
- $term->rstyle ($term->rstyle ^ urxvt::RS_Uline);
- # now output the url
- $term->scr_add_lines (substr $str, 0, $+[1] - $-[1], "");
- # toggle undelrine again
- $term->rstyle ($term->rstyle ^ urxvt::RS_Uline);
- }
-
- # output trailing text
- $term->scr_add_lines ($str);
-
- 1
-}
-
XPUSHs (sv_2mortal (wcs2sv (wstr, wlen)));
}
+ break;
case DT_XEVENT:
{
=item mark-urls
-Uses per-line filtering (C<on_line_update>) to underline urls.
+Uses per-line display filtering (C<on_line_update>) to underline urls.
+
+=item block-graphics-to-ascii
+
+A not very useful example of filtering all text output to the terminal,
+by replacing all line-drawing characters (U+2500 .. U+259F) by a
+similar-looking ascii character.
=item example-refresh-hooks
window. Illustrates overwriting the refresh callbacks to create your own
overlays or changes.
-=item example-filter-input
-
-A not very useful example of filtering all text output to the terminal, by
-underlining all urls that matches a certain regex (i.e. some urls :). It
-is not very useful because urls that are output in multiple steps (e.g.
-when typing them) do not get marked.
-
=back
=head2 General API Considerations