Commit 7191cb6
committed
fix(grid): stop double-subtracting a cell child's margin (Auto-cell truncation)
GridLayout applied a cell child's own Margin twice: once when sizing/placing
the child (it subtracted childMargin to form the pass-2 re-measure width and
the arrange alignment box) and again inside the control's own paint (e.g.
MarkupControl insets its content by Margin). The result was content measured
and arranged at cellWidth - 2*margin, which truncated a tight Auto-cell label
("Animation" -> "Animati") and could force needless wrapping.
The framework convention (VerticalStackLayout / WindowContentLayout) is that
the container hands the child its full content box — border and container
padding removed — and the CONTROL owns its own margin. GridLayout now follows
it:
- pass-2 re-measure: add the child margin back onto the measure width
(innerW already excludes it; the control re-subtracts it), and
- arrange: align DesiredSize within the full content box without pre-
insetting by the child margin.
Update GridArrangeTests.CellChildMargin_InsetsWithinCell, which encoded the
old double-inset (it expected the child's bounds inset by its margin); it now
asserts full-cell bounds, matching every other layout. Add a regression test
(AutoColumn_MarginedMarkup_DoesNotWrap) and drop the Cells() workaround in the
GridDashboard Settings page (natural Auto tracks now render correctly).
Full suite green; AOT clean.1 parent e2ea15b commit 7191cb6
4 files changed
Lines changed: 74 additions & 17 deletions
File tree
- Examples/GridDashboard
- SharpConsoleUI.Tests
- Controls
- Layout
- SharpConsoleUI/Layout
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
| 266 | + | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
348 | 357 | | |
349 | 358 | | |
350 | 359 | | |
351 | 360 | | |
352 | 361 | | |
353 | | - | |
| 362 | + | |
354 | 363 | | |
355 | 364 | | |
356 | 365 | | |
| |||
572 | 581 | | |
573 | 582 | | |
574 | 583 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
582 | 591 | | |
583 | 592 | | |
584 | 593 | | |
585 | | - | |
586 | | - | |
| 594 | + | |
| 595 | + | |
587 | 596 | | |
588 | 597 | | |
589 | 598 | | |
| |||
0 commit comments