|
|
@@ -4,16 +4,82 @@
|
|
|
};
|
|
|
|
|
|
#local id {#[fg=brightwhite]$char[档案][账号]#[default]};
|
|
|
- #local name {#[fg=brightcyan]$char[档案][大名]#[default]};
|
|
|
- #local title {$char[档案][头衔]};
|
|
|
- #replace title {;} { };
|
|
|
- #local title {#[bold fg=red]$title#[default]};
|
|
|
+
|
|
|
+ #local name {$char[档案][彩色大名]};
|
|
|
+ #if { "$name" == "" } {#local name {$char[档案][大名]}};
|
|
|
+ #local name {@tmux.ConvertFromANSI{{$name}}};
|
|
|
+
|
|
|
+ #local title {$char[档案][彩色头衔]};
|
|
|
+ #if { "$title" == "" } {#local title {$char[档案][头衔]}};
|
|
|
+ #local title {@tmux.ConvertFromANSI{{$title}}};
|
|
|
+
|
|
|
#local file {tmux/$char[档案][账号]/char-data};
|
|
|
|
|
|
#script {tmp} {echo "ID: [$id] 大名: [$name] 头衔: [$title]" > $file};
|
|
|
#script {tmp} {tmux refresh};
|
|
|
};
|
|
|
|
|
|
+#function {tmux.ConvertFromANSI} {
|
|
|
+ #local title {%1};
|
|
|
+
|
|
|
+ #local {mode} {TEXT};
|
|
|
+ #local output {};
|
|
|
+ #local pending {};
|
|
|
+ #local ch {};
|
|
|
+ #parse {$title} {ch} {
|
|
|
+ #switch {"$mode"} {
|
|
|
+ #case {"TEXT"} {
|
|
|
+ #switch {"$ch"} {
|
|
|
+ #case {"\e"} {#local mode {ESC}};
|
|
|
+ #case {";"} {#cat output { }};
|
|
|
+ #default {#cat output {$ch}};
|
|
|
+ };
|
|
|
+ };
|
|
|
+ #case {"ESC"} {
|
|
|
+ #switch {"$ch"} {
|
|
|
+ #case {"["} {#cat output {#[}; #local mode {SGR}};
|
|
|
+ #default {#cat output {$ch}; #local mode {TEXT}};
|
|
|
+ };
|
|
|
+ };
|
|
|
+ #case {"SGR"} {
|
|
|
+ #switch {"$ch"} {
|
|
|
+ #case {"0"} {#cat output {default}};
|
|
|
+ #case {"1"} {#cat output {bold}};
|
|
|
+ #case {"2"} {#cat output {dim}};
|
|
|
+ #case {"3"} {#local mode {PENDING3}};
|
|
|
+ #case {"4"} {#local mode {PENDING4}};
|
|
|
+ #case {"5"} {#cat output {blink}};
|
|
|
+ #case {";"} {#cat output { }};
|
|
|
+ #default {
|
|
|
+ #if { "$pending" == "[" } {#cat output {default}};
|
|
|
+ #cat output {]};
|
|
|
+ #local mode {TEXT};
|
|
|
+ };
|
|
|
+ };
|
|
|
+ };
|
|
|
+ #case {"PENDING3"} {
|
|
|
+ #switch {"$ch"} {
|
|
|
+ #case {"%d"} {#cat output {fg=colour$ch}; #local mode {SGR}};
|
|
|
+ #case {";"} {#cat output {italics }; #local mode {SGR}};
|
|
|
+ #case {"m"} {#cat output {italics]}; #local mode {TEXT}};
|
|
|
+ #default {#cat output {$ch]}; #local mode {TEXT}};
|
|
|
+ };
|
|
|
+ };
|
|
|
+ #case {"PENDING4"} {
|
|
|
+ #switch {"$ch"} {
|
|
|
+ #case {"%d"} {#cat output {bg=colour$ch}; #local mode {SGR}};
|
|
|
+ #case {";"} {#cat output {underscore }; #local mode {SGR}};
|
|
|
+ #case {"m"} {#cat output {underscore]}; #local mode {TEXT}};
|
|
|
+ #default {#cat output {$ch]}; #local mode {TEXT}};
|
|
|
+ };
|
|
|
+ };
|
|
|
+ };
|
|
|
+ #local {pending} {$ch};
|
|
|
+ };
|
|
|
+
|
|
|
+ #return {$output};
|
|
|
+};
|
|
|
+
|
|
|
load-lib event;
|
|
|
|
|
|
event.Handle {char/status} {tmux} {ui} {tmux.UpdateCharData};
|