1 | #! perl |
1 | #! perl |
2 | |
2 | |
|
|
3 | # simple example that uses the add_lines hook to filter unicode and vt100 line/box graphics |
|
|
4 | |
3 | # ─━│┃┄┅┆┇┈┉┊┋┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏ |
5 | # ─━│┃┄┅┆┇┈┉┊┋┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏ |
4 | my $rep = "--||--||--||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--||" |
6 | my $rep_unicode = "--||--||--||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--||" |
5 | # ═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲ ╳╴╵╶╷╸╹╺╻╼╽╾╿▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟ |
7 | # ═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲ ╳╴╵╶╷╸╹╺╻╼╽╾╿▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟ |
6 | . "=|+++++++++++++++++++++++++++++++/\\X-|-|-|-|-|-|#____#######|||||###~###########"; |
8 | . "=|+++++++++++++++++++++++++++++++/\\X-|-|-|-|-|-|#____#######|||||###~###########"; |
|
|
9 | |
|
|
10 | # ↑↓→←█▚ ☃HIJKLMNOPQRSTUVWXYZ[\ ]^ ◆▒␉␌␍␊°±␋┘┐┌└┼⎺⎻─⎼⎽├┤┴┬│≤≥π≠£· |
|
|
11 | my $rep_acs = "↑↓<>#\\☃HIJKLMNOPQRSTUVWXYZ[\\]^ ◆#␉␌␍␊°±␋+++++⎺⎻-⎼⎽++++!<>π≠£·"; |
7 | |
12 | |
8 | sub on_add_lines { |
13 | sub on_add_lines { |
9 | my ($term, $str) = @_; |
14 | my ($self, $str) = @_; |
10 | |
15 | |
11 | $str =~ s/([\x{2500}-\x{259f}])/substr $rep, (ord $1) - 0x2500, 1/ge; |
16 | $str =~ s/([\x{2500}-\x{259f}])/substr $rep_unicode, (ord $1) - 0x2500, 1/ge; |
|
|
17 | |
|
|
18 | $str =~ s/([\x41-\x7e])/substr $rep_acs, (ord $1) - 0x41, 1/ge |
|
|
19 | if $self->cur_charset eq "0"; |
|
|
20 | |
12 | $term->scr_add_lines ($str); |
21 | $self->scr_add_lines ($str); |
13 | |
22 | |
14 | 1 |
23 | 1 |
15 | } |
24 | } |
16 | |
25 | |