Open GoogleCodeExporter opened 9 years ago
Sounds like a good suggestion. Would you prefer ^^ to insert a single ^ much
like
'\\' works in Python?
Original comment by jimstorch@gmail.com
on 27 Jan 2010 at 4:59
I have written mud client via www. When I have "^rboots" it is confusing. It is
interpreted as 'oots' written on red background while it ought to be just
'boots' in
red color. Thus adding c to all colors as a second filling character would be
great.
You can write ^rcboots then and everything is clear.
And it would be better I think if "^^" indeed works like \\ so it become single
^.
And for resetting colors (like ^^ now does) you could use ^xx for instance.
I hope that you are able to see my idea despite of my weak english.
PS: Thanks for sharing such a great piece of code.
Original comment by mich.mierzwa@gmail.com
on 28 Jan 2010 at 7:19
I've decided to change everything to use two-character codes.
Background colors will be set by ^[0-6] like so;
( '^0', '\x1b[40m' ), # black background
( '^1', '\x1b[41m' ), # red background
( '^2', '\x1b[42m' ), # green background
( '^3', '\x1b[43m' ), # yellow background
( '^4', '\x1b[44m' ), # blue background
( '^5', '\x1b[45m' ), # magenta background
( '^6', '\x1b[46m' ), # cyan background
Bold on and off will be ^! and ^. instead of ^! and ^1.
Underline on and off will be ^U and ^u.
Inverse on and off will be ^I and ^i.
Reset will be ^~
and ^^ will escape a caret.
I apologize if this causes anyone a lot of string editing.
Original comment by jimstorch@gmail.com
on 31 Jan 2010 at 6:58
Thanks a lot, that is great.
By the way.
It is up to you but slightly better would be use another "replace" character,
for
example that way:
if ansi:
text = text.replace('^^', '\0')
for token, code in _ANSI_CODES:
text = text.replace(token, code)
text = text.replace('\0', '^')
else:
text = strip_caret_codes(text)
return text
as '___^___' could possibly happen as a valid and expected sequence.
Original comment by mich.mierzwa@gmail.com
on 1 Feb 2010 at 12:05
I like your suggestion. Is there any chance that NULL (0x00) might be used for
an
extended character sequence in UTF?
Original comment by jimstorch@gmail.com
on 2 Feb 2010 at 12:57
I am afraid that I do not understand. Null is null, both in ASCI and UTF. I do
not
think it could become a problem, but... I am only amateur, I do not guarantee.
:)
Original comment by mich.mierzwa@gmail.com
on 3 Feb 2010 at 7:23
I wasn't sure if NULL held a special meaning in UTF-8 but looking at:
http://en.wikipedia.org/wiki/UTF-8
It doesn't appear so. I'm putting in the NULL substitution. We can always fix
it if
causes problems.
Original comment by jimstorch@gmail.com
on 3 Feb 2010 at 1:17
Original issue reported on code.google.com by
mich.mierzwa@gmail.com
on 26 Jan 2010 at 11:57