Twisol said:
MUSHclient has a bad case of order-sensitivity. Try ANSI(1,31) on for size.
Very helpful clue, thank you.
I can explain it, the tricky bit is to fix it.
If you look at the line info for that line:
Line 390 (390), Thursday, May 05, 6:59:08 AM
Flags = End para: no, Note: no, User input: no, Log: no, Bookmark: no
Length = 12, last space = -1
Text = "aaabbbcccddd"
4 style runs
1: Offset = 0, Length = 3, Text = "aaa"
No action.
Flags = Hilite: no, Underline: no, Blink: no, Inverse: no, Changed: no
Foreground colour RGB : R=255, G=255, B=0
Background colour RGB : R=0, G=0, B=0
2: Offset = 3, Length = 3, Text = "bbb"
No action.
Flags = Hilite: YES, Underline: no, Blink: no, Inverse: no, Changed: no
Foreground colour RGB : R=128, G=0, B=0
Background colour RGB : R=0, G=0, B=0
3: Offset = 6, Length = 3, Text = "ccc"
No action.
Flags = Hilite: YES, Underline: no, Blink: no, Inverse: no, Changed: no
Foreground colour RGB : R=255, G=255, B=0
Background colour RGB : R=0, G=0, B=0
4: Offset = 9, Length = 3, Text = "ddd"
No action.
Flags = Hilite: YES, Underline: no, Blink: no, Inverse: no, Changed: no
Foreground colour RGB : R=255, G=0, B=0
Background colour RGB : R=0, G=0, B=0
12 columns in 4 style runs
------ (end line information) ------
Notice how the bbb and the ddd lines are both marked "Flags = Hilite"? So it has correctly processed the highlight flag.
But why doesn't it display correctly? Well ... MUSHclient has three storage modes for lines, ANSI-lookup, custom-lookup, and RGB.
The first two only store an index (palette number) and at display time that index is looked-up. So, if you are using ANSI or custom colours you can change the colour configuration and the screen redraws in the new colours (even text already received).
So if you were in those modes, the order of receiving colour/highlight or highlight/colour would not matter. The colour lookup is deferred anyway.
But by using the 256-ANSI code, it switches the style-run to RGB-colour. These colours are looked-up now, not at display time. Now the problem arises.
It gets 31 (red) and looks that up in the ANSI table (from world ANSI configuration page). It finds non-bold red (ie. 128) and stores that.
Then it gets 1 (bold), but this does not trigger a colour lookup. It just turns on the bold flag. Now this would work for ANSI/Custom colours because the colours are looked up later. But for the RGB colours, it really needs to relookup the colour. But this is the rub, it hasn't remembered 31. It remembers R=128,G=0,B=0. So it can't relookup the previously processed colour. |