diff --git a/src/Aquarium.Engine/Render/D3D12Renderer.cs b/src/Aquarium.Engine/Render/D3D12Renderer.cs index 5520e2e..268aeb3 100644 --- a/src/Aquarium.Engine/Render/D3D12Renderer.cs +++ b/src/Aquarium.Engine/Render/D3D12Renderer.cs @@ -318,7 +318,7 @@ public sealed class D3D12Renderer : IAquariumRenderer .Slider("Bloom Intensity", () => settings.BloomIntensity, value => settings = (settings with { BloomIntensity = Math.Clamp(value, GraphicsSettings.MinBloomIntensity, GraphicsSettings.MaxBloomIntensity) }).Normalized(), GraphicsSettings.MinBloomIntensity, GraphicsSettings.MaxBloomIntensity, "0.###", "Strength of pre-tonemap bloom energy.", () => activeDebugTab == 0) .Slider("Bloom Veil", () => settings.BloomVeilIntensity, value => settings = (settings with { BloomVeilIntensity = Math.Clamp(value, GraphicsSettings.MinBloomVeilIntensity, GraphicsSettings.MaxBloomVeilIntensity) }).Normalized(), GraphicsSettings.MinBloomVeilIntensity, GraphicsSettings.MaxBloomVeilIntensity, "0.###", "Low-frequency veil from bright HDR energy.", () => activeDebugTab == 0) .Section("Terminal", () => activeDebugTab == 1) - .TextBox("Session", TerminalDisplay, UpdateTerminalInputFromDisplay, lines: 8, acceptsReturn: false, submit: ExecuteTerminalInput, monospace: true, alignBottom: true, tooltip: "Terminal log with live command prompt.", isVisible: () => activeDebugTab == 1) + .TextBox("", TerminalDisplay, UpdateTerminalInputFromDisplay, lines: 8, acceptsReturn: false, submit: ExecuteTerminalInput, monospace: true, alignBottom: true, tooltip: "Terminal log with live command prompt.", isVisible: () => activeDebugTab == 1) .Section("Synth Playground", () => activeDebugTab == 2) .Options("Preset", () => synthPlaygroundPreset, SelectSynthPreset, SynthPresetOptions, "Loads a built-in synth patch.", () => activeDebugTab == 2) .Readout("Compile", () => $"{synthPlaygroundStatus.State}: {synthPlaygroundStatus.Message}", "Faust compile status.", () => activeDebugTab == 2) diff --git a/src/Aquarium.Engine/Render/DirectWriteOverlay.cs b/src/Aquarium.Engine/Render/DirectWriteOverlay.cs index d3ea450..1db1506 100644 --- a/src/Aquarium.Engine/Render/DirectWriteOverlay.cs +++ b/src/Aquarium.Engine/Render/DirectWriteOverlay.cs @@ -81,7 +81,7 @@ internal sealed class DirectWriteOverlay : IDisposable trackActiveBrush = renderTarget.CreateSolidColorBrush(new Color4(0.45f, 0.38f, 0.34f, 1.0f)); titleFormat = CreateTextFormat("Montserrat", 18.0f, FontWeight.Thin); smallFormat = CreateTextFormat("Ubuntu Sans", 11.0f, FontWeight.Regular); - monospaceFormat = CreateTextFormat("Ubuntu Sans Mono", 11.0f, FontWeight.Regular); + monospaceFormat = CreateTextFormat("Ubuntu Sans Mono", 11.0f, FontWeight.Regular, ParagraphAlignment.Near); } public void Render(AquariumFrame frame, int renderDebugMode, DebugUi? debugUi, IReadOnlyList clientUiPanels) @@ -184,7 +184,7 @@ internal sealed class DirectWriteOverlay : IDisposable direct2DFactory.Dispose(); } - private IDWriteTextFormat CreateTextFormat(string familyName, float size, FontWeight weight) + private IDWriteTextFormat CreateTextFormat(string familyName, float size, FontWeight weight, ParagraphAlignment paragraphAlignment = ParagraphAlignment.Center) { var format = directWriteFactory.CreateTextFormat( familyName, @@ -195,7 +195,7 @@ internal sealed class DirectWriteOverlay : IDisposable size, "en-us"); format.WordWrapping = WordWrapping.NoWrap; - format.ParagraphAlignment = ParagraphAlignment.Center; + format.ParagraphAlignment = paragraphAlignment; return format; } diff --git a/src/Aquarium.Engine/Render/Ui/DebugUi.cs b/src/Aquarium.Engine/Render/Ui/DebugUi.cs index 542f056..904e970 100644 --- a/src/Aquarium.Engine/Render/Ui/DebugUi.cs +++ b/src/Aquarium.Engine/Render/Ui/DebugUi.cs @@ -937,7 +937,7 @@ internal sealed class DebugUi private const float TextLineHeight = 18.0f; private const float VerticalPadding = 9.0f; - public override float LayoutHeight => LabelHeight + VerticalPadding * 2.0f + Math.Max(1, lines) * TextLineHeight; + public override float LayoutHeight => LabelLineHeight + VerticalPadding * 2.0f + Math.Max(1, lines) * TextLineHeight; public override bool UseMonospace => monospace; @@ -1002,9 +1002,13 @@ internal sealed class DebugUi ID2D1SolidColorBrush trackHoverBrush, ID2D1SolidColorBrush trackActiveBrush) { - var labelBounds = RectFromEdges(Bounds.Left + 8.0f, Bounds.Top, Bounds.Right - 8.0f, Bounds.Top + LabelHeight); - var box = RectFromEdges(Bounds.Left, Bounds.Top + LabelHeight, Bounds.Right, Bounds.Bottom); - target.DrawText(Label.ToUpperInvariant(), format, labelBounds, accentBrush, DrawTextOptions.Clip); + if (HasLabel) + { + var labelBounds = RectFromEdges(Bounds.Left + 8.0f, Bounds.Top, Bounds.Right - 8.0f, Bounds.Top + LabelHeight); + target.DrawText(Label.ToUpperInvariant(), format, labelBounds, accentBrush, DrawTextOptions.Clip); + } + + var box = RectFromEdges(Bounds.Left, Bounds.Top + LabelLineHeight, Bounds.Right, Bounds.Bottom); var focused = IsFocused || IsActive; target.FillRectangle(box, IsActive ? activeRowBrush : IsHovered ? hoverRowBrush : rowBrush); target.DrawRectangle(box, focused ? accentBrush : outlineBrush, focused ? 1.5f : 1.0f); @@ -1016,12 +1020,6 @@ internal sealed class DebugUi primaryBrush, DrawTextOptions.Clip); - if (focused) - { - var caretX = box.Right - 12.0f; - var caretBottom = box.Bottom - 8.0f; - target.DrawLine(new Vector2(caretX, caretBottom - TextLineHeight + 2.0f), new Vector2(caretX, caretBottom), accentBrush, 1.25f); - } } private string DisplayText() @@ -1047,6 +1045,10 @@ internal sealed class DebugUi return RectFromEdges(box.Left + 8.0f, top, box.Right - 8.0f, bottom); } + private bool HasLabel => !string.IsNullOrWhiteSpace(Label); + + private float LabelLineHeight => HasLabel ? LabelHeight : 0.0f; + private static bool IsEmptyPrompt(string value) { var normalized = value.Replace("\r\n", "\n", StringComparison.Ordinal).Replace('\r', '\n'); diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 5be3074..ee02c46 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -62,3 +62,4 @@ {"timestamp":"2026-05-12T13:20:00+01:00","topic":"debug-text-box-control","lesson":"Terminal commands and synth patch source need real text box controls, not row-value text fields. AquariumUiTextBox now carries line count, return behavior, and optional submit action through the contract; DirectWrite debug UI renders it as a boxed editable region. Use row Text only for compact scalar strings.","files":["src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs","src/Aquarium.Engine/Render/Ui/DebugUi.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","state/memory.json"],"source":"debug UI improvement pass"} {"timestamp":"2026-05-12T13:27:00+01:00","topic":"multiline-debug-terminal","lesson":"The debug terminal should be one multiline session surface: recent log lines plus the live prompt at the end. Typing updates only the trailing prompt, Enter submits that prompt and appends the command/output to the log. Avoid separate output readouts plus detached command rows for terminal UI.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Ui/DebugUi.cs","state/memory.json"],"source":"user terminal correction"} {"timestamp":"2026-05-12T13:42:00+01:00","topic":"terminal-textbox-polish","lesson":"Terminal text boxes need terminal typography and prompt-safe editing. Bundle Ubuntu Sans Mono for DirectWrite monospace surfaces, let AquariumUiTextBox opt into monospace and bottom alignment, and guard empty trailing prompts so backspace cannot collapse the prompt sentinel and reclassify the log as command input.","files":["src/Aquarium.Engine/Assets/Fonts/UbuntuSansMono.ttf","src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs","src/Aquarium.Engine/Render/Ui/DebugUi.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","state/memory.json"],"source":"user terminal polish correction"} +{"timestamp":"2026-05-12T13:55:00+01:00","topic":"terminal-surface-layout","lesson":"Terminal surfaces should not display ordinary text-box labels or fake corner carets. A terminal prompt is already the affordance. Use label-less text boxes for terminal sessions, use a near-aligned monospace text format, and bottom-align by drawing the terminal line list against the box bottom rather than relying on centered DirectWrite paragraph layout.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs","src/Aquarium.Engine/Render/Ui/DebugUi.cs","state/evidence.jsonl"],"source":"user visual correction"}