From ed5378d9b0fd2597ac7e1d55dac53ebc306f3620 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 7 Sep 2026 12:59:43 +0200 Subject: [PATCH] =?UTF-8?q?fix(app):=20slice=207=20fix=20round=20B=20item?= =?UTF-8?q?=2010=20=E2=80=94=20no=20row-selection=20band=20on=20column=20g?= =?UTF-8?q?rids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VVS's own HudList grids (Monsters/Meta/Route/Items and every other grid this codebase has, present and future) have no row-selection highlight at all — only the per-cell click callbacks are a real VTank concept. UiMarkupList.DrawColumns painted a SelectedColor band under the selected row anyway (a holdover from the legacy single-column list path, which keeps its own band unchanged — that's a plain list, not a VVS grid). Removed the band draw from DrawColumns only; SelectedIndexSource still drives scroll-into-view, and every onclick/onchange callback is untouched. New test: ColumnGrids_NeverDrawARowSelectionBand (a column list with a real in-range selected index must never paint SelectedColor). Mutation check: before the fix this test was RED against the real code ("expected no SelectedColor fill in a column-based grid"); after removing the band draw it's green. tests/AcDream.Plugins.MossTank.Tests: 671/671 (unchanged — this is an App-layer fix, MossTank markup only consumes the existing grammar). tests/AcDream.App.Tests --filter Markup|Plugin|UiMenu|Slider: 277/3 skipped/280 (was 276/3/279, +1 new test). Co-Authored-By: Claude Fable 5.1 --- src/AcDream.App/UI/UiMarkupList.cs | 9 +++- .../UI/MarkupListColumnsTests.cs | 44 +++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/AcDream.App/UI/UiMarkupList.cs b/src/AcDream.App/UI/UiMarkupList.cs index 09dffb6f..ef8fce20 100644 --- a/src/AcDream.App/UI/UiMarkupList.cs +++ b/src/AcDream.App/UI/UiMarkupList.cs @@ -320,12 +320,17 @@ public sealed class UiMarkupList : UiElement context.DrawFill(0f, 0f, Width, Height, BackgroundColor); context.DrawRectOutline(0f, 0f, Width, Height, BorderColor, 1f); + // Fix round B item 10 (owner/oracle: VVS's own HudList grids have NO + // row-selection highlight at all — Monsters/Meta/Route/Items and + // every other grid). SelectedIndexSource above still + // drives scroll-into-view; the SelectedColor band draw the legacy + // single-column path (below, unaffected) uses is deliberately + // skipped here. Every per-cell onclick/onchange callback is + // unchanged — only the visual band is gone. int end = Math.Min(rowCount, _topRow + visibleRows); for (int index = _topRow; index < end; index++) { float y = (index - _topRow) * RowHeight; - if (index == selected) - context.DrawFill(1f, y + 1f, Width - 2f, RowHeight - 1f, SelectedColor); for (int c = 0; c < columns.Count; c++) { diff --git a/tests/AcDream.App.Tests/UI/MarkupListColumnsTests.cs b/tests/AcDream.App.Tests/UI/MarkupListColumnsTests.cs index 81002296..69db1f5b 100644 --- a/tests/AcDream.App.Tests/UI/MarkupListColumnsTests.cs +++ b/tests/AcDream.App.Tests/UI/MarkupListColumnsTests.cs @@ -551,6 +551,50 @@ public sealed class MarkupListColumnsTests "expected col0's icon clamped inside the 50px list width"); } + [Fact] + public void ColumnGrids_NeverDrawARowSelectionBand() + { + // Fix round B item 10 (owner/oracle: VVS's own HudList grids — + // Monsters/Meta/Route/Items and every other grid — + // have no row-selection highlight at all; only the per-cell click + // callbacks survive). DrawColumns must never paint SelectedColor, + // even when SelectedIndexSource reports a real in-range row. + var list = new UiMarkupList + { + Width = 100f, Height = 60f, RowHeight = 18f, + SelectedIndexSource = () => 1, + BackgroundColor = new Vector4(0f, 0f, 0f, 1f), + BorderColor = default, + SelectedColor = new Vector4(1f, 0f, 0f, 1f), // distinct, unmistakable + Columns = new[] + { + UiMarkupListColumn.Text(100f, () => new[] { "Row0", "Row1", "Row2" }, null), + }, + }; + var (renderer, ctx) = MakeContext(200f, 200f); + + list.DrawSelfAndChildren(ctx); + + bool anySelectedFill = renderer.DebugSpriteSegmentVerts.Any(s => + { + if (s.Texture != 0u) + return false; + for (int q = 0; q + 48 <= s.Verts.Count; q += 48) + { + float r = s.Verts[q + 4], g = s.Verts[q + 5], b = s.Verts[q + 6], a = s.Verts[q + 7]; + if (MathF.Abs(r - list.SelectedColor.X) < 0.01f + && MathF.Abs(g - list.SelectedColor.Y) < 0.01f + && MathF.Abs(b - list.SelectedColor.Z) < 0.01f + && MathF.Abs(a - list.SelectedColor.W) < 0.01f) + { + return true; + } + } + return false; + }); + Assert.False(anySelectedFill, "expected no SelectedColor fill in a column-based grid"); + } + // ── Draw-level: column x-offsets, check glyph, icon, clipping ──────────── private static (TextRenderer renderer, UiRenderContext ctx) MakeContext(float w, float h)