fluffos/fluffos — pull request #132 by zoilder (2013-07-29 09:26:15+00:00)
Title: terminal_colour_text

A little change for sustitute texts with terminal_colour system.

In previous version, if apply terminal_colour_replace returns a text (not colour), in every new line, line starts with the last text retuns in that apply.

Example:
string terminal_colour_replace(string tx){
if(tx == "ME")
return this_object()->query_cap_name();
}

User text: say Hello, I'm %^YO_MISMO%^ and then bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla

Output in term with 75 cols length:
Dices en elfico: Hello, I'm Zoilder and then bla bla bla bla bla bla bla bla bla
Zoilder bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
Zoilder/obj>

In every line, it writes text returns by apply, because this system is for return only colours codes.

With my modification, if this apply doesn't returns a string, then executes second apply (terminal_colour_replace_text) and if it returns a string, it uses that text instead original.

Example:
string terminal_colour_replace_text(string tx){
if(tx == "ME")
return this_object()->query_cap_name();
}

User text: say Hello, I'm %^ME%^ and then bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla

Output with 75 cols length:
Dices en elfico: Hello, I'm Zoilder and then bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla

terminal_colour_replace : returns colour codes.
terminal_colour_replace_text: returns replace text.

it uses 2 applies for differentiate colour codes from texts.

Thank you very much.