fix(chat): the unseen-text indicator follows its authored per-state visibility

Regression from cbab79d7, which I introduced: the indicator stopped showing at
all. Switching it from Visible to state-driven was half a correction — right
about retail's mechanism, wrong about what makes this element appear.

Measured, rather than reasoned about (LayoutDump gained --props for it):

    0x1000048C  state 13 Ghosted  0x3B = True    -> hidden
                state 1  Normal   0x3B = False   -> shown
                state 3  pressed  0x3B = False

Dat property 0x3B is "Invisible", authored PER STATE, and it is what puts this
element on screen. UiDatElement applies 0x3B on a state change; UiButton does
not, and this element builds as a button — so driving the state alone left it
hidden forever. The original Visible toggle was, by coincidence, exactly what
the authored data prescribes.

So the property is applied here rather than left unhonoured. That is the
authored data, not a visibility hack layered over the state machinery.

The state is still set, for the media it selects, but only on the way IN:
TrySetRetailState(Ghosted) means Enabled = false, and disabling the button
would also refuse the click that scrolls to the newest text — a second bug
waiting behind the first.

The test now pins VISIBILITY across the transitions instead of ActiveState.
The previous test passed while the feature was broken because the fixture
element carried no 0x3B, so the assertion could never see the property that
actually decides this. It fails now if the state is driven without the
visibility.

Proper fix noted for later: UiButton should honour per-state 0x3B the way
UiDatElement already does. That is a wider change than this regression wants.

Solution builds clean; full hermetic gate green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-21 10:33:26 +02:00
parent 7aae5ba939
commit a330d50df9
3 changed files with 58 additions and 26 deletions

View file

@ -23,6 +23,7 @@ if (args.Length == 0)
bool showStates = args.Contains("--states");
bool showColors = args.Contains("--colors");
bool showProps = args.Contains("--props");
uint[] ids = args.Where(a => !a.StartsWith("--"))
.Select(a => Convert.ToUInt32(a, a.StartsWith("0x") ? 16 : 10))
.ToArray();
@ -141,6 +142,30 @@ void Print(ElementInfo e, int depth)
}
}
// Raw property ids per state — ToggleBehavior (0x0B) and RolloverEnabled
// (0x13) change how a button interprets a state change, so "which state did
// I set" is not the whole story.
if (showProps)
{
foreach (var (stateId, state) in e.States)
{
if (state.Properties.Values.Count == 0)
continue;
string ids = string.Join(", ", state.Properties.Values
.OrderBy(kv => kv.Key)
.Select(kv => $"0x{kv.Key:X2}={Describe(kv.Value)}"));
static string Describe(UiPropertyValue v) => v.Kind switch
{
UiPropertyKind.Bool => v.BoolValue.ToString(),
UiPropertyKind.Integer => v.IntegerValue.ToString(),
UiPropertyKind.Enum => $"0x{v.UnsignedValue:X}",
_ => v.Kind.ToString(),
};
Console.WriteLine($"{pad} state {stateId}: props {ids}");
}
}
if (showStates && e.States.Count != 0)
{
string names = string.Join(", ", e.States