From 9c9b7ada1229fd76bef460d06ccd24cb1461ce39 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 6 Jan 2006 21:06:09 +0000 Subject: [PATCH] *** empty log message *** --- MANIFEST | 2 +- src/perl/block-graphics-to-ascii | 16 ++++++++++++++++ src/perl/example-filter-input | 29 ----------------------------- src/rxvtperl.xs | 1 + src/urxvt.pm | 15 +++++++-------- 5 files changed, 25 insertions(+), 38 deletions(-) create mode 100644 src/perl/block-graphics-to-ascii delete mode 100644 src/perl/example-filter-input diff --git a/MANIFEST b/MANIFEST index 0d367e93..f3eb8b49 100644 --- a/MANIFEST +++ b/MANIFEST @@ -171,7 +171,7 @@ src/rxvtperl.h 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 diff --git a/src/perl/block-graphics-to-ascii b/src/perl/block-graphics-to-ascii new file mode 100644 index 00000000..4bdb1b3a --- /dev/null +++ b/src/perl/block-graphics-to-ascii @@ -0,0 +1,16 @@ +#! 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 +} + diff --git a/src/perl/example-filter-input b/src/perl/example-filter-input deleted file mode 100644 index ce19f2bc..00000000 --- a/src/perl/example-filter-input +++ /dev/null @@ -1,29 +0,0 @@ -#! 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 -} - diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index ffed0dd2..ea90adbe 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -487,6 +487,7 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); } + break; case DT_XEVENT: { diff --git a/src/urxvt.pm b/src/urxvt.pm index d067439c..7f8cbfad 100644 --- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -64,7 +64,13 @@ Displays a digital clock using the built-in overlay. =item mark-urls -Uses per-line filtering (C) to underline urls. +Uses per-line display filtering (C) 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 @@ -72,13 +78,6 @@ Displays a very simple digital clock in the upper right corner of the 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 -- 2.34.1