[TF] Colour preservation in arguments
Brought to you by:
kenkeys
|
From: hawkeye at tcp.c. (K. Keys) - 2003-04-17 03:20:10
|
I don't have an immediate solution for you, but both of these are taken care of in 5.0 (not yet released). Display attributes in string values are preserved by just about every string operation, including commands, variables, expression operators, functions, regexp substitutions, $() command substitution, and status bar field expressions. (For those of you who have looked at the code, this means internally that virtually all occurances of char*, String, and Aline have been replaced with a new structure which is a combination of String and Aline.) Sorry, I don't have an estimate on when 5.0 will be released. On Wed, Apr 16, 2003 at 05:17:55PM +0200, Waba wrote: > Hi list, > > I have encountered two problems about disappearing colours: > > > The first one concerns ANSI escapes and the -p option in /echo and > /substitute: the escape char (\033) is stripped off from the arguments > passed to these commands if the -p option is specified. > > Example: let %line be a variable containing ANSI escapes (for example a > line sent by the server), > /echo %line > will display it correctly in colours, while > /echo -p %line > will have no colour attributes, and [xxm sequences where the colour > changes were. > > It is fixed here: http://mumetools.sf.net/tf/tf-colours.diff > > > The second one concerns TF's internal colour format and argument passing: > internally, all commands accept plain strings (char*) instead of > "internally formatted" strings (aline*), while -a/-P colouring produces > alines. Thus, all text formatting added with -P or -a options is lost when > this text is passed as argument. For example, > /echo $(/echo -aBCgreen foo) > will echo a plain 'foo' in place of a bold, green 'foo'. > (I hope I RTFSed it right, since my coding style is quite different from > Ken Key's one). > > This causes me some problems to do the following: Let's say that Abc is > a dangerous character killing his own side (team). I want to notice him > so I do > /def -Fp2 -mregexp -t"Abc" -P0BCred t1 > Then I want to ease running after people so I replace movement messages: > /def -mregexp -t" leaves east.$" -ag t2 = /echo - %PL leaves >> EAST >> > Now if the server sends me "Abc leaves east.", Abc won't be in bold red > anymore, since %PL will have lost the colouring made by t1. > > I'm not willing to replace all char* types by aline* in the TF sources > (especially since the second one is a structure, handled in a completely > different way). Is it any workaround that I could use ? I thought about > adding raw ANSI escapes in t1, but it won't work in the case Abc appears > in a line coloured by the server: > ^[[33mInfortunatePlayer narrates 'Abc same-sided me'^[[0m > would become after t1 > ^[[33mInfortunatePlayer narrates '^[[31;1mAbc^[[0m same-sided me'^[[0m > and remove the yellow (33) colouring of the "same-sided me'" part. > > Thank you much, > Waba > -- > [www.ebb.org/ungeek] GCS/IT d-- a--- C++++ ULVB++++ P+++ L+++$>++++$ R+ > E---(-) W+(-) N+(++) w---(--) PE(--) PGP+ tv-- b+(+++) D++ h* r-- y? > _______________________________________________ > TinyFugue mailing list > Tin...@tc... > http://www.tcp.com/mailman/listinfo/tinyfugue -- Ken Keys <ha...@tc...> TinyFugue 4.0 stable 1: http://tf.tcp.com/~hawkeye/tf/ |