From 792638241bd785d5a0bf66b253decc7c8d4f8a35 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Nov 2026 23:55:51 +0000 Subject: [PATCH 001/113] fix(tui): status row, meters and settings screens at 80 columns The status row wrapped to a second row at 80x24, the meters vanished below 120 columns, and F2/F4 drew their editors off the right-hand edge at 80. The status row now drops its encoding and palette hints before wrapping, meters fall back to a compact percentage form, two-column screens too narrow for both columns show the one the keyboard is in, and header/footer bars elide text rather than clipping their keys. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- src/SharpMUTerm.Tui/AliasesScreenRenderer.cs | 2 +- src/SharpMUTerm.Tui/KeypadScreenRenderer.cs | 2 +- src/SharpMUTerm.Tui/KeypadScreenView.cs | 19 ++++- src/SharpMUTerm.Tui/MarkupText.cs | 79 +++++++++++++++++++ src/SharpMUTerm.Tui/MsspScreenRenderer.cs | 2 +- src/SharpMUTerm.Tui/OptionsScreenRenderer.cs | 2 +- src/SharpMUTerm.Tui/ScreenChrome.cs | 41 ++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 45 ++++++++++- src/SharpMUTerm.Tui/StatusMeterRenderer.cs | 28 ++++++- src/SharpMUTerm.Tui/TimersScreenRenderer.cs | 2 +- src/SharpMUTerm.Tui/TriggersScreenRenderer.cs | 2 +- src/SharpMUTerm.Tui/TriggersScreenView.cs | 15 +++- src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 2 +- 13 files changed, 223 insertions(+), 18 deletions(-) diff --git a/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs b/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs index acfe3682..298d4dd9 100644 --- a/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs @@ -114,7 +114,7 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo var title = $"[bold {Value}] Aliases[/]"; var hints = ScreenChrome.Hints( ScreenChrome.ListHints, "F3", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false); - return SpreadLR(" " + title, hints, width); + return SpreadTitle(" " + title, hints, width); } /// diff --git a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs index 6b413d6d..4af1b236 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs @@ -203,7 +203,7 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo var title = $"[bold {Value}] Keypad & hotkeys[/]"; var hints = ScreenChrome.Hints( ScreenChrome.SingleListHints, "F4", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false); - return SpreadLR(" " + title, hints, width); + return SpreadTitle(" " + title, hints, width); } /// diff --git a/src/SharpMUTerm.Tui/KeypadScreenView.cs b/src/SharpMUTerm.Tui/KeypadScreenView.cs index 10ec3420..82204dd4 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenView.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenView.cs @@ -38,14 +38,25 @@ public static IWindowControl Build( // While a key capture is armed the binding row swaps its key well for a prompt twice the width, // so the list asks for more and the diagram gives it up for as long as the prompt is up. The // numpad is the one thing on this screen with nothing to do with the keystroke being waited for. + var rows = ScreenChrome.Rows(height); + var hotkeysMinimum = focus?.Edit is { Capture: true } + ? KeypadScreenRenderer.CaptureWidth + : KeypadScreenRenderer.MinHotkeysWidth; + if (ScreenChrome.TooNarrowForTwo(width, KeypadScreenRenderer.MinNumpadWidth, hotkeysMinimum)) + { + // The diagram is a picture of the bindings the list already holds, so a narrow screen drops it + // and keeps the list, which is where every key on this screen acts. + var only = KeypadScreenRenderer.HotkeysColumn(macros, focus, sets, selected, width); + return ScreenChrome.Single( + header, footer, ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(only, rows))), + only.Count, rows); + } + var numpad = ScreenChrome.SplitWidth( width, KeypadScreenRenderer.NumpadWidth(macros), KeypadScreenRenderer.MinNumpadWidth, - focus?.Edit is { Capture: true } - ? KeypadScreenRenderer.CaptureWidth - : KeypadScreenRenderer.MinHotkeysWidth); - var rows = ScreenChrome.Rows(height); + hotkeysMinimum); var left = KeypadScreenRenderer.NumpadColumn(macros, numpad); var right = KeypadScreenRenderer.HotkeysColumn( macros, focus, sets, selected, width <= 0 ? numpad : width - numpad - ScreenChrome.ColumnDivider); diff --git a/src/SharpMUTerm.Tui/MarkupText.cs b/src/SharpMUTerm.Tui/MarkupText.cs index 892b185f..62115705 100644 --- a/src/SharpMUTerm.Tui/MarkupText.cs +++ b/src/SharpMUTerm.Tui/MarkupText.cs @@ -68,7 +68,86 @@ internal static string SpreadLR(string left, string right, int width) return $"{left} {right}"; } + // When both do not fit, the left gives way: on every bar that calls this the right is the keys + // (Esc, ⏎), and a bar that clipped them off the edge named an action without its key. + var room = width - VisibleLength(right) - 1; + if (VisibleLength(left) > room) + { + left = ElideVisible(left, room); + } + var gap = Math.Max(1, width - VisibleLength(left) - VisibleLength(right)); return left + new string(' ', gap) + right; } + + /// + /// for a screen's header, where the left is the screen's title and the right + /// its key hints. Here the right gives way: the title says where the reader is, and the hints that + /// fall off the end (the close key last of all) are repeated in the action bar. + /// + internal static string SpreadTitle(string title, string hints, int width) + { + if (width > 0 && VisibleLength(title) + 1 + VisibleLength(hints) > width) + { + hints = ElideVisible(hints, Math.Max(0, width - VisibleLength(title) - 1)); + } + + return SpreadLR(title, hints, width); + } + + /// + /// Cuts a markup string to visible cells, ending in … when anything + /// was cut. Tags are kept, including those after the cut, so every span that opened still closes. + /// + internal static string ElideVisible(string markup, int width) + { + if (VisibleLength(markup) <= width) + { + return markup; + } + + var budget = Math.Max(0, width - 1); + var result = new System.Text.StringBuilder(markup.Length); + var shown = 0; + var cut = false; + + void Visible(string text) + { + if (shown < budget) + { + result.Append(text); + shown++; + } + else if (!cut) + { + cut = true; + if (width > 0) + { + result.Append('…'); + } + } + } + + for (var i = 0; i < markup.Length; i++) + { + var c = markup[i]; + if ((c == '[' || c == ']') && i + 1 < markup.Length && markup[i + 1] == c) + { + Visible(new string(c, 2)); + i++; + continue; + } + + if (c == '[' && markup.IndexOf(']', i) is var close and > 0) + { + result.Append(markup, i, close - i + 1); + i = close; + continue; + } + + Visible(c.ToString()); + } + + return result.ToString(); + } } diff --git a/src/SharpMUTerm.Tui/MsspScreenRenderer.cs b/src/SharpMUTerm.Tui/MsspScreenRenderer.cs index 21be61b3..7424a72f 100644 --- a/src/SharpMUTerm.Tui/MsspScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/MsspScreenRenderer.cs @@ -168,7 +168,7 @@ internal static ScreenModel Model( internal static string HeaderLine(int width) { var hints = $"[{Label}]↑↓ scroll · [/][{Accent}]Esc[/][{Label}] back [/]"; - return SpreadLR($" [bold {Value}] {Escape(Title)}[/]", hints, width); + return SpreadTitle($" [bold {Value}] {Escape(Title)}[/]", hints, width); } /// The screen's action bar: where the cursor is in the report, and the key that leaves. diff --git a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs index 0e304809..58757a33 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs @@ -95,7 +95,7 @@ internal static string HeaderLine( Escape(fkey), model?.HasEditableRow ?? false, focus); - return SpreadLR(" " + heading, hints, width); + return SpreadTitle(" " + heading, hints, width); } /// diff --git a/src/SharpMUTerm.Tui/ScreenChrome.cs b/src/SharpMUTerm.Tui/ScreenChrome.cs index aa4af073..ab484d64 100644 --- a/src/SharpMUTerm.Tui/ScreenChrome.cs +++ b/src/SharpMUTerm.Tui/ScreenChrome.cs @@ -773,6 +773,47 @@ internal static IWindowControl Split( return root.Build(); } + /// + /// Whether a two-column screen has too few cells for both columns at their minimums. Below that + /// still hands the list its minimum, and the column beside it runs off the + /// right-hand edge: F2 and F4 lost their editors that way at 80 columns. Such a screen shows one + /// column at a time instead (), the one the keyboard is in. + /// + internal static bool TooNarrowForTwo(int width, int minimum, int companion) => + width > 0 && width < minimum + ColumnDivider + companion; + + /// + /// 's frame with one column in the body, for a screen too narrow for two + /// (). Same header, same action bar, same content-sized body. + /// + internal static IWindowControl Single( + MarkupControl header, MarkupControl footer, MarkupControl column, int content, int rows) + { + var root = Controls.Grid() + .WithAlignment(HorizontalAlignment.Stretch) + .WithVerticalAlignment(VerticalAlignment.Fill); + + if (rows <= 0) + { + root.Rows(GridLength.Cells(1), GridLength.Star(1), GridLength.Cells(1)).Columns(GridLength.Star(1)); + root.Place(header, 0, 0, 1, 1); + root.Place(column, 1, 0, 1, 1); + root.Place(footer, 2, 0, 1, 1); + return root.Build(); + } + + root.Rows( + GridLength.Cells(1), + GridLength.Cells(Math.Clamp(content, 1, rows)), + GridLength.Star(1), + GridLength.Cells(1)) + .Columns(GridLength.Star(1)); + root.Place(header, 0, 0, 1, 1); + root.Place(column, 1, 0, 1, 1); + root.Place(footer, 3, 0, 1, 1); + return root.Build(); + } + /// Widens a column panel to its arranged width so its content isn't hugged. internal static MarkupControl Stretch(MarkupControl control) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 8c187c52..65d95165 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -13084,9 +13084,11 @@ private string StatusBarMarkup(string character, string state) // "utf-8" means the server agreed, "utf-8 assumed" means nobody said, "iso-8859-1 forced" means // you did. With nothing connected there is no fact to report, and the cell is not drawn — the // same rule that took the address and the invented latency meter off this row. + string? encodingCell = null; if (EffectiveEncoding() is { } encoding) { - right.Add($"[dim]{Escape(encoding.Label)}[/]"); + encodingCell = $"[dim]{Escape(encoding.Label)}[/]"; + right.Add(encodingCell); } // The character count lives at the bottom now (the input gutter is gone); while recalling @@ -13096,7 +13098,39 @@ private string StatusBarMarkup(string character, string state) ? $"[{AccentHex(AccentPalette[0])}]history[/] [dim]· ↓ back to draft[/]" : $"[dim]{ActiveBar().Text.Length} chars[/]"); - right.Add("[dim]⌃P palette[/]"); + const string paletteCell = "[dim]⌃P palette[/]"; + right.Add(paletteCell); + + // The cluster above is built unconditionally, and at 80 columns a scrolled-back pane's segment + // made it one cell too wide: the row wrapped, a pane lost a row and every server was told a new + // size. Give cells back until it fits, least useful first — the encoding (a fact that rarely + // changes), then the palette hint (⌃P is also on the header's menu button), and only then the + // character count. The scrollback segment and the identity are never dropped: they are the + // only places those facts are said. + // + // The meters count here too: on a narrow terminal they are worth more to someone in a fight than + // either of those two cells, and they used to be the thing that lost — at 80 columns a world + // publishing HP showed none of it. + var compactMeters = meters.Length > 0 + ? StatusMeterRenderer.Render(StatusMeters(), StatusData(), $"{_ink.Notice}", compact: true) + : string.Empty; + var meterCost = compactMeters.Length > 0 ? 3 + MarkupWidth(compactMeters) + MeterSlack : 0; + foreach (var droppable in new[] { encodingCell, paletteCell }) + { + if (droppable is null + || MarkupWidth(left) + MinStatusGap + MarkupWidth(string.Join(" ", right)) + meterCost <= HeaderWidth()) + { + continue; + } + + right.Remove(droppable); + } + + if (right.Count > 1 + && MarkupWidth(left) + MinStatusGap + MarkupWidth(string.Join(" ", right)) > HeaderWidth()) + { + right.RemoveAt(right.Count - 1); + } // The focus hint goes in last and only if it fits. This row is a *sticky* band whose length // changes at runtime, and a cluster that overflows the width wraps it onto a second row — which @@ -13109,6 +13143,13 @@ private string StatusBarMarkup(string character, string state) // The meters sit beside the identity they describe, and only when the row has room for them with a // few cells to spare: the character count on the right grows as a line is typed, and a cluster that // came and went with it would be worse than one that is absent on a narrow terminal. + if (meters.Length > 0 + && MarkupWidth(left) + 3 + MarkupWidth(meters) + MarkupWidth(rightBar) + MinStatusGap + MeterSlack > HeaderWidth()) + { + // Too narrow for value/max: the share alone, in a field just as fixed. + meters = StatusMeterRenderer.Render(StatusMeters(), StatusData(), $"{_ink.Notice}", compact: true); + } + if (meters.Length > 0 && MarkupWidth(left) + 3 + MarkupWidth(meters) + MarkupWidth(rightBar) + MinStatusGap + MeterSlack <= HeaderWidth()) { diff --git a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs index e17a767c..1c5566a2 100644 --- a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs +++ b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs @@ -26,8 +26,16 @@ internal static class StatusMeterRenderer /// Below this share of its maximum a value is drawn in the warning ink. internal const double LowShare = 0.25; - /// The meters that have a value, as one markup run, or empty when none does. - internal static string Render(IReadOnlyList meters, GameDataStore data, string lowInk) + /// The cells a compact meter's share takes: 100%. + internal const int ShareWidth = 4; + + /// + /// The meters that have a value, as one markup run, or empty when none does. + /// draws a meter that has a numeric maximum as its share (hp 82%) in a reserved + /// -cell field, for a status row too narrow for value/max; a meter with no + /// usable maximum is drawn as its value either way. + /// + internal static string Render(IReadOnlyList meters, GameDataStore data, string lowInk, bool compact = false) { var cells = new List(); foreach (var meter in meters) @@ -40,6 +48,15 @@ internal static string Render(IReadOnlyList meters, GameDataStore d var max = string.IsNullOrWhiteSpace(meter.Max) ? null : StatusMeter.Read(data, meter.Max); var low = IsLow(value, max); var label = MarkupText.Escape(meter.Label); + if (compact && Share(value, max) is { } share) + { + var percent = $"{Math.Clamp((int)Math.Round(share * 100), 0, 999)}%".PadLeft(ShareWidth); + cells.Add(low + ? $"[dim]{label}[/] [bold {lowInk}]{percent}[/]" + : $"[dim]{label}[/] [bold]{percent}[/]"); + continue; + } + var shown = MarkupText.Escape(StatusMeter.Fit(value, ValueWidth).PadLeft(ValueWidth)); var cell = low ? $"[dim]{label}[/] [bold {lowInk}]{shown}[/]" @@ -55,10 +72,13 @@ internal static string Render(IReadOnlyList meters, GameDataStore d return string.Join(" ", cells); } - private static bool IsLow(string value, string? max) => + private static bool IsLow(string value, string? max) => Share(value, max) < LowShare; + + private static double? Share(string value, string? max) => max is not null && double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var v) && double.TryParse(max, NumberStyles.Float, CultureInfo.InvariantCulture, out var m) && m > 0 - && v / m < LowShare; + ? v / m + : null; } diff --git a/src/SharpMUTerm.Tui/TimersScreenRenderer.cs b/src/SharpMUTerm.Tui/TimersScreenRenderer.cs index f405171a..a5a84937 100644 --- a/src/SharpMUTerm.Tui/TimersScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/TimersScreenRenderer.cs @@ -114,7 +114,7 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo var title = $"[bold {Value}] Timers[/]"; var hints = ScreenChrome.Hints( ScreenChrome.ListHints, "F6", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false); - return SpreadLR(" " + title, hints, width); + return SpreadTitle(" " + title, hints, width); } /// diff --git a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs index 0919e78e..5d71b3ea 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs @@ -264,7 +264,7 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo var title = $"[bold {Value}] Triggers & spawn routing[/]"; var hints = ScreenChrome.Hints( ScreenChrome.ListHints, "F2", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false); - return SpreadLR(" " + title, hints, width); + return SpreadTitle(" " + title, hints, width); } /// diff --git a/src/SharpMUTerm.Tui/TriggersScreenView.cs b/src/SharpMUTerm.Tui/TriggersScreenView.cs index 14e3871c..9df2af08 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenView.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenView.cs @@ -35,12 +35,25 @@ public static IWindowControl Build( // Body: rule list │ editor, as two real columns. The split is a function of the screen's width: // at 120 the rule list keeps the share it was designed with, and at 100 it gives cells back to // the editor rather than letting the attribute legend run off the right-hand edge. + var body = ScreenChrome.Rows(height); + if (ScreenChrome.TooNarrowForTwo( + width, TriggersScreenRenderer.MinColumnWidth, TriggersScreenRenderer.MinEditorWidth)) + { + // One column at a time: the rule list, or the editor once the keyboard has moved into it or + // ⏎ has opened one of the rule's fields, which are drawn in the editor and nowhere else. + var only = focus is { } f && (f.InPane(1) || f.IsEditing) + ? TriggersScreenRenderer.EditorColumn(sets, selectedTrigger, routeTargets, focus, width, body, theme) + : TriggersScreenRenderer.RulesColumn(sets, selectedTrigger, focus, width); + return ScreenChrome.Single( + header, footer, ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(only, body))), + only.Count, body); + } + var rules = ScreenChrome.SplitWidth( width, TriggersScreenRenderer.ColumnWidth, TriggersScreenRenderer.MinColumnWidth, TriggersScreenRenderer.MinEditorWidth); - var body = ScreenChrome.Rows(height); var left = TriggersScreenRenderer.RulesColumn(sets, selectedTrigger, focus, rules); var right = TriggersScreenRenderer.EditorColumn( sets, selectedTrigger, routeTargets, focus, diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index 1e6e93c7..79f7fb6a 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -299,7 +299,7 @@ internal static string HeaderLine( focus, model?.HasRemovableRow ?? false, model?.HasDetailRow ?? false); - return SpreadLR(" " + title, hints, width); + return SpreadTitle(" " + title, hints, width); } /// From ba27130742f8e87afba6a517fed2c77e89607bcd Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Nov 2026 23:59:47 +0000 Subject: [PATCH 002/113] feat(tui): /connect opens a world by name or adds one from a host --plain had no way to add a world on a first run: the settings screens are not usable there. /connect [port] [tls] saves a new world and dials it; /connect opens a configured one. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs | 147 ++++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 10 +- .../ConnectCommandTests.cs | 125 +++++++++++++++ 3 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/ConnectCommandTests.cs diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs new file mode 100644 index 00000000..cefe5bd8 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs @@ -0,0 +1,147 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Session; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// /connect: open a world from the command line. A configured world is reached by name; anything else +/// is read as a host (and port), saved as a new world and dialled. It exists because --plain has no +/// settings screens a screen reader can use, so a first run there had no way to add a world at all, and it is +/// the quickest way in everywhere else too. +/// +internal sealed partial class SharpMUTermApp +{ + /// The port a host given without one is dialled on, the same default as the command line's. + internal const int DefaultConnectPort = 4000; + + /// What /connect with nothing after it says. + internal const string ConnectUsage = "/connect , or /connect [port] [tls] to add one"; + + private void ConnectCommand(string windowId, string arguments) + { + var words = arguments.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + var tls = words.Any(IsTlsWord); + words = words.Where(word => !IsTlsWord(word)).ToArray(); + + if (words.Length == 0) + { + AppendWindowLine(windowId, $"[dim]*** {Escape(ConnectUsage)}[/]"); + if (_config.Worlds.Count > 0) + { + var names = string.Join(", ", _config.Worlds.Select(world => world.Name)); + AppendWindowLine(windowId, $"[dim]*** worlds: {Escape(names)}[/]"); + } + + return; + } + + var world = _config.Worlds.FirstOrDefault( + known => string.Equals(known.Name, string.Join(' ', words), StringComparison.OrdinalIgnoreCase)); + if (world is null) + { + if (ParseEndpoint(words) is not { } endpoint) + { + RefuseCommand($"no world called {Snippet(string.Join(' ', words))}, and that is not a host — {ConnectUsage}"); + return; + } + + world = new WorldDefinition + { + Name = UniqueWorldName(endpoint.Host), + Host = endpoint.Host, + Port = endpoint.Port, + UseTls = tls, + }; + _config.Worlds.Add(world); + SaveConfiguration(); + Notice($"added {world.Name} ({world.Host}:{world.Port}) — F5 edits it", MessageSeverity.Info, "F5"); + } + + var character = world.Characters.FirstOrDefault(); + var key = character is null ? world.Name : $"{world.Name}.{character.Name}"; + var session = _sessions.Find(key); + if (session is null) + { + session = OpenSession(world, character); + BindSession(session, OpenSessionWindow(session)); + } + + Activate(OpenSessionWindow(session)); + UpdateStatus(); + UpdateInputChrome(); + + if (session.State is not (ConnectionState.Connected or ConnectionState.Connecting)) + { + LastCommand = DialAtStartupAsync(session); + } + } + + private static bool IsTlsWord(string word) => + word.Equals("tls", StringComparison.OrdinalIgnoreCase) + || word.Equals("--tls", StringComparison.OrdinalIgnoreCase); + + /// + /// Reads host port, host:port or a bare host. A bracketed IPv6 address keeps its colons. Null + /// when the words are not one host with at most one port, so a mistyped world name is refused rather than + /// saved as a world that dials a host called "my world". + /// + internal static (string Host, int Port)? ParseEndpoint(IReadOnlyList words) + { + if (words.Count is 0 or > 2) + { + return null; + } + + var host = words[0]; + var port = DefaultConnectPort; + if (words.Count == 2) + { + if (!TryPort(words[1], out port)) + { + return null; + } + } + else if (host.StartsWith('[') && host.IndexOf("]:", StringComparison.Ordinal) is var close and > 0) + { + if (!TryPort(host[(close + 2)..], out port)) + { + return null; + } + + host = host[..(close + 1)]; + } + else if (host.Count(c => c == ':') == 1) + { + var colon = host.IndexOf(':'); + if (!TryPort(host[(colon + 1)..], out port)) + { + return null; + } + + host = host[..colon]; + } + + host = host.Trim('[', ']'); + return Uri.CheckHostName(host) == UriHostNameType.Unknown ? null : (host, port); + } + + private static bool TryPort(string text, out int port) => + int.TryParse(text, out port) && port is > 0 and <= 65535; + + /// A world name not already taken: the host, then the host with a number after it. + private string UniqueWorldName(string host) + { + bool Taken(string name) => _config.Worlds.Any( + world => string.Equals(world.Name, name, StringComparison.OrdinalIgnoreCase)); + + var name = host; + for (var n = 2; Taken(name); n++) + { + name = $"{host} {n}"; + } + + return name; + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 65d95165..bfe1d20d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -2472,7 +2472,7 @@ internal async Task StartAsync(IReadOnlyList startup) /// The empty-workspace message when there is nothing to connect because there is nothing at all. internal const string NoWorldsNotice = - "No world configured. Pass a host/port on the command line, or add one on F5."; + "No world configured. Type /connect , pass one on the command line, or add one on F5."; /// /// And when there are worlds but none of their characters is marked. It is the ordinary state of a @@ -4616,6 +4616,14 @@ private void OnCommandEntered(InputBar bar, string command) return; } + // `/connect` opens a world by name, or adds one from a host and dials it. + if (command.StartsWith("/connect", StringComparison.OrdinalIgnoreCase) + && (command.Length == 8 || command[8] == ' ')) + { + ConnectCommand(windowId, command[8..].Trim()); + return; + } + // `/package` opens the Packages screen; `/package install …` reads one for review. if (command.StartsWith("/package", StringComparison.OrdinalIgnoreCase) && (command.Length == 8 || command[8] == ' ')) diff --git a/tests/SharpMUTerm.Tui.Tests/ConnectCommandTests.cs b/tests/SharpMUTerm.Tui.Tests/ConnectCommandTests.cs new file mode 100644 index 00000000..4a9c574b --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/ConnectCommandTests.cs @@ -0,0 +1,125 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// /connect: the way into a world from the command line alone, which is the only way --plain has. +/// +[NotInParallel] +public class ConnectCommandTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static (SharpMUTermApp App, RecordingTelnetSession Wire, AppConfiguration Config) Open( + Action? configure = null) + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + configure?.Invoke(config); + var wire = new RecordingTelnetSession(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32)); + app.TelnetFactory = _ => wire; + return (app, wire, config); + } + + private static void Type(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + } + + [Test] + public async Task AHostAndPortAddAWorldAndDialIt() + { + var (app, _, config) = Open(); + await using var _app = app; + + Type(app, "/connect mud.example.org 4201 tls"); + await app.LastCommand; + + await Assert.That(config.Worlds.Count).IsEqualTo(1); + var world = config.Worlds[0]; + await Assert.That(world.Name).IsEqualTo("mud.example.org"); + await Assert.That(world.Host).IsEqualTo("mud.example.org"); + await Assert.That(world.Port).IsEqualTo(4201); + await Assert.That(world.UseTls).IsTrue(); + await Assert.That(app.FindSession("mud.example.org")!.State) + .IsEqualTo(ConnectionState.Connected); + } + + [Test] + public async Task AConfiguredWorldIsReachedByNameAndNotAddedAgain() + { + var (app, _, config) = Open(c => c.Worlds.Add(new WorldDefinition + { + Name = "Convergence", + Host = "convergence.example", + Port = 4201, + Characters = { new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() } }, + })); + await using var _app = app; + + Type(app, "/connect convergence"); + await app.LastCommand; + + await Assert.That(config.Worlds.Count).IsEqualTo(1); + await Assert.That(app.FindSession("Convergence.Ann")!.State).IsEqualTo(ConnectionState.Connected); + } + + [Test] + public async Task ConnectingTwiceReusesTheSession() + { + var (app, _, config) = Open(); + await using var _app = app; + + Type(app, "/connect mud.example.org 4201"); + await app.LastCommand; + var first = app.FindSession("mud.example.org"); + Type(app, "/connect mud.example.org"); + await app.LastCommand; + + await Assert.That(config.Worlds.Count).IsEqualTo(1); + await Assert.That(app.FindSession("mud.example.org")).IsSameReferenceAs(first); + } + + [Test] + public async Task AMistypedNameIsRefusedRatherThanSavedAsAHost() + { + var (app, wire, config) = Open(); + await using var _app = app; + + Type(app, "/connect my favourite world"); + + await Assert.That(config.Worlds).IsEmpty(); + await Assert.That(wire.Lines).IsEmpty(); + } + + [Test] + [Arguments("host.example", "host.example", 4000)] + [Arguments("host.example:23", "host.example", 23)] + [Arguments("[::1]:4201", "::1", 4201)] + [Arguments("10.0.0.5", "10.0.0.5", 4000)] + public async Task EndpointsAreReadInEveryUsualShape(string text, string host, int port) + { + var endpoint = SharpMUTermApp.ParseEndpoint(new[] { text }); + + await Assert.That(endpoint).IsEqualTo((host, port)); + } + + [Test] + [Arguments("host.example", "0")] + [Arguments("host.example", "70000")] + [Arguments("host.example", "telnet")] + public async Task ABadPortIsNoEndpoint(string host, string port) + { + await Assert.That(SharpMUTermApp.ParseEndpoint(new[] { host, port })).IsNull(); + } +} From e330da2ae41a9cc4afccaea03a587a5134778e19 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 00:02:37 +0000 Subject: [PATCH 003/113] feat(window): bundle JetBrains Mono and Nerd Font symbols A machine with no Nerd Font installed drew every chrome icon in the window as a box, and text fell back to whatever monospace face the system had. The window now carries JetBrains Mono (OFL 1.1) and Symbols Nerd Font Mono (MIT) as embedded resources, used after any preferred installed face, and ships their licences beside the executable. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- src/SharpMUTerm.Avalonia/CellFonts.cs | 61 +++++++++++- .../Fonts/JetBrainsMono-Bold.ttf | Bin 0 -> 277828 bytes .../Fonts/JetBrainsMono-BoldItalic.ttf | Bin 0 -> 279832 bytes .../Fonts/JetBrainsMono-Italic.ttf | Bin 0 -> 276840 bytes .../Fonts/JetBrainsMono-OFL.txt | 93 ++++++++++++++++++ .../Fonts/JetBrainsMono-Regular.ttf | Bin 0 -> 273900 bytes src/SharpMUTerm.Avalonia/Fonts/README.md | 14 +++ .../Fonts/SymbolsNerdFont-LICENSE.txt | 21 ++++ .../Fonts/SymbolsNerdFontMono-Regular.ttf | Bin 0 -> 2507556 bytes .../SharpMUTerm.Avalonia.csproj | 10 ++ .../BundledFontTests.cs | 35 +++++++ 11 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-Bold.ttf create mode 100644 src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-BoldItalic.ttf create mode 100644 src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-Italic.ttf create mode 100644 src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-OFL.txt create mode 100644 src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-Regular.ttf create mode 100644 src/SharpMUTerm.Avalonia/Fonts/README.md create mode 100644 src/SharpMUTerm.Avalonia/Fonts/SymbolsNerdFont-LICENSE.txt create mode 100644 src/SharpMUTerm.Avalonia/Fonts/SymbolsNerdFontMono-Regular.ttf create mode 100644 tests/SharpMUTerm.Avalonia.Tests/BundledFontTests.cs diff --git a/src/SharpMUTerm.Avalonia/CellFonts.cs b/src/SharpMUTerm.Avalonia/CellFonts.cs index 65959ba3..0c086d93 100644 --- a/src/SharpMUTerm.Avalonia/CellFonts.cs +++ b/src/SharpMUTerm.Avalonia/CellFonts.cs @@ -24,9 +24,27 @@ internal sealed class CellFonts : IDisposable "CaskaydiaMono Nerd Font", "CaskaydiaCove Nerd Font Mono", "CaskaydiaCove Nerd Font", "JetBrainsMono Nerd Font Mono", "JetBrainsMono Nerd Font", "FiraCode Nerd Font Mono", "Cascadia Mono", "Cascadia Code", "JetBrains Mono", "Consolas", "SF Mono", "Menlo", + ]; + + /// + /// Installed faces tried after the bundled JetBrains Mono: they are on most machines, so they used to be + /// what a window without a preferred face drew in, and none of them is a face anybody picked. + /// + private static readonly string[] LastResortFamilies = + [ "DejaVu Sans Mono", "Liberation Mono", "Noto Sans Mono", "Courier New", ]; + /// The bundled faces (Fonts/), loaded once and never disposed: every grid shares them. + private static readonly Lazy BundledRegular = new(() => Bundled("JetBrainsMono-Regular.ttf")); + private static readonly Lazy BundledBold = new(() => Bundled("JetBrainsMono-Bold.ttf")); + private static readonly Lazy BundledItalic = new(() => Bundled("JetBrainsMono-Italic.ttf")); + private static readonly Lazy BundledBoldItalic = new(() => Bundled("JetBrainsMono-BoldItalic.ttf")); + private static readonly Lazy BundledSymbols = new(() => Bundled("SymbolsNerdFontMono-Regular.ttf")); + + /// The family name the bundled text face reports. + internal const string BundledFamily = "JetBrains Mono"; + private readonly ConcurrentDictionary<(int CodePoint, bool Bold, bool Italic), SKFont> _fonts = new(); private readonly SKTypeface _regular; private readonly SKTypeface _bold; @@ -141,9 +159,32 @@ private SKFont Create(int codePoint, bool bold, bool italic) } } - return null; + return BundledSymbols.Value is { } bundled && bundled.ContainsGlyph(codePoint) ? bundled : null; + } + + /// Whether the bundled faces are in this build, for a test to hold the packaging to. + internal static bool HasBundledFaces => BundledRegular.Value is not null && BundledSymbols.Value is not null; + + private static SKTypeface? Bundled(string file) + { + using var stream = typeof(CellFonts).Assembly.GetManifestResourceStream($"Fonts.{file}"); + if (stream is null) + { + return null; + } + + using var data = SKData.Create(stream); + return data is null ? null : SKTypeface.FromData(data); } + private static SKTypeface? BundledText(SKFontStyle style) => (style.Weight >= (int)SKFontStyleWeight.SemiBold, style.Slant != SKFontStyleSlant.Upright) switch + { + (true, true) => BundledBoldItalic.Value, + (true, false) => BundledBold.Value, + (false, true) => BundledItalic.Value, + _ => BundledRegular.Value, + }; + private static readonly string[] SymbolFamilies = [ "Symbols Nerd Font Mono", "Symbols Nerd Font", .. PreferredFamilies.Where(f => f.Contains("Nerd Font", StringComparison.Ordinal)), @@ -162,6 +203,24 @@ private SKFont Create(int codePoint, bool bold, bool italic) face?.Dispose(); } + // The bundled face is asked for by its own name, so a family that resolves to it (the regular face's, + // when bold is matched after it) gets the bundled weights rather than a system fallback. + if (BundledText(style) is { } bundled) + { + return bundled; + } + + foreach (var name in LastResortFamilies) + { + var face = SKFontManager.Default.MatchFamily(name, style); + if (face is not null && string.Equals(face.FamilyName, name, StringComparison.OrdinalIgnoreCase)) + { + return face; + } + + face?.Dispose(); + } + return SKFontManager.Default.MatchFamily("monospace", style); } } diff --git a/src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-Bold.ttf b/src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-Bold.ttf new file mode 100644 index 0000000000000000000000000000000000000000..8c93043de6454ad2d5575f0751150c6551d9c588 GIT binary patch literal 277828 zcmc${4V;zJ`u~5e`(A4|J*eq9O~#(RXKJb`(Uei6Ml(I=fh0_cW@@4+LWdASNJ0o9 zgd8F4k|Tr;Ax;P(2|Xc%oD-sl`Ms~b_Rer}e&6r^`~AKCdA)tsz1FqXy4JeZec$W8 z_skwKBGQomS;_2M*1J!W_3mZ~m+Te^+VvfL?C}r2P|m<0V*IJa$ZFRaWPUD`~$K z>>xnn0xnmn|+eoKybiewd!KYMg##;LDu6FIwp68fO)s5trUE~yNPXAu~Z=M`bUG04ccbkH!n0r6_kXo$+q9aj>(B^Q6|39Q2 zZ7YLd;GZyn{5p`? zFUp$Jr=o4gK*x6sl%>*ooaPA9`{QWxwSLF_@W1J^uD|;Gp%r=Qar`Ge7Q32ca{Ncq zV^zPq{XgU&+E%nbUC;ZYFZqRV7^pve{)eR7P(3u&rl$9Y`o$Hg`gJtDZvQ7bgm#n@ zAuEN(Go7xLN*{uzVo?3N{xmKchsqkXBz@GMpy$FZ zu)k~N{$l*UnU_nye_YRctoi>H^t`W$j-}{N*xz|pfbE}AW8SNGv99)mXzcYm_(x74 zFOB+B`Un0iWBcEnXC1rxq36)U@EB;kb?$V{q_63!YMZ`CaXv{tq|dkX`P7g+z4mKe zElanf>vOq<(0<4ym-}^#qMk zI<9)n84SA4|LC{+sBLP#`keMV?WgAJwNuXNw=Zb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1U zcMW1+QeG-Qjm)IwTeg7p(Wf*2jh>%=ocPV2&ReghBOR>|G)5{;S70cb+^;2)Pe_#Y0R;pXUDXaUS z$D%Qa5#dugF-8Si*m3V>nPK1W^YK1&$Ol-ku+dKe3%323J0b7^_rB!UZRXxOI6H1DxXZpfBP7o5h3}%5VBw#Cdf(Kr8`=! z+ruJTu4#}@Jf6ZVMQ^Ty;9)%ll2aGmRf-4W=mef~r5xe+eerdv>|}IwP1fvxDq~6* zI)~h%3%X-te}*uPD_F7rOwrg`m~l)|uMy@PQxF-D)n#+{%u+ZH!)_Y8EpG|DCX2*a zk48W8cFqMm;O$IFTBZ7n`fNGSMSF}&&+oe7d<2Yj|(`? zbAsLS8l7t&PG;FZ)pq8`xlPKiTAt_sh35}`#&TSH9$Bh8=MtwWjm zbmrvh!^y6;ProH#?5RzD&LB|p{JqLAG|CsNC2v=Qot5%LXV_nyQ7D}f6g`smD<*g< zkIX#NImhy`&V&4Pp0T_zo-D_-lp3sRn44S~uq8n| zg8qFF%1Jfwpq8T=D7Heq6F+9%6fpONG5D;nz^7 zv>!0FPHW(;2EvRCdf3~4N!QbOE#Se??QfZ!)tkrID5QM RXt+-ctVzYaTEQjd{{RH8A$|Y= literal 0 HcmV?d00001 diff --git a/src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-BoldItalic.ttf b/src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-BoldItalic.ttf new file mode 100644 index 0000000000000000000000000000000000000000..1ddf216d1884ab44789c0c86dc06f6556c4c4e22 GIT binary patch literal 279832 zcmcG%4V+ce+y8&9z1KQT>G_#5ojGTwQd2@wnQF{T&mk3N5>0v#iV#8wAxT0AA%qZ4 z2_f_)gb+eV&j@`9q4Y4n_qEqK8NS@V|9$`OUtVvYwb#DZ3hK?4g zS^czO=Zz!2Hs!TMvrZdx(WnQUZS)1nlEy4I4Xh>??0w zB;lFVC)Rh|+2@V_`Qx+ClJFer-*?8ib4QMw`p)cZk+I{k|5&tdf}=m&J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VZAv&oaAt8-Qp|45r0jYD@5gzgB4QxXfeVP@I8P|!9`x_G9^eeOK zF=IQ?rxxZHJK&T)jd;9wf^Xmk@_8>rJ#FYTl5_eC49wP-6xBWkRDEE3-qCH>Ex##1Zp9FZ^O?tG`WeX!>XW#X+RxGgOY=7cmhDf5CN1%%Kn)yk zI9iplUY#ohvt9^#je)5BQcA(B^*#eh-QeUcXsN&mr_kO;xv2)J^oBy~Q`)C8JoYn+6n72h=*MRlE8h!@CE5m9McL6UeaOy;uT2mT&)K4chsZwZ`#u$ z-DXK%uAdSHZ#m@pW{~5cb(oat%unRxTHpmEhwP^GsejFtt+3Su5T%8cjFi8y@6-v1eQ+;!LtI)EbHYKXP=|4DMx^+y|?|+ZYaXdb@#;3yO=I zRWjc+;|Il*bZ~#EuqAQZWp30j&zZrUgUw7K2g|sggZcfX&i>Nb`hz;#mzSEMA}9QB sBcEI%+-uGcTY31ByfBR}#LsVc<9@k;2&NKGV_JwI*f^n<2rQWY3j_0XZ2$lO literal 0 HcmV?d00001 diff --git a/src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-Italic.ttf b/src/SharpMUTerm.Avalonia/Fonts/JetBrainsMono-Italic.ttf new file mode 100644 index 0000000000000000000000000000000000000000..ccc9d6a5bc15ffbcce66f923bf3d7999c73ede84 GIT binary patch literal 276840 zcmcG%4V+ce+y8&9z1KQT&(rfTna-S)mJVwb#1VwI24`YwdH+PK<~& z;2$fg{rmLoC*5kDC1Lq0ks!POkYkVUeR!)>37^<5l3m#U_~C^&J~XgE!VS41qkA2D z{GlBicBwsC#LUM^>6nS5CueT#vrnWs6rM5W{3+3#r|M1@nKYR5i^okqZQ`kihL?(r z8ZT0>&S|61C9hz=d^wtO+JpJ#T|LX-D?-5D26V4hlI;Bs&V#?diah-{yr%tZFqH!P2PbGbH(&&j}mu~Jo zT*6WgBdsQ%b?%g(J~(TVgyX2spt+OJ89RCQn+q~TCQc#22cm5g9Q|I${-3TKRln!Y zQa{{5jC{6ZTy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q5@tx2PwMY1Rt)Z#TE?|4g<=(2DDjPX*h=!=U^3X z7oVIpIK!+)&R}i@M#UvIu+YWv%V4kZAuh=#7>JKe2qTvo^qzp?B!CjiNn8ZKimIsu z_;t&WtXwxp9} zL=)d9wPobAexR4HM?j%R_P)Zaiflda=2sj8_Tx*HpD#Og45}>m07?Di)4o2krG!7V znj@|JX0Uf&BJ22lck&0wbafhew~TKk^)gA>>gHyKD^rsShC8sjky9{xIEPke3e}G1qhmyDgE+OvLkN7V}6aMyoW^N=iZ4`>C)}Vyg z!O|H-!Itqs{wP@%m%xxEjN;=@$**63JzmUTu6={y&+u>TB87kDNAZ8U>sJ@cN%=s8 zOy++f;pF(*t+IkdXg^2herlJ9D;vq(3J$>fl*oh4EaWT3=O^$>J22le@Jx&FW;M

  • public PaneTint Tint { get; set; } + /// + /// The id of the layout this character's windows use (), or null to + /// follow the world's. An id that names no layout any more falls through to the next step of + /// rather than failing; no migration marks anybody. + /// + public string? Layout { get; set; } + /// Logging is configured per character. public LoggingSettings Logging { get; set; } = new(); @@ -179,6 +186,7 @@ public sealed class CharacterDefinition OnDisconnect = OnDisconnect, TriggerSets = new List(TriggerSets), Tint = Tint, + Layout = Layout, Logging = new LoggingSettings { Format = Logging.Format, diff --git a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs index b7787f89..c234a6ce 100644 --- a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs +++ b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs @@ -187,6 +187,20 @@ public sealed class WorldDefinition ///
    public TerminalColor Accent { get; set; } = TerminalColor.Default; + /// + /// The id of the layout this world's characters use when they name none of their own, or null for none. + /// See . + /// + public string? Layout { get; set; } + + /// + /// The layout the player accepted when the client suggested one for this world + /// (), or null when no suggestion was accepted. Below + /// in : a choice the player made outright wins + /// over one they only agreed to. + /// + public string? AcceptedLayoutSuggestion { get; set; } + /// The characters that can connect to this world. public List Characters { get; set; } = new(); @@ -219,6 +233,8 @@ public sealed class WorldDefinition GrabPrefix = GrabPrefix, GmcpLogin = GmcpLogin, DiscordPresence = DiscordPresence, + Layout = Layout, + AcceptedLayoutSuggestion = AcceptedLayoutSuggestion, Characters = Characters.Select(c => c.Clone()).ToList(), }; diff --git a/src/SharpMUTerm.Core/Layouts/BuiltInLayouts.cs b/src/SharpMUTerm.Core/Layouts/BuiltInLayouts.cs new file mode 100644 index 00000000..e2e988d5 --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/BuiltInLayouts.cs @@ -0,0 +1,58 @@ +namespace SharpMUTerm.Core.Layouts; + +/// +/// The layouts every client has. Read-only: they are not in config.json, +/// refuses to change them, and changing one is saving a copy. +/// +public static class BuiltInLayouts +{ + /// The id of . + public const string RoleplayId = "roleplay"; + + /// The id of . + public const string CombatId = "combat"; + + /// + /// For posing: the output with a composer docked under it, who is in the room beside it, and the capture + /// windows as a tab behind who-here. What every world gets when nothing else applies. + /// + public static LayoutDefinition Roleplay { get; } = new() + { + Id = RoleplayId, + Name = "Roleplay", + IsBuiltIn = true, + Placements = + [ + new PanelPlacement { PanelId = PanelIds.Output, Region = LayoutRegion.Main, Order = 0 }, + new PanelPlacement { PanelId = PanelIds.Composer, Region = LayoutRegion.Bottom, Order = 0 }, + new PanelPlacement { PanelId = PanelIds.WhoHere, Region = LayoutRegion.Side, Order = 0 }, + new PanelPlacement { PanelId = PanelIds.Chat, Region = LayoutRegion.Side, Order = 1, TabOf = PanelIds.WhoHere }, + ], + }; + + /// + /// For fighting: a meter strip across the top, the output, the map beside it, the capture windows collapsed + /// under the map, and a quick bar under the output. + /// + public static LayoutDefinition Combat { get; } = new() + { + Id = CombatId, + Name = "Combat", + IsBuiltIn = true, + Placements = + [ + new PanelPlacement { PanelId = PanelIds.Vitals, Region = LayoutRegion.TopStrip, Order = 0 }, + new PanelPlacement { PanelId = PanelIds.Output, Region = LayoutRegion.Main, Order = 0 }, + new PanelPlacement { PanelId = PanelIds.Map, Region = LayoutRegion.Side, Order = 0, Size = 2 }, + new PanelPlacement { PanelId = PanelIds.Chat, Region = LayoutRegion.Side, Order = 1, Collapsed = true }, + new PanelPlacement { PanelId = PanelIds.QuickBar, Region = LayoutRegion.Bottom, Order = 0 }, + ], + }; + + /// Both, in the order a picker lists them. + public static IReadOnlyList All { get; } = [Roleplay, Combat]; + + /// The built-in with , or null. + public static LayoutDefinition? Find(string? id) => + All.FirstOrDefault(l => string.Equals(l.Id, id, StringComparison.Ordinal)); +} diff --git a/src/SharpMUTerm.Core/Layouts/LayoutDefinition.cs b/src/SharpMUTerm.Core/Layouts/LayoutDefinition.cs new file mode 100644 index 00000000..70043ac3 --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/LayoutDefinition.cs @@ -0,0 +1,93 @@ +using System.Text.Json.Serialization; + +namespace SharpMUTerm.Core.Layouts; + +/// +/// The area of the window a panel is placed in. Host-neutral: the terminal folds these into its pane split tree +/// (), the desktop window into dock panes. +/// +public enum LayoutRegion +{ + /// The centre, where the output sits. Several main panels share it side by side. + Main, + + /// A column on the right of the main area. Several side panels stack top to bottom. + Side, + + /// A band under the main area (not under the side column). Several sit side by side. + Bottom, + + /// A thin band across the top of the whole window, for a meter strip. Several sit side by side. + TopStrip, +} + +/// One panel's place in a . +public sealed record PanelPlacement +{ + /// The panel, one of (an unknown id is kept and skipped). + public string PanelId { get; init; } = string.Empty; + + /// Which area it sits in. + public LayoutRegion Region { get; init; } = LayoutRegion.Main; + + /// Its position among the panels of its region, lowest first. Ties keep list order. + public int Order { get; init; } + + /// + /// Its share of its region against the other panes there, as a weight: two panes of 1 and 3 take a quarter + /// and three quarters. Zero or less is read as 1. A tab's size is not read (its pane's is). + /// + public double Size { get; init; } = 1; + + /// Whether it starts collapsed: placed, but shown as a title the player can open. + public bool Collapsed { get; init; } + + /// + /// The panel whose pane this one joins as a tab, or null for a pane of its own. When that panel is not drawn + /// (unknown, collapsed, or without data yet), this one takes a pane of its own in its own region. + /// + public string? TabOf { get; init; } +} + +/// +/// A saved arrangement of panels: which exist and where they sit. Whether a placed panel is actually drawn is a +/// separate question, answered per session by . +/// +/// Immutable: changes a layout by replacing it, so a built-in handed out by +/// cannot be edited in place. +/// +/// +public sealed record LayoutDefinition +{ + /// The stable id characters and worlds refer to. Never shown; survives a rename. + public string Id { get; init; } = string.Empty; + + /// The name the player sees and picks by. + public string Name { get; init; } = string.Empty; + + /// + /// Whether this is one of . Never read from or written to a file, so a + /// hand-edited configuration cannot make a layout of its own read-only. + /// + [JsonIgnore] + public bool IsBuiltIn { get; init; } + + /// The panels, in no particular order (each carries its ). + public IReadOnlyList Placements { get; init; } = []; + + /// + /// How much of the window each region takes, as a fraction of the axis it divides: + /// of the width, and of the height. A + /// region left out takes 's value. takes + /// what is left and is not read from here. Null (the default) is "all defaults". + /// + public IReadOnlyDictionary? RegionShares { get; init; } + + /// The placements naming a panel this client can draw (). + [JsonIgnore] + public IEnumerable KnownPlacements => Placements.Where(p => PanelIds.IsKnown(p.PanelId)); + + /// The known placement for , or null when the layout does not place it. + public PanelPlacement? PlacementOf(string panelId) => + KnownPlacements.FirstOrDefault(p => string.Equals(p.PanelId, panelId, StringComparison.Ordinal)); +} diff --git a/src/SharpMUTerm.Core/Layouts/LayoutFold.cs b/src/SharpMUTerm.Core/Layouts/LayoutFold.cs new file mode 100644 index 00000000..b6c8df6b --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/LayoutFold.cs @@ -0,0 +1,127 @@ +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Core.Layouts; + +/// +/// A layout folded into the workspace's own split tree, for one session. +/// +/// +/// The tree, built from and exactly as a workspace's is, except that a +/// pane's are panel ids rather than window ids — the host maps each to whatever +/// draws it. Pane ids are panel:<id of the pane's first panel>. Null only when nothing is drawn. +/// +/// Placed collapsed and with data: the host shows each as a title the player can open. +/// Placed, known, and without data yet: drawn once says so. +public sealed record LayoutFoldResult( + LayoutNode? Root, + IReadOnlyList Collapsed, + IReadOnlyList Waiting); + +/// +/// Folds a into a split tree, the shape the terminal's workspace already draws: +/// +/// Column[ TopStrip, Row[ Column[ Main, Bottom ], Side ] ] +/// +/// with any empty region left out. Panels in one region share it side by side (main, bottom, top strip) or stacked +/// (side), weighted by . Unknown panel ids are skipped, a collapsed panel is listed +/// rather than given a pane, and a panel without data is left out until it has some. +/// +/// A tab joins its host's pane only when the host has a pane of its own (is drawn and is not itself a tab); +/// otherwise it takes a pane in its own region. One level, so there are no chains or cycles to resolve. +/// +/// +public static class LayoutFold +{ + /// The share of the window a region takes when the layout does not say. + public static double DefaultShare(LayoutRegion region) => region switch + { + LayoutRegion.Side => 0.3, + LayoutRegion.Bottom => 0.2, + LayoutRegion.TopStrip => 0.1, + _ => 1.0, + }; + + /// The prefix of every pane id the fold makes. + public const string PanePrefix = "panel:"; + + /// Folds ; with no , every known panel has data. + public static LayoutFoldResult Fold(LayoutDefinition layout, IPanelAvailability? availability = null) + { + ArgumentNullException.ThrowIfNull(layout); + + var known = layout.KnownPlacements + .Select((p, index) => (Placement: p, Index: index)) + .OrderBy(x => x.Placement.Order) + .ThenBy(x => x.Index) + .Select(x => x.Placement) + .ToList(); + + bool HasData(PanelPlacement p) => availability?.HasData(p.PanelId) ?? true; + + var collapsed = known.Where(p => p.Collapsed && HasData(p)).ToList(); + var waiting = known.Where(p => !HasData(p)).ToList(); + var drawn = known.Where(p => !p.Collapsed && HasData(p)).ToList(); + + // A panel drawn twice would be two panes holding one thing; the first placement wins. + drawn = drawn.DistinctBy(p => p.PanelId, StringComparer.Ordinal).ToList(); + + var hosts = drawn.Where(p => p.TabOf is null).Select(p => p.PanelId).ToHashSet(StringComparer.Ordinal); + bool IsTab(PanelPlacement p) => p.TabOf is not null && hosts.Contains(p.TabOf) + && !string.Equals(p.TabOf, p.PanelId, StringComparison.Ordinal); + + var sequence = 0; + LayoutNode? Region(LayoutRegion region, SplitDirection direction) + { + var panes = new List<(PaneNode Pane, double Size)>(); + foreach (var slot in drawn.Where(p => p.Region == region && !IsTab(p))) + { + var tabs = new List { slot.PanelId }; + tabs.AddRange(drawn.Where(p => IsTab(p) && string.Equals(p.TabOf, slot.PanelId, StringComparison.Ordinal)) + .Select(p => p.PanelId)); + panes.Add((new PaneNode(PanePrefix + slot.PanelId, tabs, sequence: ++sequence), slot.Size > 0 ? slot.Size : 1)); + } + + return panes.Count switch + { + 0 => null, + 1 => panes[0].Pane, + _ => new SplitNode(direction, panes.Select(p => (LayoutNode)p.Pane).ToList(), panes.Select(p => p.Size).ToList()), + }; + } + + double Share(LayoutRegion region) => + Math.Clamp(layout.RegionShares?.GetValueOrDefault(region, DefaultShare(region)) ?? DefaultShare(region), 0.05, 0.9); + + // Numbered in the order a reader meets them: main first, then what is around it. + var main = Region(LayoutRegion.Main, SplitDirection.Row); + var bottom = Region(LayoutRegion.Bottom, SplitDirection.Row); + var side = Region(LayoutRegion.Side, SplitDirection.Column); + var top = Region(LayoutRegion.TopStrip, SplitDirection.Row); + + var centre = Join(main, bottom, SplitDirection.Column, Share(LayoutRegion.Bottom), secondIsShare: true); + var body = Join(centre, side, SplitDirection.Row, Share(LayoutRegion.Side), secondIsShare: true); + var root = Join(top, body, SplitDirection.Column, Share(LayoutRegion.TopStrip), secondIsShare: false); + + return new LayoutFoldResult(root, collapsed, waiting); + } + + /// + /// Two nodes along one axis, either of which may be missing. is the fraction the + /// region-shaped one takes: the second when , else the first. + /// + private static LayoutNode? Join(LayoutNode? first, LayoutNode? second, SplitDirection direction, double share, bool secondIsShare) + { + if (first is null) + { + return second; + } + + if (second is null) + { + return first; + } + + var sizes = secondIsShare ? new[] { 1 - share, share } : new[] { share, 1 - share }; + return new SplitNode(direction, [first, second], sizes); + } +} diff --git a/src/SharpMUTerm.Core/Layouts/LayoutLibrary.cs b/src/SharpMUTerm.Core/Layouts/LayoutLibrary.cs new file mode 100644 index 00000000..3a2c0423 --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/LayoutLibrary.cs @@ -0,0 +1,156 @@ +namespace SharpMUTerm.Core.Layouts; + +/// What did: changed the layout in place, or saved a copy. +/// The layout that now holds the placements. +/// True when the named layout was a built-in and a new one was saved instead. +public sealed record LayoutSaveResult(LayoutDefinition Layout, bool CreatedNew); + +/// +/// The layouts a player can pick from: first, then their own, which live in the list +/// handed in (AppConfiguration.Layouts). Every change is made to that list, so saving the configuration +/// is what persists it; this type writes no file. +/// +/// A built-in is never changed. on one saves a copy under a fresh name, and +/// and refuse. Names are unique across the whole library, ignoring case, +/// so a picker never shows two rows that read the same. +/// +/// +public sealed class LayoutLibrary +{ + private readonly List _user; + private readonly Func _newId; + + /// The player's layouts, changed in place. + /// Makes the id of a new layout; a GUID by default. A test passes its own. + public LayoutLibrary(List userLayouts, Func? newId = null) + { + _user = userLayouts ?? throw new ArgumentNullException(nameof(userLayouts)); + _newId = newId ?? (() => Guid.NewGuid().ToString("N")); + } + + /// The built-ins, then the player's layouts in the order they were saved. + public IReadOnlyList All => [.. BuiltInLayouts.All, .. _user]; + + /// + /// The layout with , or null. A built-in wins over a saved layout that happens to carry + /// the same id, so a hand-edited file cannot shadow one. + /// + public LayoutDefinition? Find(string? id) + { + if (string.IsNullOrEmpty(id)) + { + return null; + } + + return BuiltInLayouts.Find(id) + ?? _user.FirstOrDefault(l => string.Equals(l.Id, id, StringComparison.Ordinal)); + } + + /// Whether some layout other than is already called . + public bool IsNameTaken(string name, string? exceptId = null) => + All.Any(l => !string.Equals(l.Id, exceptId, StringComparison.Ordinal) + && string.Equals(l.Name.Trim(), name.Trim(), StringComparison.OrdinalIgnoreCase)); + + /// + /// if no layout has it, otherwise the first of name 2, name 3… that is + /// free. A blank name becomes Layout. + /// + public string UniqueName(string? name) + { + var stem = string.IsNullOrWhiteSpace(name) ? "Layout" : name.Trim(); + if (!IsNameTaken(stem)) + { + return stem; + } + + for (var n = 2; ; n++) + { + var candidate = $"{stem} {n}"; + if (!IsNameTaken(candidate)) + { + return candidate; + } + } + } + + /// + /// Saves as a new layout. The name is made unique () + /// rather than refused, so "save current" always succeeds. + /// + public LayoutDefinition SaveAsNew( + string? name, + IEnumerable placements, + IReadOnlyDictionary? regionShares = null) + { + ArgumentNullException.ThrowIfNull(placements); + var layout = new LayoutDefinition + { + Id = _newId(), + Name = UniqueName(name), + Placements = placements.ToArray(), + RegionShares = regionShares is null ? null : new Dictionary(regionShares), + }; + _user.Add(layout); + return layout; + } + + /// + /// Replaces the placements of the layout with . A built-in is not changed: a copy named + /// after it (Roleplay 2) is saved instead, and the result says so, so the caller can re-point whoever + /// was using the built-in at the copy. + /// + /// No layout has . + public LayoutSaveResult Update( + string id, + IEnumerable placements, + IReadOnlyDictionary? regionShares = null) + { + ArgumentNullException.ThrowIfNull(placements); + var existing = Find(id) ?? throw new KeyNotFoundException($"No layout has the id '{id}'."); + if (existing.IsBuiltIn) + { + return new LayoutSaveResult(SaveAsNew(existing.Name, placements, regionShares ?? existing.RegionShares), true); + } + + var updated = existing with + { + Placements = placements.ToArray(), + RegionShares = regionShares is null ? existing.RegionShares : new Dictionary(regionShares), + }; + _user[IndexOf(id)] = updated; + return new LayoutSaveResult(updated, false); + } + + /// + /// Renames a saved layout. Refused (false) for a built-in, an unknown id, a blank name or a name another + /// layout already has; renaming to its own name in a different case is allowed. + /// + public bool Rename(string id, string newName) + { + if (string.IsNullOrWhiteSpace(newName) || Find(id) is not { IsBuiltIn: false } existing + || IsNameTaken(newName, exceptId: id)) + { + return false; + } + + _user[IndexOf(id)] = existing with { Name = newName.Trim() }; + return true; + } + + /// + /// Deletes a saved layout. Refused (false) for a built-in or an unknown id. Characters and worlds still naming + /// it are left alone: falls through past an id that names nothing. + /// + public bool Delete(string id) + { + if (Find(id) is not { IsBuiltIn: false }) + { + return false; + } + + _user.RemoveAt(IndexOf(id)); + return true; + } + + private int IndexOf(string id) => _user.FindIndex(l => string.Equals(l.Id, id, StringComparison.Ordinal)); +} diff --git a/src/SharpMUTerm.Core/Layouts/LayoutResolver.cs b/src/SharpMUTerm.Core/Layouts/LayoutResolver.cs new file mode 100644 index 00000000..328b281d --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/LayoutResolver.cs @@ -0,0 +1,53 @@ +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Layouts; + +/// Which step of chose a layout. +public enum LayoutSource +{ + /// The character names it (). + Character, + + /// The world names it (). + World, + + /// The player accepted it when the client suggested it (). + AcceptedSuggestion, + + /// Nothing named one that exists, so it is . + Default, +} + +/// A resolved layout and the step that chose it. +public sealed record ResolvedLayout(LayoutDefinition Layout, LayoutSource Source); + +/// +/// Which layout a character's windows use: the character's own, else the world's, else the suggestion the player +/// accepted for the world, else . An id that names no layout (deleted, or +/// from another machine's file) is passed over as though it were not set. +/// +public static class LayoutResolver +{ + /// Resolves the layout for on ; either may be null. + public static ResolvedLayout Resolve(LayoutLibrary library, WorldDefinition? world, CharacterDefinition? character) + { + ArgumentNullException.ThrowIfNull(library); + + if (library.Find(character?.Layout) is { } own) + { + return new ResolvedLayout(own, LayoutSource.Character); + } + + if (library.Find(world?.Layout) is { } worlds) + { + return new ResolvedLayout(worlds, LayoutSource.World); + } + + if (library.Find(world?.AcceptedLayoutSuggestion) is { } accepted) + { + return new ResolvedLayout(accepted, LayoutSource.AcceptedSuggestion); + } + + return new ResolvedLayout(BuiltInLayouts.Roleplay, LayoutSource.Default); + } +} diff --git a/src/SharpMUTerm.Core/Layouts/LayoutSuggester.cs b/src/SharpMUTerm.Core/Layouts/LayoutSuggester.cs new file mode 100644 index 00000000..054c9572 --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/LayoutSuggester.cs @@ -0,0 +1,134 @@ +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Telnet.Mssp; + +namespace SharpMUTerm.Core.Layouts; + +/// +/// What a connection has shown the client, as plain values, so can be tested +/// without a session. reads it off the live stores. +/// +/// +/// The package names holds: GMCP packages by name (Char.Vitals), MSDP variables +/// as MSDP.NAME. +/// +/// MSSP CODEBASE, or null when the server sent none. +/// MSSP FAMILY, or null when the server sent none. +public sealed record LayoutSignals( + IReadOnlyCollection GameDataPackages, + string? MsspCodebase = null, + string? MsspFamily = null) +{ + /// Nothing seen yet. + public static LayoutSignals None { get; } = new([]); + + /// Reads the signals off a session's game data and its server's MSSP report; either may be null. + public static LayoutSignals From(GameDataStore? gameData, MsspData? mssp) => new( + gameData?.Entries.Select(e => e.Package).ToArray() ?? [], + mssp?.Codebase, + mssp?.Family); +} + +/// Why suggested what it did — what the offer can say to the player. +public enum LayoutSuggestionReason +{ + /// The game sends vitals (GMCP Char.Vitals, MSDP HEALTH…): a game with fighting in it. + Vitals, + + /// The server's MSSP names a MUSH-family codebase (PennMUSH, TinyMUX, a MUCK, a MOO…). + RoleplayServer, + + /// Nothing pointed either way. + Default, +} + +/// A suggested layout and the reason for it. +public sealed record LayoutSuggestion(string LayoutId, LayoutSuggestionReason Reason); + +/// +/// Suggests a built-in layout for a world from what its connection has shown: +/// once the game sends vitals, otherwise — with a reason that says whether +/// the server's MSSP named a roleplay-leaning codebase or nothing pointed either way. Vitals win over the codebase: +/// a MUSH that sends Char.Vitals has a combat system someone wanted shown. +/// +public static class LayoutSuggester +{ + /// The game-data packages that mean the game sends vitals (compared ignoring case). + public static IReadOnlySet VitalsPackages { get; } = new HashSet(StringComparer.OrdinalIgnoreCase) + { + "Char.Vitals", + $"{GameDataStore.MsdpPrefix}.HEALTH", + $"{GameDataStore.MsdpPrefix}.HEALTH_MAX", + $"{GameDataStore.MsdpPrefix}.MANA", + $"{GameDataStore.MsdpPrefix}.MOVEMENT", + }; + + /// + /// Codebase name endings that lean towards roleplay. A word of the codebase ending in one counts, so + /// PennMUSH 1.8.8, TinyMUX 2.13, RhostMUSH, ProtoMUCK and LambdaMOO all do. + /// + private static readonly string[] RoleplayEndings = ["MUSH", "MUX", "MUCK", "MOO"]; + + /// The MSSP FAMILY values that lean towards roleplay. + private static readonly string[] RoleplayFamilies = ["TinyMUD"]; + + /// Suggests a layout for what says the connection has seen. + public static LayoutSuggestion Suggest(LayoutSignals signals) + { + ArgumentNullException.ThrowIfNull(signals); + + if (signals.GameDataPackages.Any(VitalsPackages.Contains)) + { + return new LayoutSuggestion(BuiltInLayouts.CombatId, LayoutSuggestionReason.Vitals); + } + + if (IsRoleplayCodebase(signals.MsspCodebase) || IsRoleplayFamily(signals.MsspFamily)) + { + return new LayoutSuggestion(BuiltInLayouts.RoleplayId, LayoutSuggestionReason.RoleplayServer); + } + + return new LayoutSuggestion(BuiltInLayouts.RoleplayId, LayoutSuggestionReason.Default); + } + + /// + /// Whether an MSSP CODEBASE names a MUSH-family server. Read word by word (runs of letters), so a version + /// number or punctuation does not matter and a word that merely contains MOO mid-way does not count. + /// + public static bool IsRoleplayCodebase(string? codebase) + { + if (string.IsNullOrWhiteSpace(codebase)) + { + return false; + } + + foreach (var word in Words(codebase)) + { + if (RoleplayEndings.Any(e => word.EndsWith(e, StringComparison.OrdinalIgnoreCase))) + { + return true; + } + } + + return false; + } + + private static bool IsRoleplayFamily(string? family) => + family is not null && RoleplayFamilies.Any(f => string.Equals(f, family.Trim(), StringComparison.OrdinalIgnoreCase)); + + private static IEnumerable Words(string text) + { + var start = -1; + for (var i = 0; i <= text.Length; i++) + { + var letter = i < text.Length && char.IsAsciiLetter(text[i]); + if (letter && start < 0) + { + start = i; + } + else if (!letter && start >= 0) + { + yield return text[start..i]; + start = -1; + } + } + } +} diff --git a/src/SharpMUTerm.Core/Layouts/PanelAvailability.cs b/src/SharpMUTerm.Core/Layouts/PanelAvailability.cs new file mode 100644 index 00000000..d3b85774 --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/PanelAvailability.cs @@ -0,0 +1,68 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Protocols; + +namespace SharpMUTerm.Core.Layouts; + +/// +/// Whether a panel has anything to show for one session yet. A layout says where a panel goes; this says whether +/// it is drawn, so a world that never sends a map never gets an empty map pane. +/// +public interface IPanelAvailability +{ + /// Whether has data. False for an id outside . + bool HasData(string panelId); +} + +/// +/// The facts about one session that decide which panels have data, as plain values, and the rule that reads them. +/// A host builds one per session () whenever one of the inputs changes; the rule is pure. +/// +/// Rooms in the session's map (WorldMap.Rooms.Count). +/// Whether any status meter has read a value (). +/// Whether the game has said who is in the room (GMCP Room.Players). +/// Capture windows the session's trigger rules have opened. +/// Values the session's holds. +public sealed record PanelAvailability( + int RoomsRecorded = 0, + bool MeterValueArrived = false, + bool WhoHereKnown = false, + int SpawnWindows = 0, + int GameDataEntries = 0) : IPanelAvailability +{ + /// A session that has shown nothing yet: only the panels that need no data. + public static PanelAvailability Nothing { get; } = new(); + + /// The GMCP packages that say who is in the room. + public static IReadOnlyList WhoHerePackages { get; } = ["Room.Players", "Room.AddPlayer"]; + + /// + public bool HasData(string panelId) => panelId switch + { + PanelIds.Output or PanelIds.Composer or PanelIds.QuickBar => true, + PanelIds.Map => RoomsRecorded > 0, + PanelIds.Vitals => MeterValueArrived, + PanelIds.WhoHere => WhoHereKnown, + PanelIds.Chat => SpawnWindows > 0, + PanelIds.GameData => GameDataEntries > 0, + _ => false, + }; + + /// + /// Reads the facts off a session's stores. defaults to + /// ; the map and the capture windows are counted by the caller, because they + /// live in the host. + /// + public static PanelAvailability From( + GameDataStore? gameData, + int roomsRecorded, + int spawnWindows, + IEnumerable? meters = null) + { + var meterArrived = gameData is not null + && (meters ?? StatusMeter.Defaults()).Any(m => StatusMeter.Read(gameData, m.Value) is not null); + // By package name, not value: an empty Room.Players (nobody else here) is still knowing who is here. + var whoHere = gameData is not null + && gameData.Entries.Any(e => WhoHerePackages.Contains(e.Package, StringComparer.OrdinalIgnoreCase)); + return new PanelAvailability(roomsRecorded, meterArrived, whoHere, spawnWindows, gameData?.Count ?? 0); + } +} diff --git a/src/SharpMUTerm.Core/Layouts/PanelIds.cs b/src/SharpMUTerm.Core/Layouts/PanelIds.cs new file mode 100644 index 00000000..9114bea1 --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/PanelIds.cs @@ -0,0 +1,42 @@ +namespace SharpMUTerm.Core.Layouts; + +/// +/// The panels a layout can place, by id. An id is a plain string so a layout written by a newer client (or by +/// hand) still loads: a placement naming an id outside is kept in the layout and skipped by +/// everything that reads it (). +/// +public static class PanelIds +{ + /// The output pane: the game's text. + public const string Output = "output"; + + /// The docked composer, a multi-row editor for posts. + public const string Composer = "composer"; + + /// Who is in the room with the character (GMCP Room.Players). + public const string WhoHere = "who-here"; + + /// Health, mana and the other meters a game sends. + public const string Vitals = "vitals"; + + /// The map drawn from the rooms the mapper recorded. + public const string Map = "map"; + + /// The capture windows trigger rules send lines to (channels, pages, tells). + public const string Chat = "chat"; + + /// A row of buttons for the commands a player uses most. + public const string QuickBar = "quick-bar"; + + /// Every GMCP, MSDP and MXP value the session holds. + public const string GameData = "game-data"; + + /// Every id this client knows how to draw. + public static IReadOnlySet Known { get; } = new HashSet(StringComparer.Ordinal) + { + Output, Composer, WhoHere, Vitals, Map, Chat, QuickBar, GameData, + }; + + /// Whether names a panel this client can draw. + public static bool IsKnown(string? panelId) => panelId is not null && Known.Contains(panelId); +} diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutConfigurationTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutConfigurationTests.cs new file mode 100644 index 00000000..6aa0f3b9 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutConfigurationTests.cs @@ -0,0 +1,108 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; + +namespace SharpMUTerm.Core.Tests.Layouts; + +/// +/// Layouts in config.json: the player's layouts and the world/character references round-trip, the built-ins +/// are never written, and a document from before layouts loads with none — new optional fields whose defaults are +/// the old behaviour, so no migration step and no schema version change ('s +/// reasoning). +/// +public class LayoutConfigurationTests +{ + private const string DocumentWithoutLayouts = """ + { + "version": 5, + "worlds": [ { "name": "Aetherfall", "host": "aetherfall.mux", "port": 4201, "characters": [ { "name": "Corvid" } ] } ] + } + """; + + [Test] + public async Task ADocumentFromBeforeLayoutsLoadsWithNone() + { + var config = ConfigurationStore.Deserialize(DocumentWithoutLayouts); + + await Assert.That(config.Layouts).IsEmpty(); + await Assert.That(config.Worlds[0].Layout).IsNull(); + await Assert.That(config.Worlds[0].AcceptedLayoutSuggestion).IsNull(); + await Assert.That(config.Worlds[0].Characters[0].Layout).IsNull(); + } + + [Test] + public async Task LayoutsAndReferencesRoundTrip() + { + var config = new AppConfiguration(); + var library = new LayoutLibrary(config.Layouts, () => "my-layout"); + library.SaveAsNew( + "Scene", + [ + new PanelPlacement { PanelId = PanelIds.Output, Order = 0 }, + new PanelPlacement { PanelId = PanelIds.Chat, Region = LayoutRegion.Side, Order = 1, Size = 2.5, Collapsed = true, TabOf = PanelIds.WhoHere }, + new PanelPlacement { PanelId = "hologram", Region = LayoutRegion.TopStrip }, + ], + new Dictionary { [LayoutRegion.Side] = 0.35 }); + config.Worlds.Add(new WorldDefinition + { + Name = "W", + Layout = BuiltInLayouts.CombatId, + AcceptedLayoutSuggestion = BuiltInLayouts.RoleplayId, + Characters = [new CharacterDefinition { Name = "C", Layout = "my-layout" }], + }); + + var json = ConfigurationStore.Serialize(config); + var back = ConfigurationStore.Deserialize(json); + + // Region names, not numbers, so a hand-edited file reads. + await Assert.That(json).Contains("\"region\": \"Side\""); + await Assert.That(json).DoesNotContain("isBuiltIn"); + await Assert.That(json).DoesNotContain("knownPlacements"); + + var layout = back.Layouts.Single(); + await Assert.That(layout.Id).IsEqualTo("my-layout"); + await Assert.That(layout.Name).IsEqualTo("Scene"); + await Assert.That(layout.IsBuiltIn).IsFalse(); + await Assert.That(layout.Placements.Count).IsEqualTo(3); + await Assert.That(layout.Placements[1]).IsEqualTo(new PanelPlacement + { + PanelId = PanelIds.Chat, Region = LayoutRegion.Side, Order = 1, Size = 2.5, Collapsed = true, TabOf = PanelIds.WhoHere, + }); + await Assert.That(layout.Placements[2].PanelId).IsEqualTo("hologram"); + await Assert.That(layout.RegionShares![LayoutRegion.Side]).IsEqualTo(0.35); + + await Assert.That(back.Worlds[0].Layout).IsEqualTo(BuiltInLayouts.CombatId); + await Assert.That(back.Worlds[0].AcceptedLayoutSuggestion).IsEqualTo(BuiltInLayouts.RoleplayId); + await Assert.That(back.Worlds[0].Characters[0].Layout).IsEqualTo("my-layout"); + + // Resolution after the load agrees with before it. + var resolved = LayoutResolver.Resolve(new LayoutLibrary(back.Layouts), back.Worlds[0], back.Worlds[0].Characters[0]); + await Assert.That(resolved.Layout.Name).IsEqualTo("Scene"); + } + + [Test] + public async Task AFileCannotMakeItsOwnLayoutBuiltIn() + { + var config = ConfigurationStore.Deserialize(""" + { "version": 5, "layouts": [ { "id": "x", "name": "X", "isBuiltIn": true, "placements": [] } ] } + """); + + await Assert.That(config.Layouts.Single().IsBuiltIn).IsFalse(); + } + + [Test] + public async Task CloningAWorldOrCharacterCarriesItsLayout() + { + var world = new WorldDefinition + { + Layout = "a", + AcceptedLayoutSuggestion = "b", + Characters = [new CharacterDefinition { Layout = "c" }], + }; + + var copy = world.Clone(); + + await Assert.That(copy.Layout).IsEqualTo("a"); + await Assert.That(copy.AcceptedLayoutSuggestion).IsEqualTo("b"); + await Assert.That(copy.Characters[0].Layout).IsEqualTo("c"); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutFoldAndAvailabilityTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutFoldAndAvailabilityTests.cs new file mode 100644 index 00000000..f1013ea4 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutFoldAndAvailabilityTests.cs @@ -0,0 +1,161 @@ +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Core.Tests.Layouts; + +/// +/// decides which placed panels are drawn, and folds what is +/// drawn into the workspace's own split tree. +/// +public class LayoutFoldAndAvailabilityTests +{ + [Test] + public async Task OnlyTheDatalessPanelsAreAvailableBeforeAnythingArrives() + { + var nothing = PanelAvailability.Nothing; + + foreach (var always in new[] { PanelIds.Output, PanelIds.Composer, PanelIds.QuickBar }) + { + await Assert.That(nothing.HasData(always)).IsTrue(); + } + + foreach (var needsData in new[] { PanelIds.Map, PanelIds.Vitals, PanelIds.WhoHere, PanelIds.Chat, PanelIds.GameData, "hologram" }) + { + await Assert.That(nothing.HasData(needsData)).IsFalse(); + } + } + + [Test] + public async Task EachPanelLightsUpWithItsOwnData() + { + await Assert.That(new PanelAvailability(RoomsRecorded: 1).HasData(PanelIds.Map)).IsTrue(); + await Assert.That(new PanelAvailability(MeterValueArrived: true).HasData(PanelIds.Vitals)).IsTrue(); + await Assert.That(new PanelAvailability(WhoHereKnown: true).HasData(PanelIds.WhoHere)).IsTrue(); + await Assert.That(new PanelAvailability(SpawnWindows: 2).HasData(PanelIds.Chat)).IsTrue(); + await Assert.That(new PanelAvailability(GameDataEntries: 3).HasData(PanelIds.GameData)).IsTrue(); + await Assert.That(new PanelAvailability(RoomsRecorded: 1).HasData(PanelIds.Vitals)).IsFalse(); + } + + [Test] + public async Task AvailabilityIsReadOffTheGameDataStore() + { + var data = new GameDataStore(); + await Assert.That(PanelAvailability.From(data, 0, 0)).IsEqualTo(PanelAvailability.Nothing); + + data.SetGmcp("Room.Players", "[]"); + data.SetGmcp("Char.Vitals", """{"hp":"450","maxhp":"500"}"""); + var seen = PanelAvailability.From(data, roomsRecorded: 4, spawnWindows: 1); + + await Assert.That(seen.WhoHereKnown).IsTrue(); + await Assert.That(seen.MeterValueArrived).IsTrue(); + await Assert.That(seen.RoomsRecorded).IsEqualTo(4); + await Assert.That(seen.SpawnWindows).IsEqualTo(1); + await Assert.That(seen.GameDataEntries).IsEqualTo(2); + await Assert.That(PanelAvailability.From(null, 0, 0)).IsEqualTo(PanelAvailability.Nothing); + } + + [Test] + public async Task RoleplayWithEverythingFoldsIntoOutputComposerAndASideColumnWithChatAsATab() + { + var fold = LayoutFold.Fold(BuiltInLayouts.Roleplay); + + // Row[ Column[ output, composer ], side ] + var root = (SplitNode)fold.Root!; + await Assert.That(root.Direction).IsEqualTo(SplitDirection.Row); + await Assert.That(root.Sizes[1]).IsEqualTo(LayoutFold.DefaultShare(LayoutRegion.Side)).Within(1e-9); + + var centre = (SplitNode)root.Children[0]; + await Assert.That(centre.Direction).IsEqualTo(SplitDirection.Column); + await Assert.That(centre.Panes().Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output", "panel:composer" }); + + var side = (PaneNode)root.Children[1]; + await Assert.That(side.Tabs).IsEquivalentTo(new[] { PanelIds.WhoHere, PanelIds.Chat }); + await Assert.That(fold.Collapsed).IsEmpty(); + await Assert.That(fold.Waiting).IsEmpty(); + } + + [Test] + public async Task ATabWhoseHostHasNoDataTakesAPaneOfItsOwn() + { + // A MUSH sends no Room.Players, but trigger rules have opened a channel window. + var fold = LayoutFold.Fold(BuiltInLayouts.Roleplay, new PanelAvailability(SpawnWindows: 1)); + + var panes = fold.Root!.Panes().ToList(); + await Assert.That(panes.Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output", "panel:composer", "panel:chat" }); + await Assert.That(panes[2].Tabs).IsEquivalentTo(new[] { PanelIds.Chat }); + await Assert.That(fold.Waiting.Select(p => p.PanelId)).IsEquivalentTo(new[] { PanelIds.WhoHere }); + } + + [Test] + public async Task CombatWithNoDataYetIsOutputAndTheQuickBar() + { + var fold = LayoutFold.Fold(BuiltInLayouts.Combat, PanelAvailability.Nothing); + + await Assert.That(fold.Root!.Panes().Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output", "panel:quick-bar" }); + await Assert.That(fold.Waiting.Select(p => p.PanelId)).IsEquivalentTo(new[] { PanelIds.Vitals, PanelIds.Map, PanelIds.Chat }); + } + + [Test] + public async Task CombatWithEverythingHasAStripOnTopAndListsChatAsCollapsed() + { + var fold = LayoutFold.Fold(BuiltInLayouts.Combat); + + // Column[ vitals, Row[ Column[ output, quick-bar ], map ] ] + var root = (SplitNode)fold.Root!; + await Assert.That(root.Direction).IsEqualTo(SplitDirection.Column); + await Assert.That(((PaneNode)root.Children[0]).Id).IsEqualTo("panel:vitals"); + await Assert.That(root.Sizes[0]).IsEqualTo(LayoutFold.DefaultShare(LayoutRegion.TopStrip)).Within(1e-9); + await Assert.That(root.Panes().Select(p => p.Id)) + .IsEquivalentTo(new[] { "panel:vitals", "panel:output", "panel:quick-bar", "panel:map" }); + await Assert.That(fold.Collapsed.Select(p => p.PanelId)).IsEquivalentTo(new[] { PanelIds.Chat }); + } + + [Test] + public async Task PanelsInOneRegionShareItBySize() + { + var layout = new LayoutDefinition + { + Id = "x", + Name = "X", + Placements = + [ + new() { PanelId = PanelIds.Output }, + new() { PanelId = PanelIds.GameData, Region = LayoutRegion.Side, Order = 2, Size = 3 }, + new() { PanelId = PanelIds.Map, Region = LayoutRegion.Side, Order = 1, Size = 1 }, + ], + RegionShares = new Dictionary { [LayoutRegion.Side] = 0.4 }, + }; + + var root = (SplitNode)LayoutFold.Fold(layout).Root!; + await Assert.That(root.Sizes[1]).IsEqualTo(0.4).Within(1e-9); + + var side = (SplitNode)root.Children[1]; + await Assert.That(side.Direction).IsEqualTo(SplitDirection.Column); + await Assert.That(side.Panes().Select(p => p.Id)).IsEquivalentTo(new[] { "panel:map", "panel:game-data" }); + await Assert.That(side.Sizes[0]).IsEqualTo(0.25).Within(1e-9); + } + + [Test] + public async Task TabsDoNotChainAndAPanelPlacedTwiceGetsOnePane() + { + var layout = new LayoutDefinition + { + Id = "x", + Name = "X", + Placements = + [ + new() { PanelId = PanelIds.Output }, + new() { PanelId = PanelIds.Map, Region = LayoutRegion.Side, TabOf = PanelIds.Chat }, + new() { PanelId = PanelIds.Chat, Region = LayoutRegion.Side, TabOf = PanelIds.Map }, + new() { PanelId = PanelIds.Output, Region = LayoutRegion.Bottom }, + ], + }; + + var panes = LayoutFold.Fold(layout).Root!.Panes().ToList(); + + // The cycle breaks into two panes rather than losing both, and output is drawn once. + await Assert.That(panes.Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output", "panel:map", "panel:chat" }); + await Assert.That(panes.All(p => p.Tabs.Count == 1)).IsTrue(); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutLibraryTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutLibraryTests.cs new file mode 100644 index 00000000..e2cc5b16 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutLibraryTests.cs @@ -0,0 +1,157 @@ +using SharpMUTerm.Core.Layouts; + +namespace SharpMUTerm.Core.Tests.Layouts; + +/// +/// : the built-ins are listed and never changed, the player's layouts are saved, updated, +/// renamed and deleted in the list handed in, and no two layouts share a name. +/// +public class LayoutLibraryTests +{ + private static readonly PanelPlacement[] OutputOnly = [new() { PanelId = PanelIds.Output }]; + + private static LayoutLibrary Library(List? user = null) + { + var n = 0; + return new LayoutLibrary(user ?? [], () => $"id{++n}"); + } + + [Test] + public async Task TheBuiltInsAreListedFirstAndAreReadOnly() + { + var user = new List(); + var library = Library(user); + library.SaveAsNew("Mine", OutputOnly); + + await Assert.That(library.All.Select(l => l.Id)).IsEquivalentTo(new[] { "roleplay", "combat", "id1" }); + await Assert.That(library.All[0].IsBuiltIn).IsTrue(); + await Assert.That(library.All[2].IsBuiltIn).IsFalse(); + + // Never in the player's list, so never in config.json. + await Assert.That(user.Count).IsEqualTo(1); + } + + [Test] + public async Task SavingUnderATakenNameNumbersIt() + { + var library = Library(); + + var first = library.SaveAsNew("Scene", OutputOnly); + var second = library.SaveAsNew("scene", OutputOnly); + var builtInName = library.SaveAsNew("Roleplay", OutputOnly); + var blank = library.SaveAsNew(" ", OutputOnly); + + await Assert.That(first.Name).IsEqualTo("Scene"); + await Assert.That(second.Name).IsEqualTo("scene 2"); + await Assert.That(builtInName.Name).IsEqualTo("Roleplay 2"); + await Assert.That(blank.Name).IsEqualTo("Layout"); + } + + [Test] + public async Task UpdatingASavedLayoutReplacesItInPlaceAndKeepsItsId() + { + var user = new List(); + var library = Library(user); + var saved = library.SaveAsNew("Scene", OutputOnly); + PanelPlacement[] changed = [new() { PanelId = PanelIds.Output }, new() { PanelId = PanelIds.Map, Region = LayoutRegion.Side }]; + + var result = library.Update(saved.Id, changed); + + await Assert.That(result.CreatedNew).IsFalse(); + await Assert.That(result.Layout.Id).IsEqualTo(saved.Id); + await Assert.That(user.Single().Placements.Count).IsEqualTo(2); + await Assert.That(user.Single().Name).IsEqualTo("Scene"); + } + + [Test] + public async Task UpdatingABuiltInSavesACopyAndLeavesTheBuiltInAlone() + { + var user = new List(); + var library = Library(user); + var before = BuiltInLayouts.Roleplay.Placements.Count; + + var result = library.Update(BuiltInLayouts.RoleplayId, OutputOnly); + + await Assert.That(result.CreatedNew).IsTrue(); + await Assert.That(result.Layout.Name).IsEqualTo("Roleplay 2"); + await Assert.That(result.Layout.IsBuiltIn).IsFalse(); + await Assert.That(user.Count).IsEqualTo(1); + await Assert.That(BuiltInLayouts.Roleplay.Placements.Count).IsEqualTo(before); + await Assert.That(library.Find(BuiltInLayouts.RoleplayId)).IsSameReferenceAs(BuiltInLayouts.Roleplay); + } + + [Test] + public async Task UpdatingAnUnknownIdThrows() + { + await Assert.That(() => Library().Update("nope", OutputOnly)).Throws(); + } + + [Test] + public async Task RenameRefusesBuiltInsBlanksAndTakenNames() + { + var library = Library(); + var a = library.SaveAsNew("A", OutputOnly); + library.SaveAsNew("B", OutputOnly); + + await Assert.That(library.Rename(BuiltInLayouts.CombatId, "Fight")).IsFalse(); + await Assert.That(library.Rename(a.Id, " ")).IsFalse(); + await Assert.That(library.Rename(a.Id, "b")).IsFalse(); + await Assert.That(library.Rename(a.Id, "combat")).IsFalse(); + await Assert.That(library.Rename("missing", "C")).IsFalse(); + + await Assert.That(library.Rename(a.Id, "a")).IsTrue(); + await Assert.That(library.Find(a.Id)!.Name).IsEqualTo("a"); + await Assert.That(library.Rename(a.Id, " Duel ")).IsTrue(); + await Assert.That(library.Find(a.Id)!.Name).IsEqualTo("Duel"); + } + + [Test] + public async Task DeleteRemovesASavedLayoutAndRefusesABuiltIn() + { + var user = new List(); + var library = Library(user); + var saved = library.SaveAsNew("Scene", OutputOnly); + + await Assert.That(library.Delete(BuiltInLayouts.RoleplayId)).IsFalse(); + await Assert.That(library.Delete("missing")).IsFalse(); + await Assert.That(library.Delete(saved.Id)).IsTrue(); + await Assert.That(user).IsEmpty(); + await Assert.That(library.Find(saved.Id)).IsNull(); + } + + [Test] + public async Task ASavedLayoutCannotShadowABuiltInById() + { + var user = new List { new() { Id = BuiltInLayouts.RoleplayId, Name = "Impostor" } }; + var library = Library(user); + + await Assert.That(library.Find(BuiltInLayouts.RoleplayId)!.Name).IsEqualTo("Roleplay"); + await Assert.That(library.Delete(BuiltInLayouts.RoleplayId)).IsFalse(); + } + + [Test] + public async Task AnUnknownPanelIsKeptInTheLayoutAndSkippedByReaders() + { + var layout = new LayoutDefinition + { + Id = "x", + Name = "X", + Placements = [new() { PanelId = PanelIds.Output }, new() { PanelId = "hologram", Region = LayoutRegion.Side }], + }; + + await Assert.That(layout.Placements.Count).IsEqualTo(2); + await Assert.That(layout.KnownPlacements.Select(p => p.PanelId)).IsEquivalentTo(new[] { PanelIds.Output }); + await Assert.That(layout.PlacementOf("hologram")).IsNull(); + await Assert.That(LayoutFold.Fold(layout).Root!.Panes().Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output" }); + } + + [Test] + public async Task EveryPanelTheBuiltInsPlaceIsKnown() + { + foreach (var layout in BuiltInLayouts.All) + { + await Assert.That(layout.Placements.All(p => PanelIds.IsKnown(p.PanelId))).IsTrue(); + await Assert.That(layout.IsBuiltIn).IsTrue(); + } + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutResolverTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutResolverTests.cs new file mode 100644 index 00000000..bd0cf489 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutResolverTests.cs @@ -0,0 +1,71 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; + +namespace SharpMUTerm.Core.Tests.Layouts; + +/// +/// : character, then world, then the accepted suggestion, then Roleplay — and an id that +/// names nothing is passed over rather than failing. +/// +public class LayoutResolverTests +{ + private static (LayoutLibrary Library, LayoutDefinition Saved) WithOneSaved() + { + var library = new LayoutLibrary([], () => "saved"); + return (library, library.SaveAsNew("Scene", [new PanelPlacement { PanelId = PanelIds.Output }])); + } + + [Test] + public async Task NothingSetIsRoleplay() + { + var (library, _) = WithOneSaved(); + + var resolved = LayoutResolver.Resolve(library, new WorldDefinition(), new CharacterDefinition()); + + await Assert.That(resolved.Layout).IsSameReferenceAs(BuiltInLayouts.Roleplay); + await Assert.That(resolved.Source).IsEqualTo(LayoutSource.Default); + await Assert.That(LayoutResolver.Resolve(library, null, null).Source).IsEqualTo(LayoutSource.Default); + } + + [Test] + public async Task TheCharacterWinsOverTheWorldWhichWinsOverTheSuggestion() + { + var (library, saved) = WithOneSaved(); + var world = new WorldDefinition { Layout = BuiltInLayouts.CombatId, AcceptedLayoutSuggestion = BuiltInLayouts.RoleplayId }; + var character = new CharacterDefinition { Layout = saved.Id }; + + var both = LayoutResolver.Resolve(library, world, character); + await Assert.That(both.Layout.Id).IsEqualTo(saved.Id); + await Assert.That(both.Source).IsEqualTo(LayoutSource.Character); + + character.Layout = null; + var worldOnly = LayoutResolver.Resolve(library, world, character); + await Assert.That(worldOnly.Layout.Id).IsEqualTo(BuiltInLayouts.CombatId); + await Assert.That(worldOnly.Source).IsEqualTo(LayoutSource.World); + + world.Layout = null; + world.AcceptedLayoutSuggestion = BuiltInLayouts.CombatId; + var suggestion = LayoutResolver.Resolve(library, world, character); + await Assert.That(suggestion.Layout.Id).IsEqualTo(BuiltInLayouts.CombatId); + await Assert.That(suggestion.Source).IsEqualTo(LayoutSource.AcceptedSuggestion); + } + + [Test] + public async Task ADeletedLayoutFallsThroughToTheNextStep() + { + var (library, saved) = WithOneSaved(); + var world = new WorldDefinition { Layout = BuiltInLayouts.CombatId }; + var character = new CharacterDefinition { Layout = saved.Id }; + + library.Delete(saved.Id); + var resolved = LayoutResolver.Resolve(library, world, character); + + await Assert.That(resolved.Layout.Id).IsEqualTo(BuiltInLayouts.CombatId); + await Assert.That(resolved.Source).IsEqualTo(LayoutSource.World); + + // Every step dangling, all the way down. + world.Layout = "gone"; + world.AcceptedLayoutSuggestion = "also-gone"; + await Assert.That(LayoutResolver.Resolve(library, world, character).Source).IsEqualTo(LayoutSource.Default); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutSuggesterTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutSuggesterTests.cs new file mode 100644 index 00000000..5960ec17 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutSuggesterTests.cs @@ -0,0 +1,90 @@ +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Telnet.Mssp; + +namespace SharpMUTerm.Core.Tests.Layouts; + +/// : vitals suggest Combat; a MUSH-family codebase, or nothing, suggests Roleplay. +public class LayoutSuggesterTests +{ + [Test] + public async Task NothingSeenSuggestsRoleplayByDefault() + { + var suggestion = LayoutSuggester.Suggest(LayoutSignals.None); + + await Assert.That(suggestion).IsEqualTo(new LayoutSuggestion(BuiltInLayouts.RoleplayId, LayoutSuggestionReason.Default)); + } + + [Test] + [Arguments("Char.Vitals")] + [Arguments("char.vitals")] + [Arguments("MSDP.HEALTH")] + public async Task VitalsSuggestCombat(string package) + { + var suggestion = LayoutSuggester.Suggest(new LayoutSignals(["Room.Info", package])); + + await Assert.That(suggestion).IsEqualTo(new LayoutSuggestion(BuiltInLayouts.CombatId, LayoutSuggestionReason.Vitals)); + } + + [Test] + public async Task VitalsWinOverAMushCodebase() + { + var suggestion = LayoutSuggester.Suggest(new LayoutSignals(["Char.Vitals"], "PennMUSH 1.8.8p0")); + + await Assert.That(suggestion.LayoutId).IsEqualTo(BuiltInLayouts.CombatId); + } + + [Test] + [Arguments("PennMUSH 1.8.8p0")] + [Arguments("TinyMUSH 3.3")] + [Arguments("TinyMUX 2.13.0.4")] + [Arguments("RhostMUSH")] + [Arguments("MUSH")] + [Arguments("mux2")] + [Arguments("FuzzBall MUCK 7.0")] + [Arguments("LambdaMOO 1.8.1")] + [Arguments("SharpMUSH")] + public async Task AMushFamilyCodebaseSuggestsRoleplayAndSaysWhy(string codebase) + { + var suggestion = LayoutSuggester.Suggest(new LayoutSignals([], codebase)); + + await Assert.That(suggestion).IsEqualTo(new LayoutSuggestion(BuiltInLayouts.RoleplayId, LayoutSuggestionReason.RoleplayServer)); + } + + [Test] + [Arguments("tbaMUD 2023")] + [Arguments("Evennia 4.0")] + [Arguments("Smooth Engine")] + [Arguments("")] + public async Task AnyOtherCodebaseIsTheDefault(string codebase) + { + await Assert.That(LayoutSuggester.Suggest(new LayoutSignals([], codebase)).Reason).IsEqualTo(LayoutSuggestionReason.Default); + } + + [Test] + public async Task TheTinyMudFamilyCountsWhenTheCodebaseSaysNothing() + { + var suggestion = LayoutSuggester.Suggest(new LayoutSignals([], "Custom", "TinyMUD")); + + await Assert.That(suggestion.Reason).IsEqualTo(LayoutSuggestionReason.RoleplayServer); + } + + [Test] + public async Task TheSignalsAreReadOffTheLiveStores() + { + var data = new GameDataStore(); + data.SetMsdp("""{"HEALTH":"100"}"""); + var mssp = MsspData.From([ + new KeyValuePair>("CODEBASE", ["TinyMUX 2.13"]), + new KeyValuePair>("FAMILY", ["TinyMUD"]), + ]); + + var signals = LayoutSignals.From(data, mssp); + + await Assert.That(signals.GameDataPackages).Contains("MSDP.HEALTH"); + await Assert.That(signals.MsspCodebase).IsEqualTo("TinyMUX 2.13"); + await Assert.That(signals.MsspFamily).IsEqualTo("TinyMUD"); + await Assert.That(LayoutSuggester.Suggest(signals).LayoutId).IsEqualTo(BuiltInLayouts.CombatId); + await Assert.That(LayoutSignals.From(null, null).GameDataPackages).IsEmpty(); + } +} From dc332af2d0231e23688a504e6548f2a7b14f47e0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 02:13:11 +0000 Subject: [PATCH 006/113] =?UTF-8?q?Add=20SharpMUTerm.Client=20with=20a=20c?= =?UTF-8?q?ontribution=20registry;=20=E2=8C=83P=20reads=20its=20commands?= =?UTF-8?q?=20from=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A new UI-agnostic project, SharpMUTerm.Client (Core only), holds the shared client shell's first piece: ContributionRegistry, with six kinds of contribution (commands, panels, settings sections, status cells, overlays, output decorators), each with a stable id unique within its kind and an owner. The built-in ⌃P catalog moves out of Core's CommandCatalog.Build into BuiltInCommands, registered as contributions; the Tui supplies the work (RunBuiltInCommand). The command surface, the pointer menu and DispatchCommand all read the registry, so a package or host can add commands. The catalog is unchanged entry for entry. New suite: SharpMUTerm.Client.Tests (in CI). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- .github/workflows/ci.yml | 5 + CLAUDE.md | 26 +- SharpMUTerm.slnx | 2 + .../Commands/BuiltInCommands.cs | 371 ++++++++++++++++++ .../Contributions/Commands.cs | 300 ++++++++++++++ .../Contributions/ContributionList.cs | 91 +++++ .../Contributions/ContributionOwner.cs | 61 +++ .../Contributions/ContributionRegistry.cs | 49 +++ .../Contributions/Descriptors.cs | 193 +++++++++ .../SharpMUTerm.Client.csproj | 17 + .../Commands/CommandCatalog.cs | 322 +-------------- src/SharpMUTerm.Core/Commands/CommandIds.cs | 6 + .../Pointer/SharpMUTermApp.Pointer.cs | 2 +- src/SharpMUTerm.Tui/SharpMUTerm.Tui.csproj | 1 + .../SharpMUTermApp.Contributions.cs | 94 +++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 20 +- .../BuiltInCatalogTests.cs} | 27 +- .../ClientAssemblyTests.cs | 52 +++ .../ContributionRegistryTests.cs | 215 ++++++++++ .../SharpMUTerm.Client.Tests.csproj | 19 + 20 files changed, 1527 insertions(+), 346 deletions(-) create mode 100644 src/SharpMUTerm.Client/Commands/BuiltInCommands.cs create mode 100644 src/SharpMUTerm.Client/Contributions/Commands.cs create mode 100644 src/SharpMUTerm.Client/Contributions/ContributionList.cs create mode 100644 src/SharpMUTerm.Client/Contributions/ContributionOwner.cs create mode 100644 src/SharpMUTerm.Client/Contributions/ContributionRegistry.cs create mode 100644 src/SharpMUTerm.Client/Contributions/Descriptors.cs create mode 100644 src/SharpMUTerm.Client/SharpMUTerm.Client.csproj create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs rename tests/{SharpMUTerm.Core.Tests/Commands/CommandCatalogTests.cs => SharpMUTerm.Client.Tests/BuiltInCatalogTests.cs} (85%) create mode 100644 tests/SharpMUTerm.Client.Tests/ClientAssemblyTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/ContributionRegistryTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/SharpMUTerm.Client.Tests.csproj diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4b4668a..04c89bb4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,11 @@ jobs: shell: bash run: dotnet run -c Release --no-build --project tests/SharpMUTerm.Core.Tests/SharpMUTerm.Core.Tests.csproj + - name: Test — Client + if: ${{ !cancelled() }} + shell: bash + run: dotnet run -c Release --no-build --project tests/SharpMUTerm.Client.Tests/SharpMUTerm.Client.Tests.csproj + - name: Test — Graphics if: ${{ !cancelled() }} shell: bash diff --git a/CLAUDE.md b/CLAUDE.md index a6b36fb5..1e4f778f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -58,7 +58,7 @@ fallbacks) for inline images/maps. ## Repository state -**M1 delivered, plus substantial M2–M4 work.** `SharpMUTerm.slnx` builds all twelve projects on +**M1 delivered, plus substantial M2–M4 work.** `SharpMUTerm.slnx` builds all fifteen projects on `net10.0`, with the full test suite passing. In place: - **Core** — `AnsiParser` (SGR 16/256/truecolor), styled-line + `ScrollbackBuffer` model (a capped @@ -194,6 +194,21 @@ fallbacks) for inline images/maps. the review opens, so the review is never shown for bytes the index did not name. The focused window's world (its session's, else its owner's, never `_active`) sorts its own packages first; a `*` package does not count as the world's own. The default index repository does not exist yet. +- **The shared client shell** (`SharpMUTerm.Client`; `ContributionRegistry`). UI-agnostic, references Core only + (`ClientAssemblyTests` fails on a SharpConsoleUI or Avalonia reference). The registry holds six kinds — + commands, panels, settings sections (field descriptors only), status cells (reserved width, drop order), + overlays, output decorators — each with a stable id unique within its kind and an owner (built-in or a + package id, so `RemoveOwnedBy` takes a package's contributions with it). Order is registration order unless + the kind defines one, ties by registration. Only **commands** are live so far: + - **⌃P's catalog is the registry's.** `BuiltInCommands.Register` (Client) says what each entry is called, + its group, its key per host (`KeyHint`, `HostKey.Newline` resolved from `HostKeyGlyphs`) and when it is + offered; the work is the Tui's `RunBuiltInCommand`, handed in as `run`. `CommandPalette`, the pointer menu + (`AddCommands`, key from the contribution) and `DispatchCommand` all read `SharpMUTermApp.Contributions`. + Entries generated from live state (characters, windows, panes, settings screens, the send group) are a + `CommandFamily` owning an id prefix; a single command's id may not fall under one. Dispatch ignores + availability (a rail row or the other half of a stateful pair still runs). A new ⌃P command is a + contribution in `BuiltInCommands` plus a case in `RunBuiltInCommand`; Core's `CommandCatalog` keeps only + `CharacterCycle`. - **Tui** — **SharpConsoleUI** app: a `TabControl` of output windows (main + trigger-routed **spawn windows** + web view, with unread badges), each a `MarkupControl` in a `ScrollablePanelControl` viewport (PgUp/PgDn, Shift+↑/↓, ⌃Home/⌃End, wheel; unread badges count output arriving below a @@ -915,8 +930,8 @@ through `MacroKeys`, `ScreenField` and the keypad renderer. ```bash dotnet run -c Release --project tests/SharpMUTerm.Core.Tests + @@ -10,6 +11,7 @@ + diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs new file mode 100644 index 00000000..d6b39ca3 --- /dev/null +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -0,0 +1,371 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Commands; + +/// +/// The client's own commands, registered into a : every Switch to… +/// and Go to… entry, the stateful commands that read their current value (Pause logging vs +/// Start logging, Unzoom pane, Resume scrollback), and one Open … entry per settings +/// screen the host offers. What each entry is called, where it is listed, which key it names and when it is +/// offered lives here; what it does is the host's, handed in as run, because that work reaches +/// into the shell (panes, sessions, overlays) and this assembly draws nothing. +/// +/// Registration order is the catalog's order, and it is the order the surface lists entries in within a group. +/// +/// +public static class BuiltInCommands +{ + /// + /// Registers every built-in command. does the work for an id and returns false when + /// it did not do what the label promised; it is called for every id these contributions handle, offered or not. + /// + public static void Register(ContributionRegistry registry, Func run) + { + ArgumentNullException.ThrowIfNull(registry); + ArgumentNullException.ThrowIfNull(run); + var commands = registry.Commands; + + void Add( + string id, + CommandGroup group, + string title, + KeyHint? key = null, + string? detail = null, + Func? when = null, + Func? titleFor = null, + bool detailFirst = false) => + commands.Add(new SingleCommand + { + Id = id, + Category = group, + Title = title, + TitleFor = titleFor, + Key = key, + Detail = detail, + DetailFirst = detailFirst, + IsAvailable = when, + Run = _ => run(id), + }); + + void Family(string id, string prefix, Func> generate) => + commands.Add(new CommandFamily + { + Id = id, + IdPrefix = prefix, + Generate = generate, + Run = (commandId, _) => run(commandId), + }); + + // GO TO — switch character, then jump to windows. + Family("goto:characters", CommandIds.CharacterPrefix, Characters); + Family("goto:windows", CommandIds.WindowPrefix, Windows); + + // WORLD + // Both carry their chord. The surface is where this client is discovered from, and a key nobody + // can find is the same as no feature — ⌃L's newline sat unused until it was reported missing. + Add("world:reconnect", CommandGroup.World, "Reconnect", "⌥R"); + Add("world:disconnect", CommandGroup.World, "Disconnect", "⌥D"); + Family("world:send-group", CommandIds.GroupPrefix, SendGroup); + Add("world:reload-scripts", CommandGroup.World, "Reload scripts", + detail: "re-reads this character's Lua files", when: c => c.State.ScriptsOn); + + // Only where the host has a screen reader to tell: the window's live region, or --plain. + Add("a11y:toggle-window", CommandGroup.Terminal, "Read this window aloud", + when: c => c.State.Announced is not null, + titleFor: c => c.State.Announced == true ? "Stop reading this window aloud" : "Read this window aloud"); + + // TERMINAL — stateful labels. + Add("term:log-off", CommandGroup.Terminal, "Pause logging", when: c => c.State.LoggingOn); + Add("term:log-on", CommandGroup.Terminal, "Start logging", when: c => !c.State.LoggingOn); + Add("term:unfreeze", CommandGroup.Terminal, "Resume scrollback", when: c => c.State.Frozen); + Add("term:freeze", CommandGroup.Terminal, "Freeze pane", when: c => !c.State.Frozen); + Add("term:clear", CommandGroup.Terminal, "Clear window"); + + // Scrollback position. Here as well as on the keyboard because this surface is where the client + // is discovered from — every other thing you can do to an output window is listed here — and the + // subtitles are how the keys get taught: a pane that scrolls and says so nowhere is a pane + // nobody scrolls. The "back" entry appears only when there is somewhere to come back from. + Add("term:scroll-oldest", CommandGroup.Terminal, "Scroll to oldest", "⌃Home", "PgUp pages back"); + Add("term:scroll-live", CommandGroup.Terminal, "Back to live output", "⌃End", when: c => c.State.ScrolledBack); + + // The restore log's one control that is not a settings field. It is listed unconditionally, and + // it is listed *here* rather than only on F9, because "delete what this client has written down + // about my session" is a thing a person wants to do now — after saying something they would + // rather was not on disk — and a purge you have to find in a settings screen is a purge that + // happens tomorrow. The per-character switch on F9 is the other half: this one is immediate and + // total, that one is a standing preference. + Add("term:restore-purge", CommandGroup.Terminal, "Purge the restore log", + detail: "deletes every pane's saved content"); + + // Copying output. Listed unconditionally and subtitled with the *gesture* as well as the chord, + // because the gesture is the part nobody can guess: under mouse reporting a plain drag belongs to + // the application, so a user who has learnt that their terminal needs ⇧-drag has no reason to try + // dragging here. It refuses out loud with nothing selected, which is what earns it a row at all. + Add("term:copy", CommandGroup.Terminal, "Copy the selection", "⌃C", + "drag across a pane or the command line, or ⇧← ⇧→ there"); + + // The client's own messages — the status-line notices that dismiss themselves — kept out of the + // output window (and so out of the session log) and readable here instead. + Add("term:messages", CommandGroup.Terminal, "Show client messages", detail: "status-line notices"); + + // What the server is sending out of band. Listed unconditionally: a meter or a script is written + // against a GMCP path, and this is where a player finds out which paths their game has. + Add("term:gamedata", CommandGroup.Terminal, "Show game data", detail: "GMCP and MSDP this connection holds"); + + // The map. Listed unconditionally, like the game data above: a map is recorded from the first room a + // game reports, and nothing else on screen says the client keeps one. + Add("term:map", CommandGroup.Terminal, "Show map", detail: "this connection's map · click a room, or /walk "); + Add("term:walk-stop", CommandGroup.Terminal, "Stop walking", detail: "ends the speedwalk", when: c => c.State.Walking); + + // Game sound, for this run. The levels and the off switch are F7's; this is the quick one. + Add("term:mute", CommandGroup.Terminal, "Mute sound", detail: "until unmuted or restarted", + when: c => c.State.Sound == true); + Add("term:unmute", CommandGroup.Terminal, "Unmute sound", detail: "game sound is muted", + when: c => c.State.Sound == false); + + // The command line's own history, browsable and searchable. Named here as well as bound to ⌃R + // because a chord nothing mentions is a chord nobody finds — the same reason every settings screen + // has a row even though each has an F-key. + Add("term:history", CommandGroup.Terminal, "Search command history", "⌃R"); + + // The composer. Named here as well as bound to F1 for the reason the row above it is: a surface + // nobody can find is a surface nobody uses, and this one is not something a reader would guess + // at from the command line in front of them. + Add("term:compose", CommandGroup.Terminal, "Compose a post", "F1", "a full editor, sent as one line"); + + // Packages: the list, and the install that starts at the review. F10 can be taken by a terminal's + // own menu key (GNOME Terminal), so this surface is the way in that always works. + Add("term:packages", CommandGroup.Terminal, "Packages", "F10", "installed packages, on/off, remove"); + Add("term:package-install", CommandGroup.Terminal, "Install package…", detail: "from a file or an https link"); + Add("term:package-browse", CommandGroup.Terminal, "Browse packages", detail: "the package index, this game's first"); + Add("term:timestamps-off", CommandGroup.Terminal, "Hide timestamps", when: c => c.State.TimestampsOn); + Add("term:timestamps-on", CommandGroup.Terminal, "Show timestamps", when: c => !c.State.TimestampsOn); + Add("term:input2-off", CommandGroup.Terminal, "Hide second input", "⌃B i", "this window", + when: c => c.State.SecondInputOn, detailFirst: true); + Add("term:input2-on", CommandGroup.Terminal, "Show second input", "⌃B i", "this window", + when: c => !c.State.SecondInputOn, detailFirst: true); + + // The newline chord. Here for the same reason the scrollback keys are: a chord that works and is + // named nowhere is a chord nobody finds, which is precisely how this one was reported as missing. + // The host says which chord it is: a terminal reports Shift+⏎ and Ctrl+⏎ as a bare ⏎, so there it is + // Alt+⏎, and a window keeps Alt+⏎ for itself, so there it is Ctrl+⏎. + Add("term:newline", CommandGroup.Terminal, "Insert a newline in the command line", KeyHint.ForHost(HostKey.Newline)); + + // LAYOUT — every entry carries the chord that runs it, because this surface is where the client + // is discovered from and the ⌃B keymap is otherwise visible only while the prefix is armed. + Add("layout:split-right", CommandGroup.Layout, "Split right", "⌃B |"); + Add("layout:split-down", CommandGroup.Layout, "Split down", "⌃B -"); + Add("layout:unzoom", CommandGroup.Layout, "Unzoom pane", "⌃B z", when: c => c.State.Zoomed); + Add("layout:zoom", CommandGroup.Layout, "Zoom pane", "⌃B z", when: c => !c.State.Zoomed); + Add("layout:close", CommandGroup.Layout, "Close pane", "⌃B x"); + + // Directional pane focus. Listed whether or not the workspace has a second pane, deliberately: + // this is the surface that teaches the keyboard, and the entries are how a reader learns the + // workspace splits at all. Each refuses out loud when there is nothing that way. + Add("layout:focus-left", CommandGroup.Layout, "Focus pane left", "⌃←"); + Add("layout:focus-right", CommandGroup.Layout, "Focus pane right", "⌃→"); + Add("layout:focus-up", CommandGroup.Layout, "Focus pane up", "⌃↑"); + Add("layout:focus-down", CommandGroup.Layout, "Focus pane down", "⌃↓"); + Add("layout:cycle", CommandGroup.Layout, "Focus the next pane", "⌃O", "⌃B o"); + + // The tab cycle, beside the pane cycle it rhymes with. Listed unconditionally for the same reason + // the four directional entries above are: this surface is where the keyboard is learnt, and a + // reader whose panes each hold one window has no other way to find out that a pane holds tabs at + // all. ⌃N has always done this and was named on F4 and nowhere else. + // + // Listing it obliges it to answer, which the directional entries pay for by refusing out loud and + // this one did not — it returned in silence on a pane with one tab, which is what a dead key looks + // like. The refusal is the host's (SharpMUTermApp.NextWindow); the entry is only allowed to exist + // because it is there. + Add("layout:next-tab", CommandGroup.Layout, "Focus the next tab", "⌃N"); + + Family("layout:panes", CommandIds.PanePrefix, Panes); + + // Pane size, in the plain words the request used ("increase/decrease a pane's horizontal or + // vertical character size") rather than in the chord's terms. Listed for the same reason the + // directional entries and the newline chord are: ⌥⇧+arrow is not a chord anybody guesses, and a + // feature reachable only by a chord nobody knows is the state ⌃L's newline sat in until it was + // reported as missing. Listed unconditionally too — each refuses out loud when the focused pane + // has no border to move that way, which is how a reader learns the workspace resizes at all. + // The arrow names what happens to *this* pane — ↑ taller, ↓ shorter — from either side of the + // split; it named the direction the divider travelled until that was reported as inverted. + Add("layout:wider", CommandGroup.Layout, "Make this pane wider", "⌥⇧→"); + Add("layout:narrower", CommandGroup.Layout, "Make this pane narrower", "⌥⇧←"); + Add("layout:taller", CommandGroup.Layout, "Make this pane taller", "⌥⇧↑"); + Add("layout:shorter", CommandGroup.Layout, "Make this pane shorter", "⌥⇧↓"); + + // SETTINGS — one entry per configuration screen, in the order the host lists them (its F-key + // order). Every screen or none: a surface offering one of them and hiding the rest would read + // as "this is the only thing you can configure", which is the state the surface was in before. + Family("settings:screens", CommandIds.ScreenPrefix, Screens); + } + + /// + /// The built-in catalog for this state, with no host behind it: what the surface would list. For a test of + /// the catalog alone, and for any reader that wants the entries without running them. + /// + public static IReadOnlyList Catalog( + Workspace workspace, + IReadOnlyList characters, + string? focusedSessionKey, + CommandContext context, + IReadOnlyList? settings = null) + { + ArgumentNullException.ThrowIfNull(workspace); + ArgumentNullException.ThrowIfNull(characters); + ArgumentNullException.ThrowIfNull(context); + var registry = new ContributionRegistry(); + Register(registry, _ => false); + return registry.Commands.Catalog(new CommandEnvironment( + context, + workspace, + characters, + focusedSessionKey, + settings ?? Array.Empty(), + new HostKeyGlyphs(context.NewlineChord))); + } + + // The two neighbours in the character cycle carry its chords. Only those two: ⌥J and ⌥K move one + // step, so they are the honest answer for the rows either side of you and a lie for anybody + // further away. There is deliberately no direct-selection chord to put on the rest — the digit + // row is spent on windows and panes, and every remaining digit-bearing modifier (⌥⇧, ⌃⇧) has no + // legacy encoding at all on this terminal, which was measured rather than assumed. + private static IEnumerable Characters(ICommandContext context) + { + var characters = context.Characters; + var focusedSessionKey = context.FocusedSessionKey; + var cycle = CommandCatalog.CharacterCycle(characters); + var here = cycle.FindIndex(c => c.SessionKey == focusedSessionKey); + var next = here >= 0 && cycle.Count > 1 ? cycle[(here + 1) % cycle.Count].SessionKey : null; + var previous = here >= 0 && cycle.Count > 1 + ? cycle[(here - 1 + cycle.Count) % cycle.Count].SessionKey + : null; + + foreach (var character in characters) + { + if (character.SessionKey == focusedSessionKey) + { + continue; + } + + var state = character.Connected ? "connected" : "offline"; + var chord = character.SessionKey == next ? "⌥J · " + : character.SessionKey == previous ? "⌥K · " + : string.Empty; + yield return new CommandItem( + CommandGroup.GoTo, + $"Switch to {character.CharacterName}", + CommandIds.Character(character.SessionKey), + $"{chord}{character.WorldName} · {state}"); + } + } + + private static IEnumerable Windows(ICommandContext context) + { + var workspace = context.Workspace; + var activeWindow = workspace.Layout.FocusedPane.ActiveTab; + + // The chord each window's entry names, from the one place windows are numbered — the *focused* + // character's list, because that is what ⌥N indexes. A window belonging to somebody else has no + // chord from here and correctly gets none: pressing ⌥2 would reach the focused character's second + // window, not this entry, and an entry naming a key that goes elsewhere is the defect the + // numbering exists to prevent. Built as a lookup rather than read per entry because the entries + // walk the whole registry, including windows no pane holds. + var windowOrdinals = new Dictionary(StringComparer.Ordinal); + var reachable = workspace.WindowsFor(context.FocusedSessionKey); + for (var i = 0; i < reachable.Count && i < CommandIds.WindowJumpDigits; i++) + { + windowOrdinals[reachable[i].Id] = i + 1; + } + + foreach (var window in workspace.Windows) + { + if (window.Id == activeWindow) + { + continue; + } + + var owner = window.SessionKey ?? "unowned"; + var unread = window.Unread > 0 ? $" · {window.Unread} unread" : string.Empty; + + // The chord leads, because it is the part a reader is here to learn — the owner and the count + // describe the window and this says how to reach it without the surface at all. Windows past + // the ninth get the same subtitle minus the chord, rather than one naming a key that would do + // something else. + var chord = windowOrdinals.TryGetValue(window.Id, out var ordinal) ? $"⌥{ordinal} · " : string.Empty; + yield return new CommandItem( + CommandGroup.GoTo, + $"Go to {window.Title}", + CommandIds.Window(window.Id), + $"{chord}{owner}{unread}"); + } + } + + // The send group: one line to several characters. Offered once two characters are open, since a + // group of one is the command line. + private static IEnumerable SendGroup(ICommandContext context) + { + var characters = context.Characters; + var open = characters.Where(c => c.Open).ToList(); + if (open.Count <= 1 && !characters.Any(c => c.InGroup)) + { + yield break; + } + + foreach (var character in open) + { + yield return new CommandItem( + CommandGroup.World, + character.InGroup + ? $"Remove {character.CharacterName} from the send group" + : $"Add {character.CharacterName} to the send group", + CommandIds.GroupToggle(character.SessionKey), + character.WorldName); + } + + var members = characters.Count(c => c.InGroup); + if (members > 0) + { + yield return new CommandItem( + CommandGroup.World, + "Send the command line to the group", + CommandIds.GroupSend, + members == 1 ? "1 character" : $"{members} characters"); + yield return new CommandItem(CommandGroup.World, "Clear the send group", CommandIds.GroupClear); + } + } + + // Numbered pane jumps, one entry per pane that exists — the one group here that is *not* listed + // unconditionally, because "Go to pane 4" on a workspace with two panes names a place there is no + // way to make. The number is the one the move and drag overlays badge each pane with, so the entry + // and the digit a user is about to press in move mode are the same number. + // + // The chord is ⌃B N and no longer ⌥N: ⌥N names a *window* now, and a pane and a window are + // different destinations that cannot share one key. ⌃B is where the rest of the pane keymap lives. + // Only the first nine carry it, so a tenth pane gets an entry with no subtitle rather than one + // naming a key that does something else — the honest shape for a place only the mouse, ⌃O, the + // arrows and this entry can reach. + private static IEnumerable Panes(ICommandContext context) + { + var paneCount = context.Workspace.Layout.Panes.Count; + if (paneCount <= 1) + { + yield break; + } + + for (var n = 1; n <= paneCount; n++) + { + yield return new CommandItem( + CommandGroup.Layout, + $"Go to pane {n}", + CommandIds.Pane(n), + n <= CommandIds.PaneJumpDigits ? $"⌃B {n}" : null); + } + } + + private static IEnumerable Screens(ICommandContext context) => + context.Settings.Select(screen => + new CommandItem(CommandGroup.Settings, $"Open {screen.Title}", screen.Id, screen.Shortcut)); +} diff --git a/src/SharpMUTerm.Client/Contributions/Commands.cs b/src/SharpMUTerm.Client/Contributions/Commands.cs new file mode 100644 index 00000000..eab4b5e8 --- /dev/null +++ b/src/SharpMUTerm.Client/Contributions/Commands.cs @@ -0,0 +1,300 @@ +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Contributions; + +/// A key whose chord differs between hosts. Each host says how it spells each one (). +public enum HostKey +{ + /// The chord that inserts a newline in the command line: ⌥⏎ in a terminal, ⌃⏎ in the desktop window. + Newline, +} + +/// +/// How the running host names its s on an in-app surface. Supplied by the host (the Tui +/// reads it off ClientHost.Keys), never guessed here, so a surface cannot name another host's chord. +/// +/// The newline chord as a surface writes it (Alt+⏎). +public sealed record HostKeyGlyphs(string Newline) +{ + /// A terminal's spelling, for a caller that has no host to ask (a test of the catalog alone). + public static HostKeyGlyphs Terminal { get; } = new("Alt+⏎"); + + /// The glyph for . + public string Glyph(HostKey key) => key switch + { + HostKey.Newline => Newline, + _ => throw new ArgumentOutOfRangeException(nameof(key), key, null), + }; +} + +/// +/// The key that runs a command, as a surface names it: either the same on every host (⌥R, ⌃B |, +/// F1) or a each host spells its own way. +/// +public sealed record KeyHint +{ + private KeyHint(string? glyph, HostKey? hostKey) + { + Fixed = glyph; + Host = hostKey; + } + + /// The glyph, when it is the same on every host. + public string? Fixed { get; } + + /// The host key, when each host spells it differently. + public HostKey? Host { get; } + + /// A chord spelt the same on every host. + public static KeyHint Of(string glyph) + { + ArgumentException.ThrowIfNullOrWhiteSpace(glyph); + return new KeyHint(glyph, null); + } + + /// A chord each host spells its own way. + public static KeyHint ForHost(HostKey key) => new(null, key); + + /// The glyph on the host whose spellings are . + public string Resolve(HostKeyGlyphs keys) + { + ArgumentNullException.ThrowIfNull(keys); + return Fixed ?? keys.Glyph(Host!.Value); + } + + /// Lets a literal stand for a fixed hint: Key = "⌥R". + public static implicit operator KeyHint(string glyph) => Of(glyph); +} + +/// +/// What a command reads to decide whether it is offered and what it is called right now. A host supplies one +/// each time the catalog is built or a command is run. Kept small on purpose: a command's work is +/// done by its own delegate, which closes over whatever it needs; this is only the state every surface shares. +/// +public interface ICommandContext +{ + /// The stateful flags (logging, zoom, freeze, …) the catalog's labels read. + CommandContext State { get; } + + /// The workspace: windows, panes, focus. + Workspace Workspace { get; } + + /// Every configured character, in the order the connection rail draws them. + IReadOnlyList Characters { get; } + + /// The session key of the character the surface is acting on, or null. + string? FocusedSessionKey { get; } + + /// The settings screens the host offers, in its F-key order. + IReadOnlyList Settings { get; } + + /// How this host spells the keys that differ between hosts. + HostKeyGlyphs Keys { get; } +} + +/// A plain : every value given up front. +public sealed record CommandEnvironment( + CommandContext State, + Workspace Workspace, + IReadOnlyList Characters, + string? FocusedSessionKey, + IReadOnlyList Settings, + HostKeyGlyphs Keys) : ICommandContext; + +/// +/// Commands are the actions the command surface (⌃P) lists, searches and runs, and that a pointer menu +/// offers by id. A contribution is one of two shapes: a , one entry with a fixed id, +/// or a , a set of entries generated from live state (one per character, window or +/// pane) whose ids share a prefix. Either way the surface sees s, in registration order. +/// +public abstract class CommandContribution : IContribution +{ + /// + public required string Id { get; init; } + + /// + public ContributionOwner Owner { get; init; } = ContributionOwner.BuiltIn; + + /// The entries this contribution offers right now. + public abstract IEnumerable Entries(ICommandContext context); + + /// Whether a command id is one this contribution runs. Asked without a context: an id is the whole address. + public abstract bool Handles(string commandId); + + /// + /// Runs the command with this id. Availability is not checked: a surface offers what is available, + /// but an id that arrives another way (a rail row, a key, the opposite half of a stateful pair) still runs. + /// Returns false when it did not do what its label promised. + /// + public abstract bool Execute(string commandId, ICommandContext context); +} + +/// One command with a fixed id: a title, the group it is listed under, the key that runs it and when it is offered. +public sealed class SingleCommand : CommandContribution +{ + /// What the surface calls it. + public required string Title { get; init; } + + /// A title that depends on state, used instead of when set (a toggle that names its next state). + public Func? TitleFor { get; init; } + + /// The group it is listed under. + public required CommandGroup Category { get; init; } + + /// The key that runs it, on each host; null when nothing but the surface does. + public KeyHint? Key { get; init; } + + /// A few words on what it does, shown beside the key. + public string? Detail { get; init; } + + /// Whether the subtitle reads detail · key rather than the usual key · detail. + public bool DetailFirst { get; init; } + + /// Whether it is offered right now; null means always. + public Func? IsAvailable { get; init; } + + /// Does the work. Returns false when it did not do what its label promised. + public required Func Run { get; init; } + + /// The subtitle the surface shows: the key and the detail, joined. + public string? SubtitleFor(ICommandContext context) + { + var key = Key?.Resolve(context.Keys); + return (key, Detail) switch + { + (null, null) => null, + (null, { } detail) => detail, + ({ } k, null) => k, + ({ } k, { } detail) => DetailFirst ? $"{detail} · {k}" : $"{k} · {detail}", + }; + } + + /// + public override IEnumerable Entries(ICommandContext context) + { + if (IsAvailable is null || IsAvailable(context)) + { + yield return new CommandItem(Category, TitleFor?.Invoke(context) ?? Title, Id, SubtitleFor(context)); + } + } + + /// + public override bool Handles(string commandId) => string.Equals(commandId, Id, StringComparison.Ordinal); + + /// + public override bool Execute(string commandId, ICommandContext context) => Run(context); +} + +/// +/// A set of commands generated from live state — one per character, window, pane or settings screen — whose +/// ids all start with . names the family itself and is +/// never a command id. +/// +public sealed class CommandFamily : CommandContribution +{ + /// The prefix every id this family emits starts with, and so every id it runs. + public required string IdPrefix { get; init; } + + /// Generates the entries from the current state. + public required Func> Generate { get; init; } + + /// Runs one of the family's ids. + public required Func Run { get; init; } + + /// + public override IEnumerable Entries(ICommandContext context) => Generate(context); + + /// + public override bool Handles(string commandId) => commandId.StartsWith(IdPrefix, StringComparison.Ordinal); + + /// + public override bool Execute(string commandId, ICommandContext context) => Run(commandId, context); +} + +/// +/// The registry's commands: builds the catalog the surface lists, and finds the contribution that runs an id. +/// A single command's id may not fall under a family's prefix, and one family's prefix may not contain +/// another's, so every id has exactly one contribution that runs it. +/// +public sealed class CommandList : ContributionList +{ + internal CommandList() + : base(ContributionKind.Command) + { + } + + /// Every entry every contribution offers right now, in registration order. + public IReadOnlyList Catalog(ICommandContext context) + { + ArgumentNullException.ThrowIfNull(context); + var items = new List(); + foreach (var contribution in this) + { + items.AddRange(contribution.Entries(context)); + } + + return items; + } + + /// The contribution that runs : an exact single command first, else the family whose prefix it has. + public CommandContribution? Resolve(string commandId) + { + ArgumentNullException.ThrowIfNull(commandId); + if (Find(commandId) is SingleCommand single) + { + return single; + } + + return this.OfType().FirstOrDefault(f => f.Handles(commandId)); + } + + /// + /// Runs through the contribution that handles it. Returns false, and sets + /// false, when nothing does. + /// + public bool TryExecute(string commandId, ICommandContext context, out bool handled) + { + var contribution = Resolve(commandId); + handled = contribution is not null; + return contribution is not null && contribution.Execute(commandId, context); + } + + /// + protected override void Validate(CommandContribution contribution) + { + switch (contribution) + { + case SingleCommand single: + ArgumentException.ThrowIfNullOrWhiteSpace(single.Title); + if (this.OfType().FirstOrDefault(f => f.Handles(single.Id)) is { } owning) + { + throw new ArgumentException( + $"the command id '{single.Id}' falls under the family '{owning.Id}' ({owning.IdPrefix})", + nameof(contribution)); + } + + break; + case CommandFamily family: + ArgumentException.ThrowIfNullOrWhiteSpace(family.IdPrefix); + foreach (var other in this) + { + var clash = other switch + { + SingleCommand s => family.Handles(s.Id), + CommandFamily f => f.IdPrefix.StartsWith(family.IdPrefix, StringComparison.Ordinal) + || family.IdPrefix.StartsWith(f.IdPrefix, StringComparison.Ordinal), + _ => false, + }; + if (clash) + { + throw new ArgumentException( + $"the family '{family.Id}' ({family.IdPrefix}) overlaps '{other.Id}'", + nameof(contribution)); + } + } + + break; + } + } +} diff --git a/src/SharpMUTerm.Client/Contributions/ContributionList.cs b/src/SharpMUTerm.Client/Contributions/ContributionList.cs new file mode 100644 index 00000000..b9c30cce --- /dev/null +++ b/src/SharpMUTerm.Client/Contributions/ContributionList.cs @@ -0,0 +1,91 @@ +using System.Collections; + +namespace SharpMUTerm.Client.Contributions; + +/// +/// One kind's contributions, in registration order. Registration order is the order every reader sees unless +/// the kind defines its own (a settings section's Order, a status cell's DropOrder), and ties +/// there are broken by registration order too, so the same registrations always read back the same way. +/// +/// Registered and read on the client's UI thread. It is not a concurrent collection. +/// +/// +/// The contribution type. +public class ContributionList : IReadOnlyList + where T : class, IContribution +{ + private readonly List _items = new(); + private readonly Dictionary _byId = new(StringComparer.Ordinal); + + internal ContributionList(ContributionKind kind) => Kind = kind; + + /// The kind this list holds. + public ContributionKind Kind { get; } + + /// + public int Count => _items.Count; + + /// + public T this[int index] => _items[index]; + + /// + /// Adds a contribution after every one already registered. + /// + /// The id is empty, or another contribution of this kind already has it. + public void Add(T contribution) + { + ArgumentNullException.ThrowIfNull(contribution); + ArgumentException.ThrowIfNullOrWhiteSpace(contribution.Id); + ArgumentNullException.ThrowIfNull(contribution.Owner); + if (_byId.TryGetValue(contribution.Id, out var existing)) + { + throw new ArgumentException( + $"a {Kind} with the id '{contribution.Id}' is already registered by {existing.Owner}", + nameof(contribution)); + } + + Validate(contribution); + _items.Add(contribution); + _byId.Add(contribution.Id, contribution); + } + + /// The contribution with this id, or null. + public T? Find(string id) => _byId.GetValueOrDefault(id); + + /// Whether a contribution has this id. + public bool Contains(string id) => _byId.ContainsKey(id); + + /// Removes every contribution this owner registered, keeping the order of the rest. Returns how many went. + public int RemoveOwnedBy(ContributionOwner owner) + { + ArgumentNullException.ThrowIfNull(owner); + var removed = _items.RemoveAll(c => c.Owner == owner); + if (removed > 0) + { + foreach (var id in _byId.Where(p => p.Value.Owner == owner).Select(p => p.Key).ToList()) + { + _byId.Remove(id); + } + } + + return removed; + } + + /// A further check a kind makes before accepting a contribution; throw to refuse it. + protected virtual void Validate(T contribution) + { + } + + /// The contributions sorted by , ties left in registration order. + protected IReadOnlyList SortedBy(Func key) => + _items.Select((item, index) => (item, index)) + .OrderBy(p => key(p.item)) + .ThenBy(p => p.index) + .Select(p => p.item) + .ToList(); + + /// + public IEnumerator GetEnumerator() => _items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); +} diff --git a/src/SharpMUTerm.Client/Contributions/ContributionOwner.cs b/src/SharpMUTerm.Client/Contributions/ContributionOwner.cs new file mode 100644 index 00000000..93546311 --- /dev/null +++ b/src/SharpMUTerm.Client/Contributions/ContributionOwner.cs @@ -0,0 +1,61 @@ +namespace SharpMUTerm.Client.Contributions; + +/// +/// Who put a contribution into the registry: the client itself (), or a package, named by +/// its id. The owner is what lets a disabled or removed package take every one of its contributions with it +/// () without touching anything the client registered. +/// +/// The package's id, or null for the client's own contributions. +public sealed record ContributionOwner(string? PackageId) +{ + /// The client's own contributions. + public static ContributionOwner BuiltIn { get; } = new((string?)null); + + /// A contribution from the package with this id. + public static ContributionOwner Package(string packageId) + { + ArgumentException.ThrowIfNullOrWhiteSpace(packageId); + return new ContributionOwner(packageId); + } + + /// Whether this is the client's own. + public bool IsBuiltIn => PackageId is null; + + /// + public override string ToString() => PackageId is null ? "built-in" : $"package:{PackageId}"; +} + +/// +/// The six kinds of thing a host's views read from the registry. Each kind has its own list in +/// , and ids are unique within a kind. +/// +public enum ContributionKind +{ + /// An action the command surface (⌃P) lists and a pointer menu can offer. See . + Command, + + /// A view of data the client holds (game data, the map). See . + Panel, + + /// A group of fields on a settings screen. See . + SettingsSection, + + /// A cell of the status row. See . + StatusCell, + + /// A modal surface drawn over the workspace. See . + Overlay, + + /// A step that changes a line of output on its way to a pane. See . + OutputDecorator, +} + +/// What every contribution has: an id unique within its kind, and an owner. +public interface IContribution +{ + /// The stable id. Unique within the contribution's kind; a second registration under it is refused. + string Id { get; } + + /// Who registered it. + ContributionOwner Owner { get; } +} diff --git a/src/SharpMUTerm.Client/Contributions/ContributionRegistry.cs b/src/SharpMUTerm.Client/Contributions/ContributionRegistry.cs new file mode 100644 index 00000000..f6579d07 --- /dev/null +++ b/src/SharpMUTerm.Client/Contributions/ContributionRegistry.cs @@ -0,0 +1,49 @@ +namespace SharpMUTerm.Client.Contributions; + +/// +/// Everything the client's surfaces list, held in one place so that a host's views read it rather than each +/// keeping its own copy, and so that a package (or a host) can add to it. Six kinds, one list each: +/// +/// : actions the command surface (⌃P) lists and runs, and a pointer menu offers by id. +/// : views of data the client holds for a connection (game data, the map). +/// : groups of field descriptors on a settings screen. +/// : segments of the status row, each with a reserved width and a drop order. +/// : modal surfaces over the workspace. +/// : steps that change a line of output on its way to a pane. +/// +/// Every contribution has a stable id, unique within its kind (a duplicate is refused), and an owner, the +/// client or a package. Order is registration order unless a kind says otherwise, and always deterministic. +/// +/// UI-agnostic: nothing here draws. The terminal reads it through SharpConsoleUI views, and the desktop +/// window will read the same registry through its own. +/// +/// +public sealed class ContributionRegistry +{ + /// Actions the command surface lists and a pointer menu offers. + public CommandList Commands { get; } = new(); + + /// Views of data the client holds. + public ContributionList Panels { get; } = new(ContributionKind.Panel); + + /// Groups of settings fields. + public SettingsSectionList SettingsSections { get; } = new(); + + /// Segments of the status row. + public StatusCellList StatusCells { get; } = new(); + + /// Modal surfaces over the workspace. + public ContributionList Overlays { get; } = new(ContributionKind.Overlay); + + /// Steps that change a line of output on its way to a pane. + public OutputDecoratorList OutputDecorators { get; } = new(); + + /// Removes every contribution of every kind this owner registered. Returns how many went. + public int RemoveOwnedBy(ContributionOwner owner) => + Commands.RemoveOwnedBy(owner) + + Panels.RemoveOwnedBy(owner) + + SettingsSections.RemoveOwnedBy(owner) + + StatusCells.RemoveOwnedBy(owner) + + Overlays.RemoveOwnedBy(owner) + + OutputDecorators.RemoveOwnedBy(owner); +} diff --git a/src/SharpMUTerm.Client/Contributions/Descriptors.cs b/src/SharpMUTerm.Client/Contributions/Descriptors.cs new file mode 100644 index 00000000..9590c05f --- /dev/null +++ b/src/SharpMUTerm.Client/Contributions/Descriptors.cs @@ -0,0 +1,193 @@ +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Client.Contributions; + +/// +/// Panels are views of data the client holds for a connection — the game data, the map, a package's own +/// readout. A host decides how to draw one (an overlay in the terminal, a docked pane in the window); the +/// contribution says what it is called and whether there is anything to show yet. +/// +public sealed class PanelContribution : IContribution +{ + /// + public required string Id { get; init; } + + /// + public ContributionOwner Owner { get; init; } = ContributionOwner.BuiltIn; + + /// What the panel is called. + public required string Title { get; init; } + + /// + /// Whether there is data to show for the connection with this session key (null: none is focused). A host + /// can offer an empty panel all the same; this lets it say so rather than draw a blank. + /// + public Func HasData { get; init; } = _ => true; +} + +/// +/// Settings sections are groups of fields on a settings screen. This slice carries the descriptors only; +/// nothing renders them yet. Sections are read in , ties in registration order. +/// +public sealed class SettingsSectionContribution : IContribution +{ + /// + public required string Id { get; init; } + + /// + public ContributionOwner Owner { get; init; } = ContributionOwner.BuiltIn; + + /// The section's heading. + public required string Title { get; init; } + + /// Where it sits among the sections; lower first. + public int Order { get; init; } + + /// Its fields, in the order they are shown. + public IReadOnlyList Fields { get; init; } = Array.Empty(); +} + +/// One field of a settings section: its id within the section, its label and an optional line of help. +public abstract record SettingsField(string Id, string Label, string? Help = null); + +/// A tick box. +public sealed record BoolField(string Id, string Label, string? Help = null) : SettingsField(Id, Label, Help); + +/// One of a closed set of values. +public sealed record ChoiceField(string Id, string Label, IReadOnlyList Choices, string? Help = null) + : SettingsField(Id, Label, Help); + +/// A whole number within bounds. +public sealed record NumberField(string Id, string Label, int Minimum, int Maximum, string? Help = null) + : SettingsField(Id, Label, Help); + +/// Free text; for a password. +public sealed record TextField(string Id, string Label, int? MaxLength = null, bool Masked = false, string? Help = null) + : SettingsField(Id, Label, Help); + +/// A colour from a named palette (never a free hex: a name survives a theme change, a hex does not). +public sealed record ColourField(string Id, string Label, IReadOnlyList Names, string? Help = null) + : SettingsField(Id, Label, Help); + +/// A list of items, each described by 's fields. +public sealed record ListField(string Id, string Label, IReadOnlyList Item, string? Help = null) + : SettingsField(Id, Label, Help); + +/// +/// Status cells are the segments of the status row. Every cell reserves its width whether or not it has +/// anything to say, because a cell that costs a column only when it speaks reflows the row (and, through the +/// panes, the size every server is told). When the row is too narrow, cells go in : +/// the highest first, ties the most recently registered first. +/// +public sealed class StatusCellContribution : IContribution +{ + /// + public required string Id { get; init; } + + /// + public ContributionOwner Owner { get; init; } = ContributionOwner.BuiltIn; + + /// Which goes first when the row runs out of room; higher goes sooner. + public int DropOrder { get; init; } + + /// The cells it holds whether or not it has text. + public required int ReservedWidth { get; init; } + + /// Its text now, or null for blank. Never wider than once drawn. + public Func? Text { get; init; } +} + +/// +/// Overlays are modal surfaces drawn over the workspace (⌃P, ⌃R, ⌃F, the composer). Minimal for now: an +/// id, a title, and the command that opens it, so a surface can list it. +/// +public sealed class OverlayContribution : IContribution +{ + /// + public required string Id { get; init; } + + /// + public ContributionOwner Owner { get; init; } = ContributionOwner.BuiltIn; + + /// What it is called. + public required string Title { get; init; } + + /// The command id that opens it, if one does. + public string? OpenedBy { get; init; } +} + +/// +/// Output decorators change a line of output on its way to a pane — link detection and emoji +/// substitution are the client's own. Run in , lowest first, ties in registration order. +/// Minimal for now; nothing runs them yet. +/// +public sealed class OutputDecoratorContribution : IContribution +{ + /// + public required string Id { get; init; } + + /// + public ContributionOwner Owner { get; init; } = ContributionOwner.BuiltIn; + + /// Where it runs among the decorators; lower first. + public int Order { get; init; } + + /// The change, or null for a descriptor that only names one. + public Func? Apply { get; init; } +} + +/// Settings sections, readable in their declared order. +public sealed class SettingsSectionList : ContributionList +{ + internal SettingsSectionList() + : base(ContributionKind.SettingsSection) + { + } + + /// The sections by , ties in registration order. + public IReadOnlyList Ordered => SortedBy(s => s.Order); + + /// + protected override void Validate(SettingsSectionContribution contribution) + { + var duplicate = contribution.Fields.GroupBy(f => f.Id, StringComparer.Ordinal).FirstOrDefault(g => g.Count() > 1); + if (duplicate is not null) + { + throw new ArgumentException( + $"the section '{contribution.Id}' has two fields with the id '{duplicate.Key}'", nameof(contribution)); + } + } +} + +/// Status cells, readable in the order they are given up. +public sealed class StatusCellList : ContributionList +{ + internal StatusCellList() + : base(ContributionKind.StatusCell) + { + } + + /// The cells in the order they go when the row is too narrow: highest drop order first, then the newest. + public IReadOnlyList InDropOrder => + this.Select((cell, index) => (cell, index)) + .OrderByDescending(p => p.cell.DropOrder) + .ThenByDescending(p => p.index) + .Select(p => p.cell) + .ToList(); + + /// + protected override void Validate(StatusCellContribution contribution) => + ArgumentOutOfRangeException.ThrowIfNegative(contribution.ReservedWidth); +} + +/// Output decorators, readable in the order they run. +public sealed class OutputDecoratorList : ContributionList +{ + internal OutputDecoratorList() + : base(ContributionKind.OutputDecorator) + { + } + + /// The decorators by , ties in registration order. + public IReadOnlyList Ordered => SortedBy(d => d.Order); +} diff --git a/src/SharpMUTerm.Client/SharpMUTerm.Client.csproj b/src/SharpMUTerm.Client/SharpMUTerm.Client.csproj new file mode 100644 index 00000000..62aa7329 --- /dev/null +++ b/src/SharpMUTerm.Client/SharpMUTerm.Client.csproj @@ -0,0 +1,17 @@ + + + + + SharpMUTerm.Client + SharpMUTerm.Client + + + + + + + diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index 4ce9af1b..69dd79ae 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -1,5 +1,3 @@ -using SharpMUTerm.Core.Workspaces; - namespace SharpMUTerm.Core.Commands; /// A character the command surface can switch to, with enough detail to label the entry. @@ -68,12 +66,10 @@ public sealed record CommandContext( public sealed record SettingsEntry(string Title, string Id, string Shortcut); /// -/// Generates the command-surface catalog from live state, per the design: every non-focused -/// character becomes a Switch to… entry, every non-active window a Go to… entry -/// subtitled with its owner and unread count, stateful commands read their current value -/// (Pause logging vs Start logging, Unzoom pane, Resume scrollback), and -/// every configuration screen the host offers becomes an Open … entry subtitled with its key. -/// Pure so the exact catalog is unit-testable; ranks it against a query. +/// What the command surface's catalog shares with the shell outside it. The catalog itself is no longer +/// built here: its entries are contributions in SharpMUTerm.Client's registry +/// (BuiltInCommands), so a package or a host can add to it. The character cycle stays here because the +/// shell's ⌥J/⌥K and the rail read it too. /// public static class CommandCatalog { @@ -100,314 +96,4 @@ public static List CharacterCycle(IReadOnlyList char ArgumentNullException.ThrowIfNull(characters); return characters.Where(c => c.Open).ToList(); } - - public static IReadOnlyList Build( - Workspace workspace, - IReadOnlyList characters, - string? focusedSessionKey, - CommandContext context, - IReadOnlyList? settings = null) - { - ArgumentNullException.ThrowIfNull(workspace); - ArgumentNullException.ThrowIfNull(characters); - ArgumentNullException.ThrowIfNull(context); - - var items = new List(); - var activeWindow = workspace.Layout.FocusedPane.ActiveTab; - - // GO TO — switch character, then jump to windows. - // - // The two neighbours in the character cycle carry its chords. Only those two: ⌥J and ⌥K move one - // step, so they are the honest answer for the rows either side of you and a lie for anybody - // further away. There is deliberately no direct-selection chord to put on the rest — the digit - // row is spent on windows and panes, and every remaining digit-bearing modifier (⌥⇧, ⌃⇧) has no - // legacy encoding at all on this terminal, which was measured rather than assumed. - var cycle = CharacterCycle(characters); - var here = cycle.FindIndex(c => c.SessionKey == focusedSessionKey); - var next = here >= 0 && cycle.Count > 1 ? cycle[(here + 1) % cycle.Count].SessionKey : null; - var previous = here >= 0 && cycle.Count > 1 - ? cycle[(here - 1 + cycle.Count) % cycle.Count].SessionKey - : null; - - foreach (var character in characters) - { - if (character.SessionKey == focusedSessionKey) - { - continue; - } - - var state = character.Connected ? "connected" : "offline"; - var chord = character.SessionKey == next ? "⌥J · " - : character.SessionKey == previous ? "⌥K · " - : string.Empty; - items.Add(new CommandItem( - CommandGroup.GoTo, - $"Switch to {character.CharacterName}", - CommandIds.Character(character.SessionKey), - $"{chord}{character.WorldName} · {state}")); - } - - // The chord each window's entry names, from the one place windows are numbered — the *focused* - // character's list, because that is what ⌥N indexes. A window belonging to somebody else has no - // chord from here and correctly gets none: pressing ⌥2 would reach the focused character's second - // window, not this entry, and an entry naming a key that goes elsewhere is the defect the - // numbering exists to prevent. Built as a lookup rather than read per entry because the entries - // walk the whole registry, including windows no pane holds. - var windowOrdinals = new Dictionary(StringComparer.Ordinal); - var reachable = workspace.WindowsFor(focusedSessionKey); - for (var i = 0; i < reachable.Count && i < CommandIds.WindowJumpDigits; i++) - { - windowOrdinals[reachable[i].Id] = i + 1; - } - - foreach (var window in workspace.Windows) - { - if (window.Id == activeWindow) - { - continue; - } - - var owner = window.SessionKey ?? "unowned"; - var unread = window.Unread > 0 ? $" · {window.Unread} unread" : string.Empty; - - // The chord leads, because it is the part a reader is here to learn — the owner and the count - // describe the window and this says how to reach it without the surface at all. Windows past - // the ninth get the same subtitle minus the chord, rather than one naming a key that would do - // something else. - var chord = windowOrdinals.TryGetValue(window.Id, out var ordinal) ? $"⌥{ordinal} · " : string.Empty; - items.Add(new CommandItem( - CommandGroup.GoTo, - $"Go to {window.Title}", - CommandIds.Window(window.Id), - $"{chord}{owner}{unread}")); - } - - // WORLD - // Both carry their chord. The surface is where this client is discovered from, and a key nobody - // can find is the same as no feature — ⌃L's newline sat unused until it was reported missing. - items.Add(new CommandItem(CommandGroup.World, "Reconnect", "world:reconnect", "⌥R")); - items.Add(new CommandItem(CommandGroup.World, "Disconnect", "world:disconnect", "⌥D")); - // The send group: one line to several characters. Offered once two characters are open, since a - // group of one is the command line. - var open = characters.Where(c => c.Open).ToList(); - if (open.Count > 1 || characters.Any(c => c.InGroup)) - { - foreach (var character in open) - { - items.Add(new CommandItem( - CommandGroup.World, - character.InGroup - ? $"Remove {character.CharacterName} from the send group" - : $"Add {character.CharacterName} to the send group", - CommandIds.GroupToggle(character.SessionKey), - character.WorldName)); - } - - var members = characters.Count(c => c.InGroup); - if (members > 0) - { - items.Add(new CommandItem( - CommandGroup.World, - "Send the command line to the group", - CommandIds.GroupSend, - members == 1 ? "1 character" : $"{members} characters")); - items.Add(new CommandItem(CommandGroup.World, "Clear the send group", CommandIds.GroupClear)); - } - } - - if (context.ScriptsOn) - { - items.Add(new CommandItem( - CommandGroup.World, "Reload scripts", "world:reload-scripts", "re-reads this character's Lua files")); - } - - // Only where the host has a screen reader to tell: the window's live region, or --plain. - if (context.Announced is { } announced) - { - items.Add(announced - ? new CommandItem(CommandGroup.Terminal, "Stop reading this window aloud", "a11y:toggle-window") - : new CommandItem(CommandGroup.Terminal, "Read this window aloud", "a11y:toggle-window")); - } - - // TERMINAL — stateful labels. - items.Add(context.LoggingOn - ? new CommandItem(CommandGroup.Terminal, "Pause logging", "term:log-off") - : new CommandItem(CommandGroup.Terminal, "Start logging", "term:log-on")); - items.Add(context.Frozen - ? new CommandItem(CommandGroup.Terminal, "Resume scrollback", "term:unfreeze") - : new CommandItem(CommandGroup.Terminal, "Freeze pane", "term:freeze")); - items.Add(new CommandItem(CommandGroup.Terminal, "Clear window", "term:clear")); - - // Scrollback position. Here as well as on the keyboard because this surface is where the client - // is discovered from — every other thing you can do to an output window is listed here — and the - // subtitles are how the keys get taught: a pane that scrolls and says so nowhere is a pane - // nobody scrolls. The "back" entry appears only when there is somewhere to come back from. - items.Add(new CommandItem( - CommandGroup.Terminal, "Scroll to oldest", "term:scroll-oldest", "⌃Home · PgUp pages back")); - if (context.ScrolledBack) - { - items.Add(new CommandItem( - CommandGroup.Terminal, "Back to live output", "term:scroll-live", "⌃End")); - } - - // The restore log's one control that is not a settings field. It is listed unconditionally, and - // it is listed *here* rather than only on F9, because "delete what this client has written down - // about my session" is a thing a person wants to do now — after saying something they would - // rather was not on disk — and a purge you have to find in a settings screen is a purge that - // happens tomorrow. The per-character switch on F9 is the other half: this one is immediate and - // total, that one is a standing preference. - items.Add(new CommandItem( - CommandGroup.Terminal, - "Purge the restore log", - "term:restore-purge", - "deletes every pane's saved content")); - - // Copying output. Listed unconditionally and subtitled with the *gesture* as well as the chord, - // because the gesture is the part nobody can guess: under mouse reporting a plain drag belongs to - // the application, so a user who has learnt that their terminal needs ⇧-drag has no reason to try - // dragging here. It refuses out loud with nothing selected, which is what earns it a row at all. - items.Add(new CommandItem( - CommandGroup.Terminal, "Copy the selection", "term:copy", "⌃C · drag across a pane or the command line, or ⇧← ⇧→ there")); - - // The client's own messages — the status-line notices that dismiss themselves — kept out of the - // output window (and so out of the session log) and readable here instead. - items.Add(new CommandItem( - CommandGroup.Terminal, "Show client messages", "term:messages", "status-line notices")); - - // What the server is sending out of band. Listed unconditionally: a meter or a script is written - // against a GMCP path, and this is where a player finds out which paths their game has. - items.Add(new CommandItem( - CommandGroup.Terminal, "Show game data", "term:gamedata", "GMCP and MSDP this connection holds")); - - // The map. Listed unconditionally, like the game data above: a map is recorded from the first room a - // game reports, and nothing else on screen says the client keeps one. - items.Add(new CommandItem( - CommandGroup.Terminal, "Show map", "term:map", "this connection's map · click a room, or /walk ")); - if (context.Walking) - { - items.Add(new CommandItem(CommandGroup.Terminal, "Stop walking", "term:walk-stop", "ends the speedwalk")); - } - - // Game sound, for this run. The levels and the off switch are F7's; this is the quick one. - if (context.Sound is { } playing) - { - items.Add(playing - ? new CommandItem(CommandGroup.Terminal, "Mute sound", "term:mute", "until unmuted or restarted") - : new CommandItem(CommandGroup.Terminal, "Unmute sound", "term:unmute", "game sound is muted")); - } - - // The command line's own history, browsable and searchable. Named here as well as bound to ⌃R - // because a chord nothing mentions is a chord nobody finds — the same reason every settings screen - // has a row even though each has an F-key. - items.Add(new CommandItem( - CommandGroup.Terminal, "Search command history", "term:history", "⌃R")); - - // The composer. Named here as well as bound to F1 for the reason the row above it is: a surface - // nobody can find is a surface nobody uses, and this one is not something a reader would guess - // at from the command line in front of them. - items.Add(new CommandItem( - CommandGroup.Terminal, "Compose a post", "term:compose", "F1 · a full editor, sent as one line")); - - // Packages: the list, and the install that starts at the review. F10 can be taken by a terminal's - // own menu key (GNOME Terminal), so this surface is the way in that always works. - items.Add(new CommandItem( - CommandGroup.Terminal, "Packages", "term:packages", "F10 · installed packages, on/off, remove")); - items.Add(new CommandItem( - CommandGroup.Terminal, "Install package…", "term:package-install", "from a file or an https link")); - items.Add(new CommandItem( - CommandGroup.Terminal, "Browse packages", "term:package-browse", "the package index, this game's first")); - items.Add(context.TimestampsOn - ? new CommandItem(CommandGroup.Terminal, "Hide timestamps", "term:timestamps-off") - : new CommandItem(CommandGroup.Terminal, "Show timestamps", "term:timestamps-on")); - items.Add(context.SecondInputOn - ? new CommandItem( - CommandGroup.Terminal, "Hide second input", "term:input2-off", "this window · ⌃B i") - : new CommandItem( - CommandGroup.Terminal, "Show second input", "term:input2-on", "this window · ⌃B i")); - - // The newline chord. Here for the same reason the scrollback keys are: a chord that works and is - // named nowhere is a chord nobody finds, which is precisely how this one was reported as missing. - // The host says which chord it is: a terminal reports Shift+⏎ and Ctrl+⏎ as a bare ⏎, so there it is - // Alt+⏎, and a window keeps Alt+⏎ for itself, so there it is Ctrl+⏎. - items.Add(new CommandItem( - CommandGroup.Terminal, "Insert a newline in the command line", "term:newline", context.NewlineChord)); - - // LAYOUT — every entry carries the chord that runs it, because this surface is where the client - // is discovered from and the ⌃B keymap is otherwise visible only while the prefix is armed. - items.Add(new CommandItem(CommandGroup.Layout, "Split right", "layout:split-right", "⌃B |")); - items.Add(new CommandItem(CommandGroup.Layout, "Split down", "layout:split-down", "⌃B -")); - items.Add(context.Zoomed - ? new CommandItem(CommandGroup.Layout, "Unzoom pane", "layout:unzoom", "⌃B z") - : new CommandItem(CommandGroup.Layout, "Zoom pane", "layout:zoom", "⌃B z")); - items.Add(new CommandItem(CommandGroup.Layout, "Close pane", "layout:close", "⌃B x")); - - // Directional pane focus. Listed whether or not the workspace has a second pane, deliberately: - // this is the surface that teaches the keyboard, and the entries are how a reader learns the - // workspace splits at all. Each refuses out loud when there is nothing that way. - items.Add(new CommandItem(CommandGroup.Layout, "Focus pane left", "layout:focus-left", "⌃←")); - items.Add(new CommandItem(CommandGroup.Layout, "Focus pane right", "layout:focus-right", "⌃→")); - items.Add(new CommandItem(CommandGroup.Layout, "Focus pane up", "layout:focus-up", "⌃↑")); - items.Add(new CommandItem(CommandGroup.Layout, "Focus pane down", "layout:focus-down", "⌃↓")); - items.Add(new CommandItem(CommandGroup.Layout, "Focus the next pane", "layout:cycle", "⌃O · ⌃B o")); - - // The tab cycle, beside the pane cycle it rhymes with. Listed unconditionally for the same reason - // the four directional entries above are: this surface is where the keyboard is learnt, and a - // reader whose panes each hold one window has no other way to find out that a pane holds tabs at - // all. ⌃N has always done this and was named on F4 and nowhere else. - // - // Listing it obliges it to answer, which the directional entries pay for by refusing out loud and - // this one did not — it returned in silence on a pane with one tab, which is what a dead key looks - // like. The refusal is the host's (SharpMUTermApp.NextWindow); the entry is only allowed to exist - // because it is there. - items.Add(new CommandItem(CommandGroup.Layout, "Focus the next tab", "layout:next-tab", "⌃N")); - - // Numbered pane jumps, one entry per pane that exists — the one group here that is *not* listed - // unconditionally, because "Go to pane 4" on a workspace with two panes names a place there is no - // way to make. The number is the one the move and drag overlays badge each pane with, so the entry - // and the digit a user is about to press in move mode are the same number. - // - // The chord is ⌃B N and no longer ⌥N: ⌥N names a *window* now, and a pane and a window are - // different destinations that cannot share one key. ⌃B is where the rest of the pane keymap lives. - // Only the first nine carry it, so a tenth pane gets an entry with no subtitle rather than one - // naming a key that does something else — the honest shape for a place only the mouse, ⌃O, the - // arrows and this entry can reach. - var paneCount = workspace.Layout.Panes.Count; - if (paneCount > 1) - { - for (var n = 1; n <= paneCount; n++) - { - items.Add(new CommandItem( - CommandGroup.Layout, - $"Go to pane {n}", - CommandIds.Pane(n), - n <= CommandIds.PaneJumpDigits ? $"⌃B {n}" : null)); - } - } - - // Pane size, in the plain words the request used ("increase/decrease a pane's horizontal or - // vertical character size") rather than in the chord's terms. Listed for the same reason the - // directional entries and the newline chord are: ⌥⇧+arrow is not a chord anybody guesses, and a - // feature reachable only by a chord nobody knows is the state ⌃L's newline sat in until it was - // reported as missing. Listed unconditionally too — each refuses out loud when the focused pane - // has no border to move that way, which is how a reader learns the workspace resizes at all. - // The arrow names what happens to *this* pane — ↑ taller, ↓ shorter — from either side of the - // split; it named the direction the divider travelled until that was reported as inverted. - items.Add(new CommandItem(CommandGroup.Layout, "Make this pane wider", "layout:wider", "⌥⇧→")); - items.Add(new CommandItem(CommandGroup.Layout, "Make this pane narrower", "layout:narrower", "⌥⇧←")); - items.Add(new CommandItem(CommandGroup.Layout, "Make this pane taller", "layout:taller", "⌥⇧↑")); - items.Add(new CommandItem(CommandGroup.Layout, "Make this pane shorter", "layout:shorter", "⌥⇧↓")); - - // SETTINGS — one entry per configuration screen, in the order the host lists them (its F-key - // order). Every screen or none: a surface offering one of them and hiding the rest would read - // as "this is the only thing you can configure", which is the state the surface was in before. - if (settings is not null) - { - foreach (var screen in settings) - { - items.Add(new CommandItem(CommandGroup.Settings, $"Open {screen.Title}", screen.Id, screen.Shortcut)); - } - } - - return items; - } } diff --git a/src/SharpMUTerm.Core/Commands/CommandIds.cs b/src/SharpMUTerm.Core/Commands/CommandIds.cs index e842ef53..c4378852 100644 --- a/src/SharpMUTerm.Core/Commands/CommandIds.cs +++ b/src/SharpMUTerm.Core/Commands/CommandIds.cs @@ -16,6 +16,12 @@ public static class CommandIds /// Prefix of a "go to this window" id; the remainder is a workspace window id. public const string WindowPrefix = "win:"; + /// Prefix of an "open this settings screen" id; the remainder is the screen's first view name. + public const string ScreenPrefix = "screen:"; + + /// Prefix every send-group id shares: the toggles, and . + public const string GroupPrefix = "group:"; + /// Prefix of an "add to / remove from the send group" id; the remainder is a session key. public const string GroupTogglePrefix = "group:toggle:"; diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index 83641060..e30c0c38 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -535,7 +535,7 @@ private void AddCommands(List items, params string?[] ids) if (catalog.FirstOrDefault(c => c.Id == id) is { } command) { - items.Add(new PointerMenuItem(command.Title, ShortHint(command.Subtitle), () => OnUiThread(() => DispatchCommand(id)))); + items.Add(new PointerMenuItem(command.Title, MenuKeyHint(command), () => OnUiThread(() => DispatchCommand(id)))); } } } diff --git a/src/SharpMUTerm.Tui/SharpMUTerm.Tui.csproj b/src/SharpMUTerm.Tui/SharpMUTerm.Tui.csproj index 2926bfa8..4b4945b3 100644 --- a/src/SharpMUTerm.Tui/SharpMUTerm.Tui.csproj +++ b/src/SharpMUTerm.Tui/SharpMUTerm.Tui.csproj @@ -69,6 +69,7 @@ + diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs new file mode 100644 index 00000000..877d8b84 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs @@ -0,0 +1,94 @@ +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Tui; + +/// +/// The contribution registry this app reads its command surface from. The built-in commands are registered +/// at construction ( says what each is called and when it is offered; +/// does the work), and ⌃P, the pointer menu and every +/// read the registry rather than a list of their own — so a command a package or +/// a host adds is listed, searched, offered and run exactly as a built-in one is. +/// +internal sealed partial class SharpMUTermApp +{ + private readonly ContributionRegistry _contributions = new(); + + /// The registry the surfaces read. A host or a package adds to it; the views pick it up on their next read. + internal ContributionRegistry Contributions => _contributions; + + private void RegisterBuiltInContributions() => BuiltInCommands.Register(_contributions, RunBuiltInCommand); + + /// What a command reads right now. Each value is worked out only if something asks for it. + private ICommandContext CommandEnvironment() => new AppCommandContext(this); + + /// + /// Runs a command-surface entry by its id, through the contribution that handles it. Internal so a + /// headless test can dispatch an id the way the palette does, without opening the surface and typing at it. + /// + /// Returns for an id nothing implements, and says so on the status line — never + /// through _active: an unwired command is exactly what you hit while nothing is connected, and a + /// message that needs a session to be seen cannot report in the state it is being read in. + /// CommandDispatchTests dispatches every id the catalog can emit and fails on a false. + /// + /// + internal bool DispatchCommand(string id) + { + if (_contributions.Commands.Resolve(id) is not { } contribution) + { + RefuseCommand($"{id} isn't wired in this build yet"); + RefreshTabTitles(); + return false; + } + + if (contribution.Owner.IsBuiltIn) + { + return contribution.Execute(id, CommandEnvironment()); + } + + // A package's command is somebody else's code: a throw from it is reported, not allowed to take the + // UI thread down with it. + try + { + return contribution.Execute(id, CommandEnvironment()); + } + catch (Exception ex) + { + RefuseCommand($"{id} failed: {ex.Message}"); + return false; + } + } + + /// + /// The key a pointer menu shows for a command: the one the contribution names on this host, else the key + /// its catalog subtitle leads with (), for an entry a family generated. + /// + private string? MenuKeyHint(CommandItem command) => + _contributions.Commands.Resolve(command.Id) is SingleCommand { Key: { } key } + ? key.Resolve(HostKeyGlyphs()) + : ShortHint(command.Subtitle); + + private HostKeyGlyphs HostKeyGlyphs() => new(Host.Keys.Newline.Glyph); + + private sealed class AppCommandContext(SharpMUTermApp app) : ICommandContext + { + private CommandContext? _state; + private IReadOnlyList? _characters; + private IReadOnlyList? _settings; + private HostKeyGlyphs? _keys; + + public CommandContext State => _state ??= app.CommandState(); + + public Workspace Workspace => app._workspace; + + public IReadOnlyList Characters => _characters ??= app.BuildCharacterRefs(); + + public string? FocusedSessionKey => app._active?.SessionKey; + + public IReadOnlyList Settings => _settings ??= app.SettingsCommands(); + + public HostKeyGlyphs Keys => _keys ??= app.HostKeyGlyphs(); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 8c187c52..f0a2be57 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -892,6 +892,7 @@ public SharpMUTermApp( // short with the input bar a row up, for good. _window.IsScrollable = false; + RegisterBuiltInContributions(); _palette = new CommandPalette(_system, BuildCatalog, () => _active?.SessionKey, id => DispatchCommand(id)); _messageLog = new MessageLogOverlay(_system, _diagnostics); _gameData = new GameDataOverlay(_system, _time); @@ -6462,7 +6463,7 @@ private IReadOnlyList SettingsCommands() => SettingsScreens() .ToList(); /// The command-surface id prefix for "open this settings screen". - private const string ScreenCommandPrefix = "screen:"; + private const string ScreenCommandPrefix = CommandIds.ScreenPrefix; /// /// Binds every chord the app claims globally: the window/pane commands, and each settings screen's @@ -7684,9 +7685,12 @@ private void RefreshRail() /// the SETTINGS group from that table is that the two cannot disagree, and only a test that reads /// both can say so. /// - internal IReadOnlyList BuildCatalog() + internal IReadOnlyList BuildCatalog() => _contributions.Commands.Catalog(CommandEnvironment()); + + /// The stateful flags the catalog's labels read, as they stand now. + private CommandContext CommandState() { - var context = new CommandContext( + return new CommandContext( LoggingOn: _active?.IsLogging == true, Zoomed: _workspace.Layout.ZoomedPaneId is not null, Frozen: _workspace.Layout.FocusedPane.Frozen, @@ -7698,8 +7702,6 @@ internal IReadOnlyList BuildCatalog() Walking: SendTarget() is { } walker && _recorders.TryGetValue(walker, out var map) && map.Walk.IsWalking, Sound: CanPlaySound ? !_muted : null, Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId())); - return CommandCatalog.Build( - _workspace, BuildCharacterRefs(), _active?.SessionKey, context, SettingsCommands()); } /// @@ -7947,9 +7949,9 @@ internal IReadOnlyList PaneLines(string windowId) => internal bool MessageLogIsOpen => _messageLog.IsOpen; /// - /// Runs a command-surface entry by its id, doing what the current shell supports. Internal so a - /// headless test can dispatch an id the way the palette does, without opening the surface and - /// typing at it. + /// Does the work for a built-in command id: the run every contribution + /// BuiltInCommands.Register makes is handed. reaches it through the + /// registry, which is what lets a package's or a host's command sit beside these. /// /// Returns for an id nothing here implements. That is not a nicety: the /// catalog is generated from live state and this is a hand-written switch, so the two drift in @@ -7958,7 +7960,7 @@ internal IReadOnlyList PaneLines(string windowId) => /// fails on a false, which is the only thing that makes them stay in step. /// /// - internal bool DispatchCommand(string id) + private bool RunBuiltInCommand(string id) { if (DispatchGroupCommand(id)) { diff --git a/tests/SharpMUTerm.Core.Tests/Commands/CommandCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/BuiltInCatalogTests.cs similarity index 85% rename from tests/SharpMUTerm.Core.Tests/Commands/CommandCatalogTests.cs rename to tests/SharpMUTerm.Client.Tests/BuiltInCatalogTests.cs index d77b69dd..c0517de8 100644 --- a/tests/SharpMUTerm.Core.Tests/Commands/CommandCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/BuiltInCatalogTests.cs @@ -1,9 +1,10 @@ +using SharpMUTerm.Client.Commands; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Workspaces; -namespace SharpMUTerm.Core.Tests.Commands; +namespace SharpMUTerm.Client.Tests; -public class CommandCatalogTests +public class BuiltInCatalogTests { private static readonly CharacterRef[] Characters = { @@ -15,7 +16,7 @@ public class CommandCatalogTests public async Task NonFocusedCharacters_BecomeSwitchEntries() { var ws = new Workspace(); - var catalog = CommandCatalog.Build(ws, Characters, "Aetherfall.Corvid", new CommandContext()); + var catalog = BuiltInCommands.Catalog(ws, Characters, "Aetherfall.Corvid", new CommandContext()); var switches = catalog.Where(c => c.Id.StartsWith("char:")).ToArray(); await Assert.That(switches).HasSingleItem(); // Corvid is focused, only Rookery remains @@ -29,7 +30,7 @@ public async Task NonActiveWindows_BecomeGoToEntries_WithOwnerAndUnread() var ws = new Workspace(); ws.RouteSpawn("Chat"); // background window, 1 unread, owner unset here - var catalog = CommandCatalog.Build(ws, Characters, "Aetherfall.Corvid", new CommandContext()); + var catalog = BuiltInCommands.Catalog(ws, Characters, "Aetherfall.Corvid", new CommandContext()); var goTo = catalog.Single(c => c.Id.StartsWith("win:")); await Assert.That(goTo.Title).IsEqualTo("Go to Chat"); await Assert.That(goTo.Subtitle).Contains("1 unread"); @@ -39,10 +40,10 @@ public async Task NonActiveWindows_BecomeGoToEntries_WithOwnerAndUnread() public async Task StatefulCommands_ReadCurrentValue() { var ws = new Workspace(); - var loggingOff = CommandCatalog.Build(ws, Characters, null, new CommandContext(LoggingOn: false)); + var loggingOff = BuiltInCommands.Catalog(ws, Characters, null, new CommandContext(LoggingOn: false)); await Assert.That(loggingOff.Any(c => c.Title == "Start logging")).IsTrue(); - var loggingOn = CommandCatalog.Build(ws, Characters, null, new CommandContext(LoggingOn: true, Zoomed: true, Frozen: true)); + var loggingOn = BuiltInCommands.Catalog(ws, Characters, null, new CommandContext(LoggingOn: true, Zoomed: true, Frozen: true)); await Assert.That(loggingOn.Any(c => c.Title == "Pause logging")).IsTrue(); await Assert.That(loggingOn.Any(c => c.Title == "Unzoom pane")).IsTrue(); await Assert.That(loggingOn.Any(c => c.Title == "Resume scrollback")).IsTrue(); @@ -56,7 +57,7 @@ public async Task StatefulCommands_ReadCurrentValue() [Test] public async Task TheTabCycleIsListedWithItsChord() { - var catalog = CommandCatalog.Build(new Workspace(), Characters, null, new CommandContext()); + var catalog = BuiltInCommands.Catalog(new Workspace(), Characters, null, new CommandContext()); var entry = catalog.Single(c => c.Id == "layout:next-tab"); await Assert.That(entry.Title).IsEqualTo("Focus the next tab"); @@ -72,7 +73,7 @@ public async Task TheTabCycleIsListedWithItsChord() [Test] public async Task NumberedPaneEntries_AppearOnlyOnASplit_AndOnlyTheFirstNineCarryAChord() { - var one = CommandCatalog.Build(new Workspace(), Characters, null, new CommandContext()); + var one = BuiltInCommands.Catalog(new Workspace(), Characters, null, new CommandContext()); await Assert.That(one.Any(c => c.Id.StartsWith(CommandIds.PanePrefix, StringComparison.Ordinal))) .IsFalse(); @@ -97,7 +98,7 @@ await Assert.That(one.Any(c => c.Id.StartsWith(CommandIds.PanePrefix, StringComp var panes = ws.Layout.Panes.Count; await Assert.That(panes).IsGreaterThan(CommandIds.PaneJumpDigits); - var entries = CommandCatalog.Build(ws, Characters, null, new CommandContext()) + var entries = BuiltInCommands.Catalog(ws, Characters, null, new CommandContext()) .Where(c => c.Id.StartsWith(CommandIds.PanePrefix, StringComparison.Ordinal)) .ToList(); @@ -137,7 +138,7 @@ public async Task WindowEntries_LeadWithTheirChord_AndOnlyTheFirstNineHaveOne() // focused *character* is Corvid, because the numbering is scoped to whoever is active and a // catalog built for nobody would correctly hand out no chords at all. ws.Layout.FocusedPane.ActiveIndex = -1; - var entries = CommandCatalog.Build(ws, Characters, "Aetherfall.Corvid", new CommandContext()) + var entries = BuiltInCommands.Catalog(ws, Characters, "Aetherfall.Corvid", new CommandContext()) .Where(c => c.Id.StartsWith(CommandIds.WindowPrefix, StringComparison.Ordinal)) .ToDictionary(c => c.Id, c => c.Subtitle, StringComparer.Ordinal); @@ -162,7 +163,7 @@ await Assert.That(subtitle!.Contains('⌥')) public async Task Catalog_CoversEveryGroup() { var ws = new Workspace(); - var catalog = CommandCatalog.Build(ws, Characters, "Aetherfall.Corvid", new CommandContext(), Screens); + var catalog = BuiltInCommands.Catalog(ws, Characters, "Aetherfall.Corvid", new CommandContext(), Screens); foreach (var group in Enum.GetValues()) { await Assert.That(catalog.Any(c => c.Group == group)).IsTrue(); @@ -179,7 +180,7 @@ public async Task Catalog_CoversEveryGroup() public async Task EverySettingsScreenTheHostOffers_BecomesAnEntry_SubtitledWithItsKey() { var ws = new Workspace(); - var catalog = CommandCatalog.Build(ws, Characters, null, new CommandContext(), Screens); + var catalog = BuiltInCommands.Catalog(ws, Characters, null, new CommandContext(), Screens); var settings = catalog.Where(c => c.Group == CommandGroup.Settings).ToArray(); await Assert.That(settings.Length).IsEqualTo(2); @@ -194,7 +195,7 @@ public async Task EverySettingsScreenTheHostOffers_BecomesAnEntry_SubtitledWithI public async Task AHostThatOffersNoScreens_GetsNoSettingsGroup() { var ws = new Workspace(); - var catalog = CommandCatalog.Build(ws, Characters, null, new CommandContext()); + var catalog = BuiltInCommands.Catalog(ws, Characters, null, new CommandContext()); await Assert.That(catalog.Any(c => c.Group == CommandGroup.Settings)).IsFalse(); } diff --git a/tests/SharpMUTerm.Client.Tests/ClientAssemblyTests.cs b/tests/SharpMUTerm.Client.Tests/ClientAssemblyTests.cs new file mode 100644 index 00000000..71d4a8d9 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/ClientAssemblyTests.cs @@ -0,0 +1,52 @@ +using System.Reflection; +using SharpMUTerm.Client.Contributions; + +namespace SharpMUTerm.Client.Tests; + +/// +/// The shared shell draws nothing. Both hosts' views read SharpMUTerm.Client, so the day it names +/// SharpConsoleUI the desktop window inherits the terminal's framework, and the day it names Avalonia the +/// terminal loads a windowing toolkit. Checked over every assembly it pulls in from this repository, so a +/// reference that arrives through Core counts too. +/// +public class ClientAssemblyTests +{ + // Ordinal: the terminal host's assembly is "sharpmuterm", which a case-blind prefix match finds in every SharpMUTerm.* name. + private static readonly string[] Forbidden = { "SharpConsoleUI", "Avalonia", "sharpmuterm", "sharpmuterm-window", "SharpMUTerm.Tui" }; + + [Test] + public async Task TheClientAssemblyReferencesNeitherUiFramework() + { + var seen = new HashSet(StringComparer.Ordinal); + var pending = new Queue(); + pending.Enqueue(typeof(ContributionRegistry).Assembly); + var offenders = new List(); + while (pending.Count > 0) + { + var assembly = pending.Dequeue(); + if (!seen.Add(assembly.GetName().Name!)) + { + continue; + } + + foreach (var reference in assembly.GetReferencedAssemblies()) + { + var name = reference.Name!; + if (Forbidden.Any(f => name.Equals(f, StringComparison.Ordinal) + || name.StartsWith(f + ".", StringComparison.Ordinal))) + { + offenders.Add($"{assembly.GetName().Name} → {name}"); + } + + // Follow this repository's own assemblies; a package's references are its own business. + if (name.StartsWith("SharpMUTerm.", StringComparison.Ordinal) && !seen.Contains(name)) + { + pending.Enqueue(System.Reflection.Assembly.Load(reference)); + } + } + } + + await Assert.That(offenders).IsEmpty(); + await Assert.That(seen).Contains("SharpMUTerm.Core"); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/ContributionRegistryTests.cs b/tests/SharpMUTerm.Client.Tests/ContributionRegistryTests.cs new file mode 100644 index 00000000..f81b6ff2 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/ContributionRegistryTests.cs @@ -0,0 +1,215 @@ +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Tests; + +public class ContributionRegistryTests +{ + private static ICommandContext Context(CommandContext? state = null, HostKeyGlyphs? keys = null) => + new CommandEnvironment( + state ?? new CommandContext(), + new Workspace(), + Array.Empty(), + null, + Array.Empty(), + keys ?? HostKeyGlyphs.Terminal); + + private static SingleCommand Command(string id, string title = "T", ContributionOwner? owner = null) => new() + { + Id = id, + Title = title, + Category = CommandGroup.Terminal, + Owner = owner ?? ContributionOwner.BuiltIn, + Run = _ => true, + }; + + [Test] + public async Task ADuplicateIdIsRefusedWithinAKind() + { + var registry = new ContributionRegistry(); + registry.Commands.Add(Command("x:one")); + + await Assert.That(() => registry.Commands.Add(Command("x:one", owner: ContributionOwner.Package("p")))) + .Throws(); + await Assert.That(registry.Commands.Count).IsEqualTo(1); + + // Ids are per kind: a panel may share a command's id. + registry.Panels.Add(new PanelContribution { Id = "x:one", Title = "One" }); + await Assert.That(registry.Panels.Count).IsEqualTo(1); + } + + [Test] + public async Task ACommandUnderAFamilysPrefixIsRefused_AndOverlappingFamiliesToo() + { + var registry = new ContributionRegistry(); + registry.Commands.Add(new CommandFamily + { + Id = "fam", IdPrefix = "win:", Generate = _ => Array.Empty(), Run = (_, _) => true, + }); + + await Assert.That(() => registry.Commands.Add(Command("win:chat"))).Throws(); + await Assert.That(() => registry.Commands.Add(new CommandFamily + { + Id = "fam2", IdPrefix = "win:x", Generate = _ => Array.Empty(), Run = (_, _) => true, + })).Throws(); + } + + [Test] + public async Task TheCatalogIsInRegistrationOrder_AndHonoursAvailability() + { + var registry = new ContributionRegistry(); + registry.Commands.Add(Command("b:second", "Second")); + registry.Commands.Add(new SingleCommand + { + Id = "a:hidden", Title = "Hidden", Category = CommandGroup.Terminal, + IsAvailable = c => c.State.LoggingOn, Run = _ => true, + }); + registry.Commands.Add(Command("a:first", "First")); + + var quiet = registry.Commands.Catalog(Context()).Select(c => c.Id).ToList(); + await Assert.That(quiet).IsEquivalentTo(new[] { "b:second", "a:first" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + + var logging = registry.Commands.Catalog(Context(new CommandContext(LoggingOn: true))).Select(c => c.Id).ToList(); + await Assert.That(logging).IsEquivalentTo(new[] { "b:second", "a:hidden", "a:first" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + } + + [Test] + public async Task AHostKeyHintIsSpeltTheWayTheHostSpellsIt() + { + var registry = new ContributionRegistry(); + registry.Commands.Add(new SingleCommand + { + Id = "term:nl", Title = "Newline", Category = CommandGroup.Terminal, + Key = KeyHint.ForHost(HostKey.Newline), Detail = "in the command line", Run = _ => true, + }); + + var terminal = registry.Commands.Catalog(Context()).Single(); + var window = registry.Commands.Catalog(Context(keys: new HostKeyGlyphs("Ctrl+⏎"))).Single(); + await Assert.That(terminal.Subtitle).IsEqualTo("Alt+⏎ · in the command line"); + await Assert.That(window.Subtitle).IsEqualTo("Ctrl+⏎ · in the command line"); + } + + [Test] + public async Task DispatchFindsTheExactCommandFirst_ThenTheFamily_AndIgnoresAvailability() + { + var ran = new List(); + var registry = new ContributionRegistry(); + registry.Commands.Add(new SingleCommand + { + Id = "term:log-on", Title = "Start logging", Category = CommandGroup.Terminal, + IsAvailable = _ => false, Run = _ => { ran.Add("log"); return true; }, + }); + registry.Commands.Add(new CommandFamily + { + Id = "goto:windows", IdPrefix = "win:", + Generate = _ => Array.Empty(), + Run = (id, _) => { ran.Add(id); return true; }, + }); + + await Assert.That(registry.Commands.TryExecute("term:log-on", Context(), out var logHandled)).IsTrue(); + await Assert.That(registry.Commands.TryExecute("win:chat", Context(), out var winHandled)).IsTrue(); + await Assert.That(registry.Commands.TryExecute("nope", Context(), out var nopeHandled)).IsFalse(); + await Assert.That(logHandled && winHandled && !nopeHandled).IsTrue(); + await Assert.That(ran).IsEquivalentTo(new[] { "log", "win:chat" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + + // A family's own id names the family, not a command. + await Assert.That(registry.Commands.Resolve("goto:windows")).IsNull(); + } + + [Test] + public async Task RemovingAPackageTakesEveryKindItRegistered_AndLeavesTheRestInOrder() + { + var package = ContributionOwner.Package("bells"); + var registry = new ContributionRegistry(); + registry.Commands.Add(Command("a:one")); + registry.Commands.Add(Command("bells:ring", owner: package)); + registry.Commands.Add(Command("a:two")); + registry.StatusCells.Add(new StatusCellContribution { Id = "bells", Owner = package, ReservedWidth = 3 }); + registry.Panels.Add(new PanelContribution { Id = "bells", Owner = package, Title = "Bells" }); + + await Assert.That(registry.RemoveOwnedBy(package)).IsEqualTo(3); + await Assert.That(registry.Commands.Select(c => c.Id).ToList()) + .IsEquivalentTo(new[] { "a:one", "a:two" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(registry.StatusCells.Count).IsEqualTo(0); + + // Its ids are free again. + registry.Commands.Add(Command("bells:ring", owner: package)); + await Assert.That(registry.Commands.Contains("bells:ring")).IsTrue(); + } + + [Test] + public async Task SectionsReadInOrder_CellsDropHighestFirst_TiesByRegistration() + { + var registry = new ContributionRegistry(); + registry.SettingsSections.Add(new SettingsSectionContribution { Id = "late", Title = "Late", Order = 20 }); + registry.SettingsSections.Add(new SettingsSectionContribution + { + Id = "early", Title = "Early", Order = 10, + Fields = new SettingsField[] + { + new BoolField("on", "enabled"), + new ChoiceField("mode", "mode", new[] { "a", "b" }), + new NumberField("n", "count", 0, 10), + new TextField("name", "name", MaxLength: 20), + new ColourField("tint", "tint", new[] { "teal" }), + new ListField("rules", "rules", new SettingsField[] { new TextField("pattern", "pattern") }), + }, + }); + registry.SettingsSections.Add(new SettingsSectionContribution { Id = "tie", Title = "Tie", Order = 10 }); + + await Assert.That(registry.SettingsSections.Ordered.Select(s => s.Id).ToList()) + .IsEquivalentTo(new[] { "early", "tie", "late" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + + registry.StatusCells.Add(new StatusCellContribution { Id = "room", DropOrder = 1, ReservedWidth = 12 }); + registry.StatusCells.Add(new StatusCellContribution { Id = "meters", DropOrder = 5, ReservedWidth = 10 }); + registry.StatusCells.Add(new StatusCellContribution { Id = "mute", DropOrder = 1, ReservedWidth = 7 }); + await Assert.That(registry.StatusCells.InDropOrder.Select(s => s.Id).ToList()) + .IsEquivalentTo(new[] { "meters", "mute", "room" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + + await Assert.That(() => registry.SettingsSections.Add(new SettingsSectionContribution + { + Id = "dupe", Title = "Dupe", + Fields = new SettingsField[] { new BoolField("x", "x"), new BoolField("x", "y") }, + })).Throws(); + } + + /// + /// The built-in catalog is registered as contributions, so its ids are all addressable through the + /// registry and none is refused for clashing with another. + /// + [Test] + public async Task EveryBuiltInEntryResolvesToTheContributionThatListedIt() + { + var ran = new List(); + var registry = new ContributionRegistry(); + BuiltInCommands.Register(registry, id => { ran.Add(id); return true; }); + + var ws = new Workspace(mainWindowId: "main", mainTitle: "Main", sessionKey: "A.One"); + ws.RouteSpawn("Chat", "A.One"); + ws.Layout.SplitFocused(SplitDirection.Row); + var characters = new CharacterRef[] + { + new("A", "One", "A.One", true, true, true), + new("A", "Two", "A.Two", true, true), + }; + var context = new CommandEnvironment( + new CommandContext(ScriptsOn: true, Walking: true, Sound: true, Announced: false), + ws, + characters, + "A.One", + new SettingsEntry[] { new("Aliases", "screen:aliases", "F3") }, + HostKeyGlyphs.Terminal); + + var catalog = registry.Commands.Catalog(context); + foreach (var item in catalog) + { + await Assert.That(registry.Commands.TryExecute(item.Id, context, out var handled)).IsTrue(); + await Assert.That(handled).IsTrue(); + } + + await Assert.That(ran).IsEquivalentTo(catalog.Select(c => c.Id).ToList(), TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(catalog.Select(c => c.Group).Distinct().Count()).IsEqualTo(Enum.GetValues().Length); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/SharpMUTerm.Client.Tests.csproj b/tests/SharpMUTerm.Client.Tests/SharpMUTerm.Client.Tests.csproj new file mode 100644 index 00000000..67d03687 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/SharpMUTerm.Client.Tests.csproj @@ -0,0 +1,19 @@ + + + + Exe + SharpMUTerm.Client.Tests + SharpMUTerm.Client.Tests + false + true + + + + + + + + + + + From 266eb2eb7529fc2eb0cffba068b9b4306ca4c8a3 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 02:13:56 +0000 Subject: [PATCH 007/113] Add the trigger builder: a rule from selected output, plain-language match kinds, and a live test on F2 Ctrl+P > "Make a trigger from the selection" (and the output right-click menu) makes a rule from the selected line, with numbers, quoted speech and known GMCP player names turned into * wildcards, and opens F2 on it with the pattern being typed and the regex shown behind it. Triggers gain a match type (contains the text, starts with, * wildcards, regular expression; regex stays the default), and F2's pattern editor shows how many of the last 2,000 held lines match, with the newest three highlighted. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 23 ++ .../Commands/BuiltInCommands.cs | 4 + src/SharpMUTerm.Core/Automation/Trigger.cs | 24 +- .../Automation/TriggerMatchType.cs | 180 +++++++++++++++ .../Automation/TriggerPreview.cs | 96 ++++++++ .../Automation/TriggerSuggestion.cs | 206 ++++++++++++++++++ .../Commands/CommandCatalog.cs | 4 +- .../Commands/CompletionIndex.cs | 12 + src/SharpMUTerm.Core/Text/OutputSearch.cs | 2 +- .../Pointer/SharpMUTermApp.Pointer.cs | 2 +- src/SharpMUTerm.Tui/ScreenField.cs | 21 ++ src/SharpMUTerm.Tui/SettingsSession.cs | 11 + .../SharpMUTermApp.TriggerBuilder.cs | 172 +++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 29 ++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/TriggerReport.cs | 5 +- src/SharpMUTerm.Tui/TriggersScreenRenderer.cs | 197 ++++++++++++++++- src/SharpMUTerm.Tui/TriggersScreenView.cs | 7 +- .../Automation/TriggerBuilderTests.cs | 200 +++++++++++++++++ .../TriggerBuilderTests.cs | 132 +++++++++++ .../TriggerSetManagementTests.cs | 9 +- .../TriggersScreenEditingTests.cs | 4 +- .../TriggersScreenRendererTests.cs | 2 +- 24 files changed, 1323 insertions(+), 26 deletions(-) create mode 100644 src/SharpMUTerm.Core/Automation/TriggerMatchType.cs create mode 100644 src/SharpMUTerm.Core/Automation/TriggerPreview.cs create mode 100644 src/SharpMUTerm.Core/Automation/TriggerSuggestion.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Automation/TriggerBuilderTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/TriggerBuilderTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fc6e440..4a634a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Make a trigger without writing a regex: select a line of output and choose Ctrl+P ▸ *Make a trigger from + the selection* (also on the right-click menu). Triggers (F2) opens on a new rule whose pattern is the line + with its numbers, quoted speech and known player names turned into `*`, and shows the regex behind it. + While you edit a pattern, F2 shows how many recent lines it matches and the newest few, and a rule can now + match "contains the text", "starts with" or "matches with * wildcards" as well as a regular expression. - `/connect [port] [tls]` adds a world and connects to it, and `/connect ` opens a configured one. It is the way to add a world in `--plain`, where the settings screens cannot be used. - The desktop window bundles JetBrains Mono and the Nerd Font symbols, so its icons draw on a machine with no diff --git a/CLAUDE.md b/CLAUDE.md index 1e4f778f..03e383cd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1035,6 +1035,8 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg own hit test rather than a highlight posed by hand — the only frame carrying `WorkspacePalette.SelectionBand`, which is why it is in `FrameContrastTests`' list: the band is the one plane this client invents rather than derives from a pane, and its ink replaces the world's own on every selected cell), + `trigger-builder` (a real drag across a line of output and the real ⌃P *Make a trigger from the + selection*, so F2 opens on the suggested wildcard rule with its regex and the live test counting), `prefix-panel` (the ⌃B which-key panel — the state `prefix` becomes a few hundred milliseconds later, if no key has arrived), `focus`/`focus-moved` (a split *and* a second command line — the one geometry showing a focused pane @@ -1958,6 +1960,27 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] `DiscordIpc.Show` never blocks: a worker sends only the newest value, reads and discards each reply (bounded in size and time), and on a failed connect does not retry until the next update. The application id is the game's; this client registers none. The snapshot and every test host have `Presence = null`. +- **The trigger builder makes a plain-language rule from selected output** (`TriggerMatchType`, + `TriggerPatterns`, `TriggerSuggestion`, `TriggerPreview`, Core; `SharpMUTermApp.TriggerBuilder.cs`; ⌃P + `term:trigger-from-selection`; the `trigger-builder` view). Decisions not to relitigate: + - **Every match kind compiles to one regex** (`TriggerPatterns.ToRegex`), so the engine, captures and the + timeout are unchanged. `Regex` is the enum's first member and so the default: a rule with no `matchType` + means what it always meant, and the schema version did not move. A `*` wildcard is a capture (lazy, the + last one greedy) and matches anywhere in the line, like *contains*; `\*` is a literal asterisk. + - **The suggestion guesses three things and nothing else**: numbers, the inside of double quotes, and the + GMCP player names `CompletionIndex.Names()` holds, as whole words. A line with nothing variable, or only + variable, becomes *contains the text*, never a pattern of bare `*`. + - **The rule is made at once, then F2 opens on it with the pattern field open** (`SettingsSession.OpenField`). + It has no actions, so it changes nothing until given one. It goes in the selection window's character's + first listed set, else the first set, else a new `My triggers` set listed on that character. Package + sets are never written to. + - **The live test is `OutputSearch`'s corpus and safeguards**: every window a pane holds (focused window + last, so its lines count as newest), the newest 2,000, a 100 ms match timeout, and an invalid pattern as a + muted state. Unlike ⌃F a zero-width match counts, because the engine fires on one. It always draws four + rows so typing never moves the rows below. + - **The match kind is field 10, appended**, though it is drawn on the `match pattern` heading row: that + keeps every ordinal and costs no row in a pane that already fills a 24-row screen. Switching *to* a + regex rewrites the pattern as the regex it meant, so the rule keeps matching what it matched. - **The send group is session keys in memory** (`SendGroup`, Core; `SharpMUTermApp.SendGroup.cs`; ⌃P `group:` ids). It is never saved, because a saved group would be a standing order to send one line to several worlds. It is offered once two characters are open. Members are marked on the rail by swapping the dot for ◆/◇ in diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index d6b39ca3..88595d61 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -106,6 +106,10 @@ void Family(string id, string prefix, Func c.State.OutputSelected); + // The client's own messages — the status-line notices that dismiss themselves — kept out of the // output window (and so out of the session log) and readable here instead. Add("term:messages", CommandGroup.Terminal, "Show client messages", detail: "status-line notices"); diff --git a/src/SharpMUTerm.Core/Automation/Trigger.cs b/src/SharpMUTerm.Core/Automation/Trigger.cs index ce69e22d..1042c826 100644 --- a/src/SharpMUTerm.Core/Automation/Trigger.cs +++ b/src/SharpMUTerm.Core/Automation/Trigger.cs @@ -112,6 +112,7 @@ public sealed class Trigger private Regex? _compiled; private bool _caseSensitive; private string _pattern = string.Empty; + private TriggerMatchType _matchType; /// /// What the rule is called, for the lists that show it. Settable so the F2 screen can rename a rule @@ -140,6 +141,26 @@ public required string Pattern } } + /// + /// How is read — a regex (the default, and what every rule written before this + /// existed means), or one of the plain-language kinds F2 offers first. Settable so the editor can change + /// it live; writing it drops the cached for the reason does. + /// + public TriggerMatchType MatchType + { + get => _matchType; + set + { + if (_matchType == value) + { + return; + } + + _matchType = value; + _compiled = null; + } + } + public bool Enabled { get; set; } = true; /// @@ -174,7 +195,7 @@ public bool CaseSensitive /// The compiled regex (built once, lazily), with a match timeout guarding against ReDoS. [JsonIgnore] public Regex Regex => _compiled ??= new Regex( - Pattern, + TriggerPatterns.ToRegex(MatchType, Pattern), RegexOptions.Compiled | (CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase), AutomationDefaults.RegexMatchTimeout); @@ -189,6 +210,7 @@ public bool CaseSensitive { Name = Name, Pattern = Pattern, + MatchType = MatchType, Enabled = Enabled, CaseSensitive = CaseSensitive, StopProcessing = StopProcessing, diff --git a/src/SharpMUTerm.Core/Automation/TriggerMatchType.cs b/src/SharpMUTerm.Core/Automation/TriggerMatchType.cs new file mode 100644 index 00000000..3360a883 --- /dev/null +++ b/src/SharpMUTerm.Core/Automation/TriggerMatchType.cs @@ -0,0 +1,180 @@ +using System.Text; +using System.Text.RegularExpressions; + +namespace SharpMUTerm.Core.Automation; + +/// +/// How a is read. Every kind compiles to one .NET regex +/// (), so the engine, captures and the match timeout are the same +/// for all of them; what differs is only what the player has to type. +/// +/// is first, and so the default, because it is what every rule written before this +/// existed means: a configuration with no matchType reads exactly as it always did, which is why +/// the schema version did not move for it. +/// +/// +public enum TriggerMatchType +{ + /// The pattern is a .NET regular expression, as it always was. + Regex, + + /// The line contains the pattern as literal text, anywhere. + Contains, + + /// The line starts with the pattern as literal text. + StartsWith, + + /// + /// Literal text in which each * stands for any run of characters (and is a capture, so + /// $1 names the first). It matches anywhere in the line, like ; \* + /// is a literal asterisk. + /// + Wildcard, +} + +/// +/// The one place a becomes a regex, and the plain words each is offered +/// under. Pure, so the engine, the F2 editor's live test and the suggestion from a selection all read +/// a pattern the same way. +/// +public static class TriggerPatterns +{ + /// + /// The match kinds in the order the F2 editor offers them: the plain-language ones first, the raw + /// regex last, because a player who has never written one should meet the three they can use before + /// the one they cannot. + /// + public static IReadOnlyList Offered { get; } = + [ + TriggerMatchType.Contains, + TriggerMatchType.StartsWith, + TriggerMatchType.Wildcard, + TriggerMatchType.Regex, + ]; + + /// What a match kind is called on screen. + public static string Describe(TriggerMatchType type) => type switch + { + TriggerMatchType.Contains => "contains the text", + TriggerMatchType.StartsWith => "starts with", + TriggerMatchType.Wildcard => "matches with * wildcards", + _ => "regular expression", + }; + + /// The match kind a description names, case-insensitively, or null when it names none. + public static TriggerMatchType? Parse(string description) + { + ArgumentNullException.ThrowIfNull(description); + foreach (var type in Offered) + { + if (string.Equals(Describe(type), description.Trim(), StringComparison.OrdinalIgnoreCase)) + { + return type; + } + } + + return null; + } + + /// The regex means when read as . + public static string ToRegex(TriggerMatchType type, string pattern) + { + ArgumentNullException.ThrowIfNull(pattern); + return type switch + { + TriggerMatchType.Contains => Literal(pattern), + TriggerMatchType.StartsWith => "^" + Literal(pattern), + TriggerMatchType.Wildcard => WildcardToRegex(pattern), + _ => pattern, + }; + } + + /// + /// Why cannot be used as , or null when it can. Only a + /// regex can fail to parse; the literal kinds refuse only the empty pattern, which would match every + /// line. + /// + public static string? Validate(TriggerMatchType type, string pattern) + { + ArgumentNullException.ThrowIfNull(pattern); + if (pattern.Length == 0) + { + return "pattern cannot be empty"; + } + + if (type == TriggerMatchType.Wildcard && pattern.All(c => c == '*' || char.IsWhiteSpace(c))) + { + return "a pattern of only * matches every line"; + } + + if (type != TriggerMatchType.Regex) + { + return null; + } + + try + { + _ = new Regex(pattern, RegexOptions.None, AutomationDefaults.RegexMatchTimeout); + return null; + } + catch (ArgumentException error) + { + return "not a valid regex: " + error.Message.Split('\n')[0].Trim(); + } + } + + /// + /// escaped to match itself. A space is left a space: Regex.Escape writes + /// it as a backslash and a space, which is legal and is also the first thing a reader of the regex shown + /// behind a plain pattern would stumble on — and without IgnorePatternWhitespace a bare space is + /// literal anyway. + /// + public static string Literal(string text) + { + ArgumentNullException.ThrowIfNull(text); + return System.Text.RegularExpressions.Regex.Escape(text).Replace("\\ ", " ", StringComparison.Ordinal); + } + + /// + /// Literal text with each unescaped * turned into a capture. Every wildcard is lazy except a + /// trailing one, which is greedy: a lazy capture at the very end of a pattern would match nothing at + /// all, and $1 of * says * would always be empty. + /// + internal static string WildcardToRegex(string pattern) + { + var parts = new List(); + var literal = new StringBuilder(); + for (var i = 0; i < pattern.Length; i++) + { + var c = pattern[i]; + if (c == '\\' && i + 1 < pattern.Length && pattern[i + 1] == '*') + { + literal.Append('*'); + i++; + } + else if (c == '*') + { + parts.Add(literal.ToString()); + literal.Clear(); + } + else + { + literal.Append(c); + } + } + + parts.Add(literal.ToString()); + + var regex = new StringBuilder(); + for (var i = 0; i < parts.Count; i++) + { + regex.Append(Literal(parts[i])); + if (i < parts.Count - 1) + { + regex.Append(i == parts.Count - 2 && parts[^1].Length == 0 ? "(.*)" : "(.*?)"); + } + } + + return regex.ToString(); + } +} diff --git a/src/SharpMUTerm.Core/Automation/TriggerPreview.cs b/src/SharpMUTerm.Core/Automation/TriggerPreview.cs new file mode 100644 index 00000000..88ff4871 --- /dev/null +++ b/src/SharpMUTerm.Core/Automation/TriggerPreview.cs @@ -0,0 +1,96 @@ +using System.Text.RegularExpressions; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Automation; + +/// +/// What one trigger pattern comes to against the output the client is holding: how many lines it +/// matched, the newest few of them, and — when the pattern cannot be used yet — why. +/// +/// How many lines were tried. +/// How many of them matched. +/// The newest matches, newest first, at most the number asked for. +/// Why nothing could be tried, or null when the pattern was usable. +public readonly record struct TriggerPreviewResult( + int Tested, int Matched, IReadOnlyList Samples, string? Problem); + +/// +/// The F2 editor's live test: a pattern run over recent output on every keystroke. The trigger engine's +/// rules, so a count here is what the rule would have done — the same regex +/// (), the same case rule, and a zero-width match counting, because +/// the engine fires on one. 's safeguards, because this too runs on the UI +/// thread per keystroke: a bounded number of lines, a match timeout, and an unparseable pattern returned as +/// a state — a regex is unparseable most of the time it is being typed. +/// +public static class TriggerPreview +{ + /// How many of the newest lines are tried. + public const int MaxLines = 2000; + + /// How many matching lines are kept to show. + public const int DefaultSamples = 3; + + /// Runs , read as , over the newest of . + /// Plain text, oldest first. + public static TriggerPreviewResult Run( + IReadOnlyList lines, + TriggerMatchType type, + string pattern, + bool caseSensitive, + int samples = DefaultSamples) + { + ArgumentNullException.ThrowIfNull(lines); + ArgumentNullException.ThrowIfNull(pattern); + + var first = Math.Max(0, lines.Count - MaxLines); + var tested = lines.Count - first; + + if (TriggerPatterns.Validate(type, pattern) is { } problem) + { + return new TriggerPreviewResult(tested, 0, Array.Empty(), problem); + } + + Regex regex; + try + { + regex = new Regex( + TriggerPatterns.ToRegex(type, pattern), + RegexOptions.CultureInvariant | (caseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase), + OutputSearch.MatchTimeout); + } + catch (ArgumentException error) + { + return new TriggerPreviewResult(tested, 0, Array.Empty(), error.Message.Split('\n')[0].Trim()); + } + + var matched = 0; + var kept = new List(); + for (var index = lines.Count - 1; index >= first; index--) + { + var text = lines[index] ?? string.Empty; + try + { + var found = regex.Match(text); + if (!found.Success) + { + continue; + } + + matched++; + if (kept.Count < samples) + { + kept.Add(new OutputMatch(index, text, found.Index, found.Length)); + } + } + catch (RegexMatchTimeoutException) + { + // OutputSearch's reasoning: a count that silently skipped the expensive lines would be a + // test lying about what the rule would do. + return new TriggerPreviewResult( + tested, 0, Array.Empty(), "pattern took too long — try a simpler one"); + } + } + + return new TriggerPreviewResult(tested, matched, kept, null); + } +} diff --git a/src/SharpMUTerm.Core/Automation/TriggerSuggestion.cs b/src/SharpMUTerm.Core/Automation/TriggerSuggestion.cs new file mode 100644 index 00000000..41820f84 --- /dev/null +++ b/src/SharpMUTerm.Core/Automation/TriggerSuggestion.cs @@ -0,0 +1,206 @@ +using System.Text; + +namespace SharpMUTerm.Core.Automation; + +/// +/// A trigger pattern proposed from a line of output somebody selected: the text, in +/// form, with its obviously variable parts turned into *. +/// +/// A short name for the rule, from the first literal words of the pattern. +/// The pattern, read as . +/// How is read. +public readonly record struct TriggerSuggestion(string Name, string Pattern, TriggerMatchType MatchType) +{ + /// The regex the pattern compiles to — what F2 shows behind the plain-language form. + public string Regex => TriggerPatterns.ToRegex(MatchType, Pattern); + + /// The longest selection read; past it the rest is ignored rather than becoming a pattern. + public const int MaxLength = 200; + + /// The longest name proposed. + public const int MaxNameLength = 24; + + /// + /// Proposes a pattern for . Three kinds of run become a wildcard, because + /// they are the parts of a line that are different next time: + /// + /// numbers (125, 1,024, 3.5) — damage, gold, experience, counts; + /// the inside of quoted speech — what was said, while the quotes and the verb stay; + /// any of as a whole word — the players the game has told the client + /// about (GMCP), so Rivane tells you becomes * tells you. + /// + /// Nothing else is guessed at. A pattern that would be nothing but wildcards is no pattern at all, so + /// that selection is matched as literal text instead (). + /// + /// The selected text. Only its first non-blank line is used. + /// Names to read as variable, or null for none. + public static TriggerSuggestion Suggest(string selected, IEnumerable? names = null) + { + ArgumentNullException.ThrowIfNull(selected); + + var line = selected.Replace("\r", string.Empty, StringComparison.Ordinal) + .Split('\n') + .Select(l => l.Trim()) + .FirstOrDefault(l => l.Length > 0) ?? string.Empty; + if (line.Length > MaxLength) + { + line = line[..MaxLength]; + } + + var variable = new bool[line.Length]; + MarkQuoted(line, variable); + MarkNumbers(line, variable); + MarkNames(line, variable, names); + + var pattern = new StringBuilder(); + var literal = new StringBuilder(); + var wild = false; + for (var i = 0; i < line.Length; i++) + { + if (variable[i]) + { + if (!wild) + { + pattern.Append('*'); + wild = true; + } + + continue; + } + + wild = false; + + if (line[i] == '*') + { + pattern.Append("\\*"); + } + else + { + pattern.Append(line[i]); + } + + literal.Append(line[i]); + } + + if (literal.ToString().Trim().Length == 0) + { + return new TriggerSuggestion(NameFrom(line), line, TriggerMatchType.Contains); + } + + return variable.Any(v => v) + ? new TriggerSuggestion(NameFrom(literal.ToString()), pattern.ToString(), TriggerMatchType.Wildcard) + : new TriggerSuggestion(NameFrom(line), line, TriggerMatchType.Contains); + } + + /// The text between each pair of double quotes (straight or curly), not the quotes themselves. + private static void MarkQuoted(string line, bool[] variable) + { + for (var i = 0; i < line.Length; i++) + { + var close = line[i] switch + { + '"' => '"', + '“' => '”', + _ => '\0', + }; + if (close == '\0') + { + continue; + } + + var end = line.IndexOf(close, i + 1); + if (end < 0) + { + return; + } + + for (var j = i + 1; j < end; j++) + { + variable[j] = true; + } + + i = end; + } + } + + /// Runs of digits, with the separators inside a number (1,024, 3.5) taken with them. + private static void MarkNumbers(string line, bool[] variable) + { + for (var i = 0; i < line.Length; i++) + { + if (!char.IsAsciiDigit(line[i])) + { + continue; + } + + var end = i; + while (end + 1 < line.Length + && (char.IsAsciiDigit(line[end + 1]) + || (line[end + 1] is ',' or '.' && end + 2 < line.Length && char.IsAsciiDigit(line[end + 2])))) + { + end++; + } + + for (var j = i; j <= end; j++) + { + variable[j] = true; + } + + i = end; + } + } + + /// Each name as a whole word, case-insensitively. Names shorter than two letters are ignored. + private static void MarkNames(string line, bool[] variable, IEnumerable? names) + { + if (names is null) + { + return; + } + + foreach (var name in names.Where(n => n is { Length: >= 2 }).Distinct(StringComparer.OrdinalIgnoreCase)) + { + var at = 0; + while ((at = line.IndexOf(name, at, StringComparison.OrdinalIgnoreCase)) >= 0) + { + var end = at + name.Length; + var whole = (at == 0 || !char.IsLetterOrDigit(line[at - 1])) + && (end == line.Length || !char.IsLetterOrDigit(line[end])); + if (whole) + { + for (var j = at; j < end; j++) + { + variable[j] = true; + } + } + + at = end; + } + } + } + + /// The first few words of , as a rule name. + private static string NameFrom(string text) + { + var words = text.Split(' ', StringSplitOptions.RemoveEmptyEntries) + .Select(w => w.Trim(',', '.', ':', ';', '!', '?', '"', '\'', '“', '”', '(', ')', '[', ']')) + .Where(w => w.Length > 0); + var name = new StringBuilder(); + foreach (var word in words) + { + if (name.Length > 0 && name.Length + 1 + word.Length > MaxNameLength) + { + break; + } + + if (name.Length > 0) + { + name.Append(' '); + } + + name.Append(word.Length > MaxNameLength ? word[..MaxNameLength] : word); + } + + return name.Length == 0 ? "New Trigger" : name.ToString(); + } +} diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index 69dd79ae..5becd011 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -44,6 +44,7 @@ public sealed record CharacterRef( /// /// Null where the host has no screen reader to tell; otherwise whether the active window's output is read aloud. /// +/// Whether some pane's output is selected, so a trigger can be made from it. public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -55,7 +56,8 @@ public sealed record CommandContext( bool ScriptsOn = false, bool Walking = false, bool? Sound = null, - bool? Announced = null); + bool? Announced = null, + bool OutputSelected = false); /// /// A configuration screen the command surface can open: what it calls itself, the id the host diff --git a/src/SharpMUTerm.Core/Commands/CompletionIndex.cs b/src/SharpMUTerm.Core/Commands/CompletionIndex.cs index 6f64e08b..2edb7db5 100644 --- a/src/SharpMUTerm.Core/Commands/CompletionIndex.cs +++ b/src/SharpMUTerm.Core/Commands/CompletionIndex.cs @@ -114,6 +114,18 @@ public IReadOnlyList Candidates(string prefix) } } + /// + /// The player names the game has reported (GMCP), newest first — what a trigger made from a selection + /// reads as variable, since a rule about one player's line is nearly always wanted for every player's. + /// + public IReadOnlyList Names() + { + lock (_gate) + { + return _names.Newest().ToList(); + } + } + /// Forgets everything, as a new connection does. public void Clear() { diff --git a/src/SharpMUTerm.Core/Text/OutputSearch.cs b/src/SharpMUTerm.Core/Text/OutputSearch.cs index f72ec689..170bee29 100644 --- a/src/SharpMUTerm.Core/Text/OutputSearch.cs +++ b/src/SharpMUTerm.Core/Text/OutputSearch.cs @@ -58,7 +58,7 @@ public static class OutputSearch /// over every line of every window — so a pattern that backtracks catastrophically has to come back /// as an error rather than wedge the client. /// - private static readonly TimeSpan MatchTimeout = TimeSpan.FromMilliseconds(100); + internal static readonly TimeSpan MatchTimeout = TimeSpan.FromMilliseconds(100); /// /// The lines of matching , in the order they were diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index e30c0c38..c16aeeed 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -450,7 +450,7 @@ internal IReadOnlyList PointerMenu(System.Drawing.Point point) AddCommands( items, - "term:copy", null, + "term:copy", "term:trigger-from-selection", null, "layout:split-right", "layout:split-down", "layout:zoom", "layout:unzoom", "layout:close", null, "term:freeze", "term:unfreeze", "term:scroll-live", "term:clear", "term:timestamps-on", "term:timestamps-off"); break; diff --git a/src/SharpMUTerm.Tui/ScreenField.cs b/src/SharpMUTerm.Tui/ScreenField.cs index 609ff6ee..d2560a27 100644 --- a/src/SharpMUTerm.Tui/ScreenField.cs +++ b/src/SharpMUTerm.Tui/ScreenField.cs @@ -572,6 +572,27 @@ internal static ScreenField Pattern(string label, Func get, Action + /// A trigger's pattern, refused unless it can be used as the kind the rule reads it as — only a regex + /// can fail to parse, and the plain kinds refuse only the patterns that would match every line + /// (). + /// + internal static ScreenField TriggerPattern( + string label, Func get, Action set, Func type) + { + ArgumentNullException.ThrowIfNull(get); + ArgumentNullException.ThrowIfNull(set); + ArgumentNullException.ThrowIfNull(type); + + return new ScreenField( + label, + get, + value => TriggerPatterns.Validate(type(), value) is { } reason + ? (reason.Length > MaxErrorLength ? string.Concat(reason.AsSpan(0, MaxErrorLength - 1), "…") : reason) + : null, + set); + } + /// A that may be blank, held as null when it is: a pattern a world need not have. internal static ScreenField OptionalPattern(string label, Func get, Action set) { diff --git a/src/SharpMUTerm.Tui/SettingsSession.cs b/src/SharpMUTerm.Tui/SettingsSession.cs index fdd4e8e1..4c72a8e2 100644 --- a/src/SharpMUTerm.Tui/SettingsSession.cs +++ b/src/SharpMUTerm.Tui/SettingsSession.cs @@ -371,6 +371,17 @@ private ScreenAction Activate(ScreenModel model) return ScreenAction.Redraw; } + /// + /// Opens a field of the focused row as though ⏎ and ⇥ had reached it — how a screen opened for + /// something (F2 from a selection) lands in the field that something is about. + /// + internal void OpenField(int field) + { + var model = _model(Selection); + Selection.Clamp(model.Sizes); + Open(model, field); + } + /// Opens a field of the focused row, seeding the buffer with its current value. private void Open(ScreenModel model, int field) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs new file mode 100644 index 00000000..bae7a12b --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs @@ -0,0 +1,172 @@ +using SharpConsoleUI.Controls; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Diagnostics; + +namespace SharpMUTerm.Tui; + +/// +/// The trigger builder: ⌃P ▸ Make a trigger from the selection turns selected output into a new rule +/// and opens F2 on it with the pattern being typed, and F2's live test runs the pattern over what the panes +/// hold on every keystroke. +/// +internal sealed partial class SharpMUTermApp +{ + /// What the set a rule is made in is called when the configuration has none to put it in. + internal const string BuilderSetName = "My triggers"; + + /// + /// The output a pane has selected, and which window it is in — or null when what is selected is not a + /// pane's (the command line) or nothing is. Asked of the window's SelectionManager, for + /// 's reason: it owns the one selection, wherever the focus is. + /// + private (string Text, string? WindowId)? SelectedOutput() + { + if (_window.SelectionManager.ActiveSelection is not MarkupControl { HasSelection: true } pane) + { + return null; + } + + var text = SelectedText.Of(pane); + if (text.Trim().Length == 0) + { + return null; + } + + var windowId = _panes.Concat(_frozenPanes) + .FirstOrDefault(entry => ReferenceEquals(entry.Value, pane)).Key; + return (text, windowId); + } + + /// Whether some pane's output is selected — what the ⌃P entry is offered on. + private bool HasOutputSelection => + _window.SelectionManager.ActiveSelection is MarkupControl { HasSelection: true }; + + /// + /// ⌃P ▸ Make a trigger from the selection. The rule is made at once — enabled, with no actions, + /// so it does nothing to the stream until it is given something to do — and F2 opens on it with the + /// pattern field open, so the next keystroke edits the suggestion and the live test answers it. + /// + /// It goes in the first editable set of the character whose window the selection is in: the + /// character's own first listed set, else the first set F2 lists, else a new one. A package's sets are + /// never written to (they are replaced wholesale by an update), and they are not on F2 anyway. + /// + /// + private bool MakeTriggerFromSelection() + { + if (SelectedOutput() is not { } selected) + { + RefuseCommand("nothing selected — drag across a pane's output to select the line the trigger is for"); + return false; + } + + if (_settings.IsOpen) + { + RefuseCommand("close the settings screen first — the trigger opens on F2"); + return false; + } + + if (ComposerIsInTheWay("the trigger editor")) + { + return false; + } + + var windowId = selected.WindowId ?? ActiveWindowId(); + var session = WindowSession(windowId); + var suggestion = TriggerSuggestion.Suggest(selected.Text, session?.Completions.Names()); + var set = BuilderSet(session?.SessionKey ?? _workspace.FindWindow(windowId)?.SessionKey); + + var trigger = new Trigger + { + Name = ScreenLists.Available(_config.TriggerSets.SelectMany(s => s.Triggers).Select(t => t.Name), suggestion.Name), + Pattern = suggestion.Pattern, + MatchType = suggestion.MatchType, + }; + set.Triggers.Add(trigger); + SaveConfiguration(); + + var index = _config.TriggerSets.SelectMany(s => s.Triggers).ToList().IndexOf(trigger); + _settings.Toggle(ConsoleKey.F2, () => TriggersScreen(editPattern: index)); + return true; + } + + /// + /// The set a rule made from a selection goes in, for the character names + /// (world.character), creating one when the configuration has no sets at all — and listing a + /// created set on that character, or the rule would sit in a set nobody runs. + /// + private TriggerSet BuilderSet(string? owner) + { + var character = owner is null ? null : CharacterFor(owner); + if (character is not null) + { + foreach (var name in character.TriggerSets) + { + if (_config.TriggerSets.FirstOrDefault(s => string.Equals(s.Name, name, StringComparison.Ordinal)) is { } own) + { + return own; + } + } + } + + if (_config.TriggerSets.FirstOrDefault() is { } first) + { + return first; + } + + var created = new TriggerSet { Name = BuilderSetName }; + _config.TriggerSets.Add(created); + character?.TriggerSets.Add(created.Name); + Notice($"made a trigger set called {BuilderSetName} for it", MessageSeverity.Info); + return created; + } + + /// The lines the trigger-builder view lands in the main window before selecting one. + internal static IReadOnlyList TriggerBuilderScene { get; } = + [ + "You gain 125 experience points.", + "Rivane says, \"to the crypt, then!\"", + "A town guard nods to you.", + "You gain 40 experience points.", + ]; + + /// + /// The trigger-builder view: lands in the main window, the last + /// line is selected by a real drag (), and the real ⌃P entry is dispatched. + /// The row is measured, not counted, because the demo's room description wraps in a narrow pane. + /// + private void StageTriggerBuilder() + { + foreach (var line in TriggerBuilderScene) + { + AppendWindowLine(MainWindowId, MarkupText.Escape(line)); + } + + RenderWholeFrame(); + var buffer = _lines[MainWindowId]; + var target = buffer.Count - 1; + var width = _paneScrolls.GetValueOrDefault(MainWindowId)?.ViewportWidth ?? 0; + var row = MeasureRows(buffer, 0, width, _panes.GetValueOrDefault(MainWindowId), target); + SimulatePaneDrag(MainWindowId, 0, row, buffer[target].Plain.Length, row); + ReArmWholeFrame(); + DispatchCommand("term:trigger-from-selection"); + } + + /// + /// What F2's live test runs over: the plain text of every window a pane holds, ⌃F's corpus + /// (), with the focused window's lines last so they count as the newest — + /// they are the ones the rule is most likely being written about. Chrome rows carry no plain text and + /// are left out, so a test cannot match the client's own bars. takes the + /// newest of it. + /// + private IReadOnlyList TriggerTestLines() + { + var focused = ActiveWindowId(); + var windows = SearchableWindows(all: true); + return windows.Where(w => !string.Equals(w.WindowId, focused, StringComparison.Ordinal)) + .Concat(windows.Where(w => string.Equals(w.WindowId, focused, StringComparison.Ordinal))) + .SelectMany(w => w.Lines) + .Where(line => line.Length > 0) + .ToList(); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 55826312..4f6a9a2e 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1401,6 +1401,14 @@ public string RenderSnapshot(string? view = null) ReArmWholeFrame(); } + // The trigger builder: a real drag across a line of output, then the real ⌃P entry, so the frame is + // F2 opened on the rule it made — the suggested pattern being typed, the regex behind it, and the + // live test counting the lines it already matches. + if (string.Equals(view, "trigger-builder", StringComparison.OrdinalIgnoreCase)) + { + StageTriggerBuilder(); + } + // A selection in the command line: the same band on the bar the panes use, made by a real drag // through the bar's own mouse handler across part of the demo's draft. In FrameContrastTests' // list for "selection"'s reason, and because here the band sits on a tinted input row instead. @@ -7117,11 +7125,22 @@ private ScreenBinding WorldsScreen(string fkey, bool onCharacters) /// buttons, and the cursor has to leave the list to press one. The selection is what the editor /// pane and the [[- del]] row are about, and it stays on the rule the user was looking at. /// - private ScreenBinding TriggersScreen() + private ScreenBinding TriggersScreen() => TriggersScreen(editPattern: null); + + /// + /// A rule to open with its pattern field already being typed into — the trigger builder's landing — + /// as its index in the flattened list, or null to open the screen as F2 does. + /// + private ScreenBinding TriggersScreen(int? editPattern) { var session = new SettingsSession(selection => TriggersScreenRenderer.Model(_config.TriggerSets, selection.SelectionIn(0), RouteTargets()), SaveConfiguration); + if (editPattern is { } rule) + { + session.Selection.Seed(0, rule); + session.OpenField(TriggersScreenRenderer.PatternField); + } return new ScreenBinding(session, () => TriggersScreenView.Build( _config.TriggerSets, @@ -7130,7 +7149,8 @@ private ScreenBinding TriggersScreen() _system.DesktopDimensions.Width, session.Focus(), _system.DesktopDimensions.Height, - _theme)); + _theme, + TriggerTestLines())); } /// Opens the F3 Aliases screen: the alias list, then the alias's toggles. @@ -7709,7 +7729,8 @@ private CommandContext CommandState() ScriptsOn: _scriptsRoot is not null, Walking: SendTarget() is { } walker && _recorders.TryGetValue(walker, out var map) && map.Walk.IsWalking, Sound: CanPlaySound ? !_muted : null, - Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId())); + Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId()), + OutputSelected: HasOutputSelection); } /// @@ -8100,6 +8121,8 @@ private bool RunBuiltInCommand(string id) return true; case "term:copy": return CopySelection(); + case "term:trigger-from-selection": + return MakeTriggerFromSelection(); case "term:messages": if (!ComposerIsInTheWay("the client messages")) { diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index f8d76322..e89b91ab 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -21,7 +21,7 @@ internal static class SnapshotViews "compose", "compose-literal", "moo-edit", "mssp", "mssp-none", "mssp-never", "web", "rail-long", "scrollback", "scrollback-up", "links", "away", "away-scrollback", "search", "search-regex", "search-all", "search-landed", "activity-bar", - "mxp-image", "mxp-figure", "input-selection", "selection", + "mxp-image", "mxp-figure", "input-selection", "selection", "trigger-builder", "prefix", "prefix-panel", "focus", "focus-moved", "tabs", "tabs-many", "collapsed", "timestamps", "timestamps-toggled", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "packages", "package-review", "package-browse", "send-menu", diff --git a/src/SharpMUTerm.Tui/TriggerReport.cs b/src/SharpMUTerm.Tui/TriggerReport.cs index 5788da8a..e30baa58 100644 --- a/src/SharpMUTerm.Tui/TriggerReport.cs +++ b/src/SharpMUTerm.Tui/TriggerReport.cs @@ -135,7 +135,10 @@ private static string Rule(Trigger trigger, TriggerEngine engine) : $"window '{trigger.Actions.SpawnTarget}'"; var matches = engine.MatchesFor(trigger); var state = trigger.Enabled ? string.Empty : " (disabled)"; - return $" {mark} {name}{state} /{trigger.Pattern}/ → {route} · " + var pattern = trigger.MatchType == TriggerMatchType.Regex + ? $"/{trigger.Pattern}/" + : $"{TriggerPatterns.Describe(trigger.MatchType)} \"{trigger.Pattern}\""; + return $" {mark} {name}{state} {pattern} → {route} · " + $"{Count(matches, "match", "matches")}"; } diff --git a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs index 5d71b3ea..8ef9fcac 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs @@ -94,6 +94,23 @@ internal static class TriggersScreenRenderer /// internal const int SetField = 9; + /// + /// How the pattern is read — , offered in plain words. Appended for the + /// reason was, though the editor draws it above the pattern: a player + /// should meet "contains the text" before they meet a regex. + /// + internal const int MatchTypeField = 10; + + /// The words the match field offers, in the order gives. + internal static IReadOnlyList MatchTypeNames { get; } = + TriggerPatterns.Offered.Select(TriggerPatterns.Describe).ToArray(); + + /// + /// How many sample rows the live test always draws, matching or not, so the rows under it do not jump + /// as a pattern being typed gains and loses matches. + /// + internal const int TestSampleRows = TriggerPreview.DefaultSamples; + /// /// How wide the fg / bg / attrs and rewrite / respond / /// script labels are padded, so the field wells in each section start in the same column. @@ -298,8 +315,11 @@ internal static ScreenModel Model( var rules = ScreenModel.Rows(flattened, entry => ScreenRow.Of( ScreenToggle.Bind(() => entry.Trigger.Enabled, v => entry.Trigger.Enabled = v), ScreenField.Name("name", () => entry.Trigger.Name, v => entry.Trigger.Name = v), - ScreenField.Pattern( - "match pattern", () => entry.Trigger.Pattern, v => entry.Trigger.Pattern = v), + ScreenField.TriggerPattern( + "match pattern", + () => entry.Trigger.Pattern, + v => entry.Trigger.Pattern = v, + () => entry.Trigger.MatchType), ScreenField.WindowName( "route", () => Route(entry.Trigger), @@ -328,7 +348,12 @@ internal static ScreenModel Model( () => entry.Trigger.Actions.ScriptCallback, v => entry.Trigger.Actions.ScriptCallback = v, Callbacks(entry.Trigger, callbacks)), - ScreenLists.Owner(sets, s => s.Triggers, entry.Trigger))) + ScreenLists.Owner(sets, s => s.Triggers, entry.Trigger), + ScreenField.Choice( + "match", + () => TriggerPatterns.Describe(entry.Trigger.MatchType), + v => SetMatchType(entry.Trigger, TriggerPatterns.Parse(v) ?? entry.Trigger.MatchType), + MatchTypeNames))) .Concat(Buttons(sets, selectedTrigger)) .ToArray(); @@ -350,6 +375,23 @@ internal static ScreenModel Model( return new ScreenModel(rules, editor); } + /// + /// Changes how a rule's pattern is read. Moving to a regex rewrites the pattern as the regex + /// it already meant, so the rule goes on matching exactly what it matched and the player sees the raw + /// form of what they built; moving away leaves the text as typed, because there is no plain-language + /// reading of an arbitrary regex to convert it to. + /// + internal static void SetMatchType(Trigger trigger, TriggerMatchType type) + { + ArgumentNullException.ThrowIfNull(trigger); + if (type == TriggerMatchType.Regex && trigger.MatchType != TriggerMatchType.Regex) + { + trigger.Pattern = TriggerPatterns.ToRegex(trigger.MatchType, trigger.Pattern); + } + + trigger.MatchType = type; + } + /// /// The rule list's buttons. A rule is added to the set that owns the selection rather than to some /// fixed one, because the list is flattened across every set and a rule appearing in a set the user @@ -454,7 +496,7 @@ internal static List RulesColumn( foreach (var trigger in set.Triggers) { left.Add(ScreenChrome.Cursor( - RuleRow(row, selectedTrigger, trigger), cursor.IsOn(0, row), width)); + RuleRow(row, selectedTrigger, trigger, width), cursor.IsOn(0, row), width)); left.Add(RuleSub(set.Name, trigger.Actions)); row++; } @@ -541,7 +583,8 @@ internal static List EditorColumn( ScreenFocus? focus = null, int width = ColumnWidth, int height = 0, - Theme? theme = null) + Theme? theme = null, + IReadOnlyList? recent = null) { ArgumentNullException.ThrowIfNull(sets); ArgumentNullException.ThrowIfNull(routeTargets); @@ -557,7 +600,8 @@ internal static List EditorColumn( selectedTrigger, width, height, - theme is null ? null : WorkspacePalette.ReadingPlane(theme)) + theme is null ? null : WorkspacePalette.ReadingPlane(theme), + recent) : new List(); } @@ -576,7 +620,7 @@ internal static List EditorColumn( return flattened; } - private static string RuleRow(int index, int selectedTrigger, Trigger trigger) + private static string RuleRow(int index, int selectedTrigger, Trigger trigger, int width = 0) { var marker = index == selectedTrigger ? "[bold]▸[/]" : " "; var box = trigger.Enabled ? $"[{Accent}]✓[/]" : "[dim]·[/]"; @@ -585,7 +629,18 @@ private static string RuleRow(int index, int selectedTrigger, Trigger trigger) // window, the list would have gone on calling it `main` — the two surfaces disagreeing about one // rule, which is the shape of the confusion the rename exists to remove. var target = Route(trigger); - return $"{marker} {box} [bold]{Escape(trigger.Name)}[/] [dim]{Escape(trigger.Pattern)}[/] [dim]→ {Escape(target)}[/]"; + + // The pattern gives way first when the row is wider than its column: a row that wrapped put its + // route at the start of the next row, where it read as part of the rule under it. A rule made from + // a selection is the usual cause — its name and pattern are both a line of output long. + var pattern = trigger.Pattern; + if (width > 0) + { + var room = width - 1 - (4 + trigger.Name.Length + 1 + 3 + target.Length); + pattern = Fit(pattern, Math.Max(1, room)); + } + + return $"{marker} {box} [bold]{Escape(trigger.Name)}[/] [dim]{Escape(pattern)}[/] [dim]→ {Escape(target)}[/]"; } private static string RuleSub(string owningSet, TriggerActions actions) => @@ -640,7 +695,8 @@ private static List BuildEditor( int index, int width = ColumnWidth, int height = 0, - Rgb? plane = null) + Rgb? plane = null, + IReadOnlyList? recent = null) { var name = cursor.EditOn(0, index, NameField); var set = cursor.EditOn(0, index, SetField); @@ -652,6 +708,14 @@ private static List BuildEditor( var rewrite = cursor.EditOn(0, index, RewriteField); var response = cursor.EditOn(0, index, ResponseField); var script = cursor.EditOn(0, index, ScriptField); + var match = cursor.EditOn(0, index, MatchTypeField); + + // What the live test and the regex line read: the buffers while they are open, so both follow the + // keystroke rather than the last commit. + var matchType = match is { } typing && TriggerPatterns.Parse(typing.Text) is { } typed + ? typed + : trigger.MatchType; + var patternText = pattern?.Text ?? trigger.Pattern; // While the route field is open the radios follow the *buffer*, not config, so ↑↓ visibly move // the dot before anything is committed — the buffer is what ⏎ would write. @@ -672,8 +736,27 @@ private static List BuildEditor( "[dim]set[/]", $" {ScreenChrome.Field($"[{Value}]{Escape(setName)}[/]", set)}", string.Empty, - "[dim]match pattern (regex)[/]", + + // How the pattern is read, in plain words, on the heading row itself and so before the pattern + // — a player who has never written a regex meets the three kinds they can use first. It costs + // no row: this pane already runs to the height of a 24-row terminal. The raw regex is still + // drawn, under a plain pattern, so nothing that was visible before is hidden now. + $"[dim]match pattern[/] {ScreenChrome.Field($"[{Value}]{Escape(TriggerPatterns.Describe(trigger.MatchType))}[/]", match)}", $" {ScreenChrome.Field(Escape(trigger.Pattern), pattern)}", + }; + + if (matchType != TriggerMatchType.Regex) + { + lines.Add(RegexRow(matchType, patternText, width)); + } + + if (recent is not null) + { + lines.AddRange(TestRows(recent, matchType, patternText, trigger.CaseSensitive, width)); + } + + lines.AddRange(new[] + { string.Empty, // The caption is here as well as over the actions section because the route expands captures // too: "Channel $1" against ^<(.+?)> is one rule feeding a pane per channel, and a reader who @@ -689,7 +772,7 @@ private static List BuildEditor( // field is open (ScreenChrome.Choices, applied to this whole column at the end) — which is // what a radio group was really offering, without pretending the set is closed. $" {ScreenChrome.Field(Escape(currentRoute), route)}", - }; + }); var fg = trigger.Actions.HighlightForeground; var bg = trigger.Actions.HighlightBackground; @@ -738,6 +821,98 @@ private static List BuildEditor( return ScreenChrome.Choices(lines, cursor.Edit, width); } + /// + /// The regex a plain-language pattern compiles to, drawn under it: it is what the engine will run, and + /// a player outgrowing the plain kinds learns the syntax from the rules they already wrote. + /// + private static string RegexRow(TriggerMatchType type, string pattern, int width) + { + const string Label = " regex "; + var regex = TriggerPatterns.ToRegex(type, pattern); + return $"[dim]{Label}[/]{ScreenChrome.ReadOnly(Fit(regex, width - Label.Length - 2))}"; + } + + /// + /// The live test: how many of the recent lines the pattern matches, and the newest few of them with the + /// match marked. It is always + 1 rows, whatever the pattern does, so typing + /// never moves the rows below it — and a pattern that does not parse yet is a state written in the + /// muted ink, not a warning: a regex is unparseable most of the time it is being typed. + /// + internal static List TestRows( + IReadOnlyList recent, TriggerMatchType type, string pattern, bool caseSensitive, int width) + { + ArgumentNullException.ThrowIfNull(recent); + + var result = TriggerPreview.Run(recent, type, pattern, caseSensitive); + var room = Math.Max(8, width - 8); + string caption; + if (result.Problem is { } problem) + { + caption = "· not a pattern yet: " + problem; + } + else if (result.Tested == 0) + { + caption = "· no output held yet to try it on"; + } + else + { + var held = result.Tested.ToString("N0", System.Globalization.CultureInfo.InvariantCulture); + var count = result.Matched.ToString("N0", System.Globalization.CultureInfo.InvariantCulture); + caption = result.Matched == 0 + ? $"· none of the last {held} lines match" + : $"· {count} of the last {held} lines match"; + } + + var rows = new List { $"[dim]test[/] {ScreenChrome.ReadOnly(Fit(caption, room))}" }; + foreach (var sample in result.Samples) + { + rows.Add(" " + Sample(sample.Text, sample.MatchStart, sample.MatchLength, Math.Max(8, width - 4))); + } + + while (rows.Count < TestSampleRows + 1) + { + // A space, not empty: ScreenChrome.Compact drops empty rows, and these are reserved. + rows.Add(" "); + } + + return rows; + } + + /// + /// One matching line, cut to around its match so the match is always on + /// screen, with the matched run in the accent — the search surface's way of saying why a row is listed. + /// + internal static string Sample(string text, int start, int length, int width) + { + const string Ellipsis = "…"; + var from = 0; + if (text.Length > width) + { + // Lead in with a few cells of context before the match, and never leave slack at the end. + from = Math.Clamp(start - 6, 0, Math.Max(0, text.Length - width + Ellipsis.Length)); + } + + var head = from > 0 ? Ellipsis : string.Empty; + var room = width - head.Length; + var take = Math.Min(text.Length - from, room); + var tail = string.Empty; + if (from + take < text.Length) + { + take = Math.Max(0, room - Ellipsis.Length); + tail = Ellipsis; + } + + var shown = text.Substring(from, take); + var hitStart = Math.Clamp(start - from, 0, shown.Length); + var hitEnd = Math.Clamp(start + length - from, hitStart, shown.Length); + return $"[dim]{head}[/]{Escape(shown[..hitStart])}[bold {Accent}]{Escape(shown[hitStart..hitEnd])}[/]" + + $"{Escape(shown[hitEnd..])}[dim]{tail}[/]"; + } + + /// Text cut to cells with an ellipsis. + private static string Fit(string text, int width) => + width <= 1 || text.Length <= width ? text : string.Concat(text.AsSpan(0, width - 1), "…"); + /// A checkbox row in the editor pane, checked in the accent and unchecked dim. private static string Checkbox(string label, bool value) => value ? $"[{Accent}][[x]][/] {Escape(label)}" : $"[dim][[ ]] {Escape(label)}[/]"; diff --git a/src/SharpMUTerm.Tui/TriggersScreenView.cs b/src/SharpMUTerm.Tui/TriggersScreenView.cs index 9df2af08..2d42d9a7 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenView.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenView.cs @@ -23,7 +23,8 @@ public static IWindowControl Build( int width, ScreenFocus? focus = null, int height = 0, - Theme? theme = null) + Theme? theme = null, + IReadOnlyList? recent = null) { var header = ScreenChrome.Band( TriggersScreenRenderer.HeaderLine( @@ -42,7 +43,7 @@ public static IWindowControl Build( // One column at a time: the rule list, or the editor once the keyboard has moved into it or // ⏎ has opened one of the rule's fields, which are drawn in the editor and nowhere else. var only = focus is { } f && (f.InPane(1) || f.IsEditing) - ? TriggersScreenRenderer.EditorColumn(sets, selectedTrigger, routeTargets, focus, width, body, theme) + ? TriggersScreenRenderer.EditorColumn(sets, selectedTrigger, routeTargets, focus, width, body, theme, recent) : TriggersScreenRenderer.RulesColumn(sets, selectedTrigger, focus, width); return ScreenChrome.Single( header, footer, ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(only, body))), @@ -57,7 +58,7 @@ public static IWindowControl Build( var left = TriggersScreenRenderer.RulesColumn(sets, selectedTrigger, focus, rules); var right = TriggersScreenRenderer.EditorColumn( sets, selectedTrigger, routeTargets, focus, - width <= 0 ? rules : width - rules - ScreenChrome.ColumnDivider, body, theme); + width <= 0 ? rules : width - rules - ScreenChrome.ColumnDivider, body, theme, recent); var rulesCol = ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(left, body))); var editorCol = ScreenChrome.Stretch(new MarkupControl( diff --git a/tests/SharpMUTerm.Core.Tests/Automation/TriggerBuilderTests.cs b/tests/SharpMUTerm.Core.Tests/Automation/TriggerBuilderTests.cs new file mode 100644 index 00000000..329f3c3b --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Automation/TriggerBuilderTests.cs @@ -0,0 +1,200 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Tests.Automation; + +/// +/// The trigger builder's Core half: the plain-language match kinds, the pattern proposed from a selection, +/// and the live test F2 runs over held output. +/// +public class TriggerBuilderTests +{ + [Test] + public async Task NumbersBecomeWildcards() + { + var suggestion = TriggerSuggestion.Suggest("You gain 125 experience points."); + + await Assert.That(suggestion.MatchType).IsEqualTo(TriggerMatchType.Wildcard); + await Assert.That(suggestion.Pattern).IsEqualTo("You gain * experience points."); + await Assert.That(suggestion.Regex).IsEqualTo("You gain (.*?) experience points\\."); + } + + [Test] + public async Task NumbersWithSeparatorsAreOneWildcard() + { + var suggestion = TriggerSuggestion.Suggest("HP: 1,024/2,048 (3.5%)"); + + await Assert.That(suggestion.Pattern).IsEqualTo("HP: */* (*%)"); + } + + [Test] + public async Task QuotedSpeechKeepsItsQuotesAndLosesItsWords() + { + var suggestion = TriggerSuggestion.Suggest("Rivane says, \"to the crypt, then!\""); + + await Assert.That(suggestion.Pattern).IsEqualTo("Rivane says, \"*\""); + } + + [Test] + public async Task KnownPlayerNamesBecomeWildcardsOnlyAsWholeWords() + { + var suggestion = TriggerSuggestion.Suggest( + "Rivane tells you: meet Rivanes at dawn", new[] { "Rivane" }); + + await Assert.That(suggestion.Pattern).IsEqualTo("* tells you: meet Rivanes at dawn"); + } + + [Test] + public async Task ALineWithNothingVariableIsMatchedAsText() + { + var suggestion = TriggerSuggestion.Suggest(" A town guard nods to you. \nsecond line"); + + await Assert.That(suggestion.MatchType).IsEqualTo(TriggerMatchType.Contains); + await Assert.That(suggestion.Pattern).IsEqualTo("A town guard nods to you."); + await Assert.That(suggestion.Name).IsEqualTo("A town guard nods to you"); + } + + [Test] + public async Task ALineThatIsAllVariableIsMatchedAsTextRatherThanAsEverything() + { + var suggestion = TriggerSuggestion.Suggest("12345"); + + await Assert.That(suggestion.MatchType).IsEqualTo(TriggerMatchType.Contains); + await Assert.That(suggestion.Pattern).IsEqualTo("12345"); + } + + [Test] + public async Task ALiteralAsteriskIsEscapedSoItStillMatchesItself() + { + var suggestion = TriggerSuggestion.Suggest("*** You have 3 new mail ***"); + var trigger = new Trigger { Pattern = suggestion.Pattern, MatchType = suggestion.MatchType }; + + await Assert.That(suggestion.Pattern).IsEqualTo("\\*\\*\\* You have * new mail \\*\\*\\*"); + await Assert.That(trigger.Regex.IsMatch("*** You have 12 new mail ***")).IsTrue(); + await Assert.That(trigger.Regex.IsMatch("You have 12 new mail")).IsFalse(); + } + + [Test] + public async Task AWildcardIsACaptureAndATrailingOneIsGreedy() + { + var trigger = new Trigger { Pattern = "* says *", MatchType = TriggerMatchType.Wildcard }; + + var match = trigger.Regex.Match("Rivane says hello there"); + + await Assert.That(match.Groups[1].Value).IsEqualTo("Rivane"); + await Assert.That(match.Groups[2].Value).IsEqualTo("hello there"); + } + + [Test] + public async Task ContainsReadsRegexCharactersLiterally() + { + var trigger = new Trigger { Pattern = "[public] (", MatchType = TriggerMatchType.Contains }; + + await Assert.That(trigger.Regex.IsMatch("x [public] (hi)")).IsTrue(); + await Assert.That(trigger.Regex.IsMatch("p")).IsFalse(); + } + + [Test] + public async Task StartsWithIsAnchoredAndCaseFollowsTheRule() + { + var trigger = new Trigger { Pattern = "You gain", MatchType = TriggerMatchType.StartsWith }; + + await Assert.That(trigger.Regex.IsMatch("you gain 5")).IsTrue(); + await Assert.That(trigger.Regex.IsMatch("Then you gain 5")).IsFalse(); + + trigger.CaseSensitive = true; + await Assert.That(trigger.Regex.IsMatch("you gain 5")).IsFalse(); + } + + [Test] + public async Task ChangingTheMatchTypeRecompiles() + { + var trigger = new Trigger { Pattern = "a.c" }; + await Assert.That(trigger.Regex.IsMatch("abc")).IsTrue(); + + trigger.MatchType = TriggerMatchType.Contains; + + await Assert.That(trigger.Regex.IsMatch("abc")).IsFalse(); + await Assert.That(trigger.Regex.IsMatch("xa.cx")).IsTrue(); + } + + [Test] + public async Task OnlyARegexCanFailToParse() + { + await Assert.That(TriggerPatterns.Validate(TriggerMatchType.Regex, "(")).IsNotNull(); + await Assert.That(TriggerPatterns.Validate(TriggerMatchType.Contains, "(")).IsNull(); + await Assert.That(TriggerPatterns.Validate(TriggerMatchType.Wildcard, "* *")).IsNotNull(); + await Assert.That(TriggerPatterns.Validate(TriggerMatchType.StartsWith, string.Empty)).IsNotNull(); + } + + [Test] + public async Task ThePlainWordsRoundTripAndComeBeforeTheRegex() + { + foreach (var type in Enum.GetValues()) + { + await Assert.That(TriggerPatterns.Parse(TriggerPatterns.Describe(type))).IsEqualTo(type); + } + + await Assert.That(TriggerPatterns.Offered[^1]).IsEqualTo(TriggerMatchType.Regex); + } + + [Test] + public async Task TheMatchTypeRoundTripsThroughTheConfigurationAndDefaultsToRegex() + { + var config = new AppConfiguration(); + config.TriggerSets.Add(new TriggerSet + { + Name = "Mine", + Triggers = + { + new Trigger { Name = "xp", Pattern = "You gain * xp", MatchType = TriggerMatchType.Wildcard }, + new Trigger { Name = "old", Pattern = "^old$" }, + }, + }); + + var loaded = ConfigurationStore.Deserialize(ConfigurationStore.Serialize(config)); + var legacy = ConfigurationStore.Deserialize(""" + { "version": 5, "triggerSets": [ { "name": "S", "triggers": [ { "name": "t", "pattern": "^a" } ] } ] } + """); + + await Assert.That(loaded.TriggerSets[0].Triggers[0].MatchType).IsEqualTo(TriggerMatchType.Wildcard); + await Assert.That(loaded.TriggerSets[0].Triggers[1].MatchType).IsEqualTo(TriggerMatchType.Regex); + await Assert.That(legacy.TriggerSets[0].Triggers[0].MatchType).IsEqualTo(TriggerMatchType.Regex); + await Assert.That(new Trigger { Pattern = "x", MatchType = TriggerMatchType.StartsWith }.Clone().MatchType) + .IsEqualTo(TriggerMatchType.StartsWith); + } + + [Test] + public async Task ThePreviewCountsEveryMatchAndKeepsTheNewestFew() + { + var lines = new[] { "You gain 1 xp", "noise", "You gain 2 xp", "You gain 3 xp", "You gain 4 xp" }; + + var result = TriggerPreview.Run(lines, TriggerMatchType.Wildcard, "You gain * xp", caseSensitive: false); + + await Assert.That(result.Problem).IsNull(); + await Assert.That(result.Tested).IsEqualTo(5); + await Assert.That(result.Matched).IsEqualTo(4); + await Assert.That(result.Samples.Select(s => s.Text)) + .IsEquivalentTo(new[] { "You gain 4 xp", "You gain 3 xp", "You gain 2 xp" }); + } + + [Test] + public async Task ThePreviewTriesOnlyTheNewestLines() + { + var lines = Enumerable.Range(0, TriggerPreview.MaxLines + 500).Select(i => i < 500 ? "old" : "new").ToArray(); + + var result = TriggerPreview.Run(lines, TriggerMatchType.Contains, "old", caseSensitive: false); + + await Assert.That(result.Tested).IsEqualTo(TriggerPreview.MaxLines); + await Assert.That(result.Matched).IsEqualTo(0); + } + + [Test] + public async Task AnUnparseablePatternIsAStateNotAThrow() + { + var result = TriggerPreview.Run(new[] { "a" }, TriggerMatchType.Regex, "(unclosed", caseSensitive: false); + + await Assert.That(result.Problem).IsNotNull(); + await Assert.That(result.Matched).IsEqualTo(0); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/TriggerBuilderTests.cs b/tests/SharpMUTerm.Tui.Tests/TriggerBuilderTests.cs new file mode 100644 index 00000000..6cc5385b --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/TriggerBuilderTests.cs @@ -0,0 +1,132 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The trigger builder: ⌃P ▸ Make a trigger from the selection and F2's live test. Every frame here +/// is the real one — a real drag through the pane's own mouse handler, the real ⌃P entry, and the real +/// settings session typing into the pattern field. +/// +/// Serialised: rendering redirects the process-global Console.Out. +[NotInParallel] +public class TriggerBuilderTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp Demo(int width = 120, int height = 32) + { + Console.SetIn(TextReader.Null); + return new SharpMUTermApp(DemoScene.Build(), Headless, new HeadlessConsoleDriver(width, height)); + } + + private static string Text(string frame) => string.Join("\n", FrameGrid.Decode(frame, 120, 32)); + + [Test] + public async Task TheEntryIsOfferedOnlyWhileOutputIsSelected() + { + var app = Demo(); + app.RenderSnapshot(); + await Assert.That(app.BuildCatalog().Any(c => c.Id == "term:trigger-from-selection")).IsFalse(); + + app.SimulatePaneDrag(SharpMUTermApp.MainWindowId, 0, 0, 10, 0); + + await Assert.That(app.BuildCatalog().Any(c => c.Id == "term:trigger-from-selection")).IsTrue(); + } + + [Test] + public async Task WithNothingSelectedItRefusesAndMakesNothing() + { + var app = Demo(); + app.RenderSnapshot(); + var before = app.Configuration.TriggerSets.Sum(s => s.Triggers.Count); + + await Assert.That(app.DispatchCommand("term:trigger-from-selection")).IsFalse(); + await Assert.That(app.Configuration.TriggerSets.Sum(s => s.Triggers.Count)).IsEqualTo(before); + await Assert.That(app.Settings.IsOpen).IsFalse(); + } + + [Test] + public async Task TheViewOpensF2OnAWildcardRuleWithTheLiveTestCounting() + { + var app = Demo(); + var frame = Text(app.RenderSnapshot("trigger-builder")); + + var made = app.Configuration.TriggerSets.SelectMany(s => s.Triggers).Last(t => t.Name.StartsWith("You gain", StringComparison.Ordinal)); + await Assert.That(made.MatchType).IsEqualTo(TriggerMatchType.Wildcard); + await Assert.That(made.Pattern).IsEqualTo("You gain * experience points."); + await Assert.That(app.Settings.IsOpen).IsTrue(); + await Assert.That(frame).Contains("matches with * wildcards"); + await Assert.That(frame).Contains("regex You gain (.*?) experience points\\."); + await Assert.That(frame).Contains("2 of the last"); + await Assert.That(frame).Contains("You gain 125 experience points."); + } + + [Test] + public async Task TheLiveTestFollowsTheBufferKeystrokeByKeystroke() + { + var app = Demo(); + app.RenderSnapshot("trigger-builder"); + + // The pattern field is open on the suggestion: Home, then type a word that matches nothing. + app.Settings.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.Home, false, false, false)); + foreach (var c in "Never ") + { + app.Settings.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + var frame = Text(app.RenderWholeFrame()); + + await Assert.That(frame).Contains("none of the last"); + await Assert.That(frame).Contains("Never You gain * experience points."); + } + + [Test] + public async Task TheViewFitsAt80Columns() + { + var app = Demo(80, 24); + var rows = FrameGrid.Decode(app.RenderSnapshot("trigger-builder"), 80, 24); + + await Assert.That(string.Join("\n", rows)).Contains("2 of the last"); + await Assert.That(rows.All(r => r.TrimEnd().Length <= 80)).IsTrue(); + } + + [Test] + public async Task AnUnparseablePatternIsDrawnAsAStateAndTheRowsBelowDoNotMove() + { + var good = TriggersScreenRenderer.TestRows(new[] { "abc" }, TriggerMatchType.Regex, "b", false, 60); + var bad = TriggersScreenRenderer.TestRows(new[] { "abc" }, TriggerMatchType.Regex, "(b", false, 60); + var empty = TriggersScreenRenderer.TestRows(Array.Empty(), TriggerMatchType.Contains, "b", false, 60); + + await Assert.That(bad[0]).Contains("not a pattern yet"); + await Assert.That(bad[0]).DoesNotContain(ScreenPalette.Warn); + await Assert.That(empty[0]).Contains("no output held yet"); + await Assert.That(good.Count).IsEqualTo(TriggersScreenRenderer.TestSampleRows + 1); + await Assert.That(bad.Count).IsEqualTo(good.Count); + await Assert.That(empty.Count).IsEqualTo(good.Count); + } + + [Test] + public async Task ASampleKeepsItsMatchOnScreenWhenTheLineIsLong() + { + var line = new string('x', 100) + "HIT" + new string('y', 100); + + var sample = TriggersScreenRenderer.Sample(line, 100, 3, 30); + + await Assert.That(sample).Contains("HIT"); + await Assert.That(MarkupText.VisibleLength(sample)).IsLessThanOrEqualTo(30); + } + + [Test] + public async Task SwitchingToRegexKeepsWhatTheRuleMatched() + { + var trigger = new Trigger { Pattern = "You gain * xp.", MatchType = TriggerMatchType.Wildcard }; + + TriggersScreenRenderer.SetMatchType(trigger, TriggerMatchType.Regex); + + await Assert.That(trigger.Pattern).IsEqualTo("You gain (.*?) xp\\."); + await Assert.That(trigger.Regex.IsMatch("You gain 5 xp.")).IsTrue(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/TriggerSetManagementTests.cs b/tests/SharpMUTerm.Tui.Tests/TriggerSetManagementTests.cs index 38019b66..013feec0 100644 --- a/tests/SharpMUTerm.Tui.Tests/TriggerSetManagementTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TriggerSetManagementTests.cs @@ -547,9 +547,16 @@ public async Task Tab_AfterAMoveOpensTheMovedRulesOwnNextField() } session.Handle(Key(ConsoleKey.DownArrow)); - session.Handle(Key(ConsoleKey.Tab)); // commits the move and wraps to field 0 + session.Handle(Key(ConsoleKey.Tab)); // commits the move and steps to the field after the set + // The match kind follows the set now (it was appended after it), and it belongs to the moved + // rule: a regex rule reads "regular expression". var edit = session.Focus().Edit!.Value; + await Assert.That(edit.Field).IsEqualTo(TriggersScreenRenderer.MatchTypeField); + await Assert.That(edit.Text).IsEqualTo("regular expression"); + + session.Handle(Key(ConsoleKey.Tab)); // and wraps to field 0 of the same rule + edit = session.Focus().Edit!.Value; await Assert.That(edit.Field).IsEqualTo(TriggersScreenRenderer.NameField); await Assert.That(edit.Text).IsEqualTo("Spam"); } diff --git a/tests/SharpMUTerm.Tui.Tests/TriggersScreenEditingTests.cs b/tests/SharpMUTerm.Tui.Tests/TriggersScreenEditingTests.cs index 2de9c5f5..72e81c29 100644 --- a/tests/SharpMUTerm.Tui.Tests/TriggersScreenEditingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TriggersScreenEditingTests.cs @@ -61,7 +61,9 @@ public async Task ARuleRowCarriesItsPatternRouteAndBothHighlightColours() // The name leads, then everything the editor pane draws, then the set that owns the rule. Every // ordinal below is unchanged — each new field is appended, so nothing the screen, the snapshot // keys or these tests already address is renumbered. - await Assert.That(model.RowAt(0, 0).FieldCount).IsEqualTo(10); + await Assert.That(model.RowAt(0, 0).FieldCount).IsEqualTo(11); + await Assert.That(model.FieldAt(0, 0, TriggersScreenRenderer.MatchTypeField)!.Value.Get()) + .IsEqualTo("regular expression"); await Assert.That(model.FieldAt(0, 0, TriggersScreenRenderer.SetField)!.Value.Get()).IsEqualTo("Comms"); await Assert.That(model.FieldAt(0, 0, TriggersScreenRenderer.NameField)!.Value.Get()).IsEqualTo("Tell"); await Assert.That(model.FieldAt(0, 0, TriggersScreenRenderer.PatternField)!.Value.Get()).IsEqualTo("tells you"); diff --git a/tests/SharpMUTerm.Tui.Tests/TriggersScreenRendererTests.cs b/tests/SharpMUTerm.Tui.Tests/TriggersScreenRendererTests.cs index 9b42091f..efb2134d 100644 --- a/tests/SharpMUTerm.Tui.Tests/TriggersScreenRendererTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TriggersScreenRendererTests.cs @@ -117,7 +117,7 @@ public async Task Render_HighlightCaptionAndSwatchAppearWhenColourSet() { var lines = TriggersScreenRenderer.Render(Scene(), selectedTrigger: 0, routeTargets: Array.Empty()); - var heading = lines.Single(l => l.Contains("highlight") && !l.Contains("fg") && !l.Contains("bg")); + var heading = lines.Single(l => l.Contains("[dim]highlight[/]")); await Assert.That(heading).Contains("recoloured"); await Assert.That(heading).DoesNotContain("[[x]]"); await Assert.That(heading).DoesNotContain("[[ ]]"); From ab388bde4c3315d04bfa49bf057672b143ad3efe Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 03:11:53 +0000 Subject: [PATCH 008/113] Settings screens follow the theme; pane tints re-picked for colour-blind readers Settings screens (D6): ScreenPalette's constants become roles spelt as the Dark theme's values. A new immutable ScreenTheme, built once from the app's theme, resolves renderer markup and control colours at the view boundary (ScreenChrome.Panel/Band/VerticalRule, ScreenTheme.Colour), so renderers and their tests are untouched and there is no mutable global. Dark resolves to the constants byte for byte; Light mirrors L*, Solarized takes its background's hue, and every ink is held to Contrast.Floor on its planes. Threaded through every *ScreenView.Build (required), SettingsOverlay, ComposeOverlay, ListOverlay and EditReviewOverlay. FrameContrastTests gains 13 settings views on all three themes; ScreenThemeTests checks that no Light settings frame paints a dark-palette plane. Tints: ColourVision (Core) simulates protanopia/deuteranopia/tritanopia (Machado 2009) and measures CIEDE2000. The ten anchors were re-picked within 40 degrees of each name: the worst dichromat pair goes from 0.28 to 1.99, and the worst pair for typical vision from 3.71 to 3.96. TintColourVisionTests holds 1.9 / 3.5 on all themes. Names kept. A tinted character's rail and tab tooltips name the colour, at no cell cost. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 6 + CLAUDE.md | 44 +- .../Configuration/PaneTint.cs | 7 +- src/SharpMUTerm.Core/Text/ColourVision.cs | 201 +++++++++ src/SharpMUTerm.Tui/AliasesScreenView.cs | 12 +- src/SharpMUTerm.Tui/ChromeInk.cs | 6 +- src/SharpMUTerm.Tui/ComposeOverlay.cs | 26 +- src/SharpMUTerm.Tui/EditReviewOverlay.cs | 15 +- src/SharpMUTerm.Tui/KeypadScreenView.cs | 11 +- src/SharpMUTerm.Tui/ListOverlay.cs | 12 +- src/SharpMUTerm.Tui/MsspScreenView.cs | 7 +- src/SharpMUTerm.Tui/OptionsScreenView.cs | 15 +- .../Pointer/SharpMUTermApp.Pointer.cs | 22 +- src/SharpMUTerm.Tui/ScreenChrome.cs | 35 +- src/SharpMUTerm.Tui/ScreenPalette.cs | 16 +- src/SharpMUTerm.Tui/ScreenTheme.cs | 404 ++++++++++++++++++ src/SharpMUTerm.Tui/SettingsOverlay.cs | 13 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 24 +- src/SharpMUTerm.Tui/SpellingHighlighter.cs | 9 +- src/SharpMUTerm.Tui/TimersScreenView.cs | 12 +- src/SharpMUTerm.Tui/TriggersScreenView.cs | 13 +- src/SharpMUTerm.Tui/WorkspacePalette.cs | 31 +- src/SharpMUTerm.Tui/WorldsScreenView.cs | 28 +- .../Text/ColourVisionTests.cs | 70 +++ .../FrameContrastTests.cs | 10 +- tests/SharpMUTerm.Tui.Tests/PointerTests.cs | 15 + .../SharpMUTerm.Tui.Tests/ScreenThemeTests.cs | 172 ++++++++ .../TintColourVisionTests.cs | 65 +++ 28 files changed, 1186 insertions(+), 115 deletions(-) create mode 100644 src/SharpMUTerm.Core/Text/ColourVision.cs create mode 100644 src/SharpMUTerm.Tui/ScreenTheme.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Text/ColourVisionTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/TintColourVisionTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c939f10..e77c14f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,12 +106,18 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The ten pane colours a character can be given (F5 ▸ `tint`) have been re-chosen so they stay apart for + players with red-green or blue-yellow colour blindness, and a little further apart for everyone else. + The names are unchanged, so nothing needs setting again; Ochre is now a red ochre and Ember a red. In the + window, pointing at a tinted character in the sidebar or at its tab names the colour. - An MXP picture is downloaded and decoded once per session. A room picture shown on every look used to be fetched again whenever the pane's width had changed, and once per look that arrived while it was still loading. ### Fixed +- The settings screens (F1–F10), the deletion review and the package and send lists follow the Light and + Solarized Dark themes instead of staying dark on every theme. - MXP pictures draw again. Since the TelnetNegotiationCore update the client stopped answering a server's MXP `` and `` questions, so a game such as SharpMUSH decided it could not show `` and sent the picture's address as text instead. diff --git a/CLAUDE.md b/CLAUDE.md index a6b36fb5..f4889daf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -711,9 +711,10 @@ fallbacks) for inline images/maps. - **A span carrying a background is measured against *it*.** That plane is known exactly and a highlight's pair must be judged as a pair; a span with the default background emits none and takes the pane, so it is measured against the reading plane. `reverse` swaps first. - - **`ScreenPalette` is deliberately not built this way.** Those constants sit on the settings screens' - own fixed backdrop, which no theme moves; measuring them against a theme plane would be measuring - them against a plane they are never painted on. `ChromeInk` is the other four — `Accent`, `Notice`, + - **`ScreenPalette` is not built this way either, but it does follow the theme** (`ScreenTheme`, Tui; + defect D6). The settings screens are their own backdrop, so their inks are measured against their own + planes rather than a pane's; but the planes themselves move with the theme. See the *settings screens + follow the theme* entry below. `ChromeInk` is the other four — `Accent`, `Notice`, `Draft`, `Marker` — and it carries **the plane it was resolved against**, so a renderer can hold a colour it was *handed* (a world's accent) to the same floor. - **A fill is not text.** A ribbon segment's accent, a pane tint and F2's swatch are identity or @@ -731,6 +732,31 @@ fallbacks) for inline images/maps. focused pane. Reaching it means giving up `[dim]` across every renderer for an explicit floor-checked grey — a sweep, for a near miss on one theme. The exemption is a named predicate with the number in it, so whoever does that sweep can delete it and watch the test pass. +- **The settings screens follow the theme, and the renderers do not know it** (`ScreenTheme`, Tui; defect + D6). `ScreenPalette`'s constants are *roles* spelt as the Dark theme's values; renderers keep writing + `[{Label}]…` in them, and the views resolve the markup and every control colour through one immutable + `ScreenTheme` the app builds from its theme (`ScreenTheme.For`, held in `_screens`, handed to + `SettingsOverlay`, `ComposeOverlay`, `ListOverlay` and `EditReviewOverlay`, and to every `*ScreenView.Build` + as a **required** parameter). Decisions not to relitigate: + - **Resolve at the view, not in the renderers.** A palette parameter on every renderer function is every + screen and every renderer test rewritten for a value only the last step needs; a mutable `ScreenPalette` + is global state the parallel suites race on. `ScreenChrome.Panel`/`Band`/`VerticalRule(scheme)` and + `ScreenTheme.Colour` are the only ways a role reaches a control. A view that hands a renderer's lines + straight to a `MarkupControl` is a dark island on Light — legible, so `FrameContrastTests` cannot see it; + `ScreenThemeTests.NoLightSettingsFramePaintsADarkPlane` can. + - **Dark resolves to the constants byte for byte** (`IsIdentity`), so no Dark frame moved. A dark theme + keeps each role's lightness and takes its background's hue shift; a light one mirrors L* (100 − L*) and + keeps the tint, the menu shadow is placed below the darkest plane, and every ink is then held to + `Contrast.Floor` on the planes it is drawn on (`PlanesUnder`: a label never sits on the menu's selected + row). The wells are the *lightest* thing on a light screen — the input-field convention there. + - **`Paint` rewrites colours and nothing else**: escaped `[[`/`]]` and `link=` targets are text; a run of + `█░▒▓` is a colour *sample* and keeps its hex even when it equals a role's (F2's swatch of a highlight + that happens to be `#00f5b7`); a foreground that is no role (a world's accent) is held to the floor on + the plane it lands on, except on Dark, which stays as it was. + - A bordered modal's title, border and unstyled text are the framework's cyan and `#eeeeee`, 1.4:1 on a + light backdrop; `ScreenTheme.Frame` recolours them off Dark. **Not themed**: the workspace popups that do + not sit on a settings screen (⌃P, quit, ⌃B panel, search, game data, message log, history) still paint + `ScreenPalette.MenuBg` raw. They pass the floor on Light and look dark; same recipe when someone wants it. - **A trigger's `route` says three things, and the third is "nothing"** (`TriggerActions.MainWindow`, Core; F2's `route` list). `SpawnTarget = null` has always meant *this rule adds no destination — the line follows whatever the other matched rules decided*, which is exactly what a highlight rule wants. @@ -1531,6 +1557,18 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] chroma distance on the darkened surface: nearest pair Teal/Jade at 7.8, against that test's floor of 6. The yellow-greens were tried and rejected — an olive measured 5.9 from `Ochre`, a lime 6.5 from `Moss` — and `TintStrength` went from 0.75 to 0.85 with the darkening, for the same chroma-is-bounded reason. + **The ten anchors were then re-picked for colour-blind readers** (`ColourVision`, Core: Machado 2009 + dichromat matrices on linear sRGB, CIEDE2000; `TintColourVisionTests`). Searched within 40° of each + name's hue for the set whose closest pair — the ten *and* the untinted plane, all three themes — is + furthest apart under protanopia, deuteranopia and tritanopia, on condition that typical vision's closest + pair got no closer and the Light planes stayed pastel. Worst pair went from 0.28 (deutan, Moss/Ember on + Dark) to 1.99 (deutan, Moss/Ochre on Solarized Dark); typical vision 3.71 → 3.96. The floors are 1.9 + (dichromat) and 3.5 (typical). **That is "side by side they differ", not "alone it is recognised"**, + and it cannot be more: ten planes at one luminance near L* 7, seen on one hue axis, top out around 2.2 + even with the names ignored. So the name is the second cue, where it costs no cell: a tinted character's + rail row and tab tooltips say `pane colour: moss` (`TintLine`), and F5's `tint` row already names it. + **Names are stored, so they were kept**; `Ochre` is now a red ochre (hue 18°) and `Ember` a red, and the + enum's doc says so. Do not add a migration for a hue change — the name is the setting. **It says nothing on a monochrome terminal, deliberately** — the cue that must survive a lost hue is focus, and the rail and the tab title still name the character in words — and it is a **truecolor** cue, which is unacceptable for focus and is why diff --git a/src/SharpMUTerm.Core/Configuration/PaneTint.cs b/src/SharpMUTerm.Core/Configuration/PaneTint.cs index 6869251a..d34ceb6e 100644 --- a/src/SharpMUTerm.Core/Configuration/PaneTint.cs +++ b/src/SharpMUTerm.Core/Configuration/PaneTint.cs @@ -52,10 +52,13 @@ public enum PaneTint /// Green. Moss, - /// Amber. + /// + /// Red ochre — a burnt orange-brown. It was amber until the set was re-picked for colour-blind readers; + /// the stored name is kept, since a name is what the configuration holds. + /// Ochre, - /// Red-orange. + /// Red. Ember, /// Violet. diff --git a/src/SharpMUTerm.Core/Text/ColourVision.cs b/src/SharpMUTerm.Core/Text/ColourVision.cs new file mode 100644 index 00000000..b3348209 --- /dev/null +++ b/src/SharpMUTerm.Core/Text/ColourVision.cs @@ -0,0 +1,201 @@ +namespace SharpMUTerm.Core.Text; + +/// A colour-vision deficiency can simulate. +public enum ColourDeficiency +{ + /// Typical trichromatic vision: no simulation. + None = 0, + + /// No working long-wavelength (red) cones. + Protanopia, + + /// No working medium-wavelength (green) cones — the commonest of the three. + Deuteranopia, + + /// No working short-wavelength (blue) cones. + Tritanopia, +} + +/// +/// How far apart two colours look, to typical vision and under a simulated colour-vision deficiency. +/// +/// Simulation: Machado, Oliveira & Fernandes, "A Physiologically-based Model for Simulation of +/// Color Vision Deficiency", IEEE TVCG 15(6), 2009 — the severity-1.0 (dichromat) matrices from the +/// paper's supplementary table, applied to linear sRGB and clipped to the unit cube. Chosen over +/// Brettel/Viénot because it is one 3×3 matrix per deficiency, covers tritanopia with the same model as +/// the other two, and is what browser devtools and most accessibility checkers ship. +/// +/// +/// Distance: CIEDE2000 (Sharma, Wu & Dalal 2005's formulation) over CIELAB with a D65 white. +/// It is computed from the simulated colour before rounding to bytes: the pane planes this is used +/// for sit near L* 7, where one byte is a visible fraction of the whole distance being measured. +/// +/// +public static class ColourVision +{ + private static readonly double[,] Protan = + { + { 0.152286, 1.052583, -0.204868 }, + { 0.114503, 0.786281, 0.099216 }, + { -0.003882, -0.048116, 1.051998 }, + }; + + private static readonly double[,] Deutan = + { + { 0.367322, 0.860646, -0.227968 }, + { 0.280085, 0.672501, 0.047413 }, + { -0.011820, 0.042940, 0.968881 }, + }; + + private static readonly double[,] Tritan = + { + { 1.255528, -0.076749, -0.178779 }, + { -0.078411, 0.930809, 0.147602 }, + { 0.004733, 0.691367, 0.303900 }, + }; + + /// The CIEDE2000 distance between two colours as seen with . + public static double Distance(Rgb a, Rgb b, ColourDeficiency deficiency = ColourDeficiency.None) => + DeltaE2000(Lab(Linear(a, deficiency)), Lab(Linear(b, deficiency))); + + /// A colour as it appears with , rounded to bytes for display. + public static Rgb Simulate(Rgb rgb, ColourDeficiency deficiency) + { + var (r, g, b) = Linear(rgb, deficiency); + return new Rgb(Encode(r), Encode(g), Encode(b)); + } + + /// Linear sRGB, put through the deficiency's matrix. + private static (double R, double G, double B) Linear(Rgb rgb, ColourDeficiency deficiency) + { + var r = Decode(rgb.R); + var g = Decode(rgb.G); + var b = Decode(rgb.B); + var m = deficiency switch + { + ColourDeficiency.Protanopia => Protan, + ColourDeficiency.Deuteranopia => Deutan, + ColourDeficiency.Tritanopia => Tritan, + _ => null, + }; + + if (m is null) + { + return (r, g, b); + } + + return ( + Math.Clamp((m[0, 0] * r) + (m[0, 1] * g) + (m[0, 2] * b), 0, 1), + Math.Clamp((m[1, 0] * r) + (m[1, 1] * g) + (m[1, 2] * b), 0, 1), + Math.Clamp((m[2, 0] * r) + (m[2, 1] * g) + (m[2, 2] * b), 0, 1)); + } + + private static double Decode(byte channel) + { + var c = channel / 255.0; + return c <= 0.04045 ? c / 12.92 : Math.Pow((c + 0.055) / 1.055, 2.4); + } + + private static byte Encode(double linear) + { + var c = linear <= 0.0031308 ? 12.92 * linear : (1.055 * Math.Pow(linear, 1 / 2.4)) - 0.055; + return (byte)Math.Clamp(Math.Round(c * 255), 0, 255); + } + + /// CIELAB (D65) of a linear sRGB triple. + private static (double L, double A, double B) Lab((double R, double G, double B) rgb) + { + var x = (0.4124564 * rgb.R) + (0.3575761 * rgb.G) + (0.1804375 * rgb.B); + var y = (0.2126729 * rgb.R) + (0.7151522 * rgb.G) + (0.0721750 * rgb.B); + var z = (0.0193339 * rgb.R) + (0.1191920 * rgb.G) + (0.9503041 * rgb.B); + + var fx = F(x / 0.95047); + var fy = F(y); + var fz = F(z / 1.08883); + return ((116 * fy) - 16, 500 * (fx - fy), 200 * (fy - fz)); + + static double F(double t) => + t > 216.0 / 24389 ? Math.Cbrt(t) : (t * 24389 / 27 + 16) / 116; + } + + private static double DeltaE2000((double L, double A, double B) p, (double L, double A, double B) q) + { + const double Pow25To7 = 6103515625.0; // 25^7 + + var c1 = Math.Sqrt((p.A * p.A) + (p.B * p.B)); + var c2 = Math.Sqrt((q.A * q.A) + (q.B * q.B)); + var cBar7 = Math.Pow((c1 + c2) / 2, 7); + var g = 0.5 * (1 - Math.Sqrt(cBar7 / (cBar7 + Pow25To7))); + + var a1 = (1 + g) * p.A; + var a2 = (1 + g) * q.A; + var c1p = Math.Sqrt((a1 * a1) + (p.B * p.B)); + var c2p = Math.Sqrt((a2 * a2) + (q.B * q.B)); + var h1p = Hue(p.B, a1); + var h2p = Hue(q.B, a2); + + var dL = q.L - p.L; + var dC = c2p - c1p; + double dh; + if (c1p * c2p == 0) + { + dh = 0; + } + else + { + dh = h2p - h1p; + if (dh > 180) + { + dh -= 360; + } + else if (dh < -180) + { + dh += 360; + } + } + + var dH = 2 * Math.Sqrt(c1p * c2p) * Math.Sin(Radians(dh / 2)); + + var lBar = (p.L + q.L) / 2; + var cBarP = (c1p + c2p) / 2; + double hBar; + if (c1p * c2p == 0) + { + hBar = h1p + h2p; + } + else if (Math.Abs(h1p - h2p) <= 180) + { + hBar = (h1p + h2p) / 2; + } + else + { + hBar = h1p + h2p < 360 ? (h1p + h2p + 360) / 2 : (h1p + h2p - 360) / 2; + } + + var t = 1 + - (0.17 * Math.Cos(Radians(hBar - 30))) + + (0.24 * Math.Cos(Radians(2 * hBar))) + + (0.32 * Math.Cos(Radians((3 * hBar) + 6))) + - (0.20 * Math.Cos(Radians((4 * hBar) - 63))); + var dTheta = 30 * Math.Exp(-Math.Pow((hBar - 275) / 25, 2)); + var cBarP7 = Math.Pow(cBarP, 7); + var rC = 2 * Math.Sqrt(cBarP7 / (cBarP7 + Pow25To7)); + var sL = 1 + (0.015 * Math.Pow(lBar - 50, 2) / Math.Sqrt(20 + Math.Pow(lBar - 50, 2))); + var sC = 1 + (0.045 * cBarP); + var sH = 1 + (0.015 * cBarP * t); + var rT = -Math.Sin(Radians(2 * dTheta)) * rC; + + var l = dL / sL; + var c = dC / sC; + var h = dH / sH; + return Math.Sqrt((l * l) + (c * c) + (h * h) + (rT * c * h)); + + static double Hue(double b, double a) + { + var degrees = Math.Atan2(b, a) * 180 / Math.PI; + return degrees < 0 ? degrees + 360 : degrees; + } + + static double Radians(double degrees) => degrees * Math.PI / 180; + } +} diff --git a/src/SharpMUTerm.Tui/AliasesScreenView.cs b/src/SharpMUTerm.Tui/AliasesScreenView.cs index e4dfd743..6a80eaa7 100644 --- a/src/SharpMUTerm.Tui/AliasesScreenView.cs +++ b/src/SharpMUTerm.Tui/AliasesScreenView.cs @@ -15,13 +15,13 @@ namespace SharpMUTerm.Tui; internal static class AliasesScreenView { public static IWindowControl Build( - IReadOnlyList sets, int selected, int width, ScreenFocus? focus = null, int height = 0) + IReadOnlyList sets, int selected, int width, ScreenTheme scheme, ScreenFocus? focus = null, int height = 0) { var header = ScreenChrome.Band( AliasesScreenRenderer.HeaderLine(width, AliasesScreenRenderer.Model(sets, selected), focus), - ScreenPalette.HeaderBg); + ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( - AliasesScreenRenderer.FooterLine(sets, selected, width, focus), ScreenPalette.FooterBg); + AliasesScreenRenderer.FooterLine(sets, selected, width, focus), ScreenPalette.FooterBg, scheme); var list = ScreenChrome.SplitWidth( width, @@ -33,10 +33,10 @@ public static IWindowControl Build( var right = AliasesScreenRenderer.EditorColumn( sets, selected, focus, width <= 0 ? list : width - list - ScreenChrome.ColumnDivider, rows); - var listCol = ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(left, rows))); + var listCol = ScreenChrome.Stretch(ScreenChrome.Panel(ScreenChrome.Window(left, rows), scheme)); var editorCol = ScreenChrome.Stretch( - new MarkupControl(ScreenChrome.Indent(ScreenChrome.Window(right, rows)))); + ScreenChrome.Panel(ScreenChrome.Indent(ScreenChrome.Window(right, rows)), scheme)); return ScreenChrome.Split( - header, footer, listCol, editorCol, list, Math.Max(left.Count, right.Count), rows); + header, footer, listCol, editorCol, list, Math.Max(left.Count, right.Count), rows, scheme); } } diff --git a/src/SharpMUTerm.Tui/ChromeInk.cs b/src/SharpMUTerm.Tui/ChromeInk.cs index 12896dfb..d805efed 100644 --- a/src/SharpMUTerm.Tui/ChromeInk.cs +++ b/src/SharpMUTerm.Tui/ChromeInk.cs @@ -23,9 +23,9 @@ namespace SharpMUTerm.Tui; /// the theme's answer, because a hex picked against one theme becomes a hole in the next. /// /// -/// is deliberately not built this way. Those colours sit on the -/// settings screens' own fixed backdrop, which no theme moves, so measuring them against a theme plane -/// would be measuring them against a plane they are never painted on. +/// is not built this way. Those colours sit on the settings screens' +/// own backdrop, not on a pane, so they are measured against that backdrop's planes — which +/// works out per theme — rather than against a pane's. /// /// /// diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 2739eb7d..ffd51d19 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -59,12 +59,16 @@ internal sealed class ComposeOverlay /// Opens the dictionary, the first time the composer is opened and never again, so a client nobody writes a /// post in reads no dictionary. Null, or a null answer, is a composer with no spelling, which says so. /// - internal ComposeOverlay(ConsoleWindowSystem system, Func? spelling = null) + /// The settings screens' palette for the app's theme; the composer is one of them. + internal ComposeOverlay(ConsoleWindowSystem system, Func? spelling = null, ScreenTheme? scheme = null) { _system = system; _openSpelling = spelling; + _scheme = scheme ?? ScreenTheme.Dark; } + private readonly ScreenTheme _scheme; + /// /// The dictionary marking this post, or null: none was found, or this is a MOO edit, whose buffer is as often /// code as prose. @@ -155,12 +159,12 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool // paints from the *focused* pair whenever it has focus, and it always has focus here, so // setting only the unfocused one leaves the default grey on screen for the whole session — // which is exactly what the first frame of this window showed. - BackgroundColor = new Color(ScreenPalette.EditBg), - FocusedBackgroundColor = new Color(ScreenPalette.EditBg), - ForegroundColor = new Color(ScreenPalette.Value), - FocusedForegroundColor = new Color(ScreenPalette.Value), - SelectionBackgroundColor = new Color(ScreenPalette.CursorBg), - SelectionForegroundColor = new Color(ScreenPalette.Value), + BackgroundColor = _scheme.Colour(ScreenPalette.EditBg), + FocusedBackgroundColor = _scheme.Colour(ScreenPalette.EditBg), + ForegroundColor = _scheme.Colour(ScreenPalette.Value), + FocusedForegroundColor = _scheme.Colour(ScreenPalette.Value), + SelectionBackgroundColor = _scheme.Colour(ScreenPalette.CursorBg), + SelectionForegroundColor = _scheme.Colour(ScreenPalette.Value), }; if (!_spellingOpened) @@ -171,7 +175,7 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool if (Spelling is { } checker) { - _editor.SyntaxHighlighter = new SpellingHighlighter(checker); + _editor.SyntaxHighlighter = new SpellingHighlighter(checker, _scheme.Colour(ScreenPalette.Warn)); } _editor.SetContent(draft); @@ -181,7 +185,7 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool .AsModal() .Maximized() .Frameless() - .WithColors(new Color(ScreenPalette.PanelFg), new Color(ScreenPalette.PanelBg)) + .WithColors(_scheme.Colour(ScreenPalette.PanelFg), _scheme.Colour(ScreenPalette.PanelBg)) .AddControl(HeaderBand()) .AddControl(_editor) .AddControl(FooterBand()) @@ -349,14 +353,14 @@ private void Redraw() /// private MarkupControl HeaderBand() { - var band = ScreenChrome.Band(Header(), ScreenPalette.HeaderBg); + var band = ScreenChrome.Band(Header(), ScreenPalette.HeaderBg, _scheme); band.StickyPosition = StickyPosition.Top; return band; } private MarkupControl FooterBand() { - var band = ScreenChrome.Band(Footer(), ScreenPalette.FooterBg); + var band = ScreenChrome.Band(Footer(), ScreenPalette.FooterBg, _scheme); band.StickyPosition = StickyPosition.Bottom; return band; } diff --git a/src/SharpMUTerm.Tui/EditReviewOverlay.cs b/src/SharpMUTerm.Tui/EditReviewOverlay.cs index 9d9f1453..8701eaee 100644 --- a/src/SharpMUTerm.Tui/EditReviewOverlay.cs +++ b/src/SharpMUTerm.Tui/EditReviewOverlay.cs @@ -35,7 +35,13 @@ internal sealed class EditReviewOverlay private Action? _keep; private Action? _undo; - public EditReviewOverlay(ConsoleWindowSystem system) => _system = system; + private readonly ScreenTheme _scheme; + + public EditReviewOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) + { + _system = system; + _scheme = scheme ?? ScreenTheme.Dark; + } public bool IsOpen => _window is not null; @@ -62,7 +68,7 @@ public void Open(IReadOnlyList deletions, Action keep, Action undo) _selected = ReviewChoice.Keep; var lines = Lines; - _body = new MarkupControl(new List(lines)); + _body = new MarkupControl(_scheme.Lines(lines, ScreenPalette.MenuBg)); // Hug the content: the question is as tall as it has things to name. Centred *after* WithSize, // because the builder reads the bounds set so far and falls back to 80x25 otherwise. @@ -75,7 +81,7 @@ public void Open(IReadOnlyList deletions, Action keep, Action undo) .WithTitle("Deletions") .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(_scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(width, height) @@ -84,6 +90,7 @@ public void Open(IReadOnlyList deletions, Action keep, Action undo) .OnClosed((_, _) => Reset()) .Build(); + _scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); } @@ -117,7 +124,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) break; case ReviewAction.Redraw: - _body?.SetContent(new List(Lines)); + _body?.SetContent(_scheme.Lines(Lines, ScreenPalette.MenuBg)); _window.Invalidate(redrawAll: true); break; diff --git a/src/SharpMUTerm.Tui/KeypadScreenView.cs b/src/SharpMUTerm.Tui/KeypadScreenView.cs index 10ec3420..efa9267d 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenView.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenView.cs @@ -26,14 +26,15 @@ public static IWindowControl Build( IReadOnlyList sets, int selected, int width, + ScreenTheme scheme, ScreenFocus? focus = null, int height = 0) { var header = ScreenChrome.Band( KeypadScreenRenderer.HeaderLine(width, KeypadScreenRenderer.Model(macros, sets, selected), focus), - ScreenPalette.HeaderBg); + ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( - KeypadScreenRenderer.FooterLine(macros, width, focus, selected), ScreenPalette.FooterBg); + KeypadScreenRenderer.FooterLine(macros, width, focus, selected), ScreenPalette.FooterBg, scheme); // While a key capture is armed the binding row swaps its key well for a prompt twice the width, // so the list asks for more and the diagram gives it up for as long as the prompt is up. The @@ -50,10 +51,10 @@ public static IWindowControl Build( var right = KeypadScreenRenderer.HotkeysColumn( macros, focus, sets, selected, width <= 0 ? numpad : width - numpad - ScreenChrome.ColumnDivider); - var numpadCol = ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(left, rows))); + var numpadCol = ScreenChrome.Stretch(ScreenChrome.Panel(ScreenChrome.Window(left, rows), scheme)); var hotkeysCol = ScreenChrome.Stretch( - new MarkupControl(ScreenChrome.Indent(ScreenChrome.Window(right, rows)))); + ScreenChrome.Panel(ScreenChrome.Indent(ScreenChrome.Window(right, rows)), scheme)); return ScreenChrome.Split( - header, footer, numpadCol, hotkeysCol, numpad, Math.Max(left.Count, right.Count), rows); + header, footer, numpadCol, hotkeysCol, numpad, Math.Max(left.Count, right.Count), rows, scheme); } } diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index 04deb107..a8a70f3f 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -19,9 +19,12 @@ internal sealed class ListOverlay private Func>? _render; private Func? _key; - public ListOverlay(ConsoleWindowSystem system) + private readonly ScreenTheme _scheme; + + public ListOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) { _system = system; + _scheme = scheme ?? ScreenTheme.Dark; } public bool IsOpen => _window is not null; @@ -50,7 +53,7 @@ public void Open(string mode, string title, Func> render, Func var outer = width is { } asked ? Math.Clamp(asked + 4, 24, widest) : widest; var lines = render(outer - 4); var height = Math.Clamp(lines.Count + 2, 8, Math.Max(8, desktop.Height - 2)); - _content = new MarkupControl(lines); + _content = new MarkupControl(_scheme.Lines(lines, ScreenPalette.MenuBg)); // Centered() after WithSize(), for CommandPalette's reason. Window? built = null; @@ -58,7 +61,7 @@ public void Open(string mode, string title, Func> render, Func .WithTitle(title) .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(_scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(outer, height) @@ -74,6 +77,7 @@ public void Open(string mode, string title, Func> render, Func }) .Build(); _window = built; + _scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); @@ -86,7 +90,7 @@ public void Repaint() { if (_render is not null && _content is not null) { - _content.SetContent(_render(Width())); + _content.SetContent(_scheme.Lines(_render(Width()), ScreenPalette.MenuBg)); _window?.Invalidate(redrawAll: true); } } diff --git a/src/SharpMUTerm.Tui/MsspScreenView.cs b/src/SharpMUTerm.Tui/MsspScreenView.cs index 5249b93b..e498ff92 100644 --- a/src/SharpMUTerm.Tui/MsspScreenView.cs +++ b/src/SharpMUTerm.Tui/MsspScreenView.cs @@ -18,12 +18,13 @@ internal static IWindowControl Build( MsspObservation? observation, DateTimeOffset now, int width, + ScreenTheme scheme, ScreenFocus? focus = null, int height = 0) { - var header = ScreenChrome.Band(MsspScreenRenderer.HeaderLine(width), ScreenPalette.HeaderBg); + var header = ScreenChrome.Band(MsspScreenRenderer.HeaderLine(width), ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( - MsspScreenRenderer.FooterLine(world, observation, focus, width, now), ScreenPalette.FooterBg); + MsspScreenRenderer.FooterLine(world, observation, focus, width, now), ScreenPalette.FooterBg, scheme); var rows = ScreenChrome.Rows(height); @@ -32,7 +33,7 @@ internal static IWindowControl Build( // way for the control's content and the height it was sized for to disagree the moment the // renderer stopped being a pure function of its arguments. var lines = MsspScreenRenderer.Render(world, observation, now, focus, rows, width); - var body = ScreenChrome.Stretch(new MarkupControl(lines)); + var body = ScreenChrome.Stretch(ScreenChrome.Panel(lines, scheme)); var root = Controls.Grid() .WithAlignment(HorizontalAlignment.Stretch) diff --git a/src/SharpMUTerm.Tui/OptionsScreenView.cs b/src/SharpMUTerm.Tui/OptionsScreenView.cs index fa419d70..70bf2380 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenView.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenView.cs @@ -23,17 +23,17 @@ internal static class OptionsScreenView private const int CardInset = 4; public static IWindowControl Build( - OptionsScreenRenderer.OptionsScreen screen, int width, ScreenFocus? focus = null) + OptionsScreenRenderer.OptionsScreen screen, int width, ScreenTheme scheme, ScreenFocus? focus = null) { var header = ScreenChrome.Band( OptionsScreenRenderer.HeaderLine( screen.Title, screen.FKey, width, OptionsScreenRenderer.Model(screen), focus), - ScreenPalette.HeaderBg); + ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( - OptionsScreenRenderer.FooterLine(screen.Rows, width, focus), ScreenPalette.FooterBg); + OptionsScreenRenderer.FooterLine(screen.Rows, width, focus), ScreenPalette.FooterBg, scheme); var rows = OptionsScreenRenderer.BodyColumn(screen.Rows, focus, Math.Max(0, width - CardInset)); - var card = Card(rows); + var card = Card(rows, scheme); // Header on the first row, footer on the last, the card hugging its content directly beneath the // header and the remaining space left as backdrop — so the action bar sits at the bottom of the @@ -57,15 +57,16 @@ public static IWindowControl Build( /// cells its lines cover, so the card is a grid — a grid's background covers its whole arranged /// area, giving the band its full width and the padding rows their colour. /// - private static IWindowControl Card(IReadOnlyList rows) + private static IWindowControl Card(IReadOnlyList rows, ScreenTheme scheme) { - var list = new MarkupControl(Pad(rows)) { HorizontalAlignment = HorizontalAlignment.Stretch }; + var list = ScreenChrome.Panel(Pad(rows), scheme, ScreenPalette.EditBg); + list.HorizontalAlignment = HorizontalAlignment.Stretch; var card = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) .WithVerticalAlignment(VerticalAlignment.Fill) .Column(c => c.Flex(1).Add(list)) .Build(); - card.BackgroundColor = new Color(ScreenPalette.EditBg); + card.BackgroundColor = scheme.Colour(ScreenPalette.EditBg); return card; } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index 83641060..01a23684 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -2,6 +2,7 @@ using SharpConsoleUI.Controls; using SharpConsoleUI.Drivers; using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; using SharpMUTerm.Core.Workspaces; @@ -266,6 +267,13 @@ private PointerTarget RailTargetAt(PaneRect rail, System.Drawing.Point point) tooltip = hit.Span.Text.Trim(); } + var owner = target.StartsWith(CommandIds.CharacterPrefix, StringComparison.Ordinal) + ? target[CommandIds.CharacterPrefix.Length..] + : target.StartsWith(CommandIds.WindowPrefix, StringComparison.Ordinal) + ? _workspace.FindWindow(target[CommandIds.WindowPrefix.Length..])?.SessionKey + : null; + tooltip += TintLine(owner); + return new PointerTarget(PointerKind.RailRow, row, PointerShape.Hand, tooltip, "rail:" + target); } @@ -332,9 +340,21 @@ private string TabTooltip(string windowId, bool closable) var title = Snippet(WindowTitle(windowId)); var unread = window is { Unread: > 0 } ? $" · {window.Unread} unread" : string.Empty; var actions = closable ? "click to show it · drag it onto another pane · × closes it" : "click to show it · drag it onto another pane"; - return $"{title}{unread}\n{actions}"; + return $"{title}{unread}\n{actions}{TintLine(window?.SessionKey)}"; } + /// + /// The pane colour a character chose, by name, as a line for a tooltip — the cue that does not + /// depend on telling hues apart. Ten tints at one luminance cannot all be told apart by a reader with a + /// colour-vision deficiency (see ), and the rail and the tab strip may + /// not spend a cell on saying it (the NAWS rule), so the name goes where it costs none. Empty for a + /// window nobody owns and for a character with no tint. + /// + private string TintLine(string? sessionKey) => + TintOf(sessionKey) is var tint && tint != PaneTint.None + ? $"\npane colour: {tint.ToString().ToLowerInvariant()}" + : string.Empty; + /// /// What clicking a pane's link does, said before it is done. For a link a server wrote, that is the /// whole point: a URL is shown in full before anything opens it, and a <SEND> says what it diff --git a/src/SharpMUTerm.Tui/ScreenChrome.cs b/src/SharpMUTerm.Tui/ScreenChrome.cs index aa4af073..28d8964f 100644 --- a/src/SharpMUTerm.Tui/ScreenChrome.cs +++ b/src/SharpMUTerm.Tui/ScreenChrome.cs @@ -701,12 +701,25 @@ internal static string Context(params string?[] parts) return joined.Length == 0 ? string.Empty : $"[{ScreenPalette.Label}]{joined}[/]"; } - /// A full-width one-row band — the header or the footer. - internal static MarkupControl Band(string line, string bg) => new(new List { line }) - { - BackgroundColor = new Color(bg), - HorizontalAlignment = HorizontalAlignment.Stretch, - }; + /// + /// A full-width one-row band — the header or the footer — in 's colours. + /// is a role, resolved with the line. + /// + internal static MarkupControl Band(string line, string bg, ScreenTheme scheme) => + new(new List { scheme.Paint(line, bg) }) + { + BackgroundColor = scheme.Colour(bg), + HorizontalAlignment = HorizontalAlignment.Stretch, + }; + + /// + /// A column of a renderer's lines, resolved for and drawn on + /// (a role: the backdrop unless the column sits on + /// a card). The one place a screen's markup becomes a control, so it is the one place it is themed. + /// + internal static MarkupControl Panel( + IEnumerable lines, ScreenTheme scheme, string plane = ScreenPalette.PanelBg) => + new(scheme.Lines(lines, plane)); /// /// How many rows a two-column screen's body has: everything but the header band and the action bar. @@ -730,6 +743,7 @@ internal static string Context(params string?[] parts) /// How wide the list column runs (see ). /// How many rows the taller of the two columns holds. /// How many rows the body has to spend, or 0 when the caller has no height. + /// The theme's palette, for the hairline. internal static IWindowControl Split( MarkupControl header, MarkupControl footer, @@ -737,13 +751,14 @@ internal static IWindowControl Split( MarkupControl right, int leftWidth, int content, - int rows) + int rows, + ScreenTheme scheme) { var body = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) .WithVerticalAlignment(VerticalAlignment.Fill) .Column(c => c.Width(leftWidth).Add(left)) - .Column(c => c.Width(1).Add(VerticalRule())) + .Column(c => c.Width(1).Add(VerticalRule(scheme))) .Column(c => c.Width(1).Add(Filler())) .Column(c => c.Flex(1).Add(right)) .Build(); @@ -785,14 +800,14 @@ internal static MarkupControl Stretch(MarkupControl control) /// to nothing and never paints its background, so the rule is an empty grid instead — a grid's /// background covers its whole arranged area, giving a full-height hairline. /// - internal static IWindowControl VerticalRule() + internal static IWindowControl VerticalRule(ScreenTheme scheme) { var rule = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) .WithVerticalAlignment(VerticalAlignment.Fill) .Column(c => c.Flex(1).Add(Filler())) .Build(); - rule.BackgroundColor = new Color(ScreenPalette.Rule); + rule.BackgroundColor = scheme.Colour(ScreenPalette.Rule); return rule; } diff --git a/src/SharpMUTerm.Tui/ScreenPalette.cs b/src/SharpMUTerm.Tui/ScreenPalette.cs index a9048656..6552b7cd 100644 --- a/src/SharpMUTerm.Tui/ScreenPalette.cs +++ b/src/SharpMUTerm.Tui/ScreenPalette.cs @@ -1,11 +1,17 @@ namespace SharpMUTerm.Tui; /// -/// The colours the full-screen settings screens (F2–F9) are built from. Renderers interpolate them -/// into markup tags; the views hand the same hexes to as control -/// backgrounds, so the bands a renderer writes text for and the panel a view paints agree by -/// construction. Screen files pull these in with -/// using static SharpMUTerm.Tui.ScreenPalette;. +/// The colour roles the full-screen settings screens (F1–F10) are built from, spelt as the Dark +/// theme's values. Renderers interpolate them into markup tags; the views resolve that markup, and the +/// control backgrounds, through a for the active theme — so the bands a renderer +/// writes text for and the panel a view paints agree by construction, on every theme. On Dark the two are +/// the same bytes. Screen files pull these in with using static SharpMUTerm.Tui.ScreenPalette;. +/// +/// A view must never hand one of these to a control directly (new Color(ScreenPalette.EditBg), or a +/// renderer's lines straight into a MarkupControl): that is a dark island on a light theme, defect +/// D6. , and +/// are the ways in. +/// /// internal static class ScreenPalette { diff --git a/src/SharpMUTerm.Tui/ScreenTheme.cs b/src/SharpMUTerm.Tui/ScreenTheme.cs new file mode 100644 index 00000000..f59b3200 --- /dev/null +++ b/src/SharpMUTerm.Tui/ScreenTheme.cs @@ -0,0 +1,404 @@ +using System.Globalization; +using System.Text; +using SharpConsoleUI; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; + +namespace SharpMUTerm.Tui; + +/// +/// The settings screens' palette resolved for one theme. names the roles — +/// panel, header, label, value, well, accent — and its constants are the Dark theme's values for them; +/// this is the same set of roles worked out for whatever theme is active, so a Light client gets light +/// screens rather than a dark island in the middle of a light workspace (defect D6). +/// +/// The renderers do not know about it, deliberately. They write markup in the role colours +/// ([{Label}]…, the constants), and the view resolves that markup +/// through an instance of this class at the one place it becomes a control (, , ). Threading a palette parameter through every +/// renderer would have touched every function on every screen and every test that calls one, for a +/// value only the last step needs; and a mutable would be global state the +/// parallel test suites race on. An instance is immutable, made once per app from the app's theme, and +/// handed to the views. +/// +/// +/// The Dark theme resolves to the constants byte for byte, so every Dark frame is exactly what +/// it was. Other themes keep the same relationships: a dark theme takes its background's hue +/// on the planes; a light one mirrors each role's lightness (CIE L*, so a step that read as one step +/// still does) and keeps its hue. Then every ink is held to on each plane +/// it is drawn on, the floor the workspace's chrome is held to. +/// +/// +internal sealed class ScreenTheme +{ + /// The palette the constants describe: the Dark theme's. + internal static readonly ScreenTheme Dark = new(Canonical()); + + private readonly IReadOnlyDictionary _roles; + + private ScreenTheme(IReadOnlyDictionary roles) + { + _roles = roles; + IsIdentity = roles.All(r => string.Equals(r.Key, r.Value, StringComparison.OrdinalIgnoreCase)); + } + + /// Whether every role resolves to its own constant (the Dark theme). + internal bool IsIdentity { get; } + + internal string Accent => Role(ScreenPalette.Accent); + + internal string PanelBg => Role(ScreenPalette.PanelBg); + + internal string PanelFg => Role(ScreenPalette.PanelFg); + + internal string HeaderBg => Role(ScreenPalette.HeaderBg); + + internal string FooterBg => Role(ScreenPalette.FooterBg); + + internal string EditBg => Role(ScreenPalette.EditBg); + + internal string Label => Role(ScreenPalette.Label); + + internal string Value => Role(ScreenPalette.Value); + + internal string Muted => Role(ScreenPalette.Muted); + + internal string Rule => Role(ScreenPalette.Rule); + + internal string CursorBg => Role(ScreenPalette.CursorBg); + + internal string Ink => Role(ScreenPalette.Ink); + + internal string MenuBg => Role(ScreenPalette.MenuBg); + + internal string MenuSelectedBg => Role(ScreenPalette.MenuSelectedBg); + + internal string MenuShadow => Role(ScreenPalette.MenuShadow); + + internal string FieldBg => Role(ScreenPalette.FieldBg); + + internal string Warn => Role(ScreenPalette.Warn); + + /// The planes text is drawn on — what an ink is measured against. + private static readonly string[] TextPlanes = + [ + ScreenPalette.PanelBg, ScreenPalette.HeaderBg, ScreenPalette.FooterBg, ScreenPalette.EditBg, + ScreenPalette.CursorBg, ScreenPalette.MenuBg, ScreenPalette.MenuSelectedBg, ScreenPalette.FieldBg, + ]; + + /// + /// Every plane role. is not among them: it is placed relative + /// to the others rather than mirrored, because a shadow is darker than what casts it on any theme. + /// + private static readonly string[] Planes = [.. TextPlanes, ScreenPalette.Rule]; + + /// The text roles, mirrored with the planes on a light theme and then held to the floor. + private static readonly string[] Inks = + [ScreenPalette.Label, ScreenPalette.Muted, ScreenPalette.PanelFg, ScreenPalette.Value]; + + /// The reference backgrounds the hue shift is measured from, one per side of mid-grey. + private static readonly Rgb DarkReference = new(0x1e, 0x1e, 0x1e); + + private static readonly Rgb LightReference = new(0xfa, 0xfa, 0xfa); + + /// The palette for . + internal static ScreenTheme For(Theme theme) + { + ArgumentNullException.ThrowIfNull(theme); + + var light = Contrast.RelativeLuminance(theme.Background) >= LightPlaneLuminance; + var shift = Delta(theme.Background, light ? LightReference : DarkReference); + var roles = new Dictionary(StringComparer.OrdinalIgnoreCase); + + foreach (var plane in Planes) + { + var rgb = Parse(plane); + roles[plane] = Add(light ? Mirror(rgb) : rgb, shift); + } + + // Darker than every plane on either kind of theme: the list's far edge reads as "under". + var lowest = Planes.Select(p => Lightness(roles[p])).Min(); + roles[ScreenPalette.MenuShadow] = light + ? Add(AtLightness(Parse(ScreenPalette.MenuShadow), lowest - ShadowStep), shift) + : Add(Parse(ScreenPalette.MenuShadow), shift); + + foreach (var ink in Inks) + { + var rgb = Parse(ink); + roles[ink] = Legible(light ? Mirror(rgb) : rgb, roles, PlanesUnder(ink)); + } + + // The accent and the warning keep their hue and are moved only as far as the floor asks; on a + // light theme that is a long way, which is the point. + roles[ScreenPalette.Accent] = Legible(Parse(ScreenPalette.Accent), roles); + roles[ScreenPalette.Warn] = Legible(Parse(ScreenPalette.Warn), roles); + + // Text printed on the accent: near-black on a bright accent, the panel's own tone on a dark one. + var accent = roles[ScreenPalette.Accent]; + var ink0 = Contrast.RelativeLuminance(accent) < LightPlaneLuminance ? roles[ScreenPalette.PanelBg] : Parse(ScreenPalette.Ink); + roles[ScreenPalette.Ink] = Contrast.Legible(ink0, accent); + + return new ScreenTheme(roles.ToDictionary(r => r.Key, r => r.Value.ToHex(), StringComparer.OrdinalIgnoreCase)); + } + + /// What a role constant resolves to here. A colour that is not a role is returned as given. + internal string Role(string constant) => _roles.TryGetValue(constant, out var hex) ? hex : constant; + + /// A role constant as a control colour. + internal Color Colour(string constant) => new(Role(constant)); + + /// + /// Colours a bordered modal's frame, title and unstyled text. The framework's defaults (a cyan title + /// and border, #eeeeee text) were chosen for a dark backdrop and fall to 1.4:1 on a light one, + /// so a theme that is not the constants' own draws them in its label and value inks; the Dark theme + /// keeps the framework's, unchanged. + /// + internal void Frame(Window window) + { + ArgumentNullException.ThrowIfNull(window); + if (IsIdentity) + { + return; + } + + window.ForegroundColor = Colour(ScreenPalette.Value); + window.ActiveTitleForegroundColor = Colour(ScreenPalette.Value); + window.InactiveTitleForegroundColor = Colour(ScreenPalette.Label); + window.ActiveBorderForegroundColor = Colour(ScreenPalette.Label); + window.InactiveBorderForegroundColor = Colour(ScreenPalette.Label); + } + + /// Every line of a renderer's markup resolved for this theme, on . + internal List Lines(IEnumerable lines, string plane = ScreenPalette.PanelBg) + { + ArgumentNullException.ThrowIfNull(lines); + return lines.Select(line => Paint(line, plane)).ToList(); + } + + /// + /// One line of a renderer's markup resolved for this theme. Role colours are swapped for this + /// theme's; any other foreground — a world's own accent, a highlight a rule names — is held to the + /// floor against the plane it lands on, which is the tag's own background, else the one it is nested + /// in, else (the control's). Escaped brackets and link targets are text and + /// are never read as colours. A run of blocks (█░▒▓) is a colour sample and keeps its colour, + /// even one that shares a role's hex, because what it shows is that colour. + /// + internal string Paint(string markup, string plane = ScreenPalette.PanelBg) + { + ArgumentNullException.ThrowIfNull(markup); + if (markup.IndexOf('[') < 0) + { + return markup; + } + + var output = new StringBuilder(markup.Length + 16); + var planes = new Stack(); + planes.Push(Role(plane)); + + var i = 0; + while (i < markup.Length) + { + var ch = markup[i]; + if ((ch == '[' || ch == ']') && i + 1 < markup.Length && markup[i + 1] == ch) + { + output.Append(ch).Append(ch); + i += 2; + continue; + } + + if (ch != '[') + { + output.Append(ch); + i++; + continue; + } + + var close = markup.IndexOf(']', i + 1); + if (close < 0) + { + output.Append(markup, i, markup.Length - i); + break; + } + + var tag = markup.Substring(i + 1, close - i - 1); + if (tag == "/") + { + if (planes.Count > 1) + { + planes.Pop(); + } + + output.Append("[/]"); + } + else + { + output.Append('[').Append(Tag(tag, planes, Sample(markup, close + 1))).Append(']'); + } + + i = close + 1; + } + + return output.ToString(); + } + + /// One opening tag, resolved; pushes the plane its content is drawn on. + private string Tag(string tag, Stack planes, bool sample) + { + if (tag.StartsWith("link=", StringComparison.OrdinalIgnoreCase)) + { + planes.Push(planes.Peek()); + return tag; + } + + var words = tag.Split(' '); + string? background = null; + var foreground = -1; + for (var w = 0; w < words.Length; w++) + { + if (words[w] == "on" && w + 1 < words.Length && IsHex(words[w + 1])) + { + words[w + 1] = Role(words[w + 1]); + background = words[w + 1]; + w++; + } + else if (IsHex(words[w]) && foreground < 0) + { + foreground = w; + } + } + + var plane = background ?? planes.Peek(); + if (foreground >= 0) + { + var given = words[foreground]; + if (sample) + { + // A colour sample is the colour it samples — F2's swatch of a highlight that happens to be + // the accent's hex must not turn into this theme's accent. The one role a sample is drawn + // in is the hairline (an unset swatch's hatching), and that follows the theme. + words[foreground] = string.Equals(given, ScreenPalette.Rule, StringComparison.OrdinalIgnoreCase) + ? Role(given) + : given; + } + else if (_roles.ContainsKey(given)) + { + words[foreground] = Role(given); + } + else if (!IsIdentity) + { + // Not a role: a colour the screen was handed. Hold it to the floor where it lands. + words[foreground] = Contrast.Legible(Parse(given), Parse(plane)).ToHex(); + } + } + + planes.Push(plane); + return string.Join(' ', words); + } + + /// Whether the text a tag opens on is a colour sample — blocks only, up to the next tag. + private static bool Sample(string markup, int start) + { + var any = false; + for (var i = start; i < markup.Length && markup[i] != '['; i++) + { + if (markup[i] is not ('█' or '░' or '▒' or '▓')) + { + return false; + } + + any = true; + } + + return any; + } + + private static bool IsHex(string word) => + word.Length == 7 && word[0] == '#' && word.Skip(1).All(Uri.IsHexDigit); + + private static Rgb Parse(string hex) => new( + byte.Parse(hex.AsSpan(1, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture), + byte.Parse(hex.AsSpan(3, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture), + byte.Parse(hex.AsSpan(5, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture)); + + private static IReadOnlyDictionary Canonical() => + new[] + { + ScreenPalette.Accent, ScreenPalette.PanelBg, ScreenPalette.PanelFg, ScreenPalette.HeaderBg, + ScreenPalette.FooterBg, ScreenPalette.EditBg, ScreenPalette.Label, ScreenPalette.Value, + ScreenPalette.Muted, ScreenPalette.Rule, ScreenPalette.CursorBg, ScreenPalette.Ink, + ScreenPalette.MenuBg, ScreenPalette.MenuSelectedBg, ScreenPalette.MenuShadow, ScreenPalette.FieldBg, + ScreenPalette.Warn, + }.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(h => h, h => h, StringComparer.OrdinalIgnoreCase); + + /// + /// The planes an ink is drawn on. Every plane text is drawn on, except that a label never sits on the + /// menu's selected candidate — the candidate the buffer names is drawn in the value ink, and the rest of + /// the list in labels on the menu's own plane — so a label is not dragged toward a plane it never meets. + /// + internal static IReadOnlyList PlanesUnder(string ink) => + string.Equals(ink, ScreenPalette.Label, StringComparison.OrdinalIgnoreCase) + ? TextPlanes.Where(p => p != ScreenPalette.MenuSelectedBg).ToArray() + : TextPlanes; + + /// An ink moved, if it must be, until it clears the floor on every plane it is drawn on. + private static Rgb Legible(Rgb ink, IReadOnlyDictionary roles, IReadOnlyList? planes = null) + { + // Every plane is on one side of mid-grey, so the plane nearest the ink is the hardest and clearing + // it clears the rest; two passes absorb the rounding of the first. + for (var pass = 0; pass < 2; pass++) + { + foreach (var plane in planes ?? TextPlanes) + { + ink = Contrast.Legible(ink, roles[plane]); + } + } + + return ink; + } + + /// How far below the darkest plane a light theme's menu shadow sits, in L*. + private const double ShadowStep = 16; + + private const double LightPlaneLuminance = 0.18; + + /// + /// A dark role on a light theme: the same colour at the mirrored lightness (100 − L*), keeping the + /// tint it carried (its distance from the grey of its own luminance). + /// + private static Rgb Mirror(Rgb rgb) => AtLightness(rgb, 100 - Lightness(rgb)); + + /// The colour's tint laid over the grey at (L*). + private static Rgb AtLightness(Rgb rgb, double lightness) + { + var own = Grey(Contrast.RelativeLuminance(rgb)); + var grey = Grey(FromLightness(Math.Clamp(lightness, 0, 100))); + return new Rgb( + Channel(grey + (rgb.R - own)), + Channel(grey + (rgb.G - own)), + Channel(grey + (rgb.B - own))); + } + + /// CIE L* of a colour's relative luminance. + private static double Lightness(Rgb rgb) + { + var y = Contrast.RelativeLuminance(rgb); + return y > 216.0 / 24389 ? (116 * Math.Cbrt(y)) - 16 : y * 24389 / 27; + } + + private static double FromLightness(double lightness) => + lightness > 8 ? Math.Pow((lightness + 16) / 116, 3) : lightness * 27 / 24389; + + /// The sRGB byte of the neutral grey with relative luminance . + private static double Grey(double y) + { + var v = y <= 0.0031308 ? 12.92 * y : (1.055 * Math.Pow(y, 1 / 2.4)) - 0.055; + return v * 255; + } + + private static (int R, int G, int B) Delta(Rgb a, Rgb b) => (a.R - b.R, a.G - b.G, a.B - b.B); + + private static Rgb Add(Rgb rgb, (int R, int G, int B) d) => + new(Channel(rgb.R + d.R), Channel(rgb.G + d.G), Channel(rgb.B + d.B)); + + private static byte Channel(double value) => (byte)Math.Clamp(Math.Round(value), 0, 255); +} diff --git a/src/SharpMUTerm.Tui/SettingsOverlay.cs b/src/SharpMUTerm.Tui/SettingsOverlay.cs index 7139d948..e83004f5 100644 --- a/src/SharpMUTerm.Tui/SettingsOverlay.cs +++ b/src/SharpMUTerm.Tui/SettingsOverlay.cs @@ -54,12 +54,19 @@ internal sealed class SettingsOverlay /// writes the configuration out as it accepts one, so there is no moment on /// the way out at which the host would have anything left to save. See . /// - public SettingsOverlay(ConsoleWindowSystem system) + public SettingsOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) { _system = system; - _review = new EditReviewOverlay(system); + Scheme = scheme ?? ScreenTheme.Dark; + _review = new EditReviewOverlay(system, Scheme); } + /// + /// The palette the screens are painted in — the app's theme, resolved once. The window's own + /// backdrop is painted from it here; each screen's view paints its panels from the same instance. + /// + internal ScreenTheme Scheme { get; } + /// The F-key of the currently open screen, or null when closed. public ConsoleKey? OpenKey => _window is null ? null : _openKey; @@ -149,7 +156,7 @@ private void Open(ConsoleKey key, ScreenBinding binding) .AsModal() .Maximized() .Frameless() - .WithColors(new Color(PanelFg), new Color(PanelBg)) + .WithColors(Scheme.Colour(PanelFg), Scheme.Colour(PanelBg)) .AddControl(binding.Control()) .OnClosed((_, _) => Reset()) .Build(); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 8c187c52..e6ee1695 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -52,6 +52,13 @@ internal sealed partial class SharpMUTermApp : IAsyncDisposable private readonly TerminalCapabilities _capabilities; private readonly Theme _theme; + /// + /// The settings screens' palette, resolved from once (). + /// Handed to every surface built from 's roles — F1–F10, the deletion review + /// and the package and send lists — so they follow a Light theme instead of staying dark. + /// + private readonly ScreenTheme _screens; + /// /// The colours this client paints in its own voice, resolved from and held to /// the legibility floor against the plane they land on — see . They were @@ -895,10 +902,11 @@ public SharpMUTermApp( _palette = new CommandPalette(_system, BuildCatalog, () => _active?.SessionKey, id => DispatchCommand(id)); _messageLog = new MessageLogOverlay(_system, _diagnostics); _gameData = new GameDataOverlay(_system, _time); - _settings = new SettingsOverlay(_system); - _composer = new ComposeOverlay(_system, _spelling); - _packageView = new ListOverlay(_system); - _sendMenu = new ListOverlay(_system); + _screens = ScreenTheme.For(_theme); + _settings = new SettingsOverlay(_system, _screens); + _composer = new ComposeOverlay(_system, _spelling, _screens); + _packageView = new ListOverlay(_system, _screens); + _sendMenu = new ListOverlay(_system, _screens); _composer.Send += (_, result) => SendComposed(result); _composer.Closed += (_, result) => KeepComposeDraft(result); _quit = new QuitOverlay(_system, QuitFactsNow, Quit); @@ -7049,6 +7057,7 @@ private ScreenBinding MsspScreen(WorldDefinition world) observation, _time.GetUtcNow(), _system.DesktopDimensions.Width, + _screens, session.Focus(), _system.DesktopDimensions.Height)); } @@ -7095,6 +7104,7 @@ private ScreenBinding WorldsScreen(string fkey, bool onCharacters) session.Selection.SelectionIn(WorldsScreenRenderer.WorldsPane), session.Selection.SelectionIn(WorldsScreenRenderer.CharactersPane), _system.DesktopDimensions.Width, + _screens, session.Focus(), fkey, session.Selection.SelectionIn(WorldsScreenRenderer.TriggerSetsPane), @@ -7119,6 +7129,7 @@ private ScreenBinding TriggersScreen() session.Selection.SelectionIn(0), RouteTargets(), _system.DesktopDimensions.Width, + _screens, session.Focus(), _system.DesktopDimensions.Height, _theme)); @@ -7135,6 +7146,7 @@ private ScreenBinding AliasesScreen() _config.TriggerSets, session.Selection.SelectionIn(0), _system.DesktopDimensions.Width, + _screens, session.Focus(), _system.DesktopDimensions.Height)); } @@ -7155,6 +7167,7 @@ private ScreenBinding KeypadScreen() _config.TriggerSets, session.Selection.SelectionIn(0), _system.DesktopDimensions.Width, + _screens, session.Focus(), _system.DesktopDimensions.Height)); } @@ -7170,6 +7183,7 @@ private ScreenBinding TimersScreen() _config.TriggerSets, session.Selection.SelectionIn(0), _system.DesktopDimensions.Width, + _screens, session.Focus(), _system.DesktopDimensions.Height)); } @@ -7191,7 +7205,7 @@ private ScreenBinding OptionsScreen(Func sc { var session = new SettingsSession(_ => OptionsScreenRenderer.Model(screen()), SaveConfiguration); return new ScreenBinding(session, () => OptionsScreenView.Build( - screen(), _system.DesktopDimensions.Width, session.Focus())); + screen(), _system.DesktopDimensions.Width, _screens, session.Focus())); } /// The --view suffix that opens a settings screen with a field being typed into. diff --git a/src/SharpMUTerm.Tui/SpellingHighlighter.cs b/src/SharpMUTerm.Tui/SpellingHighlighter.cs index ed160a96..17781781 100644 --- a/src/SharpMUTerm.Tui/SpellingHighlighter.cs +++ b/src/SharpMUTerm.Tui/SpellingHighlighter.cs @@ -10,12 +10,11 @@ namespace SharpMUTerm.Tui; /// /// A colour and not an underline: the hook carries a foreground and nothing else, and an underline needs a /// styling hook in upstream. on -/// is the pair the settings screens already use for a refused value. +/// is the pair the settings screens already use for a refused value; +/// is that warning resolved for the app's theme (). /// -internal sealed class SpellingHighlighter(SpellChecker checker) : ISyntaxHighlighter +internal sealed class SpellingHighlighter(SpellChecker checker, Color marked) : ISyntaxHighlighter { - private static readonly Color Marked = new(ScreenPalette.Warn); - public (IReadOnlyList Tokens, SyntaxLineState EndState) Tokenize(string line, int lineIndex, SyntaxLineState startState) => - (checker.Misspellings(line).Select(m => new SyntaxToken(m.Start, m.Length, Marked)).ToArray(), startState); + (checker.Misspellings(line).Select(m => new SyntaxToken(m.Start, m.Length, marked)).ToArray(), startState); } diff --git a/src/SharpMUTerm.Tui/TimersScreenView.cs b/src/SharpMUTerm.Tui/TimersScreenView.cs index d6f1cbe8..8d682c80 100644 --- a/src/SharpMUTerm.Tui/TimersScreenView.cs +++ b/src/SharpMUTerm.Tui/TimersScreenView.cs @@ -15,13 +15,13 @@ namespace SharpMUTerm.Tui; internal static class TimersScreenView { public static IWindowControl Build( - IReadOnlyList sets, int selected, int width, ScreenFocus? focus = null, int height = 0) + IReadOnlyList sets, int selected, int width, ScreenTheme scheme, ScreenFocus? focus = null, int height = 0) { var header = ScreenChrome.Band( TimersScreenRenderer.HeaderLine(width, TimersScreenRenderer.Model(sets, selected), focus), - ScreenPalette.HeaderBg); + ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( - TimersScreenRenderer.FooterLine(sets, selected, width, focus), ScreenPalette.FooterBg); + TimersScreenRenderer.FooterLine(sets, selected, width, focus), ScreenPalette.FooterBg, scheme); var list = ScreenChrome.SplitWidth( width, @@ -33,10 +33,10 @@ public static IWindowControl Build( var right = TimersScreenRenderer.EditorColumn( sets, selected, focus, width <= 0 ? list : width - list - ScreenChrome.ColumnDivider, rows); - var listCol = ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(left, rows))); + var listCol = ScreenChrome.Stretch(ScreenChrome.Panel(ScreenChrome.Window(left, rows), scheme)); var editorCol = ScreenChrome.Stretch( - new MarkupControl(ScreenChrome.Indent(ScreenChrome.Window(right, rows)))); + ScreenChrome.Panel(ScreenChrome.Indent(ScreenChrome.Window(right, rows)), scheme)); return ScreenChrome.Split( - header, footer, listCol, editorCol, list, Math.Max(left.Count, right.Count), rows); + header, footer, listCol, editorCol, list, Math.Max(left.Count, right.Count), rows, scheme); } } diff --git a/src/SharpMUTerm.Tui/TriggersScreenView.cs b/src/SharpMUTerm.Tui/TriggersScreenView.cs index 14e3871c..666dbe91 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenView.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenView.cs @@ -21,6 +21,7 @@ public static IWindowControl Build( int selectedTrigger, IReadOnlyList routeTargets, int width, + ScreenTheme scheme, ScreenFocus? focus = null, int height = 0, Theme? theme = null) @@ -28,9 +29,9 @@ public static IWindowControl Build( var header = ScreenChrome.Band( TriggersScreenRenderer.HeaderLine( width, TriggersScreenRenderer.Model(sets, selectedTrigger, routeTargets), focus), - ScreenPalette.HeaderBg); + ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( - TriggersScreenRenderer.FooterLine(sets, selectedTrigger, width, focus), ScreenPalette.FooterBg); + TriggersScreenRenderer.FooterLine(sets, selectedTrigger, width, focus), ScreenPalette.FooterBg, scheme); // Body: rule list │ editor, as two real columns. The split is a function of the screen's width: // at 120 the rule list keeps the share it was designed with, and at 100 it gives cells back to @@ -46,9 +47,9 @@ public static IWindowControl Build( sets, selectedTrigger, routeTargets, focus, width <= 0 ? rules : width - rules - ScreenChrome.ColumnDivider, body, theme); - var rulesCol = ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(left, body))); - var editorCol = ScreenChrome.Stretch(new MarkupControl( - ScreenChrome.Indent(ScreenChrome.Window(right, body)))); - return ScreenChrome.Split(header, footer, rulesCol, editorCol, rules, Math.Max(left.Count, right.Count), body); + var rulesCol = ScreenChrome.Stretch(ScreenChrome.Panel(ScreenChrome.Window(left, body), scheme)); + var editorCol = ScreenChrome.Stretch(ScreenChrome.Panel( + ScreenChrome.Indent(ScreenChrome.Window(right, body)), scheme)); + return ScreenChrome.Split(header, footer, rulesCol, editorCol, rules, Math.Max(left.Count, right.Count), body, scheme); } } diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index de6c0404..de1ec5fb 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -156,19 +156,30 @@ private static Rgb Tinted(Rgb plane, PaneTint tint, double depth) /// plane it is going onto, so what is fixed here is hue and saturation. Ten, spread around the wheel, /// so two characters' colours are recognised rather than compared; saturated, because chroma is /// bounded by luminance and these are re-lit onto a dark plane. + /// + /// Picked for colour-blind readers as well (TintColourVisionTests): searched, within + /// 40° of each name's hue, for the set whose closest pair — among the ten and the untinted plane, on + /// all three themes — is furthest apart under simulated protanopia, deuteranopia and tritanopia, + /// without the closest pair for typical vision getting any closer and without the light theme's planes + /// leaving pastel. Worst pair, CIEDE2000: 2.05 protan, 2.22 deutan, 2.00 tritan on Dark (were 1.74, + /// 0.28, 0.83), 1.99 deutan on Solarized Dark; typical vision 3.96 (was 3.71). That is "two panes side + /// by side differ", not "a pane is recognised alone": ten planes at one luminance near L* 7 cannot be, + /// for a dichromat — the best found with the names ignored was about 2.2 — which is why a tinted + /// character's rail row and tab say the colour by name. + /// /// private static Rgb? Anchor(PaneTint tint) => tint switch { - PaneTint.Slate => new Rgb(0x1e, 0x5c, 0xe0), - PaneTint.Teal => new Rgb(0x00, 0xa0, 0x94), - PaneTint.Moss => new Rgb(0x3f, 0xa8, 0x18), - PaneTint.Ochre => new Rgb(0xd4, 0x96, 0x00), - PaneTint.Ember => new Rgb(0xd8, 0x33, 0x1c), - PaneTint.Plum => new Rgb(0xb0, 0x2c, 0xd4), - PaneTint.Indigo => new Rgb(0x5a, 0x3c, 0xf0), - PaneTint.Azure => new Rgb(0x00, 0x90, 0xd8), - PaneTint.Jade => new Rgb(0x00, 0xb0, 0x60), - PaneTint.Rose => new Rgb(0xe0, 0x30, 0x7a), + PaneTint.Slate => new Rgb(0x17, 0x57, 0xe0), + PaneTint.Teal => new Rgb(0x2e, 0xa0, 0x7f), + PaneTint.Moss => new Rgb(0x48, 0xa8, 0x30), + PaneTint.Ochre => new Rgb(0xa1, 0x32, 0x00), + PaneTint.Ember => new Rgb(0xd8, 0x00, 0x18), + PaneTint.Plum => new Rgb(0x60, 0x2f, 0xa1), + PaneTint.Indigo => new Rgb(0x40, 0x40, 0xff), + PaneTint.Azure => new Rgb(0x00, 0x89, 0xce), + PaneTint.Jade => new Rgb(0x07, 0xb0, 0x6e), + PaneTint.Rose => new Rgb(0xc6, 0x17, 0x84), _ => null, }; diff --git a/src/SharpMUTerm.Tui/WorldsScreenView.cs b/src/SharpMUTerm.Tui/WorldsScreenView.cs index 508c3823..10221711 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenView.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenView.cs @@ -22,6 +22,7 @@ public static IWindowControl Build( int selectedWorld, int selectedCharacter, int width, + ScreenTheme scheme, ScreenFocus? focus = null, string fkey = WorldsScreenRenderer.FKey, int selectedSet = 0, @@ -39,10 +40,10 @@ public static IWindowControl Build( var model = WorldsScreenRenderer.Model( worlds, triggerSets, selectedWorld, selectedCharacter, selectedSet, info ? _ => { } : null); var header = ScreenChrome.Band( - WorldsScreenRenderer.HeaderLine(width, model, focus, fkey), ScreenPalette.HeaderBg); + WorldsScreenRenderer.HeaderLine(width, model, focus, fkey), ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( WorldsScreenRenderer.FooterLine(worlds, selectedWorld, selectedCharacter, accent, width, focus), - ScreenPalette.FooterBg); + ScreenPalette.FooterBg, scheme); // How many rows the WORLDS/detail body has once the header, the character band, the gap under // it and the action bar have taken theirs. The detail column is built against that number, so a @@ -62,17 +63,17 @@ public static IWindowControl Build( var rows = height <= 0 ? 0 : Math.Max(1, height - 1 - band); // Body: WORLDS list │ detail, as two real columns. - var worldsCol = ScreenChrome.Stretch(new MarkupControl( - WorldsScreenRenderer.WorldsColumn(worlds, selectedWorld, focus, rows, info).ToList())); - var detailCol = ScreenChrome.Stretch(new MarkupControl( + var worldsCol = ScreenChrome.Stretch(ScreenChrome.Panel( + WorldsScreenRenderer.WorldsColumn(worlds, selectedWorld, focus, rows, info), scheme)); + var detailCol = ScreenChrome.Stretch(ScreenChrome.Panel( WorldsScreenRenderer - .DetailColumn(worlds, triggerSets, selectedWorld, selectedCharacter, accent, focus, rows) - .ToList())); + .DetailColumn(worlds, triggerSets, selectedWorld, selectedCharacter, accent, focus, rows), + scheme)); var body = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) .WithVerticalAlignment(VerticalAlignment.Fill) .Column(c => c.Width(30).Add(worldsCol)) - .Column(c => c.Width(1).Add(ScreenChrome.VerticalRule())) + .Column(c => c.Width(1).Add(ScreenChrome.VerticalRule(scheme))) .Column(c => c.Width(1).Add(ScreenChrome.Filler())) .Column(c => c.Flex(1).Add(detailCol)) .Build(); @@ -94,11 +95,10 @@ public static IWindowControl Build( // block sits on the right while its checkboxes stay left-aligned (an Auto column hugs it, not // per-row right-justify, which would ragged the left edge). The edit grid's own background // gives the full-width elevated band behind both. - var formPanel = new MarkupControl(ScreenChrome.Indent(form)) - { - HorizontalAlignment = HorizontalAlignment.Left, - }; - var trigPanel = new MarkupControl(triggers) { HorizontalAlignment = HorizontalAlignment.Left }; + var formPanel = ScreenChrome.Panel(ScreenChrome.Indent(form), scheme, ScreenPalette.EditBg); + formPanel.HorizontalAlignment = HorizontalAlignment.Left; + var trigPanel = ScreenChrome.Panel(triggers, scheme, ScreenPalette.EditBg); + trigPanel.HorizontalAlignment = HorizontalAlignment.Left; var edit = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) .WithVerticalAlignment(VerticalAlignment.Fill) @@ -107,7 +107,7 @@ public static IWindowControl Build( .Column(c => c.Add(trigPanel)) .Column(c => c.Width(2).Add(ScreenChrome.Filler())) .Build(); - edit.BackgroundColor = new Color(ScreenPalette.EditBg); + edit.BackgroundColor = scheme.Colour(ScreenPalette.EditBg); // A one-row panel-background gap sits between the editing pane and the footer so the footer // reads as a separate bar, not the last row of the character setup section. diff --git a/tests/SharpMUTerm.Core.Tests/Text/ColourVisionTests.cs b/tests/SharpMUTerm.Core.Tests/Text/ColourVisionTests.cs new file mode 100644 index 00000000..be3a6ad7 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Text/ColourVisionTests.cs @@ -0,0 +1,70 @@ +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Tests.Text; + +/// +/// The colour-vision simulation the pane tints are measured with. What is pinned is that it is the model it +/// says it is: the confusions each deficiency is known for collapse, the ones it is not known for do not, +/// and the distance is a distance. +/// +public class ColourVisionTests +{ + private static readonly Rgb Red = new(0xd0, 0x30, 0x30); + private static readonly Rgb Green = new(0x50, 0x90, 0x20); + private static readonly Rgb Blue = new(0x20, 0x40, 0xd0); + + [Test] + public async Task BlackAndWhiteAreAHundredApart() + { + await Assert.That(ColourVision.Distance(new Rgb(0, 0, 0), new Rgb(0xff, 0xff, 0xff))).IsEqualTo(100.0).Within(0.01); + } + + [Test] + [Arguments(ColourDeficiency.None)] + [Arguments(ColourDeficiency.Protanopia)] + [Arguments(ColourDeficiency.Deuteranopia)] + [Arguments(ColourDeficiency.Tritanopia)] + public async Task ADistanceIsZeroToItselfAndTheSameBothWays(ColourDeficiency deficiency) + { + await Assert.That(ColourVision.Distance(Red, Red, deficiency)).IsEqualTo(0.0); + await Assert.That(ColourVision.Distance(Red, Blue, deficiency)) + .IsEqualTo(ColourVision.Distance(Blue, Red, deficiency)).Within(1e-9); + } + + /// + /// Greys are untouched by every matrix — each row of Machado's matrices sums to one — so the simulation + /// moves hue and never lightness of a neutral. + /// + [Test] + [Arguments(ColourDeficiency.Protanopia)] + [Arguments(ColourDeficiency.Deuteranopia)] + [Arguments(ColourDeficiency.Tritanopia)] + public async Task AGreyLooksTheSameToEveryone(ColourDeficiency deficiency) + { + var grey = new Rgb(0x77, 0x77, 0x77); + await Assert.That(ColourVision.Distance(grey, ColourVision.Simulate(grey, deficiency))).IsLessThan(0.5); + } + + /// Red against green is the confusion protanopia and deuteranopia are named for. + [Test] + [Arguments(ColourDeficiency.Protanopia)] + [Arguments(ColourDeficiency.Deuteranopia)] + public async Task RedAndGreenCloseUpForTheRedGreenDeficiencies(ColourDeficiency deficiency) + { + var typical = ColourVision.Distance(Red, Green); + await Assert.That(ColourVision.Distance(Red, Green, deficiency)).IsLessThan(typical / 2); + } + + /// And tritanopia keeps it — its confusion is blue against green, not red against green. + [Test] + public async Task TritanopiaKeepsRedAndGreenApartAndClosesBlueOnGreen() + { + await Assert.That(ColourVision.Distance(Red, Green, ColourDeficiency.Tritanopia)) + .IsGreaterThan(ColourVision.Distance(Red, Green) / 2); + + var cyan = new Rgb(0x20, 0x90, 0xa0); + var green = new Rgb(0x30, 0xa0, 0x40); + await Assert.That(ColourVision.Distance(cyan, green, ColourDeficiency.Tritanopia)) + .IsLessThan(ColourVision.Distance(cyan, green) / 2); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index bd4847c3..44ac8df5 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -55,6 +55,12 @@ public class FrameContrastTests // The package surfaces are a modal of their own, with a warning ink on the review. "packages", "package-review", "package-browse", "send-menu", + // The settings screens follow the theme (ScreenTheme), so each kind of screen is walked on all + // three: a list-and-editor screen, an options card, a field mid-edit with its caret and its + // candidate list, a password, and the deletion review that follows a screen out. + "aliases", "timers", "textansi", "input", "set", "password", "deletions", "route", "triggers-edit", + "keypad-edit", "worlds-edit", "mssp-none", "compose-literal", + // The prompt row is the only thing this client paints outside a pane that carries the // *game's* colours rather than its own, so the floor is applied against the idle input band // instead of the reading plane. A band nothing renders in a test is a band nobody checks. @@ -78,8 +84,8 @@ public async Task NoPaintedTextIsBelowTheLegibilityFloor((string Theme, string V // FrameGrid's own remarks warn about ("quietly green on a frame it has misread"), and it is // precisely what a floor assertion cannot notice, so it is asserted separately. // - // Counted in *cells* rather than in distinct pairs: a settings screen is painted from the fixed - // ScreenPalette and is legitimately down to four colour pairs (F1's composer), while the + // Counted in *cells* rather than in distinct pairs: a settings screen is painted from the theme's + // ScreenTheme and is legitimately down to four colour pairs (F1's composer), while the // thinnest real frame here still paints 201 glyphs. A pair-count floor would be policing how // colourful a view is, which is not what this is for. var painted = pairs.Values.Sum(); diff --git a/tests/SharpMUTerm.Tui.Tests/PointerTests.cs b/tests/SharpMUTerm.Tui.Tests/PointerTests.cs index 7ba12e8b..7e2dac9a 100644 --- a/tests/SharpMUTerm.Tui.Tests/PointerTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PointerTests.cs @@ -182,6 +182,21 @@ public async Task TabsRailRowsAndTheCommandLineAreFound() await Assert.That(kinds.Any(t => t.Kind == PointerKind.Output && t.Shape == PointerShape.Text)).IsTrue(); } + /// + /// A tinted character's rail row and tab say the pane colour by name — the cue that survives a + /// reader who cannot tell the ten hues apart, in the one place it costs no cell. An untinted character's + /// rows say nothing about colour. + /// + [Test] + public async Task ATintedCharactersRowsNameThePaneColour() + { + var (app, _) = App("tint-tabs"); + var targets = Scan(app).Select(hit => hit.Target).Where(t => t.Tooltip is not null).ToArray(); + + await Assert.That(targets.Any(t => t.Kind == PointerKind.RailRow && t.Tooltip!.Contains("pane colour: "))).IsTrue(); + await Assert.That(targets.Any(t => t.Kind == PointerKind.Tab && t.Tooltip!.Contains("pane colour: "))).IsTrue(); + } + [Test] public async Task ARightClickOnADividerOrAPaneAsksTheHostForAMenu() { diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs new file mode 100644 index 00000000..d7747a68 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs @@ -0,0 +1,172 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The settings screens follow the theme (defect D6). 's constants are the Dark +/// theme's; works the same roles out for the active theme, and the views resolve +/// their renderers' markup through it. Pinned here: Dark is untouched, every theme's inks clear the floor +/// on every plane they are drawn on, the resolver rewrites only colours, and a Light frame is light. +/// holds the painted pairs of every settings view to the floor on all three. +/// +[NotInParallel] +public class ScreenThemeTests +{ + private static readonly string[] Roles = + [ + ScreenPalette.Accent, ScreenPalette.PanelBg, ScreenPalette.PanelFg, ScreenPalette.HeaderBg, + ScreenPalette.FooterBg, ScreenPalette.EditBg, ScreenPalette.Label, ScreenPalette.Value, ScreenPalette.Muted, + ScreenPalette.Rule, ScreenPalette.CursorBg, ScreenPalette.Ink, ScreenPalette.MenuBg, + ScreenPalette.MenuSelectedBg, ScreenPalette.MenuShadow, ScreenPalette.FieldBg, ScreenPalette.Warn, + ]; + + private static readonly string[] TextPlanes = + [ + ScreenPalette.PanelBg, ScreenPalette.HeaderBg, ScreenPalette.FooterBg, ScreenPalette.EditBg, + ScreenPalette.CursorBg, ScreenPalette.MenuBg, ScreenPalette.MenuSelectedBg, ScreenPalette.FieldBg, + ]; + + private static readonly string[] Planes = [.. TextPlanes, ScreenPalette.Rule, ScreenPalette.MenuShadow]; + + private static Rgb Rgb(string hex) => new( + Convert.ToByte(hex.Substring(1, 2), 16), Convert.ToByte(hex.Substring(3, 2), 16), Convert.ToByte(hex.Substring(5, 2), 16)); + + /// Every Dark frame is what it was: the Dark theme resolves each role to its own constant. + [Test] + public async Task TheDarkThemeIsTheConstantsByteForByte() + { + var scheme = ScreenTheme.For(ThemeLibrary.Get("Dark")); + + foreach (var role in Roles) + { + await Assert.That(scheme.Role(role)).IsEqualTo(role); + } + + await Assert.That(scheme.IsIdentity).IsTrue(); + } + + /// + /// The text inks — label, muted readout, value, the panel's own text, the accent and the warning — clear + /// on every plane text is drawn on, on every theme; and the ink printed on the + /// accent clears it on the accent. + /// + [Test] + [Arguments("Dark")] + [Arguments("Light")] + [Arguments("Solarized Dark")] + public async Task EveryInkClearsTheFloorOnEveryPlane(string themeName) + { + var scheme = ScreenTheme.For(ThemeLibrary.Get(themeName)); + string[] inks = [ScreenPalette.Label, ScreenPalette.Muted, ScreenPalette.Value, ScreenPalette.PanelFg, ScreenPalette.Warn]; + + foreach (var ink in inks) + { + foreach (var plane in ScreenTheme.PlanesUnder(ink)) + { + await Assert.That(Contrast.Ratio(Rgb(scheme.Role(ink)), Rgb(scheme.Role(plane)))) + .IsGreaterThanOrEqualTo(Contrast.Floor) + .Because($"{ink} on {plane} on {themeName}"); + } + } + + // The accent is text too — hints, checkmarks, the selected candidate's marker — on any of them. + foreach (var plane in TextPlanes) + { + await Assert.That(Contrast.Ratio(Rgb(scheme.Accent), Rgb(scheme.Role(plane)))) + .IsGreaterThanOrEqualTo(Contrast.Floor).Because($"accent on {plane} on {themeName}"); + } + + await Assert.That(Contrast.Ratio(Rgb(scheme.Ink), Rgb(scheme.Accent))) + .IsGreaterThanOrEqualTo(Contrast.Floor).Because($"ink on the accent on {themeName}"); + } + + /// + /// A light theme's screens are light: every plane is on the light side of mid-grey, and the text that + /// was light on the dark screens is dark. And the relationships survive — the label is quieter than the + /// value, and the menu's shadow is darker than every plane it falls on. + /// + [Test] + public async Task ALightThemeGetsLightScreensWithTheSameRelationships() + { + var scheme = ScreenTheme.For(ThemeLibrary.Get("Light")); + + foreach (var plane in TextPlanes) + { + await Assert.That(Contrast.RelativeLuminance(Rgb(scheme.Role(plane)))).IsGreaterThan(0.18).Because(plane); + } + + await Assert.That(Contrast.RelativeLuminance(Rgb(scheme.Value))).IsLessThan(0.05); + await Assert.That(Contrast.Ratio(Rgb(scheme.Value), Rgb(scheme.PanelBg))) + .IsGreaterThan(Contrast.Ratio(Rgb(scheme.Label), Rgb(scheme.PanelBg))); + + var shadow = Contrast.RelativeLuminance(Rgb(scheme.MenuShadow)); + foreach (var plane in Planes.Where(p => p != ScreenPalette.MenuShadow)) + { + await Assert.That(shadow).IsLessThan(Contrast.RelativeLuminance(Rgb(scheme.Role(plane)))).Because(plane); + } + } + + /// + /// The resolver swaps colours and nothing else: escaped brackets stay text, a link's target is never read + /// as a colour, a colour sample keeps the colour it samples even when it shares a role's hex, and a colour + /// that is not a role is held to the floor against the plane it lands on. + /// + [Test] + public async Task PaintingRewritesColoursAndLeavesTextAlone() + { + var scheme = ScreenTheme.For(ThemeLibrary.Get("Light")); + + await Assert.That(scheme.Paint($"[[{ScreenPalette.Label}]] [{ScreenPalette.Label}]x[/]")) + .IsEqualTo($"[[{ScreenPalette.Label}]] [{scheme.Label}]x[/]"); + await Assert.That(scheme.Paint($"[link=mux:send:{ScreenPalette.Value}]go[/]")) + .IsEqualTo($"[link=mux:send:{ScreenPalette.Value}]go[/]"); + await Assert.That(scheme.Paint($"[{ScreenPalette.Accent}]████[/]")) + .IsEqualTo($"[{ScreenPalette.Accent}]████[/]"); + await Assert.That(scheme.Paint($"[{ScreenPalette.Ink} on {ScreenPalette.Accent}] ⏎ [/]")) + .IsEqualTo($"[{scheme.Ink} on {scheme.Accent}] ⏎ [/]"); + + // A world's own bright accent, which was legible on the dark backdrop, is darkened onto the light one. + var painted = scheme.Paint("[bold #66ffcc]Aetherfall[/]"); + var hex = painted.Substring("[bold ".Length, 7); + await Assert.That(Contrast.Ratio(Rgb(hex), Rgb(scheme.PanelBg))).IsGreaterThanOrEqualTo(Contrast.Floor); + } + + /// + /// The frames say so too: on Light, no settings screen paints a single cell on a plane of the dark + /// palette. This is what catches a view that builds a control from a renderer's markup without resolving + /// it — the dark island D6 was — which a contrast audit cannot, because a dark band with its own light + /// text on it is perfectly legible. + /// + [Test] + [Arguments("triggers")] + [Arguments("worlds")] + [Arguments("textansi")] + [Arguments("aliases")] + [Arguments("timers")] + [Arguments("keypad-edit")] + [Arguments("mssp")] + [Arguments("compose")] + [Arguments("deletions")] + [Arguments("packages")] + public async Task NoLightSettingsFramePaintsADarkPlane(string view) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = "Light"; + config.Theme = ThemeLibrary.Get("Light"); + var caps = new TerminalCapabilities(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + var app = new SharpMUTermApp(config, caps, new HeadlessConsoleDriver(120, 32)); + var frame = app.RenderSnapshot(view); + + var dark = Planes.Select(Rgb).ToHashSet(); + var cells = FrameGrid.Cells(frame, 120, 32).Values.ToList(); + var offending = cells.Count(c => c.Background is { } bg && dark.Contains(bg)); + + await Assert.That(cells.Count).IsGreaterThan(1000); + await Assert.That(offending).IsEqualTo(0).Because($"--theme Light --view {view}"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/TintColourVisionTests.cs b/tests/SharpMUTerm.Tui.Tests/TintColourVisionTests.cs new file mode 100644 index 00000000..9e8c652d --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/TintColourVisionTests.cs @@ -0,0 +1,65 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The ten pane tints stay apart for colour-blind readers. Every pair of tinted planes — and every +/// tinted plane against the untinted one, since "no colour" is a choice a neighbour can make — is held to a +/// CIEDE2000 floor under simulated protanopia, deuteranopia and tritanopia (Machado 2009, through +/// ), on all three themes. +/// +/// The floor is 1.9, and what it buys is stated rather than flattered. A ΔE00 of about 1 is a +/// just-noticeable difference for two flat patches side by side; about 2 is where it is seen at a glance. +/// Panes are exactly that — flat planes side by side — so 1.9 says two characters' panes visibly differ +/// to a dichromat. It does not say a lone pane is recognised by its colour: the planes sit at one +/// luminance (an invariant: no character's pane is brighter than another's) near L* 7 on the dark themes, +/// where the whole gamut is a few units wide, and a dichromat sees hue on one axis only. The best set found +/// with the names ignored reached about 2.2. So the floor is close to the ceiling, and the name is said +/// where it costs no cell (the rail and tab tooltips). +/// +/// +/// Typical vision is held to 3.5 — the anchors were re-picked for colour-blind readers on condition that +/// nobody else's closest pair got closer (it was 3.71 on Dark, and is now 3.96). +/// +/// +public class TintColourVisionTests +{ + private const double DichromatFloor = 1.9; + + private const double TypicalFloor = 3.5; + + public static IEnumerable<(string Theme, ColourDeficiency Deficiency)> Cases() => + from theme in ThemeLibrary.Names + from deficiency in Enum.GetValues() + select (theme, deficiency); + + [Test] + [MethodDataSource(nameof(Cases))] + public async Task EveryPairOfPanePlanesStaysApart((string Theme, ColourDeficiency Deficiency) test) + { + var theme = ThemeLibrary.Get(test.Theme); + var floor = test.Deficiency == ColourDeficiency.None ? TypicalFloor : DichromatFloor; + + // PaneTint.None is in the enumeration, so the untinted surface is one of the planes compared. + var planes = Enum.GetValues().Select(t => (Tint: t, Plane: WorkspacePalette.Tint(theme, t))).ToList(); + + var worst = (Distance: double.MaxValue, A: PaneTint.None, B: PaneTint.None); + for (var i = 0; i < planes.Count; i++) + { + for (var j = i + 1; j < planes.Count; j++) + { + var d = ColourVision.Distance(planes[i].Plane, planes[j].Plane, test.Deficiency); + if (d < worst.Distance) + { + worst = (d, planes[i].Tint, planes[j].Tint); + } + } + } + + await Assert.That(worst.Distance).IsGreaterThanOrEqualTo(floor) + .Because($"{worst.A} vs {worst.B} on {test.Theme} under {test.Deficiency}: {worst.Distance:0.00}"); + } +} From a59445a5153c7fc11201ea08ef745a0a7d32cfc1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 03:38:03 +0000 Subject: [PATCH 009/113] =?UTF-8?q?Discoverability:=20fuzzy=20=E2=8C=83P?= =?UTF-8?q?=20with=20recents,=20a=20key=20column,=20and=20F4=20clash=20war?= =?UTF-8?q?nings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The palette's ranking and grouping move into SharpMUTerm.Client (CommandPaletteModel, FuzzyMatch, RecentCommands, KeyGlyphs) so the window's palette can list the same rows; Core's CommandMatcher is removed. Matching is word-by-word subsequence with word-start/consecutive/prefix scoring and highlighted matches. An empty query lists RECENT (in memory, eight) and SUGGESTED (from CommandContext) before the groups. Keys sit in a right-aligned column in one glyph vocabulary and are never elided. F4 marks a binding that wins over a client key (MacroKeys.YieldedBy) with an amber triangle and a shadowed duplicate as dead; ⌃P lists "Key clashes (N)" while N > 0. New snapshot views menu-fuzzy and menu-recent. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 8 + CLAUDE.md | 31 ++ .../Commands/BuiltInCommands.cs | 26 +- .../Contributions/Commands.cs | 6 +- .../Palette/CommandPaletteModel.cs | 296 ++++++++++++++++++ src/SharpMUTerm.Client/Palette/FuzzyMatch.cs | 246 +++++++++++++++ src/SharpMUTerm.Client/Palette/KeyGlyphs.cs | 53 ++++ .../Palette/RecentCommands.cs | 48 +++ .../Commands/CommandCatalog.cs | 7 +- src/SharpMUTerm.Core/Commands/CommandItem.cs | 16 +- .../Commands/CommandMatcher.cs | 113 ------- src/SharpMUTerm.Tui/CommandPalette.cs | 86 +++-- src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs | 182 +++++++---- src/SharpMUTerm.Tui/KeyClashes.cs | 116 +++++++ src/SharpMUTerm.Tui/KeypadScreenRenderer.cs | 29 +- src/SharpMUTerm.Tui/MacroKeys.cs | 61 ++++ src/SharpMUTerm.Tui/ScreenPalette.cs | 7 + .../SharpMUTermApp.Contributions.cs | 23 ++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 36 ++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- .../CommandPaletteModelTests.cs | 226 +++++++++++++ .../Commands/CommandMatcherTests.cs | 64 ---- .../CommandSurfaceRendererTests.cs | 89 ++++-- .../FrameContrastTests.cs | 2 +- .../PaletteDiscoverabilityTests.cs | 153 +++++++++ .../SnapshotViewEmptyConfigTests.cs | 2 +- 26 files changed, 1617 insertions(+), 311 deletions(-) create mode 100644 src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs create mode 100644 src/SharpMUTerm.Client/Palette/FuzzyMatch.cs create mode 100644 src/SharpMUTerm.Client/Palette/KeyGlyphs.cs create mode 100644 src/SharpMUTerm.Client/Palette/RecentCommands.cs delete mode 100644 src/SharpMUTerm.Core/Commands/CommandMatcher.cs create mode 100644 src/SharpMUTerm.Tui/KeyClashes.cs create mode 100644 tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs delete mode 100644 tests/SharpMUTerm.Core.Tests/Commands/CommandMatcherTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 911140d8..1b645dc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Ctrl+P matches as you type by initials and fragments, not only by prefix: `trig sel` finds *Make a trigger + from the selection*, and the letters it matched are highlighted. The commands you last ran from it are + listed first under RECENT, followed by what the moment suggests (copy while something is selected, back to + live output while scrolled back). Every entry's key sits in one right-aligned column, spelt one way (⌥⏎, + not Alt+⏎), and a narrow window shortens titles but never keys. +- Keypad & hotkeys (F4) marks a binding that hides one of the client's own keys (such as Ctrl+C copy) with an + amber △ and says the binding wins, and marks a second binding on the same key as one that never runs. + Ctrl+P lists *Key clashes (N)* while there are any. - Make a trigger without writing a regex: select a line of output and choose Ctrl+P ▸ *Make a trigger from the selection* (also on the right-click menu). Triggers (F2) opens on a new rule whose pattern is the line with its numbers, quoted speech and known player names turned into `*`, and shows the regex behind it. diff --git a/CLAUDE.md b/CLAUDE.md index d964b7d1..b4090398 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -209,6 +209,34 @@ fallbacks) for inline images/maps. availability (a rail row or the other half of a stateful pair still runs). A new ⌃P command is a contribution in `BuiltInCommands` plus a case in `RunBuiltInCommand`; Core's `CommandCatalog` keeps only `CharacterCycle`. +- **⌃P's ranking and grouping are the Client's, so both hosts list the same rows** (`CommandPaletteModel`, + `FuzzyMatch`, `RecentCommands`, `KeyGlyphs` in `Client/Palette`; the Tui only draws, `CommandSurfaceRenderer`). + Core's `CommandMatcher` is gone. Decisions not to relitigate: + - **Matching is subsequence, word by word, in order**, scored per character: +1 matched, +8 at a word start, + +6 straight after the previous match, +4 on the first character, −1 per skipped character (−4 at most + per gap), +20 when the title starts with the whole query. Each word is aligned by dynamic programming, + falling back to the leftmost alignment so anything that is a subsequence matches. A title match always + lists above a match on the detail, the key or the group's name; ties keep catalog order. Groups keep + their headers but are ordered by their best entry, so the best match is the first row. + - **An empty query lists RECENT, then SUGGESTED, then the groups**, each entry once. SUGGESTED is read off + `CommandContext` flags alone (selection → copy and make-a-trigger, frozen, scrolled back, walking, + zoomed, clashes) — not a guess at habit, which is RECENT's job. ⌃P refuses over the composer and the + settings screens are modal, so there is no "screen open" mode for it to adapt to. + - **Recents are in memory for the run** (eight, newest first, `SharpMUTermApp._recentCommands`). The only + view state that outlives a run goes into `config.json`, and which menu entries were clicked is not + configuration; command-line history, the nearest relative, is in memory too. Recorded when chosen on ⌃P + (`CommandPalette.Commit`, `RunFromPalette`), never on a key or a rail click. + - **A `CommandItem` carries `Key` and `Detail` apart from `Subtitle`**; `Subtitle` stays the joined line + for the pointer menu and the tests that read it. Keys are shown through `KeyGlyphs.Normalize`, so the + host's `Alt+⏎`/`Ctrl+⏎` read `⌥⏎`/`⌃⏎` in the column while `--help` keeps the words. The key column is + right-aligned at the widest key; a narrow surface drops the detail, then elides the title, never the key. + - **Clashes come from `MacroKeys`, never a second table** (`KeyClashes`, Tui). `ClaimedBy` (a global + shortcut: the client wins, `Verdict` already says Taken) and `YieldedBy` (what the main window does with a + chord only after `DispatchMacro` declined it: the binding wins, a warning). `YieldedBy`'s list mirrors the + window chain below `DispatchMacro` and the bar's key table, and must move with them. Two bindings on one + chord resolve as `MacroEngine.Resolve` does — the first answers even disabled. F4 marks a binding that wins + with an amber `△` (`ScreenPalette.Caution`) in the key's own well, a loser with `▲`, and says which side + wins in the footer; ⌃P lists `Key clashes (N)` only while N > 0, and it opens F4. - **Tui** — **SharpConsoleUI** app: a `TabControl` of output windows (main + trigger-routed **spawn windows** + web view, with unread badges), each a `MarkupControl` in a `ScrollablePanelControl` viewport (PgUp/PgDn, Shift+↑/↓, ⌃Home/⌃End, wheel; unread badges count output arriving below a @@ -1001,6 +1029,9 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg - **Views:** `worlds`/`settings`, `triggers`, `route`, `highlight`, `aliases`, `timers`, `keypad`, `set`, `textansi`, `input`, `logging`, `password`, `startup`, `freeze`, `spawn`, `split`, `move`, `drag`, `history`, `history-search`, `history-search-filter`, `draft`, `draft2`, `menu`, `menu-split`, + `menu-fuzzy` (`trig sel` typed into ⌃P after a real drag, so the trigger builder's entry is offered — the + frame showing a two-word fuzzy match highlighted), `menu-recent` (⌃P opened empty after two commands ran + through the palette's own path, `RunFromPalette` — RECENT at the top, newest first, listed once), `messages`, `quit`, `connections` (**two connections on one world** — the one view where the header's fraction, the rail's dots and the quit prompt's count are all visible together and all have to agree; every other view has at most one character connected per world, which is what hid a header dividing diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 88595d61..68391a42 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -134,6 +134,10 @@ void Family(string id, string prefix, Func c.State.KeyClashes > 0, titleFor: c => $"Key clashes ({c.State.KeyClashes})"); + // The composer. Named here as well as bound to F1 for the reason the row above it is: a surface // nobody can find is a surface nobody uses, and this one is not something a reader would guess // at from the command line in front of them. @@ -262,7 +266,11 @@ private static IEnumerable Characters(ICommandContext context) CommandGroup.GoTo, $"Switch to {character.CharacterName}", CommandIds.Character(character.SessionKey), - $"{chord}{character.WorldName} · {state}"); + $"{chord}{character.WorldName} · {state}") + { + Key = chord.Length == 0 ? null : chord[..^3], + Detail = $"{character.WorldName} · {state}", + }; } } @@ -303,7 +311,11 @@ private static IEnumerable Windows(ICommandContext context) CommandGroup.GoTo, $"Go to {window.Title}", CommandIds.Window(window.Id), - $"{chord}{owner}{unread}"); + $"{chord}{owner}{unread}") + { + Key = chord.Length == 0 ? null : chord[..^3], + Detail = $"{owner}{unread}", + }; } } @@ -365,11 +377,17 @@ private static IEnumerable Panes(ICommandContext context) CommandGroup.Layout, $"Go to pane {n}", CommandIds.Pane(n), - n <= CommandIds.PaneJumpDigits ? $"⌃B {n}" : null); + n <= CommandIds.PaneJumpDigits ? $"⌃B {n}" : null) + { + Key = n <= CommandIds.PaneJumpDigits ? $"⌃B {n}" : null, + }; } } private static IEnumerable Screens(ICommandContext context) => context.Settings.Select(screen => - new CommandItem(CommandGroup.Settings, $"Open {screen.Title}", screen.Id, screen.Shortcut)); + new CommandItem(CommandGroup.Settings, $"Open {screen.Title}", screen.Id, screen.Shortcut) + { + Key = string.IsNullOrEmpty(screen.Shortcut) ? null : screen.Shortcut, + }); } diff --git a/src/SharpMUTerm.Client/Contributions/Commands.cs b/src/SharpMUTerm.Client/Contributions/Commands.cs index eab4b5e8..9fadcbea 100644 --- a/src/SharpMUTerm.Client/Contributions/Commands.cs +++ b/src/SharpMUTerm.Client/Contributions/Commands.cs @@ -175,7 +175,11 @@ public override IEnumerable Entries(ICommandContext context) { if (IsAvailable is null || IsAvailable(context)) { - yield return new CommandItem(Category, TitleFor?.Invoke(context) ?? Title, Id, SubtitleFor(context)); + yield return new CommandItem(Category, TitleFor?.Invoke(context) ?? Title, Id, SubtitleFor(context)) + { + Key = Key?.Resolve(context.Keys), + Detail = Detail, + }; } } diff --git a/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs b/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs new file mode 100644 index 00000000..385b209e --- /dev/null +++ b/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs @@ -0,0 +1,296 @@ +using SharpMUTerm.Core.Commands; + +namespace SharpMUTerm.Client.Palette; + +/// A run of characters in a string: where it starts and how long it is. +public readonly record struct TextRange(int Start, int Length); + +/// Which field of an entry a query matched, best first. +public enum PaletteMatchField +{ + /// The query is empty; nothing was matched. + None, + + /// The title. + Title, + + /// The detail, the key or the group's name — listed below every title match. + Other, +} + +/// One line of the palette: a group header or an entry. +public abstract record PaletteRow; + +/// A group's header. +/// The header as drawn, in capitals (RECENT, LAYOUT). +public sealed record PaletteHeader(string Label) : PaletteRow; + +/// +/// An entry the palette lists: the command, its key as this host spells it (in the one glyph vocabulary, +/// ), the words beside it, and where the query matched its title. +/// +/// The catalog entry; is what a surface dispatches. +/// The chord, or null. A surface draws it in a column of its own and never elides it. +/// The words beside the title, or null. +/// The runs of the title the query matched, ascending, for highlighting. +/// Which field the query matched. +/// The match's score within its field; zero for an empty query. +public sealed record PaletteEntry( + CommandItem Item, + string? Key, + string? Detail, + IReadOnlyList TitleMatches, + PaletteMatchField Field, + int Score) : PaletteRow; + +/// +/// What the palette shows for one query: the rows in display order (headers and entries interleaved), the +/// entries alone in the same order (what ↑↓ walk and ⏎ dispatches), and how many entries the catalog held. +/// +public sealed record PaletteView(IReadOnlyList Rows, IReadOnlyList Entries, int Total) +{ + /// The widest key any entry carries, in characters; the width a surface reserves for the key column. + public int KeyWidth => Entries.Count == 0 ? 0 : Entries.Max(e => e.Key?.Length ?? 0); +} + +/// +/// The command surface's view-model, shared by every host's palette: a query and a catalog in, ordered rows +/// with group headers out. UI-agnostic — the terminal draws it as markup and the window will draw it with +/// its own controls, and both list the same rows in the same order. +/// +/// An empty query lists RECENT first (what was last run from the surface, newest first), then +/// SUGGESTED (what the state the client is in makes likely: copy and make-a-trigger while output is +/// selected, Back to live output while scrolled back, and so on — ), then every +/// group in its fixed order. An entry is listed once, in the first of those it belongs to. +/// +/// +/// A query is matched by against the title; an entry whose title does not match +/// is tried against its detail, its key and its group's name, and listed below every title match. Groups keep +/// their headers but are ordered by their best entry, so the best match is always the first row; within a group +/// entries are ordered by score, and ties keep catalog order. +/// +/// +public static class CommandPaletteModel +{ + /// The header over recently run commands. + public const string RecentLabel = "RECENT"; + + /// The header over the entries the current state suggests. + public const string SuggestedLabel = "SUGGESTED"; + + private static readonly CommandGroup[] GroupOrder = + { + CommandGroup.GoTo, + CommandGroup.World, + CommandGroup.Terminal, + CommandGroup.Layout, + CommandGroup.Settings, + }; + + /// The header a group is listed under. + public static string GroupLabel(CommandGroup group) => group switch + { + CommandGroup.GoTo => "GO TO", + CommandGroup.World => "WORLD", + CommandGroup.Terminal => "TERMINAL", + CommandGroup.Layout => "LAYOUT", + CommandGroup.Settings => "SETTINGS", + _ => group.ToString().ToUpperInvariant(), + }; + + /// + /// The ids the client's state makes likely, most specific first. Kept to what the state says outright — + /// a selection, a scrolled or frozen pane, a walk, a clash — rather than guessed from habit, which is what + /// RECENT is for. + /// + public static IReadOnlyList Suggested(CommandContext state) + { + ArgumentNullException.ThrowIfNull(state); + var ids = new List(); + if (state.OutputSelected) + { + ids.Add("term:copy"); + ids.Add("term:trigger-from-selection"); + } + + if (state.Frozen) + { + ids.Add("term:unfreeze"); + } + + if (state.ScrolledBack) + { + ids.Add("term:scroll-live"); + } + + if (state.Walking) + { + ids.Add("term:walk-stop"); + } + + if (state.Zoomed) + { + ids.Add("layout:unzoom"); + } + + if (state.KeyClashes > 0) + { + ids.Add("settings:key-clashes"); + } + + return ids; + } + + /// Builds the view for over . + /// What has been typed; blank lists everything. + /// Every entry offered right now, in registration order. + /// Ids run from the surface, newest first; ids no longer offered are skipped. + /// Ids the current state makes likely (). + public static PaletteView Build( + string query, + IReadOnlyList catalog, + IReadOnlyList? recent = null, + IReadOnlyList? suggested = null) + { + ArgumentNullException.ThrowIfNull(query); + ArgumentNullException.ThrowIfNull(catalog); + + return string.IsNullOrWhiteSpace(query) + ? BuildEmpty(catalog, recent ?? Array.Empty(), suggested ?? Array.Empty()) + : BuildMatched(query, catalog); + } + + private static PaletteView BuildEmpty( + IReadOnlyList catalog, IReadOnlyList recent, IReadOnlyList suggested) + { + var rows = new List(); + var entries = new List(); + var shown = new HashSet(StringComparer.Ordinal); + var byId = new Dictionary(StringComparer.Ordinal); + foreach (var item in catalog) + { + byId.TryAdd(item.Id, item); + } + + void Section(string label, IEnumerable items) + { + var list = items.Where(i => !shown.Contains(i.Id)).ToList(); + if (list.Count == 0) + { + return; + } + + rows.Add(new PaletteHeader(label)); + foreach (var item in list) + { + shown.Add(item.Id); + var entry = Entry(item, Array.Empty(), PaletteMatchField.None, 0); + rows.Add(entry); + entries.Add(entry); + } + } + + Section(RecentLabel, recent.Where(byId.ContainsKey).Select(id => byId[id])); + Section(SuggestedLabel, suggested.Where(byId.ContainsKey).Select(id => byId[id])); + foreach (var group in GroupOrder) + { + Section(GroupLabel(group), catalog.Where(i => i.Group == group)); + } + + // A group a package or a later build adds is listed after the known ones rather than dropped. + foreach (var group in catalog.Select(i => i.Group).Distinct().Where(g => Array.IndexOf(GroupOrder, g) < 0)) + { + Section(GroupLabel(group), catalog.Where(i => i.Group == group)); + } + + return new PaletteView(rows, entries, catalog.Count); + } + + private static PaletteView BuildMatched(string query, IReadOnlyList catalog) + { + var matched = new List<(PaletteEntry Entry, int Index)>(); + for (var index = 0; index < catalog.Count; index++) + { + var item = catalog[index]; + if (FuzzyMatch.Match(query, item.Title) is { } title) + { + matched.Add((Entry(item, Ranges(title.Positions), PaletteMatchField.Title, title.Score), index)); + continue; + } + + var other = new[] { DetailOf(item), KeyOf(item), GroupLabel(item.Group) } + .Where(t => !string.IsNullOrEmpty(t)) + .Select(t => FuzzyMatch.Match(query, t!)) + .Where(r => r is not null) + .Select(r => r!.Score) + .DefaultIfEmpty(int.MinValue) + .Max(); + if (other != int.MinValue) + { + matched.Add((Entry(item, Array.Empty(), PaletteMatchField.Other, other), index)); + } + } + + // Best first: a title match above any other, then by score, then catalog order. + static int Compare((PaletteEntry Entry, int Index) a, (PaletteEntry Entry, int Index) b) + { + var byField = a.Entry.Field.CompareTo(b.Entry.Field); + if (byField != 0) + { + return byField; + } + + var byScore = b.Entry.Score.CompareTo(a.Entry.Score); + return byScore != 0 ? byScore : a.Index.CompareTo(b.Index); + } + + matched.Sort(Compare); + + // Groups in the order of their best entry; the sort above already put each group's best first. + var rows = new List(); + var entries = new List(); + foreach (var group in matched.Select(m => m.Entry.Item.Group).Distinct()) + { + rows.Add(new PaletteHeader(GroupLabel(group))); + foreach (var (entry, _) in matched.Where(m => m.Entry.Item.Group == group)) + { + rows.Add(entry); + entries.Add(entry); + } + } + + return new PaletteView(rows, entries, catalog.Count); + } + + private static PaletteEntry Entry(CommandItem item, IReadOnlyList matches, PaletteMatchField field, int score) => + new(item, KeyOf(item), DetailOf(item), matches, field, score); + + private static string? KeyOf(CommandItem item) => + string.IsNullOrWhiteSpace(item.Key) ? null : KeyGlyphs.Normalize(item.Key); + + // An entry that set only a subtitle (a package's, or a family that has no key) shows it as its detail. + private static string? DetailOf(CommandItem item) => + item.Detail ?? (item.Key is null ? item.Subtitle : null); + + /// Collapses ascending positions into runs. + public static IReadOnlyList Ranges(IReadOnlyList positions) + { + ArgumentNullException.ThrowIfNull(positions); + var ranges = new List(); + var i = 0; + while (i < positions.Count) + { + var start = positions[i]; + var length = 1; + while (i + length < positions.Count && positions[i + length] == start + length) + { + length++; + } + + ranges.Add(new TextRange(start, length)); + i += length; + } + + return ranges; + } +} diff --git a/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs b/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs new file mode 100644 index 00000000..a8e898a0 --- /dev/null +++ b/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs @@ -0,0 +1,246 @@ +namespace SharpMUTerm.Client.Palette; + +/// A match of a query against one piece of text: how good it is, and which characters it used. +/// Higher is better. Only comparable between matches against texts of the same kind. +/// The indices in the text of every matched character, ascending. +public sealed record FuzzyResult(int Score, IReadOnlyList Positions); + +/// +/// Subsequence matching for the command surface. Every character of the query must appear in the text, in +/// order, ignoring case; a query with spaces is several words, each matched in order after the one before it, +/// so trig sel finds Make a trigger from the selection. +/// +/// The score rewards what a reader means when they type a few letters: a character at the start of a word +/// (), one straight after the previous match (), and the very +/// first character of the text (); it charges for each character skipped between two +/// matches (, capped per gap so one long skip is not worse than several short ones), +/// and adds when the text simply starts with the query. So lay scores +/// Layouts (a whole prefix) above Clear window's scattered l-a-y, and fp prefers +/// Freeze pane (two word starts) to anything that merely contains an f and a p. +/// +/// +/// Each word is aligned by dynamic programming over every place its characters could land, so the best +/// alignment is found rather than the leftmost; if aligning the words one by one leaves a later word nowhere +/// to go, the leftmost alignment of all of them is scored instead, so anything that is a subsequence matches. +/// +/// +public static class FuzzyMatch +{ + /// Every matched character. + public const int Matched = 1; + + /// A matched character that begins a word. + public const int WordStart = 8; + + /// A matched character immediately after the previous one. + public const int Consecutive = 6; + + /// A match on the text's first character. + public const int TextStart = 4; + + /// Charged per character skipped between two matched characters of one word. + public const int GapPenalty = 1; + + /// The most one gap is charged. + public const int MaxGapPenalty = 4; + + /// Added when the text starts with the whole query, spaces and all. + public const int WholePrefix = 20; + + /// + /// Matches against , or returns null when it is not a + /// subsequence of it. An empty or blank query matches everything with a score of zero. + /// + public static FuzzyResult? Match(string query, string text) + { + ArgumentNullException.ThrowIfNull(query); + ArgumentNullException.ThrowIfNull(text); + + var words = query.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + if (words.Length == 0) + { + return new FuzzyResult(0, Array.Empty()); + } + + var lower = text.ToLowerInvariant(); + var positions = new List(); + var score = 0; + var from = 0; + var aligned = true; + foreach (var word in words) + { + var best = AlignWord(word.ToLowerInvariant(), lower, text, from); + if (best is null) + { + aligned = false; + break; + } + + score += best.Value.Score; + positions.AddRange(best.Value.Positions); + from = best.Value.Positions[^1] + 1; + } + + if (!aligned) + { + // A word aligned for its own best score can leave the next one nowhere to go; the leftmost + // alignment of every word in turn finds a match whenever there is one. + positions.Clear(); + score = 0; + from = 0; + foreach (var word in words) + { + var start = positions.Count; + foreach (var c in word.ToLowerInvariant()) + { + var at = lower.IndexOf(c, from); + if (at < 0) + { + return null; + } + + positions.Add(at); + from = at + 1; + } + + score += ScoreRun(text, positions, start); + } + } + + var normalised = string.Join(' ', words).ToLowerInvariant(); + if (lower.StartsWith(normalised, StringComparison.Ordinal)) + { + score += WholePrefix; + } + + return new FuzzyResult(score, positions); + } + + /// Whether index of begins a word. + public static bool IsWordStart(string text, int i) + { + if (i == 0) + { + return true; + } + + var previous = text[i - 1]; + var current = text[i]; + return (!char.IsLetterOrDigit(previous) && char.IsLetterOrDigit(current)) + || (char.IsLower(previous) && char.IsUpper(current)); + } + + private static int CharScore(string text, int i) => + Matched + (IsWordStart(text, i) ? WordStart : 0) + (i == 0 ? TextStart : 0); + + private static int Link(int previous, int next) => + next == previous + 1 ? Consecutive : -Math.Min(MaxGapPenalty, (next - previous - 1) * GapPenalty); + + // Scored against the original text, so a capital inside a word (camelCase) counts as a word start. + // ToLowerInvariant maps char for char, so an index in the lowered text is the same index here. + private static int ScoreRun(string text, List positions, int start) + { + var score = 0; + for (var i = start; i < positions.Count; i++) + { + score += CharScore(text, positions[i]); + if (i > start) + { + score += Link(positions[i - 1], positions[i]); + } + } + + return score; + } + + private static (int Score, int[] Positions)? AlignWord(string word, string text, string original, int from) + { + var m = word.Length; + var n = text.Length; + if (m == 0 || n - from < m) + { + return null; + } + + // best[i, j]: the best score for word[0..i] with word[i] matched at text[j]; back[i, j] the j of word[i-1]. + var best = new int[m, n]; + var back = new int[m, n]; + const int none = int.MinValue; + for (var i = 0; i < m; i++) + { + for (var j = 0; j < n; j++) + { + best[i, j] = none; + } + } + + for (var j = from; j < n; j++) + { + if (text[j] == word[0]) + { + best[0, j] = CharScore(original, j); + back[0, j] = -1; + } + } + + for (var i = 1; i < m; i++) + { + for (var j = from + i; j < n; j++) + { + if (text[j] != word[i]) + { + continue; + } + + var top = none; + var arg = -1; + for (var k = from + i - 1; k < j; k++) + { + if (best[i - 1, k] == none) + { + continue; + } + + var candidate = best[i - 1, k] + Link(k, j); + if (candidate > top) + { + top = candidate; + arg = k; + } + } + + if (arg >= 0) + { + best[i, j] = top + CharScore(original, j); + back[i, j] = arg; + } + } + } + + var end = -1; + var score = none; + for (var j = from; j < n; j++) + { + // Strictly greater, so the earliest of equal endings wins and later words keep the most room. + if (best[m - 1, j] != none && best[m - 1, j] > score) + { + score = best[m - 1, j]; + end = j; + } + } + + if (end < 0) + { + return null; + } + + var positions = new int[m]; + for (int i = m - 1, j = end; i >= 0; i--) + { + positions[i] = j; + j = back[i, j]; + } + + return (score, positions); + } +} diff --git a/src/SharpMUTerm.Client/Palette/KeyGlyphs.cs b/src/SharpMUTerm.Client/Palette/KeyGlyphs.cs new file mode 100644 index 00000000..ddb7f53d --- /dev/null +++ b/src/SharpMUTerm.Client/Palette/KeyGlyphs.cs @@ -0,0 +1,53 @@ +namespace SharpMUTerm.Client.Palette; + +/// +/// One spelling for every chord a list of keys shows. The catalog's keys are written in the symbol vocabulary +/// (⌃R, ⌥⇧→, ⌃B |) except where a host names a chord in words — the newline is Alt+⏎ +/// in a terminal and Ctrl+⏎ in the window, because --help and the composer's footer read those +/// strings too. A column of keys mixing ⌥R with Alt+⏎ reads as two different modifiers, so the +/// palette spells them all the one way: Ctrl ⌃, Alt ⌥, Shift ⇧, Enter ⏎, +/// Tab ⇥, Esc stays a word. +/// +public static class KeyGlyphs +{ + private static readonly (string Word, string Glyph)[] Modifiers = + { + ("Ctrl+", "⌃"), + ("Control+", "⌃"), + ("Alt+", "⌥"), + ("Option+", "⌥"), + ("Shift+", "⇧"), + }; + + private static readonly (string Word, string Glyph)[] Keys = + { + ("Enter", "⏎"), + ("Return", "⏎"), + ("Tab", "⇥"), + }; + + /// + /// in the symbol vocabulary: Alt+⏎ → ⌥⏎, Ctrl+Enter → ⌃⏎. + /// A chord already in symbols, or a plain key name (F4, PgUp), is returned unchanged. + /// + public static string Normalize(string chord) + { + ArgumentNullException.ThrowIfNull(chord); + var result = chord; + foreach (var (word, glyph) in Modifiers) + { + result = result.Replace(word, glyph, StringComparison.OrdinalIgnoreCase); + } + + // A bare key name only after a modifier glyph, so "Tab" in prose (or F-keys) is left alone. + foreach (var (word, glyph) in Keys) + { + foreach (var modifier in new[] { "⌃", "⌥", "⇧" }) + { + result = result.Replace(modifier + word, modifier + glyph, StringComparison.OrdinalIgnoreCase); + } + } + + return result; + } +} diff --git a/src/SharpMUTerm.Client/Palette/RecentCommands.cs b/src/SharpMUTerm.Client/Palette/RecentCommands.cs new file mode 100644 index 00000000..29a484bd --- /dev/null +++ b/src/SharpMUTerm.Client/Palette/RecentCommands.cs @@ -0,0 +1,48 @@ +namespace SharpMUTerm.Client.Palette; + +/// +/// The commands most recently run from the command surface, newest first, at most . +/// Running one again moves it to the front rather than listing it twice. +/// +/// Held in memory for the life of the run and never written down. The nearest thing this client keeps is the +/// command line's history, which is in memory too (SharpMUTermApp._histories); the only view state that +/// outlives a run goes into config.json through PersistConfiguration, and "which menu entries I +/// clicked" is not configuration. A file of its own would be one more thing this client writes, purges and +/// documents, for a list a person rebuilds in eight clicks. +/// +/// +public sealed class RecentCommands +{ + /// How many the surface shows by default. + public const int DefaultCapacity = 8; + + private readonly List _ids = new(); + + /// Creates an empty list holding at most ids. + public RecentCommands(int capacity = DefaultCapacity) + { + ArgumentOutOfRangeException.ThrowIfLessThan(capacity, 1); + Capacity = capacity; + } + + /// The most ids held. + public int Capacity { get; } + + /// The ids, newest first. + public IReadOnlyList Ids => _ids; + + /// Puts at the front, dropping the oldest past . + public void Record(string commandId) + { + ArgumentException.ThrowIfNullOrWhiteSpace(commandId); + _ids.Remove(commandId); + _ids.Insert(0, commandId); + if (_ids.Count > Capacity) + { + _ids.RemoveRange(Capacity, _ids.Count - Capacity); + } + } + + /// Forgets every id. + public void Clear() => _ids.Clear(); +} diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index 5becd011..768d1fa8 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -45,6 +45,10 @@ public sealed record CharacterRef( /// Null where the host has no screen reader to tell; otherwise whether the active window's output is read aloud. /// /// Whether some pane's output is selected, so a trigger can be made from it. +/// +/// How many F4 bindings share a chord with the client or with each other, so Key clashes (N) is offered +/// only when there is one to show. +/// public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -57,7 +61,8 @@ public sealed record CommandContext( bool Walking = false, bool? Sound = null, bool? Announced = null, - bool OutputSelected = false); + bool OutputSelected = false, + int KeyClashes = 0); /// /// A configuration screen the command surface can open: what it calls itself, the id the host diff --git a/src/SharpMUTerm.Core/Commands/CommandItem.cs b/src/SharpMUTerm.Core/Commands/CommandItem.cs index 4497a58e..3dac440c 100644 --- a/src/SharpMUTerm.Core/Commands/CommandItem.cs +++ b/src/SharpMUTerm.Core/Commands/CommandItem.cs @@ -24,4 +24,18 @@ public enum CommandGroup /// value), the group it renders under, and a stable the UI dispatches on. The /// catalog is generated from live state, so often carries dynamic detail. /// -public sealed record CommandItem(CommandGroup Group, string Title, string Id, string? Subtitle = null); +public sealed record CommandItem(CommandGroup Group, string Title, string Id, string? Subtitle = null) +{ + /// + /// The chord that runs this entry on the running host, held apart from so a surface + /// can draw keys in a column of their own. Null when nothing but the surface runs it. + /// still carries it too, joined with the detail, for the readers that show one line. + /// + public string? Key { get; init; } + + /// + /// The few words describing the entry, without the key. Null when there are none, and also null on an entry + /// that set only ; a surface then treats the whole subtitle as the detail. + /// + public string? Detail { get; init; } +} diff --git a/src/SharpMUTerm.Core/Commands/CommandMatcher.cs b/src/SharpMUTerm.Core/Commands/CommandMatcher.cs deleted file mode 100644 index 99ced66b..00000000 --- a/src/SharpMUTerm.Core/Commands/CommandMatcher.cs +++ /dev/null @@ -1,113 +0,0 @@ -namespace SharpMUTerm.Core.Commands; - -/// A paired with its match score for the current query. -public readonly record struct RankedCommand(CommandItem Item, int Score); - -/// -/// Ranks command-surface entries against a query, per the design's rule: a prefix match on the -/// title ranks highest, a substring match beats a fuzzy subsequence, and subtitle matches rank -/// below title matches. Case-insensitive. An empty query returns every item in catalog order. -/// Pure and deterministic. -/// -public static class CommandMatcher -{ - // Tier bases keep the classes well separated; the per-tier bonus breaks ties within a class. - private const int PrefixTier = 4000; - private const int SubstringTier = 3000; - private const int SubtitleTier = 2000; - private const int FuzzyTier = 1000; - - /// Returns the matching items, best first (stable within equal scores). - public static IReadOnlyList Rank(string query, IEnumerable items) - { - ArgumentNullException.ThrowIfNull(query); - ArgumentNullException.ThrowIfNull(items); - - var q = query.Trim().ToLowerInvariant(); - var results = new List<(RankedCommand Ranked, int Index)>(); - var index = 0; - foreach (var item in items) - { - var score = q.Length == 0 ? 0 : Score(q, item); - if (score is not null) - { - results.Add((new RankedCommand(item, score.Value), index)); - } - - index++; - } - - // Highest score first; ties keep catalog order (stable). - results.Sort((a, b) => - { - var byScore = b.Ranked.Score.CompareTo(a.Ranked.Score); - return byScore != 0 ? byScore : a.Index.CompareTo(b.Index); - }); - - return results.Select(r => r.Ranked).ToArray(); - } - - private static int? Score(string q, CommandItem item) - { - var title = item.Title.ToLowerInvariant(); - if (title.StartsWith(q, StringComparison.Ordinal)) - { - // Shorter titles are tighter prefix matches. - return PrefixTier + Math.Max(0, 100 - title.Length); - } - - var titleIndex = title.IndexOf(q, StringComparison.Ordinal); - if (titleIndex >= 0) - { - return SubstringTier + Math.Max(0, 100 - titleIndex); - } - - var subtitle = item.Subtitle?.ToLowerInvariant(); - if (subtitle is not null && subtitle.Contains(q, StringComparison.Ordinal)) - { - return SubtitleTier; - } - - var spread = FuzzySpread(q, title); - return spread is null ? null : FuzzyTier + Math.Max(0, 200 - spread.Value); - } - - /// - /// If every char of appears in in order, returns - /// the span from the first to the last matched character (a tighter run scores higher); else null. - /// - private static int? FuzzySpread(string q, string title) - { - if (q.Length == 0) - { - return 0; - } - - int? best = null; - for (var start = 0; start < title.Length; start++) - { - if (title[start] != q[0]) - { - continue; - } - - var titleIndex = start + 1; - var queryIndex = 1; - while (queryIndex < q.Length && titleIndex < title.Length) - { - if (title[titleIndex++] == q[queryIndex]) - { - queryIndex++; - } - } - - if (queryIndex == q.Length) - { - var spread = titleIndex - start - 1; - best = best is null ? spread : Math.Min(best.Value, spread); - } - } - - return best; - } -} diff --git a/src/SharpMUTerm.Tui/CommandPalette.cs b/src/SharpMUTerm.Tui/CommandPalette.cs index 46bc5deb..b88d2333 100644 --- a/src/SharpMUTerm.Tui/CommandPalette.cs +++ b/src/SharpMUTerm.Tui/CommandPalette.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Palette; using SharpMUTerm.Core.Commands; using SharpConsoleUI; using SharpConsoleUI.Builders; @@ -6,10 +7,11 @@ namespace SharpMUTerm.Tui; /// -/// The command surface (⌃P): a modal search box over a live-generated catalog, ranked with -/// and rendered grouped by . ↑↓ -/// walk the flattened results, ⏎ dispatches the selected id, Esc closes. The catalog and dispatch -/// are supplied by the app so this stays a thin view over tested logic. +/// The command surface (⌃P): a modal search box over a live-generated catalog, ordered and grouped by the +/// shared view-model (, in Client, so the window's palette can list the same +/// rows) and drawn by . ↑↓ walk the entries, ⏎ dispatches the selected id +/// and records it among the recent ones, Esc closes. The catalog, the suggestions and dispatch are supplied by +/// the app so this stays a thin view over tested logic. /// internal sealed class CommandPalette { @@ -17,13 +19,13 @@ internal sealed class CommandPalette private readonly Func> _catalog; private readonly Func _context; private readonly Action _dispatch; + private readonly RecentCommands _recent; + private readonly Func> _suggested; private Window? _window; private PromptControl? _search; private MarkupControl? _results; - private IReadOnlyList _ranked = Array.Empty(); - private IReadOnlyList _ordered = Array.Empty(); - private int _total; + private PaletteView _view = Empty; private int _selected; private int _contentWidth; @@ -31,16 +33,41 @@ public CommandPalette( ConsoleWindowSystem system, Func> catalog, Func context, - Action dispatch) + Action dispatch, + RecentCommands recent, + Func> suggested) { _system = system; _catalog = catalog; _context = context; _dispatch = dispatch; + _recent = recent; + _suggested = suggested; } + private static PaletteView Empty { get; } = new([], [], 0); + public bool IsOpen => _window is not null; + /// What the surface is listing right now, for a test. + internal PaletteView View => _view; + + /// The selected entry's index in , for a test. + internal int Selected => _selected; + + /// Types into the open surface, as if it had been keyed in. + internal void SetQuery(string query) + { + if (_search is null) + { + return; + } + + _search.SetInput(query); + _selected = 0; + Refresh(query); + } + /// Opens the surface if closed, closes it if open (bound to ⌃P). public void Toggle() { @@ -64,13 +91,15 @@ private void Open() _results = new MarkupControl(new List()); // Size the surface to hug the full (unfiltered) catalog so nothing scrolls and there's no empty - // gutter: fit height to the row count and width to the widest row, both capped to the desktop. - var catalog = _catalog(); - var initial = CommandSurfaceRenderer.Render( - CommandMatcher.Rank(string.Empty, catalog), 0, catalog.Count, _context()); + // gutter: fit height to the row count and width to the widest row, both capped to the desktop. A + // narrower desktop elides titles and details, never keys (CommandSurfaceRenderer). + var initial = Build(string.Empty); var desktop = _system.DesktopDimensions; - var height = Math.Clamp(initial.Count + 3, 6, Math.Max(6, desktop.Height - 2)); - _contentWidth = Math.Clamp(CommandSurfaceRenderer.MaxWidth(initial) + 1, 32, Math.Max(32, desktop.Width - 6)); + var height = Math.Clamp(initial.Rows.Count + 1 + 3, 6, Math.Max(6, desktop.Height - 2)); + _contentWidth = Math.Clamp( + Math.Max(CommandSurfaceRenderer.NaturalWidth(initial), HeaderWidth(initial)) + 1, + 32, + Math.Max(32, desktop.Width - 6)); var width = _contentWidth + 2; // + the 1-cell left/right border // A clean overlay: single border, but no window chrome — no minimize/maximize/close buttons @@ -99,36 +128,42 @@ private void Open() Refresh(string.Empty); } + private PaletteView Build(string query) => + CommandPaletteModel.Build(query, _catalog(), _recent.Ids, _suggested()); + + // The context line ("N of M acting on X") is measured too, so a long character name is not cut off. + private int HeaderWidth(PaletteView view) => + CommandSurfaceRenderer.MaxWidth(CommandSurfaceRenderer.Render(view, -1, _context()).Take(1).ToList()); + private void Refresh(string query) { - var catalog = _catalog(); - _total = catalog.Count; - _ranked = CommandMatcher.Rank(query, catalog); - _ordered = CommandSurfaceRenderer.Order(_ranked); - _selected = _ordered.Count == 0 ? -1 : Math.Clamp(_selected, 0, _ordered.Count - 1); + _view = Build(query); + _selected = _view.Entries.Count == 0 ? -1 : Math.Clamp(_selected, 0, _view.Entries.Count - 1); Paint(); } private void Paint() => - _results?.SetContent(CommandSurfaceRenderer.Render(_ranked, _selected, _total, _context(), _contentWidth)); + _results?.SetContent(CommandSurfaceRenderer.Render(_view, _selected, _context(), _contentWidth)); private void Move(int delta) { - if (_ordered.Count == 0) + var count = _view.Entries.Count; + if (count == 0) { return; } - _selected = ((_selected + delta) % _ordered.Count + _ordered.Count) % _ordered.Count; + _selected = ((_selected + delta) % count + count) % count; Paint(); } private void Commit() { - if (_selected >= 0 && _selected < _ordered.Count) + if (_selected >= 0 && _selected < _view.Entries.Count) { - var id = _ordered[_selected].Id; + var id = _view.Entries[_selected].Item.Id; Close(); + _recent.Record(id); _dispatch(id); } } @@ -169,7 +204,6 @@ private void Reset() _window = null; _search = null; _results = null; - _ranked = Array.Empty(); - _ordered = Array.Empty(); + _view = Empty; } } diff --git a/src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs b/src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs index 8fd65eaf..b40da605 100644 --- a/src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs +++ b/src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs @@ -1,75 +1,73 @@ using System.Text; -using SharpMUTerm.Core.Commands; +using SharpMUTerm.Client.Palette; using static SharpMUTerm.Tui.MarkupText; namespace SharpMUTerm.Tui; /// -/// Renders the command surface (⌃P) results to markup lines, grouped GO TO / WORLD / TERMINAL / -/// LAYOUT / SETTINGS with the selected row highlighted, per the design. The flattened row order matches -/// so ↑↓ navigation and dispatch stay in sync. Pure so it's unit-testable. +/// Draws the command surface (⌃P) from the shared view-model (): a context +/// line, then each group's header and its rows, the selected row highlighted. Every row has three parts — the +/// title, with the characters the query matched in bold accent; the detail, dimmed; and the key, right-aligned +/// in a column of its own so every chord on the surface starts and ends in the same place. When the surface is +/// narrower than a row, the detail goes first and then the title is elided; the key never is, because the key +/// is the part a reader came to learn. Pure so it is unit-testable. /// internal static class CommandSurfaceRenderer { - private static readonly (CommandGroup Group, string Label)[] Groups = - { - (CommandGroup.GoTo, "GO TO"), - (CommandGroup.World, "WORLD"), - (CommandGroup.Terminal, "TERMINAL"), - (CommandGroup.Layout, "LAYOUT"), - (CommandGroup.Settings, "SETTINGS"), - }; - - /// Flattens ranked results into display order: groups in fixed order, ranked within each. - public static IReadOnlyList Order(IReadOnlyList ranked) - { - var ordered = new List(ranked.Count); - foreach (var (group, _) in Groups) - { - foreach (var r in ranked) - { - if (r.Item.Group == group) - { - ordered.Add(r.Item); - } - } - } + /// Cells before the title: ▸ on the selected row, blanks elsewhere. + private const int Lead = 3; - return ordered; - } + /// Cells between the title and its detail. + private const int DetailGap = 3; + + /// The fewest cells between the text and the key column. + private const int KeyGap = 2; + + /// The fewest characters of a detail worth showing; below this it is left out rather than cut to a stub. + private const int MinDetail = 4; + + /// The selected row's band: dark ink on the accent. + private const string SelectedBand = "#18181c on #00f5b7"; + + /// A matched character on an unselected row. + private static readonly string MatchInk = $"bold {ScreenPalette.Accent}"; /// - /// Builds the markup lines: a context header, then each group's header and its rows. The row at - /// flattened index is highlighted. When > 0 - /// the selected row's highlight bar is padded to that visible width so it spans the full surface. + /// Builds the markup lines. The entry at index of + /// is highlighted. is the surface's content width; 0 sizes every row to its own + /// natural width (), which is what a test reads. /// - public static List Render( - IReadOnlyList ranked, int selected, int total, string? context, int width = 0) + public static List Render(PaletteView view, int selected, string? context, int width = 0) { + ArgumentNullException.ThrowIfNull(view); + if (width <= 0) + { + width = NaturalWidth(view); + } + var lines = new List { - $"[dim]{Escape(ranked.Count.ToString())} of {Escape(total.ToString())}" + $"[dim]{Escape(view.Entries.Count.ToString())} of {Escape(view.Total.ToString())}" + (string.IsNullOrEmpty(context) ? string.Empty : $" acting on {Escape(context)}") + "[/]", }; - var flatIndex = 0; - foreach (var (group, label) in Groups) + var keyWidth = view.KeyWidth; + var index = 0; + foreach (var row in view.Rows) { - var inGroup = ranked.Where(r => r.Item.Group == group).ToList(); - if (inGroup.Count == 0) + switch (row) { - continue; - } - - lines.Add($"[dim]├ {label}[/]"); - foreach (var r in inGroup) - { - lines.Add(Row(r.Item, flatIndex == selected, width)); - flatIndex++; + case PaletteHeader header: + lines.Add($"[dim]├ {Escape(header.Label)}[/]"); + break; + case PaletteEntry entry: + lines.Add(Row(entry, index == selected, width, keyWidth)); + index++; + break; } } - if (ranked.Count == 0) + if (view.Entries.Count == 0) { lines.Add("[dim] no matches[/]"); } @@ -77,7 +75,25 @@ public static List Render( return lines; } - /// The visible width of the widest rendered line — used to size the surface to its content. + /// + /// The width every row fits in without eliding anything: lead, title, detail, and the key column at the + /// widest key. The surface sizes itself to this, capped to the desktop. + /// + public static int NaturalWidth(PaletteView view) + { + ArgumentNullException.ThrowIfNull(view); + var keyColumn = KeyColumn(view.KeyWidth); + var widest = 0; + foreach (var entry in view.Entries) + { + var text = entry.Item.Title.Length + (entry.Detail is null ? 0 : DetailGap + entry.Detail.Length); + widest = Math.Max(widest, Lead + text + keyColumn); + } + + return widest; + } + + /// The visible width of the widest rendered line. public static int MaxWidth(IReadOnlyList lines) { var max = 0; @@ -89,20 +105,66 @@ public static int MaxWidth(IReadOnlyList lines) return max; } - private static string Row(CommandItem item, bool selected, int width) + // The key column: the gap, the widest key, and one cell before the edge. With no keys at all, one cell. + private static int KeyColumn(int keyWidth) => keyWidth == 0 ? 1 : KeyGap + keyWidth + 1; + + private static string Row(PaletteEntry entry, bool selected, int width, int keyWidth) + { + var room = Math.Max(1, width - Lead - KeyColumn(keyWidth)); + + // The title keeps every cell it needs before the detail gets any; past that it is elided. + var title = entry.Item.Title; + var titleShown = title.Length <= room ? title.Length : Math.Max(1, room - 1); + var titleElided = titleShown < title.Length; + var used = titleShown + (titleElided ? 1 : 0); + + string? detail = null; + if (entry.Detail is { } d && room - used - DetailGap >= Math.Min(MinDetail, d.Length)) + { + var detailRoom = room - used - DetailGap; + detail = d.Length <= detailRoom ? d : string.Concat(d.AsSpan(0, detailRoom - 1), "…"); + used += DetailGap + detail.Length; + } + + var pad = new string(' ', Math.Max(0, room - used)); + var key = entry.Key is null + ? new string(' ', KeyColumn(keyWidth)) + : new string(' ', KeyGap + keyWidth - entry.Key.Length) + entry.Key + " "; + + var titleMarkup = Highlight(title, titleShown, entry.TitleMatches, selected ? "bold underline" : MatchInk) + + (titleElided ? "…" : string.Empty); + + if (selected) + { + var detailPart = detail is null ? string.Empty : new string(' ', DetailGap) + Escape(detail); + return $"[{SelectedBand}] ▸ {titleMarkup}{detailPart}{pad}{Escape(key)}[/]"; + } + + var detailMarkup = detail is null ? string.Empty : $"{new string(' ', DetailGap)}[dim]{Escape(detail)}[/]"; + var keyMarkup = entry.Key is null ? key : $"[{ScreenPalette.Muted}]{Escape(key)}[/]"; + return $" {titleMarkup}{detailMarkup}{pad}{keyMarkup}"; + } + + /// The first characters of , matched runs wrapped in . + private static string Highlight(string text, int shown, IReadOnlyList matches, string style) { - var title = Escape(item.Title); - if (!selected) + var sb = new StringBuilder(); + var at = 0; + foreach (var range in matches) { - var sub = item.Subtitle is null ? string.Empty : $" [dim]{Escape(item.Subtitle)}[/]"; - return " " + title + sub; + var start = Math.Min(range.Start, shown); + var end = Math.Min(range.Start + range.Length, shown); + if (start < at || end <= start) + { + continue; + } + + sb.Append(Escape(text[at..start])); + sb.Append('[').Append(style).Append(']').Append(Escape(text[start..end])).Append("[/]"); + at = end; } - // Selected: one continuous accent bar across the whole row (title + subtitle), padded to the - // surface width so the highlight reads as a full-width band rather than hugging the title. - var subtitle = item.Subtitle is null ? string.Empty : $" {Escape(item.Subtitle)}"; - var text = $" ▸ {title}{subtitle} "; - var pad = width > VisibleLength(text) ? new string(' ', width - VisibleLength(text)) : string.Empty; - return $"[#18181c on #00f5b7]{text}{pad}[/]"; + sb.Append(Escape(text[at..shown])); + return sb.ToString(); } } diff --git a/src/SharpMUTerm.Tui/KeyClashes.cs b/src/SharpMUTerm.Tui/KeyClashes.cs new file mode 100644 index 00000000..db76170c --- /dev/null +++ b/src/SharpMUTerm.Tui/KeyClashes.cs @@ -0,0 +1,116 @@ +using SharpMUTerm.Core.Automation; + +namespace SharpMUTerm.Tui; + +/// How a binding collides with something else that wants its chord. +internal enum KeyClashKind +{ + /// A global shortcut of the client's holds the chord, and runs first: the binding never fires. + ClientWins, + + /// Another binding earlier in the list holds the chord: this one never fires. + Shadowed, + + /// The binding runs, and the client's own action on that chord does not (a warning, not a fault). + BindingWins, + + /// The binding runs, and a later binding on the same chord never does. + Shadows, +} + +/// One clash: the binding, what kind, and the sentence F4 prints for it. +/// The binding. +/// Which of the four collisions it is. +/// What happens, naming which side wins. +internal readonly record struct KeyClash(Macro Macro, KeyClashKind Kind, string Reason) +{ + /// Whether the binding still runs: a warning rather than a fault. + internal bool BindingRuns => Kind is KeyClashKind.BindingWins or KeyClashKind.Shadows; +} + +/// +/// Which F4 bindings share a chord with the client or with one another, and which side wins. The client's +/// side is read from and nowhere else, so this cannot disagree with the dispatcher: +/// is a global shortcut (tried before any window, so the client wins and +/// already reports the binding as taken), and +/// is an action the main window takes only after DispatchMacro has declined the key (so the binding +/// wins). Two bindings on one chord resolve as does: the first in the list +/// answers, even when it is disabled, and the second never runs. +/// +/// The bindings are compared across every set, which is F4's own stricter reading (AlreadyBound): a +/// session flattens its character's sets into one engine, so two sets ever enabled together collide. +/// +/// +internal static class KeyClashes +{ + /// Every clash among , in list order. + internal static IReadOnlyList Find(IReadOnlyList macros) + { + ArgumentNullException.ThrowIfNull(macros); + var clashes = new List(); + foreach (var macro in macros) + { + if (For(macro, macros) is { } clash) + { + clashes.Add(clash); + } + } + + return clashes; + } + + /// + /// How many clashes a reader needs to look at: every binding that never fires because of another claim + /// on its chord, and every binding that hides one of the client's own keys. A binding that shadows a later + /// one is not counted again — the later one already is. + /// + internal static int Count(IReadOnlyList macros) => + Find(macros).Count(c => c.Kind != KeyClashKind.Shadows); + + /// The clash is part of, or null. + internal static KeyClash? For(Macro macro, IReadOnlyList macros) + { + ArgumentNullException.ThrowIfNull(macro); + ArgumentNullException.ThrowIfNull(macros); + if (MacroKey.Canonicalise(macro.Key) is not { } chord || !Live(macro)) + { + return null; + } + + if (MacroKeys.ClaimedBy(chord) is { } claimed) + { + return new KeyClash(macro, KeyClashKind.ClientWins, $"the client wins: {chord} {claimed}"); + } + + var holders = macros + .Where(m => string.Equals(MacroKey.Canonicalise(m.Key), chord, StringComparison.OrdinalIgnoreCase)) + .ToList(); + var at = holders.FindIndex(m => ReferenceEquals(m, macro)); + if (at > 0) + { + return new KeyClash(macro, KeyClashKind.Shadowed, $"{Name(holders[0])} holds {chord} first; this never runs"); + } + + if (!MacroKeys.Verdict(chord).Fires) + { + return null; + } + + if (MacroKeys.YieldedBy(chord) is { } yielded) + { + return new KeyClash(macro, KeyClashKind.BindingWins, $"this wins: {chord} no longer {yielded}"); + } + + return holders.Count > 1 + ? new KeyClash(macro, KeyClashKind.Shadows, $"this wins: {Name(holders[1])} on {chord} never runs") + : null; + } + + // A disabled binding, or one with nothing to send or call, leaves its key alone (DispatchMacro), so it + // clashes with nothing itself — though as the first holder of a chord it still blocks a later one. + private static bool Live(Macro macro) => + macro.Enabled && (macro.Command.Length > 0 || !string.IsNullOrEmpty(macro.ScriptCallback)); + + private static string Name(Macro macro) => + string.IsNullOrWhiteSpace(macro.Name) ? $"→ {macro.Command}" : macro.Name; +} diff --git a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs index 4af1b236..530a5aea 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs @@ -393,10 +393,13 @@ internal static string FooterLine( // The row can only spare a handful of cells for a reason; the footer has the width to give // the whole one, for the binding the cursor is actually on. var verdict = MacroKeys.Verdict(macros[at].Key); + var clash = KeyClashes.For(macros[at], macros); context = ScreenChrome.Context( ScreenChrome.Position("binding", at, macros.Count), Escape(Identify(macros[at])), - verdict.Fires ? null : "▲ " + Escape(verdict.Reason)); + clash is { } c + ? (c.BindingRuns ? "△ " : "▲ ") + Escape(c.Reason) + : verdict.Fires ? null : "▲ " + Escape(verdict.Reason)); } var actions = ScreenChrome.Actions(focus: focus); @@ -458,6 +461,7 @@ internal static List HotkeysColumn( lines.Add(ScreenChrome.Cursor( Hotkey( macros[i], + macros, sets is null ? null : ScreenLists.OwnerOf(sets, s => s.Macros, macros[i])?.Name, cursor.EditOn(0, i, NameField), cursor.EditOn(0, i, CommandField), @@ -530,6 +534,7 @@ private static string NumpadCell(int digit, IReadOnlyList macros, int wid /// private static string Hotkey( Macro macro, + IReadOnlyList macros, string? setName, ScreenFieldEdit? name, ScreenFieldEdit? command, @@ -537,10 +542,17 @@ private static string Hotkey( ScreenFieldEdit? set) { var verdict = MacroKeys.Verdict(macro.Key); + var clash = KeyClashes.For(macro, macros); var tick = macro.Enabled ? $"[{Accent}]✓[/]" : "[dim]·[/]"; - var chord = verdict.Fires - ? $"[bold]{Escape(macro.Key)}[/]" - : $"[{Muted}]▲ {Escape(macro.Key)}[/]"; + + // A clash is marked inside the key's own well, where the ▲ already goes, so it costs the row no + // cell: △ in amber for a binding that runs and hides something (a client key, or a later binding), + // ▲ for one that never runs. The footer says which side wins for the row the cursor is on. + var chord = clash is { BindingRuns: true } + ? $"[{Caution}]△ {Escape(macro.Key)}[/]" + : verdict.Fires && clash is null + ? $"[bold]{Escape(macro.Key)}[/]" + : $"[{Muted}]▲ {Escape(macro.Key)}[/]"; var bound = ScreenChrome.Field(PadVisible(chord, KeyColumnWidth), key); // A binding that has never been named still gets its well — the name is editable whether or not @@ -578,10 +590,11 @@ private static string Caveat(MacroKeyVerdict verdict) => /// private static string DeadCount(IReadOnlyList macros) { - var dead = macros.Count(m => !MacroKeys.Verdict(m.Key).Fires); - return dead == 0 - ? string.Empty - : $" [{Muted}]▲ {dead} of {macros.Count} cannot fire[/]"; + var dead = macros.Count(m => + !MacroKeys.Verdict(m.Key).Fires || KeyClashes.For(m, macros) is { Kind: KeyClashKind.Shadowed }); + var hiding = macros.Count(m => KeyClashes.For(m, macros) is { Kind: KeyClashKind.BindingWins }); + var caption = dead == 0 ? string.Empty : $" [{Muted}]▲ {dead} of {macros.Count} cannot fire[/]"; + return hiding == 0 ? caption : caption + $" [{Caution}]△ {hiding} hide a client key[/]"; } private static Macro? FindByKey(IReadOnlyList macros, string key) diff --git a/src/SharpMUTerm.Tui/MacroKeys.cs b/src/SharpMUTerm.Tui/MacroKeys.cs index e6584d76..59d0056c 100644 --- a/src/SharpMUTerm.Tui/MacroKeys.cs +++ b/src/SharpMUTerm.Tui/MacroKeys.cs @@ -195,6 +195,67 @@ private static AppShortcut[] BuildAppShortcuts() /// The claimed chords by canonical descriptor, built once from . private static readonly Dictionary Claimed = BuildClaims(); + /// + /// What the app's own global shortcut on this descriptor does, or null when no shortcut holds it. A macro + /// on such a chord never runs: a global shortcut is tried before any window sees the key, which is why + /// reports it . + /// + internal static string? ClaimedBy(string? descriptor) => + MacroKey.Canonicalise(descriptor) is { } canonical && Claimed.TryGetValue(canonical, out var does) ? does : null; + + /// + /// What the client does with this chord after DispatchMacro has had it, or null when + /// nothing does. A macro bound here runs and the client's own action does not — the chord is the user's + /// once they bind it, which is why reports these as firing. F4 marks such a binding + /// as a warning rather than a fault (). + /// + /// The list is the main window's key chain below DispatchMacro, in its order: the pane resize + /// (TryResizeKey), copy, pane selection (TryFocusKey), scrollback (TryScrollKey), + /// recall (TryRecallKey), then the command line's own table (InputBarControl.ProcessKey). + /// Unmodified keys are not here: a macro cannot be bound to one (the prompt has them). + /// + /// + internal static string? YieldedBy(string? descriptor) => + MacroKey.Canonicalise(descriptor) is { } canonical && Yielded.TryGetValue(canonical, out var does) ? does : null; + + private static readonly Dictionary Yielded = BuildYielded(); + + private static Dictionary BuildYielded() + { + var yielded = new Dictionary(StringComparer.OrdinalIgnoreCase); + void Add(string key, bool ctrl, bool alt, bool shift, string does) => + yielded[MacroKey.Describe(key, ctrl, alt, shift)] = does; + + foreach (var arrow in new[] { "Left", "Right", "Up", "Down" }) + { + Add(arrow, ctrl: false, alt: true, shift: true, "resizes the pane"); + Add(arrow, ctrl: true, alt: false, shift: false, "moves between panes"); + } + + Add("C", ctrl: true, alt: false, shift: false, "copies the selection"); + Add("Home", ctrl: true, alt: false, shift: false, "scrolls to the oldest output"); + Add("End", ctrl: true, alt: false, shift: false, "goes back to live output"); + Add("Up", ctrl: false, alt: false, shift: true, "scrolls the pane"); + Add("Down", ctrl: false, alt: false, shift: true, "scrolls the pane"); + Add("Up", ctrl: false, alt: true, shift: false, "recalls history"); + Add("Down", ctrl: false, alt: true, shift: false, "recalls history"); + Add("Left", ctrl: false, alt: true, shift: false, "moves a word"); + Add("Right", ctrl: false, alt: true, shift: false, "moves a word"); + foreach (var key in new[] { "Left", "Right", "Home", "End" }) + { + Add(key, ctrl: false, alt: false, shift: true, "selects in the command line"); + } + + Add("A", ctrl: true, alt: false, shift: false, "selects the command line"); + Add("X", ctrl: true, alt: false, shift: false, "cuts the selection"); + Add("E", ctrl: true, alt: false, shift: false, "goes to the end of the line"); + Add("K", ctrl: true, alt: false, shift: false, "deletes to the end of the line"); + Add("U", ctrl: true, alt: false, shift: false, "deletes to the start of the line"); + Add("Z", ctrl: true, alt: false, shift: false, "undoes"); + Add("Y", ctrl: true, alt: false, shift: false, "redoes"); + return yielded; + } + /// /// The canonical descriptor for a keystroke, whatever it is worth — what the capture mode writes /// into a binding, before the field's validator has a word to say about it. Null when the key has no diff --git a/src/SharpMUTerm.Tui/ScreenPalette.cs b/src/SharpMUTerm.Tui/ScreenPalette.cs index 6552b7cd..359af913 100644 --- a/src/SharpMUTerm.Tui/ScreenPalette.cs +++ b/src/SharpMUTerm.Tui/ScreenPalette.cs @@ -99,4 +99,11 @@ internal static class ScreenPalette /// palette that shouts at every risky-looking row teaches the eye to skip the colour. /// internal const string Warn = "#ff6b6b"; + + /// + /// A binding that works and costs something: F4's △ on a macro that hides one of the client's own + /// keys or another binding on its chord. Amber rather than , because nothing here is + /// refused — the binding runs, and the colour only says what it is standing in front of. + /// + internal const string Caution = "#e8b04a"; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs index 877d8b84..bd8753c7 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs @@ -1,5 +1,6 @@ using SharpMUTerm.Client.Commands; using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Palette; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Workspaces; @@ -16,6 +17,28 @@ internal sealed partial class SharpMUTermApp { private readonly ContributionRegistry _contributions = new(); + /// + /// What was last run from ⌃P, newest first, listed under RECENT when the surface opens with nothing typed. + /// In memory for the run and never saved: see for why. + /// + private readonly RecentCommands _recentCommands = new(); + + /// The ⌃P surface itself, for a test that reads what it is listing. + internal CommandPalette Palette => _palette; + + /// The ids the RECENT group lists, newest first, for a test. + internal IReadOnlyList RecentCommandIds => _recentCommands.Ids; + + /// + /// Runs an entry the way choosing it on ⌃P does: recorded among the recent ones, then dispatched. Internal + /// so a test and the menu-recent snapshot run commands through the palette's own path. + /// + internal bool RunFromPalette(string id) + { + _recentCommands.Record(id); + return DispatchCommand(id); + } + /// The registry the surfaces read. A host or a package adds to it; the views pick it up on their next read. internal ContributionRegistry Contributions => _contributions; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 0ad7eb92..783d2b5f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1,5 +1,6 @@ using System.Text; using Microsoft.Extensions.Logging; +using SharpMUTerm.Client.Palette; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; @@ -900,7 +901,13 @@ public SharpMUTermApp( _window.IsScrollable = false; RegisterBuiltInContributions(); - _palette = new CommandPalette(_system, BuildCatalog, () => _active?.SessionKey, id => DispatchCommand(id)); + _palette = new CommandPalette( + _system, + BuildCatalog, + () => _active?.SessionKey, + id => DispatchCommand(id), + _recentCommands, + () => CommandPaletteModel.Suggested(CommandState())); _messageLog = new MessageLogOverlay(_system, _diagnostics); _gameData = new GameDataOverlay(_system, _time); _screens = ScreenTheme.For(_theme); @@ -1689,6 +1696,27 @@ public string RenderSnapshot(string? view = null) _palette.Toggle(); } + // The command surface searched: a real drag across the output first, because "Make a trigger from + // the selection" is offered only while something is selected, then `trig sel` typed into it — the + // frame that shows a fuzzy match across two words, its characters highlighted, at the top. + if (string.Equals(view, "menu-fuzzy", StringComparison.OrdinalIgnoreCase)) + { + RenderWholeFrame(); + SimulatePaneDrag(MainWindowId, 0, 1, 46, 3); + ReArmWholeFrame(); + _palette.Toggle(); + _palette.SetQuery("trig sel"); + } + + // The command surface opened with nothing typed after two commands were run through the palette's + // own path: RECENT at the top, newest first, and neither entry listed a second time in its group. + if (string.Equals(view, "menu-recent", StringComparison.OrdinalIgnoreCase)) + { + RunFromPalette("layout:split-right"); + RunFromPalette("layout:cycle"); + _palette.Toggle(); + } + // The ⌃B which-key panel over the demo workspace: what the arming timer opens when no key has // arrived by the time it fires. `prefix` is the terse strip on its own — the first thing an armed // prefix shows — and this is what follows it, so the two views are the whole of the display. The @@ -7744,7 +7772,8 @@ private CommandContext CommandState() Walking: SendTarget() is { } walker && _recorders.TryGetValue(walker, out var map) && map.Walk.IsWalking, Sound: CanPlaySound ? !_muted : null, Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId()), - OutputSelected: HasOutputSelection); + OutputSelected: HasOutputSelection, + KeyClashes: KeyClashes.Count(Macros())); } /// @@ -8069,6 +8098,9 @@ private bool RunBuiltInCommand(string id) switch (id) { + case "settings:key-clashes": + // The keypad screen is where each clash is marked and explained; this entry is its way in. + return RunBuiltInCommand(ScreenCommandPrefix + "keypad"); case "layout:zoom": case "layout:unzoom": _workspace.Layout.ToggleZoom(); diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index e89b91ab..17cd7ea4 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -16,7 +16,7 @@ internal static class SnapshotViews "triggers-edit", "logging-edit", "keypad-edit", "password-edit", "startup-edit", "freeze", "freeze-scrollback", "spawn", "split", "move", "drag", "history", "history-search", "history-search-filter", "draft", "draft2", - "menu", "menu-split", "messages", "quit", "connections", "characters", + "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "tint-tabs", "compose", "compose-literal", "moo-edit", "mssp", "mssp-none", "mssp-never", "web", "rail-long", "scrollback", "scrollback-up", "links", "away", "away-scrollback", diff --git a/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs b/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs new file mode 100644 index 00000000..474add0f --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs @@ -0,0 +1,226 @@ +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; +using TUnit.Assertions.Enums; + +namespace SharpMUTerm.Client.Tests; + +public class FuzzyMatchTests +{ + [Test] + public async Task AQueryMatchesWhenItIsASubsequence_IgnoringCase() + { + await Assert.That(FuzzyMatch.Match("SPLIT", "Split right")).IsNotNull(); + await Assert.That(FuzzyMatch.Match("lgg", "Start logging")).IsNotNull(); + await Assert.That(FuzzyMatch.Match("zzz", "Start logging")).IsNull(); + } + + [Test] + public async Task WordsAreMatchedInOrder_EachAfterTheLast() + { + var match = FuzzyMatch.Match("trig sel", "Make a trigger from the selection"); + await Assert.That(match).IsNotNull(); + await Assert.That(match!.Positions).IsEquivalentTo(new[] { 7, 8, 9, 10, 24, 25, 26 }, CollectionOrdering.Matching); + await Assert.That(FuzzyMatch.Match("sel trig", "Make a trigger from the selection")).IsNull(); + } + + [Test] + public async Task AWholePrefixBeatsAScatteredMatch() + { + var prefix = FuzzyMatch.Match("lay", "Layouts")!; + var scattered = FuzzyMatch.Match("lay", "Clear window, say")!; + await Assert.That(prefix.Score).IsGreaterThan(scattered.Score); + } + + [Test] + public async Task WordStartsBeatTheMiddleOfAWord() + { + // f…p at two word starts, against an f and a p buried in words. + var starts = FuzzyMatch.Match("fp", "Freeze pane")!; + var buried = FuzzyMatch.Match("fp", "Self-help")!; + await Assert.That(starts.Score).IsGreaterThan(buried.Score); + } + + [Test] + public async Task TheBestAlignmentIsFound_NotTheLeftmost() + { + // The leftmost s is in "Show"; the best is the word start of "scrollback". + var match = FuzzyMatch.Match("sc", "Show scrollback")!; + await Assert.That(match.Positions).IsEquivalentTo(new[] { 5, 6 }, CollectionOrdering.Matching); + } +} + +public class CommandPaletteModelTests +{ + private static readonly CommandItem[] Items = + { + new(CommandGroup.Layout, "Split right", "layout:split-right", "⌃B |") { Key = "⌃B |" }, + new(CommandGroup.Layout, "Split down", "layout:split-down", "⌃B -") { Key = "⌃B -" }, + new(CommandGroup.Layout, "Layouts", "layout:layouts", "⌥M") { Key = "⌥M" }, + new(CommandGroup.Terminal, "Start logging", "term:log-on"), + new(CommandGroup.Terminal, "Clear window", "term:clear"), + new(CommandGroup.Terminal, "Make a trigger from the selection", "term:trigger-from-selection", "opens F2") + { Detail = "opens F2" }, + new(CommandGroup.Terminal, "Copy the selection", "term:copy", "⌃C · drag") { Key = "⌃C", Detail = "drag" }, + new(CommandGroup.GoTo, "Go to #public", "win:2", "⌥2 · Corvid · 3 unread") { Key = "⌥2", Detail = "Corvid · 3 unread" }, + }; + + private static IEnumerable Ids(PaletteView view) => view.Entries.Select(e => e.Item.Id); + + private static IEnumerable Headers(PaletteView view) => view.Rows.OfType().Select(h => h.Label); + + [Test] + public async Task AnEmptyQueryListsEveryGroupInItsFixedOrder() + { + var view = CommandPaletteModel.Build("", Items); + await Assert.That(Headers(view)).IsEquivalentTo(new[] { "GO TO", "TERMINAL", "LAYOUT" }, CollectionOrdering.Matching); + await Assert.That(view.Entries.Count).IsEqualTo(Items.Length); + await Assert.That(view.Total).IsEqualTo(Items.Length); + } + + [Test] + public async Task LayFindsLayoutsFirst() + { + var view = CommandPaletteModel.Build("lay", Items); + await Assert.That(view.Entries[0].Item.Id).IsEqualTo("layout:layouts"); + await Assert.That(view.Rows[0]).IsEqualTo(new PaletteHeader("LAYOUT")); + } + + [Test] + public async Task TrigSelFindsTheTriggerBuilder_WithItsCharactersMarked() + { + var view = CommandPaletteModel.Build("trig sel", Items); + var first = view.Entries[0]; + await Assert.That(first.Item.Id).IsEqualTo("term:trigger-from-selection"); + await Assert.That(first.TitleMatches) + .IsEquivalentTo(new[] { new TextRange(7, 4), new TextRange(24, 3) }, CollectionOrdering.Matching); + } + + [Test] + public async Task TheBestGroupComesFirst_EvenWhenItIsNotTheFirstGroup() + { + // "log" is a title prefix only in TERMINAL; GO TO's entry does not match at all. + var view = CommandPaletteModel.Build("log", Items); + await Assert.That(view.Entries[0].Item.Id).IsEqualTo("term:log-on"); + await Assert.That(Headers(view).First()).IsEqualTo("TERMINAL"); + } + + [Test] + public async Task ATitleMatchListsAboveADetailMatch() + { + // "corvid" is only in a detail; "c" … also matches titles, which must come first. + var detailOnly = CommandPaletteModel.Build("corvid", Items); + await Assert.That(Ids(detailOnly)).IsEquivalentTo(new[] { "win:2" }); + await Assert.That(detailOnly.Entries[0].Field).IsEqualTo(PaletteMatchField.Other); + await Assert.That(detailOnly.Entries[0].TitleMatches).IsEmpty(); + } + + [Test] + public async Task EqualScoresKeepCatalogOrder() + { + var view = CommandPaletteModel.Build("split", Items); + await Assert.That(Ids(view).Take(2)) + .IsEquivalentTo(new[] { "layout:split-right", "layout:split-down" }, CollectionOrdering.Matching); + } + + [Test] + public async Task RecentComesFirst_NewestFirst_AndIsNotListedTwice() + { + var recent = new RecentCommands(); + recent.Record("term:clear"); + recent.Record("layout:split-down"); + recent.Record("gone:away"); // no longer offered: skipped + + var view = CommandPaletteModel.Build("", Items, recent.Ids); + await Assert.That(view.Rows[0]).IsEqualTo(new PaletteHeader("RECENT")); + await Assert.That(Ids(view).Take(2)) + .IsEquivalentTo(new[] { "layout:split-down", "term:clear" }, CollectionOrdering.Matching); + await Assert.That(Ids(view).Count(id => id == "term:clear")).IsEqualTo(1); + await Assert.That(view.Entries.Count).IsEqualTo(Items.Length); + } + + [Test] + public async Task RecentIsNotAGroupOnceSomethingIsTyped() + { + var view = CommandPaletteModel.Build("clear", Items, new[] { "term:clear" }); + await Assert.That(Headers(view)).DoesNotContain("RECENT"); + } + + [Test] + public async Task TheStateSuggestsWhatItMakesLikely_AfterRecent() + { + var suggested = CommandPaletteModel.Suggested(new CommandContext(OutputSelected: true)); + await Assert.That(suggested).Contains("term:copy"); + await Assert.That(suggested).Contains("term:trigger-from-selection"); + + var view = CommandPaletteModel.Build("", Items, new[] { "term:clear" }, suggested); + await Assert.That(Headers(view).Take(2)).IsEquivalentTo(new[] { "RECENT", "SUGGESTED" }, CollectionOrdering.Matching); + await Assert.That(Ids(view).Skip(1).Take(2)) + .IsEquivalentTo(new[] { "term:copy", "term:trigger-from-selection" }, CollectionOrdering.Matching); + } + + [Test] + public async Task AnIdleClientSuggestsNothing() + { + await Assert.That(CommandPaletteModel.Suggested(new CommandContext())).IsEmpty(); + } + + [Test] + public async Task KeysAreSpeltInOneVocabulary_AndTheKeyWidthIsTheWidest() + { + var items = new[] + { + new CommandItem(CommandGroup.Terminal, "Newline", "term:newline", "Alt+⏎") { Key = "Alt+⏎" }, + new CommandItem(CommandGroup.Layout, "Split right", "layout:split-right", "⌃B |") { Key = "⌃B |" }, + }; + var view = CommandPaletteModel.Build("", items); + await Assert.That(view.Entries.Single(e => e.Item.Id == "term:newline").Key).IsEqualTo("⌥⏎"); + await Assert.That(view.KeyWidth).IsEqualTo(4); + } + + [Test] + public async Task TheRealCatalogCarriesKeysApartFromDetails() + { + var catalog = BuiltInCommands.Catalog(new Workspace(), Array.Empty(), null, new CommandContext()); + var view = CommandPaletteModel.Build("", catalog); + + var copy = view.Entries.Single(e => e.Item.Id == "term:copy"); + await Assert.That(copy.Key).IsEqualTo("⌃C"); + await Assert.That(copy.Detail).DoesNotContain("⌃C"); + var input = view.Entries.Single(e => e.Item.Id == "term:input2-on"); + await Assert.That(input.Key).IsEqualTo("⌃B i"); + await Assert.That(input.Detail).IsEqualTo("this window"); + } +} + +public class KeyGlyphsTests +{ + [Test] + [Arguments("Alt+⏎", "⌥⏎")] + [Arguments("Ctrl+⏎", "⌃⏎")] + [Arguments("Ctrl+Enter", "⌃⏎")] + [Arguments("Shift+Tab", "⇧⇥")] + [Arguments("⌃B |", "⌃B |")] + [Arguments("F4", "F4")] + [Arguments("PgUp", "PgUp")] + public async Task ChordsAreSpeltInSymbols(string chord, string expected) + { + await Assert.That(KeyGlyphs.Normalize(chord)).IsEqualTo(expected); + } +} + +public class RecentCommandsTests +{ + [Test] + public async Task RunningAgainMovesToTheFront_AndTheOldestFallsOff() + { + var recent = new RecentCommands(capacity: 3); + foreach (var id in new[] { "a", "b", "c", "a", "d" }) + { + recent.Record(id); + } + + await Assert.That(recent.Ids).IsEquivalentTo(new[] { "d", "a", "c" }, CollectionOrdering.Matching); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Commands/CommandMatcherTests.cs b/tests/SharpMUTerm.Core.Tests/Commands/CommandMatcherTests.cs deleted file mode 100644 index 39d67f4a..00000000 --- a/tests/SharpMUTerm.Core.Tests/Commands/CommandMatcherTests.cs +++ /dev/null @@ -1,64 +0,0 @@ -using SharpMUTerm.Core.Commands; - -namespace SharpMUTerm.Core.Tests.Commands; - -public class CommandMatcherTests -{ - private static readonly CommandItem[] Items = - { - new(CommandGroup.Layout, "Split right", "layout:split-right"), - new(CommandGroup.Layout, "Split down", "layout:split-down"), - new(CommandGroup.Terminal, "Start logging", "term:log-on"), - new(CommandGroup.GoTo, "Go to #public", "win:2", "Corvid · 3 unread"), - }; - - [Test] - public async Task EmptyQuery_ReturnsAllInCatalogOrder() - { - var ranked = CommandMatcher.Rank("", Items); - await Assert.That(ranked.Select(r => r.Item.Id)) - .IsEquivalentTo(new[] { "layout:split-right", "layout:split-down", "term:log-on", "win:2" }); - } - - [Test] - public async Task PrefixMatch_RanksAboveSubstring() - { - // "sp" prefixes "Split …" but is only a substring of nothing else here. - var ranked = CommandMatcher.Rank("sp", Items); - await Assert.That(ranked).Count().IsEqualTo(2); - await Assert.That(ranked[0].Item.Title).StartsWith("Split"); - } - - [Test] - public async Task Substring_BeatsFuzzySubsequence() - { - // "log" is a substring of "Start logging"; "lgg" is only a fuzzy subsequence of it. - var sub = CommandMatcher.Rank("log", Items); - await Assert.That(sub[0].Item.Id).IsEqualTo("term:log-on"); - - var fuzzy = CommandMatcher.Rank("lgg", Items); - await Assert.That(fuzzy.Any(r => r.Item.Id == "term:log-on")).IsTrue(); - await Assert.That(sub[0].Score).IsGreaterThan(fuzzy.First(r => r.Item.Id == "term:log-on").Score); - } - - [Test] - public async Task Matches_SubtitleWhenTitleDoesNot() - { - var ranked = CommandMatcher.Rank("corvid", Items); - await Assert.That(ranked).HasSingleItem(); - await Assert.That(ranked[0].Item.Id).IsEqualTo("win:2"); - } - - [Test] - public async Task NonMatching_QueryIsExcluded() - { - await Assert.That(CommandMatcher.Rank("zzzzz", Items)).IsEmpty(); - } - - [Test] - public async Task Ranking_IsCaseInsensitive() - { - var ranked = CommandMatcher.Rank("SPLIT", Items); - await Assert.That(ranked).Count().IsEqualTo(2); - } -} diff --git a/tests/SharpMUTerm.Tui.Tests/CommandSurfaceRendererTests.cs b/tests/SharpMUTerm.Tui.Tests/CommandSurfaceRendererTests.cs index bcf69154..54d5f375 100644 --- a/tests/SharpMUTerm.Tui.Tests/CommandSurfaceRendererTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/CommandSurfaceRendererTests.cs @@ -1,6 +1,6 @@ +using SharpMUTerm.Client.Palette; using SharpMUTerm.Core.Commands; using SharpMUTerm.Tui; -using TUnit.Assertions.Enums; namespace SharpMUTerm.Tui.Tests; @@ -8,33 +8,18 @@ public class CommandSurfaceRendererTests { private static readonly CommandItem[] Items = { - new(CommandGroup.Layout, "Zoom pane", "layout:zoom"), - new(CommandGroup.GoTo, "Switch to Rookery", "char:k2", "Aetherfall · offline"), - new(CommandGroup.GoTo, "Go to #public", "win:2", "Corvid · 3 unread"), + new(CommandGroup.Layout, "Zoom pane", "layout:zoom", "⌃B z") { Key = "⌃B z" }, + new(CommandGroup.GoTo, "Switch to Rookery", "char:k2", "Aetherfall · offline") { Detail = "Aetherfall · offline" }, + new(CommandGroup.GoTo, "Go to #public", "win:2", "⌥2 · Corvid · 3 unread") { Key = "⌥2", Detail = "Corvid · 3 unread" }, new(CommandGroup.Terminal, "Start logging", "term:log-on"), - new(CommandGroup.Settings, "Open Worlds & Characters", "screen:worlds", "F5"), + new(CommandGroup.Terminal, "Insert a newline in the command line", "term:newline", "Alt+⏎") { Key = "Alt+⏎" }, + new(CommandGroup.Settings, "Open Worlds & Characters", "screen:worlds", "F5") { Key = "F5" }, }; [Test] - public async Task Order_GroupsInFixedOrder_RankedWithin() + public async Task Render_DrawsTheSettingsGroup_WithEachScreensKey() { - var ranked = CommandMatcher.Rank("", Items); - var ordered = CommandSurfaceRenderer.Order(ranked); - - // GoTo entries come first (both), then Terminal, then Layout, then Settings last — the screens - // are where you go least often, and they are the only group whose rows all do the same kind of - // thing, so they read as a block at the foot rather than as noise in the middle. - await Assert.That(ordered.Select(i => i.Id)) - .IsEquivalentTo( - new[] { "char:k2", "win:2", "term:log-on", "layout:zoom", "screen:worlds" }, - CollectionOrdering.Matching); - } - - [Test] - public async Task Render_DrawsTheSettingsGroup_WithEachScreensKeyAsItsSubtitle() - { - var ranked = CommandMatcher.Rank("", Items); - var lines = CommandSurfaceRenderer.Render(ranked, selected: -1, total: Items.Length, context: null); + var lines = CommandSurfaceRenderer.Render(CommandPaletteModel.Build("", Items), selected: -1, context: null); await Assert.That(lines.Any(l => l.Contains("├ SETTINGS"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("Open Worlds & Characters") && l.Contains("F5"))).IsTrue(); @@ -43,21 +28,69 @@ public async Task Render_DrawsTheSettingsGroup_WithEachScreensKeyAsItsSubtitle() [Test] public async Task Render_EmitsGroupHeadersAndHighlightsSelected() { - var ranked = CommandMatcher.Rank("", Items); - var lines = CommandSurfaceRenderer.Render(ranked, selected: 0, total: Items.Length, context: "Corvid"); + var lines = CommandSurfaceRenderer.Render(CommandPaletteModel.Build("", Items), selected: 0, context: "Corvid"); await Assert.That(lines[0]).Contains("acting on Corvid"); await Assert.That(lines.Any(l => l.Contains("├ GO TO"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("├ LAYOUT"))).IsTrue(); - // The selected (first flattened) row is highlighted with the accent background. await Assert.That(lines.Any(l => l.Contains("on #00f5b7") && l.Contains("Switch to Rookery"))).IsTrue(); } [Test] public async Task Render_NoMatches_SaysSo() { - var ranked = CommandMatcher.Rank("zzzz", Items); - var lines = CommandSurfaceRenderer.Render(ranked, -1, Items.Length, null); + var lines = CommandSurfaceRenderer.Render(CommandPaletteModel.Build("zzzz", Items), -1, null); await Assert.That(lines.Any(l => l.Contains("no matches"))).IsTrue(); } + + /// + /// The key column: every key ends on the same column, which is one cell short of the row's edge, and the + /// host's spelt-out newline chord is drawn in the same glyphs as the rest. + /// + [Test] + public async Task EveryKeyEndsOnTheSameColumn_InOneGlyphVocabulary() + { + var view = CommandPaletteModel.Build("", Items); + var lines = CommandSurfaceRenderer.Render(view, selected: -1, context: null, width: 70); + var rows = lines.Where(l => !l.StartsWith("[dim]", StringComparison.Ordinal)).ToList(); + + foreach (var row in rows) + { + await Assert.That(MarkupText.VisibleLength(row)).IsEqualTo(70); + } + + var plain = rows.Select(Strip).ToList(); + await Assert.That(plain.Single(p => p.Contains("Zoom pane"))).EndsWith("⌃B z "); + await Assert.That(plain.Single(p => p.Contains("newline"))).EndsWith("⌥⏎ "); + await Assert.That(string.Join("\n", plain)).DoesNotContain("Alt+"); + } + + /// A surface narrower than its rows elides the title and the detail, never the key. + [Test] + public async Task ANarrowSurfaceElidesTitlesButNeverKeys() + { + var view = CommandPaletteModel.Build("", Items); + var lines = CommandSurfaceRenderer.Render(view, selected: -1, context: null, width: 24); + var newline = Strip(lines.Single(l => l.Contains("Insert"))); + + await Assert.That(newline.Length).IsEqualTo(24); + await Assert.That(newline).Contains("…"); + await Assert.That(newline).EndsWith("⌥⏎ "); + } + + [Test] + public async Task MatchedCharactersAreHighlighted() + { + var view = CommandPaletteModel.Build("zp", Items); + var lines = CommandSurfaceRenderer.Render(view, selected: -1, context: null); + var zoom = lines.Single(l => l.Contains("oom")); + + await Assert.That(zoom).Contains("[bold #00f5b7]Z[/]"); + await Assert.That(zoom).Contains("[bold #00f5b7]p[/]"); + } + + private static string Strip(string markup) => + System.Text.RegularExpressions.Regex.Replace( + markup.Replace("[[", "\u0001").Replace("]]", "\u0002"), @"\[[^\]]*\]", string.Empty) + .Replace("\u0001", "[").Replace("\u0002", "]"); } diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index 44ac8df5..3f263820 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -46,7 +46,7 @@ public class FrameContrastTests // The selection band is the one plane this client invents rather than derives from a pane, and // its ink replaces the world's own colour on every selected cell — so it is the pair with the // most to lose from a theme it was not measured against. - "selection", "input-selection", + "selection", "input-selection", "menu-fuzzy", "menu-recent", // The meters are the status row's only cells whose colour depends on what a server sent (a low // value wears the notice ink), and the inspector is a modal of its own. diff --git a/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs b/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs new file mode 100644 index 00000000..23398365 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs @@ -0,0 +1,153 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// ⌃P as the place keys are learnt: fuzzy matching over the real catalog, the RECENT group filled by the +/// palette's own dispatch path, and the key clashes F4 marks — every one read off the real app, and the +/// frames off the real paint. +/// +/// Serialised: rendering redirects the process-global Console.Out. +[NotInParallel] +public class PaletteDiscoverabilityTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp Demo(int width = 120, int height = 32) + { + Console.SetIn(TextReader.Null); + return new SharpMUTermApp(DemoScene.Build(), Headless, new HeadlessConsoleDriver(width, height)); + } + + private static string Text(string frame, int width = 120, int height = 32) => + string.Join("\n", FrameGrid.Decode(frame, width, height)); + + [Test] + public async Task TrigSelPutsTheTriggerBuilderFirst_InTheRealSurface() + { + var app = Demo(); + var frame = Text(app.RenderSnapshot("menu-fuzzy")); + + await Assert.That(app.Palette.IsOpen).IsTrue(); + await Assert.That(app.Palette.View.Entries[0].Item.Id).IsEqualTo("term:trigger-from-selection"); + await Assert.That(frame).Contains("Make a trigger from the selection"); + } + + [Test] + public async Task CommandsRunFromThePaletteAreListedUnderRecent_NewestFirst() + { + var app = Demo(); + var frame = Text(app.RenderSnapshot("menu-recent")); + + await Assert.That(app.RecentCommandIds).IsEquivalentTo(new[] { "layout:cycle", "layout:split-right" }); + var entries = app.Palette.View.Entries.Select(e => e.Item.Id).ToList(); + await Assert.That(entries[0]).IsEqualTo("layout:cycle"); + await Assert.That(entries[1]).IsEqualTo("layout:split-right"); + await Assert.That(entries.Count(id => id == "layout:cycle")).IsEqualTo(1); + await Assert.That(frame.IndexOf("RECENT", StringComparison.Ordinal)) + .IsLessThan(frame.IndexOf("GO TO", StringComparison.Ordinal)); + } + + [Test] + public async Task AKeyIsNeverElidedOnANarrowTerminal() + { + var app = Demo(80, 24); + var frame = Text(app.RenderSnapshot("menu"), 80, 24); + + // The copy entry's detail is longer than the surface: it is elided, and its key is still drawn whole. + var copy = frame.Split('\n').Single(l => l.Contains("Copy the selection", StringComparison.Ordinal)); + await Assert.That(copy).Contains("…"); + await Assert.That(copy.TrimEnd(' ', '░', '│')).EndsWith("⌃C"); + } + + [Test] + public async Task KeyClashesAreCountedOnThePalette_AndOpenTheKeypadScreen() + { + var app = Demo(); + app.RenderSnapshot(); + await Assert.That(app.BuildCatalog().Any(c => c.Id == "settings:key-clashes")).IsFalse(); + + var macros = app.Configuration.TriggerSets[0].Macros; + macros.Add(new Macro { Key = "Ctrl+C", Command = "kill", Name = "kill" }); // wins over copy + macros.Add(new Macro { Key = "F2", Command = "score", Name = "score" }); // F2 opens Triggers first + macros.Add(new Macro { Key = "F11", Command = "north", Name = "north" }); + macros.Add(new Macro { Key = "F11", Command = "south", Name = "south" }); // never runs + + var entry = app.BuildCatalog().Single(c => c.Id == "settings:key-clashes"); + await Assert.That(entry.Title).IsEqualTo("Key clashes (3)"); + + await Assert.That(app.DispatchCommand("settings:key-clashes")).IsTrue(); + await Assert.That(app.Settings.IsOpen).IsTrue(); + var frame = Text(app.RenderWholeFrame()); + await Assert.That(frame).Contains("△ Ctrl+C"); + await Assert.That(frame).Contains("hide a client key"); + } +} + +public class KeyClashesTests +{ + private static Macro M(string key, string command = "x", string name = "") => + new() { Key = key, Command = command, Name = name }; + + [Test] + public async Task AGlobalShortcutWins_AndSaysSo() + { + var f2 = M("F2"); + var clash = KeyClashes.For(f2, [f2]); + await Assert.That(clash?.Kind).IsEqualTo(KeyClashKind.ClientWins); + await Assert.That(clash!.Value.Reason).Contains("the client wins"); + await Assert.That(clash.Value.BindingRuns).IsFalse(); + } + + [Test] + public async Task AChordTheWindowTakesAfterTheMacrosIsTheBindingsAndAWarning() + { + var copy = M("Ctrl+C"); + var clash = KeyClashes.For(copy, [copy]); + await Assert.That(clash?.Kind).IsEqualTo(KeyClashKind.BindingWins); + await Assert.That(clash!.Value.BindingRuns).IsTrue(); + await Assert.That(clash.Value.Reason).Contains("no longer copies the selection"); + + // Verdict agrees that the binding fires: the warning is not a second opinion on deliverability. + await Assert.That(MacroKeys.Verdict("Ctrl+C").Fires).IsTrue(); + } + + [Test] + public async Task TwoBindingsOnOneChord_TheFirstAnswers_EvenDisabled() + { + var first = M("F11", name: "north"); + first.Enabled = false; + var second = M("F11", name: "south"); + await Assert.That(KeyClashes.For(second, [first, second])?.Kind).IsEqualTo(KeyClashKind.Shadowed); + await Assert.That(KeyClashes.For(second, [first, second])!.Value.Reason).Contains("north holds F11 first"); + + // A disabled binding clashes with nothing itself. + await Assert.That(KeyClashes.For(first, [first, second])).IsNull(); + + first.Enabled = true; + await Assert.That(KeyClashes.For(first, [first, second])?.Kind).IsEqualTo(KeyClashKind.Shadows); + await Assert.That(KeyClashes.Count([first, second])).IsEqualTo(1); + } + + [Test] + public async Task AFreeChordClashesWithNothing() + { + var free = M("F11"); + await Assert.That(KeyClashes.For(free, [free])).IsNull(); + await Assert.That(KeyClashes.For(M("Num5"), [M("Num5")])).IsNull(); // never arrives: not a clash + } + + [Test] + public async Task EveryYieldedChordIsOneTheVerdictSaysFires() + { + // The warning list may only name chords a binding can actually be written on and fire on. + foreach (var chord in new[] { "Ctrl+C", "Ctrl+Left", "Alt+Shift+Up", "Shift+Up", "Alt+Up", "Ctrl+A", "Ctrl+X" }) + { + await Assert.That(MacroKeys.YieldedBy(chord)).IsNotNull(); + await Assert.That(MacroKeys.Verdict(chord).Fires).IsTrue(); + } + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs index fddf38ad..44b8800e 100644 --- a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs @@ -40,7 +40,7 @@ public class SnapshotViewEmptyConfigTests "collapsed", "prefix", "prefix-panel", "timestamps", "timestamps-toggled", "spawn", "split", "focus", "focus-moved", "freeze", "freeze-scrollback", "move", "drag", "scrollback", "scrollback-up", "away", "away-scrollback", "links", "web", "rail-long", "history", "history-search", - "history-search-filter", "draft", "draft2", "menu", "menu-split", "messages", "quit", + "history-search-filter", "draft", "draft2", "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "compose", "compose-literal", "deletions", "textansi", "input", "keypad", "password", "startup", "logging", "set", "triggers", "route", "highlight", "worlds", "settings", "mssp", From a5e329c8ac6bfb57fa183e63ffb1dc1b67acebae Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 03:50:27 +0000 Subject: [PATCH 010/113] Wire layouts into the client: panes per panel, Alt+M list, F5 rows, suggestion A character's resolved layout is realised as one pane per panel that has data (LayoutFold -> LayoutRealiser -> WorkspaceLayout.ReplaceTree); output, chat and map are the existing windows, every other panel a panel:: window whose control comes from a factory registered in TerminalPanels. Re-folds are rate limited and rebuild only when the drawn panels change, and stop once the player rearranges the panes. A restored workspace wins at startup; only the live entry point applies layouts on its own. Alt+M and Ctrl+P > Layouts open the list (apply, save changes, save as new, use for world/character); F5 gains a layout row on worlds and characters; a world's first connect accepts a suggestion and says so once. LayoutCapture reads an arrangement back into placements. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 + CLAUDE.md | 34 + .../Commands/BuiltInCommands.cs | 4 + src/SharpMUTerm.Core/Layouts/LayoutCapture.cs | 128 ++++ .../Layouts/LayoutRealiser.cs | 198 +++++ .../Workspace/WorkspaceLayout.cs | 26 + src/SharpMUTerm.Tui/MacroKeys.cs | 4 + src/SharpMUTerm.Tui/Program.cs | 3 +- src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs | 715 ++++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 67 +- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/TerminalPanels.cs | 101 +++ src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 69 +- src/SharpMUTerm.Tui/WorldsScreenView.cs | 12 +- .../Layouts/LayoutRealiserTests.cs | 116 +++ .../LayoutWiringTests.cs | 249 ++++++ .../SharpMUTerm.Tui.Tests/ScreenModelTests.cs | 2 +- 17 files changed, 1719 insertions(+), 18 deletions(-) create mode 100644 src/SharpMUTerm.Core/Layouts/LayoutCapture.cs create mode 100644 src/SharpMUTerm.Core/Layouts/LayoutRealiser.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs create mode 100644 src/SharpMUTerm.Tui/TerminalPanels.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Layouts/LayoutRealiserTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/LayoutWiringTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 911140d8..ff2b0a21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Layouts. Alt+M (or Ctrl+P ▸ *Layouts*) lists the built-in Roleplay and Combat layouts and the ones you save: + ⏎ applies one to the panes, `s` saves the panes as they are into the selected layout, `n` saves them as a + new one, `w` makes it the world's default and `c` this character's. Worlds & Characters (F5) has a `layout` + row on each world and each character. A panel appears only once the game sends what it shows, so a MUSH + never gets an empty map pane, and the first time you connect to a world the client picks Combat or Roleplay + from what the game sends and says which in a notice. A workspace you arranged yourself is still what comes + back after a restart. - Make a trigger without writing a regex: select a line of output and choose Ctrl+P ▸ *Make a trigger from the selection* (also on the right-click menu). Triggers (F2) opens on a new rule whose pattern is the line with its numbers, quoted speech and known player names turned into `*`, and shows the regex behind it. diff --git a/CLAUDE.md b/CLAUDE.md index d964b7d1..7c050bb8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -896,6 +896,37 @@ fallbacks) for inline images/maps. - Screenshots of the window's cues come from a real window under Xvfb, driven with XTest; `--render-png` has no pointer and cannot show them. +- **Layouts are realised as panes, one per panel that has data** (`Core/Layouts`: `LayoutFold` → + `LayoutRealiser` → `WorkspaceLayout.ReplaceTree`, `LayoutCapture` for the way back; Tui `SharpMUTermApp.Layouts.cs`, + `TerminalPanels.cs`; ⌥M / ⌃P ▸ *Layouts*; F5 `layout` rows; the `layouts` and `layout-combat` views). The layout's + name is shown nowhere on the main screen. Decisions not to relitigate: + - **A panel is a window.** `output` is the session's window, `chat` its spawn windows, `map` `map:`, and + every other panel a window `panel::` (`TerminalPanels.WindowId`) whose control comes from the + factory registered for that id (`Panels.Register(id, ctx => control)`, from `partial void + RegisterTerminalPanels()`), built once and re-parented like the map's. So panels get tabs, the rail, focus, + `Activate`/`SendTarget` (a panel window is owned by its session) and persistence for nothing. An id with no + factory counts as having no data (`DrawableAvailability`), so an unbuilt panel is *Waiting* and costs no cell. + - **Applying never closes a window.** Windows no panel places stay in the pane they were in if its id survives, + else in the output pane; a collapsed panel's windows are background tabs of the first pane in its region. + - **A restored workspace wins at startup.** The first bind of a character whose windows the resumed workspace + holds keeps that arrangement; any other bind applies the resolved layout; ⌥M ⏎ always applies. Only the live + entry point applies on its own (`autoLayout:`, the `save:`/`logRoot:` family), so no test or snapshot that + binds a session has its panes rearranged. + - **Re-folding is gated twice.** Inputs (game data, the map recorder, a new spawn window) arm one 500 ms timer + (`LayoutRefoldDelay`), and the re-fold rebuilds only if `LayoutRealiser.FoldShape` changed — a burst of GMCP + that draws the same panels reflows nothing (`PaneAreaRebuilds` is the pin). It stands down for good once the + tree's shape (`TreeShape`: pane ids and nesting) is not the one it applied: the player split, closed or + moved a pane and the arrangement is theirs. A divider dragged is not a shape change and is reset by the next + re-fold. A new spawn window goes into the live layout's chat pane, not the focused one. + - **Saving captures geometry, not intent.** `LayoutCapture` reads regions off the solved rectangles (above the + output = top strip, right of it = side, below = bottom); panels not on screen keep their old placement. + Saving changes to a built-in saves a copy and points the character (or the world using it) at the copy. + - **Layout saves go through `PersistConfiguration`**, never `SaveConfiguration`, which re-periodises timers. + F5's rows commit through `SaveConfiguration` like every screen and it re-applies a live layout whose owner + now resolves differently. + - **The suggestion is taken once per world** (`AcceptedLayoutSuggestion`), 5 s after a connect or at once when + vitals arrive, said in one notice, and only by the live entry point. + ## One client, several hosts — and how they are kept the same The terminal (`sharpmuterm`), the desktop window (`sharpmuterm-window`) and the headless snapshot all run the @@ -1074,6 +1105,9 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg `tabs-many` (**more tabs than the strip can hold** — five of one character's captures in a split pane, which is the state every other tab view is too small to reach. Without eliding, that pane draws two tabs and half of a third and says nothing about the rest), plus the + `layouts` (the ⌥M list over the demo, through the registered shortcut) and `layout-combat` (the Combat layout + applied over the demo's game data and recorded streets: the map beside the output with Chat as a tab under it, + and no pane for the panels nothing draws yet), plus the default workspace (no `--view`). Any settings screen also takes a `-edit` suffix, which opens it and drives real keys in so the frame shows a field mid-edit. State toggles: `collapsed`, `prefix`, `timestamps`, diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 88595d61..b40093bd 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -187,6 +187,10 @@ void Family(string id, string prefix, FuncAn arrangement read back into placements, for or . +public sealed record CapturedLayout( + IReadOnlyList Placements, + IReadOnlyDictionary RegionShares); + +/// +/// Reads the workspace the player has arranged back into a layout: "save changes" and "save as new". The pane +/// holding the output is ; a pane entirely above it is the top strip, one entirely +/// to its right is the side column, one entirely below it is the bottom band, and anything else shares the main +/// area. A pane's first panel is its host and the rest are tabs of it (). +/// +/// Geometry is read off on a nominal 1000×1000 area, so it is the tree's own proportions +/// and not a terminal's size. Panels the previous layout placed that are not on screen now (a map on a session +/// that has recorded no room yet) keep their old placement, so saving from a quiet session does not lose them. +/// +/// +public static class LayoutCapture +{ + private const int Extent = 1000; + + /// + /// Captures . names the panel a window draws, or null for a + /// window that belongs to no panel of this session (another character's, the web view). Null when no pane holds + /// the output, since a layout is arranged around it. + /// + public static CapturedLayout? Capture(LayoutNode root, Func panelOf, LayoutDefinition? previous = null) + { + ArgumentNullException.ThrowIfNull(root); + ArgumentNullException.ThrowIfNull(panelOf); + + var rects = LayoutSolver.Solve(root, new PaneRect(0, 0, Extent, Extent)); + var seen = new HashSet(StringComparer.Ordinal); + var panes = new List<(PaneRect Rect, List Panels)>(); + foreach (var pane in root.Panes()) + { + var panels = pane.Tabs.Select(panelOf).OfType().Where(PanelIds.IsKnown).Where(seen.Add).ToList(); + if (panels.Count > 0 && rects.TryGetValue(pane.Id, out var rect)) + { + panes.Add((rect, panels)); + } + } + + var main = panes.FirstOrDefault(p => p.Panels.Contains(PanelIds.Output)); + if (main.Panels is null) + { + return null; + } + + var m = main.Rect; + LayoutRegion RegionOf(PaneRect r) => + r.Y + r.Height <= m.Y ? LayoutRegion.TopStrip + : r.X >= m.X + m.Width ? LayoutRegion.Side + : r.Y >= m.Y + m.Height ? LayoutRegion.Bottom + : LayoutRegion.Main; + + var placements = new List(); + foreach (var group in panes.GroupBy(p => RegionOf(p.Rect))) + { + var ordered = group.Key == LayoutRegion.Side + ? group.OrderBy(p => p.Rect.Y).ThenBy(p => p.Rect.X) + : group.OrderBy(p => p.Rect.X).ThenBy(p => p.Rect.Y); + var order = 0; + foreach (var (rect, panels) in ordered) + { + var size = group.Key == LayoutRegion.Side ? rect.Height : rect.Width; + var host = panels[0]; + placements.Add(new PanelPlacement + { + PanelId = host, + Region = group.Key, + Order = order, + Size = Math.Round(Math.Max(1, size) / 100.0, 2), + }); + placements.AddRange(panels.Skip(1).Select(tab => new PanelPlacement + { + PanelId = tab, + Region = group.Key, + Order = order, + TabOf = host, + })); + order++; + } + } + + if (previous is not null) + { + placements.AddRange(previous.KnownPlacements.Where(p => !seen.Contains(p.PanelId))); + } + + return new CapturedLayout(placements, Shares(panes.Select(p => (p.Rect, RegionOf(p.Rect))).ToList(), m)); + } + + private static Dictionary Shares(List<(PaneRect Rect, LayoutRegion Region)> panes, PaneRect main) + { + static double Clamp(double share) => Math.Round(Math.Clamp(share, 0.05, 0.9), 2); + var shares = new Dictionary(); + + var side = panes.Where(p => p.Region == LayoutRegion.Side).ToList(); + if (side.Count > 0) + { + var left = side.Min(p => p.Rect.X); + var right = side.Max(p => p.Rect.X + p.Rect.Width); + shares[LayoutRegion.Side] = Clamp((right - left) / (double)Extent); + } + + var bottom = panes.Where(p => p.Region == LayoutRegion.Bottom).ToList(); + if (bottom.Count > 0) + { + var top = bottom.Min(p => p.Rect.Y); + var foot = bottom.Max(p => p.Rect.Y + p.Rect.Height); + var whole = foot - main.Y; + shares[LayoutRegion.Bottom] = Clamp(whole <= 0 ? LayoutFold.DefaultShare(LayoutRegion.Bottom) : (foot - top) / (double)whole); + } + + var strip = panes.Where(p => p.Region == LayoutRegion.TopStrip).ToList(); + if (strip.Count > 0) + { + var foot = strip.Max(p => p.Rect.Y + p.Rect.Height); + shares[LayoutRegion.TopStrip] = Clamp(foot / (double)Extent); + } + + return shares; + } +} diff --git a/src/SharpMUTerm.Core/Layouts/LayoutRealiser.cs b/src/SharpMUTerm.Core/Layouts/LayoutRealiser.cs new file mode 100644 index 00000000..d9eae7ac --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/LayoutRealiser.cs @@ -0,0 +1,198 @@ +using System.Text; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Core.Layouts; + +/// +/// A layout made into a workspace tree: the panes hold window ids, ready for +/// . +/// +/// The tree. Every pane has at least one tab. +/// The pane holding the output window, which is where the keyboard goes. +/// Which pane each drawn or collapsed panel ended up in, by panel id. +/// +/// of the fold this was made from: what is drawn and where, with no window +/// ids in it. Two folds with one shape realise to the same panes, so a host re-folds without rebuilding anything +/// while the shape holds. +/// +public sealed record RealisedLayout( + LayoutNode Root, + string FocusedPaneId, + IReadOnlyDictionary PanelPanes, + string Shape); + +/// +/// Turns a (panes of panel ids) into a workspace tree (panes of +/// window ids), given what each panel is drawn by. Pure: the host says which windows a panel stands for +/// and which other windows must survive; this decides where everything goes. +/// +/// A pane takes every window of every panel folded into it, in that order; a pane left with none is dropped +/// and its split collapsed. +/// A collapsed panel's windows are background tabs of the first pane in its region, else of the output pane: +/// a title the player can open, which is what collapsed means in a pane tree. +/// Every window in keep that no panel placed survives — in the pane it asks for when that pane still +/// exists, else in the output pane. Applying a layout never closes a window. +/// +/// +public static class LayoutRealiser +{ + /// Realises , or returns null when it draws nothing. + /// The layout folded, for the regions of collapsed panels. + /// The fold. + /// The windows that draw a panel, in tab order; empty when nothing does yet. + /// The session's own window: focused, and where strays go. + /// Windows to keep, each with the pane id it would like to stay in (or null). + public static RealisedLayout? Realise( + LayoutDefinition layout, + LayoutFoldResult fold, + Func> windowsOf, + string outputWindowId, + IEnumerable<(string WindowId, string? PaneId)>? keep = null) + { + ArgumentNullException.ThrowIfNull(layout); + ArgumentNullException.ThrowIfNull(fold); + ArgumentNullException.ThrowIfNull(windowsOf); + if (fold.Root is null) + { + return null; + } + + var placed = new HashSet(StringComparer.Ordinal); + var panelPanes = new Dictionary(StringComparer.Ordinal); + var paneFirstPanel = new Dictionary(StringComparer.Ordinal); + + LayoutNode? Build(LayoutNode node) + { + if (node is PaneNode pane) + { + var tabs = new List(); + foreach (var panel in pane.Tabs) + { + var windows = windowsOf(panel).Where(placed.Add).ToList(); + if (windows.Count == 0) + { + continue; + } + + tabs.AddRange(windows); + panelPanes[panel] = pane.Id; + paneFirstPanel.TryAdd(pane.Id, panel); + } + + return tabs.Count == 0 ? null : new PaneNode(pane.Id, tabs, 0, false, pane.Sequence); + } + + var split = (SplitNode)node; + var children = new List(); + var sizes = new List(); + for (var i = 0; i < split.Children.Count; i++) + { + if (Build(split.Children[i]) is { } child) + { + children.Add(child); + sizes.Add(split.Sizes[i]); + } + } + + return children.Count switch + { + 0 => null, + 1 => children[0], + _ => new SplitNode(split.Direction, children, sizes), + }; + } + + var root = Build(fold.Root); + if (root is null) + { + return null; + } + + var panes = root.Panes().ToList(); + var output = panes.FirstOrDefault(p => p.Tabs.Contains(outputWindowId)) ?? panes[0]; + + foreach (var collapsed in fold.Collapsed) + { + var windows = windowsOf(collapsed.PanelId).Where(placed.Add).ToList(); + if (windows.Count == 0) + { + continue; + } + + var target = panes.FirstOrDefault(p => + paneFirstPanel.TryGetValue(p.Id, out var first) + && layout.PlacementOf(first)?.Region == collapsed.Region) + ?? output; + target.Tabs.AddRange(windows); + panelPanes[collapsed.PanelId] = target.Id; + } + + foreach (var (windowId, paneId) in keep ?? []) + { + if (!placed.Add(windowId)) + { + continue; + } + + var target = paneId is null ? null : panes.FirstOrDefault(p => p.Id == paneId); + (target ?? output).Tabs.Add(windowId); + } + + var at = output.Tabs.IndexOf(outputWindowId); + output.ActiveIndex = at >= 0 ? at : 0; + return new RealisedLayout(root, output.Id, panelPanes, FoldShape(fold)); + } + + /// + /// What a fold draws and where, as a string: the tree of panes with their panel ids, then the collapsed panels. + /// No sizes and no window ids, so it changes only when a panel appears, goes, or moves. + /// + public static string FoldShape(LayoutFoldResult fold) + { + ArgumentNullException.ThrowIfNull(fold); + var text = new StringBuilder(); + if (fold.Root is { } root) + { + Describe(root, text, n => string.Join(",", n.Tabs)); + } + + text.Append("|c:").Append(string.Join(",", fold.Collapsed.Select(c => c.PanelId))); + return text.ToString(); + } + + /// + /// The structure of a workspace tree — pane ids and how they nest, without tabs or sizes. A host compares it + /// with the one it applied to tell whether the player has since split, closed or moved panes, in which case + /// the arrangement is theirs and a re-fold must leave it alone. + /// + public static string TreeShape(LayoutNode root) + { + ArgumentNullException.ThrowIfNull(root); + var text = new StringBuilder(); + Describe(root, text, p => p.Id); + return text.ToString(); + } + + private static void Describe(LayoutNode node, StringBuilder text, Func pane) + { + if (node is PaneNode leaf) + { + text.Append('[').Append(pane(leaf)).Append(']'); + return; + } + + var split = (SplitNode)node; + text.Append(split.Direction == SplitDirection.Row ? "row(" : "col("); + for (var i = 0; i < split.Children.Count; i++) + { + if (i > 0) + { + text.Append(' '); + } + + Describe(split.Children[i], text, pane); + } + + text.Append(')'); + } +} diff --git a/src/SharpMUTerm.Core/Workspace/WorkspaceLayout.cs b/src/SharpMUTerm.Core/Workspace/WorkspaceLayout.cs index 52f40b20..bb889890 100644 --- a/src/SharpMUTerm.Core/Workspace/WorkspaceLayout.cs +++ b/src/SharpMUTerm.Core/Workspace/WorkspaceLayout.cs @@ -388,6 +388,32 @@ private bool DetachWindow(string windowId) return false; } + /// + /// Replaces the whole tree, as applying a layout does (Layouts.LayoutRealiser). Empty panes are + /// pruned and single-child splits collapsed, exactly as after any other change; the zoom is cleared, because + /// the pane it named may be gone and a layout is asked for in order to be seen whole; focus goes to + /// when it survives, else to pane 1. A pane carrying no creation sequence is + /// given one after the highest taken, and the pN counter moves past any pN id in the new tree, + /// so a later split cannot collide with it. + /// + public void ReplaceTree(LayoutNode root, string? focusedPaneId = null) + { + ArgumentNullException.ThrowIfNull(root); + Root = root; + ZoomedPaneId = null; + var panes = Root.Panes().ToList(); + _paneCounter = Math.Max(_paneCounter, panes.Select(p => ParsePaneCounter(p.Id)).DefaultIfEmpty(0).Max()); + _sequenceCounter = Math.Max(_sequenceCounter, panes.Select(p => p.Sequence).DefaultIfEmpty(PaneNode.Unsequenced).Max()); + foreach (var pane in panes.Where(p => p.Sequence <= PaneNode.Unsequenced)) + { + pane.Sequence = ++_sequenceCounter; + } + + FocusedPaneId = focusedPaneId ?? string.Empty; + _removed.Clear(); + PruneAndFix(); + } + /// Swaps for in the tree. private void ReplaceNode(LayoutNode target, LayoutNode replacement) { diff --git a/src/SharpMUTerm.Tui/MacroKeys.cs b/src/SharpMUTerm.Tui/MacroKeys.cs index e6584d76..98a46329 100644 --- a/src/SharpMUTerm.Tui/MacroKeys.cs +++ b/src/SharpMUTerm.Tui/MacroKeys.cs @@ -167,6 +167,10 @@ private static AppShortcut[] BuildAppShortcuts() // So ⌥G is the whole repeat, and no surface advertises a chord that goes back — going back is // ⌃F again, which is one keystroke more and is a key that exists. new(ConsoleModifiers.Alt, ConsoleKey.G, "goes to the next search hit"), + // The layouts list (⌃P ▸ Layouts). ⌥M is `ESC m`, a printable byte after ESC, so it arrives as one Alt + // chord like ⌥D/⌥R/⌥F; nothing in the framework or the command line's key table takes it, and the + // window host does not keep it for itself (HostKeys.Reserved holds ⌥⏎ and the paste chords). + new(ConsoleModifiers.Alt, ConsoleKey.M, "opens Layouts"), // The character cycle. Letters and not digits because the digit row is spent (⌥N windows, ⌃B N // panes) and there is no third digit-bearing modifier this terminal delivers: read off a pty, // kitty writes ⌥⇧1 as `CSI 49;4u` and ⌃⇧N as `CSI 110;6u` — kitty-keyboard-protocol sequences diff --git a/src/SharpMUTerm.Tui/Program.cs b/src/SharpMUTerm.Tui/Program.cs index fc4d74be..655baf21 100644 --- a/src/SharpMUTerm.Tui/Program.cs +++ b/src/SharpMUTerm.Tui/Program.cs @@ -210,7 +210,8 @@ internal static int RunLive( media: new MediaCache(MediaCache.DefaultRoot), packages: new PackageStore(PackageStore.PathFor(ConfigurationStore.DefaultPath)) { Logger = diagnostics.For("SharpMUTerm.Packages") }, scriptStoreRoot: Path.Combine(Path.GetDirectoryName(ConfigurationStore.DefaultPath)!, "script-data"), - spelling: () => OpenDictionary(loadLogger)); + spelling: () => OpenDictionary(loadLogger), + autoLayout: true); ready?.Invoke(liveApp); int exitCode; try diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs new file mode 100644 index 00000000..38b9929b --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -0,0 +1,715 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Workspaces; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// Layouts in the workspace: resolving a character's layout, realising it as panes, re-folding it as panels get +/// data, the ⌥M list, and the first-connect suggestion. +/// +/// A restored workspace wins at startup. A character whose windows came back from the last run keeps the +/// arrangement it was left in; a character with none gets its resolved layout when its session is bound. ⌥M ⏎ +/// always applies. Only the live entry point applies a layout on its own (autoLayout, the +/// save:/logRoot: family): a test or a snapshot binding a session keeps the workspace it built. +/// +/// +/// A live layout is re-folded only while the panes are still its own. The tree shape is recorded when a +/// layout is applied; once the player splits, closes or moves a pane it no longer matches, and from then on the +/// arrangement is theirs and nothing rebuilds it until ⌥M. A re-fold that would draw the same panels is a no-op, +/// so a burst of GMCP rebuilds nothing. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// How long a change in what a session has shown is gathered before the layout is re-folded. + internal static readonly TimeSpan LayoutRefoldDelay = TimeSpan.FromMilliseconds(500); + + /// How long after a world's first connect the client waits for MSSP and GMCP before suggesting a layout. + internal static readonly TimeSpan LayoutSuggestionDelay = TimeSpan.FromSeconds(5); + + /// The layout applied last and still owning the panes, or null. + private sealed record LiveLayout( + string SessionKey, + string LayoutId, + string FoldShape, + string TreeShape, + IReadOnlyDictionary PanelPanes); + + /// + /// Panels drawn by pane controls of their own, by panel id. See ; the panels plug in + /// from . + /// + internal TerminalPanels Panels { get; } = new(); + + /// Registers the terminal panels' factories into . Called once, at the end of construction. + partial void RegisterTerminalPanels(); + + private LayoutLibrary? _layoutLibrary; + + /// Whether a bound session gets its layout without being asked: the live entry point only. + private readonly bool _autoLayout; + + /// The ⌥M list. + private readonly ListOverlay _layoutsView; + + /// Every layout: the built-ins, then the player's (). + internal LayoutLibrary Layouts => _layoutLibrary ??= new LayoutLibrary(_config.Layouts); + + private LiveLayout? _liveLayout; + + /// Session keys whose windows the restored workspace holds; the first bind of each keeps the restore. + private HashSet _restoredOwners = new(StringComparer.Ordinal); + + private ITimer? _layoutTimer; + private bool _layoutTimerArmed; + private readonly Dictionary _suggestionTimers = new(StringComparer.Ordinal); + + private int _layoutsSelected; + private string? _layoutsStatus; + + /// The id of the layout realised in the panes, while it still owns them; for tests. + internal string? LiveLayoutId => _liveLayout?.LayoutId; + + /// Whose layout owns the panes, or null. + internal string? LiveLayoutOwner => _liveLayout?.SessionKey; + + /// Read once the workspace exists: whose windows a resumed workspace brought back. + private void NoteRestoredOwners() => + _restoredOwners = _workspace.Windows.Select(w => w.SessionKey).OfType().ToHashSet(StringComparer.Ordinal); + + // ── what a panel is drawn by ──────────────────────────────────────────────────────────────────── + + private bool IsDemoKey(string key) => + _sessions.Sessions.Count == 0 && string.Equals(key, DemoScene.ActiveSessionKey, StringComparison.Ordinal); + + /// A session's own window: the one it prints into, else the main window recorded as its. + private string? OutputWindowOf(string key) + { + if (FindSession(key) is { } session && _sessionWindows.TryGetValue(session, out var bound)) + { + return bound; + } + + return _workspace.Windows + .Where(w => w.Kind == WindowKind.Main && string.Equals(w.SessionKey, key, StringComparison.Ordinal)) + .OrderBy(w => w.Sequence) + .FirstOrDefault()?.Id; + } + + private IEnumerable SpawnWindowsOf(string key) => + _workspace.Windows + .Where(w => w.Kind == WindowKind.Spawn && string.Equals(w.SessionKey, key, StringComparison.Ordinal)) + .OrderBy(w => w.Sequence); + + /// The name a panel window's tab carries. + internal static string PanelTitle(string panelId) => panelId switch + { + PanelIds.WhoHere => "Here", + PanelIds.Vitals => "Vitals", + PanelIds.QuickBar => "Quick bar", + PanelIds.Composer => "Composer", + PanelIds.GameData => "Game data", + PanelIds.Map => "Map", + _ => panelId, + }; + + /// Registers (and places, if it is not) the window a terminal panel is shown in, and returns its id. + private string EnsurePanelWindow(string panelId, string key) + { + var id = TerminalPanels.WindowId(panelId, key); + if (_workspace.FindWindow(id) is null) + { + _workspace.OpenWindow(id, PanelTitle(panelId), WindowKind.Auxiliary, key); + } + else if (_workspace.Layout.FindWindow(id) is null) + { + _workspace.Layout.AddWindow(id); + } + + return id; + } + + /// + /// Opens a registered terminal panel for as a tab of the focused pane (or goes on + /// showing it where it is) and returns its window id; null when no factory is registered for the id. + /// + internal string? OpenPanel(string panelId, string sessionKey) + { + if (!Panels.IsRegistered(panelId)) + { + return null; + } + + var id = EnsurePanelWindow(panelId, sessionKey); + RebuildPaneArea(); + return id; + } + + /// The windows that draw for , creating a panel or map window on the way. + private IReadOnlyList PanelWindows(string key, string panelId) + { + switch (panelId) + { + case PanelIds.Output: + return OutputWindowOf(key) is { } output ? [output] : []; + case PanelIds.Chat: + return SpawnWindowsOf(key).Select(w => w.Id).ToList(); + case PanelIds.Map: + if (MapOf(key) is not { Map.Rooms.Count: > 0 }) + { + return []; + } + + var map = MapWindowId(key); + if (_workspace.FindWindow(map) is null) + { + _workspace.OpenWindow(map, PanelTitle(PanelIds.Map), WindowKind.Auxiliary, key); + } + + return [map]; + default: + return Panels.IsRegistered(panelId) ? [EnsurePanelWindow(panelId, key)] : []; + } + } + + /// The panel a window draws for , or null when it is not one of that session's. + private string? PanelOf(string key, string windowId) + { + if (string.Equals(windowId, OutputWindowOf(key), StringComparison.Ordinal)) + { + return PanelIds.Output; + } + + if (string.Equals(windowId, MapWindowId(key), StringComparison.Ordinal)) + { + return PanelIds.Map; + } + + if (TerminalPanels.TryParseWindowId(windowId, out var panel, out var owner)) + { + return string.Equals(owner, key, StringComparison.Ordinal) ? panel : null; + } + + return _workspace.FindWindow(windowId) is { Kind: WindowKind.Spawn } spawn + && string.Equals(spawn.SessionKey, key, StringComparison.Ordinal) + ? PanelIds.Chat + : null; + } + + /// What 's session has shown, as the fold reads it — with every panel nothing draws counted as having no data. + internal IPanelAvailability LayoutAvailability(string key) + { + var data = FindSession(key)?.GameData ?? (IsDemoKey(key) ? _demoGameData : null); + var rooms = MapOf(key)?.Map.Rooms.Count ?? 0; + var facts = PanelAvailability.From(data, rooms, SpawnWindowsOf(key).Count(), _config.Text.StatusMeters); + return new DrawableAvailability(facts, Panels); + } + + /// , less the panels this client has nothing to draw with. + private sealed class DrawableAvailability(IPanelAvailability facts, TerminalPanels panels) : IPanelAvailability + { + public bool HasData(string panelId) => + facts.HasData(panelId) + && (panelId is PanelIds.Output or PanelIds.Chat or PanelIds.Map || panels.IsRegistered(panelId)); + } + + // ── applying ──────────────────────────────────────────────────────────────────────────────────── + + /// The world and character a session key names, live or configured. + private (WorldDefinition? World, CharacterDefinition? Character) LayoutOwner(string key) => + FindSession(key) is { } session + ? (session.World, session.Character) + : FindCharacter(key) is { } found ? (found.World, found.Character) : (null, null); + + /// The layout uses, by . + internal ResolvedLayout ResolveLayout(string key) + { + var (world, character) = LayoutOwner(key); + return LayoutResolver.Resolve(Layouts, world, character); + } + + /// + /// Realises for in the workspace: one pane per drawn panel, every + /// other window kept, the session's own window focused — or , when a re-fold must + /// not move the reader. False when the session has no window to arrange around. + /// + internal bool ApplyLayout(string key, LayoutDefinition layout, string? focusWindow = null) + { + if (OutputWindowOf(key) is not { } output) + { + return false; + } + + var fold = LayoutFold.Fold(layout, LayoutAvailability(key)); + var keep = _workspace.Layout.Root.Panes() + .SelectMany(p => p.Tabs.Select(t => (t, (string?)p.Id))) + .ToList(); + if (LayoutRealiser.Realise(layout, fold, panel => PanelWindows(key, panel), output, keep) is not { } realised) + { + return false; + } + + _workspace.Layout.ReplaceTree(realised.Root, realised.FocusedPaneId); + _liveLayout = new LiveLayout( + key, layout.Id, realised.Shape, LayoutRealiser.TreeShape(_workspace.Layout.Root), realised.PanelPanes); + RebuildPaneArea(); + var focus = focusWindow is not null && _workspace.Layout.FindWindow(focusWindow) is not null ? focusWindow : output; + Activate(focus); + RefreshRail(); + return true; + } + + /// A session has been bound to its window: apply its layout, unless the restored workspace already arranged it. + private void ApplyLayoutOnBind(WorldSession session) + { + if (!_autoLayout) + { + return; + } + + if (_restoredOwners.Remove(session.SessionKey)) + { + return; // the player's last arrangement wins over the layout at startup + } + + ApplyLayout(session.SessionKey, ResolveLayout(session.SessionKey).Layout); + } + + /// Something a panel's availability reads has changed for : re-fold, once the burst settles. + private void NoteLayoutInput(string key) + { + if (_liveLayout is not { } live || !string.Equals(live.SessionKey, key, StringComparison.Ordinal) || _layoutTimerArmed) + { + return; + } + + _layoutTimerArmed = true; + _layoutTimer ??= _time.CreateTimer( + _ => OnUiThread(() => + { + _layoutTimerArmed = false; + RefoldLayout(); + }), + null, + Timeout.InfiniteTimeSpan, + Timeout.InfiniteTimeSpan); + _layoutTimer.Change(LayoutRefoldDelay, Timeout.InfiniteTimeSpan); + } + + /// + /// Re-folds the live layout against what its session has shown now, and rebuilds the panes only if that draws + /// different panels. Stands down for good once the player has rearranged the panes, and for now while a pane is + /// zoomed. + /// + internal void RefoldLayout() + { + if (_liveLayout is not { } live || _workspace.Layout.ZoomedPaneId is not null) + { + return; + } + + if (!string.Equals(LayoutRealiser.TreeShape(_workspace.Layout.Root), live.TreeShape, StringComparison.Ordinal)) + { + _liveLayout = null; // the arrangement is the player's now + return; + } + + var layout = Layouts.Find(live.LayoutId) ?? ResolveLayout(live.SessionKey).Layout; + var fold = LayoutFold.Fold(layout, LayoutAvailability(live.SessionKey)); + if (string.Equals(LayoutRealiser.FoldShape(fold), live.FoldShape, StringComparison.Ordinal)) + { + return; + } + + ApplyLayout(live.SessionKey, layout, ActiveWindowId()); + } + + /// + /// A capture window has just opened for : put it in the live layout's chat pane when + /// there is one, rather than the focused pane, and re-fold in case chat had no pane yet. + /// + private void PlaceNewSpawnWindow(WorldSession session, string windowId) + { + if (_liveLayout is { } live + && string.Equals(live.SessionKey, session.SessionKey, StringComparison.Ordinal) + && live.PanelPanes.TryGetValue(PanelIds.Chat, out var pane) + && _workspace.Layout.FindPane(pane) is not null) + { + _workspace.Layout.AddWindow(windowId, pane, activate: false); + } + + NoteLayoutInput(session.SessionKey); + } + + /// After a settings commit: a live layout whose owner now resolves to another layout is re-applied. + private void ReapplyLayoutAfterSettings() + { + if (_liveLayout is not { } live) + { + return; + } + + var resolved = ResolveLayout(live.SessionKey).Layout; + if (!string.Equals(resolved.Id, live.LayoutId, StringComparison.Ordinal)) + { + ApplyLayout(live.SessionKey, resolved, ActiveWindowId()); + } + } + + // ── the first-connect suggestion ──────────────────────────────────────────────────────────────── + + private static bool NeedsSuggestion(WorldSession session) => + session.World.Layout is null && session.World.AcceptedLayoutSuggestion is null && session.Character?.Layout is null; + + /// A session connected: on a world nobody has picked a layout for, suggest one once MSSP and GMCP have had a moment. + private void ScheduleLayoutSuggestion(WorldSession session) + { + if (!_autoLayout || !NeedsSuggestion(session) || _suggestionTimers.ContainsKey(session.SessionKey)) + { + return; + } + + _suggestionTimers[session.SessionKey] = _time.CreateTimer( + _ => OnUiThread(() => AcceptLayoutSuggestion(session)), + null, + LayoutSuggestionDelay, + Timeout.InfiniteTimeSpan); + } + + /// Vitals decide the suggestion outright, so their arrival need not wait for the timer. + private void NoteSuggestionSignal(WorldSession session, string package) + { + if (_suggestionTimers.ContainsKey(session.SessionKey) && LayoutSuggester.VitalsPackages.Contains(package)) + { + AcceptLayoutSuggestion(session); + } + } + + /// + /// Takes the suggestion for 's world into , + /// says so once, and applies it when it changes what the live layout is. + /// + internal void AcceptLayoutSuggestion(WorldSession session) + { + if (_suggestionTimers.Remove(session.SessionKey, out var timer)) + { + timer.Dispose(); + } + + if (!NeedsSuggestion(session)) + { + return; + } + + var report = _mssp.Find(session.World.Host, session.World.Port)?.Report; + var suggestion = LayoutSuggester.Suggest(LayoutSignals.From(session.GameData, report)); + session.World.AcceptedLayoutSuggestion = suggestion.LayoutId; + PersistConfiguration(); + + var name = Layouts.Find(suggestion.LayoutId)?.Name ?? suggestion.LayoutId; + var why = suggestion.Reason switch + { + LayoutSuggestionReason.Vitals => "the game sends vitals", + LayoutSuggestionReason.RoleplayServer => report?.Codebase is { } codebase + ? $"it runs {Snippet(codebase)}" + : "it is a roleplay server", + _ => "nothing it sends points elsewhere", + }; + Notice($"Using the {name} layout for {Snippet(session.World.Name)}: {why}. ⌥M changes it.", MessageSeverity.Info, "⌥M"); + + if (_liveLayout is { } live + && string.Equals(live.SessionKey, session.SessionKey, StringComparison.Ordinal) + && !string.Equals(live.LayoutId, suggestion.LayoutId, StringComparison.Ordinal)) + { + ApplyLayout(session.SessionKey, ResolveLayout(session.SessionKey).Layout, ActiveWindowId()); + } + } + + // ── ⌥M ────────────────────────────────────────────────────────────────────────────────────────── + + /// The character the layouts list is about: the focused window's, else the demo's. + private string? LayoutsKey() => + SendTarget()?.SessionKey + ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey + ?? (_sessions.Sessions.Count == 0 ? _demoActiveKey ?? DemoScene.ActiveSessionKey : null); + + /// Whether the ⌥M list is up. + internal bool LayoutsOpen => _layoutsView.IsOpen && _layoutsView.Mode == "layouts"; + + /// What the ⌥M list shows, for a test. + internal IReadOnlyList LayoutsLines => _layoutsView.Lines; + + /// Feeds a key to the ⌥M list. + internal void SimulateLayoutsKey(ConsoleKeyInfo key) => _layoutsView.SimulateKey(key); + + /// ⌥M and ⌃P ▸ Layouts: the list of layouts for the focused character, or closes it. + private void ShowLayouts() + { + if (LayoutsOpen) + { + _layoutsView.Close(); + return; + } + + if (AnyOverlayOpen) + { + return; + } + + if (LayoutsKey() is not { } key) + { + RefuseCommand("no character here — a layout belongs to a character (⌃P ▸ Switch to …)"); + return; + } + + var all = Layouts.All; + var inUse = _liveLayout is { } live && string.Equals(live.SessionKey, key, StringComparison.Ordinal) + ? live.LayoutId + : ResolveLayout(key).Layout.Id; + _layoutsSelected = Math.Max(0, all.ToList().FindIndex(l => l.Id == inUse)); + _layoutsStatus = null; + _layoutsView.Open( + "layouts", + $"Layouts · {Snippet(key)}", + width => LayoutsListLines(key, width), + k => LayoutsKeyPressed(key, k), + width: 64); + } + + private bool LayoutsKeyPressed(string key, ConsoleKeyInfo k) + { + var all = Layouts.All; + _layoutsSelected = Math.Clamp(_layoutsSelected, 0, all.Count - 1); + var selected = all[_layoutsSelected]; + var (world, character) = LayoutOwner(key); + switch (k.Key) + { + case ConsoleKey.UpArrow: + _layoutsSelected = Math.Max(0, _layoutsSelected - 1); + return true; + case ConsoleKey.DownArrow: + _layoutsSelected = Math.Min(all.Count - 1, _layoutsSelected + 1); + return true; + case ConsoleKey.Enter: + if (!ApplyLayout(key, selected)) + { + RefuseCommand($"no window to arrange for {Snippet(key)} — switch to the character first"); + return false; + } + + Notice($"{selected.Name} layout applied — c keeps it for this character, w for the world", MessageSeverity.Info, "⌥M"); + return false; + case ConsoleKey.S when k.Modifiers == 0: + SaveLayoutChanges(key, selected, world, character); + return true; + case ConsoleKey.N when k.Modifiers == 0: + SaveLayoutAsNew(key, selected); + return true; + case ConsoleKey.W when k.Modifiers == 0: + if (world is null) + { + _layoutsStatus = "this character's world is not configured"; + return true; + } + + world.Layout = selected.Id; + PersistConfiguration(); + _layoutsStatus = $"{selected.Name} is now {world.Name}'s layout"; + ReapplyIfResolvedChanged(key); + return true; + case ConsoleKey.C when k.Modifiers == 0: + if (character is null) + { + _layoutsStatus = "no configured character to keep it for"; + return true; + } + + character.Layout = selected.Id; + PersistConfiguration(); + _layoutsStatus = $"{character.Name} uses {selected.Name}"; + ReapplyIfResolvedChanged(key); + return true; + default: + return true; + } + } + + /// After w or c: applies the layout now resolves to, if the panes show another. + private void ReapplyIfResolvedChanged(string key) + { + var resolved = ResolveLayout(key).Layout; + if (_liveLayout is { } live + && string.Equals(live.SessionKey, key, StringComparison.Ordinal) + && string.Equals(live.LayoutId, resolved.Id, StringComparison.Ordinal)) + { + return; + } + + ApplyLayout(key, resolved, ActiveWindowId()); + } + + /// The current arrangement, read back as 's placements. + private CapturedLayout? CaptureArrangement(string key, LayoutDefinition? previous) => + LayoutCapture.Capture(_workspace.Layout.Root, window => PanelOf(key, window), previous); + + private void SaveLayoutChanges(string key, LayoutDefinition target, WorldDefinition? world, CharacterDefinition? character) + { + if (CaptureArrangement(key, target) is not { } captured) + { + _layoutsStatus = "nothing to save — no pane holds this character's output"; + return; + } + + var result = Layouts.Update(target.Id, captured.Placements, captured.RegionShares); + if (result.CreatedNew) + { + // A built-in is never changed; whoever was using it is pointed at the copy, and failing that this character. + if (character?.Layout == target.Id || character is not null && world?.Layout != target.Id) + { + character!.Layout = result.Layout.Id; + } + else if (world is not null) + { + world.Layout = result.Layout.Id; + } + + _layoutsStatus = $"{target.Name} is built in — saved as {result.Layout.Name}"; + } + else + { + _layoutsStatus = $"saved {result.Layout.Name}"; + } + + PersistConfiguration(); + _layoutsSelected = Layouts.All.ToList().FindIndex(l => l.Id == result.Layout.Id); + AdoptArrangementAs(key, result.Layout); + } + + private void SaveLayoutAsNew(string key, LayoutDefinition from) + { + if (CaptureArrangement(key, from) is not { } captured) + { + _layoutsStatus = "nothing to save — no pane holds this character's output"; + return; + } + + var saved = Layouts.SaveAsNew(from.Name, captured.Placements, captured.RegionShares); + PersistConfiguration(); + _layoutsSelected = Layouts.All.ToList().FindIndex(l => l.Id == saved.Id); + _layoutsStatus = $"saved as {saved.Name} — c or w puts it to use"; + } + + /// + /// The panes now are , as just saved from them: it becomes the live layout without a + /// rebuild, so re-folding follows it. + /// + private void AdoptArrangementAs(string key, LayoutDefinition layout) + { + var fold = LayoutFold.Fold(layout, LayoutAvailability(key)); + var panels = new Dictionary(StringComparer.Ordinal); + foreach (var pane in _workspace.Layout.Root.Panes()) + { + foreach (var window in pane.Tabs) + { + if (PanelOf(key, window) is { } panel) + { + panels.TryAdd(panel, pane.Id); + } + } + } + + _liveLayout = new LiveLayout( + key, layout.Id, LayoutRealiser.FoldShape(fold), LayoutRealiser.TreeShape(_workspace.Layout.Root), panels); + } + + /// One line describing a layout: its own words for a built-in, its panels for a saved one. + private static string LayoutDescription(LayoutDefinition layout) => layout.Id switch + { + BuiltInLayouts.RoleplayId => "output, composer, who is here", + BuiltInLayouts.CombatId => "vitals, map, quick bar", + _ => string.Join(", ", layout.KnownPlacements.Where(p => p.TabOf is null).Select(p => PanelTitle(p.PanelId).ToLowerInvariant())), + }; + + /// The ⌥M list for at a width. + internal List LayoutsListLines(string key, int width) + { + var (world, _) = LayoutOwner(key); + var inUse = _liveLayout is { } live && string.Equals(live.SessionKey, key, StringComparison.Ordinal) + ? live.LayoutId + : ResolveLayout(key).Layout.Id; + var worldDefault = world?.Layout ?? world?.AcceptedLayoutSuggestion; + var all = Layouts.All; + var nameColumn = Math.Clamp(all.Max(l => Snippet(l.Name).Length) + 2, 12, 24); + var lines = new List(); + + void Row(int index, LayoutDefinition layout) + { + var selected = index == _layoutsSelected; + var mark = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; + var name = Snippet(layout.Name); + name = name.Length > nameColumn - 1 ? name[..(nameColumn - 2)] + "…" : name; + var tags = new List(); + if (layout.Id == inUse) + { + tags.Add("● in use"); + } + + if (layout.Id == worldDefault) + { + tags.Add("● world default"); + } + + var tag = tags.Count == 0 ? string.Empty : string.Join(" ", tags); + var room = Math.Max(0, width - 2 - nameColumn - tag.Length - 1); + var description = LayoutDescription(layout); + description = description.Length > room ? (room > 1 ? description[..(room - 1)] + "…" : string.Empty) : description; + lines.Add( + $"{mark} [{(selected ? "bold " : string.Empty)}{ScreenPalette.Value}]{Escape(name.PadRight(nameColumn))}[/]" + + $"[{ScreenPalette.Label}]{Escape(description.PadRight(room))}[/]" + + (tag.Length == 0 ? string.Empty : $" [{ScreenPalette.Accent}]{tag}[/]")); + } + + lines.Add($"[{ScreenPalette.Label}]built in[/]"); + for (var i = 0; i < all.Count && all[i].IsBuiltIn; i++) + { + Row(i, all[i]); + } + + lines.Add(string.Empty); + lines.Add($"[{ScreenPalette.Label}]yours[/]"); + var own = 0; + for (var i = 0; i < all.Count; i++) + { + if (!all[i].IsBuiltIn) + { + Row(i, all[i]); + own++; + } + } + + if (own == 0) + { + lines.Add($" [{ScreenPalette.Label}]none yet — n saves the panes as they are now[/]"); + } + + lines.Add(string.Empty); + lines.Add( + $"[{ScreenPalette.Accent}]s[/] [{ScreenPalette.Label}]save changes[/] " + + $"[{ScreenPalette.Accent}]n[/] [{ScreenPalette.Label}]save as new[/]"); + lines.Add( + $"[{ScreenPalette.Accent}]w[/] [{ScreenPalette.Label}]use for world[/] " + + $"[{ScreenPalette.Accent}]c[/] [{ScreenPalette.Label}]use for this character[/]"); + if (_layoutsStatus is { } status) + { + lines.Add($"[{ScreenPalette.Value}]{Escape(status)}[/]"); + } + + lines.Add(string.Empty); + lines.Add($"[{ScreenPalette.Label}]↑↓ pick [[Esc]] Close [[⏎]] Apply[/]"); + return lines; + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 0ad7eb92..4cc7ad1d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -722,9 +722,11 @@ public SharpMUTermApp( MediaCache? media = null, PackageStore? packages = null, string? scriptStoreRoot = null, - Func? spelling = null) + Func? spelling = null, + bool autoLayout = false) { _spelling = spelling; + _autoLayout = autoLayout; var capabilities = host.Capabilities; Host = host; _config = config; @@ -780,6 +782,8 @@ public SharpMUTermApp( // Resume the last session's workspace (panes/windows/focus) when the config carries one; // otherwise start with a single main window. Real startup and the demo share this path. _workspace = ResumeOrNew(config); + NoteRestoredOwners(); + RegisterTerminalPanels(); var headless = host.RunsInline; _headless = headless; @@ -908,6 +912,7 @@ public SharpMUTermApp( _composer = new ComposeOverlay(_system, _spelling, _screens); _packageView = new ListOverlay(_system, _screens); _sendMenu = new ListOverlay(_system, _screens); + _layoutsView = new ListOverlay(_system, _screens); _composer.Send += (_, result) => SendComposed(result); _composer.Closed += (_, result) => KeepComposeDraft(result); _quit = new QuitOverlay(_system, QuitFactsNow, Quit); @@ -1765,6 +1770,22 @@ public string RenderSnapshot(string? view = null) } } + // Layouts. `layouts` is the ⌥M list over the demo, opened through the registered shortcut itself; + // `layout-combat` is the demo with the Combat layout realised through the same ApplyLayout ⌥M ⏎ runs, over + // the demo's game data (vitals, so the meters have values) and its recorded streets (so the map has rooms). + // Panels nothing draws yet stay out, which is the data gating the frame is there to show. + if (string.Equals(view, "layouts", StringComparison.OrdinalIgnoreCase)) + { + _shortcuts[(ConsoleModifiers.Alt, ConsoleKey.M)](); + } + + if (string.Equals(view, "layout-combat", StringComparison.OrdinalIgnoreCase)) + { + LoadDemoGameData(); + LoadDemoMap(); + ApplyLayout(DemoScene.ActiveSessionKey, Core.Layouts.BuiltInLayouts.Combat); + } + // The ⌃Q confirmation, over a workspace that has something to lose: a second world marked // connected (the demo scene's own way of saying so, and what the header's "n/m characters" reads), // a line typed into the command line through the bar's real change notification, and then the @@ -2745,6 +2766,7 @@ private void BindSession(WorldSession session, string? windowId = null) // after this transition, so a server that does publish overwrites nothing: it adds a // report beside a connection time that is already here. _mssp.RecordConnection(session.World.Host, session.World.Port, _time.GetUtcNow()); + ScheduleLayoutSuggestion(session); } UpdateStatus(); @@ -2758,12 +2780,17 @@ private void BindSession(WorldSession session, string? windowId = null) session.MsspReceived += (_, e) => OnUi(() => CaptureMssp(session.World, e.Data)); // The meters read the session's game data, which the session has already stored by the time this is // raised. Only the session the status row describes repaints it. - session.GameData.Changed += (_, _) => OnUi(() => + session.GameData.Changed += (_, package) => OnUi(() => { if (ReferenceEquals(session, _active)) { RefreshStatusBar(); } + + // A panel can have just got its data (vitals, who is here); re-folding is rate-limited and a no-op + // when nothing drawn changes, so this costs a dictionary lookup per message. + NoteLayoutInput(session.SessionKey); + NoteSuggestionSignal(session, package); }); session.SpawnLine += (_, e) => OnUi(() => OnSpawnLine(session, e.Target, e.Line)); session.MooEditReceived += (_, edit) => OnUi(() => ReceiveMooEdit(session, edit)); @@ -2789,6 +2816,7 @@ private void BindSession(WorldSession session, string? windowId = null) session.EncodingChanged += (_, _) => OnUi(UpdateStatus); RefreshTabTitles(); UpdateStatus(); + ApplyLayoutOnBind(session); } /// @@ -4611,6 +4639,7 @@ private void OnSpawnLine(WorldSession session, string target, StyledLine line) } else { + PlaceNewSpawnWindow(session, window.Id); RebuildPaneArea(); } } @@ -5067,7 +5096,8 @@ private void ToggleHistorySearch() /// private bool AnyOverlayOpen => _palette.IsOpen || _settings.IsOpen || _quit.IsOpen || _messageLog.IsOpen || _historySearch.IsOpen - || _prefixPanel.IsOpen || _composer.IsOpen || _search.IsOpen || _gameData.IsOpen || _packageView.IsOpen || _sendMenu.IsOpen; + || _prefixPanel.IsOpen || _composer.IsOpen || _search.IsOpen || _gameData.IsOpen || _packageView.IsOpen || _sendMenu.IsOpen + || _layoutsView.IsOpen; /// /// Opens the ⌃F search surface, or closes it when the chord arrives again. @@ -6646,6 +6676,12 @@ private void RegisterFocusReportTab() return () => { NextSearchHit(); return true; }; } + // ⌥M opens the layouts list. ESC m, like the rest of the Alt letters. + if (claim.Key == ConsoleKey.M) + { + return () => { ShowLayouts(); return true; }; + } + // ⌥F freezes and resumes the focused pane. It was ⌃F, and moved so that search could have the // chord every reader on every platform reaches for. Same delivery story as ⌥D and ⌥R: ESC + a // printable byte, decoded as that letter with Alt set. @@ -6882,6 +6918,9 @@ internal void SaveConfiguration() // And F7's sound levels, and F5's per-world download switch, which a playing queue holds a copy of. ApplySoundMix(); + // And F5's layout rows: a live layout whose owner now resolves to another one is re-applied. No timers. + ReapplyLayoutAfterSettings(); + PersistConfiguration(); } @@ -7106,7 +7145,8 @@ private ScreenBinding WorldsScreen(string fkey, bool onCharacters) selection.SelectionIn(WorldsScreenRenderer.WorldsPane), selection.SelectionIn(WorldsScreenRenderer.CharactersPane), selection.SelectionIn(WorldsScreenRenderer.TriggerSetsPane), - OpenMsspScreen), + OpenMsspScreen, + Layouts.All), SaveConfiguration); session.Selection.Seed(WorldsScreenRenderer.WorldsPane, ActiveWorldIndex()); session.Selection.Seed(WorldsScreenRenderer.CharactersPane, ActiveCharacterIndex()); @@ -7126,7 +7166,8 @@ private ScreenBinding WorldsScreen(string fkey, bool onCharacters) fkey, session.Selection.SelectionIn(WorldsScreenRenderer.TriggerSetsPane), _system.DesktopDimensions.Height, - info: true)); + info: true, + layouts: Layouts.All)); } /// @@ -8147,6 +8188,9 @@ private bool RunBuiltInCommand(string id) case "term:map": ShowMap(); return true; + case "layout:layouts": + ShowLayouts(); + return true; case "term:mute": case "term:unmute": SetMuted(id == "term:mute"); @@ -8355,6 +8399,7 @@ private void StartMapping(WorldSession session) { RenderMap(MapWindowId(session.SessionKey)); RefreshStatusBar(); + NoteLayoutInput(session.SessionKey); // the first room recorded is the map panel's data }; walk.Changed += (_, reason) => OnWalkChanged(session, reason); session.StateChanged += (_, e) => @@ -10452,6 +10497,14 @@ private IWindowControl BuildTabContent(PaneNode pane, string windowId, Workspace return map; } + // A layout panel drawn by a control of its own (TerminalPanels). An unregistered one falls through to an + // empty output view rather than vanishing, so a window restored from a build that had the panel still shows. + if (TerminalPanels.TryParseWindowId(windowId, out var panelId, out var panelOwner) + && Panels.GetOrCreate(new TerminalPanelContext(panelId, panelOwner, FindSession(panelOwner), windowId)) is { } panel) + { + return panel; + } + return OutputViewFor(windowId, window.Title); } @@ -10535,6 +10588,7 @@ private MarkupControl FrozenContentFor(string windowId) /// Rebuilds the pane area from the model and swaps it into the live window. private void RebuildPaneArea() { + PaneAreaRebuilds++; var row = BuildWorkspaceRow(); _window.RemoveContent(_workspaceRow); _window.InsertControl(WorkspaceRowIndex, row); @@ -10542,6 +10596,9 @@ private void RebuildPaneArea() RefreshTabTitles(); } + /// How many times the pane area has been torn down and rebuilt; a test counts the reflows a change cost. + internal int PaneAreaRebuilds { get; private set; } + /// The TabControl of the focused pane, or null if none is realised. private TabControl? FocusedTabs() => _paneTabs.GetValueOrDefault(_workspace.Layout.FocusedPaneId); diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index e89b91ab..d5af7fb9 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -24,6 +24,6 @@ internal static class SnapshotViews "mxp-image", "mxp-figure", "input-selection", "selection", "trigger-builder", "prefix", "prefix-panel", "focus", "focus-moved", "tabs", "tabs-many", "collapsed", "timestamps", "timestamps-toggled", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", - "packages", "package-review", "package-browse", "send-menu", + "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", ]; } diff --git a/src/SharpMUTerm.Tui/TerminalPanels.cs b/src/SharpMUTerm.Tui/TerminalPanels.cs new file mode 100644 index 00000000..bf46ad70 --- /dev/null +++ b/src/SharpMUTerm.Tui/TerminalPanels.cs @@ -0,0 +1,101 @@ +using SharpConsoleUI.Controls; +using SharpMUTerm.Core.Session; + +namespace SharpMUTerm.Tui; + +/// What a terminal panel is being built for: which panel, whose, and the window that will hold it. +/// One of PanelIds. +/// The world.character the panel belongs to. +/// That character's live session, or null (the snapshot demo has none). +/// The workspace window the control is shown in (). +internal sealed record TerminalPanelContext(string PanelId, string SessionKey, WorldSession? Session, string WindowId); + +/// +/// The seam layout panels plug into, keyed by panel id. A panel that is drawn by a pane control of its own — who is +/// here, the vitals strip, the quick bar, the docked composer — registers a factory here at startup +/// (SharpMUTermApp.RegisterTerminalPanels), and the layout code realises it as a workspace window +/// owned by the session, shown as a tab of the pane the layout puts it in. +/// +/// Three panels are not registered here because they are windows already: output (the session's window), +/// chat (its capture windows) and map (map:<key>). An id that is neither those nor +/// registered counts as having no data, so a layout naming it folds it into its Waiting list and draws +/// nothing — an unbuilt panel costs no cells. +/// +/// +/// The factory is called once per window; the control is cached here and re-parented on every pane rebuild, the way +/// the map's control is, so it must survive being moved between containers. +/// +/// +internal sealed class TerminalPanels +{ + /// The prefix of every panel window id. + public const string WindowPrefix = "panel:"; + + private readonly Dictionary> _factories = new(StringComparer.Ordinal); + private readonly Dictionary _controls = new(StringComparer.Ordinal); + + /// Registers the factory for , replacing any earlier one. + public void Register(string panelId, Func factory) + { + ArgumentException.ThrowIfNullOrEmpty(panelId); + _factories[panelId] = factory ?? throw new ArgumentNullException(nameof(factory)); + } + + /// Whether a factory is registered for . + public bool IsRegistered(string panelId) => _factories.ContainsKey(panelId); + + /// The ids with a factory. + public IReadOnlyCollection Registered => _factories.Keys; + + /// The window id that shows for . + public static string WindowId(string panelId, string sessionKey) => $"{WindowPrefix}{panelId}:{sessionKey}"; + + /// + /// Reads a panel window id back. The panel id runs to the first colon after the prefix (no panel id has one); + /// the session key is the rest, colons and all. + /// + public static bool TryParseWindowId(string windowId, out string panelId, out string sessionKey) + { + panelId = string.Empty; + sessionKey = string.Empty; + if (windowId is null || !windowId.StartsWith(WindowPrefix, StringComparison.Ordinal)) + { + return false; + } + + var rest = windowId.AsSpan(WindowPrefix.Length); + var colon = rest.IndexOf(':'); + if (colon <= 0 || colon == rest.Length - 1) + { + return false; + } + + panelId = rest[..colon].ToString(); + sessionKey = rest[(colon + 1)..].ToString(); + return true; + } + + /// The control already built for , or null. + public IWindowControl? ControlFor(string windowId) => _controls.GetValueOrDefault(windowId); + + /// The control for 's window, built on first use; null when the id is unregistered. + internal IWindowControl? GetOrCreate(TerminalPanelContext context) + { + if (_controls.TryGetValue(context.WindowId, out var existing)) + { + return existing; + } + + if (!_factories.TryGetValue(context.PanelId, out var factory)) + { + return null; + } + + var control = factory(context); + _controls[context.WindowId] = control; + return control; + } + + /// Forgets a window's control, when the window is closed. + internal void Forget(string windowId) => _controls.Remove(windowId); +} diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index 79f7fb6a..3a951dcb 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Core.Layouts; using System.Globalization; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Telnet; @@ -95,6 +96,27 @@ internal static class WorldsScreenRenderer /// , as one of . internal const int DiscordField = 14; + /// : the layout this world's characters use, or the suggestion. + internal const int WorldLayoutField = 15; + + /// What a world with no layout of its own reads as: the suggestion it accepted, else Roleplay. + internal const string WorldLayoutDefault = "(suggested)"; + + /// What a character with no layout of its own reads as. + internal const string CharacterLayoutDefault = "(world default)"; + + /// The layout row's choices: the default word, then every layout by name. + internal static IReadOnlyList LayoutChoices(IReadOnlyList layouts, string unset) => + [unset, .. layouts.Select(l => l.Name)]; + + /// The name of the layout names, or null for none (or one that is gone). + internal static string? LayoutName(IReadOnlyList layouts, string? id) => + id is null ? null : layouts.FirstOrDefault(l => string.Equals(l.Id, id, StringComparison.Ordinal))?.Name; + + /// The id of the layout called , or null for the default word. + internal static string? LayoutId(IReadOnlyList layouts, string name) => + layouts.FirstOrDefault(l => string.Equals(l.Name, name, StringComparison.OrdinalIgnoreCase))?.Id; + /// F5's words for . internal static readonly string[] DiscordChoices = ["off", "show status"]; @@ -161,6 +183,9 @@ internal static class WorldsScreenRenderer /// internal const int PaneTintField = 9; + /// , appended after the tint: also about how the panes look. + internal const int CharacterLayoutField = 10; + /// /// The trigger-set row's field ordinals. A set's name leads, as every list row's does — and here it /// is more than a label: a character opts into automation by name, so renaming a set is a @@ -446,10 +471,12 @@ internal static ScreenModel Model( int selectedWorld, int selectedCharacter, int selectedSet = 0, - Action? info = null) + Action? info = null, + IReadOnlyList? layouts = null) { ArgumentNullException.ThrowIfNull(worlds); ArgumentNullException.ThrowIfNull(triggerSets); + var all = layouts ?? BuiltInLayouts.All; (selectedWorld, selectedCharacter) = Resolve(worlds, selectedWorld, selectedCharacter); @@ -480,7 +507,12 @@ internal static ScreenModel Model( "discord", () => w.DiscordPresence ? DiscordChoices[1] : DiscordChoices[0], v => w.DiscordPresence = v == DiscordChoices[1], - DiscordChoices))) + DiscordChoices), + ScreenField.Choice( + "layout", + () => LayoutName(all, w.Layout) ?? WorldLayoutDefault, + v => w.Layout = LayoutId(all, v), + LayoutChoices(all, WorldLayoutDefault)))) .Concat(WorldButtons(worlds, selectedWorld, info)) .ToArray(); @@ -511,7 +543,12 @@ internal static ScreenModel Model( () => c.Logging.RestoreLog ? RestoreOn : RestoreOff, v => c.Logging.RestoreLog = string.Equals(v, RestoreOn, StringComparison.OrdinalIgnoreCase), RestoreChoices), - ScreenField.Enumeration(TintLabel, () => c.Tint, v => c.Tint = v))) + ScreenField.Enumeration(TintLabel, () => c.Tint, v => c.Tint = v), + ScreenField.Choice( + "layout", + () => LayoutName(all, c.Layout) ?? CharacterLayoutDefault, + v => c.Layout = LayoutId(all, v), + LayoutChoices(all, CharacterLayoutDefault)))) .Concat(CharacterButtons(world, selectedCharacter)) .ToArray(); @@ -938,8 +975,10 @@ internal static List DetailColumn( int selectedCharacter, string accent, ScreenFocus? focus = null, - int height = 0) + int height = 0, + IReadOnlyList? layouts = null) { + var all = layouts ?? BuiltInLayouts.All; var cursor = focus ?? ScreenFocus.None; (selectedWorld, selectedCharacter) = Resolve(worlds, selectedWorld, selectedCharacter); if (selectedWorld < 0) @@ -1028,6 +1067,13 @@ world.GrabPrefix is { } grab cursor, selectedWorld, DiscordField)), + WorldField("layout", Field( + LayoutName(all, world.Layout) is { } worldLayout + ? $"[{Value}]{Escape(worldLayout)}[/]" + : $"[{Label}]{WorldLayoutDefault} · {Escape(LayoutName(all, world.AcceptedLayoutSuggestion) ?? BuiltInLayouts.Roleplay.Name)}[/]", + cursor, + selectedWorld, + WorldLayoutField)), string.Empty, $"[{accent}]├ CHARACTERS[/] [{Label}]a character is a connection[/]", }); @@ -1144,8 +1190,13 @@ private static string Checkbox(string label, bool value, string hint) /// /// internal static List FormColumn( - CharacterDefinition character, string accent, ScreenFocus? focus = null, int selectedCharacter = -1) + CharacterDefinition character, + string accent, + ScreenFocus? focus = null, + int selectedCharacter = -1, + IReadOnlyList? layouts = null) { + var all = layouts ?? BuiltInLayouts.All; var cursor = focus ?? ScreenFocus.None; var form = new List { @@ -1219,6 +1270,14 @@ internal static List FormColumn( selectedCharacter, PaneTintField, pane: CharactersPane) + $" [{Label}]{TintNote}[/]"), + CharField("layout", Field( + LayoutName(all, character.Layout) is { } own + ? $"[{Value}]{Escape(own)}[/]" + : $"[{Label}]{CharacterLayoutDefault}[/]", + cursor, + selectedCharacter, + CharacterLayoutField, + pane: CharactersPane)), }; // The log format and `restore` both sit near the foot of this block, so their lists are drawn diff --git a/src/SharpMUTerm.Tui/WorldsScreenView.cs b/src/SharpMUTerm.Tui/WorldsScreenView.cs index 10221711..7c6c4b3a 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenView.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenView.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Core.Layouts; using SharpMUTerm.Core.Configuration; using SharpConsoleUI; using SharpConsoleUI.Builders; @@ -27,7 +28,8 @@ public static IWindowControl Build( string fkey = WorldsScreenRenderer.FKey, int selectedSet = 0, int height = 0, - bool info = false) + bool info = false, + IReadOnlyList? layouts = null) { // Both panes end in button rows, so a raw cursor can point past its list; resolving once here // keeps every block of the screen agreeing on which world and character are selected. @@ -38,7 +40,7 @@ public static IWindowControl Build( // The model is rebuilt here only to derive the header's hints, so the INFO row's presence is all // it needs of the action — a no-op stands in for it, and the delegate stays with the session. var model = WorldsScreenRenderer.Model( - worlds, triggerSets, selectedWorld, selectedCharacter, selectedSet, info ? _ => { } : null); + worlds, triggerSets, selectedWorld, selectedCharacter, selectedSet, info ? _ => { } : null, layouts); var header = ScreenChrome.Band( WorldsScreenRenderer.HeaderLine(width, model, focus, fkey), ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( @@ -51,7 +53,7 @@ public static IWindowControl Build( var band = WorldsScreenRenderer.HasCharacter(worlds, selectedWorld, selectedCharacter) ? Math.Max( WorldsScreenRenderer.FormColumn( - worlds[selectedWorld].Characters[selectedCharacter], accent, focus, selectedCharacter).Count, + worlds[selectedWorld].Characters[selectedCharacter], accent, focus, selectedCharacter, layouts).Count, WorldsScreenRenderer.TriggersColumn( worlds[selectedWorld].Characters[selectedCharacter], triggerSets, @@ -67,7 +69,7 @@ public static IWindowControl Build( WorldsScreenRenderer.WorldsColumn(worlds, selectedWorld, focus, rows, info), scheme)); var detailCol = ScreenChrome.Stretch(ScreenChrome.Panel( WorldsScreenRenderer - .DetailColumn(worlds, triggerSets, selectedWorld, selectedCharacter, accent, focus, rows), + .DetailColumn(worlds, triggerSets, selectedWorld, selectedCharacter, accent, focus, rows, layouts), scheme)); var body = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) @@ -85,7 +87,7 @@ public static IWindowControl Build( if (WorldsScreenRenderer.HasCharacter(worlds, selectedWorld, selectedCharacter)) { var character = worlds[selectedWorld].Characters[selectedCharacter]; - var form = WorldsScreenRenderer.FormColumn(character, accent, focus, selectedCharacter).ToList(); + var form = WorldsScreenRenderer.FormColumn(character, accent, focus, selectedCharacter, layouts).ToList(); var triggers = WorldsScreenRenderer .TriggersColumn(character, triggerSets, accent, focus, selectedSet, worlds) .ToList(); diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutRealiserTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutRealiserTests.cs new file mode 100644 index 00000000..a0a44db7 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutRealiserTests.cs @@ -0,0 +1,116 @@ +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Core.Tests.Layouts; + +/// +/// turns a fold into a workspace tree of windows, reads an +/// arrangement back into placements, and swaps the result in. +/// +public class LayoutRealiserTests +{ + private static readonly IReadOnlyDictionary Windows = new Dictionary + { + [PanelIds.Output] = ["main"], + [PanelIds.Map] = ["map:W.C"], + [PanelIds.Chat] = ["spawn:chat", "spawn:ooc"], + [PanelIds.Vitals] = ["panel:vitals:W.C"], + }; + + private static IReadOnlyList WindowsOf(string panel) => Windows.GetValueOrDefault(panel) ?? []; + + [Test] + public async Task CombatPutsTheMapBesideTheOutputAndTheCollapsedChatUnderTheMapAsTabs() + { + var fold = LayoutFold.Fold(BuiltInLayouts.Combat, new PanelAvailability(RoomsRecorded: 3, MeterValueArrived: true, SpawnWindows: 2)); + var realised = LayoutRealiser.Realise(BuiltInLayouts.Combat, fold, WindowsOf, "main")!; + + var panes = realised.Root.Panes().ToDictionary(p => p.Id); + await Assert.That(panes["panel:map"].Tabs).IsEquivalentTo(new[] { "map:W.C", "spawn:chat", "spawn:ooc" }); + await Assert.That(panes["panel:map"].ActiveTab).IsEqualTo("map:W.C"); + await Assert.That(panes["panel:vitals"].Tabs).IsEquivalentTo(new[] { "panel:vitals:W.C" }); + // The quick bar has no window, so its pane is dropped rather than drawn empty. + await Assert.That(panes.ContainsKey("panel:quick-bar")).IsFalse(); + await Assert.That(realised.FocusedPaneId).IsEqualTo("panel:output"); + await Assert.That(realised.PanelPanes[PanelIds.Chat]).IsEqualTo("panel:map"); + } + + [Test] + public async Task WindowsNoPanelPlacesAreKeptInThePaneTheyAskForOrTheOutputPane() + { + var fold = LayoutFold.Fold(BuiltInLayouts.Combat, new PanelAvailability(RoomsRecorded: 3)); + var realised = LayoutRealiser.Realise( + BuiltInLayouts.Combat, fold, WindowsOf, "main", + [("web", "panel:map"), ("char:Other.Ann", "p7"), ("main", null)])!; + + var panes = realised.Root.Panes().ToDictionary(p => p.Id); + await Assert.That(panes["panel:map"].Tabs).Contains("web"); + await Assert.That(panes["panel:output"].Tabs).IsEquivalentTo(new[] { "main", "char:Other.Ann" }); + await Assert.That(panes["panel:output"].ActiveTab).IsEqualTo("main"); + } + + [Test] + public async Task TheShapeChangesOnlyWhenWhatIsDrawnChanges() + { + var quiet = LayoutFold.Fold(BuiltInLayouts.Combat, new PanelAvailability()); + var stillQuiet = LayoutFold.Fold(BuiltInLayouts.Combat, new PanelAvailability(GameDataEntries: 40)); + var mapped = LayoutFold.Fold(BuiltInLayouts.Combat, new PanelAvailability(RoomsRecorded: 1)); + + await Assert.That(LayoutRealiser.FoldShape(stillQuiet)).IsEqualTo(LayoutRealiser.FoldShape(quiet)); + await Assert.That(LayoutRealiser.FoldShape(mapped)).IsNotEqualTo(LayoutRealiser.FoldShape(quiet)); + } + + [Test] + public async Task ReplacingTheTreeClearsTheZoomAndFocusesTheNamedPane() + { + var layout = new WorkspaceLayout(["main", "web"]); + layout.SplitFocused(SplitDirection.Row); + layout.ToggleZoom(); + var fold = LayoutFold.Fold(BuiltInLayouts.Combat, new PanelAvailability(RoomsRecorded: 1)); + var realised = LayoutRealiser.Realise(BuiltInLayouts.Combat, fold, WindowsOf, "main", [("web", null)])!; + + layout.ReplaceTree(realised.Root, realised.FocusedPaneId); + + await Assert.That(layout.ZoomedPaneId).IsNull(); + await Assert.That(layout.FocusedPaneId).IsEqualTo("panel:output"); + await Assert.That(layout.FindWindow("map:W.C")!.Id).IsEqualTo("panel:map"); + // A split after the swap gets a fresh pN id, and the panes keep the fold's numbering: main first. + layout.SplitFocused(SplitDirection.Column); + await Assert.That(layout.Panes.Select(p => p.Id).Distinct().Count()).IsEqualTo(layout.Panes.Count); + await Assert.That(layout.Panes[0].Id).IsEqualTo("panel:output"); + } + + [Test] + public async Task CapturingTheCombatArrangementGivesBackItsRegions() + { + var fold = LayoutFold.Fold(BuiltInLayouts.Combat, new PanelAvailability(RoomsRecorded: 3, MeterValueArrived: true, SpawnWindows: 2)); + var realised = LayoutRealiser.Realise(BuiltInLayouts.Combat, fold, WindowsOf, "main")!; + string? PanelOf(string window) => Windows.FirstOrDefault(kv => kv.Value.Contains(window)).Key; + + var captured = LayoutCapture.Capture(realised.Root, PanelOf, BuiltInLayouts.Combat)!; + + var byId = captured.Placements.ToDictionary(p => p.PanelId); + await Assert.That(byId[PanelIds.Output].Region).IsEqualTo(LayoutRegion.Main); + await Assert.That(byId[PanelIds.Map].Region).IsEqualTo(LayoutRegion.Side); + await Assert.That(byId[PanelIds.Vitals].Region).IsEqualTo(LayoutRegion.TopStrip); + await Assert.That(byId[PanelIds.Chat].TabOf).IsEqualTo(PanelIds.Map); + // Not on screen (no window draws it), so it keeps the placement the layout gave it. + await Assert.That(byId[PanelIds.QuickBar].Region).IsEqualTo(LayoutRegion.Bottom); + await Assert.That(captured.RegionShares[LayoutRegion.Side]).IsBetween(0.25, 0.35); + + // And folding the capture again draws the same panes. + var again = LayoutFold.Fold( + new LayoutDefinition { Id = "x", Name = "x", Placements = captured.Placements, RegionShares = captured.RegionShares }, + new PanelAvailability(RoomsRecorded: 3, MeterValueArrived: true, SpawnWindows: 2)); + var panesAgain = again.Root!.Panes().Select(p => p.Id).OrderBy(id => id, StringComparer.Ordinal); + var panesBefore = realised.Root.Panes().Select(p => p.Id).Append("panel:quick-bar").OrderBy(id => id, StringComparer.Ordinal); + await Assert.That(panesAgain).IsEquivalentTo(panesBefore); + } + + [Test] + public async Task NothingIsCapturedWithoutTheOutput() + { + var tree = new PaneNode("p1", ["web"]); + await Assert.That(LayoutCapture.Capture(tree, _ => null)).IsNull(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/LayoutWiringTests.cs b/tests/SharpMUTerm.Tui.Tests/LayoutWiringTests.cs new file mode 100644 index 00000000..f1a77b98 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/LayoutWiringTests.cs @@ -0,0 +1,249 @@ +using SharpConsoleUI.Controls; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Layouts in the client: ⌥M and ⌃P open the list, applying realises panes for the panels that have data, a bound +/// session gets its layout unless the restored workspace arranged it, a re-fold waits out a burst and rebuilds only +/// when a panel appears, and the player rearranging the panes ends the re-folding. +/// +/// Serialised: rendering redirects the process-global Console.Out. +[NotInParallel] +public class LayoutWiringTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static readonly ConsoleKeyInfo AltM = new('m', ConsoleKey.M, shift: false, alt: true, control: false); + + private static SharpMUTermApp Demo(AppConfiguration? config = null) + { + Console.SetIn(TextReader.Null); + config ??= DemoScene.Build(); + config.ScrollbackSpill.Enabled = false; + return new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32)); + } + + private static (SharpMUTermApp App, AppConfiguration Config, ManualTimeProvider Time) Live(bool restored = false) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ScrollbackSpill.Enabled = false; + if (!restored) + { + config.LastSession = null; + } + + var time = new ManualTimeProvider(); + var app = new SharpMUTermApp( + config, ClientHost.Headless(new HeadlessConsoleDriver(120, 32), Headless), time, autoLayout: true); + return (app, config, time); + } + + private static ConsoleKeyInfo Letter(char c) => new(c, ConsoleKey.A + (char.ToUpperInvariant(c) - 'A'), false, false, false); + + [Test] + public async Task AltMIsAClaimedChordThatOpensTheLayoutsList() + { + await Assert.That(MacroKeys.AppShortcuts.Any(s => s.Modifiers == ConsoleModifiers.Alt && s.Key == ConsoleKey.M)).IsTrue(); + + await using var app = Demo(); + app.RenderSnapshot(); + app.SimulateKey(AltM); + + await Assert.That(app.LayoutsOpen).IsTrue(); + var text = string.Join("\n", app.LayoutsLines); + await Assert.That(text).Contains("Roleplay"); + await Assert.That(text).Contains("Combat"); + await Assert.That(text).Contains("in use"); + await Assert.That(text).Contains("[Esc]] Close"); + + app.SimulateLayoutsKey(new ConsoleKeyInfo('\u001b', ConsoleKey.Escape, false, false, false)); + await Assert.That(app.LayoutsOpen).IsFalse(); + } + + [Test] + public async Task TheCommandSurfaceOpensTheSameList() + { + await using var app = Demo(); + app.RenderSnapshot(); + + await Assert.That(app.DispatchCommand("layout:layouts")).IsTrue(); + await Assert.That(app.LayoutsOpen).IsTrue(); + } + + [Test] + public async Task CombatOverTheDemoPutsTheMapBesideTheOutputWithChatTabbedUnderIt() + { + await using var app = Demo(); + app.RenderSnapshot("layout-combat"); + + await Assert.That(app.LiveLayoutId).IsEqualTo(BuiltInLayouts.CombatId); + await Assert.That(app.PaneIdOf("main")).IsEqualTo("panel:output"); + await Assert.That(app.PaneIdOf(SharpMUTermApp.MapWindowId(DemoScene.ActiveSessionKey))).IsEqualTo("panel:map"); + await Assert.That(app.PaneIdOf(DemoScene.ChatWindowId)).IsEqualTo("panel:map"); + await Assert.That(app.FocusedPaneId).IsEqualTo("panel:output"); + // Vitals and the quick bar have nothing to draw them in this build, so they take no pane. + await Assert.That(app.PaneIds).IsEquivalentTo(new[] { "panel:output", "panel:map" }); + } + + [Test] + public async Task ARegisteredPanelIsDrawnInItsOwnPaneOnceItHasData() + { + await using var app = Demo(); + app.Panels.Register(PanelIds.Vitals, _ => new MarkupControl(["vitals"])); + app.RenderSnapshot("layout-combat"); + + var window = TerminalPanels.WindowId(PanelIds.Vitals, DemoScene.ActiveSessionKey); + await Assert.That(app.PaneIdOf(window)).IsEqualTo("panel:vitals"); + await Assert.That(app.Panels.ControlFor(window)).IsNotNull(); + await Assert.That(TerminalPanels.TryParseWindowId(window, out var panel, out var key)).IsTrue(); + await Assert.That(panel).IsEqualTo(PanelIds.Vitals); + await Assert.That(key).IsEqualTo(DemoScene.ActiveSessionKey); + } + + [Test] + public async Task ABoundSessionGetsItsLayoutWhenNothingWasRestored() + { + var (app, config, _) = Live(); + await using var _app = app; + var session = app.BindWorldWithoutConnecting(config.Worlds[0]); + + await Assert.That(app.LiveLayoutId).IsEqualTo(BuiltInLayouts.RoleplayId); + await Assert.That(app.LiveLayoutOwner).IsEqualTo(session.SessionKey); + await Assert.That(app.PaneIdOf("main")).IsEqualTo("panel:output"); + } + + [Test] + public async Task ARestoredWorkspaceWinsOverTheLayoutAtStartup() + { + var (app, config, _) = Live(restored: true); + await using var _app = app; + var before = app.PaneIds.ToArray(); + app.BindWorldWithoutConnecting(config.Worlds[0]); + + await Assert.That(app.LiveLayoutId).IsNull(); + await Assert.That(app.PaneIds).IsEquivalentTo(before); + } + + [Test] + public async Task ARefoldWaitsForTheBurstAndRebuildsOnlyWhenAPanelAppears() + { + var (app, config, time) = Live(); + await using var _app = app; + config.Worlds[0].Layout = BuiltInLayouts.CombatId; + app.Panels.Register(PanelIds.Vitals, _ => new MarkupControl(["vitals"])); + var session = app.BindWorldWithoutConnecting(config.Worlds[0]); + await Assert.That(app.PaneIds).IsEquivalentTo(new[] { "panel:output" }); + + var rebuilds = app.PaneAreaRebuilds; + for (var hp = 400; hp < 410; hp++) + { + session.GameData.SetGmcp("Char.Vitals", $$"""{"hp":"{{hp}}","maxhp":"500"}"""); + } + + await Assert.That(app.PaneAreaRebuilds).IsEqualTo(rebuilds); // nothing until the burst settles + time.Advance(SharpMUTermApp.LayoutRefoldDelay); + await Assert.That(app.PaneIds).Contains("panel:vitals"); + await Assert.That(app.PaneAreaRebuilds).IsEqualTo(rebuilds + 1); + + rebuilds = app.PaneAreaRebuilds; + session.GameData.SetGmcp("Char.Vitals", """{"hp":"12","maxhp":"500"}"""); + time.Advance(SharpMUTermApp.LayoutRefoldDelay); + await Assert.That(app.PaneAreaRebuilds).IsEqualTo(rebuilds); // the same panels: no reflow + } + + [Test] + public async Task RearrangingThePanesHandsThemToThePlayer() + { + var (app, config, time) = Live(); + await using var _app = app; + config.Worlds[0].Layout = BuiltInLayouts.CombatId; + app.Panels.Register(PanelIds.Vitals, _ => new MarkupControl(["vitals"])); + var session = app.BindWorldWithoutConnecting(config.Worlds[0]); + + app.OpenUnownedWindowForTest("aside", "Aside"); // a second tab, so the split has something to move + var shape = app.PaneIds.Count; + app.DispatchCommand("layout:split-right"); + await Assert.That(app.PaneIds.Count).IsEqualTo(shape + 1); + session.GameData.SetGmcp("Char.Vitals", """{"hp":"400","maxhp":"500"}"""); + time.Advance(SharpMUTermApp.LayoutRefoldDelay); + + await Assert.That(app.PaneIds).DoesNotContain("panel:vitals"); + await Assert.That(app.LiveLayoutId).IsNull(); + } + + [Test] + public async Task SaveAsNewCapturesTheArrangementAndCPutsItToUse() + { + var config = DemoScene.Build(); + await using var app = Demo(config); + app.RenderSnapshot("layout-combat"); + app.SimulateKey(AltM); + + app.SimulateLayoutsKey(Letter('n')); + await Assert.That(config.Layouts.Count).IsEqualTo(1); + var saved = config.Layouts[0]; + await Assert.That(saved.Name).IsEqualTo("Combat 2"); + await Assert.That(saved.PlacementOf(PanelIds.Map)!.Region).IsEqualTo(LayoutRegion.Side); + await Assert.That(saved.PlacementOf(PanelIds.Chat)!.TabOf).IsEqualTo(PanelIds.Map); + + app.SimulateLayoutsKey(Letter('c')); + var corvid = config.Worlds[0].Characters.First(c => c.Name == DemoScene.MainCharacterName); + await Assert.That(corvid.Layout).IsEqualTo(saved.Id); + await Assert.That(string.Join("\n", app.LayoutsLines)).Contains("Corvid uses Combat 2"); + } + + [Test] + public async Task SavingChangesToABuiltInSavesACopyAndPointsTheCharacterAtIt() + { + var config = DemoScene.Build(); + await using var app = Demo(config); + app.RenderSnapshot("layout-combat"); + app.SimulateKey(AltM); + app.SimulateLayoutsKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); // Combat + + app.SimulateLayoutsKey(Letter('s')); + + await Assert.That(BuiltInLayouts.Combat.Placements.Count).IsEqualTo(5); // untouched + var copy = config.Layouts.Single(); + var corvid = config.Worlds[0].Characters.First(c => c.Name == DemoScene.MainCharacterName); + await Assert.That(corvid.Layout).IsEqualTo(copy.Id); + await Assert.That(app.LiveLayoutId).IsEqualTo(copy.Id); + } + + [Test] + public async Task TheSuggestionIsTakenOnceAndSaidOnce() + { + var (app, config, _) = Live(); + await using var _app = app; + var session = app.BindWorldWithoutConnecting(config.Worlds[0]); + session.GameData.SetGmcp("Char.Vitals", """{"hp":"400","maxhp":"500"}"""); + + app.AcceptLayoutSuggestion(session); + app.AcceptLayoutSuggestion(session); + + await Assert.That(config.Worlds[0].AcceptedLayoutSuggestion).IsEqualTo(BuiltInLayouts.CombatId); + var said = app.Messages.Entries.Count(m => m.Text.Contains("Using the Combat layout", StringComparison.Ordinal)); + await Assert.That(said).IsEqualTo(1); + await Assert.That(app.LiveLayoutId).IsEqualTo(BuiltInLayouts.CombatId); + } + + [Test] + public async Task TheWorldsScreenOffersEveryLayoutAndAWordForNone() + { + IReadOnlyList all = [.. BuiltInLayouts.All, new LayoutDefinition { Id = "x1", Name = "Mine" }]; + + await Assert.That(WorldsScreenRenderer.LayoutChoices(all, WorldsScreenRenderer.WorldLayoutDefault)) + .IsEquivalentTo(new[] { "(suggested)", "Roleplay", "Combat", "Mine" }); + await Assert.That(WorldsScreenRenderer.LayoutId(all, "mine")).IsEqualTo("x1"); + await Assert.That(WorldsScreenRenderer.LayoutId(all, WorldsScreenRenderer.CharacterLayoutDefault)).IsNull(); + await Assert.That(WorldsScreenRenderer.LayoutName(all, "gone")).IsNull(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs index 4cc3c22e..81ec108d 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs @@ -512,7 +512,7 @@ public async Task Worlds_TheCharacterRowCarriesItsLogFormatFolderAndRestoreSwitc var model = WorldsScreenRenderer.Model(worlds, Sets(), 0, 0); var row = model.RowAt(WorldsScreenRenderer.CharactersPane, 0); - await Assert.That(row.FieldCount).IsEqualTo(10); + await Assert.That(row.FieldCount).IsEqualTo(11); await Assert.That(row.FieldAt(WorldsScreenRenderer.CharacterNameField)!.Value.Get()).IsEqualTo("Kaz"); await Assert.That(row.FieldAt(WorldsScreenRenderer.LogFormatField)!.Value.Get()).IsEqualTo("Html"); await Assert.That(row.FieldAt(WorldsScreenRenderer.LogDirectoryField)!.Value.Get()).IsEqualTo("/logs/kaz"); From 01377316a7c7ebd4341808681982bce4c4dc6c80 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 03:53:14 +0000 Subject: [PATCH 011/113] Settings, rebuilt (first pass): declared F7/F8, search, changed marks, meter table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit F7 and F8 are drawn from settings sections declared in SharpMUTerm.Client (BuiltInSettings): each field has a group heading and a SettingBinding over the configuration, whose default is read off a fresh AppConfiguration. F7 is now "Text & display", grouped under Colour & legibility, Text, Links & pictures, Status row & meters, Activity and Sound, and windowed to the screen height so nothing runs off a 24-row terminal. - `/` on any settings screen opens a search over every declared field and every screen title, with a per-section match count; Enter goes to the field on its own screen, Esc puts the screen back. - A field away from its default is marked "● changed"; `r` resets it through the same save funnel. The header names `r reset` only there. - F7's meters are a table: label, value path, maximum path and a live `now` column from the focused session's game data, [+ meter], Delete to remove, a box of received paths while the cursor is in the table, and the path fields offer those paths with their values. Snapshot views settings-search, settings-meters, settings-meters-pick and settings-changed, in the parity list and FrameContrastTests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 11 + CLAUDE.md | 31 +- .../Contributions/Descriptors.cs | 32 +- .../Settings/BuiltInSettings.cs | 213 +++++ .../Settings/SettingBinding.cs | 99 +++ .../Settings/SettingsSearch.cs | 75 ++ .../Configuration/AppConfiguration.cs | 2 +- .../Configuration/PreferenceSettings.cs | 2 +- src/SharpMUTerm.Tui/MacroKeys.cs | 2 +- src/SharpMUTerm.Tui/OptionsScreenRenderer.cs | 740 +++++++++++++----- src/SharpMUTerm.Tui/OptionsScreenView.cs | 19 +- src/SharpMUTerm.Tui/ScreenChrome.cs | 30 +- src/SharpMUTerm.Tui/ScreenEdits.cs | 11 + src/SharpMUTerm.Tui/ScreenField.cs | 13 +- src/SharpMUTerm.Tui/ScreenModel.cs | 10 +- src/SharpMUTerm.Tui/SettingsOverlay.cs | 126 ++- src/SharpMUTerm.Tui/SettingsSearchSurface.cs | 342 ++++++++ src/SharpMUTerm.Tui/SettingsSession.cs | 24 +- .../SharpMUTermApp.Settings.cs | 93 +++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 105 ++- src/SharpMUTerm.Tui/SnapshotViews.cs | 1 + .../SettingsDeclarationTests.cs | 108 +++ .../ClientHostContractTests.cs | 3 +- .../FrameContrastTests.cs | 4 + tests/SharpMUTerm.Tui.Tests/GameDataTests.cs | 80 +- .../OptionsScreenRendererTests.cs | 3 +- .../ScreenCursorTests.cs | 7 +- .../SharpMUTerm.Tui.Tests/ScreenModelTests.cs | 33 +- .../SettingsSearchTests.cs | 148 ++++ 29 files changed, 2085 insertions(+), 282 deletions(-) create mode 100644 src/SharpMUTerm.Client/Settings/BuiltInSettings.cs create mode 100644 src/SharpMUTerm.Client/Settings/SettingBinding.cs create mode 100644 src/SharpMUTerm.Client/Settings/SettingsSearch.cs create mode 100644 src/SharpMUTerm.Tui/SettingsSearchSurface.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs create mode 100644 tests/SharpMUTerm.Client.Tests/SettingsDeclarationTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/SettingsSearchTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 911140d8..195d1164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Search the settings: press `/` on any settings screen and type. Every option, and every settings screen by + name, is listed with how many matches each screen holds; ⏎ goes straight to the option on its own screen. +- A setting you have changed from its default is marked `● changed` on Text & display (F7) and Input (F8), + and `r` on it puts the default back. - Make a trigger without writing a regex: select a line of output and choose Ctrl+P ▸ *Make a trigger from the selection* (also on the right-click menu). Triggers (F2) opens on a new rule whose pattern is the line with its numbers, quoted speech and known player names turned into `*`, and shows the regex behind it. @@ -115,6 +119,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The status row's meters are edited in a table on Text & display (F7): one row per meter with its label, + value path and maximum path, what it reads now, `[+ meter]`, and Delete to remove one. While you are in + the table it lists the game data this connection has received, and a path field offers those paths, with + their values, to pick from. +- F7 is now called Text & display and its options are grouped under Colour & legibility, Text, Links & + pictures, Status row & meters, Activity and Sound. A list taller than the terminal scrolls with the cursor + instead of running off the bottom. - The ten pane colours a character can be given (F5 ▸ `tint`) have been re-chosen so they stay apart for players with red-green or blue-yellow colour blindness, and a little further apart for everyone else. The names are unchanged, so nothing needs setting again; Ochre is now a red ochre and Ember a red. In the diff --git a/CLAUDE.md b/CLAUDE.md index d964b7d1..787eff08 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -999,7 +999,11 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg holds the two sides together; when you add state the demo fakes, pin it against the live writer the same way. - **Views:** `worlds`/`settings`, `triggers`, `route`, `highlight`, `aliases`, `timers`, `keypad`, - `set`, `textansi`, `input`, `logging`, `password`, `startup`, `freeze`, `spawn`, `split`, `move`, `drag`, + `set`, `textansi`, `input`, `settings-search` (F7, `/`, `meter` typed: the search with its section + list and match counts), `settings-meters`/`settings-meters-pick` (the meter table over the demo's game + data, the cursor on a meter with the received-data box under it, and the same meter's value path open with + its dropdown of received paths), `settings-changed` (F7 after two real edits: the `● changed` marks and + `r reset`), `logging`, `password`, `startup`, `freeze`, `spawn`, `split`, `move`, `drag`, `history`, `history-search`, `history-search-filter`, `draft`, `draft2`, `menu`, `menu-split`, `messages`, `quit`, `connections` (**two connections on one world** — the one view where the header's fraction, the rail's dots and the quit prompt's count are all visible together and all have to agree; @@ -1202,6 +1206,31 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] - **`PromptControl` is not the command line** — `InputBarControl` is, built on `MultilineEditControl`. 2.7 gave `PromptControl` an opt-in multiline mode (`Multiline`, `MinRows`/`MaxRows`, `EnterBehavior`), but it has no undo and no gutter for the prompt. +- **Settings are declared in Client, and F7 and F8 are drawn from the declarations** + (`SharpMUTerm.Client/Settings/BuiltInSettings.cs`; `SettingBinding`, `SettingsSearch`; Tui + `OptionsScreenRenderer.FromSection`, `SettingsSearchSurface`, `SharpMUTermApp.Settings.cs`). A section is a + settings screen (id, title, key, order) registered in `ContributionRegistry.SettingsSections`; every screen + F2–F10 is one, and the screen table (`SettingsScreens`) reads its titles from them, so ⌃P, the header and the + search say one name. **To add a field**: add a descriptor to its section with a `Group` (a heading, never a + screen) and a `SettingBinding` over the configuration property. The screen draws it, `/` finds it, and + `● changed` and `r reset` work on it with nothing else written. Things not to relitigate: + - **A default is never written in a declaration.** It is what the binding reads off a fresh + `AppConfiguration`, so the configuration types stay the one place a default is decided; a list default is + re-read per reset, so two configurations never share one. + - **`r` resets, and only where it would do something.** A row carries a reset only while it differs from + its default (`ScreenRow.Reset`), so the header names `r reset` exactly there. It goes through + `ScreenEdits.Apply`, the save funnel. On the meter table `r` resets the whole list (the field is the list). + - **`/` is the overlay's, not a screen's**, and only while the screen is navigating — inside a field it is a + character. The search is drawn in the same window in place of the screen (content-swapping, the + `_behind` reason); Esc puts the screen back untouched, ⏎ goes through `SettingsOverlay.Show`, which swaps + the screen in place. It matches label, group, help and keywords, and a section's title only when none of + its fields matched, so an undeclared screen is still found by name. + - **The meter table is F7's one non-row field.** A meter is a row of three fields (label, value path, + maximum path); `now` reads `SendTarget()`'s game data (never `_active`'s); Delete on a meter row is a hidden + trailing Remove button added only while the cursor is on one; the received-data box shows only while the + cursor is in the table; path fields offer the received paths with their values as `ChoiceNotes`. + - F7 and F8 are windowed to the screen height (`ScreenChrome.Window`), because F7 is taller than 24 rows. + - Not declared yet: F2–F6, F9 (F5's character form) and F10 are listed by title only. - **Settings screens have no `IPasteTarget` and cannot easily have one.** They are markup rebuilt wholesale every key, with the edited field a buffer in `SettingsSession`. `SettingsOverlay` listens at `IConsoleDriver.Paste` instead. That can't double-fire *only* because no control on diff --git a/src/SharpMUTerm.Client/Contributions/Descriptors.cs b/src/SharpMUTerm.Client/Contributions/Descriptors.cs index 9590c05f..e5a5295b 100644 --- a/src/SharpMUTerm.Client/Contributions/Descriptors.cs +++ b/src/SharpMUTerm.Client/Contributions/Descriptors.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Text; namespace SharpMUTerm.Client.Contributions; @@ -26,8 +27,10 @@ public sealed class PanelContribution : IContribution } /// -/// Settings sections are groups of fields on a settings screen. This slice carries the descriptors only; -/// nothing renders them yet. Sections are read in , ties in registration order. +/// Settings sections are the settings screens, each with the fields it declares. A section with fields +/// is drawn from them (F7 and F8 are; see ); a section with none is still listed, +/// by its title, wherever the screens are listed — the settings search names it and opens it. Sections are read +/// in , ties in registration order. /// public sealed class SettingsSectionContribution : IContribution { @@ -45,10 +48,31 @@ public sealed class SettingsSectionContribution : IContribution /// Its fields, in the order they are shown. public IReadOnlyList Fields { get; init; } = Array.Empty(); + + /// The key that opens its screen (F7), or null for a section no key opens. + public string? Key { get; init; } } -/// One field of a settings section: its id within the section, its label and an optional line of help. -public abstract record SettingsField(string Id, string Label, string? Help = null); +/// +/// One field of a settings section: its id within the section, its label and an optional line of help. +/// +/// is the heading it is drawn under — consecutive fields with the same group share one +/// heading, so a group is a heading and never a screen of its own. is where the value +/// lives in the configuration; a field with one can say whether it differs from its default and be reset. +/// are further words the settings search finds the field by. +/// +/// +public abstract record SettingsField(string Id, string Label, string? Help = null) +{ + /// The heading the field is drawn under, or null for none. + public string? Group { get; init; } + + /// Where its value lives, or null for a field that only describes. + public SettingBinding? Binding { get; init; } + + /// Further words the search finds it by, space-separated. + public string? Keywords { get; init; } +} /// A tick box. public sealed record BoolField(string Id, string Label, string? Help = null) : SettingsField(Id, Label, Help); diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs new file mode 100644 index 00000000..c700a2b9 --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -0,0 +1,213 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Settings; + +/// +/// The client's own settings screens, declared: one section per screen, in F-key order of the screens' place +/// in the list, each carrying the key that opens it. F7 () and F8 () +/// declare their fields and are drawn from them; the rest are listed by title so the settings search can name +/// them and take a reader there, and declare fields as they are moved over. +/// +/// To add a field: add a descriptor to its section's list with a (the +/// heading it sits under) and a over the configuration property that holds it. +/// The screen draws it, the search finds it, and ● changed and the reset key work on it with nothing +/// else written — the default is read off a fresh , never restated here. +/// +/// +public static class BuiltInSettings +{ + /// F7's groups, in the order they are drawn. Colour and legibility: what the client does with the colours a world sends. + public const string ColourGroup = "Colour & legibility"; + + /// Text: how a line's characters are laid out. + public const string TextGroup = "Text"; + + /// Links and pictures: what counts as a link and how one is drawn. + public const string LinksGroup = "Links & pictures"; + + /// The status row's meters. + public const string MetersGroup = "Status row & meters"; + + /// The bar marking where a reader left a window. + public const string ActivityGroup = "Activity"; + + /// Game sound; drawn only where a host passes the sound settings. + public const string SoundGroup = "Sound"; + + /// The id of the meters field, which a host draws as a table rather than one value. + public const string MetersField = "meters"; + + /// F7: how a world's text is drawn. + public static SettingsSectionContribution Text { get; } = new() + { + Id = "text", + Title = "Text & display", + Key = "F7", + Order = 60, + Fields = + [ + Flag("strip-colour", "strip incoming ANSI colour", ColourGroup, + c => c.Text.StripIncomingColour, (c, v) => c.Text.StripIncomingColour = v, + "draw every line in the theme's own colours", "sgr monochrome color"), + Flag("legible", "keep text legible", ColourGroup, + c => c.Text.KeepTextLegible, (c, v) => c.Text.KeepTextLegible = v, + "lift a colour that would be unreadable on the pane", "contrast color"), + Flag("blink", "allow blink", ColourGroup, + c => c.Text.AllowBlink, (c, v) => c.Text.AllowBlink = v, + "let a world's blinking text blink", "flash"), + Number("transparency", "background transparency (%)", 0, TextSettings.MaxBackgroundTransparency, + ColourGroup, + c => c.Text.BackgroundTransparency, (c, v) => c.Text.BackgroundTransparency = v, + "how see-through the panes are on a terminal that can do it; 0 is off", + "opacity translucent kitty background"), + + Number("tab-width", "tab width (spaces)", 0, TextSettings.MaxTabWidth, TextGroup, + c => c.Text.TabWidth, (c, v) => c.Text.TabWidth = v, + "how many spaces a tab expands to; 0 deletes tabs", "whitespace tabs"), + Flag("emoji", "emoji substitution", TextGroup, + c => c.Text.EmojiSubstitution, (c, v) => c.Text.EmojiSubstitution = v, + "draw :smile: style codes as the emoji they name", "unicode"), + + Flag("underline-links", "underline hyperlinks", LinksGroup, + c => c.Text.UnderlineHyperlinks, (c, v) => c.Text.UnderlineHyperlinks = v, + "underline every clickable link", "url"), + Flag("detect-links", "detect links in output", LinksGroup, + c => c.Text.DetectLinks, (c, v) => c.Text.DetectLinks = v, + "make an http(s) address a world prints clickable", "url browser"), + + new ListField( + MetersField, + "meters", + [ + new TextField("label", "label", StatusMeter.MaxLabelLength), + new TextField("value", "value path"), + new TextField("max", "maximum path"), + ], + "game data the status row shows, such as hp 412/500") + { + Group = MetersGroup, + Keywords = "gauge gmcp msdp vitals hp mana status", + Binding = new SettingBinding>( + c => c.Text.StatusMeters, + (c, v) => c.Text.StatusMeters = v, + StatusMeter.Format, + v => v.Count == 0 ? "none" : string.Join(" · ", v.Select(m => m.Label))), + }, + + Number("activity-seconds", "activity bar holds for (seconds)", 0, TextSettings.MaxActivityBarSeconds, + ActivityGroup, + c => c.Text.ActivityBarSeconds, (c, v) => c.Text.ActivityBarSeconds = v, + "how long the NEW bar stays once you are back; 0 retires it at once", "unread new away"), + + Flag("sound", "game sound", SoundGroup, + c => c.Sound.Enabled, (c, v) => c.Sound.Enabled = v, + "play the sounds and music a world sends", "audio mcmp msp"), + Number("master-volume", "master volume (%)", 0, SoundSettings.MaxVolume, SoundGroup, + c => c.Sound.MasterVolume, (c, v) => c.Sound.MasterVolume = v, null, "audio loudness"), + Number("sound-volume", "sound volume (%)", 0, SoundSettings.MaxVolume, SoundGroup, + c => c.Sound.SoundVolume, (c, v) => c.Sound.SoundVolume = v, null, "audio loudness effects"), + Number("music-volume", "music volume (%)", 0, SoundSettings.MaxVolume, SoundGroup, + c => c.Sound.MusicVolume, (c, v) => c.Sound.MusicVolume = v, null, "audio loudness"), + Flag("captions", "sound captions", SoundGroup, + c => c.Sound.Captions, (c, v) => c.Sound.Captions = v, + "print a line of text for each sound", "audio subtitles accessibility"), + ], + }; + + /// F8's groups. + public const string InputGroup = "Input"; + + /// The command line's own size. + public const string CommandLineGroup = "Command line"; + + /// F8: the command line. + public static SettingsSectionContribution Input { get; } = new() + { + Id = "input", + Title = "Input", + Key = "F8", + Order = 70, + Fields = + [ + Flag("echo", "local echo", InputGroup, + c => c.Input.LocalEcho, (c, v) => c.Input.LocalEcho = v, + "show what you send in the output", "typed commands"), + Flag("drafts", "keep per-tab drafts", InputGroup, + c => c.Input.KeepDrafts, (c, v) => c.Input.KeepDrafts = v, + "each window keeps the line you were typing", "unsent"), + Flag("no-logins", "keep logins out of history", InputGroup, + c => c.Input.ExcludeCredentials, (c, v) => c.Input.ExcludeCredentials = v, + "a typed connect line and its password are not recorded", "password secret credentials"), + Number("rows", "height (lines)", InputSettings.MinRows, InputSettings.MaxRowCeiling, CommandLineGroup, + c => c.Input.Rows, (c, v) => c.Input.Rows = v, + "how many rows the command line starts at", "size"), + Number("max-rows", "grows to (lines)", InputSettings.MinRows, InputSettings.MaxRowCeiling, + CommandLineGroup, + c => c.Input.MaxRows, (c, v) => c.Input.MaxRows = v, + "how tall a long line may make it", "size wrap"), + Flag("second-bar", "second bar on new windows", CommandLineGroup, + c => c.Input.SecondBar, (c, v) => c.Input.SecondBar = v, + "open new windows with a second command line", "split input"), + ], + }; + + /// Every section the client declares, in their order: the screens F2 to F10. + public static IReadOnlyList All { get; } = + [ + Listed("worlds", "Worlds & Characters", "F5", 10), + Listed("triggers", "Triggers & spawn routing", "F2", 20), + Listed("aliases", "Aliases", "F3", 30), + Listed("keypad", "Keypad & hotkeys", "F4", 40), + Listed("timers", "Timers", "F6", 50), + Text, + Input, + Listed("logging", "Character logging", "F9", 80), + Listed("packages", "Packages", "F10", 90), + ]; + + /// Registers every built-in section. + public static void Register(SettingsSectionList sections) + { + ArgumentNullException.ThrowIfNull(sections); + foreach (var section in All) + { + sections.Add(section); + } + } + + private static SettingsSectionContribution Listed(string id, string title, string key, int order) => + new() { Id = id, Title = title, Key = key, Order = order }; + + private static BoolField Flag( + string id, + string label, + string group, + Func get, + Action set, + string? help = null, + string? keywords = null) => + new(id, label, help) + { + Group = group, + Keywords = keywords, + Binding = new SettingBinding(get, set, v => v ? "on" : "off"), + }; + + private static NumberField Number( + string id, + string label, + int minimum, + int maximum, + string group, + Func get, + Action set, + string? help = null, + string? keywords = null) => + new(id, label, minimum, maximum, help) + { + Group = group, + Keywords = keywords, + Binding = new SettingBinding(get, set), + }; +} diff --git a/src/SharpMUTerm.Client/Settings/SettingBinding.cs b/src/SharpMUTerm.Client/Settings/SettingBinding.cs new file mode 100644 index 00000000..6a3c4ca7 --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/SettingBinding.cs @@ -0,0 +1,99 @@ +using System.Globalization; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Settings; + +/// +/// Where a declared setting lives in the : how to read it, how to write it, and +/// what it is when nobody has touched it. The untyped half is what every surface needs to say +/// ● changed and to reset a value; is what a renderer reads the value +/// through. +/// +/// The default is never written down. It is whatever the binding reads off a freshly constructed +/// , so the configuration types stay the one place a default is decided and a +/// declaration cannot disagree with them. +/// +/// +public abstract class SettingBinding +{ + /// Whether the value in is its default. + public abstract bool IsDefault(AppConfiguration config); + + /// Puts the default back into . + public abstract void Reset(AppConfiguration config); + + /// The value as text, the way a search result or a summary shows it. + public abstract string Text(AppConfiguration config); + + /// The default as text. + public abstract string DefaultText { get; } +} + +/// A setting of type . +/// What the configuration holds. +public sealed class SettingBinding : SettingBinding +{ + private readonly Func _get; + private readonly Action _set; + private readonly Func? _format; + private readonly Func? _describe; + private readonly Lazy _defaultText; + + /// Reads the value. It must not change the configuration. + /// Writes the value. + /// + /// The value as text, which is also what two values are compared by. Needed for a value with no useful + /// ToString — a list compares by what it lists, not by reference. + /// + /// + /// The value as a reader is shown it in a summary, when that is shorter than — + /// a list of meters reads as their labels. + /// + public SettingBinding( + Func get, + Action set, + Func? format = null, + Func? describe = null) + { + ArgumentNullException.ThrowIfNull(get); + ArgumentNullException.ThrowIfNull(set); + _get = get; + _set = set; + _format = format; + _describe = describe; + _defaultText = new Lazy(() => Format(Default)); + } + + /// The value in . + public T Get(AppConfiguration config) => _get(config); + + /// Writes into . + public void Set(AppConfiguration config, T value) => _set(config, value); + + /// + /// The default, read off a fresh configuration each time — so a default that is a list is never one + /// instance shared between every configuration that is reset to it. + /// + public T Default => _get(new AppConfiguration()); + + /// A value as text. + public string Format(T value) => + _format?.Invoke(value) ?? Convert.ToString(value, CultureInfo.InvariantCulture) ?? string.Empty; + + /// + public override string DefaultText => _defaultText.Value; + + /// + public override bool IsDefault(AppConfiguration config) => + string.Equals(Format(Get(config)), DefaultText, StringComparison.Ordinal); + + /// + public override void Reset(AppConfiguration config) => Set(config, Default); + + /// + public override string Text(AppConfiguration config) + { + var value = Get(config); + return value is bool flag ? (flag ? "on" : "off") : _describe?.Invoke(value) ?? Format(value); + } +} diff --git a/src/SharpMUTerm.Client/Settings/SettingsSearch.cs b/src/SharpMUTerm.Client/Settings/SettingsSearch.cs new file mode 100644 index 00000000..9f1eef47 --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/SettingsSearch.cs @@ -0,0 +1,75 @@ +using SharpMUTerm.Client.Contributions; + +namespace SharpMUTerm.Client.Settings; + +/// +/// One thing the settings search found: a field of a section, or — for a section that declares no fields, or +/// whose title matched where none of its fields did — the section itself. and +/// say where in the query was found, so a host can mark it; both are +/// -1/0 when the match was in text the host does not draw (the help line or the keywords). +/// +/// The section it is in. +/// The field, or null for the section itself. +/// What a result row reads: the field's label, or the section's title. +/// Where the query starts in , or -1. +/// How long the matched run is. +public sealed record SettingsMatch( + SettingsSectionContribution Section, SettingsField? Field, string Text, int Start, int Length); + +/// +/// The settings search: a query matched against every declared field's label, group, help line and keywords, +/// and against every section's title — so a screen whose fields are not declared yet is still found by name. +/// Case is ignored and the match is a plain substring, the rule ⌃R and ⌃F already follow. Pure, so the whole +/// contract is testable without a screen. +/// +public static class SettingsSearch +{ + /// + /// Every match for , in section order and then field order. An empty query matches + /// nothing: there is no list to narrow, and every field at once is what the screens already are. + /// + public static IReadOnlyList Find(IEnumerable sections, string? query) + { + ArgumentNullException.ThrowIfNull(sections); + + var q = (query ?? string.Empty).Trim(); + var matches = new List(); + if (q.Length == 0) + { + return matches; + } + + foreach (var section in sections) + { + var found = 0; + foreach (var field in section.Fields) + { + var at = field.Label.IndexOf(q, StringComparison.OrdinalIgnoreCase); + if (at >= 0 || Contains(field.Group, q) || Contains(field.Help, q) || Contains(field.Keywords, q)) + { + matches.Add(new SettingsMatch(section, field, field.Label, at, at >= 0 ? q.Length : 0)); + found++; + } + } + + var title = section.Title.IndexOf(q, StringComparison.OrdinalIgnoreCase); + if (found == 0 && title >= 0) + { + matches.Add(new SettingsMatch(section, null, section.Title, title, q.Length)); + } + } + + return matches; + } + + /// How many of are in each section, by section id. + public static IReadOnlyDictionary CountBySection(IEnumerable matches) + { + ArgumentNullException.ThrowIfNull(matches); + return matches.GroupBy(m => m.Section.Id, StringComparer.Ordinal) + .ToDictionary(g => g.Key, g => g.Count(), StringComparer.Ordinal); + } + + private static bool Contains(string? text, string query) => + text is not null && text.Contains(query, StringComparison.OrdinalIgnoreCase); +} diff --git a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs index fda2a605..d1e05953 100644 --- a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs +++ b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs @@ -75,7 +75,7 @@ public sealed class AppConfiguration /// public List CharsetOrder { get; set; } = new() { "utf-8", "iso-8859-1" }; - /// How inbound text is drawn — the F7 "Text & ANSI" screen's settings. + /// How inbound text is drawn — the F7 "Text & display" screen's settings. public TextSettings Text { get; set; } = new(); /// Game sound: on or off, the player's levels, captions (F7 ▸ SOUND). diff --git a/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs b/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs index 81ff7239..4a643d5a 100644 --- a/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs +++ b/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs @@ -1,7 +1,7 @@ namespace SharpMUTerm.Core.Configuration; /// -/// Application-wide text rendering preferences — the settings the F7 "Text & ANSI" screen edits. +/// Application-wide text rendering preferences — the settings the F7 "Text & display" screen edits. /// These are global rather than per world: they describe how *this terminal* draws what any world /// sends, so a world's own and /// stay where they are. diff --git a/src/SharpMUTerm.Tui/MacroKeys.cs b/src/SharpMUTerm.Tui/MacroKeys.cs index e6584d76..8c8a8492 100644 --- a/src/SharpMUTerm.Tui/MacroKeys.cs +++ b/src/SharpMUTerm.Tui/MacroKeys.cs @@ -185,7 +185,7 @@ private static AppShortcut[] BuildAppShortcuts() new((ConsoleModifiers)0, ConsoleKey.F4, "opens this screen"), new((ConsoleModifiers)0, ConsoleKey.F5, "opens Worlds"), new((ConsoleModifiers)0, ConsoleKey.F6, "opens Timers"), - new((ConsoleModifiers)0, ConsoleKey.F7, "opens Text & ANSI"), + new((ConsoleModifiers)0, ConsoleKey.F7, "opens Text & display"), new((ConsoleModifiers)0, ConsoleKey.F8, "opens Input"), new((ConsoleModifiers)0, ConsoleKey.F9, "opens the character's log"), // F10 is Packages, the composer's case: a different surface, claimed so F4 says so. diff --git a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs index 58757a33..38a21cae 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs @@ -1,30 +1,44 @@ using System.Globalization; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Input; +using SharpMUTerm.Core.Protocols; using static SharpMUTerm.Tui.MarkupText; using static SharpMUTerm.Tui.ScreenPalette; namespace SharpMUTerm.Tui; /// -/// Produces the markup sub-blocks shared by the F7 (Text & ANSI) and F8 (Input & spellcheck) -/// screens — the header band, the options list (toggle/value rows grouped under dim section headers), -/// and the footer action bar. The two screens differ only in their title, F-key, and rows, so the -/// blocks take an rather than being written per screen. -/// composes them into a real panel for the live/snapshot view; -/// merges the same blocks into a single -/// line list for the unit tests. Pure so every block is testable. +/// Produces the markup sub-blocks of the single-list option screens — F7 (Text & display) and F8 +/// (Input) — the header band, the options list (rows grouped under dim headings), and the footer action +/// bar. composes them into real panels; merges the same blocks into one line list for the unit tests. /// -/// F9 was a third one, "Logging", and is gone: its rows edited one character's -/// — whichever was connected, or else the first configured — while -/// presenting as a global preference. Logging now sits in the character's own form on F5, and F9 opens +/// Both screens are drawn from their declared settings sections (, in +/// the Client): one row per field, a heading wherever the field's group changes, and the value read and +/// written through the field's . A field that differs from its default says +/// ● changed and carries the reset r runs. Nothing about a row is written here any more except +/// how a kind of field is drawn, so a field added to a section appears on its screen, in the search and +/// under the reset key at once. +/// +/// +/// F7's meters field is the one drawn as more than a row: a table, one row per meter with its label, +/// value path and maximum path as three fields (⏎ opens the label, ⇥ steps on), the value now in a fourth +/// column read from the focused session's game data, [[+ meter]] under it, and — while the cursor is +/// in the table — the paths this connection has received, with their values, which a path field also offers +/// as its dropdown. +/// +/// +/// F9 was a third one, "Logging", and is gone: its rows edited one character's +/// while presenting as a global preference. Logging sits in the character's own form on F5, and F9 opens /// that screen there. See . /// /// internal static class OptionsScreenRenderer { /// Where a row's value starts, measured from the left edge of the list. - private const int LabelWidth = 28; + private const int LabelWidth = 38; /// /// The checkbox column every row reserves, whether or not it has one: "[[x]] ". A value row @@ -33,28 +47,56 @@ internal static class OptionsScreenRenderer /// private const int AffordanceWidth = 4; + /// What a field that differs from its default says, after its value. + internal const string ChangedMark = "● changed"; + /// - /// A single options-list row: a toggle, a value row, both at once, a section header, or a spacer. - /// is the config the checkbox writes to; is the - /// config the value writes to, which is what makes a value row activatable with ⏎. A row with - /// neither still takes the cursor but nothing happens there. - /// - /// Carrying both is supported and currently unused: F9's log format was the case that needed it - /// (Space started and stopped logging, ⏎ picked the format), and that row now lives on F5 where its - /// character is. F4's bindings are the same shape one layer down — Space enables the macro, ⏎ edits - /// its command — so keeps the capability whether or not this screen uses it. - /// + /// A single options-list row: a toggle, a value row, both at once, a section header, a spacer, or a + /// row drawn by its own . is the config the checkbox + /// writes to; (or , for a row of several) is what ⏎ + /// opens. A row with neither still takes the cursor but nothing happens there. /// + /// What the row is called; ├ marks a heading, empty a spacer. + /// The value it shows, or null for a checkbox row. + /// The checkbox's state, or null for none. + /// A dim note after the value. + /// What Space flips. + /// The one field ⏎ opens. + /// Several fields, ⏎ opening the first and ⇥ stepping on; wins over . + /// What ⏎ runs on a button row. + /// + /// Puts the row's setting back to its default; non-null exactly when it differs, which is also what + /// draws . + /// + /// + /// Draws the row itself, given the open edit on it (null while navigating) and the width — the meter + /// table's rows. Null for the ordinary checkbox and label/value shapes. + /// + /// Drawn but never a cursor stop: a table's column headings, the received-data box. + /// The declared field the row draws, so the search can land on it. + /// What the footer says while the cursor is on it, in place of option n/m. public readonly record struct OptionRow( string Label, string? Value, bool? Toggle, string? Hint = null, ScreenToggle? Bind = null, - ScreenField? Edit = null); + ScreenField? Edit = null, + IReadOnlyList? Fields = null, + ScreenButton? Button = null, + Action? Reset = null, + Func? Draw = null, + bool Static = false, + string? FieldId = null, + string? Where = null); - /// One options screen: the title and F-key its chrome shows, plus the rows it lists. - internal readonly record struct OptionsScreen(string Title, string FKey, IReadOnlyList Rows); + /// + /// One options screen: the title and F-key its chrome shows, the rows it lists, and — while the cursor is + /// on a row Delete can take out (a meter) — that removal, which the model carries as its pane's hidden + /// trailing button. + /// + internal readonly record struct OptionsScreen( + string Title, string FKey, IReadOnlyList Rows, ScreenButton? Remove = null); /// /// Merges every sub-block into one line list (header, options, footer). Used by the unit tests and @@ -78,45 +120,45 @@ public static List Render(string title, string fkey, IReadOnlyList /// The screen title on the left, the keyboard hints right-aligned to . The /// hints are derived from and rather than written - /// here, so the header cannot advertise an edit the screen doesn't offer; called without them it - /// describes a screen that only navigates. + /// here, so the header cannot advertise an edit the screen doesn't offer — r reset appears only + /// on a row that differs from its default, and Del remove only on a meter. /// - /// There is deliberately no ‹ back affordance. These screens were the only ones that drew - /// one, and it pointed nowhere: there is no navigation stack behind a settings screen, Esc closes - /// it, and the header already says so two columns to the right. + /// There is deliberately no ‹ back affordance: there is no navigation stack behind a settings + /// screen, Esc closes it, and the header already says so. /// /// internal static string HeaderLine( string title, string fkey, int width, ScreenModel? model = null, ScreenFocus? focus = null) { var heading = $"[bold {Value}]{Escape(title)}[/]"; + var resettable = model is not null && focus is { Edit: null } at && model.ResetAt(at.Pane, at.Index) is not null; var hints = ScreenChrome.Hints( ScreenChrome.SingleListHints, Escape(fkey), model?.HasEditableRow ?? false, - focus); + focus, + removable: model?.HasRemovableRow ?? false, + resettable: resettable); return SpreadTitle(" " + heading, hints, width); } /// - /// The action bar: where the cursor is in the options list on the left, cancel/save on the right. - /// It used to be an inventory (5 options · 2 sections); the section count was noise — the - /// headings are on screen and counting them tells nobody anything — and the option count answered a - /// different question from every other screen's footer. It now names the cursor's position and the - /// section it is standing in, which is F2's trigger 1/4 · set Comms in this screen's nouns. - /// The selected row comes from , the only thing that knows it. + /// The action bar: where the cursor is in the options list on the left — option 4/15 · COLOUR & + /// LEGIBILITY, or a row's own words (meter 2/3) — and the actions on the right. /// internal static string FooterLine(IReadOnlyList rows, int width, ScreenFocus? focus = null) { ArgumentNullException.ThrowIfNull(rows); - var options = rows.Count(r => !IsSpacer(r) && !IsSection(r)); + var options = rows.Count(IsNavigable); var context = string.Empty; if (options > 0) { var selected = Math.Clamp(focus?.Pane == 0 ? focus.Value.Index : 0, 0, options - 1); + var row = rows.Where(IsNavigable).ElementAt(selected); context = ScreenChrome.Context( - ScreenChrome.Position("option", selected, options), SectionOf(rows, selected)); + row.Where is { } where ? Escape(where) : ScreenChrome.Position("option", selected, options), + SectionOf(rows, selected)); } return SpreadLR(" " + context, ScreenChrome.Actions(focus: focus), width); @@ -138,7 +180,7 @@ internal static string FooterLine(IReadOnlyList rows, int width, Scre continue; } - if (IsSpacer(row)) + if (!IsNavigable(row)) { continue; } @@ -154,7 +196,7 @@ internal static string FooterLine(IReadOnlyList rows, int width, Scre /// /// The options list itself — one line per row, in order. The row under the keyboard cursor is - /// drawn on a cursor bar padded to ; spacers and section headers are + /// drawn on a cursor bar padded to ; spacers, headings and static rows are /// skipped when counting, so the cursor index matches 's row order. /// internal static List BodyColumn( @@ -167,14 +209,17 @@ internal static List BodyColumn( var navigable = 0; foreach (var row in rows) { - if (IsSpacer(row) || IsSection(row)) + if (!IsNavigable(row)) { - lines.Add(RenderRow(row, null)); + lines.Add(row.Draw is { } draw ? draw(null, width) : RenderRow(row, null)); continue; } - var line = RenderRow(row, cursor.EditOn(0, navigable, 0)); - lines.Add(ScreenChrome.Cursor(line, cursor.IsOn(0, navigable), width)); + var on = cursor.IsOn(0, navigable); + var line = row.Draw is { } drawn + ? drawn(on ? cursor.Edit : null, width) + : RenderRow(row, cursor.EditOn(0, navigable, 0)); + lines.Add(ScreenChrome.Cursor(line, on, width)); navigable++; } @@ -183,29 +228,59 @@ internal static List BodyColumn( /// /// How wide a dropdown may run on a screen rendered without a width — the merged - /// path the unit tests use. The live view always passes a real - /// width, so this only keeps the width-agnostic fallback from letting a list run unbounded. + /// path the unit tests use. /// private const int ChoiceListWidth = 60; /// - /// The screen's one navigable pane: every row that isn't a spacer or a section header, in display - /// order, each carrying whatever config bindings it was built with — the checkbox Space flips and - /// the value ⏎ opens. + /// The screen's one navigable pane: every row that is a cursor stop, in display order, each carrying + /// whatever it was built with — the checkbox Space flips, the values ⏎ opens, the button ⏎ runs, the + /// reset r runs — and, when there is one, the removal Delete runs as a hidden trailing button. /// internal static ScreenModel Model(OptionsScreen screen) { var rows = screen.Rows - .Where(r => !IsSpacer(r) && !IsSection(r)) - .Select(r => r.Edit is { } field ? new ScreenRow(r.Bind, new[] { field }) : new ScreenRow(r.Bind)) - .ToArray(); + .Where(IsNavigable) + .Select(r => new ScreenRow( + r.Bind, + r.Fields ?? (r.Edit is { } field ? new[] { field } : null), + r.Button, + r.Reset)) + .ToList(); + if (screen.Remove is { } remove) + { + rows.Add(ScreenRow.Of(remove)); + } + return new ScreenModel(rows); } + /// Where the row drawing a declared field sits among the cursor stops, or -1. + internal static int IndexOf(OptionsScreen screen, string fieldId) + { + var navigable = 0; + foreach (var row in screen.Rows) + { + if (!IsNavigable(row)) + { + continue; + } + + if (string.Equals(row.FieldId, fieldId, StringComparison.Ordinal)) + { + return navigable; + } + + navigable++; + } + + return -1; + } + /// /// One row: its checkbox column (a box, or the blank that keeps the labels in one column), its - /// label, the value it holds if it holds one, and its hint. A row can carry both a checkbox and a - /// value, which is the shape F4's bindings use one layer down. + /// label, the value it holds if it holds one, its hint, and when it differs + /// from its default. /// private static string RenderRow(OptionRow row, ScreenFieldEdit? edit) { @@ -227,202 +302,451 @@ private static string RenderRow(OptionRow row, ScreenFieldEdit? edit) }; var hint = row.Hint is null ? string.Empty : $"[dim] — {Escape(row.Hint)}[/]"; + var changed = row.Reset is null ? string.Empty : Changed(); var hasValue = row.Value is not null || edit is not null; var label = Escape(row.Label); + // A checkbox row's label *is* its content, so it keeps the primary ink; a label/value row's // label is the secondary half of a pair, so it dims and lets the value carry the weight. if (!hasValue) { - return $"{box}{label}{hint}"; + return $"{box}{label}{hint}{changed}"; } var value = ScreenChrome.Field(Escape(row.Value ?? string.Empty), edit); - return $"{box}[dim]{label.PadRight(LabelWidth - AffordanceWidth)}[/] {value}{hint}"; + return $"{box}[dim]{label.PadRight(LabelWidth - AffordanceWidth)}[/] {value}{hint}{changed}"; } - /// A blank separator carrying no label, value, or toggle. + private static string Changed() => $" [{Accent}]{ChangedMark}[/]"; + + /// A blank separator carrying nothing at all. private static bool IsSpacer(OptionRow row) => - row.Label.Length == 0 && row.Value is null && row.Toggle is null; + row.Label.Length == 0 && row.Value is null && row.Toggle is null && row.Draw is null + && row.Button is null && row.Fields is null; /// A dim group heading, marked by the branch glyph the screens prefix them with. private static bool IsSection(OptionRow row) => row.Label.StartsWith("├ ", StringComparison.Ordinal); + /// Whether a row is a cursor stop. + private static bool IsNavigable(OptionRow row) => !row.Static && !IsSpacer(row) && !IsSection(row); + /// - /// The F7 "Text & ANSI" screen, reflecting — and writing back to — the app's - /// . Called without arguments it projects the defaults, which is what - /// the unit tests and the width-agnostic fallback want. + /// The F7 screen over the defaults — or over the given settings, written back to as the rows are used. + /// null leaves the SOUND group out, which is how a caller that has no sound + /// settings to hand gets the rest of the screen. /// - internal static OptionsScreen TextAnsiScreen(TextSettings? text = null, SoundSettings? sound = null) + internal static OptionsScreen TextAnsiScreen(TextSettings? text = null, SoundSettings? sound = null) => + TextAnsiScreen( + new AppConfiguration { Text = text ?? new TextSettings(), Sound = sound ?? new SoundSettings() }, + includeSound: sound is not null); + + /// + /// The F7 screen, drawn from (the declared + /// unless a host passes the registry's) over . + /// + /// Where the values are read from and written to. + /// Whether the SOUND group is drawn. + /// The focused session's game data, which the meter table reads its now column from. + /// Which cursor stop the keyboard is on, which decides whether the received-data box shows. + /// The declared section. + internal static OptionsScreen TextAnsiScreen( + AppConfiguration config, + bool includeSound = true, + GameDataStore? data = null, + int cursor = -1, + SettingsSectionContribution? section = null) { - var settings = text ?? new TextSettings(); + ArgumentNullException.ThrowIfNull(config); + return FromSection( + section ?? BuiltInSettings.Text, + config, + data, + cursor, + includeSound ? null : BuiltInSettings.SoundGroup); + } + + /// The F8 screen over the defaults, or over the given settings. + internal static OptionsScreen InputScreen(InputSettings? input = null) => + InputScreen(new AppConfiguration { Input = input ?? new InputSettings() }); - var rows = new List + /// + /// The F8 "Input" screen, drawn from its declared section. + /// + /// keep logins out of history is the one row here that is about a secret rather than a + /// convenience: with history browsable and searchable (⌃R), a hand-typed + /// connect <name> <password> recorded in it is a password on display. It is bash's + /// HISTIGNORE, on by default, and the verbs it recognises are . + /// + /// + /// There is no spellcheck section and no newline key row: a setting with nothing behind it is the + /// empty promise these screens are held against, and the newline chord is fixed per host and named where + /// the keys are named. + /// + /// + internal static OptionsScreen InputScreen(AppConfiguration config, SettingsSectionContribution? section = null) + { + ArgumentNullException.ThrowIfNull(config); + return FromSection(section ?? BuiltInSettings.Input, config, null, -1, null); + } + + /// + /// A declared section as an options screen: a heading wherever the group changes, then one row per + /// field, drawn by kind. leaves one group out. + /// + internal static OptionsScreen FromSection( + SettingsSectionContribution section, + AppConfiguration config, + GameDataStore? data, + int cursor, + string? skipGroup) + { + ArgumentNullException.ThrowIfNull(section); + ArgumentNullException.ThrowIfNull(config); + + var rows = new List(); + ScreenButton? remove = null; + string? group = null; + var navigable = 0; + foreach (var field in section.Fields) { - new("├ COLOUR", null, null), - new("strip incoming ANSI colour", null, settings.StripIncomingColour, null, - ScreenToggle.Bind(() => settings.StripIncomingColour, v => settings.StripIncomingColour = v)), - - // Directly under the row above, because the two are answers to one question — what to do - // about a colour this terminal cannot show well — and they are the ends of its range: that - // one discards every colour the server sent, this one keeps them all and moves only the few - // that cannot be read. Unticking it is not "no policy"; it is the policy this client had - // before anything was measured. - new("keep text legible", null, settings.KeepTextLegible, null, - ScreenToggle.Bind(() => settings.KeepTextLegible, v => settings.KeepTextLegible = v)), - new("allow blink", null, settings.AllowBlink, null, - ScreenToggle.Bind(() => settings.AllowBlink, v => settings.AllowBlink = v)), - new("underline hyperlinks", null, settings.UnderlineHyperlinks, null, - ScreenToggle.Bind(() => settings.UnderlineHyperlinks, v => settings.UnderlineHyperlinks = v)), - - // Under COLOUR because it sits with the row above it — that one says how a link looks, this - // one says what counts as a link — even though neither is strictly about colour. The pair - // reads as one idea, which a LINKS section of two rows would not improve. - new("detect links in output", null, settings.DetectLinks, null, - ScreenToggle.Bind(() => settings.DetectLinks, v => settings.DetectLinks = v)), - new(string.Empty, null, null), - new("├ WHITESPACE", null, null), - - // A count, not a checkbox, and its own section rather than an extra row under COLOUR: it is - // the only thing on this screen that changes how wide a line *is* rather than how it looks. - // Zero is a real answer — it deletes tabs — so the field's floor is 0, not 1. - new("tab width (spaces)", settings.TabWidth.ToString(CultureInfo.InvariantCulture), null, null, null, - ScreenField.Integer( - "tab width (spaces)", () => settings.TabWidth, v => settings.TabWidth = v, - 0, TextSettings.MaxTabWidth)), - new(string.Empty, null, null), - new("├ UNICODE", null, null), - new("emoji substitution", null, settings.EmojiSubstitution, null, - ScreenToggle.Bind(() => settings.EmojiSubstitution, v => settings.EmojiSubstitution = v)), - new(string.Empty, null, null), - new("├ BACKGROUND", null, null), - - // Its own section, beside ACTIVITY's reasoning: it describes the client's chrome rather than - // how a world's text is drawn. A percentage and not a checkbox, and zero is off — it only looks - // right on a terminal set to draw its background translucent, which this client cannot see. - new("background transparency (%)", - settings.BackgroundTransparency.ToString(CultureInfo.InvariantCulture), null, null, null, - ScreenField.Integer( - "background transparency (%)", - () => settings.BackgroundTransparency, v => settings.BackgroundTransparency = v, - 0, TextSettings.MaxBackgroundTransparency)), - new(string.Empty, null, null), - new("├ ACTIVITY", null, null), - - // Seconds, and its own section: it is the only row on this screen describing the client's own - // chrome rather than how a world's text is drawn. Zero is a real answer — it retires the bar - // as soon as it has been read past, which is what this client did before the floor existed — - // so the field's floor is 0, as the tab width's is. - new("activity bar holds for (seconds)", - settings.ActivityBarSeconds.ToString(CultureInfo.InvariantCulture), null, null, null, - ScreenField.Integer( - "activity bar holds for (seconds)", - () => settings.ActivityBarSeconds, v => settings.ActivityBarSeconds = v, - 0, TextSettings.MaxActivityBarSeconds)), - new(string.Empty, null, null), - new("├ STATUS ROW", null, null), - - // One line, `label=value/max; …`, each path allowed `|` alternatives. A list editor would be - // friendlier and is a screen of its own; this is the whole of the setting, typed where it is read, - // and a part that does not parse is dropped rather than refused so a half-typed meter costs nothing. - new("meters", MeterSummary(settings.StatusMeters), null, null, null, - ScreenField.Optional( - "meters", - () => settings.StatusMeters.Count == 0 ? null : StatusMeter.Format(settings.StatusMeters), - v => settings.StatusMeters = StatusMeter.Parse(v))), - }; + if (skipGroup is not null && string.Equals(field.Group, skipGroup, StringComparison.Ordinal)) + { + continue; + } + + if (!string.Equals(field.Group, group, StringComparison.Ordinal)) + { + if (rows.Count > 0) + { + rows.Add(new OptionRow(string.Empty, null, null)); + } + + group = field.Group; + if (group is not null) + { + rows.Add(new OptionRow("├ " + group.ToUpperInvariant(), null, null)); + } + } - if (sound is not null) + if (field is ListField { Id: BuiltInSettings.MetersField, Binding: SettingBinding> meters }) + { + remove = MeterRows(rows, config, meters, data, cursor, ref navigable) ?? remove; + continue; + } + + rows.Add(Row(field, config)); + navigable++; + } + + return new OptionsScreen(section.Title, section.Key ?? string.Empty, rows, remove); + } + + /// One declared field as a row, by kind. A field with no binding the row understands is shown read-only. + private static OptionRow Row(SettingsField field, AppConfiguration config) + { + var reset = field.Binding is { } binding && !binding.IsDefault(config) + ? () => binding.Reset(config) + : (Action?)null; + + switch (field) { - rows.AddRange(SoundRows(sound)); + case BoolField when field.Binding is SettingBinding flag: + return new OptionRow( + field.Label, null, flag.Get(config), null, + ScreenToggle.Bind(() => flag.Get(config), v => flag.Set(config, v)), + Reset: reset, FieldId: field.Id); + + case NumberField number when field.Binding is SettingBinding count: + return new OptionRow( + field.Label, count.Get(config).ToString(CultureInfo.InvariantCulture), null, null, null, + ScreenField.Integer( + field.Label, () => count.Get(config), v => count.Set(config, v), number.Minimum, number.Maximum), + Reset: reset, FieldId: field.Id); + + case ChoiceField choice when field.Binding is SettingBinding named: + return new OptionRow( + field.Label, named.Get(config), null, null, null, + ScreenField.Choice(field.Label, () => named.Get(config), v => named.Set(config, v), choice.Choices), + Reset: reset, FieldId: field.Id); + + case TextField when field.Binding is SettingBinding text: + return new OptionRow( + field.Label, text.Get(config) ?? string.Empty, null, null, null, + ScreenField.Optional(field.Label, () => text.Get(config), v => text.Set(config, v)), + Reset: reset, FieldId: field.Id); + + default: + return new OptionRow( + field.Label, field.Binding?.Text(config) ?? string.Empty, null, Reset: reset, FieldId: field.Id); } + } + + /// The cells the meter table's label column takes (a label is at most eight). + private const int MeterLabelWidth = StatusMeter.MaxLabelLength + 1; + + /// The cells its now column takes: 1000/1000 and a cell. + private const int MeterNowWidth = 11; + + /// The gap between two of its columns. + private const int MeterGap = 2; - return new OptionsScreen("Text & ANSI", "F7", rows); + /// How many received paths the box under the table lists before it says how many more there are. + internal const int ReceivedRows = 6; + + /// What the received-data box is called, and the path fields' dropdown with it. + internal const string ReceivedCaption = "received on this connection"; + + /// What the now column says of a meter whose value has not arrived. + internal const string Waiting = "waiting"; + + /// + /// F7's meter table, appended to : the column headings, one row per meter, the + /// add button, and — while the cursor is on one of those — the box of paths this connection has + /// received. Returns the removal Delete runs, when the cursor is on a meter. + /// + private static ScreenButton? MeterRows( + List rows, + AppConfiguration config, + SettingBinding> binding, + GameDataStore? data, + int cursor, + ref int navigable) + { + var meters = binding.Get(config); + var reset = binding.IsDefault(config) ? null : (Action)(() => binding.Reset(config)); + var received = data is null ? Array.Empty<(string Path, string Value)>() : ReceivedPaths(data); + var first = navigable; + + rows.Add(new OptionRow(string.Empty, null, null, Static: true, FieldId: BuiltInSettings.MetersField, + Draw: (_, width) => MeterHeading(width, reset is not null))); + + ScreenButton? remove = null; + for (var i = 0; i < meters.Count; i++) + { + var meter = meters[i]; + var index = i; + var fields = new[] + { + ScreenField.Text("label", () => meter.Label, v => meter.Label = StatusMeter.Clip(v)), + PathField("value path", () => meter.Value, v => meter.Value = v ?? string.Empty, received, required: true), + PathField("maximum path", () => meter.Max, v => meter.Max = v, received, required: false), + }; + rows.Add(new OptionRow( + meter.Label, null, null, + Fields: fields, + Reset: reset, + FieldId: i == 0 ? BuiltInSettings.MetersField : null, + Where: ScreenChrome.Position("meter", index, meters.Count), + Draw: (edit, width) => MeterRow(meter, data, edit, width))); + if (navigable == cursor) + { + remove = ScreenButton.Remove(meters, index, first, $"meter {meter.Label}"); + } + + navigable++; + } + + var addAt = navigable; + rows.Add(new OptionRow( + "[+ meter]", null, null, + Button: ScreenButton.Add("+ meter", meters, () => new StatusMeter { Label = "new" }, first), + Reset: reset, + FieldId: meters.Count == 0 ? BuiltInSettings.MetersField : null, + Draw: (_, _) => new string(' ', AffordanceWidth) + $"[{Accent}][[+ meter]][/]")); + navigable++; + + if (cursor >= first && cursor <= addAt) + { + rows.AddRange(ReceivedBox(received)); + } + + return remove; + } + + /// + /// A meter's value or maximum path: free text, with every path this connection has received offered + /// in the dropdown beside what it holds now. The current value heads the list, so opening the field + /// shows the whole list with it marked rather than narrowing to nothing. + /// + private static ScreenField PathField( + string label, + Func get, + Action set, + IReadOnlyList<(string Path, string Value)> received, + bool required) + { + var current = get(); + var choices = new List(); + if (!string.IsNullOrWhiteSpace(current)) + { + choices.Add(current); + } + + choices.AddRange(received.Select(r => r.Path).Where(p => !string.Equals(p, current, StringComparison.Ordinal))); + var notes = received.ToDictionary(r => r.Path, r => r.Value, StringComparer.Ordinal); + + return new ScreenField( + label, + () => get() ?? string.Empty, + value => required && string.IsNullOrWhiteSpace(value) ? $"{label} cannot be empty" : null, + value => set(string.IsNullOrWhiteSpace(value) ? null : value.Trim()), + choices.Count > 0 ? choices : null, + ChoiceNotes: notes, + ChoiceCaption: ReceivedCaption); + } + + /// How wide the table's two path columns are at . + private static (int Value, int Max) PathWidths(int width) + { + var room = (width > 0 ? width : 100) - AffordanceWidth - MeterLabelWidth - MeterNowWidth - (3 * MeterGap); + room = Math.Max(16, room); + return (room / 2, room - (room / 2)); + } + + private static string MeterHeading(int width, bool changed) + { + var (value, max) = PathWidths(width); + var gap = new string(' ', MeterGap); + var line = new string(' ', AffordanceWidth) + + "label".PadRight(MeterLabelWidth) + gap + + "value path".PadRight(value) + gap + + "maximum path".PadRight(max) + gap + + "now"; + return $"[dim]{line}[/]" + (changed ? Changed() : string.Empty); } /// - /// F7's SOUND rows: game sound on or off, the three levels, and captions. Drawn on every host, because - /// captions are text and are the one thing a host with no audio device can still do with a sound. + /// One meter: its three fields in their columns and what it reads now. While one of its fields is open + /// that field takes the rest of the row, so a long path is typed where it can be seen. /// - private static IEnumerable SoundRows(SoundSettings sound) + private static string MeterRow(StatusMeter meter, GameDataStore? data, ScreenFieldEdit? edit, int width) + { + var (valueWidth, maxWidth) = PathWidths(width); + var gap = new string(' ', MeterGap); + var line = new System.Text.StringBuilder(new string(' ', AffordanceWidth)); + var cells = new[] { (meter.Label, MeterLabelWidth), (meter.Value, valueWidth), (meter.Max ?? string.Empty, maxWidth) }; + for (var i = 0; i < cells.Length; i++) + { + var (text, cell) = cells[i]; + if (edit is { } open && open.Field == i) + { + var room = Math.Max(8, (width > 0 ? width : 100) - VisibleLength(line.ToString()) - 2); + line.Append(ScreenChrome.Field(string.Empty, Scrolled(open, room))); + return line.ToString(); + } + + var shown = string.IsNullOrEmpty(text) ? "—" : text; + var display = Escape(ElidePlain(shown, cell - 1).PadRight(cell - 1)); + line.Append(PadVisible(ScreenChrome.Field($"[{ScreenPalette.Value}]{display}[/]", null), cell)).Append(gap); + } + + line.Append(Now(meter, data)); + return line.ToString(); + } + + /// The now column: 412/500, 412 with no maximum, or . + internal static string Now(StatusMeter meter, GameDataStore? data) { - yield return new(string.Empty, null, null); - yield return new("├ SOUND", null, null); - yield return new("game sound", null, sound.Enabled, null, - ScreenToggle.Bind(() => sound.Enabled, v => sound.Enabled = v)); - yield return Level("master volume (%)", () => sound.MasterVolume, v => sound.MasterVolume = v); - yield return Level("sound volume (%)", () => sound.SoundVolume, v => sound.SoundVolume = v); - yield return Level("music volume (%)", () => sound.MusicVolume, v => sound.MusicVolume = v); - - // A caption is a line of text for a sound, so it is the one SOUND row that matters with sound off. - yield return new("sound captions", null, sound.Captions, null, - ScreenToggle.Bind(() => sound.Captions, v => sound.Captions = v)); - - static OptionRow Level(string label, Func get, Action set) => - new(label, get().ToString(CultureInfo.InvariantCulture), null, null, null, - ScreenField.Integer(label, get, set, 0, SoundSettings.MaxVolume)); + if (data is null || StatusMeter.Read(data, meter.Value) is not { } value) + { + return $"[{Muted}]{Waiting}[/]"; + } + + var max = string.IsNullOrWhiteSpace(meter.Max) ? null : StatusMeter.Read(data, meter.Max); + var text = StatusMeter.Fit(value, 5) + (max is null ? string.Empty : "/" + StatusMeter.Fit(max, 5)); + return $"[bold {ScreenPalette.Value}]{Escape(text)}[/]"; } /// - /// What the meters row shows when it is not being edited: the labels, in order. The full line is long — - /// every alternative path of every meter — and a row clipped at the screen's edge says less than this. + /// An open edit whose buffer is longer than , cut to the stretch around the caret + /// so the caret is always drawn — the buffer itself is untouched. /// - private static string MeterSummary(IReadOnlyList meters) => - meters.Count == 0 ? "none" : string.Join(" · ", meters.Select(m => m.Label)) + " (⏎ edits the paths)"; + private static ScreenFieldEdit Scrolled(ScreenFieldEdit edit, int room) + { + if (edit.Text.Length < room) + { + return edit; + } + + var start = Math.Clamp(edit.Caret - room + 2, 0, edit.Text.Length); + var length = Math.Min(room - 1, edit.Text.Length - start); + return edit with { Text = edit.Text.Substring(start, length), Caret = edit.Caret - start }; + } + + private static string ElidePlain(string text, int width) => + text.Length <= width ? text : width <= 1 ? "…" : text[..(width - 1)] + "…"; + + /// The box of received paths under the table, drawn while the cursor is in it. + private static IEnumerable ReceivedBox(IReadOnlyList<(string Path, string Value)> received) + { + var indent = new string(' ', AffordanceWidth); + var widest = received.Count == 0 ? 0 : Math.Min(40, received.Max(r => r.Path.Length)); + yield return Line($"{indent}[{Label}]┌ {ReceivedCaption}[/]"); + if (received.Count == 0) + { + yield return Line($"{indent}[{Label}]│[/] [{Muted}]nothing yet — a meter shows once its value arrives[/]"); + } + + foreach (var (path, value) in received.Take(ReceivedRows)) + { + yield return Line( + $"{indent}[{Label}]│[/] [{ScreenPalette.Value}]{Escape(ElidePlain(path, widest).PadRight(widest))}[/]" + + $" [{Muted}]{Escape(ElidePlain(value, 20))}[/]"); + } + + var more = received.Count - ReceivedRows; + yield return Line(more > 0 + ? $"{indent}[{Label}]└ {more.ToString(CultureInfo.InvariantCulture)} more · open a path and ↑↓ to pick one[/]" + : $"{indent}[{Label}]└ open a path and ↑↓ to pick one[/]"); + + static OptionRow Line(string markup) => new(string.Empty, null, null, Static: true, Draw: (_, _) => markup); + } /// - /// The F8 "Input" screen, reflecting — and writing back to — the app's - /// . - /// - /// It was "Input & spellcheck" and had a SPELLCHECK section holding check spelling and - /// dictionary. Both are gone: this client has no speller, so the checkbox promised a check - /// that never ran and the dictionary named a file nothing opened. The rule they broke is the one - /// the header hints already follow: a screen may not advertise a key, or a setting, that does - /// nothing. - /// - /// - /// keep logins out of history is the one row here that is about a secret rather than a - /// convenience: with history browsable and searchable (⌃R), a hand-typed - /// connect <name> <password> recorded in it is a password on display. It is - /// bash's HISTIGNORE, on by default, and the verbs it recognises are - /// . Nothing writes history to disk either way. - /// - /// - /// There is still no newline key row, and now for the opposite reason to the one that took - /// it away. The command line wraps and grows, so a newline can be typed — but only on chords this - /// host delivers, and the interesting answers (Shift+⏎, Ctrl+⏎) are ones no Unix terminal reports - /// distinctly through SharpConsoleUI's parser. A field offering them would be the same empty - /// promise as the speller. The chord is fixed and named where the keys are named. - /// + /// Every value this connection's game data holds, as a path a meter can name and its text now: the + /// scalar fields of each GMCP package (and MSDP and MXP variables), objects walked a few levels deep and + /// arrays left out — a list of channels is not something a meter shows. Sorted by path. /// - internal static OptionsScreen InputScreen(InputSettings? input = null) + internal static IReadOnlyList<(string Path, string Value)> ReceivedPaths(GameDataStore data) { - var settings = input ?? new InputSettings(); + ArgumentNullException.ThrowIfNull(data); - return new OptionsScreen("Input", "F8", new List + var found = new List<(string, string)>(); + foreach (var entry in data.Entries) { - new("├ INPUT", null, null), - new("local echo", null, settings.LocalEcho, null, - ScreenToggle.Bind(() => settings.LocalEcho, v => settings.LocalEcho = v)), - new("keep per-tab drafts", null, settings.KeepDrafts, null, - ScreenToggle.Bind(() => settings.KeepDrafts, v => settings.KeepDrafts = v)), - new("keep logins out of history", null, settings.ExcludeCredentials, null, - ScreenToggle.Bind(() => settings.ExcludeCredentials, v => settings.ExcludeCredentials = v)), - new(string.Empty, null, null), - new("├ COMMAND LINE", null, null), - new("height (lines)", settings.Rows.ToString(CultureInfo.InvariantCulture), null, null, null, - ScreenField.Integer( - "height (lines)", () => settings.Rows, v => settings.Rows = v, - InputSettings.MinRows, InputSettings.MaxRowCeiling)), - new("grows to (lines)", settings.MaxRows.ToString(CultureInfo.InvariantCulture), null, null, null, - ScreenField.Integer( - "grows to (lines)", () => settings.MaxRows, v => settings.MaxRows = v, - InputSettings.MinRows, InputSettings.MaxRowCeiling)), - new("second bar on new windows", null, settings.SecondBar, null, - ScreenToggle.Bind(() => settings.SecondBar, v => settings.SecondBar = v)), - }); + Walk(entry.Package, entry.Data, 0); + } + + return found.OrderBy(f => f.Item1, StringComparer.OrdinalIgnoreCase).ToList(); + + void Walk(string path, System.Text.Json.Nodes.JsonNode? node, int depth) + { + if (found.Count >= 512) + { + return; + } + + switch (node) + { + case System.Text.Json.Nodes.JsonObject obj when depth < 4: + foreach (var (key, child) in obj) + { + Walk(path + "." + key, child, depth + 1); + } + + break; + case System.Text.Json.Nodes.JsonValue: + if (data.GetText(path) is { } text) + { + found.Add((path, text)); + } + + break; + } + } } - /// The F7 "Text & ANSI" screen body. + /// The F7 screen body. public static List TextAnsi() => Render(TextAnsiScreen()); /// The F8 "Input" screen body. diff --git a/src/SharpMUTerm.Tui/OptionsScreenView.cs b/src/SharpMUTerm.Tui/OptionsScreenView.cs index 70bf2380..1724d95f 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenView.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenView.cs @@ -6,7 +6,7 @@ namespace SharpMUTerm.Tui; /// -/// Composes an options screen (F7 Text & ANSI, F8 Input & spellcheck) from real +/// Composes an options screen (F7 Text & display, F8 Input) from real /// panels rather than one merged markup blob: a header band carrying the keyboard hints, the options /// list on a single full-width elevated card, and a Cancel/Save action bar pinned to the last row. /// These screens are one list, not two panes, so there is no column split and no vertical rule — the @@ -22,8 +22,17 @@ internal static class OptionsScreenView /// Columns the list is inset by: two of padding on each side of the card. private const int CardInset = 4; + /// + /// The screen's height, or 0 for none. With one, a list taller than the body is windowed around the + /// cursor () rather than run off the bottom — F7 with its meter table and + /// SOUND group is taller than a 24-row terminal. + /// public static IWindowControl Build( - OptionsScreenRenderer.OptionsScreen screen, int width, ScreenTheme scheme, ScreenFocus? focus = null) + OptionsScreenRenderer.OptionsScreen screen, + int width, + ScreenTheme scheme, + ScreenFocus? focus = null, + int height = 0) { var header = ScreenChrome.Band( OptionsScreenRenderer.HeaderLine( @@ -33,6 +42,12 @@ public static IWindowControl Build( OptionsScreenRenderer.FooterLine(screen.Rows, width, focus), ScreenPalette.FooterBg, scheme); var rows = OptionsScreenRenderer.BodyColumn(screen.Rows, focus, Math.Max(0, width - CardInset)); + if (height > 0) + { + // The header, the footer, the card's pad row above the list and one row of backdrop below it. + rows = ScreenChrome.Window(rows, Math.Max(1, height - 2 - CardPadding)); + } + var card = Card(rows, scheme); // Header on the first row, footer on the last, the card hugging its content directly beneath the diff --git a/src/SharpMUTerm.Tui/ScreenChrome.cs b/src/SharpMUTerm.Tui/ScreenChrome.cs index 56b0e164..0be6c83f 100644 --- a/src/SharpMUTerm.Tui/ScreenChrome.cs +++ b/src/SharpMUTerm.Tui/ScreenChrome.cs @@ -30,7 +30,8 @@ internal static string Hints( bool editable = false, ScreenFocus? focus = null, bool removable = false, - bool detailed = false) + bool detailed = false, + bool resettable = false) { if (focus?.Edit is { } edit) { @@ -56,8 +57,10 @@ internal static string Hints( // one that survives — and because the INFO key's drawn row (`i info on Aetherfall`) is on the // screen either way, while a key that removes a world has only this line and its own row. var all = (editable ? verbs + EditHint : verbs) + + (resettable ? ResetHint : string.Empty) + (removable ? DeleteHint : string.Empty) - + (detailed ? DetailHint : string.Empty); + + (detailed ? DetailHint : string.Empty) + + SearchHint; return $"[{ScreenPalette.Label}]{all} · [/][{ScreenPalette.Accent}]{fkey}[/][{ScreenPalette.Label}]/[/]" + $"[{ScreenPalette.Accent}]Esc[/][{ScreenPalette.Label}] close [/]"; } @@ -93,6 +96,18 @@ internal static string Hints( /// internal const string DetailHint = " · i info"; + /// + /// What a screen adds while the focused row is a declared setting that differs from its default — and + /// only then, since r does nothing on a row at its default. + /// + internal const string ResetHint = " · r reset"; + + /// + /// The settings search, which / opens on every settings screen (). + /// Last of the verbs, so a narrow header gives it up before anything the screen itself does. + /// + internal const string SearchHint = " · / search"; + /// The hints that replace a screen's own while a field edit is open. internal const string EditingHints = "⏎ commit · Esc revert"; @@ -365,6 +380,9 @@ private static string Capture(ScreenFieldEdit open) /// internal const int MaxChoiceRows = 6; + /// The longest note drawn beside a choice (). + internal const int MaxNoteLength = 16; + /// What the dropdown calls itself when the field will take values outside the list. internal const string OpenChoicesCaption = "suggestions"; @@ -474,7 +492,7 @@ private static (string Caption, List<(string Content, string Background)> Entrie { var all = open.Choices!; var visible = open.VisibleChoices; - var caption = open.ClosedChoices ? ClosedChoicesCaption : OpenChoicesCaption; + var caption = open.ChoiceCaption ?? (open.ClosedChoices ? ClosedChoicesCaption : OpenChoicesCaption); var entries = new List<(string, string)>(); if (visible.Count == 0) @@ -491,6 +509,12 @@ private static (string Caption, List<(string Content, string Background)> Entrie for (var i = first; i < first + take; i++) { var name = MarkupText.Escape(visible[i]); + if (open.ChoiceNotes is { } notes && notes.TryGetValue(visible[i], out var note)) + { + var shortNote = note.Length > MaxNoteLength ? note[..(MaxNoteLength - 1)] + "…" : note; + name += $" [{ScreenPalette.Muted}]{MarkupText.Escape(shortNote)}[/]"; + } + entries.Add(i == marked ? ($"[{ScreenPalette.Accent}]▸[/] [{ScreenPalette.Value}]{name}[/]", ScreenPalette.MenuSelectedBg) : ($" [{ScreenPalette.Label}]{name}[/]", ScreenPalette.MenuBg)); diff --git a/src/SharpMUTerm.Tui/ScreenEdits.cs b/src/SharpMUTerm.Tui/ScreenEdits.cs index e25d1956..5aa54b55 100644 --- a/src/SharpMUTerm.Tui/ScreenEdits.cs +++ b/src/SharpMUTerm.Tui/ScreenEdits.cs @@ -78,6 +78,17 @@ internal sealed class ScreenEdits internal IReadOnlyList Deletions => _deletions.ConvertAll(d => d.What); /// Flips a checkbox and writes it out. Committed on the spot; nothing to review. + /// + /// Puts a declared setting back to its default — the same funnel as every other change, so a reset is + /// saved, and reaches a connected session, exactly as typing the default in would. + /// + internal void Apply(Action reset) + { + ArgumentNullException.ThrowIfNull(reset); + reset(); + _persist?.Invoke(); + } + internal void Apply(ScreenToggle toggle) { toggle.Flip(); diff --git a/src/SharpMUTerm.Tui/ScreenField.cs b/src/SharpMUTerm.Tui/ScreenField.cs index d2560a27..7df78259 100644 --- a/src/SharpMUTerm.Tui/ScreenField.cs +++ b/src/SharpMUTerm.Tui/ScreenField.cs @@ -44,6 +44,11 @@ namespace SharpMUTerm.Tui; /// chrome's, applied at the last moment before markup (see ScreenChrome.Field), so the plaintext /// never exists in a rendered frame that a snapshot, a screenshot or a shoulder could read. /// +/// +/// A dim note drawn beside a choice in the dropdown, by choice — what a game-data path holds right now, on +/// F7's meter editor. The note is never part of the value: ↑↓ still put only the choice in the buffer. +/// +/// What the dropdown is called in place of suggestions, or null. internal readonly record struct ScreenFieldEdit( int Field, string Text, @@ -53,7 +58,9 @@ internal readonly record struct ScreenFieldEdit( IReadOnlyList? Choices = null, bool ClosedChoices = false, bool Capture = false, - bool Masked = false) + bool Masked = false, + IReadOnlyDictionary? ChoiceNotes = null, + string? ChoiceCaption = null) { /// Whether the open field knows any values at all, whatever the buffer currently is. internal bool HasChoices => Choices is { Count: > 0 }; @@ -129,7 +136,9 @@ internal readonly record struct ScreenField( bool ClosedChoices = false, bool Capture = false, bool Masked = false, - Func? Follow = null) + Func? Follow = null, + IReadOnlyDictionary? ChoiceNotes = null, + string? ChoiceCaption = null) { /// Longest rejection message kept; regex parser errors run to several lines otherwise. private const int MaxErrorLength = 44; diff --git a/src/SharpMUTerm.Tui/ScreenModel.cs b/src/SharpMUTerm.Tui/ScreenModel.cs index e7c34514..31a22b84 100644 --- a/src/SharpMUTerm.Tui/ScreenModel.cs +++ b/src/SharpMUTerm.Tui/ScreenModel.cs @@ -211,10 +211,15 @@ internal enum ScreenButtonKind /// The checkbox Space flips, or null when the row has none. /// The values ⏎ opens for editing, in the order the screen draws them. /// The command ⏎ runs, or null when the row is not a button. +/// +/// Puts the row's value back to its default, or null when the row is at its default or has none to go back +/// to — so r reset is offered exactly where it would do something. Only declared settings carry one. +/// internal readonly record struct ScreenRow( ScreenToggle? Toggle = null, IReadOnlyList? Fields = null, - ScreenButton? Button = null) + ScreenButton? Button = null, + Action? Reset = null) { /// A selectable row with nothing to press and nothing to type into. internal static ScreenRow Stop => default; @@ -523,6 +528,9 @@ internal ScreenRow RowAt(int pane, int index) => /// The checkbox at a cursor position, or null when that row isn't pressable. internal ScreenToggle? ToggleAt(int pane, int index) => RowAt(pane, index).Toggle; + /// What r runs on a row: its reset, or null where the row is at its default. + internal Action? ResetAt(int pane, int index) => RowAt(pane, index).Reset; + /// The button at a cursor position, or null when that row isn't one. internal ScreenButton? ButtonAt(int pane, int index) => RowAt(pane, index).Button; diff --git a/src/SharpMUTerm.Tui/SettingsOverlay.cs b/src/SharpMUTerm.Tui/SettingsOverlay.cs index e83004f5..33d4b046 100644 --- a/src/SharpMUTerm.Tui/SettingsOverlay.cs +++ b/src/SharpMUTerm.Tui/SettingsOverlay.cs @@ -49,6 +49,28 @@ internal sealed class SettingsOverlay ///
    private readonly Stack _behind = new(); + /// + /// The settings search, while it is up over a screen (/), or null. It is drawn in the screen's own + /// window in place of the screen — content-swapping, for 's reason — and Esc puts the + /// screen back exactly as it was, because the screen's session is never touched while it is up. + /// + private SettingsSearchState? _search; + + /// + /// What the search reads and how it takes a reader to a match. Set by the app; with none, / is not + /// ours and the header would be wrong to name it, which is why every screen is opened by an app that sets it. + /// + internal SettingsSearchHost? SearchHost { get; set; } + + /// Whether the settings search is up. + internal bool IsSearching => _search is not null; + + /// The search's query, for a test. + internal string? SearchQuery => _search?.Query; + + /// Where the open screen's cursor is, for a test. + internal ScreenFocus? Focus => _binding?.Session.Focus(); + /// /// The overlay no longer takes a save action. Persistence moved to the point of change: each screen's /// writes the configuration out as it accepts one, so there is no moment on @@ -103,6 +125,45 @@ public void Toggle(ConsoleKey key, Func binding) Open(key, binding()); } + /// + /// Puts a screen up in place of whatever is showing — the settings search's ⏎. Over an open screen it + /// swaps the content of the same window, so going to a field on the screen the search was opened from does + /// not close and reopen it; a screen holding deletions is closed through its review first, as a change of + /// F-key would. + /// + public void Show(ConsoleKey key, ScreenBinding binding) + { + _search = null; + if (_window is null) + { + Open(key, binding); + return; + } + + var edits = (_behind.Count > 0 ? _behind.Last() : _binding)?.Session.Edits; + if (edits is { HasDeletions: true }) + { + CloseAndReview(); + Open(key, binding); + return; + } + + _behind.Clear(); + _openKey = key; + _binding = binding; + Refresh(); + } + + /// Closes the overlay altogether, keeping everything, as Esc on a screen does. + public void CloseAll() + { + _search = null; + if (_window is not null) + { + CloseAndReview(); + } + } + /// Renders a screen into a headless frame (used by snapshots). public void OpenForSnapshot(ConsoleKey key, ScreenBinding binding) => Open(key, binding); @@ -193,6 +254,13 @@ private void Paste(string text) return; } + if (_search is { } search) + { + search.Type(text); + Refresh(); + return; + } + Apply(binding, binding.Session.Paste(text)); } @@ -203,6 +271,25 @@ private void OnKey(object? sender, KeyPressedEventArgs e) return; } + if (_search is { } search) + { + e.Handled = ApplySearch(search, search.Handle(e.KeyInfo)); + return; + } + + // `/` opens the search over any screen — but only while the screen is navigating: inside an open + // field it is a character being typed, and the field has the whole keyboard (SettingsSession's rule). + if (e.KeyInfo.KeyChar == '/' + && (e.KeyInfo.Modifiers & (ConsoleModifiers.Control | ConsoleModifiers.Alt)) == 0 + && !binding.Session.IsEditing + && SearchHost is { } host) + { + _search = new SettingsSearchState(host, TitleOf(_openKey, host)); + Refresh(); + e.Handled = true; + return; + } + // ⌃V is the app-level paste, and it was as dead on these screens as the terminal's own. The // framework reads the clipboard for the focused control when that control accepts paste, and a // settings screen has none to offer, so the read is done here instead. ⌃⇧V is not this chord: @@ -222,6 +309,39 @@ private void OnKey(object? sender, KeyPressedEventArgs e) e.Handled = Apply(binding, binding.Session.Handle(e.KeyInfo)); } + /// What the search answered a key with, acted on. + private bool ApplySearch(SettingsSearchState search, SettingsSearchAction action) + { + switch (action) + { + case SettingsSearchAction.Close: + _search = null; + Refresh(); + return true; + + case SettingsSearchAction.Go when search.Current is { } match && SearchHost is { } host: + // The host puts the screen up (Show), which takes the search down with it. A host that + // could not leaves the search where it is. + if (!host.Go(match)) + { + Refresh(); + } + + return true; + + case SettingsSearchAction.None: + return false; + + default: + Refresh(); + return true; + } + } + + /// The title of the section a key opens, for the search's "Esc goes back to …" line. + private static string? TitleOf(ConsoleKey key, SettingsSearchHost host) => + host.Sections().FirstOrDefault(s => string.Equals(s.Key, key.ToString(), StringComparison.Ordinal))?.Title; + /// /// Acts on what a screen said an input meant, and reports whether the input was consumed. Shared by /// the key and the paste paths so a screen cannot answer the two differently. @@ -268,7 +388,10 @@ private void Refresh() } window.ClearControls(); - window.AddControl(binding.Control()); + window.AddControl(_search is { } search + ? SettingsSearchView.Build( + search, _system.DesktopDimensions.Width, _system.DesktopDimensions.Height, Scheme) + : binding.Control()); window.Invalidate(redrawAll: true); } @@ -329,6 +452,7 @@ private void Reset() _system.ConsoleDriver.Paste -= OnPaste; _window = null; _binding = null; + _search = null; _behind.Clear(); } } diff --git a/src/SharpMUTerm.Tui/SettingsSearchSurface.cs b/src/SharpMUTerm.Tui/SettingsSearchSurface.cs new file mode 100644 index 00000000..3b4675c1 --- /dev/null +++ b/src/SharpMUTerm.Tui/SettingsSearchSurface.cs @@ -0,0 +1,342 @@ +using System.Globalization; +using SharpConsoleUI.Controls; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using static SharpMUTerm.Tui.MarkupText; +using static SharpMUTerm.Tui.ScreenPalette; + +namespace SharpMUTerm.Tui; + +/// +/// What the settings search needs from the app: the declared sections it searches, the configuration their +/// values are read from, and a way to take the reader to a match. returns false when it could +/// not, and the search stays up. +/// +internal sealed record SettingsSearchHost( + Func> Sections, + Func Config, + Func Go); + +/// What a key did to the settings search. +internal enum SettingsSearchAction +{ + /// Not a key the search uses. + None, + + /// The query or the selection moved. + Redraw, + + /// Back to the screen the search was opened over. + Close, + + /// Go to the selected match. + Go, +} + +/// +/// The settings search's keyboard state: the query being typed and which match is selected. It owns no +/// controls — hands it keys and draws from it — +/// so the whole contract is testable without a terminal. Typing narrows, Backspace widens, ↑↓ walk the matches, +/// ⏎ goes to the selected one, Esc goes back to the screen it was opened over. +/// +internal sealed class SettingsSearchState +{ + private readonly SettingsSearchHost _host; + + internal SettingsSearchState(SettingsSearchHost host, string? origin = null) + { + ArgumentNullException.ThrowIfNull(host); + _host = host; + Origin = origin; + } + + /// The title of the screen the search was opened over, which Esc goes back to. + internal string? Origin { get; } + + /// What has been typed. + internal string Query { get; private set; } = string.Empty; + + /// Which match is selected, clamped to the matches there are. + internal int Selected { get; private set; } + + /// The sections searched, in their order. + internal IReadOnlyList Sections => _host.Sections(); + + /// The configuration a match's value is read from. + internal AppConfiguration Config => _host.Config(); + + /// Every match for the query, in section order. + internal IReadOnlyList Matches => SettingsSearch.Find(Sections, Query); + + /// The selected match, or null when nothing matches. + internal SettingsMatch? Current + { + get + { + var matches = Matches; + return matches.Count == 0 ? null : matches[Math.Clamp(Selected, 0, matches.Count - 1)]; + } + } + + /// Interprets one key. + internal SettingsSearchAction Handle(ConsoleKeyInfo key) + { + switch (key.Key) + { + case ConsoleKey.Escape: + return SettingsSearchAction.Close; + + case ConsoleKey.Enter: + return Current is null ? SettingsSearchAction.Redraw : SettingsSearchAction.Go; + + case ConsoleKey.UpArrow: + return Move(-1); + + case ConsoleKey.DownArrow: + return Move(1); + + case ConsoleKey.Backspace: + if (Query.Length == 0) + { + return SettingsSearchAction.Redraw; + } + + Query = Query[..^1]; + Selected = 0; + return SettingsSearchAction.Redraw; + + default: + if (key.KeyChar != '\0' && !char.IsControl(key.KeyChar) + && (key.Modifiers & (ConsoleModifiers.Control | ConsoleModifiers.Alt)) == 0) + { + Type(key.KeyChar.ToString()); + return SettingsSearchAction.Redraw; + } + + // Every other key is swallowed rather than passed on: the screen under the search is not + // the one the reader is looking at, and a key reaching it would change something unseen. + return SettingsSearchAction.Redraw; + } + } + + /// Appends text to the query — a key, or a paste flattened to one line. + internal void Type(string text) + { + var line = new string((text ?? string.Empty).Where(c => !char.IsControl(c)).ToArray()); + Query = (Query + line).Length > MaxQuery ? (Query + line)[..MaxQuery] : Query + line; + Selected = 0; + } + + /// The longest query kept; a field label is never near it. + internal const int MaxQuery = 64; + + private SettingsSearchAction Move(int delta) + { + var count = Matches.Count; + if (count == 0) + { + return SettingsSearchAction.Redraw; + } + + Selected = ((Math.Clamp(Selected, 0, count - 1) + delta) % count + count) % count; + return SettingsSearchAction.Redraw; + } +} + +/// +/// Draws the settings search: a header carrying the query, a list of every settings section with how many +/// matches each holds, and beside it the matches grouped by section, the matched text marked, each field's +/// value now and ● changed where it differs from its default. Below +/// the section list is left out and the matches take the width. +/// Pure markup apart from . +/// +internal static class SettingsSearchView +{ + /// The section list's width when the screen can afford it. + internal const int SectionsWidth = 35; + + /// The fewest cells the section list is drawn in. + internal const int SectionsMinimum = 24; + + /// The fewest cells the matches are readable in. + internal const int MatchesMinimum = 44; + + /// The header's hints. Every key named here is one answers. + internal const string Hints = "type to filter · ↑↓ select · ⏎ go · Esc back"; + + /// The composed screen. + internal static IWindowControl Build(SettingsSearchState state, int width, int height, ScreenTheme scheme) + { + ArgumentNullException.ThrowIfNull(state); + + var matches = state.Matches; + var rows = ScreenChrome.Rows(height); + var header = ScreenChrome.Band(HeaderLine(state, matches, width), HeaderBg, scheme); + var footer = ScreenChrome.Band(FooterLine(state, matches, width), FooterBg, scheme); + + if (ScreenChrome.TooNarrowForTwo(width, SectionsMinimum, MatchesMinimum)) + { + var only = ScreenChrome.Window(MatchColumn(state, matches, width), rows); + return ScreenChrome.Single( + header, footer, ScreenChrome.Stretch(ScreenChrome.Panel(only, scheme)), only.Count, rows); + } + + var left = ScreenChrome.SplitWidth(width, SectionsWidth, SectionsMinimum, MatchesMinimum); + var sections = SectionColumn(state, matches, left); + var right = ScreenChrome.Window(MatchColumn(state, matches, width - left - ScreenChrome.ColumnDivider), rows); + return ScreenChrome.Split( + header, + footer, + ScreenChrome.Stretch(ScreenChrome.Panel(sections, scheme)), + ScreenChrome.Stretch(ScreenChrome.Panel(right, scheme)), + left, + Math.Max(sections.Count, right.Count), + rows, + scheme); + } + + /// + /// Settings / meter▌ 3 matches on the left, the keys on the right. The block after the query is + /// where the next character lands; it is drawn rather than placed with the terminal's caret because the + /// screens draw every caret they have. + /// + internal static string HeaderLine(SettingsSearchState state, IReadOnlyList matches, int width) + { + var count = state.Query.Trim().Length == 0 + ? string.Empty + : matches.Count == 1 ? " 1 match" : $" {matches.Count.ToString(CultureInfo.InvariantCulture)} matches"; + var left = $" [bold {Value}]Settings[/] [{Accent}]/[/] [{Value} on {FieldBg}]{Escape(state.Query)}[/]" + + $"[{Ink} on {Accent}] [/][{Label}]{count}[/]"; + return SpreadTitle(left, $"[{Label}]{Hints} [/]", width); + } + + /// Where the selection is, and the actions: meter 1/3 · Text & display [Esc] Back [⏎] Go. + internal static string FooterLine(SettingsSearchState state, IReadOnlyList matches, int width) + { + var context = state.Current is { } current + ? ScreenChrome.Context( + Escape(ScreenChrome.Position(state.Query.Trim(), Math.Clamp(state.Selected, 0, matches.Count - 1), matches.Count)), + Escape(current.Section.Title)) + : string.Empty; + var actions = $"[{Label}] [[Esc]] Back [/] " + + (state.Current is null ? string.Empty : $"[{Ink} on {Accent}] [[⏎]] Go [/] "); + return SpreadLR(" " + context, actions, width); + } + + /// + /// Every section, with its key and how many matches it holds. The section the selected match is in wears + /// the cursor band; a section with none is dimmed while a query is typed, so the list reads as where the + /// query was found. + /// + internal static List SectionColumn(SettingsSearchState state, IReadOnlyList matches, int width) + { + var counts = SettingsSearch.CountBySection(matches); + var selected = state.Current?.Section.Id; + var typed = state.Query.Trim().Length > 0; + var lines = new List { string.Empty }; + foreach (var section in state.Sections) + { + var count = counts.GetValueOrDefault(section.Id); + var key = section.Key ?? string.Empty; + var tally = count > 0 ? count.ToString(CultureInfo.InvariantCulture) : string.Empty; + var title = ElideVisible(Escape(section.Title), Math.Max(4, width - 11)); + var ink = typed && count == 0 ? Muted : Value; + var row = $" [{ink}]{PadVisible(title, Math.Max(4, width - 11))}[/] [{Label}]{key,-4}[/][{Accent}]{tally,3}[/]"; + lines.Add(ScreenChrome.Cursor(row, section.Id == selected, width)); + } + + return lines; + } + + /// + /// The matches, grouped under their section's title and key. A field match reads its label with the + /// matched run marked, its value now, and ● changed when it differs from its default; a section + /// match reads open …. The selected one wears the cursor band and has its help line under it. + /// + internal static List MatchColumn(SettingsSearchState state, IReadOnlyList matches, int width) + { + var lines = new List { string.Empty }; + if (state.Query.Trim().Length == 0) + { + lines.Add($" [{Label}]Type to search every setting by name, by what it does, or by screen.[/]"); + if (state.Origin is { } origin) + { + lines.Add($" [{Label}]Esc goes back to {Escape(origin)}.[/]"); + } + + return lines; + } + + if (matches.Count == 0) + { + lines.Add($" [{Label}]Nothing matches “{Escape(state.Query.Trim())}”.[/]"); + return lines; + } + + var config = state.Config; + var selected = Math.Clamp(state.Selected, 0, matches.Count - 1); + string? section = null; + string? group = null; + for (var i = 0; i < matches.Count; i++) + { + var match = matches[i]; + if (!string.Equals(match.Section.Id, section, StringComparison.Ordinal)) + { + if (section is not null) + { + lines.Add(string.Empty); + } + + section = match.Section.Id; + group = null; + lines.Add($" [bold {Value}]{Escape(match.Section.Title)}[/] [{Label}]{Escape(match.Section.Key ?? string.Empty)}[/]"); + } + + if (match.Field is { Group: { } fieldGroup } && !string.Equals(fieldGroup, group, StringComparison.Ordinal)) + { + group = fieldGroup; + lines.Add($" [dim]├ {Escape(fieldGroup.ToUpperInvariant())}[/]"); + } + + lines.Add(ScreenChrome.Cursor(Row(match, config, width), i == selected, width)); + if (i == selected && match.Field?.Help is { } help) + { + lines.Add($" [{Label}]{ElideVisible(Escape(help), Math.Max(8, width - 6))}[/]"); + } + } + + return lines; + } + + /// One match: its marked text, then (for a field) its value and whether it has changed. + private static string Row(SettingsMatch match, AppConfiguration config, int width) + { + var text = Marked(match); + if (match.Field is not { } field) + { + return $" [{Label}]open[/] {text}"; + } + + var changed = field.Binding is { } binding && !binding.IsDefault(config); + var mark = changed ? $" [{Accent}]{OptionsScreenRenderer.ChangedMark}[/]" : string.Empty; + var value = field.Binding?.Text(config) ?? string.Empty; + var room = Math.Max(0, width - 3 - 30 - VisibleLength(mark) - 2); + var shown = room > 3 && value.Length > 0 ? $"[{Muted}]{ElideVisible(Escape(value), room)}[/]" : string.Empty; + return $" {PadVisible(text, 30)} {shown}{mark}"; + } + + /// The match's text with the matched run in the accent, bold. + private static string Marked(SettingsMatch match) + { + if (match.Start < 0 || match.Length == 0 || match.Start + match.Length > match.Text.Length) + { + return $"[{Value}]{Escape(match.Text)}[/]"; + } + + var before = match.Text[..match.Start]; + var run = match.Text.Substring(match.Start, match.Length); + var after = match.Text[(match.Start + match.Length)..]; + return $"[{Value}]{Escape(before)}[/][bold {Accent}]{Escape(run)}[/][{Value}]{Escape(after)}[/]"; + } +} diff --git a/src/SharpMUTerm.Tui/SettingsSession.cs b/src/SharpMUTerm.Tui/SettingsSession.cs index 4c72a8e2..e106878d 100644 --- a/src/SharpMUTerm.Tui/SettingsSession.cs +++ b/src/SharpMUTerm.Tui/SettingsSession.cs @@ -149,7 +149,9 @@ internal ScreenFocus Focus() field?.Choices, field?.ClosedChoices ?? false, field?.Capture ?? false, - field?.Masked ?? false) + field?.Masked ?? false, + field?.ChoiceNotes, + field?.ChoiceCaption) : (ScreenFieldEdit?)null; return new ScreenFocus(Selection.Pane, Selection.Index, edit, Enter(model)); @@ -235,6 +237,9 @@ private ScreenAction Interpret(ConsoleKeyInfo key) case ConsoleKey.I when key.Modifiers == 0: return Detail(model); + case ConsoleKey.R when key.Modifiers == 0: + return Reset(model); + case ConsoleKey.Spacebar: return Toggle(model); @@ -310,6 +315,23 @@ private ScreenAction Detail(ScreenModel model) return ScreenAction.Consumed; } + /// + /// r on a declared setting that differs from its default puts the default back, through + /// like any other change. A row at its default has no reset and the key is not ours + /// there, which is also why the header names r reset only on such a row. A plain letter is safe + /// for 's reason: an open field edit has taken the whole keyboard long before this. + /// + private ScreenAction Reset(ScreenModel model) + { + if (model.ResetAt(Selection.Pane, Selection.Index) is not { } reset) + { + return ScreenAction.None; + } + + Edits.Apply(reset); + return ScreenAction.Redraw; + } + private ScreenAction Toggle(ScreenModel model) { if (model.ToggleAt(Selection.Pane, Selection.Index) is not { } toggle) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs new file mode 100644 index 00000000..945d294f --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs @@ -0,0 +1,93 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Protocols; + +namespace SharpMUTerm.Tui; + +/// +/// The settings screens' declared half: the sections the client registers (), the +/// projections F7 and F8 are drawn from, and the settings search's way back into the screens. The screens' +/// keyboard and chrome are 's and 's as before. +/// +internal sealed partial class SharpMUTermApp +{ + private void RegisterBuiltInSettings() => BuiltInSettings.Register(_contributions.SettingsSections); + + /// A declared section's title — what its screen's header, its ⌃P entry and the search all call it. + private string SectionTitle(string id) => + Section(id).Title; + + /// A declared section, from the registry; the built-in declaration if something removed it. + private SettingsSectionContribution Section(string id) => + _contributions.SettingsSections.Find(id) ?? BuiltInSettings.All.First(s => s.Id == id); + + /// + /// F7 as it stands: the declared section over the live configuration, the meter table reading the focused + /// window's game data, and deciding whether the received-data box is shown. + /// + private OptionsScreenRenderer.OptionsScreen TextProjection(int cursor) => + OptionsScreenRenderer.TextAnsiScreen(_config, includeSound: true, SettingsGameData(), cursor, Section("text")); + + /// F8 as it stands. + private OptionsScreenRenderer.OptionsScreen InputProjection() => + OptionsScreenRenderer.InputScreen(_config, Section("input")); + + /// + /// The game data the meter editor reads: the focused window's session's — never _active's, for the + /// misdelivery reason everything else here resolves through the focused window — or the demo scene's. + /// + private GameDataStore SettingsGameData() => SendTarget()?.GameData ?? StatusData(); + + /// What the settings search reads, and how its ⏎ lands. + private SettingsSearchHost SettingsSearchHost() => + new(() => _contributions.SettingsSections.Ordered, () => _config, GoToSetting); + + /// + /// The search's ⏎: opens the match's screen in the same window and, for a declared field, puts the cursor + /// on the row drawing it. Packages (F10) is not a settings screen and is opened its own way. + /// + private bool GoToSetting(SettingsMatch match) + { + if (string.Equals(match.Section.Id, "packages", StringComparison.Ordinal)) + { + _settings.CloseAll(); + ShowPackages(); + return true; + } + + if (!Enum.TryParse(match.Section.Key, out var key) + || SettingsScreens().FirstOrDefault(s => s.Key == key) is not { Open: not null } screen) + { + return false; + } + + var binding = screen.Open(); + if (match.Field is { } field && FieldRow(match.Section.Id, field.Id) is { } row and >= 0) + { + binding.Session.Selection.Seed(0, row); + } + + _settings.Show(key, binding); + return true; + } + + /// Where a declared field's row is on its screen, or null for a section not drawn from declarations. + private int? FieldRow(string section, string field) => section switch + { + "text" => OptionsScreenRenderer.IndexOf(TextProjection(-1), field), + "input" => OptionsScreenRenderer.IndexOf(InputProjection(), field), + _ => null, + }; + + /// Whether the settings search is up, for a test. + internal bool SettingsSearchIsOpen => _settings.IsSearching; + + /// The F-key of the open settings screen, for a test. + internal ConsoleKey? SettingsOpenKey => _settings.OpenKey; + + /// Where the open settings screen's cursor is, for a test. + internal ScreenFocus? SettingsFocus => _settings.Focus; + + /// Where a declared field's row is on F7 or F8, for a test. + internal int? SettingsFieldRow(string section, string field) => FieldRow(section, field); +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 0ad7eb92..3c95556b 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -900,11 +900,12 @@ public SharpMUTermApp( _window.IsScrollable = false; RegisterBuiltInContributions(); + RegisterBuiltInSettings(); _palette = new CommandPalette(_system, BuildCatalog, () => _active?.SessionKey, id => DispatchCommand(id)); _messageLog = new MessageLogOverlay(_system, _diagnostics); _gameData = new GameDataOverlay(_system, _time); _screens = ScreenTheme.For(_theme); - _settings = new SettingsOverlay(_system, _screens); + _settings = new SettingsOverlay(_system, _screens) { SearchHost = SettingsSearchHost() }; _composer = new ComposeOverlay(_system, _spelling, _screens); _packageView = new ListOverlay(_system, _screens); _sendMenu = new ListOverlay(_system, _screens); @@ -1949,6 +1950,56 @@ public string RenderSnapshot(string? view = null) return RenderFrame(); } + // The settings search and F7's meter editor, reached by the keys a reader would press: F7, `/`, + // `meter`. `settings-meters` then takes ⏎ to the field and ↓ onto the second meter, where the + // received-data box is drawn; `-pick` opens that meter's value path, so its dropdown lists what the + // demo's game data holds. The game data is written through SetGmcp, the call the wire makes. + // `settings-changed` is F7 after two real edits — Space on `emoji substitution`, and `8` typed into + // the tab width — so the frame carries the `● changed` marks and the header's `r reset`. + if (string.Equals(view, "settings-changed", StringComparison.OrdinalIgnoreCase)) + { + _settings.OpenForSnapshot(ConsoleKey.F7, TextAnsiScreen()); + for (var down = 0; down < 5; down++) + { + _settings.SimulateKey(Stroke('\0', ConsoleKey.DownArrow)); + } + + _settings.SimulateKey(Stroke(' ', ConsoleKey.Spacebar)); + _settings.SimulateKey(Stroke('\0', ConsoleKey.UpArrow)); + _settings.SimulateKey(Stroke('\r', ConsoleKey.Enter)); + _settings.SimulateKey(Stroke('\b', ConsoleKey.Backspace)); + _settings.SimulateKey(Stroke('8', ConsoleKey.D8)); + _settings.SimulateKey(Stroke('\r', ConsoleKey.Enter)); + SyncInputWidth(); + return RenderFrame(); + } + + if (string.Equals(view, "settings-search", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "settings-meters", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "settings-meters-pick", StringComparison.OrdinalIgnoreCase)) + { + LoadDemoGameData(); + _settings.OpenForSnapshot(ConsoleKey.F7, TextAnsiScreen()); + foreach (var c in "/meter") + { + _settings.SimulateKey(Stroke(c, c == '/' ? ConsoleKey.Oem2 : ConsoleKey.NoName)); + } + + if (!string.Equals(view, "settings-search", StringComparison.OrdinalIgnoreCase)) + { + _settings.SimulateKey(Stroke('\r', ConsoleKey.Enter)); + _settings.SimulateKey(Stroke('\0', ConsoleKey.DownArrow)); + if (view!.EndsWith("-pick", StringComparison.OrdinalIgnoreCase)) + { + _settings.SimulateKey(Stroke('\r', ConsoleKey.Enter)); + _settings.SimulateKey(Stroke('\t', ConsoleKey.Tab)); + } + } + + SyncInputWidth(); + return RenderFrame(); + } + // Settings screens (composed-control or markup — SettingsView hands back a control factory // either way) open over the workspace for their --view name. A "-edit" view opens the // same screen and then drives real keys into it, so the frame shows a field genuinely mid-edit @@ -6462,18 +6513,18 @@ private void RefreshStatusBar() /// private IReadOnlyList SettingsScreens() => new SettingsScreen[] { - new(ConsoleKey.F2, "Triggers & spawn routing", new[] { "triggers", "route", "highlight", "set" }, TriggersScreen), - new(ConsoleKey.F3, "Aliases", new[] { "aliases" }, AliasesScreen), - new(ConsoleKey.F4, "Keypad & hotkeys", new[] { "keypad" }, KeypadScreen), - new(ConsoleKey.F5, "Worlds & Characters", new[] { "worlds", "settings" }, WorldsScreen), - new(ConsoleKey.F6, "Timers", new[] { "timers" }, TimersScreen), - new(ConsoleKey.F7, "Text & ANSI", new[] { "textansi" }, TextAnsiScreen), - new(ConsoleKey.F8, "Input", new[] { "input" }, InputScreen), + new(ConsoleKey.F2, SectionTitle("triggers"), new[] { "triggers", "route", "highlight", "set" }, TriggersScreen), + new(ConsoleKey.F3, SectionTitle("aliases"), new[] { "aliases" }, AliasesScreen), + new(ConsoleKey.F4, SectionTitle("keypad"), new[] { "keypad" }, KeypadScreen), + new(ConsoleKey.F5, SectionTitle("worlds"), new[] { "worlds", "settings" }, WorldsScreen), + new(ConsoleKey.F6, SectionTitle("timers"), new[] { "timers" }, TimersScreen), + new(ConsoleKey.F7, SectionTitle("text"), new[] { "textansi" }, TextAnsiScreen), + new(ConsoleKey.F8, SectionTitle("input"), new[] { "input" }, InputScreen), // "password" and "startup" are further --view names for the same character-pane screen, the way // F2 carries four: the screen is identical, only the -edit script differs, and each names a // state a still frame is the only way to look at — a masked buffer mid-edit, and the two-entry // dropdown over `at start`, which is drawn *downward* over the rows beneath it. - new(ConsoleKey.F9, "Character logging", new[] { "logging", "password", "startup" }, CharacterLoggingScreen), + new(ConsoleKey.F9, SectionTitle("logging"), new[] { "logging", "password", "startup" }, CharacterLoggingScreen), }; /// @@ -7217,24 +7268,32 @@ private ScreenBinding TimersScreen() _system.DesktopDimensions.Height)); } - /// Opens the F7 Text & ANSI screen, bound to the app's text preferences. - private ScreenBinding TextAnsiScreen() => - OptionsScreen(() => OptionsScreenRenderer.TextAnsiScreen(_config.Text, _config.Sound)); + /// Opens the F7 Text & display screen, drawn from its declared section. + private ScreenBinding TextAnsiScreen() => OptionsScreen(TextProjection); - /// Opens the F8 Input screen, bound to the app's input preferences. - private ScreenBinding InputScreen() => - OptionsScreen(() => OptionsScreenRenderer.InputScreen(_config.Input)); + /// Opens the F8 Input screen, drawn from its declared section. + private ScreenBinding InputScreen() => OptionsScreen(_ => InputProjection()); /// /// The shared open path for the single-list option screens (F7/F8). is - /// re-projected from config on every key, so a flipped checkbox shows up in both the row it lives - /// on and the model the next keystroke navigates. - /// - private ScreenBinding OptionsScreen(Func screen) - { - var session = new SettingsSession(_ => OptionsScreenRenderer.Model(screen()), SaveConfiguration); - return new ScreenBinding(session, () => OptionsScreenView.Build( - screen(), _system.DesktopDimensions.Width, _screens, session.Focus())); + /// re-projected from config on every key, and handed the cursor, so a flipped checkbox shows up in both + /// the row it lives on and the model the next keystroke navigates — and F7's received-data box follows the + /// cursor into and out of the meter table. + /// + private ScreenBinding OptionsScreen(Func screen) + { + var session = new SettingsSession( + selection => OptionsScreenRenderer.Model(screen(selection.CursorIn(0))), SaveConfiguration); + return new ScreenBinding(session, () => + { + var focus = session.Focus(); + return OptionsScreenView.Build( + screen(session.Selection.CursorIn(0)), + _system.DesktopDimensions.Width, + _screens, + focus, + _system.DesktopDimensions.Height); + }); } /// The --view suffix that opens a settings screen with a field being typed into. diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index e89b91ab..991faf21 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -13,6 +13,7 @@ internal static class SnapshotViews null, "worlds", "settings", "triggers", "route", "highlight", "set", "aliases", "timers", "keypad", "textansi", "input", "logging", "password", "startup", "deletions", + "settings-search", "settings-meters", "settings-meters-pick", "settings-changed", "triggers-edit", "logging-edit", "keypad-edit", "password-edit", "startup-edit", "freeze", "freeze-scrollback", "spawn", "split", "move", "drag", "history", "history-search", "history-search-filter", "draft", "draft2", diff --git a/tests/SharpMUTerm.Client.Tests/SettingsDeclarationTests.cs b/tests/SharpMUTerm.Client.Tests/SettingsDeclarationTests.cs new file mode 100644 index 00000000..68680102 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/SettingsDeclarationTests.cs @@ -0,0 +1,108 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Tests; + +/// +/// The declared settings: every built-in field is bound to the configuration, a fresh configuration is at every +/// default, a change is seen and a reset undoes it, and the search finds a field by label, group, help or +/// keyword and a screen by its title. +/// +public class SettingsDeclarationTests +{ + private static IEnumerable Fields => BuiltInSettings.All.SelectMany(s => s.Fields); + + [Test] + public async Task EveryDeclaredFieldIsBoundAndGrouped() + { + foreach (var field in Fields) + { + await Assert.That(field.Binding).IsNotNull(); + await Assert.That(field.Group).IsNotNull(); + } + } + + [Test] + public async Task AFreshConfigurationIsAtEveryDefault() + { + var config = new AppConfiguration(); + foreach (var field in Fields) + { + await Assert.That(field.Binding!.IsDefault(config)).IsTrue(); + } + } + + [Test] + public async Task AChangeIsSeenAndAResetUndoesIt() + { + var config = new AppConfiguration(); + config.Text.TabWidth = 8; + config.Text.StatusMeters.RemoveAt(0); + var tab = BuiltInSettings.Text.Fields.Single(f => f.Id == "tab-width").Binding!; + var meters = BuiltInSettings.Text.Fields.Single(f => f.Id == BuiltInSettings.MetersField).Binding!; + + await Assert.That(tab.IsDefault(config)).IsFalse(); + await Assert.That(meters.IsDefault(config)).IsFalse(); + + tab.Reset(config); + meters.Reset(config); + + await Assert.That(config.Text.TabWidth).IsEqualTo(TextSettings.DefaultTabWidth); + await Assert.That(config.Text.StatusMeters.Count).IsEqualTo(3); + } + + /// A reset list is a fresh one, never a default instance two configurations would share. + [Test] + public async Task ResetListsAreNotShared() + { + var binding = (SettingBinding>)BuiltInSettings.Text.Fields + .Single(f => f.Id == BuiltInSettings.MetersField).Binding!; + var a = new AppConfiguration(); + var b = new AppConfiguration(); + binding.Reset(a); + binding.Reset(b); + + await Assert.That(ReferenceEquals(a.Text.StatusMeters, b.Text.StatusMeters)).IsFalse(); + } + + [Test] + public async Task TheSearchFindsLabelsKeywordsAndTitles() + { + var byLabel = SettingsSearch.Find(BuiltInSettings.All, "METER"); + await Assert.That(byLabel.Select(m => m.Field?.Id)).Contains(BuiltInSettings.MetersField); + var meters = byLabel.First(m => m.Field?.Id == BuiltInSettings.MetersField); + await Assert.That(meters.Start).IsEqualTo(0); + await Assert.That(meters.Length).IsEqualTo(5); + + var byKeyword = SettingsSearch.Find(BuiltInSettings.All, "opacity"); + await Assert.That(byKeyword.Single().Field!.Id).IsEqualTo("transparency"); + await Assert.That(byKeyword.Single().Start).IsEqualTo(-1); + + var byTitle = SettingsSearch.Find(BuiltInSettings.All, "alias"); + await Assert.That(byTitle.Single().Field).IsNull(); + await Assert.That(byTitle.Single().Section.Id).IsEqualTo("aliases"); + + await Assert.That(SettingsSearch.Find(BuiltInSettings.All, " ")).IsEmpty(); + } + + [Test] + public async Task MatchesAreCountedBySection() + { + var counts = SettingsSearch.CountBySection(SettingsSearch.Find(BuiltInSettings.All, "volume")); + + await Assert.That(counts["text"]).IsEqualTo(3); + await Assert.That(counts.ContainsKey("input")).IsFalse(); + } + + /// Every settings screen F2–F10 is a section with its key, so the search can list and open all of them. + [Test] + public async Task EveryScreenIsASectionWithItsKey() + { + var registry = new ContributionRegistry(); + BuiltInSettings.Register(registry.SettingsSections); + + await Assert.That(registry.SettingsSections.Ordered.Select(s => s.Key!)) + .IsEquivalentTo(new[] { "F5", "F2", "F3", "F4", "F6", "F7", "F8", "F9", "F10" }); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs b/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs index 444f0203..f405c5c8 100644 --- a/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs @@ -106,7 +106,7 @@ public async Task EveryViewTheSnapshotKnowsIsInTheParityList() var source = File.ReadAllText(Path.Combine(RepositoryRoot(), "src", "SharpMUTerm.Tui", "SharpMUTermApp.cs")); var exact = Regex.Matches(source, @"string\.Equals\(view, ""([a-z0-9-]+)""").Select(m => m.Groups[1].Value); var prefixes = Regex.Matches(source, @"view\.StartsWith\(""([a-z0-9-]+)""").Select(m => m.Groups[1].Value); - var screens = Regex.Matches(source, @"new\(ConsoleKey\.F\d+, ""[^""]+"", new\[\] \{ ([^}]+) \}") + var screens = Regex.Matches(source, @"new\(ConsoleKey\.F\d+, [^,]+, new\[\] \{ ([^}]+) \}") .SelectMany(m => Regex.Matches(m.Groups[1].Value, @"""([a-z0-9-]+)""").Select(v => v.Groups[1].Value)); var listed = SnapshotViews.All.OfType().ToHashSet(StringComparer.Ordinal); @@ -116,6 +116,7 @@ public async Task EveryViewTheSnapshotKnowsIsInTheParityList() .ToList(); await Assert.That(exact.Count()).IsGreaterThan(20).Because("the pattern still finds the view comparisons"); + await Assert.That(screens).Contains("textansi").Because("the pattern still finds the settings screen table"); await Assert.That(missing).IsEmpty().Because("each view has to be rendered in the window too"); } diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index 44ac8df5..59090649 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -61,6 +61,10 @@ public class FrameContrastTests "aliases", "timers", "textansi", "input", "set", "password", "deletions", "route", "triggers-edit", "keypad-edit", "worlds-edit", "mssp-none", "compose-literal", + // The settings search marks its matches in the accent and the changed marks wear it too; the meter + // editor's dropdown carries the received values as muted notes beside each path. + "settings-search", "settings-meters", "settings-meters-pick", "settings-changed", + // The prompt row is the only thing this client paints outside a pane that carries the // *game's* colours rather than its own, so the floor is applied against the idle input band // instead of the reading plane. A band nothing renders in a test is a band nobody checks. diff --git a/tests/SharpMUTerm.Tui.Tests/GameDataTests.cs b/tests/SharpMUTerm.Tui.Tests/GameDataTests.cs index ae89ddf7..9e4ceeb6 100644 --- a/tests/SharpMUTerm.Tui.Tests/GameDataTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/GameDataTests.cs @@ -137,23 +137,83 @@ public async Task TheInspectorOpensOnTheFocusedConnection() await Assert.That(app.GameDataIsOpen).IsFalse(); } + /// + /// F7's meters are a table: one row per meter with its label, value path and maximum path as three fields + /// of that row, written straight into . It replaced a single + /// label=value/max; … line, which was the maintainer's complaint about it: too small to edit. + /// [Test] - public async Task F7EditsTheMetersAsOneLine() + public async Task F7EditsEachMeterInItsOwnRow() { var text = new TextSettings(); var screen = OptionsScreenRenderer.TextAnsiScreen(text); var model = OptionsScreenRenderer.Model(screen); - var field = Enumerable.Range(0, model.PaneCount) - .SelectMany(p => Enumerable.Range(0, model.RowCount(p)).Select(r => model.RowAt(p, r))) - .SelectMany(r => Enumerable.Range(0, r.FieldCount).Select(i => r.FieldAt(i))) - .Where(f => f is not null) - .Select(f => f!.Value) - .Single(f => f.Label == "meters"); + var first = OptionsScreenRenderer.IndexOf(screen, "meters"); + var row = model.RowAt(0, first); + var edits = new ScreenEdits(); + + await Assert.That(row.FieldCount).IsEqualTo(3); + await Assert.That(edits.Apply(row.FieldAt(0)!.Value, "life")).IsNull(); + await Assert.That(edits.Apply(row.FieldAt(1)!.Value, "Char.Vitals.hp")).IsNull(); + await Assert.That(edits.Apply(row.FieldAt(2)!.Value, " ")).IsNull(); + await Assert.That(edits.Apply(row.FieldAt(1)!.Value, " ")).IsNotNull(); + + await Assert.That(text.StatusMeters[0].Label).IsEqualTo("life"); + await Assert.That(text.StatusMeters[0].Value).IsEqualTo("Char.Vitals.hp"); + await Assert.That(text.StatusMeters[0].Max).IsNull(); + } + + /// + /// [+ meter] adds a row and lands on it; Delete on a meter row takes that meter out, and is offered only + /// there — the header names Del remove on a meter and nowhere else on the screen. + /// + [Test] + public async Task F7AddsAndRemovesMetersFromTheTable() + { + var config = new AppConfiguration(); + var screen = () => OptionsScreenRenderer.TextAnsiScreen(config); + var session = new SettingsSession(s => OptionsScreenRenderer.Model( + OptionsScreenRenderer.TextAnsiScreen(config, cursor: s.CursorIn(0)))); + var first = OptionsScreenRenderer.IndexOf(screen(), "meters"); + + session.Selection.Seed(0, first + 3); + session.Handle(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + await Assert.That(config.Text.StatusMeters.Count).IsEqualTo(4); + await Assert.That(session.IsEditing).IsTrue(); + session.Handle(new ConsoleKeyInfo('\0', ConsoleKey.Escape, false, false, false)); + + session.Selection.Seed(0, first + 1); + session.Handle(new ConsoleKeyInfo('\0', ConsoleKey.Delete, false, false, false)); + await Assert.That(config.Text.StatusMeters.Select(m => m.Label)).IsEquivalentTo(new[] { "hp", "mv", "new" }); + await Assert.That(session.Edits.HasDeletions).IsTrue(); + + session.Selection.Seed(0, 0); + await Assert.That(session.Handle(new ConsoleKeyInfo('\0', ConsoleKey.Delete, false, false, false))) + .IsEqualTo(ScreenAction.None); + } - await Assert.That(new ScreenEdits().Apply(field, "hp=Char.Vitals.hp/Char.Vitals.maxhp; gold=Char.Status.gold; broken")).IsNull(); + /// + /// The table's now column reads the focused session's game data — 412/500 once both have + /// arrived, waiting before — and a path field offers every received path with its value. + /// + [Test] + public async Task F7MetersShowWhatTheyReadNowAndOfferWhatHasArrived() + { + var data = new GameDataStore(); + data.SetGmcp("Char.Vitals", """{"hp":"412","maxhp":"500"}"""); + var meters = StatusMeter.Defaults(); - await Assert.That(text.StatusMeters.Select(m => m.Label)).IsEquivalentTo(new[] { "hp", "gold" }); - await Assert.That(text.StatusMeters[1].Max).IsNull(); + await Assert.That(MarkupText.Plain(OptionsScreenRenderer.Now(meters[0], data))).IsEqualTo("412/500"); + await Assert.That(MarkupText.Plain(OptionsScreenRenderer.Now(meters[1], data))) + .IsEqualTo(OptionsScreenRenderer.Waiting); + await Assert.That(OptionsScreenRenderer.ReceivedPaths(data).Select(p => p.Path)) + .IsEquivalentTo(new[] { "Char.Vitals.hp", "Char.Vitals.maxhp" }); + + var config = new AppConfiguration(); + var screen = OptionsScreenRenderer.TextAnsiScreen(config, data: data); + var value = OptionsScreenRenderer.Model(screen).RowAt(0, OptionsScreenRenderer.IndexOf(screen, "meters")).FieldAt(1)!.Value; + await Assert.That(value.Choices!).Contains("Char.Vitals.maxhp"); + await Assert.That(value.ChoiceNotes!["Char.Vitals.maxhp"]).IsEqualTo("500"); } [Test] diff --git a/tests/SharpMUTerm.Tui.Tests/OptionsScreenRendererTests.cs b/tests/SharpMUTerm.Tui.Tests/OptionsScreenRendererTests.cs index 7a85056a..1cdab9f5 100644 --- a/tests/SharpMUTerm.Tui.Tests/OptionsScreenRendererTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/OptionsScreenRendererTests.cs @@ -86,7 +86,8 @@ public async Task TextAnsi_ContainsExpectedLabelsAndSections() { var lines = OptionsScreenRenderer.TextAnsi(); await Assert.That(lines.Any(l => l.Contains("COLOUR"))).IsTrue(); - await Assert.That(lines.Any(l => l.Contains("UNICODE"))).IsTrue(); + await Assert.That(lines.Any(l => l.Contains("LINKS & PICTURES"))).IsTrue(); + await Assert.That(lines.Any(l => l.Contains("STATUS ROW & METERS"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("strip incoming ANSI colour"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("allow blink"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("underline hyperlinks"))).IsTrue(); diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs index b0cb1f4d..8d75617f 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs @@ -112,11 +112,10 @@ public async Task Keypad_BarsTheFocusedBinding() [Test] public async Task Options_BarsTheFocusedOptionAndNeverASectionHeader() { - // Navigable row 6 is "emoji substitution" — the three section headers and the two spacers are - // skipped, five colour rows come first, and "tab width (spaces)" sits at 5 between them and this - // one. + // Navigable row 5 is "emoji substitution" — the headings and spacers are skipped, the four + // COLOUR & LEGIBILITY rows come first, and "tab width (spaces)" sits at 4 above it in TEXT. var screen = OptionsScreenRenderer.TextAnsiScreen(); - var lines = OptionsScreenRenderer.BodyColumn(screen.Rows, new ScreenFocus(0, 6)); + var lines = OptionsScreenRenderer.BodyColumn(screen.Rows, new ScreenFocus(0, 5)); await Assert.That(Barred(lines)).IsEqualTo(1); await Assert.That(lines.Single(l => l.Contains(Bar, StringComparison.Ordinal))).Contains("emoji substitution"); diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs index 4cc3c22e..f9632f4e 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs @@ -364,16 +364,14 @@ public async Task Options_NavigableRowsSkipSectionHeadersAndSpacers() var screen = OptionsScreenRenderer.TextAnsiScreen(); var model = OptionsScreenRenderer.Model(screen); - // 21 display rows: 6 section headers + 5 spacers + 10 options. It was 7/4 before WHITESPACE and - // its "tab width (spaces)" row, which brought a header and a spacer with it, 10/5 before - // "detect links in output" joined the COLOUR section, 11/6 before ACTIVITY and its - // "activity bar holds for (seconds)" row brought a header and a spacer of their own, and 14/7 - // before "keep text legible" joined COLOUR beneath the row it is the other half of, and 15/8 - // before BACKGROUND and its "background transparency (%)" row, and 18/9 before STATUS ROW and its - // "meters" row. - await Assert.That(screen.Rows.Count).IsEqualTo(21); + // 23 display rows: 5 group headings + 4 spacers + the meter table's column headings (drawn, never a + // stop) + 13 stops — eight settings in four groups, the three default meters, [+ meter], and the + // activity bar's hold. SOUND is left out because this caller passes no sound settings. Since F7 was + // drawn from its declared section the groups are COLOUR & LEGIBILITY, TEXT, LINKS & PICTURES, + // STATUS ROW & METERS and ACTIVITY; it was 21/10 with one row for the meters as a typed line. + await Assert.That(screen.Rows.Count).IsEqualTo(23); await Assert.That(model.PaneCount).IsEqualTo(1); - await Assert.That(model.Sizes[0]).IsEqualTo(10); + await Assert.That(model.Sizes[0]).IsEqualTo(13); } /// @@ -397,23 +395,24 @@ public async Task Options_TextAnsiRowsWriteBackToTheTextSettings() model.ToggleAt(0, 1)!.Value.Flip(); await Assert.That(text.KeepTextLegible).IsFalse(); - model.ToggleAt(0, 3)!.Value.Flip(); + model.ToggleAt(0, 6)!.Value.Flip(); await Assert.That(text.UnderlineHyperlinks).IsFalse(); - model.ToggleAt(0, 4)!.Value.Flip(); + model.ToggleAt(0, 7)!.Value.Flip(); await Assert.That(text.DetectLinks).IsFalse(); - model.ToggleAt(0, 6)!.Value.Flip(); + model.ToggleAt(0, 5)!.Value.Flip(); await Assert.That(text.EmojiSubstitution).IsFalse(); - // Row 5 is the tab width — a count, so it is a field rather than a toggle, and it is what makes + // Row 4 is the tab width — a count, so it is a field rather than a toggle, and it is what makes // this screen carry an editable row at all. - await Assert.That(model.ToggleAt(0, 5)).IsNull(); + await Assert.That(model.ToggleAt(0, 4)).IsNull(); await Assert.That(model.HasEditableRow).IsTrue(); - // Row 7 is the background transparency, a percentage rather than the checkbox it started as. - await Assert.That(model.ToggleAt(0, 7)).IsNull(); - var transparency = model.FieldAt(0, 7, 0)!.Value; + // Row 3 is the background transparency, a percentage rather than the checkbox it started as, at the + // foot of COLOUR & LEGIBILITY. + await Assert.That(model.ToggleAt(0, 3)).IsNull(); + var transparency = model.FieldAt(0, 3, 0)!.Value; await Assert.That(transparency.Validate("101")).IsNotNull(); transparency.Set("60"); await Assert.That(text.BackgroundTransparency).IsEqualTo(60); diff --git a/tests/SharpMUTerm.Tui.Tests/SettingsSearchTests.cs b/tests/SharpMUTerm.Tui.Tests/SettingsSearchTests.cs new file mode 100644 index 00000000..ab1f085c --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/SettingsSearchTests.cs @@ -0,0 +1,148 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The settings rebuilt from declarations, end to end through the overlay: / opens the search over any +/// screen, typing narrows it, ⏎ lands on the field's own row — on another screen too — and Esc puts the screen +/// back. And the changed marks: a field away from its default says so, and r puts the default back +/// through the same save as every other edit. +/// +[NotInParallel] +public class SettingsSearchTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(AppConfiguration? config = null, Action? save = null) + { + Console.SetIn(TextReader.Null); + return new SharpMUTermApp( + config ?? DemoScene.Build(), Headless, new HeadlessConsoleDriver(120, 34), save: save); + } + + private static ConsoleKeyInfo Key(char c, ConsoleKey key = ConsoleKey.NoName) => new(c, key, false, false, false); + + private static void Type(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateSettingsKey(Key(c)); + } + } + + [Test] + public async Task SlashOpensTheSearchAndEscPutsTheScreenBack() + { + var app = App(); + app.DispatchCommand("screen:input"); + + app.SimulateSettingsKey(Key('/', ConsoleKey.Oem2)); + await Assert.That(app.SettingsSearchIsOpen).IsTrue(); + + app.SimulateSettingsKey(Key('\0', ConsoleKey.Escape)); + await Assert.That(app.SettingsSearchIsOpen).IsFalse(); + await Assert.That(app.SettingsOpenKey).IsEqualTo(ConsoleKey.F8); + } + + /// The search is opened over F8 and goes to a field of F7: the screen changes, and the cursor is on that field's row. + [Test] + public async Task EnterGoesToTheFieldOnItsOwnScreen() + { + var app = App(); + app.DispatchCommand("screen:input"); + app.SimulateSettingsKey(Key('/', ConsoleKey.Oem2)); + Type(app, "meter"); + + app.SimulateSettingsKey(Key('\r', ConsoleKey.Enter)); + + await Assert.That(app.SettingsSearchIsOpen).IsFalse(); + await Assert.That(app.SettingsOpenKey).IsEqualTo(ConsoleKey.F7); + await Assert.That(app.SettingsFocus!.Value.Index).IsEqualTo(app.SettingsFieldRow("text", "meters")!.Value); + } + + /// A section with no declared fields is found by its title and opened by ⏎. + [Test] + public async Task ASectionIsFoundByItsTitle() + { + var app = App(); + app.DispatchCommand("screen:textansi"); + app.SimulateSettingsKey(Key('/', ConsoleKey.Oem2)); + Type(app, "timers"); + + app.SimulateSettingsKey(Key('\r', ConsoleKey.Enter)); + + await Assert.That(app.SettingsOpenKey).IsEqualTo(ConsoleKey.F6); + } + + /// Inside an open field `/` is a character, not the search: the field has the whole keyboard. + [Test] + public async Task SlashInsideAFieldIsTyped() + { + var app = App(); + app.DispatchCommand("screen:input"); + app.SimulateSettingsKey(Key('\0', ConsoleKey.DownArrow)); + app.SimulateSettingsKey(Key('\0', ConsoleKey.DownArrow)); + app.SimulateSettingsKey(Key('\0', ConsoleKey.DownArrow)); + app.SimulateSettingsKey(Key('\r', ConsoleKey.Enter)); + + app.SimulateSettingsKey(Key('/', ConsoleKey.Oem2)); + + await Assert.That(app.SettingsSearchIsOpen).IsFalse(); + await Assert.That(app.SettingsFocus!.Value.Edit!.Value.Text).EndsWith("/"); + } + + /// + /// r on a changed field puts its default back and saves, the way every other committed change on + /// these screens does; on a field at its default it is not taken. + /// + [Test] + public async Task RResetsAChangedFieldThroughTheSave() + { + var config = DemoScene.Build(); + config.Input.LocalEcho = false; + var saves = 0; + var app = App(config, _ => saves++); + app.DispatchCommand("screen:input"); + + app.SimulateSettingsKey(Key('r', ConsoleKey.R)); + + await Assert.That(config.Input.LocalEcho).IsTrue(); + await Assert.That(saves).IsEqualTo(1); + + app.SimulateSettingsKey(Key('r', ConsoleKey.R)); + await Assert.That(saves).IsEqualTo(1); + } + + [Test] + public async Task AChangedFieldIsMarkedAndTheHeaderOffersTheReset() + { + var input = new InputSettings { Rows = 5 }; + var screen = OptionsScreenRenderer.InputScreen(input); + var model = OptionsScreenRenderer.Model(screen); + var lines = OptionsScreenRenderer.BodyColumn(screen.Rows); + var row = OptionsScreenRenderer.IndexOf(screen, "rows"); + + await Assert.That(lines.Single(l => l.Contains("height (lines)"))) + .Contains(OptionsScreenRenderer.ChangedMark); + await Assert.That(lines.Single(l => l.Contains("local echo"))) + .DoesNotContain(OptionsScreenRenderer.ChangedMark); + await Assert.That(OptionsScreenRenderer.HeaderLine("Input", "F8", 0, model, new ScreenFocus(0, row))) + .Contains("r reset"); + await Assert.That(OptionsScreenRenderer.HeaderLine("Input", "F8", 0, model, new ScreenFocus(0, 0))) + .DoesNotContain("r reset"); + + model.ResetAt(0, row)!(); + await Assert.That(input.Rows).IsEqualTo(new InputSettings().Rows); + } + + /// Every settings screen names the search in its header, because every one of them answers `/`. + [Test] + public async Task EveryScreenNamesTheSearch() + { + var header = OptionsScreenRenderer.HeaderLine("Input", "F8", 0, OptionsScreenRenderer.Model(OptionsScreenRenderer.InputScreen())); + await Assert.That(header).Contains("/ search"); + } +} From 2fc7f4e9657d288c72a1cea6ba56153b74bfc285 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 04:07:32 +0000 Subject: [PATCH 012/113] Add the who-here, vitals, quick bar and docked composer panels Four panels plug into the layouts seam (TerminalPanels.Register from RegisterTerminalPanels): who is here from GMCP Room.Players and the room's item list (a click puts look on the command line), a one-row vitals strip of reserved fields with bars, values, a low mark and the combat target, a quick bar of function-key macros run through the key's own path, and the F1 editor docked as a pane sharing F1's draft. While the composer's pane is in front it is armed: the focus pin targets its editor, Esc hands the keyboard back to the command line, and arriving at the pane arms it again. Each is on Ctrl+P and has a snapshot view. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 37 +- .../Commands/BuiltInCommands.cs | 6 + .../Protocols/CombatTarget.cs | 77 ++ .../Protocols/RoomOccupants.cs | 317 +++++++ src/SharpMUTerm.Core/Session/WorldSession.cs | 8 + src/SharpMUTerm.Tui/Panels/DockedComposer.cs | 215 +++++ .../Panels/QuickBarRenderer.cs | 131 +++ .../Panels/VitalsStripRenderer.cs | 159 ++++ src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs | 106 +++ src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 791 ++++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 57 +- src/SharpMUTerm.Tui/SnapshotViews.cs | 1 + src/SharpMUTerm.Tui/StatusMeterRenderer.cs | 60 +- .../Protocols/RoomOccupantsTests.cs | 165 ++++ .../DockedComposerTests.cs | 252 ++++++ .../FrameContrastTests.cs | 4 + .../LayoutWiringTests.cs | 6 +- .../TerminalPanelTests.cs | 246 ++++++ 19 files changed, 2617 insertions(+), 26 deletions(-) create mode 100644 src/SharpMUTerm.Core/Protocols/CombatTarget.cs create mode 100644 src/SharpMUTerm.Core/Protocols/RoomOccupants.cs create mode 100644 src/SharpMUTerm.Tui/Panels/DockedComposer.cs create mode 100644 src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs create mode 100644 src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs create mode 100644 src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Protocols/RoomOccupantsTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/DockedComposerTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 542caadf..6a20af0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] never gets an empty map pane, and the first time you connect to a world the client picks Combat or Roleplay from what the game sends and says which in a notice. A workspace you arranged yourself is still what comes back after a restart. +- Four panels a layout can place, each also on Ctrl+P: *Show who is here* (the players and creatures in your + room, from GMCP; click a name to put `look ` on the command line), *Show vitals* (your meters as bars + with values, a warning colour when low, and what you are fighting), *Show quick bar* (your function-key + macros as `F11 kick`; click one to run it) and *Dock the composer* (the F1 editor as a pane that shares F1's + draft: ⌃S sends, ⌥L switches escaping, F1 opens it full screen, Esc goes back to the command line). - Make a trigger without writing a regex: select a line of output and choose Ctrl+P ▸ *Make a trigger from the selection* (also on the right-click menu). Triggers (F2) opens on a new rule whose pattern is the line with its numbers, quoted speech and known player names turned into `*`, and shows the regex behind it. diff --git a/CLAUDE.md b/CLAUDE.md index 97aa5c77..b978f177 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -954,6 +954,39 @@ fallbacks) for inline images/maps. now resolves differently. - **The suggestion is taken once per world** (`AcceptedLayoutSuggestion`), 5 s after a connect or at once when vitals arrive, said in one notice, and only by the live entry point. +- **Four panels plug into that seam** (`SharpMUTermApp.Panels.cs`, `Tui/Panels/`: `WhoHereRenderer`, + `VitalsStripRenderer`, `QuickBarRenderer`, `DockedComposer`; Core `RoomOccupants`, `CombatTarget`; ⌃P `panel:*`; + the `panel-who`/`panel-vitals`/`panel-quickbar`/`panel-composer` views). The first three are one `MarkupControl` + each, drawn from the session's stores on change and sized from `PaneOutputRects` on `PostBufferPaint` + (`SyncPanelSizes`), so a panel's content is a function of its own pane and moves no other cell. Decisions: + - **A panel's links are its own.** Each panel control has its own `LinkClicked`, the payload is an *index* into + what that panel last drew (`mux:who:N`, `mux:quick:N`), and the action runs on the panel's own session + (`context.SessionKey`), never `_active` — the map window's rule. A who-here click puts `look ` on the + command line through `PlaceGrab` and sends nothing (the name is the game's text); a quick-bar click runs + `WorldSession.HandleKeyAsync(descriptor)`, the path the key itself takes. + - **The roster is server text, bounded** (`RoomOccupants`: 200 rows, 64-character names, no whitespace or + control characters in a player name, so a click cannot become a second command). `Room.Players` replaces, + `AddPlayer`/`RemovePlayer` edit, and creatures come from `Char.Items.*` with `location: room` and an `m` + attribute. Cleared on connect with the game data. + - **The vitals strip reserves every field**, the status row's rule: value and max `StatusMeterRenderer.ValueWidth` + each, the low mark's cells whether shown or not, the target name padded. The level of detail (bar length, + word or `!` low mark, gap, target bar, then percentages) is chosen from the width alone, so it changes only + when the pane does. It reads F7's meters through `StatusMeterRenderer.Read`; the meter model is unchanged. + - **The quick bar elides, never wraps**: `+N` counts what did not fit and `F4 edits keys` goes first. + - **The docked composer shares F1's draft** (`_composeDrafts`, per character, in memory) and sends through + `ComposeMessage.Build`, so ⌃S, ⌥L and the `%r` join are F1's exactly. F1 from it opens the same buffer full + screen; F1's close writes the draft back into the docked copy (`SyncDockedComposers`). + - **Composer focus is one fact: *armed*.** Armed means the focused pane's front window is a composer and it has + not been released (`_composerReleased`). While armed, `PinFocusToArmedBar` pins the framework's focus to the + *editor* instead of the bar — so typing, paste and the caret all land there by the pin's existing rule — and + both command lines wear the idle band. `HandleWindowKey` hands an armed composer's keys to + `HandleComposerKey` (macros, resize, ⌃C/⌃X, ⌃S, ⌥L, Esc, the ⌃arrows, else the editor). **Esc releases** (the + bar arms and ⏎ sends from it, to the same character); the ⌃↑/⌃↓ ladder releases too; **arriving** at the + composer's pane (⌃O, ⌃arrows, a tab, a click in the editor — `ArmClickedComposer` on `FocusChanged`, guarded by + `_pinningFocus` so the pin's own focus moves never count) arms it again. `ArmBar` does **not** release: it is + re-asserted on every layout change, and releasing there disarmed the composer the moment its pane was built. + ⌥⏎ arrives as Esc then Enter, so an Enter within 50 ms of the releasing Esc re-arms and inserts a newline + (`TryComposerAltEnter`). `DockedComposerTests` covers each of these. ## One client, several hosts — and how they are kept the same @@ -1138,7 +1171,9 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg tabs and half of a third and says nothing about the rest), plus the `layouts` (the ⌥M list over the demo, through the registered shortcut) and `layout-combat` (the Combat layout applied over the demo's game data and recorded streets: the map beside the output with Chat as a tab under it, - and no pane for the panels nothing draws yet), plus the + and no pane for the panels nothing draws yet), `panel-who`/`panel-vitals`/`panel-quickbar`/`panel-composer` + (each panel in a pane of its own over the demo's game data; the composer over who-here, armed, with a draft + typed through its real key path), plus the default workspace (no `--view`). Any settings screen also takes a `-edit` suffix, which opens it and drives real keys in so the frame shows a field mid-edit. State toggles: `collapsed`, `prefix`, `timestamps`, diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 63c50b62..ea1aede6 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -121,6 +121,12 @@ void Family(string id, string prefix, Func"); + // The panels a layout places, openable one at a time as tabs: each draws the focused character's own data + // and says so when there is none yet, so they are listed unconditionally, like the map. + Add("panel:who-here", CommandGroup.Terminal, "Show who is here", detail: "players and creatures in the room · click a name to look"); + Add("panel:vitals", CommandGroup.Terminal, "Show vitals", detail: "the F7 meters as bars, and your target"); + Add("panel:quick-bar", CommandGroup.Terminal, "Show quick bar", detail: "this character's function-key macros · click one to run it"); + Add("panel:composer", CommandGroup.Terminal, "Dock the composer", detail: "a pane to write posts in · ⌃S sends"); Add("term:walk-stop", CommandGroup.Terminal, "Stop walking", detail: "ends the speedwalk", when: c => c.State.Walking); // Game sound, for this run. The levels and the off switch are F7's; this is the quick one. diff --git a/src/SharpMUTerm.Core/Protocols/CombatTarget.cs b/src/SharpMUTerm.Core/Protocols/CombatTarget.cs new file mode 100644 index 00000000..c72a732c --- /dev/null +++ b/src/SharpMUTerm.Core/Protocols/CombatTarget.cs @@ -0,0 +1,77 @@ +using System.Globalization; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Protocols; + +/// +/// What the character is fighting, as the game reports it: a name and, when the game says, how much of its health +/// is left (0–1). Read from by the vitals strip. +/// +/// The target's name as the game spells it. +/// Its health left, 0–1, or null when the game names a target and not its health. +public sealed record CombatTarget(string Name, double? Share) +{ + /// + /// Where a target's name is, in the order tried: Aardwolf's char.status enemy, IRE's + /// IRE.Target.Info short_desc, and the MSDP convention's OPPONENT_NAME. + /// + public const string NamePaths = "Char.Status.enemy|IRE.Target.Info.short_desc|MSDP.OPPONENT_NAME"; + + /// + /// Where its health is: Aardwolf's enemypct (0–100), IRE's hpperc ("40%"), and MSDP's + /// OPPONENT_HEALTH — out of OPPONENT_HEALTH_MAX when the game sends one, else a percentage. + /// + public const string SharePaths = "Char.Status.enemypct|IRE.Target.Info.hpperc|MSDP.OPPONENT_HEALTH"; + + /// The longest name kept; a longer one is cut, because the name arrives from the wire. + public const int MaxNameLength = 64; + + /// + /// The target the store describes, or null when it names none. An empty name is no target: Aardwolf sends + /// "enemy": "" once a fight is over. + /// + public static CombatTarget? Read(GameDataStore data) + { + ArgumentNullException.ThrowIfNull(data); + var name = StatusMeter.Read(data, NamePaths)?.Trim(); + if (string.IsNullOrEmpty(name) || name.All(char.IsControl)) + { + return null; + } + + name = new string(name.Where(c => !char.IsControl(c)).ToArray()); + if (name.Length > MaxNameLength) + { + name = name[..MaxNameLength]; + } + + return new CombatTarget(name, ShareOf(data)); + } + + private static double? ShareOf(GameDataStore data) + { + foreach (var path in StatusMeter.Alternatives(SharePaths)) + { + if (data.GetText(path) is not { } text) + { + continue; + } + + if (!double.TryParse(text.Trim().TrimEnd('%'), NumberStyles.Float, CultureInfo.InvariantCulture, out var value) + || !double.IsFinite(value)) + { + return null; + } + + if (path.StartsWith(GameDataStore.MsdpPrefix + ".", StringComparison.OrdinalIgnoreCase) + && data.GetNumber("MSDP.OPPONENT_HEALTH_MAX") is { } max and > 0) + { + return Math.Clamp(value / max, 0, 1); + } + + return Math.Clamp(value / 100, 0, 1); + } + + return null; + } +} diff --git a/src/SharpMUTerm.Core/Protocols/RoomOccupants.cs b/src/SharpMUTerm.Core/Protocols/RoomOccupants.cs new file mode 100644 index 00000000..04296315 --- /dev/null +++ b/src/SharpMUTerm.Core/Protocols/RoomOccupants.cs @@ -0,0 +1,317 @@ +using System.Globalization; +using System.Text.Json; + +namespace SharpMUTerm.Core.Protocols; + +/// One person or creature in the room with the character. +/// What a command names them by (look Name): a player's name, a creature's own. +/// What the panel shows: a player's fullname when the game sends one, else the name. +/// A player, from Room.Players; false for a creature from Char.Items. +/// How long the player has been idle, when the game says (no standard field does). +/// A creature's item id, which is how Char.Items.Remove names it; null for a player. +public sealed record RoomOccupant(string Name, string Display, bool IsPlayer, int? IdleSeconds = null, string? Id = null); + +/// +/// Who is in the room with one character, kept from the GMCP messages that say so: Room.Players (the whole +/// list), Room.AddPlayer and Room.RemovePlayer (one each), and the room's creatures from +/// Char.Items.List/Add/Remove with location: "room" and an m attribute — the +/// IRE and Aardwolf conventions. Read by the who-here panel. +/// +/// +/// +/// It is a roster rather than a read of , because the store keeps the +/// latest message per package: Room.AddPlayer there is whoever arrived last, and a +/// Room.RemovePlayer is a name with nothing to subtract it from. +/// +/// +/// It is bounded at the door — people, names of — and a +/// name with a control character or (for a player, whose name is a command argument) any white space is refused. +/// Writes come from the telnet read loop and reads from the UI thread; one lock covers both. +/// +/// +public sealed class RoomOccupants +{ + /// The most people held; more are dropped. + public const int MaxOccupants = 200; + + /// The longest name or display name kept. + public const int MaxNameLength = 64; + + private readonly Lock _gate = new(); + private readonly List _players = []; + private readonly List _creatures = []; + private bool _known; + + /// Raised after the roster changed. On the writer's thread. + public event EventHandler? Changed; + + /// + /// Whether the game has said who is here at all — a Room.Players or Room.AddPlayer arrived. An + /// empty room the game reported is known; a game that never reports is not. + /// + public bool Known + { + get + { + lock (_gate) + { + return _known; + } + } + } + + /// Players in the order the game listed them, then creatures. + public IReadOnlyList Snapshot + { + get + { + lock (_gate) + { + return [.. _players, .. _creatures]; + } + } + } + + /// + /// Takes one GMCP message. Packages this roster does not read, and malformed bodies, are ignored. Returns + /// whether the roster changed. + /// + public bool Apply(string package, string? json) + { + if (string.IsNullOrWhiteSpace(package) || string.IsNullOrWhiteSpace(json) || json.Length > GameDataStore.MaxPayloadBytes) + { + return false; + } + + var name = package.Trim().ToLowerInvariant(); + if (name is not ("room.players" or "room.addplayer" or "room.removeplayer" + or "char.items.list" or "char.items.add" or "char.items.remove")) + { + return false; + } + + bool changed; + try + { + using var document = JsonDocument.Parse(json, new JsonDocumentOptions { MaxDepth = 16 }); + var root = document.RootElement; + lock (_gate) + { + changed = name switch + { + "room.players" => ReplacePlayers(root), + "room.addplayer" => AddPlayer(root), + "room.removeplayer" => RemovePlayer(root), + "char.items.list" => ReplaceCreatures(root), + "char.items.add" => AddCreature(root), + _ => RemoveCreature(root), + }; + } + } + catch (JsonException) + { + return false; + } + + if (changed) + { + Changed?.Invoke(this, EventArgs.Empty); + } + + return changed; + } + + /// Forgets everyone, as a new connection does. + public void Clear() + { + lock (_gate) + { + _players.Clear(); + _creatures.Clear(); + _known = false; + } + + Changed?.Invoke(this, EventArgs.Empty); + } + + private bool ReplacePlayers(JsonElement root) + { + if (root.ValueKind != JsonValueKind.Array) + { + return false; + } + + _known = true; + _players.Clear(); + foreach (var item in root.EnumerateArray()) + { + if (Player(item) is { } player && Room() && !_players.Exists(p => SameName(p, player.Name))) + { + _players.Add(player); + } + } + + return true; + } + + private bool AddPlayer(JsonElement root) + { + if (Player(root) is not { } player) + { + return false; + } + + _known = true; + var at = _players.FindIndex(p => SameName(p, player.Name)); + if (at >= 0) + { + _players[at] = player; + } + else if (Room()) + { + _players.Add(player); + } + + return true; + } + + private bool RemovePlayer(JsonElement root) + { + var name = root.ValueKind == JsonValueKind.String ? root.GetString() : Text(root, "name"); + return name is not null && _players.RemoveAll(p => SameName(p, name.Trim())) > 0; + } + + private bool ReplaceCreatures(JsonElement root) + { + if (!InRoom(root) || !TryProperty(root, "items", out var items) || items.ValueKind != JsonValueKind.Array) + { + return false; + } + + _creatures.Clear(); + foreach (var item in items.EnumerateArray()) + { + if (Creature(item) is { } creature && Room()) + { + _creatures.Add(creature); + } + } + + return true; + } + + private bool AddCreature(JsonElement root) + { + if (!InRoom(root) || !TryProperty(root, "item", out var item) || Creature(item) is not { } creature) + { + return false; + } + + _creatures.RemoveAll(c => c.Id == creature.Id); + if (!Room()) + { + return false; + } + + _creatures.Add(creature); + return true; + } + + private bool RemoveCreature(JsonElement root) + { + if (!InRoom(root) || !TryProperty(root, "item", out var item)) + { + return false; + } + + var id = item.ValueKind == JsonValueKind.Object ? Id(item) : Scalar(item); + return id is not null && _creatures.RemoveAll(c => c.Id == id) > 0; + } + + /// Whether one more fits under . + private bool Room() => _players.Count + _creatures.Count < MaxOccupants; + + private static RoomOccupant? Player(JsonElement item) + { + var name = item.ValueKind == JsonValueKind.String ? item.GetString() : Text(item, "name"); + name = name?.Trim(); + if (!Acceptable(name) || name!.Any(char.IsWhiteSpace)) + { + return null; + } + + var full = Text(item, "fullname")?.Trim(); + return new RoomOccupant(name!, Acceptable(full) ? full! : name!, true, Idle(item)); + } + + private static RoomOccupant? Creature(JsonElement item) + { + if (item.ValueKind != JsonValueKind.Object + || Text(item, "attrib") is not { } attrib + || !attrib.Contains('m', StringComparison.Ordinal) + || Id(item) is not { } id) + { + return null; + } + + var name = Text(item, "name")?.Trim(); + return Acceptable(name) ? new RoomOccupant(name!, name!, false, Id: id) : null; + } + + private static bool InRoom(JsonElement root) => + root.ValueKind == JsonValueKind.Object + && string.Equals(Text(root, "location"), "room", StringComparison.OrdinalIgnoreCase); + + private static bool Acceptable(string? name) => + name is { Length: > 0 and <= MaxNameLength } && !name.Any(char.IsControl); + + private static bool SameName(RoomOccupant player, string name) => + string.Equals(player.Name, name, StringComparison.OrdinalIgnoreCase); + + private static string? Id(JsonElement item) => + TryProperty(item, "id", out var id) ? Scalar(id) : null; + + private static string? Scalar(JsonElement value) => value.ValueKind switch + { + JsonValueKind.String => value.GetString() is { Length: > 0 and <= MaxNameLength } s ? s : null, + JsonValueKind.Number => value.GetRawText(), + _ => null, + }; + + private static bool TryProperty(JsonElement item, string property, out JsonElement value) + { + if (item.ValueKind == JsonValueKind.Object) + { + foreach (var p in item.EnumerateObject()) + { + if (string.Equals(p.Name, property, StringComparison.OrdinalIgnoreCase)) + { + value = p.Value; + return true; + } + } + } + + value = default; + return false; + } + + private static string? Text(JsonElement item, string property) => + TryProperty(item, property, out var value) && value.ValueKind == JsonValueKind.String ? value.GetString() : null; + + private static int? Idle(JsonElement item) + { + if (!TryProperty(item, "idle", out var value)) + { + return null; + } + + var seconds = value.ValueKind switch + { + JsonValueKind.Number when value.TryGetInt32(out var n) => n, + JsonValueKind.String when int.TryParse(value.GetString(), NumberStyles.None, CultureInfo.InvariantCulture, out var n) => n, + _ => (int?)null, + }; + return seconds is >= 0 ? seconds : null; + } +} diff --git a/src/SharpMUTerm.Core/Session/WorldSession.cs b/src/SharpMUTerm.Core/Session/WorldSession.cs index e4b18442..4c7a4530 100644 --- a/src/SharpMUTerm.Core/Session/WorldSession.cs +++ b/src/SharpMUTerm.Core/Session/WorldSession.cs @@ -410,6 +410,12 @@ public ILogger Logger /// public GameDataStore GameData { get; } = new(); + /// + /// Who is in the room with this character, from GMCP Room.Players and its relatives (the who-here + /// panel). Emptied on connect, with . + /// + public RoomOccupants Occupants { get; } = new(); + /// /// This connection's map, when the client keeps one: set by the client as the session opens, read by the /// scripting bridge's map.*. Null in a session nothing maps. @@ -599,6 +605,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) _telnet = telnet; telnet.OutputReceived += OnOutputReceived; GameData.Clear(); + Occupants.Clear(); lock (_metersGate) { _mxpMeters = []; @@ -609,6 +616,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) // Stored before the event, so a handler reading GameData sees the message that raised it. GameData.SetGmcp(e.Package, e.Json); Completions.ObserveGmcp(e.Package, e.Json); + Occupants.Apply(e.Package, e.Json); OnGmcpLogin(e.Package, e.Json); if (World.DiscordPresence && e.Package.StartsWith("External.Discord.", StringComparison.OrdinalIgnoreCase) diff --git a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs new file mode 100644 index 00000000..13c5192e --- /dev/null +++ b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs @@ -0,0 +1,215 @@ +using SharpConsoleUI; +using SharpConsoleUI.Builders; +using SharpConsoleUI.Controls; +using SharpConsoleUI.Layout; +using SharpMUTerm.Core.Commands; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui.Panels; + +/// +/// The composer as a pane: a header naming what is being written and how it will be escaped +/// (COMPOSE +pose literal), the F1 composer's editor, and a key row +/// (⌃S send · ⌥L literal · F1 full screen · Esc command line). +/// +/// The editor is the F1 composer's — a that inserts on ⏎, wraps words +/// and keeps undo — and the post it builds is 's, so a docked post and a +/// full-screen one are the same command. Its buffer is the character's draft: the host writes every +/// change into the store F1 opens from, so F1 here carries on the same text. +/// +/// +/// It does not route its own keys. The host decides, from its pane, whether it is armed — the place typing, +/// paste and the caret go — and hands each key to itself. That is the rule the command +/// line follows, and it is what keeps one fact behind "which control gets a keystroke". +/// +/// +/// The grid is kept and re-parented across pane rebuilds. A disposed GridControl disposes its children and +/// nothing else, and none of these three keeps state that a dispose clears, so the same instance serves for the +/// life of the panel (pinned by DockedComposerTests). +/// +/// +internal sealed class DockedComposer +{ + private readonly MarkupControl _header; + private readonly MarkupControl _footer; + private readonly string _accent; + private bool _armed; + private bool _quiet; + + internal DockedComposer(string windowId, string sessionKey, ScreenTheme scheme, string accent) + { + WindowId = windowId; + SessionKey = sessionKey; + _accent = accent; + Editor = new MultilineEditControl + { + WrapMode = WrapMode.WrapWords, + ShowLineNumbers = false, + IsEditing = true, + VerticalAlignment = VerticalAlignment.Fill, + HorizontalAlignment = HorizontalAlignment.Stretch, + + // Esc is the host's — it hands the keyboard back to the command line — so the editor must not + // spend it dropping out of edit mode first. + EscapeExitsEditMode = false, + PlaceholderText = "Write a post. ⏎ starts a new line; ⌃S sends it as one command.", + + // Both pairs, as the F1 composer sets them: the control paints from the focused pair whenever it has + // focus, and from the other while the command line has it. + BackgroundColor = scheme.Colour(ScreenPalette.EditBg), + FocusedBackgroundColor = scheme.Colour(ScreenPalette.EditBg), + ForegroundColor = scheme.Colour(ScreenPalette.Value), + FocusedForegroundColor = scheme.Colour(ScreenPalette.Value), + SelectionBackgroundColor = scheme.Colour(ScreenPalette.CursorBg), + SelectionForegroundColor = scheme.Colour(ScreenPalette.Value), + }; + Editor.ContentChanged += (_, _) => + { + if (!_quiet) + { + Redraw(); + Changed?.Invoke(this, EventArgs.Empty); + } + }; + + _header = new MarkupControl(new List()) { HorizontalAlignment = HorizontalAlignment.Stretch }; + _footer = new MarkupControl(new List()) { HorizontalAlignment = HorizontalAlignment.Stretch }; + + var grid = Controls.Grid() + .WithAlignment(HorizontalAlignment.Stretch) + .WithVerticalAlignment(VerticalAlignment.Fill); + grid.Rows(GridLength.Cells(1), GridLength.Star(1), GridLength.Cells(1)).Columns(GridLength.Star(1)); + grid.Place(_header, 0, 0, 1, 1); + grid.Place(Editor, 1, 0, 1, 1); + grid.Place(_footer, 2, 0, 1, 1); + Control = grid.Build(); + Redraw(); + } + + /// The panel window this is drawn in. + internal string WindowId { get; } + + /// Whose draft this is: the World.Character key the panel belongs to. + internal string SessionKey { get; } + + /// What the pane hosts. + internal IWindowControl Control { get; } + + /// The editor, which the host focuses and hands keys to while this is armed. + internal MultilineEditControl Editor { get; } + + /// The escaping mode, toggled by ⌥L, as F1's is. + internal ComposeEscaping Escaping { get; private set; } = ComposeEscaping.AsTyped; + + /// The buffer, with its lines broken by \n whatever the platform's newline. + internal string Body => Editor.GetContent().Replace("\r\n", "\n", StringComparison.Ordinal); + + /// Whether typing goes here. Only the host sets it. + internal bool Armed + { + get => _armed; + set + { + if (_armed != value) + { + _armed = value; + Redraw(); + } + } + } + + /// Raised after the buffer or the mode changed by the writer's hand (never by ). + internal event EventHandler? Changed; + + /// The header row's markup, for the tests. + internal string HeaderMarkup => _header.Text; + + /// The key row's markup, for the tests. + internal string FooterMarkup => _footer.Text; + + /// Replaces the buffer and mode with a draft kept elsewhere (F1 closing), raising nothing. + internal void Load(string body, ComposeEscaping escaping) + { + Escaping = escaping; + if (!string.Equals(Body, body, StringComparison.Ordinal)) + { + _quiet = true; + try + { + Editor.SetContent(body); + } + finally + { + _quiet = false; + } + } + + Redraw(); + } + + /// ⌥L: flips the escaping and says so in the header. + internal void ToggleEscaping() + { + Escaping = Escaping == ComposeEscaping.Literal ? ComposeEscaping.AsTyped : ComposeEscaping.Literal; + Redraw(); + Changed?.Invoke(this, EventArgs.Empty); + } + + /// Sizes the editor to the pane's box, less the header and key rows. + internal void Fit(int width, int height) + { + var rows = Math.Max(1, height - 2); + if (Editor.ViewportHeight != rows) + { + Editor.ViewportHeight = rows; + } + + if (_width != width) + { + _width = width; + Redraw(); + } + } + + /// The pane's width, which picks the key row's long or short form. + private int _width; + + /// + /// The verb the post starts with — +pose, say — for the header, so a reader can see what the + /// buffer will be sent as without reading it. Empty for an empty buffer. + /// + internal static string Verb(string body) + { + var first = body.Split('\n').Select(l => l.Trim()).FirstOrDefault(l => l.Length > 0) ?? string.Empty; + var space = first.IndexOfAny([' ', '\t']); + var verb = space < 0 ? first : first[..space]; + return verb.Length <= 16 ? verb : verb[..15] + "…"; + } + + private void Redraw() + { + var verb = Verb(Body); + var mode = Escaping == ComposeEscaping.Literal ? $"[{_accent}]literal[/]" : "[dim]as typed[/]"; + var marker = _armed ? $"[{_accent}]▌[/]" : " "; + _header.SetContent(new List + { + $"{marker}[bold {_accent}]COMPOSE[/]" + (verb.Length > 0 ? $" {Escape(verb)}" : string.Empty) + $" {mode}", + }); + + // The long form names what each key does; the short one, for a narrow column, keeps every key and the + // two words that matter. Both list the same keys, so a narrow pane hides no gesture. + var footer = _armed + ? $" {Key("⌃S")}[dim] send · [/]{Key("⌥L")}[dim] literal · [/]{Key("F1")}[dim] full screen · [/]{Key("Esc")}[dim] command line[/]" + : $" [dim]click here to write · [/]{Key("F1")}[dim] full screen[/]"; + if (_width > 0 && VisibleLength(footer) > _width) + { + footer = _armed + ? $" {Key("⌃S")}[dim] send · [/]{Key("⌥L")}[dim] literal · [/]{Key("F1")}[dim] full · [/]{Key("Esc")}[dim] back[/]" + : $" [dim]click to write · [/]{Key("F1")}[dim] full[/]"; + } + + _footer.SetContent(new List { _width > 0 ? ElideVisible(footer, _width) : footer }); + } + + private string Key(string key) => $"[{_accent}]{key}[/]"; +} diff --git a/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs b/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs new file mode 100644 index 00000000..566ac149 --- /dev/null +++ b/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs @@ -0,0 +1,131 @@ +using System.Globalization; +using SharpMUTerm.Core.Automation; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui.Panels; + +/// +/// The quick bar: one row of the character's function-key macros — F1 kick F2 bash F3 cure light — with +/// F4 edits keys at the right. Each entry is a link ( and its index) that the +/// panel's own handler runs through the macro path the key itself takes. Elided to the width, never wrapped. +/// +internal static class QuickBarRenderer +{ + /// The scheme an entry's link carries, followed by its index in the list drawn. + internal const string LinkPrefix = "mux:quick:"; + + /// The longest a macro's name is drawn before it is cut. + internal const int MaxNameWidth = 16; + + /// The right-hand hint naming where the keys are edited. + internal const string Hint = "F4 edits keys"; + + /// One entry: the key as printed (F1, ⌃F2), the descriptor it fires, its name. + /// Whether pressing the key reaches the macro on this host (); + /// one that does not is still clickable and drawn dim. + internal readonly record struct Entry(string Key, string Descriptor, string Name, bool Fires); + + /// + /// The function-key bindings to show, from the bindings that resolve: one per key, plain keys before modified + /// ones, then by number. A binding with neither a command nor a script is left out, as the key path leaves it. + /// + internal static IReadOnlyList Entries(IEnumerable macros, Func resolve) + { + var seen = new HashSet(StringComparer.OrdinalIgnoreCase); + var entries = new List<(Entry Entry, int Modifiers, int Number)>(); + foreach (var candidate in macros) + { + if (!MacroKey.TryParse(candidate.Key, out var parts) + || parts.Key.Length < 2 || parts.Key[0] != 'F' + || !int.TryParse(parts.Key.AsSpan(1), NumberStyles.None, CultureInfo.InvariantCulture, out var number)) + { + continue; + } + + var descriptor = MacroKey.Describe(parts.Key, parts.Ctrl, parts.Alt, parts.Shift); + if (!seen.Add(descriptor) + || resolve(descriptor) is not { } macro + || (macro.Command.Length == 0 && string.IsNullOrEmpty(macro.ScriptCallback))) + { + continue; + } + + var name = macro.Name.Trim().Length > 0 ? macro.Name.Trim() : macro.Command.Trim(); + if (name.Length == 0) + { + name = macro.ScriptCallback ?? descriptor; + } + + var key = (parts.Ctrl ? "⌃" : string.Empty) + (parts.Alt ? "⌥" : string.Empty) + (parts.Shift ? "⇧" : string.Empty) + parts.Key; + var modifiers = (parts.Ctrl ? 1 : 0) + (parts.Alt ? 2 : 0) + (parts.Shift ? 4 : 0); + entries.Add((new Entry(key, descriptor, Single(name), MacroKeys.Verdict(descriptor).Fires), modifiers, number)); + } + + return entries.OrderBy(e => e.Modifiers).ThenBy(e => e.Number).Select(e => e.Entry).ToList(); + } + + /// The row for cells. Entries that do not fit are counted, never wrapped. + internal static string Render(IReadOnlyList entries, int width, string accent) + { + width = Math.Max(1, width); + var hint = $"[bold {accent}]F4[/][dim] edits keys[/]"; + if (entries.Count == 0) + { + return ElideVisible($"[dim]No function keys bound · [/]{hint}", width); + } + + var cells = entries.Select((e, i) => Cell(e, i, accent)).ToList(); + var hintWidth = VisibleLength(hint); + foreach (var withHint in new[] { true, false }) + { + var room = withHint ? width - hintWidth - 2 : width; + var row = Fit(cells, room); + if (row is not null) + { + return withHint ? SpreadLR(row, hint, width) : row; + } + } + + return ElideVisible(cells[0], width); + } + + /// The entry index a link names, or null for any other link. + internal static int? ParseLink(string url) => + url.StartsWith(LinkPrefix, StringComparison.Ordinal) + && int.TryParse(url.AsSpan(LinkPrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out var index) + ? index + : null; + + /// The most entries that fit with a +N for the rest, or null for none. + private static string? Fit(List cells, int room) + { + for (var take = cells.Count; take > 0; take--) + { + var row = string.Join(" ", cells.Take(take)); + if (take < cells.Count) + { + row += $" [dim]+{(cells.Count - take).ToString(CultureInfo.InvariantCulture)}[/]"; + } + + if (VisibleLength(row) <= room) + { + return row; + } + } + + return null; + } + + private static string Cell(Entry entry, int index, string accent) + { + var name = entry.Name.Length <= MaxNameWidth ? entry.Name : entry.Name[..(MaxNameWidth - 1)] + "…"; + var link = $"[link={LinkPrefix}{index.ToString(CultureInfo.InvariantCulture)}]"; + return entry.Fires + ? $"{link}[bold {accent}]{Escape(entry.Key)}[/] {Escape(name)}[/]" + : $"{link}[dim]{Escape(entry.Key)} {Escape(name)}[/][/]"; + } + + /// A name on one line: a multi-command macro's line breaks become ; . + private static string Single(string name) => + string.Join("; ", name.Split('\n', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries)); +} diff --git a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs new file mode 100644 index 00000000..105a1da9 --- /dev/null +++ b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs @@ -0,0 +1,159 @@ +using System.Text; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Protocols; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui.Panels; + +/// +/// The vitals panel: one row of the configured meters as bars — +/// hp ████████░░ 820/1000 mp ██░░░░░░░░ 190/1000 low — and, right-aligned, what the character is +/// fighting when the game says: target a rotting ghoul ████░░░░░░ 40%. +/// +/// Every field is reserved, the status row's rule (): the value and the +/// maximum take cells each, the low mark takes its three +/// whether it is showing or not, and the target's name is padded to its field. A number changing never moves a +/// cell. The level of detail is chosen from the box's width alone — full bars, short bars, no bars, +/// percentages — so it changes only when the pane does. +/// +/// +internal static class VitalsStripRenderer +{ + /// The meter's mark when it is below . + internal const string LowMark = "low"; + + /// The panel's colours: the bars, the warning, and the empty part of a bar. + internal readonly record struct Ink(string Bar, string Low, string Empty); + + /// The one-cell low mark the tighter levels use in place of . + internal const string ShortLowMark = "!"; + + /// + /// How much a level draws: the bar's cells, whether values are shown (else percentages), whether the low mark is + /// the word or one cell, the target's name field and bar, and the gap between meters. + /// + private readonly record struct Level(int Bar, bool Values, bool LongLow, int TargetName, int TargetBar, int Gap); + + /// From the most to the least; the first that fits the width is drawn. The target gives way first. + private static readonly Level[] Levels = + [ + new(10, true, true, 20, 10, 3), + new(10, true, true, 14, 0, 3), + new(8, true, false, 12, 0, 2), + new(5, true, false, 12, 0, 2), + new(0, true, false, 12, 0, 2), + new(0, false, false, 10, 0, 2), + ]; + + /// + /// The strip for a box cells wide, or empty when no meter has a value and the game + /// names no target. + /// + internal static string Render(IReadOnlyList meters, CombatTarget? target, int width, Ink ink) + { + if (meters.Count == 0 && target is null) + { + return string.Empty; + } + + width = Math.Max(1, width); + string? last = null; + foreach (var level in Levels) + { + last = Compose(meters, target, level, width, ink); + if (VisibleLength(last) <= width) + { + return last; + } + } + + return ElideVisible(last!, width); + } + + private static string Compose( + IReadOnlyList meters, CombatTarget? target, Level level, int width, Ink ink) + { + var left = string.Join(new string(' ', level.Gap), meters.Select(m => Meter(m, level, ink))); + if (target is null) + { + return left; + } + + var right = Target(target, level, ink); + var gap = width - VisibleLength(left) - VisibleLength(right); + return left.Length == 0 + ? new string(' ', Math.Max(0, gap)) + right + : left + new string(' ', Math.Max(level.Gap, gap)) + right; + } + + private static string Meter(StatusMeterRenderer.MeterReading meter, Level level, Ink ink) + { + var sb = new StringBuilder(); + sb.Append($"[dim]{Escape(meter.Label)}[/]"); + var colour = meter.Low ? ink.Low : ink.Bar; + if (!level.Values) + { + var text = meter.Share is { } share + ? StatusMeterRenderer.Percent(share) + : StatusMeter.Fit(meter.Value, StatusMeterRenderer.ValueWidth); + var width = meter.Share is null ? StatusMeterRenderer.ValueWidth : StatusMeterRenderer.ShareWidth; + sb.Append(' ').Append(meter.Low + ? $"[bold {colour}]{Escape(text.PadLeft(width))}[/]" + : $"[bold]{Escape(text.PadLeft(width))}[/]"); + return sb.ToString(); + } + + if (level.Bar > 0 && meter.HasMax) + { + sb.Append(' ').Append(Bar(meter.Share, level.Bar, colour, ink)); + } + + var value = Escape(StatusMeter.Fit(meter.Value, StatusMeterRenderer.ValueWidth).PadLeft(StatusMeterRenderer.ValueWidth)); + sb.Append(' ').Append(meter.Low ? $"[bold {colour}]{value}[/]" : $"[bold]{value}[/]"); + if (meter.HasMax) + { + var max = StatusMeter.Fit(meter.Max ?? string.Empty, StatusMeterRenderer.ValueWidth).PadRight(StatusMeterRenderer.ValueWidth); + sb.Append($"[dim]/{Escape(max)}[/]"); + var mark = level.LongLow ? LowMark : ShortLowMark; + sb.Append(' ').Append(meter.Low ? $"[{colour}]{mark}[/]" : new string(' ', mark.Length)); + } + + return sb.ToString(); + } + + private static string Target(CombatTarget target, Level level, Ink ink) + { + var name = target.Name.Length <= level.TargetName + ? target.Name.PadRight(level.TargetName) + : target.Name[..(level.TargetName - 1)] + "…"; + var sb = new StringBuilder($"[dim]target[/] {Escape(name)}"); + if (target.Share is { } share) + { + var low = share < StatusMeterRenderer.LowShare; + if (level.TargetBar > 0) + { + sb.Append(' ').Append(Bar(share, level.TargetBar, low ? ink.Low : ink.Bar, ink)); + } + + sb.Append($" [bold]{StatusMeterRenderer.Percent(share).PadLeft(StatusMeterRenderer.ShareWidth)}[/]"); + } + else + { + sb.Append(new string(' ', (level.TargetBar > 0 ? level.TargetBar + 1 : 0) + 1 + StatusMeterRenderer.ShareWidth)); + } + + return sb.ToString(); + } + + /// + /// A bar of : the filled part in solid blocks, the rest in light shade. A meter whose + /// maximum has not arrived draws all empty, so the bar's cells are held from the first value. + /// + internal static string Bar(double? share, int cells, string colour, Ink ink) + { + var filled = share is { } s ? (int)Math.Round(Math.Clamp(s, 0, 1) * cells) : 0; + var full = filled > 0 ? $"[{colour}]{new string('█', filled)}[/]" : string.Empty; + var empty = filled < cells ? $"[{ink.Empty}]{new string('░', cells - filled)}[/]" : string.Empty; + return full + empty; + } +} diff --git a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs new file mode 100644 index 00000000..ff2766b5 --- /dev/null +++ b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs @@ -0,0 +1,106 @@ +using System.Globalization; +using SharpMUTerm.Core.Protocols; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui.Panels; + +/// +/// The who-here panel: HERE The Grand Plaza · 4, then one row per person — players with a dot and how +/// long they have been idle when the game says, creatures dimmed under them. Every name is a link +/// ( and its row), answered by the panel's own handler and by nothing else. +/// +internal static class WhoHereRenderer +{ + /// The scheme a row's link carries, followed by its index in the roster drawn. + internal const string LinkPrefix = "mux:who:"; + + /// The cells the idle column takes when any row has one: idle 59m. + internal const int IdleWidth = 8; + + /// Under this many seconds idle a player reads active. + internal const int ActiveSeconds = 60; + + /// The panel's colours: the dot of an active player, and the plane they are measured on. + internal readonly record struct Ink(string Accent); + + /// + /// The panel's rows for a box by cells. Never wider than the + /// box and never taller: a room fuller than the box ends in … and N more. + /// + internal static List Render(string? room, IReadOnlyList occupants, int width, int height, Ink ink) + { + width = Math.Max(8, width); + height = Math.Max(1, height); + var lines = new List(); + + var count = $" · {occupants.Count.ToString(CultureInfo.InvariantCulture)}"; + var title = string.IsNullOrWhiteSpace(room) ? string.Empty : " " + Escape(room.Trim()); + lines.Add(ElideVisible($"[bold {ink.Accent}]HERE[/]{title}[dim]{count}[/]", width)); + if (height == 1) + { + return lines; + } + + if (occupants.Count == 0) + { + lines.Add("[dim]Nobody else is here.[/]"); + return lines; + } + + var showIdle = occupants.Any(o => o.IdleSeconds is not null) && width >= IdleWidth + 8; + var nameWidth = width - 2 - (showIdle ? IdleWidth + 1 : 0); + var rows = height - 1; + var fits = occupants.Count <= rows ? occupants.Count : Math.Max(0, rows - 1); + for (var i = 0; i < fits; i++) + { + lines.Add(Row(occupants[i], i, nameWidth, showIdle, ink)); + } + + if (fits < occupants.Count) + { + lines.Add($"[dim]… and {(occupants.Count - fits).ToString(CultureInfo.InvariantCulture)} more[/]"); + } + + return lines; + } + + /// The roster index a row's link names, or null for any other link. + internal static int? ParseLink(string url) => + url.StartsWith(LinkPrefix, StringComparison.Ordinal) + && int.TryParse(url.AsSpan(LinkPrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out var index) + ? index + : null; + + /// How an idle time reads: active, idle 4m, idle 2h, idle 3d. + internal static string Idle(int seconds) => seconds switch + { + < ActiveSeconds => "active", + < 3600 => $"idle {(seconds / 60).ToString(CultureInfo.InvariantCulture)}m", + < 86400 => $"idle {(seconds / 3600).ToString(CultureInfo.InvariantCulture)}h", + _ => $"idle {Math.Min(99, seconds / 86400).ToString(CultureInfo.InvariantCulture)}d", + }; + + private static string Row(RoomOccupant who, int index, int nameWidth, bool showIdle, Ink ink) + { + var name = Escape(Fit(who.Display, nameWidth)); + var link = $"[link={LinkPrefix}{index.ToString(CultureInfo.InvariantCulture)}]"; + if (!who.IsPlayer) + { + return $"[dim]·[/] {link}[dim]{name}[/][/]"; + } + + var idle = who.IdleSeconds is { } seconds && seconds >= ActiveSeconds; + var dot = idle ? "[dim]●[/]" : $"[{ink.Accent}]●[/]"; + var row = $"{dot} {link}{name}[/]"; + if (!showIdle) + { + return row; + } + + var status = who.IdleSeconds is { } s ? Idle(s) : string.Empty; + return PadVisible(row, nameWidth + 2) + " " + $"[dim]{status.PadLeft(IdleWidth)}[/]"; + } + + private static string Fit(string text, int width) => + text.Length <= width ? text : width <= 1 ? "…" : text[..(width - 1)] + "…"; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs new file mode 100644 index 00000000..eea3d7b6 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -0,0 +1,791 @@ +using SharpConsoleUI.Controls; +using SharpConsoleUI; +using SharpConsoleUI.Events; +using SharpConsoleUI.Layout; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui.Panels; + +namespace SharpMUTerm.Tui; + +/// +/// The four panels a layout can place that the workspace did not already have: who is here, the vitals strip, +/// the quick bar, and the docked composer. Each is a control made once per (panel, character) by the factory +/// registered here, drawn from that character's own data — never _active's — and sized to its pane on the +/// frame, the way a map window is. +/// +/// +/// +/// Links are per surface. A who-here row and a quick-bar entry are links, answered by that panel's own +/// LinkClicked and nothing else; the payload is an index into what the panel last drew +/// (mux:who:3, mux:quick:1), so no text from the game is ever read back as a command, and the output +/// panes' handler never sees either scheme. +/// +/// +/// The docked composer can hold the keyboard, and that is decided in one place (): +/// it is armed while its window is the focused pane's tab and the writer has not handed the keyboard back with Esc. +/// While it is armed the focus pin () holds the editor, so typing, paste +/// and the caret go there together, and both command lines wear the idle band. Moving to its pane (⌃arrows, ⌃O, a +/// tab click) or clicking in it arms it; Esc, ⌃↓ onto a command line, or moving to another pane disarms it. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The markup panels, by window id. + private readonly Dictionary _panelViews = new(StringComparer.Ordinal); + + /// The docked composers, by window id. + private readonly Dictionary _dockedComposers = new(StringComparer.Ordinal); + + /// Who is in the demo's room: written by , as the wire writes a session's. + private readonly RoomOccupants _demoOccupants = new(); + + /// The window last saw in front, so arriving at a composer re-arms it. + private string? _composerArmWindow; + + /// Whether Esc (or ⌃↓ onto a bar) handed the keyboard back from the composer in front. + private bool _composerReleased; + + /// When an Esc released a composer, so the Enter of a ⌥⏎ that follows it is not sent from the bar. + private DateTimeOffset? _composerEscapeAt; + + partial void RegisterTerminalPanels() + { + Panels.Register(PanelIds.WhoHere, NewWhoHerePanel); + Panels.Register(PanelIds.Vitals, NewVitalsPanel); + Panels.Register(PanelIds.QuickBar, NewQuickBarPanel); + Panels.Register(PanelIds.Composer, NewDockedComposer); + } + + /// The ⌃P ids that open a panel: panel: and the panel's id. + private const string PanelCommandPrefix = "panel:"; + + /// + /// ⌃P ▸ Show who is here and its siblings: opens the focused character's panel as a tab of the focused + /// pane, or goes to it. A window that belongs to no character refuses, for 's reason. + /// + private void ShowPanel(string panelId) + { + var key = SendTarget()?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey; + if (key is not { Length: > 0 }) + { + RefuseCommand("no character here — pick one first (⌃P ▸ Switch to …)"); + return; + } + + if (OpenPanel(panelId, key) is not { } windowId) + { + RefuseCommand($"this client cannot draw a {Snippet(panelId)} panel"); + return; + } + + Activate(windowId); + } + + // --- Who is here ------------------------------------------------------------------------------------------ + + private IWindowControl NewWhoHerePanel(TerminalPanelContext context) + { + IReadOnlyList drawn = []; + var view = NewPanelView(context, (width, height) => + { + var roster = PanelOccupants(context.SessionKey); + if (roster is not { Known: true }) + { + drawn = []; + return ["[dim]The game has not said who is here.[/]"]; + } + + drawn = roster.Snapshot; + var data = PanelGameData(context.SessionKey); + var room = data is null ? null : StatusMeter.Read(data, "Room.Info.name|MSDP.ROOM_NAME"); + return WhoHereRenderer.Render(room, drawn, width, height, new WhoHereRenderer.Ink(_ink.Accent)); + }); + view.Click = url => + { + if (WhoHereRenderer.ParseLink(url) is { } index && index < drawn.Count) + { + OfferLook(context, drawn[index]); + } + }; + + if (context.Session is { } session) + { + session.Occupants.Changed += (_, _) => OnUiThread(view.Refresh); + session.GameData.Changed += (_, package) => + { + if (package.StartsWith("Room.", StringComparison.OrdinalIgnoreCase) + || package.StartsWith("MSDP.ROOM", StringComparison.OrdinalIgnoreCase)) + { + OnUiThread(view.Refresh); + } + }; + } + else if (IsDemoKey(context.SessionKey)) + { + _demoOccupants.Changed += (_, _) => OnUiThread(view.Refresh); + } + + return view.Control; + } + + /// + /// A click on a name puts look Name on the character's command line and sends nothing: the name is the + /// game's text, and the player sees the line before ⏎. It lands on the bar of the panel's own character — the + /// panel's window is brought forward when the one in front belongs to someone else. + /// + private void OfferLook(TerminalPanelContext context, RoomOccupant who) + { + var owner = WindowSession(ActiveWindowId())?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey; + if (!string.Equals(owner, context.SessionKey, StringComparison.Ordinal)) + { + Activate(context.WindowId); + } + + if (ArmedComposer() is not null) + { + ReleaseComposer(); + } + + PlaceGrab(ActiveBar(), $"look {who.Name}", context.SessionKey); + Notice($"look {Snippet(who.Name)} is on the command line — ⏎ sends it", MessageSeverity.Info); + } + + // --- Vitals ----------------------------------------------------------------------------------------------- + + private IWindowControl NewVitalsPanel(TerminalPanelContext context) + { + var view = NewPanelView(context, (width, _) => + { + if (PanelGameData(context.SessionKey) is not { } data) + { + return ["[dim]No vitals: this character is not connected.[/]"]; + } + + var strip = VitalsStripRenderer.Render( + StatusMeterRenderer.Read(PanelMeters(context.SessionKey), data), + CombatTarget.Read(data), + width, + VitalsInk()); + return [strip.Length > 0 ? strip : "[dim]No vitals yet — the game has sent none of the meters F7 names.[/]"]; + }); + + if (context.Session is { } session) + { + session.GameData.Changed += (_, _) => OnUiThread(view.Refresh); + session.MxpMetersChanged += (_, _) => OnUiThread(view.Refresh); + } + + return view.Control; + } + + /// + /// The strip's colours, each held to the floor against the plane it lands on: the bars are fills but carry + /// meaning, so they are lifted like text; the empty part of a bar is a grey that still reads as a track. + /// + private VitalsStripRenderer.Ink VitalsInk() => + new(_ink.Accent, _ink.Notice, _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))); + + // --- Quick bar -------------------------------------------------------------------------------------------- + + private IWindowControl NewQuickBarPanel(TerminalPanelContext context) + { + IReadOnlyList drawn = []; + var view = NewPanelView(context, (width, _) => + { + drawn = QuickBarEntries(context.SessionKey); + return [QuickBarRenderer.Render(drawn, width, _ink.Accent)]; + }); + view.Click = url => + { + if (QuickBarRenderer.ParseLink(url) is { } index && index < drawn.Count) + { + RunQuickMacro(context, drawn[index]); + } + }; + return view.Control; + } + + /// + /// The function-key bindings a character's quick bar lists: its session's engine when it has one (so a script's + /// runtime binding shows), else the bindings its trigger sets configure. + /// + private IReadOnlyList QuickBarEntries(string sessionKey) + { + if (FindSession(sessionKey) is { } session) + { + return QuickBarRenderer.Entries(session.Macros.Macros, session.Macros.Resolve); + } + + if (FindCharacter(sessionKey) is not { } found) + { + return []; + } + + var macros = _config.ResolveTriggerSets(found.Character, found.World).SelectMany(s => s.Macros).ToList(); + return QuickBarRenderer.Entries(macros, key => macros.FirstOrDefault( + m => string.Equals(MacroKey.Canonicalise(m.Key), key, StringComparison.OrdinalIgnoreCase)) is { Enabled: true } m ? m : null); + } + + /// + /// A click on an entry runs that binding through — the path the key + /// itself takes — on the panel's own character, never the one in front. + /// + private void RunQuickMacro(TerminalPanelContext context, QuickBarRenderer.Entry entry) + { + if (FindSession(context.SessionKey) is not { } session) + { + RefuseCommand($"{Snippet(context.SessionKey)} has no open session — ⌃P ▸ Switch to it opens one"); + return; + } + + _ = session.HandleKeyAsync(entry.Descriptor); + LastQuickMacro = entry.Descriptor; + } + + /// The descriptor the quick bar last ran, for the tests. + internal string? LastQuickMacro { get; private set; } + + // --- The docked composer ---------------------------------------------------------------------------------- + + private IWindowControl NewDockedComposer(TerminalPanelContext context) + { + var composer = new DockedComposer(context.WindowId, context.SessionKey, _screens, _ink.Accent); + if (_composeDrafts.TryGetValue(context.SessionKey, out var draft)) + { + composer.Load(draft.Body, draft.Escaping); + } + + composer.Changed += (_, _) => KeepDockedDraft(composer); + _dockedComposers[context.WindowId] = composer; + var box = PanelBox(context.WindowId); + composer.Fit(box.Width, box.Height); + return composer.Control; + } + + /// + /// Writes the docked buffer into the draft store F1 opens from, so the two are one draft. An empty buffer + /// forgets the draft, as an F1 window closed empty does. + /// + private void KeepDockedDraft(DockedComposer composer) + { + if (composer.Body.Trim().Length == 0) + { + _composeDrafts.Remove(composer.SessionKey); + return; + } + + _composeDrafts[composer.SessionKey] = new ComposeResult(composer.Body, composer.Escaping); + } + + /// Puts a character's kept draft back into its docked composers, after F1 changed it. + private void SyncDockedComposers(string? sessionKey) + { + foreach (var composer in _dockedComposers.Values) + { + if (sessionKey is null || string.Equals(composer.SessionKey, sessionKey, StringComparison.Ordinal)) + { + var draft = _composeDrafts.GetValueOrDefault(composer.SessionKey); + composer.Load(draft.Body ?? string.Empty, draft.Body is null ? composer.Escaping : draft.Escaping); + } + } + } + + /// + /// The composer that holds the keyboard, or null: the docked composer whose window is the focused pane's tab, + /// unless the writer handed the keyboard back. Arriving at a composer's window clears the hand-back, so moving + /// to its pane is moving into it. + /// + private DockedComposer? ArmedComposer() + { + var windowId = ActiveWindowId(); + if (!string.Equals(windowId, _composerArmWindow, StringComparison.Ordinal)) + { + _composerArmWindow = windowId; + _composerReleased = false; + } + + return !_composerReleased && _dockedComposers.TryGetValue(windowId, out var composer) ? composer : null; + } + + /// The band the primary command line is painting itself in now. + internal SharpConsoleUI.Color? PrimaryBandColor => _input.BackgroundColor; + + /// Whether a docked composer holds the keyboard. + internal bool ComposerArmed => ArmedComposer() is not null; + + /// The docked composer drawn in a panel window, for the tests and the snapshot views. + internal DockedComposer? DockedComposerIn(string windowId) => _dockedComposers.GetValueOrDefault(windowId); + + /// Whether the framework's focus is on a docked composer's editor. + internal bool ComposerHasFocus => + _window.FocusManager.FocusedControl is { } focused && _dockedComposers.Values.Any(c => ReferenceEquals(c.Editor, focused)); + + /// + /// Paints who holds the keyboard: the armed composer's header marker, and both command lines idle while a + /// composer has it — ⏎ there inserts a line, it does not send. + /// + private void SyncComposerBands() + { + var armed = ArmedComposer(); + foreach (var composer in _dockedComposers.Values) + { + composer.Armed = ReferenceEquals(composer, armed); + } + + _input.Armed = armed is null && ReferenceEquals(_armed, _input); + _second.Armed = armed is null && ReferenceEquals(_armed, _second); + } + + /// Re-derives who holds the keyboard after the focused pane or window changed. + private void SyncComposerArm() + { + SyncComposerBands(); + PinFocusToArmedBar(); + } + + /// Esc in the composer: the keyboard goes back to the command line; the pane stays where it is. + private void ReleaseComposer() + { + _composerReleased = true; + SyncComposerBands(); + PinFocusToArmedBar(); + } + + /// + /// A click put the framework's focus on a docked composer's editor: arm that composer, bringing its window to + /// the front when it is not. Called on the framework's FocusChanged, ahead of the focus pin, which would + /// otherwise take the focus straight back; never from the pin itself, which runs while the editor still has the + /// focus it is about to lose. + /// + private void ArmClickedComposer() + { + if (_pinningFocus || !_window.GetIsActive() || _window.FocusManager.FocusedControl is not { } focused + || _dockedComposers.Values.FirstOrDefault(c => ReferenceEquals(c.Editor, focused)) is not { } clicked + || ReferenceEquals(clicked, ArmedComposer())) + { + return; + } + + if (!string.Equals(ActiveWindowId(), clicked.WindowId, StringComparison.Ordinal)) + { + _pinningFocus = true; + try + { + Activate(clicked.WindowId); + } + finally + { + _pinningFocus = false; + } + } + + _composerArmWindow = clicked.WindowId; + _composerReleased = false; + SyncComposerBands(); + } + + /// + /// A key while a docked composer holds the keyboard. The workspace gestures keep their meaning — a bound macro, + /// ⌃arrows, ⌥⇧arrows, ⌃C — and the composer's own three (⌃S, ⌥L, Esc) are answered here; everything else is the + /// editor's, handed to it explicitly as the command line's keys are, ⏎ included. + /// + private string? HandleComposerKey(DockedComposer composer, KeyPressedEventArgs e) + { + var key = e.KeyInfo; + _composerEscapeAt = null; + if (DispatchMacro(key) is { } sent) + { + e.Handled = true; + return sent; + } + + if (TryResizeKey(e)) + { + return null; + } + + var ctrl = key.Modifiers == ConsoleModifiers.Control; + var alt = key.Modifiers == ConsoleModifiers.Alt; + if (ctrl && key.Key is ConsoleKey.C or ConsoleKey.X) + { + // Never the editor's own: its ⌃C/⌃X write to the system clipboard through a helper nothing can + // substitute. Through the app's clipboard, as the command line's are. + e.Handled = true; + if (!composer.Editor.HasSelection) + { + CopySelection(); + } + else if (ToClipboard(composer.Editor.GetSelectedText(), key.Key == ConsoleKey.X ? "cut" : "copied") + && key.Key == ConsoleKey.X) + { + composer.Editor.ProcessKey(new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false)); + } + + return null; + } + + if (ctrl && key.Key == ConsoleKey.S) + { + e.Handled = true; + SendDocked(composer); + return null; + } + + if (alt && key.Key == ConsoleKey.L) + { + e.Handled = true; + composer.ToggleEscaping(); + return null; + } + + if (key.Key == ConsoleKey.Escape && key.Modifiers == 0) + { + e.Handled = true; + _composerEscapeAt = _time.GetUtcNow(); + ReleaseComposer(); + return null; + } + + if (TryFocusKey(e)) + { + return null; + } + + e.Handled = true; + if (!composer.Editor.HasFocus) + { + _window.FocusControl(composer.Editor); + } + + composer.Editor.ProcessKey(key.Key == ConsoleKey.Enter ? new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false) : key); + return null; + } + + /// + /// The Enter of a ⌥⏎ typed in the composer: the terminal splits it into an Esc — which released the composer — + /// and an Enter. Within the same window pairs them in, the composer takes the keyboard + /// back and the Enter is a new line there, rather than a ⏎ sending whatever the command line holds. + /// + private bool TryComposerAltEnter(KeyPressedEventArgs e) + { + var at = _composerEscapeAt; + _composerEscapeAt = null; + if (e.KeyInfo.Key != ConsoleKey.Enter || e.KeyInfo.Modifiers != 0 + || at is not { } released || _time.GetUtcNow() - released > AltEnterWindow + || !_dockedComposers.TryGetValue(ActiveWindowId(), out var composer)) + { + return false; + } + + e.Handled = true; + _composerReleased = false; + SyncComposerArm(); + composer.Editor.ProcessKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + return true; + } + + /// + /// ⌃S in the docked composer: the buffer as one command, built exactly as F1 builds it, to the composer's own + /// character — echoed, alias-expanded and recorded in that character's history like any line typed. + /// + private void SendDocked(DockedComposer composer) + { + if (FindSession(composer.SessionKey) is not { } session) + { + RefuseCommand(NothingToSendTo(composer.WindowId)); + return; + } + + if (ComposeMessage.Build(composer.Body, composer.Escaping) is not { } line) + { + RefuseCommand("nothing to send — the composer is empty"); + return; + } + + composer.Load(string.Empty, composer.Escaping); + _composeDrafts.Remove(composer.SessionKey); + HistoryFor(composer.SessionKey, BarKind(_input)).Add(line); + _ = session.SendUserInputAsync(line); + } + + /// Types into the armed composer through the window's key handler, one key per character. + internal void SimulateComposerTyping(string text) + { + foreach (var c in text) + { + SimulateKey(c == '\n' + ? new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false) + : new ConsoleKeyInfo(c, char.IsAsciiLetter(c) ? (ConsoleKey)char.ToUpperInvariant(c) : ConsoleKey.NoName, char.IsUpper(c), false, false)); + } + } + + /// + /// What a click in a docked composer's editor does to focus: the framework focuses the control the pointer hit + /// (FocusReason.Mouse) and raises FocusChanged. The framework's own mouse path runs only inside + /// Run(), which no test enters. + /// + internal void SimulateComposerClick(string windowId) + { + if (_dockedComposers.TryGetValue(windowId, out var composer)) + { + _window.FocusManager.SetFocus(composer.Editor, FocusReason.Mouse); + } + } + + // --- Shared ----------------------------------------------------------------------------------------------- + + /// A markup panel: one control, redrawn from its render function at its pane's size. + private sealed class PanelView(string windowId, MarkupControl control, Func> render, Func box) + { + internal string WindowId { get; } = windowId; + + internal MarkupControl Control { get; } = control; + + internal (int Width, int Height) Size { get; private set; } + + internal Action? Click { get; set; } + + internal List Markup { get; private set; } = []; + + internal void Refresh() + { + Size = box(WindowId); + Markup = render(Size.Width, Size.Height); + Control.SetContent(Markup.ToList()); + } + } + + private PanelView NewPanelView(TerminalPanelContext context, Func> render) + { + var control = new MarkupControl(new List()) + { + HorizontalAlignment = HorizontalAlignment.Stretch, + VerticalAlignment = VerticalAlignment.Fill, + }; + var view = new PanelView(context.WindowId, control, render, PanelBox); + control.LinkClicked += (_, e) => view.Click?.Invoke(e.Url); + _panelViews[context.WindowId] = view; + view.Refresh(); + return view; + } + + /// What a markup panel last drew, for the tests. + internal IReadOnlyList PanelMarkup(string windowId) => + _panelViews.TryGetValue(windowId, out var view) ? view.Markup : []; + + /// A click on a panel's link, as its own handler receives it. + internal void SimulatePanelClick(string windowId, string url) + { + if (_panelViews.TryGetValue(windowId, out var view)) + { + view.Click?.Invoke(url); + } + } + + /// Redraws every panel: after a configuration commit, which can change meters and macros. + private void RefreshPanels() + { + foreach (var view in _panelViews.Values) + { + view.Refresh(); + } + } + + /// Redraws a panel whose box changed, and fits each composer. Rides PostBufferPaint. + private void SyncPanelSizes() + { + foreach (var view in _panelViews.Values) + { + if (view.Size != PanelBox(view.WindowId)) + { + view.Refresh(); + } + } + + foreach (var composer in _dockedComposers.Values) + { + var box = PanelBox(composer.WindowId); + composer.Fit(box.Width, box.Height); + } + } + + /// The cells a panel has: its pane's output rectangle, or a fallback before one is arranged. + private (int Width, int Height) PanelBox(string windowId) + { + if (_workspace.Layout.FindWindow(windowId) is { } pane + && PaneOutputRects().TryGetValue(pane.Id, out var rect) + && !rect.IsEmpty) + { + return (rect.Width, rect.Height); + } + + return (Math.Max(20, _system.ConsoleDriver.ScreenSize.Width - 24), Math.Max(3, _system.ConsoleDriver.ScreenSize.Height - 6)); + } + + /// A character's game data: its session's, or the demo's for the demo character with nothing open. + private GameDataStore? PanelGameData(string sessionKey) => + FindSession(sessionKey)?.GameData + ?? (IsDemoKey(sessionKey) ? _demoGameData : null); + + /// A character's room roster: its session's, or the demo's. + private RoomOccupants? PanelOccupants(string sessionKey) => + FindSession(sessionKey)?.Occupants + ?? (IsDemoKey(sessionKey) ? _demoOccupants : null); + + /// The meters a character's vitals show: the player's own, then any its server asked for. + private IReadOnlyList PanelMeters(string sessionKey) + { + var own = _config.Text.StatusMeters; + var served = FindSession(sessionKey)?.MxpMeters ?? (IsDemoKey(sessionKey) ? _demoMeters : []); + return served.Count == 0 + ? own + : [.. own, .. served.Where(m => !own.Any(o => string.Equals(o.Value, m.Value, StringComparison.OrdinalIgnoreCase)))]; + } + + // --- The snapshot views ----------------------------------------------------------------------------------- + + /// + /// The four panel views, each opened through its real ⌃P entry and placed the way its layout places it: + /// panel-who a narrow column beside the output; panel-vitals a strip over it, with a target; + /// panel-quickbar a strip under it, with function-key bindings the demo does not otherwise carry; + /// panel-composer the Roleplay column — the composer armed and holding a post typed through the real key + /// path, over who is here. The data is written through and + /// , the calls the wire makes. + /// + private void LoadDemoPanels(string view) + { + LoadDemoGameData(); + _demoOccupants.Apply( + "Room.Players", + """[{"name":"Ashlyn","fullname":"Ashlyn the Wanderer","idle":12},{"name":"Brannoc","idle":260},{"name":"Merrow","fullname":"Merrow of the Tide","idle":5},{"name":"Corvid","idle":0}]"""); + _demoOccupants.Apply( + "Char.Items.List", + """{"location":"room","items":[{"id":"9101","name":"a town crier","attrib":"m"},{"id":"9102","name":"a stray cat","attrib":"m"},{"id":"9103","name":"a lantern","attrib":"t"}]}"""); + + switch (view) + { + case "panel-who": + OpenDemoPanelBeside(PanelIds.WhoHere, columns: 34); + Activate(MainWindowId); + break; + + case "panel-vitals": + _demoGameData.SetGmcp("Char.Status", """{"enemy":"a rotting ghoul","enemypct":"40"}"""); + OpenDemoPanelStrip(PanelIds.Vitals, Edge.Top); + Activate(MainWindowId); + break; + + case "panel-quickbar": + _config.TriggerSets.Add(new TriggerSet + { + Name = "Quick", + Macros = + { + new Macro { Name = "kick", Key = "F11", Command = "kick" }, + new Macro { Name = "bash", Key = "F12", Command = "bash" }, + new Macro { Name = "cure light", Key = "Ctrl+F3", Command = "cast 'cure light'" }, + new Macro { Name = "quaff mana", Key = "Ctrl+F4", Command = "quaff mana" }, + }, + }); + FindCharacter(DemoScene.ActiveSessionKey)?.Character.TriggerSets.Add("Quick"); + OpenDemoPanelStrip(PanelIds.QuickBar, Edge.Bottom); + Activate(MainWindowId); + break; + + case "panel-composer": + if (OpenDemoPanelBeside(PanelIds.Composer, columns: 46) is { } composer + && _workspace.Layout.FindWindow(composer) is { } column) + { + var who = TerminalPanels.WindowId(PanelIds.WhoHere, DemoScene.ActiveSessionKey); + _workspace.OpenWindow(who, PanelTitle(PanelIds.WhoHere), WindowKind.Auxiliary, DemoScene.ActiveSessionKey, column.Id); + _workspace.Layout.SplitWithWindow(who, column.Id, Edge.Bottom); + RebuildPaneArea(); + Activate(MainWindowId); + Activate(composer); + SimulateComposerTyping("+pose Corvid sets the lantern down by the fountain\nand waits, 100% certain [someone] saw."); + } + + break; + } + + RefreshRail(); + } + + /// Opens a demo panel in a new pane to the right of the main window's, wide. + private string? OpenDemoPanelBeside(string panelId, int columns) + { + var mainPane = _workspace.Layout.FindWindow(MainWindowId)?.Id; + if (mainPane is null || OpenPanel(panelId, DemoScene.ActiveSessionKey) is not { } windowId) + { + return null; + } + + _workspace.Layout.SplitWithWindow(windowId, mainPane, Edge.Right); + RebuildPaneArea(); + Activate(windowId); + SizeDemoPane(windowId, columns); + return windowId; + } + + /// Opens a demo panel in a pane along one edge of the main window's, as short as a pane may be. + private void OpenDemoPanelStrip(string panelId, Edge edge) + { + var mainPane = _workspace.Layout.FindWindow(MainWindowId)?.Id; + if (mainPane is null || OpenPanel(panelId, DemoScene.ActiveSessionKey) is not { } windowId) + { + return; + } + + _workspace.Layout.SplitWithWindow(windowId, mainPane, edge); + RebuildPaneArea(); + Activate(windowId); + SizeDemoPane(windowId, PaneResize.MinimumPaneRows); + } + + /// + /// Moves the border of the split holding a window's pane so that pane is along the + /// split's axis, through — the arithmetic a drag on the divider uses. Needs + /// a rendered frame, so the panes have rectangles. + /// + private void SizeDemoPane(string windowId, int cells) + { + RenderFrame(); + if (_workspace.Layout.FindWindow(windowId) is not { } pane + || ParentOf(_workspace.Layout.Root, pane) is not { Children.Count: 2 } parent) + { + return; + } + + var rects = PaneRectsForResize(); + if (!rects.TryGetValue(pane.Id, out var rect)) + { + return; + } + + var horizontal = parent.Direction == SplitDirection.Row; + var start = horizontal ? rect.X : rect.Y; + var length = horizontal ? rect.Width : rect.Height; + var boundary = parent.Children.IndexOf(pane) == 0 ? start + cells : start + length - cells; + PaneResize.DragBorder(parent, 0, boundary, rects); + RebuildPaneArea(); + ReArmWholeFrame(); + } + + private static SplitNode? ParentOf(Core.Workspaces.LayoutNode node, PaneNode pane) => + node is not SplitNode split + ? null + : split.Children.Contains(pane) + ? split + : split.Children.Select(child => ParentOf(child, pane)).FirstOrDefault(found => found is not null); + + /// The demo's room roster, for the tests that drive it the way the wire would. + internal RoomOccupants DemoOccupants => _demoOccupants; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 57572b8a..de401928 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -974,7 +974,12 @@ public SharpMUTermApp( // line, and this puts it back the instant anything takes it, which is what makes "which bar ⏎ // sends from", "which control the framework will paste into" and "where the caret is drawn" one // fact rather than three that agree until they don't. - _window.FocusManager.FocusChanged += (_, _) => PinFocusToArmedBar(); + _window.FocusManager.FocusChanged += (_, _) => + { + // A click in a docked composer's editor is a request to write there, not focus drifting: arm it. + ArmClickedComposer(); + PinFocusToArmedBar(); + }; _window.PreviewKeyPressed += OnWindowKey; // NAWS rides the frame. Pane rectangles exist only while an arranged layout does, and every @@ -993,6 +998,7 @@ public SharpMUTermApp( DrawSixelOverlay(buffer); PublishScrollbars(); SyncMapSizes(); + SyncPanelSizes(); }; if (_sixel is not null) { @@ -1785,6 +1791,16 @@ public string RenderSnapshot(string? view = null) LoadDemoPackages(view.ToLowerInvariant()); } + // The panels a layout places, each opened through its real ⌃P entry over the demo's game data, which is + // written through the calls the wire makes. See LoadDemoPanels for what each frame is for. + if (string.Equals(view, "panel-who", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "panel-vitals", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "panel-quickbar", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "panel-composer", StringComparison.OrdinalIgnoreCase)) + { + LoadDemoPanels(view!.ToLowerInvariant()); + } + // The status row's meters and the game data inspector, over the demo's game data — written through // GameDataStore.SetGmcp, the call the wire makes, so the frame shows what a server's messages produce. // `meters` is the row alone; `gamedata` opens the inspector through the real ⌃P entry. @@ -4893,6 +4909,7 @@ private void SendComposed(ComposeResult result) // was opened, already sent. _composer.Close(); _composeDrafts.Remove(session.SessionKey); + SyncDockedComposers(session.SessionKey); HistoryFor(BarKind(ActiveBar())).Add(line); _ = session.SendUserInputAsync(line); } @@ -4918,10 +4935,13 @@ private void KeepComposeDraft(ComposeResult result) if (result.Body.Trim().Length == 0) { _composeDrafts.Remove(key); - return; + } + else + { + _composeDrafts[key] = result; } - _composeDrafts[key] = result; + SyncDockedComposers(key); } /// The composer, for the tests and the snapshot views. @@ -5291,8 +5311,9 @@ private void SetUpBar(InputBarControl bar, InputBar kind) private void ArmBar(InputBarControl bar) { _armed = bar.Visible ? bar : _input; - _input.Armed = ReferenceEquals(_armed, _input); - _second.Armed = ReferenceEquals(_armed, _second); + // A docked composer holding the keyboard keeps it: this is re-asserted on every layout change, and only + // the explicit gestures (the ⌃↑/⌃↓ ladder, ⇥ between bars, Esc) hand it back — see ReleaseComposer. + SyncComposerBands(); _window.FocusControl(_armed); UpdateInputChrome(); } @@ -5314,7 +5335,8 @@ private void PinFocusToArmedBar() return; } - var bar = ActiveBar(); + // The armed composer, when one holds the keyboard, is what typing, paste and the caret follow instead. + IInteractiveControl bar = ArmedComposer()?.Editor ?? (IInteractiveControl)ActiveBar(); if (ReferenceEquals(_window.FocusManager.FocusedControl, bar)) { return; @@ -5707,6 +5729,7 @@ private bool TryFocusKey(KeyPressedEventArgs e) // Up out of the second command line before anything else — it is the station above it. if (move == PaneDirection.Up && ReferenceEquals(_armed, _second) && _second.Visible) { + _composerReleased = true; ArmBar(_input); return true; } @@ -5720,6 +5743,7 @@ private bool TryFocusKey(KeyPressedEventArgs e) // Down off the last pane lands on the command lines, which are drawn below them. if (move == PaneDirection.Down && _second.Visible && ReferenceEquals(_armed, _input)) { + _composerReleased = true; ArmBar(_second); return true; } @@ -6926,6 +6950,9 @@ internal void SaveConfiguration() // line rather than the next reconnect. See ReloadAutomation. ReloadAutomation(); + // The quick bar lists the macros just committed, and the vitals the meters. + RefreshPanels(); + // F5 also adds and removes worlds and characters, which are what the header's fraction and the // rail are drawn from. Neither is repainted by anything else here, so a world added on F5 used to // leave both reading the configuration as it was before. @@ -8080,6 +8107,12 @@ private bool RunBuiltInCommand(string id) return true; } + if (id.StartsWith(PanelCommandPrefix, StringComparison.Ordinal)) + { + ShowPanel(id[PanelCommandPrefix.Length..]); + return true; + } + if (id == "a11y:toggle-window") { ToggleAnnounced(); @@ -11280,6 +11313,17 @@ private bool RouteToInput(ConsoleKeyInfo key) return null; } + // A docked composer holding the keyboard takes the keys an editor takes; see HandleComposerKey. + if (ArmedComposer() is { } composer) + { + return HandleComposerKey(composer, e); + } + + if (TryComposerAltEnter(e)) + { + return null; + } + // Alt+⏎ → newline, reassembled from the Escape and Enter the parser splits it into. First in // the chain because it is the only entry that has to see *every* key: it remembers a lone // Escape and must forget it again the moment anything else arrives, whoever ends up claiming @@ -12362,6 +12406,7 @@ private void SyncToFocusedPane() SyncScrollbackState(); RefreshPromptRow(); ReportPaneSizes(); + SyncComposerArm(); } /// diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 8c046f45..b4b8f269 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -25,5 +25,6 @@ internal static class SnapshotViews "prefix", "prefix-panel", "focus", "focus-moved", "tabs", "tabs-many", "collapsed", "timestamps", "timestamps-toggled", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", + "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", ]; } diff --git a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs index 1c5566a2..d56277cd 100644 --- a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs +++ b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs @@ -38,32 +38,25 @@ internal static class StatusMeterRenderer internal static string Render(IReadOnlyList meters, GameDataStore data, string lowInk, bool compact = false) { var cells = new List(); - foreach (var meter in meters) + foreach (var reading in Read(meters, data)) { - if (StatusMeter.Read(data, meter.Value) is not { } value) - { - continue; - } - - var max = string.IsNullOrWhiteSpace(meter.Max) ? null : StatusMeter.Read(data, meter.Max); - var low = IsLow(value, max); - var label = MarkupText.Escape(meter.Label); - if (compact && Share(value, max) is { } share) + var label = MarkupText.Escape(reading.Label); + if (compact && reading.Share is { } share) { - var percent = $"{Math.Clamp((int)Math.Round(share * 100), 0, 999)}%".PadLeft(ShareWidth); - cells.Add(low + var percent = Percent(share).PadLeft(ShareWidth); + cells.Add(reading.Low ? $"[dim]{label}[/] [bold {lowInk}]{percent}[/]" : $"[dim]{label}[/] [bold]{percent}[/]"); continue; } - var shown = MarkupText.Escape(StatusMeter.Fit(value, ValueWidth).PadLeft(ValueWidth)); - var cell = low + var shown = MarkupText.Escape(StatusMeter.Fit(reading.Value, ValueWidth).PadLeft(ValueWidth)); + var cell = reading.Low ? $"[dim]{label}[/] [bold {lowInk}]{shown}[/]" : $"[dim]{label}[/] [bold]{shown}[/]"; - if (!string.IsNullOrWhiteSpace(meter.Max)) + if (reading.HasMax) { - cell += $"[dim]/{MarkupText.Escape(StatusMeter.Fit(max ?? string.Empty, ValueWidth).PadRight(ValueWidth))}[/]"; + cell += $"[dim]/{MarkupText.Escape(StatusMeter.Fit(reading.Max ?? string.Empty, ValueWidth).PadRight(ValueWidth))}[/]"; } cells.Add(cell); @@ -72,6 +65,41 @@ internal static string Render(IReadOnlyList meters, GameDataStore d return string.Join(" ", cells); } + /// + /// One meter's reading, as every renderer of meters draws it: the status row and the vitals panel read the + /// same values through this, so the two cannot disagree about what "low" is. + /// + /// The meter's label. + /// The value as the game sent it. + /// The maximum as the game sent it, or null when the game has not sent one. + /// Whether the meter is configured with a maximum at all, sent yet or not. + /// Value over maximum, when both are numbers and the maximum is positive. + /// Whether is under . + internal readonly record struct MeterReading(string Label, string Value, string? Max, bool HasMax, double? Share, bool Low); + + /// The meters that have a value, in their configured order. A meter with nothing to read is left out. + internal static IReadOnlyList Read(IReadOnlyList meters, GameDataStore data) + { + var readings = new List(); + foreach (var meter in meters) + { + if (StatusMeter.Read(data, meter.Value) is not { } value) + { + continue; + } + + var hasMax = !string.IsNullOrWhiteSpace(meter.Max); + var max = hasMax ? StatusMeter.Read(data, meter.Max) : null; + readings.Add(new MeterReading(meter.Label, value, max, hasMax, Share(value, max), IsLow(value, max))); + } + + return readings; + } + + /// A share as a whole percentage, at most four cells: 82%, 100%. + internal static string Percent(double share) => + $"{Math.Clamp((int)Math.Round(share * 100), 0, 999).ToString(CultureInfo.InvariantCulture)}%"; + private static bool IsLow(string value, string? max) => Share(value, max) < LowShare; private static double? Share(string value, string? max) => diff --git a/tests/SharpMUTerm.Core.Tests/Protocols/RoomOccupantsTests.cs b/tests/SharpMUTerm.Core.Tests/Protocols/RoomOccupantsTests.cs new file mode 100644 index 00000000..c27766b2 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Protocols/RoomOccupantsTests.cs @@ -0,0 +1,165 @@ +using SharpMUTerm.Core.Protocols; + +namespace SharpMUTerm.Core.Tests.Protocols; + +/// +/// Who is in the room, from GMCP: the whole list, a player arriving and leaving, and creatures from the room's item +/// list. The roster is server text, so it is bounded in count and name length and refuses names a click would turn +/// into a different command. +/// +public class RoomOccupantsTests +{ + [Test] + public async Task RoomPlayersReplacesTheListInTheGamesOrder() + { + var roster = new RoomOccupants(); + roster.Apply("Room.Players", """[{"name":"Ann","fullname":"Ann the Bold"},{"name":"Bo"}]"""); + roster.Apply("Room.Players", """[{"name":"Cy"},{"name":"Ann"}]"""); + + await Assert.That(roster.Known).IsTrue(); + await Assert.That(roster.Snapshot.Select(o => o.Name)).IsEquivalentTo(new[] { "Cy", "Ann" }); + } + + [Test] + public async Task AFullNameIsShownAndTheShortNameIsKept() + { + var roster = new RoomOccupants(); + roster.Apply("Room.Players", """[{"name":"Ann","fullname":"Ann the Bold"}]"""); + + var ann = roster.Snapshot.Single(); + await Assert.That(ann.Name).IsEqualTo("Ann"); + await Assert.That(ann.Display).IsEqualTo("Ann the Bold"); + await Assert.That(ann.IsPlayer).IsTrue(); + } + + [Test] + public async Task AddAndRemoveChangeOneRowWhateverTheCase() + { + var roster = new RoomOccupants(); + roster.Apply("Room.Players", """[{"name":"Ann"}]"""); + roster.Apply("Room.AddPlayer", """{"name":"Bo","idle":"240"}"""); + roster.Apply("Room.AddPlayer", """{"name":"bo","idle":5}"""); + + await Assert.That(roster.Snapshot.Count).IsEqualTo(2); + await Assert.That(roster.Snapshot[1].IdleSeconds).IsEqualTo(5); + + await Assert.That(roster.Apply("Room.RemovePlayer", "\"BO\"")).IsTrue(); + await Assert.That(roster.Snapshot.Select(o => o.Name)).IsEquivalentTo(new[] { "Ann" }); + } + + [Test] + public async Task CreaturesComeFromTheRoomsItemListAndOnlyMonsters() + { + var roster = new RoomOccupants(); + roster.Apply("Room.Players", """[{"name":"Ann"}]"""); + roster.Apply("Char.Items.List", """{"location":"room","items":[{"id":"1","name":"a rat","attrib":"m"},{"id":"2","name":"a chest","attrib":"c"}]}"""); + roster.Apply("Char.Items.List", """{"location":"inv","items":[{"id":"3","name":"a sword","attrib":"m"}]}"""); + + await Assert.That(roster.Snapshot.Select(o => o.Display)).IsEquivalentTo(new[] { "Ann", "a rat" }); + await Assert.That(roster.Snapshot[1].IsPlayer).IsFalse(); + + roster.Apply("Char.Items.Remove", """{"location":"room","item":{"id":"1"}}"""); + await Assert.That(roster.Snapshot.Count).IsEqualTo(1); + } + + [Test] + public async Task ANameWithASpaceOrAControlCharacterIsRefused() + { + var roster = new RoomOccupants(); + roster.Apply("Room.Players", """[{"name":"Ann; quit"},{"name":"Bo\u001b[2J"},{"name":"Cy"}]"""); + + await Assert.That(roster.Snapshot.Select(o => o.Name)).IsEquivalentTo(new[] { "Cy" }); + } + + [Test] + public async Task TheRosterIsCapped() + { + var roster = new RoomOccupants(); + var many = string.Join(",", Enumerable.Range(0, RoomOccupants.MaxOccupants + 50).Select(i => $"{{\"name\":\"P{i}\"}}")); + roster.Apply("Room.Players", $"[{many}]"); + + await Assert.That(roster.Snapshot.Count).IsEqualTo(RoomOccupants.MaxOccupants); + } + + [Test] + public async Task OtherPackagesAndMalformedBodiesChangeNothing() + { + var roster = new RoomOccupants(); + var raised = 0; + roster.Changed += (_, _) => raised++; + + await Assert.That(roster.Apply("Char.Vitals", """{"hp":"1"}""")).IsFalse(); + await Assert.That(roster.Apply("Room.Players", "[{")).IsFalse(); + await Assert.That(roster.Known).IsFalse(); + await Assert.That(raised).IsEqualTo(0); + } + + [Test] + public async Task AnEmptyRoomTheGameReportedIsKnown() + { + var roster = new RoomOccupants(); + roster.Apply("Room.Players", "[]"); + + await Assert.That(roster.Known).IsTrue(); + await Assert.That(roster.Snapshot).IsEmpty(); + + roster.Clear(); + await Assert.That(roster.Known).IsFalse(); + } +} + +/// What the character is fighting, read from the three shapes games send it in. +public class CombatTargetTests +{ + [Test] + public async Task AardwolfsEnemyAndPercentage() + { + var data = new GameDataStore(); + data.SetGmcp("Char.Status", """{"enemy":"a rotting ghoul","enemypct":"40"}"""); + + var target = CombatTarget.Read(data); + await Assert.That(target).IsNotNull(); + await Assert.That(target!.Name).IsEqualTo("a rotting ghoul"); + await Assert.That(target.Share).IsEqualTo(0.4); + } + + [Test] + public async Task AnEmptyEnemyIsNoTarget() + { + var data = new GameDataStore(); + data.SetGmcp("Char.Status", """{"enemy":"","enemypct":"0"}"""); + + await Assert.That(CombatTarget.Read(data)).IsNull(); + } + + [Test] + public async Task IresTargetInfo() + { + var data = new GameDataStore(); + data.SetGmcp("IRE.Target.Info", """{"id":"1","short_desc":"a goblin","hpperc":"75%"}"""); + + var target = CombatTarget.Read(data)!; + await Assert.That(target.Name).IsEqualTo("a goblin"); + await Assert.That(target.Share).IsEqualTo(0.75); + } + + [Test] + public async Task MsdpHealthIsAShareOfItsMaximumWhenOneIsSent() + { + var data = new GameDataStore(); + data.SetMsdp("""{"OPPONENT_NAME":"a troll","OPPONENT_HEALTH":"30","OPPONENT_HEALTH_MAX":"120"}"""); + + var target = CombatTarget.Read(data)!; + await Assert.That(target.Name).IsEqualTo("a troll"); + await Assert.That(target.Share).IsEqualTo(0.25); + } + + [Test] + public async Task ATargetWithNoHealthHasNoShare() + { + var data = new GameDataStore(); + data.SetGmcp("Char.Status", """{"enemy":"a shade"}"""); + + await Assert.That(CombatTarget.Read(data)!.Share).IsNull(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/DockedComposerTests.cs b/tests/SharpMUTerm.Tui.Tests/DockedComposerTests.cs new file mode 100644 index 00000000..15274901 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/DockedComposerTests.cs @@ -0,0 +1,252 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The docked composer, driven through the window's own key handler: arriving at its pane arms it, typing and paste +/// go to it and not the command line, ⌃S sends one command to its character, Esc hands the keyboard back, +/// and its buffer is the same draft F1 opens. +/// +/// Sessions are connected, as ' are: SendUserInputAsync writes nothing without +/// a transport, so "it was sent" against an unconnected session would hold whatever the code did. +/// +/// +[NotInParallel] +public class DockedComposerTests +{ + private const int Width = 120; + private const int Height = 32; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static ConsoleKeyInfo Key(ConsoleKey key, ConsoleModifiers modifiers = 0, char ch = '\0') => + new(ch, key, modifiers.HasFlag(ConsoleModifiers.Shift), + modifiers.HasFlag(ConsoleModifiers.Alt), modifiers.HasFlag(ConsoleModifiers.Control)); + + private static ConsoleKeyInfo Enter => Key(ConsoleKey.Enter, ch: '\r'); + + [Test] + public async Task OpeningTheComposerArmsItAndTypingLandsThere() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + + await Assert.That(world.App.ComposerArmed).IsTrue(); + await Assert.That(world.App.ComposerHasFocus).IsTrue().Because("paste follows the framework's focus"); + + world.App.SimulateComposerTyping("say hi"); + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo("say hi"); + await Assert.That(world.App.PrimaryInputText).IsEqualTo(string.Empty); + } + + [Test] + public async Task EnterInsertsALineAndCtrlSSendsOneCommandToTheComposersCharacter() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + + world.App.SimulateComposerTyping("+pose waves\nand sits"); + await Assert.That(world.Telnet.Lines).IsEmpty().Because("⏎ in the composer is a new line, not a send"); + + world.App.SimulateKey(Key(ConsoleKey.S, ConsoleModifiers.Control)); + + await Assert.That(world.Telnet.Lines).IsEquivalentTo(new[] { "+pose waves%rand sits" }); + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo(string.Empty); + await Assert.That(world.App.HistoryEntries(InputBar.Primary)).Contains("+pose waves%rand sits"); + } + + [Test] + public async Task AltLEscapesTheWayF1Does() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + world.App.SimulateComposerTyping("100% [sure]"); + + world.App.SimulateKey(Key(ConsoleKey.L, ConsoleModifiers.Alt)); + await Assert.That(world.App.DockedComposerIn(windowId)!.HeaderMarkup).Contains("literal"); + world.App.SimulateKey(Key(ConsoleKey.S, ConsoleModifiers.Control)); + + await Assert.That(world.Telnet.Lines).IsEquivalentTo(new[] { "100%% \\[sure\\]" }); + } + + [Test] + public async Task PasteGoesToTheComposerWhileItIsArmedAndToTheCommandLineAfterEsc() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + + world.App.SimulatePaste("pasted"); + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo("pasted"); + + world.App.SimulateKey(Key(ConsoleKey.Escape)); + await Assert.That(world.App.ComposerArmed).IsFalse(); + await Assert.That(world.App.ArmedBarHasFocus).IsTrue(); + + world.App.SimulatePaste("look"); + await Assert.That(world.App.PrimaryInputText).IsEqualTo("look"); + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo("pasted"); + } + + [Test] + public async Task AfterEscEnterSendsFromTheCommandLineToTheSameCharacter() + { + var world = await Connected(); + world.OpenComposer(); + world.App.SimulateComposerTyping("draft"); + world.App.SimulateKey(Key(ConsoleKey.Escape)); + + foreach (var c in "look") + { + world.App.SimulateKey(Key((ConsoleKey)char.ToUpperInvariant(c), ch: c)); + } + + world.App.SimulateKey(Enter); + await Assert.That(world.Telnet.Lines).IsEquivalentTo(new[] { "look" }); + } + + /// + /// ⌥⏎ is the newline chord, and a terminal writes it as Esc then Enter. In the composer the Esc alone would hand + /// the keyboard back and the Enter would send whatever the command line held — so the pair is put back together. + /// + [Test] + public async Task AltEnterInTheComposerIsANewLineAndSendsNothing() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + world.App.SimulateComposerTyping("one"); + + world.App.SimulateKey(Key(ConsoleKey.Escape)); + world.App.SimulateKey(Enter); + world.App.SimulateComposerTyping("two"); + + await Assert.That(world.Telnet.Lines).IsEmpty(); + await Assert.That(world.App.ComposerArmed).IsTrue(); + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo("one\ntwo"); + } + + [Test] + public async Task MovingToAnotherPaneDisarmsItAndComingBackArmsIt() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + world.App.DispatchCommand("layout:split-right"); + world.App.RenderNextFrame(); + var composerPane = world.App.PaneIdOf(windowId); + await Assert.That(world.App.PaneIds.Count).IsEqualTo(2); + + while (world.App.FocusedPaneId == composerPane) + { + world.App.SimulateKey(Key(ConsoleKey.O, ConsoleModifiers.Control)); + } + + await Assert.That(world.App.ComposerArmed).IsFalse(); + await Assert.That(world.App.ArmedBarHasFocus).IsTrue(); + + world.App.SimulateKey(Key(ConsoleKey.O, ConsoleModifiers.Control)); + await Assert.That(world.App.FocusedPaneId).IsEqualTo(composerPane); + await Assert.That(world.App.ComposerArmed).IsTrue().Because("arriving at its pane is moving into it"); + await Assert.That(world.App.ComposerHasFocus).IsTrue(); + } + + /// A click in the editor arms it — the focus pin must not take the focus straight back to the bar. + [Test] + public async Task AClickInTheEditorArmsItFromAnotherPane() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + world.App.DispatchCommand("layout:split-right"); + world.App.RenderNextFrame(); + var composerPane = world.App.PaneIdOf(windowId); + while (world.App.FocusedPaneId == composerPane) + { + world.App.SimulateKey(Key(ConsoleKey.O, ConsoleModifiers.Control)); + } + + await Assert.That(world.App.ComposerArmed).IsFalse(); + + world.App.SimulateComposerClick(windowId); + + await Assert.That(world.App.ComposerArmed).IsTrue(); + await Assert.That(world.App.ComposerHasFocus).IsTrue(); + await Assert.That(world.App.FocusedPaneId).IsEqualTo(composerPane); + world.App.SimulateComposerTyping("x"); + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo("x"); + } + + /// While the composer holds the keyboard both command lines are drawn idle: ⏎ is not theirs. + [Test] + public async Task BothCommandLinesAreIdleWhileTheComposerIsArmed() + { + var world = await Connected(); + world.OpenComposer(); + var (armed, idle) = world.App.InputBandColors; + await Assert.That(world.App.PrimaryBandColor).IsEqualTo(idle); + + world.App.SimulateKey(Key(ConsoleKey.Escape)); + await Assert.That(world.App.PrimaryBandColor).IsEqualTo(armed); + } + + [Test] + public async Task TheDockedBufferIsTheDraftF1Opens() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + world.App.SimulateComposerTyping("half a post"); + + world.App.SimulateKey(Key(ConsoleKey.F1)); + await Assert.That(world.App.Composer.IsOpen).IsTrue(); + await Assert.That(world.App.Composer.Body).IsEqualTo("half a post"); + + world.App.Composer.SimulateTyping(" and the rest"); + world.App.Composer.SimulateKey(Key(ConsoleKey.Escape)); + + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo("half a post and the rest"); + } + + [Test] + public async Task ItSurvivesThePaneAreaBeingRebuilt() + { + var world = await Connected(); + var windowId = world.OpenComposer(); + world.App.SimulateComposerTyping("kept"); + + world.App.DispatchCommand("layout:split-right"); + world.App.RenderNextFrame(); + + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo("kept"); + await Assert.That(world.App.RenderWholeFrame()).Contains("kept"); + } + + private sealed record Wired(SharpMUTermApp App, RecordingTelnetSession Telnet) + { + /// Opens the composer through its ⌃P entry, in a pane of its own beside the output. + internal string OpenComposer() + { + App.DispatchCommand("panel:composer"); + var windowId = TerminalPanels.WindowId(PanelIds.Composer, "Quiet.Ann"); + App.RenderNextFrame(); + return windowId; + } + } + + private static async Task Connected() + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }); + config.Worlds.Add(world); + + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height)); + var telnet = new RecordingTelnetSession(); + app.TelnetFactory = _ => telnet; + await app.BindWorldWithoutConnecting(world).ConnectAsync(); + app.RenderNextFrame(); + return new Wired(app, telnet); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index 3f263820..2019f55e 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -48,6 +48,10 @@ public class FrameContrastTests // most to lose from a theme it was not measured against. "selection", "input-selection", "menu-fuzzy", "menu-recent", + // The four panels: who is here and the quick bar carry the accent on links, the vitals strip paints bars + // and the warning in a server-driven colour, and the docked composer is an editor on its own plane. + "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", + // The meters are the status row's only cells whose colour depends on what a server sent (a low // value wears the notice ink), and the inspector is a modal of its own. "meters", "gamedata", "map", "map-walking", "map-split", diff --git a/tests/SharpMUTerm.Tui.Tests/LayoutWiringTests.cs b/tests/SharpMUTerm.Tui.Tests/LayoutWiringTests.cs index f1a77b98..921afbf1 100644 --- a/tests/SharpMUTerm.Tui.Tests/LayoutWiringTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/LayoutWiringTests.cs @@ -89,8 +89,8 @@ public async Task CombatOverTheDemoPutsTheMapBesideTheOutputWithChatTabbedUnderI await Assert.That(app.PaneIdOf(SharpMUTermApp.MapWindowId(DemoScene.ActiveSessionKey))).IsEqualTo("panel:map"); await Assert.That(app.PaneIdOf(DemoScene.ChatWindowId)).IsEqualTo("panel:map"); await Assert.That(app.FocusedPaneId).IsEqualTo("panel:output"); - // Vitals and the quick bar have nothing to draw them in this build, so they take no pane. - await Assert.That(app.PaneIds).IsEquivalentTo(new[] { "panel:output", "panel:map" }); + // The demo sends vitals, and the quick bar always has something to say, so both take their strips. + await Assert.That(app.PaneIds).IsEquivalentTo(new[] { "panel:vitals", "panel:output", "panel:map", "panel:quick-bar" }); } [Test] @@ -140,7 +140,7 @@ public async Task ARefoldWaitsForTheBurstAndRebuildsOnlyWhenAPanelAppears() config.Worlds[0].Layout = BuiltInLayouts.CombatId; app.Panels.Register(PanelIds.Vitals, _ => new MarkupControl(["vitals"])); var session = app.BindWorldWithoutConnecting(config.Worlds[0]); - await Assert.That(app.PaneIds).IsEquivalentTo(new[] { "panel:output" }); + await Assert.That(app.PaneIds).IsEquivalentTo(new[] { "panel:output", "panel:quick-bar" }); var rebuilds = app.PaneAreaRebuilds; for (var hp = 400; hp < 410; hp++) diff --git a/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs b/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs new file mode 100644 index 00000000..039a496a --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs @@ -0,0 +1,246 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui.Panels; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The three markup panels — who is here, the vitals strip, the quick bar — as pure renderers, and as panes of a +/// connected client: what a click does, whose session it does it on, and that a panel costs no cell outside its pane. +/// +[NotInParallel] +public class TerminalPanelTests +{ + private const int Width = 120; + private const int Height = 32; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static readonly VitalsStripRenderer.Ink VitalsInk = new("#00f5b7", "#f5c542", "#6a6a72"); + + // --- who is here ------------------------------------------------------------------------------------------ + + [Test] + public async Task WhoHereListsPlayersThenCreaturesUnderTheRoomName() + { + var rows = WhoHereRenderer.Render( + "The Grand Plaza", + [new("Ann", "Ann the Bold", true, 30), new("Bo", "Bo", true, 600), new("rat", "a rat", false, Id: "1")], + 40, 10, new WhoHereRenderer.Ink("#00f5b7")); + + var plain = rows.Select(StripMarkup).ToList(); + await Assert.That(plain[0]).Contains("The Grand Plaza").And.Contains("3"); + await Assert.That(plain[1]).Contains("Ann the Bold").And.Contains("active"); + await Assert.That(plain[2]).Contains("idle 10m"); + await Assert.That(plain[3]).Contains("a rat"); + await Assert.That(rows[1]).Contains($"[link={WhoHereRenderer.LinkPrefix}0]"); + await Assert.That(plain.All(r => r.Length <= 40)).IsTrue(); + } + + [Test] + public async Task WhoHereSaysHowManyItCouldNotShow() + { + var many = Enumerable.Range(0, 30).Select(i => new RoomOccupant($"P{i}", $"P{i}", true)).ToList(); + var rows = WhoHereRenderer.Render("Hall", many, 30, 6, new WhoHereRenderer.Ink("#00f5b7")); + + await Assert.That(rows.Count).IsLessThanOrEqualTo(6); + await Assert.That(StripMarkup(rows[^1])).Contains("and 26 more"); + } + + [Test] + public async Task ANameIsTheGamesTextAndIsEscaped() + { + var rows = WhoHereRenderer.Render(null, [new("Ann", "[bold]Ann[/]", true)], 40, 4, new WhoHereRenderer.Ink("#00f5b7")); + + await Assert.That(rows[1]).Contains("[[bold]]Ann[[/]]"); + } + + // --- vitals ----------------------------------------------------------------------------------------------- + + private static StatusMeterRenderer.MeterReading Meter(string label, string value, string max) => + new(label, value, max, true, double.Parse(value) / double.Parse(max), double.Parse(value) / double.Parse(max) < StatusMeterRenderer.LowShare); + + [Test] + public async Task AChangingValueMovesNoCell() + { + var before = VitalsStripRenderer.Render([Meter("hp", "1000", "1000"), Meter("mp", "900", "1000")], new CombatTarget("a ghoul", 0.9), 100, VitalsInk); + var after = VitalsStripRenderer.Render([Meter("hp", "7", "1000"), Meter("mp", "90", "1000")], new CombatTarget("a ghoul", 0.05), 100, VitalsInk); + + await Assert.That(VisibleLength(after)).IsEqualTo(VisibleLength(before)); + var mp = StripMarkup(before).IndexOf("mp", StringComparison.Ordinal); + await Assert.That(StripMarkup(after).IndexOf("mp", StringComparison.Ordinal)).IsEqualTo(mp); + await Assert.That(StripMarkup(after)).Contains(VitalsStripRenderer.LowMark); + } + + [Test] + public async Task TheStripGivesUpDetailToFitAndNeverOverflows() + { + StatusMeterRenderer.MeterReading[] meters = [Meter("hp", "412", "500"), Meter("mp", "23", "120"), Meter("mv", "88", "100")]; + var target = new CombatTarget("a rotting ghoul", 0.4); + + var wide = StripMarkup(VitalsStripRenderer.Render(meters, target, 140, VitalsInk)); + var narrow = StripMarkup(VitalsStripRenderer.Render(meters, target, 50, VitalsInk)); + + await Assert.That(wide).Contains("█").And.Contains("412/500").And.Contains("40%"); + await Assert.That(narrow.Length).IsLessThanOrEqualTo(50); + await Assert.That(narrow).DoesNotContain("█"); + foreach (var width in new[] { 8, 20, 40, 60, 80, 100, 120 }) + { + await Assert.That(VisibleLength(VitalsStripRenderer.Render(meters, target, width, VitalsInk))).IsLessThanOrEqualTo(width); + } + } + + [Test] + public async Task NothingToShowIsNoStrip() + { + await Assert.That(VitalsStripRenderer.Render([], null, 80, VitalsInk)).IsEqualTo(string.Empty); + } + + // --- quick bar -------------------------------------------------------------------------------------------- + + private static readonly Macro[] Bindings = + [ + new() { Name = "kick", Key = "F11", Enabled = true, Command = "kick" }, + new() { Name = "", Key = "Ctrl+F3", Enabled = true, Command = "cast 'cure light'" }, + new() { Name = "bash", Key = "F12", Enabled = true, Command = "bash" }, + new() { Name = "look", Key = "Num5", Enabled = true, Command = "look" }, + new() { Name = "off", Key = "F10", Enabled = false, Command = "nothing" }, + ]; + + private static Macro? Resolve(string descriptor) => + Bindings.FirstOrDefault(m => m.Enabled && string.Equals(MacroKey.Canonicalise(m.Key), descriptor, StringComparison.OrdinalIgnoreCase)); + + [Test] + public async Task TheQuickBarListsFunctionKeysPlainFirstAndByNumber() + { + var entries = QuickBarRenderer.Entries(Bindings, Resolve); + + await Assert.That(entries.Select(e => e.Key)).IsEquivalentTo(new[] { "F11", "F12", "⌃F3" }); + await Assert.That(entries[2].Name).IsEqualTo("cast 'cure light'"); + } + + [Test] + public async Task TheQuickBarElidesAndNeverWraps() + { + var entries = QuickBarRenderer.Entries(Bindings, Resolve); + + var wide = QuickBarRenderer.Render(entries, 100, "#00f5b7"); + await Assert.That(StripMarkup(wide)).Contains("F11 kick").And.EndsWith(QuickBarRenderer.Hint); + await Assert.That(wide).Contains($"[link={QuickBarRenderer.LinkPrefix}0]"); + + foreach (var width in new[] { 6, 12, 20, 30, 45 }) + { + var row = QuickBarRenderer.Render(entries, width, "#00f5b7"); + await Assert.That(VisibleLength(row)).IsLessThanOrEqualTo(width); + await Assert.That(row).DoesNotContain("\n"); + } + } + + // --- in a client ------------------------------------------------------------------------------------------ + + [Test] + public async Task ClickingANamePutsLookOnTheCommandLineAndSendsNothing() + { + var world = await Connected(); + world.Session.Occupants.Apply("Room.Players", """[{"name":"Ashlyn","fullname":"Ashlyn the Wanderer"}]"""); + var windowId = world.Open(PanelIds.WhoHere); + + await Assert.That(string.Join("\n", world.App.PanelMarkup(windowId))).Contains("Ashlyn the Wanderer"); + + var sent = world.Telnet.Lines.Count; + world.App.SimulatePanelClick(windowId, WhoHereRenderer.LinkPrefix + "0"); + + await Assert.That(world.App.PrimaryInputText).IsEqualTo("look Ashlyn"); + await Assert.That(world.Telnet.Lines.Count).IsEqualTo(sent).Because("the demo world's connect commands are all that went"); + } + + [Test] + public async Task ClickingAQuickBarKeyRunsItsBindingOnThePanelsCharacter() + { + var world = await Connected(); + var windowId = world.Open(PanelIds.QuickBar); + var markup = string.Join("\n", world.App.PanelMarkup(windowId)); + await Assert.That(StripMarkup(markup)).Contains("⌃F1 score"); + + var link = markup.Split($"[link={QuickBarRenderer.LinkPrefix}").Skip(1).First(part => part.Contains("score")); + world.App.SimulatePanelClick(windowId, QuickBarRenderer.LinkPrefix + link[..link.IndexOf(']')]); + + await Assert.That(world.App.LastQuickMacro).IsEqualTo("Ctrl+F1"); + await Assert.That(world.Telnet.Lines).Contains("score"); + } + + [Test] + public async Task TheVitalsPanelDrawsTheSessionsMetersAndTarget() + { + var world = await Connected(); + world.Session.GameData.SetGmcp("Char.Vitals", """{"hp":"412","maxhp":"500","mp":"23","maxmp":"120"}"""); + world.Session.GameData.SetGmcp("Char.Status", """{"enemy":"a rotting ghoul","enemypct":"40"}"""); + var windowId = world.Open(PanelIds.Vitals); + + var strip = StripMarkup(string.Join("\n", world.App.PanelMarkup(windowId))); + await Assert.That(strip).Contains("412").And.Contains("a rotting").And.Contains("40%"); + } + + /// Every registered panel is one a layout can place, and the layout counts the rest as drawing nothing. + [Test] + public async Task ThePanelsThisClientDrawsAreTheOnesItRegistered() + { + var world = await Connected(); + + foreach (var id in new[] { PanelIds.WhoHere, PanelIds.Vitals, PanelIds.QuickBar, PanelIds.Composer }) + { + await Assert.That(world.App.Panels.IsRegistered(id)).IsTrue(); + } + + await Assert.That(world.App.Panels.IsRegistered(PanelIds.GameData)).IsFalse(); + await Assert.That(world.App.LayoutAvailability(world.Session.SessionKey).HasData(PanelIds.GameData)).IsFalse(); + } + + [Test] + public async Task APanelUpdatingMovesNoPaneRectangle() + { + var world = await Connected(); + var windowId = world.Open(PanelIds.WhoHere); + world.App.DispatchCommand("layout:split-right"); + world.App.RenderNextFrame(); + var before = world.App.PaneOutputRects().ToDictionary(p => p.Key, p => p.Value); + + world.Session.Occupants.Apply("Room.Players", """[{"name":"Ann"},{"name":"Bo"},{"name":"Cy"}]"""); + world.App.RenderNextFrame(); + + await Assert.That(world.App.PaneOutputRects().ToDictionary(p => p.Key, p => p.Value)).IsEquivalentTo(before); + await Assert.That(windowId).StartsWith(TerminalPanels.WindowPrefix); + } + + private static string StripMarkup(string markup) => Plain(markup); + + private sealed record Wired(SharpMUTermApp App, RecordingTelnetSession Telnet, Core.Session.WorldSession Session) + { + internal string Open(string panelId) + { + App.DispatchCommand("panel:" + panelId); + App.RenderNextFrame(); + App.RenderNextFrame(); + return TerminalPanels.WindowId(panelId, Session.SessionKey); + } + } + + private static async Task Connected() + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height)); + var telnet = new RecordingTelnetSession(); + app.TelnetFactory = _ => telnet; + var session = app.BindWorldWithoutConnecting(config.Worlds[0]); + await session.ConnectAsync(); + app.RenderNextFrame(); + return new Wired(app, telnet, session); + } +} From b246c8cf8111c6916e7071d376dc0c1456928cc2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 04:36:45 +0000 Subject: [PATCH 013/113] Deliver headless MXP pictures on the driving thread, not the pool A headless app runs OnUiThread inline, so the picture host's deliveries ran on the thread pool while the test or snapshot appended the next line. The reserved-picture draw and the append that reads ReservedPicture.Drawn raced over the pane buffer, and a row could be left blank: the intermittent APictureStopsAtTheFirstLineWithoutItsCells. Headless picture work is now queued and run at the next frame or while InlineImagesSettled is awaited. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 2 + src/SharpMUTerm.Tui/SharpMUTermApp.cs | 64 +++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c3266a..1cd3e4f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -156,6 +156,8 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- A `--snapshot` frame with an MXP picture in cells a server left for it no longer sometimes leaves one of + the picture's rows blank. - At 80 columns the status row no longer wraps onto a second row: the encoding and the Ctrl+P hint are dropped first. - Health, mana and movement meters stay on the status row on a narrow terminal, shown as percentages when diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 9d6212e1..f34afcb9 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -743,7 +743,7 @@ public SharpMUTermApp( _sessions.SessionRemoved += OnSessionRemoved; _inlineImages = new InlineImageHost( (url, token) => (ImageFetch ?? _imageLoader.FetchBytesAsync)(url, token), - OnUi); + OnImageUi); _mssp = mssp ?? new MsspCache(); _maps = maps ?? new MapStore(); _media = media ?? new MediaCache(); @@ -2096,7 +2096,11 @@ public string RenderSnapshot(string? view = null) /// hung/OOM'd.) A frame also arranges the layout, so control bounds are only real after one has /// been rendered. /// - private string RenderFrame() => HeadlessFrameCapture.Capture(_system.ConsoleDriver, _system.ForceRender); + private string RenderFrame() + { + DrainHeadlessImageWork(); + return HeadlessFrameCapture.Capture(_system.ConsoleDriver, _system.ForceRender); + } /// /// Renders one more frame, the way a test drives the client on past a change it has just made — @@ -2703,7 +2707,59 @@ private WorldSession OpenSession(WorldDefinition world, CharacterDefinition? cha internal Func>? ImageFetch { get; set; } /// Completes when every MXP picture asked for so far has been delivered or given up on. - internal Task InlineImagesSettled => _inlineImages.Pending; + internal Task InlineImagesSettled => _headless ? SettleHeadlessImagesAsync() : _inlineImages.Pending; + + /// + /// UI work the picture host hands back, held until whoever drives a headless app collects it. + /// + /// The host fetches and decodes on the thread pool and hands its results to . + /// A headless app has no UI thread, and there runs the action inline — which + /// for these callers means on the pool thread, at the same moment the test or snapshot is + /// appending the next line on its own. and the append that reads + /// then raced over the same buffer: the picture set + /// Drawn and scanned the lines a moment before the next line landed, that line read + /// Drawn a moment before it was set, and the row was left blank for ever. That was the + /// intermittent APictureStopsAtTheFirstLineWithoutItsCells. So a headless app queues the work + /// and runs it on the driving thread: at the next frame, or while + /// is awaited — which is also what lets a Kitty transmit, itself UI work the load waits on, finish. + /// A real run marshals onto the loop exactly as before. + /// + /// + private readonly System.Collections.Concurrent.ConcurrentQueue _headlessImageWork = new(); + + private void OnImageUi(Action action) + { + if (_headless) + { + _headlessImageWork.Enqueue(action); + return; + } + + OnUiThread(action); + } + + private void DrainHeadlessImageWork() + { + while (_headlessImageWork.TryDequeue(out var action)) + { + action(); + } + } + + private async Task SettleHeadlessImagesAsync() + { + while (true) + { + DrainHeadlessImageWork(); + var pending = _inlineImages.Pending; + if (pending.IsCompleted && _headlessImageWork.IsEmpty) + { + return; + } + + await Task.WhenAny(pending, Task.Delay(5)).ConfigureAwait(false); + } + } /// /// Waits for a snapshot scene's pictures — headless only. A Kitty picture is transmitted on the UI thread, @@ -2715,7 +2771,7 @@ private void AwaitSnapshotPictures() { if (_headless) { - _inlineImages.Pending.GetAwaiter().GetResult(); + SettleHeadlessImagesAsync().GetAwaiter().GetResult(); } } From 82ba823ba2761f8ca043ddc20d64c7f84cd2bcc3 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 04:44:09 +0000 Subject: [PATCH 014/113] Desktop window: native Layouts button, vitals gauges and map over the cells The window host draws native views in a layer above the cell view, fed through IPointerPresenter (the scrollbars' channel): a Layouts button over the header's three trailing blank cells, whose menu is built by the client from the layout library's registry commands; native vitals gauges drawn from the VitalsModel the cell strip now renders from; and a native map canvas (zoom, pan, click to walk through the client's speedwalk). The cells underneath are unchanged, so no pane rectangle moves and host parity is untouched. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 8 + CLAUDE.md | 40 ++ src/SharpMUTerm.Avalonia/CellRenderer.cs | 4 +- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 298 ++++++++++++++ src/SharpMUTerm.Avalonia/MainWindow.cs | 3 + src/SharpMUTerm.Avalonia/MapCanvas.cs | 287 ++++++++++++++ src/SharpMUTerm.Avalonia/NativeMenu.cs | 58 +++ src/SharpMUTerm.Avalonia/TerminalView.cs | 79 ++-- src/SharpMUTerm.Avalonia/VitalsGauges.cs | 262 ++++++++++++ src/SharpMUTerm.Avalonia/WindowPointer.cs | 26 ++ .../Commands/BuiltInCommands.cs | 4 + .../Commands/LayoutCommands.cs | 34 ++ src/SharpMUTerm.Client/Panels/MapViewModel.cs | 94 +++++ src/SharpMUTerm.Client/Panels/VitalsModel.cs | 80 ++++ .../Panels/VitalsStripRenderer.cs | 9 + src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 64 ++- .../Pointer/SharpMUTermApp.Desktop.cs | 238 +++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs | 77 ++-- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 26 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 23 +- src/SharpMUTerm.Tui/StatusMeterRenderer.cs | 2 +- .../DesktopLayerTests.cs | 375 ++++++++++++++++++ .../TerminalViewTests.cs | 2 +- .../PanelModelTests.cs | 51 +++ 24 files changed, 2056 insertions(+), 88 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/DesktopLayer.cs create mode 100644 src/SharpMUTerm.Avalonia/MapCanvas.cs create mode 100644 src/SharpMUTerm.Avalonia/NativeMenu.cs create mode 100644 src/SharpMUTerm.Avalonia/VitalsGauges.cs create mode 100644 src/SharpMUTerm.Client/Commands/LayoutCommands.cs create mode 100644 src/SharpMUTerm.Client/Panels/MapViewModel.cs create mode 100644 src/SharpMUTerm.Client/Panels/VitalsModel.cs create mode 100644 src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/PanelModelTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c3266a..3542330f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Desktop window: a Layouts button at the right end of the header opens a menu of the built-in and your saved + layouts (the one in use is checked), with *Save changes*, *Save as new*, *Use for* the world or the character, + and *Manage layouts…*. It runs the same actions as Alt+M. +- Desktop window: the vitals panel is drawn as smooth gauges, with each meter's name and numbers, the low ones + in the warning colour (*Mana · low*) and what you are fighting. A tall vitals pane stacks them; a strip lays + them side by side. +- Desktop window: the map is drawn as a canvas of rooms and exits. The wheel zooms, a drag pans, a + double-click re-centres on you, and a click on a room walks there. Hovering a room shows its name. - Ctrl+P matches as you type by initials and fragments, not only by prefix: `trig sel` finds *Make a trigger from the selection*, and the letters it matched are highlighted. The commands you last ran from it are listed first under RECENT, followed by what the moment suggests (copy while something is selected, back to diff --git a/CLAUDE.md b/CLAUDE.md index 6ddf5c59..3ea32a21 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -923,6 +923,46 @@ fallbacks) for inline images/maps. without taking them. - Screenshots of the window's cues come from a real window under Xvfb, driven with XTest; `--render-png` has no pointer and cannot show them. +- **The window draws native views over the cells, and the cells stay** (`DesktopLayer`, `HeaderButton`, + `VitalsGauges`, `MapCanvas`, `NativeMenu` in Avalonia; `SharpMUTermApp.Desktop.cs`; Client `VitalsModel`, + `MapViewModel`, `LayoutCommands`). First slice of the desktop app: a Layouts button in the header, native vitals + gauges and a native map. Decisions not to relitigate: + - **An overlay, never a cell.** The layer is a `Canvas` above `TerminalView` in the window's root panel; the + client paints every cell exactly as in a terminal underneath, so no pane rectangle moves (NAWS), the parity + test (which compares cells) does not see it, and a host that draws nothing native loses nothing. A native + view covers its pane's output rectangle and paints the pane's own plane, read off the frame's cell there, so + tint and focus show through without the client saying them twice. + - **The channel is `IPointerPresenter`**, the one the scrollbars ride, with two default-implemented members + (`Panels`, `HeaderActions`) so the terminal and the test presenters need no change. `PublishPanels` runs on + `PostBufferPaint` and publishes only on change; a panel is on screen when its window is a realised pane's + front tab. The map's model is rebuilt only when `RenderMap` has run since (`_mapRevisions`), and its walk + callback is one instance per window so an overlay compares equal frame to frame. + - **Data is a view-model both hosts draw.** `ReadVitals` builds the `VitalsModel` that `VitalsStripRenderer` + draws as cells and the gauges draw natively; `VitalsModel.LowShare` is the one low threshold + (`StatusMeterRenderer.LowShare` reads it). `MapViewModel.From` is the current room's area and level, nearest + first, at most 1,500 rooms, names bounded. + - **The window never builds a command.** The Layouts menu is `LayoutsMenuItems()`, built on the client's thread + (`HeaderAction.Menu`), each entry a registry dispatch: `layout:lib:apply:`, `…save`, `…save-new`, + `…use-world`, `…use-character` (a `CommandFamily` that lists nothing on ⌃P — ⌥M is the keyboard's list), plus + `layout:layouts` for *Manage layouts…*. Those ids run the ⌥M list's own methods, which now return a + `LayoutActionResult` the list shows as its status and a command shows as a notice. A map click is + `PanelOverlay.WalkTo` → `WalkFromMap`, the method a cell map's `mux:map:` link ends in. + - **Input, by view.** The header button is the window's alone: press, release, wheel and movement stop at it, + a right press included, and nothing reaches the client (`ThePressOnTheLayoutsButtonNeverReachesTheClient…`). + It never takes focus. It sits over the header's last three cells, which the header always leaves blank + (`right` ends in three spaces), clear of the 5 px resize band, and stands down if any of them holds text. + The vitals gauges are `IsHitTestVisible = false`: every pointer event goes to the cells, so focus, the + pane's menu and selection are the terminal's. The map takes the pointer (wheel zooms about the pointer, + drag pans from the character's room, double-click re-centres, click walks) and hands a right click on to + the client as a right click on the cell (`TerminalView.ForwardRightClick`). + - **Gauges choose their arrangement from the pane's height alone**: stacked blocks when every meter and the + target fit as name-over-bar, else side by side, where the words shrink (`Mana · low 23 / 120`, then + `mp! 23/120`, then `mp 23`) before a bar goes under 24 px. The UI font, not the cell font: this is the window's + presentation. `hp`/`mp`/`mv` read as Health/Mana/Movement (`VitalsMeter.Title`). + - **Not done**: who-here, the quick bar and the composer are still cells in the window; no animation on a + gauge change; the map draws one level and area, no exits between levels and no room colours/symbols; the + button's icon is the only header action. The window's menu is Avalonia's `ContextMenu`, which needs a second + click under a WM-less X server to take the first item (seen under Xvfb only). - **Layouts are realised as panes, one per panel that has data** (`Core/Layouts`: `LayoutFold` → `LayoutRealiser` → `WorkspaceLayout.ReplaceTree`, `LayoutCapture` for the way back; Tui `SharpMUTermApp.Layouts.cs`, diff --git a/src/SharpMUTerm.Avalonia/CellRenderer.cs b/src/SharpMUTerm.Avalonia/CellRenderer.cs index 6c332c04..04f20dff 100644 --- a/src/SharpMUTerm.Avalonia/CellRenderer.cs +++ b/src/SharpMUTerm.Avalonia/CellRenderer.cs @@ -239,14 +239,14 @@ private void DrawCaret(SKCanvas canvas, ScreenFrame frame) } } - private SKColor Background(GridCell cell) + internal SKColor Background(GridCell cell) { var colour = (cell.Decorations & TextDecoration.Invert) != 0 ? cell.Foreground : cell.Background; var fallback = (cell.Decorations & TextDecoration.Invert) != 0 ? DefaultForeground : DefaultBackground; return Resolve(colour, fallback); } - private SKColor Foreground(GridCell cell) + internal SKColor Foreground(GridCell cell) { var inverted = (cell.Decorations & TextDecoration.Invert) != 0; var colour = Resolve(inverted ? cell.Background : cell.Foreground, inverted ? DefaultBackground : DefaultForeground); diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs new file mode 100644 index 00000000..c5821a3c --- /dev/null +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -0,0 +1,298 @@ +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Input; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Tui; +using SkiaSharp; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's native views, in a layer over the : header buttons, and native panels +/// drawn over the panes the client says hold them. The client's cells are painted underneath exactly as in a +/// terminal — nothing here takes a cell, moves a pane or changes what any world is told about its pane's size — +/// so this layer is the window's presentation of the same frame, and the terminal-and-window parity, which +/// compares cells, does not see it. +/// +/// Input. The layer itself has no background and so is never hit: a pointer anywhere it draws nothing goes +/// to the view, and on to the client, as before. A header button is the window's alone — its press, release, +/// movement and wheel stop at it and never reach the client, which is what lets it sit over cells the client +/// would otherwise read as a press on the header. The vitals gauges are a picture of their pane and take no input: +/// a press, a drag, a right-click or the wheel over them reaches the client as a press on the pane's cells, so +/// focus, the pane's menu and selection behave as they do in a terminal. The map is used with the pointer, so it +/// takes it (: zoom, pan, click to walk) and hands only a right click on to the client. +/// +/// +internal sealed class DesktopLayer : Canvas +{ + /// How many header cells a button covers. The header always ends in three blank cells. + internal const int ButtonCells = 3; + + private readonly TerminalView _view; + private readonly WindowPointer _pointer; + private readonly Dictionary _buttons = new(StringComparer.Ordinal); + private readonly Dictionary _gauges = new(StringComparer.Ordinal); + private readonly Dictionary _maps = new(StringComparer.Ordinal); + + public DesktopLayer(TerminalView view) + { + _view = view; + _pointer = view.Driver.Pointer; + ClipToBounds = true; + _pointer.ActionsChanged += () => Dispatcher.UIThread.Post(Sync); + _pointer.PanelsChanged += () => Dispatcher.UIThread.Post(Sync); + _view.Repainted += Sync; + Sync(); + } + + protected override void OnSizeChanged(SizeChangedEventArgs e) + { + base.OnSizeChanged(e); + Sync(); + } + + /// The header button for an action, or null. Internal for tests. + internal HeaderButton? Button(string actionId) => _buttons.GetValueOrDefault(actionId); + + /// The native vitals gauges by window id. Internal for tests. + internal IReadOnlyDictionary Gauges => _gauges; + + /// The native maps by window id. Internal for tests. + internal IReadOnlyDictionary Maps => _maps; + + /// The last header menu opened. Internal for tests. + internal ContextMenu? OpenedMenu { get; private set; } + + /// Puts every native view where the client's last word and the last frame say it goes. + internal void Sync() + { + var frame = _view.Driver.Frame; + var cell = _view.CellExtent; + SyncButtons(frame, cell); + SyncPanels(frame, cell); + } + + private void SyncButtons(ScreenFrame frame, Size cell) + { + var actions = _pointer.Actions; + foreach (var stale in _buttons.Keys.Where(id => actions.All(a => a.Id != id)).ToList()) + { + Children.Remove(_buttons[stale]); + _buttons.Remove(stale); + } + + for (var i = 0; i < actions.Count; i++) + { + var action = actions[i]; + if (!_buttons.TryGetValue(action.Id, out var button)) + { + button = new HeaderButton(action.Id); + button.Click += () => OpenMenu(action, button); + AutomationProperties.SetName(button, action.Label); + ToolTip.SetTip(button, action.Hint is { } hint ? $"{action.Label} ({hint})" : action.Label); + _buttons[action.Id] = button; + Children.Add(button); + } + + // Right to left from the header's end, one slot of blank cells each. Shown only while every cell of + // its slot is blank, so a button never covers a word of the header. + var first = frame.Width - (ButtonCells * (i + 1)); + var blank = first >= 0 && frame.Height > 0 + && Enumerable.Range(first, ButtonCells).All(x => WindowChrome.IsMoveHandle(frame, new System.Drawing.Point(x, 0))); + button.IsVisible = blank; + if (!blank) + { + continue; + } + + // Clear of the window's resize band at the right edge, which a press there is for, and a little over + // half a cell clear of whatever the header says before its blank cells, so it never touches a word. + var gridRight = (first + ButtonCells) * cell.Width; + var right = (Bounds.Width > 0 ? Math.Min(gridRight, Bounds.Width) : gridRight) - WindowChrome.EdgeBand - 1; + var size = Math.Max(8, Math.Min(cell.Height + 2, right - ((first + 0.6) * cell.Width))); + button.Width = size; + button.Height = Math.Max(4, cell.Height - 2); + SetLeft(button, right - size); + SetTop(button, 1); + var behind = _view.Renderer.Background(frame[frame.Width - 1, 0]); + button.Ink = Colour(_view.Renderer.DefaultForeground); + button.Plane = Colour(behind); + } + } + + private void SyncPanels(ScreenFrame frame, Size cell) + { + var text = Colour(_view.Renderer.DefaultForeground); + Place( + _gauges, + _pointer.Panels.Where(p => p.PanelId == PanelIds.Vitals && p.Vitals is { IsEmpty: false }), + () => new VitalsGauges(), + frame, + cell, + (gauges, panel, plane) => gauges.Show(panel.Vitals!, panel.Ink, plane, text, cell.Height)); + Place( + _maps, + _pointer.Panels.Where(p => p.PanelId == PanelIds.Map && p.Map is not null), + () => new MapCanvas(_view), + frame, + cell, + (map, panel, plane) => map.Show(panel.Map!, panel.Ink, plane, text, panel.WalkTo)); + } + + /// + /// One native control per panel window, over that pane's output rectangle; a control whose panel left the + /// screen goes with it. + /// + private void Place( + Dictionary controls, + IEnumerable panels, + Func create, + ScreenFrame frame, + Size cell, + Action show) + where T : Control + { + var wanted = panels.ToList(); + foreach (var stale in controls.Keys.Where(id => wanted.All(p => p.WindowId != id)).ToList()) + { + Children.Remove(controls[stale]); + controls.Remove(stale); + } + + foreach (var panel in wanted) + { + if (!controls.TryGetValue(panel.WindowId, out var control)) + { + control = create(); + controls[panel.WindowId] = control; + + // Under the header buttons, so a button is never covered by a panel. + Children.Insert(0, control); + } + + var rect = panel.Rect; + SetLeft(control, rect.X * cell.Width); + SetTop(control, rect.Y * cell.Height); + control.Width = rect.Width * cell.Width; + control.Height = rect.Height * cell.Height; + + // The pane's own plane, read off the frame, so the native view sits on whatever the pane wears — its + // character's tint, the focus lift — without the client having to say it twice. + var inside = rect.X >= 0 && rect.Y >= 0 && rect.X < frame.Width && rect.Y < frame.Height; + var plane = inside ? _view.Renderer.Background(frame[rect.X, rect.Y]) : _view.Renderer.DefaultBackground; + show(control, panel, Colour(plane)); + } + } + + /// The client builds the menu on its thread; it is opened here, under the button. + private void OpenMenu(HeaderAction action, HeaderButton button) => + action.Menu(items => Dispatcher.UIThread.Post(() => + { + if (items.Count == 0) + { + return; + } + + var menu = NativeMenu.Build(items, PlacementMode.BottomEdgeAlignedRight, button); + menu.Closed += (_, _) => _view.Focus(); + OpenedMenu = menu; + menu.Open(button); + })); + + internal static Color Colour(SKColor colour) => Color.FromRgb(colour.Red, colour.Green, colour.Blue); +} + +/// +/// A small icon-only button drawn by the window over blank header cells. Drawn rather than templated, so it looks +/// the same under any Avalonia theme and its hover plate is the header's own colour lifted, not a theme's grey. +/// It never takes keyboard focus: typing stays with the client. +/// +internal sealed class HeaderButton : Control +{ + private bool _pressed; + + public HeaderButton(string actionId) + { + ActionId = actionId; + Focusable = false; + Cursor = new Cursor(StandardCursorType.Hand); + } + + public string ActionId { get; } + + public Color Ink { get; set; } = Colors.White; + + public Color Plane { get; set; } = Colors.Black; + + /// Raised on a left click. + public event Action? Click; + + protected override void OnPointerEntered(PointerEventArgs e) + { + base.OnPointerEntered(e); + InvalidateVisual(); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + InvalidateVisual(); + } + + // Every pointer event over the button is the window's: handled here, so nothing routes on to the client. + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + _pressed = e.GetCurrentPoint(this).Properties.IsLeftButtonPressed; + e.Handled = true; + InvalidateVisual(); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + var click = _pressed && e.InitialPressMouseButton == MouseButton.Left && new Rect(Bounds.Size).Contains(e.GetPosition(this)); + _pressed = false; + InvalidateVisual(); + if (click) + { + Click?.Invoke(); + } + } + + protected override void OnPointerWheelChanged(PointerWheelEventArgs e) + { + base.OnPointerWheelChanged(e); + e.Handled = true; + } + + /// Clicks the button as a left press and release would. Internal for tests. + internal void PerformClick() => Click?.Invoke(); + + public override void Render(DrawingContext context) + { + var bounds = new Rect(Bounds.Size); + + // A plate that says "this is a control" at rest, a stronger one under the pointer and while pressed. + var plate = (byte)(_pressed ? 0x55 : IsPointerOver ? 0x38 : 0x16); + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(plate, Ink.R, Ink.G, Ink.B)), null, bounds, 4, 4); + + // The layouts glyph: a frame split into a wide pane and a column of two, the shape of a layout. + var pen = new Pen(new SolidColorBrush(Color.FromArgb(0xE0, Ink.R, Ink.G, Ink.B)), 1.25); + var w = Math.Min(bounds.Width - 6, 14); + var h = Math.Min(bounds.Height - 6, 11); + var x = Math.Round((bounds.Width - w) / 2) + 0.5; + var y = Math.Round((bounds.Height - h) / 2) + 0.5; + var icon = new Rect(x, y, w, h); + context.DrawRectangle(null, pen, icon, 1.5, 1.5); + var split = Math.Round(x + (w * 0.58)) + 0.5; + context.DrawLine(pen, new Point(split, y), new Point(split, y + h)); + var middle = Math.Round(y + (h / 2)) + 0.5; + context.DrawLine(pen, new Point(split, middle), new Point(x + w, middle)); + } +} diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index 72326822..c0af46a8 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -61,6 +61,9 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime } root.Children.Add(_view); + + // The window's native views over the cells: the header's Layouts button and native panels (DesktopLayer). + root.Children.Add(new DesktopLayer(_view)); Content = root; AutomationProperties.SetName(_view, "SharpMUTerm"); var size = _view.SizeFor(options.Columns, options.Rows); diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs new file mode 100644 index 00000000..3e718b04 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -0,0 +1,287 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The map as a native canvas, over the pane whose cells draw the same recorder: rooms as rounded squares joined by +/// their exits, the current room in the accent, the rooms a walk still goes through outlined in the draft colour. +/// +/// It takes the pointer, unlike the vitals gauges, because a map is used with it: the wheel zooms about the +/// pointer, a drag pans, and a click on a room walks there — through , which is the +/// client's speedwalk for the map's own character, the path a click on a cell map takes. The window never builds a +/// command. A right click is handed on to the client as a right click on the cell under it +/// (), so the pane's menu is the same here as over cells. The view is +/// centred on the character and follows them; a pan is an offset from there, and a double-click puts it back. +/// +/// +internal sealed class MapCanvas : Control +{ + /// Pixels between room centres at zoom 1. + internal const double Spacing = 34; + + private const double MinZoom = 0.35, MaxZoom = 3, DragThreshold = 4; + + private readonly TerminalView _view; + private MapViewModel _model = new(null, 0, [], [], null); + private PanelInk _ink = new("#5fafff", "#ffaf5f", "#6a6a72"); + private Color _plane = Colors.Black; + private Color _text = Colors.White; + private Action? _walkTo; + private Vector _pan; + private Point? _pressAt; + private Vector _panAtPress; + private bool _dragging; + private long? _hovered; + + public MapCanvas(TerminalView view) + { + _view = view; + ClipToBounds = true; + Focusable = false; + Cursor = new Cursor(StandardCursorType.Arrow); + } + + /// The zoom, 1 at pixels between rooms. Internal for tests. + internal double Zoom { get; private set; } = 1; + + /// The pan from the character's room, in pixels. Internal for tests. + internal Vector Pan => _pan; + + /// What it is showing. Internal for tests. + internal MapViewModel Model => _model; + + public void Show(MapViewModel model, PanelInk ink, Color plane, Color text, Action? walkTo) + { + _walkTo = walkTo; + if (model.Equals(_model) && ink == _ink && plane == _plane && text == _text) + { + return; + } + + _model = model; + _ink = ink; + _plane = plane; + _text = text; + InvalidateVisual(); + } + + /// Where a room's centre is drawn, in this control's coordinates. + internal Point CentreOf(MapViewRoom room) + { + var anchor = _model.Current ?? _model.Rooms.FirstOrDefault(); + var step = Spacing * Zoom; + var middle = new Point(Bounds.Width / 2, Bounds.Height / 2) + _pan; + return anchor is null + ? middle + : new Point(middle.X + ((room.X - anchor.X) * step), middle.Y + ((room.Y - anchor.Y) * step)); + } + + private double RoomSize => Math.Max(5, Spacing * Zoom * 0.56); + + /// The room under a point, or null. + internal MapViewRoom? RoomAt(Point point) + { + var half = (RoomSize / 2) + 2; + return _model.Rooms.FirstOrDefault(r => + { + var c = CentreOf(r); + return Math.Abs(point.X - c.X) <= half && Math.Abs(point.Y - c.Y) <= half; + }); + } + + // ── Input: the canvas's own, never routed on to the cells (bar the right click) ────────────── + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + var point = e.GetCurrentPoint(this); + e.Handled = true; + if (point.Properties.IsRightButtonPressed) + { + _view.ForwardRightClick(e.GetPosition(_view), e.KeyModifiers); + return; + } + + if (!point.Properties.IsLeftButtonPressed) + { + return; + } + + if (e.ClickCount == 2) + { + _pan = default; + InvalidateVisual(); + return; + } + + _pressAt = point.Position; + _panAtPress = _pan; + _dragging = false; + e.Pointer.Capture(this); + } + + protected override void OnPointerMoved(PointerEventArgs e) + { + base.OnPointerMoved(e); + e.Handled = true; + var position = e.GetPosition(this); + if (_pressAt is { } from) + { + var moved = position - from; + if (_dragging || Math.Abs(moved.X) + Math.Abs(moved.Y) > DragThreshold) + { + _dragging = true; + _pan = _panAtPress + moved; + Cursor = new Cursor(StandardCursorType.SizeAll); + InvalidateVisual(); + } + + return; + } + + var room = RoomAt(position); + if (room?.Id != _hovered) + { + _hovered = room?.Id; + Cursor = new Cursor(room is null ? StandardCursorType.Arrow : StandardCursorType.Hand); + ToolTip.SetTip(this, room is null ? null : room.Current ? $"{room.Name} — you are here" : $"{room.Name} — click to walk here"); + InvalidateVisual(); + } + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + if (_pressAt is null) + { + return; + } + + var wasDrag = _dragging; + _pressAt = null; + _dragging = false; + e.Pointer.Capture(null); + Cursor = new Cursor(StandardCursorType.Arrow); + if (!wasDrag && e.InitialPressMouseButton == MouseButton.Left && RoomAt(e.GetPosition(this)) is { Current: false } room) + { + _walkTo?.Invoke(room.Id); + } + } + + protected override void OnPointerWheelChanged(PointerWheelEventArgs e) + { + base.OnPointerWheelChanged(e); + e.Handled = true; + ZoomAbout(e.GetPosition(this), e.Delta.Y); + } + + /// Zooms by about , keeping what is under it there. + internal void ZoomAbout(Point point, double notches) + { + var next = Math.Clamp(Zoom * Math.Pow(1.18, notches), MinZoom, MaxZoom); + if (Math.Abs(next - Zoom) < 1e-9) + { + return; + } + + // The centre is middle + pan; a point at offset d from it moves to d·ratio, so the pan takes up the difference. + var middle = new Point(Bounds.Width / 2, Bounds.Height / 2); + var ratio = next / Zoom; + var fromCentre = point - (middle + _pan); + _pan = point - middle - (fromCentre * ratio); + Zoom = next; + InvalidateVisual(); + } + + // ── Drawing ─────────────────────────────────────────────────────────────────────────────── + + public override void Render(DrawingContext context) + { + var bounds = new Rect(Bounds.Size); + context.FillRectangle(new SolidColorBrush(_plane), bounds); + if (_model.Rooms.Count == 0) + { + DrawText(context, "No rooms mapped yet — walk somewhere.", new Point(12, 10), 12, Faded(0.7)); + return; + } + + var byId = _model.Rooms.ToDictionary(r => r.Id); + var exitPen = new Pen(new SolidColorBrush(Faded(0.42)), Math.Clamp(1.6 * Zoom, 1, 2.5), lineCap: PenLineCap.Round); + foreach (var exit in _model.Exits) + { + if (byId.TryGetValue(exit.From, out var a) && byId.TryGetValue(exit.To, out var b)) + { + context.DrawLine(exitPen, CentreOf(a), CentreOf(b)); + } + } + + var size = RoomSize; + var accent = Parse(_ink.Bar); + var path = Parse(_ink.Low); + var plainFill = new SolidColorBrush(Mix(_plane, _text, 0.16)); + var plainEdge = new Pen(new SolidColorBrush(Faded(0.55)), 1.2); + var radius = size * 0.22; + foreach (var room in _model.Rooms) + { + var c = CentreOf(room); + var rect = new Rect(c.X - (size / 2), c.Y - (size / 2), size, size); + if (!rect.Intersects(bounds)) + { + continue; + } + + if (room.Current) + { + // A soft halo, then the room in the accent: the one thing the eye should find first. + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x40, accent.R, accent.G, accent.B)), null, rect.Inflate(size * 0.22), radius * 1.6, radius * 1.6); + context.DrawRectangle(new SolidColorBrush(accent), new Pen(new SolidColorBrush(Mix(accent, Colors.White, 0.35)), 1.5), rect, radius, radius); + continue; + } + + var fill = room.Id == _hovered ? new SolidColorBrush(Mix(_plane, _text, 0.3)) : plainFill; + var edge = room.Ahead ? new Pen(new SolidColorBrush(path), 2) : plainEdge; + context.DrawRectangle(fill, edge, rect, radius, radius); + if (room.Locked) + { + var lockPen = new Pen(new SolidColorBrush(Faded(0.6)), 1.2); + context.DrawLine(lockPen, rect.TopLeft + new Vector(size * 0.25, size * 0.25), rect.BottomRight - new Vector(size * 0.25, size * 0.25)); + } + } + + // What and where, in the corner: the area and level, and a walk under way. + var label = _model.Area is { Length: > 0 } area ? $"{area} · level {_model.Level}" : $"level {_model.Level}"; + DrawText(context, label, new Point(10, 8), 12, Faded(0.75)); + if (_model.Walking is { } walking) + { + DrawText(context, walking, new Point(10, 26), 12, path); + } + else if (_model.Current is { } here) + { + DrawText(context, here.Name, new Point(10, 26), 12, accent); + } + } + + private static void DrawText(DrawingContext context, string text, Point at, double size, Color colour) => + context.DrawText( + new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Typeface.Default, size, new SolidColorBrush(colour)) + { + MaxLineCount = 1, + }, + at); + + private Color Faded(double opacity) => Color.FromArgb((byte)(opacity * 255), _text.R, _text.G, _text.B); + + private static Color Parse(string hex) => Color.TryParse(hex, out var colour) ? colour : Colors.Gray; + + private static Color Mix(Color from, Color to, double amount) => Color.FromRgb( + (byte)(from.R + ((to.R - from.R) * amount)), + (byte)(from.G + ((to.G - from.G) * amount)), + (byte)(from.B + ((to.B - from.B) * amount))); +} diff --git a/src/SharpMUTerm.Avalonia/NativeMenu.cs b/src/SharpMUTerm.Avalonia/NativeMenu.cs new file mode 100644 index 00000000..63aa6a4a --- /dev/null +++ b/src/SharpMUTerm.Avalonia/NativeMenu.cs @@ -0,0 +1,58 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Layout; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// A menu the client built (s), as a native : the right-click +/// menu and the header buttons' menus are drawn by this one function, so they look and behave alike. Each entry's +/// is already marshalled onto the client's thread. +/// +internal static class NativeMenu +{ + public static ContextMenu Build(IReadOnlyList items, PlacementMode placement, Control target) + { + var menu = new ContextMenu { Placement = placement, PlacementTarget = target }; + Grid.SetIsSharedSizeScope(menu, true); + foreach (var item in items) + { + if (item.IsSeparator) + { + menu.Items.Add(new Separator()); + continue; + } + + var entry = new MenuItem { Header = Header(item), IsEnabled = item.Enabled }; + if (item.Checked) + { + entry.ToggleType = MenuItemToggleType.CheckBox; + entry.IsChecked = true; + } + + entry.Click += (_, _) => item.Run(); + menu.Items.Add(entry); + } + + return menu; + } + + /// An entry's label with its key after it, the keys lined up in a column of their own. + private static Control Header(PointerMenuItem item) + { + var grid = new Grid(); + grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "label" }); + grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "hint" }); + grid.Children.Add(new TextBlock { Text = item.Label, VerticalAlignment = VerticalAlignment.Center }); + if (item.Hint is { } hint) + { + var key = new TextBlock { Text = hint, Opacity = 0.6, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; + Grid.SetColumn(key, 1); + grid.Children.Add(key); + } + + return grid; + } +} diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index 7a8a79c8..b005384a 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -93,6 +93,21 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba pointer.MenuRequested += (_, items) => Dispatcher.UIThread.Post(() => OpenMenu(items)); } + /// The cell size in logical units, for placing a native view over cells (). + internal Size CellExtent => CellSize; + + /// What draws the cells, for a native view that matches their colours. + internal CellRenderer Renderer => _renderer; + + /// The driver this view paints. + internal AvaloniaConsoleDriver Driver => _driver; + + /// + /// Raised on the window's thread after a new frame is taken for painting, and when the cell size or the view's + /// size changes: when anything placed over cells may need to move. + /// + internal event Action? Repainted; + /// The cell size in logical units, for mapping a pointer position to a cell. private Size CellSize => new(_renderer.Fonts.CellWidth / _scale, _renderer.Fonts.CellHeight / _scale); @@ -117,6 +132,7 @@ protected override void OnSizeChanged(SizeChangedEventArgs e) base.OnSizeChanged(e); var (columns, rows) = GridFor(e.NewSize); _driver.Resize(columns, rows); + Repainted?.Invoke(); } public override void Render(DrawingContext context) @@ -152,6 +168,7 @@ private void Rescale(double scale) new CellFonts((float)(_fontPoints * scale), _family), _renderer.DefaultForeground, _renderer.DefaultBackground); + Repainted?.Invoke(); } private void OnFrameReady() @@ -163,6 +180,7 @@ private void OnFrameReady() { Volatile.Write(ref _invalidatePending, 0); InvalidateVisual(); + Repainted?.Invoke(); }, DispatcherPriority.Render); } } @@ -258,14 +276,7 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) var modifiers = Modifiers(e.KeyModifiers); if (button == PointerButton.Right) { - // The client answers a right press with a menu, which takes the pointer, so this view never sees the - // release: the click is sent whole, and nothing is left held to repeat or to turn into a drag. - _driver.RaiseMouse(_mouse.Pressed(button, cell, 1, modifiers), cell); - if (_mouse.Released(button, cell, modifiers) is { } released) - { - _driver.RaiseMouse(released, cell); - } - + SendRightClick(cell, modifiers); e.Handled = true; return; } @@ -276,6 +287,25 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) e.Handled = true; } + /// + /// A right click on a cell, sent whole. The client answers a right press with a menu, which takes the pointer, so + /// the release would never arrive: nothing is left held to repeat or to turn into a drag. + /// + private void SendRightClick(System.Drawing.Point cell, PointerModifiers modifiers) + { + _driver.RaiseMouse(_mouse.Pressed(PointerButton.Right, cell, 1, modifiers), cell); + if (_mouse.Released(PointerButton.Right, cell, modifiers) is { } released) + { + _driver.RaiseMouse(released, cell); + } + } + + /// + /// A right click a native view over the cells took and hands on (), so the pane's menu is + /// the same over a native view as over its cells. is in this view's coordinates. + /// + internal void ForwardRightClick(Point position, KeyModifiers keys) => SendRightClick(Cell(position), Modifiers(keys)); + protected override void OnPointerMoved(PointerEventArgs e) { base.OnPointerMoved(e); @@ -475,43 +505,12 @@ private void CloseTip() private void OpenMenu(IReadOnlyList items) { CloseTip(); - var menu = new ContextMenu { Placement = PlacementMode.Pointer, PlacementTarget = this }; - Grid.SetIsSharedSizeScope(menu, true); - foreach (var item in items) - { - if (item.IsSeparator) - { - menu.Items.Add(new Separator()); - continue; - } - - var entry = new MenuItem { Header = MenuHeader(item), IsEnabled = item.Enabled }; - entry.Click += (_, _) => item.Run(); - menu.Items.Add(entry); - } - + var menu = NativeMenu.Build(items, PlacementMode.Pointer, this); menu.Closed += (_, _) => Focus(); OpenedMenu = menu; menu.Open(this); } - /// A menu entry's label with its key after it, the keys lined up in a column of their own. - private static Control MenuHeader(PointerMenuItem item) - { - var grid = new Grid(); - grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "label" }); - grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "hint" }); - grid.Children.Add(new TextBlock { Text = item.Label, VerticalAlignment = VerticalAlignment.Center }); - if (item.Hint is { } hint) - { - var key = new TextBlock { Text = hint, Opacity = 0.6, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; - Grid.SetColumn(key, 1); - grid.Children.Add(key); - } - - return grid; - } - // ── Scrollbars ────────────────────────────────────────────────────────────────────────────── /// diff --git a/src/SharpMUTerm.Avalonia/VitalsGauges.cs b/src/SharpMUTerm.Avalonia/VitalsGauges.cs new file mode 100644 index 00000000..5563ec14 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/VitalsGauges.cs @@ -0,0 +1,262 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Media; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The vitals panel as native gauges, over the pane whose cells draw the same as a strip: +/// a smooth bar per meter with its name and numbers, Mana · low in the warning colour, and what the +/// character is fighting. Drawn in the window's UI font, not the cell font — this is the window's presentation. +/// +/// Two arrangements, chosen from the pane's height alone, so a number arriving never re-arranges it: a pane +/// tall enough for every meter as a block of its own (name and numbers over the bar — the combat layout's side +/// column) stacks them; anything shorter (the strip a layout puts over the output) lays them side by side, each a +/// name, a bar and its numbers. +/// +/// It takes no input (see ): the pane under it is the client's. +/// +internal sealed class VitalsGauges : Control +{ + private VitalsModel _model = VitalsModel.Empty; + private PanelInk _ink = new("#5fafff", "#ff5f5f", "#3a3a40"); + private Color _plane = Colors.Black; + private Color _text = Colors.White; + private double _cellHeight = 16; + + public VitalsGauges() + { + IsHitTestVisible = false; + ClipToBounds = true; + } + + /// What it is showing. Internal for tests. + internal VitalsModel Model => _model; + + /// Whether the meters are stacked (true) or side by side. Internal for tests. + internal bool Stacked => StackedFor(Bounds.Height > 0 ? Bounds.Height : Height, _model); + + /// The bars drawn on the last render, in order: each bar's track and filled part. Internal for tests. + internal IReadOnlyList<(Rect Track, Rect Fill, bool Low)> DrawnBars => _drawn; + + private readonly List<(Rect Track, Rect Fill, bool Low)> _drawn = []; + + public void Show(VitalsModel model, PanelInk ink, Color plane, Color text, double cellHeight) + { + if (model.Equals(_model) && ink == _ink && plane == _plane && text == _text && Math.Abs(cellHeight - _cellHeight) < 0.01) + { + return; + } + + _model = model; + _ink = ink; + _plane = plane; + _text = text; + _cellHeight = cellHeight; + InvalidateVisual(); + } + + /// Height one stacked block takes: a line of text and a bar under it. + private static double BlockHeight(double cellHeight) => Math.Max(30, cellHeight * 2.1); + + private bool StackedFor(double height, VitalsModel model) + { + var blocks = model.Meters.Count + (model.Target is null ? 0 : 1); + return blocks > 0 && height >= (blocks * BlockHeight(_cellHeight)) + 8; + } + + public override void Render(DrawingContext context) + { + var bounds = new Rect(Bounds.Size); + _drawn.Clear(); + + // The plane covers the cells under it: the strip is drawn by this, not beside it. + context.FillRectangle(new SolidColorBrush(_plane), bounds); + if (bounds.Width < 8 || bounds.Height < 4 || _model.IsEmpty) + { + return; + } + + if (StackedFor(bounds.Height, _model)) + { + RenderStacked(context, bounds); + } + else + { + RenderRow(context, bounds); + } + } + + private void RenderStacked(DrawingContext context, Rect bounds) + { + var block = BlockHeight(_cellHeight); + var size = Math.Clamp(_cellHeight * 0.68, 10, 15); + var barHeight = Math.Clamp(_cellHeight * 0.45, 6, 10); + var inner = bounds.Deflate(new Thickness(12, 8)); + var y = inner.Top; + foreach (var meter in _model.Meters) + { + var low = meter.Low; + var title = low ? $"{meter.Title} · low" : meter.Title; + DrawText(context, title, new Point(inner.Left, y), size, low ? Parse(_ink.Low) : Dim(), bold: low, alignRight: false, inner.Width); + DrawText(context, Numbers(meter), new Point(inner.Right, y), size, _text, bold: true, alignRight: true, inner.Width); + var bar = new Rect(inner.Left, y + (size * 1.45), inner.Width, barHeight); + DrawBar(context, bar, meter.HasMax ? meter.Share ?? 0 : 1, low); + y += block; + } + + if (_model.Target is { } target) + { + DrawText(context, $"Target · {target.Name}", new Point(inner.Left, y), size, Dim(), bold: false, alignRight: false, inner.Width * 0.75); + if (target.Share is { } share) + { + DrawText(context, Percent(share), new Point(inner.Right, y), size, _text, bold: true, alignRight: true, inner.Width); + DrawBar(context, new Rect(inner.Left, y + (size * 1.45), inner.Width, barHeight), share, target.Low); + } + } + } + + /// The narrowest a side-by-side bar is drawn; below it the words get shorter first. + private const double MinimumBar = 24; + + private void RenderRow(DrawingContext context, Rect bounds) + { + var size = Math.Clamp(_cellHeight * 0.62, 9, 14); + var barHeight = Math.Clamp(bounds.Height * 0.32, 4, 9); + var inner = bounds.Deflate(new Thickness(10, 0)); + var gap = 18.0; + var shares = _model.Meters.Count + (_model.Target is null ? 0 : 1.4); + var unit = (inner.Width - (gap * Math.Max(0, Math.Ceiling(shares) - 1))) / shares; + var middle = bounds.Height / 2; + var top = middle - (size * 0.65); + + // The words shrink before the bars do, one step for every meter at once so the row reads as one: + // "Mana · low 23 / 120", then "mp! 23/120", then "mp 23". + static (string Title, string Numbers) Words(VitalsMeter m, int step) => step switch + { + 0 => (m.Low ? $"{m.Title} · low" : m.Title, Numbers(m)), + 1 => (m.Low ? $"{m.Label}!" : m.Label, m.HasMax ? $"{m.Value}/{m.Max ?? "?"}" : m.Value), + _ => (m.Label, m.Value), + }; + + var step = 0; + while (step < 2 && _model.Meters.Any(m => + { + var (t, n) = Words(m, step); + return unit - Measure(t, size, m.Low) - Measure(n, size, true) - 16 < MinimumBar; + })) + { + step++; + } + + var x = inner.Left; + foreach (var meter in _model.Meters) + { + var low = meter.Low; + var (title, numbers) = Words(meter, step); + var titleWidth = DrawText(context, title, new Point(x, top), size, low ? Parse(_ink.Low) : Dim(), bold: low, alignRight: false, unit * 0.45); + var numbersWidth = DrawText(context, numbers, new Point(x + unit, top), size, _text, bold: true, alignRight: true, unit * 0.45); + var barLeft = x + titleWidth + 8; + var barRight = x + unit - numbersWidth - 8; + if (barRight - barLeft >= 8) + { + DrawBar(context, new Rect(barLeft, middle - (barHeight / 2), barRight - barLeft, barHeight), meter.HasMax ? meter.Share ?? 0 : 1, low); + } + + x += unit + gap; + } + + if (_model.Target is { } target) + { + var width = inner.Right - x; + var pct = target.Share is { } s ? Percent(s) : null; + var pctWidth = pct is null ? 0 : Measure(pct, size, true); + var room = pct is null ? width : width - pctWidth - 16 - MinimumBar; + var nameWidth = DrawText(context, step == 0 ? $"Target · {target.Name}" : target.Name, new Point(x, top), size, Dim(), bold: false, alignRight: false, Math.Max(8, room)); + if (pct is not null) + { + DrawText(context, pct, new Point(inner.Right, top), size, _text, bold: true, alignRight: true, width); + var barLeft = x + nameWidth + 8; + var barRight = inner.Right - pctWidth - 8; + if (barRight - barLeft >= 8) + { + DrawBar(context, new Rect(barLeft, middle - (barHeight / 2), barRight - barLeft, barHeight), target.Share!.Value, target.Low); + } + } + } + } + + private static double Measure(string text, double size, bool bold) => Format(text, size, Colors.White, bold, double.PositiveInfinity).Width; + + private static FormattedText Format(string text, double size, Color colour, bool bold, double maxWidth) + { + var formatted = new FormattedText( + text, + CultureInfo.InvariantCulture, + FlowDirection.LeftToRight, + new Typeface(FontFamily.Default, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), + size, + new SolidColorBrush(colour)) + { + MaxLineCount = 1, + Trimming = TextTrimming.CharacterEllipsis, + }; + if (!double.IsInfinity(maxWidth)) + { + formatted.MaxTextWidth = Math.Max(1, maxWidth); + } + + return formatted; + } + + private void DrawBar(DrawingContext context, Rect track, double share, bool low) + { + var radius = track.Height / 2; + context.DrawRectangle(new SolidColorBrush(Parse(_ink.Track)), null, track, radius, radius); + var fill = new Rect(track.X, track.Y, track.Width * Math.Clamp(share, 0, 1), track.Height); + if (fill.Width > 0.5) + { + var colour = Parse(low ? _ink.Low : _ink.Bar); + var brush = new LinearGradientBrush + { + StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative), + EndPoint = new RelativePoint(0, 1, RelativeUnit.Relative), + GradientStops = + { + new GradientStop(Lighten(colour, 0.18), 0), + new GradientStop(colour, 1), + }, + }; + context.DrawRectangle(brush, null, fill, radius, radius); + } + + _drawn.Add((track, fill, low)); + } + + /// Draws text at (its right edge there when right-aligned) and returns its width. + private static double DrawText(DrawingContext context, string text, Point at, double size, Color colour, bool bold, bool alignRight, double maxWidth) + { + var formatted = Format(text, size, colour, bold, maxWidth); + var width = Math.Min(formatted.Width, Math.Max(1, maxWidth)); + context.DrawText(formatted, alignRight ? new Point(at.X - width, at.Y) : at); + return width; + } + + private static string Numbers(VitalsMeter meter) => + meter.HasMax ? $"{meter.Value} / {meter.Max ?? "?"}" : meter.Value; + + private static string Percent(double share) => + $"{Math.Clamp((int)Math.Round(share * 100), 0, 999).ToString(CultureInfo.InvariantCulture)}%"; + + private Color Dim() => Color.FromArgb(0xB0, _text.R, _text.G, _text.B); + + private static Color Parse(string hex) => Color.TryParse(hex, out var colour) ? colour : Colors.Gray; + + private static Color Lighten(Color colour, double amount) => Color.FromRgb( + (byte)(colour.R + ((255 - colour.R) * amount)), + (byte)(colour.G + ((255 - colour.G) * amount)), + (byte)(colour.B + ((255 - colour.B) * amount))); +} diff --git a/src/SharpMUTerm.Avalonia/WindowPointer.cs b/src/SharpMUTerm.Avalonia/WindowPointer.cs index 590c910a..3b4d5329 100644 --- a/src/SharpMUTerm.Avalonia/WindowPointer.cs +++ b/src/SharpMUTerm.Avalonia/WindowPointer.cs @@ -11,6 +11,8 @@ internal sealed class WindowPointer : IPointerPresenter { private PointerTarget _target = PointerTarget.Nothing; private IReadOnlyList _bars = []; + private IReadOnlyList _panels = []; + private IReadOnlyList _actions = []; /// What the pointer is over, as of the client's last word. public PointerTarget Target => Volatile.Read(ref _target); @@ -18,6 +20,18 @@ internal sealed class WindowPointer : IPointerPresenter /// The panes' scroll positions, as of the client's last word. public IReadOnlyList Bars => Volatile.Read(ref _bars); + /// The panels on screen the window draws natively, as of the client's last word. + public IReadOnlyList Panels => Volatile.Read(ref _panels); + + /// The header buttons the client offers, said once at start. + public IReadOnlyList Actions => Volatile.Read(ref _actions); + + /// Raised on the client's thread when changes. + public event Action? PanelsChanged; + + /// Raised on the client's thread when changes. + public event Action? ActionsChanged; + /// Raised on the client's thread when changes. public event Action? HoverChanged; @@ -42,4 +56,16 @@ public void Scrollbars(IReadOnlyList bars) Volatile.Write(ref _bars, bars); ScrollbarsChanged?.Invoke(bars); } + + void IPointerPresenter.Panels(IReadOnlyList panels) + { + Volatile.Write(ref _panels, panels); + PanelsChanged?.Invoke(); + } + + void IPointerPresenter.HeaderActions(IReadOnlyList actions) + { + Volatile.Write(ref _actions, actions); + ActionsChanged?.Invoke(); + } } diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index ea1aede6..b75be21f 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -201,6 +201,10 @@ void Family(string id, string prefix, Func []); + // Pane size, in the plain words the request used ("increase/decrease a pane's horizontal or // vertical character size") rather than in the chord's terms. Listed for the same reason the // directional entries and the newline chord are: ⌥⇧+arrow is not a chord anybody guesses, and a diff --git a/src/SharpMUTerm.Client/Commands/LayoutCommands.cs b/src/SharpMUTerm.Client/Commands/LayoutCommands.cs new file mode 100644 index 00000000..a4c10159 --- /dev/null +++ b/src/SharpMUTerm.Client/Commands/LayoutCommands.cs @@ -0,0 +1,34 @@ +namespace SharpMUTerm.Client.Commands; + +/// +/// The ids of the layout library's commands: the ⌥M list's actions, as commands, so any surface — the window's +/// native Layouts menu now, a package later — runs them through the registry instead of re-implementing them. +/// They act on the focused character, and on the layout it is using unless the id names one. +/// +/// They are a family that generates no ⌃P entries: ⌥M is where a reader picks a layout from the keyboard, and +/// Layouts (layout:layouts) is the ⌃P entry that opens it. +/// +/// +public static class LayoutCommands +{ + /// The prefix every layout-library id shares. + public const string Prefix = "layout:lib:"; + + /// Prefix of "apply this layout to the focused character's panes"; the remainder is the layout id. + public const string ApplyPrefix = Prefix + "apply:"; + + /// Saves the panes as they are into the layout in use (a built-in is saved as a copy). + public const string SaveChanges = Prefix + "save"; + + /// Saves the panes as they are as a new layout of the player's own. + public const string SaveAsNew = Prefix + "save-new"; + + /// Makes the layout in use the focused character's world's default. + public const string UseForWorld = Prefix + "use-world"; + + /// Makes the layout in use the focused character's own, whatever its world uses. + public const string UseForCharacter = Prefix + "use-character"; + + /// The id that applies . + public static string Apply(string layoutId) => ApplyPrefix + layoutId; +} diff --git a/src/SharpMUTerm.Client/Panels/MapViewModel.cs b/src/SharpMUTerm.Client/Panels/MapViewModel.cs new file mode 100644 index 00000000..5f301d88 --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/MapViewModel.cs @@ -0,0 +1,94 @@ +using SharpMUTerm.Core.Mapping; + +namespace SharpMUTerm.Client.Panels; + +/// One room as a map view draws it, at its map coordinates (y grows southwards, as the cell map draws it). +/// The room's id, which a click hands back to walk there. +/// The room's name, bounded; the game's text. +/// Its column on the map. +/// Its row on the map; north is smaller. +/// Whether the character is in it. +/// Whether a walk under way still goes through it. +/// Whether the player locked it out of paths. +public sealed record MapViewRoom(long Id, string Name, int X, int Y, bool Current, bool Ahead, bool Locked); + +/// A drawn exit between two rooms of the view, once per pair. +public sealed record MapViewExit(long From, long To); + +/// +/// The part of a character's map a view draws: the rooms of the current room's area on its level, nearest the +/// current room first and bounded, with the exits between them. The terminal draws its map from the recorder in +/// cells (MapRenderer); the window draws this as a canvas over the same pane. A click on a room is handed +/// back by id to the client, which walks there through the same speedwalk a cell click uses. +/// +public sealed record MapViewModel(string? Area, int Level, IReadOnlyList Rooms, IReadOnlyList Exits, string? Walking) +{ + /// The most rooms a view is given: the nearest to the current room are kept. + public const int MaxRooms = 1500; + + /// The longest room name a view is given. + public const int MaxNameLength = 80; + + /// The room the character is in, or null. + public MapViewRoom? Current => Rooms.FirstOrDefault(r => r.Current); + + /// + /// The view of around . With no current room, the level + /// and area of the most recently added room are drawn, so a map recorded earlier still shows. + /// + public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerable ahead, string? walking) + { + ArgumentNullException.ThrowIfNull(map); + var anchor = currentRoomId is { } id ? map.Room(id) : null; + anchor ??= map.Rooms.Values.LastOrDefault(); + if (anchor is null) + { + return new MapViewModel(null, 0, [], [], walking); + } + + var path = ahead.ToHashSet(); + var rooms = map.Rooms.Values + .Where(r => r.Z == anchor.Z && r.AreaId == anchor.AreaId) + .OrderBy(r => Math.Abs(r.X - anchor.X) + Math.Abs(r.Y - anchor.Y)) + .ThenBy(r => r.Id) + .Take(MaxRooms) + .Select(r => new MapViewRoom( + r.Id, + r.Name.Length <= MaxNameLength ? r.Name : r.Name[..(MaxNameLength - 1)] + "…", + r.X, + r.Y, + r.Id == currentRoomId, + path.Contains(r.Id), + r.Locked)) + .ToList(); + var ids = rooms.Select(r => r.Id).ToHashSet(); + var exits = new List(); + var seen = new HashSet<(long, long)>(); + foreach (var room in rooms) + { + foreach (var (_, _, to) in map.Room(room.Id)!.AllExits()) + { + if (to == room.Id || !ids.Contains(to)) + { + continue; + } + + var pair = room.Id < to ? (room.Id, to) : (to, room.Id); + if (seen.Add(pair)) + { + exits.Add(new MapViewExit(pair.Item1, pair.Item2)); + } + } + } + + var area = anchor.AreaId is { } areaId && map.Areas.TryGetValue(areaId, out var named) ? named.Name : null; + return new MapViewModel(area, anchor.Z, rooms, exits, walking); + } + + /// Value equality over the rooms and exits, which a record's list members do not give. + public bool Equals(MapViewModel? other) => + other is not null && Area == other.Area && Level == other.Level && Walking == other.Walking + && Rooms.SequenceEqual(other.Rooms) && Exits.SequenceEqual(other.Exits); + + public override int GetHashCode() => HashCode.Combine(Area, Level, Walking, Rooms.Count, Exits.Count); +} diff --git a/src/SharpMUTerm.Client/Panels/VitalsModel.cs b/src/SharpMUTerm.Client/Panels/VitalsModel.cs new file mode 100644 index 00000000..17d66134 --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/VitalsModel.cs @@ -0,0 +1,80 @@ +using SharpMUTerm.Core.Protocols; + +namespace SharpMUTerm.Client.Panels; + +/// +/// One meter of the vitals panel, as every view of it draws it: the terminal's cell strip and the window's native +/// gauges are both drawn from this, so the two cannot disagree about a value or about what "low" is. +/// +/// The label the player gave the meter on F7 (hp). +/// The value as the game sent it. +/// The maximum as the game sent it, or null when it has not sent one. +/// Whether the meter is configured with a maximum at all, sent yet or not. +/// Value over maximum, when both are numbers and the maximum is positive. +/// Whether is under . +public sealed record VitalsMeter(string Label, string Value, string? Max, bool HasMax, double? Share, bool Low) +{ + /// + /// The label spelt out where a view has the room: hp reads as Health, mp as Mana. + /// Only the abbreviations every MUD shares; anything else is the player's own label, unchanged. + /// + public string Title => VitalsModel.TitleFor(Label); +} + +/// What the character is fighting, when the game says. +/// The target's name, bounded by . +/// Its health as a share of its maximum, when the game sends one. +public sealed record VitalsTarget(string Name, double? Share) +{ + /// Whether the target is below . + public bool Low => Share < VitalsModel.LowShare; +} + +/// +/// The vitals panel's content for one character, with no presentation in it: the meters that have a value, in +/// their configured order, and the target. The terminal draws it as a row of cells +/// (VitalsStripRenderer); the window draws native gauges over that row from the same instance. +/// +public sealed record VitalsModel(IReadOnlyList Meters, VitalsTarget? Target) +{ + /// The share under which a meter is low. One number for every view, the status row's included. + public const double LowShare = 0.25; + + /// No meter and no target: nothing for any view to draw. + public static VitalsModel Empty { get; } = new([], null); + + /// Whether there is nothing to draw. + public bool IsEmpty => Meters.Count == 0 && Target is null; + + /// The model for a Core target, or null. + public static VitalsTarget? TargetFrom(CombatTarget? target) => target is null ? null : new VitalsTarget(target.Name, target.Share); + + /// Value equality over the meters, which a record's list member does not give. + public bool Equals(VitalsModel? other) => + other is not null && Equals(Target, other.Target) && Meters.SequenceEqual(other.Meters); + + public override int GetHashCode() + { + var hash = new HashCode(); + hash.Add(Target); + foreach (var meter in Meters) + { + hash.Add(meter); + } + + return hash.ToHashCode(); + } + + /// See . + public static string TitleFor(string label) => label.Trim().ToLowerInvariant() switch + { + "hp" or "health" => "Health", + "mp" or "sp" or "mana" => "Mana", + "mv" or "moves" or "move" or "movement" => "Movement", + "ep" or "en" or "endurance" => "Endurance", + "wp" or "willpower" => "Willpower", + "st" or "sta" or "stamina" => "Stamina", + "xp" or "exp" => "Experience", + _ => label, + }; +} diff --git a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs index 105a1da9..25ec70ca 100644 --- a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs @@ -1,4 +1,5 @@ using System.Text; +using SharpMUTerm.Client.Panels; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Protocols; using static SharpMUTerm.Tui.MarkupText; @@ -70,6 +71,14 @@ internal static string Render(IReadOnlyList me return ElideVisible(last!, width); } + /// The strip for a : the same model the window's native gauges are drawn from. + internal static string Render(VitalsModel vitals, int width, Ink ink) => + Render( + [.. vitals.Meters.Select(m => new StatusMeterRenderer.MeterReading(m.Label, m.Value, m.Max, m.HasMax, m.Share, m.Low))], + vitals.Target is { } target ? new CombatTarget(target.Name, target.Share) : null, + width, + ink); + private static string Compose( IReadOnlyList meters, CombatTarget? target, Level level, int width, Ink ink) { diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 9733e5f9..82ecd577 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -74,7 +74,8 @@ internal sealed record PointerTarget(PointerKind Kind, PaneRect Area, PointerSha /// The key that does the same, when there is one, drawn after the label. /// What choosing it does. /// False draws it dimmed and unclickable, which says the action exists but not here. -internal sealed record PointerMenuItem(string Label, string? Hint, Action Run, bool Enabled = true) +/// Whether the entry is the one in force (the layout in use), drawn with a check by a host that can. +internal sealed record PointerMenuItem(string Label, string? Hint, Action Run, bool Enabled = true, bool Checked = false) { /// A rule between groups of entries. public static PointerMenuItem Separator { get; } = new("-", null, () => { }, false); @@ -122,4 +123,65 @@ internal interface IPointerPresenter /// The panes' scroll positions, whenever one of them changes. void Scrollbars(IReadOnlyList bars); + + /// + /// The panels on screen that a host may draw natively over their cells, whenever one moves or its content + /// changes. The cells stay what they are; a host that draws no native panels ignores this (the default). + /// + void Panels(IReadOnlyList panels) + { + } + + /// + /// The actions a host may offer as native buttons along the header, said once when the app starts. A host + /// with no buttons ignores this (the default); every action is also a key and a ⌃P entry. + /// + void HeaderActions(IReadOnlyList actions) + { + } +} + +/// +/// One panel on screen, for a host that draws it natively over its pane rather than in cells: where it is and what +/// it shows. The cells under it are drawn as in any host, so a host that draws nothing loses nothing, and the +/// terminal-and-window parity, which compares cells, is unaffected. +/// +/// The panel (vitals, map, …; PanelIds). +/// The window the panel is drawn in, which is the pane's front tab. +/// The pane's output rectangle, in desktop cells — the area the cells of the panel cover. +/// The colours the cells are drawn in, so a native view says the same things in the same hues. +/// For the vitals panel, its content: the same model its cell strip is drawn from. +/// For the map, the rooms around the character, drawn from the recorder the cell map is drawn from. +/// +/// For the map, walks the panel's own character to a room by id, through the speedwalk a click on a cell map uses. +/// Safe to call from any thread. The same instance for as long as the window lives, so an overlay compares equal. +/// +internal sealed record PanelOverlay( + string PanelId, + string WindowId, + PaneRect Rect, + PanelInk Ink, + SharpMUTerm.Client.Panels.VitalsModel? Vitals, + SharpMUTerm.Client.Panels.MapViewModel? Map = null, + Action? WalkTo = null); + +/// A panel's colours as #rrggbb: a bar or fill, the warning, and the empty part of a bar. +internal sealed record PanelInk(string Bar, string Low, string Track); + +/// +/// An action a host may draw as a native button in the header, over blank header cells. Its menu is built by the +/// client, on the client's thread, from the same commands its key runs — a host never builds one of its own. +/// +/// Which action (); a host picks its icon by this. +/// What it is, for a tooltip and a screen reader. +/// The key that does the same, for the tooltip. +/// +/// Builds the menu; safe to call from any thread. The client builds it on its own thread and hands it to the +/// callback there, so a host marshals in the callback itself. Each entry's is +/// already marshalled. +/// +internal sealed record HeaderAction(string Id, string Label, string? Hint, Action>> Menu) +{ + /// The layouts button: built-in and saved layouts, save, and a default for a world or a character. + public const string LayoutsId = "layouts"; } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs new file mode 100644 index 00000000..6b57afaf --- /dev/null +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -0,0 +1,238 @@ +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Text; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// What a host that draws native views over the cells is told: the header actions it may offer as buttons, and +/// the panels on screen with their content. Both go out through , the channel the +/// scrollbars already ride, and both leave every cell as it was — so a host that draws nothing native (the +/// terminal, the snapshot) is unaffected, and the window's native views are a presentation over the same frame. +/// +/// Nothing here is a second implementation. The Layouts menu is built from the layout library's commands +/// (), dispatched through the registry, which run the same methods as the ⌥M list's +/// keys; the vitals a native gauge draws are , the model the cell strip draws. +/// +/// +internal sealed partial class SharpMUTermApp +{ + private IReadOnlyList _panelOverlays = Array.Empty(); + + /// How many times each map window has been drawn; a native map's model is rebuilt only when this moves. + private readonly Dictionary _mapRevisions = new(StringComparer.Ordinal); + + /// The native map model last built for each map window, with the revision it was built at. + private readonly Dictionary _mapViews = new(StringComparer.Ordinal); + + /// One walk callback per map window, kept so an overlay compares equal from frame to frame. + private readonly Dictionary> _mapWalkers = new(StringComparer.Ordinal); + + /// Tells the host which header buttons it may draw. Once, at construction. + private void AnnounceHeaderActions() => + _pointer?.HeaderActions( + [ + new HeaderAction(HeaderAction.LayoutsId, "Layouts", "⌥M", show => OnUiThread(() => show(LayoutsMenuItems()))), + ]); + + /// The layout the focused character's panes show, or would get. + private string LayoutInUse(string key) => + _liveLayout is { } live && string.Equals(live.SessionKey, key, StringComparison.Ordinal) + ? live.LayoutId + : ResolveLayout(key).Layout.Id; + + /// + /// The window's Layouts menu: the built-ins, then the player's, the one in use checked; then the list's + /// actions on the layout in use; then the list itself. Every entry dispatches a command id. + /// Internal for tests. + /// + internal IReadOnlyList LayoutsMenuItems() + { + Action Dispatch(string id) => () => OnUiThread(() => DispatchCommand(id)); + var items = new List(); + if (LayoutsKey() is not { } key) + { + items.Add(new PointerMenuItem("No character here — a layout belongs to a character", null, () => { }, Enabled: false)); + items.Add(PointerMenuItem.Separator); + items.Add(new PointerMenuItem("Manage layouts…", "⌥M", Dispatch("layout:layouts"))); + return items; + } + + var inUse = LayoutInUse(key); + var all = Layouts.All; + foreach (var layout in all.Where(l => l.IsBuiltIn)) + { + items.Add(new PointerMenuItem(Snippet(layout.Name), null, Dispatch(LayoutCommands.Apply(layout.Id)), Checked: layout.Id == inUse)); + } + + var own = all.Where(l => !l.IsBuiltIn).ToList(); + if (own.Count > 0) + { + items.Add(PointerMenuItem.Separator); + foreach (var layout in own) + { + items.Add(new PointerMenuItem(Snippet(layout.Name), null, Dispatch(LayoutCommands.Apply(layout.Id)), Checked: layout.Id == inUse)); + } + } + + var (world, character) = LayoutOwner(key); + items.Add(PointerMenuItem.Separator); + items.Add(new PointerMenuItem("Save changes", null, Dispatch(LayoutCommands.SaveChanges))); + items.Add(new PointerMenuItem("Save as new", null, Dispatch(LayoutCommands.SaveAsNew))); + items.Add(new PointerMenuItem( + world is null ? "Use for this world" : $"Use for {Snippet(world.Name)}", null, Dispatch(LayoutCommands.UseForWorld), Enabled: world is not null)); + items.Add(new PointerMenuItem( + character is null ? "Use for this character only" : $"Use for {Snippet(character.Name)} only", + null, + Dispatch(LayoutCommands.UseForCharacter), + Enabled: character is not null)); + items.Add(PointerMenuItem.Separator); + items.Add(new PointerMenuItem("Manage layouts…", "⌥M", Dispatch("layout:layouts"))); + return items; + } + + /// + /// A layout-library command (), for the focused character: the ⌥M list's own + /// methods, with what they did said in a notice rather than in the list's status line. + /// + private bool RunLayoutCommand(string id) + { + if (LayoutsKey() is not { } key) + { + RefuseCommand("no character here — a layout belongs to a character (⌃P ▸ Switch to …)"); + return false; + } + + if (id.StartsWith(LayoutCommands.ApplyPrefix, StringComparison.Ordinal)) + { + if (Layouts.Find(id[LayoutCommands.ApplyPrefix.Length..]) is not { } chosen) + { + RefuseCommand($"there is no layout {Snippet(id[LayoutCommands.ApplyPrefix.Length..])}"); + return false; + } + + if (!ApplyLayout(key, chosen)) + { + RefuseCommand($"no window to arrange for {Snippet(key)} — switch to the character first"); + return false; + } + + Notice($"{chosen.Name} layout applied", MessageSeverity.Info, "⌥M"); + return true; + } + + var current = Layouts.Find(LayoutInUse(key)) ?? ResolveLayout(key).Layout; + var (world, character) = LayoutOwner(key); + LayoutActionResult? result = id switch + { + LayoutCommands.SaveChanges => SaveLayoutChanges(key, current, world, character), + LayoutCommands.SaveAsNew => SaveLayoutAsNew(key, current), + LayoutCommands.UseForWorld => UseLayoutForWorld(key, current, world), + LayoutCommands.UseForCharacter => UseLayoutForCharacter(key, current, character), + _ => null, + }; + if (result is not { } done) + { + RefuseCommand($"{id} isn't a layout command"); + return false; + } + + if (done.Done) + { + Notice(Capitalise(done.Status), MessageSeverity.Info, "⌥M"); + } + else + { + RefuseCommand(done.Status); + } + + return done.Done; + } + + private static string Capitalise(string text) => + text.Length == 0 ? text : char.ToUpperInvariant(text[0]) + text[1..]; + + /// + /// Tells the host which panels are on screen, where, and what they show, when any of that changed. Rides the + /// frame, for ' reason. A panel is on screen when its window is the front tab of + /// a realised pane. + /// + private void PublishPanels() + { + if (_pointer is null) + { + return; + } + + var overlays = new List(); + foreach (var (paneId, rect) in PaneOutputRects()) + { + if (_workspace.Layout.FindPane(paneId) is not { ActiveTab: { } windowId }) + { + continue; + } + + if (IsMapWindow(windowId)) + { + if (MapViewFor(windowId) is { } view) + { + var walker = _mapWalkers.TryGetValue(windowId, out var known) + ? known + : _mapWalkers[windowId] = room => OnUiThread(() => WalkFromMap(windowId, room)); + overlays.Add(new PanelOverlay( + PanelIds.Map, windowId, rect, new PanelInk(_ink.Accent, _ink.Draft, _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))), null, view, walker)); + } + + continue; + } + + if (!TerminalPanels.TryParseWindowId(windowId, out var panelId, out var key)) + { + continue; + } + + if (panelId == PanelIds.Vitals) + { + var ink = VitalsInk(); + overlays.Add(new PanelOverlay(panelId, windowId, rect, new PanelInk(ink.Bar, ink.Low, ink.Empty), ReadVitals(key))); + } + } + + if (overlays.SequenceEqual(_panelOverlays)) + { + return; + } + + _panelOverlays = overlays; + _pointer.Panels(overlays); + } + + /// + /// A map window's native model, rebuilt only when the cell map has been redrawn since ( + /// counts), so a frame that changed nothing on the map costs a dictionary lookup. + /// + private MapViewModel? MapViewFor(string windowId) + { + if (MapOf(_workspace.FindWindow(windowId)?.SessionKey) is not { } map) + { + return null; + } + + var revision = _mapRevisions.GetValueOrDefault(windowId); + if (_mapViews.TryGetValue(windowId, out var cached) && cached.Revision == revision) + { + return cached.Model; + } + + var walking = map.Walk.IsWalking ? $"walking, {map.Walk.Remaining} to go" : null; + var model = MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking); + _mapViews[windowId] = (revision, model); + return model; + } + + /// What the host was last told about panels. Internal for tests. + internal IReadOnlyList PanelOverlays => _panelOverlays; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs index 38b9929b..1592339e 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Commands; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; using SharpMUTerm.Core.Layouts; @@ -504,34 +505,16 @@ private bool LayoutsKeyPressed(string key, ConsoleKeyInfo k) Notice($"{selected.Name} layout applied — c keeps it for this character, w for the world", MessageSeverity.Info, "⌥M"); return false; case ConsoleKey.S when k.Modifiers == 0: - SaveLayoutChanges(key, selected, world, character); + _layoutsStatus = SaveLayoutChanges(key, selected, world, character).Status; return true; case ConsoleKey.N when k.Modifiers == 0: - SaveLayoutAsNew(key, selected); + _layoutsStatus = SaveLayoutAsNew(key, selected).Status; return true; case ConsoleKey.W when k.Modifiers == 0: - if (world is null) - { - _layoutsStatus = "this character's world is not configured"; - return true; - } - - world.Layout = selected.Id; - PersistConfiguration(); - _layoutsStatus = $"{selected.Name} is now {world.Name}'s layout"; - ReapplyIfResolvedChanged(key); + _layoutsStatus = UseLayoutForWorld(key, selected, world).Status; return true; case ConsoleKey.C when k.Modifiers == 0: - if (character is null) - { - _layoutsStatus = "no configured character to keep it for"; - return true; - } - - character.Layout = selected.Id; - PersistConfiguration(); - _layoutsStatus = $"{character.Name} uses {selected.Name}"; - ReapplyIfResolvedChanged(key); + _layoutsStatus = UseLayoutForCharacter(key, selected, character).Status; return true; default: return true; @@ -556,12 +539,42 @@ private void ReapplyIfResolvedChanged(string key) private CapturedLayout? CaptureArrangement(string key, LayoutDefinition? previous) => LayoutCapture.Capture(_workspace.Layout.Root, window => PanelOf(key, window), previous); - private void SaveLayoutChanges(string key, LayoutDefinition target, WorldDefinition? world, CharacterDefinition? character) + /// What one of the list's actions did: whether it did it, and the line that says so. + private readonly record struct LayoutActionResult(bool Done, string Status); + + /// ⌥M w and : becomes the world's default. + private LayoutActionResult UseLayoutForWorld(string key, LayoutDefinition layout, WorldDefinition? world) + { + if (world is null) + { + return new(false, "this character's world is not configured"); + } + + world.Layout = layout.Id; + PersistConfiguration(); + ReapplyIfResolvedChanged(key); + return new(true, $"{layout.Name} is now {world.Name}'s layout"); + } + + /// ⌥M c and : becomes the character's own. + private LayoutActionResult UseLayoutForCharacter(string key, LayoutDefinition layout, CharacterDefinition? character) + { + if (character is null) + { + return new(false, "no configured character to keep it for"); + } + + character.Layout = layout.Id; + PersistConfiguration(); + ReapplyIfResolvedChanged(key); + return new(true, $"{character.Name} uses {layout.Name}"); + } + + private LayoutActionResult SaveLayoutChanges(string key, LayoutDefinition target, WorldDefinition? world, CharacterDefinition? character) { if (CaptureArrangement(key, target) is not { } captured) { - _layoutsStatus = "nothing to save — no pane holds this character's output"; - return; + return new(false, "nothing to save — no pane holds this character's output"); } var result = Layouts.Update(target.Id, captured.Placements, captured.RegionShares); @@ -576,31 +589,25 @@ private void SaveLayoutChanges(string key, LayoutDefinition target, WorldDefinit { world.Layout = result.Layout.Id; } - - _layoutsStatus = $"{target.Name} is built in — saved as {result.Layout.Name}"; - } - else - { - _layoutsStatus = $"saved {result.Layout.Name}"; } PersistConfiguration(); _layoutsSelected = Layouts.All.ToList().FindIndex(l => l.Id == result.Layout.Id); AdoptArrangementAs(key, result.Layout); + return new(true, result.CreatedNew ? $"{target.Name} is built in — saved as {result.Layout.Name}" : $"saved {result.Layout.Name}"); } - private void SaveLayoutAsNew(string key, LayoutDefinition from) + private LayoutActionResult SaveLayoutAsNew(string key, LayoutDefinition from) { if (CaptureArrangement(key, from) is not { } captured) { - _layoutsStatus = "nothing to save — no pane holds this character's output"; - return; + return new(false, "nothing to save — no pane holds this character's output"); } var saved = Layouts.SaveAsNew(from.Name, captured.Placements, captured.RegionShares); PersistConfiguration(); _layoutsSelected = Layouts.All.ToList().FindIndex(l => l.Id == saved.Id); - _layoutsStatus = $"saved as {saved.Name} — c or w puts it to use"; + return new(true, $"saved as {saved.Name} — c or w puts it to use"); } /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index eea3d7b6..f8ab5da9 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -11,6 +11,7 @@ using SharpMUTerm.Core.Session; using SharpMUTerm.Core.Text; using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Client.Panels; using SharpMUTerm.Tui.Panels; namespace SharpMUTerm.Tui; @@ -164,16 +165,12 @@ private IWindowControl NewVitalsPanel(TerminalPanelContext context) { var view = NewPanelView(context, (width, _) => { - if (PanelGameData(context.SessionKey) is not { } data) + if (ReadVitals(context.SessionKey) is not { } vitals) { return ["[dim]No vitals: this character is not connected.[/]"]; } - var strip = VitalsStripRenderer.Render( - StatusMeterRenderer.Read(PanelMeters(context.SessionKey), data), - CombatTarget.Read(data), - width, - VitalsInk()); + var strip = VitalsStripRenderer.Render(vitals, width, VitalsInk()); return [strip.Length > 0 ? strip : "[dim]No vitals yet — the game has sent none of the meters F7 names.[/]"]; }); @@ -186,6 +183,23 @@ private IWindowControl NewVitalsPanel(TerminalPanelContext context) return view.Control; } + /// + /// A character's vitals as the one model every view draws (): the cell strip here, and + /// the window's native gauges through . Null when the character has no game data. + /// + internal VitalsModel? ReadVitals(string sessionKey) + { + if (PanelGameData(sessionKey) is not { } data) + { + return null; + } + + var meters = StatusMeterRenderer.Read(PanelMeters(sessionKey), data) + .Select(m => new VitalsMeter(m.Label, m.Value, m.Max, m.HasMax, m.Share, m.Low)) + .ToList(); + return new VitalsModel(meters, VitalsModel.TargetFrom(CombatTarget.Read(data))); + } + /// /// The strip's colours, each held to the floor against the plane it lands on: the bars are fills but carry /// meaning, so they are lifted like text; the empty part of a bar is a grey that still reads as a track. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 9d6212e1..4a7c0daa 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -785,6 +785,7 @@ public SharpMUTermApp( _workspace = ResumeOrNew(config); NoteRestoredOwners(); RegisterTerminalPanels(); + AnnounceHeaderActions(); var headless = host.RunsInline; _headless = headless; @@ -998,6 +999,7 @@ public SharpMUTermApp( SyncTransparentColours(); DrawSixelOverlay(buffer); PublishScrollbars(); + PublishPanels(); SyncMapSizes(); SyncPanelSizes(); }; @@ -8161,6 +8163,11 @@ internal IReadOnlyList PaneLines(string windowId) => /// private bool RunBuiltInCommand(string id) { + if (id.StartsWith(SharpMUTerm.Client.Commands.LayoutCommands.Prefix, StringComparison.Ordinal)) + { + return RunLayoutCommand(id); + } + if (DispatchGroupCommand(id)) { return true; @@ -8635,8 +8642,19 @@ private MarkupControl MapControlFor(string windowId) /// private void OnMapLinkClicked(string windowId, string url) { - if (MapRenderer.ParseLink(url) is not { } room - || MapOf(_workspace.FindWindow(windowId)?.SessionKey) is not { } map) + if (MapRenderer.ParseLink(url) is { } room) + { + WalkFromMap(windowId, room); + } + } + + /// + /// Walks a map window's own character to a room: a cell map's click and the window's native map both end here, + /// so there is one walk and one refusal. + /// + private void WalkFromMap(string windowId, long room) + { + if (MapOf(_workspace.FindWindow(windowId)?.SessionKey) is not { } map) { return; } @@ -8660,6 +8678,7 @@ private void RenderMap(string windowId) var (width, height) = MapBox(windowId); _mapSizes[windowId] = (width, height); + _mapRevisions[windowId] = _mapRevisions.GetValueOrDefault(windowId) + 1; if (MapOf(_workspace.FindWindow(windowId)?.SessionKey) is not { } map) { control.SetContent(new List { "[dim]No map: this character is not connected.[/]" }); diff --git a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs index d56277cd..53ffb13a 100644 --- a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs +++ b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs @@ -24,7 +24,7 @@ internal static class StatusMeterRenderer internal const int ValueWidth = 5; /// Below this share of its maximum a value is drawn in the warning ink. - internal const double LowShare = 0.25; + internal const double LowShare = SharpMUTerm.Client.Panels.VitalsModel.LowShare; /// The cells a compact meter's share takes: 100%. internal const int ShareWidth = 4; diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs new file mode 100644 index 00000000..815f7aeb --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -0,0 +1,375 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Input; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; +using SkiaSharp; +using Color = SharpConsoleUI.Color; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's native views over the cells (): the header's Layouts button, whose +/// presses are the window's and whose menu is the client's commands, and the native vitals gauges, drawn from the +/// same model as the cell strip under them and taking no input of their own. +/// +public class DesktopLayerTests +{ + private static readonly SKColor Back = new(0x10, 0x20, 0x30); + + private static readonly VitalsModel Vitals = new( + [ + new VitalsMeter("hp", "412", "500", true, 412 / 500.0, false), + new VitalsMeter("mp", "23", "120", true, 23 / 120.0, true), + ], + new VitalsTarget("a rotting ghoul", 0.4)); + + // ── The client's half: what it tells a host ────────────────────────────────────────────────── + + [Test] + public async Task TheClientPublishesTheVitalsPaneWithTheModelItsCellStripIsDrawnFrom() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("layout-combat"); + + var panel = driver.Pointer.Panels.SingleOrDefault(p => p.PanelId == PanelIds.Vitals); + await Assert.That(panel).IsNotNull(); + var pane = app.PaneOutputRects().Single(r => app.PaneWindows().GetValueOrDefault(r.Key) == panel!.WindowId); + await Assert.That(panel!.Rect).IsEqualTo(pane.Value).Because("the overlay goes exactly where the strip's cells are"); + await Assert.That(panel.Vitals).IsEqualTo(app.ReadVitals(DemoScene.ActiveSessionKey)); + await Assert.That(panel.Vitals!.Meters.Count).IsGreaterThan(0); + await Assert.That(driver.Pointer.Actions.Select(a => a.Id)).Contains(HeaderAction.LayoutsId); + } + + [Test] + public async Task PublishingPanelsMovesNoPaneRectangle() + { + using var headless = new HeadlessConsoleDriver(140, 36); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities)); + terminal.RenderSnapshot("layout-combat"); + + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var window = InlineWindowApp(driver); + window.RenderSnapshot("layout-combat"); + + await Assert.That(driver.Pointer.Panels.Count).IsGreaterThan(0); + await Assert.That(window.PaneOutputRects().OrderBy(r => r.Key).ToArray()) + .IsEquivalentTo(terminal.PaneOutputRects().OrderBy(r => r.Key).ToArray()); + } + + [Test] + public async Task TheLayoutsMenuIsTheLayoutLibraryWithTheOneInUseChecked() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("layout-combat"); + + var items = app.LayoutsMenuItems(); + var labels = items.Where(i => !i.IsSeparator).Select(i => i.Label).ToArray(); + await Assert.That(labels).Contains("Roleplay"); + await Assert.That(labels).Contains("Combat"); + await Assert.That(labels).Contains("Save changes"); + await Assert.That(labels).Contains("Save as new"); + await Assert.That(labels).Contains("Use for Aetherfall"); + await Assert.That(labels).Contains("Use for Corvid only"); + await Assert.That(labels).Contains("Manage layouts…"); + await Assert.That(items.Single(i => i.Checked).Label).IsEqualTo("Combat"); + + // Choosing an entry runs the command, through the registry, that the ⌥M list's ⏎ runs. + items.Single(i => i.Label == "Roleplay").Run(); + await Assert.That(app.LiveLayoutId).IsEqualTo(BuiltInLayouts.RoleplayId); + await Assert.That(app.LayoutsMenuItems().Single(i => i.Checked).Label).IsEqualTo("Roleplay"); + } + + [Test] + public async Task EveryLayoutCommandResolvesThroughTheRegistry() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("layout-combat"); + + foreach (var id in new[] + { + LayoutCommands.Apply(BuiltInLayouts.CombatId), LayoutCommands.SaveChanges, LayoutCommands.SaveAsNew, + LayoutCommands.UseForWorld, LayoutCommands.UseForCharacter, + }) + { + await Assert.That(app.Contributions.Commands.Resolve(id)).IsNotNull().Because(id); + } + + await Assert.That(app.DispatchCommand(LayoutCommands.SaveAsNew)).IsTrue(); + await Assert.That(app.Layouts.All.Count(l => !l.IsBuiltIn)).IsEqualTo(1); + await Assert.That(app.DispatchCommand(LayoutCommands.UseForCharacter)).IsTrue(); + } + + // ── The window's half: what it draws, and where the pointer goes ───────────────────────────── + + [Test] + public async Task ThePressOnTheLayoutsButtonNeverReachesTheClientAndOpensTheClientsMenu() + { + var (visible, clientSaw, asked, entries) = await Run((window, view, layer, driver) => + { + var asked = 0; + Offer(driver, show => + { + asked++; + show([new PointerMenuItem("Combat", null, () => { }, Checked: true), PointerMenuItem.Separator, new PointerMenuItem("Manage layouts…", "⌥M", () => { })]); + }); + var clientSaw = new List>(); + driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); + + window.UpdateLayout(); + var button = layer.Button(HeaderAction.LayoutsId)!; + var centre = button.TranslatePoint(new Point(button.Bounds.Width / 2, button.Bounds.Height / 2), window)!.Value; + window.MouseMove(centre); + window.MouseDown(centre, MouseButton.Left); + window.MouseUp(centre, MouseButton.Left); + window.MouseDown(centre, MouseButton.Right); + window.MouseUp(centre, MouseButton.Right); + Drain(); + var entries = layer.OpenedMenu?.Items.Select(i => i is MenuItem m ? $"{m.IsChecked}" : "-").ToArray() ?? []; + return (button.IsVisible, clientSaw, asked, entries); + }); + + await Assert.That(visible).IsTrue(); + await Assert.That(clientSaw).IsEmpty().Because("every press on the button is the window's"); + await Assert.That(asked).IsEqualTo(1).Because("only the left click opens the menu"); + await Assert.That(entries).IsEquivalentTo(new[] { "True", "-", "False" }); + } + + [Test] + public async Task TheButtonCoversOnlyBlankHeaderCellsAndStandsDownOverText() + { + var (blank, overText) = await Run((window, view, layer, driver) => + { + Offer(driver, _ => { }); + var blank = layer.Button(HeaderAction.LayoutsId)!.IsVisible; + driver.SetNarrowCell(driver.Frame.Width - 2, 0, 'x', Color.Default, Color.Default); + driver.Flush(); + Drain(); + return (blank, layer.Button(HeaderAction.LayoutsId)!.IsVisible); + }); + + await Assert.That(blank).IsTrue(); + await Assert.That(overText).IsFalse(); + } + + [Test] + public async Task VitalsGaugesAreDrawnOverTheirPaneAndThePointerStillReachesTheCells() + { + var (gaugeRect, paneRect, bars, barColour, cellsUnchanged, clientSaw) = await Run((window, view, layer, driver) => + { + var before = driver.Frame; + Publish(driver, new PaneRect(2, 2, 36, 6)); + Drain(); + window.UpdateLayout(); + using var frame = window.CaptureRenderedFrame()!; + var gauges = layer.Gauges.Values.Single(); + var cell = view.SizeFor(1, 1); + var paneRect = new Rect(2 * cell.Width, 2 * cell.Height, 36 * cell.Width, 6 * cell.Height); + var gaugeRect = new Rect(Canvas.GetLeft(gauges), Canvas.GetTop(gauges), gauges.Bounds.Width, gauges.Bounds.Height); + var bars = gauges.DrawnBars.ToArray(); + var fill = bars[0].Fill; + var inLayer = gauges.TranslatePoint(new Point(fill.X + 3, fill.Center.Y), window)!.Value; + var barColour = Pixel(frame, inLayer.X, inLayer.Y); + + var clientSaw = new List(); + driver.MouseEvent += (_, _, at) => clientSaw.Add(at); + var press = new Point((5 * cell.Width) + 2, (4 * cell.Height) + 2); + window.MouseDown(press, MouseButton.Left); + window.MouseUp(press, MouseButton.Left); + return (gaugeRect, paneRect, bars, barColour, ReferenceEquals(before, driver.Frame), clientSaw); + }); + + await Assert.That(gaugeRect).IsEqualTo(paneRect); + await Assert.That(bars.Length).IsEqualTo(3).Because("health, mana and the target"); + await Assert.That(bars[1].Low).IsTrue(); + await Assert.That(barColour.G).IsGreaterThan(barColour.R).Because("health's bar wears the bar ink, a green"); + await Assert.That(cellsUnchanged).IsTrue().Because("the gauges draw over the frame, never into it"); + await Assert.That(clientSaw.Distinct().ToArray()).IsEquivalentTo(new[] { new System.Drawing.Point(5, 4) }); + } + + [Test] + public async Task AShortPaneLaysTheMetersSideBySideAndATallOneStacksThem() + { + var (row, stacked) = await Run((window, view, layer, driver) => + { + Publish(driver, new PaneRect(0, 2, 40, 1)); + Drain(); + window.UpdateLayout(); + var row = layer.Gauges.Values.Single().Stacked; + Publish(driver, new PaneRect(0, 2, 40, 9)); + Drain(); + window.UpdateLayout(); + return (row, layer.Gauges.Values.Single().Stacked); + }, rows: 12); + + await Assert.That(row).IsFalse(); + await Assert.That(stacked).IsTrue(); + } + + [Test] + public async Task AGaugeGoesWhenItsPanelLeavesTheScreen() + { + var (shown, after) = await Run((window, view, layer, driver) => + { + Publish(driver, new PaneRect(0, 2, 30, 3)); + Drain(); + var shown = layer.Gauges.Count; + ((IPointerPresenter)driver.Pointer).Panels([]); + Drain(); + return (shown, layer.Gauges.Count); + }); + + await Assert.That(shown).IsEqualTo(1); + await Assert.That(after).IsEqualTo(0); + } + + [Test] + public async Task TheClientPublishesTheMapAroundTheCharacterAndAWalkGoesThroughItsSpeedwalk() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("layout-combat"); + + var map = driver.Pointer.Panels.SingleOrDefault(p => p.PanelId == PanelIds.Map); + await Assert.That(map).IsNotNull(); + await Assert.That(map!.WindowId).IsEqualTo(SharpMUTermApp.MapWindowId(DemoScene.ActiveSessionKey)); + await Assert.That(map.Map!.Current).IsNotNull(); + await Assert.That(map.Map.Exits.Count).IsGreaterThan(0); + + var target = map.Map.Rooms.First(r => !r.Current); + map.WalkTo!(target.Id); + app.RenderNextFrame(); + var after = driver.Pointer.Panels.Single(p => p.PanelId == PanelIds.Map); + await Assert.That(after.Map!.Walking).IsNotNull().Because("the click started the client's own speedwalk"); + await Assert.That(after.Map.Rooms.Single(r => r.Id == target.Id).Ahead).IsTrue(); + await Assert.That(ReferenceEquals(after.WalkTo, map.WalkTo)).IsTrue().Because("one walker per window, so an overlay compares equal"); + } + + [Test] + public async Task OnTheNativeMapAClickWalksADragPansTheWheelZoomsAndARightClickReachesTheClient() + { + var (walked, pan, zoom, clientSaw) = await Run((window, view, layer, driver) => + { + var walked = new List(); + var model = new MapViewModel( + "Town", + 0, + [ + new MapViewRoom(1, "Plaza", 0, 0, Current: true, Ahead: false, Locked: false), + new MapViewRoom(2, "North Road", 0, -1, Current: false, Ahead: false, Locked: false), + ], + [new MapViewExit(1, 2)], + null); + ((IPointerPresenter)driver.Pointer).Panels( + [new PanelOverlay(PanelIds.Map, "map:demo", new PaneRect(0, 1, 40, 9), new PanelInk("#33ccff", "#ffaa33", "#555555"), null, model, walked.Add)]); + Drain(); + window.UpdateLayout(); + var canvas = layer.Maps.Values.Single(); + Point At(MapViewRoom room) => canvas.TranslatePoint(canvas.CentreOf(room), window)!.Value; + + var clientSaw = new List>(); + driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); + + // A click on the room north of the character, then a click on the character's own room (nothing to walk). + window.MouseDown(At(model.Rooms[1]), MouseButton.Left); + window.MouseUp(At(model.Rooms[1]), MouseButton.Left); + window.MouseDown(At(model.Rooms[0]), MouseButton.Left); + window.MouseUp(At(model.Rooms[0]), MouseButton.Left); + + // A drag that starts on a room pans and walks nowhere. + var from = At(model.Rooms[1]); + window.MouseDown(from, MouseButton.Left); + window.MouseMove(from + new Vector(30, 12)); + window.MouseUp(from + new Vector(30, 12), MouseButton.Left); + var pan = canvas.Pan; + + window.MouseWheel(At(model.Rooms[0]), new Vector(0, 2)); + var zoom = canvas.Zoom; + + window.MouseDown(At(model.Rooms[0]), MouseButton.Right); + window.MouseUp(At(model.Rooms[0]), MouseButton.Right); + return (walked, pan, zoom, clientSaw); + }); + + await Assert.That(walked).IsEquivalentTo(new long[] { 2 }); + await Assert.That(pan).IsEqualTo(new Vector(30, 12)); + await Assert.That(zoom).IsGreaterThan(1.0); + await Assert.That(clientSaw.Count).IsEqualTo(2).Because("only the right click is handed on, pressed and released"); + await Assert.That(clientSaw[0]).Contains(MouseFlags.Button3Pressed); + } + + // ── helpers ────────────────────────────────────────────────────────────────────────────────── + + private static SharpMUTermApp InlineWindowApp(AvaloniaConsoleDriver driver) => + new(DemoScene.Build(), WindowHost.Create(driver, clipboard: null) with + { + Capabilities = WindowOptions.Capabilities, + Audio = null, + Presence = null, + Announcer = null, + RunsInline = true, + }); + + private static void Offer(AvaloniaConsoleDriver driver, Action>> menu) + { + ((IPointerPresenter)driver.Pointer).HeaderActions([new HeaderAction(HeaderAction.LayoutsId, "Layouts", "⌥M", menu)]); + Drain(); + } + + private static void Publish(AvaloniaConsoleDriver driver, PaneRect rect) => + ((IPointerPresenter)driver.Pointer).Panels( + [new PanelOverlay(PanelIds.Vitals, "panel:vitals:demo", rect, new PanelInk("#3ccf6a", "#ff5555", "#333338"), Vitals)]); + + private static void Drain() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); + + private static Task Run( + Func body, int columns = 40, int rows = 10) => + Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(columns, rows); + var view = new TerminalView(driver, SKColors.White, Back, 16, null); + var layer = new DesktopLayer(view); + var root = new Panel(); + root.Children.Add(view); + root.Children.Add(layer); + var window = new Window { Content = root, WindowDecorations = WindowDecorations.BorderOnly }; + var size = view.SizeFor(columns, rows); + window.Width = size.Width; + window.Height = size.Height; + window.Show(); + view.Focus(); + driver.Flush(); + Drain(); + try + { + return body(window, view, layer, driver); + } + finally + { + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + private static global::Avalonia.Media.Color Pixel(global::Avalonia.Media.Imaging.WriteableBitmap bitmap, double x, double y) + { + using var buffer = bitmap.Lock(); + var bytes = new byte[buffer.RowBytes * buffer.Size.Height]; + System.Runtime.InteropServices.Marshal.Copy(buffer.Address, bytes, 0, bytes.Length); + var i = ((int)y * buffer.RowBytes) + ((int)x * 4); + return buffer.Format == global::Avalonia.Platform.PixelFormat.Rgba8888 + ? global::Avalonia.Media.Color.FromRgb(bytes[i], bytes[i + 1], bytes[i + 2]) + : global::Avalonia.Media.Color.FromRgb(bytes[i + 2], bytes[i + 1], bytes[i]); + } + + private static HeadlessUnitTestSession Session => TerminalViewTests.Session; +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/TerminalViewTests.cs b/tests/SharpMUTerm.Avalonia.Tests/TerminalViewTests.cs index c13d75a9..67a5ec90 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/TerminalViewTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/TerminalViewTests.cs @@ -286,7 +286,7 @@ public async Task APanesScrollbarIsPaintedOnItsRightEdgeAndDraggingItScrollsInst : global::Avalonia.Media.Color.FromRgb(bytes[i + 2], bytes[i + 1], bytes[i]); } - private static readonly HeadlessUnitTestSession Session = HeadlessUnitTestSession.StartNew(typeof(TestApp)); + internal static readonly HeadlessUnitTestSession Session = HeadlessUnitTestSession.StartNew(typeof(TestApp)); private static Task Run(Func body, WindowDecorations decorations = WindowDecorations.Full) => Session.Dispatch(() => diff --git a/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs b/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs new file mode 100644 index 00000000..62f43f8c --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs @@ -0,0 +1,51 @@ +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Mapping; + +namespace SharpMUTerm.Client.Tests; + +/// The view-models both hosts draw native or cell views from, and the layout library's command ids. +public class PanelModelTests +{ + [Test] + public async Task TwoVitalsModelsWithTheSameMetersAreEqual() + { + static VitalsModel Make() => new([new VitalsMeter("hp", "10", "20", true, 0.5, false)], new VitalsTarget("a rat", 0.1)); + + await Assert.That(Make()).IsEqualTo(Make()); + await Assert.That(Make().GetHashCode()).IsEqualTo(Make().GetHashCode()); + await Assert.That(Make().Target!.Low).IsTrue(); + await Assert.That(new VitalsMeter("mp", "1", null, false, null, false).Title).IsEqualTo("Mana"); + await Assert.That(new VitalsMeter("rage", "1", null, false, null, false).Title).IsEqualTo("rage"); + } + + [Test] + public async Task TheMapViewIsTheCurrentLevelAndAreaWithEachExitOnce() + { + var map = new WorldMap(); + map.Add(new MapRoom { Id = 1, Name = "Plaza", AreaId = 1, X = 0, Y = 0, Exits = { ["north"] = 2, ["up"] = 3 } }); + map.Add(new MapRoom { Id = 2, Name = "Road", AreaId = 1, X = 0, Y = -1, Exits = { ["south"] = 1 } }); + map.Add(new MapRoom { Id = 3, Name = "Tower", AreaId = 1, X = 0, Y = 0, Z = 1 }); + map.Add(new MapRoom { Id = 4, Name = "Elsewhere", AreaId = 2, X = 5, Y = 5 }); + + var view = MapViewModel.From(map, 1, [2], "walking, 1 to go"); + + await Assert.That(view.Rooms.Select(r => r.Id)).IsEquivalentTo(new long[] { 1, 2 }); + await Assert.That(view.Exits).IsEquivalentTo(new[] { new MapViewExit(1, 2) }); + await Assert.That(view.Current!.Name).IsEqualTo("Plaza"); + await Assert.That(view.Rooms.Single(r => r.Id == 2).Ahead).IsTrue(); + await Assert.That(MapViewModel.From(map, 1, [2], "walking, 1 to go")).IsEqualTo(view); + } + + [Test] + public async Task TheLayoutLibraryIsAFamilyThatListsNothingButHandlesItsIds() + { + var registry = new ContributionRegistry(); + BuiltInCommands.Register(registry, _ => true); + + await Assert.That(registry.Commands.Resolve(LayoutCommands.Apply("combat"))).IsNotNull(); + await Assert.That(registry.Commands.Resolve(LayoutCommands.SaveChanges)).IsNotNull(); + await Assert.That(registry.Commands.Resolve("layout:layouts")).IsNotNull(); + } +} From 5afb6bbc15f41a5c5b1cc60157967e02afa2d761 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 04:44:33 +0000 Subject: [PATCH 015/113] Split a scrolled-back pane, and join lines a server hard-wrapped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Scrolling a pane back now splits it inside its own rectangle: the history being read on top, a band ("scrolled back N rows · End returns · ⌥F freezes"), and the newest lines still arriving below. It reuses freeze's two-viewport layout with the window's own control and viewport kept on top, so the scroll keys, wheel, search landing and status row are unchanged; the tail is a re-fed copy of the buffer's last lines and indexes nothing. A split pane is not "scrolled back" for unread badging. F7 ▸ SCROLLBACK turns it off. F5 ▸ join wraps (per world, off by default) joins rows a server broke at its own column, at ingest and before the triggers, through a conservative ServerWrapJoiner: full row, unpunctuated end, lower-case continuation, same style, no prompts, structure or column layouts. A full row is held until the next line or 250 ms of quiet. New snapshot views: scrollback-split, reflow. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 10 + CLAUDE.md | 53 +++- .../Settings/BuiltInSettings.cs | 7 + .../Configuration/PreferenceSettings.cs | 8 + .../Configuration/WorldDefinition.cs | 9 + src/SharpMUTerm.Core/Session/WorldSession.cs | 111 ++++++- src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs | 270 ++++++++++++++++ src/SharpMUTerm.Tui/InputBarControl.cs | 2 +- src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs | 38 +++ .../SharpMUTermApp.ReflowScene.cs | 100 ++++++ .../SharpMUTermApp.ScrollSplit.cs | 274 ++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 53 +++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 20 +- .../Session/WorldSessionReflowTests.cs | 147 +++++++++ .../Text/ServerWrapJoinerTests.cs | 293 ++++++++++++++++++ .../ActivityBarDwellTests.cs | 10 +- .../SharpMUTerm.Tui.Tests/AwayDividerTests.cs | 38 +-- .../FrameContrastTests.cs | 4 + .../JoinWrapsFieldTests.cs | 50 +++ .../OutputScrollbackTests.cs | 20 +- .../SharpMUTerm.Tui.Tests/ScreenModelTests.cs | 15 +- .../SharpMUTerm.Tui.Tests/ScrollSplitTests.cs | 211 +++++++++++++ .../SnapshotViewEmptyConfigTests.cs | 2 +- .../TabActivityIndicatorTests.cs | 1 + .../WindowActivityBoundaryTests.cs | 4 +- 26 files changed, 1705 insertions(+), 47 deletions(-) create mode 100644 src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs create mode 100644 src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.ReflowScene.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Session/WorldSessionReflowTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Text/ServerWrapJoinerTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/JoinWrapsFieldTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/ScrollSplitTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c3266a..16cc6df1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Scrolling a pane back splits it: the history you are reading stays on top, a band says how far back you + are (`scrolled back 120 rows · End returns · ⌥F freezes`), and the newest lines keep arriving underneath. + End (with the cursor at the end of the command line), Ctrl+End, or scrolling the history back down to its end + closes it; ⌥F turns it into a freeze. The split is inside the pane, so the game is not told a new window + size. Text & display (F7) ▸ *split the pane when scrolled back* turns it off. +- Worlds & Characters (F5) has a `join wraps` row on each world: on, lines the game broke at its own width + (usually 78 or 80 columns) are joined back together, so a paragraph fills a wide pane and does not wrap twice + in a narrow one. It is careful — it joins only a full row that ends mid-sentence onto a row that carries on in + lower case, in the same colour — and triggers see the joined line. It applies to lines that arrive after you + turn it on. - Ctrl+P matches as you type by initials and fragments, not only by prefix: `trig sel` finds *Make a trigger from the selection*, and the letters it matched are highlighted. The commands you last ran from it are listed first under RECENT, followed by what the moment suggests (copy while something is selected, back to diff --git a/CLAUDE.md b/CLAUDE.md index 6ddf5c59..6001116d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -501,6 +501,51 @@ fallbacks) for inline images/maps. it. A window that gained nothing gets no bar. - **`SimulateKey` used to discard a global shortcut's result** and swallow the key either way. Harmless while every claim returned true; wrong the moment one declined, and it now honours the decline. +- **Scrolling a pane back splits it** (`SharpMUTermApp.ScrollSplit.cs`, `ScrollSplitBarRenderer`; F7 ▸ + SCROLLBACK ▸ `split the pane when scrolled back`, on by default; the `scrollback-up`/`scrollback-split` views). + History on top, a band (`── scrolled back 120 rows · End returns · ⌥F freezes ──`), the live tail below. + Decisions not to relitigate: + - **It is freeze's layout, not a third way of drawing a pane** — one more arm of `BuildTabContent`, the same + two-viewport grid as `BuildFrozenContent`. But the halves are the other way round: the window's *own* + control and its *own* `_paneScrolls[windowId]` viewport stay on top, so the scroll position, the + scrollback keys, the wheel, `ScrollTarget`, `RevealSearchBar`/`RevealAwayBar` and the status row's segment + all keep addressing the viewport they always did. The bottom (`tail:`) is a *copy* of the buffer's + last `TailLines` (64) lines, re-fed by `RefreshScrollTail` wherever the window's control is told about a + change (`AppendWindowLine`, `RepaintPane`, `InsertImageRows`). It indexes nothing, so no chrome row, trim + or picture has a split point to move — which is why it is not built on `_freezePoints`. + - **Opened and closed in `SyncScrollbackState`**, where every scroll route lands: open while the window's + viewport is detached (`!AutoScroll`) and scrollable, closed once it re-attaches — scrolling the history down + to its end, ⌃End, or bare End. **Bare End is claimed only while a split is open and the command line's + caret is already at its end** (`CaretAtEnd`), where End has nothing left to do in the editor and where a + caret rests after typing; anywhere else End is the editor's and a second press returns. Also closed by ⌥F + (freeze takes over and splits at its freeze point, as it always does), by a frozen pane, and with the setting off. + - **The tail is 30% of the pane's viewport, at least 3 rows, and the history keeps at least 3** + (`TailRowsFor`); a pane shorter than 7 rows does not split. Fixed when the split opens (a `Cells` row), + not re-derived per frame. + - **Inside the pane rectangle, so NAWS never moves**: the band and the tail are rows of the tab's content; + `PaneOutputRects` is unchanged (`ScrollingBackSplitsThePane…` pins it). + - **A split pane is not "scrolled back" for the workspace** (`SetScrolledBack(…, !AutoScroll && !split)`): + its new lines are on screen in the tail, so they badge nothing and record no `NEW` boundary. + - **The band's count is the status row's figure** (display rows below the history viewport, capped through + `UnreadBadge` in a reserved field), refreshed on `PostBufferPaint` with the status row repainted beside it + when it moves, so the two surfaces never disagree. It says *rows*, not lines: a buffer index is not a + viewport row. +- **F5 ▸ `join wraps` joins the lines a server hard-wrapped** (`ServerWrapJoiner`, Core; `WorldSession.Reflow`; + `WorldDefinition.JoinWrappedLines`, off by default; the `reflow` view). **A false join is worse than a missed + one**, so every condition is a reason not to join: the wrap column is known (third-longest of the last 128 + non-blank lines, at least 8 seen, at least 40); neither line is a prompt, blank, rule-coloured, interactive + (MXP), or holds a three-space run (a column layout); the first row is *full* — within `Slack` (max(8, col/6)) + of the column, no longer than it, and the next line's first word would not have fitted (one cell of + tolerance) — and ends in a letter, digit or comma (never a hyphen); the next starts unindented with a + lower-case letter; the style at the break is the same on both sides. Joined with one space; a paragraph + chains, each decision against the previous *physical* row. Decisions not to relitigate: + - **Ingest-time, in Core, before the triggers** — so a trigger matches the line the player reads, including + a phrase the server split. Like `strip incoming colour`, it changes the next line and never history. + - **A full row is held until the next line says whether it continues**, and released after + `ReflowHold` (250 ms) of quiet, by a prompt, a blank line, a parser swap or a disconnect — so nothing is + shown out of order and only the last full row of a burst is ever late (a paragraph's last row is short and + never held). The read loop and that timer share `_ingestGate`; nothing on the UI thread or in a script takes + it, so it cannot close a cycle with the script host's lock. Rebuilt per connection, like the parser. - **Every server's MSSP report is kept, and the INFO screen reads it** (`MsspCache`, Core; `mssp.json` beside `config.json`, keyed by `host:port`; F5 ▸ `i`). Fourth of the `save:`/`logRoot:`/`restore:` family with **one deliberate difference**: the constructor parameter is null by default like the @@ -1130,7 +1175,11 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg a report, a server that answered and publishes none, and a world nothing has dialled; all three reached by driving the real `i` into a real F5, and all three needed because the two empty ones are the pair it is easy to conflate), `web`, - `rail-long`, `scrollback`, `scrollback-up`, `freeze-scrollback`, + `rail-long`, `scrollback`, `scrollback-up` (now the split opening, since split scrollback is on by default), + `scrollback-split` (the split doing its job: scrolled back, then more output arriving in the live tail under + the band while the history stays put), `reflow` (one room as a server wrapping at 78 sends it, then the same + rows through `ServerWrapJoiner` — ragged short of the edge at 120 columns, wrapping twice at 80), + `freeze-scrollback`, `links` (a URL too long for the pane it arrived in — a split, so the pane is narrower than the terminal, which is the whole defect; the frame shows one underlined span running to the pane's edge and continuing on the next row), `away`/`away-scrollback` (the bar marking where the reader was when they tabbed away from the @@ -1211,7 +1260,7 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg `LogFolder` or a fake sink would have passed all along. It also let a pile of per-test `character.Logging = new LoggingSettings()` workarounds be deleted — with them gone the suite exercises the gate, and an unfixed build leaks seven files a run instead of three. -- **Four views have more output than a pane holds** — `scrollback`, `scrollback-up`, +- **Five views have more output than a pane holds** — `scrollback`, `scrollback-up`, `scrollback-split`, `freeze-scrollback` and `away-scrollback`. Name them, rather than saying "the `scroll*` views": the prefix has now twice lagged behind the set it claimed to describe, and a reader looking for a long-output view goes by the list. (`away` is the shallow one and fits.) Every other view fits too, diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index c700a2b9..d3652a7b 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -32,6 +32,9 @@ public static class BuiltInSettings /// The bar marking where a reader left a window. public const string ActivityGroup = "Activity"; + /// What a pane does when it is scrolled back. + public const string ScrollbackGroup = "Scrollback"; + /// Game sound; drawn only where a host passes the sound settings. public const string SoundGroup = "Sound"; @@ -100,6 +103,10 @@ public static class BuiltInSettings c => c.Text.ActivityBarSeconds, (c, v) => c.Text.ActivityBarSeconds = v, "how long the NEW bar stays once you are back; 0 retires it at once", "unread new away"), + Flag("split-scrollback", "split the pane when scrolled back", ScrollbackGroup, + c => c.Text.SplitScrollback, (c, v) => c.Text.SplitScrollback = v, + "keep the newest lines in view below the history you are reading", "live tail history split"), + Flag("sound", "game sound", SoundGroup, c => c.Sound.Enabled, (c, v) => c.Sound.Enabled = v, "play the sounds and music a world sends", "audio mcmp msp"), diff --git a/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs b/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs index 4a643d5a..258f9da3 100644 --- a/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs +++ b/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs @@ -155,6 +155,14 @@ public sealed class TextSettings /// public int ActivityBarSeconds { get; set; } = DefaultActivityBarSeconds; + /// + /// Whether scrolling a pane back splits it: the history being read above, a band saying how far back it + /// is, and the newest few rows still arriving below (F7 ▸ SCROLLBACK, on by default). The split is inside + /// the pane, so it costs no cell of the pane's rectangle and reports no new size to a server. Off, a pane + /// scrolls as a whole, as it always did. A display setting, read when a pane is next scrolled back. + /// + public bool SplitScrollback { get; set; } = true; + /// Thirty seconds: long enough to read a screenful, short enough not to become furniture. public const int DefaultActivityBarSeconds = 30; diff --git a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs index c234a6ce..8b64c6dc 100644 --- a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs +++ b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs @@ -181,6 +181,14 @@ public sealed class WorldDefinition /// public string? GrabPrefix { get; set; } + /// + /// Whether lines this world hard-wrapped at its own column are joined back together, so a paragraph + /// reflows to the pane it is read in (F5 ▸ join wraps). Off by default. Read per line at ingest, + /// so it changes the next line and never the ones already shown; triggers see the joined line. The rule + /// is 's, and it is deliberately conservative. + /// + public bool JoinWrappedLines { get; set; } + /// /// The world's accent colour, used to keep its windows traceable to their owner once they /// scatter across panes. Default resolves to a theme-derived accent. @@ -231,6 +239,7 @@ public sealed class WorldDefinition Map = Map.Clone(), DownloadMedia = DownloadMedia, GrabPrefix = GrabPrefix, + JoinWrappedLines = JoinWrappedLines, GmcpLogin = GmcpLogin, DiscordPresence = DiscordPresence, Layout = Layout, diff --git a/src/SharpMUTerm.Core/Session/WorldSession.cs b/src/SharpMUTerm.Core/Session/WorldSession.cs index 4c7a4530..ab0f9499 100644 --- a/src/SharpMUTerm.Core/Session/WorldSession.cs +++ b/src/SharpMUTerm.Core/Session/WorldSession.cs @@ -330,9 +330,13 @@ private void UpgradeParser(ContentFormat format) return; } - if (_parser.Flush() is { } tail) + lock (_ingestGate) { - ProcessOutputLine(tail); + ReleaseHeldLine(); + if (_parser.Flush() is { } tail) + { + ProcessOutputLine(tail); + } } _parser = NewParser(format); @@ -595,6 +599,11 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) // negotiated again to take it back off ANSI. _parser = NewParser(World.ContentFormat); + // No lock: the old connection's read loop has ended (its transport is disposed above), and a release + // timer still pending checks it is releasing for this joiner before it does anything. + _reflowRelease?.Dispose(); + _wrapJoiner = new ServerWrapJoiner(); + // Re-read with the parser, so an F5 change to the world's emoji switches reaches the next connection. _emoji = NewEmoji(World.Emoji); @@ -674,9 +683,97 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) } private void OnOutputReceived(object? sender, TelnetOutputEventArgs e) + { + lock (_ingestGate) + { + IngestOutput(e); + } + } + + /// + /// The joiner for , rebuilt per connection like the parser: + /// the wrap column it has learnt and any line it holds belong to one stream. + /// + private ServerWrapJoiner _wrapJoiner = new(); + + /// + /// Serialises the read loop (output, a parser swap, the disconnect) against the timer that releases a held + /// line (). Nothing on the UI thread or in a script takes it, so it cannot close a + /// cycle with the script host's lock, which a trigger script takes from inside it. + /// + private readonly object _ingestGate = new(); + + /// The pending release of a held line, or null when nothing is held. + private IDisposable? _reflowRelease; + + /// + /// How long a line that might continue waits for the next before it is shown as it is. Short, because the + /// only line ever held is a full row at the end of a burst — the rows of a paragraph arrive in + /// one write, and its last row is short and is never held. + /// + public TimeSpan ReflowHold { get; set; } = TimeSpan.FromMilliseconds(250); + + /// + /// Hands a completed line on, through the joiner when this world joins the server's wraps. Every + /// ordinary line of output goes through here; a prompt, a deliberate blank line and a parser swap release + /// what is held first (), so nothing is ever shown out of order. + /// + private void Reflow(StyledLine line) + { + if (!World.JoinWrappedLines) + { + ReleaseHeldLine(); + ProcessOutputLine(line); + return; + } + + foreach (var ready in _wrapJoiner.Push(line)) + { + ProcessOutputLine(ready); + } + + if (_wrapJoiner.Holding) + { + CancelReflowHold(); + var joiner = _wrapJoiner; + _reflowRelease = Scheduler.After(ReflowHold, () => + { + lock (_ingestGate) + { + if (ReferenceEquals(joiner, _wrapJoiner)) + { + ReleaseHeldLine(); + } + } + }, "reflow-hold"); + } + else + { + CancelReflowHold(); + } + } + + /// Shows the line the joiner is holding, unjoined, if it is holding one. Call under . + private void ReleaseHeldLine() + { + CancelReflowHold(); + if (_wrapJoiner.Flush() is { } held) + { + ProcessOutputLine(held); + } + } + + private void CancelReflowHold() + { + _reflowRelease?.Dispose(); + _reflowRelease = null; + } + + private void IngestOutput(TelnetOutputEventArgs e) { if (e.IsPrompt) { + ReleaseHeldLine(); _parser.Feed(e.Text); var flushed = _parser.Flush(); var raw = flushed ?? StyledLine.Empty; @@ -703,18 +800,19 @@ private void OnOutputReceived(object? sender, TelnetOutputEventArgs e) var emitted = false; foreach (var completed in _parser.Feed(e.Text)) { - ProcessOutputLine(completed); + Reflow(completed); emitted = true; } var tail = _parser.Flush(); if (tail is not null) { - ProcessOutputLine(tail); + Reflow(tail); emitted = true; } else if (!emitted && _parser is not MxpParser { LineSwallowed: true }) { + ReleaseHeldLine(); ProcessOutputLine(StyledLine.Empty); } } @@ -1235,6 +1333,11 @@ private void OnEncodingChanged(object? sender, SessionEncodingEventArgs e) private void OnDisconnected(object? sender, SessionDisconnectedEventArgs e) { + lock (_ingestGate) + { + ReleaseHeldLine(); + } + CancelGmcpLogin(); StopTimers(); ClearPrompt(); diff --git a/src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs b/src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs new file mode 100644 index 00000000..881b50e9 --- /dev/null +++ b/src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs @@ -0,0 +1,270 @@ +namespace SharpMUTerm.Core.Text; + +/// +/// Joins back together the lines a server broke at its own wrap column, so a paragraph reflows to the pane +/// it is read in rather than to the 78 or 80 columns the game assumed (F5 ▸ join wraps, per world, +/// off by default; ). +/// +/// A false join is worse than a missed one, so every condition below is a reason not to join +/// and they all have to pass. A missed join leaves the text exactly as the server sent it, which is what +/// every client shows today; a false join glues a room's exits onto its description or a channel line onto +/// the one above it, and nothing on screen says it happened. The rule, exactly: +/// +/// +/// The wrap column is known: it is the third longest of the last +/// non-blank lines (trailing spaces ignored), once there are of them, and only +/// if it is at least . Third rather than first so one or two over-long lines +/// do not move it; a block of wide ASCII art does, upwards, which stops joining while it is in the window — +/// the safe direction to fail in. +/// Neither line is a prompt, blank, carries a rule colour, or holds an interactive span (an MXP +/// <SEND>, link or image): structured lines are the server's layout, not its wrapping. +/// Neither line has a run of three spaces inside it — a column layout (a who list, a score sheet) +/// is not prose. +/// The first line is full: no longer than the wrap column, no shorter than it by more than +/// , and the next line's first word would not have fitted on it (within one cell, +/// since the column is the longest row seen and can fall a cell short of the server's) — the signature of +/// a greedy word wrap, and the one condition that tells a wrapped line from a short line that happens to +/// end unpunctuated. +/// The first line ends in a letter, a digit or a comma. Not a full stop, colon, closing quote, +/// bracket or hyphen: a hyphen would have to be either kept or dropped, and both are wrong half the +/// time. +/// The next line starts, with no indentation, with a lower-case letter. +/// The style the first line ends in is the style the next one starts in. +/// +/// +/// Lines are joined with one space. A paragraph of several rows chains, each decision taken against the +/// previous physical row (its length is what the server measured), never against the joined line. +/// +/// +/// It is a stream: a line that could be continued is held until the next one says whether it is. The +/// session releases a held line after a short quiet period too (WorldSession.ReflowHold), so only +/// the last full row of a burst is ever delayed — the last row of a paragraph is short, and a short row is +/// never held. +/// +/// +public sealed class ServerWrapJoiner +{ + /// How many recent lines the wrap column is estimated from. + public const int SampleWindow = 128; + + /// How many non-blank lines must have been seen before anything is joined. + public const int MinimumSamples = 8; + + /// Below this a "wrap column" is short output, not wrapping, and nothing is joined. + public const int MinimumWrapColumn = 40; + + private readonly Queue _lengths = new(); + private StyledLine? _held; + private StyledLine? _lastPhysical; + + /// The wrap column the stream has shown so far, or null while it is unknown. + public int? WrapColumn + { + get + { + if (_lengths.Count < MinimumSamples) + { + return null; + } + + var third = _lengths.OrderByDescending(l => l).Skip(2).First(); + return third >= MinimumWrapColumn ? third : null; + } + } + + /// How far short of the wrap column a row may end and still be called full. + public static int Slack(int wrapColumn) => Math.Max(8, wrapColumn / 6); + + /// Whether a line is waiting for the next one to say whether it continues. + public bool Holding => _held is not null; + + /// + /// Takes the next line of the stream and returns the lines that are now final, in order: none while a + /// line is held, the held line (joined or not) once it is settled, and then possibly this one. + /// + public IReadOnlyList Push(StyledLine line) + { + ArgumentNullException.ThrowIfNull(line); + Observe(line); + + var ready = new List(2); + if (_held is { } held && _lastPhysical is { } last) + { + if (WrapColumn is { } column && Continues(last, line, column)) + { + _held = Join(held, line); + _lastPhysical = line; + if (!IsFull(line, column)) + { + ready.Add(_held); + _held = null; + _lastPhysical = null; + } + + return ready; + } + + ready.Add(held); + _held = null; + _lastPhysical = null; + } + + if (WrapColumn is { } wrap && IsFull(line, wrap)) + { + _held = line; + _lastPhysical = line; + } + else + { + ready.Add(line); + } + + return ready; + } + + /// Releases the held line, if there is one: the stream went quiet, or something else is about to be shown. + public StyledLine? Flush() + { + var held = _held; + _held = null; + _lastPhysical = null; + return held; + } + + /// + /// Whether is a row the server filled: the conditions that are about the first + /// line alone (items 2–5 of the rule, less the next word's fit). + /// + public static bool IsFull(StyledLine line, int wrapColumn) + { + ArgumentNullException.ThrowIfNull(line); + if (!IsPlainProse(line)) + { + return false; + } + + var text = line.Text.TrimEnd(); + if (text.Length > wrapColumn || text.Length < wrapColumn - Slack(wrapColumn)) + { + return false; + } + + var last = text[^1]; + return char.IsLetterOrDigit(last) || last == ','; + } + + /// + /// Whether continues , a row already known to be + /// full: the conditions that need both lines (items 4, 6 and 7 of the rule). + /// + public static bool Continues(StyledLine previous, StyledLine next, int wrapColumn) + { + ArgumentNullException.ThrowIfNull(previous); + ArgumentNullException.ThrowIfNull(next); + if (!IsFull(previous, wrapColumn) || !IsPlainProse(next)) + { + return false; + } + + var text = next.Text; + if (!char.IsLower(text[0])) + { + return false; + } + + // The next line's first word would not have fitted on the previous one, so the server had to break. + // One cell of tolerance, because the column is the longest row seen, which can fall a cell short of + // the server's own. + var firstWord = text.IndexOf(' ') is var space and >= 0 ? space : text.TrimEnd().Length; + if (previous.Text.TrimEnd().Length + 1 + firstWord < wrapColumn) + { + return false; + } + + return LastStyle(previous) == next.Spans[0].Style; + } + + /// One line made of two, with a single space where the server broke it. + public static StyledLine Join(StyledLine previous, StyledLine next) + { + ArgumentNullException.ThrowIfNull(previous); + ArgumentNullException.ThrowIfNull(next); + + var spans = new List(previous.Spans.Count + next.Spans.Count + 1); + spans.AddRange(previous.Spans); + + // Trailing whitespace off the first line, so the join is exactly one space whatever the server padded with. + while (spans.Count > 0 && spans[^1].Text.TrimEnd() is var trimmed && trimmed.Length < spans[^1].Text.Length) + { + var span = spans[^1]; + spans.RemoveAt(spans.Count - 1); + if (trimmed.Length > 0) + { + spans.Add(new StyledSpan(trimmed, span.Style, span.Interaction)); + break; + } + } + + var style = spans.Count > 0 ? spans[^1].Style : TextStyle.Default; + spans.Add(new StyledSpan(" ", style)); + spans.AddRange(next.Spans); + return new StyledLine(spans, previous.RuleColor, previous.IsPrompt); + } + + /// Records a line's length towards the wrap column. Blank lines say nothing about it. + private void Observe(StyledLine line) + { + var length = line.Text.TrimEnd().Length; + if (length == 0 || line.IsPrompt) + { + return; + } + + _lengths.Enqueue(length); + while (_lengths.Count > SampleWindow) + { + _lengths.Dequeue(); + } + } + + /// Item 2 and 3 of the rule: an ordinary run of text, not a prompt, a structure or a column layout. + private static bool IsPlainProse(StyledLine line) + { + if (line.IsPrompt || line.RuleColor is not null || line.Spans.Count == 0) + { + return false; + } + + foreach (var span in line.Spans) + { + if (span.IsInteractive) + { + return false; + } + } + + var text = line.Text; + var start = 0; + while (start < text.Length && text[start] == ' ') + { + start++; + } + + var body = text.AsSpan(start).TrimEnd(); + return body.Length > 0 && body.IndexOf(" ", StringComparison.Ordinal) < 0; + } + + /// The style of the last visible character of a line. + private static TextStyle LastStyle(StyledLine line) + { + for (var i = line.Spans.Count - 1; i >= 0; i--) + { + if (line.Spans[i].Text.TrimEnd().Length > 0) + { + return line.Spans[i].Style; + } + } + + return line.Spans[^1].Style; + } +} diff --git a/src/SharpMUTerm.Tui/InputBarControl.cs b/src/SharpMUTerm.Tui/InputBarControl.cs index 2ae86c63..a07bc082 100644 --- a/src/SharpMUTerm.Tui/InputBarControl.cs +++ b/src/SharpMUTerm.Tui/InputBarControl.cs @@ -237,7 +237,7 @@ private void ApplyColors() } /// Whether the caret is after the last character, which is the only place ⇥ completes. - private bool CaretAtEnd() + internal bool CaretAtEnd() { var text = Text; var last = text.LastIndexOf('\n'); diff --git a/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs b/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs new file mode 100644 index 00000000..7f8c4e89 --- /dev/null +++ b/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs @@ -0,0 +1,38 @@ +namespace SharpMUTerm.Tui; + +/// +/// The band across a pane split by scrolling back (── scrolled back 120 rows · End returns · ⌥F freezes ──), +/// between the history being read above and the live tail below. Fifth of the boundary bars, and like +/// it is both the label and the divider. Pure, so its width is testable. +/// +internal static class ScrollSplitBarRenderer +{ + /// + /// The bar for a viewport display rows above its newest line, exactly + /// cells wide. The count is a reserved field capped the way the status row's is + /// (), so the label does not move as output arrives; the hints are dropped, last + /// first, when the pane is too narrow for them, and the rule takes whatever is left. + /// + public static string Bar(int rowsBack, int width, string accentHex) + { + ArgumentException.ThrowIfNullOrEmpty(accentHex); + + var count = UnreadBadge.Format(Math.Max(1, rowsBack)).PadLeft(UnreadBadge.FieldWidth); + var label = $"{Glyphs.Scrollback} scrolled back {count} rows"; + string[] hints = ["End returns", "⌥F freezes"]; + + for (var keep = hints.Length; keep >= 0; keep--) + { + var hint = keep == 0 ? string.Empty : " · " + string.Join(" · ", hints.Take(keep)); + var lead = keep > 0 || width >= label.Length + 4 ? "── " : string.Empty; + var used = lead.Length + label.Length + hint.Length + 1; // lead + label + hints + " " + if (used + 2 <= width || keep == 0) + { + var rule = new string('─', Math.Max(0, width - used)); + return $"[dim]{lead}[/][{accentHex}]{MarkupText.Escape(label)}[/][dim]{MarkupText.Escape(hint)} {rule}[/]"; + } + } + + return string.Empty; // unreachable: keep == 0 always returns + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ReflowScene.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ReflowScene.cs new file mode 100644 index 00000000..ee8bb794 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ReflowScene.cs @@ -0,0 +1,100 @@ +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Tui; + +/// +/// The reflow snapshot view: one room as a server that wraps at 78 columns sends it, shown twice in the +/// main window — first as the rows arrived, then through as a world with F5 ▸ +/// join wraps on shows it. The demo has no live session, so the joiner is run here over the same rows a +/// session would hand it; WorldSessionReflowTests pins the session doing the same. +/// +internal sealed partial class SharpMUTermApp +{ + /// The column the demo's server wraps at. + internal const int ReflowSceneColumn = 78; + + /// The demo room, as prose; wrapped at on the way in. + internal static readonly string[] ReflowSceneParagraphs = + [ + "The Grand Bazaar sprawls beneath a canopy of patched sailcloth. Stalls lean against one another in " + + "crooked rows, their awnings dyed every colour a merchant could afford, and the travelling Merchants " + + "of the Salt Road call out their prices over the clatter of carts.", + ]; + + /// + /// Lays the scene into the main window. Sized to fit an 80x24 pane with both halves showing: one + /// paragraph and the exits line, which is never joined (it starts with a capital), in each half. + /// + private void LoadReflowScene() + { + var rows = new List(); + foreach (var paragraph in ReflowSceneParagraphs) + { + rows.AddRange(GreedyWrap(paragraph, ReflowSceneColumn).Select(r => StyledLine.FromText(r, TextStyle.Default))); + } + + rows.Add(StyledLine.FromText("Obvious exits: north, south, east and down.", TextStyle.Default)); + + AppendWindowLine(MainWindowId, $"[dim]── join wraps off · as sent, wrapped at {ReflowSceneColumn}[/]"); + foreach (var row in rows) + { + AppendWindowLine(MainWindowId, _formatter.ToMarkup(row)); + } + + AppendWindowLine(MainWindowId, "[dim]── join wraps on · the same rows, joined[/]"); + + // Taught the column the way a session learns it, from lines it has already seen. + var joiner = new ServerWrapJoiner(); + for (var i = 0; i < ServerWrapJoiner.MinimumSamples; i++) + { + foreach (var row in rows) + { + joiner.Push(row); + } + } + + joiner.Flush(); + foreach (var row in rows) + { + foreach (var ready in joiner.Push(row)) + { + AppendWindowLine(MainWindowId, _formatter.ToMarkup(ready)); + } + } + + if (joiner.Flush() is { } held) + { + AppendWindowLine(MainWindowId, _formatter.ToMarkup(held)); + } + } + + /// A greedy word wrap, the way a server does it. + internal static List GreedyWrap(string text, int width) + { + var rows = new List(); + var row = string.Empty; + foreach (var word in text.Split(' ')) + { + if (row.Length == 0) + { + row = word; + } + else if (row.Length + 1 + word.Length <= width) + { + row += " " + word; + } + else + { + rows.Add(row); + row = word; + } + } + + if (row.Length > 0) + { + rows.Add(row); + } + + return rows; + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs new file mode 100644 index 00000000..9063a7ef --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs @@ -0,0 +1,274 @@ +using SharpConsoleUI; +using SharpConsoleUI.Controls; +using SharpConsoleUI.Layout; +using SharpConsoleUI.Builders; + +namespace SharpMUTerm.Tui; + +/// +/// Split scrollback (F7 ▸ SCROLLBACK ▸ split the pane when scrolled back, on by default): a pane scrolled +/// back off its live tail splits into the history being read above, a band saying how far back it is, and the +/// newest rows still arriving below — what Mudlet and TinTin++ readers expect, where before the new lines +/// landed out of sight under the viewport. +/// +/// It is freeze's layout with a different trigger, not a third way of drawing a pane. The same grid of +/// two scroll viewports and a one-row bar (), the same ScrollViewFor +/// viewports, chosen by the same branch of . What differs is which half is the +/// window's real control: freeze moves the live control to the bottom and pins a copy of the history above; +/// here the window's own control and its own viewport stay on top — so the reader's scroll position, the +/// scrollback keys, the wheel, ⌃F's landing and the status row's segment all keep working on the viewport +/// they always addressed — and the bottom is a view of the buffer's last +/// lines, re-fed from it. It indexes nothing, so no chrome row, trim or picture has a split point to move. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// Windows currently split, and how many rows their live tail was given when the split opened. + private readonly Dictionary _scrollSplits = new(StringComparer.Ordinal); + + /// Each split window's live-tail control: a copy of the buffer's newest lines. + private readonly Dictionary _scrollTails = new(StringComparer.Ordinal); + + /// Each split window's band. + private readonly Dictionary _scrollSplitBars = new(StringComparer.Ordinal); + + /// What each band last said, so an unchanged count costs no repaint. + private readonly Dictionary _scrollSplitBarText = new(StringComparer.Ordinal); + + /// The share of a pane the live tail takes when a split opens. + internal const double TailShare = 0.3; + + /// The fewest rows a live tail is given, and the fewest the history above it keeps. + internal const int MinimumSplitRows = 3; + + /// + /// How many of the newest lines the live tail holds. Far more than it shows — a line wraps into several + /// rows in a narrow pane — and few enough that re-feeding it per line costs nothing worth measuring. + /// + internal const int TailLines = 64; + + /// + /// The rows a live tail gets in a pane whose viewport is tall, or zero when the + /// pane is too short to split: 30% of it, at least , leaving the history and + /// the band at least that many and one. + /// + internal static int TailRowsFor(int paneRows) + { + var tail = Math.Max(MinimumSplitRows, (int)Math.Round(paneRows * TailShare)); + return paneRows - 1 - tail >= MinimumSplitRows ? tail : 0; + } + + /// Whether the workspace counts a window as scrolled back, which is what unread badging reads. + internal bool IsWindowScrolledBack(string windowId) => _workspace.FindWindow(windowId)?.ScrolledBack ?? false; + + /// Whether a window is drawn split by scrollback right now. + internal bool IsScrollSplit(string windowId) => _scrollSplits.ContainsKey(windowId); + + /// + /// Opens or closes a window's split to match its viewport: open while the viewport is off its live tail, + /// closed once it is back (the reader scrolled the history down to its end, ⌃End, or End), when the pane is + /// frozen (freeze is the other split, and takes over), and when the setting is off. Called from + /// , where every scroll route lands. + /// + private void SyncScrollSplit(string windowId) + { + var open = _scrollSplits.ContainsKey(windowId); + var pane = _workspace.Layout.FindWindow(windowId); + var live = _paneScrolls.GetValueOrDefault(windowId); + var eligible = _config.Text.SplitScrollback + && pane is { Frozen: false } + && string.Equals(pane.ActiveTab, windowId, StringComparison.Ordinal) + && _panes.ContainsKey(windowId) + && !string.Equals(windowId, WebWindowId, StringComparison.Ordinal) + && live is not null; + var wanted = eligible && !live!.AutoScroll && Scrollable(live); + + if (open && !wanted) + { + CloseScrollSplit(windowId); + RebuildPaneArea(); + return; + } + + if (!open && wanted) + { + var tail = TailRowsFor(live!.ViewportHeight); + if (tail == 0) + { + return; + } + + _scrollSplits[windowId] = tail; + RefreshScrollTail(windowId); + RebuildPaneArea(); + } + + if (_scrollSplits.ContainsKey(windowId)) + { + RefreshScrollSplitBar(windowId); + } + } + + /// Forgets a window's split without rebuilding; the caller rebuilds (or is about to). + private void CloseScrollSplit(string windowId) + { + _scrollSplits.Remove(windowId); + if (_scrollTails.TryGetValue(windowId, out var tail)) + { + tail.ClearSelection(); + tail.SetContent(new List()); + } + } + + /// Drops everything a closed window kept for its split. + private void ForgetScrollSplit(string windowId) + { + _scrollSplits.Remove(windowId); + _scrollTails.Remove(windowId); + _scrollSplitBars.Remove(windowId); + _scrollSplitBarText.Remove(windowId); + _paneScrolls.Remove(TailRegionKey(windowId)); + } + + /// The key of a split window's live-tail half. + private static string TailRegionKey(string windowId) => $"tail:{windowId}"; + + /// + /// A split window's content: the window's own control in its own viewport, the band, and the live tail. + /// The tail's height is set when the split opens and kept for its life; history takes the rest. + /// + private IWindowControl BuildScrollSplitContent(string windowId, string title) + { + var live = PaneContentFor(windowId, title); + var tail = ScrollTailFor(windowId); + RefreshScrollTail(windowId); + var bar = ScrollSplitBarFor(windowId); + RefreshScrollSplitBar(windowId); + + var grid = Controls.Grid() + .WithAlignment(HorizontalAlignment.Stretch) + .WithVerticalAlignment(VerticalAlignment.Fill); + grid.Rows(GridLength.Star(1), GridLength.Cells(1), GridLength.Cells(_scrollSplits[windowId])) + .Columns(GridLength.Star(1)); + grid.Place(ScrollViewFor(windowId, live), 0, 0, 1, 1); + grid.Place(bar, 1, 0, 1, 1); + grid.Place(ScrollViewFor(TailRegionKey(windowId), tail), 2, 0, 1, 1); + return grid.Build(); + } + + private MarkupControl ScrollTailFor(string windowId) + { + if (_scrollTails.TryGetValue(windowId, out var existing)) + { + return existing; + } + + var control = new MarkupControl(new List()); + control.LinkClicked += (_, e) => OnLinkClicked(windowId, e.Url); + EnableSelection(control); + _scrollTails[windowId] = control; + return control; + } + + private MarkupControl ScrollSplitBarFor(string windowId) + { + if (_scrollSplitBars.TryGetValue(windowId, out var existing)) + { + return existing; + } + + var bar = new MarkupControl(new List()) { Wrap = false }; + _scrollSplitBars[windowId] = bar; + return bar; + } + + /// + /// Re-feeds a split window's live tail from the buffer's newest lines. Called after every change to the + /// buffer the window's own control is told about — an appended line, a re-feed, a picture — so the two + /// halves never disagree about the newest line. + /// + private void RefreshScrollTail(string windowId) + { + if (!_scrollSplits.ContainsKey(windowId) || !_lines.TryGetValue(windowId, out var buffer)) + { + return; + } + + var tail = ScrollTailFor(windowId); + var from = Math.Max(0, buffer.Count - TailLines); + FeedRange(tail, buffer, from, buffer.Count - from); + if (_paneScrolls.GetValueOrDefault(TailRegionKey(windowId)) is { } panel) + { + panel.AutoScroll = true; + } + } + + /// + /// Re-writes a split window's band from its history viewport: the rows below what the reader is looking + /// at, the same figure the status row's scrollback segment reports, so the two never disagree. + /// + private bool RefreshScrollSplitBar(string windowId) + { + if (!_scrollSplits.ContainsKey(windowId) || _paneScrolls.GetValueOrDefault(windowId) is not { } panel) + { + return false; + } + + var bar = ScrollSplitBarFor(windowId); + var width = panel.ViewportWidth > 0 ? panel.ViewportWidth : 80; + var below = panel.TotalContentHeight - panel.ViewportHeight - panel.VerticalScrollOffset; + var markup = ScrollSplitBarRenderer.Bar(below, width, _ink.Notice); + if (!string.Equals(_scrollSplitBarText.GetValueOrDefault(windowId), markup, StringComparison.Ordinal)) + { + _scrollSplitBarText[windowId] = markup; + bar.SetContent(new List { markup }); + return true; + } + + return false; + } + + /// + /// Keeps every band's count current; rides PostBufferPaint, where viewport metrics are fresh. A count + /// that moved is a count the status row's scrollback segment also reports, so the row is repainted with it + /// and the two never disagree. It converges: the next frame finds both unchanged. + /// + private void SyncScrollSplitBars() + { + var changed = false; + foreach (var windowId in _scrollSplits.Keys) + { + changed |= RefreshScrollSplitBar(windowId); + } + + if (changed) + { + RefreshStatusRow(); + } + } + + /// + /// Bare End returns a split pane to its live tail, but only when the caret is already at the end of the + /// command line: there End has nothing left to do in the editor, and that is where a caret rests after + /// typing. Anywhere else End is the editor's, and a second End returns. + /// + private bool TryEndReturnsFromSplit(KeyPressedEventArgs e) + { + if (e.KeyInfo.Key != ConsoleKey.End || e.KeyInfo.Modifiers != 0) + { + return false; + } + + var windowId = _workspace.Layout.FocusedPane.ActiveTab ?? MainWindowId; + if (!_scrollSplits.ContainsKey(windowId) || !ActiveBar().CaretAtEnd() + || _paneScrolls.GetValueOrDefault(windowId) is not { } panel) + { + return false; + } + + e.Handled = true; + BackToLive(panel); + SyncScrollbackState(); + return true; + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 9d6212e1..1c68a710 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1000,6 +1000,7 @@ public SharpMUTermApp( PublishScrollbars(); SyncMapSizes(); SyncPanelSizes(); + SyncScrollSplitBars(); }; if (_sixel is not null) { @@ -1496,6 +1497,31 @@ public string RenderSnapshot(string? view = null) } } + // Split scrollback (F7 ▸ SCROLLBACK): the same long buffer scrolled back with real PgUp keys, and then + // more output arriving — which lands in the live tail under the band while the history the reader + // scrolled to stays exactly where it was. `scrollback-up` shows the split opening; this one shows it + // doing its job. + if (string.Equals(view, "scrollback-split", StringComparison.OrdinalIgnoreCase)) + { + LoadLongScene(MainWindowId, ScrollbackSceneLines); + SettleScroll(); + SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.PageUp, false, false, false)); + SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.PageUp, false, false, false)); + SettleScroll(); + LoadLongScene(MainWindowId, 4, first: ScrollbackSceneLines + 1); + SettleScroll(); + ReArmWholeFrame(); + } + + // F5 ▸ join wraps: one room as a server wrapping at 78 sends it, then the same rows joined. In a pane + // wider than 80 the first block stops short of the edge; in a narrower one its rows wrap again. + if (string.Equals(view, "reflow", StringComparison.OrdinalIgnoreCase)) + { + LoadReflowScene(); + SettleScroll(); + ReArmWholeFrame(); + } + // The bar marking where the reader was when they tabbed away from the terminal. Two views, // because the two states it has are the two ends of the consumption rule. `away` is a shallow // absence: the bar and everything below it are on screen at once, which is the frame where the @@ -3233,6 +3259,8 @@ private void AppendWindowLine( { control.AppendLine(Compose(buffer[^1])); } + + RefreshScrollTail(windowId); } /// The most lines a pane's buffer (and so its control) is trimmed back to. @@ -3475,6 +3503,8 @@ private void RepaintPane(string windowId) { FeedRange(control, buffer, 0, buffer.Count); } + + RefreshScrollTail(windowId); } /// @@ -4349,6 +4379,8 @@ private void InsertImageRows(string windowId, long anchor, IReadOnlyList { control.AppendLine(row); } + + RefreshScrollTail(windowId); } else { @@ -6194,6 +6226,11 @@ private bool TryScrollKey(KeyPressedEventArgs e) return false; } + if (TryEndReturnsFromSplit(e)) + { + return true; + } + Action? scroll = (key, ctrl, shift) switch { (ConsoleKey.PageUp, false, _) => panel => panel.ScrollVerticalBy(-PageRows(panel)), @@ -6307,8 +6344,12 @@ private void ScrollFocusedPane(Action move) private void SyncScrollbackState(string? windowId = null) { windowId ??= ActiveWindowId(); + + // A split pane is not one whose new lines go unseen — they are arriving in its live tail — so it is + // not "scrolled back" for the unread badge or the activity bar, whatever its history viewport says. + SyncScrollSplit(windowId); if (_paneScrolls.GetValueOrDefault(windowId) is { } live - && _workspace.SetScrolledBack(windowId, !live.AutoScroll)) + && _workspace.SetScrolledBack(windowId, !live.AutoScroll && !IsScrollSplit(windowId))) { RefreshTabTitles(); } @@ -9118,6 +9159,10 @@ private void ToggleFreeze() var windowId = pane.ActiveTab ?? MainWindowId; _workspace.Layout.ToggleFreezeFocused(); + // Freeze is the other split, and takes over from a scrollback one: the pane splits at the freeze + // point, as ⌥F always does, and the scrollback split is forgotten rather than drawn inside it. + CloseScrollSplit(windowId); + if (pane.Frozen) { _freezePoints[windowId] = _lines.TryGetValue(windowId, out var buf) ? buf.Count : 0; @@ -10609,6 +10654,11 @@ private IWindowControl BuildTabContent(PaneNode pane, string windowId, Workspace return BuildFrozenContent(windowId, window.Title); } + if (pane.ActiveTab == windowId && _scrollSplits.ContainsKey(windowId)) + { + return BuildScrollSplitContent(windowId, window.Title); + } + if (windowId == WebWindowId) { return BuildWebContent(window.Title); @@ -12294,6 +12344,7 @@ private void CloseWindow(string id) _paneScrolls.Remove(id); // and its scroll position: a reopened window starts live _paneScrolls.Remove(FrozenRegionKey(id)); _frozenPanes.Remove(id); + ForgetScrollSplit(id); _drafts.Forget(id); // both bars: a closed window keeps neither of its two drafts _pendingGrabs.Remove(id); _secondBars.Forget(id); // and a same-id window later starts from F8's default again diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index fb5474d4..289d3513 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -20,7 +20,7 @@ internal static class SnapshotViews "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "tint-tabs", "compose", "compose-literal", "moo-edit", "mssp", "mssp-none", "mssp-never", "web", - "rail-long", "scrollback", "scrollback-up", "links", "away", "away-scrollback", + "rail-long", "scrollback", "scrollback-up", "scrollback-split", "reflow", "links", "away", "away-scrollback", "search", "search-regex", "search-all", "search-landed", "activity-bar", "mxp-image", "mxp-figure", "input-selection", "selection", "trigger-builder", "prefix", "prefix-panel", "focus", "focus-moved", "tabs", "tabs-many", diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index 3a951dcb..b5b6940e 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -99,6 +99,12 @@ internal static class WorldsScreenRenderer /// : the layout this world's characters use, or the suggestion. internal const int WorldLayoutField = 15; + /// , as one of . + internal const int JoinWrapsField = 16; + + /// F5's words for : off shows rows as the server sent them. + internal static readonly string[] JoinWrapChoices = ["off", "join"]; + /// What a world with no layout of its own reads as: the suggestion it accepted, else Roleplay. internal const string WorldLayoutDefault = "(suggested)"; @@ -512,7 +518,12 @@ internal static ScreenModel Model( "layout", () => LayoutName(all, w.Layout) ?? WorldLayoutDefault, v => w.Layout = LayoutId(all, v), - LayoutChoices(all, WorldLayoutDefault)))) + LayoutChoices(all, WorldLayoutDefault)), + ScreenField.Choice( + "join wraps", + () => w.JoinWrappedLines ? JoinWrapChoices[1] : JoinWrapChoices[0], + v => w.JoinWrappedLines = v == JoinWrapChoices[1], + JoinWrapChoices))) .Concat(WorldButtons(worlds, selectedWorld, info)) .ToArray(); @@ -1074,6 +1085,13 @@ world.GrabPrefix is { } grab cursor, selectedWorld, WorldLayoutField)), + WorldField("join wraps", Field( + world.JoinWrappedLines + ? $"[{Value}]{JoinWrapChoices[1]} lines the server wrapped[/]" + : $"[{Label}]{JoinWrapChoices[0]} · rows as the server sent them[/]", + cursor, + selectedWorld, + JoinWrapsField)), string.Empty, $"[{accent}]├ CHARACTERS[/] [{Label}]a character is a connection[/]", }); diff --git a/tests/SharpMUTerm.Core.Tests/Session/WorldSessionReflowTests.cs b/tests/SharpMUTerm.Core.Tests/Session/WorldSessionReflowTests.cs new file mode 100644 index 00000000..d00a1777 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Session/WorldSessionReflowTests.cs @@ -0,0 +1,147 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Tests.Session; + +/// F5 ▸ join wraps, through a real session: ingest-time, triggers see the joined line, nothing out of order. +public class WorldSessionReflowTests +{ + private static readonly string[] Paragraph = + [ + "The market square is crowded with stalls selling everything from bolts of", + "dyed cloth to barrels of salted fish, and the noise of haggling rises above", + "the clatter of carts as travelling merchants call out their wares.", + ]; + + private const string Joined = + "The market square is crowded with stalls selling everything from bolts of " + + "dyed cloth to barrels of salted fish, and the noise of haggling rises above " + + "the clatter of carts as travelling merchants call out their wares."; + + private static (WorldSession Session, FakeTelnetSession Telnet, List Printed) Create( + bool join, TriggerSet? set = null) + { + var telnet = new FakeTelnetSession(); + var world = new WorldDefinition { Name = "T", Host = "h", Port = 1, JoinWrappedLines = join }; + var session = new WorldSession(world, triggerSets: set is null ? null : new[] { set }, sessionFactory: _ => telnet) + { + ReflowHold = TimeSpan.FromHours(1), // released only by what the tests send + }; + var printed = new List(); + session.LinePrinted += (_, l) => printed.Add(l); + return (session, telnet, printed); + } + + /// Lines a server filled to 76 columns, so the session learns the wrap column. + private static void Warm(FakeTelnetSession telnet) + { + for (var i = 0; i < ServerWrapJoiner.MinimumSamples; i++) + { + telnet.EmitLine(new string('=', 75) + "."); + } + } + + private static List Output(List printed) => + printed.Select(l => l.Text).Where(t => !t.StartsWith("***", StringComparison.Ordinal) && !t.StartsWith("===", StringComparison.Ordinal)).ToList(); + + [Test] + public async Task AWorldThatJoinsShowsTheParagraphAsOneLine() + { + var (session, telnet, printed) = Create(join: true); + await session.ConnectAsync(); + Warm(telnet); + + foreach (var row in Paragraph) + { + telnet.EmitLine(row); + } + + await Assert.That(Output(printed)).IsEquivalentTo(new[] { Joined }); + } + + [Test] + public async Task AWorldThatDoesNotShowsTheRowsAsSent() + { + var (session, telnet, printed) = Create(join: false); + await session.ConnectAsync(); + Warm(telnet); + + foreach (var row in Paragraph) + { + telnet.EmitLine(row); + } + + await Assert.That(Output(printed)).IsEquivalentTo(Paragraph); + } + + [Test] + public async Task ATriggerMatchesAcrossTheServersBreak() + { + var set = new TriggerSet(); + set.Triggers.Add(new Trigger { Pattern = "bolts of dyed cloth", Actions = new TriggerActions { SpawnTarget = "Shop" } }); + var (session, telnet, _) = Create(join: true, set); + var spawned = new List(); + session.SpawnLine += (_, e) => spawned.Add(e.Line.Text); + await session.ConnectAsync(); + Warm(telnet); + + foreach (var row in Paragraph) + { + telnet.EmitLine(row); + } + + await Assert.That(spawned).IsEquivalentTo(new[] { Joined }); + } + + [Test] + public async Task APromptReleasesAHeldLineFirst() + { + var (session, telnet, printed) = Create(join: true); + await session.ConnectAsync(); + Warm(telnet); + + telnet.EmitLine(Paragraph[0]); + await Assert.That(Output(printed)).IsEmpty(); + + telnet.EmitPrompt("HP:100>"); + + await Assert.That(Output(printed)).IsEquivalentTo(new[] { Paragraph[0], "HP:100>" }); + } + + [Test] + public async Task AHeldLineIsShownWhenTheStreamGoesQuiet() + { + var (session, telnet, printed) = Create(join: true); + session.ReflowHold = TimeSpan.FromMilliseconds(20); + await session.ConnectAsync(); + Warm(telnet); + + telnet.EmitLine(Paragraph[0]); + + var deadline = DateTime.UtcNow.AddSeconds(5); + while (Output(printed).Count == 0 && DateTime.UtcNow < deadline) + { + await Task.Delay(10); + } + + await Assert.That(Output(printed)).IsEquivalentTo(new[] { Paragraph[0] }); + } + + [Test] + public async Task ADisconnectReleasesAHeldLineBeforeItsOwnMessage() + { + var (session, telnet, printed) = Create(join: true); + await session.ConnectAsync(); + Warm(telnet); + + telnet.EmitLine(Paragraph[0]); + await telnet.DisconnectAsync(); + + var texts = printed.Select(l => l.Text).ToList(); + var held = texts.IndexOf(Paragraph[0]); + await Assert.That(held).IsGreaterThanOrEqualTo(0); + await Assert.That(texts.FindIndex(t => t.StartsWith("*** Disconnected", StringComparison.Ordinal))).IsGreaterThan(held); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Text/ServerWrapJoinerTests.cs b/tests/SharpMUTerm.Core.Tests/Text/ServerWrapJoinerTests.cs new file mode 100644 index 00000000..b6a9acee --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Text/ServerWrapJoinerTests.cs @@ -0,0 +1,293 @@ +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Tests.Text; + +public class ServerWrapJoinerTests +{ + private const string Prose = + "The market square is crowded with stalls selling everything from bolts of dyed cloth to " + + "barrels of salted fish, and the noise of haggling rises above the clatter of carts as " + + "travelling merchants call out their wares to anyone who will listen, while a pair of " + + "bored guards lean on their spears by the fountain and watch the crowd for cutpurses and " + + "trouble of every other kind that a busy morning tends to bring with it."; + + /// A greedy word wrap, the way a server does it. + private static List Wrap(string text, int width) + { + var rows = new List(); + var row = string.Empty; + foreach (var word in text.Split(' ')) + { + if (row.Length == 0) + { + row = word; + } + else if (row.Length + 1 + word.Length <= width) + { + row += " " + word; + } + else + { + rows.Add(row); + row = word; + } + } + + if (row.Length > 0) + { + rows.Add(row); + } + + return rows; + } + + private static StyledLine Line(string text) => StyledLine.FromText(text, TextStyle.Default); + + /// Teaches a joiner the wrap column with lines the server filled, and throws away what they produce. + private static ServerWrapJoiner Warmed(int width = 78) + { + var joiner = new ServerWrapJoiner(); + for (var i = 0; i < ServerWrapJoiner.MinimumSamples; i++) + { + joiner.Push(Line(new string('x', width - 1) + ".")); + joiner.Push(Line(new string('y', width - 2) + ".")); + } + + joiner.Flush(); + return joiner; + } + + private static List Run(ServerWrapJoiner joiner, IEnumerable rows) + { + var shown = new List(); + foreach (var row in rows) + { + shown.AddRange(joiner.Push(Line(row)).Select(l => l.Text)); + } + + if (joiner.Flush() is { } held) + { + shown.Add(held.Text); + } + + return shown; + } + + [Test] + public async Task AParagraphTheServerWrappedComesBackAsOneLine() + { + var rows = Wrap(Prose, 78); + await Assert.That(rows.Count).IsGreaterThan(3); + + var shown = Run(Warmed(), rows); + + await Assert.That(shown).Count().IsEqualTo(1); + await Assert.That(shown[0]).IsEqualTo(Prose); + } + + [Test] + public async Task NothingIsJoinedBeforeTheWrapColumnIsKnown() + { + var rows = Wrap(Prose, 78); + var shown = Run(new ServerWrapJoiner(), rows.Take(3)); + + await Assert.That(shown).IsEquivalentTo(rows.Take(3)); + } + + [Test] + public async Task TheWrapColumnIsTheThirdLongestRecentLine() + { + var joiner = new ServerWrapJoiner(); + foreach (var length in new[] { 50, 60, 70, 75, 78, 120, 200, 40 }) + { + joiner.Push(Line(new string('a', length) + ".")); + } + + // 201 and 121 are outliers; the third longest (79, with its full stop) is the column. + await Assert.That(joiner.WrapColumn).IsEqualTo(79); + } + + [Test] + public async Task AShortStreamHasNoWrapColumn() + { + var joiner = new ServerWrapJoiner(); + for (var i = 0; i < 20; i++) + { + joiner.Push(Line("You hit the rat.")); + } + + await Assert.That(joiner.WrapColumn).IsNull(); + } + + [Test] + public async Task ARowEndingInAFullStopIsNotContinuedEvenByALowerCaseLine() + { + var first = "The merchants have packed away their stalls for the evening and gone home."; + var shown = Run(Warmed(), new[] { first, "then the rain begins to fall." }); + + await Assert.That(shown).Count().IsEqualTo(2); + } + + [Test] + public async Task ALineStartingWithACapitalIsNotAContinuation() + { + var rows = new[] + { + "The merchants have packed away their stalls for the evening and gone home to", + "Merchants Row, where the lamps are already lit and the shutters are closed.", + }; + + var shown = Run(Warmed(), rows); + + await Assert.That(shown).IsEquivalentTo(rows); + } + + [Test] + public async Task AShortRowIsNeverHeldOrJoined() + { + var rows = new[] { "You are hungry", "and thirsty." }; + var joiner = Warmed(); + + var first = joiner.Push(Line(rows[0])); + + await Assert.That(joiner.Holding).IsFalse(); + await Assert.That(first.Select(l => l.Text)).IsEquivalentTo(new[] { rows[0] }); + } + + [Test] + public async Task ARowTheNextWordWouldHaveFittedOnIsNotJoined() + { + // 66 characters: "and" would have fitted on it at 78, so the server did not have to break here. + var first = "The merchants have packed away their stalls for the evening, alone"; + await Assert.That(first.Length).IsLessThan(78 - 4); + var shown = Run(Warmed(), new[] { first, "and the square is empty." }); + + await Assert.That(shown).Count().IsEqualTo(2); + } + + [Test] + public async Task AnIndentedNextLineStartsAParagraph() + { + var rows = new[] + { + "The merchants have packed away their stalls for the evening and gone home to", + " supper while the square empties under the first drops of a cold rain.", + }; + + var shown = Run(Warmed(), rows); + + await Assert.That(shown).IsEquivalentTo(rows); + } + + [Test] + public async Task AColumnLayoutIsNotProse() + { + var rows = new[] + { + "Ann level 12 warrior online for three hours and some minutes ago", + "bob level 3 thief idle", + }; + + var shown = Run(Warmed(), rows); + + await Assert.That(shown).IsEquivalentTo(rows); + } + + [Test] + public async Task AHyphenAtTheBreakIsLeftAlone() + { + var rows = new[] + { + "The merchants have packed away their stalls for the evening and the well-", + "known tavern on the corner has opened its doors to the soaking crowd outside.", + }; + + var shown = Run(Warmed(), rows); + + await Assert.That(shown).IsEquivalentTo(rows); + } + + [Test] + public async Task AChangeOfStyleAtTheBreakIsNotJoined() + { + var joiner = Warmed(); + var first = Line("The merchants have packed away their stalls for the evening and gone home to"); + var red = new TextStyle(TerminalColor.FromIndex(1), TerminalColor.Default, TextAttributes.None); + var second = StyledLine.FromText("supper while the square empties under the first drops of rain.", red); + + var shown = joiner.Push(first).Concat(joiner.Push(second)).ToList(); + + await Assert.That(shown).Count().IsEqualTo(2); + } + + [Test] + public async Task AnInteractiveSpanKeepsALineToItself() + { + var joiner = Warmed(); + var link = new StyledLine(new[] + { + new StyledSpan("The merchants have packed away their stalls for the evening and gone ", TextStyle.Default), + new StyledSpan("home", TextStyle.Default, new SpanInteraction(InteractionKind.SendCommand, "home")), + }); + + joiner.Push(link); + + await Assert.That(joiner.Holding).IsFalse(); + } + + [Test] + public async Task APromptIsNeverJoined() + { + var prompt = StyledLine.FromText( + "The merchants have packed away their stalls for the evening and gone home to", + TextStyle.Default).WithPrompt(true); + + await Assert.That(ServerWrapJoiner.IsFull(prompt, 78)).IsFalse(); + } + + [Test] + public async Task AJoinKeepsEachSidesStylesAndPutsOneSpaceAtTheBreak() + { + var green = new TextStyle(TerminalColor.FromIndex(2), TerminalColor.Default, TextAttributes.None); + var first = new StyledLine(new[] + { + new StyledSpan("A ", TextStyle.Default), + new StyledSpan("green", green), + new StyledSpan(" word ", TextStyle.Default), + }); + var joined = ServerWrapJoiner.Join(first, Line("continues")); + + await Assert.That(joined.Text).IsEqualTo("A green word continues"); + await Assert.That(joined.Spans[1].Style).IsEqualTo(green); + } + + [Test] + public async Task AFullRowFollowedByABlankLineIsShownAsItWas() + { + var full = "The merchants have packed away their stalls for the evening and gone home to"; + var shown = Run(Warmed(), new[] { full, string.Empty, "supper." }); + + await Assert.That(shown).IsEquivalentTo(new[] { full, string.Empty, "supper." }); + } + + [Test] + public async Task ANarrowerServerReflowsToo() + { + var rows = Wrap(Prose, 60); + var shown = Run(Warmed(60), rows); + + await Assert.That(shown).IsEquivalentTo(new[] { Prose }); + } + + [Test] + public async Task TwoParagraphsStayTwo() + { + var second = "Somewhere beyond the walls a bell is ringing for the evening meal, and the gulls wheel " + + "over the harbour crying for scraps from the boats that came in with the tide."; + var rows = Wrap(Prose, 78).Concat(Wrap(second, 78)).ToList(); + + var shown = Run(Warmed(), rows); + + await Assert.That(shown).IsEquivalentTo(new[] { Prose, second }); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/ActivityBarDwellTests.cs b/tests/SharpMUTerm.Tui.Tests/ActivityBarDwellTests.cs index 331cc67a..e4badb28 100644 --- a/tests/SharpMUTerm.Tui.Tests/ActivityBarDwellTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ActivityBarDwellTests.cs @@ -49,10 +49,10 @@ private static (SharpMUTermApp App, WorldSession Session, ManualTimeProvider Tim private static void DrawAndRead(SharpMUTermApp app, WorldSession session) { session.PrintSystem("*** before you left"); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** while you were away"); app.SimulateReturnFromAway(TimeSpan.FromMinutes(2)); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); } [Test] @@ -64,11 +64,11 @@ public async Task TheBarSurvivesBeingReadPastUntilTheFloorHasElapsed() await Assert.That(app.AwayBarIndex(Main)).IsNotNull(); time.Advance(TimeSpan.FromSeconds(29)); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); await Assert.That(app.AwayBarIndex(Main)).IsNotNull(); time.Advance(TimeSpan.FromSeconds(2)); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); await Assert.That(app.AwayBarIndex(Main)).IsNull(); } @@ -107,7 +107,7 @@ public async Task TimePassingIsNotEnoughOnItsOwn() app.SimulateScrollKey(Key(ConsoleKey.PageUp)); time.Advance(TimeSpan.FromMinutes(5)); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); await Assert.That(app.AwayBarIndex(Main)).IsNotNull(); } diff --git a/tests/SharpMUTerm.Tui.Tests/AwayDividerTests.cs b/tests/SharpMUTerm.Tui.Tests/AwayDividerTests.cs index bae0ee1e..016dae1e 100644 --- a/tests/SharpMUTerm.Tui.Tests/AwayDividerTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/AwayDividerTests.cs @@ -36,7 +36,7 @@ public async Task AReturnDrawsTheBarWhereTheReaderLeft() { var (app, session, _) = Bound(); session.PrintSystem("*** before you left"); - app.SimulateKey(Key(ConsoleKey.End)); // the reader is here; this is the boundary + app.SimulateKey(Key(ConsoleKey.LeftArrow)); // the reader is here; this is the boundary session.PrintSystem("*** while you were away"); session.PrintSystem("*** and again"); @@ -61,7 +61,7 @@ public async Task AWindowThatGainedNothingGetsNoBar() { var (app, session, _) = Bound(); session.PrintSystem("*** before you left"); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); app.SimulateReturnFromAway(TimeSpan.FromHours(2)); @@ -75,11 +75,11 @@ public async Task AWindowThatGainedNothingGetsNoBar() public async Task ASecondReturnReplacesTheFirstBar() { var (app, session, _) = Bound(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** first absence"); app.SimulateReturnFromAway(TimeSpan.FromMinutes(5)); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** second absence"); app.SimulateReturnFromAway(TimeSpan.FromMinutes(9)); @@ -100,7 +100,7 @@ public async Task ASecondReturnReplacesTheFirstBar() public async Task TheBarSurvivesTheFrameItIsDrawnIn() { var (app, session, _) = Bound(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** while you were away"); app.SimulateReturnFromAway(TimeSpan.FromMinutes(12)); app.RenderWholeFrame(); @@ -112,12 +112,12 @@ public async Task TheBarSurvivesTheFrameItIsDrawnIn() public async Task TheBarGoesOnceItHasBeenSeenAndTheReaderTouchesSomething() { var (app, session, _) = Bound(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** while you were away"); app.SimulateReturnFromAway(TimeSpan.FromMinutes(12)); app.RenderWholeFrame(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); await Assert.That(app.AwayBarIndex(Main)).IsNull(); await Assert.That(app.PaneLines(Main).Any(r => r.Contains(AwayBarRenderer.Label))).IsFalse(); @@ -142,7 +142,7 @@ public async Task TheBarGoesOnceItHasBeenSeenAndTheReaderTouchesSomething() public async Task ADeepAbsenceScrollsThePaneSoTheBarIsOnScreen() { var (app, session, _) = Bound(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); for (var i = 0; i < 200; i++) { session.PrintSystem($"*** while you were away {i}"); @@ -166,7 +166,7 @@ public async Task ADeepAbsenceScrollsThePaneSoTheBarIsOnScreen() public async Task ADeepAbsenceKeepsItsBarUntilTheReaderReadsDownToTheTail() { var (app, session, _) = Bound(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); for (var i = 0; i < 200; i++) { session.PrintSystem($"*** while you were away {i}"); @@ -177,13 +177,13 @@ public async Task ADeepAbsenceKeepsItsBarUntilTheReaderReadsDownToTheTail() app.RenderWholeFrame(); // Typing where you landed does not clear it — you have read the top of what you missed, not all. - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); await Assert.That(app.AwayBarIndex(Main)).IsNotNull(); // ⌃End is the way back to live output, and arriving there is the gap being crossed. app.SimulateKey(Key(ConsoleKey.End, ctrl: true)); app.RenderWholeFrame(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); await Assert.That(app.AwayBarIndex(Main)).IsNull(); } @@ -196,7 +196,7 @@ public async Task ADeepAbsenceKeepsItsBarUntilTheReaderReadsDownToTheTail() public async Task AShallowAbsenceLeavesThePaneOnItsLiveTail() { var (app, session, _) = Bound(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** while you were away"); app.RenderWholeFrame(); @@ -205,7 +205,7 @@ public async Task AShallowAbsenceLeavesThePaneOnItsLiveTail() await Assert.That(Painted(app.RenderWholeFrame())).IsTrue(); // Still at the tail, so one keystroke is all it takes to be done with it. - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); await Assert.That(app.AwayBarIndex(Main)).IsNull(); } @@ -223,7 +223,7 @@ public async Task AShallowAbsenceLeavesThePaneOnItsLiveTail() public async Task ASecondReturnToAQuietWindowTakesTheOldBarOffTheScreen() { var (app, session, _) = Bound(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); for (var i = 0; i < 200; i++) { session.PrintSystem($"*** while you were away {i}"); @@ -249,7 +249,7 @@ public async Task ASecondReturnToAQuietWindowTakesTheOldBarOffTheScreen() public async Task TheBarIsNotCountedAsUnread() { var (app, session, _) = Bound(); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** while you were away"); var before = app.UnreadOf(Main); @@ -273,7 +273,7 @@ public async Task ABarTrimmedOffTheTopOfTheBufferIsForgotten() config.PaneLines = 40; var (app, session, _) = Bound(config); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** while you were away"); app.SimulateReturnFromAway(TimeSpan.FromMinutes(12)); await Assert.That(app.AwayBarIndex(Main)).IsNotNull(); @@ -295,7 +295,7 @@ public async Task ABarTrimmedOffTheTopOfTheBufferIsForgotten() public async Task ATabAfterAQuietGapDrawsTheBar() { var (app, session, time) = Bound(focusReporting: true); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** while you were away"); time.Advance(TimeSpan.FromMinutes(12)); @@ -323,7 +323,7 @@ public async Task ATabFromAReaderWhoIsSittingThereIsATab() { var (app, session, _) = Bound(focusReporting: true); ToggleSecondBar(app); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** a line"); await Assert.That(app.SecondBarArmed).IsTrue().Because("raising the second bar arms it"); @@ -338,7 +338,7 @@ public async Task AnAppWithNoFocusReportingClaimsNoTabAtAll() { var (app, session, time) = Bound(); ToggleSecondBar(app); - app.SimulateKey(Key(ConsoleKey.End)); + app.SimulateKey(Key(ConsoleKey.LeftArrow)); session.PrintSystem("*** while you were away"); time.Advance(TimeSpan.FromHours(3)); diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index 4cb736ea..e7a9efff 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -48,6 +48,10 @@ public class FrameContrastTests // most to lose from a theme it was not measured against. "selection", "input-selection", "menu-fuzzy", "menu-recent", + // The split-scrollback band (the notice ink on a pane) and the reflowed room, whose two blocks carry + // dim labels and the world's own text. + "scrollback-split", "reflow", + // The four panels: who is here and the quick bar carry the accent on links, the vitals strip paints bars // and the warning in a server-driven colour, and the docked composer is an editor on its own plane. "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", diff --git a/tests/SharpMUTerm.Tui.Tests/JoinWrapsFieldTests.cs b/tests/SharpMUTerm.Tui.Tests/JoinWrapsFieldTests.cs new file mode 100644 index 00000000..2a4229a6 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/JoinWrapsFieldTests.cs @@ -0,0 +1,50 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// F5's join wraps row: one world field over . +public class JoinWrapsFieldTests +{ + private static List Worlds() => + [ + new() { Name = "Aetherfall", Host = "aether.example.org", Port = 4000 }, + ]; + + [Test] + public async Task TheRowWritesTheWorldsSettingBothWays() + { + var worlds = Worlds(); + var model = WorldsScreenRenderer.Model(worlds, [], 0, 0); + var field = model.FieldAt(WorldsScreenRenderer.WorldsPane, 0, WorldsScreenRenderer.JoinWrapsField)!.Value; + + await Assert.That(field.Label).IsEqualTo("join wraps"); + await Assert.That(field.Get()).IsEqualTo("off"); + + field.Set("join"); + await Assert.That(worlds[0].JoinWrappedLines).IsTrue(); + + field.Set("off"); + await Assert.That(worlds[0].JoinWrappedLines).IsFalse(); + } + + [Test] + public async Task TheDetailColumnSaysWhatItDoes() + { + var worlds = Worlds(); + var off = WorldsScreenRenderer.DetailColumn(worlds, [], 0, 0, ScreenPalette.Accent); + worlds[0].JoinWrappedLines = true; + var on = WorldsScreenRenderer.DetailColumn(worlds, [], 0, 0, ScreenPalette.Accent); + + await Assert.That(off.Any(l => l.Contains("join wraps") && l.Contains("rows as the server sent them"))).IsTrue(); + await Assert.That(on.Any(l => l.Contains("join wraps") && l.Contains("lines the server wrapped"))).IsTrue(); + } + + [Test] + public async Task ACloneKeepsTheSetting() + { + var world = new WorldDefinition { Name = "W", JoinWrappedLines = true }; + + await Assert.That(world.Clone().JoinWrappedLines).IsTrue(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/OutputScrollbackTests.cs b/tests/SharpMUTerm.Tui.Tests/OutputScrollbackTests.cs index e127da70..6cd15ac5 100644 --- a/tests/SharpMUTerm.Tui.Tests/OutputScrollbackTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/OutputScrollbackTests.cs @@ -42,11 +42,23 @@ public class OutputScrollbackTests private static readonly TerminalCapabilities Headless = new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + /// + /// The demo configuration with split scrollback off. This file is about the one viewport a pane scrolls + /// as a whole — what every pane does with the setting off, and the viewport a split keeps on top — so + /// the split, which shows the newest line on purpose, is ' to test. + /// + private static AppConfiguration WholePane() + { + var config = DemoScene.Build(); + config.Text.SplitScrollback = false; + return config; + } + private static SharpMUTermApp App() { // The window system reads the console for input even headless; a null reader returns EOF. Console.SetIn(TextReader.Null); - return new SharpMUTermApp(DemoScene.Build(), Headless, new HeadlessConsoleDriver(Width, Height)); + return new SharpMUTermApp(WholePane(), Headless, new HeadlessConsoleDriver(Width, Height)); } /// @@ -58,7 +70,7 @@ private static SharpMUTermApp App() private static (SharpMUTermApp App, WorldSession Session) Bound() { Console.SetIn(TextReader.Null); - var config = DemoScene.Build(); + var config = WholePane(); var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height)); var session = app.BindWorldWithoutConnecting(config.Worlds[0]); @@ -301,7 +313,7 @@ public async Task CtrlHomeReachesTheOldestLine() private static SharpMUTermApp CappedApp(int paneLines) { Console.SetIn(TextReader.Null); - var config = DemoScene.Build(); + var config = WholePane(); config.PaneLines = paneLines; return new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height)); } @@ -516,7 +528,7 @@ public async Task TheWheelScrollsThePaneUnderThePointer() { Console.SetIn(TextReader.Null); var driver = new HeadlessConsoleDriver(Width, Height); - var app = new SharpMUTermApp(DemoScene.Build(), Headless, driver); + var app = new SharpMUTermApp(WholePane(), Headless, driver); app.RenderSnapshot("scrollback"); var bottom = app.ScrollbackOf(Main)!.Value; diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs index bac21197..05ff25e7 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs @@ -364,14 +364,15 @@ public async Task Options_NavigableRowsSkipSectionHeadersAndSpacers() var screen = OptionsScreenRenderer.TextAnsiScreen(); var model = OptionsScreenRenderer.Model(screen); - // 23 display rows: 5 group headings + 4 spacers + the meter table's column headings (drawn, never a - // stop) + 13 stops — eight settings in four groups, the three default meters, [+ meter], and the - // activity bar's hold. SOUND is left out because this caller passes no sound settings. Since F7 was - // drawn from its declared section the groups are COLOUR & LEGIBILITY, TEXT, LINKS & PICTURES, - // STATUS ROW & METERS and ACTIVITY; it was 21/10 with one row for the meters as a typed line. - await Assert.That(screen.Rows.Count).IsEqualTo(23); + // 26 display rows: 6 group headings + 5 spacers + the meter table's column headings (drawn, never a + // stop) + 14 stops — eight settings in four groups, the three default meters, [+ meter], the + // activity bar's hold and split scrollback. SOUND is left out because this caller passes no sound + // settings. Since F7 was drawn from its declared section the groups are COLOUR & LEGIBILITY, TEXT, + // LINKS & PICTURES, STATUS ROW & METERS, ACTIVITY and SCROLLBACK; it was 21/10 with one row for the + // meters as a typed line, and 23/13 before SCROLLBACK. + await Assert.That(screen.Rows.Count).IsEqualTo(26); await Assert.That(model.PaneCount).IsEqualTo(1); - await Assert.That(model.Sizes[0]).IsEqualTo(13); + await Assert.That(model.Sizes[0]).IsEqualTo(14); } /// diff --git a/tests/SharpMUTerm.Tui.Tests/ScrollSplitTests.cs b/tests/SharpMUTerm.Tui.Tests/ScrollSplitTests.cs new file mode 100644 index 00000000..924c4193 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/ScrollSplitTests.cs @@ -0,0 +1,211 @@ +using System.Text.RegularExpressions; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Split scrollback (F7 ▸ SCROLLBACK): a pane scrolled back off its live tail keeps the newest rows in view +/// under a band, inside its own rectangle. Asserted on the painted frame, not on the state that drives it. +/// +[NotInParallel] +public class ScrollSplitTests +{ + private const string Main = "main"; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(bool split = true) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.Text.SplitScrollback = split; + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32)); + app.RenderSnapshot("scrollback"); + return app; + } + + private static ConsoleKeyInfo Key(ConsoleKey key, bool ctrl = false, bool alt = false) => + new('\0', key, shift: false, alt: alt, control: ctrl); + + private static string Plain(string ansi) => Regex.Replace(ansi, @"\x1b\[[0-9;?]*[A-Za-z]", string.Empty); + + private static string Settled(SharpMUTermApp app) + { + app.RenderWholeFrame(); + return Plain(app.RenderWholeFrame()); + } + + private static string Line(int number) => $"line {number:0000}"; + + [Test] + public async Task ScrollingBackSplitsThePaneAndKeepsTheNewestLineInView() + { + var app = App(); + var before = app.PaneOutputRects().ToDictionary(p => p.Key, p => p.Value); + + app.SimulateKey(Key(ConsoleKey.PageUp)); + app.SimulateKey(Key(ConsoleKey.PageUp)); + var frame = Settled(app); + + await Assert.That(app.IsScrollSplit(Main)).IsTrue(); + await Assert.That(frame).Contains("scrolled back"); + await Assert.That(frame).Contains("End returns"); + await Assert.That(frame).Contains(Line(SharpMUTermApp.ScrollbackSceneLines)); + + // Inside the pane: no rectangle moved, so no server is told a new size. + await Assert.That(app.PaneOutputRects()).IsEquivalentTo(before); + } + + [Test] + public async Task OutputArrivingWhileSplitLandsInTheTailAndLeavesTheHistoryWhereItWas() + { + var app = App(); + app.SimulateKey(Key(ConsoleKey.PageUp)); + app.SimulateKey(Key(ConsoleKey.PageUp)); + Settled(app); + var offset = app.ScrollbackOf(Main)!.Value.Offset; + + app.LoadLongScene(Main, 3, first: SharpMUTermApp.ScrollbackSceneLines + 1); + var frame = Settled(app); + + await Assert.That(frame).Contains(Line(SharpMUTermApp.ScrollbackSceneLines + 3)); + await Assert.That(app.ScrollbackOf(Main)!.Value.Offset).IsEqualTo(offset); + await Assert.That(app.IsScrollSplit(Main)).IsTrue(); + } + + [Test] + public async Task ASplitPaneIsNotScrolledBackForTheUnreadBadge() + { + var app = App(); + app.SimulateKey(Key(ConsoleKey.PageUp)); + Settled(app); + + await Assert.That(app.IsScrollSplit(Main)).IsTrue(); + await Assert.That(app.IsWindowScrolledBack(Main)).IsFalse(); + } + + [Test] + public async Task ALineThatLandsInTheLiveTailIsNotMissed() + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32)); + var session = app.BindWorldWithoutConnecting(config.Worlds[0]); + for (var i = 1; i <= 80; i++) + { + session.PrintSystem($"*** line {i}"); + } + + app.RenderSnapshot(); + app.SimulateScrollKey(Key(ConsoleKey.PageUp)); + Settled(app); + await Assert.That(app.IsScrollSplit(Main)).IsTrue(); + + session.PrintSystem("*** arrived while you were reading back"); + app.SimulateScrollKey(Key(ConsoleKey.End, ctrl: true)); + + await Assert.That(app.UnreadOf(Main)).IsEqualTo(0); + await Assert.That(app.AwayBarIndex(Main)).IsNull(); + } + + [Test] + public async Task CtrlEndReturnsAndClosesTheSplit() + { + var app = App(); + app.SimulateKey(Key(ConsoleKey.PageUp)); + Settled(app); + + app.SimulateKey(Key(ConsoleKey.End, ctrl: true)); + var frame = Settled(app); + + await Assert.That(app.IsScrollSplit(Main)).IsFalse(); + await Assert.That(frame).DoesNotContain("scrolled back"); + await Assert.That(app.ScrollbackOf(Main)!.Value.AutoScroll).IsTrue(); + } + + [Test] + public async Task BareEndReturnsWhenTheCaretIsAlreadyAtTheEnd() + { + var app = App(); + app.SimulateKey(Key(ConsoleKey.PageUp)); + Settled(app); + + app.SimulateKey(Key(ConsoleKey.End)); + Settled(app); + + await Assert.That(app.IsScrollSplit(Main)).IsFalse(); + } + + [Test] + public async Task ScrollingTheHistoryBackDownToItsEndClosesTheSplit() + { + var app = App(); + app.SimulateKey(Key(ConsoleKey.PageUp)); + Settled(app); + + for (var i = 0; i < 10 && app.IsScrollSplit(Main); i++) + { + app.SimulateKey(Key(ConsoleKey.PageDown)); + Settled(app); + } + + await Assert.That(app.IsScrollSplit(Main)).IsFalse(); + } + + [Test] + public async Task WithTheSettingOffThePaneScrollsAsAWhole() + { + var app = App(split: false); + app.SimulateKey(Key(ConsoleKey.PageUp)); + var frame = Settled(app); + + await Assert.That(app.IsScrollSplit(Main)).IsFalse(); + await Assert.That(frame).DoesNotContain("scrolled back"); + await Assert.That(frame).DoesNotContain(Line(SharpMUTermApp.ScrollbackSceneLines)); + } + + [Test] + public async Task FreezingASplitPaneHandsItToFreeze() + { + var app = App(); + app.SimulateKey(Key(ConsoleKey.PageUp)); + Settled(app); + + app.SimulateKey(Key(ConsoleKey.F, alt: true)); + var frame = Settled(app); + + await Assert.That(app.IsScrollSplit(Main)).IsFalse(); + await Assert.That(frame).Contains("FROZEN"); + await Assert.That(frame).DoesNotContain("scrolled back"); + } + + [Test] + [Arguments(30, 9)] + [Arguments(20, 6)] + [Arguments(10, 3)] + [Arguments(7, 3)] + [Arguments(6, 0)] + public async Task TheLiveTailIsThirtyPercentOfThePaneAndAtLeastThreeRows(int pane, int tail) + { + await Assert.That(SharpMUTermApp.TailRowsFor(pane)).IsEqualTo(tail); + } + + [Test] + [Arguments(120)] + [Arguments(60)] + [Arguments(30)] + public async Task TheBandIsExactlyAsWideAsThePaneWhateverTheCount(int width) + { + foreach (var rows in new[] { 1, 42, 99, 4127 }) + { + var markup = ScrollSplitBarRenderer.Bar(rows, width, "#e5c07b"); + await Assert.That(MarkupStripped(markup).Length).IsEqualTo(width); + } + } + + private static string MarkupStripped(string markup) => + Regex.Replace(markup, @"\[(?:/|dim|#[0-9a-f]{6})\]", string.Empty).Replace("[[", "[").Replace("]]", "]"); +} diff --git a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs index 44b8800e..852f3630 100644 --- a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs @@ -39,7 +39,7 @@ public class SnapshotViewEmptyConfigTests [ "collapsed", "prefix", "prefix-panel", "timestamps", "timestamps-toggled", "spawn", "split", "focus", "focus-moved", "freeze", "freeze-scrollback", "move", "drag", "scrollback", - "scrollback-up", "away", "away-scrollback", "links", "web", "rail-long", "history", "history-search", + "scrollback-up", "scrollback-split", "reflow", "away", "away-scrollback", "links", "web", "rail-long", "history", "history-search", "history-search-filter", "draft", "draft2", "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "compose", "compose-literal", "deletions", "textansi", "input", "keypad", "password", diff --git a/tests/SharpMUTerm.Tui.Tests/TabActivityIndicatorTests.cs b/tests/SharpMUTerm.Tui.Tests/TabActivityIndicatorTests.cs index 2a6cd96d..7af76669 100644 --- a/tests/SharpMUTerm.Tui.Tests/TabActivityIndicatorTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TabActivityIndicatorTests.cs @@ -57,6 +57,7 @@ private static (SharpMUTermApp App, WorldSession Session) Bound( { Console.SetIn(TextReader.Null); var config = DemoScene.Build(); + config.Text.SplitScrollback = false; // a split pane's new lines are on screen, so they badge nothing var app = clock is null ? new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)) : new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height), clock); diff --git a/tests/SharpMUTerm.Tui.Tests/WindowActivityBoundaryTests.cs b/tests/SharpMUTerm.Tui.Tests/WindowActivityBoundaryTests.cs index e4b42151..a24250c6 100644 --- a/tests/SharpMUTerm.Tui.Tests/WindowActivityBoundaryTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WindowActivityBoundaryTests.cs @@ -95,12 +95,14 @@ public async Task TheWindowInFrontOfTheReaderGetsNoBar() /// /// A window the reader is looking at but has scrolled back off is exactly as blind as one they are /// not looking at — OnLine's reasoning for the badge, one field over — so it accrues, and the - /// bar is there when they come back down to the tail. + /// bar is there when they come back down to the tail. With split scrollback off: a split pane's new + /// lines land in its live tail, on screen, and pins that they are not missed. /// [Test] public async Task AVisibleWindowScrolledBackAccruesAndTheBarIsThereOnTheWayBackDown() { var (app, session) = Bound(); + app.Configuration.Text.SplitScrollback = false; for (var i = 1; i <= 80; i++) { session.PrintSystem($"*** line {i}"); From f39a967e8aabd2333a02e76bb5baa92bf7bc48c6 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 04:44:52 +0000 Subject: [PATCH 016/113] Size strip panels to their content and keep panels off the rail The vitals strip and the quick bar are exactly one row, with no tab strip over a one-tab strip, and the docked composer has an editor's floor. A pane's height claim (PaneNode.FixedRows/MinRows) is derived from what it holds on every rebuild (PanelSizing) and honoured by the grid and by LayoutSolver (PaneExtent.DistributeRows); a divider beside a fixed strip neither hovers nor drags, and the resize keys take rows from a pane beyond it or refuse out loud. The status row leaves its meters out while the vitals strip is showing them. Layout panels are WindowKind.Panel: no rail row, no Alt+number, no Go to entry, so map and capture windows keep their digits. Alt+M renames (r) and deletes (d, then y) saved layouts. New snapshot view: layout-roleplay. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 +- CLAUDE.md | 39 ++- .../Commands/BuiltInCommands.cs | 4 +- src/SharpMUTerm.Core/Layouts/PanelSizing.cs | 66 +++++ src/SharpMUTerm.Core/Workspace/LayoutNode.cs | 18 ++ .../Workspace/LayoutSolver.cs | 3 +- src/SharpMUTerm.Core/Workspace/PaneExtent.cs | 139 +++++++++++ src/SharpMUTerm.Core/Workspace/PaneResize.cs | 56 ++++- src/SharpMUTerm.Core/Workspace/Workspace.cs | 1 + .../Workspace/WorkspaceWindow.cs | 7 + src/SharpMUTerm.Tui/ListOverlay.cs | 21 +- .../Pointer/SharpMUTermApp.Pointer.cs | 12 +- src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs | 184 +++++++++++++- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 27 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 91 ++++++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- .../Workspace/PaneExtentTests.cs | 209 ++++++++++++++++ .../Workspace/WindowNumberingTests.cs | 17 ++ .../SharpMUTerm.Tui.Tests/LayoutStripTests.cs | 234 ++++++++++++++++++ 19 files changed, 1094 insertions(+), 43 deletions(-) create mode 100644 src/SharpMUTerm.Core/Layouts/PanelSizing.cs create mode 100644 src/SharpMUTerm.Core/Workspace/PaneExtent.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c3266a..95e187ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,8 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] Ctrl+P lists *Key clashes (N)* while there are any. - Layouts. Alt+M (or Ctrl+P ▸ *Layouts*) lists the built-in Roleplay and Combat layouts and the ones you save: ⏎ applies one to the panes, `s` saves the panes as they are into the selected layout, `n` saves them as a - new one, `w` makes it the world's default and `c` this character's. Worlds & Characters (F5) has a `layout` + new one, `w` makes it the world's default and `c` this character's; `r` renames one of your own and `d` + deletes it, after asking. Worlds & Characters (F5) has a `layout` row on each world and each character. A panel appears only once the game sends what it shows, so a MUSH never gets an empty map pane, and the first time you connect to a world the client picks Combat or Roleplay from what the game sends and says which in a notice. A workspace you arranged yourself is still what comes @@ -33,6 +34,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] with values, a warning colour when low, and what you are fighting), *Show quick bar* (your function-key macros as `F11 kick`; click one to run it) and *Dock the composer* (the F1 editor as a pane that shares F1's draft: ⌃S sends, ⌥L switches escaping, F1 opens it full screen, Esc goes back to the command line). + The vitals strip and the quick bar are exactly one row tall, with no tab over them, and the docked composer + never shrinks below a few rows. While the vitals strip is on screen the status row leaves its meters out + rather than showing them twice. Panels are part of the layout, not places you go: they take no row in the + sidebar and no Alt+number, so your map and capture windows keep theirs. - Make a trigger without writing a regex: select a line of output and choose Ctrl+P ▸ *Make a trigger from the selection* (also on the right-click menu). Triggers (F2) opens on a new rule whose pattern is the line with its numbers, quoted speech and known player names turned into `*`, and shows the regex behind it. diff --git a/CLAUDE.md b/CLAUDE.md index 6ddf5c59..ad722f51 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -926,13 +926,31 @@ fallbacks) for inline images/maps. - **Layouts are realised as panes, one per panel that has data** (`Core/Layouts`: `LayoutFold` → `LayoutRealiser` → `WorkspaceLayout.ReplaceTree`, `LayoutCapture` for the way back; Tui `SharpMUTermApp.Layouts.cs`, - `TerminalPanels.cs`; ⌥M / ⌃P ▸ *Layouts*; F5 `layout` rows; the `layouts` and `layout-combat` views). The layout's + `TerminalPanels.cs`; ⌥M / ⌃P ▸ *Layouts*; F5 `layout` rows; the `layouts`, `layout-combat` and `layout-roleplay` views). The layout's name is shown nowhere on the main screen. Decisions not to relitigate: - **A panel is a window.** `output` is the session's window, `chat` its spawn windows, `map` `map:`, and every other panel a window `panel::` (`TerminalPanels.WindowId`) whose control comes from the factory registered for that id (`Panels.Register(id, ctx => control)`, from `partial void - RegisterTerminalPanels()`), built once and re-parented like the map's. So panels get tabs, the rail, focus, - `Activate`/`SendTarget` (a panel window is owned by its session) and persistence for nothing. An id with no + RegisterTerminalPanels()`), built once and re-parented like the map's. So panels get tabs, focus, + `Activate`/`SendTarget` (a panel window is owned by its session) and persistence for nothing. + - **A panel window is furniture, not a destination** (`WindowKind.Panel`). `Workspace.WindowsFor` leaves it out, + so it has no `⌥N` and pushes no map or capture window to a later digit; `BuildRailWindows` lists no row for it; + ⌃P has no `Go to …` entry for it, because each panel's own entry (*Show vitals*, *Dock the composer*) goes to it. + ⌃O, the ⌃arrows and a click still reach it — it is a pane like any other. + - **A strip is as tall as its content** (`PanelSizing`, `PaneExtent`; `PaneNode.FixedRows`/`MinRows`). Vitals and + the quick bar are one row; the composer has a floor (`PanelSizing.ComposerMinRows` plus its tab strip). Region + shares are proportional, so the height is a pane property instead: `BuildWorkspaceRow` derives it from each + pane's tabs on every rebuild (never persisted — a strip handed an ordinary window stops being one), the grid + gives a fixed child `GridLength.Cells` and a floored one `Star(min:)`, and `LayoutSolver` shares rows the same + way (`PaneExtent.DistributeRows`; if every child is fixed the last shares, in both). A one-tab strip draws **no + tab strip** (`TabControl.ShowTabHeader`, which `PaneOutputRects` already reads) and offers no drag handle. Only + rows: a strip's width is a share. The divider beside a fixed pane is not registered with the pointer, a drag + on it returns `PaneResizeOutcome.FixedSize`, and ⌥⇧↑/↓ take rows from a sharing pane beyond the strip or + pass to the next split up, refusing out loud when only a strip could pay. + - **The status row leaves its meters out while the vitals strip shows them** (`VitalsStripShowing`: the status + row's character's vitals window is the front tab of a drawn pane, zoom included). `SyncStatusMeters` repaints + the row only when that flips (on a rebuild or an activation), so a notice is not displaced for nothing. The + rest of the row's width rules are untouched: the meters were already the optional part. An id with no factory counts as having no data (`DrawableAvailability`), so an unbuilt panel is *Waiting* and costs no cell. - **Applying never closes a window.** Windows no panel places stay in the pane they were in if its id survives, else in the output pane; a collapsed panel's windows are background tabs of the first pane in its region. @@ -946,6 +964,11 @@ fallbacks) for inline images/maps. tree's shape (`TreeShape`: pane ids and nesting) is not the one it applied: the player split, closed or moved a pane and the arrangement is theirs. A divider dragged is not a shape change and is reset by the next re-fold. A new spawn window goes into the live layout's chat pane, not the focused one. + - **⌥M renames (`r`) and deletes (`d`, then `y`) saved layouts** through `LayoutLibrary.Rename`/`Delete`; both + are refused for a built-in and the footer names them only over a layout of the player's own. The name is typed + in the list itself; Esc leaves the rename or the question before it closes anything (`ListOverlay`'s `escape:` + hook). Every footer row is always emitted, blank when idle, because the modal is sized once when it opens. + Deleting the live layout hands the panes to the player (`_liveLayout = null`) rather than re-folding them. - **Saving captures geometry, not intent.** `LayoutCapture` reads regions off the solved rectangles (above the output = top strip, right of it = side, below = bottom); panels not on screen keep their old placement. Saving changes to a built-in saves a copy and points the character (or the world using it) at the copy. @@ -1173,9 +1196,11 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg `tabs-many` (**more tabs than the strip can hold** — five of one character's captures in a split pane, which is the state every other tab view is too small to reach. Without eliding, that pane draws two tabs and half of a third and says nothing about the rest), plus the - `layouts` (the ⌥M list over the demo, through the registered shortcut) and `layout-combat` (the Combat layout - applied over the demo's game data and recorded streets: the map beside the output with Chat as a tab under it, - and no pane for the panels nothing draws yet), `panel-who`/`panel-vitals`/`panel-quickbar`/`panel-composer` + `layouts` (the ⌥M list over the demo, through the registered shortcut), `layout-combat` (the Combat layout + applied over the demo's game data and recorded streets: a one-row vitals strip across the top, the map beside + the output with Chat as a tab under it, a one-row quick bar under the output, and no meters on the status row) + and `layout-roleplay` (the Roleplay layout over the demo's room roster: who is here beside the output with Chat + behind it, and the composer under the output at its floor), `panel-who`/`panel-vitals`/`panel-quickbar`/`panel-composer` (each panel in a pane of its own over the demo's game data; the composer over who-here, armed, with a draft typed through its real key path), plus the default workspace @@ -1448,7 +1473,7 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] (`WindowNumberingTests.AWindowOpenedIntoAClosedOnesSlotStillTakesTheLastNumber` is the pin, and it took a four-window fixture to expose: with fewer, both orders agree). Only **placed** windows are numbered — one no pane holds is drawn `closed` and a digit for it would - name nowhere to go. + name nowhere to go — and never a layout panel (`WindowKind.Panel`), which is furniture and has no rail row. - **⌃B 1–⌃B 9 go to a pane.** It was ⌥N until windows took that; it is on the prefix because that is where the rest of the pane keymap lives, and it is kept rather than dropped because the pane numbering does not go away with the chord — move mode badges each pane with it, the move and drag diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index ea1aede6..87377dc0 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -304,7 +304,9 @@ private static IEnumerable Windows(ICommandContext context) foreach (var window in workspace.Windows) { - if (window.Id == activeWindow) + // A layout panel is furniture, not a destination: each has its own ⌃P entry (Show vitals, Dock the + // composer…) that goes to it, so a "Go to Vitals" row would be a second spelling of one action. + if (window.Id == activeWindow || window.Kind == WindowKind.Panel) { continue; } diff --git a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs new file mode 100644 index 00000000..683551fc --- /dev/null +++ b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs @@ -0,0 +1,66 @@ +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Core.Layouts; + +/// +/// How tall a panel is drawn, in rows of content. Most panels share the window like any pane; a strip is +/// one row however much room there is (the vitals meters, the quick bar), and an editor has a floor below which it +/// stops being one (the docked composer). +/// +public static class PanelSizing +{ + /// The rows of content a docked composer is never squeezed below: its header, four rows of post and its key hints. + public const int ComposerMinRows = 6; + + /// The exact rows of content draws, or null when it shares the window. + public static int? FixedRows(string? panelId) => panelId switch + { + PanelIds.Vitals => 1, + PanelIds.QuickBar => 1, + _ => null, + }; + + /// The fewest rows of content is given, or null for the ordinary floor. + public static int? MinRows(string? panelId) => panelId switch + { + PanelIds.Composer => ComposerMinRows, + _ => null, + }; + + /// + /// Whether a pane holding (one entry per tab: its panel id, or null for a window no + /// panel draws) is a strip: every tab a fixed-height panel. A strip with one tab shows no tab strip, because + /// its content already says what it is. + /// + public static bool IsStrip(IReadOnlyList panels) => + panels.Count > 0 && panels.All(p => FixedRows(p) is not null); + + /// Whether a pane holding draws its tab strip: anything but a one-tab strip. + public static bool ShowsTabStrip(IReadOnlyList panels) => !(panels.Count == 1 && IsStrip(panels)); + + /// + /// Sets 's and from what it + /// holds. names the panel each tab draws (null for an ordinary window), and + /// is the height of the tab strip the host draws over a pane that shows one. + /// A strip is as tall as its tallest panel (plus the tab strip when it holds several); any other pane shares, + /// with a floor from the tallest floor among its panels. + /// + public static void Apply(PaneNode pane, Func panelOf, int tabStripRows) + { + ArgumentNullException.ThrowIfNull(pane); + ArgumentNullException.ThrowIfNull(panelOf); + var panels = pane.Tabs.Select(panelOf).ToList(); + var chrome = ShowsTabStrip(panels) ? Math.Max(0, tabStripRows) : 0; + + if (IsStrip(panels)) + { + pane.FixedRows = panels.Max(p => FixedRows(p)!.Value) + chrome; + pane.MinRows = null; + return; + } + + pane.FixedRows = null; + var floor = panels.Select(MinRows).Where(m => m is not null).Select(m => m!.Value).DefaultIfEmpty(0).Max(); + pane.MinRows = floor > 0 ? floor + chrome : null; + } +} diff --git a/src/SharpMUTerm.Core/Workspace/LayoutNode.cs b/src/SharpMUTerm.Core/Workspace/LayoutNode.cs index 2f96568d..dc65bb3d 100644 --- a/src/SharpMUTerm.Core/Workspace/LayoutNode.cs +++ b/src/SharpMUTerm.Core/Workspace/LayoutNode.cs @@ -92,6 +92,24 @@ public PaneNode( /// The active window id, or null when the pane is empty. public string? ActiveTab => ActiveIndex >= 0 && ActiveIndex < Tabs.Count ? Tabs[ActiveIndex] : null; + /// + /// The exact height this pane takes in a stacked split, in rows, or null for a pane that shares the space + /// (). A strip panel — one row of meters, one row of buttons — declares it, so it is as + /// tall as its content rather than a share of the window. The divider beside such a pane does not move it. + /// + /// Not persisted: the host derives it from what the pane holds every time it lays the panes out, so a pane + /// that is handed an ordinary window stops being a strip at once. + /// + /// + public int? FixedRows { get; set; } + + /// + /// The fewest rows this pane is given in a stacked split, or null for the ordinary floor. An editor declares + /// one so a short window does not squeeze it to a line. Like , derived by the host and + /// not persisted. + /// + public int? MinRows { get; set; } + public override IEnumerable Panes() { yield return this; diff --git a/src/SharpMUTerm.Core/Workspace/LayoutSolver.cs b/src/SharpMUTerm.Core/Workspace/LayoutSolver.cs index f03a02ef..1538f150 100644 --- a/src/SharpMUTerm.Core/Workspace/LayoutSolver.cs +++ b/src/SharpMUTerm.Core/Workspace/LayoutSolver.cs @@ -55,7 +55,8 @@ private static void Place(LayoutNode node, PaneRect rect, Dictionary +/// The rows a pane asks for in a stacked () split, and how a split's rows are +/// shared out once some of its panes have asked: a pane with gets exactly that, +/// one with gets at least that, and the rest is shared by the split's fractions +/// among the panes that did not fix their height. +/// +/// Only rows. A strip is one row of meters however wide it is drawn, so its width stays a share like any pane's. +/// +/// +public static class PaneExtent +{ + /// + /// The exact rows takes, or null when it shares. A stack of fixed panes is fixed at + /// their sum and dividers; a side-by-side row of them at the tallest; a subtree with any sharing pane in it + /// shares. + /// + public static int? FixedRows(LayoutNode node) + { + ArgumentNullException.ThrowIfNull(node); + if (node is PaneNode pane) + { + return pane.FixedRows is > 0 ? pane.FixedRows : null; + } + + var split = (SplitNode)node; + var rows = new List(split.Children.Count); + foreach (var child in split.Children) + { + if (FixedRows(child) is not { } fixedRows) + { + return null; + } + + rows.Add(fixedRows); + } + + return split.Direction == SplitDirection.Row + ? rows.Max() + : rows.Sum() + (LayoutSolver.DividerThickness * (rows.Count - 1)); + } + + /// The fewest rows is given: its fixed height, else its declared floor, else 0. + public static int MinRows(LayoutNode node) + { + ArgumentNullException.ThrowIfNull(node); + if (node is PaneNode pane) + { + return FixedRows(pane) ?? Math.Max(0, pane.MinRows ?? 0); + } + + var split = (SplitNode)node; + return split.Direction == SplitDirection.Row + ? split.Children.Max(MinRows) + : split.Children.Sum(MinRows) + (LayoutSolver.DividerThickness * (split.Children.Count - 1)); + } + + /// + /// Which children of are fixed in height. When every child is, the last is treated as + /// sharing, so the rows left over have somewhere to go — and the terminal's grid is built the same way. + /// + public static int?[] FixedChildren(SplitNode split) + { + ArgumentNullException.ThrowIfNull(split); + var fixedRows = split.Children.Select(FixedRows).ToArray(); + if (fixedRows.All(f => f is not null)) + { + fixedRows[^1] = null; + } + + return fixedRows; + } + + /// + /// Shares rows among a stacked split's children: fixed children first (in order, each + /// clamped to what is left), then the rest by the sharing children's fractions, and then any sharing child + /// under its floor is raised by taking from the sharing children with rows to spare. The result sums to + /// . + /// + public static int[] DistributeRows(int total, SplitNode split) + { + ArgumentNullException.ThrowIfNull(split); + var count = split.Children.Count; + var result = new int[count]; + if (total <= 0) + { + return result; + } + + var fixedRows = FixedChildren(split); + var remaining = total; + for (var i = 0; i < count; i++) + { + if (fixedRows[i] is { } rows) + { + result[i] = Math.Min(rows, remaining); + remaining -= result[i]; + } + } + + var sharing = Enumerable.Range(0, count).Where(i => fixedRows[i] is null).ToArray(); + // Distribute expects fractions of a whole, so the sharing children's are re-normalised among themselves. + var weights = sharing.Select(i => Math.Max(0, split.Sizes[i])).ToArray(); + var sum = weights.Sum(); + var fractions = sum > 0 + ? weights.Select(w => w / sum).ToArray() + : weights.Select(_ => 1.0 / weights.Length).ToArray(); + var cells = LayoutSolver.Distribute(remaining, fractions); + for (var j = 0; j < sharing.Length; j++) + { + result[sharing[j]] = cells[j]; + } + + // Floors: raise each short child from whichever sharing sibling has the most to spare. + foreach (var i in sharing) + { + var need = MinRows(split.Children[i]) - result[i]; + while (need > 0) + { + var donor = sharing + .Where(k => k != i && result[k] > MinRows(split.Children[k])) + .OrderByDescending(k => result[k] - MinRows(split.Children[k])) + .Cast() + .FirstOrDefault(); + if (donor is not { } d) + { + break; + } + + result[d]--; + result[i]++; + need--; + } + } + + return result; + } +} diff --git a/src/SharpMUTerm.Core/Workspace/PaneResize.cs b/src/SharpMUTerm.Core/Workspace/PaneResize.cs index 96f39410..95fa65de 100644 --- a/src/SharpMUTerm.Core/Workspace/PaneResize.cs +++ b/src/SharpMUTerm.Core/Workspace/PaneResize.cs @@ -17,6 +17,12 @@ public enum PaneResizeOutcome /// No rectangles for the panes involved — nothing has been laid out yet. NotMeasured, + + /// + /// The border is against a pane whose height is fixed (): a strip is as tall as + /// its content, so neither this pane nor the one beyond it can give or take rows across it. + /// + FixedSize, } /// The outcome of one resize, and the cells the border actually moved by (signed, 0 when it did not). @@ -144,17 +150,27 @@ public static PaneResizeResult Apply( var delta = direction is PaneDirection.Right or PaneDirection.Up ? step : -step; // Nearest first: the path runs root → pane, so walking it backwards is walking up from the pane. + // A split whose border is held by a fixed-height strip is passed over for the next one up, so the output + // under a vitals strip still grows by taking from a pane further out that can give. var path = Ancestry(layout.Root, layout.FocusedPaneId); + var blockedByFixed = false; for (var depth = path.Count - 1; depth >= 0; depth--) { var (split, index) = path[depth]; if (split.Direction == axis) { - return MoveBorder(split, index, horizontal, delta, rects); + var result = MoveBorder(split, index, horizontal, delta, rects); + if (result.Outcome != PaneResizeOutcome.FixedSize) + { + return result; + } + + blockedByFixed = true; } } - return new PaneResizeResult(PaneResizeOutcome.NoSplitInThatAxis, 0); + return new PaneResizeResult( + blockedByFixed ? PaneResizeOutcome.FixedSize : PaneResizeOutcome.NoSplitInThatAxis, 0); } /// @@ -183,6 +199,11 @@ public static PaneResizeResult DragBorder( } var horizontal = split.Direction == SplitDirection.Row; + if (!horizontal && (IsFixed(split.Children[index]) || IsFixed(split.Children[index + 1]))) + { + return new PaneResizeResult(PaneResizeOutcome.FixedSize, 0); + } + var extents = new int[split.Children.Count]; var start = 0; for (var i = 0; i < extents.Length; i++) @@ -247,7 +268,10 @@ public static int Minimum(LayoutNode node, bool horizontal) if (node is not SplitNode split) { - return horizontal ? MinimumPaneColumns : MinimumPaneRows; + var pane = (PaneNode)node; + return horizontal + ? MinimumPaneColumns + : PaneExtent.FixedRows(pane) ?? Math.Max(MinimumPaneRows, pane.MinRows ?? 0); } if ((split.Direction == SplitDirection.Row) != horizontal) @@ -284,6 +308,7 @@ public static string Describe(PaneResizeOutcome outcome, PaneDirection direction PaneResizeOutcome.Resized => string.Empty, PaneResizeOutcome.Zoomed => "this pane is zoomed — ⌃B z shows the others", PaneResizeOutcome.NotMeasured => "the panes have not been drawn yet", + PaneResizeOutcome.FixedSize => "a strip panel keeps the height of what it shows", PaneResizeOutcome.NoSplitInThatAxis when horizontal => "nothing divides this pane's columns — ⌃B | splits it side by side", PaneResizeOutcome.NoSplitInThatAxis => @@ -324,8 +349,28 @@ private static PaneResizeResult MoveBorder( } // The sibling on the side the border is: the next child, or the previous one at the far end. - // A SplitNode always has at least two children, so one of the two always exists. + // A SplitNode always has at least two children, so one of the two always exists. Rows are never + // taken from (or given to) a fixed-height strip: the pane on its other side pays instead, and with + // none the border cannot move. var donor = index + 1 < extents.Length ? index + 1 : index - 1; + if (!horizontal) + { + if (IsFixed(split.Children[index])) + { + return new PaneResizeResult(PaneResizeOutcome.FixedSize, 0); + } + + if (IsFixed(split.Children[donor])) + { + var other = donor == index + 1 ? index - 1 : index + 1; + if (other < 0 || other >= extents.Length || IsFixed(split.Children[other])) + { + return new PaneResizeResult(PaneResizeOutcome.FixedSize, 0); + } + + donor = other; + } + } // How far the border can travel before either side is at its floor. A pane already under its // floor — a workspace on a terminal too small for the split it holds — inverts these, and is the @@ -349,6 +394,9 @@ private static PaneResizeResult MoveBorder( return new PaneResizeResult(PaneResizeOutcome.Resized, moved); } + /// Whether a subtree's height is fixed, so no border may move rows into or out of it. + private static bool IsFixed(LayoutNode node) => PaneExtent.FixedRows(node) is not null; + /// /// A subtree's extent along one axis, in cells: its panes' rectangles unioned. Null when any of them /// has no rectangle, because a partial answer here would move a border by a made-up distance. diff --git a/src/SharpMUTerm.Core/Workspace/Workspace.cs b/src/SharpMUTerm.Core/Workspace/Workspace.cs index ad2c6212..9178aa18 100644 --- a/src/SharpMUTerm.Core/Workspace/Workspace.cs +++ b/src/SharpMUTerm.Core/Workspace/Workspace.cs @@ -96,6 +96,7 @@ public Workspace(IEnumerable windows, WorkspaceLayout layout) public IReadOnlyList WindowsFor(string? sessionKey) => _windows.Values .Where(w => Layout.FindWindow(w.Id) is not null) + .Where(w => w.Kind != WindowKind.Panel) .Where(w => w.SessionKey is null || string.Equals(w.SessionKey, sessionKey, StringComparison.Ordinal)) .OrderBy(w => w.Sequence) .ToList(); diff --git a/src/SharpMUTerm.Core/Workspace/WorkspaceWindow.cs b/src/SharpMUTerm.Core/Workspace/WorkspaceWindow.cs index 2d972c83..362e3d8c 100644 --- a/src/SharpMUTerm.Core/Workspace/WorkspaceWindow.cs +++ b/src/SharpMUTerm.Core/Workspace/WorkspaceWindow.cs @@ -11,6 +11,13 @@ public enum WindowKind /// An arbitrary auxiliary window (web view, map, notes…). Auxiliary, + + /// + /// A layout panel drawn by a control of its own (who is here, vitals, the quick bar, the docked composer): fixed + /// furniture of a layout rather than a place to go, so it has no ⌥N and no row on the rail + /// (). It is still a tab, focusable, and reached by its own ⌃P entry. + /// + Panel, } /// diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index a8a70f3f..7cbcc3e3 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -18,6 +18,7 @@ internal sealed class ListOverlay private MarkupControl? _content; private Func>? _render; private Func? _key; + private Func? _escape; private readonly ScreenTheme _scheme; @@ -39,7 +40,17 @@ public ListOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) /// Opens a surface. draws it at a width; answers a key /// and returns whether the surface stays open. /// - public void Open(string mode, string title, Func> render, Func key, int? width = null) + /// + /// Asked first when Esc is pressed: true when the surface took it (to leave a sub-mode of its own — a name being + /// typed, a delete awaiting its answer) and stays open; with none, or false, Esc closes. + /// + public void Open( + string mode, + string title, + Func> render, + Func key, + int? width = null, + Func? escape = null) { if (_window is not null) { @@ -48,6 +59,7 @@ public void Open(string mode, string title, Func> render, Func _render = render; _key = key; + _escape = escape; var desktop = _system.DesktopDimensions; var widest = Math.Clamp(desktop.Width - 8, 44, 110); var outer = width is { } asked ? Math.Clamp(asked + 4, 24, widest) : widest; @@ -119,6 +131,12 @@ private void OnKey(object? sender, KeyPressedEventArgs e) // A key can start a fetch whose answer opens the next surface (browse, then a review). Only the // surface the key was pressed on is closed, so that answer is never closed with it. var window = _window; + if (e.KeyInfo.Key == ConsoleKey.Escape && _escape?.Invoke() == true) + { + Repaint(); + return; + } + if (e.KeyInfo.Key == ConsoleKey.Escape || !_key(e.KeyInfo)) { if (_window == window) @@ -138,6 +156,7 @@ private void Reset() _content = null; _render = null; _key = null; + _escape = null; Mode = null; } } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index 9eec02cf..732a802d 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -61,7 +61,17 @@ private HorizontalGridControl PaneDivider(SplitNode split, int index) { var key = new DividerKey(split, index); var rule = Divider(_litDivider is { } lit && lit.Equals(key)); - _dividers.Add(new DividerSlot(rule, split, index)); + + // The rule beside a fixed-height strip is drawn but not registered: it cannot move, so it offers no + // resize cue to hover, no drag and no double-click to even. + var held = split.Direction == SplitDirection.Column + && (PaneExtent.FixedRows(split.Children[index]) is not null + || PaneExtent.FixedRows(split.Children[index + 1]) is not null); + if (!held) + { + _dividers.Add(new DividerSlot(rule, split, index)); + } + return rule; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs index 38b9929b..9bf7a4a4 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -71,6 +71,15 @@ private sealed record LiveLayout( private int _layoutsSelected; private string? _layoutsStatus; + /// The name being typed over the selected layout's (r), or null when no rename is under way. + private string? _layoutsRenaming; + + /// Whether the selected layout's delete (d) is waiting for its y. + private bool _layoutsConfirmingDelete; + + /// The longest name a rename takes; the list elides past its column anyway. + private const int LayoutNameMaxLength = 40; + /// The id of the layout realised in the panes, while it still owns them; for tests. internal string? LiveLayoutId => _liveLayout?.LayoutId; @@ -123,7 +132,7 @@ private string EnsurePanelWindow(string panelId, string key) var id = TerminalPanels.WindowId(panelId, key); if (_workspace.FindWindow(id) is null) { - _workspace.OpenWindow(id, PanelTitle(panelId), WindowKind.Auxiliary, key); + _workspace.OpenWindow(id, PanelTitle(panelId), WindowKind.Panel, key); } else if (_workspace.Layout.FindWindow(id) is null) { @@ -472,12 +481,108 @@ private void ShowLayouts() : ResolveLayout(key).Layout.Id; _layoutsSelected = Math.Max(0, all.ToList().FindIndex(l => l.Id == inUse)); _layoutsStatus = null; + _layoutsRenaming = null; + _layoutsConfirmingDelete = false; _layoutsView.Open( "layouts", $"Layouts · {Snippet(key)}", width => LayoutsListLines(key, width), k => LayoutsKeyPressed(key, k), - width: 64); + width: 64, + escape: LayoutsEscape); + } + + /// Esc in the ⌥M list: leaves a rename or a pending delete first, and closes the list only from rest. + private bool LayoutsEscape() + { + if (_layoutsRenaming is not null) + { + _layoutsRenaming = null; + _layoutsStatus = "rename cancelled"; + return true; + } + + if (_layoutsConfirmingDelete) + { + _layoutsConfirmingDelete = false; + _layoutsStatus = "kept"; + return true; + } + + return false; + } + + /// A key while a name is being typed: letters build it, ⏎ keeps it, ⌫ takes a letter back. + private bool LayoutsRenameKey(LayoutDefinition selected, ConsoleKeyInfo k) + { + var typed = _layoutsRenaming ?? string.Empty; + switch (k.Key) + { + case ConsoleKey.Enter: + var name = typed.Trim(); + if (name.Length == 0) + { + _layoutsStatus = "a layout needs a name — type one, or Esc keeps the old"; + return true; + } + + if (!Layouts.Rename(selected.Id, name)) + { + _layoutsStatus = Layouts.IsNameTaken(name, selected.Id) + ? $"a layout is already called {name}" + : $"{selected.Name} cannot be renamed"; + return true; + } + + PersistConfiguration(); + _layoutsRenaming = null; + _layoutsStatus = $"renamed to {name}"; + return true; + case ConsoleKey.Backspace: + _layoutsRenaming = typed.Length == 0 ? typed : typed[..^1]; + return true; + default: + if (k.KeyChar >= ' ' && !char.IsControl(k.KeyChar) + && (k.Modifiers & (ConsoleModifiers.Control | ConsoleModifiers.Alt)) == 0 + && typed.Length < LayoutNameMaxLength) + { + _layoutsRenaming = typed + k.KeyChar; + } + + return true; + } + } + + /// The answer to "delete …?": y deletes, anything else keeps it. + private bool LayoutsDeleteAnswer(string key, LayoutDefinition selected, ConsoleKeyInfo k) + { + _layoutsConfirmingDelete = false; + if (k.Key != ConsoleKey.Y || (k.Modifiers & (ConsoleModifiers.Control | ConsoleModifiers.Alt)) != 0) + { + _layoutsStatus = "kept"; + return true; + } + + if (!Layouts.Delete(selected.Id)) + { + _layoutsStatus = $"{selected.Name} cannot be deleted"; + return true; + } + + // The panes stay as they are; with the layout they were drawn from gone, they are the player's own now. + if (_liveLayout is { } live && live.LayoutId == selected.Id) + { + _liveLayout = null; + } + + PersistConfiguration(); + _layoutsSelected = Math.Clamp(_layoutsSelected, 0, Layouts.All.Count - 1); + var (world, character) = LayoutOwner(key); + var named = character?.Layout == selected.Id || world?.Layout == selected.Id; + _layoutsStatus = named + ? $"deleted {selected.Name} — this character falls back to the next layout" + : $"deleted {selected.Name}"; + return true; } private bool LayoutsKeyPressed(string key, ConsoleKeyInfo k) @@ -486,6 +591,17 @@ private bool LayoutsKeyPressed(string key, ConsoleKeyInfo k) _layoutsSelected = Math.Clamp(_layoutsSelected, 0, all.Count - 1); var selected = all[_layoutsSelected]; var (world, character) = LayoutOwner(key); + if (_layoutsRenaming is not null) + { + return LayoutsRenameKey(selected, k); + } + + if (_layoutsConfirmingDelete) + { + return LayoutsDeleteAnswer(key, selected, k); + } + + _layoutsStatus = null; switch (k.Key) { case ConsoleKey.UpArrow: @@ -509,6 +625,24 @@ private bool LayoutsKeyPressed(string key, ConsoleKeyInfo k) case ConsoleKey.N when k.Modifiers == 0: SaveLayoutAsNew(key, selected); return true; + case ConsoleKey.R when k.Modifiers == 0: + if (selected.IsBuiltIn) + { + _layoutsStatus = $"{selected.Name} is built in — n saves a copy you can rename"; + return true; + } + + _layoutsRenaming = selected.Name; + return true; + case ConsoleKey.D when k.Modifiers == 0: + if (selected.IsBuiltIn) + { + _layoutsStatus = $"{selected.Name} is built in and cannot be deleted"; + return true; + } + + _layoutsConfirmingDelete = true; + return true; case ConsoleKey.W when k.Modifiers == 0: if (world is null) { @@ -650,8 +784,11 @@ void Row(int index, LayoutDefinition layout) { var selected = index == _layoutsSelected; var mark = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; - var name = Snippet(layout.Name); - name = name.Length > nameColumn - 1 ? name[..(nameColumn - 2)] + "…" : name; + var renaming = selected && _layoutsRenaming is not null; + var name = renaming ? _layoutsRenaming! + "▏" : Snippet(layout.Name); + name = renaming + ? (name.Length > nameColumn - 1 ? "…" + name[^(nameColumn - 2)..] : name) + : (name.Length > nameColumn - 1 ? name[..(nameColumn - 2)] + "…" : name); var tags = new List(); if (layout.Id == inUse) { @@ -696,18 +833,41 @@ void Row(int index, LayoutDefinition layout) lines.Add($" [{ScreenPalette.Label}]none yet — n saves the panes as they are now[/]"); } + string Key(string chord, string what) => $"[{ScreenPalette.Accent}]{chord}[/] [{ScreenPalette.Label}]{what}[/]"; + var current = all[Math.Clamp(_layoutsSelected, 0, all.Count - 1)]; + var statusLine = _layoutsStatus is { } status ? $"[{ScreenPalette.Value}]{Escape(status)}[/]" : string.Empty; + + // Every row below is always present, blank when it has nothing to say, so the modal (sized once, when it + // opens) never has a line pushed off its bottom by a status or a question. lines.Add(string.Empty); - lines.Add( - $"[{ScreenPalette.Accent}]s[/] [{ScreenPalette.Label}]save changes[/] " - + $"[{ScreenPalette.Accent}]n[/] [{ScreenPalette.Label}]save as new[/]"); - lines.Add( - $"[{ScreenPalette.Accent}]w[/] [{ScreenPalette.Label}]use for world[/] " - + $"[{ScreenPalette.Accent}]c[/] [{ScreenPalette.Label}]use for this character[/]"); - if (_layoutsStatus is { } status) + if (_layoutsRenaming is not null) { - lines.Add($"[{ScreenPalette.Value}]{Escape(status)}[/]"); + lines.Add($"[{ScreenPalette.Label}]type a new name for[/] [{ScreenPalette.Value}]{Escape(Snippet(current.Name))}[/]"); + lines.Add(string.Empty); + lines.Add(string.Empty); + lines.Add(statusLine); + lines.Add(string.Empty); + lines.Add($"[{ScreenPalette.Label}][[⏎]] Keep name [[⌫]] Erase [[Esc]] Cancel[/]"); + return lines; } + if (_layoutsConfirmingDelete) + { + lines.Add($"[{ScreenPalette.Value}]delete {Escape(Snippet(current.Name))}?[/] [{ScreenPalette.Label}]it cannot be brought back[/]"); + lines.Add(string.Empty); + lines.Add(string.Empty); + lines.Add(string.Empty); + lines.Add(string.Empty); + lines.Add($"[{ScreenPalette.Label}][[y]] Delete [[Esc]] or any other key keeps it[/]"); + return lines; + } + + lines.Add($"{Key("s", "save changes")} {Key("n", "save as new")}"); + lines.Add($"{Key("w", "use for world")} {Key("c", "use for this character")}"); + + // r and d are named only over a layout of the player's own: on a built-in neither does anything but say so. + lines.Add(current.IsBuiltIn ? string.Empty : $"{Key("r", "rename")} {Key("d", "delete")}"); + lines.Add(statusLine); lines.Add(string.Empty); lines.Add($"[{ScreenPalette.Label}]↑↓ pick [[Esc]] Close [[⏎]] Apply[/]"); return lines; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index eea3d7b6..cce0ffe6 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -663,12 +663,7 @@ private IReadOnlyList PanelMeters(string sessionKey) private void LoadDemoPanels(string view) { LoadDemoGameData(); - _demoOccupants.Apply( - "Room.Players", - """[{"name":"Ashlyn","fullname":"Ashlyn the Wanderer","idle":12},{"name":"Brannoc","idle":260},{"name":"Merrow","fullname":"Merrow of the Tide","idle":5},{"name":"Corvid","idle":0}]"""); - _demoOccupants.Apply( - "Char.Items.List", - """{"location":"room","items":[{"id":"9101","name":"a town crier","attrib":"m"},{"id":"9102","name":"a stray cat","attrib":"m"},{"id":"9103","name":"a lantern","attrib":"t"}]}"""); + LoadDemoOccupants(); switch (view) { @@ -705,7 +700,7 @@ private void LoadDemoPanels(string view) && _workspace.Layout.FindWindow(composer) is { } column) { var who = TerminalPanels.WindowId(PanelIds.WhoHere, DemoScene.ActiveSessionKey); - _workspace.OpenWindow(who, PanelTitle(PanelIds.WhoHere), WindowKind.Auxiliary, DemoScene.ActiveSessionKey, column.Id); + _workspace.OpenWindow(who, PanelTitle(PanelIds.WhoHere), WindowKind.Panel, DemoScene.ActiveSessionKey, column.Id); _workspace.Layout.SplitWithWindow(who, column.Id, Edge.Bottom); RebuildPaneArea(); Activate(MainWindowId); @@ -719,6 +714,21 @@ private void LoadDemoPanels(string view) RefreshRail(); } + /// The demo room's roster, written through as the wire would. + private void LoadDemoOccupants() + { + const string players = + """[{"name":"Ashlyn","fullname":"Ashlyn the Wanderer","idle":12},{"name":"Brannoc","idle":260},{"name":"Merrow","fullname":"Merrow of the Tide","idle":5},{"name":"Corvid","idle":0}]"""; + + // Into the game data too, as a session stores every GMCP package: that is where a layout reads "who is here + // is known" from (PanelAvailability), so the Roleplay layout draws the panel. + _demoGameData.SetGmcp("Room.Players", players); + _demoOccupants.Apply("Room.Players", players); + _demoOccupants.Apply( + "Char.Items.List", + """{"location":"room","items":[{"id":"9101","name":"a town crier","attrib":"m"},{"id":"9102","name":"a stray cat","attrib":"m"},{"id":"9103","name":"a lantern","attrib":"t"}]}"""); + } + /// Opens a demo panel in a new pane to the right of the main window's, wide. private string? OpenDemoPanelBeside(string panelId, int columns) { @@ -735,7 +745,7 @@ private void LoadDemoPanels(string view) return windowId; } - /// Opens a demo panel in a pane along one edge of the main window's, as short as a pane may be. + /// Opens a demo strip panel in a pane along one edge of the main window's; it is as tall as its content. private void OpenDemoPanelStrip(string panelId, Edge edge) { var mainPane = _workspace.Layout.FindWindow(MainWindowId)?.Id; @@ -747,7 +757,6 @@ private void OpenDemoPanelStrip(string panelId, Edge edge) _workspace.Layout.SplitWithWindow(windowId, mainPane, edge); RebuildPaneArea(); Activate(windowId); - SizeDemoPane(windowId, PaneResize.MinimumPaneRows); } /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 9d6212e1..8668ea1d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1831,6 +1831,15 @@ public string RenderSnapshot(string? view = null) ApplyLayout(DemoScene.ActiveSessionKey, Core.Layouts.BuiltInLayouts.Combat); } + // `layout-roleplay` is the same for the Roleplay layout: who is here beside the output (the room's roster, + // so it has data) with Chat as a tab behind it, and the docked composer under the output at its floor. + if (string.Equals(view, "layout-roleplay", StringComparison.OrdinalIgnoreCase)) + { + LoadDemoGameData(); + LoadDemoOccupants(); + ApplyLayout(DemoScene.ActiveSessionKey, Core.Layouts.BuiltInLayouts.Roleplay); + } + // The ⌃Q confirmation, over a workspace that has something to lose: a second world marked // connected (the demo scene's own way of saying so, and what the header's "n/m characters" reads), // a line typed into the command line through the bar's real change notification, and then the @@ -7719,8 +7728,10 @@ private IReadOnlyList BuildRailWindows( var windows = new List(); foreach (var window in _workspace.Windows) { + // A layout panel is not listed: it is furniture of the layout, not a window you go to, and it carries + // no ⌥N (Workspace.WindowsFor) — so the rail and the numbering stay one list. var mine = string.Equals(window.SessionKey, owner, StringComparison.Ordinal); - if (window.SessionKey is not null && !mine) + if (window.Kind == WindowKind.Panel || window.SessionKey is not null && !mine) { continue; } @@ -9921,6 +9932,14 @@ private IWindowControl BuildWorkspaceRow() _dividers.Clear(); + // Each pane's height claim, from what it holds: a strip panel is as tall as its content and an editor has a + // floor. Derived here on every rebuild rather than stored, so a pane handed an ordinary window stops being a + // strip at once. + foreach (var pane in _workspace.Layout.Root.Panes()) + { + Core.Layouts.PanelSizing.Apply(pane, PanelIdOfWindow, TabStripRows); + } + // When a pane is zoomed, render just that pane full-area; otherwise render the whole tree. var zoomed = _workspace.Layout.ZoomedPaneId is { } zid ? _workspace.Layout.FindPane(zid) : null; var paneArea = zoomed is not null @@ -10458,10 +10477,17 @@ private IWindowControl BuildLayoutNode(SharpMUTerm.Core.Workspaces.LayoutNode no // Interleave a thin 1-cell divider between children (a solid border-colour bar) instead of the // framework's double-line splitter, so splits read as a single calm line. + // A stacked split gives a strip pane exactly its rows (Cells) and an editor its floor (Star's min); the rest + // share by weight. PaneExtent.DistributeRows is the same rule, for the panes nothing has arranged yet. + var stacked = split.Direction == SplitDirection.Column; + var fixedRows = stacked ? PaneExtent.FixedChildren(split) : new int?[children.Count]; var tracks = new List(); for (var i = 0; i < children.Count; i++) { - tracks.Add(GridLength.Star(Math.Max(0.01, split.Sizes[i]))); + var floor = stacked ? PaneExtent.MinRows(split.Children[i]) : 0; + tracks.Add(fixedRows[i] is { } rows + ? GridLength.Cells(rows) + : GridLength.Star(Math.Max(0.01, split.Sizes[i]), min: floor > 0 ? floor : null)); if (i < children.Count - 1) { tracks.Add(GridLength.Cells(1)); @@ -10499,6 +10525,13 @@ private IWindowControl BuildLayoutNode(SharpMUTerm.Core.Workspaces.LayoutNode no return grid.Build(); } + /// The rows the framework's tab strip takes over a pane (the classic header style). + private const int TabStripRows = 1; + + /// The layout panel a window draws, or null for an ordinary window. + private static string? PanelIdOfWindow(string windowId) => + TerminalPanels.TryParseWindowId(windowId, out var panelId, out _) ? panelId : null; + /// Whether a pane is the one every workspace keystroke is aimed at. private bool IsFocusedPane(string paneId) => string.Equals(paneId, _workspace.Layout.FocusedPaneId, StringComparison.Ordinal); @@ -10578,6 +10611,11 @@ private IWindowControl BuildPaneTabs(PaneNode pane) PaintTabChips(tabs, PaneSurfaceTone(pane.Id)); + // A one-tab strip (the vitals meters, the quick bar) draws no tab strip: its row already says what it is, + // and a strip the height of its content has no row to spare. PaneOutputRects reads TabHeaderHeight, so the + // rectangle it reports follows. + tabs.ShowTabHeader = Core.Layouts.PanelSizing.ShowsTabStrip(pane.Tabs.Select(PanelIdOfWindow).ToList()); + var paneId = pane.Id; tabs.TabChanged += (_, e) => OnTabChanged(paneId, e.NewTab); tabs.TabCloseRequested += (_, e) => OnTabCloseRequested(e.TabPage); @@ -10718,6 +10756,7 @@ private void RebuildPaneArea() _window.InsertControl(WorkspaceRowIndex, row); _workspaceRow = row; RefreshTabTitles(); + SyncStatusMeters(); } /// How many times the pane area has been torn down and rebuilt; a test counts the reflows a change cost. @@ -11966,11 +12005,13 @@ internal PaneDragSurface PaneSnapshot() var rects = new Dictionary(StringComparer.Ordinal); var windows = new Dictionary(StringComparer.Ordinal); - foreach (var (paneId, _, rect) in RealisedPanes()) + foreach (var (paneId, tabs, rect) in RealisedPanes()) { rects[paneId] = rect; - if (_workspace.Layout.FindPane(paneId)?.ActiveTab is { } windowId) + // A pane that draws no tab strip (a one-row strip panel) has no drag handle: its one row is its + // content, and a press there belongs to that content's links. + if (tabs.ShowTabHeader && _workspace.Layout.FindPane(paneId)?.ActiveTab is { } windowId) { windows[paneId] = windowId; } @@ -12466,6 +12507,7 @@ private void SyncToFocusedPane() RefreshPromptRow(); ReportPaneSizes(); SyncComposerArm(); + SyncStatusMeters(); } /// @@ -13278,6 +13320,40 @@ internal static string RoomCell(string name, string? area) return $"[dim]⌂ {Escape(text.PadRight(room))}[/]"; } + /// Whether the status row last left its meters out because the vitals strip was showing them. + private bool _statusMetersHidden; + + /// + /// Whether the status row's character (the one its meters read) has its vitals strip on screen: the strip's + /// window is the front tab of a pane that is drawn, so the same meters are already in front of the reader. + /// + internal bool VitalsStripShowing() + { + var key = _active?.SessionKey + ?? (_sessions.Sessions.Count == 0 ? _demoActiveKey ?? DemoScene.ActiveSessionKey : null); + if (key is null) + { + return false; + } + + var windowId = TerminalPanels.WindowId(Core.Layouts.PanelIds.Vitals, key); + return _workspace.Layout.FindWindow(windowId) is { } pane + && pane.ActiveTab == windowId + && (_workspace.Layout.ZoomedPaneId is not { } zoomed || zoomed == pane.Id); + } + + /// + /// Repaints the status row when the vitals strip has come onto the screen or left it since the row was drawn, + /// so the meters move between the two. Only on a change: a repaint for nothing would displace a notice. + /// + private void SyncStatusMeters() + { + if (VitalsStripShowing() != _statusMetersHidden) + { + RefreshStatusBar(); + } + } + /// The cells the meters leave free for the typed-character count to grow into. private const int MeterSlack = 4; @@ -13285,7 +13361,12 @@ private string StatusBarMarkup(string character, string state) { var accent = ActiveWorld() is { } world ? AccentHex(world.Accent) : _ink.Accent; var left = $"[{accent}]●[/] [bold]{Escape(character)}[/] [dim]{Escape(state)}[/]"; - var meters = StatusMeterRenderer.Render(StatusMeters(), StatusData(), $"{_ink.Notice}"); + // The vitals strip already draws these meters for this character, larger; the row says them only while it + // is not on screen. Nothing else on the row moves with it: every other cell is reserved or dropped by width. + _statusMetersHidden = VitalsStripShowing(); + var meters = _statusMetersHidden + ? string.Empty + : StatusMeterRenderer.Render(StatusMeters(), StatusData(), $"{_ink.Notice}"); var right = new List(); diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index fb5474d4..338a6695 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -25,7 +25,7 @@ internal static class SnapshotViews "mxp-image", "mxp-figure", "input-selection", "selection", "trigger-builder", "prefix", "prefix-panel", "focus", "focus-moved", "tabs", "tabs-many", "collapsed", "timestamps", "timestamps-toggled", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", - "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", + "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", ]; } diff --git a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs new file mode 100644 index 00000000..d16bea02 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs @@ -0,0 +1,209 @@ +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Core.Tests.Workspaces; + +/// +/// A strip panel (one row of meters, one row of buttons) is as tall as its content, whatever share its region was +/// given: is honoured by the solver and the resizer, and the rest of a stacked +/// split goes to the panes that share. +/// +public class PaneExtentTests +{ + private static readonly PaneRect Screen = new(0, 0, 100, 30); + + private static PaneNode Pane(string id, int? fixedRows = null, int? minRows = null) => + new(id, [id]) { FixedRows = fixedRows, MinRows = minRows }; + + [Test] + public async Task AFixedStripGetsExactlyItsRowsAndTheRestGoesToTheSharingPane() + { + // The Combat shape: a one-row strip over the output, the strip's share a tenth of the window. + var root = new SplitNode(SplitDirection.Column, [Pane("vitals", fixedRows: 1), Pane("output")], [0.1, 0.9]); + + var rects = LayoutSolver.Solve(root, Screen); + + await Assert.That(rects["vitals"]).IsEqualTo(new PaneRect(0, 0, 100, 1)); + await Assert.That(rects["output"]).IsEqualTo(new PaneRect(0, 2, 100, 28)); + } + + [Test] + public async Task TheShareAFixedPaneWasGivenDoesNotMatter() + { + var narrow = new SplitNode(SplitDirection.Column, [Pane("output"), Pane("quick", fixedRows: 1)], [0.95, 0.05]); + var wide = new SplitNode(SplitDirection.Column, [Pane("output"), Pane("quick", fixedRows: 1)], [0.2, 0.8]); + + await Assert.That(LayoutSolver.Solve(narrow, Screen)["quick"].Height).IsEqualTo(1); + await Assert.That(LayoutSolver.Solve(wide, Screen)["quick"].Height).IsEqualTo(1); + await Assert.That(LayoutSolver.Solve(wide, Screen)["output"].Height).IsEqualTo(28); + } + + [Test] + public async Task SharingPanesStillSplitWhatIsLeftByTheirFractions() + { + var root = new SplitNode( + SplitDirection.Column, + [Pane("strip", fixedRows: 2), Pane("a"), Pane("b")], + [0.5, 0.25, 0.25]); + + var rects = LayoutSolver.Solve(root, Screen); + + // 30 − 2 dividers = 28; the strip takes 2, and a and b split the 26 left evenly. + await Assert.That(rects["strip"].Height).IsEqualTo(2); + await Assert.That(rects["a"].Height).IsEqualTo(13); + await Assert.That(rects["b"].Height).IsEqualTo(13); + } + + [Test] + public async Task ColumnsAreNeverFixed() + { + var root = new SplitNode(SplitDirection.Row, [Pane("vitals", fixedRows: 1), Pane("output")]); + + var rects = LayoutSolver.Solve(root, Screen); + + await Assert.That(rects["vitals"].Height).IsEqualTo(30); + await Assert.That(rects["vitals"].Width).IsEqualTo(50); + } + + [Test] + public async Task AFloorRaisesAPaneItsShareWouldSqueeze() + { + // The Roleplay shape: the composer's region is a fifth of the window, its floor six rows. + var root = new SplitNode(SplitDirection.Column, [Pane("output"), Pane("composer", minRows: 6)], [0.9, 0.1]); + + var rects = LayoutSolver.Solve(root, Screen); + + await Assert.That(rects["composer"].Height).IsEqualTo(6); + await Assert.That(rects["output"].Height).IsEqualTo(23); + } + + [Test] + public async Task WhenEveryPaneIsFixedTheLastTakesWhatIsLeftSoNoRowIsLost() + { + var root = new SplitNode(SplitDirection.Column, [Pane("a", fixedRows: 1), Pane("b", fixedRows: 1)]); + + var rects = LayoutSolver.Solve(root, Screen); + + await Assert.That(rects["a"].Height).IsEqualTo(1); + await Assert.That(rects["b"].Height).IsEqualTo(28); + } + + [Test] + public async Task ASubtreeIsFixedOnlyWhenEveryPaneInItIs() + { + var strips = new SplitNode(SplitDirection.Row, [Pane("vitals", fixedRows: 1), Pane("quick", fixedRows: 2)]); + var stack = new SplitNode(SplitDirection.Column, [Pane("vitals2", fixedRows: 1), Pane("quick2", fixedRows: 1)]); + var mixed = new SplitNode(SplitDirection.Row, [Pane("vitals3", fixedRows: 1), Pane("output")]); + + await Assert.That(PaneExtent.FixedRows(strips)).IsEqualTo(2); + await Assert.That(PaneExtent.FixedRows(stack)).IsEqualTo(3); // two rows and the divider between them + await Assert.That(PaneExtent.FixedRows(mixed)).IsNull(); + } + + [Test] + public async Task DraggingTheDividerOfAFixedStripMovesNothing() + { + var root = new SplitNode(SplitDirection.Column, [Pane("vitals", fixedRows: 1), Pane("output")], [0.1, 0.9]); + var before = root.Sizes.ToList(); + var rects = LayoutSolver.Solve(root, Screen); + + var result = PaneResize.DragBorder(root, 0, 8, rects); + + await Assert.That(result.Outcome).IsEqualTo(PaneResizeOutcome.FixedSize); + await Assert.That(root.Sizes).IsEquivalentTo(before); + } + + [Test] + public async Task ResizingFromBesideAStripTakesTheRowsFromThePaneBeyondIt() + { + // output between a fixed strip above and a sharing pane below: ⌥⇧↑ grows output from below, not the strip. + var layout = new WorkspaceLayout( + new SplitNode(SplitDirection.Column, [Pane("strip", fixedRows: 1), Pane("output"), Pane("below")], [0.1, 0.45, 0.45]), + "output"); + var rects = LayoutSolver.Solve(layout.Root, Screen); + + var result = PaneResize.Apply(layout, PaneDirection.Up, rects); + var after = LayoutSolver.Solve(layout.Root, Screen); + + await Assert.That(result.Outcome).IsEqualTo(PaneResizeOutcome.Resized); + await Assert.That(after["strip"].Height).IsEqualTo(1); + await Assert.That(after["output"].Height).IsEqualTo(rects["output"].Height + 1); + } + + [Test] + public async Task AResizeWithOnlyAStripToPayIsRefusedAndSaysWhy() + { + var layout = new WorkspaceLayout( + new SplitNode(SplitDirection.Column, [Pane("vitals", fixedRows: 1), Pane("output")]), + "output"); + var rects = LayoutSolver.Solve(layout.Root, Screen); + + var result = PaneResize.Apply(layout, PaneDirection.Up, rects); + + await Assert.That(result.Outcome).IsEqualTo(PaneResizeOutcome.FixedSize); + await Assert.That(PaneResize.Describe(result.Outcome, PaneDirection.Up)).IsNotEmpty(); + } + + [Test] + public async Task AStripsFloorIsItsOwnHeightNotTheOrdinaryFloor() + { + await Assert.That(PaneResize.Minimum(Pane("vitals", fixedRows: 1), horizontal: false)).IsEqualTo(1); + await Assert.That(PaneResize.Minimum(Pane("composer", minRows: 6), horizontal: false)).IsEqualTo(6); + await Assert.That(PaneResize.Minimum(Pane("output"), horizontal: false)).IsEqualTo(PaneResize.MinimumPaneRows); + } + + [Test] + public async Task APaneHoldingOneStripPanelIsAsTallAsItAndDrawsNoTabStrip() + { + var pane = new PaneNode("p", ["panel:vitals:W.C"]); + + PanelSizing.Apply(pane, PanelOf, tabStripRows: 1); + + await Assert.That(pane.FixedRows).IsEqualTo(1); + await Assert.That(PanelSizing.ShowsTabStrip(pane.Tabs.Select(PanelOf).ToList())).IsFalse(); + } + + [Test] + public async Task TwoStripPanelsInOnePaneAddTheTabStripTheyThenNeed() + { + var pane = new PaneNode("p", ["panel:vitals:W.C", "panel:quick-bar:W.C"]); + + PanelSizing.Apply(pane, PanelOf, tabStripRows: 1); + + await Assert.That(pane.FixedRows).IsEqualTo(2); + await Assert.That(PanelSizing.ShowsTabStrip(pane.Tabs.Select(PanelOf).ToList())).IsTrue(); + } + + [Test] + public async Task AStripHandedAnOrdinaryWindowStopsBeingAStrip() + { + var pane = new PaneNode("p", ["panel:vitals:W.C"]) { FixedRows = 1 }; + pane.Tabs.Add("main"); + + PanelSizing.Apply(pane, PanelOf, tabStripRows: 1); + + await Assert.That(pane.FixedRows).IsNull(); + } + + [Test] + public async Task AComposerPaneHasAFloorOfItsEditorAndItsTabStrip() + { + var pane = new PaneNode("p", ["panel:composer:W.C"]); + + PanelSizing.Apply(pane, PanelOf, tabStripRows: 1); + + await Assert.That(pane.FixedRows).IsNull(); + await Assert.That(pane.MinRows).IsEqualTo(PanelSizing.ComposerMinRows + 1); + } + + private static string? PanelOf(string windowId) + { + if (!windowId.StartsWith("panel:", StringComparison.Ordinal)) + { + return null; + } + + var rest = windowId["panel:".Length..]; + return rest[..rest.IndexOf(':')]; + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Workspace/WindowNumberingTests.cs b/tests/SharpMUTerm.Core.Tests/Workspace/WindowNumberingTests.cs index 3d107e11..eda4ab28 100644 --- a/tests/SharpMUTerm.Core.Tests/Workspace/WindowNumberingTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Workspace/WindowNumberingTests.cs @@ -235,6 +235,23 @@ public async Task AHalfMigratedWorkspaceGivesNoTwoWindowsOneNumber() private const string Owner = "W.C"; /// The window id produces for . + /// + /// A layout panel is furniture, not a destination. The vitals strip or the quick bar opening must not + /// take a digit from the windows a player goes to — the map, a capture — nor push them to later ones; the + /// numbering stays contiguous over what is left. + /// + [Test] + public async Task ALayoutPanelTakesNoNumberAndMovesNoOtherWindowsNumber() + { + var ws = new Workspace(mainWindowId: "main", mainTitle: "Main", sessionKey: "W.C"); + ws.OpenWindow("panel:vitals:W.C", "Vitals", WindowKind.Panel, "W.C"); + ws.RouteSpawn("Chat", "W.C"); + ws.OpenWindow("panel:quick-bar:W.C", "Quick bar", WindowKind.Panel, "W.C"); + ws.OpenWindow("map:W.C", "Map", WindowKind.Auxiliary, "W.C"); + + await Assert.That(Order(ws)).IsEqualTo($"main,{Spawn("Chat")},map:W.C"); + } + private static string Spawn(string target) => Workspace.SpawnWindowId(Owner, target); private static string Order(Workspace workspace) => diff --git a/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs b/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs new file mode 100644 index 00000000..49c6da09 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs @@ -0,0 +1,234 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The furniture of a layout in the client: a strip panel is as tall as its content and draws no tab strip, the status +/// row does not repeat meters the vitals strip is already showing, a panel takes no rail row and no ⌥N, the +/// composer keeps an editor's height, and ⌥M renames and deletes saved layouts. +/// +/// Serialised: rendering redirects the process-global Console.Out. +[NotInParallel] +public class LayoutStripTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static readonly ConsoleKeyInfo AltM = new('m', ConsoleKey.M, shift: false, alt: true, control: false); + + private static readonly ConsoleKeyInfo Down = new('\0', ConsoleKey.DownArrow, false, false, false); + + private static readonly ConsoleKeyInfo Enter = new('\r', ConsoleKey.Enter, false, false, false); + + private static readonly ConsoleKeyInfo Esc = new('\u001b', ConsoleKey.Escape, false, false, false); + + private static readonly ConsoleKeyInfo Backspace = new('\b', ConsoleKey.Backspace, false, false, false); + + private static SharpMUTermApp Demo(AppConfiguration? config = null, int width = 120, int height = 32) + { + Console.SetIn(TextReader.Null); + config ??= DemoScene.Build(); + config.ScrollbackSpill.Enabled = false; + return new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); + } + + private static ConsoleKeyInfo Letter(char c) => + new(c, ConsoleKey.A + (char.ToUpperInvariant(c) - 'A'), char.IsUpper(c), false, false); + + private static ConsoleKeyInfo Typed(char c) => char.IsLetter(c) ? Letter(c) : new(c, ConsoleKey.Spacebar, false, false, false); + + [Test] + [Arguments(120, 32)] + [Arguments(80, 24)] + public async Task CombatsVitalsAndQuickBarAreOneRowEachWithNoTabStrip(int width, int height) + { + await using var app = Demo(width: width, height: height); + app.RenderSnapshot("layout-combat"); + + var output = app.PaneOutputRects(); + var whole = app.PaneSnapshot().Rects; + await Assert.That(output["panel:vitals"].Height).IsEqualTo(1); + await Assert.That(output["panel:quick-bar"].Height).IsEqualTo(1); + + // No tab strip: the pane is its content, so its whole rectangle is that one row too. + await Assert.That(whole["panel:vitals"].Height).IsEqualTo(1); + await Assert.That(whole["panel:quick-bar"].Height).IsEqualTo(1); + + // The output pane keeps its tab strip, and everything the strips did not take. + await Assert.That(whole["panel:output"].Height - output["panel:output"].Height).IsEqualTo(1); + await Assert.That(output["panel:output"].Height).IsGreaterThan(height / 2); + } + + [Test] + public async Task TheStatusRowLeavesOutTheMetersWhileTheVitalsStripShowsThem() + { + await using var app = Demo(); + app.RenderSnapshot("layout-combat"); + + await Assert.That(app.VitalsStripShowing()).IsTrue(); + await Assert.That(app.StatusMarkup).DoesNotContain("[dim]hp[/]"); + await Assert.That(app.StatusMarkup).Contains("Corvid"); + } + + [Test] + public async Task TheMetersComeBackToTheStatusRowWhenTheStripIsNotOnScreen() + { + await using var app = Demo(); + app.RenderSnapshot("meters"); + + await Assert.That(app.VitalsStripShowing()).IsFalse(); + await Assert.That(app.StatusMarkup).Contains("[dim]hp[/]"); + } + + [Test] + public async Task ZoomingAnotherPaneBringsTheMetersBack() + { + await using var app = Demo(); + app.RenderSnapshot("layout-combat"); + + app.DispatchCommand("layout:zoom"); + + await Assert.That(app.VitalsStripShowing()).IsFalse(); + await Assert.That(app.StatusMarkup).Contains("[dim]hp[/]"); + } + + [Test] + public async Task PanelsTakeNoRailRowAndNoNumber() + { + await using var app = Demo(); + app.RenderSnapshot("layout-combat"); + + var rail = string.Join("\n", app.RailLines); + await Assert.That(rail).DoesNotContain("Vitals"); + await Assert.That(rail).DoesNotContain("Quick bar"); + await Assert.That(app.NumberedWindowIds.Any(id => id.StartsWith(TerminalPanels.WindowPrefix, StringComparison.Ordinal))).IsFalse(); + + // The map is a place you go, so it keeps its number — the third, right after main and Chat. + await Assert.That(app.NumberedWindowIds[2]).IsEqualTo(SharpMUTermApp.MapWindowId(DemoScene.ActiveSessionKey)); + await Assert.That(rail).Contains("⌥3"); + await Assert.That(rail).DoesNotContain("⌥4"); + } + + [Test] + public async Task RoleplayDrawsWhoIsHereAndGivesTheComposerAnEditorsHeight() + { + await using var app = Demo(); + app.RenderSnapshot("layout-roleplay"); + + await Assert.That(app.LiveLayoutId).IsEqualTo(BuiltInLayouts.RoleplayId); + await Assert.That(app.PaneIds).Contains("panel:who-here"); + await Assert.That(app.PaneIds).Contains("panel:composer"); + await Assert.That(app.PaneOutputRects()["panel:composer"].Height).IsGreaterThanOrEqualTo(PanelSizing.ComposerMinRows); + } + + [Test] + public async Task RenameTypesANewNameOverTheSelectedLayout() + { + var config = DemoScene.Build(); + config.Layouts.Add(new LayoutDefinition { Id = "mine", Name = "Mine", Placements = BuiltInLayouts.Combat.Placements }); + await using var app = Demo(config); + app.RenderSnapshot(); + app.SimulateKey(AltM); + app.SimulateLayoutsKey(Down); + app.SimulateLayoutsKey(Down); // Mine + + await Assert.That(string.Join("\n", app.LayoutsLines)).Contains("rename"); + app.SimulateLayoutsKey(Letter('r')); + for (var i = 0; i < "Mine".Length; i++) + { + app.SimulateLayoutsKey(Backspace); + } + + foreach (var c in "Raid night") + { + app.SimulateLayoutsKey(Typed(c)); + } + + await Assert.That(string.Join("\n", app.LayoutsLines)).Contains("Raid night"); + app.SimulateLayoutsKey(Enter); + + await Assert.That(app.LayoutsOpen).IsTrue(); // ⏎ keeps the name; it does not apply the layout + await Assert.That(config.Layouts.Single().Name).IsEqualTo("Raid night"); + await Assert.That(string.Join("\n", app.LayoutsLines)).Contains("renamed to Raid night"); + } + + [Test] + public async Task EscLeavesARenameWithoutClosingTheListOrChangingTheName() + { + var config = DemoScene.Build(); + config.Layouts.Add(new LayoutDefinition { Id = "mine", Name = "Mine", Placements = BuiltInLayouts.Combat.Placements }); + await using var app = Demo(config); + app.RenderSnapshot(); + app.SimulateKey(AltM); + app.SimulateLayoutsKey(Down); + app.SimulateLayoutsKey(Down); + app.SimulateLayoutsKey(Letter('r')); + app.SimulateLayoutsKey(Letter('x')); + + app.SimulateLayoutsKey(Esc); + + await Assert.That(app.LayoutsOpen).IsTrue(); + await Assert.That(config.Layouts.Single().Name).IsEqualTo("Mine"); + } + + [Test] + public async Task DeleteAsksFirstAndYDeletes() + { + var config = DemoScene.Build(); + config.Layouts.Add(new LayoutDefinition { Id = "mine", Name = "Mine", Placements = BuiltInLayouts.Combat.Placements }); + await using var app = Demo(config); + app.RenderSnapshot(); + app.SimulateKey(AltM); + app.SimulateLayoutsKey(Down); + app.SimulateLayoutsKey(Down); + + app.SimulateLayoutsKey(Letter('d')); + await Assert.That(string.Join("\n", app.LayoutsLines)).Contains("delete Mine?"); + await Assert.That(config.Layouts.Count).IsEqualTo(1); // nothing yet + + app.SimulateLayoutsKey(Letter('y')); + await Assert.That(config.Layouts).IsEmpty(); + await Assert.That(app.LayoutsOpen).IsTrue(); + } + + [Test] + public async Task AnyOtherAnswerKeepsTheLayout() + { + var config = DemoScene.Build(); + config.Layouts.Add(new LayoutDefinition { Id = "mine", Name = "Mine", Placements = BuiltInLayouts.Combat.Placements }); + await using var app = Demo(config); + app.RenderSnapshot(); + app.SimulateKey(AltM); + app.SimulateLayoutsKey(Down); + app.SimulateLayoutsKey(Down); + + app.SimulateLayoutsKey(Letter('d')); + app.SimulateLayoutsKey(Letter('n')); + + await Assert.That(config.Layouts.Count).IsEqualTo(1); + await Assert.That(string.Join("\n", app.LayoutsLines)).Contains("kept"); + } + + [Test] + public async Task ABuiltInIsNeitherRenamedNorDeletedAndTheFooterDoesNotOfferEither() + { + var config = DemoScene.Build(); + await using var app = Demo(config); + app.RenderSnapshot(); + app.SimulateKey(AltM); // Roleplay, built in, is selected + + var lines = string.Join("\n", app.LayoutsLines); + await Assert.That(lines).DoesNotContain("rename"); + await Assert.That(lines).DoesNotContain("delete"); + + app.SimulateLayoutsKey(Letter('d')); + await Assert.That(string.Join("\n", app.LayoutsLines)).Contains("cannot be deleted"); + app.SimulateLayoutsKey(Letter('r')); + await Assert.That(string.Join("\n", app.LayoutsLines)).Contains("n saves a copy you can rename"); + await Assert.That(BuiltInLayouts.All.Select(l => l.Name)).IsEquivalentTo(new[] { "Roleplay", "Combat" }); + } +} From 1202adaf1e530c6a6f6da9168e4c6683d324d5ae Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 05:08:17 +0000 Subject: [PATCH 017/113] Open a first run on a welcome, and leave a key tour after its first connect A client with no worlds opens on a welcome: connect to a host (a form that goes through /connect's own path, adding the character it names), browse games from the package index (still fetched only when asked; says so in place when no index is set), or open F5, with the /connect line spelt out and a starting layout to pick (suggested by default, so the client's suggestion still applies). Esc closes it for the run; /welcome and Ctrl+P > Welcome reopen it. Under --plain (ClientHost.ScreenIsSeen false) the choices are announced as commands and /welcome layout picks the layout. The first connect of a configuration that started empty puts one chrome row naming Ctrl+P, Alt+M, F1 and F5, owed through AppConfiguration.KeyTourPending so it is shown once and survives a restart. Ctrl+P > Key tour hides and shows it. Snapshot views welcome, welcome-connect and tour. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 9 + CLAUDE.md | 30 +- src/SharpMUTerm.Avalonia/WindowHost.cs | 1 + .../Commands/BuiltInCommands.cs | 6 + .../Configuration/AppConfiguration.cs | 9 + src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 10 + src/SharpMUTerm.Tui/Hosting/PlainHost.cs | 1 + src/SharpMUTerm.Tui/ListOverlay.cs | 24 +- src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs | 15 +- src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs | 351 ++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 52 +- src/SharpMUTerm.Tui/SnapshotViews.cs | 1 + src/SharpMUTerm.Tui/WelcomeSurface.cs | 447 ++++++++++++++++++ .../FrameContrastTests.cs | 4 + .../SnapshotViewEmptyConfigTests.cs | 2 +- tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs | 328 +++++++++++++ 16 files changed, 1281 insertions(+), 9 deletions(-) create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs create mode 100644 src/SharpMUTerm.Tui/WelcomeSurface.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cd3e4f7..d5b99cd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- A first run has somewhere to start: with no worlds, the client opens on a welcome offering *Connect to a + host* (a small form for the host, port, TLS and your character's name), *Browse games* from the package + index and *Open settings*, with the `/connect` line spelt out and a starting layout to pick (Roleplay, + Combat, or suggested from what the game sends). Esc closes it; `/welcome` or Ctrl+P ▸ *Welcome* brings it + back. With `--plain` the choices are read out as commands to type. +- After the first connect of a new configuration, one row names the keys worth knowing (Ctrl+P, Alt+M, F1, + F5). Ctrl+P ▸ *Key tour* hides it and shows it again. + - Ctrl+P matches as you type by initials and fragments, not only by prefix: `trig sel` finds *Make a trigger from the selection*, and the letters it matched are highlighted. The commands you last ran from it are listed first under RECENT, followed by what the moment suggests (copy while something is selected, back to @@ -156,6 +164,7 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- The message a client with no worlds shows no longer wraps the status row onto a second row at 80 columns. - A `--snapshot` frame with an MXP picture in cells a server left for it no longer sometimes leaves one of the picture's rows blank. - At 80 columns the status row no longer wraps onto a second row: the encoding and the Ctrl+P hint are diff --git a/CLAUDE.md b/CLAUDE.md index 6ddf5c59..e1e3d74c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -543,6 +543,30 @@ fallbacks) for inline images/maps. leaves, so several auto-connects always land you in the same place, and a black-holed host cannot hold the other worlds' windows hostage. `ConnectAtStartup` is *not* `AutoLogin` — one opens the socket, the other sends the connect line once one is open, and either is useful alone. +- **A client with no worlds opens on a welcome, and the first connect of a new configuration leaves a key tour** + (`WelcomeSurface`, `SharpMUTermApp.Welcome.cs`; `/welcome`, ⌃P ▸ *Welcome* / *Key tour*). The welcome is a + `ListOverlay` over a pure model (the `QuitPrompt` split): *Connect to a host* (a form: host, port 4000, TLS, an + optional character, a password reminder), *Browse games* (`BrowsePackages`, so the index is still fetched only + when asked; with no https `PackageIndexUrl` it says so on the row instead), *Open settings* (F5), the + `/connect` example, and a starting layout. Decisions not to relitigate: + - **The form goes through `ConnectCommand`**, with a `shape` callback that adds the character — so it can do + nothing `/connect` cannot. Esc on the form goes back to the menu; on the menu it closes, leaving + `NoWorldsNotice` (short enough for an 80-column row, and it names `/welcome`), and nothing reopens it that + run. The menu and the form are drawn at **one height in one window**: reopening the overlay to resize it + worked headlessly and left the old window in front under the window host's loop. + - **The layout row's default is *suggested*, which writes nothing**, so `LayoutSuggester` still applies at the + first connect; Roleplay or Combat is written to `WorldDefinition.Layout`. It applies to the first world a + configuration gains however it is added, so a `/connect` typed under the welcome gets it too. + - **`--plain` gets lines, not a modal** (`ClientHost.ScreenIsSeen`, false only there): a modal on a screen + nobody reads would take the reader's typing. The choices are announced as commands, and `/welcome layout + roleplay|combat|suggested` stands in for the arrows. A host with an announcer hears the lines either way. + - **The tour is owed, not "shown"** (`AppConfiguration.KeyTourPending`): set on the way to a save + (`PersistConfiguration` → `NoteFirstWorld`) once a configuration that started the run empty has a world, and + cleared when the tour row is put up on the next `Connected`. A configuration from before the tour has + worlds and never gets it, with no migration; a new player who quits before connecting still gets it next + run. The row is chrome (`AppendWindowLine`), found again by its markup, and hidden or shown by ⌃P ▸ + *Key tour* — not by a link, because the panes' link handler is scheme-tagged server text and a client action + there would be a new trust path. - **The URLs a world prints as plain text are marked up by this client, because the terminal's own detection cannot survive a pane** (`UrlDetector`, Core; F7 ▸ `detect links in output`, default on). Kitty, WezTerm and Ghostty all find URLs in the cells they paint — across the terminal **row**. A pane @@ -1177,8 +1201,10 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg applied over the demo's game data and recorded streets: the map beside the output with Chat as a tab under it, and no pane for the panels nothing draws yet), `panel-who`/`panel-vitals`/`panel-quickbar`/`panel-composer` (each panel in a pane of its own over the demo's game data; the composer over who-here, armed, with a draft - typed through its real key path), plus the - default workspace + typed through its real key path), `welcome`/`welcome-connect` (the first-run welcome over an **emptied** + configuration and a main window alone — `--demo-config` has worlds, and the welcome never opens over them — and + its connect form filled in by real keys) and `tour` (the key tour row at the end of the demo's main window), plus + the default workspace (no `--view`). Any settings screen also takes a `-edit` suffix, which opens it and drives real keys in so the frame shows a field mid-edit. State toggles: `collapsed`, `prefix`, `timestamps`, and `timestamps-toggled` — the same column reached the *other* way, by dispatching the real ⌃P entry diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 4d55e597..72178d12 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -55,5 +55,6 @@ internal static class WindowHost // A live region a screen reader watches; the terminal has none, and --plain is its answer. Announcer = driver.Announcer, + ScreenIsSeen = true, }; } diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index ea1aede6..e3f97a0c 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -154,6 +154,12 @@ void Family(string id, string prefix, Func c.State.TimestampsOn); Add("term:timestamps-on", CommandGroup.Terminal, "Show timestamps", when: c => !c.State.TimestampsOn); Add("term:input2-off", CommandGroup.Terminal, "Hide second input", "⌃B i", "this window", diff --git a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs index d1e05953..a46258ba 100644 --- a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs +++ b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs @@ -113,6 +113,15 @@ public sealed class AppConfiguration /// The ids of installed packages the player has switched off; their sets apply to nobody. public List DisabledPackages { get; set; } = new(); + /// + /// The short key tour is owed: set when a configuration that started a run with no worlds gains its first + /// one, and cleared once the tour has been shown after a connect. A pending flag rather than a "shown" one, + /// so a configuration from before the tour existed (every one that already has worlds) never gets it and + /// needs no migration; and it survives a restart, so a new player who adds a world and quits before it + /// connects still gets the tour on the connect that follows. + /// + public bool KeyTourPending { get; set; } + /// The package index Browse packages reads: an https link to an index.json. public string PackageIndexUrl { get; set; } = DefaultPackageIndexUrl; diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 0aef6403..be14b3b5 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -83,6 +83,14 @@ internal sealed record ClientHost /// public required IAnnouncer? Announcer { get; init; } + /// + /// Whether anybody looks at the cells. False for --plain, whose screen is a headless buffer nobody + /// reads: a surface the client would open as a modal there (the first-run welcome) is said as lines through + /// and worked by typed commands instead, because a modal there would take the keys + /// the reader types and show them nothing. + /// + public required bool ScreenIsSeen { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -119,6 +127,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Audio = () => DesktopAudio.TryCreate(), Presence = () => new DiscordIpc(), Announcer = null, + ScreenIsSeen = true, }; /// @@ -140,6 +149,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Audio = null, Presence = null, Announcer = null, + ScreenIsSeen = true, }; /// diff --git a/src/SharpMUTerm.Tui/Hosting/PlainHost.cs b/src/SharpMUTerm.Tui/Hosting/PlainHost.cs index 93246992..1917ce7d 100644 --- a/src/SharpMUTerm.Tui/Hosting/PlainHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/PlainHost.cs @@ -29,6 +29,7 @@ public static ClientHost Create(TerminalCapabilities capabilities, TextWriter ou Audio = () => DesktopAudio.TryCreate(), Presence = () => new DiscordIpc(), Announcer = new PlainAnnouncer(output), + ScreenIsSeen = false, }; } diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index a8a70f3f..c951215a 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -18,6 +18,7 @@ internal sealed class ListOverlay private MarkupControl? _content; private Func>? _render; private Func? _key; + private Func? _escape; private readonly ScreenTheme _scheme; @@ -37,9 +38,16 @@ public ListOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) /// /// Opens a surface. draws it at a width; answers a key - /// and returns whether the surface stays open. + /// and returns whether the surface stays open. , when given, is asked first about + /// Esc and keeps the surface open by returning true — a surface with a step to go back from. /// - public void Open(string mode, string title, Func> render, Func key, int? width = null) + public void Open( + string mode, + string title, + Func> render, + Func key, + int? width = null, + Func? escape = null) { if (_window is not null) { @@ -48,6 +56,7 @@ public void Open(string mode, string title, Func> render, Func _render = render; _key = key; + _escape = escape; var desktop = _system.DesktopDimensions; var widest = Math.Clamp(desktop.Width - 8, 44, 110); var outer = width is { } asked ? Math.Clamp(asked + 4, 24, widest) : widest; @@ -119,6 +128,16 @@ private void OnKey(object? sender, KeyPressedEventArgs e) // A key can start a fetch whose answer opens the next surface (browse, then a review). Only the // surface the key was pressed on is closed, so that answer is never closed with it. var window = _window; + if (e.KeyInfo.Key == ConsoleKey.Escape && _escape?.Invoke() == true) + { + if (_window == window) + { + Repaint(); + } + + return; + } + if (e.KeyInfo.Key == ConsoleKey.Escape || !_key(e.KeyInfo)) { if (_window == window) @@ -138,6 +157,7 @@ private void Reset() _content = null; _render = null; _key = null; + _escape = null; Mode = null; } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs index cefe5bd8..445c76a2 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs @@ -19,7 +19,11 @@ internal sealed partial class SharpMUTermApp /// What /connect with nothing after it says. internal const string ConnectUsage = "/connect , or /connect [port] [tls] to add one"; - private void ConnectCommand(string windowId, string arguments) + /// + /// Finishes a world this adds before it is saved — the welcome's form adds the character it named. Not + /// called when the words name a world that already exists. + /// + private void ConnectCommand(string windowId, string arguments, Action? shape = null) { var words = arguments.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var tls = words.Any(IsTlsWord); @@ -54,6 +58,15 @@ private void ConnectCommand(string windowId, string arguments) Port = endpoint.Port, UseTls = tls, }; + + // A configuration's first world takes the layout the welcome was left at, whether it came from + // the welcome's form or from a /connect typed under it. + if (_config.Worlds.Count == 0) + { + ApplyWelcomeLayout(world); + } + + shape?.Invoke(world); _config.Worlds.Add(world); SaveConfiguration(); Notice($"added {world.Name} ({world.Host}:{world.Port}) — F5 edits it", MessageSeverity.Info, "F5"); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs new file mode 100644 index 00000000..f1ffa912 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs @@ -0,0 +1,351 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Session; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// The first run: a welcome when the configuration has no worlds, and a short key tour after the first +/// connect. The welcome is a over where somebody sees +/// the screen, and the same choices said as lines where nobody does (--plain, +/// ). Its connect form goes through , so it +/// can do nothing /connect cannot. +/// +internal sealed partial class SharpMUTermApp +{ + private readonly ListOverlay _welcomeView; + + /// The welcome's state while it is open, and what it was left at when it closed. + private WelcomeSurface? _welcome; + + /// + /// The starting layout the welcome was left at, for the run. Applied to the first world a configuration + /// gains, however it is added — the form, or /connect typed under the welcome. + /// + private WelcomeLayout _welcomeLayout = WelcomeLayout.Suggested; + + /// Whether the configuration had no worlds when this app was made: the one state the tour is owed in. + private readonly bool _startedEmpty; + + /// Sessions whose player asked, on the welcome's form, to be reminded to save a password. + private readonly HashSet _passwordLater = new(StringComparer.Ordinal); + + /// The words the key tour row starts with, so it can be found in a buffer again. + internal const string KeyTourLead = "Keys:"; + + /// The window holding the tour row, or null when none does. + private string? _tourWindow; + + /// Whether the welcome surface is up, for the tests. + internal bool WelcomeIsOpen => _welcomeView.IsOpen; + + /// What the welcome shows now, for the tests. + internal IReadOnlyList WelcomeLines => _welcomeView.Lines; + + /// The welcome's model, for a test that reads the form it drove. + internal WelcomeSurface? Welcome => _welcome; + + /// Feeds a key to the welcome surface the way the window's own handler would. + internal void SimulateWelcomeKey(ConsoleKeyInfo key) => _welcomeView.SimulateKey(key); + + /// Why the package index cannot be browsed, or null when it can be asked for. + private string? PackageIndexProblem() => + Uri.TryCreate(_config.PackageIndexUrl, UriKind.Absolute, out var uri) && uri.Scheme == Uri.UriSchemeHttps + ? null + : string.IsNullOrWhiteSpace(_config.PackageIndexUrl) + ? "no package index is set (packageIndexUrl in config.json)" + : "the package index is not an https link (packageIndexUrl in config.json)"; + + /// + /// Shows the welcome: the surface where the screen is seen, the lines where it is not. Opened at start on + /// an empty configuration and by /welcome or ⌃P ▸ Welcome; never again on its own once closed. + /// + internal void ShowWelcome() + { + var problem = PackageIndexProblem(); + if (Host.Announcer is { } announcer) + { + foreach (var line in WelcomeSurface.PlainLines(_welcomeLayout, problem)) + { + announcer.Announce(line, Core.Accessibility.AnnouncementKind.Notice); + } + } + + if (!Host.ScreenIsSeen) + { + return; + } + + // Already up: left as it is, form and all. Asking again (a second /welcome, or the startup pass a live + // loop runs after a scene was laid out) must not throw away what the player has typed. + if (_welcomeView.IsOpen && _welcome is not null) + { + return; + } + + if (ComposerIsInTheWay("the welcome") || (AnyOverlayOpen && !_welcomeView.IsOpen && Refuse($"close {OpenOverlayName()} first"))) + { + return; + } + + _welcome = new WelcomeSurface(problem) { Layout = _welcomeLayout }; + OpenWelcomeView(); + } + + private void OpenWelcomeView() + { + var welcome = _welcome!; + _welcomeView.Open( + "welcome", + "Welcome", + welcome.Render, + key => WelcomeKey(welcome, key), + WelcomeSurface.PreferredWidth, + escape: () => + { + return welcome.Back(); + }); + } + + private bool WelcomeKey(WelcomeSurface welcome, ConsoleKeyInfo key) + { + var action = welcome.Interpret(key, words => ParseEndpoint(words)); + _welcomeLayout = welcome.Layout; + switch (action) + { + case WelcomeAction.Browse: + _welcomeView.Close(); + BrowsePackages(); + return false; + + case WelcomeAction.Settings: + _welcomeView.Close(); + if (!ComposerIsInTheWay("a settings screen")) + { + _settings.Toggle(ConsoleKey.F5, WorldsScreen); + } + + return false; + + case WelcomeAction.Connect when welcome.Request is { } request: + _welcomeView.Close(); + ConnectFromWelcome(request); + return false; + + default: + return true; + } + } + + /// The form's answer, through /connect's own path, with the character the form named. + private void ConnectFromWelcome(WelcomeConnect request) + { + var host = request.Host.Contains(':') ? $"[{request.Host}]" : request.Host; + var arguments = $"{host} {request.Port}" + (request.Tls ? " tls" : string.Empty); + ConnectCommand(ActiveWindowId(), arguments, world => + { + ApplyWelcomeLayout(world); + if (request.Character is { } name) + { + world.Characters.Add(new CharacterDefinition { Name = name }); + if (request.PasswordLater) + { + _passwordLater.Add($"{world.Name}.{name}"); + } + } + }); + } + + /// /welcome, and /welcome layout roleplay|combat|suggested for a reader with no arrows to press. + private void WelcomeCommand(string arguments) + { + var words = arguments.Split(' ', StringSplitOptions.RemoveEmptyEntries); + if (words.Length == 0) + { + ShowWelcome(); + return; + } + + if (words.Length == 2 && words[0].Equals("layout", StringComparison.OrdinalIgnoreCase) + && WelcomeSurface.ParseLayout(words[1]) is { } layout) + { + _welcomeLayout = layout; + if (_welcome is not null) + { + _welcome.Layout = layout; + } + + Notice( + layout == WelcomeLayout.Suggested + ? "starting layout: suggested from what the game sends" + : $"starting layout: {layout}", + MessageSeverity.Info); + return; + } + + RefuseCommand("/welcome, or /welcome layout roleplay, combat or suggested"); + } + + /// + /// What a world the welcome adds starts with: the welcome's layout, when the player chose one. Left alone, + /// nothing is set and the client's suggestion applies at the first connect. + /// + private void ApplyWelcomeLayout(WorldDefinition world) + { + if (WelcomeSurface.LayoutIdOf(_welcomeLayout) is { } layout) + { + world.Layout = layout; + } + } + + /// + /// Marks the tour owed once a configuration that started this run empty has a world. Called on the way to + /// every save, so a world added by the welcome, by /connect or on F5 all count. + /// + private void NoteFirstWorld() + { + if (_startedEmpty && !_tourOwedNoted && _config.Worlds.Count > 0) + { + _tourOwedNoted = true; + _config.KeyTourPending = true; + } + } + + private bool _tourOwedNoted; + + /// The first connect of a new configuration: the key tour, and a reminder the form asked for. + private void OnFirstRunConnected(WorldSession session, string windowId) + { + if (_config.KeyTourPending) + { + _config.KeyTourPending = false; + ShowKeyTour(windowId); + PersistConfiguration(); + } + + if (_passwordLater.Remove(session.SessionKey)) + { + Notice( + $"to log in by itself next time, save {Snippet(session.Character?.Name ?? session.World.Name)}'s password on F5", + MessageSeverity.Info, + "F5"); + } + } + + /// The tour row: one line naming four keys, chrome in the window, never the session's text. + internal string KeyTourMarkup() + { + string Key(string key) => $"[bold {_ink.Accent}]{Escape(key)}[/]"; + string Say(string text) => $"[{_ink.Notice}]{Escape(text)}[/]"; + return Say(KeyTourLead + " ") + + Key("⌃P") + Say(" every command · ") + + Key("⌥M") + Say(" layouts · ") + + Key("F1") + Say(" long posts · ") + + Key("F5") + Say(" worlds · ") + + Say("hide with ⌃P ▸ Key tour"); + } + + /// Puts the tour row at the end of , or moves it there. + internal void ShowKeyTour(string windowId) + { + HideKeyTour(); + AppendWindowLine(windowId, KeyTourMarkup()); + _tourWindow = windowId; + } + + /// Takes the tour row away. False when there was none. + private bool HideKeyTour() + { + if (_tourWindow is not { } windowId) + { + return false; + } + + _tourWindow = null; + if (_lines.TryGetValue(windowId, out var buffer)) + { + var markup = KeyTourMarkup(); + var at = buffer.FindLastIndex(line => string.Equals(line.Markup, markup, StringComparison.Ordinal)); + if (at >= 0) + { + RemoveChromeRow(windowId, at); + RepaintPane(windowId); + return true; + } + } + + return false; + } + + /// ⌃P ▸ Key tour: shows the row in the focused window, or hides it when it is up. + private void ToggleKeyTour() + { + if (!HideKeyTour()) + { + ShowKeyTour(ActiveWindowId()); + } + } + + /// The snapshot views that start with this: welcome and welcome-connect. + internal const string WelcomeView = "welcome"; + + /// + /// The welcome as a first run meets it: the configuration emptied, the startup path run with nothing to + /// connect (which raises the notice and opens the surface), and for welcome-connect the form + /// filled in by real keys — ⏎ on the first choice, a host, a port over the default, TLS on, a name. + /// + private string RenderWelcomeSnapshot(string view) + { + // And the workspace a first run has: the main window alone, owned by nobody. --demo-config resumes a + // saved workspace with a character's windows in it, which an empty configuration could never have. + _config.Worlds.Clear(); + foreach (var window in _workspace.Windows.Select(w => w.Id).Where(id => id != MainWindowId).ToList()) + { + _workspace.CloseWindow(window); + } + + if (_workspace.FindWindow(MainWindowId) is { } main) + { + main.Title = "Main"; + _workspace.SetWindowOwner(MainWindowId, null); + } + + RebuildPaneArea(); + RefreshHeader(); + RefreshRail(); + UpdateStatus(); + LastCommand = StartAsync([]); + + if (string.Equals(view, WelcomeView + "-connect", StringComparison.OrdinalIgnoreCase)) + { + SimulateWelcomeKey(Stroke('\r', ConsoleKey.Enter)); + Type("mud.example.org"); + SimulateWelcomeKey(Stroke('\0', ConsoleKey.DownArrow)); + for (var i = 0; i < 4; i++) + { + SimulateWelcomeKey(Stroke('\b', ConsoleKey.Backspace)); + } + + Type("4201"); + SimulateWelcomeKey(Stroke('\0', ConsoleKey.DownArrow)); + SimulateWelcomeKey(Stroke(' ', ConsoleKey.Spacebar)); + SimulateWelcomeKey(Stroke('\0', ConsoleKey.DownArrow)); + Type("Corvid"); + } + + SyncInputWidth(); + return RenderFrame(); + + void Type(string text) + { + foreach (var c in text) + { + SimulateWelcomeKey(Stroke(c, ConsoleKey.NoName)); + } + } + } + + /// Whether a tour row is on screen, for the tests. + internal bool KeyTourShown => _tourWindow is not null; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index f34afcb9..ff3281e3 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -731,6 +731,7 @@ public SharpMUTermApp( var capabilities = host.Capabilities; Host = host; _config = config; + _startedEmpty = config.Worlds.Count == 0; _save = save; _openUrl = host.OpenUrl; _clipboard = host.Clipboard; @@ -921,6 +922,7 @@ public SharpMUTermApp( _packageView = new ListOverlay(_system, _screens); _sendMenu = new ListOverlay(_system, _screens); _layoutsView = new ListOverlay(_system, _screens); + _welcomeView = new ListOverlay(_system, _screens); _composer.Send += (_, result) => SendComposed(result); _composer.Closed += (_, result) => KeepComposeDraft(result); _quit = new QuitOverlay(_system, QuitFactsNow, Quit); @@ -1111,10 +1113,25 @@ public string RenderSnapshot(string? view = null) // one of them would count as missed, so any frame that later made such a window visible (a split, // a tab change) would carry an activity bar reporting the client's own setup as news. Same // reasoning as `_watching` itself, which the restore replay needs for the same shape of reason. + // The first-run welcome is what a client with *no* worlds opens on, so it is drawn over an empty + // configuration whatever the caller loaded — --demo-config has worlds, and the welcome never opens + // over them. + if (view is not null && view.StartsWith(WelcomeView, StringComparison.OrdinalIgnoreCase)) + { + return RenderWelcomeSnapshot(view); + } + _watching = false; LoadDemoScene(); _watching = true; + // The key tour row, as the first connect of a new configuration leaves it at the end of the window. + if (string.Equals(view, "tour", StringComparison.OrdinalIgnoreCase)) + { + ShowKeyTour(MainWindowId); + SettleScroll(); + } + // The reported bug, as a frame: the scene is already on screen with the column off, and *then* // the real ⌃P entry is dispatched. Under the old append-time gutter this frame was identical to // the default workspace — which is exactly what "the button seems to not do anything" was. @@ -2582,6 +2599,14 @@ internal async Task StartAsync(IReadOnlyList startup) Notice( empty ? NoWorldsNotice : NothingAtStartNotice, empty ? MessageSeverity.Warning : MessageSeverity.Info); + + // And the first run gets somewhere to start from: the welcome, over the notice it leaves behind + // when it is closed. + if (empty) + { + ShowWelcome(); + } + return; } @@ -2607,9 +2632,13 @@ internal async Task StartAsync(IReadOnlyList startup) await Task.WhenAll(opened.Select(o => DialAtStartupAsync(o.Session))).ConfigureAwait(false); } - /// The empty-workspace message when there is nothing to connect because there is nothing at all. + /// + /// The empty-workspace message when there is nothing to connect because there is nothing at all. It is what + /// the welcome leaves behind when it is closed, so it names the welcome's way back as well as the two ways + /// in; and it is short enough for an 80-column status row, which a longer one wrapped onto a second row. + /// internal const string NoWorldsNotice = - "No world configured. Type /connect , pass one on the command line, or add one on F5."; + "No world configured · /connect · F5 adds one · /welcome"; /// /// And when there are worlds but none of their characters is marked. It is the ordinary state of a @@ -2918,6 +2947,7 @@ private void BindSession(WorldSession session, string? windowId = null) // report beside a connection time that is already here. _mssp.RecordConnection(session.World.Host, session.World.Port, _time.GetUtcNow()); ScheduleLayoutSuggestion(session); + OnFirstRunConnected(session, windowId); } UpdateStatus(); @@ -4821,6 +4851,14 @@ private void OnCommandEntered(InputBar bar, string command) return; } + // `/welcome` shows the first-run welcome again; `/welcome layout …` picks its starting layout. + if (command.StartsWith("/welcome", StringComparison.OrdinalIgnoreCase) + && (command.Length == 8 || command[8] == ' ')) + { + WelcomeCommand(command[8..].Trim()); + return; + } + // `/package` opens the Packages screen; `/package install …` reads one for review. if (command.StartsWith("/package", StringComparison.OrdinalIgnoreCase) && (command.Length == 8 || command[8] == ' ')) @@ -5252,7 +5290,7 @@ private void ToggleHistorySearch() private bool AnyOverlayOpen => _palette.IsOpen || _settings.IsOpen || _quit.IsOpen || _messageLog.IsOpen || _historySearch.IsOpen || _prefixPanel.IsOpen || _composer.IsOpen || _search.IsOpen || _gameData.IsOpen || _packageView.IsOpen || _sendMenu.IsOpen - || _layoutsView.IsOpen; + || _layoutsView.IsOpen || _welcomeView.IsOpen; /// /// Opens the ⌃F search surface, or closes it when the chord arrives again. @@ -5371,6 +5409,7 @@ private string OpenOverlayName() => : _historySearch.IsOpen ? "the history search" : _search.IsOpen ? "the search surface" : _prefixPanel.IsOpen ? "the pane keys panel" + : _welcomeView.IsOpen ? "the welcome" : "what is open"; /// Whether either bar is holding unsent text — what the ✎ tab marker means. @@ -7106,6 +7145,7 @@ internal void SaveConfiguration() /// private void PersistConfiguration() { + NoteFirstWorld(); if (_save is null) { return; @@ -8404,6 +8444,12 @@ private bool RunBuiltInCommand(string id) case "term:package-browse": BrowsePackages(); return true; + case "term:welcome": + ShowWelcome(); + return true; + case "term:tour": + ToggleKeyTour(); + return true; case "term:package-install": ActiveBar().SetAndNotify("/package install "); return true; diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index fb5474d4..d95687d1 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -27,5 +27,6 @@ internal static class SnapshotViews "collapsed", "timestamps", "timestamps-toggled", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", + "welcome", "welcome-connect", "tour", ]; } diff --git a/src/SharpMUTerm.Tui/WelcomeSurface.cs b/src/SharpMUTerm.Tui/WelcomeSurface.cs new file mode 100644 index 00000000..5a735d9d --- /dev/null +++ b/src/SharpMUTerm.Tui/WelcomeSurface.cs @@ -0,0 +1,447 @@ +using SharpMUTerm.Core.Layouts; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// What the welcome's menu offers, in the order it lists them. +internal enum WelcomeChoice +{ + /// The small form: host, port, TLS, a character name. + Connect, + + /// The package index browser, fetched only now. + Browse, + + /// F5, to add a world by hand. + Settings, +} + +/// +/// The starting layout a first world is given. sets nothing, so the client's own +/// suggestion () still applies when it first connects; the other two are the +/// player's choice outright and are written to WorldDefinition.Layout. +/// +internal enum WelcomeLayout +{ + Suggested, + Roleplay, + Combat, +} + +/// The connect form's rows, top to bottom. +internal enum WelcomeField +{ + Host, + Port, + Tls, + Character, + Password, +} + +/// What a key on the welcome asks the app to do. +internal enum WelcomeAction +{ + /// Nothing beyond a repaint. + Redraw, + + /// Dial . + Connect, + + /// Close, and open the package index. + Browse, + + /// Close, and open F5. + Settings, +} + +/// What the connect form asks for, read once ⏎ has checked it. +internal sealed record WelcomeConnect(string Host, int Port, bool Tls, string? Character, bool PasswordLater); + +/// +/// The first-run welcome: what it says and what a key on it means, with no window in it — the +/// split, so a test reads it without a terminal. hosts it +/// in a , and is the same surface said as lines for +/// --plain, where nothing reads the cells. +/// +/// The form goes nowhere the command line cannot: ⏎ hands back a and the app runs +/// it through /connect's own path, so a world the welcome adds is the world /connect host port +/// would have added, character and layout aside. +/// +/// +internal sealed class WelcomeSurface +{ + /// The example the surface names, a host nobody owns (RFC 2606). + internal const string ExampleCommand = "/connect mud.example.org 4201 tls"; + + /// The width the surface asks for; the overlay narrows it on a small terminal. + internal const int PreferredWidth = 66; + + /// The longest host the form takes: a DNS name's limit. + private const int MaxHost = 253; + + /// A character name long enough for any game's. + private const int MaxCharacter = 40; + + private readonly string? _indexProblem; + + /// Why the package index cannot be browsed, or null when it can be asked for. + public WelcomeSurface(string? indexProblem) => _indexProblem = indexProblem; + + public WelcomeChoice Selected { get; private set; } = WelcomeChoice.Connect; + + public WelcomeLayout Layout { get; set; } = WelcomeLayout.Suggested; + + /// Whether the connect form is showing rather than the menu. + public bool InForm { get; private set; } + + public WelcomeField Field { get; private set; } = WelcomeField.Host; + + public string Host { get; private set; } = string.Empty; + + public string Port { get; private set; } = SharpMUTermApp.DefaultConnectPort.ToString(System.Globalization.CultureInfo.InvariantCulture); + + public bool Tls { get; private set; } + + public string Character { get; private set; } = string.Empty; + + public bool PasswordLater { get; private set; } + + /// What the surface says about the last thing it refused, shown in place; null when nothing. + public string? Problem { get; private set; } + + /// The checked form, once ⏎ has accepted it. + public WelcomeConnect? Request { get; private set; } + + /// The built-in layout id names, or null for the suggestion. + public string? LayoutId => LayoutIdOf(Layout); + + internal static string? LayoutIdOf(WelcomeLayout layout) => layout switch + { + WelcomeLayout.Roleplay => BuiltInLayouts.RoleplayId, + WelcomeLayout.Combat => BuiltInLayouts.CombatId, + _ => null, + }; + + /// Reads a layout word as /welcome layout takes it. + internal static WelcomeLayout? ParseLayout(string word) => word.Trim().ToLowerInvariant() switch + { + "suggested" or "suggest" or "auto" => WelcomeLayout.Suggested, + "roleplay" or "rp" => WelcomeLayout.Roleplay, + "combat" => WelcomeLayout.Combat, + _ => null, + }; + + /// Back to the menu, as it opens — for /welcome reopening a surface that was left in the form. + public void ShowMenu() + { + InForm = false; + Problem = null; + } + + /// Esc: the form goes back to the menu and stays open; on the menu Esc closes, which is the overlay's. + /// Whether Esc was taken here. + public bool Back() + { + if (!InForm) + { + return false; + } + + ShowMenu(); + return true; + } + + /// What a key does. reads a host and port the way /connect does. + public WelcomeAction Interpret(ConsoleKeyInfo key, Func, (string Host, int Port)?> parse) + { + ArgumentNullException.ThrowIfNull(parse); + return InForm ? FormKey(key, parse) : MenuKey(key); + } + + private WelcomeAction MenuKey(ConsoleKeyInfo key) + { + switch (key.Key) + { + case ConsoleKey.UpArrow: + Selected = (WelcomeChoice)Math.Max(0, (int)Selected - 1); + Problem = null; + return WelcomeAction.Redraw; + case ConsoleKey.DownArrow: + Selected = (WelcomeChoice)Math.Min((int)WelcomeChoice.Settings, (int)Selected + 1); + Problem = null; + return WelcomeAction.Redraw; + case ConsoleKey.LeftArrow: + Layout = (WelcomeLayout)(((int)Layout + 2) % 3); + return WelcomeAction.Redraw; + case ConsoleKey.RightArrow: + Layout = (WelcomeLayout)(((int)Layout + 1) % 3); + return WelcomeAction.Redraw; + case ConsoleKey.Enter: + switch (Selected) + { + case WelcomeChoice.Connect: + InForm = true; + Field = WelcomeField.Host; + Problem = null; + return WelcomeAction.Redraw; + case WelcomeChoice.Browse when _indexProblem is not null: + Problem = _indexProblem; + return WelcomeAction.Redraw; + case WelcomeChoice.Browse: + return WelcomeAction.Browse; + default: + return WelcomeAction.Settings; + } + + default: + return WelcomeAction.Redraw; + } + } + + private WelcomeAction FormKey(ConsoleKeyInfo key, Func, (string Host, int Port)?> parse) + { + var shift = (key.Modifiers & ConsoleModifiers.Shift) != 0; + switch (key.Key) + { + case ConsoleKey.UpArrow: + case ConsoleKey.Tab when shift: + Field = (WelcomeField)Math.Max(0, (int)Field - 1); + return WelcomeAction.Redraw; + case ConsoleKey.DownArrow: + case ConsoleKey.Tab: + Field = (WelcomeField)Math.Min((int)WelcomeField.Password, (int)Field + 1); + return WelcomeAction.Redraw; + case ConsoleKey.Enter: + return Submit(parse); + case ConsoleKey.Backspace: + Edit(text => text.Length == 0 ? text : text[..^1]); + return WelcomeAction.Redraw; + case ConsoleKey.Spacebar when Field is WelcomeField.Tls or WelcomeField.Password: + case ConsoleKey.LeftArrow when Field is WelcomeField.Tls or WelcomeField.Password: + case ConsoleKey.RightArrow when Field is WelcomeField.Tls or WelcomeField.Password: + if (Field == WelcomeField.Tls) + { + Tls = !Tls; + } + else + { + PasswordLater = !PasswordLater; + } + + return WelcomeAction.Redraw; + } + + // Typing, with the modifiers a printable key can carry and no others: a chord is not text. + var c = key.KeyChar; + if (char.IsControl(c) || (key.Modifiers & (ConsoleModifiers.Control | ConsoleModifiers.Alt)) != 0) + { + return WelcomeAction.Redraw; + } + + switch (Field) + { + case WelcomeField.Host when !char.IsWhiteSpace(c) && Host.Length < MaxHost: + Host += c; + break; + case WelcomeField.Port when char.IsAsciiDigit(c) && Port.Length < 5: + Port += c; + break; + case WelcomeField.Character when Character.Length < MaxCharacter && !(c == ' ' && Character.Length == 0): + Character += c; + break; + } + + Problem = null; + return WelcomeAction.Redraw; + } + + private void Edit(Func change) + { + switch (Field) + { + case WelcomeField.Host: + Host = change(Host); + break; + case WelcomeField.Port: + Port = change(Port); + break; + case WelcomeField.Character: + Character = change(Character); + break; + } + + Problem = null; + } + + private WelcomeAction Submit(Func, (string Host, int Port)?> parse) + { + if (Host.Length == 0) + { + Field = WelcomeField.Host; + Problem = "type the game's host first, for example mud.example.org"; + return WelcomeAction.Redraw; + } + + if (parse(Port.Length == 0 ? [Host] : [Host, Port]) is not { } endpoint) + { + Problem = Port.Length > 0 && !(int.TryParse(Port, out var port) && port is > 0 and <= 65535) + ? "the port is a number from 1 to 65535" + : "that is not a host name or address"; + Field = Problem.StartsWith("the port", StringComparison.Ordinal) ? WelcomeField.Port : WelcomeField.Host; + return WelcomeAction.Redraw; + } + + var character = Character.Trim(); + Request = new WelcomeConnect(endpoint.Host, endpoint.Port, Tls, character.Length == 0 ? null : character, PasswordLater); + return WelcomeAction.Connect; + } + + // ---- What it says --------------------------------------------------------------------------- + + private static string Accent(string text) => $"[bold {ScreenPalette.Accent}]{Escape(text)}[/]"; + + private static string Label(string text) => $"[{ScreenPalette.Label}]{Escape(text)}[/]"; + + private static string Value(string text, bool bold = false) => + $"[{(bold ? "bold " : string.Empty)}{ScreenPalette.Value}]{Escape(text)}[/]"; + + private static string Pad(string markup, int width) => + markup + new string(' ', Math.Max(0, width - VisibleLength(markup))); + + /// + /// The surface at a width: the menu, or the form. Both are the same number of lines, so the one window holds + /// either — the form's footer sits where the menu's does, and nothing has to be closed and reopened to switch, + /// which a window running its own loop does not do in the order a headless one does. + /// + public List Render(int width) + { + if (!InForm) + { + return RenderMenu(width); + } + + var form = RenderForm(width); + var footer = form[^1]; + form.RemoveAt(form.Count - 1); + var height = RenderMenu(width).Count; + while (form.Count < height - 1) + { + form.Add(string.Empty); + } + + form.Add(footer); + return form; + } + + private List RenderMenu(int width) + { + var lines = new List + { + Accent("Welcome to SharpMUTerm"), + Label("No games yet. Pick one of these to start."), + string.Empty, + }; + + foreach (var choice in Enum.GetValues()) + { + var selected = choice == Selected; + var (title, detail) = choice switch + { + WelcomeChoice.Connect => ("Connect to a host", "type a host and port"), + WelcomeChoice.Browse => ("Browse games", _indexProblem is null ? "from the package index" : "no package index set"), + _ => ("Open settings", "F5, add a world by hand"), + }; + var marker = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; + lines.Add($"{marker} {Pad(Value(title, selected), 20)} {Label(detail)}"); + } + + lines.Add(Problem is null ? string.Empty : $" [{ScreenPalette.Caution}]{Escape(Problem)}[/]"); + lines.Add(Label("Or type it on the command line below:")); + lines.Add(" " + Value(ExampleCommand)); + lines.Add(string.Empty); + lines.Add(Label(Layout == WelcomeLayout.Suggested + ? "Starting layout, picked from what the game sends:" + : "Starting layout, whatever the game sends:")); + var chips = string.Join(" ", Enum.GetValues().Select(layout => + { + var name = layout == WelcomeLayout.Suggested ? "suggested" : layout.ToString(); + return layout == Layout + ? $"[bold {ScreenPalette.Ink} on {ScreenPalette.Accent}] {Escape(name)} [/]" + : $"[{ScreenPalette.Value}] {Escape(name)} [/]"; + })); + lines.Add(" " + chips); + lines.Add(" " + Label("saved per world · ⌥M changes it later")); + lines.Add(string.Empty); + lines.Add(Footer(width, "↑↓ select · ←→ layout", "Esc close · ⏎ choose")); + return lines; + } + + private List RenderForm(int width) + { + var lines = new List + { + Accent("Connect to a host"), + Label("Saved as a world, so you can come back to it."), + string.Empty, + }; + + var boxWidth = Math.Clamp(width - 16, 12, 44); + lines.Add(Row(WelcomeField.Host, "host", Box(Host, boxWidth, Field == WelcomeField.Host, "mud.example.org"))); + lines.Add(Row(WelcomeField.Port, "port", Box(Port, 7, Field == WelcomeField.Port, null))); + lines.Add(Row(WelcomeField.Tls, "TLS", Toggle(Tls, "on, encrypted", "off"))); + lines.Add(Row(WelcomeField.Character, "character", Box(Character, boxWidth, Field == WelcomeField.Character, "optional, the name you log in as"))); + lines.Add(Row(WelcomeField.Password, "password", Toggle(PasswordLater, "save it on F5 after connecting", "type it at the login prompt"))); + lines.Add(string.Empty); + lines.Add(Problem is null + ? Label(Layout == WelcomeLayout.Suggested + ? "Layout: suggested from what the game sends." + : $"Layout: {Layout}.") + : $"[{ScreenPalette.Caution}]{Escape(Problem)}[/]"); + lines.Add(string.Empty); + lines.Add(Footer(width, "↑↓ field · Space toggle", "Esc back · ⏎ connect")); + return lines; + } + + private string Row(WelcomeField field, string label, string value) + { + var selected = Field == field; + var marker = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; + return $"{marker} {Pad(selected ? Value(label, bold: true) : Label(label), 11)} {value}"; + } + + private static string Box(string text, int width, bool editing, string? placeholder) + { + var shown = text.Length > width - 1 ? "…" + text[^(width - 2)..] : text; + var body = shown.Length == 0 && !editing && placeholder is not null + ? $"[{ScreenPalette.Muted} on {ScreenPalette.FieldBg}]{Escape(placeholder.Length > width ? placeholder[..width] : placeholder)}[/]" + : $"[{ScreenPalette.Value} on {ScreenPalette.FieldBg}]{Escape(shown)}[/]"; + var caret = editing ? $"[{ScreenPalette.Ink} on {ScreenPalette.Accent}] [/]" : string.Empty; + var used = VisibleLength(body) + (editing ? 1 : 0); + return body + caret + $"[on {ScreenPalette.FieldBg}]{new string(' ', Math.Max(0, width - used))}[/]"; + } + + private static string Toggle(bool on, string yes, string no) => + on ? $"[{ScreenPalette.Accent}]●[/] {Value(yes)}" : $"[{ScreenPalette.Label}]○[/] {Value(no)}"; + + private static string Footer(int width, string left, string right) + { + var gap = Math.Max(2, width - left.Length - right.Length); + return Label(left) + new string(' ', gap) + Label(right); + } + + /// + /// The welcome said as lines, for --plain: every choice is a command a reader can type, because + /// there is no menu to arrow through. + /// + public static IReadOnlyList PlainLines(WelcomeLayout layout, string? indexProblem) => + [ + "Welcome to SharpMUTerm. No games yet.", + "To connect, type /connect, a host and a port, and tls for an encrypted connection: " + ExampleCommand, + indexProblem is null + ? "To browse games from the package index, type /package browse" + : "Browsing games is not available: " + indexProblem, + "Starting layout: " + (layout == WelcomeLayout.Suggested ? "suggested from what the game sends" : layout.ToString()) + + ". Type /welcome layout roleplay, combat or suggested to change it.", + "Type /welcome to hear this again.", + ]; +} diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index 4cb736ea..b645d840 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -48,6 +48,10 @@ public class FrameContrastTests // most to lose from a theme it was not measured against. "selection", "input-selection", "menu-fuzzy", "menu-recent", + // The first run: the welcome over an empty client, its connect form mid-entry (a field on FieldBg, the + // caret, the toggles), and the key tour row on a pane. + "welcome", "welcome-connect", "tour", + // The four panels: who is here and the quick bar carry the accent on links, the vitals strip paints bars // and the warning in a server-driven colour, and the docked composer is an editor on its own plane. "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", diff --git a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs index 44b8800e..a51e0710 100644 --- a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs @@ -44,7 +44,7 @@ public class SnapshotViewEmptyConfigTests "connections", "characters", "tint", "tint-input", "tint-input-moved", "compose", "compose-literal", "deletions", "textansi", "input", "keypad", "password", "startup", "logging", "set", "triggers", "route", "highlight", "worlds", "settings", "mssp", - "mssp-none", "mssp-never", "mxp-image", "mxp-figure", + "mssp-none", "mssp-never", "mxp-image", "mxp-figure", "welcome", "welcome-connect", "tour", ]; /// diff --git a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs new file mode 100644 index 00000000..38d4b072 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs @@ -0,0 +1,328 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Accessibility; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The first run: a client with no worlds opens on the welcome, its form dials through /connect's own +/// path, and the first connect of a new configuration leaves a one-line key tour, once. +/// +[NotInParallel] +public class WelcomeTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class Recorder : IAnnouncer + { + public List Heard { get; } = []; + + public void Announce(string text, AnnouncementKind kind) => Heard.Add(text); + } + + private sealed record Run(SharpMUTermApp App, RecordingTelnetSession Wire, AppConfiguration Config, List Saved) + : IAsyncDisposable + { + public ValueTask DisposeAsync() => App.DisposeAsync(); + } + + private static async Task Start(AppConfiguration? config = null, Func? host = null) + { + Console.SetIn(TextReader.Null); + config ??= new AppConfiguration(); + var saved = new List(); + var wire = new RecordingTelnetSession(); + var baseHost = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, null); + var app = new SharpMUTermApp(config, host?.Invoke(baseHost) ?? baseHost, save: c => saved.Add(c.KeyTourPending)); + app.TelnetFactory = _ => wire; + await app.StartAsync([]); + return new Run(app, wire, config, saved); + } + + private static ConsoleKeyInfo Key(ConsoleKey key, char c = '\0', bool shift = false) => new(c, key, shift, false, false); + + private static void Type(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateWelcomeKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + } + + private static void TypeCommand(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(Key(ConsoleKey.Enter, '\r')); + } + + private static AppConfiguration OneWorld() => new() + { + Worlds = + { + new WorldDefinition + { + Name = "Mush", + Host = "mush.example", + Port = 4201, + Characters = { new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() } }, + }, + }, + }; + + [Test] + public async Task AClientWithNoWorldsOpensOnTheWelcomeAndKeepsTheNotice() + { + await using var run = await Start(); + + await Assert.That(run.App.WelcomeIsOpen).IsTrue(); + var text = string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain)); + await Assert.That(text).Contains("Connect to a host").And.Contains("Browse games").And.Contains("Open settings"); + await Assert.That(text).Contains(WelcomeSurface.ExampleCommand); + await Assert.That(run.App.StatusMarkup).Contains("No world configured"); + } + + [Test] + public async Task AClientWithWorldsDoesNotOpenIt() + { + await using var run = await Start(OneWorld()); + + await Assert.That(run.App.WelcomeIsOpen).IsFalse(); + } + + [Test] + public async Task EscClosesItForTheRunAndSlashWelcomeBringsItBack() + { + await using var run = await Start(); + + run.App.SimulateWelcomeKey(Key(ConsoleKey.Escape, '\x1b')); + await Assert.That(run.App.WelcomeIsOpen).IsFalse(); + await Assert.That(run.App.StatusMarkup).Contains("No world configured"); + + TypeCommand(run.App, "/welcome"); + await Assert.That(run.App.WelcomeIsOpen).IsTrue(); + } + + [Test] + public async Task TheCommandSurfaceReopensIt() + { + await using var run = await Start(); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Escape, '\x1b')); + + await Assert.That(run.App.DispatchCommand("term:welcome")).IsTrue(); + await Assert.That(run.App.WelcomeIsOpen).IsTrue(); + } + + /// The form, driven with keys, adds the world /connect would have, with the character it named, and dials it. + [Test] + public async Task TheFormAddsTheWorldAndCharacterAndDials() + { + await using var run = await Start(); + + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + await Assert.That(run.App.Welcome!.InForm).IsTrue(); + Type(run.App, "mud.example.org"); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Tab, '\t')); + for (var i = 0; i < 4; i++) + { + run.App.SimulateWelcomeKey(Key(ConsoleKey.Backspace, '\b')); + } + + Type(run.App, "4201"); + run.App.SimulateWelcomeKey(Key(ConsoleKey.DownArrow)); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Spacebar, ' ')); + run.App.SimulateWelcomeKey(Key(ConsoleKey.DownArrow)); + Type(run.App, "Corvid"); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + await run.App.LastCommand; + + await Assert.That(run.App.WelcomeIsOpen).IsFalse(); + await Assert.That(run.Config.Worlds.Count).IsEqualTo(1); + var world = run.Config.Worlds[0]; + await Assert.That(world.Host).IsEqualTo("mud.example.org"); + await Assert.That(world.Port).IsEqualTo(4201); + await Assert.That(world.UseTls).IsTrue(); + await Assert.That(world.Characters.Single().Name).IsEqualTo("Corvid"); + await Assert.That(world.Layout).IsNull().Because("the suggestion is left to apply when nothing was chosen"); + await Assert.That(run.App.FindSession("mud.example.org.Corvid")!.State).IsEqualTo(ConnectionState.Connected); + } + + [Test] + public async Task APickedLayoutIsTheNewWorldsOwn() + { + await using var run = await Start(); + + run.App.SimulateWelcomeKey(Key(ConsoleKey.RightArrow)); + run.App.SimulateWelcomeKey(Key(ConsoleKey.RightArrow)); + await Assert.That(run.App.Welcome!.Layout).IsEqualTo(WelcomeLayout.Combat); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + Type(run.App, "mud.example.org"); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + await run.App.LastCommand; + + await Assert.That(run.Config.Worlds.Single().Layout).IsEqualTo(BuiltInLayouts.CombatId); + await Assert.That(run.Config.Worlds.Single().Port).IsEqualTo(SharpMUTermApp.DefaultConnectPort); + } + + /// The layout row applies to a /connect typed under the welcome too: it is the first world either way. + [Test] + public async Task ThePickedLayoutReachesAConnectTypedOnTheCommandLine() + { + await using var run = await Start(); + run.App.SimulateWelcomeKey(Key(ConsoleKey.RightArrow)); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Escape, '\x1b')); + + TypeCommand(run.App, "/connect mud.example.org 4201"); + await run.App.LastCommand; + + await Assert.That(run.Config.Worlds.Single().Layout).IsEqualTo(BuiltInLayouts.RoleplayId); + } + + [Test] + public async Task ABadPortIsRefusedInPlace() + { + await using var run = await Start(); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + Type(run.App, "mud.example.org"); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Tab, '\t')); + Type(run.App, "0000"); // 40000000 is too many digits to take, and 4000 0000 is not a port + for (var i = 0; i < 5; i++) + { + run.App.SimulateWelcomeKey(Key(ConsoleKey.Backspace, '\b')); + } + + Type(run.App, "0"); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.WelcomeIsOpen).IsTrue(); + await Assert.That(run.Config.Worlds.Count).IsEqualTo(0); + await Assert.That(string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain))).Contains("port is a number"); + } + + [Test] + public async Task EscOnTheFormGoesBackToTheMenu() + { + await using var run = await Start(); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + + run.App.SimulateWelcomeKey(Key(ConsoleKey.Escape, '\x1b')); + + await Assert.That(run.App.WelcomeIsOpen).IsTrue(); + await Assert.That(run.App.Welcome!.InForm).IsFalse(); + } + + /// With no index to read, Browse says so where the player is looking and fetches nothing. + [Test] + public async Task BrowseWithNoIndexSaysSoInPlace() + { + await using var run = await Start(new AppConfiguration { PackageIndexUrl = string.Empty }); + + run.App.SimulateWelcomeKey(Key(ConsoleKey.DownArrow)); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.WelcomeIsOpen).IsTrue(); + await Assert.That(string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain))).Contains("no package index is set"); + } + + [Test] + public async Task OpenSettingsGoesToF5() + { + await using var run = await Start(); + + run.App.SimulateWelcomeKey(Key(ConsoleKey.DownArrow)); + run.App.SimulateWelcomeKey(Key(ConsoleKey.DownArrow)); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.WelcomeIsOpen).IsFalse(); + await Assert.That(run.App.OpenSettingsKey).IsEqualTo(ConsoleKey.F5); + } + + // ---- The key tour --------------------------------------------------------------------------- + + [Test] + public async Task TheFirstConnectOfANewConfigurationShowsTheTourOnceAndSaysSoOnDisk() + { + await using var run = await Start(); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Escape, '\x1b')); + + TypeCommand(run.App, "/connect mud.example.org 4201"); + await run.App.LastCommand; + + await Assert.That(run.App.KeyTourShown).IsTrue(); + await Assert.That(run.App.PaneLines(SharpMUTermApp.MainWindowId).Any(l => l.Contains(SharpMUTermApp.KeyTourLead))).IsTrue(); + await Assert.That(run.Saved).Contains(true).Because("the world's save carries the tour as owed"); + await Assert.That(run.Config.KeyTourPending).IsFalse(); + await Assert.That(run.Saved[^1]).IsFalse().Because("and the save after it, once shown, does not"); + } + + [Test] + public async Task AConfigurationThatStartedWithWorldsNeverGetsTheTour() + { + await using var run = await Start(OneWorld()); + + TypeCommand(run.App, "/connect Mush"); + await run.App.LastCommand; + + await Assert.That(run.App.KeyTourShown).IsFalse(); + await Assert.That(run.Config.KeyTourPending).IsFalse(); + } + + [Test] + public async Task AnOwedTourIsShownOnTheNextRunsConnect() + { + var config = OneWorld(); + config.KeyTourPending = true; + await using var run = await Start(config); + + TypeCommand(run.App, "/connect Mush"); + await run.App.LastCommand; + + await Assert.That(run.App.KeyTourShown).IsTrue(); + await Assert.That(config.KeyTourPending).IsFalse(); + } + + [Test] + public async Task TheCommandSurfaceHidesTheTourAndShowsItAgain() + { + await using var run = await Start(); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Escape, '\x1b')); + TypeCommand(run.App, "/connect mud.example.org 4201"); + await run.App.LastCommand; + + run.App.DispatchCommand("term:tour"); + await Assert.That(run.App.KeyTourShown).IsFalse(); + await Assert.That(run.App.PaneLines(SharpMUTermApp.MainWindowId).Any(l => l.Contains(SharpMUTermApp.KeyTourLead))).IsFalse(); + + run.App.DispatchCommand("term:tour"); + await Assert.That(run.App.KeyTourShown).IsTrue(); + } + + // ---- Where nobody sees the screen ------------------------------------------------------------ + + /// + /// --plain: no modal to take the reader's typing; the welcome is said as lines naming commands, and + /// /welcome layout stands in for the arrows. + /// + [Test] + public async Task WhereTheScreenIsNotSeenTheWelcomeIsLinesAndCommands() + { + var heard = new Recorder(); + await using var run = await Start(host: h => h with { Announcer = heard, ScreenIsSeen = false }); + + await Assert.That(run.App.WelcomeIsOpen).IsFalse(); + await Assert.That(heard.Heard).Contains(line => line.Contains("/connect") && line.Contains(WelcomeSurface.ExampleCommand)); + + TypeCommand(run.App, "/welcome layout combat"); + TypeCommand(run.App, "/connect mud.example.org 4201"); + await run.App.LastCommand; + + await Assert.That(run.Config.Worlds.Single().Layout).IsEqualTo(BuiltInLayouts.CombatId); + } +} From f224898c6d9806a9f225a1edd54b7509151223e1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 05:15:53 +0000 Subject: [PATCH 018/113] Drop the divider row a tab strip or a strip panel already marks In a stacked split no row is spent on a divider above a pane that draws its own tab strip: the strip is the boundary, and its empty run past the last tab is the divider's handle (hover cue, drag, double-click to even, tooltip). Fixed strip panels sit flush with no divider on either side and, unfocused, are recessed a step so they never share an unfocused pane's plane. Side by side is unchanged. The freed rows go to the panes (a NAWS change). PaneExtent.DividerRows is the one rule, read by LayoutSolver, PaneExtent, PaneResize and the terminal's grid. Adds the split-stacked snapshot view. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 4 + CLAUDE.md | 26 +++- src/SharpMUTerm.Core/Layouts/PanelSizing.cs | 1 + src/SharpMUTerm.Core/Workspace/LayoutNode.cs | 8 ++ .../Workspace/LayoutSolver.cs | 7 +- src/SharpMUTerm.Core/Workspace/PaneExtent.cs | 85 ++++++++++- src/SharpMUTerm.Core/Workspace/PaneResize.cs | 3 +- src/SharpMUTerm.Tui/PaneDragSurface.cs | 19 ++- src/SharpMUTerm.Tui/PaneDragTracker.cs | 5 +- .../Pointer/SharpMUTermApp.Pointer.cs | 135 +++++++++++++++++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 66 ++++++--- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- .../Workspace/PaneExtentTests.cs | 103 ++++++++++++- tests/SharpMUTerm.Tui.Tests/PointerTests.cs | 75 ++++++++++ .../StackedDividerTests.cs | 117 +++++++++++++++ 15 files changed, 607 insertions(+), 49 deletions(-) create mode 100644 tests/SharpMUTerm.Tui.Tests/StackedDividerTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index b9101a5e..f0956a0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -162,6 +162,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- Panes stacked one above the other no longer have an empty row between them when the lower pane shows its + tabs: the tab row is the boundary, and the panes get the row back. Drag the empty part of that tab row to + resize, or double-click it to even the panes out. The vitals and quick-bar strips sit flush against their + neighbours, on a slightly darker background. Side-by-side panes are unchanged. - The status row's meters are edited in a table on Text & display (F7): one row per meter with its label, value path and maximum path, what it reads now, `[+ meter]`, and Delete to remove one. While you are in the table it lists the game data this connection has received, and a path field offers those paths, with diff --git a/CLAUDE.md b/CLAUDE.md index dd5d80e3..f7c51035 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -245,8 +245,9 @@ fallbacks) for inline images/maps. command line (wrapping, auto-growing, per-window drafts, plus an optional per-window second bar), status line, `Ctrl+Q` quit, per-pane NAWS (every connected session is told its own pane's output rectangle, on every resize and layout change, rate-limited to four writes a second with a trailing - flush). The tab/pane set is driven by the tested `Core.Workspaces` model, with **splits** (thin - single-line dividers) and the **connection rail** now rendered as well — and **clickable**: a world, + flush). The tab/pane set is driven by the tested `Core.Workspaces` model, with **splits** (a thin + single-cell divider column side by side; stacked, a divider row only where nothing else marks the + boundary — see *No divider row where a tab strip or a strip panel already marks it* below) and the **connection rail** now rendered as well — and **clickable**: a world, character or window row switches to it, dispatched through the rail control's *own* `LinkClicked` (never the output panes' handler, so a world cannot drive the client's UI from the wire). - **Panes come back after a restart, and the log that does it is keyed by *window*** (`RestoreLog`, @@ -950,6 +951,19 @@ fallbacks) for inline images/maps. (`PaneResize.DragBorder`, which changes only the two children either side), a double-click evens the split (`PaneResize.Even`). A recolour costs no cell and moves no pane rectangle — the NAWS rule. While a drag is held the 100 ms bare-press repeat is read as "the pointer is here". + - **No divider row where a tab strip or a strip panel already marks it** (`PaneExtent.DividerRows`, read by + `LayoutSolver`, `PaneExtent`, `PaneResize.Minimum` and `BuildLayoutNode` alike). Stacked, there is no row + above a pane that draws its own tab strip (`PaneNode.DrawsHeader`, host-derived by `PanelSizing.Apply` + like `FixedRows`, false until then): that strip is the boundary, and its empty run past the last tab is + registered as the divider (`DividerSlot.HeaderPaneId`, `HeaderFill`) — the same hover, `DragBorder` drag, + double-click and tooltip, lit by recolouring those cells after the paint (`PaintHeaderDividers`; the + control's own background is what its content inherits, so it cannot be set there). A tab, its `×` and the + `│` between tabs stay the framework's, and `PaneDragSurface.IsDragHandle` keeps the run from starting a + window drag. There is no row either side of a fixed strip panel; it sits flush, and an *unfocused* strip is + recessed the backdrop's step (`SurfaceToneIn`), so it is never the same plane as an unfocused pane (2.8 L* + on Dark, 3.7 Solarized Dark, 21 Light — the pane-over-backdrop step). Side by side, nothing changed. The + freed row went to the panes, which is the point and a NAWS change; `StackedDividerTests` and the + `split-stacked` view are the pins. - **The menu is the ⌃P catalog's own entries** (`AddCommands`), so it cannot offer an action the keyboard lacks, and each says its key (`ShortHint`). A right-click on a link or output focuses that pane first, and on a tab activates it, so the entries act on what was clicked. @@ -1029,8 +1043,8 @@ fallbacks) for inline images/maps. gives a fixed child `GridLength.Cells` and a floored one `Star(min:)`, and `LayoutSolver` shares rows the same way (`PaneExtent.DistributeRows`; if every child is fixed the last shares, in both). A one-tab strip draws **no tab strip** (`TabControl.ShowTabHeader`, which `PaneOutputRects` already reads) and offers no drag handle. Only - rows: a strip's width is a share. The divider beside a fixed pane is not registered with the pointer, a drag - on it returns `PaneResizeOutcome.FixedSize`, and ⌥⇧↑/↓ take rows from a sharing pane beyond the strip or + rows: a strip's width is a share. No divider row is drawn beside a fixed pane (it sits flush, on a recessed + plane), and a drag of that border returns `PaneResizeOutcome.FixedSize`, and ⌥⇧↑/↓ take rows from a sharing pane beyond the strip or pass to the next split up, refusing out loud when only a strip could pay. - **The status row leaves its meters out while the vitals strip shows them** (`VitalsStripShowing`: the status row's character's vitals window is the front tab of a drawn pane, zoom included). `SyncStatusMeters` repaints @@ -1203,7 +1217,9 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg list and match counts), `settings-meters`/`settings-meters-pick` (the meter table over the demo's game data, the cursor on a meter with the received-data box under it, and the same meter's value path open with its dropdown of received paths), `settings-changed` (F7 after two real edits: the `● changed` marks and - `r reset`), `logging`, `password`, `startup`, `freeze`, `spawn`, `split`, `move`, `drag`, + `r reset`), `logging`, `password`, `startup`, `freeze`, `spawn`, `split`, + `split-stacked` (the same split stacked through the real ⌃B -, where the lower pane's tab strip is the + boundary and no divider row is drawn), `move`, `drag`, `history`, `history-search`, `history-search-filter`, `draft`, `draft2`, `menu`, `menu-split`, `menu-fuzzy` (`trig sel` typed into ⌃P after a real drag, so the trigger builder's entry is offered — the frame showing a two-word fuzzy match highlighted), `menu-recent` (⌃P opened empty after two commands ran diff --git a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs index 683551fc..6cb0a7cb 100644 --- a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs +++ b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs @@ -51,6 +51,7 @@ public static void Apply(PaneNode pane, Func panelOf, int tabSt ArgumentNullException.ThrowIfNull(panelOf); var panels = pane.Tabs.Select(panelOf).ToList(); var chrome = ShowsTabStrip(panels) ? Math.Max(0, tabStripRows) : 0; + pane.DrawsHeader = chrome > 0; if (IsStrip(panels)) { diff --git a/src/SharpMUTerm.Core/Workspace/LayoutNode.cs b/src/SharpMUTerm.Core/Workspace/LayoutNode.cs index dc65bb3d..4c360e57 100644 --- a/src/SharpMUTerm.Core/Workspace/LayoutNode.cs +++ b/src/SharpMUTerm.Core/Workspace/LayoutNode.cs @@ -110,6 +110,14 @@ public PaneNode( /// public int? MinRows { get; set; } + /// + /// Whether the host draws a tab strip along this pane's top row. In a stacked split such a pane needs no divider + /// row above it: its own tab strip is the boundary, and the host makes the strip's empty run the handle a divider + /// would have been (). Like , derived by the host every + /// time it lays the panes out and not persisted; false until then, which keeps the divider. + /// + public bool DrawsHeader { get; set; } + public override IEnumerable Panes() { yield return this; diff --git a/src/SharpMUTerm.Core/Workspace/LayoutSolver.cs b/src/SharpMUTerm.Core/Workspace/LayoutSolver.cs index 1538f150..21f2f1c2 100644 --- a/src/SharpMUTerm.Core/Workspace/LayoutSolver.cs +++ b/src/SharpMUTerm.Core/Workspace/LayoutSolver.cs @@ -9,7 +9,8 @@ public readonly record struct PaneRect(int X, int Y, int Width, int Height) /// /// Turns a split tree into concrete per-pane rectangles for a given -/// bounding area, reserving one cell for the divider between siblings and honouring each split's +/// bounding area, reserving one cell for the divider between siblings (where +/// says a stacked split draws one) and honouring each split's /// fractional . Pure and deterministic; the SharpConsoleUI layer maps /// the resulting s onto views. When a pane is zoomed it fills the whole area. /// @@ -54,7 +55,7 @@ private static void Place(LayoutNode node, PaneRect rect, DictionaryThe fewest rows is given: its fixed height, else its declared floor, else 0. @@ -53,7 +53,88 @@ public static int MinRows(LayoutNode node) var split = (SplitNode)node; return split.Direction == SplitDirection.Row ? split.Children.Max(MinRows) - : split.Children.Sum(MinRows) + (LayoutSolver.DividerThickness * (split.Children.Count - 1)); + : split.Children.Sum(MinRows) + Dividers(split); + } + + /// + /// The cells between child and child + 1 of + /// . Side by side it is always a divider column. Stacked, a divider row is drawn only + /// where nothing else already marks the boundary: + /// + /// none beside a fixed-height strip, which sits flush and is told apart by its own plane — it cannot be + /// resized, so a row there would be a rule with nothing to drag; + /// none above a child whose top row is all tab strip (): that strip is the + /// boundary, and the host makes its empty run the divider's handle. + /// + /// + public static int DividerRows(SplitNode split, int index) + { + ArgumentNullException.ThrowIfNull(split); + if (index < 0 || index + 1 >= split.Children.Count) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + + if (split.Direction == SplitDirection.Row) + { + return LayoutSolver.DividerThickness; + } + + var above = split.Children[index]; + var below = split.Children[index + 1]; + if (FixedRows(above) is not null || FixedRows(below) is not null || HeaderPanes(below).Count > 0) + { + return 0; + } + + return LayoutSolver.DividerThickness; + } + + /// Every divider cell along 's axis: the sum of . + public static int Dividers(SplitNode split) + { + ArgumentNullException.ThrowIfNull(split); + var total = 0; + for (var i = 0; i + 1 < split.Children.Count; i++) + { + total += DividerRows(split, i); + } + + return total; + } + + /// + /// The panes whose tab strips run along 's whole top edge, or an empty list when any part + /// of that edge is not a tab strip. A pane is its own answer; a stack is its first child's; a side-by-side row is + /// every child's, and only when each of them has one. + /// + public static IReadOnlyList HeaderPanes(LayoutNode node) + { + ArgumentNullException.ThrowIfNull(node); + if (node is PaneNode pane) + { + return pane.DrawsHeader ? [pane] : []; + } + + var split = (SplitNode)node; + if (split.Direction == SplitDirection.Column) + { + return HeaderPanes(split.Children[0]); + } + + var panes = new List(); + foreach (var child in split.Children) + { + var below = HeaderPanes(child); + if (below.Count == 0) + { + return []; + } + + panes.AddRange(below); + } + + return panes; } /// diff --git a/src/SharpMUTerm.Core/Workspace/PaneResize.cs b/src/SharpMUTerm.Core/Workspace/PaneResize.cs index 95fa65de..08fd4d48 100644 --- a/src/SharpMUTerm.Core/Workspace/PaneResize.cs +++ b/src/SharpMUTerm.Core/Workspace/PaneResize.cs @@ -279,8 +279,7 @@ public static int Minimum(LayoutNode node, bool horizontal) return split.Children.Max(child => Minimum(child, horizontal)); } - return split.Children.Sum(child => Minimum(child, horizontal)) - + (LayoutSolver.DividerThickness * (split.Children.Count - 1)); + return split.Children.Sum(child => Minimum(child, horizontal)) + PaneExtent.Dividers(split); } /// The arrow a direction is spelled with, for the surfaces that name the chord. diff --git a/src/SharpMUTerm.Tui/PaneDragSurface.cs b/src/SharpMUTerm.Tui/PaneDragSurface.cs index d7b4f478..9718b738 100644 --- a/src/SharpMUTerm.Tui/PaneDragSurface.cs +++ b/src/SharpMUTerm.Tui/PaneDragSurface.cs @@ -12,16 +12,23 @@ internal sealed class PaneDragSurface { private readonly Dictionary _rects; private readonly Dictionary _activeWindows; + private readonly List _dividers; - /// Creates a surface from pane rectangles and each pane's active window id. + /// + /// Creates a surface from pane rectangles and each pane's active window id. are the + /// cells of a tab strip that stand in for the divider above its pane (the run past its last tab): a press there + /// resizes the split, so it is not a drag handle for the pane's window. + /// public PaneDragSurface( IReadOnlyDictionary rects, - IReadOnlyDictionary activeWindows) + IReadOnlyDictionary activeWindows, + IEnumerable? dividers = null) { ArgumentNullException.ThrowIfNull(rects); ArgumentNullException.ThrowIfNull(activeWindows); _rects = new Dictionary(rects, StringComparer.Ordinal); _activeWindows = new Dictionary(activeWindows, StringComparer.Ordinal); + _dividers = dividers is null ? new List() : new List(dividers); } /// The pane rectangles, keyed by pane id. @@ -64,4 +71,12 @@ public PaneDragSurface( /// drag, so clicking, selecting text and following links in a pane's body are all left alone. /// public bool IsTabStrip(string paneId, int y) => RectOf(paneId) is { } rect && !rect.IsEmpty && y == rect.Y; + + /// + /// True when a press at the cell starts a pane drag: it is on the pane's tab strip and not on the part of the + /// strip that is the divider above the pane. + /// + public bool IsDragHandle(string paneId, int x, int y) => + IsTabStrip(paneId, y) + && !_dividers.Any(d => x >= d.X && x < d.X + d.Width && y >= d.Y && y < d.Y + d.Height); } diff --git a/src/SharpMUTerm.Tui/PaneDragTracker.cs b/src/SharpMUTerm.Tui/PaneDragTracker.cs index ead67be9..27f569d6 100644 --- a/src/SharpMUTerm.Tui/PaneDragTracker.cs +++ b/src/SharpMUTerm.Tui/PaneDragTracker.cs @@ -203,8 +203,9 @@ private PaneDragResult OnPress(int x, int y, Func snapshot) return wasDragging ? Cancelled() : Idle(); } - // Only the tab strip is a drag handle; a press in the body belongs to the pane's content. - if (!surface.IsTabStrip(paneId, y) || surface.ActiveWindow(paneId) is not { } windowId) + // Only the tab strip is a drag handle; a press in the body belongs to the pane's content, and one on the strip's + // empty run, where that run is the divider above the pane, belongs to the divider. + if (!surface.IsDragHandle(paneId, x, y) || surface.ActiveWindow(paneId) is not { } windowId) { return wasDragging ? Cancelled() : Idle(); } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index 732a802d..ad4315d7 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -36,8 +36,12 @@ internal sealed partial class SharpMUTermApp private DividerDrag? _dividerDrag; private IReadOnlyList _scrollbars = Array.Empty(); - /// One divider between two children of a split, and the control that draws it. - private sealed record DividerSlot(HorizontalGridControl Control, SplitNode Split, int Index); + /// + /// One divider between two children of a split: either the control that draws it, or — in a stack where the pane + /// below draws a tab strip and so needs no divider row () — that pane's id, + /// whose strip's empty run past its last tab is the handle instead (). + /// + private sealed record DividerSlot(HorizontalGridControl? Control, SplitNode Split, int Index, string? HeaderPaneId = null); /// A divider by what it divides, which survives the rebuild that replaces its control. private readonly record struct DividerKey(SplitNode Split, int Index) @@ -62,8 +66,8 @@ private HorizontalGridControl PaneDivider(SplitNode split, int index) var key = new DividerKey(split, index); var rule = Divider(_litDivider is { } lit && lit.Equals(key)); - // The rule beside a fixed-height strip is drawn but not registered: it cannot move, so it offers no - // resize cue to hover, no drag and no double-click to even. + // Beside a fixed-height strip no rule is drawn at all (PaneExtent.DividerRows: it sits flush); should one + // ever be, it is not registered: it cannot move, so it offers no resize cue, no drag and no double-click. var held = split.Direction == SplitDirection.Column && (PaneExtent.FixedRows(split.Children[index]) is not null || PaneExtent.FixedRows(split.Children[index + 1]) is not null); @@ -75,6 +79,118 @@ private HorizontalGridControl PaneDivider(SplitNode split, int index) return rule; } + /// + /// Registers the tab strips of the panes along the top of a stacked split's child + 1 as + /// the divider above it, where drew no row. Nothing is registered beside a + /// fixed strip, for 's reason: it cannot move. + /// + private void RegisterHeaderDivider(SplitNode split, int index) + { + if (split.Direction != SplitDirection.Column + || PaneExtent.FixedRows(split.Children[index]) is not null + || PaneExtent.FixedRows(split.Children[index + 1]) is not null) + { + return; + } + + foreach (var pane in PaneExtent.HeaderPanes(split.Children[index + 1])) + { + _dividers.Add(new DividerSlot(null, split, index, pane.Id)); + } + } + + /// + /// The run of a pane's tab strip to the right of its last tab, in desktop cells, or null when the strip is not + /// drawn or its tabs fill it. Only that run is the divider: a tab, its × and the separators between tabs + /// stay the framework's, and its own hit test is what says where the last tab ends. + /// + private PaneRect? HeaderFill(string paneId) + { + TabControl? tabs; + lock (_paneTabsLock) + { + tabs = _paneTabs.GetValueOrDefault(paneId); + } + + if (tabs is not { ShowTabHeader: true } || BoundsOf(tabs) is not { Height: > 0 } rect) + { + return null; + } + + var from = rect.Width; + while (from > 0 && FrameworkHitTests.TabAt(tabs, from - 1) < 0) + { + from--; + } + + // A strip whose hit test answers nothing at all (a framework that renamed it) offers no handle rather than + // turning its tabs into one. + if (from == 0 && tabs.TabCount > 0) + { + return null; + } + + return from >= rect.Width ? null : new PaneRect(rect.X + from, rect.Y, rect.Width - from, 1); + } + + /// Every tab strip's run that is a divider's handle, for the pane drag to leave alone. + /// + /// Called from the driver's input thread (), so it reads the copy + /// swapped in, never the list a rebuild is filling. + /// + private List HeaderDividerCells() => + Volatile.Read(ref _headerDividerSlots) + .Select(AreaOf) + .Where(area => area is not null) + .Select(area => area!.Value) + .ToList(); + + /// The tab strips standing in for dividers, as of the last rebuild; swapped whole, read off-thread. + private DividerSlot[] _headerDividerSlots = []; + + /// Publishes the rebuilt pane area's tab-strip dividers for . + private void PublishHeaderDividers() => + Volatile.Write(ref _headerDividerSlots, _dividers.Where(slot => slot.HeaderPaneId is not null).ToArray()); + + /// Where a divider's handle is, in desktop cells: its control's cells, or the empty run of a tab strip. + private PaneRect? AreaOf(DividerSlot slot) => + slot.Control is { } control ? BoundsOf(control) : slot.HeaderPaneId is { } paneId ? HeaderFill(paneId) : null; + + /// + /// Lights the tab strip standing in for the divider under the pointer (or being dragged). A recolour of cells the + /// strip already drew, after the frame is painted — the framework paints that run in the control's own + /// background, which is also what the pane's content inherits, so it cannot be set on the control. + /// + private void PaintHeaderDividers(SharpConsoleUI.Layout.CharacterBuffer buffer) + { + if (_litDivider is not { } lit) + { + return; + } + + var hover = ToColor(WorkspacePalette.RuleHover(_theme)); + foreach (var slot in _dividers) + { + if (slot.HeaderPaneId is null || !lit.Equals(new DividerKey(slot.Split, slot.Index)) || AreaOf(slot) is not { } fill) + { + continue; + } + + var top = _window.Top + _system.DesktopUpperLeft.Y; + for (var x = fill.X; x < fill.X + fill.Width; x++) + { + var bx = x - _window.Left; + var by = fill.Y - top; + if (bx < 0 || by < 0 || bx >= buffer.Width || by >= buffer.Height) + { + continue; + } + + buffer.SetCellColors(bx, by, buffer.GetCell(bx, by).Foreground, hover); + } + } + } + /// /// One mouse frame, on the client's thread: a divider drag, a right-click menu, or a hover. Nothing /// here consumes the frame — the framework and the pane-drag tracker see it as they always did. @@ -174,6 +290,11 @@ private void RelightDividers() { foreach (var slot in _dividers) { + if (slot.Control is null) + { + continue; // a tab strip standing in for the divider is lit after the paint (PaintHeaderDividers) + } + var lit = _litDivider is { } key && key.Equals(new DividerKey(slot.Split, slot.Index)); slot.Control.BackgroundColor = ToColor(lit ? WorkspacePalette.RuleHover(_theme) : WorkspacePalette.Rule(_theme)); } @@ -200,7 +321,7 @@ private Dictionary PaneRectsForResize() => { foreach (var slot in _dividers) { - if (BoundsOf(slot.Control) is { } rect && Contains(rect, point)) + if (AreaOf(slot) is { } rect && Contains(rect, point)) { return slot; } @@ -210,14 +331,14 @@ private Dictionary PaneRectsForResize() => } /// The divider occupying exactly , or null. - private DividerSlot? DividerAt(PaneRect area) => _dividers.FirstOrDefault(slot => BoundsOf(slot.Control) == area); + private DividerSlot? DividerAt(PaneRect area) => _dividers.FirstOrDefault(slot => AreaOf(slot) == area); /// /// What is at a desktop cell, as the pointer sees it. Internal so a test can ask without a mouse. /// internal PointerTarget TargetAt(System.Drawing.Point point) { - if (DividerAt(point) is { } divider && BoundsOf(divider.Control) is { } line) + if (DividerAt(point) is { } divider && AreaOf(divider) is { } line) { var columns = divider.Split.Direction == SplitDirection.Row; return new PointerTarget( diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index b18e5644..2aa5f285 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -997,6 +997,7 @@ public SharpMUTermApp( ReportPaneSizes(); SyncTabStripWidths(); SyncTransparentColours(); + PaintHeaderDividers(buffer); DrawSixelOverlay(buffer); PublishScrollbars(); PublishPanels(); @@ -1306,6 +1307,14 @@ public string RenderSnapshot(string? view = null) RebuildPaneArea(); } + // The same split stacked, through the real ⌃B - keys: Chat lands in the lower pane, whose tab strip is the + // boundary between the two — there is no divider row above a pane that draws its own tab strip. + if (string.Equals(view, "split-stacked", StringComparison.OrdinalIgnoreCase)) + { + SimulateKey(Stroke('\u0002', ConsoleKey.B, ctrl: true)); + SimulateKey(Stroke('-', ConsoleKey.OemMinus)); + } + // More tabs than the strip can hold, which is the state every other tab view is too small to // show. The channels are named the way a real client's are — a character's captures, carrying // their owner as a prefix — and there are seven of them in a split pane, so the strip wants far @@ -10009,6 +10018,7 @@ private IWindowControl BuildWorkspaceRow() var paneArea = zoomed is not null ? OnSurface(BuildPaneTabs(zoomed), zoomed.Id) : BuildLayoutNode(_workspace.Layout.Root); + PublishHeaderDividers(); // Size the rail to what its rows actually need (clamped), so it never hogs width nor clips. var railLines = RenderRailLines(); @@ -10140,12 +10150,13 @@ private IWindowControl OnSurface(IWindowControl content, string? paneId = null) /// Only the body. The tab chips keep , so the selected chip still carries /// the focused pane's lift: the plane behind the text is the one cue that can be given up, because the /// chip, the ▌ and the armed command line all say the same thing. A tinted pane stays painted — - /// its colour says whose pane it is, and nothing else on the plane says that. On kitty none of this + /// its colour says whose pane it is, and nothing else on the plane says that. So does a strip panel: no divider + /// row separates it from its neighbour, and its recessed plane is the only thing that does. On kitty none of this /// applies: every plane stays painted and is named to the terminal instead (). /// /// private SColor PaneBodyColor(string? paneId) => - HandsPlanesToTheTerminal && PaneTintOf(paneId) == PaneTint.None + HandsPlanesToTheTerminal && PaneTintOf(paneId) == PaneTint.None && !IsStripPane(paneId) ? SColor.Transparent : ToColor(PaneSurfaceTone(paneId)); @@ -10355,9 +10366,22 @@ private void EmitColourControl(string sequence) private Rgb SurfaceToneIn(string? paneId, PaneTint tint) { var plane = WorkspacePalette.Tint(_theme, tint); - return paneId is not null && IsFocusedPane(paneId) ? WorkspacePalette.Focus(plane) : plane; + if (paneId is not null && IsFocusedPane(paneId)) + { + return WorkspacePalette.Focus(plane); + } + + // A fixed strip (vitals, the quick bar) sits flush against its neighbour with no divider row between them + // (PaneExtent.DividerRows), so an unfocused one is recessed the backdrop's step: two unfocused panes are + // otherwise one plane, and the strip would run straight into the output under it. Focused, it takes the + // focus lift like any pane — recessed strip, then unfocused pane, then the focused one, in luminance. + return IsStripPane(paneId) ? WorkspacePalette.Recessed(plane) : plane; } + /// Whether a pane is a fixed-height strip panel (, derived on every rebuild). + private bool IsStripPane(string? paneId) => + paneId is not null && _workspace.Layout.FindPane(paneId) is { FixedRows: not null }; + /// /// The chip an unselected tab is painted on: its own character's plane, recessed the same /// step every idle chip has always been recessed by. @@ -10540,21 +10564,35 @@ private IWindowControl BuildLayoutNode(SharpMUTerm.Core.Workspaces.LayoutNode no var children = split.Children.Select(BuildLayoutNode).ToList(); // Interleave a thin 1-cell divider between children (a solid border-colour bar) instead of the - // framework's double-line splitter, so splits read as a single calm line. + // framework's double-line splitter, so splits read as a single calm line — but only where + // PaneExtent.DividerRows says one is drawn. Stacked, there is none above a pane whose tab strip is its top + // row (that strip is the boundary, and its empty run is registered as the divider's handle) and none beside a + // fixed strip, which sits flush on a plane of its own. LayoutSolver reads the same rule, so the panes nothing + // has arranged yet are solved to the same rectangles. // A stacked split gives a strip pane exactly its rows (Cells) and an editor its floor (Star's min); the rest // share by weight. PaneExtent.DistributeRows is the same rule, for the panes nothing has arranged yet. var stacked = split.Direction == SplitDirection.Column; var fixedRows = stacked ? PaneExtent.FixedChildren(split) : new int?[children.Count]; var tracks = new List(); + var cells = new List(); for (var i = 0; i < children.Count; i++) { var floor = stacked ? PaneExtent.MinRows(split.Children[i]) : 0; tracks.Add(fixedRows[i] is { } rows ? GridLength.Cells(rows) : GridLength.Star(Math.Max(0.01, split.Sizes[i]), min: floor > 0 ? floor : null)); + cells.Add(children[i]); if (i < children.Count - 1) { - tracks.Add(GridLength.Cells(1)); + if (PaneExtent.DividerRows(split, i) > 0) + { + tracks.Add(GridLength.Cells(1)); + cells.Add(PaneDivider(split, i)); + } + else + { + RegisterHeaderDivider(split, i); + } } } @@ -10564,25 +10602,17 @@ private IWindowControl BuildLayoutNode(SharpMUTerm.Core.Workspaces.LayoutNode no if (split.Direction == SplitDirection.Row) { grid.Columns(tracks.ToArray()).Rows(GridLength.Star(1)); - for (var i = 0; i < children.Count; i++) + for (var i = 0; i < cells.Count; i++) { - grid.Place(children[i], 0, i * 2, 1, 1); - if (i < children.Count - 1) - { - grid.Place(PaneDivider(split, i), 0, i * 2 + 1, 1, 1); - } + grid.Place(cells[i], 0, i, 1, 1); } } else { grid.Rows(tracks.ToArray()).Columns(GridLength.Star(1)); - for (var i = 0; i < children.Count; i++) + for (var i = 0; i < cells.Count; i++) { - grid.Place(children[i], i * 2, 0, 1, 1); - if (i < children.Count - 1) - { - grid.Place(PaneDivider(split, i), i * 2 + 1, 0, 1, 1); - } + grid.Place(cells[i], i, 0, 1, 1); } } @@ -12086,7 +12116,7 @@ internal PaneDragSurface PaneSnapshot() } } - return new PaneDragSurface(rects, windows); + return new PaneDragSurface(rects, windows, HeaderDividerCells()); } /// diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 1b7de907..20232942 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -15,7 +15,7 @@ internal static class SnapshotViews "input", "logging", "password", "startup", "deletions", "settings-search", "settings-meters", "settings-meters-pick", "settings-changed", "triggers-edit", "logging-edit", "keypad-edit", "password-edit", "startup-edit", - "freeze", "freeze-scrollback", "spawn", "split", "move", "drag", + "freeze", "freeze-scrollback", "spawn", "split", "split-stacked", "move", "drag", "history", "history-search", "history-search-filter", "draft", "draft2", "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "tint-tabs", diff --git a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs index d16bea02..4b10a5e2 100644 --- a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs @@ -23,8 +23,9 @@ public async Task AFixedStripGetsExactlyItsRowsAndTheRestGoesToTheSharingPane() var rects = LayoutSolver.Solve(root, Screen); + // Flush: a strip sits against its neighbour with no divider row, so the output has the row a rule took. await Assert.That(rects["vitals"]).IsEqualTo(new PaneRect(0, 0, 100, 1)); - await Assert.That(rects["output"]).IsEqualTo(new PaneRect(0, 2, 100, 28)); + await Assert.That(rects["output"]).IsEqualTo(new PaneRect(0, 1, 100, 29)); } [Test] @@ -35,7 +36,7 @@ public async Task TheShareAFixedPaneWasGivenDoesNotMatter() await Assert.That(LayoutSolver.Solve(narrow, Screen)["quick"].Height).IsEqualTo(1); await Assert.That(LayoutSolver.Solve(wide, Screen)["quick"].Height).IsEqualTo(1); - await Assert.That(LayoutSolver.Solve(wide, Screen)["output"].Height).IsEqualTo(28); + await Assert.That(LayoutSolver.Solve(wide, Screen)["output"].Height).IsEqualTo(29); } [Test] @@ -48,10 +49,98 @@ public async Task SharingPanesStillSplitWhatIsLeftByTheirFractions() var rects = LayoutSolver.Solve(root, Screen); - // 30 − 2 dividers = 28; the strip takes 2, and a and b split the 26 left evenly. + // 30 − 1 divider (between a and b; none beside the strip) = 29; the strip takes 2, a and b split 27. await Assert.That(rects["strip"].Height).IsEqualTo(2); - await Assert.That(rects["a"].Height).IsEqualTo(13); - await Assert.That(rects["b"].Height).IsEqualTo(13); + await Assert.That(rects["a"].Height + rects["b"].Height).IsEqualTo(27); + await Assert.That(Math.Abs(rects["a"].Height - rects["b"].Height)).IsLessThanOrEqualTo(1); + } + + [Test] + public async Task NoDividerRowIsDrawnAboveAPaneThatDrawsItsOwnTabStrip() + { + var top = Pane("top"); + var below = Pane("below"); + below.DrawsHeader = true; + var root = new SplitNode(SplitDirection.Column, [top, below]); + + var rects = LayoutSolver.Solve(root, Screen); + + await Assert.That(PaneExtent.DividerRows(root, 0)).IsEqualTo(0); + await Assert.That(rects["top"]).IsEqualTo(new PaneRect(0, 0, 100, 15)); + await Assert.That(rects["below"]).IsEqualTo(new PaneRect(0, 15, 100, 15)); + } + + [Test] + public async Task APaneWithNoTabStripStillGetsItsDividerRow() + { + var top = Pane("top"); + top.DrawsHeader = true; // the strip above a boundary is not the boundary + var root = new SplitNode(SplitDirection.Column, [top, Pane("below")]); + + var rects = LayoutSolver.Solve(root, Screen); + + await Assert.That(PaneExtent.DividerRows(root, 0)).IsEqualTo(1); + await Assert.That(rects["below"].Y).IsEqualTo(rects["top"].Height + 1); + } + + [Test] + public async Task SideBySideKeepsItsDividerColumnWhateverThePanesDraw() + { + var left = Pane("left"); + var right = Pane("right"); + left.DrawsHeader = right.DrawsHeader = true; + var root = new SplitNode(SplitDirection.Row, [left, right]); + + var rects = LayoutSolver.Solve(root, Screen); + + await Assert.That(PaneExtent.DividerRows(root, 0)).IsEqualTo(1); + await Assert.That(rects["right"].X).IsEqualTo(rects["left"].Width + 1); + } + + [Test] + public async Task ARowOfPanesIsTheBoundaryOnlyWhenEveryOneOfThemDrawsATabStrip() + { + var a = Pane("a"); + var b = Pane("b"); + a.DrawsHeader = true; + var row = new SplitNode(SplitDirection.Row, [a, b]); + var root = new SplitNode(SplitDirection.Column, [Pane("top"), row]); + + await Assert.That(PaneExtent.HeaderPanes(row)).IsEmpty(); + await Assert.That(PaneExtent.DividerRows(root, 0)).IsEqualTo(1); + + b.DrawsHeader = true; + await Assert.That(PaneExtent.HeaderPanes(row).Select(p => p.Id)).IsEquivalentTo(["a", "b"]); + await Assert.That(PaneExtent.DividerRows(root, 0)).IsEqualTo(0); + } + + [Test] + public async Task DraggingATabStripBoundaryPutsTheLowerPanesStripAtTheRowAskedFor() + { + var below = Pane("below"); + below.DrawsHeader = true; + var root = new SplitNode(SplitDirection.Column, [Pane("top"), below]); + var rects = LayoutSolver.Solve(root, Screen); + + var result = PaneResize.DragBorder(root, 0, 10, rects); + var after = LayoutSolver.Solve(root, Screen); + + await Assert.That(result.Outcome).IsEqualTo(PaneResizeOutcome.Resized); + await Assert.That(after["below"].Y).IsEqualTo(10); + await Assert.That(after["top"].Height + after["below"].Height).IsEqualTo(30); + } + + [Test] + public async Task ApplyingPanelSizingSaysWhetherThePaneDrawsATabStrip() + { + var strip = new PaneNode("s", ["panel:vitals:W.C"]); + var output = new PaneNode("o", ["main"]); + + PanelSizing.Apply(strip, PanelOf, tabStripRows: 1); + PanelSizing.Apply(output, PanelOf, tabStripRows: 1); + + await Assert.That(strip.DrawsHeader).IsFalse(); + await Assert.That(output.DrawsHeader).IsTrue(); } [Test] @@ -85,7 +174,7 @@ public async Task WhenEveryPaneIsFixedTheLastTakesWhatIsLeftSoNoRowIsLost() var rects = LayoutSolver.Solve(root, Screen); await Assert.That(rects["a"].Height).IsEqualTo(1); - await Assert.That(rects["b"].Height).IsEqualTo(28); + await Assert.That(rects["b"].Height).IsEqualTo(29); } [Test] @@ -96,7 +185,7 @@ public async Task ASubtreeIsFixedOnlyWhenEveryPaneInItIs() var mixed = new SplitNode(SplitDirection.Row, [Pane("vitals3", fixedRows: 1), Pane("output")]); await Assert.That(PaneExtent.FixedRows(strips)).IsEqualTo(2); - await Assert.That(PaneExtent.FixedRows(stack)).IsEqualTo(3); // two rows and the divider between them + await Assert.That(PaneExtent.FixedRows(stack)).IsEqualTo(2); // two rows, flush: strips need no divider await Assert.That(PaneExtent.FixedRows(mixed)).IsNull(); } diff --git a/tests/SharpMUTerm.Tui.Tests/PointerTests.cs b/tests/SharpMUTerm.Tui.Tests/PointerTests.cs index 7e2dac9a..d6ec71f4 100644 --- a/tests/SharpMUTerm.Tui.Tests/PointerTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PointerTests.cs @@ -146,6 +146,81 @@ public async Task DoubleClickingADividerEvensThePanesOut() await Assert.That(Math.Abs(widths[0] - widths[1])).IsLessThanOrEqualTo(1); } + /// + /// In a stack there is no divider row above a pane that draws its own tab strip: the strip's empty run past + /// its last tab is the divider. It is found as one (rows shape, the divider's tooltip), the tab itself is + /// still a tab, and no row of the screen between the two panes is spent on a rule. + /// + [Test] + public async Task InAStackTheLowerPanesTabStripIsTheDivider() + { + var (app, _) = App("split-stacked"); + var rects = app.PaneSnapshot().Rects.Values.OrderBy(r => r.Y).ToArray(); + await Assert.That(rects.Length).IsEqualTo(2); + await Assert.That(rects[1].Y).IsEqualTo(rects[0].Y + rects[0].Height).Because("no divider row between the panes"); + + var header = Scan(app).Where(hit => hit.Cell.Y == rects[1].Y).ToArray(); + var divider = header.Where(hit => hit.Target.Kind == PointerKind.Divider).ToArray(); + var tab = header.Where(hit => hit.Target.Kind == PointerKind.Tab).ToArray(); + await Assert.That(divider).IsNotEmpty(); + await Assert.That(tab).IsNotEmpty().Because("the tab is still the framework's"); + await Assert.That(divider.All(hit => hit.Target.Shape == PointerShape.ResizeRows)).IsTrue(); + await Assert.That(divider[0].Target.Tooltip).Contains("above and below"); + await Assert.That(divider.Min(hit => hit.Cell.X)).IsGreaterThan(tab.Max(hit => hit.Cell.X)) + .Because("only the run past the last tab is the divider"); + await Assert.That(divider.Max(hit => hit.Cell.X)).IsEqualTo(rects[1].X + rects[1].Width - 1); + } + + [Test] + public async Task HoveringTheTabStripDividerLightsOnlyItsEmptyRun() + { + var (app, pointer) = App("split-stacked"); + var before = app.PaneOutputRects(); + var cell = DividerCell(app); + var resting = FrameGrid.Backgrounds(app.RenderWholeFrame()); + + app.SimulatePointer(cell, MouseFlags.ReportMousePosition); + var lit = FrameGrid.Backgrounds(app.RenderWholeFrame()); + + await Assert.That(app.DividerLit).IsTrue(); + await Assert.That(pointer.Hovers.Last().Kind).IsEqualTo(PointerKind.Divider); + var changed = lit.Keys.Where(k => lit[k] != resting.GetValueOrDefault(k)).ToArray(); + await Assert.That(changed).IsNotEmpty(); + await Assert.That(changed.All(k => k.Row == cell.Y && k.Column >= pointer.Hovers.Last().Area.X)).IsTrue() + .Because("only the strip's empty run is recoloured, never a tab"); + await Assert.That(app.PaneOutputRects()).IsEquivalentTo(before); + + app.SimulatePointer(cell with { Y = cell.Y + 3 }, MouseFlags.ReportMousePosition); + await Assert.That(app.DividerLit).IsFalse(); + var unlit = FrameGrid.Backgrounds(app.RenderWholeFrame()); + await Assert.That(unlit.Keys.All(k => unlit[k] == resting.GetValueOrDefault(k))).IsTrue(); + } + + [Test] + public async Task DraggingTheTabStripDividerResizesTheStackAndStartsNoPaneDrag() + { + var (app, _) = App("split-stacked"); + var cell = DividerCell(app); + var top = app.PaneSnapshot().Rects.Values.OrderBy(r => r.Y).First(); + + await Assert.That(app.PaneSnapshot().IsDragHandle(app.PaneSnapshot().PaneAt(cell.X, cell.Y)!, cell.X, cell.Y)).IsFalse() + .Because("a press on the divider run is the divider's, not a window drag"); + + app.SimulatePointer(cell, MouseFlags.Button1Pressed); + app.SimulatePointer(cell with { Y = cell.Y - 4 }, MouseFlags.Button1Pressed, MouseFlags.Button1Dragged, MouseFlags.ReportMousePosition); + app.SimulatePointer(cell with { Y = cell.Y - 4 }, MouseFlags.Button1Released); + app.RenderNextFrame(); + + var rects = app.PaneSnapshot().Rects.Values.OrderBy(r => r.Y).ToArray(); + await Assert.That(rects[0].Height).IsEqualTo(top.Height - 4); + await Assert.That(rects[1].Y).IsEqualTo(cell.Y - 4).Because("the lower pane's tab strip follows the pointer"); + + app.SimulatePointer(DividerCell(app), MouseFlags.Button1DoubleClicked); + app.RenderNextFrame(); + var heights = app.PaneSnapshot().Rects.Values.Select(r => r.Height).ToArray(); + await Assert.That(Math.Abs(heights[0] - heights[1])).IsLessThanOrEqualTo(1); + } + [Test] public async Task AURLInOutputIsALinkWhoseTooltipNamesIt() { diff --git a/tests/SharpMUTerm.Tui.Tests/StackedDividerTests.cs b/tests/SharpMUTerm.Tui.Tests/StackedDividerTests.cs new file mode 100644 index 00000000..f622fa2f --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/StackedDividerTests.cs @@ -0,0 +1,117 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A stacked split spends no row on a divider where something already marks the boundary: above a pane that draws +/// its own tab strip (the strip is the boundary, and its empty run is the handle), and either side of a fixed strip +/// panel, which is told apart by its plane instead. Side by side, the divider column is unchanged. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class StackedDividerTests +{ + private const int Width = 120; + private const int Height = 32; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(string view, string theme = "Dark") + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = theme; + config.Theme = ThemeLibrary.Get(theme); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height)); + app.RenderSnapshot(view); + app.RenderNextFrame(); + return app; + } + + [Test] + public async Task AStackedSplitGivesTheDividerRowToThePanes() + { + var app = App("split-stacked"); + var rects = app.PaneSnapshot().Rects.Values.OrderBy(r => r.Y).ToArray(); + + await Assert.That(rects.Length).IsEqualTo(2); + await Assert.That(rects[1].Y).IsEqualTo(rects[0].Y + rects[0].Height); + + // The lower pane's output starts under its tab strip, which is the row the divider used to take. + var outputs = app.PaneOutputRects().Values.OrderBy(r => r.Y).ToArray(); + await Assert.That(outputs[1].Y).IsEqualTo(rects[1].Y + 1); + } + + [Test] + public async Task ASideBySideSplitKeepsItsDividerColumn() + { + var app = App("split"); + var rects = app.PaneSnapshot().Rects.Values.OrderBy(r => r.X).ToArray(); + + await Assert.That(rects.Length).IsEqualTo(2); + await Assert.That(rects[1].X).IsEqualTo(rects[0].X + rects[0].Width + 1); + } + + /// + /// The vitals strip sits flush on the panes under it and is told apart from them by its plane, on every theme + /// and whether or not the pane beside it holds the focus: an unfocused strip is recessed a step, so it is never + /// the same plane as an unfocused pane. + /// + [Test] + [Arguments("Dark")] + [Arguments("Light")] + [Arguments("Solarized Dark")] + public async Task AStripSitsFlushAndIsToldApartByItsPlane(string theme) + { + var app = App("layout-combat", theme); + foreach (var moved in new[] { false, true }) + { + if (moved) + { + // The focus goes to the map pane, so the output pane under the strip is unfocused too. + app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.RightArrow, shift: false, alt: false, control: true)); + } + + var frame = FrameGrid.Backgrounds(app.RenderWholeFrame()); + var rects = app.PaneSnapshot().Rects.Values.ToArray(); + var strip = rects.Where(r => r.Height == 1).OrderBy(r => r.Y).First(); + var below = rects.Where(r => r.Y == strip.Y + strip.Height).ToArray(); + + await Assert.That(below).IsNotEmpty().Because("nothing between the strip and the panes under it"); + foreach (var pane in below) + { + var stripPlane = Plane(frame, strip.Y, pane.X, pane.Width); + var panePlane = Plane(frame, pane.Y + 4, pane.X, pane.Width); + await Assert.That(Math.Abs(Lightness(stripPlane) - Lightness(panePlane))).IsGreaterThanOrEqualTo(2.5) + .Because($"{theme}, focus {(moved ? "moved" : "left")}: strip {stripPlane} against pane {panePlane}"); + } + } + } + + /// The commonest background along a run of one row. + private static (int R, int G, int B) Plane(Dictionary<(int Row, int Column), string?> frame, int row, int x, int width) => + Enumerable.Range(x, width) + .Select(column => frame.GetValueOrDefault((row, column))) + .Where(bg => bg is not null) + .GroupBy(bg => bg) + .OrderByDescending(group => group.Count()) + .Select(group => Parse(group.Key!)) + .First(); + + private static (int R, int G, int B) Parse(string sgr) + { + var parts = sgr.Split(';'); + return (int.Parse(parts[2]), int.Parse(parts[3]), int.Parse(parts[4])); + } + + private static double Lightness((int R, int G, int B) c) + { + var y = Core.Text.Contrast.RelativeLuminance(new Core.Text.Rgb((byte)c.R, (byte)c.G, (byte)c.B)); + return y > 0.008856 ? (116 * Math.Cbrt(y)) - 16 : 903.3 * y; + } +} From 9212ea2fcdb3ce6cb44f9260fc86d405fec76dc0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 05:36:00 +0000 Subject: [PATCH 019/113] Desktop window: native settings window for F7 and F8 Built from the Client setting declarations, with the shared search, reset and meter table. Other sections open their cell screens. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 35 +- Directory.Packages.props | 1 + .../AvaloniaConsoleDriver.cs | 3 + src/SharpMUTerm.Avalonia/MainWindow.cs | 1 + src/SharpMUTerm.Avalonia/SettingsPresenter.cs | 59 ++ src/SharpMUTerm.Avalonia/SettingsWindow.cs | 720 ++++++++++++++++++ .../SharpMUTerm.Avalonia.csproj | 1 + src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + .../Settings/SettingsForm.cs | 211 +++++ src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 9 + .../Hosting/INativeSettings.cs | 20 + src/SharpMUTerm.Tui/OptionsScreenRenderer.cs | 13 +- .../SharpMUTermApp.Settings.cs | 88 +++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 4 +- .../HostParityTests.cs | 4 +- .../SettingsWindowTests.cs | 218 ++++++ .../NativeSettingsRoutingTests.cs | 130 ++++ 18 files changed, 1515 insertions(+), 10 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/SettingsPresenter.cs create mode 100644 src/SharpMUTerm.Avalonia/SettingsWindow.cs create mode 100644 src/SharpMUTerm.Client/Settings/SettingsForm.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/INativeSettings.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NativeSettingsRoutingTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 78fb2cbe..eb75eb44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Desktop window: F7 (Text & display) and F8 (Input) open a settings window with real switches, number boxes + and a search box. Matches are counted per section as you type. A changed setting shows a dot and a Reset + button, and every change applies and saves as you make it. The status-row meters are a table that shows each + meter's current value, with the paths your game has sent listed for you to pick from. The other screens are + listed in the window and open as before. - Desktop window: a Layouts button at the right end of the header opens a menu of the built-in and your saved layouts (the one in use is checked), with *Save changes*, *Save as new*, *Use for* the world or the character, and *Manage layouts…*. It runs the same actions as Alt+M. diff --git a/CLAUDE.md b/CLAUDE.md index ec9bfcb2..72ec808b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1126,7 +1126,7 @@ The terminal (`sharpmuterm`), the desktop window (`sharpmuterm-window`) and the one `SharpMUTermApp`; a host is only the place it runs. What differs between hosts is a **`ClientHost`** (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, -the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), and whether it draws the declared settings natively (`INativeSettings`, null for the cell screens). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until @@ -1470,7 +1470,38 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] trailing Remove button added only while the cursor is on one; the received-data box shows only while the cursor is in the table; path fields offer the received paths with their values as `ChoiceNotes`. - F7 and F8 are windowed to the screen height (`ScreenChrome.Window`), because F7 is taller than 24 rows. - - Not declared yet: F2–F6, F9 (F5's character form) and F10 are listed by title only. + - Not declared yet: F2–F6, F9 (F5's character form) and F10 are listed by title only. F9 was not declared + for the native window either: its fields are per *character*, and a `SettingBinding` reads an + `AppConfiguration`, so declaring it needs a binding that knows which character first. +- **In the window, a declared section opens a native settings window, generated from the declarations** + (`ClientHost.NativeSettings` → `INativeSettings`; Client `SettingsForm`; Avalonia `SettingsWindow`, + `SettingsPresenter` on the driver; `OpenSettingsScreen`/`TryOpenNativeSettings` in `SharpMUTermApp.Settings.cs`). + The terminal, the snapshot, the tests and the parity harness pass null, so their cells do not change. Decisions + not to relitigate: + - **Every way in goes through `OpenSettingsScreen`**: the F-key, ⌃P's `screen:` entries and the cell search's ⏎ + (`GoToSetting`). A section with fields goes native and any open cell screen is closed first. A section with + none is a cell screen as before. In the window's list it carries `↗`, and choosing it calls + `SettingsForm.OpenScreen`, which closes the window and opens the cell screen through `GoToSetting`. + - **The window only draws; the client commits.** `SettingsForm` reads values through each field's + `SettingBinding` and sends every write through one delegate. The app's delegate runs + `ScreenEdits(SaveConfiguration).Apply` on its own thread (`OnUiThread`), so a native edit is saved and re-syncs + bars, panels and automation exactly as an F7 edit does. `Changed` is raised after the change lands, and the + window re-reads values and marks. A number is clamped to its field's bounds and a text to its length, the cell + field's rules. Reset is `binding.Reset`, the default `r` uses. + - **Reads cross threads, so lists are replaced and never edited.** The window reads the live configuration on + Avalonia's thread. A declared value is a scalar or a list, so `SetMeters` builds a new list every time. + - **The meter table reads the game data of the window focused when the form opened**, captured on the client's + thread. `GameDataStore` is locked, but the focus is not safe to read from another thread. The `now` column is + re-read each second (`OptionsScreenRenderer.NowText`). The received paths feed each path box's auto-complete + and a list below it; clicking a path fills the path box last used. + - **Search is `SettingsSearch.Find` and nothing else**, so the two surfaces always find the same fields. While + searching, the page shows only matched fields, and if the section on show has none it moves to the first that + has some. + - **Fluent is applied to this window only** (`Styles.Add(new FluentTheme())`), and `RequestedThemeVariant` + follows the client's theme (`SettingsForm.IsDark`). The rest of the window stays on the Simple theme the + native menu and tooltips were built against. + - Not done: the window is not modal and does not follow a theme change while it is open. Screenshots come from a + real window under Xvfb, driven with XTest (`ux-wave4/native-settings-*.png`). - **Settings screens have no `IPasteTarget` and cannot easily have one.** They are markup rebuilt wholesale every key, with the edited field a buffer in `SettingsSession`. `SettingsOverlay` listens at `IConsoleDriver.Paste` instead. That can't double-fire *only* because no control on diff --git a/Directory.Packages.props b/Directory.Packages.props index 33fb2cc3..b1c8bec7 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -69,6 +69,7 @@ + diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index 23f46530..684b33fd 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -70,6 +70,9 @@ public AvaloniaConsoleDriver(int columns, int rows) /// The window's screen-reader regions; the window adds them beside the view. public WindowAnnouncer Announcer { get; } = new(); + /// The window's native settings window, which the main window owns (). + public SettingsPresenter Settings { get; } = new(); + public bool IsRunning { get; private set; } // ── IConsoleDriver: output ──────────────────────────────────────────────────────────────── diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index c0af46a8..ffdabba3 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -40,6 +40,7 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime _view = new TerminalView(_driver, foreground, background, options.FontPoints * 96f / 72f, options.FontFamily); Title = "SharpMUTerm"; + _driver.Settings.Owner = this; // The window's own pop-ups (tooltips, the right-click menu) follow the client's theme: a light menu // over a dark client reads as somebody else's. diff --git a/src/SharpMUTerm.Avalonia/SettingsPresenter.cs b/src/SharpMUTerm.Avalonia/SettingsPresenter.cs new file mode 100644 index 00000000..1d6a01c0 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/SettingsPresenter.cs @@ -0,0 +1,59 @@ +using Avalonia.Controls; +using Avalonia.Threading; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window host's : one at a time, owned by the main +/// window. The client calls in on its own thread, so everything here is posted to the window's. +/// +internal sealed class SettingsPresenter : INativeSettings +{ + private SettingsWindow? _window; + + /// The window the settings window belongs to, set once the main window exists. + public Window? Owner { get; set; } + + /// The open settings window, for a test; read on the window's thread. + public SettingsWindow? Window => _window; + + public void Show(SettingsForm form) => Dispatcher.UIThread.Post(() => ShowNow(form)); + + public void Close() => Dispatcher.UIThread.Post(() => _window?.Close()); + + /// Shows now; on the window's thread. + internal SettingsWindow ShowNow(SettingsForm form) + { + if (_window is { } open) + { + open.Load(form); + open.Activate(); + return open; + } + + var window = new SettingsWindow(form); + window.Closed += (_, _) => + { + if (ReferenceEquals(_window, window)) + { + _window = null; + } + + // The keyboard goes back to the client, as it does when a cell screen closes. + Owner?.Activate(); + }; + _window = window; + if (Owner is { IsVisible: true } owner) + { + window.Show(owner); + } + else + { + window.Show(); + } + + return window; + } +} diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs new file mode 100644 index 00000000..bbd4faf6 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -0,0 +1,720 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Controls.Shapes; +using Avalonia.Input; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Styling; +using Avalonia.Themes.Fluent; +using Avalonia.Threading; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Avalonia; + +/// +/// The desktop's settings window, generated from the declared sections (): a search box, +/// the sections down the left with match counts while searching, and the chosen section's fields on the right under +/// their group headings — each with its label, its help, the native control for its kind, a dot while it differs +/// from its default and a reset beside it. The meters are a table with a live now column and the paths this +/// connection has received to pick from. +/// +/// Nothing here writes the configuration: every change goes to the form, which commits it through the client's own +/// save funnel on the client's thread. Changes apply as they are made; there is no OK and no Cancel, as there is +/// none on a cell screen. A section that declares no fields is listed and opens its own cell screen. +/// +/// +internal sealed class SettingsWindow : Window +{ + private readonly TextBox _search; + private readonly ListBox _sections; + private readonly StackPanel _page; + private readonly ScrollViewer _scroller; + private readonly List _refreshers = []; + private readonly DispatcherTimer _clock; + private readonly Dictionary _controls = new(StringComparer.Ordinal); + private readonly Dictionary _resets = new(StringComparer.Ordinal); + private readonly Dictionary _badges = new(StringComparer.Ordinal); + private readonly List<(StatusMeter Meter, TextBlock Now)> _meterNow = []; + private SettingsForm _form; + private IReadOnlyList _matches = []; + private string? _shown; + private bool _syncing; + private bool _choosing; + private int _meterRows = -1; + + public SettingsWindow(SettingsForm form) + { + _form = form; + Title = "Settings"; + Width = 960; + Height = 680; + MinWidth = 640; + MinHeight = 420; + WindowStartupLocation = WindowStartupLocation.CenterOwner; + Styles.Add(new FluentTheme()); + + _search = new TextBox { PlaceholderText = "Search settings", Margin = new Thickness(16, 14, 16, 10) }; + AutomationProperties.SetName(_search, "Search settings"); + _search.TextChanged += (_, _) => OnQuery(); + DockPanel.SetDock(_search, Dock.Top); + + _sections = new ListBox { Width = 250, Margin = new Thickness(8, 0, 0, 12), Background = Brushes.Transparent }; + _sections.SelectionChanged += (_, _) => OnSectionChosen(); + DockPanel.SetDock(_sections, Dock.Left); + + _page = new StackPanel { Margin = new Thickness(28, 4, 28, 28), Spacing = 2 }; + _scroller = new ScrollViewer { Content = _page, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }; + + var dock = new DockPanel { LastChildFill = true }; + dock.Children.Add(_search); + dock.Children.Add(_sections); + dock.Children.Add(_scroller); + Content = dock; + + _clock = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Background, (_, _) => Tick()); + Opened += (_, _) => _clock.Start(); + Closed += (_, _) => + { + _clock.Stop(); + _form.Changed -= OnChanged; + }; + KeyDown += OnKey; + + Load(form); + } + + /// The section on the right, by id. + public string? ShownSection => _shown; + + /// The ids of the fields drawn on the right, in order, for a test. + public IReadOnlyList ShownFields { get; private set; } = []; + + /// The control drawn for each field on the right, by field id, for a test. + public IReadOnlyDictionary FieldControls => _controls; + + /// The reset button of each field on the right, by field id, for a test. + public IReadOnlyDictionary ResetButtons => _resets; + + /// What each section's row says beside its title — its match count while searching — by id, for a test. + public IReadOnlyDictionary SectionBadges => + _badges.ToDictionary(b => b.Key, b => b.Value.Text ?? string.Empty, StringComparer.Ordinal); + + /// The search box. + public TextBox SearchBox => _search; + + /// The section list. + public ListBox SectionList => _sections; + + /// The meter table, for a test: a heading row and one row per meter. + public Grid? MeterGrid { get; private set; } + + /// Shows , on its initial section, replacing the form shown before. + public void Load(SettingsForm form) + { + _form.Changed -= OnChanged; + _form = form; + _form.Changed += OnChanged; + RequestedThemeVariant = form.IsDark ? ThemeVariant.Dark : ThemeVariant.Light; + _shown = null; + _matches = _form.Search(_search.Text); + BuildSectionList(); + Choose(form.Section(form.Initial) is { } initial && SettingsForm.IsDeclared(initial) + ? initial.Id + : form.Sections.FirstOrDefault(SettingsForm.IsDeclared)?.Id); + } + + // ── the section list ───────────────────────────────────────────────────────────────────────── + + private IEnumerable Items => _sections.ItemsSource as IEnumerable ?? []; + + private void BuildSectionList() + { + _badges.Clear(); + var items = new List(); + foreach (var section in _form.Sections) + { + var title = new TextBlock { Text = section.Title, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; + var badge = new TextBlock { Opacity = 0.7, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8, 0, 0, 0) }; + _badges[section.Id] = badge; + var row = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; + row.Children.Add(title); + Grid.SetColumn(badge, 1); + row.Children.Add(badge); + var item = new ListBoxItem { Content = row, Tag = section.Id, Padding = new Thickness(12, 9) }; + ToolTip.SetTip(item, SettingsForm.IsDeclared(section) ? section.Key : $"Opens the {section.Key} screen"); + items.Add(item); + } + + _choosing = true; + _sections.ItemsSource = items; + _choosing = false; + UpdateBadges(); + } + + private void UpdateBadges() + { + var counts = SettingsSearch.CountBySection(_matches); + var searching = Searching; + foreach (var section in _form.Sections) + { + var count = counts.GetValueOrDefault(section.Id); + _badges[section.Id].Text = searching + ? count.ToString(CultureInfo.InvariantCulture) + : SettingsForm.IsDeclared(section) ? string.Empty : "↗"; + if (Items.FirstOrDefault(i => Equals(i.Tag, section.Id)) is { } item) + { + item.Opacity = searching && count == 0 ? 0.45 : 1; + } + } + } + + private void OnSectionChosen() + { + if (_choosing || _sections.SelectedItem is not ListBoxItem { Tag: string id } || _form.Section(id) is not { } section) + { + return; + } + + if (!SettingsForm.IsDeclared(section)) + { + // Not drawn here yet: its own screen is the way to it, and this window gets out of its way. + Select(_shown); + _form.OpenScreen(id); + return; + } + + if (!string.Equals(id, _shown, StringComparison.Ordinal)) + { + Choose(id); + } + } + + private void Choose(string? id) + { + _shown = id; + Select(id); + BuildPage(); + } + + private void Select(string? id) + { + _choosing = true; + _sections.SelectedItem = Items.FirstOrDefault(i => Equals(i.Tag, id)); + _choosing = false; + } + + // ── search ─────────────────────────────────────────────────────────────────────────────────── + + private bool Searching => !string.IsNullOrWhiteSpace(_search.Text); + + private void OnQuery() + { + _matches = _form.Search(_search.Text); + UpdateBadges(); + if (Searching + && !_matches.Any(m => m.Field is not null && m.Section.Id == _shown) + && _matches.FirstOrDefault(m => m.Field is not null) is { } first) + { + // The section on show has nothing matching: go to the first that has. + Choose(first.Section.Id); + return; + } + + BuildPage(); + } + + // ── the page ───────────────────────────────────────────────────────────────────────────────── + + private void BuildPage() + { + _page.Children.Clear(); + _refreshers.Clear(); + _controls.Clear(); + _resets.Clear(); + _meterNow.Clear(); + MeterGrid = null; + _meterRows = -1; + if (_shown is null || _form.Section(_shown) is not { } section) + { + ShownFields = []; + return; + } + + _page.Children.Add(new TextBlock { Text = section.Title, FontSize = 24, FontWeight = FontWeight.SemiBold, Margin = new Thickness(0, 0, 0, 2) }); + if (section.Key is { } key) + { + _page.Children.Add(new TextBlock { Text = $"{key} in the client · changes apply as you make them", Opacity = 0.7, Margin = new Thickness(0, 0, 0, 6) }); + } + + var visible = Searching + ? section.Fields.Where(f => _matches.Any(m => ReferenceEquals(m.Field, f))).ToList() + : section.Fields.ToList(); + if (visible.Count == 0) + { + _page.Children.Add(new TextBlock { Text = "No setting here matches the search.", Opacity = 0.7, Margin = new Thickness(0, 16, 0, 0) }); + } + + string? group = null; + foreach (var field in visible) + { + if (field.Group is { } heading && !string.Equals(heading, group, StringComparison.Ordinal)) + { + group = heading; + _page.Children.Add(new TextBlock + { + Text = heading, + FontSize = 15, + FontWeight = FontWeight.SemiBold, + Margin = new Thickness(0, 18, 0, 4), + Foreground = Accent, + }); + } + + _page.Children.Add(field is ListField { Id: BuiltInSettings.MetersField } meters ? MeterTable(meters) : FieldRow(field)); + } + + ShownFields = visible.Select(f => f.Id).ToList(); + } + + /// The accent the changed dot and headings wear: Fluent's own, for the theme variant. + private SolidColorBrush Accent => new(_form.IsDark ? Color.Parse("#60cdff") : Color.Parse("#005fb8")); + + /// One field: label and help on the left, its control, then the changed dot and the reset. + private Grid FieldRow(SettingsField field) + { + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto,Auto"), Margin = new Thickness(0, 4), MinHeight = 44 }; + + var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Spacing = 1, Margin = new Thickness(0, 0, 16, 0) }; + words.Children.Add(new TextBlock { Text = Capitalise(field.Label), FontSize = 14, TextWrapping = TextWrapping.Wrap }); + if (field.Help is { } help) + { + words.Children.Add(new TextBlock { Text = Capitalise(help), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + } + + grid.Children.Add(words); + + var control = ControlFor(field); + control.VerticalAlignment = VerticalAlignment.Center; + AutomationProperties.SetName(control, field.Label); + Grid.SetColumn(control, 1); + grid.Children.Add(control); + _controls[field.Id] = control; + + grid.Children.Add(ChangedMark(field, column: 2)); + return grid; + } + + /// The dot and reset button for , shown only while it differs from its default. + private StackPanel ChangedMark(SettingsField field, int column) + { + var dot = new Ellipse { Width = 8, Height = 8, Fill = Accent, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(14, 0, 8, 0) }; + ToolTip.SetTip(dot, "Changed from its default"); + var reset = new Button { Content = "Reset", Padding = new Thickness(10, 3), VerticalAlignment = VerticalAlignment.Center }; + ToolTip.SetTip(reset, $"Back to the default: {SettingsForm.DefaultText(field)}"); + AutomationProperties.SetName(reset, $"Reset {field.Label}"); + reset.Click += (_, _) => _form.Reset(field); + _resets[field.Id] = reset; + + var panel = new StackPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center, MinWidth = 100 }; + panel.Children.Add(dot); + panel.Children.Add(reset); + Grid.SetColumn(panel, column); + + void Refresh() + { + var changed = !_form.IsDefault(field); + dot.Opacity = changed ? 1 : 0; + reset.IsVisible = changed; + } + + Refresh(); + _refreshers.Add(Refresh); + return panel; + } + + /// The native control for a field's kind, wired to the form and refreshed from it. + private Control ControlFor(SettingsField field) + { + switch (field) + { + case BoolField when field.Binding is SettingBinding flag: + { + var toggle = new ToggleSwitch { OnContent = "On", OffContent = "Off", IsChecked = _form.Get(flag) }; + toggle.IsCheckedChanged += (_, _) => + { + if (!_syncing && toggle.IsChecked is { } on && on != _form.Get(flag)) + { + _form.Set(flag, on); + } + }; + _refreshers.Add(() => toggle.IsChecked = _form.Get(flag)); + return toggle; + } + + case NumberField number when field.Binding is SettingBinding count: + { + var box = new NumericUpDown + { + Minimum = number.Minimum, + Maximum = number.Maximum, + Increment = 1, + FormatString = "0", + Value = _form.Get(count), + Width = 150, + ClipValueToMinMax = true, + }; + box.ValueChanged += (_, e) => + { + if (!_syncing && e.NewValue is { } value && (int)value != _form.Get(count)) + { + _form.SetNumber(number, (int)value); + } + }; + _refreshers.Add(() => + { + if (!box.IsKeyboardFocusWithin) + { + box.Value = _form.Get(count); + } + }); + return box; + } + + case ChoiceField choice when field.Binding is SettingBinding named: + { + var combo = new ComboBox { ItemsSource = choice.Choices, SelectedItem = _form.Get(named), MinWidth = 180 }; + combo.SelectionChanged += (_, _) => + { + if (!_syncing && combo.SelectedItem is string value && value != _form.Get(named)) + { + _form.Set(named, value); + } + }; + _refreshers.Add(() => combo.SelectedItem = _form.Get(named)); + return combo; + } + + case ColourField colour when field.Binding is SettingBinding named: + { + var swatches = colour.Names.Select(Swatch).ToList(); + var combo = new ComboBox { ItemsSource = swatches, MinWidth = 180 }; + void Pick() => combo.SelectedItem = swatches.FirstOrDefault(c => Equals(c.Tag, _form.Get(named))); + Pick(); + combo.SelectionChanged += (_, _) => + { + if (!_syncing && combo.SelectedItem is Control { Tag: string value } && value != _form.Get(named)) + { + _form.Set(named, value); + } + }; + _refreshers.Add(Pick); + return combo; + } + + case TextField text when field.Binding is SettingBinding optional: + { + var box = new TextBox { Text = _form.Get(optional) ?? string.Empty, Width = 260 }; + if (text.Masked) + { + box.PasswordChar = '•'; + } + + if (text.MaxLength is { } max) + { + box.MaxLength = max; + } + + void Commit() + { + if (!_syncing && (box.Text ?? string.Empty) != (_form.Get(optional) ?? string.Empty)) + { + _form.SetText(text, box.Text); + } + } + + box.LostFocus += (_, _) => Commit(); + box.KeyDown += (_, e) => + { + if (e.Key == Key.Enter) + { + Commit(); + e.Handled = true; + } + }; + _refreshers.Add(() => + { + if (!box.IsKeyboardFocusWithin) + { + box.Text = _form.Get(optional) ?? string.Empty; + } + }); + return box; + } + + default: + return new TextBlock { Text = "set on its own screen", Opacity = 0.7 }; + } + } + + private static StackPanel Swatch(string name) + { + var panel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Tag = name }; + if (Color.TryParse(name, out var colour)) + { + panel.Children.Add(new Border { Width = 14, Height = 14, CornerRadius = new CornerRadius(3), Background = new SolidColorBrush(colour) }); + } + + panel.Children.Add(new TextBlock { Text = name }); + return panel; + } + + // ── the meter table ────────────────────────────────────────────────────────────────────────── + + private StackPanel MeterTable(ListField field) + { + var outer = new StackPanel { Spacing = 8, Margin = new Thickness(0, 4, 0, 4) }; + + var top = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; + var words = new StackPanel { Spacing = 1 }; + words.Children.Add(new TextBlock { Text = Capitalise(field.Label), FontSize = 14 }); + if (field.Help is { } help) + { + words.Children.Add(new TextBlock { Text = Capitalise(help), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + } + + top.Children.Add(words); + top.Children.Add(ChangedMark(field, column: 1)); + outer.Children.Add(top); + + var received = _form.Received(); + var paths = received.Select(r => r.Path).ToList(); + var meters = _form.Meters(field); + _meterRows = meters.Count; + + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("110,*,*,100,Auto"), ColumnSpacing = 8, RowSpacing = 6 }; + MeterGrid = grid; + _controls[field.Id] = grid; + string[] headings = ["Label", "Value path", "Maximum path", "Now"]; + grid.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); + for (var c = 0; c < headings.Length; c++) + { + var heading = new TextBlock { Text = headings[c], FontSize = 12, FontWeight = FontWeight.SemiBold, Opacity = 0.78 }; + Grid.SetColumn(heading, c); + grid.Children.Add(heading); + } + + AutoCompleteBox? lastPath = null; + void Commit() => _form.SetMeters(field, meters); + + for (var i = 0; i < meters.Count; i++) + { + var meter = meters[i]; + var row = i + 1; + grid.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); + + var label = new TextBox { Text = meter.Label, MaxLength = StatusMeter.MaxLabelLength }; + AutomationProperties.SetName(label, $"meter {row} label"); + label.LostFocus += (_, _) => + { + if ((label.Text ?? string.Empty) != meter.Label) + { + meter.Label = label.Text ?? string.Empty; + Commit(); + } + }; + + var value = PathBox(meter.Value, paths, $"meter {row} value path", v => meter.Value = v ?? string.Empty, Commit); + var max = PathBox(meter.Max, paths, $"meter {row} maximum path", v => meter.Max = v, Commit); + value.GotFocus += (_, _) => lastPath = value; + max.GotFocus += (_, _) => lastPath = max; + + var now = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontWeight = FontWeight.SemiBold }; + _meterNow.Add((meter, now)); + + var remove = new Button { Content = "✕", Padding = new Thickness(9, 3) }; + ToolTip.SetTip(remove, $"Remove {meter.Label}"); + AutomationProperties.SetName(remove, $"Remove meter {meter.Label}"); + var index = i; + remove.Click += (_, _) => + { + meters.RemoveAt(index); + Commit(); + }; + + Control[] cells = [label, value, max, now, remove]; + for (var c = 0; c < cells.Length; c++) + { + Grid.SetRow(cells[c], row); + Grid.SetColumn(cells[c], c); + grid.Children.Add(cells[c]); + } + } + + outer.Children.Add(grid); + + var add = new Button { Content = "+ Meter", HorizontalAlignment = HorizontalAlignment.Left }; + AutomationProperties.SetName(add, "Add a meter"); + add.Click += (_, _) => + { + meters.Add(new StatusMeter { Label = "new" }); + Commit(); + }; + outer.Children.Add(add); + + // What this connection has received, to pick a path from: a click puts it in the path box last used. + var box = new StackPanel { Spacing = 2 }; + box.Children.Add(new TextBlock { Text = "Received on this connection", FontSize = 12, FontWeight = FontWeight.SemiBold, Opacity = 0.78, Margin = new Thickness(0, 2, 0, 2) }); + if (received.Count == 0) + { + box.Children.Add(new TextBlock { Text = "Nothing yet — a meter shows once its value arrives.", FontSize = 12, Opacity = 0.72 }); + } + + foreach (var item in received.Take(40)) + { + var line = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; + line.Children.Add(new TextBlock { Text = item.Path, FontFamily = FontFamily.Parse("monospace"), FontSize = 12 }); + var v = new TextBlock { Text = item.Value, FontSize = 12, Opacity = 0.72, Margin = new Thickness(16, 0, 0, 0) }; + Grid.SetColumn(v, 1); + line.Children.Add(v); + var pick = new Button + { + Content = line, + Background = Brushes.Transparent, + Padding = new Thickness(6, 2), + HorizontalAlignment = HorizontalAlignment.Stretch, + HorizontalContentAlignment = HorizontalAlignment.Stretch, + }; + ToolTip.SetTip(pick, "Use this path in the path box you were last in"); + pick.Click += (_, _) => + { + if (lastPath is { } target) + { + target.Text = item.Path; + target.Focus(); + } + }; + box.Children.Add(pick); + } + + outer.Children.Add(new Border + { + Child = box, + BorderThickness = new Thickness(1), + BorderBrush = new SolidColorBrush(_form.IsDark ? Color.Parse("#46464e") : Color.Parse("#c8c8d0")), + CornerRadius = new CornerRadius(6), + Padding = new Thickness(10, 6, 10, 8), + Margin = new Thickness(0, 4, 0, 0), + }); + + Tick(); + return outer; + } + + private static AutoCompleteBox PathBox(string? text, IReadOnlyList paths, string name, Action set, Action commit) + { + var box = new AutoCompleteBox + { + Text = text ?? string.Empty, + ItemsSource = paths, + FilterMode = AutoCompleteFilterMode.ContainsOrdinal, + MinimumPrefixLength = 0, + HorizontalAlignment = HorizontalAlignment.Stretch, + }; + AutomationProperties.SetName(box, name); + var held = string.IsNullOrWhiteSpace(text) ? null : text; + void Commit() + { + var now = string.IsNullOrWhiteSpace(box.Text) ? null : box.Text.Trim(); + if (!string.Equals(now, held, StringComparison.Ordinal)) + { + held = now; + set(now); + commit(); + } + } + + box.LostFocus += (_, _) => Commit(); + box.KeyDown += (_, e) => + { + if (e.Key == Key.Enter) + { + Commit(); + } + }; + return box; + } + + /// The meters' now column, re-read each second while the window is open. + private void Tick() + { + foreach (var (meter, now) in _meterNow) + { + var text = _form.Now(meter); + now.Text = text ?? "waiting"; + now.Opacity = text is null ? 0.6 : 1; + } + } + + // ── changes landing ────────────────────────────────────────────────────────────────────────── + + /// Raised on the client's thread once a change has landed; the page catches up on this one. + private void OnChanged() => Dispatcher.UIThread.Post(Refresh); + + /// Re-reads every value and indicator on the page. A meter added or removed rebuilds the page, whose rows moved. + internal void Refresh() + { + if (_meterRows >= 0 + && _form.Section(_shown ?? string.Empty)?.Fields.OfType().FirstOrDefault() is { } meters + && _form.Meters(meters).Count != _meterRows) + { + var offset = _scroller.Offset; + BuildPage(); + _scroller.Offset = offset; + return; + } + + _syncing = true; + try + { + foreach (var refresh in _refreshers) + { + refresh(); + } + } + finally + { + _syncing = false; + } + } + + private void OnKey(object? sender, KeyEventArgs e) + { + if (e.Key == Key.Escape) + { + if (Searching) + { + _search.Text = string.Empty; + } + else + { + Close(); + } + + e.Handled = true; + } + else if (e.Key == Key.F && e.KeyModifiers == KeyModifiers.Control) + { + _search.Focus(); + _search.SelectAll(); + e.Handled = true; + } + } + + private static string Capitalise(string text) => + text.Length == 0 ? text : char.ToUpper(text[0], CultureInfo.InvariantCulture) + text[1..]; +} diff --git a/src/SharpMUTerm.Avalonia/SharpMUTerm.Avalonia.csproj b/src/SharpMUTerm.Avalonia/SharpMUTerm.Avalonia.csproj index bb9bcb91..eac0ea6f 100644 --- a/src/SharpMUTerm.Avalonia/SharpMUTerm.Avalonia.csproj +++ b/src/SharpMUTerm.Avalonia/SharpMUTerm.Avalonia.csproj @@ -21,6 +21,7 @@ + diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 72178d12..e973767b 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -56,5 +56,8 @@ internal static class WindowHost // A live region a screen reader watches; the terminal has none, and --plain is its answer. Announcer = driver.Announcer, ScreenIsSeen = true, + + // F7 and F8 open a native settings window generated from their declarations; the rest stay cell screens. + NativeSettings = driver.Settings, }; } diff --git a/src/SharpMUTerm.Client/Settings/SettingsForm.cs b/src/SharpMUTerm.Client/Settings/SettingsForm.cs new file mode 100644 index 00000000..f6d367ae --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/SettingsForm.cs @@ -0,0 +1,211 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Settings; + +/// A value the focused connection's game data holds, as a path a meter can name and its text now. +/// The path, as a meter names it (Char.Vitals.hp). +/// What it holds now. +public sealed record ReceivedValue(string Path, string Value); + +/// +/// The declared settings as a form a host draws with its own controls: the sections in their order, every value +/// read through its field's , and every change committed through one delegate the +/// client supplies — the same funnel its cell screens commit through, so a change made here is saved, re-syncs the +/// bars and reloads automation exactly as one made on F7 does. Nothing here knows what a control is. +/// +/// Threads. A host may read values on its own thread: a declared value is a scalar, or a list that is only +/// ever replaced wholesale (this form never edits one in place), so a read never meets a half-made change. Every +/// write goes through commit, which the client runs on its own thread, and is raised +/// there once a change has landed. +/// +/// +public sealed class SettingsForm +{ + private readonly AppConfiguration _config; + private readonly Action _commit; + private readonly Action _openScreen; + private readonly Func> _received; + private readonly Func _now; + + /// Every settings section, in order — declared ones and the ones only listed by title. + /// The live configuration the values are read from and written to. + /// Runs a change to the configuration through the client's save funnel. + /// Opens a section's own screen, by id — the way to a section this form cannot draw. + /// The section to show first. + /// Whether the client's theme is a dark one, so the host's controls can follow it. + /// The focused connection's game data as meter paths, or null for none. + /// What a meter reads now (412/500), or null while its value has not arrived. + public SettingsForm( + IReadOnlyList sections, + AppConfiguration config, + Action commit, + Action openScreen, + string initial, + bool isDark, + Func>? received = null, + Func? now = null) + { + ArgumentNullException.ThrowIfNull(sections); + ArgumentNullException.ThrowIfNull(config); + ArgumentNullException.ThrowIfNull(commit); + ArgumentNullException.ThrowIfNull(openScreen); + Sections = sections; + _config = config; + _commit = commit; + _openScreen = openScreen; + Initial = initial; + IsDark = isDark; + _received = received ?? (() => Array.Empty()); + _now = now ?? (_ => null); + } + + /// Every section, in order. + public IReadOnlyList Sections { get; } + + /// The id of the section shown first. + public string Initial { get; } + + /// Whether the client's theme is dark. + public bool IsDark { get; } + + /// Raised on the client's thread after a change made through this form has landed. + public event Action? Changed; + + /// Whether a section declares its fields, and so can be drawn here; the rest open their own screen. + public static bool IsDeclared(SettingsSectionContribution section) + { + ArgumentNullException.ThrowIfNull(section); + return section.Fields.Count > 0; + } + + /// A section by id, or null. + public SettingsSectionContribution? Section(string id) => + Sections.FirstOrDefault(s => string.Equals(s.Id, id, StringComparison.Ordinal)); + + /// The value of now. + public T Get(SettingBinding binding) + { + ArgumentNullException.ThrowIfNull(binding); + return binding.Get(_config); + } + + /// Whether holds its default — what decides its changed dot and its reset. + public bool IsDefault(SettingsField field) + { + ArgumentNullException.ThrowIfNull(field); + return field.Binding?.IsDefault(_config) ?? true; + } + + /// The default of as text, for a reset button's tooltip. + public static string DefaultText(SettingsField field) + { + ArgumentNullException.ThrowIfNull(field); + return field.Binding?.DefaultText ?? string.Empty; + } + + /// + /// Writes through the save funnel. Numbers and texts go through + /// and , which hold them to the rules the cell screen's field applies first, so neither + /// surface can store what the other would refuse. + /// + public void Set(SettingBinding binding, T value) + { + ArgumentNullException.ThrowIfNull(binding); + _commit(() => binding.Set(_config, value)); + } + + /// Writes a number, held to 's bounds. + public void SetNumber(NumberField field, int value) + { + ArgumentNullException.ThrowIfNull(field); + if (field.Binding is SettingBinding binding) + { + Set(binding, Math.Clamp(value, field.Minimum, field.Maximum)); + } + } + + /// Writes a text; empty is stored as no value, the cell screen's optional-field rule. + public void SetText(TextField field, string? value) + { + ArgumentNullException.ThrowIfNull(field); + if (field.Binding is not SettingBinding binding) + { + return; + } + + var text = string.IsNullOrWhiteSpace(value) ? null : value.Trim(); + if (text is not null && field.MaxLength is { } max && text.Length > max) + { + text = text[..max]; + } + + Set(binding, text); + } + + /// Puts back to its default, through the funnel, as the cell screen's r does. + public void Reset(SettingsField field) + { + ArgumentNullException.ThrowIfNull(field); + if (field.Binding is { } binding) + { + _commit(() => binding.Reset(_config)); + } + } + + /// The meters now — a copy, so a host can edit it and hand it back to . + public List Meters(ListField field) + { + ArgumentNullException.ThrowIfNull(field); + return field.Binding is SettingBinding> binding + ? binding.Get(_config).Select(Copy).ToList() + : new List(); + } + + /// + /// Replaces the meters with (copied, labels clipped, empty maximum paths dropped), as + /// one change through the funnel. The list in the configuration is replaced, never edited in place. + /// + public void SetMeters(ListField field, IEnumerable meters) + { + ArgumentNullException.ThrowIfNull(field); + ArgumentNullException.ThrowIfNull(meters); + if (field.Binding is not SettingBinding> binding) + { + return; + } + + var list = meters.Select(m => new StatusMeter + { + Label = StatusMeter.Clip(m.Label.Trim()), + Value = m.Value.Trim(), + Max = string.IsNullOrWhiteSpace(m.Max) ? null : m.Max.Trim(), + }).ToList(); + Set(binding, list); + } + + /// The focused connection's game data as paths a meter can name, sorted by path. + public IReadOnlyList Received() => _received(); + + /// What reads now, or null while its value has not arrived. + public string? Now(StatusMeter meter) + { + ArgumentNullException.ThrowIfNull(meter); + return _now(meter); + } + + /// The settings search, over these sections: the cell surface's own matching. + public IReadOnlyList Search(string? query) => SettingsSearch.Find(Sections, query); + + /// Opens a section's own screen, by id. + public void OpenScreen(string sectionId) + { + ArgumentNullException.ThrowIfNull(sectionId); + _openScreen(sectionId); + } + + /// Raises ; the client calls it once a committed change has landed. + public void NotifyChanged() => Changed?.Invoke(); + + private static StatusMeter Copy(StatusMeter m) => new() { Label = m.Label, Value = m.Value, Max = m.Max }; +} diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index be14b3b5..1e8b37bb 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -91,6 +91,13 @@ internal sealed record ClientHost /// public required bool ScreenIsSeen { get; init; } + /// + /// Draws the declared settings sections (F7, F8) with the host's own controls, or null for a host whose settings + /// are the cell screens. Only a section that declares its fields goes here; the others keep their cell screen. + /// Null in the terminal, the snapshot, the tests and the parity harness, so every cell frame is unchanged. + /// + public required INativeSettings? NativeSettings { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -128,6 +135,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Presence = () => new DiscordIpc(), Announcer = null, ScreenIsSeen = true, + NativeSettings = null, }; /// @@ -150,6 +158,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Presence = null, Announcer = null, ScreenIsSeen = true, + NativeSettings = null, }; /// diff --git a/src/SharpMUTerm.Tui/Hosting/INativeSettings.cs b/src/SharpMUTerm.Tui/Hosting/INativeSettings.cs new file mode 100644 index 00000000..7973e23e --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/INativeSettings.cs @@ -0,0 +1,20 @@ +using SharpMUTerm.Client.Settings; + +namespace SharpMUTerm.Tui; + +/// +/// A host that draws the declared settings with its own controls (the desktop window's settings window) instead of +/// the cell screens. The client hands it a ; everything the form changes is committed +/// back through the client's own save funnel, so the host only draws. +/// +internal interface INativeSettings +{ + /// + /// Shows , or brings an open settings window forward on its + /// section. Called on the client's thread; the host marshals to its own. + /// + void Show(SettingsForm form); + + /// Closes the settings window if it is open. Called on the client's thread. + void Close(); +} diff --git a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs index 38a21cae..e283de3e 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs @@ -645,16 +645,21 @@ private static string MeterRow(StatusMeter meter, GameDataStore? data, ScreenFie } /// The now column: 412/500, 412 with no maximum, or . - internal static string Now(StatusMeter meter, GameDataStore? data) + internal static string Now(StatusMeter meter, GameDataStore? data) => + NowText(meter, data) is { } text + ? $"[bold {ScreenPalette.Value}]{Escape(text)}[/]" + : $"[{Muted}]{Waiting}[/]"; + + /// The now column as plain text, or null while the meter's value has not arrived. + internal static string? NowText(StatusMeter meter, GameDataStore? data) { if (data is null || StatusMeter.Read(data, meter.Value) is not { } value) { - return $"[{Muted}]{Waiting}[/]"; + return null; } var max = string.IsNullOrWhiteSpace(meter.Max) ? null : StatusMeter.Read(data, meter.Max); - var text = StatusMeter.Fit(value, 5) + (max is null ? string.Empty : "/" + StatusMeter.Fit(max, 5)); - return $"[bold {ScreenPalette.Value}]{Escape(text)}[/]"; + return StatusMeter.Fit(value, 5) + (max is null ? string.Empty : "/" + StatusMeter.Fit(max, 5)); } /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs index 945d294f..73ff3a99 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs @@ -1,6 +1,8 @@ using SharpMUTerm.Client.Contributions; using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Text; namespace SharpMUTerm.Tui; @@ -55,6 +57,12 @@ private bool GoToSetting(SettingsMatch match) return true; } + // A declared section is the host's own settings window where the host has one. + if (TryOpenNativeSettings(match.Section)) + { + return true; + } + if (!Enum.TryParse(match.Section.Key, out var key) || SettingsScreens().FirstOrDefault(s => s.Key == key) is not { Open: not null } screen) { @@ -79,6 +87,86 @@ private bool GoToSetting(SettingsMatch match) _ => null, }; + /// + /// Opens the settings screen on : the host's own settings window when the host has one and + /// the screen's section declares its fields, otherwise the cell screen, toggled as it always was. Every way in — + /// the F-key, ⌃P's SETTINGS entries — comes through here, so a window host's F7 never shows the cell overlay. + /// + private void OpenSettingsScreen(ConsoleKey key, Func open) + { + var name = key.ToString(); + var section = _contributions.SettingsSections.Ordered + .FirstOrDefault(s => string.Equals(s.Key, name, StringComparison.Ordinal)); + if (!TryOpenNativeSettings(section)) + { + _settings.Toggle(key, open); + } + } + + /// + /// Shows in the host's settings window, closing any cell screen first; false when the + /// host has none (the terminal, the snapshot, the tests) or the section declares no fields, which keep their + /// cell screens. + /// + private bool TryOpenNativeSettings(SettingsSectionContribution? section) + { + if (Host.NativeSettings is not { } native || section is null || !SettingsForm.IsDeclared(section)) + { + return false; + } + + _settings.CloseAll(); + native.Show(NativeSettingsForm(section.Id)); + return true; + } + + /// + /// The declared settings as a form a host draws natively, opening on . Every change it + /// makes goes through a over — the cell screens' own + /// funnel — on this thread, so it is saved and reaches the bars and live sessions exactly as an F7 edit does. The + /// meter table reads the game data of the window focused when the form opened (), + /// captured here because the store is thread-safe and the focus is not. + /// + internal SettingsForm NativeSettingsForm(string initial) + { + var edits = new ScreenEdits(SaveConfiguration); + var data = SettingsGameData(); + SettingsForm? form = null; + form = new SettingsForm( + _contributions.SettingsSections.Ordered, + _config, + change => OnUiThread(() => + { + edits.Apply(change); + form?.NotifyChanged(); + }), + id => OnUiThread(() => OpenSectionScreen(id)), + initial, + ThemeIsDark(), + () => OptionsScreenRenderer.ReceivedPaths(data).Select(r => new ReceivedValue(r.Path, r.Value)).ToList(), + meter => OptionsScreenRenderer.NowText(meter, data)); + return form; + } + + /// + /// The settings window's way to a section it cannot draw: close the window and open that section's own screen. + /// + private void OpenSectionScreen(string id) + { + Host.NativeSettings?.Close(); + if (_contributions.SettingsSections.Find(id) is { } section) + { + GoToSetting(new SettingsMatch(section, null, section.Title, -1, 0)); + } + } + + /// Whether the client's theme is a dark one: its default background is darker than mid-grey. + private bool ThemeIsDark() + { + var bg = _theme.Resolve(TerminalColor.Default, isBackground: true); + return (0.2126 * bg.R) + (0.7152 * bg.G) + (0.0722 * bg.B) < 128; + } + /// Whether the settings search is up, for a test. internal bool SettingsSearchIsOpen => _settings.IsSearching; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index d2d6cf54..2581d78d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -6878,7 +6878,7 @@ private void RegisterFocusReportTab() { if (!ComposerIsInTheWay("a settings screen")) { - _settings.Toggle(key, open); + OpenSettingsScreen(key, open); } return true; @@ -8376,7 +8376,7 @@ private bool RunBuiltInCommand(string id) var view = id[ScreenCommandPrefix.Length..]; if (SettingsScreens().FirstOrDefault(s => s.Views[0] == view) is { Open: not null } screen) { - _settings.Toggle(screen.Key, screen.Open); + OpenSettingsScreen(screen.Key, screen.Open); return true; } diff --git a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs index 5cc3b447..d8639ebb 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs @@ -46,7 +46,7 @@ public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string na using var driver = new AvaloniaConsoleDriver(Width, Height); await using (var window = new SharpMUTermApp( DemoScene.Build(), - WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, RunsInline = true })) + WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, RunsInline = true })) { window.RenderSnapshot(view); } @@ -83,7 +83,7 @@ public async Task EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning(string n using var driver = new AvaloniaConsoleDriver(Width, Height); await using var window = new SharpMUTermApp( DemoScene.Build(), - WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null }); + WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null }); window.OnUiThread(() => _ = window.RenderSnapshot(view)); var loop = new Thread(() => window.Run([])) { IsBackground = true }; loop.Start(); diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs new file mode 100644 index 00000000..d37b677a --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -0,0 +1,218 @@ +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Interactivity; +using Avalonia.Threading; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The desktop's settings window (), generated from the declared sections: one native +/// control per field, every edit committed through the form (and so the client's funnel), reset back to the default, +/// the search narrowing the page and counting matches per section, and the meter table's live now column. +/// +public class SettingsWindowTests +{ + private sealed class Harness + { + public AppConfiguration Config { get; } = new(); + + public int Commits { get; set; } + + public List Opened { get; } = []; + + public SettingsForm Form(string initial = "text") + { + SettingsForm? form = null; + form = new SettingsForm( + BuiltInSettings.All, + Config, + change => + { + change(); + Commits++; + form!.NotifyChanged(); + }, + Opened.Add, + initial, + isDark: true, + () => [new ReceivedValue("Char.Vitals.hp", "412"), new ReceivedValue("Char.Vitals.maxhp", "500")], + meter => meter.Value == "Char.Vitals.hp" ? "412/500" : null); + return form; + } + } + + [Test] + public async Task TheWindowBuildsOneControlPerDeclaredField() + { + var (ids, controls) = await Run(new Harness(), "text", window => + (window.ShownFields.ToArray(), window.FieldControls.ToDictionary(c => c.Key, c => c.Value.GetType()))); + + var declared = BuiltInSettings.Text.Fields.Select(f => f.Id).ToArray(); + await Assert.That(ids).IsEquivalentTo(declared); + await Assert.That(controls.Keys).IsEquivalentTo(declared); + await Assert.That(controls["legible"]).IsEqualTo(typeof(ToggleSwitch)); + await Assert.That(controls["tab-width"]).IsEqualTo(typeof(NumericUpDown)); + await Assert.That(controls[BuiltInSettings.MetersField]).IsEqualTo(typeof(Grid)); + } + + [Test] + public async Task AnEditCommitsThroughTheFormAndResetPutsTheDefaultBack() + { + var harness = new Harness(); + var fresh = new AppConfiguration().Text.KeepTextLegible; + var (afterEdit, resetShown, afterReset, resetHidden) = await Run(harness, "text", window => + { + var toggle = (ToggleSwitch)window.FieldControls["legible"]; + toggle.IsChecked = !fresh; + Dispatcher.UIThread.RunJobs(); + var edited = harness.Config.Text.KeepTextLegible; + var shown = window.ResetButtons["legible"].IsVisible; + + window.ResetButtons["legible"].RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); + Dispatcher.UIThread.RunJobs(); + return (edited, shown, harness.Config.Text.KeepTextLegible, !window.ResetButtons["legible"].IsVisible && toggle.IsChecked == fresh); + }); + + await Assert.That(afterEdit).IsEqualTo(!fresh); + await Assert.That(resetShown).IsTrue().Because("a changed field carries its reset"); + await Assert.That(afterReset).IsEqualTo(fresh); + await Assert.That(resetHidden).IsTrue().Because("the toggle shows the default again and the reset goes"); + await Assert.That(harness.Commits).IsEqualTo(2); + } + + [Test] + public async Task ANumberIsCommittedWithinItsBounds() + { + var harness = new Harness(); + var wanted = new AppConfiguration().Input.Rows + 1; + await Run(harness, "input", window => + { + ((NumericUpDown)window.FieldControls["rows"]).Value = 999; + Dispatcher.UIThread.RunJobs(); + ((NumericUpDown)window.FieldControls["rows"]).Value = wanted; + Dispatcher.UIThread.RunJobs(); + return 0; + }); + + await Assert.That(harness.Config.Input.Rows).IsEqualTo(wanted); + await Assert.That(harness.Commits).IsEqualTo(2).Because("999 was clipped to the maximum and committed, then the value"); + } + + [Test] + public async Task TheSearchNarrowsThePageAndCountsEachSection() + { + var (fields, badges, section) = await Run(new Harness(), "input", window => + { + window.SearchBox.Text = "volume"; + Dispatcher.UIThread.RunJobs(); + return (window.ShownFields.ToArray(), window.SectionBadges, window.ShownSection); + }); + + var expected = SettingsSearch.Find(BuiltInSettings.All, "volume"); + await Assert.That(section).IsEqualTo("text").Because("the section on show had nothing matching, so the first that has is shown"); + await Assert.That(fields).IsEquivalentTo(expected.Where(m => m.Section.Id == "text").Select(m => m.Field!.Id).ToArray()); + await Assert.That(badges["text"]).IsEqualTo(expected.Count(m => m.Section.Id == "text").ToString(System.Globalization.CultureInfo.InvariantCulture)); + await Assert.That(badges["input"]).IsEqualTo("0"); + } + + [Test] + public async Task TheMeterTableHasARowPerMeterAndReadsNow() + { + var harness = new Harness(); + harness.Config.Text.StatusMeters = [new StatusMeter { Label = "hp", Value = "Char.Vitals.hp", Max = "Char.Vitals.maxhp" }]; + var (rows, now, rowsAfterAdd) = await Run(harness, "text", window => + { + var grid = window.MeterGrid!; + var rows = grid.RowDefinitions.Count; + var now = grid.Children.OfType().Where(t => Grid.GetRow(t) == 1 && Grid.GetColumn(t) == 3).Select(t => t.Text).Single(); + + var add = window.GetVisualDescendantsOf - private static string WorldTarget(RailWorld world) + public static string TargetFor(RailWorld world) { if (world.Characters.Count == 0) { diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 82ecd577..6390f6ff 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -139,6 +139,14 @@ void Panels(IReadOnlyList panels) void HeaderActions(IReadOnlyList actions) { } + + /// + /// The header band and the connection sidebar, as data, whenever either moves or what it says changes. The cells + /// stay what they are; a host that draws no native chrome ignores this (the default). + /// + void Chrome(ChromeOverlay chrome) + { + } } /// diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs new file mode 100644 index 00000000..6bb0ac92 --- /dev/null +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs @@ -0,0 +1,177 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Tui; + +/// +/// The header band and the connection sidebar as data, for a host that draws them natively over their cells (the +/// window). Both are the view-models the cell header and the cell rail are drawn from (, +/// ), so a native view cannot say anything the cells do not. +/// +/// A click comes back as a target the client itself put in the model, and goes where the same click on the +/// cells goes: a rail target to , the rail's own handler, and the header's palette +/// target to the command surface the ribbon's ☰ opens. Never through , the output +/// panes' handler, and never a command the host spelt: a target that is not in the overlay the client last published +/// is refused. +/// +/// +internal sealed partial class SharpMUTermApp +{ + private ChromeOverlay? _chromeOverlay; + + private Action? _chromeActivate; + + /// + /// Tells the host where the header and the rail are and what they say, when any of it changed. Rides the frame, + /// for ' reason, and the main window's activation, because another window opening over + /// this one (⌃P, a settings screen, the quit prompt) repaints that window and not this one. + /// + private void PublishChrome() + { + if (_pointer is null) + { + return; + } + + var overlay = BuildChromeOverlay(); + if (overlay == _chromeOverlay) + { + return; + } + + _chromeOverlay = overlay; + _pointer.Chrome(overlay); + } + + /// The chrome as it stands. Internal for tests. + internal ChromeOverlay BuildChromeOverlay() + { + _chromeActivate ??= target => OnUiThread(() => ActivateChromeTarget(target)); + var header = BuildHeaderModel(); + var brand = FillHex(AccentPalette[2]); + var palette = new ChromePalette( + brand, + header.World is { } world ? FillHex(world.Accent) : null, + _ink.Accent, + _ink.Draft, + UnreadBadge.TintFor(_ink)); + + // Shown only while the main window is the one in front. Every other window here — the command surface, the + // settings screens, the composer, the quit prompt — is drawn in cells over this one, and a native view over + // the header or the rail would paint over it. + return new ChromeOverlay( + MainWindowInFront(), + CellRectOf(_header), + header, + RailCellRect(), + BuildSidebar(), + palette, + _chromeActivate); + } + + /// + /// Whether no other window of the client's is in front of the main one. Asked of the window system rather than of + /// the window's own active flag, which a window that has never been activated (a headless harness, the first + /// frame) reports false with nothing over it. + /// + private bool MainWindowInFront() => + _system.ActiveWindow is not { } front || ReferenceEquals(front, _window); + + /// + /// The sidebar's rectangle: its whole column, top to bottom, which is what the rail's cells (and the plane under + /// them) occupy — the rail control itself is only as tall as its rows. The control's own when there is no column yet. + /// + private PaneRect RailCellRect() + { + var rows = CellRectOf(_rail); + var column = _railColumn is null ? default : CellRectOf(_railColumn); + return column.Width > 0 && column.Height >= rows.Height ? column : rows; + } + + /// A control's arranged rectangle in desktop cells, or empty while it has none. + private PaneRect CellRectOf(SharpConsoleUI.Controls.IWindowControl control) + { + if (_window.GetLayoutNode(control) is not { } node) + { + return default; + } + + var origin = ContentOrigin(); + var bounds = node.AbsoluteBounds; + return new PaneRect(origin.X + bounds.X, origin.Y + bounds.Y, bounds.Width, bounds.Height); + } + + /// + /// A click on a native header or sidebar, by the target the client put in the model. Internal so a test can drive + /// it the way a host does; returns whether the target was one the client offered and was acted on. + /// + internal bool ActivateChromeTarget(string target) + { + var offered = _chromeOverlay ?? BuildChromeOverlay(); + if (!offered.Offers(target)) + { + RefuseCommand($"the header and sidebar never offered {Snippet(target)}"); + return false; + } + + if (target == HeaderModel.PaletteTarget) + { + // Opens, rather than the ☰'s toggle: a search box is clicked to start typing in it, never to close it. + if (!_palette.IsOpen) + { + ToggleMenu(); + } + + return true; + } + + if (target == SidebarModel.AddGameTarget) + { + return DispatchCommand(target); + } + + return DispatchRailTarget(target); + } + + /// What the host was last told about the header and the rail. Internal for tests. + internal ChromeOverlay? ChromeOverlayPublished => _chromeOverlay; +} + +/// +/// The header band and the connection sidebar, for a host that draws them natively over their cells. The cells are +/// drawn as in any host, so a host that draws nothing loses nothing, and the parity test, which compares cells, is +/// unaffected. +/// +/// Whether the main window is in front; while another window is, nothing native may be drawn. +/// The header row's rectangle, in desktop cells. +/// What the header says. +/// The rail's rectangle, in desktop cells: the sidebar column, top to bottom. +/// What the rail says. +/// The client's own colours for the active theme. +/// +/// Acts on a target from or ; safe to call from any thread. The same +/// instance for the life of the app, so an overlay compares equal from frame to frame. +/// +internal sealed record ChromeOverlay( + bool Shown, + PaneRect Header, + HeaderModel HeaderModel, + PaneRect Rail, + SidebarModel Sidebar, + ChromePalette Palette, + Action Activate) +{ + /// Whether is one this overlay offered a click on. + public bool Offers(string target) => + target == HeaderModel.PaletteTarget + || target == HeaderModel.Character?.Target + || Sidebar.Targets().Contains(target, StringComparer.Ordinal); +} + +/// +/// The chrome's own colours as #rrggbb: the brand fill of the ribbon's first segment, the world's fill (or +/// null with no world), the client's accent, the draft pen, and the unread badge. Planes are not here: a host reads +/// those off the frame's cells, so a native view sits on what the cells under it wear. +/// +internal sealed record ChromePalette(string Brand, string? WorldFill, string Accent, string Draft, string Unread); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index d2d6cf54..bd4a7254 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1,5 +1,6 @@ using System.Text; using Microsoft.Extensions.Logging; +using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Palette; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Automation; @@ -1002,6 +1003,7 @@ public SharpMUTermApp( DrawSixelOverlay(buffer); PublishScrollbars(); PublishPanels(); + PublishChrome(); SyncMapSizes(); SyncPanelSizes(); SyncScrollSplitBars(); @@ -1014,6 +1016,10 @@ public SharpMUTermApp( _window.Deactivated += (_, _) => _sixel.Invalidate(); } + // The native chrome stands down while another window is in front, and that window repaints, not this one. + _window.Activated += (_, _) => PublishChrome(); + _window.Deactivated += (_, _) => PublishChrome(); + // Pane drag-and-drop listens at the driver, not at a control: SharpConsoleUI delivers mouse // frames to the control that was pressed (it captures on Button1Pressed), so a control-level // handler would only ever see the *source* pane. The driver stream carries every frame in @@ -7800,7 +7806,14 @@ private static string Ink(string inkHex, string fillHex) => /// character — the workspace's windows with their unread/unsent detail and their own chords. /// Ranking/markup stays in the tested Core/renderer. /// - private IReadOnlyList BuildRail() + private IReadOnlyList BuildRail() => BuildSidebar().Rows(); + + /// + /// The sidebar as a view-model (): the tree 's rows are projected + /// from, plus the window in front and whether the rail is collapsed. The cell rail and the window's native sidebar + /// are both drawn from this, so it is the one place either learns what the sidebar says. + /// + internal SidebarModel BuildSidebar() { var activeKey = ActiveCharacterKey(); @@ -7845,7 +7858,7 @@ private IReadOnlyList BuildRail() index++; } - return RailModel.Build(worlds); + return new SidebarModel(worlds, ActiveWindowId(), _railCollapsed); } /// @@ -13263,11 +13276,56 @@ private void UpdateStatus() /// The design header row: the brand affordance on the left, the active world (with its accent) /// in the middle, and connection/graphics/palette hints on the right. /// - private string HeaderMarkup() + private string HeaderMarkup() => HeaderMarkup(BuildHeaderModel()); + + /// + /// The header as a view-model (): what the band says, with no presentation. The cell + /// header and the window's native header are both drawn from this. + /// + internal HeaderModel BuildHeaderModel() + { + HeaderWorld? world = null; + HeaderCharacter? character = null; + if (ActiveWorld() is { } active) + { + world = new HeaderWorld(active.World.Name, active.Accent); + if (active.Character is { } name) + { + var key = $"{active.World.Name}.{name}"; + character = new HeaderCharacter( + name, + key, + // The rail's dot and this one are one answer: ConnectedCharacters is what the dot and the fraction + // read, and a session's own state adds only "being dialled". + ConnectedCharacters().Contains(key) + ? CharacterPresence.Online + : PresenceOf.State(_sessions.Find(key)?.State) == CharacterPresence.Connecting + ? CharacterPresence.Connecting + : CharacterPresence.Offline, + active.World.Host, + active.World.Port, + active.World.UseTls, + CommandIds.Character(key)); + } + } + + return new HeaderModel( + _palette is { IsOpen: true }, + world, + character, + ConnectedCharacters().Count, + ConfiguredConnections(), + _config.Worlds.Count > 0, + HeaderLogFormat(), + _prefixArmed); + } + + /// The header row's markup, drawn from and nothing else it could disagree with. + private string HeaderMarkup(HeaderModel model) { // The menu affordance opens the command surface (caret flips to ▾ while it's open). The whole // identity cluster is a powerline ribbon — menu ▸ world ▸ character — flowing accent colours. - var caret = _palette is { IsOpen: true } ? "▾" : Glyphs.Menu; + var caret = model.MenuOpen ? "▾" : Glyphs.Menu; var dark = Hex(_theme.Resolve(TerminalColor.Default, isBackground: true)); var headerBg = Hex(_theme.StatusBackground); // The dim chrome the character segment sits on. Derived rather than the literal #3f4859 it was: @@ -13284,16 +13342,16 @@ private string HeaderMarkup() // legible is the text *on* it, so each segment's ink is measured against the fill it lands on. var brandBg = FillHex(AccentPalette[2]); // violet var sb = new System.Text.StringBuilder(); - sb.Append($"[link={MenuScheme}toggle][bold {Ink(dark, brandBg)} on {brandBg}] {caret} muterm [/][/]"); + sb.Append($"[link={HeaderModel.PaletteTarget}][bold {Ink(dark, brandBg)} on {brandBg}] {caret} muterm [/][/]"); var tail = brandBg; - if (ActiveWorld() is { } active) + if (model.World is { } active) { var worldAccent = FillHex(active.Accent); sb.Append($"[{tail} on {worldAccent}]{Glyphs.PowerRight}[/]"); - sb.Append($"[bold {Ink(dark, worldAccent)} on {worldAccent}] {Escape(active.World.Name)} [/]"); + sb.Append($"[bold {Ink(dark, worldAccent)} on {worldAccent}] {Escape(active.Name)} [/]"); tail = worldAccent; - if (active.Character is { } name) + if (model.Character?.Name is { } name) { sb.Append($"[{tail} on {chip}]{Glyphs.PowerRight}[/]"); @@ -13314,7 +13372,7 @@ private string HeaderMarkup() // cannot drift. It is picked to fit the room the identity ribbon leaves, because the header is one // row and an overlong one *wraps*, which costs a row of workspace; the widest spelling ran the // eighty-column layout to within four cells of the edge before anything was added to it. - if (_prefixArmed) + if (model.PrefixArmed) { var room = HeaderWidth() - MarkupWidth(leftBar) - 2; return $"{leftBar} {PrefixPanel.Strip(room, _ink)}"; @@ -13329,14 +13387,10 @@ private string HeaderMarkup() // graphics readout, which took the 80-column layout to precisely 80 cells; dropping that (see // below) gave the width back. InputAreaLayoutTests.TheFirstFrameFitsTheTerminalItIsOn(80) is the // test that says so, and anything added here has to keep it passing. - var connected = ConnectedCharacters().Count; - var conn = _config.Worlds.Count > 0 - ? $"{connected}/{ConfiguredConnections()} characters " - : string.Empty; - var logFormat = HeaderLogFormat(); - var log = logFormat == LogFormat.None - ? $"[dim]{Glyphs.Log} LOG off[/]" - : $"[{_ink.Accent}]{Glyphs.Log}[/] [dim]LOG {logFormat.ToString().ToLowerInvariant()}[/]"; + var conn = model.HasWorlds ? $"{model.ConnectedText} " : string.Empty; + var log = model.Log == LogFormat.None + ? $"[dim]{Glyphs.Log} {model.LogText}[/]" + : $"[{_ink.Accent}]{Glyphs.Log}[/] [dim]{model.LogText}[/]"; // No graphics readout here. Which protocol the probe settled on is decided once at startup and // never changes, so a permanent cell of chrome spends the row's scarcest resource on a fact that // cannot become news — and it was already said twice elsewhere: the session prints diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs new file mode 100644 index 00000000..cd5eaedd --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs @@ -0,0 +1,231 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Input; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; +using SkiaSharp; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's native header and sidebar (, ): drawn exactly +/// over the cells the client says hold the header and the rail, from the models those cells are drawn from; a click +/// is handed back as the model's own target and never reaches the client as a press on a cell; empty header space +/// still moves the window; and no pane moves. +/// +public class NativeChromeTests +{ + private static readonly SKColor Back = new(0x10, 0x20, 0x30); + + private static readonly TerminalColor Teal = TerminalColor.FromRgb(0x00, 0xf5, 0xb7); + + private static SidebarModel Sidebar(bool collapsed = false) => new( + [ + new RailWorld("Aetherfall", "aether.example", 4000, Teal, + [ + new RailCharacter("Corvid", "Aetherfall.Corvid", Connected: true, Active: true, Unread: 3, + [ + new RailWindow("main", "session:1", "⌥1", 0, true, false), + new RailWindow("Chat", "spawn:2", "⌥2", 3, false, false), + ]), + new RailCharacter("Wren", "Aetherfall.Wren", Connected: false, Active: false, Unread: 0, [], Chord: "⌥J"), + ]), + ], + "session:1", + collapsed); + + private static HeaderModel Header(bool prefix = false) => new( + false, + new HeaderWorld("Aetherfall", Teal), + new HeaderCharacter("Corvid", "Aetherfall.Corvid", CharacterPresence.Online, "aether.example", 4000, true, CommandIds.Character("Aetherfall.Corvid")), + 1, 2, true, LogFormat.None, prefix); + + private static ChromeOverlay Overlay(Action activate, bool shown = true, bool collapsed = false, bool prefix = false) => new( + shown, + new PaneRect(0, 0, 100, 1), + Header(prefix), + new PaneRect(0, 1, 22, 28), + Sidebar(collapsed), + new ChromePalette("#9d7cff", "#00f5b7", "#00f5b7", "#ffd700", "#00f5b7"), + activate); + + [Test] + public async Task TheHeaderAndTheSidebarCoverExactlyTheCellsTheClientNamed() + { + var (header, sidebar, cell) = await Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { })); + Drain(); + window.UpdateLayout(); + return (Bounds(layer.Header, window), Bounds(layer.Sidebar, window), view.CellExtent); + }); + + await Assert.That(header).IsEqualTo(new Rect(0, 0, 100 * cell.Width, cell.Height)); + await Assert.That(sidebar).IsEqualTo(new Rect(0, cell.Height, 22 * cell.Width, 28 * cell.Height)); + } + + [Test] + public async Task NothingNativeIsDrawnUnderAnotherWindowOverACollapsedRailOrOverTheArmedPrefix() + { + var states = await Run((window, view, layer, driver) => + { + var seen = new List<(bool Header, bool Sidebar)>(); + foreach (var overlay in new[] + { + Overlay(_ => { }), Overlay(_ => { }, shown: false), Overlay(_ => { }, collapsed: true), Overlay(_ => { }, prefix: true), + }) + { + ((IPointerPresenter)driver.Pointer).Chrome(overlay); + Drain(); + seen.Add((layer.Header.IsVisible, layer.Sidebar.IsVisible)); + } + + return seen; + }); + + await Assert.That(states[0]).IsEqualTo((true, true)); + await Assert.That(states[1]).IsEqualTo((false, false)); + await Assert.That(states[2]).IsEqualTo((true, false)); + await Assert.That(states[3]).IsEqualTo((false, true)); + } + + [Test] + public async Task AClickOnTheSidebarOrTheHeaderHandsBackTheModelsTargetAndNeverReachesTheClient() + { + var (activated, clientSaw, rows, focused) = await Run((window, view, layer, driver) => + { + var activated = new List(); + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(activated.Add)); + Drain(); + window.UpdateLayout(); + var clientSaw = new List>(); + driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); + + void Click(Control on, Rect area) + { + var centre = on.TranslatePoint(area.Center, window)!.Value; + window.MouseMove(centre); + window.MouseDown(centre, MouseButton.Left); + window.MouseUp(centre, MouseButton.Left); + Drain(); + } + + var chat = layer.Sidebar.Rows.Single(r => r.Window?.Id == "spawn:2"); + Click(layer.Sidebar, chat.Area); + var wren = layer.Sidebar.Rows.Single(r => r.Character?.Name == "Wren"); + Click(layer.Sidebar, wren.Area); + Click(layer.Sidebar, layer.Sidebar.Hits.Single(h => h.Target == SidebarModel.AddGameTarget).Area); + Click(layer.Header, layer.Header.Hits.Last(h => h.Target == HeaderModel.PaletteTarget).Area); + Click(layer.Header, layer.Header.Hits.Single(h => h.Target.StartsWith(CommandIds.CharacterPrefix, StringComparison.Ordinal)).Area); + window.MouseWheel(window.Bounds.Center.WithX(10), new Vector(0, 1)); + Drain(); + return (activated, clientSaw, layer.Sidebar.Rows.Select(r => r.Kind).ToArray(), view.IsFocused); + }, columns: 100, rows: 30); + + await Assert.That(activated).IsEquivalentTo(new[] + { + CommandIds.Window("spawn:2"), CommandIds.Character("Aetherfall.Wren"), SidebarModel.AddGameTarget, + HeaderModel.PaletteTarget, CommandIds.Character("Aetherfall.Corvid"), + }); + await Assert.That(clientSaw.Count).IsEqualTo(0).Because("every press, release and wheel over native chrome is the window's"); + await Assert.That(focused).IsTrue().Because("the keyboard stays with the client"); + await Assert.That(rows).IsEquivalentTo(new[] { RailRowKind.World, RailRowKind.Character, RailRowKind.Window, RailRowKind.Window, RailRowKind.Character }); + } + + [Test] + public async Task APressOnEmptyHeaderSpaceMovesTheWindowAndNeverReachesTheClient() + { + var (gestures, clientSaw, activated) = await Run((window, view, layer, driver) => + { + var activated = new List(); + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(activated.Add)); + Drain(); + window.UpdateLayout(); + var clientSaw = new List>(); + driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); + + // Between the brand and the search box: a gap the header leaves on purpose. + var brand = layer.Header.Hits[0].Area; + var gap = layer.Header.TranslatePoint(new Point(brand.Right + 8, layer.Header.Bounds.Height / 2), window)!.Value; + window.MouseDown(gap, MouseButton.Left); + window.MouseUp(gap, MouseButton.Left); + Drain(); + return (view.WindowGestures, clientSaw, activated); + }, columns: 100, rows: 30); + + await Assert.That(gestures).IsEqualTo(1); + await Assert.That(clientSaw.Count).IsEqualTo(0); + await Assert.That(activated.Count).IsEqualTo(0); + } + + [Test] + public async Task TheLiveClientPublishesItsOwnRectanglesAndNoPaneMovesAgainstTheTerminal() + { + using var headless = new HeadlessConsoleDriver(120, 32); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities)); + terminal.RenderSnapshot("connections"); + + using var driver = new AvaloniaConsoleDriver(120, 32); + await using var window = new SharpMUTermApp(DemoScene.Build(), WindowHost.Create(driver, clipboard: null) with + { + Capabilities = WindowOptions.Capabilities, + Audio = null, + Presence = null, + Announcer = null, + RunsInline = true, + }); + window.RenderSnapshot("connections"); + window.RenderNextFrame(); + + var chrome = driver.Pointer.Chrome; + await Assert.That(chrome).IsNotNull(); + await Assert.That(chrome!.Header).IsEqualTo(new PaneRect(0, 0, 120, 1)); + await Assert.That(chrome.Rail.Width).IsEqualTo(window.RailColumnWidth); + await Assert.That(chrome.Sidebar).IsEqualTo(window.BuildSidebar()); + await Assert.That(window.PaneOutputRects().OrderBy(r => r.Key).ToArray()) + .IsEquivalentTo(terminal.PaneOutputRects().OrderBy(r => r.Key).ToArray()); + } + + private static Rect Bounds(Control control, Window window) => + new(control.TranslatePoint(default, window)!.Value, control.Bounds.Size); + + private static void Drain() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); + + private static Task Run( + Func body, int columns = 100, int rows = 30) => + Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(columns, rows); + var view = new TerminalView(driver, SKColors.White, Back, 16, null); + var layer = new DesktopLayer(view); + var root = new Panel(); + root.Children.Add(view); + root.Children.Add(layer); + var window = new Window { Content = root, WindowDecorations = WindowDecorations.BorderOnly }; + var size = view.SizeFor(columns, rows); + window.Width = size.Width; + window.Height = size.Height; + window.Show(); + view.Focus(); + driver.Flush(); + Drain(); + try + { + return body(window, view, layer, driver); + } + finally + { + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + private static HeadlessUnitTestSession Session => TerminalViewTests.Session; +} diff --git a/tests/SharpMUTerm.Client.Tests/ChromeModelTests.cs b/tests/SharpMUTerm.Client.Tests/ChromeModelTests.cs new file mode 100644 index 00000000..959b38da --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/ChromeModelTests.cs @@ -0,0 +1,100 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Tests; + +/// The header and sidebar view-models, which the cell chrome and the window's native chrome are both drawn from. +public class ChromeModelTests +{ + private static readonly TerminalColor Teal = TerminalColor.FromRgb(0x00, 0xf5, 0xb7); + + private static IReadOnlyList Tree(int unread = 3, bool unsent = false) => + [ + new RailWorld("Aetherfall", "aether.example", 4000, Teal, + [ + new RailCharacter("Corvid", "Aetherfall.Corvid", Connected: true, Active: true, Unread: unread, + [ + new RailWindow("main", "session:1", "⌥1", 0, unsent, false), + new RailWindow("Chat", "spawn:2", "⌥2", unread, false, false), + ]), + new RailCharacter("Wren", "Aetherfall.Wren", Connected: false, Active: false, Unread: 0, [], Chord: "⌥J"), + ]), + new RailWorld("Empty Shore", "shore.example", 23, Teal, []), + ]; + + [Test] + public async Task TheSidebarsRowsAreCoresRowProjectionOfTheSameTree() + { + var model = new SidebarModel(Tree(), "spawn:2", false); + await Assert.That(model.Rows()).IsEquivalentTo(RailModel.Build(model.Worlds)); + await Assert.That(model.Rows().Count(r => r.Kind == RailRowKind.Window)).IsEqualTo(2); + } + + [Test] + public async Task TwoSidebarsOverTheSameStateAreEqualAndAnyChangeIsNot() + { + await Assert.That(new SidebarModel(Tree(), "spawn:2", false)).IsEqualTo(new SidebarModel(Tree(), "spawn:2", false)); + await Assert.That(new SidebarModel(Tree(), "spawn:2", false).GetHashCode()) + .IsEqualTo(new SidebarModel(Tree(), "spawn:2", false).GetHashCode()); + await Assert.That(new SidebarModel(Tree(unread: 4), "spawn:2", false)).IsNotEqualTo(new SidebarModel(Tree(), "spawn:2", false)); + await Assert.That(new SidebarModel(Tree(unsent: true), "spawn:2", false)).IsNotEqualTo(new SidebarModel(Tree(), "spawn:2", false)); + await Assert.That(new SidebarModel(Tree(), "session:1", false)).IsNotEqualTo(new SidebarModel(Tree(), "spawn:2", false)); + await Assert.That(new SidebarModel(Tree(), "spawn:2", true)).IsNotEqualTo(new SidebarModel(Tree(), "spawn:2", false)); + } + + [Test] + public async Task EveryTargetTheSidebarOffersIsOneTheCellRailCarriesOrTheAddButton() + { + var model = new SidebarModel(Tree(), "spawn:2", false); + var rowTargets = model.Rows().Select(r => r.Target).OfType().ToHashSet(); + foreach (var target in model.Targets().Where(t => t != SidebarModel.AddGameTarget)) + { + await Assert.That(rowTargets).Contains(target).Because(target); + } + + await Assert.That(model.Targets()).Contains(CommandIds.Window("spawn:2")); + await Assert.That(model.Targets()).Contains(CommandIds.Character("Aetherfall.Wren")); + await Assert.That(model.Targets()).Contains(RailModel.NoCharactersTarget("Empty Shore")); + await Assert.That(model.IsSelected(model.Worlds[0].Characters[0].Windows[1])).IsTrue(); + } + + [Test] + public async Task TheHeaderWordsItsCountsAndLogTheWayTheCellRowDoes() + { + var model = new HeaderModel(false, new HeaderWorld("Aetherfall", Teal), + new HeaderCharacter("Corvid", "Aetherfall.Corvid", CharacterPresence.Online, "aether.example", 4000, true, "char:Aetherfall.Corvid"), + 2, 3, true, LogFormat.Html, false); + + await Assert.That(model.ConnectedText).IsEqualTo("2/3 characters"); + await Assert.That(model.LogText).IsEqualTo("LOG html"); + await Assert.That(model.Character!.Detail("Aetherfall")).IsEqualTo("Aetherfall · TLS"); + await Assert.That((model with { Character = model.Character with { Tls = false } }).Character!.Detail("Aetherfall")).IsEqualTo("Aetherfall"); + await Assert.That(HeaderModel.Empty.ConnectedText).IsEqualTo(string.Empty); + await Assert.That(HeaderModel.Empty.LogText).IsEqualTo("LOG off"); + await Assert.That(model).IsEqualTo(model with { }); + } + + [Test] + public async Task PresenceFollowsTheSessionsState() + { + await Assert.That(PresenceOf.State(ConnectionState.Connected)).IsEqualTo(CharacterPresence.Online); + await Assert.That(PresenceOf.State(ConnectionState.Connecting)).IsEqualTo(CharacterPresence.Connecting); + await Assert.That(PresenceOf.State(ConnectionState.Faulted)).IsEqualTo(CharacterPresence.Offline); + await Assert.That(PresenceOf.State(null)).IsEqualTo(CharacterPresence.Offline); + } + + [Test] + public async Task ChordsAreSpeltInWordsForAUiFont() + { + await Assert.That(KeyGlyphs.Words("⌥1")).IsEqualTo("Alt+1"); + await Assert.That(KeyGlyphs.Words("⌃P")).IsEqualTo("Ctrl+P"); + await Assert.That(KeyGlyphs.Words("⌥⇧→")).IsEqualTo("Alt+Shift+→"); + await Assert.That(KeyGlyphs.Words("F4")).IsEqualTo("F4"); + await Assert.That(KeyGlyphs.Normalize(KeyGlyphs.Words("⌥J"))).IsEqualTo("⌥J"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/NativeChromeModelTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeChromeModelTests.cs new file mode 100644 index 00000000..abce896f --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NativeChromeModelTests.cs @@ -0,0 +1,171 @@ +using System.Drawing; +using SharpConsoleUI.Drivers; +using SharpConsoleUI.Parsing; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The header and the rail as data (, ): the cell chrome is drawn from +/// the same models a host is handed, the host is told where the header and the rail are, and a click it hands back +/// goes where the same click on the cells goes — and nowhere the client did not offer. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class NativeChromeModelTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class ChromePresenter : IPointerPresenter + { + public List Published { get; } = []; + + public void Hover(PointerTarget target) + { + } + + public void ShowMenu(Point cell, IReadOnlyList items) + { + } + + public bool DrawsMenus => true; + + public void Scrollbars(IReadOnlyList bars) + { + } + + public void Chrome(ChromeOverlay chrome) => Published.Add(chrome); + } + + private static (SharpMUTermApp App, ChromePresenter Pointer) App(string? view = null) + { + Console.SetIn(TextReader.Null); + var pointer = new ChromePresenter(); + var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, _ => { }) with { Pointer = pointer }; + var app = new SharpMUTermApp(DemoScene.Build(), host); + app.RenderSnapshot(view); + app.RenderNextFrame(); + return (app, pointer); + } + + [Test] + public async Task TheCellHeaderSaysWhatTheHeaderModelSays() + { + var (app, _) = App("connections"); + await using var _app = app; + var model = app.BuildHeaderModel(); + await Assert.That(model.World).IsNotNull(); + await Assert.That(model.Character).IsNotNull(); + await Assert.That(app.HeaderText).Contains(model.World!.Name); + await Assert.That(app.HeaderText).Contains(model.Character!.Name); + await Assert.That(app.HeaderText).Contains(model.ConnectedText); + await Assert.That(app.HeaderText).Contains(model.LogText); + await Assert.That(app.HeaderText).Contains($"[link={HeaderModel.PaletteTarget}]"); + } + + [Test] + public async Task TheCellRailCarriesExactlyTheSidebarModelsTargets() + { + var (app, _) = App("characters"); + await using var _app = app; + var sidebar = app.BuildSidebar(); + var rowTargets = sidebar.Rows().Select(r => r.Target).OfType().Distinct().ToArray(); + var linked = string.Join("\n", app.RailLines); + foreach (var target in rowTargets) + { + await Assert.That(linked).Contains(LinkUrl.Escape(target)).Because(target); + } + + await Assert.That(app.RailLines.Count).IsEqualTo(sidebar.Rows().Count); + await Assert.That(sidebar.SelectedWindowId).IsEqualTo(app.ActiveWindowId()); + } + + [Test] + public async Task TheHostIsToldWhereTheHeaderAndTheRailAre() + { + var (app, pointer) = App("characters"); + await using var _app = app; + var chrome = pointer.Published.Last(); + await Assert.That(chrome.Shown).IsTrue(); + await Assert.That(chrome.Header).IsEqualTo(new PaneRect(0, 0, 120, 1)); + await Assert.That(chrome.Rail.X).IsEqualTo(0); + await Assert.That(chrome.Rail.Y).IsEqualTo(1); + await Assert.That(chrome.Rail.Width).IsEqualTo(app.RailColumnWidth); + await Assert.That(chrome.Rail.Height).IsGreaterThan(10); + await Assert.That(chrome.Sidebar).IsEqualTo(app.BuildSidebar()); + await Assert.That(chrome.HeaderModel).IsEqualTo(app.BuildHeaderModel()); + + // Nothing changed, nothing said: a frame that moved nothing does not re-publish. + var count = pointer.Published.Count; + app.RenderNextFrame(); + await Assert.That(pointer.Published.Count).IsEqualTo(count); + } + + [Test] + public async Task TheSearchBoxOpensTheCommandSurfaceAndTheChromeStandsDownUnderIt() + { + var (app, pointer) = App(); + await using var _app = app; + await Assert.That(app.MenuIsOpen).IsFalse(); + pointer.Published.Last().Activate(HeaderModel.PaletteTarget); + await Assert.That(app.MenuIsOpen).IsTrue(); + + // A second click on the box does not close it: a search box is for starting to type. + await Assert.That(app.ActivateChromeTarget(HeaderModel.PaletteTarget)).IsTrue(); + await Assert.That(app.MenuIsOpen).IsTrue(); + + app.RenderNextFrame(); + await Assert.That(pointer.Published.Last().Shown).IsFalse().Because("the command surface is drawn over the cells the chrome would cover"); + } + + [Test] + public async Task ASidebarClickGoesWhereTheRailsOwnClickGoes() + { + var (app, pointer) = App("characters"); + await using var _app = app; + var chrome = pointer.Published.Last(); + var other = chrome.Sidebar.Worlds.SelectMany(w => w.Characters).First(c => !c.Active); + await Assert.That(app.ActivateChromeTarget(SidebarModel.TargetOf(other))).IsTrue(); + await Assert.That(app.BuildSidebar().Worlds.SelectMany(w => w.Characters).Single(c => c.Active).SessionKey) + .IsEqualTo(other.SessionKey); + } + + [Test] + [Arguments("characters")] + [Arguments("layout-roleplay")] + [Arguments(null)] + public async Task TheHeadersPresenceDotAndTheRailsDotAreOneAnswer(string? view) + { + var (app, _) = App(view); + await using var _app = app; + var header = app.BuildHeaderModel().Character!; + var row = app.BuildSidebar().Worlds.SelectMany(w => w.Characters).Single(c => c.SessionKey == header.SessionKey); + await Assert.That(header.Presence == CharacterPresence.Online).IsEqualTo(row.Connected); + } + + [Test] + public async Task TheChromeStandsDownUnderTheQuitPrompt() + { + // The connections scene leaves the quit prompt open over the main window. + var (app, pointer) = App("connections"); + await using var _app = app; + await Assert.That(pointer.Published.Last().Shown).IsFalse(); + } + + [Test] + public async Task ATargetTheChromeNeverOfferedIsRefused() + { + var (app, _) = App("connections"); + await using var _app = app; + var before = app.ActiveWindowId(); + await Assert.That(app.ActivateChromeTarget("mux:send:@shutdown")).IsFalse(); + await Assert.That(app.ActivateChromeTarget(CommandIds.Window("no-such-window"))).IsFalse(); + await Assert.That(app.ActivateChromeTarget("layout:close")).IsFalse(); + await Assert.That(app.ActiveWindowId()).IsEqualTo(before); + } +} From db0040f42e00b4236e8c30cd462ce9aecdafde67 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 05:50:34 +0000 Subject: [PATCH 021/113] Draw who-here and the quick bar natively in the desktop window The window draws a native who-here list (presence dots, idle text, NPCs dimmed, hover plate, full-name tooltip) and native quick-bar buttons (+N overflow menu, F4 edits keys link) over their panes, from new host-neutral WhoHereModel/QuickBarModel in SharpMUTerm.Client that the cell renderers now draw from too. A click is PanelOverlay.Pick(index), read back by the client from what it published and acted on through the cell links' own methods on the panel's character; the window builds no command and never takes keyboard focus. Native panels are withdrawn while a modal is open, so they no longer sit on top of F4 or Ctrl+P. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 29 +- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 28 +- src/SharpMUTerm.Avalonia/PanelText.cs | 61 +++ src/SharpMUTerm.Avalonia/QuickBarButtons.cs | 382 ++++++++++++++++++ src/SharpMUTerm.Avalonia/WhoHereList.cs | 312 ++++++++++++++ .../Panels/QuickBarModel.cs | 49 +++ src/SharpMUTerm.Client/Panels/WhoHereModel.cs | 87 ++++ .../Panels/QuickBarRenderer.cs | 31 +- src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs | 60 +-- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 19 +- .../Pointer/SharpMUTermApp.Desktop.cs | 48 ++- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 105 +++-- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 8 +- .../DesktopLayerTests.cs | 6 +- .../NativePanelTests.cs | 321 +++++++++++++++ .../TerminalPanelTests.cs | 4 +- 17 files changed, 1454 insertions(+), 101 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/PanelText.cs create mode 100644 src/SharpMUTerm.Avalonia/QuickBarButtons.cs create mode 100644 src/SharpMUTerm.Avalonia/WhoHereList.cs create mode 100644 src/SharpMUTerm.Client/Panels/QuickBarModel.cs create mode 100644 src/SharpMUTerm.Client/Panels/WhoHereModel.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 78fb2cbe..6ab27489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] them side by side. - Desktop window: the map is drawn as a canvas of rooms and exits. The wheel zooms, a drag pans, a double-click re-centres on you, and a click on a room walks there. Hovering a room shows its name. +- Desktop window: who is here is a native list, with a coloured dot for each player (dim when idle), how long + they have been idle, and creatures dimmed below. Hovering a name lights the row and shows the full name; a click + puts `look` and the name on that character's command line, as in the terminal. The quick bar is a row of + buttons, with the bindings that do not fit under a `+N` menu and *F4 edits keys* as a link. Neither takes the + keyboard away from the command line, and native panels no longer sit on top of a settings screen or ⌃P. - Scrolling a pane back splits it: the history you are reading stays on top, a band says how far back you are (`scrolled back 120 rows · End returns · ⌥F freezes`), and the newest lines keep arriving underneath. End (with the cursor at the end of the command line), Ctrl+End, or scrolling the history back down to its end diff --git a/CLAUDE.md b/CLAUDE.md index ec9bfcb2..e3968dd2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -993,9 +993,10 @@ fallbacks) for inline images/maps. - Screenshots of the window's cues come from a real window under Xvfb, driven with XTest; `--render-png` has no pointer and cannot show them. - **The window draws native views over the cells, and the cells stay** (`DesktopLayer`, `HeaderButton`, - `VitalsGauges`, `MapCanvas`, `NativeMenu` in Avalonia; `SharpMUTermApp.Desktop.cs`; Client `VitalsModel`, - `MapViewModel`, `LayoutCommands`). First slice of the desktop app: a Layouts button in the header, native vitals - gauges and a native map. Decisions not to relitigate: + `VitalsGauges`, `MapCanvas`, `WhoHereList`, `QuickBarButtons`, `NativeMenu` in Avalonia; `SharpMUTermApp.Desktop.cs`; + Client `VitalsModel`, `MapViewModel`, `WhoHereModel`, `QuickBarModel`, `LayoutCommands`). A Layouts button in the + header, native vitals gauges, a native map, a native who-here list and native quick-bar buttons. Decisions not + to relitigate: - **An overlay, never a cell.** The layer is a `Canvas` above `TerminalView` in the window's root panel; the client paints every cell exactly as in a terminal underneath, so no pane rectangle moves (NAWS), the parity test (which compares cells) does not see it, and a host that draws nothing native loses nothing. A native @@ -1004,18 +1005,26 @@ fallbacks) for inline images/maps. - **The channel is `IPointerPresenter`**, the one the scrollbars ride, with two default-implemented members (`Panels`, `HeaderActions`) so the terminal and the test presenters need no change. `PublishPanels` runs on `PostBufferPaint` and publishes only on change; a panel is on screen when its window is a realised pane's - front tab. The map's model is rebuilt only when `RenderMap` has run since (`_mapRevisions`), and its walk + front tab **and no modal is open**. A settings screen, ⌃P or F1 is drawn in cells over the panes and a native + view would sit on top of it; a modal covering the whole window leaves the main window unpainted, so + `ModalStateService.StateChanged` publishes too (`TheEditLinkDispatchesTheF4ScreenAndNoNativePanelCoversIt`). The map's model is rebuilt only when `RenderMap` has run since (`_mapRevisions`), and its walk callback is one instance per window so an overlay compares equal frame to frame. - **Data is a view-model both hosts draw.** `ReadVitals` builds the `VitalsModel` that `VitalsStripRenderer` draws as cells and the gauges draw natively; `VitalsModel.LowShare` is the one low threshold (`StatusMeterRenderer.LowShare` reads it). `MapViewModel.From` is the current room's area and level, nearest - first, at most 1,500 rooms, names bounded. + first, at most 1,500 rooms, names bounded. `ReadWhoHere` builds the `WhoHereModel` and `QuickBarEntries` the + `QuickBarModel` that `WhoHereRenderer`/`QuickBarRenderer` draw as cells; row or item N is the same person or + binding in both, and the empty/unknown sentences and the `F4 edits keys` hint live on the models. - **The window never builds a command.** The Layouts menu is `LayoutsMenuItems()`, built on the client's thread (`HeaderAction.Menu`), each entry a registry dispatch: `layout:lib:apply:`, `…save`, `…save-new`, `…use-world`, `…use-character` (a `CommandFamily` that lists nothing on ⌃P — ⌥M is the keyboard's list), plus `layout:layouts` for *Manage layouts…*. Those ids run the ⌥M list's own methods, which now return a `LayoutActionResult` the list shows as its status and a command shows as a notice. A map click is - `PanelOverlay.WalkTo` → `WalkFromMap`, the method a cell map's `mux:map:` link ends in. + `PanelOverlay.WalkTo` → `WalkFromMap`, the method a cell map's `mux:map:` link ends in. A who-here or quick-bar + click is `PanelOverlay.Pick(index)`: the client reads row N back from the overlay it *published* for that + window (out of range is nothing) and runs `OfferLook` / `RunQuickMacro`, the cell links' own methods, on the + window's own character. `F4 edits keys` is `PanelOverlay.Dispatch(QuickBarModel.EditCommand)` + (`screen:keypad`). One pick callback per window (`_panelPickers`), for the map walker's reason. - **Input, by view.** The header button is the window's alone: press, release, wheel and movement stop at it, a right press included, and nothing reaches the client (`ThePressOnTheLayoutsButtonNeverReachesTheClient…`). It never takes focus. It sits over the header's last three cells, which the header always leaves blank @@ -1023,12 +1032,16 @@ fallbacks) for inline images/maps. The vitals gauges are `IsHitTestVisible = false`: every pointer event goes to the cells, so focus, the pane's menu and selection are the terminal's. The map takes the pointer (wheel zooms about the pointer, drag pans from the character's room, double-click re-centres, click walks) and hands a right click on to - the client as a right click on the cell (`TerminalView.ForwardRightClick`). + the client as a right click on the cell (`TerminalView.ForwardRightClick`). The who-here list and the quick bar + take the pointer the same way (hover plate, tooltip, left click is a pick, right click forwarded, wheel + swallowed) and are `Focusable = false`, as the map is: the keyboard stays on the client's command line. The + quick bar lays out the cells' rule in pixels — the link first, then bindings in order, `+N` for the rest, whose + `NativeMenu` entries pick by the same index. Every binding is drawn alike; only a key that does not fire is dim. - **Gauges choose their arrangement from the pane's height alone**: stacked blocks when every meter and the target fit as name-over-bar, else side by side, where the words shrink (`Mana · low 23 / 120`, then `mp! 23/120`, then `mp 23`) before a bar goes under 24 px. The UI font, not the cell font: this is the window's presentation. `hp`/`mp`/`mv` read as Health/Mana/Movement (`VitalsMeter.Title`). - - **Not done**: who-here, the quick bar and the composer are still cells in the window; no animation on a + - **Not done**: the docked composer is still cells in the window; no animation on a gauge change; the map draws one level and area, no exits between levels and no room colours/symbols; the button's icon is the only header action. The window's menu is Avalonia's `ContextMenu`, which needs a second click under a WM-less X server to take the first item (seen under Xvfb only). diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index c5821a3c..e19b916f 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -23,8 +23,10 @@ namespace SharpMUTerm.Avalonia; /// movement and wheel stop at it and never reach the client, which is what lets it sit over cells the client /// would otherwise read as a press on the header. The vitals gauges are a picture of their pane and take no input: /// a press, a drag, a right-click or the wheel over them reaches the client as a press on the pane's cells, so -/// focus, the pane's menu and selection behave as they do in a terminal. The map is used with the pointer, so it -/// takes it (: zoom, pan, click to walk) and hands only a right click on to the client. +/// focus, the pane's menu and selection behave as they do in a terminal. The map, the who-here list and the quick +/// bar are used with the pointer, so they take it (: zoom, pan, click to walk; +/// : click a name; : click a binding) and hand only a right +/// click on to the client. None of them takes keyboard focus. /// /// internal sealed class DesktopLayer : Canvas @@ -37,6 +39,8 @@ internal sealed class DesktopLayer : Canvas private readonly Dictionary _buttons = new(StringComparer.Ordinal); private readonly Dictionary _gauges = new(StringComparer.Ordinal); private readonly Dictionary _maps = new(StringComparer.Ordinal); + private readonly Dictionary _whoHere = new(StringComparer.Ordinal); + private readonly Dictionary _quickBars = new(StringComparer.Ordinal); public DesktopLayer(TerminalView view) { @@ -64,6 +68,12 @@ protected override void OnSizeChanged(SizeChangedEventArgs e) /// The native maps by window id. Internal for tests. internal IReadOnlyDictionary Maps => _maps; + /// The native who-here lists by window id. Internal for tests. + internal IReadOnlyDictionary WhoHere => _whoHere; + + /// The native quick bars by window id. Internal for tests. + internal IReadOnlyDictionary QuickBars => _quickBars; + /// The last header menu opened. Internal for tests. internal ContextMenu? OpenedMenu { get; private set; } @@ -141,6 +151,20 @@ private void SyncPanels(ScreenFrame frame, Size cell) frame, cell, (map, panel, plane) => map.Show(panel.Map!, panel.Ink, plane, text, panel.WalkTo)); + Place( + _whoHere, + _pointer.Panels.Where(p => p.PanelId == PanelIds.WhoHere && p.WhoHere is not null), + () => new WhoHereList(_view), + frame, + cell, + (list, panel, plane) => list.Show(panel.WhoHere!, panel.Ink, plane, text, cell.Height, panel.Pick)); + Place( + _quickBars, + _pointer.Panels.Where(p => p.PanelId == PanelIds.QuickBar && p.QuickBar is not null), + () => new QuickBarButtons(_view), + frame, + cell, + (bar, panel, plane) => bar.Show(panel.QuickBar!, panel.Ink, plane, text, cell.Height, panel.Pick, panel.Dispatch)); } /// diff --git a/src/SharpMUTerm.Avalonia/PanelText.cs b/src/SharpMUTerm.Avalonia/PanelText.cs new file mode 100644 index 00000000..47b9e705 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/PanelText.cs @@ -0,0 +1,61 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Media; + +namespace SharpMUTerm.Avalonia; + +/// +/// Text and colour for the native list panels (, ): one line of +/// the window's UI font, trimmed with an ellipsis, measured and drawn the same way, so the two panels read as one +/// family with the vitals gauges. +/// +internal static class PanelText +{ + /// One line of text, trimmed to with an ellipsis. + public static FormattedText Format(string text, double size, Color colour, bool bold, double maxWidth = double.PositiveInfinity) + { + var formatted = new FormattedText( + text, + CultureInfo.InvariantCulture, + FlowDirection.LeftToRight, + new Typeface(FontFamily.Default, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), + size, + new SolidColorBrush(colour)) + { + MaxLineCount = 1, + Trimming = TextTrimming.CharacterEllipsis, + }; + if (!double.IsInfinity(maxWidth)) + { + formatted.MaxTextWidth = Math.Max(1, maxWidth); + } + + return formatted; + } + + /// How wide a line is drawn, untrimmed. + public static double Measure(string text, double size, bool bold) => Format(text, size, Colors.White, bold).Width; + + /// + /// Draws a line with its left edge at (its right edge there when ), + /// centred on , and returns the width it took. + /// + public static double Draw(DrawingContext context, string text, double x, double middle, double size, Color colour, bool bold, double maxWidth, bool alignRight = false) + { + if (maxWidth < 2 || text.Length == 0) + { + return 0; + } + + var formatted = Format(text, size, colour, bold, maxWidth); + var width = Math.Min(formatted.Width, maxWidth); + context.DrawText(formatted, new Point(alignRight ? x - width : x, middle - (formatted.Height / 2))); + return width; + } + + /// The ink at an alpha: the dim and hover shades are the text colour, never a theme's grey. + public static Color Alpha(Color colour, byte alpha) => Color.FromArgb(alpha, colour.R, colour.G, colour.B); + + /// A #rrggbb from the client, or grey when it is not one. + public static Color Parse(string hex) => Color.TryParse(hex, out var colour) ? colour : Colors.Gray; +} diff --git a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs new file mode 100644 index 00000000..de494bcb --- /dev/null +++ b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs @@ -0,0 +1,382 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Input; +using Avalonia.Media; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The quick bar as native buttons, over the pane whose cells draw the same : one button +/// per binding (its key in the accent, then its name), a +N button holding the bindings that do not fit, and +/// F4 edits keys as a link at the right. Every button is drawn alike — the model marks no binding as special, +/// so neither does the window — except that a key this host cannot deliver is drawn dim, as the cells draw it. +/// +/// It takes the pointer, as the map does, and never the keyboard. A click on a binding is +/// with its index: the client runs that binding on the panel's own character through +/// the path the key takes. The +N menu's entries do the same. The link dispatches +/// through . The window never builds a +/// command. A right click is handed on to the client as a right click on the cell under it. +/// +/// +internal sealed class QuickBarButtons : Control +{ + /// What a laid-out slot does when clicked. + internal enum SlotKind + { + /// Runs the binding at . + Item, + + /// Opens the menu of bindings that did not fit. + More, + + /// Opens F4. + Edit, + } + + /// One slot of the bar, in this control's coordinates. + internal readonly record struct Slot(SlotKind Kind, int Index, Rect Rect); + + /// The widest a binding's name is drawn before it is trimmed. + internal const double MaxTitleWidth = 150; + + private const double Gap = 6, PadX = 8; + + private readonly TerminalView _view; + private readonly List _slots = []; + private QuickBarModel _model = QuickBarModel.Empty; + private PanelInk _ink = new("#5fafff", "#ff5f5f", "#3a3a40"); + private Color _plane = Colors.Black; + private Color _text = Colors.White; + private double _cellHeight = 16; + private Action? _pick; + private Action? _dispatch; + private Size _laidOutFor; + private QuickBarModel? _laidOutModel; + private Slot? _hovered; + private Slot? _pressed; + + public QuickBarButtons(TerminalView view) + { + _view = view; + ClipToBounds = true; + Focusable = false; + } + + /// What it is showing. Internal for tests. + internal QuickBarModel Model => _model; + + /// The slots laid out for the current size. Internal for tests. + internal IReadOnlyList Slots + { + get + { + Layout(new Size(Bounds.Width > 0 ? Bounds.Width : Width, Bounds.Height > 0 ? Bounds.Height : Height)); + return _slots; + } + } + + /// The indexes the +N button holds. Internal for tests. + internal IReadOnlyList Overflowed + { + get + { + var shown = Slots.Where(s => s.Kind == SlotKind.Item).Select(s => s.Index).ToHashSet(); + return Enumerable.Range(0, _model.Items.Count).Where(i => !shown.Contains(i)).ToList(); + } + } + + /// The last +N menu opened. Internal for tests. + internal ContextMenu? OpenedMenu { get; private set; } + + public void Show(QuickBarModel model, PanelInk ink, Color plane, Color text, double cellHeight, Action? pick, Action? dispatch) + { + _pick = pick; + _dispatch = dispatch; + if (model.Equals(_model) && ink == _ink && plane == _plane && text == _text && Math.Abs(cellHeight - _cellHeight) < 0.01) + { + return; + } + + _model = model; + _ink = ink; + _plane = plane; + _text = text; + _cellHeight = cellHeight; + _laidOutModel = null; + Hover(null); + InvalidateVisual(); + } + + private double FontSize => Math.Clamp(_cellHeight * 0.62, 9, 13); + + private static string Trim(QuickBarItem item) => item.Title; + + private double ItemWidth(QuickBarItem item) + { + var size = FontSize; + var title = Math.Min(MaxTitleWidth, PanelText.Measure(Trim(item), size, false)); + return PadX + PanelText.Measure(item.Key, size, true) + 5 + title + PadX; + } + + private double MoreWidth(int hidden) => PadX + PanelText.Measure($"+{hidden.ToString(CultureInfo.InvariantCulture)}", FontSize, true) + PadX; + + private double EditWidth => PanelText.Measure(QuickBarModel.EditHint, FontSize, false) + (PadX * 2); + + /// + /// The cells' rule, in pixels: the link first, then as many bindings as fit in order, with +N for the + /// rest; without room for the link, the bindings alone. + /// + private void Layout(Size size) + { + if (size == _laidOutFor && ReferenceEquals(_laidOutModel, _model)) + { + return; + } + + _laidOutFor = size; + _laidOutModel = _model; + _slots.Clear(); + if (size.Width < 8 || size.Height < 4) + { + return; + } + + var height = Math.Max(4, size.Height - 4); + var top = (size.Height - height) / 2; + var items = _model.Items; + var widths = items.Select(ItemWidth).ToList(); + foreach (var withEdit in new[] { true, false }) + { + var room = size.Width - (Gap * 2) - (withEdit ? EditWidth + Gap : 0); + for (var take = items.Count; take >= 0 && room >= 0; take--) + { + var hidden = items.Count - take; + var used = widths.Take(take).Sum() + (Gap * Math.Max(0, take - 1)) + + (hidden > 0 ? (take > 0 ? Gap : 0) + MoreWidth(hidden) : 0); + if (used > room) + { + continue; + } + + var x = Gap; + for (var i = 0; i < take; i++) + { + _slots.Add(new Slot(SlotKind.Item, i, new Rect(x, top, widths[i], height))); + x += widths[i] + Gap; + } + + if (hidden > 0) + { + _slots.Add(new Slot(SlotKind.More, hidden, new Rect(x, top, MoreWidth(hidden), height))); + } + + if (withEdit) + { + _slots.Add(new Slot(SlotKind.Edit, -1, new Rect(size.Width - Gap - EditWidth, top, EditWidth, height))); + } + + return; + } + } + } + + private Slot? SlotAt(Point point) + { + Layout(Bounds.Size); + foreach (var slot in _slots) + { + if (slot.Rect.Contains(point)) + { + return slot; + } + } + + return null; + } + + private void Hover(Slot? slot) + { + if (slot == _hovered) + { + return; + } + + _hovered = slot; + Cursor = slot is null ? Cursor.Default : new Cursor(StandardCursorType.Hand); + ToolTip.SetIsOpen(this, false); + ToolTip.SetTip(this, slot is { } s ? Tip(s) : null); + InvalidateVisual(); + } + + private string? Tip(Slot slot) => slot.Kind switch + { + SlotKind.Item when slot.Index < _model.Items.Count => $"{_model.Items[slot.Index].Title} ({_model.Items[slot.Index].Key})", + SlotKind.More => $"{slot.Index.ToString(CultureInfo.InvariantCulture)} more", + SlotKind.Edit => "Edit the keys (F4)", + _ => null, + }; + + // ── Input: the bar's own, never routed on to the cells (bar the right click) ───────────────── + + protected override void OnPointerMoved(PointerEventArgs e) + { + base.OnPointerMoved(e); + e.Handled = true; + Hover(SlotAt(e.GetPosition(this))); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + Hover(null); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + e.Handled = true; + var point = e.GetCurrentPoint(this); + if (point.Properties.IsRightButtonPressed) + { + _view.ForwardRightClick(e.GetPosition(_view), e.KeyModifiers); + return; + } + + _pressed = point.Properties.IsLeftButtonPressed ? SlotAt(point.Position) : null; + InvalidateVisual(); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + var pressed = _pressed; + _pressed = null; + InvalidateVisual(); + if (e.InitialPressMouseButton == MouseButton.Left && pressed is { } slot && SlotAt(e.GetPosition(this)) == slot) + { + Activate(slot); + } + } + + protected override void OnPointerWheelChanged(PointerWheelEventArgs e) + { + base.OnPointerWheelChanged(e); + e.Handled = true; + } + + /// Clicks a slot as a left press and release over it would. Internal for tests. + internal void PerformClick(Slot slot) => Activate(slot); + + private void Activate(Slot slot) + { + switch (slot.Kind) + { + case SlotKind.Item: + _pick?.Invoke(slot.Index); + break; + case SlotKind.Edit: + _dispatch?.Invoke(QuickBarModel.EditCommand); + break; + case SlotKind.More: + OpenMore(slot); + break; + } + } + + /// The bindings that did not fit, as a native menu over the +N button; each entry is a pick. + private void OpenMore(Slot slot) + { + var pick = _pick; + var items = Overflowed + .Select(i => new PointerMenuItem(_model.Items[i].Title, _model.Items[i].Key, () => pick?.Invoke(i))) + .ToList(); + if (items.Count == 0) + { + return; + } + + var menu = NativeMenu.Build(items, PlacementMode.TopEdgeAlignedRight, this); + menu.PlacementRect = slot.Rect; + menu.Closed += (_, _) => _view.Focus(); + OpenedMenu = menu; + menu.Open(this); + } + + // ── Drawing ────────────────────────────────────────────────────────────────────────────────── + + public override void Render(DrawingContext context) + { + var bounds = new Rect(Bounds.Size); + context.FillRectangle(new SolidColorBrush(_plane), bounds); + Layout(bounds.Size); + var size = FontSize; + var accent = PanelText.Parse(_ink.Bar); + var dim = PanelText.Alpha(_text, 0xA0); + var middle = bounds.Height / 2; + + if (_model.Items.Count == 0) + { + var editLeft = _slots.FirstOrDefault(s => s.Kind == SlotKind.Edit).Rect.Left; + PanelText.Draw(context, QuickBarModel.EmptyText, Gap + 2, middle, size, dim, false, (editLeft > 0 ? editLeft : bounds.Width) - Gap - 8); + } + + foreach (var slot in _slots) + { + var hot = slot == _hovered; + var down = slot == _pressed; + var rect = slot.Rect; + switch (slot.Kind) + { + case SlotKind.Item: + { + var item = _model.Items[slot.Index]; + Plate(context, rect, hot, down); + var keyInk = item.Fires ? accent : dim; + var titleInk = item.Fires ? _text : dim; + var x = rect.Left + PadX; + x += PanelText.Draw(context, item.Key, x, middle, size, keyInk, true, rect.Width) + 5; + PanelText.Draw(context, Trim(item), x, middle, size, titleInk, false, rect.Right - PadX - x + 0.5); + break; + } + + case SlotKind.More: + Plate(context, rect, hot, down); + PanelText.Draw(context, $"+{slot.Index.ToString(CultureInfo.InvariantCulture)}", rect.Left + PadX, middle, size, _text, true, rect.Width); + break; + + case SlotKind.Edit: + { + // A link, not a button: the accent key, the words in the dim ink, underlined under the pointer. + var x = rect.Left + PadX; + var keyWidth = PanelText.Draw(context, QuickBarModel.EditKey, x, middle, size, accent, true, rect.Width); + var rest = QuickBarModel.EditHint[QuickBarModel.EditKey.Length..]; + var restWidth = PanelText.Draw(context, rest, x + keyWidth, middle, size, hot ? _text : dim, false, rect.Right - x - keyWidth); + if (hot) + { + var y = Math.Round(middle + (size * 0.62)) + 0.5; + context.DrawLine(new Pen(new SolidColorBrush(PanelText.Alpha(_text, 0xC0)), 1), new Point(x, y), new Point(x + keyWidth + restWidth, y)); + } + + break; + } + } + } + } + + /// A button's plate: the text colour at a low alpha, stronger under the pointer and while pressed. + private void Plate(DrawingContext context, Rect rect, bool hot, bool down) + { + var alpha = (byte)(down ? 0x48 : hot ? 0x30 : 0x18); + context.DrawRectangle( + new SolidColorBrush(PanelText.Alpha(_text, alpha)), + new Pen(new SolidColorBrush(PanelText.Alpha(_text, 0x26)), 1), + rect.Deflate(0.5), + 4, + 4); + } +} diff --git a/src/SharpMUTerm.Avalonia/WhoHereList.cs b/src/SharpMUTerm.Avalonia/WhoHereList.cs new file mode 100644 index 00000000..bc910ebe --- /dev/null +++ b/src/SharpMUTerm.Avalonia/WhoHereList.cs @@ -0,0 +1,312 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The who-here panel as a native list, over the pane whose cells draw the same : the room +/// under HERE, then a row per person — a presence dot in the accent (dim when idle), the name, how long they +/// have been idle — with creatures dimmed under the players. A row lights under the pointer and its tooltip is the +/// full name. +/// +/// It takes the pointer, as the map does. A left click on a row is with the +/// row's index — the client puts look and the name on the panel's own character's command line, the action a +/// click on the cells takes; the window never builds the line. A right click is handed on to the client as a right +/// click on the cell under it (), so the pane's menu is the same here as +/// over cells. It never takes keyboard focus. +/// +/// +internal sealed class WhoHereList : Control +{ + private readonly TerminalView _view; + private readonly List<(int Index, Rect Rect)> _rows = []; + private WhoHereModel _model = WhoHereModel.Unknown; + private PanelInk _ink = new("#5fafff", "#ff5f5f", "#3a3a40"); + private Color _plane = Colors.Black; + private Color _text = Colors.White; + private double _cellHeight = 16; + private Action? _pick; + private Size _laidOutFor; + private WhoHereModel? _laidOutModel; + private int? _hovered; + private int? _pressed; + private string? _overflow; + + public WhoHereList(TerminalView view) + { + _view = view; + ClipToBounds = true; + Focusable = false; + } + + /// What it is showing. Internal for tests. + internal WhoHereModel Model => _model; + + /// The rows laid out, by model index, in this control's coordinates. Internal for tests. + internal IReadOnlyList<(int Index, Rect Rect)> Rows + { + get + { + Layout(new Size(Bounds.Width > 0 ? Bounds.Width : Width, Bounds.Height > 0 ? Bounds.Height : Height)); + return _rows; + } + } + + /// The row under the pointer, or null. Internal for tests. + internal int? Hovered => _hovered; + + /// The … and N more line, when the pane is too short for everyone. Internal for tests. + internal string? Overflow + { + get + { + _ = Rows; + return _overflow; + } + } + + public void Show(WhoHereModel model, PanelInk ink, Color plane, Color text, double cellHeight, Action? pick) + { + _pick = pick; + if (model.Equals(_model) && ink == _ink && plane == _plane && text == _text && Math.Abs(cellHeight - _cellHeight) < 0.01) + { + return; + } + + _model = model; + _ink = ink; + _plane = plane; + _text = text; + _cellHeight = cellHeight; + _laidOutModel = null; + if (_hovered >= model.Rows.Count) + { + Hover(null); + } + + InvalidateVisual(); + } + + private double FontSize => Math.Clamp(_cellHeight * 0.7, 10, 15); + + private double HeaderHeight => Math.Max(22, _cellHeight * 1.5); + + private double RowHeight => Math.Max(22, _cellHeight * 1.4); + + private const double Pad = 8; + + /// Which rows fit, and where, for a size. Every row is the same height, so it is arithmetic. + private void Layout(Size size) + { + if (size == _laidOutFor && ReferenceEquals(_laidOutModel, _model)) + { + return; + } + + _laidOutFor = size; + _laidOutModel = _model; + _rows.Clear(); + _overflow = null; + var count = _model.Rows.Count; + if (!_model.Known || count == 0) + { + return; + } + + var top = HeaderHeight + 2; + var room = Math.Max(0, (int)((size.Height - top - 4) / RowHeight)); + var fits = count <= room ? count : Math.Max(0, room - 1); + for (var i = 0; i < fits; i++) + { + _rows.Add((i, new Rect(Pad / 2, top + (i * RowHeight), Math.Max(0, size.Width - Pad), RowHeight))); + } + + if (fits < count) + { + _overflow = $"… and {(count - fits).ToString(CultureInfo.InvariantCulture)} more"; + } + } + + private int? RowAt(Point point) + { + Layout(Bounds.Size); + foreach (var (index, rect) in _rows) + { + if (rect.Contains(point)) + { + return index; + } + } + + return null; + } + + private void Hover(int? index) + { + if (index == _hovered) + { + return; + } + + _hovered = index; + Cursor = index is null ? Cursor.Default : new Cursor(StandardCursorType.Hand); + ToolTip.SetIsOpen(this, false); + ToolTip.SetTip(this, index is { } i && i < _model.Rows.Count ? Tip(_model.Rows[i]) : null); + InvalidateVisual(); + } + + private static string Tip(WhoHereRow row) + { + var who = row.Display == row.Name || row.IsNpc ? row.Display : $"{row.Display} ({row.Name})"; + return row.Idle is { } idle ? $"{who} · {idle}" : who; + } + + // ── Input: the list's own, never routed on to the cells (bar the right click) ──────────────── + + protected override void OnPointerMoved(PointerEventArgs e) + { + base.OnPointerMoved(e); + e.Handled = true; + Hover(RowAt(e.GetPosition(this))); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + Hover(null); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + e.Handled = true; + var point = e.GetCurrentPoint(this); + if (point.Properties.IsRightButtonPressed) + { + _view.ForwardRightClick(e.GetPosition(_view), e.KeyModifiers); + return; + } + + _pressed = point.Properties.IsLeftButtonPressed ? RowAt(point.Position) : null; + InvalidateVisual(); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + var pressed = _pressed; + _pressed = null; + InvalidateVisual(); + if (e.InitialPressMouseButton == MouseButton.Left && pressed is { } index && RowAt(e.GetPosition(this)) == index) + { + _pick?.Invoke(index); + } + } + + protected override void OnPointerWheelChanged(PointerWheelEventArgs e) + { + base.OnPointerWheelChanged(e); + e.Handled = true; + } + + /// Clicks row as a left press and release over it would. Internal for tests. + internal void PerformClick(int index) + { + if (Rows.Any(r => r.Index == index)) + { + _pick?.Invoke(index); + } + } + + // ── Drawing ────────────────────────────────────────────────────────────────────────────────── + + public override void Render(DrawingContext context) + { + var bounds = new Rect(Bounds.Size); + context.FillRectangle(new SolidColorBrush(_plane), bounds); + if (bounds.Width < 16 || bounds.Height < 8) + { + return; + } + + Layout(bounds.Size); + var size = FontSize; + var dim = PanelText.Alpha(_text, 0xA0); + var accent = PanelText.Parse(_ink.Bar); + var left = Pad + 4; + var right = bounds.Width - Pad - 4; + + if (!_model.Known) + { + PanelText.Draw(context, WhoHereModel.UnknownText, left, HeaderHeight / 2, size, dim, false, right - left); + return; + } + + // HERE The Grand Plaza · 4 + var middle = HeaderHeight / 2; + var x = left; + x += PanelText.Draw(context, "HERE", x, middle, size * 0.82, accent, true, right - x) + 10; + var count = $"· {_model.Rows.Count.ToString(CultureInfo.InvariantCulture)}"; + var countWidth = PanelText.Measure(count, size, false); + if (_model.Room is { } room) + { + x += PanelText.Draw(context, room, x, middle, size, _text, true, right - x - countWidth - 6) + 6; + } + + PanelText.Draw(context, count, x, middle, size, dim, false, right - x); + context.DrawLine( + new Pen(new SolidColorBrush(PanelText.Alpha(_text, 0x22)), 1), + new Point(Pad / 2, HeaderHeight + 0.5), + new Point(bounds.Width - (Pad / 2), HeaderHeight + 0.5)); + + if (_model.Rows.Count == 0) + { + PanelText.Draw(context, WhoHereModel.EmptyText, left, HeaderHeight + 2 + (RowHeight / 2), size, dim, false, right - left); + return; + } + + var idleWidth = _model.ShowsIdle ? PanelText.Measure("idle 59m", size * 0.9, false) + 8 : 0; + foreach (var (index, rect) in _rows) + { + var row = _model.Rows[index]; + if (index == _hovered || index == _pressed) + { + var plate = (byte)(index == _pressed ? 0x38 : 0x1E); + context.DrawRectangle(new SolidColorBrush(PanelText.Alpha(_text, plate)), null, rect, 4, 4); + } + + var centre = rect.Center.Y; + var dot = new Point(left + 4, centre); + if (row.IsNpc) + { + context.DrawEllipse(null, new Pen(new SolidColorBrush(PanelText.Alpha(_text, 0x70)), 1.2), dot, 3, 3); + } + else + { + var colour = row.State == WhoPresence.Idle ? PanelText.Alpha(_text, 0x60) : accent; + context.DrawEllipse(new SolidColorBrush(colour), null, dot, 4, 4); + } + + var nameLeft = left + 16; + var nameRoom = right - nameLeft - idleWidth; + PanelText.Draw(context, row.Display, nameLeft, centre, size, row.IsNpc ? PanelText.Alpha(_text, 0x88) : _text, false, nameRoom); + if (row.Idle is { } idle && idleWidth > 0) + { + var active = row.State == WhoPresence.Active; + PanelText.Draw(context, idle, right, centre, size * 0.9, active ? PanelText.Alpha(accent, 0xD0) : dim, false, idleWidth, alignRight: true); + } + } + + if (_overflow is { } more) + { + var y = HeaderHeight + 2 + (_rows.Count * RowHeight) + (RowHeight / 2); + PanelText.Draw(context, more, left, y, size * 0.9, dim, false, right - left); + } + } +} diff --git a/src/SharpMUTerm.Client/Panels/QuickBarModel.cs b/src/SharpMUTerm.Client/Panels/QuickBarModel.cs new file mode 100644 index 00000000..05875b5b --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/QuickBarModel.cs @@ -0,0 +1,49 @@ +using SharpMUTerm.Core.Commands; + +namespace SharpMUTerm.Client.Panels; + +/// One binding on the quick bar, as every view of it draws it. +/// The key as printed: F1, ⌃F2. +/// The descriptor the key fires (Ctrl+F2), which the client runs on a click. +/// The binding's name, on one line. +/// Whether pressing the key reaches the binding on this host; one that does not is still +/// clickable and drawn dim. +public sealed record QuickBarItem(string Key, string Descriptor, string Title, bool Fires); + +/// +/// The quick bar's content for one character: its function-key bindings in the order every view lists them, plain +/// keys before modified ones and then by number. The terminal draws them as a row of cells (QuickBarRenderer); +/// the window draws native buttons over that row from the same instance, so an item index names the same binding +/// in both. Nothing here marks a binding as dangerous: the configuration says no such thing, so no view may. +/// +public sealed record QuickBarModel(IReadOnlyList Items) +{ + /// The key that opens the bindings, as the hint prints it. + public const string EditKey = "F4"; + + /// The hint naming where the keys are edited. + public const string EditHint = EditKey + " edits keys"; + + /// The command a click on the hint dispatches: the F4 screen, through the registry. + public const string EditCommand = CommandIds.ScreenPrefix + "keypad"; + + /// What every view says when there are no bindings to show. + public const string EmptyText = "No function keys bound"; + + /// No bindings. + public static QuickBarModel Empty { get; } = new([]); + + /// Value equality over the items, which a record's list member does not give. + public bool Equals(QuickBarModel? other) => other is not null && Items.SequenceEqual(other.Items); + + public override int GetHashCode() + { + var hash = new HashCode(); + foreach (var item in Items) + { + hash.Add(item); + } + + return hash.ToHashCode(); + } +} diff --git a/src/SharpMUTerm.Client/Panels/WhoHereModel.cs b/src/SharpMUTerm.Client/Panels/WhoHereModel.cs new file mode 100644 index 00000000..2b56efbc --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/WhoHereModel.cs @@ -0,0 +1,87 @@ +using System.Globalization; +using SharpMUTerm.Core.Protocols; + +namespace SharpMUTerm.Client.Panels; + +/// Whether a person in the room is at the keyboard, as far as the game says. +public enum WhoPresence +{ + /// Active, or the game sends no idle time for them. + Active, + + /// Idle for at least . + Idle, +} + +/// One person or creature in the room, as every view of the who-here panel draws it. +/// The name a look uses: bounded and free of whitespace by . +/// What the panel shows: a player's full name when the game sends one, else the name. +/// Active or idle; a creature is always . +/// How long the player has been idle as it reads (active, idle 4m), or null when the +/// game does not say. +/// A creature from Char.Items rather than a player. +public sealed record WhoHereRow(string Name, string Display, WhoPresence State, string? Idle, bool IsNpc); + +/// +/// The who-here panel's content for one character, with no presentation in it: the room's name and who is in it, +/// in the roster's order. The terminal draws it as rows of cells (WhoHereRenderer); the window draws a +/// native list over those cells from the same instance, so a row index names the same person in both. +/// +/// Whether the game has said who is here at all. +/// The room's name, when the game sends one. +/// Who is here. +public sealed record WhoHereModel(bool Known, string? Room, IReadOnlyList Rows) +{ + /// Under this many seconds idle a player reads active. + public const int ActiveSeconds = 60; + + /// What every view says before the game has said who is here. + public const string UnknownText = "The game has not said who is here."; + + /// What every view says in a room with nobody else in it. + public const string EmptyText = "Nobody else is here."; + + /// The game has not said who is here. + public static WhoHereModel Unknown { get; } = new(false, null, []); + + /// Whether any row carries an idle time, so a view knows whether to give the column room. + public bool ShowsIdle => Rows.Any(r => r.Idle is not null); + + /// The model for a room name and a roster snapshot. + public static WhoHereModel From(string? room, IReadOnlyList occupants) => + new( + true, + string.IsNullOrWhiteSpace(room) ? null : room.Trim(), + occupants.Select(o => new WhoHereRow( + o.Name, + o.Display, + o.IsPlayer && o.IdleSeconds is >= ActiveSeconds ? WhoPresence.Idle : WhoPresence.Active, + o.IsPlayer && o.IdleSeconds is { } seconds ? IdleText(seconds) : null, + !o.IsPlayer)).ToList()); + + /// How an idle time reads: active, idle 4m, idle 2h, idle 3d. + public static string IdleText(int seconds) => seconds switch + { + < ActiveSeconds => "active", + < 3600 => $"idle {(seconds / 60).ToString(CultureInfo.InvariantCulture)}m", + < 86400 => $"idle {(seconds / 3600).ToString(CultureInfo.InvariantCulture)}h", + _ => $"idle {Math.Min(99, seconds / 86400).ToString(CultureInfo.InvariantCulture)}d", + }; + + /// Value equality over the rows, which a record's list member does not give. + public bool Equals(WhoHereModel? other) => + other is not null && Known == other.Known && Room == other.Room && Rows.SequenceEqual(other.Rows); + + public override int GetHashCode() + { + var hash = new HashCode(); + hash.Add(Known); + hash.Add(Room); + foreach (var row in Rows) + { + hash.Add(row); + } + + return hash.ToHashCode(); + } +} diff --git a/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs b/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs index 566ac149..a8165981 100644 --- a/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs @@ -1,4 +1,5 @@ using System.Globalization; +using SharpMUTerm.Client.Panels; using SharpMUTerm.Core.Automation; using static SharpMUTerm.Tui.MarkupText; @@ -7,7 +8,9 @@ namespace SharpMUTerm.Tui.Panels; /// /// The quick bar: one row of the character's function-key macros — F1 kick F2 bash F3 cure light — with /// F4 edits keys at the right. Each entry is a link ( and its index) that the -/// panel's own handler runs through the macro path the key itself takes. Elided to the width, never wrapped. +/// panel's own handler runs through the macro path the key itself takes. Elided to the width, never wrapped. Drawn +/// from a , the one the window's native buttons are drawn from, so entry N is the same +/// binding in both. /// internal static class QuickBarRenderer { @@ -18,21 +21,16 @@ internal static class QuickBarRenderer internal const int MaxNameWidth = 16; /// The right-hand hint naming where the keys are edited. - internal const string Hint = "F4 edits keys"; - - /// One entry: the key as printed (F1, ⌃F2), the descriptor it fires, its name. - /// Whether pressing the key reaches the macro on this host (); - /// one that does not is still clickable and drawn dim. - internal readonly record struct Entry(string Key, string Descriptor, string Name, bool Fires); + internal const string Hint = QuickBarModel.EditHint; /// /// The function-key bindings to show, from the bindings that resolve: one per key, plain keys before modified /// ones, then by number. A binding with neither a command nor a script is left out, as the key path leaves it. /// - internal static IReadOnlyList Entries(IEnumerable macros, Func resolve) + internal static QuickBarModel Entries(IEnumerable macros, Func resolve) { var seen = new HashSet(StringComparer.OrdinalIgnoreCase); - var entries = new List<(Entry Entry, int Modifiers, int Number)>(); + var entries = new List<(QuickBarItem Entry, int Modifiers, int Number)>(); foreach (var candidate in macros) { if (!MacroKey.TryParse(candidate.Key, out var parts) @@ -58,20 +56,21 @@ internal static IReadOnlyList Entries(IEnumerable macros, Func e.Modifiers).ThenBy(e => e.Number).Select(e => e.Entry).ToList(); + return new QuickBarModel(entries.OrderBy(e => e.Modifiers).ThenBy(e => e.Number).Select(e => e.Entry).ToList()); } /// The row for cells. Entries that do not fit are counted, never wrapped. - internal static string Render(IReadOnlyList entries, int width, string accent) + internal static string Render(QuickBarModel model, int width, string accent) { + var entries = model.Items; width = Math.Max(1, width); - var hint = $"[bold {accent}]F4[/][dim] edits keys[/]"; + var hint = $"[bold {accent}]{QuickBarModel.EditKey}[/][dim]{QuickBarModel.EditHint[QuickBarModel.EditKey.Length..]}[/]"; if (entries.Count == 0) { - return ElideVisible($"[dim]No function keys bound · [/]{hint}", width); + return ElideVisible($"[dim]{QuickBarModel.EmptyText} · [/]{hint}", width); } var cells = entries.Select((e, i) => Cell(e, i, accent)).ToList(); @@ -116,9 +115,9 @@ internal static string Render(IReadOnlyList entries, int width, string ac return null; } - private static string Cell(Entry entry, int index, string accent) + private static string Cell(QuickBarItem entry, int index, string accent) { - var name = entry.Name.Length <= MaxNameWidth ? entry.Name : entry.Name[..(MaxNameWidth - 1)] + "…"; + var name = entry.Title.Length <= MaxNameWidth ? entry.Title : entry.Title[..(MaxNameWidth - 1)] + "…"; var link = $"[link={LinkPrefix}{index.ToString(CultureInfo.InvariantCulture)}]"; return entry.Fires ? $"{link}[bold {accent}]{Escape(entry.Key)}[/] {Escape(name)}[/]" diff --git a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs index ff2766b5..d936b074 100644 --- a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs @@ -1,4 +1,5 @@ using System.Globalization; +using SharpMUTerm.Client.Panels; using SharpMUTerm.Core.Protocols; using static SharpMUTerm.Tui.MarkupText; @@ -7,7 +8,8 @@ namespace SharpMUTerm.Tui.Panels; /// /// The who-here panel: HERE The Grand Plaza · 4, then one row per person — players with a dot and how /// long they have been idle when the game says, creatures dimmed under them. Every name is a link -/// ( and its row), answered by the panel's own handler and by nothing else. +/// ( and its row), answered by the panel's own handler and by nothing else. Drawn from a +/// , the one the window's native list is drawn from, so row N is the same person in both. /// internal static class WhoHereRenderer { @@ -18,7 +20,13 @@ internal static class WhoHereRenderer internal const int IdleWidth = 8; /// Under this many seconds idle a player reads active. - internal const int ActiveSeconds = 60; + internal const int ActiveSeconds = WhoHereModel.ActiveSeconds; + + /// What the panel says before the game has said who is here. + internal const string UnknownText = WhoHereModel.UnknownText; + + /// What the panel says in an empty room. + internal const string EmptyText = WhoHereModel.EmptyText; /// The panel's colours: the dot of an active player, and the plane they are measured on. internal readonly record struct Ink(string Accent); @@ -27,38 +35,48 @@ internal static class WhoHereRenderer /// The panel's rows for a box by cells. Never wider than the /// box and never taller: a room fuller than the box ends in … and N more. /// - internal static List Render(string? room, IReadOnlyList occupants, int width, int height, Ink ink) + internal static List Render(string? room, IReadOnlyList occupants, int width, int height, Ink ink) => + Render(WhoHereModel.From(room, occupants), width, height, ink); + + /// The panel's rows for a model; see the other overload. + internal static List Render(WhoHereModel model, int width, int height, Ink ink) { + if (!model.Known) + { + return [$"[dim]{UnknownText}[/]"]; + } + width = Math.Max(8, width); height = Math.Max(1, height); var lines = new List(); + var rowsIn = model.Rows; - var count = $" · {occupants.Count.ToString(CultureInfo.InvariantCulture)}"; - var title = string.IsNullOrWhiteSpace(room) ? string.Empty : " " + Escape(room.Trim()); + var count = $" · {rowsIn.Count.ToString(CultureInfo.InvariantCulture)}"; + var title = model.Room is { } room ? " " + Escape(room) : string.Empty; lines.Add(ElideVisible($"[bold {ink.Accent}]HERE[/]{title}[dim]{count}[/]", width)); if (height == 1) { return lines; } - if (occupants.Count == 0) + if (rowsIn.Count == 0) { - lines.Add("[dim]Nobody else is here.[/]"); + lines.Add($"[dim]{EmptyText}[/]"); return lines; } - var showIdle = occupants.Any(o => o.IdleSeconds is not null) && width >= IdleWidth + 8; + var showIdle = model.ShowsIdle && width >= IdleWidth + 8; var nameWidth = width - 2 - (showIdle ? IdleWidth + 1 : 0); var rows = height - 1; - var fits = occupants.Count <= rows ? occupants.Count : Math.Max(0, rows - 1); + var fits = rowsIn.Count <= rows ? rowsIn.Count : Math.Max(0, rows - 1); for (var i = 0; i < fits; i++) { - lines.Add(Row(occupants[i], i, nameWidth, showIdle, ink)); + lines.Add(Row(rowsIn[i], i, nameWidth, showIdle, ink)); } - if (fits < occupants.Count) + if (fits < rowsIn.Count) { - lines.Add($"[dim]… and {(occupants.Count - fits).ToString(CultureInfo.InvariantCulture)} more[/]"); + lines.Add($"[dim]… and {(rowsIn.Count - fits).ToString(CultureInfo.InvariantCulture)} more[/]"); } return lines; @@ -72,33 +90,25 @@ internal static List Render(string? room, IReadOnlyList oc : null; /// How an idle time reads: active, idle 4m, idle 2h, idle 3d. - internal static string Idle(int seconds) => seconds switch - { - < ActiveSeconds => "active", - < 3600 => $"idle {(seconds / 60).ToString(CultureInfo.InvariantCulture)}m", - < 86400 => $"idle {(seconds / 3600).ToString(CultureInfo.InvariantCulture)}h", - _ => $"idle {Math.Min(99, seconds / 86400).ToString(CultureInfo.InvariantCulture)}d", - }; + internal static string Idle(int seconds) => WhoHereModel.IdleText(seconds); - private static string Row(RoomOccupant who, int index, int nameWidth, bool showIdle, Ink ink) + private static string Row(WhoHereRow who, int index, int nameWidth, bool showIdle, Ink ink) { var name = Escape(Fit(who.Display, nameWidth)); var link = $"[link={LinkPrefix}{index.ToString(CultureInfo.InvariantCulture)}]"; - if (!who.IsPlayer) + if (who.IsNpc) { return $"[dim]·[/] {link}[dim]{name}[/][/]"; } - var idle = who.IdleSeconds is { } seconds && seconds >= ActiveSeconds; - var dot = idle ? "[dim]●[/]" : $"[{ink.Accent}]●[/]"; + var dot = who.State == WhoPresence.Idle ? "[dim]●[/]" : $"[{ink.Accent}]●[/]"; var row = $"{dot} {link}{name}[/]"; if (!showIdle) { return row; } - var status = who.IdleSeconds is { } s ? Idle(s) : string.Empty; - return PadVisible(row, nameWidth + 2) + " " + $"[dim]{status.PadLeft(IdleWidth)}[/]"; + return PadVisible(row, nameWidth + 2) + " " + $"[dim]{(who.Idle ?? string.Empty).PadLeft(IdleWidth)}[/]"; } private static string Fit(string text, int width) => diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 82ecd577..dd70029e 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -156,6 +156,19 @@ void HeaderActions(IReadOnlyList actions) /// For the map, walks the panel's own character to a room by id, through the speedwalk a click on a cell map uses. /// Safe to call from any thread. The same instance for as long as the window lives, so an overlay compares equal. /// +/// For the who-here panel, its content: the same model its cell rows are drawn from. +/// For the quick bar, its content: the same model its cell row is drawn from. +/// +/// For who-here and the quick bar, does what a click on row or item N of the cells does, on the panel's own +/// character: who-here puts look and the name on that character's command line, the quick bar runs the +/// binding through the key's own path. The index is into the model this overlay carries; the client reads the row +/// back from what it published, so the host never names a person or a command. Safe to call from any thread, and +/// the same instance for as long as the window lives. +/// +/// +/// Runs a command id through the client's registry (the quick bar's F4 edits keys is +/// ). Safe to call from any thread; one instance. +/// internal sealed record PanelOverlay( string PanelId, string WindowId, @@ -163,7 +176,11 @@ internal sealed record PanelOverlay( PanelInk Ink, SharpMUTerm.Client.Panels.VitalsModel? Vitals, SharpMUTerm.Client.Panels.MapViewModel? Map = null, - Action? WalkTo = null); + Action? WalkTo = null, + SharpMUTerm.Client.Panels.WhoHereModel? WhoHere = null, + SharpMUTerm.Client.Panels.QuickBarModel? QuickBar = null, + Action? Pick = null, + Action? Dispatch = null); /// A panel's colours as #rrggbb: a bar or fill, the warning, and the empty part of a bar. internal sealed record PanelInk(string Bar, string Low, string Track); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs index 6b57afaf..9c3a2b4e 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -31,6 +31,12 @@ internal sealed partial class SharpMUTermApp /// One walk callback per map window, kept so an overlay compares equal from frame to frame. private readonly Dictionary> _mapWalkers = new(StringComparer.Ordinal); + /// One pick callback per who-here or quick-bar window, for the same reason. + private readonly Dictionary> _panelPickers = new(StringComparer.Ordinal); + + /// The one command callback every native panel is handed. + private Action? _panelDispatch; + /// Tells the host which header buttons it may draw. Once, at construction. private void AnnounceHeaderActions() => _pointer?.HeaderActions( @@ -158,7 +164,7 @@ private static string Capitalise(string text) => /// /// Tells the host which panels are on screen, where, and what they show, when any of that changed. Rides the /// frame, for ' reason. A panel is on screen when its window is the front tab of - /// a realised pane. + /// a realised pane and no modal window covers the main one. /// private void PublishPanels() { @@ -167,8 +173,10 @@ private void PublishPanels() return; } + // A modal over the main window (a settings screen, ⌃P, F1) is drawn in cells over the panes; a native view + // would sit on top of it, so while one is up no panel is on screen as far as the host is concerned. var overlays = new List(); - foreach (var (paneId, rect) in PaneOutputRects()) + foreach (var (paneId, rect) in !_system.ModalStateService.HasModals ? PaneOutputRects() : new Dictionary()) { if (_workspace.Layout.FindPane(paneId) is not { ActiveTab: { } windowId }) { @@ -199,6 +207,17 @@ private void PublishPanels() var ink = VitalsInk(); overlays.Add(new PanelOverlay(panelId, windowId, rect, new PanelInk(ink.Bar, ink.Low, ink.Empty), ReadVitals(key))); } + else if (panelId == PanelIds.WhoHere) + { + overlays.Add(new PanelOverlay( + panelId, windowId, rect, PanelListInk(), null, WhoHere: ReadWhoHere(key), Pick: PickerFor(windowId, key))); + } + else if (panelId == PanelIds.QuickBar) + { + overlays.Add(new PanelOverlay( + panelId, windowId, rect, PanelListInk(), null, QuickBar: QuickBarEntries(key), Pick: PickerFor(windowId, key), + Dispatch: _panelDispatch ??= id => OnUiThread(() => DispatchCommand(id)))); + } } if (overlays.SequenceEqual(_panelOverlays)) @@ -210,6 +229,31 @@ private void PublishPanels() _pointer.Panels(overlays); } + /// The list panels' colours: the accent their cells draw an active dot and a key in, and the warning. + private PanelInk PanelListInk() => new(_ink.Accent, _ink.Notice, _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))); + + /// + /// A who-here or quick-bar window's pick callback: the row or item at an index of the model last published for + /// that window, acted on exactly as a click on its cells is, on the window's own character. + /// + private Action PickerFor(string windowId, string sessionKey) => + _panelPickers.TryGetValue(windowId, out var known) + ? known + : _panelPickers[windowId] = index => OnUiThread(() => PickFromPanel(windowId, sessionKey, index)); + + private void PickFromPanel(string windowId, string sessionKey, int index) + { + var published = _panelOverlays.FirstOrDefault(p => p.WindowId == windowId); + if (published?.WhoHere is { } who && index >= 0 && index < who.Rows.Count) + { + OfferLook(windowId, sessionKey, who.Rows[index].Name); + } + else if (published?.QuickBar is { } bar && index >= 0 && index < bar.Items.Count) + { + RunQuickMacro(sessionKey, bar.Items[index].Descriptor); + } + } + /// /// A map window's native model, rebuilt only when the cell map has been redrawn since ( /// counts), so a frame that changed nothing on the map costs a dictionary lookup. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index 48e96586..b564e791 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -94,26 +94,18 @@ private void ShowPanel(string panelId) private IWindowControl NewWhoHerePanel(TerminalPanelContext context) { - IReadOnlyList drawn = []; + IReadOnlyList drawn = []; var view = NewPanelView(context, (width, height) => { - var roster = PanelOccupants(context.SessionKey); - if (roster is not { Known: true }) - { - drawn = []; - return ["[dim]The game has not said who is here.[/]"]; - } - - drawn = roster.Snapshot; - var data = PanelGameData(context.SessionKey); - var room = data is null ? null : StatusMeter.Read(data, "Room.Info.name|MSDP.ROOM_NAME"); - return WhoHereRenderer.Render(room, drawn, width, height, new WhoHereRenderer.Ink(_ink.Accent)); + var model = ReadWhoHere(context.SessionKey); + drawn = model.Rows; + return WhoHereRenderer.Render(model, width, height, new WhoHereRenderer.Ink(_ink.Accent)); }); view.Click = url => { if (WhoHereRenderer.ParseLink(url) is { } index && index < drawn.Count) { - OfferLook(context, drawn[index]); + OfferLook(context.WindowId, context.SessionKey, drawn[index].Name); } }; @@ -137,17 +129,33 @@ private IWindowControl NewWhoHerePanel(TerminalPanelContext context) return view.Control; } + /// + /// A character's who-here panel as the one model every view draws (): the cell rows + /// here, and the window's native list through . + /// + internal WhoHereModel ReadWhoHere(string sessionKey) + { + if (PanelOccupants(sessionKey) is not { Known: true } roster) + { + return WhoHereModel.Unknown; + } + + var data = PanelGameData(sessionKey); + var room = data is null ? null : StatusMeter.Read(data, "Room.Info.name|MSDP.ROOM_NAME"); + return WhoHereModel.From(room, roster.Snapshot); + } + /// /// A click on a name puts look Name on the character's command line and sends nothing: the name is the /// game's text, and the player sees the line before ⏎. It lands on the bar of the panel's own character — the /// panel's window is brought forward when the one in front belongs to someone else. /// - private void OfferLook(TerminalPanelContext context, RoomOccupant who) + private void OfferLook(string windowId, string sessionKey, string name) { var owner = WindowSession(ActiveWindowId())?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey; - if (!string.Equals(owner, context.SessionKey, StringComparison.Ordinal)) + if (!string.Equals(owner, sessionKey, StringComparison.Ordinal)) { - Activate(context.WindowId); + Activate(windowId); } if (ArmedComposer() is not null) @@ -155,8 +163,8 @@ private void OfferLook(TerminalPanelContext context, RoomOccupant who) ReleaseComposer(); } - PlaceGrab(ActiveBar(), $"look {who.Name}", context.SessionKey); - Notice($"look {Snippet(who.Name)} is on the command line — ⏎ sends it", MessageSeverity.Info); + PlaceGrab(ActiveBar(), $"look {name}", sessionKey); + Notice($"look {Snippet(name)} is on the command line — ⏎ sends it", MessageSeverity.Info); } // --- Vitals ----------------------------------------------------------------------------------------------- @@ -211,17 +219,18 @@ private VitalsStripRenderer.Ink VitalsInk() => private IWindowControl NewQuickBarPanel(TerminalPanelContext context) { - IReadOnlyList drawn = []; + IReadOnlyList drawn = []; var view = NewPanelView(context, (width, _) => { - drawn = QuickBarEntries(context.SessionKey); - return [QuickBarRenderer.Render(drawn, width, _ink.Accent)]; + var model = QuickBarEntries(context.SessionKey); + drawn = model.Items; + return [QuickBarRenderer.Render(model, width, _ink.Accent)]; }); view.Click = url => { if (QuickBarRenderer.ParseLink(url) is { } index && index < drawn.Count) { - RunQuickMacro(context, drawn[index]); + RunQuickMacro(context.SessionKey, drawn[index].Descriptor); } }; return view.Control; @@ -231,7 +240,7 @@ private IWindowControl NewQuickBarPanel(TerminalPanelContext context) /// The function-key bindings a character's quick bar lists: its session's engine when it has one (so a script's /// runtime binding shows), else the bindings its trigger sets configure. /// - private IReadOnlyList QuickBarEntries(string sessionKey) + internal QuickBarModel QuickBarEntries(string sessionKey) { if (FindSession(sessionKey) is { } session) { @@ -240,7 +249,7 @@ private IWindowControl NewQuickBarPanel(TerminalPanelContext context) if (FindCharacter(sessionKey) is not { } found) { - return []; + return QuickBarModel.Empty; } var macros = _config.ResolveTriggerSets(found.Character, found.World).SelectMany(s => s.Macros).ToList(); @@ -252,16 +261,16 @@ private IWindowControl NewQuickBarPanel(TerminalPanelContext context) /// A click on an entry runs that binding through — the path the key /// itself takes — on the panel's own character, never the one in front. /// - private void RunQuickMacro(TerminalPanelContext context, QuickBarRenderer.Entry entry) + private void RunQuickMacro(string sessionKey, string descriptor) { - if (FindSession(context.SessionKey) is not { } session) + if (FindSession(sessionKey) is not { } session) { - RefuseCommand($"{Snippet(context.SessionKey)} has no open session — ⌃P ▸ Switch to it opens one"); + RefuseCommand($"{Snippet(sessionKey)} has no open session — ⌃P ▸ Switch to it opens one"); return; } - _ = session.HandleKeyAsync(entry.Descriptor); - LastQuickMacro = entry.Descriptor; + _ = session.HandleKeyAsync(descriptor); + LastQuickMacro = descriptor; } /// The descriptor the quick bar last ran, for the tests. @@ -666,6 +675,31 @@ private IReadOnlyList PanelMeters(string sessionKey) // --- The snapshot views ----------------------------------------------------------------------------------- + /// + /// Function-key bindings for the demo character, which the demo configuration does not carry: a trigger set + /// named Quick, added and listed the way F2 and F5 would. For the quick-bar views. + /// + private void LoadDemoBindings() + { + if (_config.TriggerSets.Any(s => s.Name == "Quick")) + { + return; + } + + _config.TriggerSets.Add(new TriggerSet + { + Name = "Quick", + Macros = + { + new Macro { Name = "kick", Key = "F11", Command = "kick" }, + new Macro { Name = "bash", Key = "F12", Command = "bash" }, + new Macro { Name = "cure light", Key = "Ctrl+F3", Command = "cast 'cure light'" }, + new Macro { Name = "quaff mana", Key = "Ctrl+F4", Command = "quaff mana" }, + }, + }); + FindCharacter(DemoScene.ActiveSessionKey)?.Character.TriggerSets.Add("Quick"); + } + /// /// The four panel views, each opened through its real ⌃P entry and placed the way its layout places it: /// panel-who a narrow column beside the output; panel-vitals a strip over it, with a target; @@ -693,18 +727,7 @@ private void LoadDemoPanels(string view) break; case "panel-quickbar": - _config.TriggerSets.Add(new TriggerSet - { - Name = "Quick", - Macros = - { - new Macro { Name = "kick", Key = "F11", Command = "kick" }, - new Macro { Name = "bash", Key = "F12", Command = "bash" }, - new Macro { Name = "cure light", Key = "Ctrl+F3", Command = "cast 'cure light'" }, - new Macro { Name = "quaff mana", Key = "Ctrl+F4", Command = "quaff mana" }, - }, - }); - FindCharacter(DemoScene.ActiveSessionKey)?.Character.TriggerSets.Add("Quick"); + LoadDemoBindings(); OpenDemoPanelStrip(PanelIds.QuickBar, Edge.Bottom); Activate(MainWindowId); break; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index d2d6cf54..190757bc 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1006,6 +1006,10 @@ public SharpMUTermApp( SyncPanelSizes(); SyncScrollSplitBars(); }; + + // A modal that covers the main window entirely leaves it unpainted, so no PostBufferPaint says the native + // panels are now under it; the modal stack changing says it instead. + _system.ModalStateService.StateChanged += (_, _) => PublishPanels(); if (_sixel is not null) { // Another window over this one rewrites the cells a picture sits on, and the frame that puts @@ -1862,7 +1866,8 @@ public string RenderSnapshot(string? view = null) // Layouts. `layouts` is the ⌥M list over the demo, opened through the registered shortcut itself; // `layout-combat` is the demo with the Combat layout realised through the same ApplyLayout ⌥M ⏎ runs, over - // the demo's game data (vitals, so the meters have values) and its recorded streets (so the map has rooms). + // the demo's game data (vitals, so the meters have values), its recorded streets (so the map has rooms) and + // a few function-key bindings (so the quick bar has buttons). // Panels nothing draws yet stay out, which is the data gating the frame is there to show. if (string.Equals(view, "layouts", StringComparison.OrdinalIgnoreCase)) { @@ -1873,6 +1878,7 @@ public string RenderSnapshot(string? view = null) { LoadDemoGameData(); LoadDemoMap(); + LoadDemoBindings(); ApplyLayout(DemoScene.ActiveSessionKey, Core.Layouts.BuiltInLayouts.Combat); } diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs index 815f7aeb..36281a5c 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -309,7 +309,7 @@ [new MapViewExit(1, 2)], // ── helpers ────────────────────────────────────────────────────────────────────────────────── - private static SharpMUTermApp InlineWindowApp(AvaloniaConsoleDriver driver) => + internal static SharpMUTermApp InlineWindowApp(AvaloniaConsoleDriver driver) => new(DemoScene.Build(), WindowHost.Create(driver, clipboard: null) with { Capabilities = WindowOptions.Capabilities, @@ -329,9 +329,9 @@ private static void Publish(AvaloniaConsoleDriver driver, PaneRect rect) => ((IPointerPresenter)driver.Pointer).Panels( [new PanelOverlay(PanelIds.Vitals, "panel:vitals:demo", rect, new PanelInk("#3ccf6a", "#ff5555", "#333338"), Vitals)]); - private static void Drain() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); + internal static void Drain() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); - private static Task Run( + internal static Task Run( Func body, int columns = 40, int rows = 10) => Session.Dispatch(() => { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs new file mode 100644 index 00000000..bc0830b4 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs @@ -0,0 +1,321 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Input; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; +using SharpMUTerm.Tui.Panels; +using static SharpMUTerm.Avalonia.Tests.DesktopLayerTests; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's native who-here list and quick bar (, ): drawn +/// over their panes from the models the cell panels are drawn from, moving no pane, and handing a click to the +/// client's own callback — never to the driver, and never as a command the window built. +/// +public class NativePanelTests +{ + private static readonly WhoHereModel Who = WhoHereModel.From( + "The Grand Plaza", + [ + new RoomOccupant("Ashlyn", "Ashlyn the Wanderer", true, 30), + new RoomOccupant("Bo", "Bo", true, 900), + new RoomOccupant("rat", "a sewer rat", false, Id: "7"), + ]); + + private static readonly QuickBarModel Bar = new( + [ + new QuickBarItem("F11", "F11", "kick", true), + new QuickBarItem("F12", "F12", "bash", true), + new QuickBarItem("⌃F3", "Ctrl+F3", "cure light", true), + new QuickBarItem("⌃F4", "Ctrl+F4", "quaff mana", true), + new QuickBarItem("⌃F5", "Ctrl+F5", "rescue", false), + ]); + + private static readonly PanelInk Ink = new("#3ccf6a", "#ff5555", "#333338"); + + // ── The client's half ──────────────────────────────────────────────────────────────────────── + + [Test] + public async Task TheClientPublishesWhoHereWithTheModelItsCellRowsAreDrawnFrom() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("layout-roleplay"); + + var panel = driver.Pointer.Panels.SingleOrDefault(p => p.PanelId == PanelIds.WhoHere); + await Assert.That(panel).IsNotNull(); + var pane = app.PaneOutputRects().Single(r => app.PaneWindows().GetValueOrDefault(r.Key) == panel!.WindowId); + await Assert.That(panel!.Rect).IsEqualTo(pane.Value); + await Assert.That(panel.WhoHere).IsEqualTo(app.ReadWhoHere(DemoScene.ActiveSessionKey)); + await Assert.That(panel.WhoHere!.Rows.Count).IsGreaterThan(0); + await Assert.That(panel.Pick).IsNotNull(); + + // Row N of the model is row N of the cells: the same name under the same link index. + var cells = WhoHereRenderer.Render(panel.WhoHere, 60, 40, new WhoHereRenderer.Ink("#00f5b7")); + for (var i = 0; i < panel.WhoHere.Rows.Count; i++) + { + var line = cells.Single(l => l.Contains($"[link={WhoHereRenderer.LinkPrefix}{i}]", StringComparison.Ordinal)); + await Assert.That(Plain(line)).Contains(panel.WhoHere.Rows[i].Display); + } + } + + [Test] + public async Task TheClientPublishesTheQuickBarWithTheModelItsCellRowIsDrawnFrom() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("layout-combat"); + + var panel = driver.Pointer.Panels.SingleOrDefault(p => p.PanelId == PanelIds.QuickBar); + await Assert.That(panel).IsNotNull(); + var pane = app.PaneOutputRects().Single(r => app.PaneWindows().GetValueOrDefault(r.Key) == panel!.WindowId); + await Assert.That(panel!.Rect).IsEqualTo(pane.Value); + await Assert.That(panel.QuickBar).IsEqualTo(app.QuickBarEntries(DemoScene.ActiveSessionKey)); + await Assert.That(panel.QuickBar!.Items.Select(i => i.Key).Take(2)).IsEquivalentTo(new[] { "F11", "F12" }); + + var row = QuickBarRenderer.Render(panel.QuickBar, 140, "#00f5b7"); + for (var i = 0; i < panel.QuickBar.Items.Count; i++) + { + var item = panel.QuickBar.Items[i]; + await Assert.That(row).Contains($"[link={QuickBarRenderer.LinkPrefix}{i}]"); + await Assert.That(Plain(row)).Contains($"{item.Key} {item.Title}"); + } + } + + [Test] + public async Task NativeListsMoveNoPaneRectangle() + { + foreach (var view in new[] { "layout-roleplay", "layout-combat" }) + { + using var headless = new HeadlessConsoleDriver(140, 36); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities)); + terminal.RenderSnapshot(view); + + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var window = InlineWindowApp(driver); + window.RenderSnapshot(view); + + await Assert.That(driver.Pointer.Panels.Any(p => p.WhoHere is not null || p.QuickBar is not null)).IsTrue().Because(view); + await Assert.That(window.PaneOutputRects().OrderBy(r => r.Key).ToArray()) + .IsEquivalentTo(terminal.PaneOutputRects().OrderBy(r => r.Key).ToArray()); + } + } + + [Test] + public async Task APickFromTheNativeListPutsLookOnTheCommandLineAndSendsNothing() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("layout-roleplay"); + + var panel = driver.Pointer.Panels.Single(p => p.PanelId == PanelIds.WhoHere); + var first = panel.WhoHere!.Rows[0]; + panel.Pick!(0); + app.RenderNextFrame(); + + await Assert.That(app.PrimaryInputText).IsEqualTo($"look {first.Name}"); + + // Out of range is nothing: the index is read back from what the client published, never trusted. + panel.Pick(999); + app.RenderNextFrame(); + await Assert.That(app.PrimaryInputText).IsEqualTo($"look {first.Name}"); + await Assert.That(ReferenceEquals(driver.Pointer.Panels.Single(p => p.PanelId == PanelIds.WhoHere).Pick, panel.Pick)) + .IsTrue().Because("one pick callback per window, so an overlay compares equal"); + } + + [Test] + public async Task TheEditLinkDispatchesTheF4ScreenAndNoNativePanelCoversIt() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("layout-combat"); + + var panel = driver.Pointer.Panels.Single(p => p.PanelId == PanelIds.QuickBar); + await Assert.That(app.Contributions.Commands.Resolve(QuickBarModel.EditCommand)).IsNotNull(); + panel.Dispatch!(QuickBarModel.EditCommand); + app.RenderNextFrame(); + await Assert.That(app.OpenSettingsKey).IsEqualTo(ConsoleKey.F4); + await Assert.That(driver.Pointer.Panels).IsEmpty().Because("a native view would sit over the modal's cells"); + } + + // ── The window's half ──────────────────────────────────────────────────────────────────────── + + [Test] + public async Task TheWhoHereListCoversItsPaneAndAClickReachesThePickNotTheDriver() + { + var (listRect, paneRect, picked, clientSaw, rows, hovered, tip) = await Run((window, view, layer, driver) => + { + var picked = new List(); + ((IPointerPresenter)driver.Pointer).Panels([new PanelOverlay(PanelIds.WhoHere, "panel:who:demo", new PaneRect(2, 1, 30, 8), Ink, null, WhoHere: Who, Pick: picked.Add)]); + Drain(); + window.UpdateLayout(); + var list = layer.WhoHere.Values.Single(); + var cell = view.SizeFor(1, 1); + var paneRect = new Rect(2 * cell.Width, 1 * cell.Height, 30 * cell.Width, 8 * cell.Height); + var listRect = new Rect(Canvas.GetLeft(list), Canvas.GetTop(list), list.Bounds.Width, list.Bounds.Height); + + var clientSaw = new List>(); + driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); + var second = list.Rows.Single(r => r.Index == 1).Rect; + var at = list.TranslatePoint(second.Center, window)!.Value; + window.MouseMove(at); + var hovered = list.Hovered; + var tip = ToolTip.GetTip(list) as string; + window.MouseDown(at, MouseButton.Left); + window.MouseUp(at, MouseButton.Left); + + // A right click is the client's: the pane's menu, as over cells. + window.MouseDown(at, MouseButton.Right); + window.MouseUp(at, MouseButton.Right); + return (listRect, paneRect, picked, clientSaw, list.Rows.Count, hovered, tip); + }, columns: 40, rows: 12); + + await Assert.That(listRect).IsEqualTo(paneRect); + await Assert.That(rows).IsEqualTo(3); + await Assert.That(picked).IsEquivalentTo(new[] { 1 }); + await Assert.That(hovered).IsEqualTo(1); + await Assert.That(tip).IsNotNull().And.Contains("Bo").And.Contains("idle 15m"); + await Assert.That(clientSaw.Count).IsEqualTo(2).Because("only the right click is handed on, pressed and released"); + await Assert.That(clientSaw[0]).Contains(MouseFlags.Button3Pressed); + } + + [Test] + public async Task AShortPaneSaysHowManyTheListCouldNotShow() + { + var (rows, overflow) = await Run((window, view, layer, driver) => + { + var many = WhoHereModel.From("Hall", Enumerable.Range(0, 20).Select(i => new RoomOccupant($"P{i}", $"P{i}", true)).ToList()); + ((IPointerPresenter)driver.Pointer).Panels([new PanelOverlay(PanelIds.WhoHere, "panel:who:demo", new PaneRect(0, 1, 30, 6), Ink, null, WhoHere: many, Pick: _ => { })]); + Drain(); + window.UpdateLayout(); + var list = layer.WhoHere.Values.Single(); + return (list.Rows.Count, list.Overflow); + }, columns: 40, rows: 10); + + await Assert.That(rows).IsGreaterThan(0).And.IsLessThan(20); + await Assert.That(overflow).IsEqualTo($"… and {20 - rows} more"); + } + + [Test] + public async Task TheQuickBarIsAButtonPerBindingWithTheLinkAndAClickReachesThePickNotTheDriver() + { + var (barRect, paneRect, kinds, picked, dispatched, clientSaw) = await Run((window, view, layer, driver) => + { + var picked = new List(); + var dispatched = new List(); + ((IPointerPresenter)driver.Pointer).Panels( + [new PanelOverlay(PanelIds.QuickBar, "panel:quickbar:demo", new PaneRect(0, 8, 100, 1), Ink, null, QuickBar: Bar, Pick: picked.Add, Dispatch: dispatched.Add)]); + Drain(); + window.UpdateLayout(); + var bar = layer.QuickBars.Values.Single(); + var cell = view.SizeFor(1, 1); + var paneRect = new Rect(0, 8 * cell.Height, 100 * cell.Width, cell.Height); + var barRect = new Rect(Canvas.GetLeft(bar), Canvas.GetTop(bar), bar.Bounds.Width, bar.Bounds.Height); + var clientSaw = new List>(); + driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); + + void Click(QuickBarButtons.Slot slot) + { + var at = bar.TranslatePoint(slot.Rect.Center, window)!.Value; + window.MouseDown(at, MouseButton.Left); + window.MouseUp(at, MouseButton.Left); + } + + var slots = bar.Slots.ToList(); + Click(slots.Single(s => s.Kind == QuickBarButtons.SlotKind.Item && s.Index == 2)); + Click(slots.Single(s => s.Kind == QuickBarButtons.SlotKind.Edit)); + return (barRect, paneRect, slots.Select(s => s.Kind).ToArray(), picked, dispatched, clientSaw); + }, columns: 100, rows: 10); + + await Assert.That(barRect).IsEqualTo(paneRect); + await Assert.That(kinds.Count(k => k == QuickBarButtons.SlotKind.Item)).IsEqualTo(5).Because("every binding fits a wide bar"); + await Assert.That(kinds).Contains(QuickBarButtons.SlotKind.Edit); + await Assert.That(kinds).DoesNotContain(QuickBarButtons.SlotKind.More); + await Assert.That(picked).IsEquivalentTo(new[] { 2 }); + await Assert.That(dispatched).IsEquivalentTo(new[] { QuickBarModel.EditCommand }); + await Assert.That(clientSaw).IsEmpty().Because("a left click on the bar is the bar's"); + } + + [Test] + public async Task ANarrowBarPutsWhatDoesNotFitUnderPlusNAndItsMenuPicksOnTheSameIndex() + { + var (more, overflowed, menu, picked) = await Run((window, view, layer, driver) => + { + var picked = new List(); + ((IPointerPresenter)driver.Pointer).Panels( + [new PanelOverlay(PanelIds.QuickBar, "panel:quickbar:demo", new PaneRect(0, 8, 40, 1), Ink, null, QuickBar: Bar, Pick: picked.Add, Dispatch: _ => { })]); + Drain(); + window.UpdateLayout(); + var bar = layer.QuickBars.Values.Single(); + var more = bar.Slots.Single(s => s.Kind == QuickBarButtons.SlotKind.More); + var overflowed = bar.Overflowed.ToArray(); + bar.PerformClick(more); + Drain(); + var items = bar.OpenedMenu!.Items.OfType().ToList(); + items[^1].RaiseEvent(new global::Avalonia.Interactivity.RoutedEventArgs(MenuItem.ClickEvent)); + bar.OpenedMenu.Close(); + return (more, overflowed, items.Count, picked); + }, columns: 40, rows: 10); + + await Assert.That(overflowed.Length).IsGreaterThan(0); + await Assert.That(more.Index).IsEqualTo(overflowed.Length).Because("+N counts what it holds"); + await Assert.That(menu).IsEqualTo(overflowed.Length); + await Assert.That(picked).IsEquivalentTo(new[] { overflowed[^1] }); + } + + [Test] + public async Task NeitherNativePanelTakesKeyboardFocus() + { + var (whoFocusable, barFocusable, viewFocused) = await Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Panels( + [ + new PanelOverlay(PanelIds.WhoHere, "panel:who:demo", new PaneRect(0, 1, 20, 6), Ink, null, WhoHere: Who, Pick: _ => { }), + new PanelOverlay(PanelIds.QuickBar, "panel:quickbar:demo", new PaneRect(20, 8, 40, 1), Ink, null, QuickBar: Bar, Pick: _ => { }, Dispatch: _ => { }), + ]); + Drain(); + window.UpdateLayout(); + var list = layer.WhoHere.Values.Single(); + var bar = layer.QuickBars.Values.Single(); + var at = list.TranslatePoint(list.Rows[0].Rect.Center, window)!.Value; + window.MouseDown(at, MouseButton.Left); + window.MouseUp(at, MouseButton.Left); + var b = bar.TranslatePoint(bar.Slots[0].Rect.Center, window)!.Value; + window.MouseDown(b, MouseButton.Left); + window.MouseUp(b, MouseButton.Left); + return (list.Focusable, bar.Focusable, view.IsFocused); + }, columns: 60, rows: 10); + + await Assert.That(whoFocusable).IsFalse(); + await Assert.That(barFocusable).IsFalse(); + await Assert.That(viewFocused).IsTrue(); + } + + [Test] + public async Task ANativePanelGoesWhenItLeavesTheScreen() + { + var (shown, after) = await Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Panels( + [ + new PanelOverlay(PanelIds.WhoHere, "panel:who:demo", new PaneRect(0, 1, 20, 6), Ink, null, WhoHere: Who, Pick: _ => { }), + new PanelOverlay(PanelIds.QuickBar, "panel:quickbar:demo", new PaneRect(20, 8, 20, 1), Ink, null, QuickBar: Bar, Pick: _ => { }, Dispatch: _ => { }), + ]); + Drain(); + var shown = layer.WhoHere.Count + layer.QuickBars.Count; + ((IPointerPresenter)driver.Pointer).Panels([]); + Drain(); + return (shown, layer.WhoHere.Count + layer.QuickBars.Count); + }); + + await Assert.That(shown).IsEqualTo(2); + await Assert.That(after).IsEqualTo(0); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs b/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs index 039a496a..fd1e35fa 100644 --- a/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs @@ -121,8 +121,8 @@ public async Task TheQuickBarListsFunctionKeysPlainFirstAndByNumber() { var entries = QuickBarRenderer.Entries(Bindings, Resolve); - await Assert.That(entries.Select(e => e.Key)).IsEquivalentTo(new[] { "F11", "F12", "⌃F3" }); - await Assert.That(entries[2].Name).IsEqualTo("cast 'cure light'"); + await Assert.That(entries.Items.Select(e => e.Key)).IsEquivalentTo(new[] { "F11", "F12", "⌃F3" }); + await Assert.That(entries.Items[2].Title).IsEqualTo("cast 'cure light'"); } [Test] From 766567032e5491647d6209f223b1a947c15d04d7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 06:15:42 +0000 Subject: [PATCH 022/113] Open a native command palette on Ctrl+P in the desktop window The window host gets ClientHost.NativePalette (INativePalette, null in the terminal, snapshot, tests and parity harness). ToggleMenu/OpenMenu are the one funnel: Ctrl+P, the native header's search box and brand, the pointer menu's new "More commands..." entry and the menu* views all ask the host first. The client captures a PaletteSession (Client) on its own thread; the window's PaletteOverlay filters it with CommandPaletteModel, so both hosts list the same rows, and runs the chosen id back through RunFromPalette so recents are recorded identically. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 27 +- .../AvaloniaConsoleDriver.cs | 3 + src/SharpMUTerm.Avalonia/MainWindow.cs | 3 + src/SharpMUTerm.Avalonia/PaletteOverlay.cs | 493 ++++++++++++++++++ src/SharpMUTerm.Avalonia/PalettePresenter.cs | 77 +++ src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + .../Palette/PaletteSession.cs | 111 ++++ src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 9 + src/SharpMUTerm.Tui/Hosting/INativePalette.cs | 21 + .../Pointer/SharpMUTermApp.Chrome.cs | 5 +- .../Pointer/SharpMUTermApp.Pointer.cs | 11 + .../SharpMUTermApp.NativePalette.cs | 104 ++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 29 +- .../HostParityTests.cs | 4 +- .../NativePaletteTests.cs | 213 ++++++++ .../PaletteSessionTests.cs | 73 +++ .../NativePaletteRoutingTests.cs | 210 ++++++++ 18 files changed, 1385 insertions(+), 16 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/PaletteOverlay.cs create mode 100644 src/SharpMUTerm.Avalonia/PalettePresenter.cs create mode 100644 src/SharpMUTerm.Client/Palette/PaletteSession.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/INativePalette.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/PaletteSessionTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NativePaletteRoutingTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d72e617..3fad42b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Desktop window: Ctrl+P opens a native command palette, a rounded popup near the top of the window with a + search box, grouped results, the matched letters highlighted and each command's key on the right. It lists + the same commands in the same order as the terminal's palette, recent and suggested first. Arrow keys and the + mouse choose, Enter runs, Escape closes and returns you to the command line. The header's search box and a new + *More commands…* entry at the foot of every right-click menu open it too. - Desktop window: F7 (Text & display) and F8 (Input) open a settings window with real switches, number boxes and a search box. Matches are counted per section as you type. A changed setting shows a dot and a Reset button, and every change applies and saves as you make it. The status-row meters are a table that shows each diff --git a/CLAUDE.md b/CLAUDE.md index aa95d2fc..af7b7265 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1188,7 +1188,8 @@ The terminal (`sharpmuterm`), the desktop window (`sharpmuterm-window`) and the one `SharpMUTermApp`; a host is only the place it runs. What differs between hosts is a **`ClientHost`** (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, -the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), and whether it draws the declared settings natively (`INativeSettings`, null for the cell screens). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it +draws ⌃P natively (`INativePalette`, null for the cell popup). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until @@ -1566,6 +1567,30 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] native menu and tooltips were built against. - Not done: the window is not modal and does not follow a theme change while it is open. Screenshots come from a real window under Xvfb, driven with XTest (`ux-wave4/native-settings-*.png`). +- **In the window, ⌃P is a native palette over the window, listing the cell palette's rows** (`ClientHost.NativePalette` + → `INativePalette`; Client `PaletteSession`; Avalonia `PaletteOverlay`, `PalettePresenter` on the driver; + `SharpMUTermApp.NativePalette.cs`). The terminal, the snapshot, the tests and the parity harness pass null. Decisions + not to relitigate: + - **One funnel**: `ToggleMenu` (⌃P, the header ☰ link) and `OpenMenu` (the native header's search box and brand + through `ActivateChromeTarget`, the pointer menu's last entry *More commands…*, the `menu*` snapshot views) ask + `TryOpenNativePalette` first. ⌃P is a toggle in both. The composer refusal is `ToggleMenu`'s, so it holds for both. + `PaletteIsOpen` (either palette) feeds `AnyOverlayOpen`, `OpenOverlayName`, `MenuIsOpen` and the header's caret. + - **The session is captured on the client's thread** — catalog, recents, suggestions, `acting on`, dark or light, + an opening query — so the window filters with `CommandPaletteModel.Build` on its own thread and locks nothing. + The rows are therefore the cell palette's for the same query (`NativePaletteTests.TheRowsAreTheModelsForTheSameQuery`). + - **Running goes back through the session**: `Run` closes, then the client runs `RunFromPalette` on its own thread, + so recents are recorded exactly as from the cells. A session runs once and closes once; a session an earlier + opening left behind is ignored when it reports closing. + - **It is an overlay, not a window**: `PalettePresenter.Attach(root, refocus)` from `MainWindow`, and the overlay is + added as the root panel's *last* child when it opens, so it lies over the cells, `DesktopLayer`'s panels and the + native chrome. A scrim covers the rest; a press on it closes. Closing gives the keyboard back to `TerminalView`, + which is the client's command line by the focus pin. Fluent is applied to the card alone (`ThemeVariantScope`), + in the client's variant. + - **Keys are words** (`KeyGlyphs.Words`, as the native chrome does): the UI font draws `Ctrl+⏎` better than `⌃⏎`, + and the window's catalog already carries the window's newline. A sequence (`⌃B |`) is one chip per key. + - **Hover selects on movement only** (`PointerMoved`, not `PointerEntered`), so the row that opens under a resting + pointer is not chosen. ↑↓ wrap as in the cells; PgUp/PgDn stop at the ends. + - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave5/native-palette-*.png`). - **Settings screens have no `IPasteTarget` and cannot easily have one.** They are markup rebuilt wholesale every key, with the edited field a buffer in `SettingsSession`. `SettingsOverlay` listens at `IConsoleDriver.Paste` instead. That can't double-fire *only* because no control on diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index 684b33fd..e3aa00fb 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -73,6 +73,9 @@ public AvaloniaConsoleDriver(int columns, int rows) /// The window's native settings window, which the main window owns (). public SettingsPresenter Settings { get; } = new(); + /// The window's native ⌃P, drawn over everything in the main window (). + public PalettePresenter Palette { get; } = new(); + public bool IsRunning { get; private set; } // ── IConsoleDriver: output ──────────────────────────────────────────────────────────────── diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index ffdabba3..6e50935d 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -65,6 +65,9 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime // The window's native views over the cells: the header's Layouts button and native panels (DesktopLayer). root.Children.Add(new DesktopLayer(_view)); + + // ⌃P, over everything above; it is added last when it opens, and gives the keyboard back to the cells. + _driver.Palette.Attach(root, () => _view.Focus()); Content = root; AutomationProperties.SetName(_view, "SharpMUTerm"); var size = _view.SizeFor(options.Columns, options.Rows); diff --git a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs new file mode 100644 index 00000000..0f674b7a --- /dev/null +++ b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs @@ -0,0 +1,493 @@ +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Controls.Documents; +using Avalonia.Controls.Primitives; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Styling; +using Avalonia.Themes.Fluent; +using SharpMUTerm.Client.Palette; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's ⌃P: a rounded card near the top of the window over a faint scrim, with a search box that has the +/// keyboard, the status line the cell palette leads with, and the rows of — group +/// headers, each entry's title with the matched characters in the accent, its detail dimmed, and its key in a +/// right-aligned column in the host's words (). ↑↓ and PgUp/PgDn walk the entries, +/// ⏎ runs the selected one, Esc (or ⌃P, or a click outside the card) closes. The pointer selects what it hovers +/// and runs what it clicks. +/// +/// It lies over everything else in the window — cells, native panels and chrome — because it is the last child of +/// the window's root panel. Fluent is applied to the card only, and its variant follows the client's theme. +/// +/// +internal sealed class PaletteOverlay : Panel +{ + /// The widest the card is drawn. + private const double CardWidth = 680; + + /// How far below the window's top the card sits. + private const double CardTop = 56; + + private readonly PaletteSession _session; + private readonly Action _remove; + private readonly Colours _colours; + private readonly Border _card; + private readonly TextBox _search; + private readonly TextBlock _status; + private readonly StackPanel _list; + private readonly ScrollViewer _scroller; + private readonly List _entryRows = []; + private readonly List _rowTexts = []; + private readonly List _keyTexts = []; + private PaletteView _view; + private int _selected = -1; + + /// What to list, and where a choice goes. + /// Takes the overlay out of the window and gives the keyboard back to the cells. + public PaletteOverlay(PaletteSession session, Action remove) + { + _session = session; + _remove = remove; + _colours = session.IsDark ? Colours.Dark : Colours.Light; + _view = session.View(string.Empty); + + Background = new SolidColorBrush(_colours.Scrim); + Focusable = false; + AutomationProperties.SetName(this, "Command palette"); + + _search = new TextBox + { + PlaceholderText = "Type a command, a character, a window or a setting", + FontSize = 16, + Margin = new Thickness(14, 14, 14, 6), + Padding = new Thickness(12, 9), + CornerRadius = new CornerRadius(8), + }; + AutomationProperties.SetName(_search, "Search commands"); + _search.TextChanged += (_, _) => Refresh(resetSelection: true); + DockPanel.SetDock(_search, Dock.Top); + + _status = new TextBlock + { + FontSize = 12, + Foreground = new SolidColorBrush(_colours.Dim), + Margin = new Thickness(20, 0, 20, 6), + }; + DockPanel.SetDock(_status, Dock.Top); + + var footer = new TextBlock + { + Text = "↑↓ move ⏎ run Esc close", + FontSize = 11.5, + Foreground = new SolidColorBrush(_colours.Dim), + Margin = new Thickness(20, 6, 20, 10), + HorizontalAlignment = HorizontalAlignment.Right, + }; + DockPanel.SetDock(footer, Dock.Bottom); + + _list = new StackPanel { Margin = new Thickness(8, 0, 8, 4) }; + _scroller = new ScrollViewer + { + Content = _list, + HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled, + VerticalScrollBarVisibility = ScrollBarVisibility.Auto, + }; + + var dock = new DockPanel { LastChildFill = true }; + dock.Children.Add(_search); + dock.Children.Add(_status); + dock.Children.Add(footer); + dock.Children.Add(new Border + { + BorderBrush = new SolidColorBrush(_colours.Rule), + BorderThickness = new Thickness(0, 1, 0, 1), + Child = _scroller, + }); + + _card = new Border + { + Background = new SolidColorBrush(_colours.Card), + BorderBrush = new SolidColorBrush(_colours.Edge), + BorderThickness = new Thickness(1), + CornerRadius = new CornerRadius(12), + BoxShadow = BoxShadows.Parse("0 16 40 0 #66000000"), + ClipToBounds = true, + Child = dock, + }; + + // Fluent for the card alone, in the client's variant; the rest of the window keeps the Simple theme its + // menus and tooltips were built against. + var scope = new ThemeVariantScope + { + RequestedThemeVariant = session.IsDark ? ThemeVariant.Dark : ThemeVariant.Light, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Top, + Margin = new Thickness(16, CardTop, 16, 16), + Child = _card, + }; + scope.Styles.Add(new FluentTheme()); + Children.Add(scope); + + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + PointerPressed += OnScrimPressed; + SizeChanged += (_, _) => Fit(); + Loaded += (_, _) => _search.Focus(); + + _search.Text = session.InitialQuery; + _search.CaretIndex = session.InitialQuery.Length; + Refresh(resetSelection: true); + } + + /// The session shown. + public PaletteSession Session => _session; + + /// The search box, which has the keyboard while the palette is open. + public TextBox SearchBox => _search; + + /// The card, for a test that measures where it sits. + public Border Card => _card; + + /// What is listed now: the model's view for the query in the box. + public PaletteView View => _view; + + /// The selected entry's index in , or -1 with nothing listed. + public int Selected => _selected; + + /// Each row as drawn, in order: a header's label, an entry's title. + public IReadOnlyList RowTexts => _rowTexts; + + /// Each entry's key column as drawn, in entry order; null where the entry has no key. + public IReadOnlyList KeyTexts => _keyTexts; + + /// The drawn row of each entry, in entry order, for a test that hovers or clicks one. + public IReadOnlyList EntryRows => _entryRows; + + /// The line over the list. + public string StatusText => _status.Text ?? string.Empty; + + /// Runs the selected entry, as ⏎ does. + public void Commit() + { + if (_selected < 0 || _selected >= _view.Entries.Count) + { + return; + } + + var id = _view.Entries[_selected].Item.Id; + _remove(this); + _session.Run(id); + } + + /// Closes without running anything, as Esc does. + public void Dismiss() + { + _remove(this); + _session.Dismiss(); + } + + /// Moves the selection by entries, wrapping as the cell palette does. + public void Move(int delta) + { + var count = _view.Entries.Count; + if (count == 0) + { + return; + } + + Select(((_selected + delta) % count + count) % count, reveal: true); + } + + private void Fit() + { + var width = Math.Max(240, Math.Min(CardWidth, Bounds.Width - 32)); + _card.Width = width; + _card.MaxHeight = Math.Max(160, Bounds.Height - CardTop - 32); + } + + private void Refresh(bool resetSelection) + { + _view = _session.View(_search.Text ?? string.Empty); + _status.Text = _session.Status(_view); + _list.Children.Clear(); + _entryRows.Clear(); + _rowTexts.Clear(); + _keyTexts.Clear(); + + var first = true; + foreach (var row in _view.Rows) + { + switch (row) + { + case PaletteHeader header: + _rowTexts.Add(header.Label); + _list.Children.Add(new TextBlock + { + Text = header.Label, + FontSize = 11, + FontWeight = FontWeight.SemiBold, + LetterSpacing = 0.8, + Foreground = new SolidColorBrush(_colours.Header), + Margin = new Thickness(12, first ? 8 : 14, 12, 4), + }); + break; + case PaletteEntry entry: + _rowTexts.Add(entry.Item.Title); + var key = entry.Key is null ? null : KeyGlyphs.Words(entry.Key); + _keyTexts.Add(key); + var drawn = EntryRow(entry, key, _entryRows.Count); + _entryRows.Add(drawn); + _list.Children.Add(drawn); + break; + } + + first = false; + } + + if (_view.Entries.Count == 0) + { + _list.Children.Add(new TextBlock + { + Text = "No matching commands", + Foreground = new SolidColorBrush(_colours.Dim), + Margin = new Thickness(12, 14), + }); + } + + var selected = resetSelection ? 0 : _selected; + _selected = -1; + if (_view.Entries.Count > 0) + { + Select(Math.Clamp(selected, 0, _view.Entries.Count - 1), reveal: false); + _scroller.Offset = default; + } + } + + private Border EntryRow(PaletteEntry entry, string? key, int index) + { + var title = new TextBlock + { + FontSize = 14, + Foreground = new SolidColorBrush(_colours.Text), + VerticalAlignment = VerticalAlignment.Center, + TextTrimming = TextTrimming.CharacterEllipsis, + }; + title.Inlines = TitleInlines(entry); + + var left = new DockPanel { LastChildFill = true }; + if (entry.Detail is { Length: > 0 } detail) + { + var words = new TextBlock + { + Text = detail, + FontSize = 12.5, + Foreground = new SolidColorBrush(_colours.Dim), + Margin = new Thickness(12, 0, 0, 0), + VerticalAlignment = VerticalAlignment.Center, + TextTrimming = TextTrimming.CharacterEllipsis, + }; + DockPanel.SetDock(title, Dock.Left); + left.Children.Add(title); + left.Children.Add(words); + } + else + { + left.Children.Add(title); + } + + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; + grid.Children.Add(left); + if (key is not null) + { + // A sequence (⌃B |) is a chip per key, so the second key does not read as a caret in the first. + var chips = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 4, Margin = new Thickness(16, 0, 0, 0) }; + foreach (var part in key.Split(' ', StringSplitOptions.RemoveEmptyEntries)) + { + chips.Children.Add(new Border + { + Background = new SolidColorBrush(_colours.KeyFill), + BorderBrush = new SolidColorBrush(_colours.Edge), + BorderThickness = new Thickness(1), + CornerRadius = new CornerRadius(5), + Padding = new Thickness(7, 1), + VerticalAlignment = VerticalAlignment.Center, + Child = new TextBlock { Text = part, FontSize = 12, Foreground = new SolidColorBrush(_colours.KeyInk) }, + }); + } + + Grid.SetColumn(chips, 1); + grid.Children.Add(chips); + } + + var row = new Border + { + CornerRadius = new CornerRadius(7), + Padding = new Thickness(12, 7), + Background = Brushes.Transparent, + Child = grid, + Cursor = new Cursor(StandardCursorType.Hand), + }; + AutomationProperties.SetName(row, entry.Item.Title); + // On movement only: a row that appears under a pointer resting where the card opened is not chosen. + row.PointerMoved += (_, _) => Select(index, reveal: false); + row.PointerPressed += (_, e) => + { + e.Handled = true; + if (e.GetCurrentPoint(row).Properties.IsLeftButtonPressed) + { + Select(index, reveal: false); + Commit(); + } + }; + return row; + } + + private InlineCollection TitleInlines(PaletteEntry entry) + { + var text = entry.Item.Title; + var inlines = new InlineCollection(); + var at = 0; + foreach (var range in entry.TitleMatches) + { + if (range.Start < at || range.Start + range.Length > text.Length) + { + continue; + } + + if (range.Start > at) + { + inlines.Add(new Run(text[at..range.Start])); + } + + inlines.Add(new Run(text.Substring(range.Start, range.Length)) + { + FontWeight = FontWeight.Bold, + Foreground = new SolidColorBrush(_colours.Accent), + }); + at = range.Start + range.Length; + } + + if (at < text.Length) + { + inlines.Add(new Run(text[at..])); + } + + return inlines; + } + + private void Select(int index, bool reveal) + { + if (index == _selected) + { + return; + } + + if (_selected >= 0 && _selected < _entryRows.Count) + { + _entryRows[_selected].Background = Brushes.Transparent; + } + + _selected = index; + if (index >= 0 && index < _entryRows.Count) + { + var row = _entryRows[index]; + row.Background = new SolidColorBrush(_colours.Selected); + if (reveal) + { + row.BringIntoView(); + } + } + } + + private void OnKey(object? sender, KeyEventArgs e) + { + switch (e.Key) + { + case Key.Down: + Move(1); + break; + case Key.Up: + Move(-1); + break; + case Key.PageDown: + Page(1); + break; + case Key.PageUp: + Page(-1); + break; + case Key.Enter: + Commit(); + break; + case Key.Escape: + Dismiss(); + break; + case Key.P when e.KeyModifiers == KeyModifiers.Control: + // ⌃P is a toggle in the cell palette too. + Dismiss(); + break; + default: + return; + } + + e.Handled = true; + } + + /// Moves about a screenful of entries; a page stops at either end rather than wrapping. + private void Page(int direction) + { + var count = _view.Entries.Count; + if (count == 0) + { + return; + } + + var rowHeight = _entryRows[0].Bounds.Height > 0 ? _entryRows[0].Bounds.Height : 32; + var page = (int)Math.Max(1, (_scroller.Viewport.Height / rowHeight) - 1); + Select(Math.Clamp(_selected + (direction * page), 0, count - 1), reveal: true); + } + + private void OnScrimPressed(object? sender, PointerPressedEventArgs e) + { + // Only a press on the scrim itself; one on the card has already been handled or belongs to the card. + if (ReferenceEquals(e.Source, this)) + { + e.Handled = true; + Dismiss(); + } + } + + /// The card's colours, one set per variant: the client's accent marks a match, as in the cells. + private sealed record Colours( + Color Scrim, Color Card, Color Edge, Color Rule, Color Text, Color Dim, Color Header, Color Selected, Color Accent, Color KeyFill, Color KeyInk) + { + public static Colours Dark { get; } = new( + Color.FromArgb(0x59, 0, 0, 0), + Color.Parse("#1e1e25"), + Color.Parse("#3a3a46"), + Color.Parse("#2c2c36"), + Color.Parse("#ececf1"), + Color.Parse("#9a9aab"), + Color.Parse("#80808f"), + Color.Parse("#22403a"), + Color.Parse("#00f5b7"), + Color.Parse("#2a2a34"), + Color.Parse("#cfcfdb")); + + public static Colours Light { get; } = new( + Color.FromArgb(0x33, 0, 0, 0), + Color.Parse("#ffffff"), + Color.Parse("#d4d4dd"), + Color.Parse("#e6e6ec"), + Color.Parse("#1d1d24"), + Color.Parse("#626270"), + Color.Parse("#7a7a88"), + Color.Parse("#d5efe7"), + Color.Parse("#007a63"), + Color.Parse("#f1f1f5"), + Color.Parse("#40404c")); + } +} diff --git a/src/SharpMUTerm.Avalonia/PalettePresenter.cs b/src/SharpMUTerm.Avalonia/PalettePresenter.cs new file mode 100644 index 00000000..a3aa6ae0 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/PalettePresenter.cs @@ -0,0 +1,77 @@ +using Avalonia.Controls; +using Avalonia.Threading; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window host's : one at a time, added as the last child +/// of the window's root panel so it lies over the cells, the native panels and the chrome. The client calls in on its +/// own thread, so everything here is posted to the window's. When the palette goes, the keyboard goes back to the +/// cells — which is the client's command line, since the client pins its focus there. +/// +internal sealed class PalettePresenter : INativePalette +{ + private Panel? _host; + private Action? _refocus; + private PaletteOverlay? _overlay; + + /// The open palette, for a test; read on the window's thread. + public PaletteOverlay? Overlay => _overlay; + + /// + /// Where the palette is drawn, and what takes the keyboard back when it closes. Set once by the main window (or a + /// test), on the window's thread. + /// + public void Attach(Panel host, Action refocus) + { + _host = host; + _refocus = refocus; + } + + public void Show(PaletteSession session) => Dispatcher.UIThread.Post(() => ShowNow(session)); + + public void Close() => Dispatcher.UIThread.Post(() => + { + if (_overlay is { } open) + { + Remove(open); + } + }); + + /// Shows now, replacing a palette already open; on the window's thread. + internal PaletteOverlay? ShowNow(PaletteSession session) + { + if (_overlay is { } open) + { + Remove(open); + open.Session.Dismiss(); + } + + if (_host is not { } host) + { + // Nowhere to draw it: say it closed, so the client is not left thinking a palette is up. + session.Dismiss(); + return null; + } + + var overlay = new PaletteOverlay(session, Remove); + _overlay = overlay; + host.Children.Add(overlay); + overlay.SearchBox.Focus(); + return overlay; + } + + private void Remove(PaletteOverlay overlay) + { + if (!ReferenceEquals(_overlay, overlay)) + { + return; + } + + _overlay = null; + _host?.Children.Remove(overlay); + _refocus?.Invoke(); + } +} diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index e973767b..1fc9b08d 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -59,5 +59,8 @@ internal static class WindowHost // F7 and F8 open a native settings window generated from their declarations; the rest stay cell screens. NativeSettings = driver.Settings, + + // ⌃P is a native palette over the window, listing the same rows as the cell one. + NativePalette = driver.Palette, }; } diff --git a/src/SharpMUTerm.Client/Palette/PaletteSession.cs b/src/SharpMUTerm.Client/Palette/PaletteSession.cs new file mode 100644 index 00000000..664128bd --- /dev/null +++ b/src/SharpMUTerm.Client/Palette/PaletteSession.cs @@ -0,0 +1,111 @@ +using SharpMUTerm.Core.Commands; + +namespace SharpMUTerm.Client.Palette; + +/// +/// One opening of ⌃P, for a host that draws the palette with its own controls. Everything that depends on the +/// client's state is captured when it opens, on the client's thread — the catalog, the recent ids, the suggested +/// ones and whose session the entries act on — so a host can filter it on its own thread with nothing to lock. +/// is over that capture, so a native palette lists the +/// same rows in the same order as the cell one for the same query. +/// +/// Running an entry and closing go back through two delegates the client supplies; the client marshals them onto +/// its own thread and runs the entry through the cell palette's own path (RunFromPalette), so recents are +/// recorded exactly as they are there. Each session runs at most one entry and closes once. +/// +/// +public sealed class PaletteSession +{ + private readonly IReadOnlyList _catalog; + private readonly IReadOnlyList _recent; + private readonly IReadOnlyList _suggested; + private readonly Action _run; + private readonly Action _closed; + private int _ended; + + /// Every entry offered when the palette opened, in registration order. + /// Ids run from the palette, newest first. + /// Ids the client's state makes likely (). + /// Whose session the entries act on, or null; the cell palette's acting on. + /// Whether the client's theme is a dark one, so the host can follow it. + /// What the palette opens with typed in; empty for nothing. + /// Runs an entry by id; called once, from any thread. + /// Told the palette closed, whether or not an entry ran; called once, from any thread. + public PaletteSession( + IReadOnlyList catalog, + IReadOnlyList recent, + IReadOnlyList suggested, + string? context, + bool isDark, + string initialQuery, + Action run, + Action closed) + { + ArgumentNullException.ThrowIfNull(initialQuery); + ArgumentNullException.ThrowIfNull(catalog); + ArgumentNullException.ThrowIfNull(recent); + ArgumentNullException.ThrowIfNull(suggested); + ArgumentNullException.ThrowIfNull(run); + ArgumentNullException.ThrowIfNull(closed); + _catalog = catalog.ToArray(); + _recent = recent.ToArray(); + _suggested = suggested.ToArray(); + _run = run; + _closed = closed; + Context = context; + IsDark = isDark; + InitialQuery = initialQuery; + } + + /// What the palette opens with typed in its box; empty for nothing. + public string InitialQuery { get; } + + /// Whose session the entries act on, or null. + public string? Context { get; } + + /// Whether the client's theme is a dark one. + public bool IsDark { get; } + + /// How many entries the catalog held when the palette opened. + public int Total => _catalog.Count; + + /// Whether or has been called. + public bool IsEnded => Volatile.Read(ref _ended) != 0; + + /// The rows for : exactly what the cell palette lists for it. + public PaletteView View(string query) => + CommandPaletteModel.Build(query ?? string.Empty, _catalog, _recent, _suggested); + + /// + /// The line over the list, in the cell palette's words: 12 of 80 acting on Aetherfall.Corvid. + /// + public string Status(PaletteView view) + { + ArgumentNullException.ThrowIfNull(view); + var count = $"{view.Entries.Count} of {view.Total}"; + return string.IsNullOrEmpty(Context) ? count : $"{count} acting on {Context}"; + } + + /// Closes the palette and runs . Ignored once the session has ended. + public void Run(string id) + { + ArgumentNullException.ThrowIfNull(id); + if (Interlocked.Exchange(ref _ended, 1) != 0) + { + return; + } + + // Closed first, as the cell palette closes before it dispatches: the entry may open another surface. + _closed(); + _run(id); + } + + /// Closes the palette without running anything. Ignored once the session has ended. + public void Dismiss() + { + if (Interlocked.Exchange(ref _ended, 1) == 0) + { + _closed(); + } + } +} diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 1e8b37bb..f5d848d4 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -98,6 +98,13 @@ internal sealed record ClientHost /// public required INativeSettings? NativeSettings { get; init; } + /// + /// Draws ⌃P with the host's own controls, or null for a host whose palette is the cell popup. Every way in (⌃P, + /// the header, the pointer menu's More commands…) goes through one funnel that asks this first. Null in + /// the terminal, the snapshot, the tests and the parity harness, so every cell frame is unchanged. + /// + public required INativePalette? NativePalette { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -136,6 +143,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Announcer = null, ScreenIsSeen = true, NativeSettings = null, + NativePalette = null, }; /// @@ -159,6 +167,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Announcer = null, ScreenIsSeen = true, NativeSettings = null, + NativePalette = null, }; /// diff --git a/src/SharpMUTerm.Tui/Hosting/INativePalette.cs b/src/SharpMUTerm.Tui/Hosting/INativePalette.cs new file mode 100644 index 00000000..af237441 --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/INativePalette.cs @@ -0,0 +1,21 @@ +using SharpMUTerm.Client.Palette; + +namespace SharpMUTerm.Tui; + +/// +/// A host that draws ⌃P with its own controls (the desktop window's native palette) instead of the cell popup. The +/// client hands it a captured on the client's thread; the host filters it with the +/// shared model, and the entry chosen goes back through the session to the cell palette's own dispatch path, so +/// the host only draws. +/// +internal interface INativePalette +{ + /// + /// Shows , replacing a palette already open. Called on the client's thread; the host + /// marshals to its own. + /// + void Show(PaletteSession session); + + /// Closes the palette if it is open, running nothing. Called on the client's thread. + void Close(); +} diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs index 6bb0ac92..36ada1a2 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs @@ -118,10 +118,7 @@ internal bool ActivateChromeTarget(string target) if (target == HeaderModel.PaletteTarget) { // Opens, rather than the ☰'s toggle: a search box is clicked to start typing in it, never to close it. - if (!_palette.IsOpen) - { - ToggleMenu(); - } + OpenMenu(); return true; } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index ad4315d7..b683ee27 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -1,6 +1,7 @@ using System.Runtime.CompilerServices; using SharpConsoleUI.Controls; using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; @@ -532,6 +533,9 @@ private void ShowPointerMenu(System.Drawing.Point point) } } + /// The pointer menu's last entry, which opens ⌃P. + internal const string MoreCommandsLabel = "More commands…"; + /// The menu would show. Internal so a test can read it. internal IReadOnlyList PointerMenu(System.Drawing.Point point) { @@ -611,6 +615,13 @@ internal IReadOnlyList PointerMenu(System.Drawing.Point point) break; } + // Everything else is on ⌃P, and the menu says so: the same palette the chord opens, native in the window. + if (items.Count > 0 && target.Kind != PointerKind.Divider) + { + items.Add(PointerMenuItem.Separator); + items.Add(new PointerMenuItem(MoreCommandsLabel, HeaderModel.PaletteKey, () => OnUiThread(() => OpenMenu()))); + } + return Tidy(items); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs new file mode 100644 index 00000000..abb9e151 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs @@ -0,0 +1,104 @@ +using SharpMUTerm.Client.Palette; + +namespace SharpMUTerm.Tui; + +/// +/// ⌃P in a host that draws it natively (). Every way to the palette — ⌃P, the +/// header's brand and search box, the pointer menu's More commands… — ends in or +/// , and those ask the host first. A host without one (the terminal, the snapshot, the tests) +/// gets the cell popup, unchanged. +/// +internal sealed partial class SharpMUTermApp +{ + /// The session the host's palette is showing, or null while it is closed. Read on the client's thread. + private PaletteSession? _nativePaletteSession; + + /// Whether either palette is up: the cell popup or the host's own. + private bool PaletteIsOpen => _palette.IsOpen || _nativePaletteSession is not null; + + /// What SUGGESTED lists right now, in either palette. + internal IReadOnlyList SuggestedCommandIds => CommandPaletteModel.Suggested(CommandState()); + + /// Whether the host's palette is up, for a test. + internal bool NativePaletteIsOpen => _nativePaletteSession is not null; + + /// + /// Opens ⌃P if it is not up — never closes it. For a search box or a menu entry, which is chosen to start + /// searching, never to stop. + /// + /// What the palette opens with typed in; null for nothing. + internal void OpenMenu(string? query = null) + { + if (PaletteIsOpen) + { + return; + } + + _openingQuery = query; + try + { + ToggleMenu(); + } + finally + { + _openingQuery = null; + } + + if (query is not null && _palette.IsOpen) + { + _palette.SetQuery(query); + } + } + + /// The query asked for, while it is opening the palette. + private string? _openingQuery; + + /// + /// Shows the palette in the host's own controls; false when the host has none. The catalog, recents and + /// suggestions are captured here, on the client's thread, so the host can filter on its own. The entry it runs + /// comes back through , the cell palette's own path. + /// + private bool TryOpenNativePalette() + { + if (Host.NativePalette is not { } native) + { + return false; + } + + PaletteSession? session = null; + session = new PaletteSession( + BuildCatalog(), + _recentCommands.Ids, + SuggestedCommandIds, + _active?.SessionKey, + ThemeIsDark(), + _openingQuery ?? string.Empty, + id => OnUiThread(() => RunFromPalette(id)), + () => OnUiThread(() => NativePaletteClosed(session!))); + _nativePaletteSession = session; + native.Show(session); + return true; + } + + /// Closes the host's palette, running nothing. + private void CloseNativePalette() + { + if (_nativePaletteSession is { } session) + { + session.Dismiss(); + Host.NativePalette?.Close(); + } + } + + /// The host's palette has closed; a session an earlier opening left behind is ignored. + private void NativePaletteClosed(PaletteSession session) + { + if (!ReferenceEquals(_nativePaletteSession, session)) + { + return; + } + + _nativePaletteSession = null; + _header.SetContent(new List { HeaderMarkup() }); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 7576598e..4087dce0 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1769,7 +1769,7 @@ public string RenderSnapshot(string? view = null) RebuildPaneArea(); } - _palette.Toggle(); + OpenMenu(); } // The command surface searched: a real drag across the output first, because "Make a trigger from @@ -1780,8 +1780,7 @@ public string RenderSnapshot(string? view = null) RenderWholeFrame(); SimulatePaneDrag(MainWindowId, 0, 1, 46, 3); ReArmWholeFrame(); - _palette.Toggle(); - _palette.SetQuery("trig sel"); + OpenMenu("trig sel"); } // The command surface opened with nothing typed after two commands were run through the palette's @@ -1790,7 +1789,7 @@ public string RenderSnapshot(string? view = null) { RunFromPalette("layout:split-right"); RunFromPalette("layout:cycle"); - _palette.Toggle(); + OpenMenu(); } // The ⌃B which-key panel over the demo workspace: what the arming timer opens when no key has @@ -5352,7 +5351,7 @@ private void ToggleHistorySearch() /// how the framework happens to dispatch, and the next surface may not be modal. /// private bool AnyOverlayOpen => - _palette.IsOpen || _settings.IsOpen || _quit.IsOpen || _messageLog.IsOpen || _historySearch.IsOpen + PaletteIsOpen || _settings.IsOpen || _quit.IsOpen || _messageLog.IsOpen || _historySearch.IsOpen || _prefixPanel.IsOpen || _composer.IsOpen || _search.IsOpen || _gameData.IsOpen || _packageView.IsOpen || _sendMenu.IsOpen || _layoutsView.IsOpen || _welcomeView.IsOpen; @@ -5464,7 +5463,7 @@ private bool ComposerIsInTheWay(string surface) /// private string OpenOverlayName() => _settings.IsOpen ? "the settings screen" - : _palette.IsOpen ? "the command surface" + : PaletteIsOpen ? "the command surface" : _quit.IsOpen ? "the quit prompt" : _messageLog.IsOpen ? "the client messages" : _gameData.IsOpen ? "the game data" @@ -8181,7 +8180,7 @@ private void CycleCharacter(int delta) internal IReadOnlyList WindowIds() => _workspace.Windows.Select(w => w.Id).ToArray(); /// Whether the ⌃P command surface is up — the header's ☰ opens it, and only the header may. - internal bool MenuIsOpen => _palette.IsOpen; + internal bool MenuIsOpen => PaletteIsOpen; /// /// Clicks the connection rail at a cell measured from the rail's own top-left, the way the framework @@ -9345,12 +9344,24 @@ private void ToggleFreeze() /// Opens/closes the command surface (⌃P or the header ☰ menu) and flips the header caret. private void ToggleMenu() { + // The host's palette is a toggle too: ⌃P reaches here only when the host passes it on. + if (_nativePaletteSession is not null) + { + CloseNativePalette(); + return; + } + if (ComposerIsInTheWay("the command surface")) { return; } - _palette.Toggle(); + // A host that draws ⌃P itself gets it, unless the cell popup is already up (then this closes that). + if (_palette.IsOpen || !TryOpenNativePalette()) + { + _palette.Toggle(); + } + _header.SetContent(new List { HeaderMarkup() }); } @@ -13346,7 +13357,7 @@ internal HeaderModel BuildHeaderModel() } return new HeaderModel( - _palette is { IsOpen: true }, + _palette is { IsOpen: true } || _nativePaletteSession is not null, world, character, ConnectedCharacters().Count, diff --git a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs index d8639ebb..128970bb 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs @@ -46,7 +46,7 @@ public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string na using var driver = new AvaloniaConsoleDriver(Width, Height); await using (var window = new SharpMUTermApp( DemoScene.Build(), - WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, RunsInline = true })) + WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, NativePalette = null, RunsInline = true })) { window.RenderSnapshot(view); } @@ -83,7 +83,7 @@ public async Task EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning(string n using var driver = new AvaloniaConsoleDriver(Width, Height); await using var window = new SharpMUTermApp( DemoScene.Build(), - WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null }); + WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, NativePalette = null }); window.OnUiThread(() => _ = window.RenderSnapshot(view)); var loop = new Thread(() => window.Run([])) { IsBackground = true }; loop.Start(); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs new file mode 100644 index 00000000..0be9227d --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs @@ -0,0 +1,213 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Documents; +using Avalonia.Headless; +using Avalonia.Input; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Tui; +using SkiaSharp; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's native ⌃P (), driven from the real client in the window host: it lists the +/// shared model's rows for the query in its box, ⏎ and a click run the selected id through the cell palette's own +/// path, Esc closes and gives the keyboard back to the cells, and the key column is in the window's keys. +/// +[NotInParallel] +public class NativePaletteTests +{ + private sealed record Rig(Window Window, TerminalView View, SharpMUTermApp App, AvaloniaConsoleDriver Driver); + + private static readonly ConsoleKeyInfo CtrlP = new('\x10', ConsoleKey.P, false, false, true); + + private static Task Run(Func body) => + Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(120, 34); + var view = new TerminalView(driver, SKColors.White, new SKColor(0x1e, 0x1e, 0x24), 14, null); + var root = new Panel(); + root.Children.Add(view); + root.Children.Add(new DesktopLayer(view)); + driver.Palette.Attach(root, () => view.Focus()); + var window = new Window { Content = root, Width = 1000, Height = 700 }; + window.Show(); + view.Focus(); + var app = new SharpMUTermApp(DemoScene.Build(), WindowHost.Create(driver, clipboard: null) with + { + Audio = null, + Presence = null, + Announcer = null, + NativeSettings = null, + RunsInline = true, + }); + try + { + DesktopLayerTests.Drain(); + return body(new Rig(window, view, app, driver)); + } + finally + { + app.DisposeAsync().AsTask().GetAwaiter().GetResult(); + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + private static PaletteOverlay Open(Rig rig) + { + rig.App.SimulateKey(CtrlP); + DesktopLayerTests.Drain(); + return rig.Driver.Palette.Overlay ?? throw new InvalidOperationException("the palette did not open"); + } + + private static void Type(PaletteOverlay overlay, string query) + { + overlay.SearchBox.Text = query; + DesktopLayerTests.Drain(); + } + + private static void Press(PaletteOverlay overlay, Key key) + { + overlay.SearchBox.RaiseEvent(new KeyEventArgs { RoutedEvent = InputElement.KeyDownEvent, Key = key, Source = overlay.SearchBox }); + DesktopLayerTests.Drain(); + } + + private static string[] ModelRows(PaletteView view) => + view.Rows.Select(r => r is PaletteHeader h ? h.Label : ((PaletteEntry)r).Item.Title).ToArray(); + + [Test] + public async Task CtrlPOpensTheNativePaletteWithTheSearchFocusedAndNoCellPopup() + { + var (focused, cellOpen, onTop) = await Run(rig => + { + var overlay = Open(rig); + var root = (Panel)rig.Window.Content!; + return (overlay.SearchBox.IsFocused, rig.App.Palette.IsOpen, ReferenceEquals(root.Children[^1], overlay)); + }); + + await Assert.That(focused).IsTrue(); + await Assert.That(cellOpen).IsFalse(); + await Assert.That(onTop).IsTrue().Because("nothing native draws over it: it is the root panel's last child"); + } + + [Test] + public async Task TheRowsAreTheModelsForTheSameQuery() + { + var results = await Run(rig => + { + rig.App.RunFromPalette("layout:split-right"); + var overlay = Open(rig); + var list = new List<(string Query, string[] Drawn, string[] Model, string Status, string Count)>(); + foreach (var query in new[] { string.Empty, "split", "frz", "zzzz" }) + { + Type(overlay, query); + var model = CommandPaletteModel.Build(query, rig.App.BuildCatalog(), rig.App.RecentCommandIds, rig.App.SuggestedCommandIds); + list.Add((query, overlay.RowTexts.ToArray(), ModelRows(model), overlay.StatusText, $"{model.Entries.Count} of {model.Total}")); + } + + return list; + }); + + foreach (var (query, drawn, model, status, count) in results) + { + await Assert.That(drawn).IsEquivalentTo(model, TUnit.Assertions.Enums.CollectionOrdering.Matching).Because($"query '{query}'"); + await Assert.That(status).StartsWith(count); + } + + await Assert.That(results[0].Drawn[0]).IsEqualTo(CommandPaletteModel.RecentLabel); + } + + [Test] + public async Task MatchedCharactersAreHighlighted() + { + var bold = await Run(rig => + { + var overlay = Open(rig); + Type(overlay, "split"); + var title = overlay.EntryRows[0].GetVisualDescendantsOf().First(); + return title.Inlines!.OfType().Where(r => r.FontWeight == global::Avalonia.Media.FontWeight.Bold).Select(r => r.Text).ToArray(); + }); + + await Assert.That(string.Concat(bold)).IsEqualTo("Split").Because("the matched run is drawn bold in the accent"); + } + + [Test] + public async Task EnterRunsTheSelectedIdThroughThePalettesOwnPath() + { + var (expected, recent, panes, open, focused) = await Run(rig => + { + var overlay = Open(rig); + Type(overlay, "split right"); + Press(overlay, Key.Down); + Press(overlay, Key.Up); + var id = overlay.View.Entries[overlay.Selected].Item.Id; + Press(overlay, Key.Enter); + return (id, rig.App.RecentCommandIds.FirstOrDefault(), rig.App.PaneOutputRects().Count, rig.Driver.Palette.Overlay is not null, rig.View.IsFocused); + }); + + await Assert.That(expected).IsEqualTo("layout:split-right"); + await Assert.That(recent).IsEqualTo(expected); + await Assert.That(panes).IsEqualTo(2); + await Assert.That(open).IsFalse(); + await Assert.That(focused).IsTrue().Because("the keyboard goes back to the cells, and so to the command line"); + } + + [Test] + public async Task EscapeClosesRunsNothingAndGivesTheKeyboardBack() + { + var (open, clientOpen, recent, focused) = await Run(rig => + { + var overlay = Open(rig); + Type(overlay, "split"); + Press(overlay, Key.Escape); + return (rig.Driver.Palette.Overlay is not null, rig.App.NativePaletteIsOpen, rig.App.RecentCommandIds.Count, rig.View.IsFocused); + }); + + await Assert.That(open).IsFalse(); + await Assert.That(clientOpen).IsFalse(); + await Assert.That(recent).IsEqualTo(0); + await Assert.That(focused).IsTrue(); + } + + [Test] + public async Task HoverSelectsAndAClickRuns() + { + var (hovered, ran, expected) = await Run(rig => + { + var overlay = Open(rig); + Type(overlay, "split"); + var row = overlay.EntryRows[1]; + var centre = row.TranslatePoint(new Point(row.Bounds.Width / 2, row.Bounds.Height / 2), rig.Window)!.Value; + rig.Window.MouseMove(centre); + DesktopLayerTests.Drain(); + var selected = overlay.Selected; + var id = overlay.View.Entries[1].Item.Id; + rig.Window.MouseDown(centre, MouseButton.Left); + rig.Window.MouseUp(centre, MouseButton.Left); + DesktopLayerTests.Drain(); + return (selected, rig.App.RecentCommandIds.FirstOrDefault(), id); + }); + + await Assert.That(hovered).IsEqualTo(1); + await Assert.That(ran).IsEqualTo(expected); + } + + [Test] + public async Task TheKeyColumnIsInTheWindowsKeys() + { + var (newline, any) = await Run(rig => + { + var overlay = Open(rig); + var index = overlay.View.Entries.ToList().FindIndex(e => e.Item.Id == "term:newline"); + return (index < 0 ? null : overlay.KeyTexts[index], overlay.KeyTexts.Where(k => k is not null).ToArray()); + }); + + await Assert.That(newline).IsEqualTo("Ctrl+⏎"); + await Assert.That(any).DoesNotContain("Alt+⏎"); + await Assert.That(any.Any(k => k!.Contains('⌃') || k.Contains('⌥'))).IsFalse().Because("the window's UI font reads keys in words"); + } + + private static HeadlessUnitTestSession Session => TerminalViewTests.Session; +} diff --git a/tests/SharpMUTerm.Client.Tests/PaletteSessionTests.cs b/tests/SharpMUTerm.Client.Tests/PaletteSessionTests.cs new file mode 100644 index 00000000..afe3580d --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/PaletteSessionTests.cs @@ -0,0 +1,73 @@ +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Core.Commands; +using TUnit.Assertions.Enums; + +namespace SharpMUTerm.Client.Tests; + +/// +/// One opening of a host's native palette (): its rows are the shared model's over what +/// was captured when it opened, it runs at most one entry, and it says it closed exactly once. +/// +public class PaletteSessionTests +{ + private static readonly CommandItem[] Catalog = + [ + new(CommandGroup.Terminal, "Newline", "term:newline", "Ctrl+⏎") { Key = "Ctrl+⏎" }, + new(CommandGroup.Layout, "Split right", "layout:split-right", "⌃B |") { Key = "⌃B |" }, + new(CommandGroup.Terminal, "Freeze pane", "term:freeze", "⌥F") { Key = "⌥F" }, + ]; + + private static (PaletteSession Session, List Ran, List Closed) Make(List? catalog = null) + { + var ran = new List(); + var closed = new List(); + var session = new PaletteSession( + catalog ?? [.. Catalog], ["layout:split-right"], ["term:freeze"], "Aetherfall.Corvid", isDark: true, string.Empty, + id => ran.Add(id), () => closed.Add("closed")); + return (session, ran, closed); + } + + [Test] + public async Task TheRowsAreTheModelsOverTheCapture() + { + var catalog = Catalog.ToList(); + var (session, _, _) = Make(catalog); + catalog.Clear(); + + foreach (var query in new[] { string.Empty, "spl", "zz" }) + { + var expected = CommandPaletteModel.Build(query, Catalog, ["layout:split-right"], ["term:freeze"]); + await Assert.That(session.View(query).Rows).IsEquivalentTo(expected.Rows, CollectionOrdering.Matching); + } + + await Assert.That(session.View(string.Empty).Entries.Select(e => e.Key)).Contains("⌃⏎"); + await Assert.That(session.Status(session.View("spl"))).IsEqualTo("1 of 3 acting on Aetherfall.Corvid"); + } + + [Test] + public async Task RunClosesFirstThenRunsAndOnlyOnce() + { + var order = new List(); + var session = new PaletteSession(Catalog, [], [], null, isDark: false, string.Empty, id => order.Add(id), () => order.Add("closed")); + + session.Run("term:freeze"); + session.Run("term:newline"); + session.Dismiss(); + + await Assert.That(order).IsEquivalentTo(new[] { "closed", "term:freeze" }, CollectionOrdering.Matching); + await Assert.That(session.IsEnded).IsTrue(); + } + + [Test] + public async Task DismissClosesOnceAndRunsNothing() + { + var (session, ran, closed) = Make(); + + session.Dismiss(); + session.Dismiss(); + session.Run("term:freeze"); + + await Assert.That(ran).IsEmpty(); + await Assert.That(closed.Count).IsEqualTo(1); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/NativePaletteRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativePaletteRoutingTests.cs new file mode 100644 index 00000000..3a4a8ee0 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NativePaletteRoutingTests.cs @@ -0,0 +1,210 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A host with its own palette () gets every way to ⌃P — the chord, the header, +/// the pointer menu's More commands… — and no cell popup; a host without one keeps the cell popup. The rows a +/// native palette is handed are the shared model's, and the entry it runs goes through the cell palette's own path. +/// +[NotInParallel] +public class NativePaletteRoutingTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class Presenter : INativePalette + { + public List Shown { get; } = []; + + public int Closed { get; private set; } + + public void Show(PaletteSession session) => Shown.Add(session); + + public void Close() => Closed++; + } + + private static (SharpMUTermApp App, Presenter Native) App(bool native = true) + { + Console.SetIn(TextReader.Null); + var presenter = new Presenter(); + var host = ClientHost.Headless(new HeadlessConsoleDriver(120, 34), Caps) with + { + NativePalette = native ? presenter : null, + }; + return (new SharpMUTermApp(DemoScene.Build(), host), presenter); + } + + private static readonly ConsoleKeyInfo CtrlP = new('\x10', ConsoleKey.P, false, false, true); + + private static IEnumerable Shape(PaletteView view) => + view.Rows.Select(row => row switch + { + PaletteHeader header => "# " + header.Label, + PaletteEntry entry => $"{entry.Item.Id}|{entry.Key}|{string.Join(',', entry.TitleMatches)}", + _ => "?", + }); + + private static System.Drawing.Point CommandLineCell(SharpMUTermApp app) + { + for (var y = 33; y >= 0; y--) + { + for (var x = 0; x < 120; x++) + { + var cell = new System.Drawing.Point(x, y); + if (app.TargetAt(cell).Kind == PointerKind.CommandLine) + { + return cell; + } + } + } + + throw new InvalidOperationException("no command line on screen"); + } + + [Test] + public async Task CtrlPOpensTheHostsPaletteAndNoCellPopup() + { + var (app, native) = App(); + + app.SimulateKey(CtrlP); + + await Assert.That(native.Shown.Count).IsEqualTo(1); + await Assert.That(app.Palette.IsOpen).IsFalse().Because("no cell popup opens under a native one"); + await Assert.That(app.NativePaletteIsOpen).IsTrue(); + await Assert.That(app.MenuIsOpen).IsTrue(); + await Assert.That(app.BuildHeaderModel().MenuOpen).IsTrue().Because("the header's caret flips for either palette"); + } + + [Test] + public async Task AHostWithNoPaletteOpensTheCellPopup() + { + var (app, native) = App(native: false); + + app.SimulateKey(CtrlP); + + await Assert.That(native.Shown).IsEmpty(); + await Assert.That(app.Palette.IsOpen).IsTrue(); + } + + [Test] + public async Task TheSessionListsTheModelsRowsForEveryQuery() + { + var (app, native) = App(); + app.RunFromPalette("layout:split-right"); + app.SimulateKey(CtrlP); + var session = native.Shown.Single(); + + foreach (var query in new[] { string.Empty, "trig sel", "split", "zzzz" }) + { + var expected = CommandPaletteModel.Build( + query, app.BuildCatalog(), app.RecentCommandIds, app.SuggestedCommandIds); + await Assert.That(Shape(session.View(query))).IsEquivalentTo(Shape(expected), TUnit.Assertions.Enums.CollectionOrdering.Matching); + } + + await Assert.That(session.View(string.Empty).Rows[0]).IsEqualTo(new PaletteHeader(CommandPaletteModel.RecentLabel)); + } + + [Test] + public async Task RunningAnEntryRecordsItAndDispatchesItAsTheCellPaletteDoes() + { + var (app, native) = App(); + app.SimulateKey(CtrlP); + var session = native.Shown.Single(); + + session.Run("layout:split-right"); + + await Assert.That(app.RecentCommandIds[0]).IsEqualTo("layout:split-right"); + await Assert.That(app.PaneOutputRects().Count).IsEqualTo(2).Because("the split ran"); + await Assert.That(app.NativePaletteIsOpen).IsFalse(); + await Assert.That(app.BuildHeaderModel().MenuOpen).IsFalse(); + } + + [Test] + public async Task EscapeInTheHostClosesItAndRunsNothing() + { + var (app, native) = App(); + app.SimulateKey(CtrlP); + + native.Shown.Single().Dismiss(); + + await Assert.That(app.NativePaletteIsOpen).IsFalse(); + await Assert.That(app.RecentCommandIds).IsEmpty(); + } + + [Test] + public async Task CtrlPAgainClosesTheHostsPalette() + { + var (app, native) = App(); + app.SimulateKey(CtrlP); + app.SimulateKey(CtrlP); + + await Assert.That(native.Closed).IsEqualTo(1); + await Assert.That(native.Shown.Single().IsEnded).IsTrue(); + await Assert.That(app.NativePaletteIsOpen).IsFalse(); + + app.SimulateKey(CtrlP); + await Assert.That(native.Shown.Count).IsEqualTo(2).Because("a third press opens it again"); + } + + [Test] + public async Task TheHeaderOpensTheHostsPaletteAndNeverClosesIt() + { + var (app, native) = App(); + + await Assert.That(app.ActivateChromeTarget(HeaderModel.PaletteTarget)).IsTrue(); + await Assert.That(app.ActivateChromeTarget(HeaderModel.PaletteTarget)).IsTrue(); + + await Assert.That(native.Shown.Count).IsEqualTo(1); + await Assert.That(native.Closed).IsEqualTo(0); + await Assert.That(app.Palette.IsOpen).IsFalse(); + } + + [Test] + public async Task ThePointerMenusMoreCommandsOpensThePalette() + { + foreach (var native in new[] { true, false }) + { + var (app, presenter) = App(native); + app.RenderWholeFrame(); + var input = CommandLineCell(app); + var more = app.PointerMenu(input).Single(item => item.Label == SharpMUTermApp.MoreCommandsLabel); + await Assert.That(more.Hint).IsEqualTo(HeaderModel.PaletteKey); + + more.Run(); + + await Assert.That(presenter.Shown.Count).IsEqualTo(native ? 1 : 0); + await Assert.That(app.Palette.IsOpen).IsEqualTo(!native); + } + } + + [Test] + public async Task OpeningWithAQueryHandsItToEitherPalette() + { + var (app, native) = App(); + app.OpenMenu("trig sel"); + await Assert.That(native.Shown.Single().InitialQuery).IsEqualTo("trig sel"); + + var (cells, _) = App(native: false); + cells.OpenMenu("trig sel"); + await Assert.That(cells.Palette.IsOpen).IsTrue(); + await Assert.That(cells.Palette.View.Entries.Count).IsLessThan(cells.BuildCatalog().Count).Because("the cell popup filtered by it"); + } + + [Test] + public async Task ItRefusesOverTheComposerAsTheCellPopupDoes() + { + var (app, native) = App(); + await Assert.That(app.DispatchCommand("term:compose")).IsTrue(); + await Assert.That(app.Composer.IsOpen).IsTrue(); + + app.SimulateKey(CtrlP); + app.ActivateChromeTarget(HeaderModel.PaletteTarget); + + await Assert.That(native.Shown).IsEmpty(); + await Assert.That(app.Palette.IsOpen).IsFalse(); + } +} From f82e23aadd713d9e1720f15ac037616584f972a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 06:16:26 +0000 Subject: [PATCH 023/113] WIP native layout --- src/SharpMUTerm.Avalonia/ClientLaunch.cs | 4 +- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 165 +++-- src/SharpMUTerm.Avalonia/MainWindow.cs | 18 +- src/SharpMUTerm.Avalonia/NativeChrome.cs | 577 ++++++++++++------ src/SharpMUTerm.Avalonia/TerminalView.cs | 43 +- src/SharpMUTerm.Avalonia/WindowHost.cs | 12 +- src/SharpMUTerm.Avalonia/WindowOptions.cs | 17 +- src/SharpMUTerm.Client/Chrome/HeaderModel.cs | 31 + src/SharpMUTerm.Client/Chrome/SidebarModel.cs | 7 + src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 31 + .../Pointer/SharpMUTermApp.Chrome.cs | 120 ++-- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 69 ++- .../DesktopLayerTests.cs | 4 +- .../HostParityTests.cs | 30 +- .../NativeChromeTests.cs | 222 ++++--- .../NativePanelTests.cs | 2 +- .../HostChromeLayoutTests.cs | 248 ++++++++ .../NativeChromeModelTests.cs | 22 +- 18 files changed, 1233 insertions(+), 389 deletions(-) create mode 100644 tests/SharpMUTerm.Tui.Tests/HostChromeLayoutTests.cs diff --git a/src/SharpMUTerm.Avalonia/ClientLaunch.cs b/src/SharpMUTerm.Avalonia/ClientLaunch.cs index 10f3d0b8..31d0e4e6 100644 --- a/src/SharpMUTerm.Avalonia/ClientLaunch.cs +++ b/src/SharpMUTerm.Avalonia/ClientLaunch.cs @@ -37,13 +37,13 @@ public static int Run(WindowOptions options, AppConfiguration config, IReadOnlyL return app.Run([]); } - return Tui.Program.RunLive(options.ClientArgs, config, notices, WindowHost.Create(driver, clipboard)); + return Tui.Program.RunLive(options.ClientArgs, config, notices, WindowHost.Create(driver, clipboard, options.Chrome)); } /// The demo client, with its --view scene laid out and not yet running. public static SharpMUTermApp Demo(WindowOptions options, AppConfiguration config, AvaloniaConsoleDriver driver, Action? clipboard) { - var app = new SharpMUTermApp(config, WindowHost.Create(driver, clipboard)); + var app = new SharpMUTermApp(config, WindowHost.Create(driver, clipboard, options.Chrome)); // The snapshot's scene builder is the demo: it pours the demo output in and opens the named view. What // it returns is the headless driver's capture, which on this driver is empty and not wanted. It is queued diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index 7345c40e..4f5f828c 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -13,11 +13,12 @@ namespace SharpMUTerm.Avalonia; /// -/// The window's native views, in a layer over the : header buttons, and native panels -/// drawn over the panes the client says hold them. The client's cells are painted underneath exactly as in a -/// terminal — nothing here takes a cell, moves a pane or changes what any world is told about its pane's size — -/// so this layer is the window's presentation of the same frame, and the terminal-and-window parity, which -/// compares cells, does not see it. +/// The window's native views, in a layer over the whole window: the header band and the connections sidebar beside +/// the (when the window draws them, ), the header buttons, and +/// native panels drawn over the panes the client says hold them. The header and the sidebar have no cells under +/// them — the client leaves no row or column for them, and this layer moves the view out of their way +/// () — while a panel sits over its pane's cells, which are painted underneath exactly as in +/// a terminal, so nothing a panel does takes a cell, moves a pane or changes what any world is told. /// /// Input. The layer itself has no background and so is never hit: a pointer anywhere it draws nothing goes /// to the view, and on to the client, as before. A header button is the window's alone — its press, release, @@ -37,6 +38,7 @@ internal sealed class DesktopLayer : Canvas private readonly TerminalView _view; private readonly WindowPointer _pointer; + private readonly HostChrome _chrome; private readonly Dictionary _buttons = new(StringComparer.Ordinal); private readonly Dictionary _gauges = new(StringComparer.Ordinal); private readonly Dictionary _maps = new(StringComparer.Ordinal); @@ -45,10 +47,17 @@ internal sealed class DesktopLayer : Canvas private readonly Dictionary _whoHere = new(StringComparer.Ordinal); private readonly Dictionary _quickBars = new(StringComparer.Ordinal); - public DesktopLayer(TerminalView view) + /// The cells. + /// + /// Which chrome the window draws: the same value the client was told (), so the part + /// the client leaves out of the cells is the part this layer draws, and nothing is drawn twice or not at all. + /// + public DesktopLayer(TerminalView view, HostChrome chrome) { _view = view; + _chrome = chrome; _pointer = view.Driver.Pointer; + _view.CellsHoldHeader = !chrome.Header; ClipToBounds = true; _pointer.ActionsChanged += () => Dispatcher.UIThread.Post(Sync); _pointer.PanelsChanged += () => Dispatcher.UIThread.Post(Sync); @@ -60,9 +69,32 @@ public DesktopLayer(TerminalView view) Children.Add(_header); Children.Add(_sidebar); _view.Repainted += Sync; + SyncInsets(collapsed: false); Sync(); } + /// Which chrome this layer draws. Internal for tests. + internal HostChrome Chrome => _chrome; + + /// + /// Where the cells start in this layer: past the native header and sidebar. Every view placed over cells is placed + /// from here, so a panel sits on its pane however wide the sidebar is. + /// + internal Point CellOrigin => new(_view.Margin.Left, _view.Margin.Top); + + /// + /// Moves the cells out of the way of the native header and sidebar: the view's margin is their size, so the view — + /// and the grid it hands the driver, and so every pane the client lays out — is what is left of the window. + /// + private void SyncInsets(bool collapsed) + { + var insets = NativeLayout.Insets(_chrome, collapsed); + if (_view.Margin != insets) + { + _view.Margin = insets; + } + } + protected override void OnSizeChanged(SizeChangedEventArgs e) { base.OnSizeChanged(e); @@ -98,52 +130,52 @@ internal void Sync() { var frame = _view.Driver.Frame; var cell = _view.CellExtent; + SyncChrome(); SyncButtons(frame, cell); SyncPanels(frame, cell); - SyncChrome(frame, cell); } /// - /// The native header and sidebar over the cells the client says hold them, each painting the plane read off its - /// own cells. Neither is drawn while another of the client's windows is in front (it would paint over it), the - /// header not while ⌃B is armed (the cells then say what the next key does), the sidebar not while collapsed. + /// The native header across the top and the sidebar down the left, when the window draws them — always, a modal in + /// front included: the client draws its modals in the cells, which no longer reach under either, so the chrome + /// stays where a desktop app's stays and only goes inert (). ⌃B armed is said + /// by the header itself, and a collapsed rail is the sidebar's slim strip. /// - private void SyncChrome(ScreenFrame frame, Size cell) + private void SyncChrome() { var chrome = _pointer.Chrome; - var ink = Colour(_view.Renderer.DefaultForeground); - Cover(_header, chrome, chrome is { Shown: true, HeaderModel.PrefixArmed: false } ? chrome.Header : default, frame, cell, ink, header: true); - Cover(_sidebar, chrome, chrome is { Shown: true, Sidebar.Collapsed: false } ? chrome.Rail : default, frame, cell, ink, header: false); + SyncInsets(chrome?.Sidebar.Collapsed ?? false); + var width = Bounds.Width; + var height = Bounds.Height; + var top = _chrome.Header ? NativeLayout.HeaderHeight : 0; + + // The header buttons' slots, plus the resize band, stay clear for the buttons drawn above the header. + _header.ReserveRight = _chrome.Header + ? (_pointer.Actions.Count * (NativeLayout.ButtonSize + NativeLayout.ButtonGap)) + WindowChrome.EdgeBand + 4 + : 0; + + // Before the client has said anything the bands are drawn empty, on the view's own colours, so a window never + // opens with a hole where its header will be. + var ink = chrome is null ? Colour(_view.Renderer.DefaultForeground) : NativeChromeView.Parse(chrome.Palette.Ink); + Place(_header, _chrome.Header, new Rect(0, 0, width, NativeLayout.HeaderHeight), chrome, + chrome is null ? Colour(_view.Renderer.DefaultBackground) : NativeChromeView.Parse(chrome.Palette.HeaderPlane), ink); + Place(_sidebar, _chrome.Rail, new Rect(0, top, _view.Margin.Left, Math.Max(0, height - top)), chrome, + chrome is null ? Colour(_view.Renderer.DefaultBackground) : NativeChromeView.Parse(chrome.Palette.RailPlane), ink); } - private void Cover(NativeChromeView view, ChromeOverlay? chrome, PaneRect rect, ScreenFrame frame, Size cell, Color ink, bool header) + private static void Place(NativeChromeView view, bool drawn, Rect area, ChromeOverlay? chrome, Color plane, Color ink) { - var inside = rect.Width > 0 && rect.Height > 0 && rect.X >= 0 && rect.Y >= 0 - && rect.X + rect.Width <= frame.Width && rect.Y + rect.Height <= frame.Height; - if (chrome is null || !inside) + if (!drawn || area.Width <= 0 || area.Height <= 0) { view.IsVisible = false; return; } - SetLeft(view, rect.X * cell.Width); - SetTop(view, rect.Y * cell.Height); - view.Width = rect.Width * cell.Width; - view.Height = rect.Height * cell.Height; - if (view is NativeHeader nativeHeader) - { - // The header buttons' slots, plus the resize band, stay clear for the buttons drawn above this view. - nativeHeader.ReserveRight = (_pointer.Actions.Count * ButtonCells * cell.Width) + WindowChrome.EdgeBand; - } - else if (view is NativeSidebar sidebar) - { - sidebar.SetCellHeight(cell.Height); - } - - // The plane is read off the last cell of the rectangle's first row: the header's right end and the rail's - // margin column are blank in every state, so the colour is the band's own and not a segment's fill. - var plane = _view.Renderer.Background(frame[rect.X + rect.Width - 1, rect.Y]); - view.Show(chrome, Colour(plane), ink); + SetLeft(view, area.X); + SetTop(view, area.Y); + view.Width = area.Width; + view.Height = area.Height; + view.Show(chrome, plane, ink); view.IsVisible = true; } @@ -156,6 +188,7 @@ private void SyncButtons(ScreenFrame frame, Size cell) _buttons.Remove(stale); } + var origin = CellOrigin; for (var i = 0; i < actions.Count; i++) { var action = actions[i]; @@ -169,6 +202,21 @@ private void SyncButtons(ScreenFrame frame, Size cell) Children.Add(button); } + if (_chrome.Header) + { + // In the window's own header: right to left from its end, clear of the resize band, on its plane. + var side = NativeLayout.ButtonSize; + button.Width = side; + button.Height = side; + SetLeft(button, Bounds.Width - WindowChrome.EdgeBand - 4 - ((i + 1) * (side + NativeLayout.ButtonGap)) + NativeLayout.ButtonGap); + SetTop(button, Math.Round((NativeLayout.HeaderHeight - side) / 2)); + var said = _pointer.Chrome; + button.Ink = said is null ? Colour(_view.Renderer.DefaultForeground) : NativeChromeView.Parse(said.Palette.Ink); + button.Plane = said is null ? Colour(_view.Renderer.DefaultBackground) : NativeChromeView.Parse(said.Palette.HeaderPlane); + button.IsVisible = Bounds.Width > 0; + continue; + } + // Right to left from the header's end, one slot of blank cells each. Shown only while every cell of // its slot is blank, so a button never covers a word of the header. var first = frame.Width - (ButtonCells * (i + 1)); @@ -187,8 +235,8 @@ private void SyncButtons(ScreenFrame frame, Size cell) var size = Math.Max(8, Math.Min(cell.Height + 2, right - ((first + 0.6) * cell.Width))); button.Width = size; button.Height = Math.Max(4, cell.Height - 2); - SetLeft(button, right - size); - SetTop(button, 1); + SetLeft(button, origin.X + right - size); + SetTop(button, origin.Y + 1); var behind = _view.Renderer.Background(frame[frame.Width - 1, 0]); button.Ink = Colour(_view.Renderer.DefaultForeground); button.Plane = Colour(behind); @@ -260,8 +308,9 @@ private void Place( } var rect = panel.Rect; - SetLeft(control, rect.X * cell.Width); - SetTop(control, rect.Y * cell.Height); + var origin = CellOrigin; + SetLeft(control, origin.X + (rect.X * cell.Width)); + SetTop(control, origin.Y + (rect.Y * cell.Height)); control.Width = rect.Width * cell.Width; control.Height = rect.Height * cell.Height; @@ -381,3 +430,39 @@ public override void Render(DrawingContext context) context.DrawLine(pen, new Point(split, middle), new Point(x + w, middle)); } } + +/// +/// How big the window's own chrome is, in logical pixels: the header band across the top and the sidebar down the +/// left, each the size of a desktop app's rather than a cell's. The client is told only that it draws neither +/// (); the sizes are the window's, and the cell grid is the rest of the window. +/// +internal static class NativeLayout +{ + /// The header band's height. + public const double HeaderHeight = 42; + + /// The sidebar's width, open. + public const double SidebarWidth = 232; + + /// The sidebar's width folded to its strip (⌃B b, or its own fold button). + public const double SidebarSlim = 48; + + /// + /// The sidebar's breathing room before the panes: its own plane carried a few pixels on, so a pane's first column + /// of text does not sit hard against the sidebar's edge. Part of the sidebar, never of a pane, so it costs no cell. + /// + public const double SidebarGutter = 8; + + /// A header button's side. + public const double ButtonSize = 30; + + /// The gap between two header buttons. + public const double ButtonGap = 6; + + /// The cells' margin in the window: the space the native header and sidebar take. + public static Thickness Insets(HostChrome chrome, bool collapsed) => new( + chrome.Rail ? (collapsed ? SidebarSlim : SidebarWidth) + SidebarGutter : 0, + chrome.Header ? HeaderHeight : 0, + 0, + 0); +} diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index ffdabba3..50f75893 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -50,11 +50,12 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime app.RequestedThemeVariant = luma < 128 ? ThemeVariant.Dark : ThemeVariant.Light; } - // No title bar: the client's own header is the top of the window, as it is the top of a terminal. The - // border stays, and the header's blank cells move the window (WindowChrome). --title-bar brings it back. + // No title bar: the header is the top of the window — the window's own (NativeHeader), or the client's cells + // with --cell-chrome. The border stays, and the header's empty space moves the window (WindowChrome). + // --title-bar brings it back. WindowDecorations = options.TitleBar ? WindowDecorations.Full : WindowDecorations.BorderOnly; Background = new SolidColorBrush(Color.FromRgb(background.Red, background.Green, background.Blue)); - // The view fills the window; the screen-reader regions sit under it, unseen. + // The view fills the window past the native chrome; the screen-reader regions sit under it, unseen. var root = new Panel(); foreach (var region in _driver.Announcer.Regions()) { @@ -63,11 +64,16 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime root.Children.Add(_view); - // The window's native views over the cells: the header's Layouts button and native panels (DesktopLayer). - root.Children.Add(new DesktopLayer(_view)); + // The window's native views: the header band and the connections sidebar beside the cells (the layer moves the + // view out of their way, so no cell lies under either), the Layouts button, and native panels over their panes. + root.Children.Add(new DesktopLayer(_view, options.Chrome)); Content = root; AutomationProperties.SetName(_view, "SharpMUTerm"); - var size = _view.SizeFor(options.Columns, options.Rows); + + // --size names the grid, so the window is that grid plus the native chrome around it. + var insets = NativeLayout.Insets(options.Chrome, collapsed: false); + var cells = _view.SizeFor(options.Columns, options.Rows); + var size = new Size(cells.Width + insets.Left, cells.Height + insets.Top); Width = size.Width; Height = size.Height; _normalSize = size; diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 448144b6..72e151ab 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -15,9 +15,12 @@ namespace SharpMUTerm.Avalonia; /// What the native header and sidebar share: a clickable area naming the target the client put in its model, and the /// pointer handling that turns a press and release on one area into that target. Nothing here spells a target: every /// one comes out of or , and goes back through -/// , which acts on it exactly as a click on the cells under it would. +/// , which acts on it exactly as a click on the cell rail or header would. /// -/// Never focusable: the keyboard stays with the client, as a click on the cells leaves it. +/// Both sit beside the cells, never over them (): the client leaves no row or column for +/// them. The window's resize band runs along their outer edges as it does along the cells'. Never focusable: the +/// keyboard stays with the client. While a modal of the client's is in front ( +/// false) they stay drawn, under a veil, and take no click. /// /// internal abstract class NativeChromeView : Control @@ -35,36 +38,43 @@ protected NativeChromeView(TerminalView view) protected TerminalView View { get; } - /// What the client last said, or null. + /// What the client last said, or null before it has said anything. internal ChromeOverlay? Overlay { get; private set; } protected Color Plane { get; private set; } = Colors.Black; protected Color Ink { get; private set; } = Colors.White; + /// Whether the chrome is drawn but takes no click, because a modal of the client's is in front. + internal bool Inert => Overlay is { Interactive: false }; + /// The clickable areas and their targets, as last laid out. Internal for tests. internal IReadOnlyList<(Rect Area, string Target, string Tip)> Hits => _hits; - /// Takes what the client said and the plane under the view, read off the frame, and redraws. - public void Show(ChromeOverlay overlay, Color plane, Color ink) + /// Takes what the client said and the plane and ink to draw with, and redraws. + public void Show(ChromeOverlay? overlay, Color plane, Color ink) { Overlay = overlay; Plane = plane; Ink = ink; _hits.Clear(); - Layout(_hits); + if (overlay is not null && !double.IsNaN(Width) && !double.IsNaN(Height)) + { + Layout(overlay, _hits); + } + InvalidateVisual(); } /// Works out where each clickable thing goes, for the size the view has been given. - protected abstract void Layout(List<(Rect Area, string Target, string Tip)> hits); + protected abstract void Layout(ChromeOverlay overlay, List<(Rect Area, string Target, string Tip)> hits); /// A left press on no clickable area. The header moves the window; the sidebar does nothing. protected virtual void PressedEmpty(PointerPressedEventArgs e) { } - /// The area under , or null. + /// The area under , or null. An area with no target only carries a tooltip. protected (Rect Area, string Target, string Tip)? HitAt(Point point) { foreach (var hit in _hits) @@ -79,23 +89,32 @@ protected virtual void PressedEmpty(PointerPressedEventArgs e) } /// Whether the pointer is over , for a hover plate. - protected bool Hovered(Rect area) => _hover == area; + protected bool Hovered(Rect area) => !Inert && _hover == area; /// Whether is being pressed. protected bool Pressing(Rect area) => _pressed is not null && _hover == area; /// Acts on a target as a click would. Internal for tests. - internal void Click(string target) => Overlay?.Activate(target); + internal void Click(string target) + { + if (!Inert && target.Length > 0) + { + Overlay?.Activate(target); + } + } protected override void OnPointerMoved(PointerEventArgs e) { base.OnPointerMoved(e); var hit = HitAt(e.GetPosition(this)); var area = hit?.Area; + var edge = View.EdgeCursorFromChrome(e); + Cursor = edge is { } resize ? new Cursor(resize) + : hit is { Target.Length: > 0 } && !Inert ? new Cursor(StandardCursorType.Hand) + : Cursor.Default; if (area != _hover) { _hover = area; - Cursor = hit is null ? Cursor.Default : new Cursor(StandardCursorType.Hand); ToolTip.SetTip(this, hit?.Tip); InvalidateVisual(); } @@ -110,30 +129,24 @@ protected override void OnPointerExited(PointerEventArgs e) InvalidateVisual(); } - // Every pointer event over the view is the window's, as over a header button: nothing routes on to the cells, - // which would read a press on whatever the client drew there. + // Every pointer event over the view is the window's: there is no cell under it to reach, and the client's own + // cells beside it are a different place. protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); e.Handled = true; var point = e.GetCurrentPoint(this); - if (point.Properties.IsRightButtonPressed) + if (!point.Properties.IsLeftButtonPressed) { - // The client's own menu for the place under the pointer, as over the cells (the map does the same). - if (this.TranslatePoint(point.Position, View) is { } onView) - { - View.ForwardRightClick(onView, e.KeyModifiers); - } - return; } - if (!point.Properties.IsLeftButtonPressed) + if (View.ResizeFromChrome(e)) { return; } - if (HitAt(point.Position) is { } hit) + if (!Inert && HitAt(point.Position) is { Target.Length: > 0 } hit) { _pressed = hit.Target; _hover = hit.Area; @@ -166,7 +179,10 @@ protected override void OnPointerWheelChanged(PointerWheelEventArgs e) // ── Drawing ──────────────────────────────────────────────────────────────────────────────── - protected Color Dim => Color.FromArgb(0xA0, Ink.R, Ink.G, Ink.B); + /// The UI font size the chrome's text is set in. + protected const double FontSize = 13; + + protected Color Dim => Color.FromArgb(0xA8, Ink.R, Ink.G, Ink.B); protected Color Faint(byte alpha) => Color.FromArgb(alpha, Ink.R, Ink.G, Ink.B); @@ -182,10 +198,29 @@ protected Color Accent(TerminalColor accent) => protected static Color On(Color fill, Color ink) => ToColour(Contrast.Legible(new Rgb(ink.R, ink.G, ink.B), new Rgb(fill.R, fill.G, fill.B))); - protected static Color Parse(string? hex) => hex is not null && Color.TryParse(hex, out var colour) ? colour : Colors.Gray; + /// A #rrggbb the client handed over, or grey. + internal static Color Parse(string? hex) => hex is not null && Color.TryParse(hex, out var colour) ? colour : Colors.Gray; private static Color ToColour(Rgb rgb) => Color.FromRgb(rgb.R, rgb.G, rgb.B); + /// The plane lifted (on a dark theme) or lowered (on a light one) by : a raised surface. + protected Color Raised(double amount) + { + var luma = (0.2126 * Plane.R) + (0.7152 * Plane.G) + (0.0722 * Plane.B); + var target = luma < 128 ? Colors.White : Colors.Black; + byte Mix(byte a, byte b) => (byte)Math.Round(a + ((b - a) * amount)); + return Color.FromRgb(Mix(Plane.R, target.R), Mix(Plane.G, target.G), Mix(Plane.B, target.B)); + } + + /// The veil a modal in front lays over the chrome: drawn, readable, and plainly not the thing in use. + protected void DrawVeil(DrawingContext context) + { + if (Inert) + { + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x70, Plane.R, Plane.G, Plane.B)), null, new Rect(Bounds.Size)); + } + } + protected static FormattedText Format(string text, double size, Color colour, bool bold = false, double maxWidth = double.PositiveInfinity) { var formatted = new FormattedText( @@ -225,28 +260,74 @@ protected double Badge(DrawingContext context, int unread, double right, double { var text = UnreadText(unread); var fill = Legible(Parse(Overlay?.Palette.Unread)); - var width = Measure(text, size * 0.85, bold: true) + (size * 0.9); - var height = Math.Max(size * 1.15, 10); + var width = Math.Max(Measure(text, size * 0.85, bold: true) + (size * 0.9), size * 1.4); + var height = Math.Max(size * 1.3, 10); var pill = new Rect(right - width, middle - (height / 2), width, height); context.DrawRectangle(new SolidColorBrush(fill), null, pill, height / 2, height / 2); Text(context, text, pill.X + ((width - Measure(text, size * 0.85, bold: true)) / 2), middle, size * 0.85, On(fill, Plane), bold: true); return width; } + /// A presence dot: filled while connected, a ring while being dialled or offline. + protected static void Dot(DrawingContext context, Point centre, double radius, Color colour, bool filled, bool diamond = false) + { + if (diamond) + { + // A member of the send group wears a diamond, as on the cells. + var shape = new StreamGeometry(); + using (var g = shape.Open()) + { + g.BeginFigure(centre + new Point(0, -radius * 1.25), true); + g.LineTo(centre + new Point(radius * 1.25, 0)); + g.LineTo(centre + new Point(0, radius * 1.25)); + g.LineTo(centre + new Point(-radius * 1.25, 0)); + g.EndFigure(true); + } + + context.DrawGeometry(filled ? new SolidColorBrush(colour) : null, new Pen(new SolidColorBrush(colour), 1.3), shape); + return; + } + + if (filled) + { + context.DrawEllipse(new SolidColorBrush(colour), null, centre, radius, radius); + } + else + { + context.DrawEllipse(null, new Pen(new SolidColorBrush(colour), 1.3), centre, radius, radius); + } + } + + /// A chevron pointing left () or right, centred in . + protected static void Chevron(DrawingContext context, Rect area, bool left, Color colour) + { + var pen = new Pen(new SolidColorBrush(colour), 1.6, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round); + var c = area.Center; + var s = Math.Min(area.Width, area.Height) * 0.18; + foreach (var dx in new[] { -s * 0.9, s * 0.9 }) + { + var tip = left ? c.X + dx - s : c.X + dx + s; + var back = left ? c.X + dx + s : c.X + dx - s; + context.DrawLine(pen, new Point(back, c.Y - (s * 1.6)), new Point(tip, c.Y)); + context.DrawLine(pen, new Point(tip, c.Y), new Point(back, c.Y + (s * 1.6))); + } + } + /// A count as the cells write it (99+ past the cap), so the two views agree about one count. internal static string UnreadText(int unread) => unread > 99 ? "99+" : unread.ToString(CultureInfo.InvariantCulture); } /// -/// The window's own header, drawn over the client's header row: the app's name, a search box that opens the command -/// surface (⌃P), the connected count and log state, and the character in front as a pill — a presence dot, the name, -/// and world · TLS. Everything it says is , the model the cell ribbon under it is -/// drawn from. +/// The window's own header band, across the top of the window above the cells: the app's name, a search box that +/// opens the command surface (⌃P), the connected count and log state, and the character in front as a pill — a +/// presence dot, the name, and world · TLS. Everything it says is , the model the cell +/// ribbon would be drawn from; the client draws no header row in this host. /// -/// Within the row, never taller. The header is one cell row and stays one; a taller native header needs the -/// client's layout to leave the room (see CLAUDE.md, native chrome). The right end is left clear for the header -/// buttons (), which sit above this view. A press on empty space moves the -/// window and a double-click maximises, as a blank header cell does (). +/// While ⌃B is armed the search box and the counts give way to the keymap (): the +/// chord, each key it answers (a key that cannot run now is dimmed, and its tooltip says why), and the way out — what +/// the cell header's strip says, with the room to say all of it. The right end is left clear for the header buttons +/// (), which sit above this view. A press on empty space moves the window and a +/// double-click maximises (). /// /// internal sealed class NativeHeader(TerminalView view) : NativeChromeView(view) @@ -254,6 +335,9 @@ internal sealed class NativeHeader(TerminalView view) : NativeChromeView(view) /// What the search box says. ⌃P lists commands, characters and windows, and settings screens. internal const string SearchText = "Search commands, windows, settings"; + /// The prefix's leading word, beside its chord. + internal const string PrefixWord = "awaiting a pane key"; + /// Width kept clear at the right for the header buttons. public double ReserveRight { get; set; } @@ -261,57 +345,97 @@ internal sealed class NativeHeader(TerminalView view) : NativeChromeView(view) private Rect _search; private Rect _pill; private Rect _counts; + private Rect _prefix; + private readonly List<(Rect Area, HeaderPrefixKey Key)> _keys = []; + private Rect _exit; - private double Size => Math.Clamp(Height * 0.6, 9, 14); + /// The ⌃B keys as last laid out. Internal for tests. + internal IReadOnlyList<(Rect Area, HeaderPrefixKey Key)> PrefixKeys => _keys; - protected override void Layout(List<(Rect Area, string Target, string Tip)> hits) - { - _brand = _search = _pill = _counts = default; - if (Overlay is not { } overlay || double.IsNaN(Width) || double.IsNaN(Height)) - { - return; - } + private const double PlateHeight = 30; + protected override void Layout(ChromeOverlay overlay, List<(Rect Area, string Target, string Tip)> hits) + { + _brand = _search = _pill = _counts = _prefix = _exit = default; + _keys.Clear(); var model = overlay.HeaderModel; - var size = Size; + const double size = FontSize; var h = Height; - var plateTop = 1.0; - var plateHeight = Math.Max(4, h - 2); - var pad = Math.Round(size * 0.8); + var plateHeight = Math.Min(PlateHeight, Math.Max(4, h - 6)); + var plateTop = Math.Round((h - plateHeight) / 2); + const double pad = 12; - _brand = new Rect(6, plateTop, Measure("SharpMUTerm", size, bold: true) + (pad * 2), plateHeight); + _brand = new Rect(10, plateTop, Measure("SharpMUTerm", size + 1, bold: true) + pad + 22, plateHeight); hits.Add((_brand, HeaderModel.PaletteTarget, $"Commands ({KeyGlyphs.Words(HeaderModel.PaletteKey)})")); - var right = Width - ReserveRight - 6; + var right = Width - ReserveRight - 8; if (model.Character is { } character && model.World is { } world) { var name = Measure(character.Name, size, bold: true); - var detail = Measure(character.Detail(world.Name), size * 0.9); - var width = Math.Min(pad + size + name + pad + detail + pad, Math.Max(0, right - _brand.Right - 24)); + var detail = Measure(character.Detail(world.Name), size - 1); + var width = Math.Min(pad + 10 + 8 + name + 10 + detail + pad, Math.Max(0, right - _brand.Right - 24)); _pill = new Rect(right - width, plateTop, width, plateHeight); - hits.Add((_pill, character.Target, $"{character.Name} on {world.Name}")); - right = _pill.Left - 12; + hits.Add((_pill, character.Target, $"{character.Name} on {world.Name} — {character.Host}:{character.Port}")); + right = _pill.Left - 16; + } + + var start = _brand.Right + 20; + if (model.Prefix is { } prefix) + { + LayoutPrefix(prefix, start, right, plateTop, plateHeight, hits); + return; } var counts = CountsText(model); - var countsWidth = Measure(counts, size * 0.9); - var searchStart = _brand.Right + 16; - var keyWidth = Measure(KeyGlyphs.Words(HeaderModel.PaletteKey), size * 0.85) + 10; - var searchFloor = size + Measure("Search", size) + keyWidth + (pad * 3); - if (right - countsWidth - 16 - searchStart >= searchFloor) + var countsWidth = Measure(counts, size - 1); + var keyWidth = Measure(KeyGlyphs.Words(HeaderModel.PaletteKey), size - 1.5) + 12; + var searchFloor = 18 + Measure("Search", size) + keyWidth + (pad * 3); + if (right - countsWidth - 20 - start >= searchFloor) { _counts = new Rect(right - countsWidth, 0, countsWidth, h); - right = _counts.Left - 16; + right = _counts.Left - 20; } - if (right - searchStart >= searchFloor) + if (right - start >= searchFloor) { - var width = Math.Min(420, right - searchStart); - _search = new Rect(searchStart, plateTop, width, plateHeight); + var width = Math.Min(460, right - start); + _search = new Rect(start, plateTop, width, plateHeight); hits.Add((_search, HeaderModel.PaletteTarget, $"Commands, characters, windows and settings ({KeyGlyphs.Words(HeaderModel.PaletteKey)})")); } } + private void LayoutPrefix(HeaderPrefix prefix, double start, double right, double plateTop, double plateHeight, List<(Rect Area, string Target, string Tip)> hits) + { + const double size = FontSize; + var chipHeight = plateHeight - 6; + var chipTop = plateTop + 3; + var lead = Measure(HeaderPrefix.Chord, size, bold: true) + Measure(PrefixWord, size - 1) + 34; + _prefix = new Rect(start, plateTop, Math.Min(lead, Math.Max(0, right - start)), plateHeight); + hits.Add((_prefix, string.Empty, $"{HeaderPrefix.Chord} is armed: the next key acts on the workspace. {prefix.Exit}.")); + + var exitWidth = Measure(prefix.Exit, size - 1) + 8; + var x = _prefix.Right + 12; + var limit = right - exitWidth - 12; + foreach (var key in prefix.Keys) + { + var width = Measure(key.Keys, size, bold: true) + 16; + if (x + width > limit) + { + break; + } + + var area = new Rect(x, chipTop, width, chipHeight); + _keys.Add((area, key)); + hits.Add((area, string.Empty, key.Available ? $"{key.Keys} {key.Title}" : $"{key.Keys} {key.Title} — {key.Blocked}")); + x += width + 5; + } + + if (right - x >= exitWidth) + { + _exit = new Rect(right - exitWidth, 0, exitWidth, Height); + } + } + private static string CountsText(HeaderModel model) => model.HasWorlds ? $"{model.ConnectedText} · {model.LogText}" : model.LogText; @@ -319,18 +443,22 @@ private static string CountsText(HeaderModel model) => public override void Render(DrawingContext context) { - context.DrawRectangle(new SolidColorBrush(Plane), null, new Rect(Bounds.Size)); + var bounds = new Rect(Bounds.Size); + context.DrawRectangle(new SolidColorBrush(Plane), null, bounds); + + // A hairline under the band, where a desktop app's toolbar meets its content. + context.DrawRectangle(new SolidColorBrush(Faint(0x24)), null, new Rect(0, bounds.Height - 1, bounds.Width, 1)); if (Overlay is not { } overlay) { return; } var model = overlay.HeaderModel; - var size = Size; + const double size = FontSize; var middle = Bounds.Height / 2; - var radius = Math.Min(6, _brand.Height / 2); + const double radius = 7; - // The brand: the ribbon's first segment, in its own fill. + // The brand: the ribbon's first segment, in its own fill, with the ☰ the ribbon carries. var brand = Parse(overlay.Palette.Brand); if (Pressing(_brand) || Hovered(_brand)) { @@ -338,77 +466,110 @@ public override void Render(DrawingContext context) } context.DrawRectangle(new SolidColorBrush(brand), null, _brand, radius, radius); - Text(context, "SharpMUTerm", _brand.X + ((_brand.Width - Measure("SharpMUTerm", size, true)) / 2), middle, size, On(brand, Colors.Black), bold: true); - - if (_search.Width > 0) + var brandInk = On(brand, Colors.Black); + var menu = new Pen(new SolidColorBrush(brandInk), 1.6, lineCap: PenLineCap.Round); + var mx = _brand.X + 12; + foreach (var dy in new[] { -4.0, 0, 4 }) { - var fill = Faint((byte)(Hovered(_search) ? 0x26 : 0x14)); - context.DrawRectangle(new SolidColorBrush(fill), new Pen(new SolidColorBrush(Faint(0x38)), 1), _search.Deflate(0.5), radius, radius); - var pad = Math.Round(size * 0.8); + context.DrawLine(menu, new Point(mx, middle + dy), new Point(mx + 11, middle + dy)); + } - // A magnifier: a ring and its handle. - var ring = size * 0.32; - var centre = new Point(_search.X + pad + ring, middle - (ring * 0.25)); - var pen = new Pen(new SolidColorBrush(Dim), 1.3); - context.DrawEllipse(null, pen, centre, ring, ring); - context.DrawLine(pen, centre + new Point(ring * 0.7, ring * 0.7), centre + new Point(ring * 1.5, ring * 1.5)); + Text(context, "SharpMUTerm", mx + 18, middle, size + 1, brandInk, bold: true); - var key = KeyGlyphs.Words(HeaderModel.PaletteKey); - var keyWidth = Measure(key, size * 0.85) + 10; - var cap = new Rect(_search.Right - pad - keyWidth, middle - (_search.Height * 0.36), keyWidth, _search.Height * 0.72); - context.DrawRectangle(null, new Pen(new SolidColorBrush(Faint(0x50)), 1), cap.Deflate(0.5), 3, 3); - Text(context, key, cap.X + 5, middle, size * 0.85, Dim); - var textLeft = centre.X + (ring * 2) + 6; - Text(context, SearchText, textLeft, middle, size, Dim, maxWidth: Math.Max(1, cap.Left - 8 - textLeft)); + if (_search.Width > 0) + { + DrawSearch(context, middle, radius); } if (_counts.Width > 0) { - Text(context, CountsText(model), _counts.X, middle, size * 0.9, Dim); + Text(context, CountsText(model), _counts.X, middle, size - 1, Dim); + } + + if (model.Prefix is { } prefix) + { + DrawPrefix(context, prefix, overlay, middle); } if (_pill.Width > 0 && model.Character is { } character && model.World is { } world) { - var fill = Faint((byte)(Hovered(_pill) ? 0x2A : 0x18)); + var fill = Hovered(_pill) ? Raised(0.16) : Raised(0.09); context.DrawRectangle(new SolidColorBrush(fill), null, _pill, _pill.Height / 2, _pill.Height / 2); - var pad = Math.Round(size * 0.8); - var dot = size * 0.32; - var dotCentre = new Point(_pill.X + pad + dot, middle); var accent = Accent(world.Accent); - switch (character.Presence) - { - case CharacterPresence.Online: - context.DrawEllipse(new SolidColorBrush(accent), null, dotCentre, dot, dot); - break; - case CharacterPresence.Connecting: - context.DrawEllipse(null, new Pen(new SolidColorBrush(accent), 1.5), dotCentre, dot, dot); - break; - default: - context.DrawEllipse(null, new Pen(new SolidColorBrush(Dim), 1.2), dotCentre, dot, dot); - break; - } - - var x = dotCentre.X + dot + 6; - var room = _pill.Right - pad - x; + var dotCentre = new Point(_pill.X + 12 + 4.5, middle); + Dot(context, dotCentre, 4.5, character.Presence == CharacterPresence.Offline ? Dim : accent, character.Presence == CharacterPresence.Online); + var x = dotCentre.X + 4.5 + 8; + var room = _pill.Right - 12 - x; var nameWidth = Text(context, character.Name, x, middle, size, Ink, bold: true, maxWidth: room); - x += nameWidth + 8; - if (_pill.Right - pad - x > 12) + x += nameWidth + 10; + if (_pill.Right - 12 - x > 12) { - Text(context, character.Detail(world.Name), x, middle, size * 0.9, Dim, maxWidth: _pill.Right - pad - x); + Text(context, character.Detail(world.Name), x, middle, size - 1, Dim, maxWidth: _pill.Right - 12 - x); } } + + DrawVeil(context); + } + + private void DrawSearch(DrawingContext context, double middle, double radius) + { + const double size = FontSize; + var fill = Hovered(_search) ? Raised(0.13) : Raised(0.07); + context.DrawRectangle(new SolidColorBrush(fill), new Pen(new SolidColorBrush(Faint(0x30)), 1), _search.Deflate(0.5), radius, radius); + + // A magnifier: a ring and its handle. + const double ring = 5; + var centre = new Point(_search.X + 14 + ring, middle - 1); + var pen = new Pen(new SolidColorBrush(Dim), 1.4, lineCap: PenLineCap.Round); + context.DrawEllipse(null, pen, centre, ring, ring); + context.DrawLine(pen, centre + new Point(ring * 0.72, ring * 0.72), centre + new Point(ring * 1.55, ring * 1.55)); + + var key = KeyGlyphs.Words(HeaderModel.PaletteKey); + var keyWidth = Measure(key, size - 1.5) + 12; + var cap = new Rect(_search.Right - 8 - keyWidth, middle - 10, keyWidth, 20); + context.DrawRectangle(null, new Pen(new SolidColorBrush(Faint(0x50)), 1), cap.Deflate(0.5), 4, 4); + Text(context, key, cap.X + 6, middle, size - 1.5, Dim); + var textLeft = centre.X + (ring * 2) + 8; + Text(context, SearchText, textLeft, middle, size, Dim, maxWidth: Math.Max(1, cap.Left - 10 - textLeft)); + } + + private void DrawPrefix(DrawingContext context, HeaderPrefix prefix, ChromeOverlay overlay, double middle) + { + const double size = FontSize; + var notice = Legible(Parse(overlay.Palette.Notice)); + if (_prefix.Width > 0) + { + var plate = Color.FromArgb(0x2A, notice.R, notice.G, notice.B); + context.DrawRectangle(new SolidColorBrush(plate), new Pen(new SolidColorBrush(Color.FromArgb(0x90, notice.R, notice.G, notice.B)), 1), _prefix.Deflate(0.5), 7, 7); + var x = _prefix.X + 12; + x += Text(context, HeaderPrefix.Chord, x, middle, size, notice, bold: true) + 8; + Text(context, PrefixWord, x, middle, size - 1, Ink, maxWidth: Math.Max(1, _prefix.Right - 10 - x)); + } + + foreach (var (area, key) in _keys) + { + var colour = key.Available ? Ink : Faint(0x60); + context.DrawRectangle(new SolidColorBrush(Raised(key.Available ? 0.12 : 0.04)), new Pen(new SolidColorBrush(Faint(key.Available ? (byte)0x40 : (byte)0x20)), 1), area.Deflate(0.5), 5, 5); + Text(context, key.Keys, area.X + 8, middle, size, colour, bold: true); + } + + if (_exit.Width > 0) + { + Text(context, prefix.Exit, _exit.Right, middle, size - 1, Dim, alignRight: true); + } } } /// -/// The window's own sidebar, drawn over the client's rail: CONNECTIONS, worlds as headings, characters with a -/// presence dot and an unread badge (offline ones greyed and saying so), the open character's windows indented with -/// the chord that reaches each and its unread count, and an "add a game" button at the foot. Everything it says is -/// , the model the cell rail under it is drawn from, and every click goes back as the -/// target that model gave — the rail's own handler acts on it. +/// The window's own sidebar, down the left of the window beside the cells: CONNECTIONS, worlds as headings, +/// characters with a presence dot and an unread badge (offline ones greyed and saying so), the open character's +/// windows indented with the chord that reaches each and its unread count, and an "add a game" button at the foot. +/// Everything it says is , the model the cell rail would be drawn from, and every click goes +/// back as the target that model gave — the rail's own handler acts on it. The client draws no rail column here. /// -/// It draws within the rail's cells and never wider, so no pane moves and no world is told a new size. While the -/// rail is collapsed (⌃B b) it draws nothing and the cells' narrow strip shows. +/// Folded (⌃B b, or the fold button beside the title) it is a slim strip, the cell rail's collapsed form at a +/// desktop app's size: an unfold button, an accent mark per world, and a dot with an initial per character (filled +/// while connected, with an unread mark), each still a click on its target, with the name in its tooltip. /// /// internal sealed class NativeSidebar(TerminalView view) : NativeChromeView(view) @@ -416,38 +577,38 @@ internal sealed class NativeSidebar(TerminalView view) : NativeChromeView(view) /// What the button at the foot says. internal const string AddGameText = "+ Add a game or connect"; + /// The fold button's tooltip, open and folded. + internal const string FoldTip = "Fold the sidebar (⌃B b)", UnfoldTip = "Open the sidebar (⌃B b)"; + /// One drawn row: what it is, where, and its node. internal sealed record Row(RailRowKind Kind, Rect Area, RailWorld World, RailCharacter? Character = null, RailWindow? Window = null); private readonly List _rows = []; private Rect _add; + private Rect _fold; /// The rows as last laid out. Internal for tests. internal IReadOnlyList Rows => _rows; - private double CellHeight { get; set; } = 16; - - /// The height of a cell, which the rows are spaced from. - public void SetCellHeight(double height) => CellHeight = Math.Max(8, height); + private const double RowHeight = 28; - private double Size => Math.Clamp(CellHeight * 0.66, 9, 14); + private const double TitleHeight = 40; - private double RowHeight => Math.Round(Math.Max(CellHeight * 1.3, Size * 1.9)); + private bool Folded => Overlay?.Sidebar.Collapsed ?? false; - protected override void Layout(List<(Rect Area, string Target, string Tip)> hits) + protected override void Layout(ChromeOverlay overlay, List<(Rect Area, string Target, string Tip)> hits) { _rows.Clear(); _add = default; - if (Overlay is not { } overlay || double.IsNaN(Width) || double.IsNaN(Height)) - { - return; - } + var width = Width - NativeLayout.SidebarGutter; // the gutter is plane, never a row + var folded = overlay.Sidebar.Collapsed; + _fold = folded ? new Rect((width - 32) / 2, 6, 32, 28) : new Rect(width - 38, 6, 30, 28); + hits.Add((_fold, SidebarModel.CollapseTarget, folded ? UnfoldTip : FoldTip)); - var row = RowHeight; - var width = Width; - _add = new Rect(8, Height - row - 8, Math.Max(0, width - 16), row); + var row = folded ? 32 : RowHeight; + _add = folded ? new Rect((width - 32) / 2, Height - 32 - 10, 32, 32) : new Rect(10, Height - row - 12, Math.Max(0, width - 20), row + 2); var bottom = _add.Top - 6; - var y = row + 4; // under the CONNECTIONS title + var y = TitleHeight; void Add(Row r, string target, string tip) { if (r.Area.Bottom > bottom) @@ -461,34 +622,52 @@ void Add(Row r, string target, string tip) foreach (var world in overlay.Sidebar.Worlds) { - y += 6; - Add(new Row(RailRowKind.World, new Rect(4, y, width - 8, row), world), SidebarModel.TargetOf(world), world.Name); - y += row; - if (world.Characters.Count == 0) + y += folded ? 4 : 8; + if (folded) + { + // The world's accent mark, one short rule: where its characters begin. + Add(new Row(RailRowKind.World, new Rect(6, y, width - 12, 10), world), SidebarModel.TargetOf(world), world.Name); + y += 10; + } + else { - Add(new Row(RailRowKind.Empty, new Rect(4, y, width - 8, row), world), SidebarModel.TargetOf(world), $"{world.Name} has no characters yet"); + Add(new Row(RailRowKind.World, new Rect(6, y, width - 12, row), world), SidebarModel.TargetOf(world), $"{world.Name} — {world.Host}:{world.Port}"); y += row; + } + + if (world.Characters.Count == 0) + { + if (!folded) + { + Add(new Row(RailRowKind.Empty, new Rect(6, y, width - 12, row), world), SidebarModel.TargetOf(world), $"{world.Name} has no characters yet"); + y += row; + } + continue; } foreach (var character in world.Characters) { - Add(new Row(RailRowKind.Character, new Rect(4, y, width - 8, row), world, character), SidebarModel.TargetOf(character), $"Switch to {character.Name}"); + var area = folded ? new Rect((width - 36) / 2, y, 36, row) : new Rect(6, y, width - 12, row); + var tip = folded + ? $"{character.Name} on {world.Name}{(character.Connected ? string.Empty : " (offline)")}{(character.Unread > 0 ? $", {UnreadText(character.Unread)} unread" : string.Empty)}" + : $"Switch to {character.Name}"; + Add(new Row(RailRowKind.Character, area, world, character), SidebarModel.TargetOf(character), tip); y += row; - if (!character.Active) + if (!character.Active || folded) { continue; } foreach (var window in character.Windows) { - Add(new Row(RailRowKind.Window, new Rect(4, y, width - 8, row), world, character, window), SidebarModel.TargetOf(window), window.Closed ? $"{window.Title} is closed" : $"Go to {window.Title}"); + Add(new Row(RailRowKind.Window, new Rect(6, y, width - 12, row), world, character, window), SidebarModel.TargetOf(window), window.Closed ? $"{window.Title} is closed" : $"Go to {window.Title}"); y += row; } } } - if (_add.Width > 40 && _add.Top > row) + if (_add.Width > 20 && _add.Top > TitleHeight) { hits.Add((_add, SidebarModel.AddGameTarget, "Connect to a game, or add one")); } @@ -500,38 +679,53 @@ void Add(Row r, string target, string tip) public override void Render(DrawingContext context) { + // The plane runs on through the gutter to the panes (NativeLayout.SidebarGutter): the pane's own raised surface + // against it is the edge, as the cell rail's backdrop is. context.DrawRectangle(new SolidColorBrush(Plane), null, new Rect(Bounds.Size)); if (Overlay is not { } overlay) { return; } - var size = Size; - var row = RowHeight; - Text(context, "CONNECTIONS", 12, row / 2 + 4, size * 0.8, Dim, bold: true); + const double size = FontSize; + if (Hovered(_fold)) + { + context.DrawRectangle(new SolidColorBrush(Raised(0.12)), null, _fold, 6, 6); + } + + Chevron(context, _fold, left: !Folded, Dim); + if (!Folded) + { + Text(context, "CONNECTIONS", 16, _fold.Center.Y, size - 2.5, Dim, bold: true); + } foreach (var r in _rows) { + if (Folded) + { + DrawFolded(context, r, overlay); + continue; + } + var middle = r.Area.Center.Y; var hovered = Hovered(r.Area); var selected = r.Window is { } w && overlay.Sidebar.IsSelected(w) || r.Kind == RailRowKind.Character && r.Character!.Active; if (selected || hovered) { - var plate = (byte)(selected && hovered ? 0x30 : selected ? 0x22 : 0x14); - context.DrawRectangle(new SolidColorBrush(Faint(plate)), null, r.Area, 5, 5); + context.DrawRectangle(new SolidColorBrush(Raised(selected && hovered ? 0.16 : selected ? 0.11 : 0.07)), null, r.Area, 6, 6); } var accent = Accent(r.World.Accent); - var right = r.Area.Right - 8; + var right = r.Area.Right - 10; switch (r.Kind) { case RailRowKind.World: - context.DrawRectangle(new SolidColorBrush(accent), null, new Rect(r.Area.X + 4, middle - (size * 0.55), 3, size * 1.1), 1.5, 1.5); - Text(context, r.World.Name, r.Area.X + 14, middle, size, Ink, bold: true, maxWidth: right - r.Area.X - 14); + context.DrawRectangle(new SolidColorBrush(accent), null, new Rect(r.Area.X + 6, middle - 7, 3, 14), 1.5, 1.5); + Text(context, r.World.Name, r.Area.X + 18, middle, size, Ink, bold: true, maxWidth: right - r.Area.X - 18); break; case RailRowKind.Empty: - Text(context, "no characters", r.Area.X + 24, middle, size * 0.92, Dim, maxWidth: right - r.Area.X - 24); + Text(context, "no characters", r.Area.X + 28, middle, size - 1, Dim, maxWidth: right - r.Area.X - 28); break; case RailRowKind.Character: @@ -546,41 +740,72 @@ public override void Render(DrawingContext context) if (_add.Width > 0) { - var fill = Faint((byte)(Hovered(_add) ? 0x22 : 0x0E)); - context.DrawRectangle(new SolidColorBrush(fill), new Pen(new SolidColorBrush(Faint(0x40)), 1), _add.Deflate(0.5), 6, 6); - Text(context, AddGameText, _add.Center.X - (Math.Min(Measure(AddGameText, size), _add.Width - 12) / 2), _add.Center.Y, size, Ink, maxWidth: _add.Width - 12); + var fill = Hovered(_add) ? Raised(0.12) : Raised(0.05); + context.DrawRectangle(new SolidColorBrush(fill), new Pen(new SolidColorBrush(Faint(0x40)), 1), _add.Deflate(0.5), 7, 7); + if (Folded) + { + var pen = new Pen(new SolidColorBrush(Ink), 1.6, lineCap: PenLineCap.Round); + var c = _add.Center; + context.DrawLine(pen, c + new Point(-6, 0), c + new Point(6, 0)); + context.DrawLine(pen, c + new Point(0, -6), c + new Point(0, 6)); + } + else + { + Text(context, AddGameText, _add.Center.X - (Math.Min(Measure(AddGameText, size), _add.Width - 12) / 2), _add.Center.Y, size, Ink, maxWidth: _add.Width - 12); + } } + + DrawVeil(context); } - private void DrawCharacter(DrawingContext context, Row r, RailCharacter character, Color accent, double middle, double right, double size) + private void DrawFolded(DrawingContext context, Row r, ChromeOverlay overlay) { - var dot = size * 0.32; - var centre = new Point(r.Area.X + 22, middle); - var colour = character.Connected ? accent : Dim; - if (character.InGroup) + var accent = Accent(r.World.Accent); + if (r.Kind == RailRowKind.World) { - // A member of the send group wears a diamond, as on the cells. - var diamond = new StreamGeometry(); - using (var g = diamond.Open()) - { - g.BeginFigure(centre + new Point(0, -dot * 1.2), true); - g.LineTo(centre + new Point(dot * 1.2, 0)); - g.LineTo(centre + new Point(0, dot * 1.2)); - g.LineTo(centre + new Point(-dot * 1.2, 0)); - g.EndFigure(true); - } + context.DrawRectangle(new SolidColorBrush(accent), null, new Rect(r.Area.Center.X - 9, r.Area.Center.Y - 1.5, 18, 3), 1.5, 1.5); + return; + } - context.DrawGeometry(character.Connected ? new SolidColorBrush(colour) : null, new Pen(new SolidColorBrush(colour), 1.2), diamond); + if (r.Character is not { } character) + { + return; } - else if (character.Connected) + + // A disc with the character's initial: filled in the world's colour while connected, a ring while not. + var centre = r.Area.Center; + const double radius = 12; + if (character.Active || Hovered(r.Area)) + { + context.DrawRectangle(new SolidColorBrush(Raised(character.Active ? 0.12 : 0.07)), null, r.Area, 7, 7); + } + + var colour = character.Connected ? accent : Dim; + if (character.Connected) { - context.DrawEllipse(new SolidColorBrush(colour), null, centre, dot, dot); + context.DrawEllipse(new SolidColorBrush(colour), null, centre, radius, radius); } else { - context.DrawEllipse(null, new Pen(new SolidColorBrush(colour), 1.2), centre, dot, dot); + context.DrawEllipse(null, new Pen(new SolidColorBrush(colour), 1.4), centre, radius, radius); } + var initial = character.Name.Length > 0 ? char.ToUpperInvariant(character.Name[0]).ToString() : "?"; + var ink = character.Connected ? On(colour, Plane) : Dim; + Text(context, initial, centre.X - (Measure(initial, FontSize, bold: true) / 2), centre.Y, FontSize, ink, bold: true); + if (character.Unread > 0) + { + var mark = Legible(Parse(overlay.Palette.Unread)); + context.DrawEllipse(new SolidColorBrush(mark), new Pen(new SolidColorBrush(Plane), 1.5), centre + new Point(radius * 0.75, -radius * 0.75), 4, 4); + } + } + + private void DrawCharacter(DrawingContext context, Row r, RailCharacter character, Color accent, double middle, double right, double size) + { + var centre = new Point(r.Area.X + 24, middle); + var colour = character.Connected ? accent : Dim; + Dot(context, centre, 4.5, colour, character.Connected, diamond: character.InGroup); + // Right to left: the unread badge or the offline word, then the cycle chord. if (character.Unread > 0) { @@ -588,24 +813,24 @@ private void DrawCharacter(DrawingContext context, Row r, RailCharacter characte } else if (!character.Connected) { - right -= Text(context, "offline", right, middle, size * 0.85, Dim, alignRight: true) + 6; + right -= Text(context, "offline", right, middle, size - 1.5, Dim, alignRight: true) + 6; } if (character.Chord is { Length: > 0 } chord) { - right -= Text(context, KeyGlyphs.Words(chord), right, middle, size * 0.85, Dim, alignRight: true) + 6; + right -= Text(context, KeyGlyphs.Words(chord), right, middle, size - 1.5, Dim, alignRight: true) + 6; } - var x = centre.X + dot + 7; + var x = centre.X + 12; Text(context, character.Name, x, middle, size, character.Connected ? Ink : Dim, bold: character.Active, maxWidth: Math.Max(1, right - x)); } private void DrawWindow(DrawingContext context, Row r, RailWindow window, Color accent, bool selected, double middle, double right, double size) { - var x = r.Area.X + 36; + var x = r.Area.X + 40; if (selected) { - context.DrawRectangle(new SolidColorBrush(accent), null, new Rect(r.Area.X + 28, middle - (size * 0.5), 2.5, size), 1, 1); + context.DrawRectangle(new SolidColorBrush(accent), null, new Rect(r.Area.X + 31, middle - 7, 3, 14), 1.5, 1.5); } if (window.Unread > 0) @@ -615,12 +840,12 @@ private void DrawWindow(DrawingContext context, Row r, RailWindow window, Color if (!window.Closed && window.Chord is { Length: > 0 } chord) { - right -= Text(context, KeyGlyphs.Words(chord), right, middle, size * 0.85, Dim, alignRight: true) + 6; + right -= Text(context, KeyGlyphs.Words(chord), right, middle, size - 1.5, Dim, alignRight: true) + 6; } if (window.Closed) { - right -= Text(context, "closed", right, middle, size * 0.85, Dim, alignRight: true) + 6; + right -= Text(context, "closed", right, middle, size - 1.5, Dim, alignRight: true) + 6; } if (window.HasUnsent) diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index 11b2f9b4..81384662 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -102,6 +102,13 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba /// The driver this view paints. internal AvaloniaConsoleDriver Driver => _driver; + /// + /// Whether the client's header is the cells' first row, so a blank cell there moves the window as a title bar + /// would. False when the window draws the header itself (): the first row is then a + /// pane's tab strip, whose blank run is the client's and never a handle. + /// + internal bool CellsHoldHeader { get; set; } = true; + /// /// Raised on the window's thread after a new frame is taken for painting, and when the cell size or the view's /// size changes: when anything placed over cells may need to move. @@ -393,13 +400,13 @@ private bool TryWindowGesture(PointerPressedEventArgs e, Point position, bool em return false; } - if (window.WindowState == WindowState.Normal && WindowChrome.EdgeAt(position, Bounds.Size) is { } edge) + if (EdgeAt(position) is { } edge) { window.BeginResizeDrag(edge, e); return true; } - if (!emptyChrome && !WindowChrome.IsMoveHandle(_driver.Frame, Cell(position))) + if (!emptyChrome && (!CellsHoldHeader || !WindowChrome.IsMoveHandle(_driver.Frame, Cell(position)))) { return false; } @@ -418,6 +425,36 @@ private bool TryWindowGesture(PointerPressedEventArgs e, Point position, bool em return true; } + /// + /// The window edge a pointer at (in this view's coordinates, which may lie outside it — + /// a native view beside the cells asks with its own pointer) would resize, or null. Measured against the + /// window: the view does not reach the window's top or left edge when the window draws its own header + /// and sidebar there. + /// + private WindowEdge? EdgeAt(Point position) => + Undecorated is { WindowState: WindowState.Normal } window && this.TranslatePoint(position, window) is { } inWindow + ? WindowChrome.EdgeAt(inWindow, window.ClientSize) + : null; + + /// The resize cursor for a native view's pointer over a window edge, or null when it is not over one. + internal StandardCursorType? EdgeCursorFromChrome(PointerEventArgs e) => + EdgeAt(e.GetPosition(this)) is { } edge ? WindowChrome.CursorFor(edge) : null; + + /// + /// A left press on a native view beside the cells that lands in the window's resize band: begins the resize, as a + /// press on a cell there does. Returns false off the band, and with a title bar. + /// + internal bool ResizeFromChrome(PointerPressedEventArgs e) + { + if (Undecorated is not { } window || EdgeAt(e.GetPosition(this)) is not { } edge) + { + return false; + } + + window.BeginResizeDrag(edge, e); + return true; + } + /// How many presses this view has turned into a move or a maximise. Internal for tests. internal int WindowGestures { get; private set; } @@ -435,7 +472,7 @@ private void ToggleMaximised() /// private void UpdateCursor(Point position) { - var edge = Undecorated is { WindowState: WindowState.Normal } && !_mouse.IsHeld ? WindowChrome.EdgeAt(position, Bounds.Size) : null; + var edge = !_mouse.IsHeld ? EdgeAt(position) : null; var cursor = edge is { } e ? WindowChrome.CursorFor(e) : _scrollDrag is not null || _barHovered is not null ? StandardCursorType.Arrow : CursorFor(_target.Shape); diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index e973767b..40eab64f 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -31,7 +31,13 @@ internal static class WindowHost Reserved = [Maximise, .. Paste], }; - public static ClientHost Create(AvaloniaConsoleDriver driver, Action? clipboard) => new() + /// The window's driver. + /// Where a copy goes. + /// + /// Which chrome the window draws natively. The header and the rail by default, which is the window a person runs; + /// for --render-png and --cell-chrome, where the cells carry it all. + /// + public static ClientHost Create(AvaloniaConsoleDriver driver, Action? clipboard, HostChrome? chrome = null) => new() { Name = "window", Driver = driver, @@ -59,5 +65,9 @@ internal static class WindowHost // F7 and F8 open a native settings window generated from their declarations; the rest stay cell screens. NativeSettings = driver.Settings, + + // The header band and the connections sidebar are the window's own controls, beside the cell grid rather + // than over it (MainWindow, DesktopLayer): the client draws neither. + Chrome = chrome ?? HostChrome.HeaderAndRail, }; } diff --git a/src/SharpMUTerm.Avalonia/WindowOptions.cs b/src/SharpMUTerm.Avalonia/WindowOptions.cs index 7c0772e6..857321a5 100644 --- a/src/SharpMUTerm.Avalonia/WindowOptions.cs +++ b/src/SharpMUTerm.Avalonia/WindowOptions.cs @@ -23,8 +23,15 @@ internal sealed record WindowOptions( string? RenderPng, int Columns, int Rows, - bool TitleBar = false) + bool TitleBar = false, + bool CellChrome = false) { + /// + /// Which chrome the window draws natively: the header and the sidebar, unless --cell-chrome asked for the + /// terminal's cells or this is --render-png, which draws cells and nothing native. + /// + public HostChrome Chrome => CellChrome || RenderPng is not null ? HostChrome.None : HostChrome.HeaderAndRail; + /// /// What the client is told about this "terminal": Kitty graphics and truecolour. Both are true by /// construction — this driver is the thing drawing the pixels — so nothing is probed. @@ -39,6 +46,7 @@ public static WindowOptions Parse(string[] args) var points = 14f; var demo = false; var titleBar = false; + var cellChrome = false; var (columns, rows) = (120, 36); for (var i = 0; i < args.Length; i++) { @@ -55,6 +63,7 @@ public static WindowOptions Parse(string[] args) break; case "--demo-config": demo = true; break; case "--title-bar": titleBar = true; break; + case "--cell-chrome": cellChrome = true; break; case WindowHandoff.Flag: break; // already in a window case "--view": view = Next(); break; case "--theme": theme = Next(); break; @@ -70,7 +79,7 @@ public static WindowOptions Parse(string[] args) } } - return new WindowOptions([.. rest], font, points, demo, view, theme, png, columns, rows, titleBar); + return new WindowOptions([.. rest], font, points, demo, view, theme, png, columns, rows, titleBar, cellChrome); } /// Applies --theme, the way the snapshot does: name and inline theme both. @@ -118,8 +127,10 @@ public static string Usage new("--font ", "Monospace font (default: the first installed Nerd Font, then Cascadia, Consolas…)."), new("--font-size ", "Font size (default 14)."), new("--size ", "The window's first size in cells, and the grid for --render-png (default 120x36)."), - new("--title-bar", "Keep the system title bar. Without it, drag the blank part of the top row", + new("--title-bar", "Keep the system title bar. Without it, drag the blank part of the header", "to move the window, double-click it to maximise, and drag an edge to resize."), + new("--cell-chrome", "Draw the header and the connections sidebar in cells, as the terminal does,", + "instead of as the window's own controls."), ]), ("Demo:", [ diff --git a/src/SharpMUTerm.Client/Chrome/HeaderModel.cs b/src/SharpMUTerm.Client/Chrome/HeaderModel.cs index f965378c..ebee1f4a 100644 --- a/src/SharpMUTerm.Client/Chrome/HeaderModel.cs +++ b/src/SharpMUTerm.Client/Chrome/HeaderModel.cs @@ -45,6 +45,37 @@ public sealed record HeaderModel( /// The log cell as the header words it. public string LogText => Log == LogFormat.None ? "LOG off" : $"LOG {Log.ToString().ToLowerInvariant()}"; + + /// + /// While ⌃B is armed, what the next key does — the which-key keymap the cell header's strip abbreviates and the + /// panel lists in full; null otherwise. A host drawing its own header shows this in place of the search box. + /// + public HeaderPrefix? Prefix { get; init; } +} + +/// The ⌃B keymap as the header shows it while the prefix is armed. +/// Every key the prefix answers, in the panel's order. +/// How the prefix is left, as every surface words it. +public sealed record HeaderPrefix(IReadOnlyList Keys, string Exit) +{ + /// The chord that arms the prefix. + public const string Chord = "⌃B"; + + /// Value equality over the keys, which a record's list member does not give. + public bool Equals(HeaderPrefix? other) => + other is not null && Exit == other.Exit && Keys.SequenceEqual(other.Keys); + + public override int GetHashCode() => HashCode.Combine(Exit, Keys.Count); +} + +/// One key of the ⌃B keymap. +/// The key, or keys, as the panel writes them (|, 1–9, < > ← →). +/// What it does. +/// Why it cannot run now, or null when it can. +public sealed record HeaderPrefixKey(string Keys, string Title, string? Blocked) +{ + /// Whether the key does something now. + public bool Available => Blocked is null; } /// The world in front, as the header names it. diff --git a/src/SharpMUTerm.Client/Chrome/SidebarModel.cs b/src/SharpMUTerm.Client/Chrome/SidebarModel.cs index 255b440b..3ddff292 100644 --- a/src/SharpMUTerm.Client/Chrome/SidebarModel.cs +++ b/src/SharpMUTerm.Client/Chrome/SidebarModel.cs @@ -30,6 +30,13 @@ public sealed record SidebarModel(IReadOnlyList Worlds, string? Selec /// public const string AddGameTarget = "term:welcome"; + /// + /// The sidebar's own target for folding it to its slim strip and back: what ⌃B b does. A chrome target, never a + /// server's — only the chrome's own handler reads it — and offered only by a host that draws the sidebar itself, + /// because the cell rail is folded with the keys. + /// + public const string CollapseTarget = "sharpmuterm-rail:toggle"; + /// The flat rows the cell rail draws (). public IReadOnlyList Rows() => RailModel.Build(Worlds); diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 1e8b37bb..b942f8d4 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -98,6 +98,14 @@ internal sealed record ClientHost /// public required INativeSettings? NativeSettings { get; init; } + /// + /// Which of the client's chrome the host draws itself, outside the cells (). The client + /// draws no cell for a part the host draws: no header row when , no rail column + /// when , so the cell grid the host hands the driver is only what is left. None in + /// the terminal, the snapshot and the tests, so their frames are the ones they always were. + /// + public required HostChrome Chrome { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -136,6 +144,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Announcer = null, ScreenIsSeen = true, NativeSettings = null, + Chrome = HostChrome.None, }; /// @@ -159,6 +168,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Announcer = null, ScreenIsSeen = true, NativeSettings = null, + Chrome = HostChrome.None, }; /// @@ -209,3 +219,24 @@ internal static ClientHost HarnessTerminal( Presence = null, // nor talks to Discord }; } + +/// +/// The parts of the client's chrome a host draws with its own controls, outside the cell grid. The space they take is +/// the host's business, in its own units (the window's header is 42 pixels, not a row): the client is told only +/// that the part is not its to draw, and leaves no cell for it. So nothing is drawn twice, nothing native sits over a +/// cell it hides, and every count the client makes of its own rows — the input-height veto, the layout, the pane +/// rectangles and therefore NAWS — is made over the cells that really exist. +/// +/// The host draws the header band (the client's first row). +/// The host draws the connection rail (the client's left column, with its divider and spacer). +internal sealed record HostChrome(bool Header, bool Rail) +{ + /// The client draws all of its chrome in cells: the terminal, the snapshot, the tests. + public static HostChrome None { get; } = new(false, false); + + /// The host draws the header and the rail natively: the desktop window. + public static HostChrome HeaderAndRail { get; } = new(true, true); + + /// Whether the host draws anything at all. + public bool Any => Header || Rail; +} diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs index 6bb0ac92..b3602075 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs @@ -5,9 +5,10 @@ namespace SharpMUTerm.Tui; /// -/// The header band and the connection sidebar as data, for a host that draws them natively over their cells (the -/// window). Both are the view-models the cell header and the cell rail are drawn from (, -/// ), so a native view cannot say anything the cells do not. +/// The header band and the connection sidebar as data, for a host that draws them itself, outside the cells (the +/// window; ). Both are the view-models the cell header and the cell rail are drawn +/// from (, ), so a native view cannot say anything the cells +/// would not. /// /// A click comes back as a target the client itself put in the model, and goes where the same click on the /// cells goes: a rail target to , the rail's own handler, and the header's palette @@ -23,13 +24,15 @@ internal sealed partial class SharpMUTermApp private Action? _chromeActivate; /// - /// Tells the host where the header and the rail are and what they say, when any of it changed. Rides the frame, - /// for ' reason, and the main window's activation, because another window opening over - /// this one (⌃P, a settings screen, the quit prompt) repaints that window and not this one. + /// Tells the host what the header and the rail say, when any of it changed — only a host that draws them + /// (). Rides the frame, for ' reason; the main window's + /// activation, because another window opening over this one (⌃P, a settings screen) repaints that window and not + /// this one; and every refresh of the header or the rail (), because with neither in + /// the cells a change to them may move no cell and paint no frame. /// private void PublishChrome() { - if (_pointer is null) + if (_pointer is null || !Host.Chrome.Any) { return; } @@ -44,6 +47,18 @@ private void PublishChrome() _pointer.Chrome(overlay); } + /// + /// from a refresh of the header or the rail, which can run while the app is still + /// being built (the window and the overlays not there yet), when there is nothing to publish. + /// + private void PublishHostChrome() + { + if (_window is not null && _palette is not null) + { + PublishChrome(); + } + } + /// The chrome as it stands. Internal for tests. internal ChromeOverlay BuildChromeOverlay() { @@ -55,16 +70,16 @@ internal ChromeOverlay BuildChromeOverlay() header.World is { } world ? FillHex(world.Accent) : null, _ink.Accent, _ink.Draft, - UnreadBadge.TintFor(_ink)); + UnreadBadge.TintFor(_ink), + _ink.Notice, + Hex(_theme.StatusBackground), + Hex(WorkspacePalette.Backdrop(_theme)), + Hex(_theme.Resolve(Core.Text.TerminalColor.Default, isBackground: false))); - // Shown only while the main window is the one in front. Every other window here — the command surface, the - // settings screens, the composer, the quit prompt — is drawn in cells over this one, and a native view over - // the header or the rail would paint over it. return new ChromeOverlay( + Host.Chrome, MainWindowInFront(), - CellRectOf(_header), header, - RailCellRect(), BuildSidebar(), palette, _chromeActivate); @@ -78,30 +93,6 @@ internal ChromeOverlay BuildChromeOverlay() private bool MainWindowInFront() => _system.ActiveWindow is not { } front || ReferenceEquals(front, _window); - /// - /// The sidebar's rectangle: its whole column, top to bottom, which is what the rail's cells (and the plane under - /// them) occupy — the rail control itself is only as tall as its rows. The control's own when there is no column yet. - /// - private PaneRect RailCellRect() - { - var rows = CellRectOf(_rail); - var column = _railColumn is null ? default : CellRectOf(_railColumn); - return column.Width > 0 && column.Height >= rows.Height ? column : rows; - } - - /// A control's arranged rectangle in desktop cells, or empty while it has none. - private PaneRect CellRectOf(SharpConsoleUI.Controls.IWindowControl control) - { - if (_window.GetLayoutNode(control) is not { } node) - { - return default; - } - - var origin = ContentOrigin(); - var bounds = node.AbsoluteBounds; - return new PaneRect(origin.X + bounds.X, origin.Y + bounds.Y, bounds.Width, bounds.Height); - } - /// /// A click on a native header or sidebar, by the target the client put in the model. Internal so a test can drive /// it the way a host does; returns whether the target was one the client offered and was acted on. @@ -115,6 +106,13 @@ internal bool ActivateChromeTarget(string target) return false; } + // A modal in front (⌃P, a settings screen, the composer, the quit prompt) owns the keys and the screen; the + // chrome stays drawn beside it, inert, as a desktop app's does under its own dialog. + if (!MainWindowInFront()) + { + return false; + } + if (target == HeaderModel.PaletteTarget) { // Opens, rather than the ☰'s toggle: a search box is clicked to start typing in it, never to close it. @@ -126,6 +124,12 @@ internal bool ActivateChromeTarget(string target) return true; } + if (target == SidebarModel.CollapseTarget) + { + ToggleRail(); + return true; + } + if (target == SidebarModel.AddGameTarget) { return DispatchCommand(target); @@ -139,39 +143,49 @@ internal bool ActivateChromeTarget(string target) } /// -/// The header band and the connection sidebar, for a host that draws them natively over their cells. The cells are -/// drawn as in any host, so a host that draws nothing loses nothing, and the parity test, which compares cells, is -/// unaffected. +/// The header band and the connection sidebar, for a host that draws them itself beside the cells +/// (). There are no cells under them: the client leaves no row or column for a part the +/// host draws, so the host places them in its own units and the cell grid is what is left. /// -/// Whether the main window is in front; while another window is, nothing native may be drawn. -/// The header row's rectangle, in desktop cells. +/// Which parts the host draws; a part it does not draw is in the cells and is not its to show. +/// +/// Whether the main window is in front. While another of the client's windows is (⌃P, a settings screen, the +/// composer, the quit prompt), the chrome stays drawn and takes no click: the modal owns the screen. +/// /// What the header says. -/// The rail's rectangle, in desktop cells: the sidebar column, top to bottom. /// What the rail says. -/// The client's own colours for the active theme. +/// The client's own colours for the active theme, planes included. /// /// Acts on a target from or ; safe to call from any thread. The same /// instance for the life of the app, so an overlay compares equal from frame to frame. /// internal sealed record ChromeOverlay( - bool Shown, - PaneRect Header, + HostChrome Drawn, + bool Interactive, HeaderModel HeaderModel, - PaneRect Rail, SidebarModel Sidebar, ChromePalette Palette, Action Activate) { /// Whether is one this overlay offered a click on. public bool Offers(string target) => - target == HeaderModel.PaletteTarget - || target == HeaderModel.Character?.Target - || Sidebar.Targets().Contains(target, StringComparer.Ordinal); + (Drawn.Header && (target == HeaderModel.PaletteTarget || target == HeaderModel.Character?.Target)) + || (Drawn.Rail && (target == SidebarModel.CollapseTarget || Sidebar.Targets().Contains(target, StringComparer.Ordinal))); } /// /// The chrome's own colours as #rrggbb: the brand fill of the ribbon's first segment, the world's fill (or -/// null with no world), the client's accent, the draft pen, and the unread badge. Planes are not here: a host reads -/// those off the frame's cells, so a native view sits on what the cells under it wear. +/// null with no world), the client's accent, the draft pen, the unread badge, the client's notice voice (the armed +/// ⌃B), and the three a host needs to sit its views on the client's palette with no cell to read them off — the header +/// band's plane, the backdrop the rail sits on, and the default ink. /// -internal sealed record ChromePalette(string Brand, string? WorldFill, string Accent, string Draft, string Unread); +internal sealed record ChromePalette( + string Brand, + string? WorldFill, + string Accent, + string Draft, + string Unread, + string Notice, + string HeaderPlane, + string RailPlane, + string Ink); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 7576598e..c43f894f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -838,6 +838,10 @@ public SharpMUTermApp( _header.FocusedLinkBackgroundColor = ToColor(new Rgb(brand.R, brand.G, brand.B)); _header.FocusedLinkForegroundColor = ToColor(_theme.Resolve(TerminalColor.Default, isBackground: true)); + // A host that draws the header (the window) gets no header row at all: hidden, a sticky band takes no row, + // so the workspace starts at row 0 and every count of the chrome below follows (ChromeRows). + _header.Visible = !host.Chrome.Header; + var main = NewPaneControl(MainWindowId); // The connection rail (worlds → characters → windows) sits left of the pane area, joined by @@ -950,7 +954,7 @@ public SharpMUTermApp( // *old* window's arranged rectangles — the new ones don't exist until the next frame is // laid out — so a report made here would announce a size that was already wrong. The // repaint this resize forces reports them once they are real; see ReportPaneSizes. - _header.SetContent(new List { HeaderMarkup() }); // re-align the status cluster to the new width + RefreshHeader(); // re-align the status cluster to the new width SyncInputWidth(); // keep the input band spanning the full row after a resize SyncInputBars(); // and re-derive how tall the bars may grow in the new window }; @@ -1801,7 +1805,7 @@ public string RenderSnapshot(string? view = null) if (string.Equals(view, "prefix-panel", StringComparison.OrdinalIgnoreCase)) { _prefixArmed = true; - _header.SetContent(new List { HeaderMarkup() }); + RefreshHeader(); _prefixPanel.Open(); } @@ -1915,7 +1919,7 @@ public string RenderSnapshot(string? view = null) if (_config.Worlds.ElementAtOrDefault(1) is { Characters.Count: > 0 } second) { _demoConnectedKeys.Add($"{second.Name}.{second.Characters[0].Name}"); - _header.SetContent(new List { HeaderMarkup() }); // the band counts them: 2/3 + RefreshHeader(); // the band counts them: 2/3 } _input.SetAndNotify("say back in a moment — kettle's on"); @@ -2344,7 +2348,7 @@ void Feed(string windowId, string ansiLine) // would read "utf-8 forced" and a server that never negotiated "utf-8 assumed". _demoEncoding = new SessionEncoding(Encoding.UTF8, EncodingSource.Negotiated); _statusBar.SetContent(new List { StatusBarMarkup("Corvid", "connected") }); - _header.SetContent(new List { HeaderMarkup() }); + RefreshHeader(); _input.SetAndNotify("say hello there"); RebuildPaneArea(); // realise the Chat spawn tab, then refresh badges } @@ -5647,7 +5651,8 @@ private void SyncInputHeights(bool secondShown) /// on the first frame too, and nothing has been arranged yet when the window is built. /// private int ChromeRows() => - InputLayout.WrappedRows(MarkupWidth(_header.Text), HeaderWidth()) + // No row for a header the host draws: it is not in the cells, so the bars may have the row it would take. + (_header.Visible ? InputLayout.WrappedRows(MarkupWidth(_header.Text), HeaderWidth()) : 0) + InputLayout.WrappedRows(MarkupWidth(_statusBar.Text), HeaderWidth()) // One, not WrappedRows: the prompt row is elided to a single row by construction, precisely so // that a long prompt cannot take a second row off the panes. See PromptRowRenderer. @@ -8044,6 +8049,7 @@ private void RefreshRail() var lines = RenderRailLines(); _rail.SetContent(lines); ApplyRailWidth(RailWidth(lines)); + PublishHostChrome(); // a rail the host draws has no cell to repaint (RefreshHeader's reason) } /// @@ -9351,7 +9357,7 @@ private void ToggleMenu() } _palette.Toggle(); - _header.SetContent(new List { HeaderMarkup() }); + RefreshHeader(); } /// @@ -10152,6 +10158,18 @@ private IWindowControl BuildWorkspaceRow() // Stretch (control default is Left) so the window arranges the whole row at the full console // width; without it the row floats at content width and the Flex pane column can't claim the // space to the right edge. (SharpConsoleUI docs/patterns.md — sidebar+content layouts.) + // A host that draws the rail itself (the window) gets the pane area alone: no rail column, no divider and no + // spacer, so the panes start at column 0 and are as wide as the cells really are — which is what NAWS reports. + if (Host.Chrome.Rail) + { + _railColumn = null; + return Controls.HorizontalGrid() + .WithAlignment(HorizontalAlignment.Stretch) + .WithVerticalAlignment(VerticalAlignment.Fill) + .Column(c => c.Flex(1).Add(paneArea)) + .Build(); + } + var row = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) .WithVerticalAlignment(VerticalAlignment.Fill) @@ -10596,6 +10614,18 @@ private List RenderRailLines() : RailRenderer.Render(rows, RailMaxWidth - RailMargin, _ink); } + /// + /// Folds the rail to its narrow strip, or opens it again: ⌃B b, and the native sidebar's own fold button. With the + /// rail in the cells that is a rebuild of the row it shares with the panes; with the rail the host's, the cells do + /// not change at all and only the host is told — its sidebar narrows, and the cell grid it hands the driver widens. + /// + private void ToggleRail() + { + _railCollapsed = !_railCollapsed; + RebuildPaneArea(); + PublishHostChrome(); + } + /// The narrowest the expanded sidebar goes, so a sparse rail still reads as a column. private const int RailMinWidth = 16; @@ -11047,7 +11077,7 @@ private void ArmPrefix() } _prefixArmed = true; - _header.SetContent(new List { HeaderMarkup() }); + RefreshHeader(); _prefixTimer ??= _time.CreateTimer( _ => OnUiThread(ShowPrefixPanel), null, Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); _prefixTimer.Change(PrefixPanelDelay, Timeout.InfiniteTimeSpan); @@ -11068,7 +11098,7 @@ private void DisarmPrefix() _prefixArmed = false; _prefixTimer?.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); _prefixPanel.Close(); - _header.SetContent(new List { HeaderMarkup() }); + RefreshHeader(); } /// @@ -11799,8 +11829,7 @@ private void RunPrefixCommand(char key) break; case 'b': - _railCollapsed = !_railCollapsed; - RebuildPaneArea(); + ToggleRail(); break; case '<': @@ -13296,7 +13325,7 @@ private void UpdateStatus() var character = session.Character?.Name ?? session.World.Name; _statusIdentity = (character, session.World.Host, session.World.Port, session.State.ToString().ToLowerInvariant()); RefreshStatusBar(); - _header.SetContent(new List { HeaderMarkup() }); + RefreshHeader(); RefreshRail(); } @@ -13306,7 +13335,14 @@ private void UpdateStatus() /// connected fraction reading the old denominator until the next connect or disconnect happened to /// repaint it. /// - private void RefreshHeader() => _header.SetContent(new List { HeaderMarkup() }); + private void RefreshHeader() + { + _header.SetContent(new List { HeaderMarkup() }); + + // A host that draws the header itself has no cell of it to repaint, so a change that moves no cell (⌃B + // armed, a world connecting) might paint no frame and the host would not hear of it on PostBufferPaint. + PublishHostChrome(); + } /// /// The design header row: the brand affordance on the left, the active world (with its accent) @@ -13353,7 +13389,14 @@ internal HeaderModel BuildHeaderModel() ConfiguredConnections(), _config.Worlds.Count > 0, HeaderLogFormat(), - _prefixArmed); + _prefixArmed) + { + Prefix = _prefixArmed + ? new HeaderPrefix( + [.. PrefixPanel.Entries(PrefixFactsNow()).Select(e => new HeaderPrefixKey(e.Keys, e.Title, e.Blocked))], + "Esc cancels") + : null, + }; } /// The header row's markup, drawn from and nothing else it could disagree with. diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs index 36281a5c..5fbaa577 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -52,7 +52,7 @@ public async Task TheClientPublishesTheVitalsPaneWithTheModelItsCellStripIsDrawn public async Task PublishingPanelsMovesNoPaneRectangle() { using var headless = new HeadlessConsoleDriver(140, 36); - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities)); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.HeaderAndRail }); terminal.RenderSnapshot("layout-combat"); using var driver = new AvaloniaConsoleDriver(140, 36); @@ -337,7 +337,7 @@ internal static Task Run( { var driver = new AvaloniaConsoleDriver(columns, rows); var view = new TerminalView(driver, SKColors.White, Back, 16, null); - var layer = new DesktopLayer(view); + var layer = new DesktopLayer(view, HostChrome.None); var root = new Panel(); root.Children.Add(view); root.Children.Add(layer); diff --git a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs index d8639ebb..46f1edb9 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs @@ -24,29 +24,43 @@ public partial class HostParityTests public static IEnumerable Views() => SnapshotViews.All.Select(v => v ?? "(default)"); + /// + /// Every view under both chrome arrangements: the client's chrome in cells (the terminal's, and the window's with + /// --cell-chrome), and the header and rail drawn by the host (the window as a person runs it). Both hosts + /// are told the same arrangement each time, so the comparison is still of drivers and nothing else, over every + /// cell either one draws. + /// + public static IEnumerable<(string View, bool HostChrome)> ViewsUnderBothChromes() => + from view in Views() + from native in new[] { false, true } + select (view, native); + + private static HostChrome ChromeFor(bool native) => native ? HostChrome.HeaderAndRail : HostChrome.None; + /// /// A view drawn in the window is the view drawn in the terminal, cell for cell. What this catches is the /// driver falling behind the framework — a cell it does not store, a write path it does not implement — /// for any view, including the next one added (EveryViewTheSnapshotKnowsIsInTheParityList). /// [Test] - [MethodDataSource(nameof(Views))] - public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string name) + [MethodDataSource(nameof(ViewsUnderBothChromes))] + public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string name, bool hostChrome) { var view = name == "(default)" ? null : name; + var chrome = ChromeFor(hostChrome); Console.SetIn(TextReader.Null); string ansi; using (var headless = new HeadlessConsoleDriver(Width, Height)) { - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, Caps)); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, Caps) with { Chrome = chrome }); ansi = terminal.RenderSnapshot(view); } using var driver = new AvaloniaConsoleDriver(Width, Height); await using (var window = new SharpMUTermApp( DemoScene.Build(), - WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, RunsInline = true })) + WindowHost.Create(driver, clipboard: null, chrome) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, RunsInline = true })) { window.RenderSnapshot(view); } @@ -60,12 +74,14 @@ public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string na /// above draws every view inline, with no loop, and that is how a ⌃P menu and an F1 composer that the window /// drew as empty frames went unnoticed: inline they were whole. The bottom row is left out — a running client /// has been through startup, and says on that row that nothing connects at start, where a snapshot never - /// started — and so are the views that read the clock, which a loop does and a snapshot pins. + /// started — and so are the views that read the clock, which a loop does and a snapshot pins. Drawn with the + /// window's own chrome, because that is how a person runs it; the terminal is told the same. /// [Test] [MethodDataSource(nameof(Views))] public async Task EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning(string name) { + var chrome = HostChrome.HeaderAndRail; var view = name == "(default)" ? null : name; if (view is "timestamps" or "timestamps-toggled") { @@ -76,14 +92,14 @@ public async Task EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning(string n string ansi; using (var headless = new HeadlessConsoleDriver(Width, Height)) { - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, Caps)); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, Caps) with { Chrome = chrome }); ansi = terminal.RenderSnapshot(view); } using var driver = new AvaloniaConsoleDriver(Width, Height); await using var window = new SharpMUTermApp( DemoScene.Build(), - WindowHost.Create(driver, clipboard: null) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null }); + WindowHost.Create(driver, clipboard: null, chrome) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null }); window.OnUiThread(() => _ = window.RenderSnapshot(view)); var loop = new Thread(() => window.Run([])) { IsBackground = true }; loop.Start(); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs index cd5eaedd..499bde6d 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs @@ -15,10 +15,11 @@ namespace SharpMUTerm.Avalonia.Tests; /// -/// The window's native header and sidebar (, ): drawn exactly -/// over the cells the client says hold the header and the rail, from the models those cells are drawn from; a click -/// is handed back as the model's own target and never reaches the client as a press on a cell; empty header space -/// still moves the window; and no pane moves. +/// The window's native header and sidebar (, ): drawn beside the +/// cells at a desktop app's size, with no cell under either — the view is moved out of their way, so the grid the +/// driver holds is what is left of the window; a click is handed back as the model's own target and never reaches the +/// client as a press on a cell; a press on the cells still lands on the cell under the pointer; empty header space +/// still moves the window; and no pane is laid out differently from a terminal told the same chrome. /// public class NativeChromeTests { @@ -26,6 +27,8 @@ public class NativeChromeTests private static readonly TerminalColor Teal = TerminalColor.FromRgb(0x00, 0xf5, 0xb7); + private const int Columns = 100, Rows = 30; + private static SidebarModel Sidebar(bool collapsed = false) => new( [ new RailWorld("Aetherfall", "aether.example", 4000, Teal, @@ -45,55 +48,93 @@ public class NativeChromeTests false, new HeaderWorld("Aetherfall", Teal), new HeaderCharacter("Corvid", "Aetherfall.Corvid", CharacterPresence.Online, "aether.example", 4000, true, CommandIds.Character("Aetherfall.Corvid")), - 1, 2, true, LogFormat.None, prefix); + 1, 2, true, LogFormat.None, prefix) + { + Prefix = prefix + ? new HeaderPrefix([new HeaderPrefixKey("|", "split this pane side by side", null), new HeaderPrefixKey("z", "zoom", "needs a second pane")], "Esc cancels") + : null, + }; - private static ChromeOverlay Overlay(Action activate, bool shown = true, bool collapsed = false, bool prefix = false) => new( - shown, - new PaneRect(0, 0, 100, 1), + private static ChromeOverlay Overlay(Action activate, bool interactive = true, bool collapsed = false, bool prefix = false) => new( + HostChrome.HeaderAndRail, + interactive, Header(prefix), - new PaneRect(0, 1, 22, 28), Sidebar(collapsed), - new ChromePalette("#9d7cff", "#00f5b7", "#00f5b7", "#ffd700", "#00f5b7"), + new ChromePalette("#9d7cff", "#00f5b7", "#00f5b7", "#ffd700", "#00f5b7", "#ffaf00", "#202028", "#18181d", "#e0e0e0"), activate); [Test] - public async Task TheHeaderAndTheSidebarCoverExactlyTheCellsTheClientNamed() + public async Task TheHeaderAndTheSidebarSitBesideTheCellsAndNoCellIsUnderThem() { - var (header, sidebar, cell) = await Run((window, view, layer, driver) => + var (header, sidebar, view, grid, cell, windowSize) = await Run((window, view, layer, driver) => { ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { })); Drain(); window.UpdateLayout(); - return (Bounds(layer.Header, window), Bounds(layer.Sidebar, window), view.CellExtent); + Drain(); + return (Bounds(layer.Header, window), Bounds(layer.Sidebar, window), Bounds(view, window), + (driver.ScreenSize.Width, driver.ScreenSize.Height), view.CellExtent, window.ClientSize); }); - await Assert.That(header).IsEqualTo(new Rect(0, 0, 100 * cell.Width, cell.Height)); - await Assert.That(sidebar).IsEqualTo(new Rect(0, cell.Height, 22 * cell.Width, 28 * cell.Height)); + await Assert.That(header).IsEqualTo(new Rect(0, 0, windowSize.Width, NativeLayout.HeaderHeight)); + await Assert.That(sidebar).IsEqualTo(new Rect(0, NativeLayout.HeaderHeight, NativeLayout.SidebarWidth + NativeLayout.SidebarGutter, windowSize.Height - NativeLayout.HeaderHeight)); + await Assert.That(view.Position).IsEqualTo(new Point(NativeLayout.SidebarWidth + NativeLayout.SidebarGutter, NativeLayout.HeaderHeight)); + await Assert.That(header.Height).IsGreaterThan(cell.Height * 1.5).Because("a desktop header, not a squeezed cell row"); + + // The grid is the view's, and the view is what the chrome leaves: the client's cells start past both. + await Assert.That(grid).IsEqualTo(((int)(view.Width / cell.Width), (int)(view.Height / cell.Height))); + await Assert.That(grid.Width).IsEqualTo(Columns).Because("the window was sized to hold the requested grid beside its chrome"); + await Assert.That(grid.Height).IsEqualTo(Rows); } [Test] - public async Task NothingNativeIsDrawnUnderAnotherWindowOverACollapsedRailOrOverTheArmedPrefix() + public async Task AFoldedRailIsASlimStripAndTheGridWidensIntoTheRoomItGaveBack() { - var states = await Run((window, view, layer, driver) => + var (open, folded, openColumns, foldedColumns, rows) = await Run((window, view, layer, driver) => { - var seen = new List<(bool Header, bool Sidebar)>(); - foreach (var overlay in new[] - { - Overlay(_ => { }), Overlay(_ => { }, shown: false), Overlay(_ => { }, collapsed: true), Overlay(_ => { }, prefix: true), - }) - { - ((IPointerPresenter)driver.Pointer).Chrome(overlay); - Drain(); - seen.Add((layer.Header.IsVisible, layer.Sidebar.IsVisible)); - } + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { })); + Drain(); + window.UpdateLayout(); + Drain(); + var open = layer.Sidebar.Bounds.Width; + var openColumns = driver.ScreenSize.Width; + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { }, collapsed: true)); + Drain(); + window.UpdateLayout(); + Drain(); + return (open, layer.Sidebar.Bounds.Width, openColumns, driver.ScreenSize.Width, layer.Sidebar.Rows.Select(r => r.Kind).ToArray()); + }); + + await Assert.That(open).IsEqualTo(NativeLayout.SidebarWidth + NativeLayout.SidebarGutter); + await Assert.That(folded).IsEqualTo(NativeLayout.SidebarSlim + NativeLayout.SidebarGutter); + await Assert.That(foldedColumns).IsGreaterThan(openColumns); + await Assert.That(rows).IsEquivalentTo(new[] { RailRowKind.World, RailRowKind.Character, RailRowKind.Character }) + .Because("folded, a world is its mark and each character its disc; windows are the open sidebar's"); + } - return seen; + [Test] + public async Task UnderAModalTheChromeStaysAndTakesNoClickAndTheArmedPrefixIsInTheHeader() + { + var (visible, activated, prefixKeys) = await Run((window, view, layer, driver) => + { + var activated = new List(); + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(activated.Add, interactive: false)); + Drain(); + window.UpdateLayout(); + Drain(); + var visible = (layer.Header.IsVisible, layer.Sidebar.IsVisible, layer.Header.Inert); + Click(window, layer.Sidebar, layer.Sidebar.Rows.Single(r => r.Character?.Name == "Wren").Area); + + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(activated.Add, prefix: true)); + Drain(); + window.UpdateLayout(); + Drain(); + return (visible, activated, layer.Header.PrefixKeys.Select(k => (k.Key.Keys, k.Key.Available)).ToArray()); }); - await Assert.That(states[0]).IsEqualTo((true, true)); - await Assert.That(states[1]).IsEqualTo((false, false)); - await Assert.That(states[2]).IsEqualTo((true, false)); - await Assert.That(states[3]).IsEqualTo((false, true)); + await Assert.That(visible).IsEqualTo((true, true, true)); + await Assert.That(activated).IsEmpty().Because("a modal owns the screen; the chrome beside it is inert"); + await Assert.That(prefixKeys).IsEquivalentTo(new[] { ("|", true), ("z", false) }); } [Test] @@ -105,72 +146,104 @@ public async Task AClickOnTheSidebarOrTheHeaderHandsBackTheModelsTargetAndNeverR ((IPointerPresenter)driver.Pointer).Chrome(Overlay(activated.Add)); Drain(); window.UpdateLayout(); + Drain(); var clientSaw = new List>(); driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); - void Click(Control on, Rect area) - { - var centre = on.TranslatePoint(area.Center, window)!.Value; - window.MouseMove(centre); - window.MouseDown(centre, MouseButton.Left); - window.MouseUp(centre, MouseButton.Left); - Drain(); - } - var chat = layer.Sidebar.Rows.Single(r => r.Window?.Id == "spawn:2"); - Click(layer.Sidebar, chat.Area); + Click(window, layer.Sidebar, chat.Area); var wren = layer.Sidebar.Rows.Single(r => r.Character?.Name == "Wren"); - Click(layer.Sidebar, wren.Area); - Click(layer.Sidebar, layer.Sidebar.Hits.Single(h => h.Target == SidebarModel.AddGameTarget).Area); - Click(layer.Header, layer.Header.Hits.Last(h => h.Target == HeaderModel.PaletteTarget).Area); - Click(layer.Header, layer.Header.Hits.Single(h => h.Target.StartsWith(CommandIds.CharacterPrefix, StringComparison.Ordinal)).Area); - window.MouseWheel(window.Bounds.Center.WithX(10), new Vector(0, 1)); + Click(window, layer.Sidebar, wren.Area); + Click(window, layer.Sidebar, layer.Sidebar.Hits.Single(h => h.Target == SidebarModel.AddGameTarget).Area); + Click(window, layer.Sidebar, layer.Sidebar.Hits.Single(h => h.Target == SidebarModel.CollapseTarget).Area); + Click(window, layer.Header, layer.Header.Hits.Last(h => h.Target == HeaderModel.PaletteTarget).Area); + Click(window, layer.Header, layer.Header.Hits.Single(h => h.Target.StartsWith(CommandIds.CharacterPrefix, StringComparison.Ordinal)).Area); + window.MouseWheel(new Point(40, window.ClientSize.Height / 2), new Vector(0, 1)); Drain(); return (activated, clientSaw, layer.Sidebar.Rows.Select(r => r.Kind).ToArray(), view.IsFocused); - }, columns: 100, rows: 30); + }); await Assert.That(activated).IsEquivalentTo(new[] { CommandIds.Window("spawn:2"), CommandIds.Character("Aetherfall.Wren"), SidebarModel.AddGameTarget, - HeaderModel.PaletteTarget, CommandIds.Character("Aetherfall.Corvid"), + SidebarModel.CollapseTarget, HeaderModel.PaletteTarget, CommandIds.Character("Aetherfall.Corvid"), }); await Assert.That(clientSaw.Count).IsEqualTo(0).Because("every press, release and wheel over native chrome is the window's"); await Assert.That(focused).IsTrue().Because("the keyboard stays with the client"); await Assert.That(rows).IsEquivalentTo(new[] { RailRowKind.World, RailRowKind.Character, RailRowKind.Window, RailRowKind.Window, RailRowKind.Character }); } + [Test] + public async Task APressOnTheCellsLandsOnTheCellUnderThePointerPastTheChrome() + { + var landed = await Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { })); + Drain(); + window.UpdateLayout(); + Drain(); + var cells = new List(); + driver.MouseEvent += (_, _, point) => cells.Add(point); + + // The middle of cell (5, 3), in window coordinates: past the sidebar and under the header. + var cell = view.CellExtent; + var at = view.TranslatePoint(new Point((5.5 * cell.Width), (3.5 * cell.Height)), window)!.Value; + window.MouseDown(at, MouseButton.Left); + window.MouseUp(at, MouseButton.Left); + Drain(); + return cells; + }); + + await Assert.That(landed.Count).IsGreaterThan(0); + await Assert.That(landed.Distinct()).IsEquivalentTo(new[] { new System.Drawing.Point(5, 3) }); + } + [Test] public async Task APressOnEmptyHeaderSpaceMovesTheWindowAndNeverReachesTheClient() { - var (gestures, clientSaw, activated) = await Run((window, view, layer, driver) => + var (gestures, clientSaw, activated, cellRowMoves) = await Run((window, view, layer, driver) => { var activated = new List(); ((IPointerPresenter)driver.Pointer).Chrome(Overlay(activated.Add)); Drain(); window.UpdateLayout(); + Drain(); var clientSaw = new List>(); driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); // Between the brand and the search box: a gap the header leaves on purpose. var brand = layer.Header.Hits[0].Area; - var gap = layer.Header.TranslatePoint(new Point(brand.Right + 8, layer.Header.Bounds.Height / 2), window)!.Value; + var gap = layer.Header.TranslatePoint(new Point(brand.Right + 10, layer.Header.Bounds.Height / 2), window)!.Value; window.MouseDown(gap, MouseButton.Left); window.MouseUp(gap, MouseButton.Left); Drain(); - return (view.WindowGestures, clientSaw, activated); - }, columns: 100, rows: 30); + var gestures = view.WindowGestures; + var fromHeader = clientSaw.Count; + + // The cells' first row is a pane's tab strip here, never a handle: a blank cell there is the client's. + var blank = view.TranslatePoint(new Point(view.Bounds.Width - 40, view.CellExtent.Height / 2), window)!.Value; + window.MouseDown(blank, MouseButton.Left); + window.MouseUp(blank, MouseButton.Left); + Drain(); + return (gestures, (fromHeader, clientSaw.Count), activated, view.WindowGestures - gestures); + }); await Assert.That(gestures).IsEqualTo(1); - await Assert.That(clientSaw.Count).IsEqualTo(0); + await Assert.That(clientSaw.Item1).IsEqualTo(0).Because("a press on the header is the window's"); + await Assert.That(clientSaw.Item2).IsGreaterThan(0).Because("a press on the cells' first row is the client's"); await Assert.That(activated.Count).IsEqualTo(0); + await Assert.That(cellRowMoves).IsEqualTo(0); } [Test] - public async Task TheLiveClientPublishesItsOwnRectanglesAndNoPaneMovesAgainstTheTerminal() + [Arguments("connections")] + [Arguments("layout-roleplay")] + [Arguments("layout-combat")] + public async Task TheLiveClientDrawsNoChromeCellAndLaysThePanesOutAsATerminalToldTheSame(string view) { using var headless = new HeadlessConsoleDriver(120, 32); - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities)); - terminal.RenderSnapshot("connections"); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.HeaderAndRail }); + terminal.RenderSnapshot(view); using var driver = new AvaloniaConsoleDriver(120, 32); await using var window = new SharpMUTermApp(DemoScene.Build(), WindowHost.Create(driver, clipboard: null) with @@ -181,16 +254,28 @@ public async Task TheLiveClientPublishesItsOwnRectanglesAndNoPaneMovesAgainstThe Announcer = null, RunsInline = true, }); - window.RenderSnapshot("connections"); + window.RenderSnapshot(view); window.RenderNextFrame(); var chrome = driver.Pointer.Chrome; await Assert.That(chrome).IsNotNull(); - await Assert.That(chrome!.Header).IsEqualTo(new PaneRect(0, 0, 120, 1)); - await Assert.That(chrome.Rail.Width).IsEqualTo(window.RailColumnWidth); + await Assert.That(chrome!.Drawn).IsEqualTo(HostChrome.HeaderAndRail); await Assert.That(chrome.Sidebar).IsEqualTo(window.BuildSidebar()); - await Assert.That(window.PaneOutputRects().OrderBy(r => r.Key).ToArray()) - .IsEquivalentTo(terminal.PaneOutputRects().OrderBy(r => r.Key).ToArray()); + await Assert.That(window.LaidOutRows.Header).IsEqualTo(0); + await Assert.That(Enumerable.Range(0, 32).Any(y => driver.Frame.RowText(y).Contains("muterm", StringComparison.Ordinal))).IsFalse() + .Because("the cell header is not drawn when the window draws its own"); + var rects = window.PaneOutputRects(); + await Assert.That(rects.Values.Min(r => r.X)).IsEqualTo(0).Because("no rail column comes before the panes"); + await Assert.That(rects.OrderBy(r => r.Key).ToArray()).IsEquivalentTo(terminal.PaneOutputRects().OrderBy(r => r.Key).ToArray()); + } + + private static void Click(Window window, Control on, Rect area) + { + var centre = on.TranslatePoint(area.Center, window)!.Value; + window.MouseMove(centre); + window.MouseDown(centre, MouseButton.Left); + window.MouseUp(centre, MouseButton.Left); + Drain(); } private static Rect Bounds(Control control, Window window) => @@ -198,20 +283,19 @@ private static Rect Bounds(Control control, Window window) => private static void Drain() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); - private static Task Run( - Func body, int columns = 100, int rows = 30) => + private static Task Run(Func body) => Session.Dispatch(() => { - var driver = new AvaloniaConsoleDriver(columns, rows); + var driver = new AvaloniaConsoleDriver(Columns, Rows); var view = new TerminalView(driver, SKColors.White, Back, 16, null); - var layer = new DesktopLayer(view); + var layer = new DesktopLayer(view, HostChrome.HeaderAndRail); var root = new Panel(); root.Children.Add(view); root.Children.Add(layer); var window = new Window { Content = root, WindowDecorations = WindowDecorations.BorderOnly }; - var size = view.SizeFor(columns, rows); - window.Width = size.Width; - window.Height = size.Height; + var cells = view.SizeFor(Columns, Rows); + window.Width = cells.Width + NativeLayout.SidebarWidth + NativeLayout.SidebarGutter; + window.Height = cells.Height + NativeLayout.HeaderHeight; window.Show(); view.Focus(); driver.Flush(); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs index bc0830b4..d7278ce3 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs @@ -95,7 +95,7 @@ public async Task NativeListsMoveNoPaneRectangle() foreach (var view in new[] { "layout-roleplay", "layout-combat" }) { using var headless = new HeadlessConsoleDriver(140, 36); - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities)); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.HeaderAndRail }); terminal.RenderSnapshot(view); using var driver = new AvaloniaConsoleDriver(140, 36); diff --git a/tests/SharpMUTerm.Tui.Tests/HostChromeLayoutTests.cs b/tests/SharpMUTerm.Tui.Tests/HostChromeLayoutTests.cs new file mode 100644 index 00000000..4ff70b81 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/HostChromeLayoutTests.cs @@ -0,0 +1,248 @@ +using System.Drawing; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A host that draws the header or the rail itself () gets no cell for it: no header +/// row, no rail column, and every count the client makes of its own rows and columns — the layout, the input-height +/// veto, the pane rectangles and so what each world is told over NAWS — is made over the cells that are left. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class HostChromeLayoutTests +{ + private const int Width = 120; + private const int Height = 32; + + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class ChromePresenter : IPointerPresenter + { + public List Published { get; } = []; + + public void Hover(PointerTarget target) + { + } + + public void ShowMenu(Point cell, IReadOnlyList items) + { + } + + public bool DrawsMenus => true; + + public void Scrollbars(IReadOnlyList bars) + { + } + + public void Chrome(ChromeOverlay chrome) => Published.Add(chrome); + } + + private static SharpMUTermApp App(HostChrome chrome, out string frame, string? view = null, int width = Width, int height = Height, IPointerPresenter? pointer = null) + { + Console.SetIn(TextReader.Null); + var host = ClientHost.Headless(new HeadlessConsoleDriver(width, height), Caps) with { Chrome = chrome, Pointer = pointer }; + var app = new SharpMUTermApp(DemoScene.Build(), host); + frame = app.RenderSnapshot(view); + app.RenderNextFrame(); + return app; + } + + private static async Task<(WorldSession Session, RecordingTelnetSession Telnet)> ConnectedAsync(string name) + { + var telnet = new RecordingTelnetSession(); + var session = new WorldSession(new WorldDefinition { Name = name, Host = "h", Port = 1 }, sessionFactory: _ => telnet); + await session.ConnectAsync(); + return (session, telnet); + } + + [Test] + public async Task EveryHostTheRepositoryBuildsSaysWhichChromeItDraws() + { + await Assert.That(ClientHost.Headless(new HeadlessConsoleDriver(40, 10), Caps).Chrome).IsEqualTo(HostChrome.None); + await Assert.That(ClientHost.Snapshot(40, 10, Caps).Chrome).IsEqualTo(HostChrome.None); + await Assert.That(ClientHost.ForHarness(Caps, new HeadlessConsoleDriver(40, 10), null, null, null).Chrome).IsEqualTo(HostChrome.None); + await Assert.That(HostChrome.None.Any).IsFalse(); + await Assert.That(HostChrome.HeaderAndRail.Any).IsTrue(); + } + + [Test] + public async Task AHostThatDrawsTheHeaderGetsNoHeaderRowAndTheWorkspaceTakesIt() + { + await using var cells = App(HostChrome.None, out var cellFrame); + await using var native = App(HostChrome.HeaderAndRail with { Rail = false }, out var nativeFrame); + + await Assert.That(cells.LaidOutRows.Header).IsEqualTo(1); + await Assert.That(native.LaidOutRows.Header).IsEqualTo(0); + await Assert.That(native.LaidOutRows.Workspace).IsEqualTo(cells.LaidOutRows.Workspace + 1); + + // The ribbon's brand is on the terminal's first row and on no row of the window's cells. + await Assert.That(FrameGrid.Decode(cellFrame, Width, Height)[0]).Contains("muterm"); + await Assert.That(FrameGrid.Decode(nativeFrame, Width, Height).Any(row => row.Contains("muterm", StringComparison.Ordinal))).IsFalse(); + + // The bands still fill the grid exactly: nothing promised to a header that is not there. + var rows = native.LaidOutRows; + await Assert.That(rows.Header + rows.Workspace + rows.Primary + rows.Second + rows.Status).IsEqualTo(Height); + } + + [Test] + public async Task AHostThatDrawsTheRailGetsNoRailColumnAndThePanesStartAtTheEdge() + { + await using var cells = App(HostChrome.None, out _); + await using var native = App(HostChrome.HeaderAndRail with { Header = false }, out var nativeFrame); + + var cellPane = cells.PaneOutputRects().Values.Single(); + var nativePane = native.PaneOutputRects().Values.Single(); + await Assert.That(cellPane.X).IsGreaterThan(0).Because("the terminal's rail, divider and spacer come first"); + await Assert.That(nativePane.X).IsEqualTo(0); + await Assert.That(nativePane.Width).IsEqualTo(Width); + await Assert.That(nativePane.Width).IsEqualTo(cellPane.Width + cellPane.X); + await Assert.That(nativePane.Height).IsEqualTo(cellPane.Height); + + // No rail row in the cells: the world's heading the terminal's rail opens with is nowhere in the first columns. + var world = DemoScene.Build().Worlds[0].Name; + await Assert.That(FrameGrid.Decode(nativeFrame, Width, Height).Skip(1).Any(row => row.TrimStart().StartsWith(world, StringComparison.Ordinal))) + .IsFalse(); + } + + [Test] + [Arguments(null)] + [Arguments("split")] + [Arguments("layout-combat")] + [Arguments("layout-roleplay")] + public async Task ThePanesTileTheWholeGridWhenTheHostDrawsBoth(string? view) + { + await using var app = App(HostChrome.HeaderAndRail, out _, view); + var rects = app.PaneSnapshot().Rects.Values.ToList(); + await Assert.That(rects.Min(r => r.X)).IsEqualTo(0); + await Assert.That(rects.Min(r => r.Y)).IsEqualTo(0); + await Assert.That(rects.Max(r => r.X + r.Width)).IsEqualTo(Width); + await Assert.That(app.LaidOutRows.Header).IsEqualTo(0); + } + + [Test] + public async Task EachWorldIsToldItsPanesRealSizeWhenTheHostDrawsTheChrome() + { + await using var app = App(HostChrome.HeaderAndRail, out _, "split"); + var left = await ConnectedAsync("Left"); + var right = await ConnectedAsync("Right"); + app.AttachSession(left.Session, "main"); + app.AttachSession(right.Session, DemoScene.ChatWindowId); + app.RenderNextFrame(); + + var surface = app.PaneSnapshot(); + PaneRect Output(string windowId) => app.PaneOutputRects()[surface.Rects.Keys.Single(id => surface.ActiveWindow(id) == windowId)]; + var l = Output("main"); + var r = Output(DemoScene.ChatWindowId); + + await Assert.That(left.Telnet.Sizes[^1]).IsEqualTo((l.Width, l.Height)); + await Assert.That(right.Telnet.Sizes[^1]).IsEqualTo((r.Width, r.Height)); + + // The two panes and the divider between them are the whole width: no rail column was taken off either. + await Assert.That(l.X).IsEqualTo(0); + await Assert.That(l.Width + r.Width + 1).IsEqualTo(Width); + } + + [Test] + [Arguments(6)] + [Arguments(8)] + [Arguments(12)] + public async Task TheInputVetoCountsNoHeaderRowAndTheBandsFitASmallGrid(int height) + { + await using var app = App(HostChrome.HeaderAndRail, out _, height: height, width: 80); + var rows = app.LaidOutRows; + await Assert.That(rows.Header).IsEqualTo(0); + await Assert.That(rows.Header + rows.Workspace + rows.Primary + rows.Second + rows.Status).IsEqualTo(height); + await Assert.That(rows.Status).IsGreaterThan(0).Because("the status line is never arranged off the grid"); + } + + // ── What the host is told ───────────────────────────────────────────────────────────────────── + + [Test] + public async Task OnlyAHostThatDrawsChromeIsToldAboutIt() + { + var cells = new ChromePresenter(); + await using (App(HostChrome.None, out _, pointer: cells)) + { + await Assert.That(cells.Published).IsEmpty(); + } + + var native = new ChromePresenter(); + await using var app = App(HostChrome.HeaderAndRail, out _, "characters", pointer: native); + var chrome = native.Published.Last(); + await Assert.That(chrome.Drawn).IsEqualTo(HostChrome.HeaderAndRail); + await Assert.That(chrome.Interactive).IsTrue(); + await Assert.That(chrome.Sidebar).IsEqualTo(app.BuildSidebar()); + await Assert.That(chrome.HeaderModel).IsEqualTo(app.BuildHeaderModel()); + await Assert.That(chrome.Palette.HeaderPlane).StartsWith("#"); + await Assert.That(chrome.Palette.RailPlane).StartsWith("#"); + } + + [Test] + public async Task TheChromeStaysUnderAModalAndTakesNoClick() + { + var pointer = new ChromePresenter(); + + // The connections scene leaves the quit prompt open over the main window. + await using var app = App(HostChrome.HeaderAndRail, out _, "connections", pointer: pointer); + var chrome = pointer.Published.Last(); + await Assert.That(chrome.Interactive).IsFalse(); + + var before = app.ActiveWindowId(); + var other = chrome.Sidebar.Worlds.SelectMany(w => w.Characters).SelectMany(c => c.Windows).First(w => w.Id != before); + await Assert.That(app.ActivateChromeTarget(SidebarModel.TargetOf(other))).IsFalse(); + await Assert.That(app.ActiveWindowId()).IsEqualTo(before); + } + + [Test] + public async Task TheArmedPrefixIsInTheHeaderModelWithEveryKeyThePanelLists() + { + var pointer = new ChromePresenter(); + await using var app = App(HostChrome.HeaderAndRail, out _, "prefix", pointer: pointer); + var prefix = app.BuildHeaderModel().Prefix; + await Assert.That(prefix).IsNotNull(); + await Assert.That(prefix!.Keys.Select(k => k.Keys)).IsEquivalentTo(PrefixPanel.Entries(app.PrefixFactsSnapshot).Select(e => e.Keys)); + await Assert.That(prefix.Exit).Contains("Esc"); + await Assert.That(pointer.Published.Last().HeaderModel.Prefix).IsEqualTo(prefix); + + await using var idle = App(HostChrome.HeaderAndRail, out _); + await Assert.That(idle.BuildHeaderModel().Prefix).IsNull(); + } + + [Test] + public async Task TheSidebarsFoldButtonFoldsTheRailAndSaysSo() + { + var pointer = new ChromePresenter(); + await using var app = App(HostChrome.HeaderAndRail, out _, pointer: pointer); + var panes = app.PaneOutputRects(); + await Assert.That(pointer.Published.Last().Offers(SidebarModel.CollapseTarget)).IsTrue(); + + await Assert.That(app.ActivateChromeTarget(SidebarModel.CollapseTarget)).IsTrue(); + app.RenderNextFrame(); + await Assert.That(pointer.Published.Last().Sidebar.Collapsed).IsTrue(); + await Assert.That(app.PaneOutputRects()).IsEquivalentTo(panes).Because("the cells hold no rail to fold; only the host's sidebar narrows"); + + await Assert.That(app.ActivateChromeTarget(SidebarModel.CollapseTarget)).IsTrue(); + app.RenderNextFrame(); + await Assert.That(pointer.Published.Last().Sidebar.Collapsed).IsFalse(); + } + + [Test] + public async Task AHostDrawingOnlyTheHeaderIsOfferedNoRailTarget() + { + var pointer = new ChromePresenter(); + await using var app = App(HostChrome.HeaderAndRail with { Rail = false }, out _, "characters", pointer: pointer); + var chrome = pointer.Published.Last(); + var window = chrome.Sidebar.Worlds.SelectMany(w => w.Characters).SelectMany(c => c.Windows).First(); + await Assert.That(chrome.Offers(SidebarModel.TargetOf(window))).IsFalse(); + await Assert.That(chrome.Offers(SidebarModel.CollapseTarget)).IsFalse(); + await Assert.That(chrome.Offers(HeaderModel.PaletteTarget)).IsTrue(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/NativeChromeModelTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeChromeModelTests.cs index abce896f..f5457d3e 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeChromeModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeChromeModelTests.cs @@ -11,7 +11,7 @@ namespace SharpMUTerm.Tui.Tests; /// /// The header and the rail as data (, ): the cell chrome is drawn from -/// the same models a host is handed, the host is told where the header and the rail are, and a click it hands back +/// the same models a host is handed, the host that draws them is told what they say, and a click it hands back /// goes where the same click on the cells goes — and nowhere the client did not offer. /// /// Serialised: rendering a frame redirects the process-global Console.Out. @@ -46,7 +46,7 @@ private static (SharpMUTermApp App, ChromePresenter Pointer) App(string? view = { Console.SetIn(TextReader.Null); var pointer = new ChromePresenter(); - var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, _ => { }) with { Pointer = pointer }; + var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, _ => { }) with { Pointer = pointer, Chrome = HostChrome.HeaderAndRail }; var app = new SharpMUTermApp(DemoScene.Build(), host); app.RenderSnapshot(view); app.RenderNextFrame(); @@ -86,17 +86,13 @@ public async Task TheCellRailCarriesExactlyTheSidebarModelsTargets() } [Test] - public async Task TheHostIsToldWhereTheHeaderAndTheRailAre() + public async Task TheHostIsToldWhatTheHeaderAndTheRailSay() { var (app, pointer) = App("characters"); await using var _app = app; var chrome = pointer.Published.Last(); - await Assert.That(chrome.Shown).IsTrue(); - await Assert.That(chrome.Header).IsEqualTo(new PaneRect(0, 0, 120, 1)); - await Assert.That(chrome.Rail.X).IsEqualTo(0); - await Assert.That(chrome.Rail.Y).IsEqualTo(1); - await Assert.That(chrome.Rail.Width).IsEqualTo(app.RailColumnWidth); - await Assert.That(chrome.Rail.Height).IsGreaterThan(10); + await Assert.That(chrome.Interactive).IsTrue(); + await Assert.That(chrome.Drawn).IsEqualTo(HostChrome.HeaderAndRail); await Assert.That(chrome.Sidebar).IsEqualTo(app.BuildSidebar()); await Assert.That(chrome.HeaderModel).IsEqualTo(app.BuildHeaderModel()); @@ -107,7 +103,7 @@ public async Task TheHostIsToldWhereTheHeaderAndTheRailAre() } [Test] - public async Task TheSearchBoxOpensTheCommandSurfaceAndTheChromeStandsDownUnderIt() + public async Task TheSearchBoxOpensTheCommandSurfaceAndTheChromeGoesInertUnderIt() { var (app, pointer) = App(); await using var _app = app; @@ -120,7 +116,7 @@ public async Task TheSearchBoxOpensTheCommandSurfaceAndTheChromeStandsDownUnderI await Assert.That(app.MenuIsOpen).IsTrue(); app.RenderNextFrame(); - await Assert.That(pointer.Published.Last().Shown).IsFalse().Because("the command surface is drawn over the cells the chrome would cover"); + await Assert.That(pointer.Published.Last().Interactive).IsFalse().Because("the command surface owns the screen while it is up"); } [Test] @@ -149,12 +145,12 @@ public async Task TheHeadersPresenceDotAndTheRailsDotAreOneAnswer(string? view) } [Test] - public async Task TheChromeStandsDownUnderTheQuitPrompt() + public async Task TheChromeGoesInertUnderTheQuitPrompt() { // The connections scene leaves the quit prompt open over the main window. var (app, pointer) = App("connections"); await using var _app = app; - await Assert.That(pointer.Published.Last().Shown).IsFalse(); + await Assert.That(pointer.Published.Last().Interactive).IsFalse(); } [Test] From 71824ce8e567b03b51b5a5992fe144be212ca6d0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 06:28:49 +0000 Subject: [PATCH 024/113] Give the desktop header and sidebar room of their own beside the cells ClientHost.Chrome (HostChrome(Header, Rail), required) says which chrome the host draws; the client then leaves no cell for it (hidden header band, no rail column), so the veto, the layout, PaneOutputRects and per-pane NAWS follow from arranged bounds. The window draws a 42 px header and a 232 px sidebar (48 px folded) and moves TerminalView into what is left; modals draw in the cell area with the chrome inert beside them, and an armed Ctrl+B shows its keys in the native header. The header's search box opens the palette and a second click while it is up is not a refusal. HostParityTests compares both hosts under both arrangements. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 ++ CLAUDE.md | 94 ++++++++++++------- src/SharpMUTerm.Avalonia/NativeChrome.cs | 6 +- .../Pointer/SharpMUTermApp.Chrome.cs | 27 ++++-- .../NativePaletteRoutingTests.cs | 2 + 5 files changed, 92 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fad42b2..e2574a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Desktop window: the header and the connections sidebar now have room of their own — a full-height toolbar + across the top and a 232-pixel sidebar down the left — instead of being squeezed into one row and one column + of text, and the text area is the rest of the window, so every pane is as wide and tall as it really is (and + that is the size your games are told). While Ctrl+B is armed the header lists the keys it answers, dimming the + ones that cannot run, with each key's meaning in its tooltip. The sidebar folds to a slim strip of characters + with the chevron at its top or Ctrl+B b, and stays in place, inactive, while a dialog or settings screen is + open. `--cell-chrome` draws them as text, the way the terminal does. - Desktop window: Ctrl+P opens a native command palette, a rounded popup near the top of the window with a search box, grouped results, the matched letters highlighted and each command's key on the right. It lists the same commands in the same order as the terminal's palette, recent and suggested first. Arrow keys and the diff --git a/CLAUDE.md b/CLAUDE.md index af7b7265..effbc326 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1060,40 +1060,67 @@ fallbacks) for inline images/maps. button's icon is the only header action. The window's menu is Avalonia's `ContextMenu`, which needs a second click under a WM-less X server to take the first item (seen under Xvfb only). -- **The header and the sidebar are data, and the window draws them natively over their cells** (Client - `Chrome/HeaderModel`, `Chrome/SidebarModel`; Tui `Pointer/SharpMUTermApp.Chrome.cs`, `ChromeOverlay`; Avalonia - `NativeChrome.cs`: `NativeHeader`, `NativeSidebar`). Second slice of the desktop app, on `DesktopLayer`'s model. +- **The header and the sidebar are data, and the window draws them natively beside the cells** (Client + `Chrome/HeaderModel`, `Chrome/SidebarModel`; Tui `Hosting/ClientHost.cs` `HostChrome`, `Pointer/SharpMUTermApp.Chrome.cs`, + `ChromeOverlay`; Avalonia `NativeChrome.cs`: `NativeHeader`, `NativeSidebar`; `DesktopLayer`'s `NativeLayout`). Decisions not to relitigate: - **One model per surface, and the cells render from it.** `BuildHeaderModel()` feeds `HeaderMarkup(model)`; - `BuildSidebar()` feeds `BuildRail()` (`SidebarModel.Rows()` is Core's `RailModel.Build` over the same tree), so - the cell frames are byte-identical to before (checked by diffing `default`, `rail-long`, `connections`, - `characters`, `tint`, `tint-tabs`, `collapsed`, `prefix`, `menu`, `layout-roleplay`). `SidebarModel` wraps Core's - `RailWorld`/`RailCharacter`/`RailWindow` tree rather than duplicating it, adding the selected window, collapsed, - targets and value equality. It is not called `RailModel` because Core's `RailModel` is the row projection. - The header's presence dot reads `ConnectedCharacters()`, the same answer as the rail's dot and the fraction. - - **The channel is `IPointerPresenter.Chrome(ChromeOverlay)`**, default-implemented, published on `PostBufferPaint` - and on the main window's `Activated`/`Deactivated`, only on change. Rectangles are the header control's and the - rail's *column* (the rail control is only as tall as its rows), in desktop cells. + `BuildSidebar()` feeds `BuildRail()` (`SidebarModel.Rows()` is Core's `RailModel.Build` over the same tree). + `SidebarModel` wraps Core's `RailWorld`/`RailCharacter`/`RailWindow` tree rather than duplicating it, adding the + selected window, collapsed, targets and value equality. It is not called `RailModel` because Core's `RailModel` + is the row projection. The header's presence dot reads `ConnectedCharacters()`, the same answer as the rail's + dot and the fraction. While ⌃B is armed `HeaderModel.Prefix` carries `PrefixPanel.Entries` (key, title, why it + is blocked) and the exit, so the native header shows the keymap where the cell header shows its strip. + - **`ClientHost.Chrome` (`HostChrome(Header, Rail)`, required) says which chrome the host draws, and the client + leaves no cell for it.** `HostChrome.None` for the terminal, the snapshot, `--plain` and the tests; + `HeaderAndRail` for the window (`WindowHost.Create`, from `WindowOptions.Chrome`; `--cell-chrome` and + `--render-png` say None). It is a flag per part, not a size: the space is the host's own business (42 px, 232 px, + `NativeLayout`), and the client is only told the part is not its to draw. With `Header` the header control is + `Visible = false` — a hidden sticky band takes no row — and `ChromeRows()` counts no header row, so the + input-height veto (`SyncInputHeights`) and the layout agree. With `Rail` `BuildWorkspaceRow` builds the pane area + alone (no rail column, divider or spacer; `_railColumn` is null, so `ApplyRailWidth` does nothing). Everything + else follows from arranged bounds: `PaneOutputRects` and so per-pane NAWS are the panes the cells really hold. + `HostChromeLayoutTests` pins rows, rectangles, NAWS and the veto at 80×6. + - **The window moves the cells out of the way; nothing native sits over a cell.** `DesktopLayer` spans the window + and sets `TerminalView.Margin` to `NativeLayout.Insets` (header height on top, sidebar width plus an 8 px gutter of + the sidebar's plane on the left; the slim width while `Sidebar.Collapsed`), so the view, the grid it hands the + driver and every pane are what is left. `MainWindow` sizes the window as the `--size` grid plus the insets. + Panels and the cell-mode header buttons are placed from `DesktopLayer.CellOrigin`; scrollbars, hovers, tooltips + and pointer-to-cell mapping are the view's own coordinates and needed no offset. The window's resize band is + measured against the *window* (`TerminalView.EdgeAt` translates), so it works over the header and sidebar too + (`ResizeFromChrome`, `EdgeCursorFromChrome`); a blank cell on row 0 moves the window only while + `CellsHoldHeader` (row 0 is a tab strip otherwise). The native palette (`PaletteOverlay`) is the root panel's last + child and centres over the whole window, its card starting under the header (`ThePaletteCentresOverTheWhole…`). + - **The channel is `IPointerPresenter.Chrome(ChromeOverlay)`**, published only to a host whose `Chrome.Any`, on + `PostBufferPaint`, the main window's `Activated`/`Deactivated`, and every `RefreshHeader`/`RefreshRail`/`ToggleRail` + (`PublishHostChrome`): with no cell of either a change may paint no frame. Only on change. It carries no + rectangles; `ChromePalette` carries the planes (`HeaderPlane`, `RailPlane`, `Ink`) and the notice voice, because + there is no cell to read them off. - **A click hands back a target the client put in the model**, and `ActivateChromeTarget` refuses one the last - overlay did not offer. Rail targets go to `DispatchRailTarget` (the rail's own `LinkClicked` handler), the search - box and brand to `HeaderModel.PaletteTarget` (opens ⌃P, never toggles it shut), *Add a game* to `term:welcome`. - Never `OnLinkClicked`, and the host spells no command. - - **Native chrome stands down** while another of the client's windows is in front (`_system.ActiveWindow` is not - the main window: ⌃P, settings, composer, quit prompt), because those are cells a native view would cover; the - header also while ⌃B is armed (the cells then show the which-key strip), and the sidebar while collapsed. - - **Input**: every press, release and wheel over the native views is the window's (`NativeChromeView`), a right - press is forwarded as a right click on the cell (`ForwardRightClick`), and nothing is focusable. A left press on - empty header space calls `TerminalView.WindowGestureFromChrome`: edge band resizes, the rest moves the window, - double-click maximises, whatever cell lies under it. The header leaves the header buttons' slots clear. - - **It draws inside one cell row.** A real 44 px header (and a 232 px sidebar wider than its cells) needs the - client's layout to make room, so that the cell grid starts below a header band the client does not draw: a - `ClientHost` member giving the host-drawn header's height in rows (the client then skips its own header row and - every `HeaderHeight`/`ChromeRows`/`InputLayout` count follows), the window offsetting `TerminalView` by the - native height and mapping pointer positions through that offset, and the parity test comparing cells below it. - The sidebar likewise needs a host-declared rail width in cells, so NAWS stays what the panes really are. - - **Not done**: no tooltips beyond the native `ToolTip`, no keyboard navigation of the native views (the keys are - the client's: ⌥N, ⌥J/⌥K, ⌃P), no scrolling of an overlong sidebar (rows past the foot are cut), the collapsed - strip stays cells. + overlay did not offer (a rail target is offered only when `Drawn.Rail`). Rail targets go to `DispatchRailTarget`, + the search box and brand to `HeaderModel.PaletteTarget` (opens ⌃P, never toggles it shut), *Add a game* to + `term:welcome`, the sidebar's chevron to `SidebarModel.CollapseTarget` (`ToggleRail`, what ⌃B b runs). Never + `OnLinkClicked`, and the host spells no command. + - **A modal does not hide the chrome.** ⌃P, a settings screen, the composer and the quit prompt are drawn in the + cells, which no longer reach under the header or sidebar, so the chrome stays where a desktop app's stays, under + a veil, and takes no click (`ChromeOverlay.Interactive`, `MainWindowInFront`; refused client-side too). The + settings screens and F1 size to the driver's screen, which is the cell area, so they fit and centre there. + - **Folded, the sidebar is a 48 px strip**: the unfold chevron, an accent mark per world, a disc with the initial + per character (filled while connected, an unread dot), "+" at the foot; names in tooltips. + - **Input**: every press, release and wheel over the native views is the window's (`NativeChromeView`); a right + press does nothing (there is no cell under it to forward to), and nothing is focusable. A left press on empty + header space calls `TerminalView.WindowGestureFromChrome`: edge band resizes, the rest moves the window, + double-click maximises. The header leaves the header buttons' slots clear; with a native header the buttons sit + in it, 30 px, right-aligned. + - **Parity is cells against cells under the same `HostChrome`.** `HostParityTests` draws every view twice inline — + both hosts told `None`, and both told `HeaderAndRail` — and the looping pass with `HeaderAndRail`, comparing every + cell. Telling both hosts the same arrangement keeps the comparison a comparison of drivers (the guarantee it + exists for), and covering both arrangements means the layout a person actually runs in the window is held to + the terminal's cell for cell, rather than compared below an offset or skipped. What the native header and + sidebar *say* is held to the cells by the shared models (`NativeChromeModelTests`), not by pixels. + - **Not done**: no keyboard navigation of the native views (the keys are the client's: ⌥N, ⌥J/⌥K, ⌃P), no + scrolling of an overlong sidebar (rows past the foot are cut), no right-click menu on a sidebar row, no + animation when the sidebar folds. - **Layouts are realised as panes, one per panel that has data** (`Core/Layouts`: `LayoutFold` → `LayoutRealiser` → `WorkspaceLayout.ReplaceTree`, `LayoutCapture` for the way back; Tui `SharpMUTermApp.Layouts.cs`, @@ -1189,7 +1216,7 @@ one `SharpMUTermApp`; a host is only the place it runs. What differs between hos (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it -draws ⌃P natively (`INativePalette`, null for the cell popup). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +draws ⌃P natively (`INativePalette`, null for the cell popup), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until @@ -1204,7 +1231,8 @@ draws ⌃P natively (`INativePalette`, null for the cell popup). Built by `Clien `ClientHost`. Don't use `WarningsAsErrors` for it: that ignores the folder's `severity = none`. - **Every snapshot view is drawn through both drivers and compared cell for cell**, glyph and background (`HostParityTests.EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal`, Avalonia suite), with the same - capabilities and keys, so a difference can only be the driver. The list is `SnapshotViews.All`, and + capabilities, keys and `HostChrome` — once with the chrome in cells and once with the header and rail drawn by + the host, as the window runs — so a difference can only be the driver. The list is `SnapshotViews.All`, and `EveryViewTheSnapshotKnowsIsInTheParityList` reads `RenderSnapshot`'s source and fails when it learns a view the list does not name. The harness drag goes through `IMouseInjector` so `drag` draws in both. A second pass (`EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning`) draws each view with the window's loop diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 72e151ab..50eb41ef 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -409,9 +409,9 @@ private void LayoutPrefix(HeaderPrefix prefix, double start, double right, doubl const double size = FontSize; var chipHeight = plateHeight - 6; var chipTop = plateTop + 3; - var lead = Measure(HeaderPrefix.Chord, size, bold: true) + Measure(PrefixWord, size - 1) + 34; + var lead = Measure(KeyGlyphs.Words(HeaderPrefix.Chord), size, bold: true) + Measure(PrefixWord, size - 1) + 34; _prefix = new Rect(start, plateTop, Math.Min(lead, Math.Max(0, right - start)), plateHeight); - hits.Add((_prefix, string.Empty, $"{HeaderPrefix.Chord} is armed: the next key acts on the workspace. {prefix.Exit}.")); + hits.Add((_prefix, string.Empty, $"{KeyGlyphs.Words(HeaderPrefix.Chord)} is armed: the next key acts on the workspace. {prefix.Exit}.")); var exitWidth = Measure(prefix.Exit, size - 1) + 8; var x = _prefix.Right + 12; @@ -542,7 +542,7 @@ private void DrawPrefix(DrawingContext context, HeaderPrefix prefix, ChromeOverl var plate = Color.FromArgb(0x2A, notice.R, notice.G, notice.B); context.DrawRectangle(new SolidColorBrush(plate), new Pen(new SolidColorBrush(Color.FromArgb(0x90, notice.R, notice.G, notice.B)), 1), _prefix.Deflate(0.5), 7, 7); var x = _prefix.X + 12; - x += Text(context, HeaderPrefix.Chord, x, middle, size, notice, bold: true) + 8; + x += Text(context, KeyGlyphs.Words(HeaderPrefix.Chord), x, middle, size, notice, bold: true) + 8; Text(context, PrefixWord, x, middle, size - 1, Ink, maxWidth: Math.Max(1, _prefix.Right - 10 - x)); } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs index c44a3b89..dcc86098 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs @@ -106,21 +106,32 @@ internal bool ActivateChromeTarget(string target) return false; } - // A modal in front (⌃P, a settings screen, the composer, the quit prompt) owns the keys and the screen; the - // chrome stays drawn beside it, inert, as a desktop app's does under its own dialog. - if (!MainWindowInFront()) - { - return false; - } - if (target == HeaderModel.PaletteTarget) { - // Opens, rather than the ☰'s toggle: a search box is clicked to start typing in it, never to close it. + // Opens, rather than the ☰'s toggle: a search box is clicked to start typing in it, never to close it. A + // second click while the palette is up is that same answer, not a refusal. + if (_palette.IsOpen || NativePaletteIsOpen) + { + return true; + } + + if (!MainWindowInFront()) + { + return false; + } + OpenMenu(); return true; } + // A modal in front (⌃P, a settings screen, the composer, the quit prompt) owns the keys and the screen; the + // chrome stays drawn beside it, inert, as a desktop app's does under its own dialog. + if (!MainWindowInFront()) + { + return false; + } + if (target == SidebarModel.CollapseTarget) { ToggleRail(); diff --git a/tests/SharpMUTerm.Tui.Tests/NativePaletteRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativePaletteRoutingTests.cs index 3a4a8ee0..f9e8c938 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativePaletteRoutingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativePaletteRoutingTests.cs @@ -34,6 +34,8 @@ private static (SharpMUTermApp App, Presenter Native) App(bool native = true) var host = ClientHost.Headless(new HeadlessConsoleDriver(120, 34), Caps) with { NativePalette = native ? presenter : null, + // The header's search box is the host's own header: only a host that draws it is offered its target. + Chrome = HostChrome.HeaderAndRail, }; return (new SharpMUTermApp(DemoScene.Build(), host), presenter); } From dad8be569ce28ac99403b6f2a0119266f6544279 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 06:36:28 +0000 Subject: [PATCH 025/113] Surface catalog: one declaration per surface, held to both hosts SurfaceCatalog (Client/Surfaces) declares every surface a host may draw with its own controls - header, sidebar, folded rail strip, armed Ctrl+B keymap, vitals, map, who-here, quick bar, settings, the Layouts menu and Ctrl+P - with its Client model, its actions and the client method each ends in, how each host draws it, its cell renderer and its native views. Three suites hold the hosts to it: - SurfaceCatalogTests (Client): ids, hosts, models in Client/Core, a native-only door names where the cells offer it. - SurfaceCellTests (Tui): every cell renderer takes its model, every action's method exists, every command resolves; F4's terminal verdicts. - SurfaceParityTests (Avalonia): every Control in the window is declared and handed its model; each native model equals the one the cells drew in the same frame; each native action and its cell link leave two clients in the same state; F4 and the quick bar's window verdicts. F4 and the quick bar are per host: MacroKeys.Verdict and the keypad, clash and quick-bar code take HostKeys, and HostKeys.ReportsChordsWhole says the window delivers Ctrl+digit and friends as themselves. Divergences fixed on the way: the quick bar's "F4 edits keys" is a cell link too; the map's anchor with no current room is one rule (and the native map gets the model instance the cells drew); the Layouts menu is a MenuModel whose choices come back through HeaderAction.Dispatch and are refused unless offered; the Ctrl+B keymap is one model (exit hint included) for the cell panel and the native header; the sidebar's fold button has a Ctrl+P command, layout:toggle-rail. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 + CLAUDE.md | 25 +- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 6 +- src/SharpMUTerm.Avalonia/NativeMenu.cs | 60 ++- src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + .../Commands/BuiltInCommands.cs | 3 + .../Commands/LayoutCommands.cs | 3 + src/SharpMUTerm.Client/Commands/MenuModel.cs | 48 ++ src/SharpMUTerm.Client/Panels/MapViewModel.cs | 10 +- .../Surfaces/SurfaceCatalog.cs | 276 +++++++++++ src/SharpMUTerm.Tui/CommandPalette.cs | 14 + src/SharpMUTerm.Tui/Hosting/HostKeys.cs | 27 + src/SharpMUTerm.Tui/KeyClashes.cs | 12 +- src/SharpMUTerm.Tui/KeypadScreenRenderer.cs | 54 +- src/SharpMUTerm.Tui/KeypadScreenView.cs | 11 +- src/SharpMUTerm.Tui/MacroKeys.cs | 55 ++- src/SharpMUTerm.Tui/MapRenderer.cs | 32 +- .../Panels/QuickBarRenderer.cs | 9 +- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 14 +- .../Pointer/SharpMUTermApp.Desktop.cs | 70 ++- .../Pointer/SharpMUTermApp.Surfaces.cs | 63 +++ src/SharpMUTerm.Tui/PrefixOverlay.cs | 6 +- src/SharpMUTerm.Tui/PrefixPanel.cs | 16 +- src/SharpMUTerm.Tui/RailRenderer.cs | 11 + src/SharpMUTerm.Tui/ScreenField.cs | 4 +- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 16 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 31 +- .../DesktopLayerTests.cs | 15 +- .../SurfaceParityTests.cs | 467 ++++++++++++++++++ .../SurfaceCatalogTests.cs | 101 ++++ .../AdvertisedKeyHonestyTests.cs | 2 +- .../ClientHostContractTests.cs | 1 + .../ConnectionKeysTests.cs | 6 +- .../KeypadScreenRendererTests.cs | 16 +- .../MacroKeyCaptureTests.cs | 31 +- .../PaletteDiscoverabilityTests.cs | 22 +- tests/SharpMUTerm.Tui.Tests/PaneJumpTests.cs | 2 +- .../PaneResizeEndToEndTests.cs | 2 +- .../ScreenButtonTests.cs | 2 +- .../ScreenCursorTests.cs | 8 +- .../ScreenDeleteKeyTests.cs | 7 +- .../ScreenFieldRenderingTests.cs | 11 +- .../ScreenFooterTests.cs | 4 +- .../SharpMUTerm.Tui.Tests/ScreenHintTests.cs | 2 +- .../ScreenLayoutTests.cs | 2 +- .../ScreenListButtonTests.cs | 30 +- .../SharpMUTerm.Tui.Tests/ScreenModelTests.cs | 4 +- .../SharpMUTerm.Tui.Tests/ScreenNameTests.cs | 4 +- .../ScreenPaneNavigationTests.cs | 3 +- .../ScreenReachabilityTests.cs | 4 +- .../ScreenReadOnlyTests.cs | 8 +- .../SettingsPasteTests.cs | 4 +- .../SharpMUTerm.Tui.Tests/SurfaceCellTests.cs | 108 ++++ .../TerminalPanelTests.cs | 4 +- .../TriggerSetManagementTests.cs | 6 +- .../SharpMUTerm.Tui.Tests/WindowJumpTests.cs | 6 +- 56 files changed, 1523 insertions(+), 245 deletions(-) create mode 100644 src/SharpMUTerm.Client/Commands/MenuModel.cs create mode 100644 src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs create mode 100644 src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/SurfaceCellTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index e2574a85..5aafdc4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Ctrl+P lists *Fold or unfold the connection rail*, the same fold as Ctrl+B b and as the desktop window's + sidebar button. - Desktop window: the header and the connections sidebar now have room of their own — a full-height toolbar across the top and a 232-pixel sidebar down the left — instead of being squeezed into one row and one column of text, and the text area is the rest of the window, so every pane is as wide and tall as it really is (and @@ -219,6 +221,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- Desktop window: the Keys screen (F4) and the quick bar now describe the window's keys rather than a + terminal's. Ctrl+digit, Ctrl+Shift+letter, Ctrl+Tab and Alt+O are shown as working keys you can bind, and + Alt+Enter is marked as taken because it maximises the window. +- Terminal: the quick bar's *F4 edits keys* can be clicked, as it already could in the desktop window. With no + room known, the map panel now centres on the same room in the terminal as in the window. - The message a client with no worlds shows no longer wraps the status row onto a second row at 80 columns. - A `--snapshot` frame with an MXP picture in cells a server left for it no longer sometimes leaves one of the picture's rows blank. diff --git a/CLAUDE.md b/CLAUDE.md index effbc326..230e1f4f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1240,6 +1240,23 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), and which chrom came out as an empty frame — ⌃P and F1 blank — while the inline pass was green. The scene is now queued for the loop's first tick (`ClientLaunch.Demo`). That pass skips the bottom row (a live client has been through startup) and the two timestamp views (a loop reads the clock). +- **Every native view is a declared surface, drawn from the model the cells drew** (`SurfaceCatalog`, Client + `Surfaces/`). A surface (header, sidebar, the folded rail strip, the armed ⌃B keymap, each panel, settings, the + Layouts menu, ⌃P) is declared once: id, + Client model, actions (each naming the client method it ends in), per host `Cells`/`Native`/`Both`, its cell + renderer and its native views. Three suites hold the hosts to it: `SurfaceCatalogTests` (Client: the + declaration's own rules), `SurfaceCellTests` (Tui: the renderer takes the model, every action's method exists, + every command resolves) and `SurfaceParityTests` (Avalonia: every `Control` in the window assembly is declared; + each native model equals `DrawnModel` — what the cell renderer recorded through `Drawing(...)` in the same frame; + each native action and its cell link leave two identical clients in the same state, and not the state before). + A door only the native view offers says where the cells offer it (`CellsVia`: another surface or a ⌃P command — + which is why the sidebar's fold button has `layout:toggle-rail` beside ⌃B b). The ⌃B keymap is one model + (`PrefixPanel.Model` → `HeaderPrefix`) for the cell panel and the native header, exit hint included. + The window never builds a command: a menu is a `MenuModel` of entries the client offered, and a choice comes + back through `HeaderAction.Dispatch` and is refused if it was not offered. **To add a native surface**: put its + model in Client, draw its cells from it through `Drawing(...)`, publish the same instance to the host, declare + it in `SurfaceCatalog.All`, and add its model and action probes to `SurfaceParityTests`, whose coverage guards + fail until you do. - **Every surface that names a key is read once per host** (`EverySurfaceNamesThisHostsKeys`): ⌃P and `--help` must name the host's newline and none of the chords the host keeps (`HostKeys.Reserved`, which `TerminalView` acts on, so the window's chords and the list are one). The help page is one writer @@ -1257,9 +1274,11 @@ turned into the window by `AppRun` itself rather than by the hand-off, because a program it started exits and the hand-off exits at once. The installer is Inno Setup, per-user by default, with an optional PATH entry so `sharpmuterm` runs from any terminal. -**Not covered yet**: F4's verdicts (`MacroKeys.Verdict`) describe the terminal only. In the window ⌃digit -does arrive (F4 says it cannot), and ⌥⏎ never reaches a macro. Making it per host means threading `HostKeys` -through `MacroKeys`, `ScreenField` and the keypad renderer. +**F4 and the quick bar read the host's keys** (`MacroKeys.Verdict(HostKeys, …)`, threaded through `ScreenField`, +`KeyClashes`, the keypad renderer and `QuickBarRenderer`). `HostKeys.ReportsChordsWhole` says whether the host +delivers a modified key as itself (the window: ⌃digit, ⌃⇧letter, ⌃Tab and ⌥O fire) or as the terminal's bytes; +a chord in `HostKeys.Reserved` or the host's newline is *Taken* with the host's own reason (the window's ⌥⏎ +maximises). `SurfaceCellTests.F4TellsTheTerminalsTruth` and `SurfaceParityTests.F4TellsTheWindowsTruth` pin each. ## Building and testing diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index 4f5f828c..cc6c25a7 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -324,14 +324,14 @@ private void Place( /// The client builds the menu on its thread; it is opened here, under the button. private void OpenMenu(HeaderAction action, HeaderButton button) => - action.Menu(items => Dispatcher.UIThread.Post(() => + action.Menu(model => Dispatcher.UIThread.Post(() => { - if (items.Count == 0) + if (model.Entries.Count == 0) { return; } - var menu = NativeMenu.Build(items, PlacementMode.BottomEdgeAlignedRight, button); + var menu = NativeMenu.Build(model, action.Dispatch, PlacementMode.BottomEdgeAlignedRight, button); menu.Closed += (_, _) => _view.Focus(); OpenedMenu = menu; menu.Open(button); diff --git a/src/SharpMUTerm.Avalonia/NativeMenu.cs b/src/SharpMUTerm.Avalonia/NativeMenu.cs index 63aa6a4a..e541dc15 100644 --- a/src/SharpMUTerm.Avalonia/NativeMenu.cs +++ b/src/SharpMUTerm.Avalonia/NativeMenu.cs @@ -2,55 +2,81 @@ using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Layout; +using SharpMUTerm.Client.Commands; using SharpMUTerm.Tui; namespace SharpMUTerm.Avalonia; /// -/// A menu the client built (s), as a native : the right-click -/// menu and the header buttons' menus are drawn by this one function, so they look and behave alike. Each entry's -/// is already marshalled onto the client's thread. +/// A menu the client built, as a native : the right-click menu (s) +/// and the header buttons' menus (a ) are drawn by this one class, so they look and behave +/// alike. A right-click entry's is already marshalled onto the client's thread; a +/// header menu entry hands its command id back through the action's own dispatch, which the client checks against +/// the menu it built. /// internal static class NativeMenu { - public static ContextMenu Build(IReadOnlyList items, PlacementMode placement, Control target) + public static ContextMenu Build(IReadOnlyList items, PlacementMode placement, Control target) => + Build( + items.Select(i => i.IsSeparator ? null : ((string, string?, bool, bool, Action)?)(i.Label, i.Hint, i.Enabled, i.Checked, i.Run)), + placement, + target); + + /// A header button's menu: each entry hands its command id to . + public static ContextMenu Build(MenuModel model, Action dispatch, PlacementMode placement, Control target) => + Build( + model.Entries.Select(e => e.IsSeparator + ? null + : ((string, string?, bool, bool, Action)?)(e.Label, e.Key, e.Enabled && e.Command is not null, e.Checked, () => + { + if (e.Command is { } command) + { + dispatch(command); + } + })), + placement, + target); + + private static ContextMenu Build( + IEnumerable<(string Label, string? Hint, bool Enabled, bool Checked, Action Run)?> items, PlacementMode placement, Control target) { var menu = new ContextMenu { Placement = placement, PlacementTarget = target }; Grid.SetIsSharedSizeScope(menu, true); foreach (var item in items) { - if (item.IsSeparator) + if (item is not { } entry) { menu.Items.Add(new Separator()); continue; } - var entry = new MenuItem { Header = Header(item), IsEnabled = item.Enabled }; - if (item.Checked) + var menuItem = new MenuItem { Header = Header(entry.Label, entry.Hint), IsEnabled = entry.Enabled }; + if (entry.Checked) { - entry.ToggleType = MenuItemToggleType.CheckBox; - entry.IsChecked = true; + menuItem.ToggleType = MenuItemToggleType.CheckBox; + menuItem.IsChecked = true; } - entry.Click += (_, _) => item.Run(); - menu.Items.Add(entry); + var run = entry.Run; + menuItem.Click += (_, _) => run(); + menu.Items.Add(menuItem); } return menu; } /// An entry's label with its key after it, the keys lined up in a column of their own. - private static Control Header(PointerMenuItem item) + private static Control Header(string label, string? hint) { var grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "label" }); grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "hint" }); - grid.Children.Add(new TextBlock { Text = item.Label, VerticalAlignment = VerticalAlignment.Center }); - if (item.Hint is { } hint) + grid.Children.Add(new TextBlock { Text = label, VerticalAlignment = VerticalAlignment.Center }); + if (hint is { } key) { - var key = new TextBlock { Text = hint, Opacity = 0.6, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; - Grid.SetColumn(key, 1); - grid.Children.Add(key); + var text = new TextBlock { Text = key, Opacity = 0.6, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; + Grid.SetColumn(text, 1); + grid.Children.Add(text); } return grid; diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 16191e68..c35ea924 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -29,6 +29,9 @@ internal static class WindowHost { Newline = new HostChord(ConsoleKey.Enter, ConsoleModifiers.Control, "Ctrl+⏎", "Ctrl+Enter"), Reserved = [Maximise, .. Paste], + + // Avalonia reports the key and its modifiers: ⌃digit, ⌃⇧letter, ⌃Tab and ⌥O arrive as themselves. + ReportsChordsWhole = true, }; /// The window's driver. diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 3cb7e5d5..bcffae17 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -201,6 +201,9 @@ void Family(string id, string prefix, FuncMakes the layout in use the focused character's own, whatever its world uses. public const string UseForCharacter = Prefix + "use-character"; + /// Opens the ⌥M list itself: the ⌃P entry, and the menu's last entry. Not under . + public const string Manage = "layout:layouts"; + /// The id that applies . public static string Apply(string layoutId) => ApplyPrefix + layoutId; } diff --git a/src/SharpMUTerm.Client/Commands/MenuModel.cs b/src/SharpMUTerm.Client/Commands/MenuModel.cs new file mode 100644 index 00000000..211f834f --- /dev/null +++ b/src/SharpMUTerm.Client/Commands/MenuModel.cs @@ -0,0 +1,48 @@ +namespace SharpMUTerm.Client.Commands; + +/// +/// One entry of a menu the client builds for a host to draw: what it says, the key that does the same, and the +/// command id it dispatches. A host never names a command of its own — it hands the id back to the client, which +/// runs it through the registry, as a key or a ⌃P entry would. +/// +/// What the entry says; may carry the game's or the player's text, already bounded. +/// The key that does the same, for the entry's key column, or null. +/// The command id the entry dispatches, or null for an entry that does nothing. +/// Whether the entry is ticked: the one in use. +/// Whether it can be chosen. +public sealed record MenuEntry(string Label, string? Key, string? Command, bool Checked = false, bool Enabled = true) +{ + /// A rule between groups of entries. + public static MenuEntry Separator { get; } = new("-", null, null, Enabled: false); + + /// Whether this is the rule between groups. + public bool IsSeparator => Equals(Separator); +} + +/// +/// A menu as data, built by the client and drawn by a host (the window's Layouts button draws it as a native +/// menu). Every entry carries the command id it runs, so the menu cannot offer what the registry does not have. +/// +public sealed record MenuModel(IReadOnlyList Entries) +{ + /// No entries. + public static MenuModel Empty { get; } = new([]); + + /// Every command id the menu offers, so a host's answer can be checked against what was offered. + public IEnumerable Commands() => + Entries.Where(e => e.Enabled && e.Command is not null).Select(e => e.Command!); + + /// Value equality over the entries, which a record's list member does not give. + public bool Equals(MenuModel? other) => other is not null && Entries.SequenceEqual(other.Entries); + + public override int GetHashCode() + { + var hash = new HashCode(); + foreach (var entry in Entries) + { + hash.Add(entry); + } + + return hash.ToHashCode(); + } +} diff --git a/src/SharpMUTerm.Client/Panels/MapViewModel.cs b/src/SharpMUTerm.Client/Panels/MapViewModel.cs index 5f301d88..334578fb 100644 --- a/src/SharpMUTerm.Client/Panels/MapViewModel.cs +++ b/src/SharpMUTerm.Client/Panels/MapViewModel.cs @@ -29,6 +29,12 @@ public sealed record MapViewModel(string? Area, int Level, IReadOnlyListThe longest room name a view is given. public const int MaxNameLength = 80; + /// + /// The room the view is drawn around: the character's, or with no current room the most recently recorded one. + /// Null when nothing is mapped. The cell map centres on this room too, so the two views never disagree about it. + /// + public long? AnchorId { get; init; } + /// The room the character is in, or null. public MapViewRoom? Current => Rooms.FirstOrDefault(r => r.Current); @@ -82,12 +88,12 @@ public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerableValue equality over the rooms and exits, which a record's list members do not give. public bool Equals(MapViewModel? other) => - other is not null && Area == other.Area && Level == other.Level && Walking == other.Walking + other is not null && Area == other.Area && Level == other.Level && Walking == other.Walking && AnchorId == other.AnchorId && Rooms.SequenceEqual(other.Rooms) && Exits.SequenceEqual(other.Exits); public override int GetHashCode() => HashCode.Combine(Area, Level, Walking, Rooms.Count, Exits.Count); diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs new file mode 100644 index 00000000..1f576228 --- /dev/null +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -0,0 +1,276 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; + +namespace SharpMUTerm.Client.Surfaces; + +/// How a surface is drawn on one host. +[Flags] +public enum SurfaceDrawing +{ + /// Not drawn on this host; its actions are reached another way (). + None = 0, + + /// Drawn as cells by the client. + Cells = 1, + + /// Drawn by the host with its own controls. + Native = 2, + + /// Drawn as cells, with the host's native view over them: the cells stay underneath. + Both = Cells | Native, +} + +/// What kind of input a surface hands back to the client. +public enum SurfaceActionKind +{ + /// A command id, run through the registry. + Command, + + /// An index into the model the surface was drawn from (row N, item N). + Pick, + + /// A click target the client put in the model. + Target, + + /// A room id on the map. + Walk, + + /// A change to a declared setting, committed through the client's save funnel. + Edit, +} + +/// +/// One thing a surface can ask the client to do, and the one client method every view of the surface ends in. +/// +/// What the view hands back. +/// A command id for ; otherwise what is picked or targeted. +/// The client method the cells and the native view both end in. +/// +/// Null when the surface's cells carry the action themselves. Otherwise the action is the native view's alone, and +/// this names where the cells offer the same thing: another surface's id, or a command id (a key, a ⌃P entry). A +/// native view may add a door; it may not add a room. +/// +public sealed record SurfaceAction(SurfaceActionKind Kind, string Name, string Reaches, string? CellsVia = null); + +/// The hosts a surface is declared for, by ClientHost.Name. +public static class SurfaceHosts +{ + /// The terminal: cells only, since nothing in a terminal can draw over a cell without taking it. + public const string Terminal = "terminal"; + + /// The desktop window: cells, and native views over them. + public const string Window = "window"; + + /// Every host a declaration states. + public static IReadOnlyList All { get; } = [Terminal, Window]; +} + +/// +/// One user-facing surface, declared once: its model, what it can ask for, and how each host draws it. +/// +/// Stable id. For a panel, the layout's panel id (). +/// The Client model every view of the surface is drawn from. +/// What the surface can hand back to the client. +/// Per host (), how it is drawn. +/// +/// The Tui method that draws the cells, as Namespace.Type.Method; one of its overloads takes +/// . Null only for a surface no host draws in cells. +/// +/// The window's classes that draw it natively, as Namespace.Type. +/// +/// For a surface no host draws in cells: the command id that reaches the same actions from the keyboard. +/// +public sealed record SurfaceDeclaration( + string Id, + Type Model, + IReadOnlyList Actions, + IReadOnlyDictionary Drawing, + string? CellRenderer, + IReadOnlyList NativeViews, + string? KeyboardPath = null) +{ + /// How draws this surface. + public SurfaceDrawing On(string host) => Drawing.TryGetValue(host, out var drawing) ? drawing : SurfaceDrawing.None; + + /// Whether any host draws it as cells. + public bool HasCells => Drawing.Values.Any(d => d.HasFlag(SurfaceDrawing.Cells)); + + /// Whether any host draws it natively. + public bool HasNative => Drawing.Values.Any(d => d.HasFlag(SurfaceDrawing.Native)); +} + +/// +/// Every user-facing surface that a host may draw with its own controls, declared once. The terminal and the +/// window run one client; what keeps their surfaces saying the same things is that each has one Client model, the +/// cells are drawn from it, the window's native view is drawn from the same instance, and every click comes back to +/// one client method. This catalog is where that is written down, and the tests read it: a native view no surface +/// declares, a declared surface whose cell renderer does not take its model, a native action that ends somewhere a +/// cell click does not, and a native model that differs from the one the cells drew in the same frame all fail. +/// +/// Adding a native surface: give it a model here in Client, draw its cells from that model, publish the same +/// instance to the host, declare it below, and add its probes to the window suite's SurfaceParityTests +/// (which fails until it has them). +/// +/// +public static class SurfaceCatalog +{ + /// The header band. + public const string Header = "header"; + + /// The connection sidebar. + public const string Sidebar = "sidebar"; + + /// The declared settings sections (F7, F8). + public const string Settings = "settings"; + + /// The Layouts button's menu. + public const string LayoutsMenu = "layouts-menu"; + + /// ⌃P, the command palette. + public const string Palette = "palette"; + + /// The ⌃B keymap while the prefix is armed: a cell panel, or the window's native header. + public const string Prefix = "prefix"; + + /// The folded sidebar: a strip of dots in cells, the window's narrow native strip. + public const string RailStrip = "rail-strip"; + + /// + /// The header and the rail: cells in a terminal; in the window (HostChrome.HeaderAndRail) native views + /// beside the cells, which then leave them out. + /// + private static readonly IReadOnlyDictionary NativeChrome = new Dictionary + { + [SurfaceHosts.Terminal] = SurfaceDrawing.Cells, + [SurfaceHosts.Window] = SurfaceDrawing.Native, + }; + + private static readonly IReadOnlyDictionary CellsUnderNative = new Dictionary + { + [SurfaceHosts.Terminal] = SurfaceDrawing.Cells, + [SurfaceHosts.Window] = SurfaceDrawing.Both, + }; + + /// Every declared surface. + public static IReadOnlyList All { get; } = + [ + new( + Header, + typeof(HeaderModel), + [ + new(SurfaceActionKind.Target, HeaderModel.PaletteTarget, "ToggleMenu"), + new(SurfaceActionKind.Target, "character", "DispatchRailTarget", CellsVia: Sidebar), + ], + NativeChrome, + "SharpMUTerm.Tui.SharpMUTermApp.HeaderMarkup", + ["SharpMUTerm.Avalonia.NativeHeader"]), + new( + Sidebar, + typeof(SidebarModel), + [ + new(SurfaceActionKind.Target, "world, character or window", "DispatchRailTarget"), + new(SurfaceActionKind.Command, SidebarModel.AddGameTarget, "DispatchCommand", CellsVia: SidebarModel.AddGameTarget), + ], + NativeChrome, + "SharpMUTerm.Tui.RailRenderer.Render", + ["SharpMUTerm.Avalonia.NativeSidebar"]), + new( + RailStrip, + typeof(SidebarModel), + [new(SurfaceActionKind.Target, SidebarModel.CollapseTarget, "ToggleRail", CellsVia: "layout:toggle-rail")], + NativeChrome, + "SharpMUTerm.Tui.RailRenderer.Render", + ["SharpMUTerm.Avalonia.NativeSidebar"]), + new( + Prefix, + typeof(HeaderPrefix), + [], + NativeChrome, + "SharpMUTerm.Tui.PrefixPanel.Render", + ["SharpMUTerm.Avalonia.NativeHeader"]), + new( + PanelIds.Vitals, + typeof(VitalsModel), + [], + CellsUnderNative, + "SharpMUTerm.Tui.Panels.VitalsStripRenderer.Render", + ["SharpMUTerm.Avalonia.VitalsGauges"]), + new( + PanelIds.Map, + typeof(MapViewModel), + [new(SurfaceActionKind.Walk, "room", "WalkFromMap")], + CellsUnderNative, + "SharpMUTerm.Tui.MapRenderer.Render", + ["SharpMUTerm.Avalonia.MapCanvas"]), + new( + PanelIds.WhoHere, + typeof(WhoHereModel), + [new(SurfaceActionKind.Pick, "row", "OfferLook")], + CellsUnderNative, + "SharpMUTerm.Tui.Panels.WhoHereRenderer.Render", + ["SharpMUTerm.Avalonia.WhoHereList"]), + new( + PanelIds.QuickBar, + typeof(QuickBarModel), + [ + new(SurfaceActionKind.Pick, "item", "RunQuickMacro"), + new(SurfaceActionKind.Command, QuickBarModel.EditCommand, "DispatchCommand"), + ], + CellsUnderNative, + "SharpMUTerm.Tui.Panels.QuickBarRenderer.Render", + ["SharpMUTerm.Avalonia.QuickBarButtons"]), + new( + Settings, + typeof(SettingsSectionContribution), + [new(SurfaceActionKind.Edit, "field", "ScreenEdits.Apply")], + new Dictionary + { + [SurfaceHosts.Terminal] = SurfaceDrawing.Cells, + + // A declared section opens the native settings window instead of its cell screen. + [SurfaceHosts.Window] = SurfaceDrawing.Native, + }, + "SharpMUTerm.Tui.OptionsScreenRenderer.FromSection", + ["SharpMUTerm.Avalonia.SettingsWindow"]), + new( + LayoutsMenu, + typeof(MenuModel), + [ + new(SurfaceActionKind.Command, LayoutCommands.Apply(BuiltInLayouts.CombatId), "RunLayoutCommand"), + new(SurfaceActionKind.Command, LayoutCommands.SaveChanges, "RunLayoutCommand"), + new(SurfaceActionKind.Command, LayoutCommands.SaveAsNew, "RunLayoutCommand"), + new(SurfaceActionKind.Command, LayoutCommands.UseForWorld, "RunLayoutCommand"), + new(SurfaceActionKind.Command, LayoutCommands.UseForCharacter, "RunLayoutCommand"), + new(SurfaceActionKind.Command, LayoutCommands.Manage, "DispatchCommand"), + ], + new Dictionary + { + // A terminal has no header buttons; ⌥M's list is the same commands from the keyboard. + [SurfaceHosts.Terminal] = SurfaceDrawing.None, + [SurfaceHosts.Window] = SurfaceDrawing.Native, + }, + null, + ["SharpMUTerm.Avalonia.HeaderButton", "SharpMUTerm.Avalonia.NativeMenu"], + KeyboardPath: LayoutCommands.Manage), + new( + Palette, + typeof(PaletteView), + [new(SurfaceActionKind.Pick, "entry", "RunFromPalette")], + new Dictionary + { + [SurfaceHosts.Terminal] = SurfaceDrawing.Cells, + + // A window with a native palette opens it instead of the cell popup (ClientHost.NativePalette). + [SurfaceHosts.Window] = SurfaceDrawing.Native, + }, + "SharpMUTerm.Tui.CommandSurfaceRenderer.Render", + ["SharpMUTerm.Avalonia.PaletteOverlay"]), + ]; + + /// The surface with , or null. + public static SurfaceDeclaration? Find(string id) => All.FirstOrDefault(s => s.Id == id); +} diff --git a/src/SharpMUTerm.Tui/CommandPalette.cs b/src/SharpMUTerm.Tui/CommandPalette.cs index b88d2333..6bfcab80 100644 --- a/src/SharpMUTerm.Tui/CommandPalette.cs +++ b/src/SharpMUTerm.Tui/CommandPalette.cs @@ -157,6 +157,20 @@ private void Move(int delta) Paint(); } + /// Selects the listed entry with and commits it, as arrows and ⏎ would; for a test. + internal bool Choose(string id) + { + var index = _view.Entries.ToList().FindIndex(e => e.Item.Id == id); + if (index < 0) + { + return false; + } + + _selected = index; + Commit(); + return true; + } + private void Commit() { if (_selected >= 0 && _selected < _view.Entries.Count) diff --git a/src/SharpMUTerm.Tui/Hosting/HostKeys.cs b/src/SharpMUTerm.Tui/Hosting/HostKeys.cs index c2669678..70b4c04c 100644 --- a/src/SharpMUTerm.Tui/Hosting/HostKeys.cs +++ b/src/SharpMUTerm.Tui/Hosting/HostKeys.cs @@ -1,3 +1,5 @@ +using SharpMUTerm.Core.Automation; + namespace SharpMUTerm.Tui; /// A chord as a host spells it: the key, its exact modifiers, and the two ways a surface names it. @@ -24,8 +26,32 @@ internal sealed record HostKeys /// Chords the host acts on itself; the client never receives them, so no surface may offer them. public required IReadOnlyList Reserved { get; init; } + /// + /// Whether the host reports every chord as the key and the modifiers that were pressed. A window does. A + /// terminal does not: it writes Ctrl+letter as a control byte (losing Shift, and spelling ⌃H/⌃I/⌃J/⌃M as + /// Backspace, Tab and Enter), Ctrl+digit as whatever byte the ASCII table gives it, Ctrl+Tab as a bare Tab, and + /// its emulator and the framework's parser spend chords of their own (kitty's ⌃⇧←/→, the parser's ⌥O). F4 and + /// the quick bar read this through , so a binding is drawn live on the host + /// where it fires and dead where it never arrives. + /// + public required bool ReportsChordsWhole { get; init; } + public bool Reserves(ConsoleKeyInfo key) => Reserved.Any(r => r.Chord.Matches(key)); + /// The reserved chord a descriptor names, or null. + internal ReservedChord? ReservedFor(MacroKeyParts parts) => + Reserved.FirstOrDefault(r => Same(r.Chord, parts)); + + /// Whether a descriptor names the newline chord. + internal bool IsNewline(MacroKeyParts parts) => Same(Newline, parts); + + private static bool Same(HostChord chord, MacroKeyParts parts) => + MacroKeys.NameOf(chord.Key) is { } name + && string.Equals(name, parts.Key, StringComparison.OrdinalIgnoreCase) + && chord.Modifiers.HasFlag(ConsoleModifiers.Control) == parts.Ctrl + && chord.Modifiers.HasFlag(ConsoleModifiers.Alt) == parts.Alt + && chord.Modifiers.HasFlag(ConsoleModifiers.Shift) == parts.Shift; + /// /// A terminal: ⌥⏎ is the newline, reassembled from the Escape and Enter it arrives as /// (SharpMUTermApp.TryAltEnter). ⇧⏎ and ⌃⏎ arrive as a bare ⏎ and are named nowhere. The emulator's @@ -35,5 +61,6 @@ internal sealed record HostKeys { Newline = new HostChord(ConsoleKey.Enter, ConsoleModifiers.Alt, "Alt+⏎", "Alt+Enter"), Reserved = [], + ReportsChordsWhole = false, }; } diff --git a/src/SharpMUTerm.Tui/KeyClashes.cs b/src/SharpMUTerm.Tui/KeyClashes.cs index db76170c..7b373451 100644 --- a/src/SharpMUTerm.Tui/KeyClashes.cs +++ b/src/SharpMUTerm.Tui/KeyClashes.cs @@ -44,13 +44,13 @@ internal readonly record struct KeyClash(Macro Macro, KeyClashKind Kind, string internal static class KeyClashes { /// Every clash among , in list order. - internal static IReadOnlyList Find(IReadOnlyList macros) + internal static IReadOnlyList Find(HostKeys keys, IReadOnlyList macros) { ArgumentNullException.ThrowIfNull(macros); var clashes = new List(); foreach (var macro in macros) { - if (For(macro, macros) is { } clash) + if (For(keys, macro, macros) is { } clash) { clashes.Add(clash); } @@ -64,11 +64,11 @@ internal static IReadOnlyList Find(IReadOnlyList macros) /// on its chord, and every binding that hides one of the client's own keys. A binding that shadows a later /// one is not counted again — the later one already is. /// - internal static int Count(IReadOnlyList macros) => - Find(macros).Count(c => c.Kind != KeyClashKind.Shadows); + internal static int Count(HostKeys keys, IReadOnlyList macros) => + Find(keys, macros).Count(c => c.Kind != KeyClashKind.Shadows); /// The clash is part of, or null. - internal static KeyClash? For(Macro macro, IReadOnlyList macros) + internal static KeyClash? For(HostKeys keys, Macro macro, IReadOnlyList macros) { ArgumentNullException.ThrowIfNull(macro); ArgumentNullException.ThrowIfNull(macros); @@ -91,7 +91,7 @@ internal static int Count(IReadOnlyList macros) => return new KeyClash(macro, KeyClashKind.Shadowed, $"{Name(holders[0])} holds {chord} first; this never runs"); } - if (!MacroKeys.Verdict(chord).Fires) + if (!MacroKeys.Verdict(keys, chord).Fires) { return null; } diff --git a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs index 530a5aea..8a02f865 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs @@ -170,14 +170,14 @@ internal static int NumpadWidth(IReadOnlyList macros) /// panels instead. /// public static List Render( - IReadOnlyList macros, IReadOnlyList? sets = null, int selected = -1) + HostKeys keys, IReadOnlyList macros, IReadOnlyList? sets = null, int selected = -1) { ArgumentNullException.ThrowIfNull(macros); - var left = NumpadColumn(macros); - var right = HotkeysColumn(macros, null, sets, selected); + var left = NumpadColumn(keys, macros); + var right = HotkeysColumn(keys, macros, null, sets, selected); - var lines = new List { HeaderLine(0, Model(macros, sets, selected)), string.Empty }; + var lines = new List { HeaderLine(0, Model(keys, macros, sets, selected)), string.Empty }; var rowCount = Math.Max(left.Count, right.Count); for (var i = 0; i < rowCount; i++) @@ -188,7 +188,7 @@ public static List Render( } lines.Add(string.Empty); - lines.Add(FooterLine(macros, 0, null, selected)); + lines.Add(FooterLine(keys, macros, 0, null, selected)); return lines; } @@ -221,12 +221,13 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo /// /// Which binding the cursor has anchored, or -1 for none. internal static ScreenModel Model( + HostKeys keys, IReadOnlyList macros, IReadOnlyList? sets = null, int selected = -1) { ArgumentNullException.ThrowIfNull(macros); - return new ScreenModel(ScreenModel.Rows(macros, macro => BindingRow(macro, macros, sets)) - .Concat(Buttons(sets, selected)) + return new ScreenModel(ScreenModel.Rows(macros, macro => BindingRow(keys, macro, macros, sets)) + .Concat(Buttons(keys, sets, selected)) .ToArray()); } @@ -235,13 +236,13 @@ internal static ScreenModel Model( /// the screen knows which sets the bindings came from — the set that owns it. /// private static ScreenRow BindingRow( - Macro macro, IReadOnlyList macros, IReadOnlyList? sets) + HostKeys keys, Macro macro, IReadOnlyList macros, IReadOnlyList? sets) { var fields = new List { ScreenField.Name("name", () => macro.Name, v => macro.Name = v), ScreenField.Text("command", () => macro.Command, v => macro.Command = v), - ScreenField.Key("key", () => macro.Key, v => macro.Key = v, key => AlreadyBound(macros, macro, key)), + ScreenField.Key(keys, "key", () => macro.Key, v => macro.Key = v, key => AlreadyBound(macros, macro, key)), }; if (sets is not null) @@ -300,7 +301,7 @@ private static ScreenRow BindingRow( /// contradicting the field beside it. /// /// - private static List Buttons(IReadOnlyList? sets, int selected) + private static List Buttons(HostKeys keys, IReadOnlyList? sets, int selected) { var rows = new List(); if (sets is null) @@ -310,7 +311,7 @@ private static List Buttons(IReadOnlyList? sets, int sele var bound = sets.SelectMany(s => s.Macros).Select(m => m.Key).ToList(); if (ScreenLists.Target(sets, s => s.Macros, selected) is { } target - && FreeBindableKey(bound) is { } key) + && FreeBindableKey(keys, bound) is { } key) { rows.Add(ScreenRow.Of(ScreenButton.Add( AddBindingLabel, @@ -338,9 +339,9 @@ private static List Buttons(IReadOnlyList? sets, int sele /// Null when every candidate is taken, which is what stops the button being drawn at all. /// Comparison is case-insensitive because 's lookup is. /// - private static string? FreeBindableKey(IReadOnlyList bound) + private static string? FreeBindableKey(HostKeys keys, IReadOnlyList bound) { - foreach (var key in MacroKeys.Bindable) + foreach (var key in MacroKeys.Bindable(keys)) { if (!bound.Contains(key, StringComparer.OrdinalIgnoreCase)) { @@ -380,7 +381,7 @@ private static string Identify(Macro macro) => /// stays on the binding the screen is showing; the footer has to report that one, not the last. /// internal static string FooterLine( - IReadOnlyList macros, int width, ScreenFocus? focus = null, int selected = -1) + HostKeys keys, IReadOnlyList macros, int width, ScreenFocus? focus = null, int selected = -1) { ArgumentNullException.ThrowIfNull(macros); @@ -392,8 +393,8 @@ internal static string FooterLine( // The row can only spare a handful of cells for a reason; the footer has the width to give // the whole one, for the binding the cursor is actually on. - var verdict = MacroKeys.Verdict(macros[at].Key); - var clash = KeyClashes.For(macros[at], macros); + var verdict = MacroKeys.Verdict(keys, macros[at].Key); + var clash = KeyClashes.For(keys, macros[at], macros); context = ScreenChrome.Context( ScreenChrome.Position("binding", at, macros.Count), Escape(Identify(macros[at])), @@ -421,7 +422,7 @@ clash is { } c /// whole command and a narrow one ellipsises it — rather than every screen ellipsising at ten /// characters because that was the width the grid was first drawn at. /// - internal static List NumpadColumn(IReadOnlyList macros, int width = 0) + internal static List NumpadColumn(HostKeys keys, IReadOnlyList macros, int width = 0) { ArgumentNullException.ThrowIfNull(macros); @@ -429,7 +430,7 @@ internal static List NumpadColumn(IReadOnlyList macros, int width ? NumpadCommandWidth : Math.Clamp((width - NumpadRowChrome) / 3, MinNumpadCommandWidth, MaxNumpadCommandWidth); - var lines = new List { $"[dim]NUMPAD[/]{Caveat(MacroKeys.Verdict("Num5"))}" }; + var lines = new List { $"[dim]NUMPAD[/]{Caveat(MacroKeys.Verdict(keys, "Num5"))}" }; foreach (var row in NumpadRows) { lines.Add(NumpadRow(row, macros, command)); @@ -441,6 +442,7 @@ internal static List NumpadColumn(IReadOnlyList macros, int width /// The binding list — every macro with its enabled state, key, name, and command. /// How wide the column runs, which its cursor bars and dropdown are sized to. internal static List HotkeysColumn( + HostKeys keys, IReadOnlyList macros, ScreenFocus? focus = null, IReadOnlyList? sets = null, @@ -450,7 +452,7 @@ internal static List HotkeysColumn( ArgumentNullException.ThrowIfNull(macros); var cursor = focus ?? ScreenFocus.None; - var lines = new List { $"[dim]HOTKEYS[/]{DeadCount(macros)}" }; + var lines = new List { $"[dim]HOTKEYS[/]{DeadCount(keys, macros)}" }; if (macros.Count == 0) { lines.Add(" [dim]no hotkeys[/]"); @@ -460,6 +462,7 @@ internal static List HotkeysColumn( { lines.Add(ScreenChrome.Cursor( Hotkey( + keys, macros[i], macros, sets is null ? null : ScreenLists.OwnerOf(sets, s => s.Macros, macros[i])?.Name, @@ -484,7 +487,7 @@ internal static List HotkeysColumn( lines.Add(string.Empty); lines.AddRange(ScreenChrome.Buttons( - Buttons(sets, selected), cursor, 0, macros.Count, width)); + Buttons(keys, sets, selected), cursor, 0, macros.Count, width)); return ScreenChrome.Choices(lines, cursor.Edit, width); } @@ -533,6 +536,7 @@ private static string NumpadCell(int digit, IReadOnlyList macros, int wid /// /// private static string Hotkey( + HostKeys keys, Macro macro, IReadOnlyList macros, string? setName, @@ -541,8 +545,8 @@ private static string Hotkey( ScreenFieldEdit? key, ScreenFieldEdit? set) { - var verdict = MacroKeys.Verdict(macro.Key); - var clash = KeyClashes.For(macro, macros); + var verdict = MacroKeys.Verdict(keys, macro.Key); + var clash = KeyClashes.For(keys, macro, macros); var tick = macro.Enabled ? $"[{Accent}]✓[/]" : "[dim]·[/]"; // A clash is marked inside the key's own well, where the ▲ already goes, so it costs the row no @@ -588,11 +592,11 @@ private static string Caveat(MacroKeyVerdict verdict) => /// count, though, is the one thing neither the rows nor the footer can say: how much of this list is /// scenery. /// - private static string DeadCount(IReadOnlyList macros) + private static string DeadCount(HostKeys keys, IReadOnlyList macros) { var dead = macros.Count(m => - !MacroKeys.Verdict(m.Key).Fires || KeyClashes.For(m, macros) is { Kind: KeyClashKind.Shadowed }); - var hiding = macros.Count(m => KeyClashes.For(m, macros) is { Kind: KeyClashKind.BindingWins }); + !MacroKeys.Verdict(keys, m.Key).Fires || KeyClashes.For(keys, m, macros) is { Kind: KeyClashKind.Shadowed }); + var hiding = macros.Count(m => KeyClashes.For(keys, m, macros) is { Kind: KeyClashKind.BindingWins }); var caption = dead == 0 ? string.Empty : $" [{Muted}]▲ {dead} of {macros.Count} cannot fire[/]"; return hiding == 0 ? caption : caption + $" [{Caution}]△ {hiding} hide a client key[/]"; } diff --git a/src/SharpMUTerm.Tui/KeypadScreenView.cs b/src/SharpMUTerm.Tui/KeypadScreenView.cs index e1e83dd6..ec9a55da 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenView.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenView.cs @@ -22,6 +22,7 @@ namespace SharpMUTerm.Tui; internal static class KeypadScreenView { public static IWindowControl Build( + HostKeys keys, IReadOnlyList macros, IReadOnlyList sets, int selected, @@ -31,10 +32,10 @@ public static IWindowControl Build( int height = 0) { var header = ScreenChrome.Band( - KeypadScreenRenderer.HeaderLine(width, KeypadScreenRenderer.Model(macros, sets, selected), focus), + KeypadScreenRenderer.HeaderLine(width, KeypadScreenRenderer.Model(keys, macros, sets, selected), focus), ScreenPalette.HeaderBg, scheme); var footer = ScreenChrome.Band( - KeypadScreenRenderer.FooterLine(macros, width, focus, selected), ScreenPalette.FooterBg, scheme); + KeypadScreenRenderer.FooterLine(keys, macros, width, focus, selected), ScreenPalette.FooterBg, scheme); // While a key capture is armed the binding row swaps its key well for a prompt twice the width, // so the list asks for more and the diagram gives it up for as long as the prompt is up. The @@ -47,7 +48,7 @@ public static IWindowControl Build( { // The diagram is a picture of the bindings the list already holds, so a narrow screen drops it // and keeps the list, which is where every key on this screen acts. - var only = KeypadScreenRenderer.HotkeysColumn(macros, focus, sets, selected, width); + var only = KeypadScreenRenderer.HotkeysColumn(keys, macros, focus, sets, selected, width); return ScreenChrome.Single( header, footer, ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(only, rows))), only.Count, rows); @@ -58,9 +59,9 @@ public static IWindowControl Build( KeypadScreenRenderer.NumpadWidth(macros), KeypadScreenRenderer.MinNumpadWidth, hotkeysMinimum); - var left = KeypadScreenRenderer.NumpadColumn(macros, numpad); + var left = KeypadScreenRenderer.NumpadColumn(keys, macros, numpad); var right = KeypadScreenRenderer.HotkeysColumn( - macros, focus, sets, selected, width <= 0 ? numpad : width - numpad - ScreenChrome.ColumnDivider); + keys, macros, focus, sets, selected, width <= 0 ? numpad : width - numpad - ScreenChrome.ColumnDivider); var numpadCol = ScreenChrome.Stretch(ScreenChrome.Panel(ScreenChrome.Window(left, rows), scheme)); var hotkeysCol = ScreenChrome.Stretch( diff --git a/src/SharpMUTerm.Tui/MacroKeys.cs b/src/SharpMUTerm.Tui/MacroKeys.cs index 3f5f0b91..cbf62d69 100644 --- a/src/SharpMUTerm.Tui/MacroKeys.cs +++ b/src/SharpMUTerm.Tui/MacroKeys.cs @@ -281,10 +281,9 @@ void Add(string key, bool ctrl, bool alt, bool shift, string does) => /// test rather than trusted — a list of candidates that drifted from the verdicts would hand out /// keys that cannot be reached, which is the exact defect it exists to prevent. /// - internal static IReadOnlyList Bindable { get; } = BuildBindable(); - - private static List BuildBindable() + internal static IReadOnlyList Bindable(HostKeys keys) { + ArgumentNullException.ThrowIfNull(keys); var candidates = new List(); for (var f = 1; f <= 12; f++) { @@ -296,7 +295,7 @@ private static List BuildBindable() candidates.Add(MacroKey.Describe($"F{f}", ctrl: true)); } - return candidates.FindAll(c => Verdict(c).Fires); + return candidates.FindAll(c => Verdict(keys, c).Fires); } /// @@ -305,21 +304,36 @@ private static List BuildBindable() /// filtered by so that the rows F4 draws as live are /// precisely the ones this returns for. /// - internal static string? Descriptor(ConsoleKeyInfo key) => - Capture(key) is { } descriptor && Verdict(descriptor).Fires ? descriptor : null; + internal static string? Descriptor(HostKeys keys, ConsoleKeyInfo key) => + Capture(key) is { } descriptor && Verdict(keys, descriptor).Fires ? descriptor : null; /// - /// What a stored descriptor is worth on this host. Every answer is a fact about the parser, the app's - /// own shortcuts, or the prompt — never a guess — and the reason is short enough to print on the - /// binding's own row. + /// What a stored descriptor is worth on the host whose keys are . Every answer is a + /// fact about the host's input (what its terminal writes, or what its window reports), the chords the host + /// keeps, the app's own shortcuts, or the prompt — never a guess — and the reason is short enough to print on + /// the binding's own row. The terminal and the window differ: in a window ⌃digit, ⌃⇧letter and ⌥O arrive, and + /// ⌥⏎ never reaches the client at all. /// - internal static MacroKeyVerdict Verdict(string? descriptor) + internal static MacroKeyVerdict Verdict(HostKeys keys, string? descriptor) { + ArgumentNullException.ThrowIfNull(keys); if (!MacroKey.TryParse(descriptor, out var parts)) { return Never("not a key this client knows"); } + // The host acts on these before the client sees the key, so nothing the client holds can outrank them. + if (keys.ReservedFor(parts) is { } reserved) + { + return new MacroKeyVerdict(MacroKeyDelivery.Taken, $"{reserved.Chord.Glyph} {reserved.Action}"); + } + + if (keys.IsNewline(parts)) + { + return new MacroKeyVerdict(MacroKeyDelivery.Taken, $"{keys.Newline.Glyph} is the newline"); + } + + var whole = keys.ReportsChordsWhole; var canonical = MacroKey.Describe(parts.Key, parts.Ctrl, parts.Alt, parts.Shift); if (Claimed.TryGetValue(canonical, out var does)) { @@ -336,7 +350,8 @@ internal static MacroKeyVerdict Verdict(string? descriptor) if (parts.Ctrl && parts.Alt) { - return Never("Ctrl+Alt arrives as two keys"); + // A window hands Ctrl+Alt to the keyboard layout as AltGr, which types a character instead. + return Never(whole ? "Ctrl+Alt is AltGr here: it types a character" : "Ctrl+Alt arrives as two keys"); } if (IsFunction(parts.Key)) @@ -346,7 +361,7 @@ internal static MacroKeyVerdict Verdict(string? descriptor) if (IsLetter(parts.Key) || IsDigit(parts.Key)) { - return Chord(parts); + return Chord(parts, whole); } if (Navigation.Contains(parts.Key)) @@ -358,7 +373,7 @@ internal static MacroKeyVerdict Verdict(string? descriptor) // the pane-resize chord was on it, was reported dead, and moved to Alt+Shift because of this. // The vertical pair is not listed: kitty_mod+up/down is scroll_line_up/down, which returns // "passthrough" while the alternate screen is up, so those do arrive. - if (parts.Ctrl && parts.Shift && !parts.Alt && parts.Key is "Left" or "Right") + if (!whole && parts.Ctrl && parts.Shift && !parts.Alt && parts.Key is "Left" or "Right") { return Never("the terminal keeps ⌃⇧←/→ for its tabs"); } @@ -372,7 +387,8 @@ internal static MacroKeyVerdict Verdict(string? descriptor) // letter, and it is here rather than in Chord() because Chord() only sees letters and digits. if (parts.Ctrl && ControlBytes.TryGetValue(parts.Key, out var spentOn)) { - return Never($"the terminal sends {spentOn} instead"); + // A window reports ⌃Tab as itself. + return whole ? new MacroKeyVerdict(MacroKeyDelivery.Fires) : Never($"the terminal sends {spentOn} instead"); } return Never("only F-keys and Ctrl/Alt chords arrive"); @@ -387,13 +403,19 @@ internal static MacroKeyVerdict Verdict(string? descriptor) /// which is why the window-jump chords are on it — then reports ⌥1–⌥9 as /// taken through , and ⌥0 stays free for a macro. /// - private static MacroKeyVerdict Chord(MacroKeyParts parts) + private static MacroKeyVerdict Chord(MacroKeyParts parts, bool whole) { if (!parts.Ctrl && !parts.Alt) { return new MacroKeyVerdict(MacroKeyDelivery.Taken, "plain keys type into the prompt"); } + // A window reports the key and its modifiers as pressed: no control byte, no ESC prefix, no SS3. + if (whole) + { + return new MacroKeyVerdict(MacroKeyDelivery.Fires); + } + if (parts.Ctrl) { if (parts.Shift) @@ -498,6 +520,9 @@ private static Dictionary BuildClaims() return claims; } + /// The descriptor name of a , or null (see ). + internal static string? NameOf(ConsoleKey key) => Name(key); + /// /// The descriptor name of a , or null for one a binding cannot be written /// for. It is deliberately wider than what will accept — the numpad keys have diff --git a/src/SharpMUTerm.Tui/MapRenderer.cs b/src/SharpMUTerm.Tui/MapRenderer.cs index ff701cda..5349cc17 100644 --- a/src/SharpMUTerm.Tui/MapRenderer.cs +++ b/src/SharpMUTerm.Tui/MapRenderer.cs @@ -1,5 +1,6 @@ using System.Globalization; using System.Text; +using SharpMUTerm.Client.Panels; using SharpMUTerm.Core.Mapping; namespace SharpMUTerm.Tui; @@ -55,9 +56,8 @@ private enum Kind : null; /// - /// The map as rows at most, each at most cells. The first - /// row is the title; the rest is the grid around . With no current room the map is - /// drawn around the lowest-numbered room, and an empty map says so. + /// The map as rows at most, each at most cells, around + /// ; see the overload that takes a , which this builds. /// internal static List Render( WorldMap map, @@ -66,14 +66,23 @@ internal static List Render( int width, int height, Ink ink, - string? walking = null) + string? walking = null) => + Render(MapViewModel.From(map, current, ahead, walking), map, width, height, ink); + + /// + /// The map as rows at most, each at most cells. The first + /// row is the title; the rest is the grid. Where, which level, who is where and whether a walk is under way + /// are the view's (the model the window's native map is drawn from), so the two cannot centre on different + /// rooms or title different areas. Only the exits' geometry (directions, stubs, ways off the level), which the + /// view does not carry, is read from . An empty map says so. + /// + internal static List Render(MapViewModel view, WorldMap map, int width, int height, Ink ink) { width = Math.Max(1, width); height = Math.Max(1, height); var lines = new List(); - var centre = current is { } c ? map.Room(c) : null; - centre ??= map.Rooms.Values.OrderBy(r => r.Id).FirstOrDefault(); + var centre = view.AnchorId is { } anchor ? map.Room(anchor) : null; if (centre is null) { lines.Add(Title("Map · nothing mapped yet", width, ink)); @@ -81,15 +90,16 @@ internal static List Render( return lines.Take(height).ToList(); } - var area = centre.AreaId is { } a && map.Areas.TryGetValue(a, out var found) ? found.Name : null; + var current = view.Current?.Id; + var ahead = view.Rooms.Where(r => r.Ahead).Select(r => r.Id); var title = new StringBuilder("Map"); - if (!string.IsNullOrWhiteSpace(area)) + if (!string.IsNullOrWhiteSpace(view.Area)) { - title.Append(" · ").Append(area); + title.Append(" · ").Append(view.Area); } - title.Append(" · z ").Append(centre.Z.ToString(CultureInfo.InvariantCulture)); - if (walking is not null) + title.Append(" · z ").Append(view.Level.ToString(CultureInfo.InvariantCulture)); + if (view.Walking is { } walking) { title.Append(" · ").Append(walking); } diff --git a/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs b/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs index a8165981..d6291aad 100644 --- a/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs @@ -17,6 +17,9 @@ internal static class QuickBarRenderer /// The scheme an entry's link carries, followed by its index in the list drawn. internal const string LinkPrefix = "mux:quick:"; + /// The hint's link: a click opens the F4 screen (), as the window's does. + internal const string EditLink = LinkPrefix + "edit"; + /// The longest a macro's name is drawn before it is cut. internal const int MaxNameWidth = 16; @@ -27,7 +30,7 @@ internal static class QuickBarRenderer /// The function-key bindings to show, from the bindings that resolve: one per key, plain keys before modified /// ones, then by number. A binding with neither a command nor a script is left out, as the key path leaves it. /// - internal static QuickBarModel Entries(IEnumerable macros, Func resolve) + internal static QuickBarModel Entries(HostKeys keys, IEnumerable macros, Func resolve) { var seen = new HashSet(StringComparer.OrdinalIgnoreCase); var entries = new List<(QuickBarItem Entry, int Modifiers, int Number)>(); @@ -56,7 +59,7 @@ internal static QuickBarModel Entries(IEnumerable macros, Func e.Modifiers).ThenBy(e => e.Number).Select(e => e.Entry).ToList()); @@ -67,7 +70,7 @@ internal static string Render(QuickBarModel model, int width, string accent) { var entries = model.Items; width = Math.Max(1, width); - var hint = $"[bold {accent}]{QuickBarModel.EditKey}[/][dim]{QuickBarModel.EditHint[QuickBarModel.EditKey.Length..]}[/]"; + var hint = $"[link={EditLink}][bold {accent}]{QuickBarModel.EditKey}[/][dim]{QuickBarModel.EditHint[QuickBarModel.EditKey.Length..]}[/][/]"; if (entries.Count == 0) { return ElideVisible($"[dim]{QuickBarModel.EmptyText} · [/]{hint}", width); diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index f433d34d..1e6c56b3 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -202,10 +202,18 @@ internal sealed record PanelInk(string Bar, string Low, string Track); /// The key that does the same, for the tooltip. /// /// Builds the menu; safe to call from any thread. The client builds it on its own thread and hands it to the -/// callback there, so a host marshals in the callback itself. Each entry's is -/// already marshalled. +/// callback there, so a host marshals in the callback itself. /// -internal sealed record HeaderAction(string Id, string Label, string? Hint, Action>> Menu) +/// +/// Runs an entry by the command id the menu carried; safe to call from any thread. An id the last menu built did +/// not offer is refused, so a host can choose an entry and never name a command of its own. +/// +internal sealed record HeaderAction( + string Id, + string Label, + string? Hint, + Action> Menu, + Action Dispatch) { /// The layouts button: built-in and saved layouts, save, and a default for a world or a character. public const string LayoutsId = "layouts"; diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs index 9c3a2b4e..f062d66f 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -37,11 +37,19 @@ internal sealed partial class SharpMUTermApp /// The one command callback every native panel is handed. private Action? _panelDispatch; + /// The Layouts menu the client last built, so a command handed back can be checked against it. + private MenuModel _layoutsMenuOffered = MenuModel.Empty; + /// Tells the host which header buttons it may draw. Once, at construction. private void AnnounceHeaderActions() => _pointer?.HeaderActions( [ - new HeaderAction(HeaderAction.LayoutsId, "Layouts", "⌥M", show => OnUiThread(() => show(LayoutsMenuItems()))), + new HeaderAction( + HeaderAction.LayoutsId, + "Layouts", + "⌥M", + show => OnUiThread(() => show(_layoutsMenuOffered = LayoutsMenu())), + id => OnUiThread(() => RunLayoutsMenuEntry(id))), ]); /// The layout the focused character's panes show, or would get. @@ -52,54 +60,72 @@ private string LayoutInUse(string key) => /// /// The window's Layouts menu: the built-ins, then the player's, the one in use checked; then the list's - /// actions on the layout in use; then the list itself. Every entry dispatches a command id. + /// actions on the layout in use; then the list itself. Every entry names a command id the registry runs. /// Internal for tests. /// - internal IReadOnlyList LayoutsMenuItems() + internal MenuModel LayoutsMenu() { - Action Dispatch(string id) => () => OnUiThread(() => DispatchCommand(id)); - var items = new List(); + var entries = new List(); if (LayoutsKey() is not { } key) { - items.Add(new PointerMenuItem("No character here — a layout belongs to a character", null, () => { }, Enabled: false)); - items.Add(PointerMenuItem.Separator); - items.Add(new PointerMenuItem("Manage layouts…", "⌥M", Dispatch("layout:layouts"))); - return items; + entries.Add(new MenuEntry("No character here — a layout belongs to a character", null, null, Enabled: false)); + entries.Add(MenuEntry.Separator); + entries.Add(new MenuEntry("Manage layouts…", "⌥M", LayoutCommands.Manage)); + return new MenuModel(entries); } var inUse = LayoutInUse(key); var all = Layouts.All; foreach (var layout in all.Where(l => l.IsBuiltIn)) { - items.Add(new PointerMenuItem(Snippet(layout.Name), null, Dispatch(LayoutCommands.Apply(layout.Id)), Checked: layout.Id == inUse)); + entries.Add(new MenuEntry(Snippet(layout.Name), null, LayoutCommands.Apply(layout.Id), Checked: layout.Id == inUse)); } var own = all.Where(l => !l.IsBuiltIn).ToList(); if (own.Count > 0) { - items.Add(PointerMenuItem.Separator); + entries.Add(MenuEntry.Separator); foreach (var layout in own) { - items.Add(new PointerMenuItem(Snippet(layout.Name), null, Dispatch(LayoutCommands.Apply(layout.Id)), Checked: layout.Id == inUse)); + entries.Add(new MenuEntry(Snippet(layout.Name), null, LayoutCommands.Apply(layout.Id), Checked: layout.Id == inUse)); } } var (world, character) = LayoutOwner(key); - items.Add(PointerMenuItem.Separator); - items.Add(new PointerMenuItem("Save changes", null, Dispatch(LayoutCommands.SaveChanges))); - items.Add(new PointerMenuItem("Save as new", null, Dispatch(LayoutCommands.SaveAsNew))); - items.Add(new PointerMenuItem( - world is null ? "Use for this world" : $"Use for {Snippet(world.Name)}", null, Dispatch(LayoutCommands.UseForWorld), Enabled: world is not null)); - items.Add(new PointerMenuItem( + entries.Add(MenuEntry.Separator); + entries.Add(new MenuEntry("Save changes", null, LayoutCommands.SaveChanges)); + entries.Add(new MenuEntry("Save as new", null, LayoutCommands.SaveAsNew)); + entries.Add(new MenuEntry( + world is null ? "Use for this world" : $"Use for {Snippet(world.Name)}", null, LayoutCommands.UseForWorld, Enabled: world is not null)); + entries.Add(new MenuEntry( character is null ? "Use for this character only" : $"Use for {Snippet(character.Name)} only", null, - Dispatch(LayoutCommands.UseForCharacter), + LayoutCommands.UseForCharacter, Enabled: character is not null)); - items.Add(PointerMenuItem.Separator); - items.Add(new PointerMenuItem("Manage layouts…", "⌥M", Dispatch("layout:layouts"))); - return items; + entries.Add(MenuEntry.Separator); + entries.Add(new MenuEntry("Manage layouts…", "⌥M", LayoutCommands.Manage)); + return new MenuModel(entries); } + /// + /// An entry chosen from the window's Layouts menu, by the command id the client put in it. A command the menu last + /// built did not offer is refused, the chrome's rule: the host hands back a choice, never a command of its own. + /// Internal so a test can drive it as the window does. + /// + internal bool RunLayoutsMenuEntry(string id) + { + if (!_layoutsMenuOffered.Commands().Contains(id, StringComparer.Ordinal)) + { + RefuseCommand($"the Layouts menu never offered {Snippet(id)}"); + return false; + } + + return DispatchCommand(id); + } + + /// Builds the Layouts menu as the header button does, and remembers it as offered. Internal for tests. + internal MenuModel OfferLayoutsMenu() => _layoutsMenuOffered = LayoutsMenu(); + /// /// A layout-library command (), for the focused character: the ⌥M list's own /// methods, with what they did said in a notice rather than in the list's status line. diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs new file mode 100644 index 00000000..388e3f43 --- /dev/null +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs @@ -0,0 +1,63 @@ +using SharpMUTerm.Client.Surfaces; + +namespace SharpMUTerm.Tui; + +/// +/// The model each declared surface's cells were last drawn from (), by surface and by +/// window. The cell renderers record what they were handed; the window suite compares it with what the host was +/// told in the same frame, so a native view drawn from anything but the model the cells drew fails a test rather +/// than drifting. +/// +internal sealed partial class SharpMUTermApp +{ + private readonly Dictionary<(string Surface, string Key), object> _drawnModels = new(); + + /// Records as the one 's cells are about to draw. + private T Drawing(string surface, string key, T model) + where T : notnull + { + _drawnModels[(surface, key)] = model; + return model; + } + + /// + /// The model a surface's cells were last drawn from: is the window id for a panel, empty + /// for the header and the sidebar. Null when they have not been drawn. Internal for tests. + /// + internal object? DrawnModel(string surface, string key = "") => + surface == SurfaceCatalog.Palette ? (_palette.IsOpen ? _palette.View : null) + : surface == SurfaceCatalog.Prefix ? (_prefixPanel.IsOpen ? _prefixPanel.Drawn : null) + : _drawnModels.TryGetValue((surface, key), out var model) ? model : null; + + /// A click on a header link, as the header's own handler receives it. + internal void SimulateHeaderLink(string url) => OnChromeLinkClicked(url); + + /// The notice on the status row right now, as markup, or null; for a test comparing two paths' outcomes. + internal string? LastNotice => _notice; + + /// Each session's walk — under way or not, and the rooms still ahead — for a test comparing two paths. + internal string WalkState => string.Join( + ";", + _recorders.Select(r => (r.Key.SessionKey, r.Value)) + .Concat(_demoMap is null ? [] : [(DemoScene.ActiveSessionKey, _demoMap)]) + .Select(r => $"{r.Item1}:{r.Item2.Walk.IsWalking}:{string.Join('/', r.Item2.Walk.RoomsAhead)}") + .Order(StringComparer.Ordinal)); + + /// Types into the open cell palette, as if it had been keyed in. + internal void SimulateCellPaletteQuery(string query) => _palette.SetQuery(query); + + /// + /// Types into the open cell palette and commits the entry with , as + /// arrows and ⏎ would. False when the palette is closed or does not list it. + /// + internal bool SimulateCellPaletteChoice(string query, string id) + { + if (!_palette.IsOpen) + { + return false; + } + + _palette.SetQuery(query); + return _palette.Choose(id); + } +} diff --git a/src/SharpMUTerm.Tui/PrefixOverlay.cs b/src/SharpMUTerm.Tui/PrefixOverlay.cs index 20ba88b1..00eeec1a 100644 --- a/src/SharpMUTerm.Tui/PrefixOverlay.cs +++ b/src/SharpMUTerm.Tui/PrefixOverlay.cs @@ -67,6 +67,9 @@ public PrefixOverlay(ConsoleWindowSystem system, Func facts, Action /// What the panel is showing — or would show if it opened now — for a headless test to read. internal IReadOnlyList Lines => PrefixPanel.Render(Current); + /// The model the panel was last opened with, for the surface parity test. + internal SharpMUTerm.Client.Chrome.HeaderPrefix? Drawn { get; private set; } + /// The keymap it is drawing, or would draw, availability and all. internal IReadOnlyList Entries => PrefixPanel.Entries(Current); @@ -79,7 +82,8 @@ public void Open() } _current = _facts(); - var lines = PrefixPanel.Render(_current); + Drawn = PrefixPanel.Model(_current); + var lines = PrefixPanel.Render(Drawn); // Hug the content, the way QuitOverlay does. Centred *after* WithSize, because the builder reads // the bounds set so far and falls back to 80x25 otherwise. diff --git a/src/SharpMUTerm.Tui/PrefixPanel.cs b/src/SharpMUTerm.Tui/PrefixPanel.cs index 7664b4dd..5bc803da 100644 --- a/src/SharpMUTerm.Tui/PrefixPanel.cs +++ b/src/SharpMUTerm.Tui/PrefixPanel.cs @@ -170,9 +170,19 @@ internal static IReadOnlyList Entries(PrefixFacts facts) /// The whole panel as markup lines: one row per command, dimmed with its reason where it cannot run, /// then the footer naming the way out. /// - internal static List Render(PrefixFacts facts) + /// + /// The keymap as the shared model both hosts draw: the cell panel here, the window's native header while ⌃B is + /// armed (). + /// + internal static SharpMUTerm.Client.Chrome.HeaderPrefix Model(PrefixFacts facts) => + new([.. Entries(facts).Select(e => new SharpMUTerm.Client.Chrome.HeaderPrefixKey(e.Keys, e.Title, e.Blocked))], Footer); + + internal static List Render(PrefixFacts facts) => Render(Model(facts)); + + /// Builds the panel's lines from and nothing else. + internal static List Render(SharpMUTerm.Client.Chrome.HeaderPrefix model) { - var entries = Entries(facts); + var entries = model.Keys; var keyColumn = entries.Max(e => e.Keys.Length); var titleColumn = entries.Max(e => e.Title.Length); @@ -192,7 +202,7 @@ internal static List Render(PrefixFacts facts) } lines.Add(string.Empty); - lines.Add($" [{Label}]{Escape(Footer)}[/]"); + lines.Add($" [{Label}]{Escape(model.Exit)}[/]"); return lines; } diff --git a/src/SharpMUTerm.Tui/RailRenderer.cs b/src/SharpMUTerm.Tui/RailRenderer.cs index 1da5ddc2..fe03f7cf 100644 --- a/src/SharpMUTerm.Tui/RailRenderer.cs +++ b/src/SharpMUTerm.Tui/RailRenderer.cs @@ -1,4 +1,5 @@ using SharpConsoleUI.Parsing; +using SharpMUTerm.Client.Chrome; using SharpMUTerm.Core.Text; using SharpMUTerm.Core.Workspaces; using static SharpMUTerm.Tui.MarkupText; @@ -19,6 +20,16 @@ namespace SharpMUTerm.Tui; /// internal static class RailRenderer { + /// + /// The sidebar's cells, drawn from the model the window's native sidebar is drawn from: the collapsed strip + /// when the model says collapsed, else the full rail fitted to . + /// + public static List Render(SidebarModel model, int maxWidth, ChromeInk? ink) + { + ArgumentNullException.ThrowIfNull(model); + var rows = model.Rows(); + return model.Collapsed ? RenderCollapsed(rows, ink) : Render(rows, maxWidth, ink); + } /// The rail's rows, as projects them. /// diff --git a/src/SharpMUTerm.Tui/ScreenField.cs b/src/SharpMUTerm.Tui/ScreenField.cs index 7df78259..5e9435f2 100644 --- a/src/SharpMUTerm.Tui/ScreenField.cs +++ b/src/SharpMUTerm.Tui/ScreenField.cs @@ -768,7 +768,7 @@ internal static ScreenField Enumeration(string label, Func get, Ac /// /// Names the binding already holding a descriptor, or null when it is free. internal static ScreenField Key( - string label, Func get, Action set, Func taken) + HostKeys keys, string label, Func get, Action set, Func taken) { ArgumentNullException.ThrowIfNull(get); ArgumentNullException.ThrowIfNull(set); @@ -777,7 +777,7 @@ internal static ScreenField Key( return new ScreenField( label, get, - value => MacroKeys.Verdict(value) is { Fires: false } verdict ? verdict.Reason : taken(value), + value => MacroKeys.Verdict(keys, value) is { Fires: false } verdict ? verdict.Reason : taken(value), value => set(MacroKey.Canonicalise(value) ?? value.Trim()), Capture: true); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index b564e791..3747e134 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -97,7 +97,7 @@ private IWindowControl NewWhoHerePanel(TerminalPanelContext context) IReadOnlyList drawn = []; var view = NewPanelView(context, (width, height) => { - var model = ReadWhoHere(context.SessionKey); + var model = Drawing(PanelIds.WhoHere, context.WindowId, ReadWhoHere(context.SessionKey)); drawn = model.Rows; return WhoHereRenderer.Render(model, width, height, new WhoHereRenderer.Ink(_ink.Accent)); }); @@ -178,7 +178,7 @@ private IWindowControl NewVitalsPanel(TerminalPanelContext context) return ["[dim]No vitals: this character is not connected.[/]"]; } - var strip = VitalsStripRenderer.Render(vitals, width, VitalsInk()); + var strip = VitalsStripRenderer.Render(Drawing(PanelIds.Vitals, context.WindowId, vitals), width, VitalsInk()); return [strip.Length > 0 ? strip : "[dim]No vitals yet — the game has sent none of the meters F7 names.[/]"]; }); @@ -222,13 +222,17 @@ private IWindowControl NewQuickBarPanel(TerminalPanelContext context) IReadOnlyList drawn = []; var view = NewPanelView(context, (width, _) => { - var model = QuickBarEntries(context.SessionKey); + var model = Drawing(PanelIds.QuickBar, context.WindowId, QuickBarEntries(context.SessionKey)); drawn = model.Items; return [QuickBarRenderer.Render(model, width, _ink.Accent)]; }); view.Click = url => { - if (QuickBarRenderer.ParseLink(url) is { } index && index < drawn.Count) + if (url == QuickBarRenderer.EditLink) + { + DispatchCommand(QuickBarModel.EditCommand); + } + else if (QuickBarRenderer.ParseLink(url) is { } index && index < drawn.Count) { RunQuickMacro(context.SessionKey, drawn[index].Descriptor); } @@ -244,7 +248,7 @@ internal QuickBarModel QuickBarEntries(string sessionKey) { if (FindSession(sessionKey) is { } session) { - return QuickBarRenderer.Entries(session.Macros.Macros, session.Macros.Resolve); + return QuickBarRenderer.Entries(Host.Keys, session.Macros.Macros, session.Macros.Resolve); } if (FindCharacter(sessionKey) is not { } found) @@ -253,7 +257,7 @@ internal QuickBarModel QuickBarEntries(string sessionKey) } var macros = _config.ResolveTriggerSets(found.Character, found.World).SelectMany(s => s.Macros).ToList(); - return QuickBarRenderer.Entries(macros, key => macros.FirstOrDefault( + return QuickBarRenderer.Entries(Host.Keys, macros, key => macros.FirstOrDefault( m => string.Equals(MacroKey.Canonicalise(m.Key), key, StringComparison.OrdinalIgnoreCase)) is { Enabled: true } m ? m : null); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 3dbf8201..e7f81a73 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.Logging; using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Palette; +using SharpMUTerm.Client.Surfaces; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; @@ -7508,10 +7509,11 @@ private ScreenBinding AliasesScreen() private ScreenBinding KeypadScreen() { var session = new SettingsSession(selection => - KeypadScreenRenderer.Model(Macros(), _config.TriggerSets, selection.SelectionIn(0)), + KeypadScreenRenderer.Model(Host.Keys, Macros(), _config.TriggerSets, selection.SelectionIn(0)), SaveConfiguration); return new ScreenBinding(session, () => KeypadScreenView.Build( + Host.Keys, Macros(), _config.TriggerSets, session.Selection.SelectionIn(0), @@ -8083,7 +8085,7 @@ private CommandContext CommandState() Sound: CanPlaySound ? !_muted : null, Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId()), OutputSelected: HasOutputSelection, - KeyClashes: KeyClashes.Count(Macros())); + KeyClashes: KeyClashes.Count(Host.Keys, Macros())); } /// @@ -8472,6 +8474,9 @@ private bool RunBuiltInCommand(string id) case "layout:next-tab": NextWindow(); // refuses out loud on a pane with one tab, the same as the chord does return true; + case "layout:toggle-rail": + ToggleRail(); // ⌃B b's fold, and the window sidebar's fold button + return true; case "term:newline": // The same edit Alt+⏎ makes, through the same key table, so the surface cannot drift from // the chord it advertises. @@ -8872,10 +8877,13 @@ private void RenderMap(string windowId) return; } + // One model per drawing, and the window's native map is handed this same instance (MapViewFor), so the two + // cannot disagree about where the character is, which level is shown or whether a walk is under way. var walking = map.Walk.IsWalking ? $"walking, {map.Walk.Remaining} to go" : null; + var view = Drawing(Core.Layouts.PanelIds.Map, windowId, SharpMUTerm.Client.Panels.MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking)); + _mapViews[windowId] = (_mapRevisions[windowId], view); var ink = new MapRenderer.Ink(_ink.Accent, _ink.Accent, _ink.Notice, _ink.Draft); - var lines = MapRenderer.Render( - map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, width, height, ink, walking); + var lines = MapRenderer.Render(view, map.Map, width, height, ink); _mapMarkup[windowId] = lines; control.SetContent(lines.ToList()); } @@ -10619,10 +10627,7 @@ private void RefreshPaneFocus() /// private List RenderRailLines() { - var rows = BuildRail(); - return _railCollapsed - ? RailRenderer.RenderCollapsed(rows, _ink) - : RailRenderer.Render(rows, RailMaxWidth - RailMargin, _ink); + return RailRenderer.Render(Drawing(SurfaceCatalog.Sidebar, string.Empty, BuildSidebar()), RailMaxWidth - RailMargin, _ink); } /// @@ -11946,7 +11951,7 @@ private void SplitFocusedPane(PaneCommand command) // The focused window's session, not _active: a macro key is a keystroke, and a keystroke may not // reach a world other than the one whose pane is focused (see SendTarget). A pane with no // connection fires no macro and the key falls through the rest of the chain unclaimed. - if (SendTarget() is not { } session || MacroKeys.Descriptor(key) is not { } descriptor) + if (SendTarget() is not { } session || MacroKeys.Descriptor(Host.Keys, key) is not { } descriptor) { return null; } @@ -13402,17 +13407,15 @@ internal HeaderModel BuildHeaderModel() HeaderLogFormat(), _prefixArmed) { - Prefix = _prefixArmed - ? new HeaderPrefix( - [.. PrefixPanel.Entries(PrefixFactsNow()).Select(e => new HeaderPrefixKey(e.Keys, e.Title, e.Blocked))], - "Esc cancels") - : null, + Prefix = _prefixArmed ? PrefixPanel.Model(PrefixFactsNow()) : null, }; } /// The header row's markup, drawn from and nothing else it could disagree with. private string HeaderMarkup(HeaderModel model) { + Drawing(SurfaceCatalog.Header, string.Empty, model); + // The menu affordance opens the command surface (caret flips to ▾ while it's open). The whole // identity cluster is a powerline ribbon — menu ▸ world ▸ character — flowing accent colours. var caret = model.MenuOpen ? "▾" : Glyphs.Menu; diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs index 5fbaa577..12a3e0f6 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -71,7 +71,7 @@ public async Task TheLayoutsMenuIsTheLayoutLibraryWithTheOneInUseChecked() await using var app = InlineWindowApp(driver); app.RenderSnapshot("layout-combat"); - var items = app.LayoutsMenuItems(); + var items = app.OfferLayoutsMenu().Entries; var labels = items.Where(i => !i.IsSeparator).Select(i => i.Label).ToArray(); await Assert.That(labels).Contains("Roleplay"); await Assert.That(labels).Contains("Combat"); @@ -83,9 +83,12 @@ public async Task TheLayoutsMenuIsTheLayoutLibraryWithTheOneInUseChecked() await Assert.That(items.Single(i => i.Checked).Label).IsEqualTo("Combat"); // Choosing an entry runs the command, through the registry, that the ⌥M list's ⏎ runs. - items.Single(i => i.Label == "Roleplay").Run(); + await Assert.That(app.RunLayoutsMenuEntry(items.Single(i => i.Label == "Roleplay").Command!)).IsTrue(); await Assert.That(app.LiveLayoutId).IsEqualTo(BuiltInLayouts.RoleplayId); - await Assert.That(app.LayoutsMenuItems().Single(i => i.Checked).Label).IsEqualTo("Roleplay"); + await Assert.That(app.LayoutsMenu().Entries.Single(i => i.Checked).Label).IsEqualTo("Roleplay"); + + // A command the menu did not offer is refused: the window chooses an entry, it never names a command. + await Assert.That(app.RunLayoutsMenuEntry("term:quit")).IsFalse(); } [Test] @@ -120,7 +123,7 @@ public async Task ThePressOnTheLayoutsButtonNeverReachesTheClientAndOpensTheClie Offer(driver, show => { asked++; - show([new PointerMenuItem("Combat", null, () => { }, Checked: true), PointerMenuItem.Separator, new PointerMenuItem("Manage layouts…", "⌥M", () => { })]); + show(new MenuModel([new MenuEntry("Combat", null, "layout:lib:apply:combat", Checked: true), MenuEntry.Separator, new MenuEntry("Manage layouts…", "⌥M", LayoutCommands.Manage)])); }); var clientSaw = new List>(); driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); @@ -319,9 +322,9 @@ internal static SharpMUTermApp InlineWindowApp(AvaloniaConsoleDriver driver) => RunsInline = true, }); - private static void Offer(AvaloniaConsoleDriver driver, Action>> menu) + private static void Offer(AvaloniaConsoleDriver driver, Action> menu, Action? dispatch = null) { - ((IPointerPresenter)driver.Pointer).HeaderActions([new HeaderAction(HeaderAction.LayoutsId, "Layouts", "⌥M", menu)]); + ((IPointerPresenter)driver.Pointer).HeaderActions([new HeaderAction(HeaderAction.LayoutsId, "Layouts", "⌥M", menu, dispatch ?? (_ => { }))]); Drain(); } diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs new file mode 100644 index 00000000..ad1fa43e --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -0,0 +1,467 @@ +using System.Reflection; +using Avalonia.Controls; +using Avalonia.Input; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Tui; +using SharpMUTerm.Tui.Panels; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's half of the surface catalog (): every native view the window draws is a +/// declared surface, is handed that surface's model, is handed the very model the cells drew in the same frame, and +/// every click on it ends where the matching cell click ends. The terminal's half is SurfaceCellTests. +/// +[NotInParallel] +public class SurfaceParityTests +{ + /// Controls of the window that are the window itself rather than a surface of the client's. + private static readonly HashSet Infrastructure = [typeof(TerminalView), typeof(DesktopLayer), typeof(MainWindow)]; + + private static readonly Assembly Window = typeof(DesktopLayer).Assembly; + + // ── every native view is declared ──────────────────────────────────────────────────────────── + + /// + /// A control the window draws over the cells that no surface declares is a view nobody holds to the cells: it + /// can say what it likes. Found by reflection, so a new one fails here until it is declared. + /// + [Test] + public async Task EveryNativeViewIsADeclaredSurface() + { + var declared = SurfaceCatalog.All.SelectMany(s => s.NativeViews).ToHashSet(StringComparer.Ordinal); + var views = Window.GetTypes() + .Where(t => typeof(Control).IsAssignableFrom(t) && !t.IsAbstract && !Infrastructure.Contains(t)) + .Where(t => !t.IsNested) + .ToList(); + + await Assert.That(views.Count).IsGreaterThan(5).Because("the scan still finds the window's views"); + foreach (var view in views) + { + await Assert.That(declared).Contains(view.FullName!).Because($"{view.Name} draws over the cells and no surface declares it"); + } + + foreach (var name in declared) + { + await Assert.That(Window.GetType(name)).IsNotNull().Because($"{name} is declared and is not a type in the window"); + } + } + + /// + /// Some native view of each surface is handed the surface's model — as a parameter, or inside what it is handed + /// (a property, a list, or a method of it that returns the model) — never state of its own. + /// + [Test] + public async Task ANativeViewOfEachSurfaceReceivesItsModel() + { + foreach (var surface in SurfaceCatalog.All.Where(s => s.HasNative)) + { + var takes = surface.NativeViews + .Select(Window.GetType) + .OfType() + .SelectMany(t => t.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static) + .Cast() + .Concat(t.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))) + .SelectMany(m => m.GetParameters()) + .Any(p => Carries(p.ParameterType, surface.Model)); + await Assert.That(takes).IsTrue().Because($"{surface.Id}: no view of it is handed a {surface.Model.Name}"); + } + } + + private static bool Carries(Type type, Type model) => + type == model + || type.GetProperties().Any(p => p.PropertyType == model || typeof(IEnumerable<>).MakeGenericType(model).IsAssignableFrom(p.PropertyType)) + || type.GetMethods(BindingFlags.Public | BindingFlags.Instance).Any(m => m.ReturnType == model); + + // ── the native model is the model the cells drew ───────────────────────────────────────────── + + /// + /// What the window was told in a frame is what the cells were drawn from in that frame: every panel overlay, the + /// header and the sidebar, the settings window's sections, the Layouts menu and ⌃P. A native view built from a + /// model of its own would fail here before it showed something the terminal does not. + /// + [Test] + public async Task NativeModelsAreTheModelsTheCellsDrew() + { + var covered = new HashSet(StringComparer.Ordinal); + + foreach (var view in new[] { "layout-combat", "layout-roleplay" }) + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot(view); + + foreach (var panel in driver.Pointer.Panels) + { + object? model = (object?)panel.Vitals ?? (object?)panel.Map ?? (object?)panel.WhoHere ?? panel.QuickBar; + if (model is null) + { + continue; + } + + await Assert.That(app.DrawnModel(panel.PanelId, panel.WindowId)).IsEqualTo(model).Because($"{view}: {panel.PanelId}"); + covered.Add(panel.PanelId); + } + + var chrome = driver.Pointer.Chrome; + await Assert.That(chrome).IsNotNull(); + await Assert.That(app.DrawnModel(SurfaceCatalog.Header)).IsEqualTo(chrome!.HeaderModel).Because($"{view}: header"); + await Assert.That(app.DrawnModel(SurfaceCatalog.Sidebar)).IsEqualTo(chrome.Sidebar).Because($"{view}: sidebar"); + covered.Add(SurfaceCatalog.Header); + covered.Add(SurfaceCatalog.Sidebar); + + // The Layouts button's menu is the one the ⌥M commands answer for. + MenuModel? offered = null; + driver.Pointer.Actions.Single(a => a.Id == HeaderAction.LayoutsId).Menu(m => offered = m); + await Assert.That(offered).IsEqualTo(app.LayoutsMenu()).Because($"{view}: layouts menu"); + covered.Add(SurfaceCatalog.LayoutsMenu); + } + + // Settings: the window is handed the sections F7 and F8's cells are drawn from. + { + using var driver = new AvaloniaConsoleDriver(140, 36); + var settings = new FakeSettings(); + await using var app = App(driver, DemoScene.Build(), settings: settings); + app.RenderSnapshot(null); + await Assert.That(app.DispatchCommand("screen:input")).IsTrue(); + await Assert.That(settings.Form).IsNotNull().Because("F8 opens the native settings window"); + await Assert.That(settings.Form!.Sections.SequenceEqual(app.Contributions.SettingsSections.Ordered)).IsTrue(); + covered.Add(SurfaceCatalog.Settings); + } + + // ⌃P: the native palette's rows for a query are the cell palette's rows for it. + foreach (var query in new[] { string.Empty, "split", "tog tim" }) + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + var palette = new FakePalette(); + await using var native = App(nativeDriver, DemoScene.Build(), palette: palette); + native.RenderSnapshot(null); + native.OpenMenu(); + await Assert.That(palette.Session).IsNotNull(); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var cells = App(cellDriver, DemoScene.Build()); + cells.RenderSnapshot(null); + cells.OpenMenu(); + cells.SimulateCellPaletteQuery(query); + + var drawn = (PaletteView?)cells.DrawnModel(SurfaceCatalog.Palette); + await Assert.That(drawn).IsNotNull(); + await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn!), TUnit.Assertions.Enums.CollectionOrdering.Matching) + .Because($"query '{query}'"); + } + + covered.Add(SurfaceCatalog.Palette); + + // ⌃B armed: the window's header lists the keymap the cell panel draws. + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot("prefix-panel"); + var prefix = driver.Pointer.Chrome?.HeaderModel.Prefix; + await Assert.That(prefix).IsNotNull().Because("the native header shows the armed keymap"); + await Assert.That(app.DrawnModel(SurfaceCatalog.Prefix)).IsEqualTo(prefix).Because("prefix"); + covered.Add(SurfaceCatalog.Prefix); + } + + // The folded rail: the window's strip is drawn from the sidebar model the cells drew folded. + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot(null); + await Assert.That(app.DispatchCommand("layout:toggle-rail")).IsTrue(); + app.RenderSnapshot(null); + var sidebar = driver.Pointer.Chrome!.Sidebar; + await Assert.That(sidebar.Collapsed).IsTrue(); + await Assert.That(app.DrawnModel(SurfaceCatalog.Sidebar)).IsEqualTo(sidebar).Because("rail-strip"); + covered.Add(SurfaceCatalog.RailStrip); + } + + var drawnNatively = SurfaceCatalog.All.Where(s => s.On(SurfaceHosts.Window).HasFlag(SurfaceDrawing.Native)).Select(s => s.Id); + await Assert.That(covered).IsEquivalentTo(drawnNatively).Because("every surface the window draws natively has its model compared here"); + } + + private static string[] Rows(PaletteView view) => + view.Rows.Select(r => r is PaletteHeader h ? "# " + h.Label : ((PaletteEntry)r).Item.Id + " " + ((PaletteEntry)r).Item.Key).ToArray(); + + // ── a native action ends where the cell action ends ────────────────────────────────────────── + + /// + /// For each surface, its native action and the matching cell click are run on two clients built alike, and the + /// client's state after each is the same — and is not the state before, so a path that does nothing on both + /// sides does not pass. + /// + [Test] + public async Task ANativeActionEndsWhereTheCellActionEnds() + { + var probed = new HashSet(StringComparer.Ordinal); + + // Header: the search box opens ⌃P; the ☰ link does too. The character click is the sidebar's. + await Same("header: palette", "layout-combat", + (app, _) => app.ActivateChromeTarget(HeaderModel.PaletteTarget), + (app, _) => app.SimulateHeaderLink(HeaderModel.PaletteTarget)); + await Same("header: character", "layout-combat", + (app, _) => app.ActivateChromeTarget(app.BuildChromeOverlay().HeaderModel.Character!.Target), + (app, _) => app.DispatchRailTarget(app.BuildChromeOverlay().HeaderModel.Character!.Target)); + probed.Add(SurfaceCatalog.Header); + + // Sidebar: a window row, and Add a game (⌃P ▸ Welcome in cells). + await Same("sidebar: window", "layout-combat", + (app, _) => app.ActivateChromeTarget(OtherWindow(app)), + (app, _) => app.DispatchRailTarget(OtherWindow(app))); + await Same("sidebar: add a game", "layout-combat", + (app, _) => app.ActivateChromeTarget(SidebarModel.AddGameTarget), + (app, _) => app.DispatchCommand(SidebarModel.AddGameTarget)); + probed.Add(SurfaceCatalog.Sidebar); + + // The folded rail: the strip's fold button, and the ⌃P command beside ⌃B b. + await Same("rail-strip: fold", "layout-combat", + (app, _) => app.ActivateChromeTarget(SidebarModel.CollapseTarget), + (app, _) => app.DispatchCommand("layout:toggle-rail")); + probed.Add(SurfaceCatalog.RailStrip); + + // Map: a room clicked on the canvas and the same room's cell link. + await Same("map: walk", "layout-combat", + (app, d) => Panel(d, PanelIds.Map).WalkTo!(OtherRoom(Panel(d, PanelIds.Map).Map!)), + (app, d) => app.SimulateMapClick(Panel(d, PanelIds.Map).WindowId, MapRenderer.LinkPrefix + OtherRoom(Panel(d, PanelIds.Map).Map!))); + probed.Add(PanelIds.Map); + + // Who is here: the first row. + await Same("who-here: pick", "layout-roleplay", + (app, d) => Panel(d, PanelIds.WhoHere).Pick!(0), + (app, d) => app.SimulatePanelClick(Panel(d, PanelIds.WhoHere).WindowId, WhoHereRenderer.LinkPrefix + "0")); + probed.Add(PanelIds.WhoHere); + + // Quick bar: the first key, and "F4 edits keys". + await Same("quick-bar: pick", "layout-combat", + (app, d) => Panel(d, PanelIds.QuickBar).Pick!(0), + (app, d) => app.SimulatePanelClick(Panel(d, PanelIds.QuickBar).WindowId, QuickBarRenderer.LinkPrefix + "0")); + await Same("quick-bar: edit", "layout-combat", + (app, d) => Panel(d, PanelIds.QuickBar).Dispatch!(QuickBarModel.EditCommand), + (app, d) => app.SimulatePanelClick(Panel(d, PanelIds.QuickBar).WindowId, QuickBarRenderer.EditLink)); + probed.Add(PanelIds.QuickBar); + + // Layouts: choosing Roleplay in the menu, and running the ⌥M list's command for it. + await Same("layouts-menu: apply", "layout-combat", + (app, d) => + { + var action = d.Pointer.Actions.Single(a => a.Id == HeaderAction.LayoutsId); + MenuModel? menu = null; + action.Menu(m => menu = m); + action.Dispatch(menu!.Entries.Single(e => e.Label == "Roleplay").Command!); + }, + (app, _) => app.DispatchCommand(LayoutCommands.Apply(BuiltInLayouts.RoleplayId))); + probed.Add(SurfaceCatalog.LayoutsMenu); + + // Settings: resetting a changed field in the window, and r on the same field of F8's cells. + { + var (nativeEcho, nativeSaves) = SettingsReset(native: true); + var (cellEcho, cellSaves) = SettingsReset(native: false); + await Assert.That(nativeEcho).IsTrue(); + await Assert.That(nativeEcho).IsEqualTo(cellEcho); + await Assert.That(nativeSaves).IsEqualTo(cellSaves).Because("both go through the one save funnel, once"); + probed.Add(SurfaceCatalog.Settings); + } + + // ⌃P: an entry run from the native palette, and the same entry chosen in the cell palette. + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + var palette = new FakePalette(); + await using var native = App(nativeDriver, DemoScene.Build(), palette: palette); + native.RenderSnapshot(null); + var before = Outcome(native); + native.OpenMenu(); + palette.Session!.Run("layout:split-right"); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var cells = App(cellDriver, DemoScene.Build()); + cells.RenderSnapshot(null); + cells.OpenMenu(); + await Assert.That(cells.SimulateCellPaletteChoice("split right", "layout:split-right")).IsTrue(); + + await Assert.That(Outcome(native)).IsNotEqualTo(before); + await Assert.That(Outcome(native)).IsEqualTo(Outcome(cells)).Because("palette: run"); + probed.Add(SurfaceCatalog.Palette); + } + + var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); + await Assert.That(probed).IsEquivalentTo(acting).Because("every native surface with actions has a probe here"); + } + + private static (bool Echo, int Saves) SettingsReset(bool native) + { + using var driver = new AvaloniaConsoleDriver(140, 36); + var config = DemoScene.Build(); + config.Input.LocalEcho = false; + var saves = 0; + var settings = native ? new FakeSettings() : null; + var app = App(driver, config, settings: settings, save: _ => saves++); + try + { + app.RenderSnapshot(null); + app.DispatchCommand("screen:input"); + if (settings is not null) + { + var form = settings.Form!; + var field = form.Section("input")!.Fields.First(f => f.Binding is not null && !form.IsDefault(f)); + form.Reset(field); + } + else + { + app.SimulateSettingsKey(new ConsoleKeyInfo('r', ConsoleKey.R, false, false, false)); + } + + return (config.Input.LocalEcho, saves); + } + finally + { + app.DisposeAsync().AsTask().GetAwaiter().GetResult(); + } + } + + private static async Task Same( + string probe, string view, Action native, Action cells) + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + await using var a = App(nativeDriver, DemoScene.Build()); + a.RenderSnapshot(view); + var before = Outcome(a); + native(a, nativeDriver); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var b = App(cellDriver, DemoScene.Build()); + b.RenderSnapshot(view); + cells(b, cellDriver); + + await Assert.That(Outcome(a)).IsNotEqualTo(before).Because($"{probe}: the native action did something"); + await Assert.That(Outcome(a)).IsEqualTo(Outcome(b)).Because(probe); + } + + /// Everything a surface's action can change, read off the client. + private static string Outcome(SharpMUTermApp app) => string.Join( + " | ", + "input=" + app.PrimaryInputText, + "window=" + app.ActiveWindowId(), + "panes=" + app.PaneIds.Count, + "menu=" + app.MenuIsOpen, + "screen=" + app.OpenSettingsKey, + "layout=" + app.LiveLayoutId, + "welcome=" + app.WelcomeIsOpen, + "quick=" + app.LastQuickMacro, + "walk=" + app.WalkState, + "rail=" + (app.BuildChromeOverlay().Sidebar.Collapsed ? "folded" : "open"), + "notice=" + app.LastNotice, + "recent=" + string.Join(",", app.RecentCommandIds)); + + private static PanelOverlay Panel(AvaloniaConsoleDriver driver, string id) => + driver.Pointer.Panels.First(p => p.PanelId == id); + + private static string OtherWindow(SharpMUTermApp app) + { + var sidebar = app.BuildChromeOverlay().Sidebar; + var selected = CommandIds.Window(app.ActiveWindowId()); + return sidebar.Targets().Last(t => t.StartsWith(CommandIds.Window(string.Empty), StringComparison.Ordinal) && t != selected); + } + + private static long OtherRoom(MapViewModel map) => + map.Rooms.First(r => !r.Current && r.Id != map.AnchorId).Id; + + // ── F4 and the quick bar, per host ────────────────────────────────────────────────────────── + + /// + /// The window's verdicts: ⌃3 arrives here and fires, ⌥⏎ is the window's (it maximises) and never reaches a macro; + /// a macro on ⌃3 runs from the key path and F4 does not mark it dead. + /// + [Test] + public async Task F4TellsTheWindowsTruth() + { + await Assert.That(MacroKeys.Verdict(WindowHost.Keys, "Ctrl+3").Fires).IsTrue(); + await Assert.That(MacroKeys.Verdict(WindowHost.Keys, "Ctrl+Shift+Left").Fires).IsTrue(); + await Assert.That(MacroKeys.Verdict(WindowHost.Keys, "Alt+Enter").Delivery).IsEqualTo(MacroKeyDelivery.Taken); + await Assert.That(MacroKeys.Verdict(WindowHost.Keys, "Alt+Enter").Reason).Contains("maximises"); + await Assert.That(MacroKeys.Verdict(WindowHost.Keys, "Ctrl+Enter").Fires).IsFalse().Because("Ctrl+⏎ is the window's newline"); + + var config = DemoScene.Build(); + using var driver = new AvaloniaConsoleDriver(120, 34); + await using var app = App(driver, config); + app.BindWorldWithoutConnecting(config.Worlds[0]); + var macro = config.TriggerSets.SelectMany(s => s.Macros).Single(m => m.Key == "Ctrl+F1"); + macro.Key = "Ctrl+3"; + + var key = KeyMapper.FromKeyDown(Key.D3, KeyModifiers.Control); + await Assert.That(key).IsNotNull(); + await Assert.That(app.SimulateKey(key!.Value)).IsEqualTo("score"); + + var hotkeys = string.Join('\n', KeypadScreenRenderer.HotkeysColumn(app.Host.Keys, config.TriggerSets.SelectMany(s => s.Macros).ToList())); + await Assert.That(hotkeys).Contains("Ctrl+3"); + await Assert.That(hotkeys).DoesNotContain("▲ Ctrl+3"); + } + + /// The quick bar reads the host's keys: a chord the host keeps for itself is drawn as one that does not fire. + [Test] + public async Task TheQuickBarReadsTheHostsKeys() + { + var keeps = WindowHost.Keys with + { + Reserved = [.. WindowHost.Keys.Reserved, new ReservedChord(new HostChord(ConsoleKey.F1, ConsoleModifiers.Control, "Ctrl+F1", "Ctrl+F1"), "a test")], + }; + + using var driver = new AvaloniaConsoleDriver(120, 34); + await using var window = App(driver, DemoScene.Build(), keys: keeps); + using var plain = new AvaloniaConsoleDriver(120, 34); + await using var terminalKeys = App(plain, DemoScene.Build(), keys: HostKeys.Terminal); + + var kept = window.QuickBarEntries(DemoScene.ActiveSessionKey).Items.Single(i => i.Key == "⌃F1"); + var free = terminalKeys.QuickBarEntries(DemoScene.ActiveSessionKey).Items.Single(i => i.Key == "⌃F1"); + await Assert.That(kept.Fires).IsFalse(); + await Assert.That(free.Fires).IsTrue(); + } + + // ── helpers ────────────────────────────────────────────────────────────────────────────────── + + private static SharpMUTermApp App( + AvaloniaConsoleDriver driver, + AppConfiguration config, + INativeSettings? settings = null, + INativePalette? palette = null, + Action? save = null, + HostKeys? keys = null) => + new(config, WindowHost.Create(driver, clipboard: null) with + { + Capabilities = WindowOptions.Capabilities, + Audio = null, + Presence = null, + Announcer = null, + RunsInline = true, + NativeSettings = settings, + NativePalette = palette, + Keys = keys ?? WindowHost.Keys, + }, save: save); + + private sealed class FakeSettings : INativeSettings + { + public SettingsForm? Form { get; private set; } + + public void Show(SettingsForm form) => Form = form; + + public void Close() => Form = null; + } + + private sealed class FakePalette : INativePalette + { + public PaletteSession? Session { get; private set; } + + public void Show(PaletteSession session) => Session = session; + + public void Close() => Session = null; + } +} diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs new file mode 100644 index 00000000..48856d14 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -0,0 +1,101 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Layouts; + +namespace SharpMUTerm.Client.Tests; + +/// +/// The surface catalog's own rules (): each surface declared once, for every host, with a +/// Client model, and drawn somewhere a reader can reach. The window suite's SurfaceParityTests and the +/// terminal suite's SurfaceCellTests hold the hosts to what is declared here. +/// +public class SurfaceCatalogTests +{ + [Test] + public async Task EverySurfaceIsDeclaredOnceUnderAStableId() + { + var ids = SurfaceCatalog.All.Select(s => s.Id).ToList(); + await Assert.That(ids.Distinct(StringComparer.Ordinal).Count()).IsEqualTo(ids.Count); + await Assert.That(ids.All(id => id.Length > 0 && id == id.Trim() && id == id.ToLowerInvariant())).IsTrue(); + } + + [Test] + public async Task EverySurfaceSaysHowEachHostDrawsIt() + { + foreach (var surface in SurfaceCatalog.All) + { + await Assert.That(surface.Drawing.Keys.Order(StringComparer.Ordinal)) + .IsEquivalentTo(SurfaceHosts.All.Order(StringComparer.Ordinal)).Because(surface.Id); + } + } + + /// A terminal has nothing that can draw over a cell without taking it, so it draws nothing natively. + [Test] + public async Task TheTerminalDrawsNothingNatively() + { + foreach (var surface in SurfaceCatalog.All) + { + await Assert.That(surface.On(SurfaceHosts.Terminal).HasFlag(SurfaceDrawing.Native)).IsFalse().Because(surface.Id); + } + } + + [Test] + public async Task ANativeSurfaceNamesItsViewsAndACellSurfaceItsRenderer() + { + foreach (var surface in SurfaceCatalog.All) + { + await Assert.That(surface.HasNative).IsEqualTo(surface.NativeViews.Count > 0).Because(surface.Id); + await Assert.That(surface.HasCells).IsEqualTo(surface.CellRenderer is not null).Because(surface.Id); + + // Drawn in cells nowhere: the keyboard must reach the same actions, by a command. + if (!surface.HasCells) + { + await Assert.That(surface.KeyboardPath).IsNotNull().Because(surface.Id); + } + } + } + + /// The model is shared data, so it lives where both hosts can read it: Client or Core, never a UI type. + [Test] + public async Task EveryModelIsAClientOrCoreType() + { + var allowed = new[] { typeof(ContributionRegistry).Assembly, typeof(PanelIds).Assembly }; + foreach (var surface in SurfaceCatalog.All) + { + await Assert.That(allowed).Contains(surface.Model.Assembly).Because(surface.Id); + } + } + + /// A panel surface's id is the layout's panel id, so a published panel names its surface. + [Test] + public async Task PanelSurfacesAreKnownPanels() + { + var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar + or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette + or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip)); + foreach (var surface in panels) + { + await Assert.That(PanelIds.Known).Contains(surface.Id); + } + } + + /// + /// A native view may offer a door the cells of the same surface do not; it must then say where the cells offer + /// it — another surface ending in the same method, or a command (a key, a ⌃P entry). + /// + [Test] + public async Task ANativeOnlyActionNamesWhereTheCellsOfferIt() + { + foreach (var surface in SurfaceCatalog.All) + { + foreach (var action in surface.Actions.Where(a => a.CellsVia is not null)) + { + var via = SurfaceCatalog.Find(action.CellsVia!); + var ok = via is not null + ? via.HasCells && via.Actions.Any(a => a.CellsVia is null && a.Reaches == action.Reaches) + : action.CellsVia!.Contains(':', StringComparison.Ordinal); + await Assert.That(ok).IsTrue().Because($"{surface.Id}: {action.Name} → {action.CellsVia}"); + } + } + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/AdvertisedKeyHonestyTests.cs b/tests/SharpMUTerm.Tui.Tests/AdvertisedKeyHonestyTests.cs index 5fb07416..838843dd 100644 --- a/tests/SharpMUTerm.Tui.Tests/AdvertisedKeyHonestyTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/AdvertisedKeyHonestyTests.cs @@ -308,7 +308,7 @@ public async Task AMacroOnACtrlArrowStillOutranksPaneNavigation() { foreach (var descriptor in new[] { "Ctrl+Left", "Ctrl+Right", "Ctrl+Up", "Ctrl+Down" }) { - await Assert.That(MacroKeys.Verdict(descriptor).Fires) + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, descriptor).Fires) .IsTrue() .Because($"F4 says a macro on {descriptor} fires, so pane navigation must not pre-empt it"); } diff --git a/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs b/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs index f405c5c8..96636e2e 100644 --- a/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs @@ -65,6 +65,7 @@ public async Task TheCatalogNamesTheHostsNewlineChord() { Newline = new HostChord(ConsoleKey.Enter, ConsoleModifiers.Control, "Ctrl+⏎", "Ctrl+Enter"), Reserved = [], + ReportsChordsWhole = false, }; await using var app = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(driver, Caps) with { Keys = keys }); diff --git a/tests/SharpMUTerm.Tui.Tests/ConnectionKeysTests.cs b/tests/SharpMUTerm.Tui.Tests/ConnectionKeysTests.cs index 8e93888d..01eae0f8 100644 --- a/tests/SharpMUTerm.Tui.Tests/ConnectionKeysTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ConnectionKeysTests.cs @@ -145,12 +145,12 @@ await Assert.That(MacroKeys.AppShortcuts.Any( s => s.Modifiers == ConsoleModifiers.Control && s.Key == ConsoleKey.D)) .IsFalse() .Because("a second key for one action is a duplicate row on every surface that lists chords"); - await Assert.That(MacroKeys.Verdict("Ctrl+D").Fires).IsTrue(); + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, "Ctrl+D").Fires).IsTrue(); // Which is what makes F4 honest about a macro bound to either of them. foreach (var descriptor in new[] { "Alt+D", "Alt+R" }) { - var verdict = MacroKeys.Verdict(descriptor); + var verdict = MacroKeys.Verdict(HostKeys.Terminal, descriptor); await Assert.That(verdict.Delivery).IsEqualTo(MacroKeyDelivery.Taken).Because(descriptor); await Assert.That(verdict.Reason).Contains(descriptor); } @@ -166,7 +166,7 @@ public async Task NeitherChordIsOneTheTerminalCannotReport() { foreach (var dead in new[] { "Ctrl+I", "Ctrl+M", "Ctrl+J", "Ctrl+H" }) { - await Assert.That(MacroKeys.Verdict(dead).Delivery) + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, dead).Delivery) .IsEqualTo(MacroKeyDelivery.NeverArrives) .Because($"{dead} collapses onto its ASCII byte — this is the list the new chords avoid"); } diff --git a/tests/SharpMUTerm.Tui.Tests/KeypadScreenRendererTests.cs b/tests/SharpMUTerm.Tui.Tests/KeypadScreenRendererTests.cs index 43ea9bbd..6f7ff135 100644 --- a/tests/SharpMUTerm.Tui.Tests/KeypadScreenRendererTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/KeypadScreenRendererTests.cs @@ -16,7 +16,7 @@ public class KeypadScreenRendererTests [Test] public async Task Render_NumpadCellShowsCommandBoundToNum5() { - var lines = KeypadScreenRenderer.Render(Scene()); + var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, Scene()); var middleRow = lines.Single(l => l.Contains("[5]")); await Assert.That(middleRow).Contains("look"); } @@ -37,7 +37,7 @@ public async Task NumpadColumn_ColumnsAlignRegardlessOfBoundCommandLength() }; // Skip(1): the first entry is the "NUMPAD" caption, not a key row. - var offsets = KeypadScreenRenderer.NumpadColumn(macros).Skip(1).Select(CellOffsets).ToList(); + var offsets = KeypadScreenRenderer.NumpadColumn(HostKeys.Terminal, macros).Skip(1).Select(CellOffsets).ToList(); await Assert.That(offsets).Count().IsEqualTo(3); await Assert.That(offsets[1]).IsEqualTo(offsets[0]); @@ -67,7 +67,7 @@ private static string CellOffsets(string row) [Test] public async Task Render_UnboundNumpadCellShowsPlaceholder() { - var lines = KeypadScreenRenderer.Render(Scene()); + var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, Scene()); var topRow = lines.Single(l => l.Contains("[7]")); await Assert.That(topRow).Contains("[dim]—[/]"); } @@ -75,7 +75,7 @@ public async Task Render_UnboundNumpadCellShowsPlaceholder() [Test] public async Task Render_HotkeyListShowsCtrlF1BindingCommandAndEnabledTick() { - var lines = KeypadScreenRenderer.Render(Scene()); + var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, Scene()); var row = lines.Single(l => l.Contains("Ctrl+F1")); await Assert.That(row).Contains("ping"); await Assert.That(row).Contains("✓"); @@ -84,7 +84,7 @@ public async Task Render_HotkeyListShowsCtrlF1BindingCommandAndEnabledTick() [Test] public async Task Render_DisabledHotkeyShowsDimMarker() { - var lines = KeypadScreenRenderer.Render(Scene()); + var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, Scene()); var row = lines.Single(l => l.Contains("Ctrl+F2")); await Assert.That(row).Contains("who"); await Assert.That(row).Contains("[dim]·[/]"); @@ -93,7 +93,7 @@ public async Task Render_DisabledHotkeyShowsDimMarker() [Test] public async Task Render_EmptyMacrosRendersGridWithNoHotkeys() { - var lines = KeypadScreenRenderer.Render(Array.Empty()); + var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, Array.Empty()); await Assert.That(lines.Any(l => l.Contains("[5]") && l.Contains("[dim]—[/]"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("no hotkeys"))).IsTrue(); } @@ -101,7 +101,7 @@ public async Task Render_EmptyMacrosRendersGridWithNoHotkeys() [Test] public async Task Render_HeaderContainsF4AndTitle() { - var lines = KeypadScreenRenderer.Render(Scene()); + var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, Scene()); await Assert.That(lines[0]).Contains("Keypad & hotkeys"); await Assert.That(lines[0]).Contains("F4"); } @@ -113,7 +113,7 @@ public async Task Render_EscapesMarkupBracketsInCommand() { new Macro { Name = "Weird", Key = "Ctrl+F9", Enabled = true, Command = "say [hi]" }, }; - var lines = KeypadScreenRenderer.Render(macros); + var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, macros); var row = lines.Single(l => l.Contains("Ctrl+F9")); await Assert.That(row).Contains("say [[hi]]"); } diff --git a/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs b/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs index 0c0c9c7e..923296b6 100644 --- a/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs @@ -31,8 +31,7 @@ public class MacroKeyCaptureTests }; private static SettingsSession Session(IReadOnlyList sets) => - new(selection => KeypadScreenRenderer.Model( - sets.SelectMany(s => s.Macros).ToList(), sets, selection.SelectionIn(0))); + new(selection => KeypadScreenRenderer.Model(HostKeys.Terminal, sets.SelectMany(s => s.Macros).ToList(), sets, selection.SelectionIn(0))); private static ConsoleKeyInfo Chord(ConsoleKey key, bool ctrl = false, bool alt = false, bool shift = false) => new('\0', key, shift, alt, ctrl); @@ -96,7 +95,7 @@ private static void ArmCapture(SettingsSession session) [Arguments("Up", nameof(MacroKeyDelivery.Taken))] public async Task TheVerdictSaysWhatWillHappenToAChord(string descriptor, string expected) { - var verdict = MacroKeys.Verdict(descriptor); + var verdict = MacroKeys.Verdict(HostKeys.Terminal, descriptor); await Assert.That(verdict.Delivery.ToString()).IsEqualTo(expected).Because(descriptor); await Assert.That(verdict.Reason.Length > 0).IsEqualTo(expected != nameof(MacroKeyDelivery.Fires)) @@ -125,7 +124,7 @@ public async Task WhateverTheScreenCallsLiveIsWhatTheDispatcherActsOn() { var stroke = Chord(key, modifiers.ctrl, modifiers.alt, modifiers.shift); var captured = MacroKeys.Capture(stroke); - var dispatched = MacroKeys.Descriptor(stroke); + var dispatched = MacroKeys.Descriptor(HostKeys.Terminal, stroke); if (captured is null) { @@ -134,7 +133,7 @@ public async Task WhateverTheScreenCallsLiveIsWhatTheDispatcherActsOn() } await Assert.That(dispatched) - .IsEqualTo(MacroKeys.Verdict(captured).Fires ? captured : null) + .IsEqualTo(MacroKeys.Verdict(HostKeys.Terminal, captured).Fires ? captured : null) .Because(captured); } } @@ -154,7 +153,7 @@ await Assert.That(dispatched) public async Task ABindingThatCannotFireIsMarkedOnItsRowAndExplainedInTheFooter() { var macros = Sets()[0].Macros; - var rows = KeypadScreenRenderer.HotkeysColumn(macros); + var rows = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, macros); var dead = rows.Single(l => l.Contains("Num5", StringComparison.Ordinal)); await Assert.That(dead).Contains("▲"); @@ -166,9 +165,9 @@ public async Task ABindingThatCannotFireIsMarkedOnItsRowAndExplainedInTheFooter( await Assert.That(rows[0]).Contains("HOTKEYS"); await Assert.That(rows[0]).Contains("1 of 2 cannot fire"); - await Assert.That(KeypadScreenRenderer.FooterLine(macros, 120, new ScreenFocus(0, 0))) - .Contains(MacroKeys.Verdict("Num5").Reason); - await Assert.That(KeypadScreenRenderer.FooterLine(macros, 120, new ScreenFocus(0, 1))) + await Assert.That(KeypadScreenRenderer.FooterLine(HostKeys.Terminal, macros, 120, new ScreenFocus(0, 0))) + .Contains(MacroKeys.Verdict(HostKeys.Terminal, "Num5").Reason); + await Assert.That(KeypadScreenRenderer.FooterLine(HostKeys.Terminal, macros, 120, new ScreenFocus(0, 1))) .DoesNotContain("▲"); } @@ -177,7 +176,7 @@ public async Task ABindingThatCannotFireIsMarkedOnItsRowAndExplainedInTheFooter( public async Task AListOfLiveBindingsCarriesNoCaveatAtAll() { var macros = new List { new() { Name = "Score", Key = "Ctrl+F1", Command = "score" } }; - var rows = KeypadScreenRenderer.HotkeysColumn(macros); + var rows = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, macros); await Assert.That(rows[0]).DoesNotContain("▲"); await Assert.That(rows.Any(l => l.Contains("▲", StringComparison.Ordinal))).IsFalse(); @@ -191,10 +190,10 @@ public async Task AListOfLiveBindingsCarriesNoCaveatAtAll() [Test] public async Task TheNumpadGridSaysThatNothingReachesIt() { - var caption = KeypadScreenRenderer.NumpadColumn(Sets()[0].Macros)[0]; + var caption = KeypadScreenRenderer.NumpadColumn(HostKeys.Terminal, Sets()[0].Macros)[0]; await Assert.That(caption).Contains("NUMPAD"); - await Assert.That(caption).Contains(MacroKeys.Verdict("Num5").Reason); + await Assert.That(caption).Contains(MacroKeys.Verdict(HostKeys.Terminal, "Num5").Reason); } // ---- the capture mode ------------------------------------------------------------------------ @@ -209,7 +208,7 @@ public async Task TheNumpadGridSaysThatNothingReachesIt() public async Task TheBindingRowCarriesItsKeyAsACaptureField() { var sets = Sets(); - var model = KeypadScreenRenderer.Model(sets.SelectMany(s => s.Macros).ToList(), sets, 0); + var model = KeypadScreenRenderer.Model(HostKeys.Terminal, sets.SelectMany(s => s.Macros).ToList(), sets, 0); var row = model.RowAt(0, 0); await Assert.That(row.FieldCount).IsEqualTo(4); @@ -384,18 +383,18 @@ public async Task TheChromeOffersOnlyWhatACaptureActuallyAnswersTo() var focus = session.Focus(); var header = KeypadScreenRenderer.HeaderLine( - 120, KeypadScreenRenderer.Model(sets[0].Macros, sets, 0), focus); + 120, KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros, sets, 0), focus); await Assert.That(header).Contains(ScreenChrome.CaptureHints); await Assert.That(header).DoesNotContain(ScreenChrome.EditingHints); await Assert.That(header).DoesNotContain(ScreenChrome.NextFieldHint); await Assert.That(Visible(header)).DoesNotContain("F4 close"); - var footer = KeypadScreenRenderer.FooterLine(sets[0].Macros, 120, focus); + var footer = KeypadScreenRenderer.FooterLine(HostKeys.Terminal, sets[0].Macros, 120, focus); await Assert.That(footer).Contains(ScreenChrome.BindAction); await Assert.That(footer).DoesNotContain(ScreenChrome.CommitAction); // And the field itself is a prompt, not a caret over a buffer there is no way to type into. - var row = KeypadScreenRenderer.HotkeysColumn(sets[0].Macros, focus) + var row = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, sets[0].Macros, focus) .Single(l => l.Contains(ScreenChrome.CapturePrompt, StringComparison.Ordinal)); await Assert.That(row).Contains("look"); } diff --git a/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs b/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs index 23398365..ec4d5da1 100644 --- a/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs @@ -96,7 +96,7 @@ private static Macro M(string key, string command = "x", string name = "") => public async Task AGlobalShortcutWins_AndSaysSo() { var f2 = M("F2"); - var clash = KeyClashes.For(f2, [f2]); + var clash = KeyClashes.For(HostKeys.Terminal, f2, [f2]); await Assert.That(clash?.Kind).IsEqualTo(KeyClashKind.ClientWins); await Assert.That(clash!.Value.Reason).Contains("the client wins"); await Assert.That(clash.Value.BindingRuns).IsFalse(); @@ -106,13 +106,13 @@ public async Task AGlobalShortcutWins_AndSaysSo() public async Task AChordTheWindowTakesAfterTheMacrosIsTheBindingsAndAWarning() { var copy = M("Ctrl+C"); - var clash = KeyClashes.For(copy, [copy]); + var clash = KeyClashes.For(HostKeys.Terminal, copy, [copy]); await Assert.That(clash?.Kind).IsEqualTo(KeyClashKind.BindingWins); await Assert.That(clash!.Value.BindingRuns).IsTrue(); await Assert.That(clash.Value.Reason).Contains("no longer copies the selection"); // Verdict agrees that the binding fires: the warning is not a second opinion on deliverability. - await Assert.That(MacroKeys.Verdict("Ctrl+C").Fires).IsTrue(); + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, "Ctrl+C").Fires).IsTrue(); } [Test] @@ -121,23 +121,23 @@ public async Task TwoBindingsOnOneChord_TheFirstAnswers_EvenDisabled() var first = M("F11", name: "north"); first.Enabled = false; var second = M("F11", name: "south"); - await Assert.That(KeyClashes.For(second, [first, second])?.Kind).IsEqualTo(KeyClashKind.Shadowed); - await Assert.That(KeyClashes.For(second, [first, second])!.Value.Reason).Contains("north holds F11 first"); + await Assert.That(KeyClashes.For(HostKeys.Terminal, second, [first, second])?.Kind).IsEqualTo(KeyClashKind.Shadowed); + await Assert.That(KeyClashes.For(HostKeys.Terminal, second, [first, second])!.Value.Reason).Contains("north holds F11 first"); // A disabled binding clashes with nothing itself. - await Assert.That(KeyClashes.For(first, [first, second])).IsNull(); + await Assert.That(KeyClashes.For(HostKeys.Terminal, first, [first, second])).IsNull(); first.Enabled = true; - await Assert.That(KeyClashes.For(first, [first, second])?.Kind).IsEqualTo(KeyClashKind.Shadows); - await Assert.That(KeyClashes.Count([first, second])).IsEqualTo(1); + await Assert.That(KeyClashes.For(HostKeys.Terminal, first, [first, second])?.Kind).IsEqualTo(KeyClashKind.Shadows); + await Assert.That(KeyClashes.Count(HostKeys.Terminal, [first, second])).IsEqualTo(1); } [Test] public async Task AFreeChordClashesWithNothing() { var free = M("F11"); - await Assert.That(KeyClashes.For(free, [free])).IsNull(); - await Assert.That(KeyClashes.For(M("Num5"), [M("Num5")])).IsNull(); // never arrives: not a clash + await Assert.That(KeyClashes.For(HostKeys.Terminal, free, [free])).IsNull(); + await Assert.That(KeyClashes.For(HostKeys.Terminal, M("Num5"), [M("Num5")])).IsNull(); // never arrives: not a clash } [Test] @@ -147,7 +147,7 @@ public async Task EveryYieldedChordIsOneTheVerdictSaysFires() foreach (var chord in new[] { "Ctrl+C", "Ctrl+Left", "Alt+Shift+Up", "Shift+Up", "Alt+Up", "Ctrl+A", "Ctrl+X" }) { await Assert.That(MacroKeys.YieldedBy(chord)).IsNotNull(); - await Assert.That(MacroKeys.Verdict(chord).Fires).IsTrue(); + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, chord).Fires).IsTrue(); } } } diff --git a/tests/SharpMUTerm.Tui.Tests/PaneJumpTests.cs b/tests/SharpMUTerm.Tui.Tests/PaneJumpTests.cs index e9319bd5..3a88cdf8 100644 --- a/tests/SharpMUTerm.Tui.Tests/PaneJumpTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PaneJumpTests.cs @@ -248,7 +248,7 @@ public async Task ABareDigitStillTypesRatherThanJumping() await Assert.That(app.ArmedInputText).Contains("2"); await Assert.That(app.FocusedPaneId).IsEqualTo(pane); - await Assert.That(MacroKeys.Verdict("2").Delivery).IsEqualTo(MacroKeyDelivery.Taken); + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, "2").Delivery).IsEqualTo(MacroKeyDelivery.Taken); await Assert.That(MacroKeys.AppShortcuts.Any(s => s.Modifiers == 0 && s.Key == ConsoleKey.D2)).IsFalse(); } diff --git a/tests/SharpMUTerm.Tui.Tests/PaneResizeEndToEndTests.cs b/tests/SharpMUTerm.Tui.Tests/PaneResizeEndToEndTests.cs index 38fde540..b9290d88 100644 --- a/tests/SharpMUTerm.Tui.Tests/PaneResizeEndToEndTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PaneResizeEndToEndTests.cs @@ -701,7 +701,7 @@ public async Task ABoundMacroWinsTheChordAndTheLayoutStaysPut() "Alt+Shift+Left", "Alt+Shift+Right", "Alt+Shift+Up", "Alt+Shift+Down", }) { - await Assert.That(MacroKeys.Verdict(descriptor).Fires) + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, descriptor).Fires) .IsTrue() .Because($"F4 says a macro on {descriptor} fires, so the resize must not pre-empt it"); } diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenButtonTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenButtonTests.cs index 19c23875..abb6685f 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenButtonTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenButtonTests.cs @@ -366,7 +366,7 @@ public async Task NoReachableRowIsADestructiveButton() { ("F2 triggers", TriggersScreenRenderer.Model(sets, 0)), ("F3 aliases", AliasesScreenRenderer.Model(sets, 0)), - ("F4 keypad", KeypadScreenRenderer.Model(macros, sets, 0)), + ("F4 keypad", KeypadScreenRenderer.Model(HostKeys.Terminal, macros, sets, 0)), ("F5 worlds", WorldsScreenRenderer.Model(worlds, sets, 0, 0)), ("F6 timers", TimersScreenRenderer.Model(sets, 0)), }; diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs index 8d75617f..18c1570b 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs @@ -52,7 +52,7 @@ public async Task NoFocus_DrawsNoCursorBarAtAll() await Assert.That(Barred(TriggersScreenRenderer.RulesColumn(sets, 0))).IsEqualTo(0); await Assert.That(Barred(AliasesScreenRenderer.ListColumn(sets, 0))).IsEqualTo(0); await Assert.That(Barred(TimersScreenRenderer.ListColumn(sets, 0))).IsEqualTo(0); - await Assert.That(Barred(KeypadScreenRenderer.HotkeysColumn(sets[0].Macros))).IsEqualTo(0); + await Assert.That(Barred(KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, sets[0].Macros))).IsEqualTo(0); } [Test] @@ -103,7 +103,7 @@ public async Task Timers_BarsTheFocusedTimer_AndTheEditorsOneShotRow() [Test] public async Task Keypad_BarsTheFocusedBinding() { - var lines = KeypadScreenRenderer.HotkeysColumn(Sets()[0].Macros, new ScreenFocus(0, 1)); + var lines = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, Sets()[0].Macros, new ScreenFocus(0, 1)); await Assert.That(Barred(lines)).IsEqualTo(1); await Assert.That(lines.Single(l => l.Contains(Bar, StringComparison.Ordinal))).Contains("Num1"); @@ -293,7 +293,7 @@ public async Task HeaderHints_SwapToTheEditingKeysWhileAFieldIsOpen() Pair(TriggersScreenRenderer.Model(sets, 0), m => TriggersScreenRenderer.HeaderLine(0, m)), Pair(AliasesScreenRenderer.Model(sets, 0), m => AliasesScreenRenderer.HeaderLine(0, m)), Pair(TimersScreenRenderer.Model(sets, 0), m => TimersScreenRenderer.HeaderLine(0, m)), - Pair(KeypadScreenRenderer.Model(sets[0].Macros), m => KeypadScreenRenderer.HeaderLine(0, m)), + Pair(KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros), m => KeypadScreenRenderer.HeaderLine(0, m)), Pair( WorldsScreenRenderer.Model(worlds, sets, 0, 0), m => WorldsScreenRenderer.HeaderLine(0, m)), @@ -332,7 +332,7 @@ public async Task HeaderHints_SwapToTheEditingKeysWhileAFieldIsOpen() Pair(AliasesScreenRenderer.Model(empty, -1), m => AliasesScreenRenderer.HeaderLine(0, m)), Pair(TimersScreenRenderer.Model(empty, -1), m => TimersScreenRenderer.HeaderLine(0, m)), Pair( - KeypadScreenRenderer.Model(Array.Empty()), + KeypadScreenRenderer.Model(HostKeys.Terminal, Array.Empty()), m => KeypadScreenRenderer.HeaderLine(0, m)), Pair( WorldsScreenRenderer.Model(Array.Empty(), empty, -1, -1), diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenDeleteKeyTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenDeleteKeyTests.cs index fdad0f77..42d93bc7 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenDeleteKeyTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenDeleteKeyTests.cs @@ -78,8 +78,7 @@ public async Task Delete_WorksOnEveryScreenThatHasSomethingToRemove() var triggers = new SettingsSession(s => TriggersScreenRenderer.Model(sets, s.SelectionIn(0))); var aliases = new SettingsSession(s => AliasesScreenRenderer.Model(sets, s.SelectionIn(0))); var timers = new SettingsSession(s => TimersScreenRenderer.Model(sets, s.SelectionIn(0))); - var keypad = new SettingsSession(s => KeypadScreenRenderer.Model( - sets.SelectMany(x => x.Macros).ToList(), sets, s.SelectionIn(0))); + var keypad = new SettingsSession(s => KeypadScreenRenderer.Model(HostKeys.Terminal, sets.SelectMany(x => x.Macros).ToList(), sets, s.SelectionIn(0))); var f5 = new SettingsSession(s => WorldsScreenRenderer.Model( worlds, sets, s.SelectionIn(0), s.SelectionIn(1))); @@ -236,12 +235,12 @@ void Add(string name, ScreenModel model, Func header) => Add("F2", TriggersScreenRenderer.Model(sets, 0), m => TriggersScreenRenderer.HeaderLine(120, m)); Add("F3", AliasesScreenRenderer.Model(sets, 0), m => AliasesScreenRenderer.HeaderLine(120, m)); - Add("F4", KeypadScreenRenderer.Model(sets[0].Macros, sets, 0), m => KeypadScreenRenderer.HeaderLine(120, m)); + Add("F4", KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros, sets, 0), m => KeypadScreenRenderer.HeaderLine(120, m)); Add("F5", WorldsScreenRenderer.Model(worlds, sets, 0, 0), m => WorldsScreenRenderer.HeaderLine(120, m)); Add("F6", TimersScreenRenderer.Model(sets, 0), m => TimersScreenRenderer.HeaderLine(120, m)); Add("F2 empty", TriggersScreenRenderer.Model(empty, -1), m => TriggersScreenRenderer.HeaderLine(120, m)); Add("F3 empty", AliasesScreenRenderer.Model(empty, -1), m => AliasesScreenRenderer.HeaderLine(120, m)); - Add("F4 no sets", KeypadScreenRenderer.Model(Array.Empty()), m => KeypadScreenRenderer.HeaderLine(120, m)); + Add("F4 no sets", KeypadScreenRenderer.Model(HostKeys.Terminal, Array.Empty()), m => KeypadScreenRenderer.HeaderLine(120, m)); Add("F6 empty", TimersScreenRenderer.Model(empty, -1), m => TimersScreenRenderer.HeaderLine(120, m)); Add( "F7 options", diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenFieldRenderingTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenFieldRenderingTests.cs index af7774bc..8a3c5221 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenFieldRenderingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenFieldRenderingTests.cs @@ -54,7 +54,7 @@ public async Task NoOpenEdit_DrawsNoCaretOnAnyScreen() await Assert.That(Carets(TriggersScreenRenderer.EditorColumn(sets, 0, Array.Empty()))).IsEqualTo(0); await Assert.That(Carets(AliasesScreenRenderer.EditorColumn(sets, 0))).IsEqualTo(0); await Assert.That(Carets(TimersScreenRenderer.EditorColumn(sets, 0))).IsEqualTo(0); - await Assert.That(Carets(KeypadScreenRenderer.HotkeysColumn(sets[0].Macros))).IsEqualTo(0); + await Assert.That(Carets(KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, sets[0].Macros))).IsEqualTo(0); await Assert.That(Carets( WorldsScreenRenderer.DetailColumn(worlds, sets, 0, 0, ScreenPalette.Accent))).IsEqualTo(0); await Assert.That(Carets( @@ -187,16 +187,14 @@ public async Task Keypad_DrawsTheNameAndCommandBuffersInTheBindingRowItself() { var macros = Sets()[0].Macros; - var command = KeypadScreenRenderer.HotkeysColumn( - macros, Edit(0, 0, KeypadScreenRenderer.CommandField, "look here")); + var command = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, macros, Edit(0, 0, KeypadScreenRenderer.CommandField, "look here")); await Assert.That(Carets(command)).IsEqualTo(1); var edited = command.Single(HasCaret); await Assert.That(edited).Contains("Num5"); await Assert.That(edited).Contains("look her"); - var name = KeypadScreenRenderer.HotkeysColumn( - macros, Edit(0, 0, KeypadScreenRenderer.NameField, "Survey")); + var name = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, macros, Edit(0, 0, KeypadScreenRenderer.NameField, "Survey")); await Assert.That(Carets(name)).IsEqualTo(1); await Assert.That(name.Single(HasCaret)).Contains("Surve"); @@ -278,8 +276,7 @@ public async Task ARefusedValueIsMarkedOnTheRowThatRefusedIt() [Test] public async Task BracketsTypedIntoABufferAreEscaped_NotRenderedAsMarkup() { - var lines = KeypadScreenRenderer.HotkeysColumn( - Sets()[0].Macros, Edit(0, 0, KeypadScreenRenderer.CommandField, "say [red]hi")); + var lines = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, Sets()[0].Macros, Edit(0, 0, KeypadScreenRenderer.CommandField, "say [red]hi")); var edited = lines.Single(HasCaret); await Assert.That(edited).Contains("[[red]]hi"); diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenFooterTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenFooterTests.cs index 2babb2e2..de808082 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenFooterTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenFooterTests.cs @@ -60,8 +60,8 @@ public class ScreenFooterTests AliasesScreenRenderer.FooterLine(sets, 0, 80), AliasesScreenRenderer.FooterLine(sets, 0, 80, Editing)), ("F4 keypad", - KeypadScreenRenderer.FooterLine(macros, 80), - KeypadScreenRenderer.FooterLine(macros, 80, Editing)), + KeypadScreenRenderer.FooterLine(HostKeys.Terminal, macros, 80), + KeypadScreenRenderer.FooterLine(HostKeys.Terminal, macros, 80, Editing)), ("F5 worlds", WorldsScreenRenderer.FooterLine(worlds, 0, 0, accent, 80), WorldsScreenRenderer.FooterLine(worlds, 0, 0, accent, 80, Editing)), diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenHintTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenHintTests.cs index 8ce23050..63e1c337 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenHintTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenHintTests.cs @@ -144,7 +144,7 @@ public async Task TheSidewaysHintGoesAwayWhileAFieldIsOpen() var triggers = TriggersScreenRenderer.Model(sets, 0); var aliases = AliasesScreenRenderer.Model(sets, 0); - var keypad = KeypadScreenRenderer.Model(macros, sets, 0); + var keypad = KeypadScreenRenderer.Model(HostKeys.Terminal, macros, sets, 0); var timers = TimersScreenRenderer.Model(sets, 0); var world = WorldsScreenRenderer.Model(worlds, sets, 0, 0); var text = OptionsScreenRenderer.Model(textAnsi); diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenLayoutTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenLayoutTests.cs index 76d0c5f0..9da98c22 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenLayoutTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenLayoutTests.cs @@ -213,7 +213,7 @@ await Assert.That(KeypadScreenRenderer.NumpadWidth(wide)) .IsGreaterThan(KeypadScreenRenderer.NumpadWidth(narrow)); // Given that width, the cell draws the command whole — the asymmetry the review named. - var grid = KeypadScreenRenderer.NumpadColumn(wide, KeypadScreenRenderer.NumpadWidth(wide)); + var grid = KeypadScreenRenderer.NumpadColumn(HostKeys.Terminal, wide, KeypadScreenRenderer.NumpadWidth(wide)); await Assert.That(grid.Single(l => l.Contains("[[1]]"))).Contains("look at altar"); } diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenListButtonTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenListButtonTests.cs index 467aa6bb..3f81c9c8 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenListButtonTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenListButtonTests.cs @@ -100,7 +100,7 @@ await Assert.That(triggers.ButtonAt(0, 4)!.Value.Label) // Nor does F4: a copied binding would land on the key its original already holds, and the // second macro on a key never fires. - var keypad = KeypadScreenRenderer.Model(sets[0].Macros, sets, 0); + var keypad = KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros, sets, 0); await Assert.That(keypad.ListSizes[0]).IsEqualTo(1); await Assert.That(keypad.ButtonAt(0, 1)!.Value.Label).IsEqualTo(KeypadScreenRenderer.AddBindingLabel); await Assert.That(keypad.ButtonAt(0, 2)!.Value.Label).IsEqualTo(ScreenButton.RemoveKeyLabel); @@ -141,7 +141,7 @@ public async Task APaneWithNothingSelectedOffersOnlyItsAddButton() await Assert.That(TriggersScreenRenderer.Model(empty, -1).Sizes[0]).IsEqualTo(0); await Assert.That(AliasesScreenRenderer.Model(empty, -1).Sizes[0]).IsEqualTo(0); await Assert.That(TimersScreenRenderer.Model(empty, -1).Sizes[0]).IsEqualTo(0); - await Assert.That(KeypadScreenRenderer.Model(Array.Empty(), empty, -1).Sizes[0]).IsEqualTo(0); + await Assert.That(KeypadScreenRenderer.Model(HostKeys.Terminal, Array.Empty(), empty, -1).Sizes[0]).IsEqualTo(0); } /// @@ -212,7 +212,7 @@ public async Task ANewTimerArrivesDisabled_UnlikeANewTriggerOrBinding() new ScreenEdits().Apply( ButtonNamed(AliasesScreenRenderer.Model(sets, 0), 0, AliasesScreenRenderer.AddAliasLabel)); new ScreenEdits().Apply(ButtonNamed( - KeypadScreenRenderer.Model(sets[0].Macros, sets, 0), 0, KeypadScreenRenderer.AddBindingLabel)); + KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros, sets, 0), 0, KeypadScreenRenderer.AddBindingLabel)); await Assert.That(sets[0].Timers[^1].Enabled).IsFalse(); await Assert.That(sets[0].Aliases[^1].Enabled).IsTrue(); @@ -240,7 +240,7 @@ public async Task RemovingUndoesBackIntoItsOwnIndexOnEveryScreen() edits.Apply(Removal(TimersScreenRenderer.Model(sets, 0), 0)); await Assert.That(sets[0].Timers).IsEmpty(); - edits.Apply(Removal(KeypadScreenRenderer.Model(sets[0].Macros, sets, 0), 0)); + edits.Apply(Removal(KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros, sets, 0), 0)); await Assert.That(sets[0].Macros).IsEmpty(); edits.Revert(); @@ -345,7 +345,7 @@ await Assert.That(sets[0].Triggers.Select(t => t.Name)) /// /// F4's add button is the one that cannot simply append. A is identified by its /// , so the button claims a free one and says which on its own row. It claims - /// from rather than the numpad: no numpad key ever reaches this + /// from rather than the numpad: no numpad key ever reaches this /// client, so a binding born on one could never fire, and a button whose whole job is to name the /// key it takes must not name a dead one. /// @@ -354,21 +354,21 @@ public async Task AddingABindingClaimsAFreeKeyThatCanActuallyFire_AndNamesIt() { var sets = Sets(); var button = ButtonNamed( - KeypadScreenRenderer.Model(sets[0].Macros, sets, 0), 0, KeypadScreenRenderer.AddBindingLabel); + KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros, sets, 0), 0, KeypadScreenRenderer.AddBindingLabel); - var first = MacroKeys.Bindable[0]; + var first = MacroKeys.Bindable(HostKeys.Terminal)[0]; await Assert.That(button.Target).IsEqualTo(first); - await Assert.That(MacroKeys.Verdict(first).Fires).IsTrue(); + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, first).Fires).IsTrue(); new ScreenEdits().Apply(button); await Assert.That(sets[0].Macros[^1].Key).IsEqualTo(first); // The next one takes the next free key, not the same one again. var again = ButtonNamed( - KeypadScreenRenderer.Model(sets.SelectMany(s => s.Macros).ToList(), sets, 0), + KeypadScreenRenderer.Model(HostKeys.Terminal, sets.SelectMany(s => s.Macros).ToList(), sets, 0), 0, KeypadScreenRenderer.AddBindingLabel); - await Assert.That(again.Target).IsEqualTo(MacroKeys.Bindable[1]); + await Assert.That(again.Target).IsEqualTo(MacroKeys.Bindable(HostKeys.Terminal)[1]); } /// @@ -380,13 +380,13 @@ public async Task AddingABindingClaimsAFreeKeyThatCanActuallyFire_AndNamesIt() public async Task NoBindingCanBeAddedOnceEveryBindableKeyIsTaken() { var sets = new List { new() { Name = "All" } }; - foreach (var key in MacroKeys.Bindable) + foreach (var key in MacroKeys.Bindable(HostKeys.Terminal)) { sets[0].Macros.Add(new Macro { Name = key, Key = key, Command = "look" }); } - var model = KeypadScreenRenderer.Model(sets[0].Macros, sets, 0); - var bindings = MacroKeys.Bindable.Count; + var model = KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros, sets, 0); + var bindings = MacroKeys.Bindable(HostKeys.Terminal).Count; // The bindings and nothing else the cursor can reach: the add button is gone because there is no // free chord left to claim, and the removal past them is drawn but not a stop (was bindings + 1). @@ -422,9 +422,9 @@ bool Removes(IEnumerable column, string target) => column.Any(l => await Assert.That(Removes(AliasesScreenRenderer.ListColumn(sets, 0), "gr")).IsTrue(); await Assert.That(Removes(TimersScreenRenderer.ListColumn(sets, 0), "ping")).IsTrue(); - var bindings = KeypadScreenRenderer.HotkeysColumn(sets[0].Macros, null, sets, 0); + var bindings = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, sets[0].Macros, null, sets, 0); await Assert.That(Removes(bindings, "Look")).IsTrue(); - await Assert.That(bindings.Any(l => l.Contains("[[+ binding]]") && l.Contains(MacroKeys.Bindable[0]))) + await Assert.That(bindings.Any(l => l.Contains("[[+ binding]]") && l.Contains(MacroKeys.Bindable(HostKeys.Terminal)[0]))) .IsTrue(); } diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs index 05ff25e7..693276af 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs @@ -143,7 +143,7 @@ public async Task Timers_ListTogglesEnabled_AndTheEditorTogglesOneShotThenEnable public async Task Keypad_IsOnePaneOfMacroToggles() { var macros = Sets()[0].Macros; - var model = KeypadScreenRenderer.Model(macros); + var model = KeypadScreenRenderer.Model(HostKeys.Terminal, macros); await Assert.That(model.PaneCount).IsEqualTo(1); @@ -164,7 +164,7 @@ public async Task Keypad_IsOnePaneOfMacroToggles() public async Task Keypad_GrowsItsButtonsOnceItKnowsWhichSetsTheBindingsLiveIn() { var sets = Sets(); - var model = KeypadScreenRenderer.Model(sets[0].Macros, sets, selected: 0); + var model = KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros, sets, selected: 0); await Assert.That(model.ListSizes[0]).IsEqualTo(1); await Assert.That(model.Sizes[0]).IsEqualTo(2); // was 3, with the removal reachable diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenNameTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenNameTests.cs index 0269b7ad..0dc98b75 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenNameTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenNameTests.cs @@ -58,7 +58,7 @@ public class ScreenNameTests AliasesScreenRenderer.Model(sets, 0).FieldAt(0, 0, AliasesScreenRenderer.NameField)!.Value, () => alias.Name), ("F4 keypad", - KeypadScreenRenderer.Model(sets[0].Macros).FieldAt(0, 0, KeypadScreenRenderer.NameField)!.Value, + KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros).FieldAt(0, 0, KeypadScreenRenderer.NameField)!.Value, () => macro.Name), ("F6 timers", TimersScreenRenderer.Model(sets, 0).FieldAt(0, 0, TimersScreenRenderer.NameField)!.Value, @@ -82,7 +82,7 @@ private static List FirstFields(List sets, List AliasesScreenRenderer.Model(sets, selection.SelectionIn(0)))); yield return ("F4 keypad", new SettingsSession( - selection => KeypadScreenRenderer.Model( - sets.SelectMany(s => s.Macros).ToList(), sets, selection.SelectionIn(0)))); + selection => KeypadScreenRenderer.Model(HostKeys.Terminal, sets.SelectMany(s => s.Macros).ToList(), sets, selection.SelectionIn(0)))); yield return ("F5 worlds", WorldsSession(Worlds(), sets)); yield return ("F6 timers", new SettingsSession( selection => TimersScreenRenderer.Model(sets, selection.SelectionIn(0)))); diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenReachabilityTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenReachabilityTests.cs index 865cbeb8..dae0af9b 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenReachabilityTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenReachabilityTests.cs @@ -240,11 +240,11 @@ public async Task RemovingLeavesNoFieldOpen() var keypadSets = Sets(); List Macros() => keypadSets.SelectMany(s => s.Macros).ToList(); var keypad = new SettingsSession( - selection => KeypadScreenRenderer.Model(Macros(), keypadSets, selection.SelectionIn(0))); + selection => KeypadScreenRenderer.Model(HostKeys.Terminal, Macros(), keypadSets, selection.SelectionIn(0))); yield return ( "F4 keypad", keypad, - () => KeypadScreenRenderer.Model(Macros(), keypadSets, keypad.Selection.SelectionIn(0)), + () => KeypadScreenRenderer.Model(HostKeys.Terminal, Macros(), keypadSets, keypad.Selection.SelectionIn(0)), KeypadScreenRenderer.AddBindingLabel, "New Binding"); diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenReadOnlyTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenReadOnlyTests.cs index 20319a80..da3951f6 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenReadOnlyTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenReadOnlyTests.cs @@ -433,12 +433,12 @@ public async Task Keypad_TheNumpadGridIsAReadoutAndTheBindingListIsNot() { var macros = Sets()[0].Macros; - var grid = KeypadScreenRenderer.NumpadColumn(macros); + var grid = KeypadScreenRenderer.NumpadColumn(HostKeys.Terminal, macros); await Assert.That(grid.Any(InAWell)).IsFalse(); await Assert.That(grid.Single(l => l.Contains("look", StringComparison.Ordinal))) .Contains(ScreenPalette.Muted); - var list = KeypadScreenRenderer.HotkeysColumn(macros); + var list = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, macros); await Assert.That(list.Single(l => l.Contains("Num5", StringComparison.Ordinal))).Contains(Well); } @@ -501,7 +501,7 @@ private static List Headers() { TriggersScreenRenderer.HeaderLine(80, TriggersScreenRenderer.Model(sets, 0)), AliasesScreenRenderer.HeaderLine(80, AliasesScreenRenderer.Model(sets, 0)), - KeypadScreenRenderer.HeaderLine(80, KeypadScreenRenderer.Model(sets[0].Macros)), + KeypadScreenRenderer.HeaderLine(80, KeypadScreenRenderer.Model(HostKeys.Terminal, sets[0].Macros)), WorldsScreenRenderer.HeaderLine(80, WorldsScreenRenderer.Model(worlds, sets, 0, 0)), TimersScreenRenderer.HeaderLine(80, TimersScreenRenderer.Model(sets, 0)), Header(OptionsScreenRenderer.TextAnsiScreen()), @@ -524,7 +524,7 @@ private static string Header(OptionsScreenRenderer.OptionsScreen screen) => { ("F2 triggers", TriggersScreenRenderer.FooterLine(sets, 0, 80)), ("F3 aliases", AliasesScreenRenderer.FooterLine(sets, 0, 80)), - ("F4 keypad", KeypadScreenRenderer.FooterLine(sets[0].Macros, 80)), + ("F4 keypad", KeypadScreenRenderer.FooterLine(HostKeys.Terminal, sets[0].Macros, 80)), ("F5 worlds", WorldsScreenRenderer.FooterLine(worlds, 0, 0, accent, 80)), ("F6 timers", TimersScreenRenderer.FooterLine(sets, 0, 80)), ("F7 text", OptionsScreenRenderer.FooterLine(OptionsScreenRenderer.TextAnsiScreen().Rows, 80)), diff --git a/tests/SharpMUTerm.Tui.Tests/SettingsPasteTests.cs b/tests/SharpMUTerm.Tui.Tests/SettingsPasteTests.cs index 8fc7ee07..bd566387 100644 --- a/tests/SharpMUTerm.Tui.Tests/SettingsPasteTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SettingsPasteTests.cs @@ -175,7 +175,7 @@ public async Task AKeyCaptureFieldSwallowsAPaste() var binding = "F5"; var session = new SettingsSession(_ => new ScreenModel(new[] { - ScreenRow.Of(ScreenField.Key("key", () => binding, v => binding = v, _ => null)), + ScreenRow.Of(ScreenField.Key(HostKeys.Terminal, "key", () => binding, v => binding = v, _ => null)), })); session.Handle(Key(ConsoleKey.Enter)); await Assert.That(session.IsEditing).IsTrue(); @@ -228,7 +228,7 @@ public async Task CtrlV_OverAKeyCaptureIsStillRecordedAsABinding() var binding = "F5"; var session = new SettingsSession(_ => new ScreenModel(new[] { - ScreenRow.Of(ScreenField.Key("key", () => binding, v => binding = v, _ => null)), + ScreenRow.Of(ScreenField.Key(HostKeys.Terminal, "key", () => binding, v => binding = v, _ => null)), })); var system = new ConsoleWindowSystem( new HeadlessConsoleDriver(120, 34), new ConsoleWindowSystemOptions()); diff --git a/tests/SharpMUTerm.Tui.Tests/SurfaceCellTests.cs b/tests/SharpMUTerm.Tui.Tests/SurfaceCellTests.cs new file mode 100644 index 00000000..d9044013 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/SurfaceCellTests.cs @@ -0,0 +1,108 @@ +using System.Reflection; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The terminal's half of the surface catalog (): every surface drawn in cells is drawn +/// by a renderer that takes the surface's model, every command a surface raises is one the registry runs, and every +/// action ends in a client method that exists. The window's half is SurfaceParityTests. +/// +[NotInParallel] +public class SurfaceCellTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static readonly Assembly Tui = typeof(SharpMUTermApp).Assembly; + + /// + /// A cell renderer that stopped taking the model — reading the app's state itself — could say something the + /// native view does not. The renderer is named in the catalog and one of its overloads must take the model. + /// + [Test] + public async Task EverySurfaceDrawnInCellsHasACellRendererThatTakesItsModel() + { + foreach (var surface in SurfaceCatalog.All.Where(s => s.HasCells)) + { + var name = surface.CellRenderer!; + var dot = name.LastIndexOf('.'); + var type = Tui.GetType(name[..dot]); + await Assert.That(type).IsNotNull().Because($"{surface.Id}: {name[..dot]} is not a type in the terminal client"); + var overloads = type!.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance) + .Where(m => m.Name == name[(dot + 1)..]) + .ToList(); + await Assert.That(overloads).IsNotEmpty().Because($"{surface.Id}: {name} does not exist"); + await Assert.That(overloads.Any(m => m.GetParameters().Any(p => p.ParameterType == surface.Model))) + .IsTrue().Because($"{surface.Id}: no overload of {name} takes a {surface.Model.Name}"); + } + } + + /// Every action names the client method both views end in, and that method is there to end in. + [Test] + public async Task EveryActionReachesAClientMethodThatExists() + { + foreach (var surface in SurfaceCatalog.All) + { + foreach (var action in surface.Actions) + { + var dot = action.Reaches.LastIndexOf('.'); + var type = dot < 0 ? typeof(SharpMUTermApp) : Tui.GetType("SharpMUTerm.Tui." + action.Reaches[..dot]); + var method = dot < 0 ? action.Reaches : action.Reaches[(dot + 1)..]; + var found = type?.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance) + .Any(m => m.Name == method) ?? false; + await Assert.That(found).IsTrue().Because($"{surface.Id}: {action.Reaches}"); + } + } + } + + /// A command a surface raises, or names as its keyboard path, is one the registry runs. + [Test] + public async Task EveryCommandASurfaceRaisesResolvesThroughTheRegistry() + { + Console.SetIn(TextReader.Null); + using var driver = new HeadlessConsoleDriver(120, 34); + await using var app = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(driver, Caps)); + + var ids = SurfaceCatalog.All.SelectMany(s => s.Actions.Where(a => a.Kind == SurfaceActionKind.Command).Select(a => a.Name)) + .Concat(SurfaceCatalog.All.SelectMany(s => s.Actions.Select(a => a.CellsVia)).OfType().Where(v => SurfaceCatalog.Find(v) is null)) + .Concat(SurfaceCatalog.All.Select(s => s.KeyboardPath).OfType()) + .Distinct(StringComparer.Ordinal); + foreach (var id in ids) + { + await Assert.That(app.Contributions.Commands.Resolve(id)).IsNotNull().Because(id); + } + } + + /// + /// The terminal's verdicts, read through the app's own host: ⌃3 is the Escape byte here and never fires, ⌥⏎ is + /// the newline, ⌃⇧←/→ are kitty's; and a macro on ⌃3 is dead on F4 and is not dispatched by the key path. + /// + [Test] + public async Task F4TellsTheTerminalsTruth() + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + await using var app = new SharpMUTermApp(config, ClientHost.Headless(new HeadlessConsoleDriver(120, 34), Caps)); + app.BindWorldWithoutConnecting(config.Worlds[0]); + var keys = app.Host.Keys; + + await Assert.That(MacroKeys.Verdict(keys, "Ctrl+3").Delivery).IsEqualTo(MacroKeyDelivery.NeverArrives); + await Assert.That(MacroKeys.Verdict(keys, "Ctrl+3").Reason).Contains("Escape"); + await Assert.That(MacroKeys.Verdict(keys, "Alt+Enter").Delivery).IsEqualTo(MacroKeyDelivery.Taken); + await Assert.That(MacroKeys.Verdict(keys, "Alt+Enter").Reason).IsEqualTo("Alt+⏎ is the newline"); + await Assert.That(MacroKeys.Verdict(keys, "Ctrl+Shift+Left").Fires).IsFalse(); + await Assert.That(MacroKeys.Verdict(keys, "Ctrl+Shift+A").Fires).IsFalse(); + await Assert.That(MacroKeys.Verdict(keys, "Alt+O").Fires).IsFalse(); + + var macro = config.TriggerSets.SelectMany(s => s.Macros).Single(m => m.Key == "Ctrl+F1"); + macro.Key = "Ctrl+3"; + await Assert.That(app.SimulateKey(new ConsoleKeyInfo('3', ConsoleKey.D3, false, false, true))).IsNull(); + + var hotkeys = string.Join('\n', KeypadScreenRenderer.HotkeysColumn(keys, config.TriggerSets.SelectMany(s => s.Macros).ToList())); + await Assert.That(hotkeys).Contains("▲ Ctrl+3"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs b/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs index fd1e35fa..6e5db705 100644 --- a/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs @@ -119,7 +119,7 @@ public async Task NothingToShowIsNoStrip() [Test] public async Task TheQuickBarListsFunctionKeysPlainFirstAndByNumber() { - var entries = QuickBarRenderer.Entries(Bindings, Resolve); + var entries = QuickBarRenderer.Entries(HostKeys.Terminal, Bindings, Resolve); await Assert.That(entries.Items.Select(e => e.Key)).IsEquivalentTo(new[] { "F11", "F12", "⌃F3" }); await Assert.That(entries.Items[2].Title).IsEqualTo("cast 'cure light'"); @@ -128,7 +128,7 @@ public async Task TheQuickBarListsFunctionKeysPlainFirstAndByNumber() [Test] public async Task TheQuickBarElidesAndNeverWraps() { - var entries = QuickBarRenderer.Entries(Bindings, Resolve); + var entries = QuickBarRenderer.Entries(HostKeys.Terminal, Bindings, Resolve); var wide = QuickBarRenderer.Render(entries, 100, "#00f5b7"); await Assert.That(StripMarkup(wide)).Contains("F11 kick").And.EndsWith(QuickBarRenderer.Hint); diff --git a/tests/SharpMUTerm.Tui.Tests/TriggerSetManagementTests.cs b/tests/SharpMUTerm.Tui.Tests/TriggerSetManagementTests.cs index 013feec0..8e622c19 100644 --- a/tests/SharpMUTerm.Tui.Tests/TriggerSetManagementTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TriggerSetManagementTests.cs @@ -472,7 +472,7 @@ public async Task EveryFlattenedScreenCanMoveItsItemsBetweenSets() await Assert.That(sets[1].Timers.Select(t => t.Name)).IsEquivalentTo(new[] { "ping" }); var macros = sets.SelectMany(s => s.Macros).ToList(); - var binding = KeypadScreenRenderer.Model(macros, sets, 0) + var binding = KeypadScreenRenderer.Model(HostKeys.Terminal, macros, sets, 0) .FieldAt(0, 0, KeypadScreenRenderer.SetField)!.Value; await Assert.That(new ScreenEdits().Apply(binding, "Trade")).IsNull(); await Assert.That(sets[0].Macros).IsEmpty(); @@ -487,7 +487,7 @@ public async Task EveryFlattenedScreenCanMoveItsItemsBetweenSets() [Test] public async Task TheKeypadOffersNoSetFieldWhenItWasNotToldWhichSetsTheBindingsCameFrom() { - var row = KeypadScreenRenderer.Model(Sets()[0].Macros).RowAt(0, 0); + var row = KeypadScreenRenderer.Model(HostKeys.Terminal, Sets()[0].Macros).RowAt(0, 0); await Assert.That(row.FieldCount).IsEqualTo(3); await Assert.That(row.FieldAt(KeypadScreenRenderer.SetField)).IsNull(); @@ -582,7 +582,7 @@ await Assert.That(AliasesScreenRenderer.ListColumn(sets, 0) .Any(l => l.Contains("▪ Combat — no aliases", StringComparison.Ordinal))).IsTrue(); await Assert.That(TimersScreenRenderer.ListColumn(sets, 0) .Any(l => l.Contains("▪ Combat — no timers", StringComparison.Ordinal))).IsTrue(); - await Assert.That(KeypadScreenRenderer.HotkeysColumn(macros, null, sets, 0) + await Assert.That(KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, macros, null, sets, 0) .Any(l => l.Contains("▪ Combat — no bindings", StringComparison.Ordinal))).IsTrue(); // Trade holds triggers but no aliases, so it is named on F3 and not on F2 — the placeholder is diff --git a/tests/SharpMUTerm.Tui.Tests/WindowJumpTests.cs b/tests/SharpMUTerm.Tui.Tests/WindowJumpTests.cs index 0181aed9..c576f2d3 100644 --- a/tests/SharpMUTerm.Tui.Tests/WindowJumpTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WindowJumpTests.cs @@ -548,7 +548,7 @@ await Assert.That(MacroKeys.AppShortcuts.Any(s => s.Modifiers == ConsoleModifier await Assert.That(MacroKeys.WindowJumpNumber(ConsoleKey.D0)).IsNull(); await Assert.That(MacroKeys.AppShortcuts.Any( s => s.Modifiers == ConsoleModifiers.Alt && s.Key == ConsoleKey.D0)).IsFalse(); - await Assert.That(MacroKeys.Verdict("Alt+0").Fires).IsTrue(); + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, "Alt+0").Fires).IsTrue(); } /// @@ -682,7 +682,7 @@ public async Task TheKeypadScreenSaysWhatHasEachDigit() { for (var n = 1; n <= 9; n++) { - var verdict = MacroKeys.Verdict($"Alt+{n}"); + var verdict = MacroKeys.Verdict(HostKeys.Terminal, $"Alt+{n}"); await Assert.That(verdict.Delivery).IsEqualTo(MacroKeyDelivery.Taken); await Assert.That(verdict.Reason).Contains($"window {n}"); @@ -702,7 +702,7 @@ public async Task TheKeypadScreenSaysWhatHasEachDigit() [Arguments(9, "bare 9")] public async Task CtrlDigitIsReportedAsUnreachableWithTheByteTheTerminalSends(int digit, string byteName) { - var verdict = MacroKeys.Verdict($"Ctrl+{digit}"); + var verdict = MacroKeys.Verdict(HostKeys.Terminal, $"Ctrl+{digit}"); await Assert.That(verdict.Delivery).IsEqualTo(MacroKeyDelivery.NeverArrives); await Assert.That(verdict.Reason).Contains(byteName); From c60528657dcc244159ed7f6b6e1bc8fe34cc45c9 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 07:07:44 +0000 Subject: [PATCH 026/113] Narrow layout below 100 columns, and mode-aware key hints on the status row Below 100 columns the connection rail folds itself to its strip (whichever rail is drawn, through SidebarModel.Collapsed; the window measures its whole width via IPointerPresenter.WindowColumns so the fold cannot undo itself), acting only when the width crosses the line so a player's own fold wins. Below 100 columns or 30 rows an empty command line is one row and grows as before; a growing bar now takes back the editor's scroll. While the focused pane is scrolled back, split, frozen, carrying the search bar, or a docked composer holds the keyboard, the status row names that mode's keys (ModeHints, Client), resolved through the host's spellings, in place of the pane hints and only where they fit. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 8 + CLAUDE.md | 27 +++ src/SharpMUTerm.Avalonia/TerminalView.cs | 4 + src/SharpMUTerm.Avalonia/WindowPointer.cs | 14 ++ src/SharpMUTerm.Client/Chrome/ModeHints.cs | 82 +++++++ src/SharpMUTerm.Tui/InputBarControl.cs | 17 +- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 8 + .../SharpMUTermApp.ModeHints.cs | 80 +++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs | 84 +++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 1 + src/SharpMUTerm.Tui/SharpMUTermApp.cs | 59 ++++- .../HostParityTests.cs | 51 ++++ .../NativeChromeTests.cs | 12 +- .../NewlineKeyTests.cs | 5 +- .../ModeHintsTests.cs | 51 ++++ .../InputAreaLayoutTests.cs | 6 +- .../NarrowLayoutTests.cs | 218 ++++++++++++++++++ 17 files changed, 717 insertions(+), 10 deletions(-) create mode 100644 src/SharpMUTerm.Client/Chrome/ModeHints.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.ModeHints.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs create mode 100644 tests/SharpMUTerm.Client.Tests/ModeHintsTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NarrowLayoutTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aafdc4e..20ec6a15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- A narrow terminal gives its room to the game: below 100 columns the connection rail folds to its slim strip + on its own (in the desktop window, the sidebar does), and below 100 columns or 30 rows an empty command line + is one row tall and grows as you type. At 80×24 a pane is now 72 columns wide instead of 60, two rows taller, + and a world's 80-column text no longer leaves a stray word on every other line. Folding or unfolding the rail + yourself (Ctrl+B b) always wins, until the window next crosses 100 columns. +- The status row names the keys of whatever you are in: scrolled back (End returns, Alt+F freezes), frozen + (Alt+F thaws), on a search result (Alt+G next hit), or writing in a docked composer (Ctrl+S sends, Esc + releases, F1 full screen), in place of the pane hints, and only where they fit. - Ctrl+P lists *Fold or unfold the connection rail*, the same fold as Ctrl+B b and as the desktop window's sidebar button. - Desktop window: the header and the connections sidebar now have room of their own — a full-height toolbar diff --git a/CLAUDE.md b/CLAUDE.md index 230e1f4f..fc628ff4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -531,6 +531,33 @@ fallbacks) for inline images/maps. `UnreadBadge` in a reserved field), refreshed on `PostBufferPaint` with the status row repainted beside it when it moves, so the two surfaces never disagree. It says *rows*, not lines: a buffer index is not a viewport row. +- **Below 100 columns the layout is narrow** (`SharpMUTermApp.Narrow.cs`; `NarrowColumns`, `ShortRows`; + `NarrowLayoutTests`). The rail folds itself to its strip, and below 100 columns *or* 30 rows an empty command line + is one row (`SyncInputHeights`: `MinRows` becomes `InputSettings.MinRows`; it still grows to `MaxRows` as it wraps). + At 80×24 that is a 72-column pane instead of 60 and two more output rows. Decisions not to relitigate: + - **100 because of the server's wrap width**: the open rail, divider and spacer cost ~20 columns, so 100 still + leaves the pane 80; below it a world's 80-column text orphans a word on every other row. 30 rows because above it + the output keeps 24 rows with a three-row bar. Height never folds the rail. + - **The automatic fold acts only on a crossing** (`_narrowSeen`) and once at start, never on a resize that stays on + one side, so ⌃B b / ⌃P / the window sidebar's fold button win until the width next crosses 100. It is the same + `_railCollapsed` those toggle, published as `SidebarModel.Collapsed`, so whichever rail is drawn folds. + - **The window measures its whole width, not its cells** (`LayoutColumns`; `IPointerPresenter.WindowColumns`, set by + `TerminalView` before each grid resize as the view's width plus its margin, in cells). Folding a sidebar the host + draws widens the cells; measured on them, the fold would cross back over the line and undo itself. A host that + says nothing (the terminal, every test presenter) is measured on its cells. + - **A growing bar takes back the editor's scroll** (`InputBarControl.MeasureDOM`, `_verticalScrollOffset` by + reflection). The editor scrolls to keep the caret on a row the viewport does not have yet and never scrolls back + when the viewport grows, so a newline in a one-row bar drew the new row and a blank. The three-row floor had hidden + it; `NewlineKeyTests` caught it. +- **The status row names the keys of the mode you are in** (`ModeHints`/`StatusMode`, Client; + `SharpMUTermApp.ModeHints.cs`). Composer armed > search bar in the focused window > frozen > split > scrolled back; + while one holds, its hints replace `FocusHints` (`End returns · ⌥F freezes`, `⌥F thaws`, `⌥G next hit · ⌃F searches + again`, `⌃S sends · Esc releases · F1 full screen`). The keys are `KeyHint`s resolved through the host's + `HostKeyGlyphs` and written through `KeyGlyphs.Normalize`; `HostParityTests.TheStatusRowNamesEachModesKeysAsThisHost…` + reads each mode's row once per host at 80 and 120 columns. The longest candidate goes in that fits once as few of the + encoding and `⌃P palette` cells as it needs are given up; meters and the scrollback segment are never given up for + it, and nothing may wrap the row (the D1 lesson). A change of mode alone repaints the row: `SyncStatusMode` rides + `PostBufferPaint` as well as freeze, the composer's bands and the scroll path. - **F5 ▸ `join wraps` joins the lines a server hard-wrapped** (`ServerWrapJoiner`, Core; `WorldSession.Reflow`; `WorldDefinition.JoinWrappedLines`, off by default; the `reflow` view). **A false join is worse than a missed one**, so every condition is a reason not to join: the wrap column is known (third-longest of the last 128 diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index 81384662..0ca2dd51 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -138,6 +138,10 @@ protected override void OnSizeChanged(SizeChangedEventArgs e) { base.OnSizeChanged(e); var (columns, rows) = GridFor(e.NewSize); + + // The width a terminal this window's size would have, sidebar and all, said before the grid moves: the + // client's narrow layout reads it with the resize, and it does not change when the sidebar folds. + _driver.Pointer.WindowColumnsMeasured = Math.Max(columns, (int)((e.NewSize.Width + Margin.Left + Margin.Right) / CellSize.Width)); _driver.Resize(columns, rows); Repainted?.Invoke(); } diff --git a/src/SharpMUTerm.Avalonia/WindowPointer.cs b/src/SharpMUTerm.Avalonia/WindowPointer.cs index a372c140..22561ab1 100644 --- a/src/SharpMUTerm.Avalonia/WindowPointer.cs +++ b/src/SharpMUTerm.Avalonia/WindowPointer.cs @@ -58,6 +58,20 @@ public void Hover(PointerTarget target) public bool DrawsMenus => true; + private int _windowColumns; + + /// + /// The window's whole width in cells, the native header and sidebar included: written by + /// before each resize of the grid, so the client reads it fresh with the resize. Zero until then. + /// + internal int WindowColumnsMeasured + { + get => Volatile.Read(ref _windowColumns); + set => Volatile.Write(ref _windowColumns, value); + } + + int? IPointerPresenter.WindowColumns => WindowColumnsMeasured is > 0 and var columns ? columns : null; + public void Scrollbars(IReadOnlyList bars) { Volatile.Write(ref _bars, bars); diff --git a/src/SharpMUTerm.Client/Chrome/ModeHints.cs b/src/SharpMUTerm.Client/Chrome/ModeHints.cs new file mode 100644 index 00000000..695893f1 --- /dev/null +++ b/src/SharpMUTerm.Client/Chrome/ModeHints.cs @@ -0,0 +1,82 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Palette; + +namespace SharpMUTerm.Client.Chrome; + +/// +/// A state the focused pane (or the keyboard) is in that changes what the keys do, and so changes which keys the +/// status row names. Zellij's idea: the row that otherwise teaches the pane chords teaches the way out of whatever +/// you are in. Listed in priority order, lowest first; when two hold at once the higher one is named. +/// +public enum StatusMode +{ + /// Nothing special: the row names the pane, tab and command-line chords (FocusHints). + None, + + /// The focused pane is scrolled back with the split off: the history fills the pane. + ScrolledBack, + + /// The focused pane is scrolled back and split, the live tail under a band. + SplitScrollback, + + /// The focused pane is frozen (⌥F). + Frozen, + + /// The focused window carries the ⌃F search's result bar. + SearchResult, + + /// A docked composer holds the keyboard. + Composer, +} + +/// One key a mode answers, and what it does: ⌥F thaws. +/// The chord, as the ⌃P catalog writes keys. +/// What it does, as a verb the row reads after the key. +public sealed record ModeHint(KeyHint Key, string Does) +{ + /// The hint as the row writes it on the host whose spellings are . + public string Text(HostKeyGlyphs keys) => $"{KeyGlyphs.Normalize(Key.Resolve(keys))} {Does}"; +} + +/// +/// The keys the status row names while a holds. Pure, so both hosts — and the tests — read +/// one list, and a key is resolved through the host's own spellings () and written in the +/// palette's one vocabulary (), never typed out a second time by whoever draws the row. +/// +/// Most important first, and the row takes the longest prefix that fits: a narrow terminal keeps the way out +/// and loses the extras, rather than losing both because the pair no longer fitted — FocusHints' rule. +/// +/// +public static class ModeHints +{ + /// What 's keys are, most important first; empty for . + public static IReadOnlyList For(StatusMode mode) => mode switch + { + // The scrollback segment beside it already says ⌃End live, so this row adds what that one does not. + StatusMode.ScrolledBack => [new("⌥F", "freezes"), new("PgDn", "pages down")], + + // Bare End is claimed only while a split is open (and the caret is at the end of the line, where it rests). + StatusMode.SplitScrollback => [new("End", "returns"), new("⌥F", "freezes")], + StatusMode.Frozen => [new("⌥F", "thaws")], + StatusMode.SearchResult => [new("⌥G", "next hit"), new("⌃F", "searches again")], + StatusMode.Composer => [new("⌃S", "sends"), new("Esc", "releases"), new("F1", "full screen")], + _ => [], + }; + + /// + /// The row's candidates for on the host whose spellings are : every + /// hint, then one fewer, down to the first alone. Joined with the row's own · . + /// + public static IReadOnlyList Candidates(StatusMode mode, HostKeyGlyphs keys) + { + ArgumentNullException.ThrowIfNull(keys); + var hints = For(mode).Select(h => h.Text(keys)).ToList(); + var candidates = new List(hints.Count); + for (var n = hints.Count; n > 0; n--) + { + candidates.Add(string.Join(" · ", hints.Take(n))); + } + + return candidates; + } +} diff --git a/src/SharpMUTerm.Tui/InputBarControl.cs b/src/SharpMUTerm.Tui/InputBarControl.cs index a07bc082..febf1f8d 100644 --- a/src/SharpMUTerm.Tui/InputBarControl.cs +++ b/src/SharpMUTerm.Tui/InputBarControl.cs @@ -56,6 +56,9 @@ internal sealed class InputBarControl : MultilineEditControl, private static readonly MethodInfo? WrappedLinesMethod = typeof(MultilineEditControl).GetMethod( "GetWrappedLines", BindingFlags.Instance | BindingFlags.NonPublic, [typeof(int)]); + private static readonly FieldInfo? VerticalScrollField = typeof(MultilineEditControl).GetField( + "_verticalScrollOffset", BindingFlags.Instance | BindingFlags.NonPublic); + private readonly PromptGutter _gutter; private bool _armed = true; private int _minRows = 3; @@ -574,7 +577,19 @@ private int WrappedRowCount(int fieldWidth) public override LayoutSize MeasureDOM(LayoutConstraints constraints) { var width = Width ?? constraints.MaxWidth; - ViewportHeight = InputLayout.Height(WrappedRowCount(FieldWidth(width)), MinRows, MaxRows); + var rows = WrappedRowCount(FieldWidth(width)); + ViewportHeight = InputLayout.Height(rows, MinRows, MaxRows); + + // A bar that grows lets the rows it scrolled past back into view. The editor scrolled to keep the caret on a + // row the viewport did not yet have (a newline typed into a one-row bar), and nothing in it scrolls back when + // the viewport is made taller: the bar would grow to two rows and show the second and a blank. Private, so by + // reflection, and a rename only costs that frame. + var most = Math.Max(0, rows - ViewportHeight); + if (VerticalScrollOffset > most) + { + VerticalScrollField?.SetValue(this, most); + } + return base.MeasureDOM(constraints); } diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 1e6c56b3..e2e4a6c6 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -147,6 +147,14 @@ void HeaderActions(IReadOnlyList actions) void Chrome(ChromeOverlay chrome) { } + + /// + /// How many columns a terminal the size of the host's whole window would have: its cells plus the chrome it draws + /// beside them, in cells. Null when the cells are the whole window (the terminal, and the default). The client's + /// narrow layout measures this rather than the cells (SharpMUTermApp.LayoutColumns), because folding a + /// sidebar the host draws gives the cells its width: measured on the cells, the fold would undo itself. + /// + int? WindowColumns => null; } /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ModeHints.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ModeHints.cs new file mode 100644 index 00000000..a12cd463 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ModeHints.cs @@ -0,0 +1,80 @@ +using SharpMUTerm.Client.Chrome; + +namespace SharpMUTerm.Tui; + +/// +/// The status row's mode-aware key hints. While the focused pane is scrolled back, split, frozen, carrying the ⌃F +/// result bar, or a docked composer holds the keyboard, the row's hint names that mode's keys instead of the pane +/// and tab chords — the way out of where you are outranks the way around. The keys come from +/// (Client), resolved through this host's spellings, so the row cannot name a chord the host +/// keeps for itself; the hint goes in only where it fits, like every other droppable cell on the row. +/// +internal sealed partial class SharpMUTermApp +{ + /// The mode the status row last named the keys of, so a change of mode alone repaints it. + private StatusMode _statusModeShown; + + /// + /// The mode the keyboard is in, as far as the status row is concerned, the highest first: an armed composer, the + /// focused window carrying the search bar, the focused pane frozen, split, or scrolled back. Internal for tests. + /// + internal StatusMode CurrentStatusMode() + { + if (ComposerArmed) + { + return StatusMode.Composer; + } + + var pane = _workspace.Layout.FocusedPane; + var windowId = pane.ActiveTab ?? MainWindowId; + if (_searchMark is { } mark && string.Equals(mark.WindowId, windowId, StringComparison.Ordinal)) + { + return StatusMode.SearchResult; + } + + if (pane.Frozen) + { + return StatusMode.Frozen; + } + + if (IsScrollSplit(windowId)) + { + return StatusMode.SplitScrollback; + } + + return ScrollTarget() is { CanScrollDown: true } ? StatusMode.ScrolledBack : StatusMode.None; + } + + /// + /// The row's candidates for , longest first, as markup: each key in the client's notice + /// voice and what it does dimmed, so the way out reads at a glance. Every candidate is exactly as wide as the + /// plain text gives, which is what the row measures. + /// + private List ModeHintMarkup(StatusMode mode) + { + var keys = HostKeyGlyphs(); + var hints = ModeHints.For(mode) + .Select(h => $"[{_ink.Notice}]{MarkupText.Escape(Client.Palette.KeyGlyphs.Normalize(h.Key.Resolve(keys)))}[/] [dim]{MarkupText.Escape(h.Does)}[/]") + .ToList(); + var candidates = new List(hints.Count); + for (var n = hints.Count; n > 0; n--) + { + candidates.Add(string.Join("[dim] · [/]", hints.Take(n))); + } + + return candidates; + } + + /// + /// Repaints the status row when the mode has changed since it was drawn. Rides the frame as well as the places + /// that change a mode, because a mode can begin with no key of ours (a click in a composer, the wheel). Never + /// displaces a notice: keeps it and the resting row comes back with the hint. + /// + private void SyncStatusMode() + { + if (CurrentStatusMode() != _statusModeShown) + { + RefreshStatusRow(); + } + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs new file mode 100644 index 00000000..326afb16 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs @@ -0,0 +1,84 @@ +using SharpMUTerm.Client.Chrome; + +namespace SharpMUTerm.Tui; + +/// +/// The layout below a comfortable size: the rail folds to its strip on its own, and an empty command line is one row +/// rather than the configured height. Both give their room to the output, which is what a narrow terminal is short of. +/// +/// Why 100 columns. A MU* server wraps at 78 or 80. The open rail with its divider and spacer takes about 20 +/// columns (more with long names), so a terminal of 100 still leaves the pane the 80 a server wraps to; below that every +/// other row of a room description ends in one stray word, which was the 80×24 finding. The folded strip costs 8, so +/// at 80 the pane is 72 instead of 60. +/// +/// +/// Why 30 rows, for the command line only. The two extra rows of an empty three-row command line are kept for +/// a line that wraps, and they cost output on every frame. At 30 rows the output keeps 24 or more with them, the +/// height servers page for; below it each one is a line of the game that is not shown. Width alone decides the rail: +/// a short terminal has columns to spare. +/// +/// +/// A player's own fold wins until the width next crosses the line. The automatic fold acts only when the width +/// moves from one side of to the other (and once at start), so ⌃B b, ⌃P and the window +/// sidebar's fold button are never undone by a resize that stays on one side. The fold is the same +/// _railCollapsed they toggle, published as , so whichever rail is drawn — +/// the cells' or the window's own sidebar — folds, and both hosts agree. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// Below this many columns the rail folds itself and an empty command line is one row. + internal const int NarrowColumns = 100; + + /// Below this many rows an empty command line is one row, whatever the width. + internal const int ShortRows = 30; + + /// Which side of the width was last seen on; null before the first look. + private bool? _narrowSeen; + + /// + /// The width the narrow layout is decided on: the whole window's in cells. In a terminal that is the cells; in a + /// window that draws its own sidebar it is the cells plus the sidebar (), + /// which a fold of that sidebar does not change — measured on the cells, folding would widen them past the line + /// and the next resize would unfold it again. + /// + internal int LayoutColumns() => _pointer?.WindowColumns ?? HeaderWidth(); + + /// Whether the layout is narrow: the rail folds itself. + internal bool IsNarrow() => LayoutColumns() < NarrowColumns; + + /// Whether an empty command line is one row: a narrow or a short window. + internal bool CompactInput() => IsNarrow() || HeaderHeight() < ShortRows; + + /// Whether the rail is folded, by the player or by the narrow layout. Internal for tests. + internal bool RailCollapsed => _railCollapsed; + + /// + /// Folds or unfolds the rail when the width has crossed since it was last looked at, + /// and on the first look. Called on every resize (and by tests, which have no resize to raise); returns whether it + /// changed the rail. + /// + internal bool SyncNarrowLayout() + { + var narrow = IsNarrow(); + if (_narrowSeen == narrow) + { + return false; + } + + _narrowSeen = narrow; + if (_railCollapsed == narrow) + { + return false; + } + + _railCollapsed = narrow; + if (_workspaceRow is not null) + { + RebuildPaneArea(); + } + + PublishHostChrome(); + return true; + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index 3747e134..e8a7a11d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -369,6 +369,7 @@ private void SyncComposerBands() _input.Armed = armed is null && ReferenceEquals(_armed, _input); _second.Armed = armed is null && ReferenceEquals(_armed, _second); + SyncStatusMode(); // the composer's keys on the status row, or the pane's again } /// Re-derives who holds the keyboard after the focused pane or window changed. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index e7f81a73..dcfc1c58 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -852,6 +852,8 @@ public SharpMUTermApp( // The pane area renders the workspace's split tree (one TabControl per leaf pane). It's built // from the model and rebuilt whenever the layout changes; the initial row goes into the window. + // A narrow terminal starts with the rail folded (SyncNarrowLayout), so the first row is built that way. + SyncNarrowLayout(); _workspaceRow = BuildWorkspaceRow(); // The input area is one or two bars pinned above the status line. Each paints its own full-width @@ -956,6 +958,7 @@ public SharpMUTermApp( // laid out — so a report made here would announce a size that was already wrong. The // repaint this resize forces reports them once they are real; see ReportPaneSizes. RefreshHeader(); // re-align the status cluster to the new width + SyncNarrowLayout(); // fold or unfold the rail if the width crossed the narrow line SyncInputWidth(); // keep the input band spanning the full row after a resize SyncInputBars(); // and re-derive how tall the bars may grow in the new window }; @@ -1013,6 +1016,7 @@ public SharpMUTermApp( SyncMapSizes(); SyncPanelSizes(); SyncScrollSplitBars(); + SyncStatusMode(); }; // A modal that covers the main window entirely leaves it unpainted, so no PostBufferPaint says the native @@ -5637,9 +5641,12 @@ private void SyncInputBars() private void SyncInputHeights(bool secondShown) { var room = InputLayout.Room(HeaderHeight(), ChromeRows(), secondShown ? 2 : 1); + + // A narrow or short window starts an empty command line at one row; it still grows to MaxRows as it wraps. + var rows = CompactInput() ? InputSettings.MinRows : _config.Input.Rows; foreach (var bar in new[] { _input, _second }) { - bar.MinRows = Math.Min(_config.Input.Rows, room); + bar.MinRows = Math.Min(rows, room); bar.MaxRows = Math.Min(_config.Input.MaxRows, room); } } @@ -9350,6 +9357,7 @@ private void ToggleFreeze() } RebuildPaneArea(); + SyncStatusMode(); // ⌥F thaws, or the scrollback keys again } /// The custom link scheme the header's ☰ affordance uses to open the menu. @@ -13320,7 +13328,16 @@ private string NotConnectedMarkup() { var scrollback = ScrollbackStatus(); var suffix = scrollback.Length == 0 ? string.Empty : $" {scrollback}"; - return $"[dim]not connected · Graphics {Escape(_capabilities.Protocol.ToString())} · ⌃P palette · ⌃Q quit[/]{suffix}"; + var row = $"[dim]not connected · Graphics {Escape(_capabilities.Protocol.ToString())} · ⌃P palette · ⌃Q quit[/]{suffix}"; + + // A client with nothing connected is still read back through, frozen and searched: the mode's keys go on + // the end where they fit, the longest that does. + var mode = CurrentStatusMode(); + _statusModeShown = mode; + return mode != StatusMode.None + && ModeHintMarkup(mode).FirstOrDefault(h => MarkupWidth(row) + 3 + MarkupWidth(h) <= HeaderWidth()) is { } hint + ? $"{row} {hint}" + : row; } private void UpdateStatus() @@ -13796,6 +13813,42 @@ private string StatusBarMarkup(string character, string state) left = $"{left} {meters}"; } + // A mode's keys outrank the room and the MOO's status, and the encoding and the palette hint too: while the + // pane is scrolled back, frozen, carrying a search bar or a composer holds the keyboard, the way out is the + // thing the reader needs from this row. The longest candidate goes in that fits once as few of those two + // cells as it needs are given up (the encoding first, as the drop loop above does); a mode is temporary, and + // ⌃P is also on the header. The focus hints are not offered at all while a mode holds. + var mode = CurrentStatusMode(); + _statusModeShown = mode; + if (mode != StatusMode.None) + { + bool Fits(string hint, IEnumerable cluster) => + MarkupWidth(left) + 3 + MarkupWidth(hint) + MarkupWidth(string.Join(" ", cluster)) + MinStatusGap <= HeaderWidth(); + + var droppables = new[] { encodingCell, paletteCell }.OfType().Where(right.Contains).ToList(); + foreach (var hint in ModeHintMarkup(mode)) + { + var given = 0; + while (!Fits(hint, right.Except(droppables.Take(given))) && given < droppables.Count) + { + given++; + } + + if (!Fits(hint, right.Except(droppables.Take(given)))) + { + continue; + } + + right.RemoveAll(c => droppables.Take(given).Contains(c)); + + // Leftmost of the cluster but for the scrollback segment, which states the mode the hint answers. + right.Insert(right.Count > 0 && ScrollbackStatus().Length > 0 ? 1 : 0, hint); + break; + } + + rightBar = string.Join(" ", right); + } + // Where the character stands, once the map knows. A reserved width, so a walk does not move the right // cluster with every room name; a name too long for it is elided, never wrapped. if (StatusRoom() is { } here) @@ -13816,7 +13869,7 @@ private string StatusBarMarkup(string character, string state) } var room = HeaderWidth() - MarkupWidth(left) - MarkupWidth(rightBar) - MinStatusGap; - foreach (var focusHint in FocusHints()) + foreach (var focusHint in mode == StatusMode.None ? FocusHints() : []) { if (MarkupWidth(focusHint) + 3 <= room) { diff --git a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs index 11259924..c402d8a7 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs @@ -1,4 +1,6 @@ using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Palette; using SharpMUTerm.Graphics; using SharpMUTerm.Tui; using SharpMUTerm.Tui.Tests; @@ -214,6 +216,55 @@ await Assert.That(text).DoesNotContain(reserved.Chord.Text) } } + public static IEnumerable<(string Host, string View, StatusMode Mode, int Width, int Height)> ModeViews() => + from host in Hosts() + from view in new (string View, StatusMode Mode)[] + { + ("scrollback-up", StatusMode.SplitScrollback), + ("scrollback-split", StatusMode.SplitScrollback), + ("freeze", StatusMode.Frozen), + ("freeze-scrollback", StatusMode.Frozen), + ("search-landed", StatusMode.SearchResult), + ("panel-composer", StatusMode.Composer), + } + from size in new[] { (80, 24), (120, 32) } + select (host, view.View, view.Mode, size.Item1, size.Item2); + + /// + /// While a mode holds, the status row names that mode's keys — at least the first, the way out — as this host + /// spells them, and none of the chords the host keeps; and the row still fits on one row at 80 columns, where a + /// status line that wrapped once took a row off every pane and re-announced every pane's size. + /// + [Test] + [MethodDataSource(nameof(ModeViews))] + public async Task TheStatusRowNamesEachModesKeysAsThisHostSpellsThem(string name, string view, StatusMode mode, int width, int height) + { + var (keys, _) = HostNamed(name); + Console.SetIn(TextReader.Null); + using var headless = new HeadlessConsoleDriver(width, height); + await using var app = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, Caps) with { Keys = keys }); + var frame = app.RenderSnapshot(view); + + await Assert.That(app.CurrentStatusMode()).IsEqualTo(mode); + var glyphs = new SharpMUTerm.Client.Contributions.HostKeyGlyphs(keys.Newline.Glyph); + var status = System.Text.RegularExpressions.Regex.Replace(app.StatusMarkup, @"\[[^\]]*\]", string.Empty); + await Assert.That(status).Contains(ModeHints.Candidates(mode, glyphs)[^1]); + if (width >= 120) + { + await Assert.That(status).Contains(ModeHints.Candidates(mode, glyphs)[0]).Because("a wide row has room for every key"); + } + + foreach (var reserved in keys.Reserved) + { + await Assert.That(status).DoesNotContain(reserved.Chord.Glyph); + await Assert.That(status).DoesNotContain(KeyGlyphs.Normalize(reserved.Chord.Glyph)); + } + + await Assert.That(app.LaidOutRows.Status).IsEqualTo(1).Because("the status row never wraps"); + await Assert.That(SharpMUTermApp.MarkupWidth(app.StatusMarkup)).IsLessThanOrEqualTo(width); + await Assert.That(FrameGrid.Decode(frame, width, height)[height - 1]).Contains(ModeHints.Candidates(mode, glyphs)[^1]); + } + /// The chord the window names as its newline is one it hands the client, not one it keeps. [Test] public async Task TheWindowsNewlineIsNotOneOfItsOwnChords() diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs index 499bde6d..db436713 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs @@ -90,7 +90,7 @@ public async Task TheHeaderAndTheSidebarSitBesideTheCellsAndNoCellIsUnderThem() [Test] public async Task AFoldedRailIsASlimStripAndTheGridWidensIntoTheRoomItGaveBack() { - var (open, folded, openColumns, foldedColumns, rows) = await Run((window, view, layer, driver) => + var (open, folded, openColumns, foldedColumns, rows, openWindow, foldedWindow) = await Run((window, view, layer, driver) => { ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { })); Drain(); @@ -98,13 +98,21 @@ public async Task AFoldedRailIsASlimStripAndTheGridWidensIntoTheRoomItGaveBack() Drain(); var open = layer.Sidebar.Bounds.Width; var openColumns = driver.ScreenSize.Width; + var openWindow = ((IPointerPresenter)driver.Pointer).WindowColumns; ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { }, collapsed: true)); Drain(); window.UpdateLayout(); Drain(); - return (open, layer.Sidebar.Bounds.Width, openColumns, driver.ScreenSize.Width, layer.Sidebar.Rows.Select(r => r.Kind).ToArray()); + return (open, layer.Sidebar.Bounds.Width, openColumns, driver.ScreenSize.Width, layer.Sidebar.Rows.Select(r => r.Kind).ToArray(), + openWindow, ((IPointerPresenter)driver.Pointer).WindowColumns); }); + // The client's narrow layout reads the window's whole width, which the fold does not change: measured on the + // cells, the fold that widened them would read as the window growing past the line and undo itself. + await Assert.That(openWindow).IsNotNull(); + await Assert.That(openWindow!.Value).IsGreaterThan(openColumns); + await Assert.That(foldedWindow).IsEqualTo(openWindow); + await Assert.That(open).IsEqualTo(NativeLayout.SidebarWidth + NativeLayout.SidebarGutter); await Assert.That(folded).IsEqualTo(NativeLayout.SidebarSlim + NativeLayout.SidebarGutter); await Assert.That(foldedColumns).IsGreaterThan(openColumns); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NewlineKeyTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NewlineKeyTests.cs index a5ab7c13..539080e3 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NewlineKeyTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NewlineKeyTests.cs @@ -18,8 +18,11 @@ public async Task CtrlOrShiftEnterBreaksTheLineInsteadOfSendingIt(bool ctrl, boo await Assert.That(before.Caret.Y).IsEqualTo(draftRow); // Still drafted, not sent, and the caret has gone down a row to the start of the new one. + // Below 100 columns the empty bar is one row and grows upwards by the row the newline added, so the draft is + // read off the frame after the key rather than assumed to have stayed where it was. await Assert.That(ClientResizeTests.Rows(after).Count(r => r.Contains("say hello there"))).IsEqualTo(1); - await Assert.That(after.Caret.Y).IsEqualTo(draftRow + 1); + var draftAfter = Array.FindIndex(ClientResizeTests.Rows(after), r => r.Contains("say hello there")); + await Assert.That(after.Caret.Y).IsEqualTo(draftAfter + 1); await Assert.That(after.Caret.X).IsLessThan(before.Caret.X); } } diff --git a/tests/SharpMUTerm.Client.Tests/ModeHintsTests.cs b/tests/SharpMUTerm.Client.Tests/ModeHintsTests.cs new file mode 100644 index 00000000..fdf963eb --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/ModeHintsTests.cs @@ -0,0 +1,51 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Contributions; + +namespace SharpMUTerm.Client.Tests; + +public class ModeHintsTests +{ + [Test] + public async Task NoModeNamesNoKeys() + { + await Assert.That(ModeHints.For(StatusMode.None)).IsEmpty(); + await Assert.That(ModeHints.Candidates(StatusMode.None, HostKeyGlyphs.Terminal)).IsEmpty(); + } + + [Test] + [Arguments(StatusMode.ScrolledBack)] + [Arguments(StatusMode.SplitScrollback)] + [Arguments(StatusMode.Frozen)] + [Arguments(StatusMode.SearchResult)] + [Arguments(StatusMode.Composer)] + public async Task EveryModeNamesAtLeastItsWayOutAndCandidatesShrinkFromTheEnd(StatusMode mode) + { + var candidates = ModeHints.Candidates(mode, HostKeyGlyphs.Terminal); + await Assert.That(candidates.Count).IsEqualTo(ModeHints.For(mode).Count); + await Assert.That(candidates.Count).IsGreaterThan(0); + for (var i = 1; i < candidates.Count; i++) + { + await Assert.That(candidates[i - 1]).StartsWith(candidates[i]).Because("a narrower row loses the last key, never the first"); + await Assert.That(candidates[i].Length).IsLessThan(candidates[i - 1].Length); + } + } + + [Test] + public async Task TheKeysAreTheOnesTheModesAnswer() + { + await Assert.That(ModeHints.Candidates(StatusMode.SplitScrollback, HostKeyGlyphs.Terminal)[0]).IsEqualTo("End returns · ⌥F freezes"); + await Assert.That(ModeHints.Candidates(StatusMode.Frozen, HostKeyGlyphs.Terminal)[0]).IsEqualTo("⌥F thaws"); + await Assert.That(ModeHints.Candidates(StatusMode.SearchResult, HostKeyGlyphs.Terminal)[^1]).IsEqualTo("⌥G next hit"); + await Assert.That(ModeHints.Candidates(StatusMode.Composer, HostKeyGlyphs.Terminal)[0]) + .IsEqualTo("⌃S sends · Esc releases · F1 full screen"); + } + + /// A key is written in the palette's one vocabulary, so a host's word spelling reads as a glyph. + [Test] + public async Task AHostSpelledKeyIsNormalisedToGlyphs() + { + var hint = new ModeHint(KeyHint.ForHost(HostKey.Newline), "breaks the line"); + await Assert.That(hint.Text(new HostKeyGlyphs("Ctrl+⏎"))).IsEqualTo("⌃⏎ breaks the line"); + await Assert.That(hint.Text(HostKeyGlyphs.Terminal)).IsEqualTo("⌥⏎ breaks the line"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/InputAreaLayoutTests.cs b/tests/SharpMUTerm.Tui.Tests/InputAreaLayoutTests.cs index e8f9b730..438af39d 100644 --- a/tests/SharpMUTerm.Tui.Tests/InputAreaLayoutTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/InputAreaLayoutTests.cs @@ -125,7 +125,7 @@ private static int RowsPainted(string ansi, int width, int height, string backgr /// [Test] [Arguments(120, 34)] - [Arguments(100, 24)] + [Arguments(100, 30)] // the smallest size that keeps the configured rows (NarrowColumns, ShortRows) public async Task OneBar_GetsItsConfiguredRows_AndTheWorkspaceTakesTheRest(int width, int height) { var frame = Frame(width, height); @@ -143,7 +143,7 @@ await Assert.That(frame.Rows.Workspace) /// [Test] [Arguments(120, 34)] - [Arguments(100, 24)] + [Arguments(100, 30)] // the smallest size that keeps the configured rows (NarrowColumns, ShortRows) public async Task TwoBars_EachGetTheirRows_AndTheWorkspaceGivesThemUp(int width, int height) { Console.SetIn(TextReader.Null); @@ -171,7 +171,7 @@ await Assert.That(two.Header + two.Workspace + two.Primary + two.Second + two.St /// [Test] [Arguments(120, 34)] - [Arguments(100, 24)] + [Arguments(100, 30)] // the smallest size that keeps the configured rows (NarrowColumns, ShortRows) public async Task BothBands_ArePaintedForAsManyRowsAsTheyWereGiven(int width, int height) { // draft2 raises the second bar, puts a line in each, and arms the second — so the armed band diff --git a/tests/SharpMUTerm.Tui.Tests/NarrowLayoutTests.cs b/tests/SharpMUTerm.Tui.Tests/NarrowLayoutTests.cs new file mode 100644 index 00000000..40410aea --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NarrowLayoutTests.cs @@ -0,0 +1,218 @@ +using System.Drawing; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Below the rail folds itself and an empty command line is one row, so a +/// narrow terminal's room goes to the output. Pinned on the pane's width and on what the world is told over NAWS at +/// the three sizes the audit measured, on the player's own fold winning until the width next crosses the line, and on +/// the window's rail folding by the same rule through . +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class NarrowLayoutTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class WindowPresenter : IPointerPresenter + { + public int? Columns { get; set; } + + public List Published { get; } = []; + + public void Hover(PointerTarget target) + { + } + + public void ShowMenu(Point cell, IReadOnlyList items) + { + } + + public bool DrawsMenus => true; + + public void Scrollbars(IReadOnlyList bars) + { + } + + public void Chrome(ChromeOverlay chrome) => Published.Add(chrome); + + public int? WindowColumns => Columns; + } + + private static SharpMUTermApp App(int width, int height, HostChrome? chrome = null, IPointerPresenter? pointer = null, string? view = null) + { + Console.SetIn(TextReader.Null); + var host = ClientHost.Headless(new HeadlessConsoleDriver(width, height), Caps) with { Chrome = chrome ?? HostChrome.None, Pointer = pointer }; + var app = new SharpMUTermApp(DemoScene.Build(), host); + app.RenderSnapshot(view); + app.RenderNextFrame(); + return app; + } + + private static async Task ConnectMainAsync(SharpMUTermApp app) + { + var telnet = new RecordingTelnetSession(); + var session = new WorldSession(new WorldDefinition { Name = "W", Host = "h", Port = 1 }, sessionFactory: _ => telnet); + await session.ConnectAsync(); + app.AttachSession(session, SharpMUTermApp.MainWindowId); + app.RenderNextFrame(); + return telnet; + } + + /// + /// At 80×24 the rail is its strip and the command line one row: the pane is 72 columns where it was 60, and the + /// output is two rows taller. The world is told the pane it is really drawn in. + /// + [Test] + public async Task At80By24TheRailFoldsAndTheCommandLineIsOneRow() + { + await using var app = App(80, 24); + await Assert.That(app.RailCollapsed).IsTrue(); + await Assert.That(app.LaidOutRows.Primary).IsEqualTo(1); + + var telnet = await ConnectMainAsync(app); + var pane = app.PaneOutputRects().Values.Single(); + await Assert.That(pane.Width).IsGreaterThanOrEqualTo(72).Because("the folded strip and its divider cost 8 columns, the open rail 20"); + await Assert.That(pane.X + pane.Width).IsEqualTo(80); + await Assert.That(telnet.Sizes[^1]).IsEqualTo((pane.Width, pane.Height)); + } + + /// At 100×30 the layout is the full one: the open rail leaves the pane the 80 columns a server wraps at. + [Test] + public async Task At100By30TheRailIsOpenAndTheCommandLineKeepsItsRows() + { + await using var app = App(100, 30); + await Assert.That(app.RailCollapsed).IsFalse(); + await Assert.That(app.LaidOutRows.Primary).IsEqualTo(new InputSettings().Rows); + + var telnet = await ConnectMainAsync(app); + var pane = app.PaneOutputRects().Values.Single(); + await Assert.That(pane.Width).IsGreaterThanOrEqualTo(78).Because("100 is chosen so the open rail still leaves a server's wrap width"); + await Assert.That(telnet.Sizes[^1]).IsEqualTo((pane.Width, pane.Height)); + } + + [Test] + public async Task At120By32NothingFolds() + { + await using var app = App(120, 32); + await Assert.That(app.RailCollapsed).IsFalse(); + await Assert.That(app.LaidOutRows.Primary).IsEqualTo(new InputSettings().Rows); + + var telnet = await ConnectMainAsync(app); + var pane = app.PaneOutputRects().Values.Single(); + await Assert.That(telnet.Sizes[^1]).IsEqualTo((pane.Width, pane.Height)); + } + + /// A short but wide terminal keeps its rail and gives the command line's spare rows to the output. + [Test] + public async Task AShortWideTerminalKeepsItsRailAndStartsTheCommandLineAtOneRow() + { + await using var app = App(140, 24); + await Assert.That(app.RailCollapsed).IsFalse(); + await Assert.That(app.LaidOutRows.Primary).IsEqualTo(1); + } + + /// The one-row command line still grows as it wraps, as it always has. + [Test] + public async Task TheOneRowCommandLineGrowsAsItWraps() + { + await using var app = App(80, 24); + var rows = app.LaidOutRows; + foreach (var ch in new string('x', 200)) + { + app.SimulateKey(new ConsoleKeyInfo(ch, ConsoleKey.X, false, false, false)); + } + + app.RenderNextFrame(); + app.RenderNextFrame(); + await Assert.That(app.LaidOutRows.Primary).IsGreaterThan(1); + await Assert.That(app.LaidOutRows.Workspace).IsLessThan(rows.Workspace); + } + + /// + /// A newline typed into the one-row bar grows it to two and both rows are on screen: the editor had scrolled to + /// keep the caret on a row the viewport did not have yet, and the bar takes that scroll back when it grows. + /// + [Test] + public async Task ANewlineInTheOneRowBarShowsBothRows() + { + await using var app = App(80, 24); + app.SimulateKey(new ConsoleKeyInfo('\u001b', ConsoleKey.Escape, false, false, false)); + app.SimulateKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + app.RenderNextFrame(); + var frame = app.RenderWholeFrame(); + + await Assert.That(app.LaidOutRows.Primary).IsEqualTo(2); + var rows = FrameGrid.Decode(frame, 80, 24); + await Assert.That(rows.Count(r => r.Contains("say hello there", StringComparison.Ordinal))).IsEqualTo(1); + } + + /// + /// ⌃B b (or ⌃P, or the window's fold button) wins over the automatic fold until the width crosses the line again: + /// a resize that stays on one side changes nothing the player chose. + /// + [Test] + public async Task APlayersFoldWinsUntilTheWidthCrossesTheLine() + { + var window = new WindowPresenter { Columns = 120 }; + await using var app = App(120, 32, HostChrome.HeaderAndRail, window); + await Assert.That(app.RailCollapsed).IsFalse(); + + // Folded by hand on a wide window, and kept through a resize that stays wide. + await Assert.That(app.DispatchCommand("layout:toggle-rail")).IsTrue(); + window.Columns = 110; + await Assert.That(app.SyncNarrowLayout()).IsFalse(); + await Assert.That(app.RailCollapsed).IsTrue(); + + // Narrowed: already folded, so nothing to do — and opened by hand, it stays open while it stays narrow. + window.Columns = 90; + app.SyncNarrowLayout(); + await Assert.That(app.RailCollapsed).IsTrue(); + await Assert.That(app.DispatchCommand("layout:toggle-rail")).IsTrue(); + window.Columns = 85; + await Assert.That(app.SyncNarrowLayout()).IsFalse(); + await Assert.That(app.RailCollapsed).IsFalse(); + + // Widened past the line and narrowed again: each crossing is the automatic fold's. + window.Columns = 120; + app.SyncNarrowLayout(); + await Assert.That(app.RailCollapsed).IsFalse(); + app.DispatchCommand("layout:toggle-rail"); + window.Columns = 95; + app.SyncNarrowLayout(); + await Assert.That(app.RailCollapsed).IsTrue(); + window.Columns = 125; + await Assert.That(app.SyncNarrowLayout()).IsTrue(); + await Assert.That(app.RailCollapsed).IsFalse(); + } + + /// + /// In a window that draws its own sidebar the fold is decided on the whole window's width, not the cells'; and the + /// host is told through the sidebar's model, so the rail it draws is the one that folds. + /// + [Test] + public async Task TheWindowsOwnSidebarFoldsByTheWindowsWidthNotTheCells() + { + // 90 columns of cells in a window 120 wide: the sidebar is open, and the cells are not what is measured. + var wide = new WindowPresenter { Columns = 120 }; + await using (var app = App(90, 30, HostChrome.HeaderAndRail, wide)) + { + await Assert.That(app.RailCollapsed).IsFalse(); + await Assert.That(wide.Published.Last().Sidebar.Collapsed).IsFalse(); + } + + // 90 columns of cells in a window 95 wide: narrow, so the window's sidebar folds and is told so. + var narrow = new WindowPresenter { Columns = 95 }; + await using var folded = App(90, 30, HostChrome.HeaderAndRail, narrow); + await Assert.That(folded.RailCollapsed).IsTrue(); + await Assert.That(narrow.Published.Last().Sidebar.Collapsed).IsTrue(); + await Assert.That(folded.BuildSidebar().Collapsed).IsTrue(); + } +} From 0f538f3af01e60cebcf47ab018d0f213a942c632 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 07:25:41 +0000 Subject: [PATCH 027/113] Notices as toasts in the window; area colours, stairs and a legend on both maps A notice is now a Client model (NoticeModel: text, severity, optional action command, time). The terminal draws the status row from it exactly as before; the window also shows it as a toast bottom-right above the pane area, held while hovered, faded after six seconds, never focused, and a click runs its action through the registry (refused unless a notice offered it). Declared as the `notice` surface with model and action probes in SurfaceParityTests. MapViewModel carries area colours (MapAreaPalette: stable per area name, dark and light sets that clear the floor on every theme), stairs flags and the area an exit leads to. The cell map colours rooms through Contrast.Legible and draws a one-line legend; the native map adds names at zoom, a hover plate, stairs marks, a current-room halo and a legend. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 6 + CLAUDE.md | 37 +- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 28 ++ src/SharpMUTerm.Avalonia/MapCanvas.cs | 189 ++++++++++- src/SharpMUTerm.Avalonia/NoticeToasts.cs | 320 ++++++++++++++++++ src/SharpMUTerm.Avalonia/WindowPointer.cs | 18 + src/SharpMUTerm.Client/Chrome/NoticeModel.cs | 37 ++ .../Panels/MapAreaPalette.cs | 68 ++++ src/SharpMUTerm.Client/Panels/MapViewModel.cs | 122 ++++++- .../Surfaces/SurfaceCatalog.cs | 15 + src/SharpMUTerm.Tui/MapRenderer.cs | 187 ++++++++-- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 9 + .../Pointer/SharpMUTermApp.Desktop.cs | 5 +- .../Pointer/SharpMUTermApp.Notices.cs | 171 ++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs | 7 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 63 +++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/WorkspacePalette.cs | 10 + .../NoticeToastTests.cs | 129 +++++++ .../SurfaceParityTests.cs | 30 ++ .../PanelModelTests.cs | 50 +++ .../SurfaceCatalogTests.cs | 2 +- .../MapAreaPaletteTests.cs | 79 +++++ .../NoticeAndMapSurfaceTests.cs | 166 +++++++++ .../SnapshotViewEmptyConfigTests.cs | 2 +- 25 files changed, 1669 insertions(+), 83 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/NoticeToasts.cs create mode 100644 src/SharpMUTerm.Client/Chrome/NoticeModel.cs create mode 100644 src/SharpMUTerm.Client/Panels/MapAreaPalette.cs create mode 100644 src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/MapAreaPaletteTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aafdc4e..f4ba28d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Desktop window: notices also appear as toasts in the bottom-right corner. They stay while you hover over them, + fade after a few seconds, and never take the keyboard. Some carry a button, such as *Change layout* or + *Reconnect*. The status row still shows each notice, as it does in the terminal. +- Maps colour each area, mark rooms with stairs up or down, and show a legend: a one-line legend under the map in + the terminal, and a legend in the corner in the desktop window. In the window, room names appear when you zoom + in, and hovering over a room shows its name. - Ctrl+P lists *Fold or unfold the connection rail*, the same fold as Ctrl+B b and as the desktop window's sidebar button. - Desktop window: the header and the connections sidebar now have room of their own — a full-height toolbar diff --git a/CLAUDE.md b/CLAUDE.md index 230e1f4f..b595bbf7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -135,6 +135,16 @@ fallbacks) for inline images/maps. changes (`SyncMapSizes` on `PostBufferPaint`), never fed from a line buffer, so its control lives in `_mapControls` and not `_panes`. Its `LinkClicked` is its own and answers only `mux:map:` — the output panes' handler never sees a map link, and the map's never sees a send. + - **Both hosts draw the map from one `MapViewModel`, which carries the colours** (`MapAreaPalette`, Client; + `MapRenderer` cells, `MapCanvas` native). Each area's colour is picked by a stable hash of its name (FNV-1a, + so the same area is the same colour every run and in both hosts) from one of two eight-hue sets, dark-pane + and light-pane (`WorkspacePalette.DarkPanes`), because no fixed hex clears 3:1 on both kinds of theme; every + entry clears the floor on its themes' reading planes (`MapAreaPaletteTests`), and the cells still pass each + colour through `Contrast.Legible`. `Areas` lists the drawn area first, then areas reached by an exit. A room + carries `Up`/`Down` (an up/down exit or stub, or an exit to a room on another level) and `Elsewhere` (the + other area an exit leads to). The cells draw a one-line legend on the last row from 6 rows up — words go + first, then names shorten, then areas are counted (`+2`); it never wraps. The window adds names from zoom + 1.6, the hovered name on a plate, stairs triangles, a halo on the current room and a legend plate. - **A speedwalk sends one step and waits for the map to say it arrived** (`Speedwalk`); it goes through `SendCommandAsync`, so the recorder sees the step. It stops off the path, on the world's `WalkFailurePattern`, after `StepTimeout` with no room, and on disconnect. @@ -1056,8 +1066,8 @@ fallbacks) for inline images/maps. `mp! 23/120`, then `mp 23`) before a bar goes under 24 px. The UI font, not the cell font: this is the window's presentation. `hp`/`mp`/`mv` read as Health/Mana/Movement (`VitalsMeter.Title`). - **Not done**: the docked composer is still cells in the window; no animation on a - gauge change; the map draws one level and area, no exits between levels and no room colours/symbols; the - button's icon is the only header action. The window's menu is Avalonia's `ContextMenu`, which needs a second + gauge change; the map draws one level and area (other levels show only as stairs marks, other areas only as + a coloured spur), with no room symbols beyond the game's own; the button's icon is the only header action. The window's menu is Avalonia's `ContextMenu`, which needs a second click under a WM-less X server to take the first item (seen under Xvfb only). - **The header and the sidebar are data, and the window draws them natively beside the cells** (Client @@ -1257,6 +1267,27 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), and which chrom model in Client, draw its cells from it through `Drawing(...)`, publish the same instance to the host, declare it in `SurfaceCatalog.All`, and add its model and action probes to `SurfaceParityTests`, whose coverage guards fail until you do. +- **A notice is a model, drawn as the status row's text in both hosts and as a toast in the window** + (`NoticeModel`/`NoticeSeverity`/`NoticeAction`, Client `Chrome/`; `SharpMUTermApp.Notices.cs`; `NoticeToasts`, + Avalonia; surface `notice`, `CellsUnderNative`; the `notices` view). `Notice(...)` builds one model per call + (`Drawing`), draws the row from it with the same markup as before (`NoticeMarkup`; terminal frames are + byte-identical) and publishes it through `IPointerPresenter.Notice`. Decisions not to relitigate: + - **The window keeps the status-row copy in cells.** The toast is an overlay above the cells, never a + replacement: `HostParityTests` compares cells, the row is what a screen reader and a keyboard user read + (the announcer speaks the same notice), and the row has rules of its own (reserved fields, drop order) a + toast must not fork. The cost is one notice said in two places in the window, for six seconds. + - **A toast never takes focus and nothing on it reaches the client**: not focusable, every press on a card is + the window's, a press beside the stack goes to the cells. The stack is bottom-right inside the cell area, + ending above the row the pane area ends at (`NoticeOverlay.AboveRow`), newest at the bottom, four at most. + It fades after `NoticeModel.Duration`, held while hovered (plus a 2 s grace). Right click dismisses. + - **An action is a registry command the client offered**: a click runs `NoticeOverlay.Run` → + `RunNoticeAction`, which refuses a command no recent notice carried, then `DispatchCommand`. The cells' way to + the same door is ⌃P (`CellsVia: term:messages`). Three notices carry one so far: the layout suggestion + (*Change layout*), "switched to … · offline" (*Reconnect*) and the orphan trigger-set notice (*Open F5*). + - **Severity is mapped from `MessageSeverity`**: Info → info, Error → warning (a failure), Warning → refusal + (the default voice of `Notice`). Edge colours are the accent, `ScreenPalette.Warn` and the notice ink, held to + 4.5:1 on the status plane because they also ink the key chip and the action line. + - The message log (⌃P ▸ *Show client messages*) stays the history; a toast keeps nothing. - **Every surface that names a key is read once per host** (`EverySurfaceNamesThisHostsKeys`): ⌃P and `--help` must name the host's newline and none of the chords the host keeps (`HostKeys.Reserved`, which `TerminalView` acts on, so the window's chords and the list are one). The help page is one writer @@ -1344,7 +1375,7 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg `menu-fuzzy` (`trig sel` typed into ⌃P after a real drag, so the trigger builder's entry is offered — the frame showing a two-word fuzzy match highlighted), `menu-recent` (⌃P opened empty after two commands ran through the palette's own path, `RunFromPalette` — RECENT at the top, newest first, listed once), - `messages`, `quit`, `connections` (**two connections on one world** — the one view where the header's + `messages`, `notices` (two notices with a refusal between them, the first carrying an action — the window shows them as toasts over the same cells), `quit`, `connections` (**two connections on one world** — the one view where the header's fraction, the rail's dots and the quit prompt's count are all visible together and all have to agree; every other view has at most one character connected per world, which is what hid a header dividing connections by *worlds* and a quit prompt reducing them to distinct world names), `characters` (**two diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index cc6c25a7..d454a25f 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -46,6 +46,8 @@ internal sealed class DesktopLayer : Canvas private readonly NativeSidebar _sidebar; private readonly Dictionary _whoHere = new(StringComparer.Ordinal); private readonly Dictionary _quickBars = new(StringComparer.Ordinal); + private readonly NoticeToasts _toasts; + private int _noticeAboveRow; /// The cells. /// @@ -68,6 +70,16 @@ public DesktopLayer(TerminalView view, HostChrome chrome) _sidebar = new NativeSidebar(view) { IsVisible = false }; Children.Add(_header); Children.Add(_sidebar); + + // The toasts last, over everything: a notice is the one thing the window says over a panel. + _toasts = new NoticeToasts(); + Children.Add(_toasts); + _pointer.NoticeSaid += notice => Dispatcher.UIThread.Post(() => + { + _noticeAboveRow = notice.AboveRow; + Sync(); + _toasts.Show(notice); + }); _view.Repainted += Sync; SyncInsets(collapsed: false); Sync(); @@ -133,8 +145,24 @@ internal void Sync() SyncChrome(); SyncButtons(frame, cell); SyncPanels(frame, cell); + SyncToasts(frame, cell); } + /// The toasts over the cell area, their stack sitting on the row the client said the pane area ends at. + private void SyncToasts(ScreenFrame frame, Size cell) + { + var origin = CellOrigin; + SetLeft(_toasts, origin.X); + SetTop(_toasts, origin.Y); + _toasts.Width = Math.Max(0, frame.Width * cell.Width); + _toasts.Height = Math.Max(0, frame.Height * cell.Height); + var above = _noticeAboveRow > 0 && _noticeAboveRow < frame.Height ? _noticeAboveRow : Math.Max(0, frame.Height - 2); + _toasts.Bottom = above * cell.Height; + } + + /// The notice toasts. Internal for tests. + internal NoticeToasts Toasts => _toasts; + /// /// The native header across the top and the sidebar down the left, when the window draws them — always, a modal in /// front included: the client draws its modals in the cells, which no longer reach under either, so the chrome diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index 3e718b04..9d2787f5 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -150,7 +150,8 @@ protected override void OnPointerMoved(PointerEventArgs e) { _hovered = room?.Id; Cursor = new Cursor(room is null ? StandardCursorType.Arrow : StandardCursorType.Hand); - ToolTip.SetTip(this, room is null ? null : room.Current ? $"{room.Name} — you are here" : $"{room.Name} — click to walk here"); + // The name is drawn on the canvas beside the room; the tip says only what a click does. + ToolTip.SetTip(this, room is null || room.Current ? null : "Click to walk here"); InvalidateVisual(); } } @@ -202,6 +203,41 @@ internal void ZoomAbout(Point point, double notches) // ── Drawing ─────────────────────────────────────────────────────────────────────────────── + /// The zoom from which every room's name is written under it, not only the hovered one's. + internal const double NamesFromZoom = 1.6; + + /// + /// The colour a room is drawn in: its area's, as the view gives it (), or the + /// text colour faded when the area has no name. Internal for tests, which hold it to the model's hex. + /// + internal Color AreaColourOf(MapViewRoom room) => + _model.AreaColour is { } hex ? Parse(hex) : Faded(0.55); + + /// The colour of the area a room's way out leads into, or null. Internal for tests. + internal Color? ElsewhereColourOf(MapViewRoom room) => + _model.ColourOf(room.Elsewhere) is { } hex ? Parse(hex) : null; + + /// + /// The legend's entries, in the order drawn: you, the stairs marks when a room has them, a walk under way, then + /// every area the view names in its colour. Internal for tests. + /// + internal IReadOnlyList<(string Label, Color Swatch)> LegendEntries() + { + var entries = new List<(string, Color)> { ("you", Parse(_ink.Bar)) }; + if (_model.Rooms.Any(r => r.Up || r.Down)) + { + entries.Add(("stairs up / down", Faded(0.85))); + } + + if (_model.Rooms.Any(r => r.Ahead)) + { + entries.Add(("walk", Parse(_ink.Low))); + } + + entries.AddRange(_model.Areas.Select(a => (a.Name, Parse(a.Colour)))); + return entries; + } + public override void Render(DrawingContext context) { var bounds = new Rect(Bounds.Size); @@ -225,39 +261,62 @@ public override void Render(DrawingContext context) var size = RoomSize; var accent = Parse(_ink.Bar); var path = Parse(_ink.Low); - var plainFill = new SolidColorBrush(Mix(_plane, _text, 0.16)); - var plainEdge = new Pen(new SolidColorBrush(Faded(0.55)), 1.2); var radius = size * 0.22; + var names = Zoom >= NamesFromZoom; foreach (var room in _model.Rooms) { var c = CentreOf(room); var rect = new Rect(c.X - (size / 2), c.Y - (size / 2), size, size); - if (!rect.Intersects(bounds)) + if (!rect.Inflate(size).Intersects(bounds)) { continue; } + // A way into another area: a short spur off the room's corner, in that area's colour. + if (ElsewhereColourOf(room) is { } elsewhere) + { + var spur = new Pen(new SolidColorBrush(elsewhere), Math.Clamp(2 * Zoom, 1.5, 3), lineCap: PenLineCap.Round); + context.DrawLine(spur, rect.BottomRight - new Vector(size * 0.1, size * 0.1), rect.BottomRight + new Vector(size * 0.32, size * 0.32)); + context.DrawEllipse(new SolidColorBrush(elsewhere), null, rect.BottomRight + new Vector(size * 0.36, size * 0.36), size * 0.12, size * 0.12); + } + + var area = AreaColourOf(room); if (room.Current) { - // A soft halo, then the room in the accent: the one thing the eye should find first. - context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x40, accent.R, accent.G, accent.B)), null, rect.Inflate(size * 0.22), radius * 1.6, radius * 1.6); + // A soft halo and a ring, then the room in the accent: the one thing the eye should find first. + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x38, accent.R, accent.G, accent.B)), null, rect.Inflate(size * 0.34), radius * 2, radius * 2); + context.DrawRectangle(null, new Pen(new SolidColorBrush(Color.FromArgb(0xB0, accent.R, accent.G, accent.B)), 1.5), rect.Inflate(size * 0.2), radius * 1.6, radius * 1.6); context.DrawRectangle(new SolidColorBrush(accent), new Pen(new SolidColorBrush(Mix(accent, Colors.White, 0.35)), 1.5), rect, radius, radius); - continue; + } + else + { + var fill = new SolidColorBrush(Mix(_plane, area, room.Id == _hovered ? 0.55 : 0.3)); + var edge = room.Ahead ? new Pen(new SolidColorBrush(path), 2.2) : new Pen(new SolidColorBrush(area), 1.4); + context.DrawRectangle(fill, edge, rect, radius, radius); + if (room.Locked) + { + var lockPen = new Pen(new SolidColorBrush(Faded(0.7)), 1.2); + context.DrawLine(lockPen, rect.TopLeft + new Vector(size * 0.25, size * 0.25), rect.BottomRight - new Vector(size * 0.25, size * 0.25)); + } } - var fill = room.Id == _hovered ? new SolidColorBrush(Mix(_plane, _text, 0.3)) : plainFill; - var edge = room.Ahead ? new Pen(new SolidColorBrush(path), 2) : plainEdge; - context.DrawRectangle(fill, edge, rect, radius, radius); - if (room.Locked) + DrawStairs(context, room, rect, room.Current ? Contrasting(accent) : _text); + + if ((names || room.Id == _hovered) && room.Id != _hovered) { - var lockPen = new Pen(new SolidColorBrush(Faded(0.6)), 1.2); - context.DrawLine(lockPen, rect.TopLeft + new Vector(size * 0.25, size * 0.25), rect.BottomRight - new Vector(size * 0.25, size * 0.25)); + DrawName(context, room.Name, c, size, plate: false); } } + // The hovered room's name last, on a plate, so it reads over its neighbours. + if (_hovered is { } hoveredId && byId.TryGetValue(hoveredId, out var hovered)) + { + DrawName(context, hovered.Current ? $"{hovered.Name} — you are here" : hovered.Name, CentreOf(hovered), size, plate: true); + } + // What and where, in the corner: the area and level, and a walk under way. - var label = _model.Area is { Length: > 0 } area ? $"{area} · level {_model.Level}" : $"level {_model.Level}"; - DrawText(context, label, new Point(10, 8), 12, Faded(0.75)); + var label = _model.Area is { Length: > 0 } areaName ? $"{areaName} · level {_model.Level}" : $"level {_model.Level}"; + DrawText(context, label, new Point(10, 8), 12, _model.AreaColour is { } areaHex ? Parse(areaHex) : Faded(0.75)); if (_model.Walking is { } walking) { DrawText(context, walking, new Point(10, 26), 12, path); @@ -266,8 +325,108 @@ public override void Render(DrawingContext context) { DrawText(context, here.Name, new Point(10, 26), 12, accent); } + + DrawLegend(context, bounds); + } + + /// Up and down marks: a small triangle at the top of the room for a way up, at the bottom for a way down. + private void DrawStairs(DrawingContext context, MapViewRoom room, Rect rect, Color ink) + { + if (!room.Up && !room.Down) + { + return; + } + + var brush = new SolidColorBrush(Color.FromArgb(0xE0, ink.R, ink.G, ink.B)); + var w = rect.Width * 0.26; + var h = rect.Height * 0.2; + var mid = rect.Center.X; + if (room.Up) + { + var top = rect.Y + (rect.Height * 0.16); + context.DrawGeometry(brush, null, Triangle(new Point(mid, top), new Point(mid - w, top + h), new Point(mid + w, top + h))); + } + + if (room.Down) + { + var bottom = rect.Bottom - (rect.Height * 0.16); + context.DrawGeometry(brush, null, Triangle(new Point(mid, bottom), new Point(mid - w, bottom - h), new Point(mid + w, bottom - h))); + } + } + + private static StreamGeometry Triangle(Point a, Point b, Point c) + { + var geometry = new StreamGeometry(); + using var g = geometry.Open(); + g.BeginFigure(a, isFilled: true); + g.LineTo(b); + g.LineTo(c); + g.EndFigure(isClosed: true); + return geometry; } + /// A room's name centred under it; on a plate of the pane's own colour when . + private void DrawName(DrawingContext context, string name, Point centre, double size, bool plate) + { + var maxWidth = plate ? 280 : Math.Max(30, (Spacing * Zoom) - 4); + var text = PanelText.Format(name, 11, plate ? _text : Faded(0.8), bold: plate, maxWidth); + var at = new Point(centre.X - (text.Width / 2), centre.Y + (size / 2) + 3); + if (plate) + { + var back = new Rect(at.X - 6, at.Y - 2, text.Width + 12, text.Height + 4); + context.DrawRectangle(new SolidColorBrush(Mix(_plane, _text, 0.12)), new Pen(new SolidColorBrush(Faded(0.35)), 1), back, 4, 4); + } + else + { + // The pane's own plane behind the words, so an exit line passing under a room does not strike them out. + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0xD0, _plane.R, _plane.G, _plane.B)), null, new Rect(at.X - 2, at.Y, text.Width + 4, text.Height), 2, 2); + } + + context.DrawText(text, at); + } + + /// + /// The legend, in the bottom-left corner on a plate: you, the stairs, a walk, and each area in its colour. Drawn only + /// where it fits, and it never takes the pointer from a room under it (the canvas hit-tests rooms only). + /// + private void DrawLegend(DrawingContext context, Rect bounds) + { + var entries = LegendEntries(); + const double size = 11, row = 16, pad = 8, swatch = 9; + var widest = entries.Max(e => PanelText.Measure(e.Label, size, bold: false)); + var width = pad + swatch + 6 + widest + pad; + var height = (pad * 2) + (entries.Count * row) - (row - size - 3); + if (width > bounds.Width * 0.6 || height > bounds.Height * 0.6) + { + return; + } + + var plate = new Rect(10, bounds.Height - height - 10, width, height); + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0xE6, _plane.R, _plane.G, _plane.B)), new Pen(new SolidColorBrush(Faded(0.25)), 1), plate, 5, 5); + var y = plate.Y + pad; + foreach (var (label, colour) in entries) + { + var mark = new Rect(plate.X + pad, y + 2, swatch, swatch); + if (label == "stairs up / down") + { + var brush = new SolidColorBrush(colour); + context.DrawGeometry(brush, null, Triangle(new Point(mark.Center.X, mark.Y), new Point(mark.X, mark.Center.Y - 0.5), new Point(mark.Right, mark.Center.Y - 0.5))); + context.DrawGeometry(brush, null, Triangle(new Point(mark.Center.X, mark.Bottom), new Point(mark.X, mark.Center.Y + 0.5), new Point(mark.Right, mark.Center.Y + 0.5))); + } + else + { + context.DrawRectangle(new SolidColorBrush(colour), null, mark, 2, 2); + } + + context.DrawText(PanelText.Format(label, size, Faded(0.85), bold: false, widest + 1), new Point(mark.Right + 6, y)); + y += row; + } + } + + /// Black or white, whichever reads on : the stairs marks on the accent room. + private static Color Contrasting(Color fill) => + (0.299 * fill.R) + (0.587 * fill.G) + (0.114 * fill.B) > 140 ? Color.FromRgb(0x10, 0x10, 0x14) : Colors.White; + private static void DrawText(DrawingContext context, string text, Point at, double size, Color colour) => context.DrawText( new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Typeface.Default, size, new SolidColorBrush(colour)) diff --git a/src/SharpMUTerm.Avalonia/NoticeToasts.cs b/src/SharpMUTerm.Avalonia/NoticeToasts.cs new file mode 100644 index 00000000..2b1f0fc8 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/NoticeToasts.cs @@ -0,0 +1,320 @@ +using System.Diagnostics; +using System.Globalization; +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The client's notices as toasts: stacked at the bottom right of the cell area, just above the command line and the +/// status row, newest at the bottom. Each is the very the status row's cells were drawn from +/// (which still carry it underneath — the toast is an overlay, so the cells are what they are in a terminal), and the +/// message log stays the history: a toast fades after and is not kept. +/// +/// Input. Only a toast is hit: the control paints nothing between its toasts, and Avalonia hits only what was +/// painted, so everywhere else in the control the pointer goes through to the cells. While the pointer is over a toast it stays, and for a moment after it leaves. A left click on +/// a toast with an action runs it — through , the registry, never a command the window +/// built — and a click without one, or a right click, dismisses it. Nothing here is focusable, so a toast never takes +/// the keyboard from the command line. +/// +/// +internal sealed class NoticeToasts : Control +{ + /// How many toasts are stacked at once; an older one is retired when a fifth arrives. + internal const int MaxShown = 4; + + /// How long a toast takes to fade once its time is up. + internal static readonly TimeSpan FadeTime = TimeSpan.FromMilliseconds(450); + + /// How long a toast stays after the pointer leaves it. + internal static readonly TimeSpan HoverGrace = TimeSpan.FromSeconds(2); + + private const double Inset = 12, Gap = 8, Padding = 10, EdgeWidth = 4, CardWidth = 380, TextSize = 13, ChipSize = 11; + + private readonly List _toasts = []; + private readonly Stopwatch _clock = Stopwatch.StartNew(); + private readonly DispatcherTimer _timer; + private Point? _pointer; + + public NoticeToasts() + { + Focusable = false; + IsTabStop = false; + ClipToBounds = true; + _timer = new DispatcherTimer(TimeSpan.FromMilliseconds(50), DispatcherPriority.Background, (_, _) => Tick()); + AutomationProperties.SetName(this, "Notices"); + } + + /// The toasts on screen, oldest first. Internal for tests. + internal IReadOnlyList Shown => _toasts.Select(t => t.Overlay.Notice).ToList(); + + /// The bottom of the stack, in this control's coordinates: just above the pane area's last row. + internal double Bottom { get; set; } + + /// Shows a notice the client said. A toast for the same notice (by sequence) is not shown twice. + public void Show(NoticeOverlay overlay) + { + ArgumentNullException.ThrowIfNull(overlay); + if (_toasts.Any(t => t.Overlay.Notice.Sequence == overlay.Notice.Sequence)) + { + return; + } + + _toasts.Add(new Toast(overlay, _clock.Elapsed)); + while (_toasts.Count > MaxShown) + { + _toasts.RemoveAt(0); + } + + _timer.Start(); + InvalidateVisual(); + } + + /// + /// Runs or dismisses the toast showing notice , as a left click on it does. Internal for + /// tests; a real click comes through . + /// + internal void Click(long sequence) + { + var toast = _toasts.FirstOrDefault(t => t.Overlay.Notice.Sequence == sequence); + if (toast is null) + { + return; + } + + _toasts.Remove(toast); + if (toast.Overlay.Notice.Action is { } action) + { + toast.Overlay.Run(action.Command); + } + + InvalidateVisual(); + } + + /// Moves every toast's clock on by , as time passing would. Internal for tests. + internal void Advance(TimeSpan by) + { + foreach (var toast in _toasts) + { + toast.Shown -= by; + toast.HeldUntil -= by; + } + + Tick(); + } + + /// Where each toast is drawn, oldest first, in this control's coordinates. Internal for tests. + internal IReadOnlyList Rects() => Layout().Select(l => l.Rect).ToList(); + + private void Tick() + { + var now = _clock.Elapsed; + var hovered = HoveredToast(); + foreach (var toast in _toasts) + { + if (toast == hovered) + { + toast.HeldUntil = now + HoverGrace; + } + } + + var before = _toasts.Count; + _toasts.RemoveAll(t => FadeOf(t, now) <= 0); + if (_toasts.Count == 0) + { + _timer.Stop(); + } + + if (before != _toasts.Count || _toasts.Any(t => Fading(t, now))) + { + InvalidateVisual(); + } + } + + private static TimeSpan Due(Toast toast) => toast.Shown + NoticeModel.Duration > toast.HeldUntil ? toast.Shown + NoticeModel.Duration : toast.HeldUntil; + + private static bool Fading(Toast toast, TimeSpan now) => now > Due(toast); + + private static double FadeOf(Toast toast, TimeSpan now) + { + var past = (now - Due(toast)).TotalMilliseconds; + return past <= 0 ? 1 : Math.Max(0, 1 - (past / FadeTime.TotalMilliseconds)); + } + + private Toast? HoveredToast() => + _pointer is { } at ? Layout().LastOrDefault(l => l.Rect.Contains(at)).Toast : null; + + // ── Layout ─────────────────────────────────────────────────────────────────────────────── + + private readonly record struct Placed(Toast Toast, Rect Rect, FormattedText Text, FormattedText? Chip, FormattedText? Action); + + private List Layout() + { + var placed = new List(); + var width = Math.Min(CardWidth, Bounds.Width - (2 * Inset)); + if (width < 120 || _toasts.Count == 0) + { + return placed; + } + + var bottom = (Bottom > 0 ? Math.Min(Bottom, Bounds.Height) : Bounds.Height) - Gap; + var x = Bounds.Width - Inset - width; + + // Newest at the bottom: lay out from the newest upwards, then hand them back oldest first. + for (var i = _toasts.Count - 1; i >= 0; i--) + { + var toast = _toasts[i]; + var palette = toast.Overlay.Palette; + var ink = PanelText.Parse(palette.Text); + var inner = width - EdgeWidth - (2 * Padding); + var chip = toast.Overlay.Notice.Key is { } key ? Format(key, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var textWidth = inner - (chip is null ? 0 : chip.Width + 8); + var text = Format(toast.Overlay.Notice.Text, TextSize, ink, bold: false, Math.Max(40, textWidth), lines: 3); + var action = toast.Overlay.Notice.Action is { } a ? Format($"{a.Label} ›", ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var height = (2 * Padding) + text.Height + (action is null ? 0 : action.Height + 6); + var top = bottom - height; + if (top < Inset) + { + break; + } + + placed.Insert(0, new Placed(toast, new Rect(x, top, width, height), text, chip, action)); + bottom = top - Gap; + } + + return placed; + } + + private static FormattedText Format(string text, double size, Color colour, bool bold, double maxWidth, int lines = 1) => + new(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, + new Typeface(FontFamily.Default, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), size, new SolidColorBrush(colour)) + { + MaxTextWidth = Math.Max(1, maxWidth), + MaxLineCount = lines, + Trimming = TextTrimming.CharacterEllipsis, + }; + + // ── Input ──────────────────────────────────────────────────────────────────────────────── + + internal bool Hits(Point point) => Layout().Any(l => l.Rect.Contains(point)); + + protected override void OnPointerMoved(PointerEventArgs e) + { + base.OnPointerMoved(e); + _pointer = e.GetPosition(this); + var over = HoveredToast(); + Cursor = new Cursor(over?.Overlay.Notice.Action is not null ? StandardCursorType.Hand : StandardCursorType.Arrow); + ToolTip.SetTip(this, over?.Overlay.Notice.Action is { } action ? $"{action.Label} — click" : over is null ? null : "Click to dismiss"); + e.Handled = true; + Tick(); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + _pointer = null; + ToolTip.SetTip(this, null); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + e.Handled = true; + var at = e.GetPosition(this); + var hit = Layout().LastOrDefault(l => l.Rect.Contains(at)); + if (hit.Toast is null) + { + return; + } + + var point = e.GetCurrentPoint(this); + if (point.Properties.IsRightButtonPressed) + { + _toasts.Remove(hit.Toast); + InvalidateVisual(); + return; + } + + if (point.Properties.IsLeftButtonPressed) + { + Click(hit.Toast.Overlay.Notice.Sequence); + } + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + } + + protected override void OnPointerWheelChanged(PointerWheelEventArgs e) + { + base.OnPointerWheelChanged(e); + e.Handled = true; + } + + // ── Drawing ────────────────────────────────────────────────────────────────────────────── + + public override void Render(DrawingContext context) + { + var now = _clock.Elapsed; + var hovered = HoveredToast(); + foreach (var (toast, rect, text, chip, action) in Layout()) + { + var palette = toast.Overlay.Palette; + var plane = PanelText.Parse(palette.Plane); + var edge = PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)); + using var _ = context.PushOpacity(FadeOf(toast, now)); + + // A soft shadow, the card, and the severity edge down its left side. + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x50, 0, 0, 0)), null, rect.Translate(new Vector(0, 2)).Inflate(1), 7, 7); + var lift = toast == hovered ? 0.08 : 0; + context.DrawRectangle( + new SolidColorBrush(Mix(plane, PanelText.Parse(palette.Text), lift)), + new Pen(new SolidColorBrush(Color.FromArgb(0x60, edge.R, edge.G, edge.B)), 1), + rect, + 6, + 6); + using (context.PushClip(new RoundedRect(rect, 6))) + { + context.FillRectangle(new SolidColorBrush(edge), new Rect(rect.X, rect.Y, EdgeWidth, rect.Height)); + } + + var x = rect.X + EdgeWidth + Padding; + var y = rect.Y + Padding; + if (chip is not null) + { + var chipRect = new Rect(x - 3, y + 1, chip.Width + 6, chip.Height); + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x30, edge.R, edge.G, edge.B)), null, chipRect, 3, 3); + context.DrawText(chip, new Point(x, y + 1)); + x += chip.Width + 8; + } + + context.DrawText(text, new Point(x, y)); + if (action is not null) + { + context.DrawText(action, new Point(rect.X + EdgeWidth + Padding, y + text.Height + 6)); + } + } + } + + private static Color Mix(Color from, Color to, double amount) => Color.FromRgb( + (byte)(from.R + ((to.R - from.R) * amount)), + (byte)(from.G + ((to.G - from.G) * amount)), + (byte)(from.B + ((to.B - from.B) * amount))); + + private sealed class Toast(NoticeOverlay overlay, TimeSpan shown) + { + public NoticeOverlay Overlay { get; } = overlay; + + public TimeSpan Shown { get; set; } = shown; + + public TimeSpan HeldUntil { get; set; } + } +} diff --git a/src/SharpMUTerm.Avalonia/WindowPointer.cs b/src/SharpMUTerm.Avalonia/WindowPointer.cs index a372c140..f37fb8ad 100644 --- a/src/SharpMUTerm.Avalonia/WindowPointer.cs +++ b/src/SharpMUTerm.Avalonia/WindowPointer.cs @@ -81,4 +81,22 @@ void IPointerPresenter.Chrome(ChromeOverlay chrome) Volatile.Write(ref _chrome, chrome); ChromeChanged?.Invoke(); } + + private IReadOnlyList _notices = []; + + /// The notices the client has said, newest last, the most recent . + public IReadOnlyList Notices => Volatile.Read(ref _notices); + + /// How many notices are kept for the toasts; the message log is the history. + public const int NoticesKept = 8; + + /// Raised on the client's thread with each notice the client says. + public event Action? NoticeSaid; + + void IPointerPresenter.Notice(NoticeOverlay notice) + { + var next = Notices.Append(notice).TakeLast(NoticesKept).ToList(); + Volatile.Write(ref _notices, next); + NoticeSaid?.Invoke(notice); + } } diff --git a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs new file mode 100644 index 00000000..e557033a --- /dev/null +++ b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs @@ -0,0 +1,37 @@ +namespace SharpMUTerm.Client.Chrome; + +/// How loud a notice is. Each host says it in its own way: the status row by ink, a toast by its edge. +public enum NoticeSeverity +{ + /// Something happened that the player asked for (a character switched, a layout applied). + Info, + + /// Something failed: a connection that would not open, a settings file that would not save. + Warning, + + /// The client declined to do what was asked, or did less than the label promised (the default). + Refusal, +} + +/// A command a notice offers, by registry id, with what a host may call it. +/// The command id; run through the client's registry, never built by a host. +/// What the action does, for a button or a tooltip (Reconnect). +public sealed record NoticeAction(string Command, string Label); + +/// +/// One notice, as data: the client's display-message, said once and gone in a few seconds. The terminal draws +/// it on the status row (SharpMUTermApp.NoticeMarkup); the window draws the same instance as a toast over the +/// cells. Every notice is kept in the client message log as well (⌃P ▸ Show client messages), which is the history: +/// neither view keeps one. +/// +/// What it says, as plain text. +/// How loud it is. +/// An optional chip naming the surface that spoke (⌃B, ⌃P, ⌥M). +/// A command the notice offers, or null. Only the window can offer it as a click. +/// When it was said, on the client's clock. +/// Counts the run's notices, so two that say the same thing are still two. +public sealed record NoticeModel(string Text, NoticeSeverity Severity, string? Key, NoticeAction? Action, DateTimeOffset At, long Sequence) +{ + /// How long a notice holds the status row, and how long a toast stays before it fades. + public static readonly TimeSpan Duration = TimeSpan.FromSeconds(6); +} diff --git a/src/SharpMUTerm.Client/Panels/MapAreaPalette.cs b/src/SharpMUTerm.Client/Panels/MapAreaPalette.cs new file mode 100644 index 00000000..237e5508 --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/MapAreaPalette.cs @@ -0,0 +1,68 @@ +namespace SharpMUTerm.Client.Panels; + +/// +/// The colours a map gives its areas: one per area name, the same every run and in both hosts, from a closed +/// set of eight hues. +/// +/// Two sets of hexes, one set of hues. A colour is read against the pane it lands on, and the pane planes of a +/// dark theme and a light one leave no colour that clears the legibility floor (3:1) on both: the darkest plane a +/// Light pane can wear wants a foreground no brighter than about 0.13 in relative luminance, the brightest a Dark or +/// Solarized Dark pane can wear wants one no darker than about 0.18. So each hue has a dark-theme hex and a +/// light-theme hex, and the client picks the set by its theme (). The index an area gets is the same +/// in both, so an area keeps its hue when the theme changes. MapAreaPaletteTests holds every hex to the floor +/// against every pane plane of the themes it serves. +/// +/// +/// The index is a hash of the name (FNV-1a over its characters, ordinal), never , +/// which changes from run to run. Two areas can share a hue; the legend names them, and an area's name is the second +/// cue wherever its colour is the first. +/// +/// +public sealed class MapAreaPalette +{ + private readonly string[] _colours; + + private MapAreaPalette(string name, string[] colours) + { + Name = name; + _colours = colours; + } + + /// Amber, jade, azure, orchid, coral, moss, cyan, lavender — for a dark theme's panes. + public static MapAreaPalette Dark { get; } = new( + "dark", + ["#e0a458", "#5ec79f", "#7fa8ff", "#e08fd6", "#f08a7e", "#b5c46a", "#5cc3dc", "#b9a2ff"]); + + /// The same hues, deep enough for a light theme's panes. + public static MapAreaPalette Light { get; } = new( + "light", + ["#7a4600", "#0f6a4a", "#2a52b0", "#86307c", "#a02c22", "#4c5a06", "#0b5a6e", "#5b3aa8"]); + + /// Which set this is (dark, light). + public string Name { get; } + + /// The colours, by index. + public IReadOnlyList Colours => _colours; + + /// The set for a theme whose panes are dark () or light. + public static MapAreaPalette For(bool darkPanes) => darkPanes ? Dark : Light; + + /// The index gets in every set. + public static int IndexOf(string area) + { + ArgumentNullException.ThrowIfNull(area); + unchecked + { + var hash = 2166136261u; + foreach (var c in area) + { + hash = (hash ^ c) * 16777619u; + } + + return (int)(hash % 8u); + } + } + + /// The colour of the area called , as #rrggbb. + public string Colour(string area) => _colours[IndexOf(area)]; +} diff --git a/src/SharpMUTerm.Client/Panels/MapViewModel.cs b/src/SharpMUTerm.Client/Panels/MapViewModel.cs index 334578fb..e62bccbd 100644 --- a/src/SharpMUTerm.Client/Panels/MapViewModel.cs +++ b/src/SharpMUTerm.Client/Panels/MapViewModel.cs @@ -10,23 +10,38 @@ namespace SharpMUTerm.Client.Panels; /// Whether the character is in it. /// Whether a walk under way still goes through it. /// Whether the player locked it out of paths. -public sealed record MapViewRoom(long Id, string Name, int X, int Y, bool Current, bool Ahead, bool Locked); +/// Whether it has a way to a level above: an up exit, or any exit to a room higher up. +/// Whether it has a way to a level below. +/// +/// The name of another area one of its exits leads into (the first by name), or null. Both views mark the way out in +/// that area's colour (). +/// +public sealed record MapViewRoom( + long Id, string Name, int X, int Y, bool Current, bool Ahead, bool Locked, bool Up = false, bool Down = false, string? Elsewhere = null); /// A drawn exit between two rooms of the view, once per pair. public sealed record MapViewExit(long From, long To); +/// An area a view names, with the colour every view draws it in. +/// The area's name, bounded; the game's text. +/// Its colour as #rrggbb, from : stable for the name. +/// True for the area the view draws; false for one its exits lead into. +public sealed record MapViewArea(string Name, string Colour, bool Drawn); + /// /// The part of a character's map a view draws: the rooms of the current room's area on its level, nearest the -/// current room first and bounded, with the exits between them. The terminal draws its map from the recorder in -/// cells (MapRenderer); the window draws this as a canvas over the same pane. A click on a room is handed -/// back by id to the client, which walks there through the same speedwalk a cell click uses. +/// current room first and bounded, with the exits between them, which rooms have a way up or down, which lead into +/// another area, and the colour of every area named. The terminal draws its map in cells (MapRenderer) and the +/// window draws a canvas over the same pane, both from this, so they cannot disagree about where the character is, +/// what colour an area is or which rooms have stairs. A click on a room is handed back by id to the client, which +/// walks there through the same speedwalk a cell click uses. /// public sealed record MapViewModel(string? Area, int Level, IReadOnlyList Rooms, IReadOnlyList Exits, string? Walking) { /// The most rooms a view is given: the nearest to the current room are kept. public const int MaxRooms = 1500; - /// The longest room name a view is given. + /// The longest room or area name a view is given. public const int MaxNameLength = 80; /// @@ -35,16 +50,36 @@ public sealed record MapViewModel(string? Area, int Level, IReadOnlyList public long? AnchorId { get; init; } + /// + /// The areas the view names, with their colours: the drawn area first (when it has a name), then every area an + /// exit of a drawn room leads into, by name. Both views read their area colours here and nowhere else, and both + /// draw their legend from this list. + /// + public IReadOnlyList Areas { get; init; } = []; + /// The room the character is in, or null. public MapViewRoom? Current => Rooms.FirstOrDefault(r => r.Current); + /// The colour of the area the view draws, or null when that area has no name. + public string? AreaColour => Areas.FirstOrDefault(a => a.Drawn)?.Colour; + + /// The colour the view gives the area called , or null when it names no such area. + public string? ColourOf(string? name) => + name is null ? null : Areas.FirstOrDefault(a => string.Equals(a.Name, name, StringComparison.Ordinal))?.Colour; + /// /// The view of around . With no current room, the level /// and area of the most recently added room are drawn, so a map recorded earlier still shows. /// - public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerable ahead, string? walking) + /// The map. + /// The character's room, or null. + /// The rooms a walk under way still goes through. + /// What the walk says about itself, or null. + /// The area colours for the theme in use ( by default). + public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerable ahead, string? walking, MapAreaPalette? palette = null) { ArgumentNullException.ThrowIfNull(map); + palette ??= MapAreaPalette.Dark; var anchor = currentRoomId is { } id ? map.Room(id) : null; anchor ??= map.Rooms.Values.LastOrDefault(); if (anchor is null) @@ -60,12 +95,15 @@ public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerable new MapViewRoom( r.Id, - r.Name.Length <= MaxNameLength ? r.Name : r.Name[..(MaxNameLength - 1)] + "…", + Bounded(r.Name), r.X, r.Y, r.Id == currentRoomId, path.Contains(r.Id), - r.Locked)) + r.Locked, + Climbs(map, r, up: true), + Climbs(map, r, up: false), + Elsewhere(map, r))) .ToList(); var ids = rooms.Select(r => r.Id).ToHashSet(); var exits = new List(); @@ -87,14 +125,72 @@ public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerable(); + if (area is not null) + { + areas.Add(new MapViewArea(area, palette.Colour(area), Drawn: true)); + } + + foreach (var other in rooms.Select(r => r.Elsewhere).OfType().Distinct(StringComparer.Ordinal).Order(StringComparer.Ordinal)) + { + if (!string.Equals(other, area, StringComparison.Ordinal)) + { + areas.Add(new MapViewArea(other, palette.Colour(other), Drawn: false)); + } + } + + return new MapViewModel(area, anchor.Z, rooms, exits, walking) { AnchorId = anchor.Id, Areas = areas }; + } + + private static string Bounded(string name) => name.Length <= MaxNameLength ? name : name[..(MaxNameLength - 1)] + "…"; + + /// An area's name, bounded, or null for none. + private static string? AreaName(WorldMap map, int? areaId) => + areaId is { } id && map.Areas.TryGetValue(id, out var named) && !string.IsNullOrWhiteSpace(named.Name) + ? Bounded(named.Name) + : null; + + /// Whether has a way up (or down): the direction itself, or an exit to another level. + private static bool Climbs(WorldMap map, MapRoom room, bool up) + { + var direction = up ? "up" : "down"; + if (room.Exits.ContainsKey(direction) || room.Stubs.Contains(direction)) + { + return true; + } + + foreach (var (_, _, to) in room.AllExits()) + { + if (map.Room(to) is { } next && (up ? next.Z > room.Z : next.Z < room.Z)) + { + return true; + } + } + + return false; + } + + /// The first other area, by name, that an exit of leads into. + private static string? Elsewhere(WorldMap map, MapRoom room) + { + string? first = null; + foreach (var (_, _, to) in room.AllExits()) + { + if (map.Room(to) is { } next && next.AreaId != room.AreaId && AreaName(map, next.AreaId) is { } name + && (first is null || string.CompareOrdinal(name, first) < 0)) + { + first = name; + } + } + + return first; } - /// Value equality over the rooms and exits, which a record's list members do not give. + /// Value equality over the rooms, exits and areas, which a record's list members do not give. public bool Equals(MapViewModel? other) => other is not null && Area == other.Area && Level == other.Level && Walking == other.Walking && AnchorId == other.AnchorId - && Rooms.SequenceEqual(other.Rooms) && Exits.SequenceEqual(other.Exits); + && Rooms.SequenceEqual(other.Rooms) && Exits.SequenceEqual(other.Exits) && Areas.SequenceEqual(other.Areas); - public override int GetHashCode() => HashCode.Combine(Area, Level, Walking, Rooms.Count, Exits.Count); + public override int GetHashCode() => HashCode.Combine(Area, Level, Walking, Rooms.Count, Exits.Count, Areas.Count); } diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 1f576228..4764fd3a 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -139,6 +139,9 @@ public static class SurfaceCatalog /// The folded sidebar: a strip of dots in cells, the window's narrow native strip. public const string RailStrip = "rail-strip"; + /// A notice: the status row's message in cells, and in the window a toast over them as well. + public const string Notice = "notice"; + /// /// The header and the rail: cells in a terminal; in the window (HostChrome.HeaderAndRail) native views /// beside the cells, which then leave them out. @@ -269,6 +272,18 @@ public static class SurfaceCatalog }, "SharpMUTerm.Tui.CommandSurfaceRenderer.Render", ["SharpMUTerm.Avalonia.PaletteOverlay"]), + new( + Notice, + typeof(NoticeModel), + [ + // The toast's click runs the action the client put in the notice. The status row is not a button; the + // action is a registry command, so the cells reach it as a ⌃P entry, and the message log is where a + // notice that has gone is found again. + new(SurfaceActionKind.Target, "action", "RunNoticeAction", CellsVia: "term:messages"), + ], + CellsUnderNative, + "SharpMUTerm.Tui.SharpMUTermApp.NoticeMarkup", + ["SharpMUTerm.Avalonia.NoticeToasts"]), ]; /// The surface with , or null. diff --git a/src/SharpMUTerm.Tui/MapRenderer.cs b/src/SharpMUTerm.Tui/MapRenderer.cs index 5349cc17..f3c6c25c 100644 --- a/src/SharpMUTerm.Tui/MapRenderer.cs +++ b/src/SharpMUTerm.Tui/MapRenderer.cs @@ -2,6 +2,7 @@ using System.Text; using SharpMUTerm.Client.Panels; using SharpMUTerm.Core.Mapping; +using SharpMUTerm.Core.Text; namespace SharpMUTerm.Tui; @@ -11,16 +12,23 @@ namespace SharpMUTerm.Tui; /// A room is three cells, [ ], and the grid is four columns by two rows, which leaves one cell /// between rooms for an east–west line and one row for the north–south and diagonal ones. The middle cell says /// what the room is: @ where you are, the room's own symbol when it has one, an arrow when it has a way -/// up or down, otherwise blank. A room on the walk ahead wears the notice ink; a locked one the draft ink. +/// up or down (the view's /), otherwise blank. A room is +/// drawn in its area's colour (); a room on the walk ahead wears the notice ink, +/// a locked one the draft ink, and an exit into another area is drawn in that area's colour. Every area +/// colour is the view's, held to the legibility floor on the pane (), which leaves the +/// palette's hexes as they are. /// /// /// Each room is a link ( and its number), which the map window's own handler /// answers by walking there. The payload is never a mux:send:: what a click on a map does is the -/// client's decision, and nothing on the map is text a server chose — room names are drawn only in the title. +/// client's decision, and nothing on the map is text a server chose — room and area names are drawn only in the +/// title and the legend. /// /// /// An exit leading to a room off this level or area is drawn as its first segment only; an unexplored exit -/// (a stub) is drawn dim. Nothing is drawn past the box it was given, so a map can never wrap. +/// (a stub) is drawn dim. Nothing is drawn past the box it was given, so a map can never wrap. With room for it +/// ( rows), the last row is a one-line legend: @ you, the stairs marks when any +/// room has one, and each area the view names in its colour. /// /// internal static class MapRenderer @@ -32,8 +40,14 @@ internal static class MapRenderer internal const int CellHeight = 2; - /// The inks a map is drawn in. Hexes, already held to the legibility floor by the caller. - internal readonly record struct Ink(string Title, string Current, string Path, string Locked); + /// The fewest rows a map needs before it spends one on the legend. + internal const int LegendMinHeight = 6; + + /// + /// The inks a map is drawn in. Hexes, already held to the legibility floor by the caller; + /// is the pane plane the area colours are held to, or null to draw them as the view gives them. + /// + internal readonly record struct Ink(string Title, string Current, string Path, string Locked, Rgb? Plane = null); private enum Kind { @@ -46,7 +60,7 @@ private enum Kind Locked, } - private readonly record struct Cell(char Glyph, Kind Kind, long? Room); + private readonly record struct Cell(char Glyph, Kind Kind, long? Room, string? Colour = null); /// The room number a map link names, or null for anything else. internal static long? ParseLink(string url) => @@ -71,9 +85,10 @@ internal static List Render( /// /// The map as rows at most, each at most cells. The first - /// row is the title; the rest is the grid. Where, which level, who is where and whether a walk is under way - /// are the view's (the model the window's native map is drawn from), so the two cannot centre on different - /// rooms or title different areas. Only the exits' geometry (directions, stubs, ways off the level), which the + /// row is the title; the rest is the grid, and the legend under it when there is room. Where, which level, who + /// is where, whether a walk is under way, which rooms have stairs and what colour each area is are the view's + /// (the model the window's native map is drawn from), so the two cannot centre on different rooms, title different + /// areas or colour them differently. Only the exits' geometry (directions, stubs, ways off the level), which the /// view does not carry, is read from . An empty map says so. /// internal static List Render(MapViewModel view, WorldMap map, int width, int height, Ink ink) @@ -110,9 +125,12 @@ internal static List Render(MapViewModel view, WorldMap map, int width, return lines; } - var rows = height - 1; + var legend = height >= LegendMinHeight; + var rows = height - 1 - (legend ? 1 : 0); var grid = new Cell[rows, width]; var ahead_ = ahead.ToHashSet(); + var byId = view.Rooms.ToDictionary(r => r.Id); + var roomInk = AreaInk(view.AreaColour, ink); // Rooms are placed so the centre room's middle cell lands in the middle of the box. var originCol = width / 2 - 1; @@ -124,7 +142,7 @@ internal static List Render(MapViewModel view, WorldMap map, int width, .Where(r => r.Z == centre.Z && r.AreaId == centre.AreaId) .ToList(); - void Put(int col, int row, char glyph, Kind kind, long? room = null) + void Put(int col, int row, char glyph, Kind kind, long? room = null, string? colour = null) { if (row < 0 || row >= rows || col < 0 || col >= width) { @@ -142,22 +160,27 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null) return; } - grid[row, col] = new Cell(glyph, kind, room); + grid[row, col] = new Cell(glyph, kind, room, colour); } foreach (var room in level) { var (col, row) = At(room); - foreach (var (_, key, _) in room.AllExits()) + foreach (var (_, key, to) in room.AllExits()) { - Connect(col, row, key, Kind.Line); + // A way into another area is drawn in that area's colour, which is the view's. + var into = map.Room(to) is { } next && next.AreaId != room.AreaId && next.AreaId is { } areaId + && map.Areas.TryGetValue(areaId, out var area) + ? AreaInk(view.ColourOf(area.Name), ink) + : null; + Connect(col, row, key, Kind.Line, into); } foreach (var stub in room.Stubs) { if (MapDirections.Normalise(stub) is { } direction) { - Connect(col, row, direction, Kind.Stub); + Connect(col, row, direction, Kind.Stub, null); } } } @@ -169,9 +192,10 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null) : room.Locked ? Kind.Locked : ahead_.Contains(room.Id) ? Kind.Path : Kind.Room; - Put(col, row, '[', kind, room.Id); - Put(col + 1, row, Middle(room, current), kind, room.Id); - Put(col + 2, row, ']', kind, room.Id); + var colour = kind == Kind.Room ? roomInk : null; + Put(col, row, '[', kind, room.Id, colour); + Put(col + 1, row, Middle(room, byId.GetValueOrDefault(room.Id), current), kind, room.Id, colour); + Put(col + 2, row, ']', kind, room.Id, colour); } for (var row = 0; row < rows; row++) @@ -179,41 +203,138 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null) lines.Add(Row(grid, row, width, ink)); } + if (legend) + { + lines.Add(Legend(view, width, ink)); + } + return lines; - void Connect(int col, int row, string direction, Kind kind) + void Connect(int col, int row, string direction, Kind kind, string? colour) { switch (direction) { case "east": - Put(col + 3, row, '─', kind); + Put(col + 3, row, '─', kind, colour: colour); break; case "west": - Put(col - 1, row, '─', kind); + Put(col - 1, row, '─', kind, colour: colour); break; case "south": - Put(col + 1, row + 1, '│', kind); + Put(col + 1, row + 1, '│', kind, colour: colour); break; case "north": - Put(col + 1, row - 1, '│', kind); + Put(col + 1, row - 1, '│', kind, colour: colour); break; case "southeast": - Put(col + 3, row + 1, '╲', kind); + Put(col + 3, row + 1, '╲', kind, colour: colour); break; case "northwest": - Put(col - 1, row - 1, '╲', kind); + Put(col - 1, row - 1, '╲', kind, colour: colour); break; case "southwest": - Put(col - 1, row + 1, '╱', kind); + Put(col - 1, row + 1, '╱', kind, colour: colour); break; case "northeast": - Put(col + 3, row - 1, '╱', kind); + Put(col + 3, row - 1, '╱', kind, colour: colour); break; } } } - private static char Middle(MapRoom room, long? current) + /// + /// An area colour from the view, held to the floor on the pane. The palette clears it on every built-in theme, + /// so this returns the view's hex unchanged there; a custom theme may move it. + /// + internal static string? AreaInk(string? colour, Ink ink) + { + if (colour is null || ink.Plane is not { } plane || !TryParse(colour, out var rgb)) + { + return colour; + } + + var legible = Contrast.Legible(rgb, plane); + return legible == rgb ? colour : $"#{legible.R:x2}{legible.G:x2}{legible.B:x2}"; + } + + private static bool TryParse(string hex, out Rgb rgb) + { + rgb = default; + if (hex.Length != 7 || hex[0] != '#' + || !byte.TryParse(hex.AsSpan(1, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var r) + || !byte.TryParse(hex.AsSpan(3, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var g) + || !byte.TryParse(hex.AsSpan(5, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var b)) + { + return false; + } + + rgb = new Rgb(r, g, b); + return true; + } + + /// + /// The one-line legend: where you are, the stairs marks when a room has one, a walk under way, then each area in + /// its colour. The areas are what a narrow pane keeps longest: the words beside the marks go first (@ you + /// becomes @), then area names are shortened, and only then are areas counted (+2) instead of named. + /// It never wraps. + /// + private static string Legend(MapViewModel view, int width, Ink ink) + { + var stairs = view.Rooms.Any(r => r.Up || r.Down); + var walk = view.Rooms.Any(r => r.Ahead); + List<(string Markup, int Length)> Marks(bool words) + { + var marks = new List<(string, int)> { ($"[bold {ink.Current}]@[/]" + (words ? " [dim]you[/]" : string.Empty), words ? 5 : 1) }; + if (stairs) + { + marks.Add(("[dim]↑↓" + (words ? " stairs" : string.Empty) + "[/]", words ? 9 : 2)); + } + + if (walk) + { + marks.Add(($"[{ink.Path}][[ ]][/]" + (words ? " [dim]walk[/]" : string.Empty), words ? 8 : 3)); + } + + return marks; + } + + List<(string Markup, int Length)> Areas(int cap) => view.Areas + .Select(a => + { + var name = a.Name.Length <= cap ? a.Name : a.Name[..(cap - 1)] + "…"; + return (Markup: $"[{AreaInk(a.Colour, ink)}]■[/] [dim]{MarkupText.Escape(name)}[/]", Length: 2 + name.Length); + }) + .ToList(); + + for (var keep = view.Areas.Count; keep >= 0; keep--) + { + foreach (var words in new[] { true, false }) + { + foreach (var cap in LegendNameCaps) + { + var items = Marks(words).Concat(Areas(cap).Take(keep)).ToList(); + if (keep < view.Areas.Count) + { + var more = $"+{view.Areas.Count - keep}"; + items.Add(($"[dim]{more}[/]", more.Length)); + } + + if (items.Sum(i => i.Length) + (3 * (items.Count - 1)) <= width) + { + return string.Join(" [dim]·[/] ", items.Select(i => i.Markup)); + } + } + } + } + + return Fit(string.Join(" [dim]·[/] ", Marks(words: false).Select(p => p.Markup)), width); + } + + /// The lengths an area name is shortened through, longest first, before an area is counted instead. + private static readonly int[] LegendNameCaps = [24, 14, 8]; + + + private static char Middle(MapRoom room, MapViewRoom? seen, long? current) { if (room.Id == current) { @@ -225,8 +346,9 @@ private static char Middle(MapRoom room, long? current) return room.Symbol[0]; } - var up = room.Exits.ContainsKey("up"); - var down = room.Exits.ContainsKey("down"); + // The stairs are the view's, so the window's marks and these arrows are one answer. + var up = seen?.Up ?? false; + var down = seen?.Down ?? false; return up && down ? '↕' : up ? '↑' : down ? '↓' : ' '; } @@ -254,7 +376,7 @@ private static string Row(Cell[,] grid, int row, int width, Ink ink) { var cell = grid[row, col]; var end = col + 1; - while (end <= last && grid[row, end].Kind == cell.Kind && grid[row, end].Room == cell.Room) + while (end <= last && grid[row, end].Kind == cell.Kind && grid[row, end].Room == cell.Room && grid[row, end].Colour == cell.Colour) { end++; } @@ -268,7 +390,8 @@ private static string Row(Cell[,] grid, int row, int width, Ink ink) var escaped = MarkupText.Escape(text.ToString()); var styled = cell.Kind switch { - Kind.Blank or Kind.Line or Kind.Room => escaped, + Kind.Blank => escaped, + Kind.Line or Kind.Room => cell.Colour is { } colour ? $"[{colour}]{escaped}[/]" : escaped, Kind.Stub => $"[dim]{escaped}[/]", Kind.Current => $"[bold {ink.Current}]{escaped}[/]", Kind.Path => $"[{ink.Path}]{escaped}[/]", diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 1e6c56b3..24db4485 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -147,6 +147,15 @@ void HeaderActions(IReadOnlyList actions) void Chrome(ChromeOverlay chrome) { } + + /// + /// A notice was said, as it is drawn on the status row. The status row's cells carry it in every host; a host that + /// draws notices natively (the window's toasts) shows this over the cells and ignores nothing else. It must never + /// take focus. A host that draws none ignores this (the default). + /// + void Notice(NoticeOverlay notice) + { + } } /// diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs index f062d66f..069b2a8f 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -298,11 +298,14 @@ private void PickFromPanel(string windowId, string sessionKey, int index) } var walking = map.Walk.IsWalking ? $"walking, {map.Walk.Remaining} to go" : null; - var model = MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking); + var model = MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking, MapPalette()); _mapViews[windowId] = (revision, model); return model; } + /// The map's area colours for the theme in use: the set that clears the floor on its panes. + private MapAreaPalette MapPalette() => MapAreaPalette.For(WorkspacePalette.DarkPanes(_theme)); + /// What the host was last told about panels. Internal for tests. internal IReadOnlyList PanelOverlays => _panelOverlays; } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs new file mode 100644 index 00000000..16d17960 --- /dev/null +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs @@ -0,0 +1,171 @@ +using System.Globalization; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Text; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// The notice surface (): one per , +/// drawn by the terminal on the status row (, unchanged from before the model existed) and +/// handed to a host that draws notices natively () as the same instance. The +/// window's toast is an overlay: the status row's cells still carry the notice under it in every host, so the cells +/// of both hosts stay the same and the message log (⌃P ▸ Show client messages) stays the one history. +/// +internal sealed partial class SharpMUTermApp +{ + /// How many notices this run has raised; each model's . + private long _noticeSequence; + + /// The action commands of the notices a host was handed, newest last, so a click can be checked against them. + private readonly List _noticeActionsOffered = []; + + /// The most notice actions remembered; a host offers a click only while its toast is up. + private const int NoticeActionsKept = 16; + + /// The one callback every published notice carries, so a host compares overlays by value. + private Action? _noticeRun; + + /// + /// The log's severity in the notice's words. The log's Warning is "the client refused or did less" — a + /// refusal; its Error is "something failed" — the notice's warning. + /// + internal static NoticeSeverity NoticeSeverityOf(MessageSeverity severity) => severity switch + { + MessageSeverity.Info => NoticeSeverity.Info, + MessageSeverity.Error => NoticeSeverity.Warning, + _ => NoticeSeverity.Refusal, + }; + + /// + /// The status row's markup for a notice: the key chip in the notice ink, then the text — in the warning red when + /// something failed, otherwise dim. The cell renderer of the notice surface; byte for byte what the row drew + /// before the model existed. + /// + internal string NoticeMarkup(NoticeModel notice) + { + ArgumentNullException.ThrowIfNull(notice); + var body = notice.Severity == NoticeSeverity.Warning + ? $"[{ScreenPalette.Warn}]{Escape(notice.Text)}[/]" + : $"[dim]{Escape(notice.Text)}[/]"; + return notice.Key is null ? body : $"[{_ink.Notice}]{Escape(notice.Key)}[/] {body}"; + } + + /// Hands a notice to a host that draws notices natively; nothing for one that does not. + private void PublishNotice(NoticeModel notice) + { + if (_pointer is null) + { + return; + } + + if (notice.Action is { } action) + { + _noticeActionsOffered.Add(action.Command); + if (_noticeActionsOffered.Count > NoticeActionsKept) + { + _noticeActionsOffered.RemoveAt(0); + } + } + + _noticeRun ??= id => OnUiThread(() => RunNoticeAction(id)); + _pointer.Notice(new NoticeOverlay(notice, NoticeAboveRow(), NoticePalette(), _noticeRun)); + } + + /// + /// The row a toast sits above: the top of the command line and status row, which is the bottom of the pane area. + /// A toast stacked above it covers neither the row it repeats nor the line being typed. + /// + private int NoticeAboveRow() + { + var bottom = 0; + foreach (var rect in PaneOutputRects().Values) + { + bottom = Math.Max(bottom, rect.Y + rect.Height); + } + + return bottom > 0 ? bottom : Math.Max(0, _system.ConsoleDriver.ScreenSize.Height - 2); + } + + /// + /// A notice's action, as a toast's click hands it back. Only a command a notice offered is run, through the + /// registry as any other command is; anything else is refused, the chrome's rule. Internal for tests. + /// + internal bool RunNoticeAction(string command) + { + if (!_noticeActionsOffered.Contains(command, StringComparer.Ordinal)) + { + RefuseCommand($"no notice offered {Snippet(command)}"); + return false; + } + + return DispatchCommand(command); + } + + /// + /// The toast's colours: the status row's plane, the theme's text held to the floor on it, and one edge per + /// severity — the accent for news, the notice voice for a refusal, the warning red for a failure, each held to a + /// floor on the plane as well. An edge also inks the key chip and the action line, which are small text, so it is held to 4.5:1 + /// rather than the 3:1 floor. + /// + private NoticePalette NoticePalette() + { + var plane = _theme.StatusBackground; + string On(string hex) => TryParseRgb(hex, out var rgb) ? Hex(Contrast.Legible(rgb, plane, 4.5)) : hex; + return new NoticePalette( + Hex(plane), + Hex(Contrast.Legible(_theme.StatusForeground, plane, 4.5)), + On(_ink.Accent), + On(ScreenPalette.Warn), + On(_ink.Notice)); + } + + private static bool TryParseRgb(string hex, out Rgb rgb) + { + rgb = default; + if (hex.Length != 7 || hex[0] != '#' + || !byte.TryParse(hex.AsSpan(1, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var r) + || !byte.TryParse(hex.AsSpan(3, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var g) + || !byte.TryParse(hex.AsSpan(5, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var b)) + { + return false; + } + + rgb = new Rgb(r, g, b); + return true; + } + + /// The notice the status row's cells were last drawn from, or null; for a test comparing hosts. + internal NoticeModel? LastNoticeModel => DrawnModel(SurfaceCatalog.Notice) as NoticeModel; + + /// Says a notice through the real , as a test needs one with an action. + internal void SimulateNotice(string text, MessageSeverity severity, string? key, NoticeAction? action) => + Notice(text, severity, key, action); +} + +/// +/// A notice for a host that draws it natively, over the cells: the model the status row was drawn from, where the +/// pane area ends, the colours, and the one way back. +/// +/// The notice; the very instance the status row's cells were drawn from. +/// The grid row a toast stacks above: the top of the command line and status row. +/// The colours to draw it in, already held to the floor. +/// +/// Runs the notice's action by its command id, through the registry; a command no notice offered is refused. Safe to +/// call from any thread. The same instance for the life of the client. +/// +internal sealed record NoticeOverlay(NoticeModel Notice, int AboveRow, NoticePalette Palette, Action Run); + +/// A toast's colours as #rrggbb: its plane, its text, and its edge per severity. +internal sealed record NoticePalette(string Plane, string Text, string Info, string Warning, string Refusal) +{ + /// The edge for . + public string Edge(NoticeSeverity severity) => severity switch + { + NoticeSeverity.Info => Info, + NoticeSeverity.Warning => Warning, + _ => Refusal, + }; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs index 6050f5ed..d9d21a1a 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Commands; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; @@ -429,7 +430,11 @@ internal void AcceptLayoutSuggestion(WorldSession session) : "it is a roleplay server", _ => "nothing it sends points elsewhere", }; - Notice($"Using the {name} layout for {Snippet(session.World.Name)}: {why}. ⌥M changes it.", MessageSeverity.Info, "⌥M"); + Notice( + $"Using the {name} layout for {Snippet(session.World.Name)}: {why}. ⌥M changes it.", + MessageSeverity.Info, + "⌥M", + new NoticeAction(LayoutCommands.Manage, "Change layout")); if (_liveLayout is { } live && string.Equals(live.SessionKey, session.SessionKey, StringComparison.Ordinal) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index e7f81a73..deec091e 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1816,11 +1816,29 @@ public string RenderSnapshot(string? view = null) { RefusePrefix(PrefixPanel.NoSplitRefusal); RefuseCommand("nothing to reconnect — pick a character first (⌃P ▸ Switch to …)"); - Notice("switched to Corvid · offline — Alt+R (⌃P ▸ Reconnect) connects it", MessageSeverity.Info, "⌃P"); + Notice( + "switched to Corvid · offline — Alt+R (⌃P ▸ Reconnect) connects it", + MessageSeverity.Info, + "⌃P", + new NoticeAction("world:reconnect", "Reconnect")); Notice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error, "⌃P"); _messageLog.Toggle(); } + // Three notices over the demo workspace and no modal: in a terminal the status row carries the last of them, + // as it always has; in the window each is a toast as well, stacked over the cells, the first offering its + // action as a click. One of each severity, in the order a session might say them. + if (string.Equals(view, "notices", StringComparison.OrdinalIgnoreCase)) + { + Notice( + "Using the Combat layout for Aetherfall: the game sends vitals. ⌥M changes it.", + MessageSeverity.Info, + "⌥M", + new NoticeAction(Client.Commands.LayoutCommands.Manage, "Change layout")); + RefusePrefix(PrefixPanel.NoSplitRefusal); + Notice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error, "⌃P"); + } + // The map window, over the demo's recorded streets: opened through the real ⌃P entry; `map-walking` // starts a walk to the docks through the real `/walk`, so the path ahead is marked; `map-split` puts // the map beside the output, the way it is meant to be read. @@ -3101,7 +3119,8 @@ private void ReportAutomation(WorldSession session) Notice( $"{who} is assigned a trigger set called {orphan}, and no such set exists — F2 defines sets, F5 assigns them", MessageSeverity.Warning, - "⌃P"); + "⌃P", + new NoticeAction("screen:worlds", "Open F5")); } } @@ -3208,7 +3227,11 @@ private void SwitchToCharacter(string sessionKey) var state = session.IsConnected ? "connected" : "offline — Alt+R (⌃P ▸ Reconnect) connects it"; - Notice($"switched to {SessionTitle(session)} · {state}", MessageSeverity.Info, "⌃P"); + Notice( + $"switched to {SessionTitle(session)} · {state}", + MessageSeverity.Info, + "⌃P", + session.IsConnected ? null : new NoticeAction("world:reconnect", "Reconnect")); } /// @@ -8880,9 +8903,9 @@ private void RenderMap(string windowId) // One model per drawing, and the window's native map is handed this same instance (MapViewFor), so the two // cannot disagree about where the character is, which level is shown or whether a walk is under way. var walking = map.Walk.IsWalking ? $"walking, {map.Walk.Remaining} to go" : null; - var view = Drawing(Core.Layouts.PanelIds.Map, windowId, SharpMUTerm.Client.Panels.MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking)); + var view = Drawing(Core.Layouts.PanelIds.Map, windowId, SharpMUTerm.Client.Panels.MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking, MapPalette())); _mapViews[windowId] = (_mapRevisions[windowId], view); - var ink = new MapRenderer.Ink(_ink.Accent, _ink.Accent, _ink.Notice, _ink.Draft); + var ink = new MapRenderer.Ink(_ink.Accent, _ink.Accent, _ink.Notice, _ink.Draft, WorkspacePalette.ReadingPlane(_theme)); var lines = MapRenderer.Render(view, map.Map, width, height, ink); _mapMarkup[windowId] = lines; control.SetContent(lines.ToList()); @@ -9102,24 +9125,28 @@ private void LoadDemoMap() [4203] = ("Temple of the Tide", [("south", 4202)]), [4210] = ("Market Row", [("west", 4201), ("east", 4211), ("southeast", 4212)]), [4211] = ("Spice Stall", [("west", 4210)]), - [4212] = ("Docks Gate", [("northwest", 4210), ("south", null)]), + [4212] = ("Docks Gate", [("northwest", 4210), ("south", 4300)]), [4199] = ("Lantern Street", [("north", 4201), ("south", null), ("southwest", 4198)]), [4198] = ("Old Well", [("northeast", 4199)]), [4220] = ("Guildhall", [("east", 4201), ("west", null)]), + + // A floor up and an area next door, so the map has stairs and a second area colour to show. + [4250] = ("Bell Tower", [("down", 4202)]), + [4300] = ("The Quay", [("north", 4212), ("east", null)]), }; void Arrive(long id) => recorder.Apply(new RoomObservation( id, rooms[id].Name, rooms[id].Exits.Select(e => new ObservedExit(e.Item1, e.Item2)).ToList()) { - Area = "Aetherfall", + Area = id >= 4300 ? "Saltmarsh Docks" : "Aetherfall", }); Arrive(4201); foreach (var (command, to) in new (string, long)[] { - ("n", 4202), ("n", 4203), ("s", 4202), ("s", 4201), ("e", 4210), ("e", 4211), ("w", 4210), - ("se", 4212), ("nw", 4210), ("w", 4201), ("s", 4199), ("sw", 4198), ("ne", 4199), ("n", 4201), + ("n", 4202), ("n", 4203), ("s", 4202), ("u", 4250), ("d", 4202), ("s", 4201), ("e", 4210), ("e", 4211), ("w", 4210), + ("se", 4212), ("s", 4300), ("n", 4212), ("nw", 4210), ("w", 4201), ("s", 4199), ("sw", 4198), ("ne", 4199), ("n", 4201), ("w", 4220), ("e", 4201), }) { @@ -13228,7 +13255,7 @@ private void SetStatus(string markup, bool displace = false) /// five seconds of unhurried reading. Six gives that a margin without a refusal outstaying the thing /// it refused. Nothing is lost to it either way: every notice is echoed into the output window. /// - internal static readonly TimeSpan NoticeDuration = TimeSpan.FromSeconds(6); + internal static readonly TimeSpan NoticeDuration = NoticeModel.Duration; /// The transient message currently laid over the resting row, or null when there is none. private string? _notice; @@ -13262,7 +13289,11 @@ private void SetStatus(string markup, bool displace = false) /// The message, as plain text — the log keeps this, and the row's markup is built from it. /// How loud it is; the viewer colours and labels rows by this. /// An optional leading chip naming the surface that refused (⌃B, ⌃P). - private void Notice(string text, MessageSeverity severity = MessageSeverity.Warning, string? key = null) + /// + /// A command the notice offers. The status row never draws it (a terminal cell is not a button, and the text + /// already names the key); a host that draws notices natively offers it as a click (). + /// + private void Notice(string text, MessageSeverity severity = MessageSeverity.Warning, string? key = null, NoticeAction? action = null) { // Through the logger, not straight into the buffer: the client's own messages and the telnet // stack's diagnostics then share one ordered history (and one rolling file), which is the point @@ -13278,13 +13309,15 @@ private void Notice(string text, MessageSeverity severity = MessageSeverity.Warn key is null ? text : $"{key} {text}"); AnnounceNotice(text); - var body = severity == MessageSeverity.Error - ? $"[{ScreenPalette.Warn}]{Escape(text)}[/]" - : $"[dim]{Escape(text)}[/]"; - var markup = key is null ? body : $"[{_ink.Notice}]{Escape(key)}[/] {body}"; + var model = Drawing( + SurfaceCatalog.Notice, + string.Empty, + new NoticeModel(text, NoticeSeverityOf(severity), key, action, _time.GetUtcNow(), ++_noticeSequence)); + var markup = NoticeMarkup(model); _notice = markup; PaintStatus(markup); + PublishNotice(model); _noticeTimer ??= _time.CreateTimer( _ => OnUiThread(ClearNotice), null, Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); _noticeTimer.Change(NoticeDuration, Timeout.InfiniteTimeSpan); diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 0796e858..1b9a6bfb 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -17,7 +17,7 @@ internal static class SnapshotViews "triggers-edit", "logging-edit", "keypad-edit", "password-edit", "startup-edit", "freeze", "freeze-scrollback", "spawn", "split", "split-stacked", "move", "drag", "history", "history-search", "history-search-filter", "draft", "draft2", - "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "quit", "connections", "characters", + "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "notices", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "tint-tabs", "compose", "compose-literal", "moo-edit", "mssp", "mssp-none", "mssp-never", "web", "rail-long", "scrollback", "scrollback-up", "scrollback-split", "reflow", "links", "away", "away-scrollback", diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index de1ec5fb..614d95bf 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -330,6 +330,16 @@ internal static Rgb ReadingPlane(Theme theme) return Extreme(PanePlanes(theme), Surface(theme)); } + /// + /// Whether a theme's panes are dark — a foreground on them is lifted rather than darkened. The map's area colours + /// take their dark or light set by this (MapAreaPalette.For). + /// + internal static bool DarkPanes(Theme theme) + { + ArgumentNullException.ThrowIfNull(theme); + return Contrast.RelativeLuminance(Surface(theme)) < LightPlaneLuminance; + } + /// /// The band a selected run of a pane's output is painted on. /// diff --git a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs new file mode 100644 index 00000000..457f0cd2 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs @@ -0,0 +1,129 @@ +using Avalonia; +using Avalonia.Headless; +using Avalonia.Input; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; +using static SharpMUTerm.Avalonia.Tests.DesktopLayerTests; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's toasts () and the native map's legend and colours: a toast is the notice the +/// status row drew, stacked over the cells above the command line, held while hovered, faded after its time, never +/// focused; a click runs its action through the client and nothing else reaches the client. The map canvas draws its +/// areas in the model's colours. +/// +public class NoticeToastTests +{ + private static readonly NoticePalette Palette = new("#333344", "#e0e0e0", "#5fafff", "#ff6b6b", "#ffaf5f"); + + private static NoticeOverlay Overlay(long sequence, string text, NoticeAction? action, Action run, int aboveRow = 8) => + new(new NoticeModel(text, NoticeSeverity.Info, "⌥M", action, DateTimeOffset.UnixEpoch, sequence), aboveRow, Palette, run); + + [Test] + public async Task AToastStacksAboveTheCommandLineAndAClickRunsItsActionWithoutTakingFocus() + { + var (shown, rects, bottom, ran, focused, clientSaw, remaining, passedThrough) = await Run((window, view, layer, driver) => + { + var ran = new List(); + var notices = (IPointerPresenter)driver.Pointer; + notices.Notice(Overlay(1, "Using the Combat layout: the game sends vitals.", new NoticeAction("layout:layouts", "Change layout"), ran.Add)); + notices.Notice(Overlay(2, "nothing to split", null, ran.Add)); + Drain(); + window.UpdateLayout(); + + var toasts = layer.Toasts; + var shown = toasts.Shown.Select(n => n.Sequence).ToList(); + var rects = toasts.Rects(); + var bottom = toasts.Bottom; + + var clientSaw = new List>(); + driver.MouseEvent += (_, flags, _) => clientSaw.Add(flags); + + // A click on the toast with an action: it runs, the toast goes, and the client never sees the press. + var on = toasts.TranslatePoint(rects[0].Center, window)!.Value; + window.MouseDown(on, MouseButton.Left); + window.MouseUp(on, MouseButton.Left); + var focused = view.IsFocused; + var remaining = toasts.Shown.Select(n => n.Sequence).ToList(); + var sawOnToast = clientSaw.Count; + + // A press beside the toasts goes through to the cells. + var beside = toasts.TranslatePoint(new Point(40, 30), window)!.Value; + window.MouseDown(beside, MouseButton.Left); + window.MouseUp(beside, MouseButton.Left); + return (shown, rects, bottom, ran, focused, sawOnToast, remaining, clientSaw.Count > sawOnToast); + }, columns: 80, rows: 12); + + await Assert.That(shown).IsEquivalentTo(new long[] { 1, 2 }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(rects[1].Y).IsGreaterThan(rects[0].Y).Because("the newest is at the bottom of the stack"); + await Assert.That(rects[1].Bottom).IsLessThanOrEqualTo(bottom).Because("the stack sits above the row the pane area ends at"); + await Assert.That(ran).IsEquivalentTo(new[] { "layout:layouts" }); + await Assert.That(focused).IsTrue().Because("a toast never takes the keyboard from the cells"); + await Assert.That(clientSaw).IsEqualTo(0).Because("a press on a toast is the window's"); + await Assert.That(remaining).IsEquivalentTo(new long[] { 2 }); + await Assert.That(passedThrough).IsTrue().Because("only a toast is hit; the rest of the layer is the cells'"); + } + + [Test] + public async Task AToastFadesAfterItsTimeButStaysWhileHovered() + { + var (held, faded, gone) = await Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Notice(Overlay(1, "saved", null, _ => { })); + Drain(); + window.UpdateLayout(); + var toasts = layer.Toasts; + var over = toasts.TranslatePoint(toasts.Rects()[0].Center, window)!.Value; + + window.MouseMove(over); + toasts.Advance(NoticeModel.Duration + TimeSpan.FromSeconds(2)); + var held = toasts.Shown.Count; + + window.MouseMove(toasts.TranslatePoint(new Point(2, 2), window)!.Value); + toasts.Advance(NoticeToasts.HoverGrace + TimeSpan.FromMilliseconds(100)); + var faded = toasts.Shown.Count; + toasts.Advance(NoticeToasts.FadeTime); + return (held, faded, toasts.Shown.Count); + }, columns: 80, rows: 12); + + await Assert.That(held).IsEqualTo(1).Because("a hovered toast stays"); + await Assert.That(faded).IsEqualTo(1).Because("it is fading, not gone"); + await Assert.That(gone).IsEqualTo(0); + } + + [Test] + public async Task TheNativeMapDrawsItsAreasInTheModelsColours() + { + var (room, elsewhere, legend) = await Run((window, view, layer, driver) => + { + var model = new MapViewModel( + "Town", + 0, + [ + new MapViewRoom(1, "Plaza", 0, 0, Current: true, Ahead: false, Locked: false, Up: true), + new MapViewRoom(2, "Gate", 1, 0, Current: false, Ahead: false, Locked: false, Elsewhere: "Docks"), + ], + [new MapViewExit(1, 2)], + null) + { + Areas = [new MapViewArea("Town", "#abcdef", Drawn: true), new MapViewArea("Docks", "#fedcba", Drawn: false)], + }; + ((IPointerPresenter)driver.Pointer).Panels( + [new PanelOverlay(PanelIds.Map, "map:demo", new PaneRect(0, 1, 40, 9), new PanelInk("#33ccff", "#ffaa33", "#555555"), null, model, _ => { })]); + Drain(); + window.UpdateLayout(); + var canvas = layer.Maps.Values.Single(); + return (canvas.AreaColourOf(model.Rooms[1]), canvas.ElsewhereColourOf(model.Rooms[1]), canvas.LegendEntries()); + }); + + await Assert.That(room.ToString()).IsEqualTo("#ffabcdef"); + await Assert.That(elsewhere?.ToString()).IsEqualTo("#fffedcba"); + await Assert.That(legend.Select(e => e.Label)).IsEquivalentTo(new[] { "you", "stairs up / down", "Town", "Docks" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(legend[2].Swatch.ToString()).IsEqualTo("#ffabcdef"); + } +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index ad1fa43e..abcfbce5 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -186,6 +186,20 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! covered.Add(SurfaceCatalog.RailStrip); } + // Notices: each toast the window was handed is the model the status row was drawn from, and the last is the + // one the row carries now. + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot("notices"); + var said = driver.Pointer.Notices; + await Assert.That(said.Count).IsEqualTo(3); + await Assert.That((object)said[^1].Notice).IsEqualTo(app.DrawnModel(SurfaceCatalog.Notice)).Because("notice"); + await Assert.That(app.NoticeMarkup(said[^1].Notice)).IsEqualTo(app.LastNotice); + await Assert.That(said[0].Notice.Action).IsNotNull().Because("the first offers its action"); + covered.Add(SurfaceCatalog.Notice); + } + var drawnNatively = SurfaceCatalog.All.Where(s => s.On(SurfaceHosts.Window).HasFlag(SurfaceDrawing.Native)).Select(s => s.Id); await Assert.That(covered).IsEquivalentTo(drawnNatively).Because("every surface the window draws natively has its model compared here"); } @@ -293,6 +307,22 @@ await Same("layouts-menu: apply", "layout-combat", probed.Add(SurfaceCatalog.Palette); } + // Notice: a click on a toast runs its action; in cells the same command is the ⌃P entry, run by the registry. + var openF5 = new SharpMUTerm.Client.Chrome.NoticeAction("screen:worlds", "Open F5"); + await Same("notice: action", "layout-combat", + (app, d) => + { + app.SimulateNotice("a set is missing", SharpMUTerm.Core.Diagnostics.MessageSeverity.Warning, "⌃P", openF5); + var toast = d.Pointer.Notices[^1]; + toast.Run(toast.Notice.Action!.Command); + }, + (app, _) => + { + app.SimulateNotice("a set is missing", SharpMUTerm.Core.Diagnostics.MessageSeverity.Warning, "⌃P", openF5); + app.DispatchCommand(openF5.Command); + }); + probed.Add(SurfaceCatalog.Notice); + var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); await Assert.That(probed).IsEquivalentTo(acting).Because("every native surface with actions has a probe here"); } diff --git a/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs b/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs index 62f43f8c..3e76faf2 100644 --- a/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs @@ -38,6 +38,56 @@ public async Task TheMapViewIsTheCurrentLevelAndAreaWithEachExitOnce() await Assert.That(MapViewModel.From(map, 1, [2], "walking, 1 to go")).IsEqualTo(view); } + /// + /// The view says which rooms have stairs, which lead into another area, and the colour of every area it names — + /// the drawn area first, from the palette the client chose, stable for the name. + /// + [Test] + public async Task TheMapViewCarriesStairsWaysOutAndAreaColours() + { + var map = new WorldMap(); + var town = map.AreaNamed("Town"); + var docks = map.AreaNamed("Docks"); + map.Add(new MapRoom { Id = 1, Name = "Plaza", AreaId = town.Id, Exits = { ["north"] = 2, ["up"] = 3, ["south"] = 4 } }); + map.Add(new MapRoom { Id = 2, Name = "Cellar Stair", AreaId = town.Id, Y = -1, Exits = { ["south"] = 1, ["east"] = 5 } }); + map.Add(new MapRoom { Id = 3, Name = "Tower", AreaId = town.Id, Z = 1, Exits = { ["down"] = 1 } }); + map.Add(new MapRoom { Id = 4, Name = "Quay", AreaId = docks.Id, Y = 1, Exits = { ["north"] = 1 } }); + map.Add(new MapRoom { Id = 5, Name = "Crypt", AreaId = town.Id, X = 1, Y = -1, Z = -1 }); + + var view = MapViewModel.From(map, 1, [], null, MapAreaPalette.Light); + + var plaza = view.Rooms.Single(r => r.Id == 1); + var stair = view.Rooms.Single(r => r.Id == 2); + await Assert.That(plaza.Up).IsTrue(); + await Assert.That(plaza.Down).IsFalse(); + await Assert.That(stair.Down).IsTrue().Because("an exit to a room on a lower level is a way down whatever its direction"); + await Assert.That(plaza.Elsewhere).IsEqualTo("Docks"); + await Assert.That(stair.Elsewhere).IsNull(); + + await Assert.That(view.Areas).IsEquivalentTo( + new[] + { + new MapViewArea("Town", MapAreaPalette.Light.Colour("Town"), Drawn: true), + new MapViewArea("Docks", MapAreaPalette.Light.Colour("Docks"), Drawn: false), + }, + TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(view.AreaColour).IsEqualTo(MapAreaPalette.Light.Colour("Town")); + await Assert.That(view.ColourOf("Docks")).IsEqualTo(MapAreaPalette.Light.Colour("Docks")); + await Assert.That(MapAreaPalette.IndexOf("Town")).IsEqualTo(MapAreaPalette.IndexOf("Town")); + await Assert.That(MapViewModel.From(map, 1, [], null, MapAreaPalette.Dark)).IsNotEqualTo(view).Because("the palette is part of the view"); + await Assert.That(MapViewModel.From(map, 1, [], null, MapAreaPalette.Light)).IsEqualTo(view); + } + + [Test] + public async Task TwoNoticesThatSayTheSameThingAreStillTwo() + { + var at = new DateTimeOffset(2026, 11, 4, 12, 0, 0, TimeSpan.Zero); + var first = new SharpMUTerm.Client.Chrome.NoticeModel("saved", SharpMUTerm.Client.Chrome.NoticeSeverity.Info, null, null, at, 1); + await Assert.That(first with { }).IsEqualTo(first); + await Assert.That(first with { Sequence = 2 }).IsNotEqualTo(first); + await Assert.That(SharpMUTerm.Client.Chrome.NoticeModel.Duration).IsEqualTo(TimeSpan.FromSeconds(6)); + } + [Test] public async Task TheLayoutLibraryIsAFamilyThatListsNothingButHandlesItsIds() { diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs index 48856d14..48366e94 100644 --- a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -72,7 +72,7 @@ public async Task PanelSurfacesAreKnownPanels() { var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette - or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip)); + or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice)); foreach (var surface in panels) { await Assert.That(PanelIds.Known).Contains(surface.Id); diff --git a/tests/SharpMUTerm.Tui.Tests/MapAreaPaletteTests.cs b/tests/SharpMUTerm.Tui.Tests/MapAreaPaletteTests.cs new file mode 100644 index 00000000..3af70578 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/MapAreaPaletteTests.cs @@ -0,0 +1,79 @@ +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The map's area colours () against the planes they are drawn on: every hex of the set a +/// theme takes clears the legibility floor on the worst pane plane of that theme, so the terminal's +/// leaves them exactly as the model says and the window draws the same hex. +/// +public class MapAreaPaletteTests +{ + [Test] + public async Task EveryAreaColourClearsTheFloorOnEveryBuiltInTheme() + { + var failures = new List(); + foreach (var name in ThemeLibrary.Names) + { + var theme = ThemeLibrary.Get(name); + var palette = MapAreaPalette.For(WorkspacePalette.DarkPanes(theme)); + var plane = WorkspacePalette.ReadingPlane(theme); + foreach (var hex in palette.Colours) + { + var colour = Parse(hex); + var ratio = Contrast.Ratio(colour, plane); + if (ratio < Contrast.Floor) + { + failures.Add($"{name}: {hex} is {ratio:F2}:1 on {plane}"); + } + + if (Contrast.Legible(colour, plane) != colour) + { + failures.Add($"{name}: {hex} is moved by the floor"); + } + } + } + + await Assert.That(failures).IsEmpty(); + } + + [Test] + public async Task TheDarkAndLightThemesTakeDifferentSetsOfTheSameHues() + { + await Assert.That(WorkspacePalette.DarkPanes(ThemeLibrary.Get("Dark"))).IsTrue(); + await Assert.That(WorkspacePalette.DarkPanes(ThemeLibrary.Get("Solarized Dark"))).IsTrue(); + await Assert.That(WorkspacePalette.DarkPanes(ThemeLibrary.Get("Light"))).IsFalse(); + await Assert.That(MapAreaPalette.Dark.Colours.Count).IsEqualTo(MapAreaPalette.Light.Colours.Count); + } + + [Test] + public async Task AnAreasColourIsStableForItsName() + { + await Assert.That(MapAreaPalette.Dark.Colour("Aetherfall")).IsEqualTo(MapAreaPalette.Dark.Colour("Aetherfall")); + await Assert.That(MapAreaPalette.IndexOf("Aetherfall")).IsEqualTo(MapAreaPalette.IndexOf("Aetherfall")); + + // Pinned, so a change to the hash (which would recolour every player's areas) is a decision, not an accident. + await Assert.That(MapAreaPalette.IndexOf("Aetherfall")).IsEqualTo(Fnv("Aetherfall")); + var spread = Enumerable.Range(0, 64).Select(i => MapAreaPalette.IndexOf($"Area {i}")).Distinct().Count(); + await Assert.That(spread).IsEqualTo(8); + } + + private static int Fnv(string text) + { + var hash = 2166136261u; + foreach (var c in text) + { + hash = unchecked((hash ^ c) * 16777619u); + } + + return (int)(hash % 8u); + } + + private static Rgb Parse(string hex) => new( + Convert.ToByte(hex.Substring(1, 2), 16), + Convert.ToByte(hex.Substring(3, 2), 16), + Convert.ToByte(hex.Substring(5, 2), 16)); +} diff --git a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs new file mode 100644 index 00000000..0711de0d --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs @@ -0,0 +1,166 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Mapping; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The terminal's half of two surfaces: the notice, whose status-row markup is what it always was now that it is drawn +/// from a ; and the map, whose cells take their area colours, stairs and legend from the +/// the window's canvas is handed. +/// +[NotInParallel] +public class NoticeAndMapSurfaceTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App() + { + Console.SetIn(TextReader.Null); + return new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(new HeadlessConsoleDriver(120, 34), Caps)); + } + + // ── notices ────────────────────────────────────────────────────────────────────────────── + + /// + /// The row reads exactly as before the model: a key chip in the notice ink, the text dim — or in the warning red when + /// something failed — and an action changes nothing on it, since a cell is not a button. + /// + [Test] + public async Task TheStatusRowDrawsANoticeAsItAlwaysHas() + { + await using var app = App(); + app.RenderSnapshot(null); + + app.SimulateNotice("nothing to split", MessageSeverity.Warning, "⌃B", null); + var plain = app.LastNotice!; + await Assert.That(plain).EndsWith("]⌃B[/] [dim]nothing to split[/]"); + var chip = plain[..plain.IndexOf("⌃B", StringComparison.Ordinal)]; + + app.SimulateNotice("nothing to split", MessageSeverity.Warning, "⌃B", new NoticeAction("layout:layouts", "Change layout")); + await Assert.That(app.LastNotice).IsEqualTo(plain).Because("the action is the window's to offer; the row is unchanged"); + + app.SimulateNotice("no route to host", MessageSeverity.Error, null, null); + await Assert.That(app.LastNotice).IsEqualTo($"[{ScreenPalette.Warn}]no route to host[/]"); + + app.SimulateNotice("saved [x]", MessageSeverity.Info, "F5", null); + await Assert.That(app.LastNotice).IsEqualTo($"{chip}F5[/] [dim]saved [[x]][/]"); + } + + /// The model the row was drawn from is recorded as the notice surface's drawn model, sequence and all. + [Test] + public async Task EachNoticeIsOneModelTheRowIsDrawnFrom() + { + await using var app = App(); + app.RenderSnapshot(null); + var action = new NoticeAction("layout:layouts", "Change layout"); + + app.SimulateNotice("first", MessageSeverity.Info, "⌥M", action); + var first = (NoticeModel?)app.DrawnModel(SurfaceCatalog.Notice); + app.SimulateNotice("second", MessageSeverity.Error, null, null); + var second = (NoticeModel?)app.DrawnModel(SurfaceCatalog.Notice); + + await Assert.That(first).IsNotNull(); + await Assert.That(first!.Severity).IsEqualTo(NoticeSeverity.Info); + await Assert.That(first.Action).IsEqualTo(action); + await Assert.That(first.Key).IsEqualTo("⌥M"); + await Assert.That(second!.Severity).IsEqualTo(NoticeSeverity.Warning).Because("the log's Error is the notice's warning"); + await Assert.That(second.Sequence).IsEqualTo(first.Sequence + 1); + await Assert.That(app.NoticeMarkup(second)).IsEqualTo(app.LastNotice); + await Assert.That(SharpMUTermApp.NoticeSeverityOf(MessageSeverity.Warning)).IsEqualTo(NoticeSeverity.Refusal); + await Assert.That(app.Messages.Entries.Select(e => e.Text)).Contains("second").Because("the message log stays the history"); + } + + /// A notice action runs only if a notice offered it, and the terminal offers none: it has no toast to click. + [Test] + public async Task ANoticeActionNoNoticeOfferedIsRefused() + { + await using var app = App(); + app.RenderSnapshot(null); + app.SimulateNotice("first", MessageSeverity.Info, "⌥M", new NoticeAction("layout:layouts", "Change layout")); + + await Assert.That(app.RunNoticeAction("layout:layouts")).IsFalse().Because("a terminal host publishes no notice, so offers no click"); + await Assert.That(app.LastNotice).Contains("no notice offered"); + } + + // ── the map ────────────────────────────────────────────────────────────────────────────── + + private static (WorldMap Map, MapViewModel View) TwoAreas(MapAreaPalette palette) + { + var map = new WorldMap(); + var town = map.AreaNamed("Town"); + var docks = map.AreaNamed("Docks"); + map.Add(new MapRoom { Id = 1, Name = "Plaza", AreaId = town.Id, Exits = { ["east"] = 2, ["south"] = 3 } }); + map.Add(new MapRoom { Id = 2, Name = "Stair", AreaId = town.Id, X = 1, Exits = { ["west"] = 1, ["up"] = 4 } }); + map.Add(new MapRoom { Id = 3, Name = "Quay", AreaId = docks.Id, Y = 1, Exits = { ["north"] = 1 } }); + map.Add(new MapRoom { Id = 4, Name = "Loft", AreaId = town.Id, X = 1, Z = 1, Exits = { ["down"] = 2 } }); + return (map, MapViewModel.From(map, 1, [], null, palette)); + } + + /// + /// Rooms in the drawn area's colour, the way into another area in that area's colour, and the legend naming both — + /// every colour the view's own. A view handed made-up colours draws exactly those, so the cells read the model and + /// not a palette of their own. + /// + [Test] + public async Task TheCellMapDrawsTheViewsAreaColoursStairsAndLegend() + { + var (map, view) = TwoAreas(MapAreaPalette.Dark); + var invented = view with + { + Areas = [new MapViewArea("Town", "#abcdef", Drawn: true), new MapViewArea("Docks", "#fedcba", Drawn: false)], + }; + var ink = new MapRenderer.Ink("#ffffff", "#00ff00", "#ffff00", "#ff00ff"); + + var lines = MapRenderer.Render(invented, map, 40, 9, ink); + var all = string.Join('\n', lines); + + await Assert.That(all).Contains("[link=mux:map:2][#abcdef][[↑]][/][/]").Because("a room wears its area's colour and the view's stairs"); + await Assert.That(all).Contains("[#fedcba]│[/]").Because("the way south into the docks is drawn in the docks' colour"); + await Assert.That(MarkupText.Plain(lines[^1])).IsEqualTo("@ you · ↑↓ stairs · ■ Town · ■ Docks"); + await Assert.That(lines[^1]).Contains("[#abcdef]■[/]"); + await Assert.That(lines[^1]).Contains("[#fedcba]■[/]"); + + // The stairs mark is the view's: a room the view says has none draws none, whatever the map holds. + var flat = invented with { Rooms = invented.Rooms.Select(r => r with { Up = false, Down = false }).ToList() }; + await Assert.That(string.Join('\n', MapRenderer.Render(flat, map, 40, 9, ink))).DoesNotContain("↑"); + } + + /// On every built-in theme the floor leaves the palette's colours as the model says them. + [Test] + public async Task TheFloorLeavesThePalettesAreaColoursAlone() + { + foreach (var name in Core.Theming.ThemeLibrary.Names) + { + var theme = Core.Theming.ThemeLibrary.Get(name); + var (map, view) = TwoAreas(MapAreaPalette.For(WorkspacePalette.DarkPanes(theme))); + var ink = new MapRenderer.Ink("#ffffff", "#00ff00", "#ffff00", "#ff00ff", WorkspacePalette.ReadingPlane(theme)); + var all = string.Join('\n', MapRenderer.Render(view, map, 40, 9, ink)); + await Assert.That(all).Contains($"[{view.AreaColour}]").Because(name); + await Assert.That(all).Contains($"[{view.ColourOf("Docks")}]").Because(name); + } + } + + /// The demo's map window draws from the model the client recorded for it, area colour included. + [Test] + public async Task TheDemoMapIsDrawnFromItsRecordedModel() + { + await using var app = App(); + app.RenderSnapshot("map"); + var window = SharpMUTermApp.MapWindowId(DemoScene.ActiveSessionKey); + var view = (MapViewModel?)app.DrawnModel(Core.Layouts.PanelIds.Map, window); + + await Assert.That(view).IsNotNull(); + await Assert.That(view!.Areas.Select(a => a.Name)).IsEquivalentTo(new[] { "Aetherfall", "Saltmarsh Docks" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(view.Rooms.Single(r => r.Name == "Temple Steps").Up).IsTrue(); + var markup = string.Join('\n', app.MapMarkup(window)); + await Assert.That(markup).Contains($"[{view.AreaColour}]"); + await Assert.That(markup).Contains($"[{view.ColourOf("Saltmarsh Docks")}]■[/]"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs index b15c4bc8..c5b4e5db 100644 --- a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs @@ -40,7 +40,7 @@ public class SnapshotViewEmptyConfigTests "collapsed", "prefix", "prefix-panel", "timestamps", "timestamps-toggled", "spawn", "split", "focus", "focus-moved", "freeze", "freeze-scrollback", "move", "drag", "scrollback", "scrollback-up", "scrollback-split", "reflow", "away", "away-scrollback", "links", "web", "rail-long", "history", "history-search", - "history-search-filter", "draft", "draft2", "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "quit", + "history-search-filter", "draft", "draft2", "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "notices", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "compose", "compose-literal", "deletions", "textansi", "input", "keypad", "password", "startup", "logging", "set", "triggers", "route", "highlight", "worlds", "settings", "mssp", From 3c9676d5a35bc28bb58e10d568093f7256267ce2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 07:27:32 +0000 Subject: [PATCH 028/113] Theme picker in both hosts; F5 and F9 declared with scoped bindings F7 opens with a THEME group: one row per theme (built-ins, the customised theme in force, CustomThemes) with a seven-row preview of the theme under the cursor - an ANSI pane, the focused pane with a tab strip, a tinted pane and the armed command line - drawn from one Client model (ThemePreview / ThemeCard, built by Tui ThemePreviews). Moving the cursor paints the screen in that theme; Esc closes with nothing committed; Enter commits through ScreenEdits.Apply, and SaveConfiguration puts the new theme into force (ApplyThemeIfChanged / ApplyTheme), with a notice that output already on screen keeps its colours. The desktop settings window draws the same model as native cards (ThemeCardView); a click uses the theme and the window follows the variant. SettingBinding now reads a SettingTarget (configuration, world, character) with ForWorld/ForCharacter factories and a section Scope. F5's world fields and F9's character fields are declared (BuiltInSettings.World and .Character) with TextRules shared by both surfaces. The cell F5 builds its world, security and character rows from those declarations in its own ordinal order; the settings window edits them with a subject picker and a door to the cell screen for the lists. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 6 + CLAUDE.md | 50 ++- src/SharpMUTerm.Avalonia/SettingsWindow.cs | 159 +++++++++- src/SharpMUTerm.Avalonia/ThemeCardView.cs | 137 +++++++++ .../Contributions/Descriptors.cs | 35 ++- .../Settings/BuiltInSettings.cs | 288 +++++++++++++++++- .../Settings/SettingBinding.cs | 204 +++++++++++-- .../Settings/SettingsForm.cs | 148 +++++++-- src/SharpMUTerm.Client/Settings/TextRules.cs | 96 ++++++ .../Settings/ThemeChoices.cs | 100 ++++++ .../Settings/ThemePreview.cs | 109 +++++++ .../Settings/WorldFieldValues.cs | 171 +++++++++++ .../Surfaces/SurfaceCatalog.cs | 2 +- .../Configuration/AppConfiguration.cs | 8 + src/SharpMUTerm.Core/Theming/Theme.cs | 15 + src/SharpMUTerm.Tui/ComposeOverlay.cs | 5 +- src/SharpMUTerm.Tui/DeclaredFields.cs | 61 ++++ src/SharpMUTerm.Tui/EditReviewOverlay.cs | 5 +- src/SharpMUTerm.Tui/ListOverlay.cs | 5 +- src/SharpMUTerm.Tui/OptionsScreenRenderer.cs | 214 ++++++++++++- src/SharpMUTerm.Tui/OptionsScreenView.cs | 16 + src/SharpMUTerm.Tui/ScreenChrome.cs | 11 +- src/SharpMUTerm.Tui/ScreenFocus.cs | 3 + src/SharpMUTerm.Tui/ScreenModel.cs | 6 + src/SharpMUTerm.Tui/SettingsOverlay.cs | 23 +- src/SharpMUTerm.Tui/SettingsSession.cs | 4 +- .../SharpMUTermApp.Settings.cs | 37 ++- src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs | 100 ++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 79 +++-- src/SharpMUTerm.Tui/SnapshotViews.cs | 1 + src/SharpMUTerm.Tui/ThemePreviews.cs | 102 +++++++ src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 202 ++++-------- .../SettingsWindowTests.cs | 108 ++++++- .../ScopedSettingsTests.cs | 183 +++++++++++ .../CommandSurfaceSettingsTests.cs | 14 +- .../DeclaredWorldSettingsTests.cs | 186 +++++++++++ .../FrameContrastTests.cs | 1 + .../ScreenCursorTests.cs | 7 +- .../SharpMUTerm.Tui.Tests/ScreenModelTests.cs | 25 +- .../SessionStateAccountingTests.cs | 7 +- 40 files changed, 2671 insertions(+), 262 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/ThemeCardView.cs create mode 100644 src/SharpMUTerm.Client/Settings/TextRules.cs create mode 100644 src/SharpMUTerm.Client/Settings/ThemeChoices.cs create mode 100644 src/SharpMUTerm.Client/Settings/ThemePreview.cs create mode 100644 src/SharpMUTerm.Client/Settings/WorldFieldValues.cs create mode 100644 src/SharpMUTerm.Tui/DeclaredFields.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs create mode 100644 src/SharpMUTerm.Tui/ThemePreviews.cs create mode 100644 tests/SharpMUTerm.Client.Tests/ScopedSettingsTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aafdc4e..e093ca81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- A theme picker at the top of F7: each theme with a preview of the panes, a tab strip and the command line. + Moving onto a theme shows the screen in it, Enter uses it and Esc keeps the one you had. The desktop window's + settings show the same themes as cards; click one to use it. A customised theme stays in the list when you + try another. +- Desktop window: the settings window now edits Worlds & Characters (F5) and Characters (F9) too, with a + picker for which world or character you are editing and a button to the full screen for adding and deleting. - Ctrl+P lists *Fold or unfold the connection rail*, the same fold as Ctrl+B b and as the desktop window's sidebar button. - Desktop window: the header and the connections sidebar now have room of their own — a full-height toolbar diff --git a/CLAUDE.md b/CLAUDE.md index 230e1f4f..81bf1a25 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1334,7 +1334,9 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg same way. - **Views:** `worlds`/`settings`, `triggers`, `route`, `highlight`, `aliases`, `timers`, `keypad`, `set`, `textansi`, `input`, `settings-search` (F7, `/`, `meter` typed: the search with its section - list and match counts), `settings-meters`/`settings-meters-pick` (the meter table over the demo's game + list and match counts), `settings-themes`/`settings-themes-solarized`/`settings-themes-used` (F7's theme + picker with the cursor on Light and on Solarized Dark — the screen painted in the previewed theme — and Light + used with ⏎), `settings-meters`/`settings-meters-pick` (the meter table over the demo's game data, the cursor on a meter with the received-data box under it, and the same meter's value path open with its dropdown of received paths), `settings-changed` (F7 after two real edits: the `● changed` marks and `r reset`), `logging`, `password`, `startup`, `freeze`, `spawn`, `split`, @@ -1582,9 +1584,34 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] trailing Remove button added only while the cursor is on one; the received-data box shows only while the cursor is in the table; path fields offer the received paths with their values as `ChoiceNotes`. - F7 and F8 are windowed to the screen height (`ScreenChrome.Window`), because F7 is taller than 24 rows. - - Not declared yet: F2–F6, F9 (F5's character form) and F10 are listed by title only. F9 was not declared - for the native window either: its fields are per *character*, and a `SettingBinding` reads an - `AppConfiguration`, so declaring it needs a binding that knows which character first. + - **F5's world fields and F9's character fields are declared, with scoped bindings** (`BuiltInSettings.World` + and `.Character`; `SettingScope`, `SettingTarget`, `SettingBinding.ForWorld`/`ForCharacter`; + `WorldFieldValues`, `TextRules`; Tui `DeclaredFields`). A binding reads a `SettingTarget` (the configuration + plus a world and a character, implicitly just the configuration), and a section's `Scope` says which it needs. + A target that does not reach the scope reads as default, shows `per world`/`per character`, and resets nothing. + Defaults come off a fresh `WorldDefinition`/`CharacterDefinition`, the rule above. Identity fields (name, host, + port, character name, password) are declared not resettable. **The cell F5 is not drawn by `FromSection`**: its + world row, security checkboxes and character row are built from the declarations through `DeclaredFields`, in + the order `WorldFieldOrder`/`SecurityFieldOrder`/`CharacterFieldOrder` name, because ⇥ order and the field + ordinals tests navigate by are the cell screen's, while the declaration's order is the window's grouping. A + `TextRule` (Required, Name, Pattern, Secret, Defaulted) is the one rule both the cell field and + `SettingsForm.SetText` apply. The lists (characters, trigger sets, adding and deleting) stay the cell screen's. + `DeclaredWorldSettingsTests` holds the two surfaces' field lists together. + - **The theme is F7's first field, a `ThemeField`** (`ThemeChoices`, `ThemePreview`/`ThemeCard`, Client; + `ThemePreviews`, `SharpMUTermApp.Theme.cs`, Tui; `ThemeCardView`, Avalonia). One Client model per theme: three + panes (ANSI, focused with a tab strip, tinted) and the armed command line, every colour resolved by + `ThemePreviews.Preview` the way the workspace paints it and held to the floor. The cell picker draws a row per + theme (an `Apply` button: `ScreenButtonKind.Apply`, `[⏎] Use`) and a seven-row preview of the theme under the + cursor; the window draws the same cards natively. **Moving the cursor previews by painting the screen in that + theme** (`OptionsScreen.Preview` → `SchemeFor`), so Esc closing with nothing committed is the revert; ⏎ commits + through `ScreenEdits.Apply`. F7 opens with the cursor on the theme in force. **A theme change is noticed in + `SaveConfiguration`** (`ApplyThemeIfChanged`, by colour signature) and `ApplyTheme` re-derives the chrome, the + formatters, every overlay's `Scheme` and the panes' planes. **Output already in a pane keeps its colours** — + it is markup by then — and the notice says so; on a light theme the old dark-theme greys are faint until they + scroll away. A customised theme replaced by the picker is kept in `AppConfiguration.CustomThemes` (no schema + bump), and listed. Unstyled text on a settings screen takes the scheme's ink (`ScreenChrome.Panel`/`Band` + set `ForegroundColor`), not the window's, because the window is still the theme in force while one is previewed. + - Not declared yet: F2–F4, F6 and F10 are listed by title only. - **In the window, a declared section opens a native settings window, generated from the declarations** (`ClientHost.NativeSettings` → `INativeSettings`; Client `SettingsForm`; Avalonia `SettingsWindow`, `SettingsPresenter` on the driver; `OpenSettingsScreen`/`TryOpenNativeSettings` in `SharpMUTermApp.Settings.cs`). @@ -1606,14 +1633,21 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] thread. `GameDataStore` is locked, but the focus is not safe to read from another thread. The `now` column is re-read each second (`OptionsScreenRenderer.NowText`). The received paths feed each path box's auto-complete and a list below it; clicking a path fills the path box last used. + - **A scoped section (F5, F9) has a subject picker and a door.** `SettingsForm.Subjects`/`Choose` pick the world + or character its fields edit; the form opens on the focused window's (`FocusedSubject`, resolved on the client's + thread). A write captures the subject at the moment it is made. `Open the F5 screen ↗` (`OpenScreen`) is the way + to the lists, and opens the *cell* screen: `OpenSectionScreen` calls `GoToSetting(…, native: false)`, or the door + would reopen this window. With no world there are no fields, only a sentence and the door. A text the rule + refuses is put back with the reason as a tooltip. - **Search is `SettingsSearch.Find` and nothing else**, so the two surfaces always find the same fields. While searching, the page shows only matched fields, and if the section on show has none it moves to the first that has some. - **Fluent is applied to this window only** (`Styles.Add(new FluentTheme())`), and `RequestedThemeVariant` - follows the client's theme (`SettingsForm.IsDark`). The rest of the window stays on the Simple theme the - native menu and tooltips were built against. - - Not done: the window is not modal and does not follow a theme change while it is open. Screenshots come from a - real window under Xvfb, driven with XTest (`ux-wave4/native-settings-*.png`). + follows the client's theme (`SettingsForm.IsDark`, read live), so a theme card clicked here flips the window's + variant and rebuilds the page. The rest of the window stays on the Simple theme the native menu and tooltips + were built against. + - Not done: the window is not modal. Screenshots come from a real window under Xvfb, driven with XTest + (`ux-wave4/native-settings-*.png`, `ux-wave6/settings-themes-window-*.png`). - **In the window, ⌃P is a native palette over the window, listing the cell palette's rows** (`ClientHost.NativePalette` → `INativePalette`; Client `PaletteSession`; Avalonia `PaletteOverlay`, `PalettePresenter` on the driver; `SharpMUTermApp.NativePalette.cs`). The terminal, the snapshot, the tests and the parity harness pass null. Decisions diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index bbd4faf6..ecefd3d1 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -40,6 +40,7 @@ internal sealed class SettingsWindow : Window private readonly Dictionary _resets = new(StringComparer.Ordinal); private readonly Dictionary _badges = new(StringComparer.Ordinal); private readonly List<(StatusMeter Meter, TextBlock Now)> _meterNow = []; + private readonly List _themeCards = []; private SettingsForm _form; private IReadOnlyList _matches = []; private string? _shown; @@ -110,6 +111,15 @@ public SettingsWindow(SettingsForm form) /// The section list. public ListBox SectionList => _sections; + /// The theme cards on the page, for a test. + public IReadOnlyList ThemeCards => _themeCards; + + /// The world or character picker of a scoped section, for a test; null on an app-wide one. + public ComboBox? SubjectPicker { get; private set; } + + /// The button that opens the section's own cell screen, for a test; null where there is none. + public Button? ScreenDoor { get; private set; } + /// The meter table, for a test: a heading row and one row per meter. public Grid? MeterGrid { get; private set; } @@ -237,6 +247,9 @@ private void BuildPage() _controls.Clear(); _resets.Clear(); _meterNow.Clear(); + _themeCards.Clear(); + SubjectPicker = null; + ScreenDoor = null; MeterGrid = null; _meterRows = -1; if (_shown is null || _form.Section(_shown) is not { } section) @@ -251,6 +264,16 @@ private void BuildPage() _page.Children.Add(new TextBlock { Text = $"{key} in the client · changes apply as you make them", Opacity = 0.7, Margin = new Thickness(0, 0, 0, 6) }); } + if (section.Scope != SettingScope.App) + { + _page.Children.Add(SubjectRow(section)); + if (!_form.HasSubject(section)) + { + ShownFields = []; + return; + } + } + var visible = Searching ? section.Fields.Where(f => _matches.Any(m => ReferenceEquals(m.Field, f))).ToList() : section.Fields.ToList(); @@ -275,12 +298,114 @@ private void BuildPage() }); } - _page.Children.Add(field is ListField { Id: BuiltInSettings.MetersField } meters ? MeterTable(meters) : FieldRow(field)); + _page.Children.Add(field switch + { + ListField { Id: BuiltInSettings.MetersField } meters => MeterTable(meters), + ThemeField theme => ThemePicker(theme), + _ => FieldRow(field), + }); } ShownFields = visible.Select(f => f.Id).ToList(); } + /// + /// A scoped section's header row: which world or character its fields are for, picked from every one there is, and + /// the way to the section's own cell screen for what is not a field — the lists of characters and trigger sets, + /// adding and deleting. With nothing to edit yet it says so and offers only the screen. + /// + private StackPanel SubjectRow(SettingsSectionContribution section) + { + var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, Margin = new Thickness(0, 6, 0, 2) }; + var subjects = _form.Subjects(section.Scope); + var noun = section.Scope == SettingScope.World ? "world" : "character"; + if (subjects.Count == 0) + { + row.Children.Add(new TextBlock { Text = $"There is no {noun} yet.", VerticalAlignment = VerticalAlignment.Center, Opacity = 0.8 }); + } + else + { + var labels = subjects.Select(s => s.Label).ToList(); + var current = _form.Subject(section.Scope); + var picker = new ComboBox { ItemsSource = labels, MinWidth = 240, SelectedItem = current?.Label }; + AutomationProperties.SetName(picker, $"The {noun} these settings are for"); + picker.SelectionChanged += (_, _) => + { + if (!_syncing && picker.SelectedIndex is >= 0 and var i && i < subjects.Count + && !string.Equals(subjects[i].Label, _form.Subject(section.Scope)?.Label, StringComparison.Ordinal)) + { + _form.Choose(subjects[i]); + var offset = _scroller.Offset; + BuildPage(); + _scroller.Offset = offset; + } + }; + SubjectPicker = picker; + row.Children.Add(new TextBlock { Text = section.Scope == SettingScope.World ? "World" : "Character", VerticalAlignment = VerticalAlignment.Center, FontWeight = FontWeight.SemiBold }); + row.Children.Add(picker); + } + + if (section.Key is { } key) + { + var door = new Button { Content = $"Open the {key} screen ↗", VerticalAlignment = VerticalAlignment.Center }; + ToolTip.SetTip(door, section.Scope == SettingScope.World + ? "Adding and deleting worlds, their characters and trigger sets are on the cell screen" + : "Adding and deleting characters is on the cell screen"); + AutomationProperties.SetName(door, $"Open the {key} screen"); + var id = section.Id; + door.Click += (_, _) => _form.OpenScreen(id); + ScreenDoor = door; + row.Children.Add(door); + } + + return row; + } + + /// The theme field: a card per theme, its preview drawn from the client's model; a click uses it. + private StackPanel ThemePicker(ThemeField field) + { + var outer = new StackPanel { Spacing = 6, Margin = new Thickness(0, 4, 0, 4) }; + var words = new StackPanel { Spacing = 1 }; + words.Children.Add(new TextBlock { Text = Capitalise(field.Label), FontSize = 14 }); + if (field.Help is { } help) + { + words.Children.Add(new TextBlock { Text = Capitalise(help), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + } + + outer.Children.Add(words); + + var wrap = new WrapPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 6, 0, 0) }; + var inUse = CurrentTheme(field); + foreach (var card in _form.Themes()) + { + var view = new ThemeCardView(card, string.Equals(card.Name, inUse, StringComparison.OrdinalIgnoreCase), _form.IsDark); + view.Click += (_, _) => + { + if (!string.Equals(card.Name, CurrentTheme(field), StringComparison.OrdinalIgnoreCase)) + { + _form.SetTheme(field, card.Name); + } + }; + _themeCards.Add(view); + wrap.Children.Add(view); + } + + _controls[field.Id] = wrap; + _refreshers.Add(() => + { + var now = CurrentTheme(field); + foreach (var view in _themeCards) + { + view.SetInUse(string.Equals(view.Card.Name, now, StringComparison.OrdinalIgnoreCase), _form.IsDark); + } + }); + outer.Children.Add(wrap); + return outer; + } + + private string? CurrentTheme(ThemeField field) => + field.Binding is SettingBinding binding ? _form.Get(binding) : null; + /// The accent the changed dot and headings wear: Fluent's own, for the theme variant. private SolidColorBrush Accent => new(_form.IsDark ? Color.Parse("#60cdff") : Color.Parse("#005fb8")); @@ -387,7 +512,7 @@ private Control ControlFor(SettingsField field) case ChoiceField choice when field.Binding is SettingBinding named: { - var combo = new ComboBox { ItemsSource = choice.Choices, SelectedItem = _form.Get(named), MinWidth = 180 }; + var combo = new ComboBox { ItemsSource = _form.Choices(choice), SelectedItem = _form.Get(named), MinWidth = 180 }; combo.SelectionChanged += (_, _) => { if (!_syncing && combo.SelectedItem is string value && value != _form.Get(named)) @@ -416,9 +541,9 @@ private Control ControlFor(SettingsField field) return combo; } - case TextField text when field.Binding is SettingBinding optional: + case TextField text when field.Binding is SettingBinding: { - var box = new TextBox { Text = _form.Get(optional) ?? string.Empty, Width = 260 }; + var box = new TextBox { Text = _form.Text(text), Width = 260 }; if (text.Masked) { box.PasswordChar = '•'; @@ -431,9 +556,19 @@ private Control ControlFor(SettingsField field) void Commit() { - if (!_syncing && (box.Text ?? string.Empty) != (_form.Get(optional) ?? string.Empty)) + if (!_syncing && (box.Text ?? string.Empty) != _form.Text(text)) { - _form.SetText(text, box.Text); + if (_form.SetText(text, box.Text) is { } refused) + { + // Refused by the rule the cell screen's field applies: put the value back and say why. + box.Text = _form.Text(text); + ToolTip.SetTip(box, refused); + ToolTip.SetIsOpen(box, true); + } + else + { + ToolTip.SetTip(box, null); + } } } @@ -450,7 +585,7 @@ void Commit() { if (!box.IsKeyboardFocusWithin) { - box.Text = _form.Get(optional) ?? string.Empty; + box.Text = _form.Text(text); } }); return box; @@ -668,9 +803,13 @@ private void Tick() /// Re-reads every value and indicator on the page. A meter added or removed rebuilds the page, whose rows moved. internal void Refresh() { - if (_meterRows >= 0 - && _form.Section(_shown ?? string.Empty)?.Fields.OfType().FirstOrDefault() is { } meters - && _form.Meters(meters).Count != _meterRows) + var variant = _form.IsDark ? ThemeVariant.Dark : ThemeVariant.Light; + var flipped = RequestedThemeVariant != variant; + RequestedThemeVariant = variant; + if (flipped + || (_meterRows >= 0 + && _form.Section(_shown ?? string.Empty)?.Fields.OfType().FirstOrDefault() is { } meters + && _form.Meters(meters).Count != _meterRows)) { var offset = _scroller.Offset; BuildPage(); diff --git a/src/SharpMUTerm.Avalonia/ThemeCardView.cs b/src/SharpMUTerm.Avalonia/ThemeCardView.cs new file mode 100644 index 00000000..b122db5a --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ThemeCardView.cs @@ -0,0 +1,137 @@ +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Controls.Documents; +using Avalonia.Layout; +using Avalonia.Media; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Avalonia; + +/// +/// One theme in the settings window's theme field: its preview drawn natively — three panes with their tab strips on +/// the workspace backdrop and the armed command line under them — and its name, kind and whether it is in use. Every +/// colour is the client's (), the instance the cell picker draws, so the two cannot +/// disagree. A click is the card's ; the window hands it to the form. +/// +internal sealed class ThemeCardView : Button +{ + private readonly Border _frame; + private readonly TextBlock _state; + + public ThemeCardView(ThemeCard card, bool inUse, bool windowIsDark) + { + ArgumentNullException.ThrowIfNull(card); + Card = card; + Padding = new Thickness(0); + Background = Brushes.Transparent; + BorderThickness = new Thickness(0); + HorizontalContentAlignment = HorizontalAlignment.Stretch; + Margin = new Thickness(0, 0, 14, 14); + Width = 300; + AutomationProperties.SetName(this, $"Use the {card.Name} theme"); + ToolTip.SetTip(this, $"Use {card.Name}"); + + var name = new TextBlock { Text = card.Name, FontSize = 14, FontWeight = FontWeight.SemiBold }; + _state = new TextBlock { FontSize = 12, Opacity = 0.72 }; + var words = new StackPanel { Margin = new Thickness(10, 8, 10, 8), Spacing = 1 }; + words.Children.Add(name); + words.Children.Add(_state); + + var body = new StackPanel(); + body.Children.Add(Preview(card.Preview)); + body.Children.Add(words); + + _frame = new Border + { + Child = body, + CornerRadius = new CornerRadius(8), + ClipToBounds = true, + BorderThickness = new Thickness(2), + Background = new SolidColorBrush(windowIsDark ? Color.Parse("#2b2b30") : Color.Parse("#f3f3f5")), + }; + Content = _frame; + SetInUse(inUse, windowIsDark); + } + + /// The theme this card shows. + public ThemeCard Card { get; } + + /// Whether the card is marked as the theme in use, for a test. + public bool InUse { get; private set; } + + /// Marks the card as the theme in use, or not. + public void SetInUse(bool inUse, bool windowIsDark) + { + InUse = inUse; + var kind = $"{(Card.IsDark ? "dark" : "light")} · {(Card.IsCustom ? "your own" : "built in")}"; + _state.Text = inUse ? $"In use · {kind}" : kind; + _frame.BorderBrush = inUse + ? new SolidColorBrush(windowIsDark ? Color.Parse("#60cdff") : Color.Parse("#005fb8")) + : new SolidColorBrush(windowIsDark ? Color.Parse("#46464e") : Color.Parse("#c8c8d0")); + } + + private static readonly FontFamily Mono = FontFamily.Parse("monospace"); + + private static IBrush Brush(Rgb colour) => new SolidColorBrush(Color.FromRgb(colour.R, colour.G, colour.B)); + + /// The backdrop with the panes side by side on it and the command line under them. + private static Border Preview(ThemePreview preview) + { + var panes = new Grid { ColumnSpacing = 3 }; + for (var i = 0; i < preview.Panes.Count; i++) + { + panes.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Star)); + var pane = Pane(preview.Panes[i]); + Grid.SetColumn(pane, i); + panes.Children.Add(pane); + } + + var line = preview.CommandLine; + var command = new TextBlock { FontFamily = Mono, FontSize = 9, Padding = new Thickness(4, 2), TextTrimming = TextTrimming.CharacterEllipsis }; + command.Inlines!.Add(new Run(line.Prompt + " ") { Foreground = Brush(line.PromptInk), FontWeight = FontWeight.Bold }); + command.Inlines.Add(new Run(line.Text) { Foreground = Brush(line.Ink) }); + + var stack = new StackPanel { Spacing = 3 }; + stack.Children.Add(panes); + stack.Children.Add(new Border { Background = Brush(line.Band), Child = command }); + + return new Border { Background = Brush(preview.Backdrop), Padding = new Thickness(3), Child = stack }; + } + + private static Border Pane(PreviewPane pane) + { + var tabs = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 1 }; + foreach (var tab in pane.Tabs) + { + var title = new TextBlock { FontFamily = Mono, FontSize = 9, Padding = new Thickness(3, 1) }; + title.Inlines!.Add(new Run(tab.Title) { Foreground = Brush(tab.Ink), FontWeight = tab.Selected ? FontWeight.Bold : FontWeight.Normal }); + if (tab.Badge is { } badge) + { + title.Inlines.Add(new Run($" {badge}") { Foreground = Brush(tab.BadgeInk ?? tab.Ink) }); + } + + tabs.Children.Add(new Border { Background = Brush(tab.Chip), Child = title }); + } + + var lines = new StackPanel { Margin = new Thickness(4, 3, 4, 4) }; + foreach (var runs in pane.Lines) + { + var text = new TextBlock { FontFamily = Mono, FontSize = 9, TextTrimming = TextTrimming.CharacterEllipsis }; + foreach (var run in runs) + { + text.Inlines!.Add(new Run(run.Text) { Foreground = Brush(run.Ink), FontWeight = run.Bold ? FontWeight.Bold : FontWeight.Normal }); + } + + lines.Children.Add(text); + } + + var stack = new StackPanel(); + stack.Children.Add(new Border { Child = tabs, ClipToBounds = true }); + stack.Children.Add(lines); + var plane = new Border { Background = Brush(pane.Plane), Child = stack, MinHeight = 70 }; + ToolTip.SetTip(plane, pane.Role); + return plane; + } +} diff --git a/src/SharpMUTerm.Client/Contributions/Descriptors.cs b/src/SharpMUTerm.Client/Contributions/Descriptors.cs index e5a5295b..963b93e5 100644 --- a/src/SharpMUTerm.Client/Contributions/Descriptors.cs +++ b/src/SharpMUTerm.Client/Contributions/Descriptors.cs @@ -1,4 +1,5 @@ using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Text; namespace SharpMUTerm.Client.Contributions; @@ -51,6 +52,12 @@ public sealed class SettingsSectionContribution : IContribution /// The key that opens its screen (F7), or null for a section no key opens. public string? Key { get; init; } + + /// + /// What its fields belong to: the client (F7, F8), one world (F5) or one character (F9). A surface drawing a + /// scoped section first says which world or character it is editing; every field's binding is of this scope. + /// + public SettingScope Scope { get; init; } = SettingScope.App; } /// @@ -79,7 +86,17 @@ public sealed record BoolField(string Id, string Label, string? Help = null) : S /// One of a closed set of values. public sealed record ChoiceField(string Id, string Label, IReadOnlyList Choices, string? Help = null) - : SettingsField(Id, Label, Help); + : SettingsField(Id, Label, Help) +{ + /// + /// The choices when they depend on the configuration (a layout row lists the player's own layouts), or null for + /// the fixed . + /// + public Func>? ChoicesFrom { get; init; } + + /// The choices over . + public IReadOnlyList ChoicesIn(AppConfiguration config) => ChoicesFrom?.Invoke(config) ?? Choices; +} /// A whole number within bounds. public sealed record NumberField(string Id, string Label, int Minimum, int Maximum, string? Help = null) @@ -87,7 +104,21 @@ public sealed record NumberField(string Id, string Label, int Minimum, int Maxim /// Free text; for a password. public sealed record TextField(string Id, string Label, int? MaxLength = null, bool Masked = false, string? Help = null) - : SettingsField(Id, Label, Help); + : SettingsField(Id, Label, Help) +{ + /// What the text may be and how it is stored (); optional free text by default. + public TextRule Rule { get; init; } = TextRule.Optional; + + /// For : the value an unset field stands for, and is shown and opened as. + public string? Fallback { get; init; } +} + +/// +/// The client's theme, picked from a list where each theme is shown as a preview (): a pane +/// in a world's colours, a tinted pane, the focused pane, the command line and a tab strip, all in that theme. Its +/// binding holds the theme's name; the choices are . +/// +public sealed record ThemeField(string Id, string Label, string? Help = null) : SettingsField(Id, Label, Help); /// A colour from a named palette (never a free hex: a name survives a theme change, a hex does not). public sealed record ColourField(string Id, string Label, IReadOnlyList Names, string? Help = null) diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index d3652a7b..5f00f041 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -17,7 +17,13 @@ namespace SharpMUTerm.Client.Settings; /// public static class BuiltInSettings { - /// F7's groups, in the order they are drawn. Colour and legibility: what the client does with the colours a world sends. + /// F7's groups, in the order they are drawn. The theme: the client's own colours, picked with a preview. + public const string ThemeGroup = "Theme"; + + /// The id of the theme field, which a host draws as a list of previews rather than one value. + public const string ThemeFieldId = "theme"; + + /// Colour and legibility: what the client does with the colours a world sends. public const string ColourGroup = "Colour & legibility"; /// Text: how a line's characters are laid out. @@ -50,6 +56,13 @@ public static class BuiltInSettings Order = 60, Fields = [ + new ThemeField(ThemeFieldId, "theme", "the colours of the panes, the bars and these screens") + { + Group = ThemeGroup, + Keywords = "colour color dark light solarized palette appearance look", + Binding = new SettingBinding(ThemeChoices.Current, ThemeChoices.Apply), + }, + Flag("strip-colour", "strip incoming ANSI colour", ColourGroup, c => c.Text.StripIncomingColour, (c, v) => c.Text.StripIncomingColour = v, "draw every line in the theme's own colours", "sgr monochrome color"), @@ -159,17 +172,203 @@ public static class BuiltInSettings ], }; + /// F5's world groups. + public const string ConnectionGroup = "Connection"; + + /// What the world speaks and how it logs in. + public const string ProtocolGroup = "Protocols & login"; + + /// How the world's text is taken in. + public const string WorldTextGroup = "Text"; + + /// What the mapper reads. + public const string MapGroup = "Map"; + + /// Sound and the starting layout. + public const string WorldMediaGroup = "Sound & layout"; + + /// + /// F5: one world's own fields, edited for the world a surface has chosen. The cell screen builds its world row from + /// these (in its own ⇥ order, by id — see WorldsScreenRenderer.WorldFieldOrder), and its CHARACTERS and TRIGGER + /// SETS panes — lists, not fields — stay the cell screen's, which the native window links to. + /// + public static SettingsSectionContribution World { get; } = new() + { + Id = "worlds", + Title = "Worlds & Characters", + Key = "F5", + Order = 10, + Scope = SettingScope.World, + Fields = + [ + WorldText("name", "name", TextRule.Name, ConnectionGroup, + (_, w) => w.Name, (_, w, v) => w.Name = v ?? w.Name, "what the world is called here", resettable: false), + WorldText("host", "host", TextRule.Required, ConnectionGroup, + (_, w) => w.Host, (_, w, v) => w.Host = v ?? w.Host, "the address to dial", "address server dns", resettable: false), + new NumberField("port", "port", 1, 65535, "the port to dial") + { + Group = ConnectionGroup, + Binding = SettingBinding.ForWorld((_, w) => w.Port, (_, w, v) => w.Port = v, resettable: false), + }, + WorldFlag("tls", "TLS", ConnectionGroup, w => w.UseTls, (w, v) => w.UseTls = v, + "connect over an encrypted connection", "ssl secure encrypted"), + WorldFlag("invalid-certificates", "accept invalid certificates", ConnectionGroup, + w => w.AllowInvalidCertificates, (w, v) => w.AllowInvalidCertificates = v, + "connect even when the server's certificate does not check out", "ssl tls self-signed insecure"), + WorldChoice("encoding", "encoding", WorldFieldValues.Encodings, ConnectionGroup, + (_, w) => w.Encoding, (_, w, v) => w.Encoding = v, + "auto follows what the server agrees; anything else overrides it", "charset utf-8 latin"), + new NumberField("keepalive", "keepalive", 0, 86400, "seconds between keepalives; 0 is off") + { + Group = ConnectionGroup, + Keywords = "idle timeout ping", + Binding = SettingBinding.ForWorld((_, w) => w.KeepaliveSeconds, (_, w, v) => w.KeepaliveSeconds = v), + }, + + WorldChoice("content", "content", WorldFieldValues.ContentChoices, ProtocolGroup, + (_, w) => WorldFieldValues.ContentName(w.ContentFormat), (_, w, v) => w.ContentFormat = WorldFieldValues.ContentOf(v), + "the markup the world sends; auto follows what it negotiates", "mxp pueblo ansi markup"), + WorldText("gmcp-modules", "gmcp modules", TextRule.Optional, ProtocolGroup, + (_, w) => WorldFieldValues.JoinModules(w), (_, w, v) => WorldFieldValues.SplitModules(w, v), + "extra GMCP packages to ask for, such as IRE.Rift 1", "gmcp packages supports"), + WorldChoice("gmcp-login", "gmcp login", WorldFieldValues.LoginChoices, ProtocolGroup, + (_, w) => w.GmcpLogin ? WorldFieldValues.LoginChoices[1] : WorldFieldValues.LoginChoices[0], + (_, w, v) => w.GmcpLogin = v == WorldFieldValues.LoginChoices[1], + "log in over GMCP when the server offers it", "char.login password credentials"), + WorldChoice("discord", "discord", WorldFieldValues.DiscordChoices, ProtocolGroup, + (_, w) => w.DiscordPresence ? WorldFieldValues.DiscordChoices[1] : WorldFieldValues.DiscordChoices[0], + (_, w, v) => w.DiscordPresence = v == WorldFieldValues.DiscordChoices[1], + "show what the game says you are doing on Discord", "presence rich status"), + + WorldChoice("emoji", "emoji", WorldFieldValues.EmojiChoices, WorldTextGroup, + (_, w) => WorldFieldValues.EmojiName(w.Emoji), (_, w, v) => WorldFieldValues.SetEmoji(w.Emoji, v), + "which emoji substitutions run on this world's text", "emoticons shortcodes"), + WorldChoice("join-wraps", "join wraps", WorldFieldValues.JoinWrapChoices, WorldTextGroup, + (_, w) => w.JoinWrappedLines ? WorldFieldValues.JoinWrapChoices[1] : WorldFieldValues.JoinWrapChoices[0], + (_, w, v) => w.JoinWrappedLines = v == WorldFieldValues.JoinWrapChoices[1], + "join lines the server wrapped at its own width", "reflow wrap hard"), + WorldText("edit-grab", "edit grab", TextRule.Optional, WorldTextGroup, + (_, w) => w.GrabPrefix, (_, w, v) => w.GrabPrefix = v, + "a line starting with this goes on the command line instead of the output", "fugueedit mush edit prefix"), + + WorldText("map-room", "map room", TextRule.Pattern, MapGroup, + (_, w) => w.Map.RoomNamePattern, (_, w, v) => w.Map.RoomNamePattern = v, + "a pattern matching a room's name line", "mapper regex"), + WorldText("map-exits", "map exits", TextRule.Pattern, MapGroup, + (_, w) => w.Map.ExitsPattern, (_, w, v) => w.Map.ExitsPattern = v, + "a pattern matching a room's exits line", "mapper regex"), + WorldText("walk-fail", "walk fail", TextRule.Pattern, MapGroup, + (_, w) => w.Map.WalkFailurePattern, (_, w, v) => w.Map.WalkFailurePattern = v, + "a pattern that stops a speedwalk", "speedwalk mapper regex"), + + WorldChoice("sounds", "sounds", WorldFieldValues.SoundChoices, WorldMediaGroup, + (_, w) => w.DownloadMedia ? WorldFieldValues.SoundChoices[0] : WorldFieldValues.SoundChoices[1], + (_, w, v) => w.DownloadMedia = v == WorldFieldValues.SoundChoices[0], + "fetch the sounds the game asks for, or play only those already cached", "audio media download"), + new ChoiceField("layout", "layout", [WorldFieldValues.WorldLayoutDefault], "the layout this world's characters start in") + { + Group = WorldMediaGroup, + Keywords = "panes combat roleplay", + ChoicesFrom = c => WorldFieldValues.LayoutChoices(WorldFieldValues.Layouts(c), WorldFieldValues.WorldLayoutDefault), + Binding = SettingBinding.ForWorld( + (c, w) => WorldFieldValues.LayoutName(WorldFieldValues.Layouts(c), w.Layout) ?? WorldFieldValues.WorldLayoutDefault, + (c, w, v) => w.Layout = WorldFieldValues.LayoutId(WorldFieldValues.Layouts(c), v)), + }, + ], + }; + + /// F9's character groups. + public const string CharacterGroup = "Character"; + + /// The character's transcript and restore log. + public const string LoggingGroup = "Logging"; + + /// How the character's panes look. + public const string LookGroup = "Panes"; + + /// + /// F9: one character's own fields, edited for the character a surface has chosen. The cell screen builds its + /// character row from these (in its ⇥ order, by id — WorldsScreenRenderer.CharacterFieldOrder); the trigger + /// sets a character uses are a list, and stay on the cell screen. + /// + public static SettingsSectionContribution Character { get; } = new() + { + Id = "logging", + Title = "Characters", + Key = "F9", + Order = 80, + Scope = SettingScope.Character, + Fields = + [ + CharacterText("name", "name", TextRule.Name, CharacterGroup, + (_, c) => c.Name, (_, c, v) => c.Name = v ?? c.Name, "the name the connect line logs in as", resettable: false), + new TextField("password", "password", Masked: true, Help: "saved in secrets.json, in plain text") + { + Group = CharacterGroup, + Rule = TextRule.Secret, + Keywords = "secret login", + Binding = SettingBinding.ForCharacter((_, c) => c.Password, (_, c, v) => c.Password = v, resettable: false), + }, + new TextField("connect", "connect", Help: "the login line; %CHARACTER% and %PASSWORD% are filled in") + { + Group = CharacterGroup, + Rule = TextRule.Defaulted, + Fallback = ConnectStringTemplate.Default, + Keywords = "login auto-login connect string", + Binding = SettingBinding.ForCharacter((_, c) => c.ConnectString, (_, c, v) => c.ConnectString = v), + }, + CharacterText("on-connect", "on connect", TextRule.Optional, CharacterGroup, + (_, c) => c.OnConnect, (_, c, v) => c.OnConnect = v, "a command sent once logged in", "commands startup"), + CharacterText("disconnect", "disconnect", TextRule.Optional, CharacterGroup, + (_, c) => c.OnDisconnect, (_, c, v) => c.OnDisconnect = v, "a command sent before hanging up", "quit logout"), + CharacterChoice("at-start", "at start", WorldFieldValues.StartupChoices, CharacterGroup, + (_, c) => c.ConnectAtStartup ? WorldFieldValues.StartupOn : WorldFieldValues.StartupOff, + (_, c, v) => c.ConnectAtStartup = string.Equals(v, WorldFieldValues.StartupOn, StringComparison.OrdinalIgnoreCase), + "connect this character when the client starts", "startup launch auto connect"), + + CharacterChoice("log", "log", WorldFieldValues.LogFormats, LoggingGroup, + (_, c) => c.Logging.Format.ToString(), + (_, c, v) => c.Logging.Format = Enum.TryParse(v, ignoreCase: true, out var f) ? f : c.Logging.Format, + "write this character's session to a transcript", "transcript html text logging"), + CharacterText("log-folder", "log folder", TextRule.Optional, LoggingGroup, + (_, c) => c.Logging.Directory, (_, c, v) => c.Logging.Directory = v, + "where transcripts go; blank is the default folder", "directory path logging"), + CharacterChoice("restore", "restore", WorldFieldValues.RestoreChoices, LoggingGroup, + (_, c) => c.Logging.RestoreLog ? WorldFieldValues.RestoreOn : WorldFieldValues.RestoreOff, + (_, c, v) => c.Logging.RestoreLog = string.Equals(v, WorldFieldValues.RestoreOn, StringComparison.OrdinalIgnoreCase), + "panes refill after a restart", "restart history"), + + new ColourField("tint", "tint", WorldFieldValues.Tints, "this character's pane colour") + { + Group = LookGroup, + Keywords = "colour color pane tint", + Binding = SettingBinding.ForCharacter( + (_, c) => c.Tint.ToString(), + (_, c, v) => c.Tint = Enum.TryParse(v, ignoreCase: true, out var t) ? t : c.Tint), + }, + new ChoiceField("layout", "layout", [WorldFieldValues.CharacterLayoutDefault], "the layout this character starts in") + { + Group = LookGroup, + Keywords = "panes combat roleplay", + ChoicesFrom = c => WorldFieldValues.LayoutChoices(WorldFieldValues.Layouts(c), WorldFieldValues.CharacterLayoutDefault), + Binding = SettingBinding.ForCharacter( + (c, ch) => WorldFieldValues.LayoutName(WorldFieldValues.Layouts(c), ch.Layout) ?? WorldFieldValues.CharacterLayoutDefault, + (c, ch, v) => ch.Layout = WorldFieldValues.LayoutId(WorldFieldValues.Layouts(c), v)), + }, + ], + }; + /// Every section the client declares, in their order: the screens F2 to F10. public static IReadOnlyList All { get; } = [ - Listed("worlds", "Worlds & Characters", "F5", 10), + World, Listed("triggers", "Triggers & spawn routing", "F2", 20), Listed("aliases", "Aliases", "F3", 30), Listed("keypad", "Keypad & hotkeys", "F4", 40), Listed("timers", "Timers", "F6", 50), Text, Input, - Listed("logging", "Character logging", "F9", 80), + Character, Listed("packages", "Packages", "F10", 90), ]; @@ -201,6 +400,89 @@ private static BoolField Flag( Binding = new SettingBinding(get, set, v => v ? "on" : "off"), }; + private static BoolField WorldFlag( + string id, + string label, + string group, + Func get, + Action set, + string? help = null, + string? keywords = null) => + new(id, label, help) + { + Group = group, + Keywords = keywords, + Binding = SettingBinding.ForWorld((_, w) => get(w), (_, w, v) => set(w, v), v => v ? "on" : "off"), + }; + + private static ChoiceField WorldChoice( + string id, + string label, + IReadOnlyList choices, + string group, + Func get, + Action set, + string? help = null, + string? keywords = null) => + new(id, label, choices, help) + { + Group = group, + Keywords = keywords, + Binding = SettingBinding.ForWorld(get, set), + }; + + private static TextField WorldText( + string id, + string label, + TextRule rule, + string group, + Func get, + Action set, + string? help = null, + string? keywords = null, + bool resettable = true) => + new(id, label, Help: help) + { + Group = group, + Rule = rule, + Keywords = keywords, + Binding = SettingBinding.ForWorld(get, set, resettable: resettable), + }; + + private static ChoiceField CharacterChoice( + string id, + string label, + IReadOnlyList choices, + string group, + Func get, + Action set, + string? help = null, + string? keywords = null) => + new(id, label, choices, help) + { + Group = group, + Keywords = keywords, + Binding = SettingBinding.ForCharacter(get, set), + }; + + private static TextField CharacterText( + string id, + string label, + TextRule rule, + string group, + Func get, + Action set, + string? help = null, + string? keywords = null, + bool resettable = true) => + new(id, label, Help: help) + { + Group = group, + Rule = rule, + Keywords = keywords, + Binding = SettingBinding.ForCharacter(get, set, resettable: resettable), + }; + private static NumberField Number( string id, string label, diff --git a/src/SharpMUTerm.Client/Settings/SettingBinding.cs b/src/SharpMUTerm.Client/Settings/SettingBinding.cs index 6a3c4ca7..690f3aa1 100644 --- a/src/SharpMUTerm.Client/Settings/SettingBinding.cs +++ b/src/SharpMUTerm.Client/Settings/SettingBinding.cs @@ -4,26 +4,82 @@ namespace SharpMUTerm.Client.Settings; /// -/// Where a declared setting lives in the : how to read it, how to write it, and -/// what it is when nobody has touched it. The untyped half is what every surface needs to say -/// ● changed and to reset a value; is what a renderer reads the value -/// through. +/// What a declared setting belongs to: the whole client, one world, or one character. A world's fields and a +/// character's fields are declared once, like the client's own, and edited for whichever world or character a +/// surface has chosen (). +/// +public enum SettingScope +{ + /// The whole client: a property of . + App, + + /// One world: a property of a . + World, + + /// One character: a property of a . + Character, +} + +/// +/// Where a binding reads and writes: the configuration, and — for a world's or a character's field — the world +/// or character being edited. An converts to one with neither, so every surface +/// that only ever edited app-wide settings passes its configuration exactly as before. +/// +/// The live configuration. +/// The world a world-scoped field edits, or null. +/// The character a character-scoped field edits, or null. +public readonly record struct SettingTarget( + AppConfiguration Config, WorldDefinition? World = null, CharacterDefinition? Character = null) +{ + /// An app-wide target over . + public static implicit operator SettingTarget(AppConfiguration config) => new(config); + + /// Whether this target names what a field of edits. + public bool Reaches(SettingScope scope) => scope switch + { + SettingScope.World => World is not null, + SettingScope.Character => Character is not null, + _ => true, + }; +} + +/// +/// Where a declared setting lives in the configuration: how to read it, how to write it, and what it is when nobody +/// has touched it. The untyped half is what every surface needs to say ● changed and to reset a value; +/// is what a renderer reads the value through. /// /// The default is never written down. It is whatever the binding reads off a freshly constructed -/// , so the configuration types stay the one place a default is decided and a +/// — or, for a world's or a character's field, a fresh or +/// — so the configuration types stay the one place a default is decided and a /// declaration cannot disagree with them. /// +/// +/// A scoped binding handed a target that does not name its owner (the settings search reading a world's field +/// with no world chosen) reads as per world / per character, is at its default and resets nothing, +/// rather than throwing: the search lists fields from every section and must not need a world to do it. Reading or +/// writing the value itself without one does throw. +/// /// public abstract class SettingBinding { - /// Whether the value in is its default. - public abstract bool IsDefault(AppConfiguration config); + /// What the setting belongs to. + public abstract SettingScope Scope { get; } - /// Puts the default back into . - public abstract void Reset(AppConfiguration config); + /// + /// Whether the value has a default worth going back to. An identity — a world's name and host, a character's + /// name and password — does not: "reset" would turn one world into a blank template, so such a field never shows + /// ● changed and offers no reset. + /// + public bool Resettable { get; protected init; } = true; + + /// Whether the value in is its default. + public abstract bool IsDefault(SettingTarget target); + + /// Puts the default back into . + public abstract void Reset(SettingTarget target); /// The value as text, the way a search result or a summary shows it. - public abstract string Text(AppConfiguration config); + public abstract string Text(SettingTarget target); /// The default as text. public abstract string DefaultText { get; } @@ -33,8 +89,9 @@ public abstract class SettingBinding /// What the configuration holds. public sealed class SettingBinding : SettingBinding { - private readonly Func _get; - private readonly Action _set; + private readonly SettingScope _scope; + private readonly Func _get; + private readonly Action _set; private readonly Func? _format; private readonly Func? _describe; private readonly Lazy _defaultText; @@ -54,27 +111,86 @@ public SettingBinding( Action set, Func? format = null, Func? describe = null) + : this( + SettingScope.App, + OnConfig(get), + OnConfig(set), + format, + describe, + resettable: true) { - ArgumentNullException.ThrowIfNull(get); - ArgumentNullException.ThrowIfNull(set); + } + + private SettingBinding( + SettingScope scope, + Func get, + Action set, + Func? format, + Func? describe, + bool resettable) + { + _scope = scope; _get = get; _set = set; _format = format; _describe = describe; + Resettable = resettable; _defaultText = new Lazy(() => Format(Default)); } - /// The value in . - public T Get(AppConfiguration config) => _get(config); + /// A field of one world: read and written on the world a surface has chosen. + /// Reads the value; the configuration is there for what a world's value is looked up in (its layouts). + /// Writes the value. + /// As for the app-wide constructor. + /// False for an identity (). + public static SettingBinding ForWorld( + Func get, + Action set, + Func? format = null, + bool resettable = true) + { + ArgumentNullException.ThrowIfNull(get); + ArgumentNullException.ThrowIfNull(set); + return new SettingBinding( + SettingScope.World, t => get(t.Config, t.World!), (t, v) => set(t.Config, t.World!, v), format, null, resettable); + } + + /// A field of one character: read and written on the character a surface has chosen. + /// Reads the value. + /// Writes the value. + /// As for the app-wide constructor. + /// False for an identity (). + public static SettingBinding ForCharacter( + Func get, + Action set, + Func? format = null, + bool resettable = true) + { + ArgumentNullException.ThrowIfNull(get); + ArgumentNullException.ThrowIfNull(set); + return new SettingBinding( + SettingScope.Character, + t => get(t.Config, t.Character!), + (t, v) => set(t.Config, t.Character!, v), + format, + null, + resettable); + } + + /// + public override SettingScope Scope => _scope; + + /// The value in . + public T Get(SettingTarget target) => _get(Checked(target)); - /// Writes into . - public void Set(AppConfiguration config, T value) => _set(config, value); + /// Writes into . + public void Set(SettingTarget target, T value) => _set(Checked(target), value); /// - /// The default, read off a fresh configuration each time — so a default that is a list is never one - /// instance shared between every configuration that is reset to it. + /// The default, read off a fresh configuration (and a fresh world and character) each time — so a default + /// that is a list is never one instance shared between every configuration that is reset to it. /// - public T Default => _get(new AppConfiguration()); + public T Default => _get(new SettingTarget(new AppConfiguration(), new WorldDefinition(), new CharacterDefinition())); /// A value as text. public string Format(T value) => @@ -84,16 +200,52 @@ public string Format(T value) => public override string DefaultText => _defaultText.Value; /// - public override bool IsDefault(AppConfiguration config) => - string.Equals(Format(Get(config)), DefaultText, StringComparison.Ordinal); + public override bool IsDefault(SettingTarget target) => + !Resettable + || !target.Reaches(_scope) + || string.Equals(Format(Get(target)), DefaultText, StringComparison.Ordinal); /// - public override void Reset(AppConfiguration config) => Set(config, Default); + public override void Reset(SettingTarget target) + { + if (Resettable && target.Reaches(_scope)) + { + Set(target, Default); + } + } /// - public override string Text(AppConfiguration config) + public override string Text(SettingTarget target) { - var value = Get(config); + if (!target.Reaches(_scope)) + { + return _scope == SettingScope.World ? "per world" : "per character"; + } + + var value = Get(target); return value is bool flag ? (flag ? "on" : "off") : _describe?.Invoke(value) ?? Format(value); } + + private SettingTarget Checked(SettingTarget target) + { + if (target.Reaches(_scope)) + { + return target; + } + + var noun = _scope.ToString().ToLowerInvariant(); + throw new InvalidOperationException($"A {noun} setting needs a {noun} to read or write."); + } + + private static Func OnConfig(Func get) + { + ArgumentNullException.ThrowIfNull(get); + return t => get(t.Config); + } + + private static Action OnConfig(Action set) + { + ArgumentNullException.ThrowIfNull(set); + return (t, v) => set(t.Config, v); + } } diff --git a/src/SharpMUTerm.Client/Settings/SettingsForm.cs b/src/SharpMUTerm.Client/Settings/SettingsForm.cs index f6d367ae..edc98640 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsForm.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsForm.cs @@ -8,6 +8,12 @@ namespace SharpMUTerm.Client.Settings; /// What it holds now. public sealed record ReceivedValue(string Path, string Value); +/// A world or character a scoped section can be edited for, as a host lists it. +/// What the list says: the world's name, or Corvid · Aetherfall. +/// The world. +/// The character, for a character-scoped section; null for a world. +public sealed record SettingsSubject(string Label, WorldDefinition World, CharacterDefinition? Character); + /// /// The declared settings as a form a host draws with its own controls: the sections in their order, every value /// read through its field's , and every change committed through one delegate the @@ -27,6 +33,10 @@ public sealed class SettingsForm private readonly Action _openScreen; private readonly Func> _received; private readonly Func _now; + private readonly Func> _themes; + private readonly Func _isDark; + private WorldDefinition? _world; + private CharacterDefinition? _character; /// Every settings section, in order — declared ones and the ones only listed by title. /// The live configuration the values are read from and written to. @@ -36,6 +46,10 @@ public sealed class SettingsForm /// Whether the client's theme is a dark one, so the host's controls can follow it. /// The focused connection's game data as meter paths, or null for none. /// What a meter reads now (412/500), or null while its value has not arrived. + /// The themes the theme field offers, each with its preview, or null for none. + /// Whether the client's theme is dark now — it changes when a theme is picked here. + /// The world a world-scoped section is edited for first, or null for the first world. + /// The character a character-scoped section is edited for first, or null for the first. public SettingsForm( IReadOnlyList sections, AppConfiguration config, @@ -44,7 +58,11 @@ public SettingsForm( string initial, bool isDark, Func>? received = null, - Func? now = null) + Func? now = null, + Func>? themes = null, + Func? isDarkNow = null, + WorldDefinition? world = null, + CharacterDefinition? character = null) { ArgumentNullException.ThrowIfNull(sections); ArgumentNullException.ThrowIfNull(config); @@ -55,9 +73,19 @@ public SettingsForm( _commit = commit; _openScreen = openScreen; Initial = initial; - IsDark = isDark; + _isDark = isDarkNow ?? (() => isDark); _received = received ?? (() => Array.Empty()); _now = now ?? (_ => null); + _themes = themes ?? (() => Array.Empty()); + var worlds = config.Worlds.ToArray(); + _character = character; + _world = world ?? (character is null ? null : worlds.FirstOrDefault(w => w.Characters.Contains(character))) + ?? worlds.FirstOrDefault(); + _character ??= _world?.Characters.FirstOrDefault() ?? worlds.SelectMany(w => w.Characters).FirstOrDefault(); + if (_character is not null && _world?.Characters.Contains(_character) != true) + { + _world = worlds.FirstOrDefault(w => w.Characters.Contains(_character)) ?? _world; + } } /// Every section, in order. @@ -66,8 +94,81 @@ public SettingsForm( /// The id of the section shown first. public string Initial { get; } - /// Whether the client's theme is dark. - public bool IsDark { get; } + /// Whether the client's theme is dark — now, so a theme picked here is followed. + public bool IsDark => _isDark(); + + /// + /// Every world (for ) or every character (for ) + /// a scoped section can be edited for, in configuration order; empty for an app-wide section. + /// + public IReadOnlyList Subjects(SettingScope scope) + { + var worlds = _config.Worlds.ToArray(); + return scope switch + { + SettingScope.World => [.. worlds.Select(w => new SettingsSubject(w.Name, w, null))], + SettingScope.Character => + [.. worlds.SelectMany(w => w.Characters.ToArray().Select(c => new SettingsSubject($"{c.Name} · {w.Name}", w, c)))], + _ => [], + }; + } + + /// The world or character a scoped section is being edited for, or null when there is none to edit. + public SettingsSubject? Subject(SettingScope scope) => scope switch + { + SettingScope.World when _world is { } w => new SettingsSubject(w.Name, w, null), + SettingScope.Character when _character is { } c && _world is { } w => new SettingsSubject($"{c.Name} · {w.Name}", w, c), + _ => null, + }; + + /// + /// Edits the scoped sections for from now on: a world's fields for its world, a + /// character's for its character (and its world). + /// + public void Choose(SettingsSubject subject) + { + ArgumentNullException.ThrowIfNull(subject); + _world = subject.World; + if (subject.Character is { } character) + { + _character = character; + } + else if (_character is null || !subject.World.Characters.Contains(_character)) + { + _character = subject.World.Characters.FirstOrDefault() ?? _character; + } + } + + /// Whether a section can be edited now: an app-wide one always, a scoped one once it has a world or character. + public bool HasSubject(SettingsSectionContribution section) + { + ArgumentNullException.ThrowIfNull(section); + return Target.Reaches(section.Scope); + } + + /// Where every binding reads and writes now: the configuration and the chosen world and character. + private SettingTarget Target => new(_config, _world, _character); + + /// The choices offers now (a layout row lists the player's own layouts). + public IReadOnlyList Choices(ChoiceField field) + { + ArgumentNullException.ThrowIfNull(field); + return field.ChoicesIn(_config); + } + + /// The themes the theme field offers, each with its preview — the model the cell picker draws too. + public IReadOnlyList Themes() => _themes(); + + /// Makes the client's theme, through the save funnel. + public void SetTheme(ThemeField field, string name) + { + ArgumentNullException.ThrowIfNull(field); + ArgumentNullException.ThrowIfNull(name); + if (field.Binding is SettingBinding binding) + { + Set(binding, name); + } + } /// Raised on the client's thread after a change made through this form has landed. public event Action? Changed; @@ -87,14 +188,14 @@ public static bool IsDeclared(SettingsSectionContribution section) public T Get(SettingBinding binding) { ArgumentNullException.ThrowIfNull(binding); - return binding.Get(_config); + return binding.Get(Target); } /// Whether holds its default — what decides its changed dot and its reset. public bool IsDefault(SettingsField field) { ArgumentNullException.ThrowIfNull(field); - return field.Binding?.IsDefault(_config) ?? true; + return field.Binding?.IsDefault(Target) ?? true; } /// The default of as text, for a reset button's tooltip. @@ -107,12 +208,14 @@ public static string DefaultText(SettingsField field) /// /// Writes through the save funnel. Numbers and texts go through /// and , which hold them to the rules the cell screen's field applies first, so neither - /// surface can store what the other would refuse. + /// surface can store what the other would refuse. A scoped field is written to the world or character chosen + /// when the change was made, even if the choice moves before the client runs it. /// public void Set(SettingBinding binding, T value) { ArgumentNullException.ThrowIfNull(binding); - _commit(() => binding.Set(_config, value)); + var target = Target; + _commit(() => binding.Set(target, value)); } /// Writes a number, held to 's bounds. @@ -125,22 +228,32 @@ public void SetNumber(NumberField field, int value) } } - /// Writes a text; empty is stored as no value, the cell screen's optional-field rule. - public void SetText(TextField field, string? value) + /// + /// Writes a text by its field's — refused, trimmed, blank as no value — the rule the cell + /// screen's field of the same kind applies. Returns why it was refused, or null once it is on its way. + /// + public string? SetText(TextField field, string? value) { ArgumentNullException.ThrowIfNull(field); if (field.Binding is not SettingBinding binding) { - return; + return null; } - var text = string.IsNullOrWhiteSpace(value) ? null : value.Trim(); - if (text is not null && field.MaxLength is { } max && text.Length > max) + if (TextRules.Check(field, value) is { } refused) { - text = text[..max]; + return refused; } - Set(binding, text); + Set(binding, TextRules.Store(field, value)); + return null; + } + + /// What a text field shows now: its value, or the fallback a defaulted field stands for. + public string Text(TextField field) + { + ArgumentNullException.ThrowIfNull(field); + return field.Binding is SettingBinding binding ? TextRules.Shown(field, Get(binding)) : string.Empty; } /// Puts back to its default, through the funnel, as the cell screen's r does. @@ -149,7 +262,8 @@ public void Reset(SettingsField field) ArgumentNullException.ThrowIfNull(field); if (field.Binding is { } binding) { - _commit(() => binding.Reset(_config)); + var target = Target; + _commit(() => binding.Reset(target)); } } @@ -158,7 +272,7 @@ public List Meters(ListField field) { ArgumentNullException.ThrowIfNull(field); return field.Binding is SettingBinding> binding - ? binding.Get(_config).Select(Copy).ToList() + ? binding.Get(Target).Select(Copy).ToList() : new List(); } diff --git a/src/SharpMUTerm.Client/Settings/TextRules.cs b/src/SharpMUTerm.Client/Settings/TextRules.cs new file mode 100644 index 00000000..d8efd279 --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/TextRules.cs @@ -0,0 +1,96 @@ +using System.Text.RegularExpressions; +using SharpMUTerm.Client.Contributions; + +namespace SharpMUTerm.Client.Settings; + +/// What a declared text field may hold and how it is stored. Both hosts apply the same rule. +public enum TextRule +{ + /// Free text that may be blank, stored as null when it is; trimmed (an on-connect command). + Optional, + + /// Free text that may not be blank; trimmed (a host). + Required, + + /// What a thing is called: not blank, no control characters; trimmed. + Name, + + /// A regular expression that may be blank (stored as null); refused when it does not parse; not trimmed. + Pattern, + + /// A secret: blank is no value, no control characters, and never trimmed — a trimmed password is another password. + Secret, + + /// + /// A value with a default behind it (): shown as the fallback while unset, and + /// blank or the fallback itself stores null again, so "unset" has one spelling. + /// + Defaulted, +} + +/// +/// The rules of , applied by the native settings window; the cell screens build their own field +/// of the matching kind from the same rule, so the two surfaces refuse and store the same things. +/// +public static class TextRules +{ + /// Why is refused for , or null when it is accepted. + public static string? Check(TextField field, string? value) + { + ArgumentNullException.ThrowIfNull(field); + var text = value ?? string.Empty; + return field.Rule switch + { + TextRule.Required when string.IsNullOrWhiteSpace(text) => $"{field.Label} cannot be empty", + TextRule.Name when string.IsNullOrWhiteSpace(text) => $"{field.Label} cannot be empty", + TextRule.Name or TextRule.Secret or TextRule.Defaulted when text.Any(char.IsControl) => + $"{field.Label} cannot contain control characters", + TextRule.Pattern when !string.IsNullOrWhiteSpace(text) => PatternError(text), + _ => null, + }; + } + + /// What is stored for an accepted : trimmed or not, and null for "unset". + public static string? Store(TextField field, string? value) + { + ArgumentNullException.ThrowIfNull(field); + var text = value ?? string.Empty; + string? stored = field.Rule switch + { + TextRule.Required or TextRule.Name => text.Trim(), + TextRule.Pattern => string.IsNullOrWhiteSpace(text) ? null : text, + TextRule.Secret => text.Length == 0 ? null : text, + TextRule.Defaulted => text.Trim() is var t && (t.Length == 0 || string.Equals(t, field.Fallback, StringComparison.Ordinal)) + ? null + : t, + _ => string.IsNullOrWhiteSpace(text) ? null : text.Trim(), + }; + + if (stored is not null && field.MaxLength is { } max && stored.Length > max) + { + stored = stored[..max]; + } + + return stored; + } + + /// What a field shows for a stored value: the fallback for an unset defaulted field. + public static string Shown(TextField field, string? stored) + { + ArgumentNullException.ThrowIfNull(field); + return stored ?? (field.Rule == TextRule.Defaulted ? field.Fallback ?? string.Empty : string.Empty); + } + + private static string? PatternError(string pattern) + { + try + { + _ = new Regex(pattern, RegexOptions.None, TimeSpan.FromMilliseconds(100)); + return null; + } + catch (ArgumentException e) + { + return e.Message; + } + } +} diff --git a/src/SharpMUTerm.Client/Settings/ThemeChoices.cs b/src/SharpMUTerm.Client/Settings/ThemeChoices.cs new file mode 100644 index 00000000..3057d2d3 --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/ThemeChoices.cs @@ -0,0 +1,100 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Theming; + +namespace SharpMUTerm.Client.Settings; + +/// +/// The themes a player can pick and how picking one is written: the built-ins (), the +/// customised theme in use if it is one of the player's own, and the player's other themes +/// (). One place, so the cell picker, the native cards and the client's +/// own theme resolution agree on what a name means. +/// +public static class ThemeChoices +{ + /// Whether names a built-in theme. + public static bool IsBuiltIn(string? name) => + name is not null && ThemeLibrary.Names.Contains(name, StringComparer.OrdinalIgnoreCase); + + /// + /// The theme in force: the inline theme when it is one of the player's own (its name is not a built-in's, or + /// disagrees with ), otherwise the built-in by name. + /// + public static Theme Resolve(AppConfiguration config) + { + ArgumentNullException.ThrowIfNull(config); + if (config.Theme is { } inline + && (!string.Equals(inline.Name, config.ThemeName, StringComparison.OrdinalIgnoreCase) || !IsBuiltIn(config.ThemeName))) + { + return inline; + } + + return ThemeLibrary.Get(config.ThemeName); + } + + /// The name of the theme in force. + public static string Current(AppConfiguration config) => Resolve(config).Name; + + /// Every theme the picker lists, by name: the built-ins in their order, then the player's own. + public static IReadOnlyList Names(AppConfiguration config) => [.. All(config).Select(t => t.Name)]; + + /// Every theme the picker lists, in order, each a copy safe to read on another thread. + public static IReadOnlyList All(AppConfiguration config) + { + ArgumentNullException.ThrowIfNull(config); + var themes = ThemeLibrary.Names.Select(ThemeLibrary.Get).ToList(); + var current = Resolve(config); + if (!IsBuiltIn(current.Name)) + { + themes.Add(current.Clone()); + } + + foreach (var own in config.CustomThemes) + { + if (!themes.Any(t => string.Equals(t.Name, own.Name, StringComparison.OrdinalIgnoreCase))) + { + themes.Add(own.Clone()); + } + } + + return themes; + } + + /// Whether is one of the player's own themes rather than a built-in. + public static bool IsCustom(string name) => !IsBuiltIn(name); + + /// The theme called , or null when the picker lists none by that name. + public static Theme? Find(AppConfiguration config, string name) => + All(config).FirstOrDefault(t => string.Equals(t.Name, name, StringComparison.OrdinalIgnoreCase)); + + /// + /// Makes the theme in force. A customised theme being replaced is kept in + /// , so nothing the player made is lost by trying another theme; a + /// name the picker does not list changes nothing. + /// + public static void Apply(AppConfiguration config, string name) + { + ArgumentNullException.ThrowIfNull(config); + ArgumentNullException.ThrowIfNull(name); + var chosen = Find(config, name); + if (chosen is null) + { + return; + } + + var current = Resolve(config); + if (string.Equals(current.Name, chosen.Name, StringComparison.OrdinalIgnoreCase)) + { + return; + } + + if (!IsBuiltIn(current.Name) + && !config.CustomThemes.Any(t => string.Equals(t.Name, current.Name, StringComparison.OrdinalIgnoreCase))) + { + config.CustomThemes.Add(current.Clone()); + } + + config.CustomThemes.RemoveAll(t => string.Equals(t.Name, chosen.Name, StringComparison.OrdinalIgnoreCase)); + config.ThemeName = chosen.Name; + config.Theme = chosen; + } +} diff --git a/src/SharpMUTerm.Client/Settings/ThemePreview.cs b/src/SharpMUTerm.Client/Settings/ThemePreview.cs new file mode 100644 index 00000000..480d0078 --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/ThemePreview.cs @@ -0,0 +1,109 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Client.Settings; + +/// One run of preview text and the colour it is drawn in, already held to the legibility floor on its pane. +/// The text. +/// Its colour. +/// Whether it is bold. +public sealed record PreviewRun(string Text, Rgb Ink, bool Bold = false); + +/// One tab of a preview pane's strip. +/// The window's name. +/// The chip it is painted on. +/// Its text colour on the chip. +/// Whether it is the tab in front. +/// An unread count, or null. +/// The count's colour on the chip. +public sealed record PreviewTab(string Title, Rgb Chip, Rgb Ink, bool Selected, string? Badge = null, Rgb? BadgeInk = null); + +/// One preview pane: what it stands for, its plane, its tab strip and its lines. +/// What the pane shows about the theme (ANSI colours, focused, tinted · moss). +/// The pane's surface. +/// Its tab strip. +/// Its output, line by line. +/// Whether it is the pane holding the keyboard. +public sealed record PreviewPane( + string Role, Rgb Plane, IReadOnlyList Tabs, IReadOnlyList> Lines, bool Focused); + +/// The armed command line under the panes. +/// The prompt, Corvid ›. +/// The prompt's colour. +/// The line being typed. +/// Its colour. +/// The band it is drawn on. +public sealed record PreviewCommandLine(string Prompt, Rgb PromptInk, string Text, Rgb Ink, Rgb Band); + +/// +/// A theme as the theme picker shows it: three panes on the workspace's backdrop — a world's ANSI colours, the focused +/// pane, a character's tinted pane — each with its tab strip, and the command line under them. Every colour is +/// resolved by the client from the theme exactly as it paints the workspace, so the cell picker and the native cards +/// draw one instance and cannot disagree. The words are 's. +/// +/// The workspace backdrop the panes sit on. +/// The panes, left to right. +/// The command line. +public sealed record ThemePreview(Rgb Backdrop, IReadOnlyList Panes, PreviewCommandLine CommandLine); + +/// A theme the picker lists, with its preview. +/// The theme's name, which is what is stored. +/// Whether its background is dark. +/// Whether it is one of the player's own rather than a built-in. +/// How it looks. +public sealed record ThemeCard(string Name, bool IsDark, bool IsCustom, ThemePreview Preview); + +/// A run of sample text: its words and the ANSI colour (0–15) a world would send it in, or null for the default. +/// The words. +/// An ANSI index, or null for the pane's default foreground. +/// Whether it is bold. +public sealed record SampleRun(string Text, int? Colour = null, bool Bold = false); + +/// +/// What every theme preview says, whatever its colours: the words both hosts draw. Kept here, beside the model, so a +/// change to the sample is one change for both. Short lines, because a cell preview splits the screen in three. +/// +public static class ThemePreviewContent +{ + /// The character the preview's focused pane and command line belong to. + public const string Character = "Corvid"; + + /// The second character, whose pane wears a tint. + public const string TintedCharacter = "Wren"; + + /// The tint the second character's pane wears. + public const PaneTint Tint = PaneTint.Moss; + + /// What the focused pane's command line holds. + public const string Typed = "say Well met."; + + /// The pane showing a world's ANSI colours. + public static IReadOnlyList> Ansi { get; } = + [ + [new("The Grand Plaza", Bold: true)], + [new("Exits: "), new("north", 6), new(", "), new("east", 6)], + [new("Mara", 2), new(" says, "), new("\"Hi!\"", 3)], + [new(" ", 5), new("Tam: brb")], + [new("HP ", 1), new("412", 9), new("/500 "), new("MP ", 4), new("88", 12)], + ]; + + /// The focused pane. + public static IReadOnlyList> Focused { get; } = + [ + [new("You enter the hall.")], + [new("A lantern burns", 3), new(" low.")], + [new("Ilse", 2), new(" waves.")], + [new("[Chat] ", 13), new("Ash: hello")], + [new("> ", 8), new("look")], + ]; + + /// The tinted pane. + public static IReadOnlyList> Tinted { get; } = + [ + [new("Wren pages: ready?")], + [new("You page Wren.", 8)], + [new("The bell tolls.", 11)], + [new("Rain on the roof.")], + [new("* ", 10), new("Wren nods.")], + ]; +} diff --git a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs new file mode 100644 index 00000000..a8fc3051 --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs @@ -0,0 +1,171 @@ +using System.Globalization; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Telnet; + +namespace SharpMUTerm.Client.Settings; + +/// +/// The words F5's world fields and F9's character fields are written in, and how each is read from and written to the +/// configuration: one list per choice field, one pair of functions per value that is not stored the way it is shown. +/// The declarations (, ) are built from +/// these, and the cell F5 screen draws its detail column with the same words, so the two cannot drift. +/// +public static class WorldFieldValues +{ + /// The encodings a world may be set to; auto follows CHARSET, every other entry is an override. + public static IReadOnlyList Encodings { get; } = + [TelnetSessionOptions.AutoEncodingName, "UTF-8", "ISO-8859-1", "ASCII", "CP437", "CP1252"]; + + /// The content field's words. auto is , the stored default. + public static IReadOnlyList ContentChoices { get; } = ["auto", "ansi", "mxp", "pueblo"]; + + /// A content format's word. + public static string ContentName(ContentFormat format) => format switch + { + ContentFormat.AnsiOnly => "ansi", + ContentFormat.Mxp => "mxp", + ContentFormat.Pueblo => "pueblo", + _ => "auto", + }; + + /// The content format a word names. + public static ContentFormat ContentOf(string name) => name.ToLowerInvariant() switch + { + "ansi" => ContentFormat.AnsiOnly, + "mxp" => ContentFormat.Mxp, + "pueblo" => ContentFormat.Pueblo, + _ => ContentFormat.Ansi, + }; + + /// The emoji field's word for "neither substitution". + public const string EmojiOff = "off"; + + /// The emoji field's words: which of the two substitutions run. + public static IReadOnlyList EmojiChoices { get; } = [EmojiOff, "emoticons", "shortcodes", "both"]; + + /// A world's emoji settings as one word. + public static string EmojiName(EmojiSettings emoji) + { + ArgumentNullException.ThrowIfNull(emoji); + return (emoji.Enabled, emoji.Emoticons, emoji.Shortcodes) switch + { + (false, _, _) or (true, false, false) => EmojiOff, + (true, true, false) => "emoticons", + (true, false, true) => "shortcodes", + _ => "both", + }; + } + + /// Writes one word back into a world's three emoji switches. + public static void SetEmoji(EmojiSettings emoji, string name) + { + ArgumentNullException.ThrowIfNull(emoji); + ArgumentNullException.ThrowIfNull(name); + var choice = name.ToLowerInvariant(); + emoji.Enabled = choice != EmojiOff; + if (emoji.Enabled) + { + emoji.Emoticons = choice is "emoticons" or "both"; + emoji.Shortcodes = choice is "shortcodes" or "both"; + } + } + + /// The words for : on fetches what the game asks for. + public static IReadOnlyList SoundChoices { get; } = ["download", "cached only"]; + + /// The words for . + public static IReadOnlyList LoginChoices { get; } = ["off", "if offered"]; + + /// The words for . + public static IReadOnlyList DiscordChoices { get; } = ["off", "show status"]; + + /// The words for . + public static IReadOnlyList JoinWrapChoices { get; } = ["off", "join"]; + + /// What a world's layout row says while it names none. + public const string WorldLayoutDefault = "(suggested)"; + + /// What a character's layout row says while it names none. + public const string CharacterLayoutDefault = "(world default)"; + + /// The at start word for connecting at launch. + public const string StartupOn = "connect"; + + /// The at start word for not. + public const string StartupOff = "off"; + + /// The at start field's words. + public static IReadOnlyList StartupChoices { get; } = [StartupOn, StartupOff]; + + /// The restore word for on. + public const string RestoreOn = "on"; + + /// The restore word for off. + public const string RestoreOff = "off"; + + /// The restore field's words. + public static IReadOnlyList RestoreChoices { get; } = [RestoreOn, RestoreOff]; + + /// The log formats, by name. + public static IReadOnlyList LogFormats { get; } = Enum.GetNames(); + + /// The pane tints, by name. + public static IReadOnlyList Tints { get; } = Enum.GetNames(); + + /// Every layout a world or character may name: the built-ins and the player's own. + public static IReadOnlyList Layouts(AppConfiguration config) + { + ArgumentNullException.ThrowIfNull(config); + return new LayoutLibrary(config.Layouts).All; + } + + /// The layout row's choices: the default word, then every layout by name. + public static IReadOnlyList LayoutChoices(IReadOnlyList layouts, string unset) + { + ArgumentNullException.ThrowIfNull(layouts); + return [unset, .. layouts.Select(l => l.Name)]; + } + + /// The name of the layout names, or null for none (or one that is gone). + public static string? LayoutName(IReadOnlyList layouts, string? id) + { + ArgumentNullException.ThrowIfNull(layouts); + return id is null ? null : layouts.FirstOrDefault(l => string.Equals(l.Id, id, StringComparison.Ordinal))?.Name; + } + + /// The id of the layout called , or null for the default word. + public static string? LayoutId(IReadOnlyList layouts, string name) + { + ArgumentNullException.ThrowIfNull(layouts); + return layouts.FirstOrDefault(l => string.Equals(l.Name, name, StringComparison.OrdinalIgnoreCase))?.Id; + } + + /// A world's extra GMCP modules as one line, or null for none. + public static string? JoinModules(WorldDefinition world) + { + ArgumentNullException.ThrowIfNull(world); + return world.GmcpModules.Count == 0 ? null : string.Join(", ", world.GmcpModules); + } + + /// + /// Writes the line back: split on commas, and only entries accepts are kept, + /// normalised to Name Version, so what is saved is what will be sent. A new list, never an edit of the old + /// one, so a surface reading on another thread never meets a half-made change. + /// + public static void SplitModules(WorldDefinition world, string? value) + { + ArgumentNullException.ThrowIfNull(world); + var modules = new List(); + foreach (var part in (value ?? string.Empty).Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries)) + { + if (GmcpHandshake.Parse(part) is { } module + && !modules.Any(m => m.StartsWith(module.Name + " ", StringComparison.OrdinalIgnoreCase))) + { + modules.Add($"{module.Name} {module.Version.ToString(CultureInfo.InvariantCulture)}"); + } + } + + world.GmcpModules = modules; + } +} diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 1f576228..00862326 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -235,7 +235,7 @@ public static class SurfaceCatalog [SurfaceHosts.Window] = SurfaceDrawing.Native, }, "SharpMUTerm.Tui.OptionsScreenRenderer.FromSection", - ["SharpMUTerm.Avalonia.SettingsWindow"]), + ["SharpMUTerm.Avalonia.SettingsWindow", "SharpMUTerm.Avalonia.ThemeCardView"]), new( LayoutsMenu, typeof(MenuModel), diff --git a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs index a46258ba..cf709f96 100644 --- a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs +++ b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs @@ -22,6 +22,14 @@ public sealed class AppConfiguration /// public Theme Theme { get; set; } = ThemeLibrary.Dark(); + /// + /// The player's own themes that are not in use. A customised theme lives in while it is the + /// active one; picking another moves it here rather than dropping it, so the theme picker can offer it again. + /// Empty by default; no schema version moved for it, since a configuration without it has no custom theme to + /// keep. + /// + public List CustomThemes { get; set; } = new(); + /// /// Maximum scrollback lines retained per session. See /// for why the default is ten diff --git a/src/SharpMUTerm.Core/Theming/Theme.cs b/src/SharpMUTerm.Core/Theming/Theme.cs index 154b5df4..cdae71e3 100644 --- a/src/SharpMUTerm.Core/Theming/Theme.cs +++ b/src/SharpMUTerm.Core/Theming/Theme.cs @@ -41,6 +41,21 @@ public sealed class Theme /// public List? Palette16 { get; set; } + /// A copy that shares nothing with this theme, so editing one never edits the other. + public Theme Clone() => new() + { + Name = Name, + Foreground = Foreground, + Background = Background, + StatusForeground = StatusForeground, + StatusBackground = StatusBackground, + Border = Border, + SystemMessage = SystemMessage, + LocalEcho = LocalEcho, + Prompt = Prompt, + Palette16 = Palette16 is null ? null : [.. Palette16], + }; + /// Resolves a palette index (0-255) honouring any override. public Rgb ResolveIndex(int index) { diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index ffd51d19..36285219 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -67,7 +67,10 @@ internal ComposeOverlay(ConsoleWindowSystem system, Func? spellin _scheme = scheme ?? ScreenTheme.Dark; } - private readonly ScreenTheme _scheme; + private ScreenTheme _scheme; + + /// The palette it is painted in; the app replaces it when the theme changes, and the next time it is drawn follows. + internal ScreenTheme Scheme { get => _scheme; set => _scheme = value ?? ScreenTheme.Dark; } /// /// The dictionary marking this post, or null: none was found, or this is a MOO edit, whose buffer is as often diff --git a/src/SharpMUTerm.Tui/DeclaredFields.cs b/src/SharpMUTerm.Tui/DeclaredFields.cs new file mode 100644 index 00000000..7872efb2 --- /dev/null +++ b/src/SharpMUTerm.Tui/DeclaredFields.cs @@ -0,0 +1,61 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; + +namespace SharpMUTerm.Tui; + +/// +/// A declared field () as the cell screens' field: the of the kind +/// its rule names, reading and writing through the field's own binding on 's world or +/// character. It is how F5's world row and character row are built, so the cell screen and the native settings window +/// edit one object through one binding and refuse the same values. +/// +internal static class DeclaredFields +{ + /// The field with in . + internal static SettingsField Find(SettingsSectionContribution section, string id) => + section.Fields.FirstOrDefault(f => string.Equals(f.Id, id, StringComparison.Ordinal)) + ?? throw new InvalidOperationException($"{section.Id} declares no field '{id}'."); + + /// The cell screen's field for , editing . + internal static ScreenField Screen(SettingsField field, SettingTarget target) + { + ArgumentNullException.ThrowIfNull(field); + switch (field) + { + case TextField text when field.Binding is SettingBinding binding: + { + string? Get() => binding.Get(target); + void Set(string? value) => binding.Set(target, value); + return text.Rule switch + { + TextRule.Name => ScreenField.Name(field.Label, () => Get() ?? string.Empty, v => Set(v)), + TextRule.Required => ScreenField.Text(field.Label, () => Get() ?? string.Empty, v => Set(v)), + TextRule.Pattern => ScreenField.OptionalPattern(field.Label, Get, Set), + TextRule.Secret => ScreenField.Password(field.Label, Get, Set), + TextRule.Defaulted => ScreenField.Defaulted(field.Label, Get, Set, text.Fallback ?? string.Empty), + _ => ScreenField.Optional(field.Label, Get, Set), + }; + } + + case NumberField number when field.Binding is SettingBinding count: + return ScreenField.Integer( + field.Label, () => count.Get(target), v => count.Set(target, v), number.Minimum, number.Maximum); + + case ChoiceField choice when field.Binding is SettingBinding named: + return ScreenField.Choice( + field.Label, () => named.Get(target), v => named.Set(target, v), choice.ChoicesIn(target.Config)); + + case ColourField colour when field.Binding is SettingBinding named: + return ScreenField.Choice(field.Label, () => named.Get(target), v => named.Set(target, v), colour.Names); + + default: + throw new InvalidOperationException($"No cell field draws {field.GetType().Name} '{field.Id}'."); + } + } + + /// The cell screen's checkbox for a declared flag, editing . + internal static ScreenToggle Toggle(SettingsField field, SettingTarget target) => + field.Binding is SettingBinding flag + ? ScreenToggle.Bind(() => flag.Get(target), v => flag.Set(target, v)) + : throw new InvalidOperationException($"'{field.Id}' is not a flag."); +} diff --git a/src/SharpMUTerm.Tui/EditReviewOverlay.cs b/src/SharpMUTerm.Tui/EditReviewOverlay.cs index 8701eaee..3b4faa72 100644 --- a/src/SharpMUTerm.Tui/EditReviewOverlay.cs +++ b/src/SharpMUTerm.Tui/EditReviewOverlay.cs @@ -35,7 +35,10 @@ internal sealed class EditReviewOverlay private Action? _keep; private Action? _undo; - private readonly ScreenTheme _scheme; + private ScreenTheme _scheme; + + /// The palette it is painted in; the app replaces it when the theme changes. + internal ScreenTheme Scheme { get => _scheme; set => _scheme = value ?? ScreenTheme.Dark; } public EditReviewOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) { diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index f09c52da..ef463426 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -20,7 +20,10 @@ internal sealed class ListOverlay private Func? _key; private Func? _escape; - private readonly ScreenTheme _scheme; + private ScreenTheme _scheme; + + /// The palette it is painted in; the app replaces it when the theme changes, and the next time it is drawn follows. + internal ScreenTheme Scheme { get => _scheme; set => _scheme = value ?? ScreenTheme.Dark; } public ListOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) { diff --git a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs index e283de3e..905bd68b 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs @@ -93,10 +93,11 @@ public readonly record struct OptionRow( /// /// One options screen: the title and F-key its chrome shows, the rows it lists, and — while the cursor is /// on a row Delete can take out (a meter) — that removal, which the model carries as its pane's hidden - /// trailing button. + /// trailing button. is the theme under the cursor in the theme picker, or null while + /// the cursor is elsewhere: the screen is painted in that theme while it is, which is the picker's live preview. /// internal readonly record struct OptionsScreen( - string Title, string FKey, IReadOnlyList Rows, ScreenButton? Remove = null); + string Title, string FKey, IReadOnlyList Rows, ScreenButton? Remove = null, string? Preview = null); /// /// Merges every sub-block into one line list (header, options, footer). Used by the unit tests and @@ -405,6 +406,7 @@ internal static OptionsScreen FromSection( var rows = new List(); ScreenButton? remove = null; + string? preview = null; string? group = null; var navigable = 0; foreach (var field in section.Fields) @@ -434,13 +436,217 @@ internal static OptionsScreen FromSection( continue; } + if (field is ThemeField { Binding: SettingBinding theme }) + { + preview = ThemeRows(rows, config, field, theme, cursor, ref navigable) ?? preview; + continue; + } + rows.Add(Row(field, config)); navigable++; } - return new OptionsScreen(section.Title, section.Key ?? string.Empty, rows, remove); + return new OptionsScreen(section.Title, section.Key ?? string.Empty, rows, remove, preview); + } + + /// What the theme picker's caption says of the theme in use. + internal const string ThemeInUse = "in use"; + + /// The width a preview is drawn at when the screen is rendered without one (the unit tests' merged path). + private const int PreviewFallbackWidth = 76; + + /// + /// F7's theme picker, appended to : one cursor stop per theme (⏎ uses it, through the + /// screen's edits and so the save funnel), then the preview of the theme under the cursor — or of the theme in use, + /// while the cursor is elsewhere. Returns the theme under the cursor, which the screen is painted in while it is + /// there; Esc closes the screen with nothing committed, which is the revert. + /// + private static string? ThemeRows( + List rows, + AppConfiguration config, + SettingsField field, + SettingBinding binding, + int cursor, + ref int navigable) + { + var cards = ThemePreviews.Cards(config); + var current = binding.Get(config); + var reset = binding.IsDefault(config) ? null : (Action)(() => binding.Reset(config)); + string? under = null; + for (var i = 0; i < cards.Count; i++) + { + var card = cards[i]; + rows.Add(new OptionRow( + card.Name, null, null, + Button: UseTheme(binding, config, card.Name), + Reset: reset, + FieldId: i == 0 ? field.Id : null, + Where: ScreenChrome.Position("theme", i, cards.Count), + Draw: (_, width) => ThemeRow(card, current, reset is not null && i == 0))); + if (navigable == cursor) + { + under = card.Name; + } + + navigable++; + } + + var shown = cards.FirstOrDefault(c => string.Equals(c.Name, under ?? current, StringComparison.OrdinalIgnoreCase)) + ?? cards[0]; + var caption = under is null || string.Equals(under, current, StringComparison.OrdinalIgnoreCase) + ? $"[dim]preview · {Escape(shown.Name)} · {ThemeInUse}[/]" + : $"[dim]preview · {Escape(shown.Name)} · ⏎ uses it, Esc keeps {Escape(current)}[/]"; + rows.Add(new OptionRow(string.Empty, null, null, Static: true, Draw: (_, _) => new string(' ', AffordanceWidth) + caption)); + for (var line = 0; line < PreviewRows; line++) + { + var at = line; + rows.Add(new OptionRow(string.Empty, null, null, Static: true, + Draw: (_, width) => PreviewLines(shown.Preview, width > 0 ? width : PreviewFallbackWidth)[at])); + } + + return under; + } + + /// ⏎ on a theme: make it the theme, with the old one as the undo. + private static ScreenButton UseTheme(SettingBinding binding, AppConfiguration config, string name) => new( + "use", + () => + { + var before = binding.Get(config); + binding.Set(config, name); + return new ScreenPress(() => binding.Set(config, before)); + }, + ScreenButtonKind.Apply, + name); + + /// One theme's row: the in-use mark, its name, a strip of its planes, and what kind of theme it is. + private static string ThemeRow(ThemeCard card, string current, bool changed) + { + var inUse = string.Equals(card.Name, current, StringComparison.OrdinalIgnoreCase); + var mark = inUse ? $"[{Accent}]●[/] " : new string(' ', AffordanceWidth); + var preview = card.Preview; + var strip = string.Concat( + new[] { preview.Backdrop, preview.Panes[0].Plane, preview.Panes[1].Plane, preview.Panes[2].Plane, preview.CommandLine.Band } + .Select(p => $"[{p.ToHex()}]██[/]")); + var kind = $"{(card.IsDark ? "dark" : "light")} · {(card.IsCustom ? "your own" : "built in")}"; + var name = Escape(card.Name).PadRight(LabelWidth - AffordanceWidth - 12); + var label = inUse ? $"[{Value}]{name}[/]" : name; + return $"{mark}{label} {strip} [dim]{kind}[/]{(inUse ? $" [{Accent}]{ThemeInUse}[/]" : string.Empty)}" + + (changed ? Changed() : string.Empty); + } + + /// How many rows a preview takes under its caption: the tab strips, five lines, the command line. + internal const int PreviewRows = 7; + + /// + /// A preview as rows of markup, wide: three panes on the + /// backdrop, each with its tab strip, and the command line across them. Every colour is the model's own, so the + /// window's cards and these rows say the same thing. + /// + internal static IReadOnlyList PreviewLines(ThemePreview preview, int width) + { + ArgumentNullException.ThrowIfNull(preview); + var indent = new string(' ', AffordanceWidth); + var room = Math.Max(3 * 8 + 4, width - AffordanceWidth - 1); + var paneWidth = (room - 4) / 3; + var full = (paneWidth * 3) + 4; + var backdrop = preview.Backdrop.ToHex(); + var gap = $"[on {backdrop}] [/]"; + + var lines = new List(PreviewRows); + var strips = new List(); + foreach (var pane in preview.Panes) + { + strips.Add(TabStrip(pane, paneWidth, backdrop)); + } + + lines.Add(indent + gap + string.Join(gap, strips) + gap); + var depth = preview.Panes.Max(p => p.Lines.Count); + for (var row = 0; row < Math.Min(depth, PreviewRows - 2); row++) + { + var cells = preview.Panes.Select(p => PaneLine(p, row, paneWidth)); + lines.Add(indent + gap + string.Join(gap, cells) + gap); + } + + while (lines.Count < PreviewRows - 1) + { + lines.Add(indent + gap + string.Join(gap, preview.Panes.Select(p => $"[on {p.Plane.ToHex()}]{new string(' ', paneWidth)}[/]")) + gap); + } + + var line = preview.CommandLine; + var band = line.Band.ToHex(); + var prompt = Clip(line.Prompt, full - 2); + var typed = Clip(line.Text, Math.Max(0, full - 3 - prompt.Length)); + var used = prompt.Length + 1 + typed.Length; + lines.Add(indent + gap + + $"[{line.PromptInk.ToHex()} on {band}]{Escape(prompt)}[/][on {band}] [/]" + + $"[{line.Ink.ToHex()} on {band}]{Escape(typed)}[/]" + + $"[on {band}]{new string(' ', Math.Max(0, full - 2 - used))}[/]" + gap); + return lines; } + private static string TabStrip(PreviewPane pane, int width, string backdrop) + { + var markup = new System.Text.StringBuilder(); + var used = 0; + foreach (var tab in pane.Tabs) + { + var title = $" {tab.Title}"; + var badge = tab.Badge is null ? string.Empty : $" {tab.Badge}"; + var cost = title.Length + badge.Length + 1; + if (used + cost > width) + { + break; + } + + var chip = tab.Chip.ToHex(); + var weight = tab.Selected ? "bold " : string.Empty; + markup.Append($"[{weight}{tab.Ink.ToHex()} on {chip}]{Escape(title)}[/]"); + if (tab.Badge is { } count && tab.BadgeInk is { } ink) + { + markup.Append($"[{ink.ToHex()} on {chip}]{Escape(" " + count)}[/]"); + } + + markup.Append($"[on {chip}] [/]"); + used += cost; + } + + if (used < width) + { + markup.Append($"[on {backdrop}]{new string(' ', width - used)}[/]"); + } + + return markup.ToString(); + } + + private static string PaneLine(PreviewPane pane, int row, int width) + { + var plane = pane.Plane.ToHex(); + var markup = new System.Text.StringBuilder($"[on {plane}] [/]"); + var used = 1; + if (row < pane.Lines.Count) + { + foreach (var run in pane.Lines[row]) + { + var text = Clip(run.Text, width - 1 - used); + if (text.Length == 0) + { + break; + } + + var weight = run.Bold ? "bold " : string.Empty; + markup.Append($"[{weight}{run.Ink.ToHex()} on {plane}]{Escape(text)}[/]"); + used += text.Length; + } + } + + markup.Append($"[on {plane}]{new string(' ', Math.Max(0, width - used))}[/]"); + return markup.ToString(); + } + + private static string Clip(string text, int width) => + width <= 0 ? string.Empty : text.Length <= width ? text : width == 1 ? "…" : text[..(width - 1)] + "…"; + /// One declared field as a row, by kind. A field with no binding the row understands is shown read-only. private static OptionRow Row(SettingsField field, AppConfiguration config) { @@ -466,7 +672,7 @@ private static OptionRow Row(SettingsField field, AppConfiguration config) case ChoiceField choice when field.Binding is SettingBinding named: return new OptionRow( field.Label, named.Get(config), null, null, null, - ScreenField.Choice(field.Label, () => named.Get(config), v => named.Set(config, v), choice.Choices), + ScreenField.Choice(field.Label, () => named.Get(config), v => named.Set(config, v), choice.ChoicesIn(config)), Reset: reset, FieldId: field.Id); case TextField when field.Binding is SettingBinding text: diff --git a/src/SharpMUTerm.Tui/OptionsScreenView.cs b/src/SharpMUTerm.Tui/OptionsScreenView.cs index 1724d95f..87a47af4 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenView.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenView.cs @@ -62,11 +62,27 @@ public static IWindowControl Build( .Columns(GridLength.Star(1)); root.Place(header, 0, 0, 1, 1); root.Place(card, 1, 0, 1, 1); + root.Place(Backdrop(scheme), 2, 0, 1, 1); root.Place(footer, 3, 0, 1, 1); return root.Build(); } + /// + /// The backdrop under the card, painted from rather than left to the window: while F7's + /// theme picker previews another theme, the window behind is still the theme in force. + /// + private static IWindowControl Backdrop(ScreenTheme scheme) + { + var fill = Controls.HorizontalGrid() + .WithAlignment(HorizontalAlignment.Stretch) + .WithVerticalAlignment(VerticalAlignment.Fill) + .Column(c => c.Flex(1).Add(ScreenChrome.Panel([string.Empty], scheme, ScreenPalette.PanelBg))) + .Build(); + fill.BackgroundColor = scheme.Colour(ScreenPalette.PanelBg); + return fill; + } + /// /// The full-width elevated card holding the list. A only paints the /// cells its lines cover, so the card is a grid — a grid's background covers its whole arranged diff --git a/src/SharpMUTerm.Tui/ScreenChrome.cs b/src/SharpMUTerm.Tui/ScreenChrome.cs index 0be6c83f..6bbca503 100644 --- a/src/SharpMUTerm.Tui/ScreenChrome.cs +++ b/src/SharpMUTerm.Tui/ScreenChrome.cs @@ -141,6 +141,9 @@ internal static string Hints( /// And on one of a pane's building buttons, which is the other row ⏎ acts on. internal const string AddAction = "[[⏎]] Add"; + /// And on a value to use — a theme in F7's picker. + internal const string UseAction = "[[⏎]] Use"; + /// /// And on a row that is neither, where ⏎ leaves the screen. It says Done rather than /// Save because there is nothing left to save — every committed value is already on disk (see @@ -191,6 +194,7 @@ internal static string Actions(string? accent = null, ScreenFocus? focus = null) { ScreenEnter.Edit => EditAction, ScreenEnter.Add => AddAction, + ScreenEnter.Apply => UseAction, _ => DoneAction, }; @@ -733,17 +737,20 @@ internal static MarkupControl Band(string line, string bg, ScreenTheme scheme) = new(new List { scheme.Paint(line, bg) }) { BackgroundColor = scheme.Colour(bg), + ForegroundColor = scheme.Colour(ScreenPalette.PanelFg), HorizontalAlignment = HorizontalAlignment.Stretch, }; /// /// A column of a renderer's lines, resolved for and drawn on /// (a role: the backdrop unless the column sits on - /// a card). The one place a screen's markup becomes a control, so it is the one place it is themed. + /// a card). The one place a screen's markup becomes a control, so it is the one place it is themed — unstyled + /// text included, which takes the scheme's ink rather than the window's: while F7 previews a theme the window + /// behind is still the theme in force. /// internal static MarkupControl Panel( IEnumerable lines, ScreenTheme scheme, string plane = ScreenPalette.PanelBg) => - new(scheme.Lines(lines, plane)); + new(scheme.Lines(lines, plane)) { ForegroundColor = scheme.Colour(ScreenPalette.PanelFg) }; /// /// How many rows a two-column screen's body has: everything but the header band and the action bar. diff --git a/src/SharpMUTerm.Tui/ScreenFocus.cs b/src/SharpMUTerm.Tui/ScreenFocus.cs index 2259e14d..70304503 100644 --- a/src/SharpMUTerm.Tui/ScreenFocus.cs +++ b/src/SharpMUTerm.Tui/ScreenFocus.cs @@ -11,6 +11,9 @@ internal enum ScreenEnter /// The row is a button; ⏎ runs it. Only the building ones are reachable. Add, + + /// The row is a value to use (a theme); ⏎ makes it the setting. + Apply, } /// diff --git a/src/SharpMUTerm.Tui/ScreenModel.cs b/src/SharpMUTerm.Tui/ScreenModel.cs index 31a22b84..ad1b5fa6 100644 --- a/src/SharpMUTerm.Tui/ScreenModel.cs +++ b/src/SharpMUTerm.Tui/ScreenModel.cs @@ -196,6 +196,12 @@ internal enum ScreenButtonKind /// "only the last world can be deleted", one feature later. /// Detail, + + /// + /// Makes the row's own value the setting — a theme in F7's picker. A cursor stop like , but it + /// builds nothing, so ⏎ opens no field after it and the action bar says Use. + /// + Apply, } /// diff --git a/src/SharpMUTerm.Tui/SettingsOverlay.cs b/src/SharpMUTerm.Tui/SettingsOverlay.cs index 33d4b046..4825e352 100644 --- a/src/SharpMUTerm.Tui/SettingsOverlay.cs +++ b/src/SharpMUTerm.Tui/SettingsOverlay.cs @@ -79,15 +79,32 @@ internal sealed class SettingsOverlay public SettingsOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) { _system = system; - Scheme = scheme ?? ScreenTheme.Dark; - _review = new EditReviewOverlay(system, Scheme); + _scheme = scheme ?? ScreenTheme.Dark; + _review = new EditReviewOverlay(system, _scheme); } /// /// The palette the screens are painted in — the app's theme, resolved once. The window's own /// backdrop is painted from it here; each screen's view paints its panels from the same instance. /// - internal ScreenTheme Scheme { get; } + internal ScreenTheme Scheme + { + get => _scheme; + set + { + _scheme = value ?? ScreenTheme.Dark; + _review.Scheme = _scheme; + if (_window is { } window) + { + // A theme picked on F7 lands while F7 is open: repaint the window's own backdrop and the screen in it. + window.BackgroundColor = _scheme.Colour(PanelBg); + window.ForegroundColor = _scheme.Colour(PanelFg); + Refresh(); + } + } + } + + private ScreenTheme _scheme = ScreenTheme.Dark; /// The F-key of the currently open screen, or null when closed. public ConsoleKey? OpenKey => _window is null ? null : _openKey; diff --git a/src/SharpMUTerm.Tui/SettingsSession.cs b/src/SharpMUTerm.Tui/SettingsSession.cs index e106878d..6bb03c9b 100644 --- a/src/SharpMUTerm.Tui/SettingsSession.cs +++ b/src/SharpMUTerm.Tui/SettingsSession.cs @@ -165,9 +165,9 @@ internal ScreenFocus Focus() private ScreenEnter Enter(ScreenModel model) { var row = model.RowAt(Selection.Pane, Selection.Index); - if (row.Button is not null) + if (row.Button is { } button) { - return ScreenEnter.Add; + return button.Kind == ScreenButtonKind.Apply ? ScreenEnter.Apply : ScreenEnter.Add; } return row.FieldCount > 0 ? ScreenEnter.Edit : ScreenEnter.Close; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs index 73ff3a99..c3f1680d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs @@ -48,7 +48,14 @@ private SettingsSearchHost SettingsSearchHost() => /// The search's ⏎: opens the match's screen in the same window and, for a declared field, puts the cursor /// on the row drawing it. Packages (F10) is not a settings screen and is opened its own way. /// - private bool GoToSetting(SettingsMatch match) + private bool GoToSetting(SettingsMatch match) => GoToSetting(match, native: true); + + /// What to go to. + /// + /// Whether a declared section may open in the host's settings window. False when the window itself asked for the + /// cell screen — F5's world lists and trigger sets are the cell screen's, and the window links to it. + /// + private bool GoToSetting(SettingsMatch match, bool native) { if (string.Equals(match.Section.Id, "packages", StringComparison.Ordinal)) { @@ -58,7 +65,7 @@ private bool GoToSetting(SettingsMatch match) } // A declared section is the host's own settings window where the host has one. - if (TryOpenNativeSettings(match.Section)) + if (native && TryOpenNativeSettings(match.Section)) { return true; } @@ -131,6 +138,13 @@ internal SettingsForm NativeSettingsForm(string initial) { var edits = new ScreenEdits(SaveConfiguration); var data = SettingsGameData(); + var (world, character) = FocusedSubject(); + + // The theme cards are built here, on the client's thread, and re-built only when a theme is added — the themes + // do not change while the window is open except by being picked, which changes which one is in use, not how + // each looks. + var cards = ThemePreviews.Cards(_config); + IReadOnlyList themes() => cards; SettingsForm? form = null; form = new SettingsForm( _contributions.SettingsSections.Ordered, @@ -144,10 +158,25 @@ internal SettingsForm NativeSettingsForm(string initial) initial, ThemeIsDark(), () => OptionsScreenRenderer.ReceivedPaths(data).Select(r => new ReceivedValue(r.Path, r.Value)).ToList(), - meter => OptionsScreenRenderer.NowText(meter, data)); + meter => OptionsScreenRenderer.NowText(meter, data), + themes, + () => ThemePreviews.IsDark(_theme), + world, + character); return form; } + /// + /// The world and character the focused window belongs to — what F5 and F9 open on — or nulls, and the form takes the + /// first. Resolved here, on the client's thread, because the focus is not safe to read from the window's. + /// + private (WorldDefinition? World, CharacterDefinition? Character) FocusedSubject() + { + var world = _config.Worlds.ElementAtOrDefault(ActiveWorldIndex()); + var character = world?.Characters.ElementAtOrDefault(ActiveCharacterIndex()); + return (world, character); + } + /// /// The settings window's way to a section it cannot draw: close the window and open that section's own screen. /// @@ -156,7 +185,7 @@ private void OpenSectionScreen(string id) Host.NativeSettings?.Close(); if (_contributions.SettingsSections.Find(id) is { } section) { - GoToSetting(new SettingsMatch(section, null, section.Title, -1, 0)); + GoToSetting(new SettingsMatch(section, null, section.Title, -1, 0), native: false); } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs new file mode 100644 index 00000000..50d1fbb8 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs @@ -0,0 +1,100 @@ +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; + +namespace SharpMUTerm.Tui; + +/// +/// The theme, changed while the client runs. F7's theme picker and the desktop's theme cards both commit through +/// , and that is where a new theme is noticed and put into force: every colour the client +/// derives from it — the workspace planes, the bars, the header, the settings screens and the popups — is re-derived and +/// repainted. What it cannot recolour is output already in a pane: a line's colours were resolved against the theme it +/// arrived under and held there as markup (), so the notice says so rather than leaving a reader to +/// wonder why the old lines look different. +/// +internal sealed partial class SharpMUTermApp +{ + /// Screen palettes for themes previewed on F7, by name, so moving the cursor does not re-derive one per key. + private readonly Dictionary _previewSchemes = new(StringComparer.OrdinalIgnoreCase); + + /// The theme in force, for a test. + internal string ThemeName => _theme.Name; + + /// + /// The palette F7 is painted in while the theme picker's cursor is on : that theme's, which + /// is the live preview; otherwise the theme in force. + /// + private ScreenTheme SchemeFor(string? preview) + { + if (preview is null || string.Equals(preview, _theme.Name, StringComparison.OrdinalIgnoreCase)) + { + return _screens; + } + + if (!_previewSchemes.TryGetValue(preview, out var scheme)) + { + scheme = ThemeChoices.Find(_config, preview) is { } theme ? ScreenTheme.For(theme) : _screens; + _previewSchemes[preview] = scheme; + } + + return scheme; + } + + /// Puts the configuration's theme into force when it is not the one the client is painting in. + private void ApplyThemeIfChanged() + { + var theme = ThemeChoices.Resolve(_config); + if (!string.Equals(Signature(theme), Signature(_theme), StringComparison.Ordinal)) + { + ApplyTheme(theme); + } + } + + /// + /// Re-derives everything the client paints from . The caller () + /// goes on to repaint the header, the rail, the pane planes, the bars and the backdrop, which all read + /// as they paint; this does the parts that were resolved once at start. + /// + private void ApplyTheme(Theme theme) + { + _theme = theme; + _ink = WorkspacePalette.Chrome(theme); + _formatter = new MarkupFormatter(theme, _config.Text); + _promptFormatter = new MarkupFormatter(theme, _config.Text, WorkspacePalette.IdleBand(theme)); + _screens = ScreenTheme.For(theme); + _previewSchemes.Clear(); + + _settings.Scheme = _screens; + _composer.Scheme = _screens; + _packageView.Scheme = _screens; + _sendMenu.Scheme = _screens; + _layoutsView.Scheme = _screens; + _welcomeView.Scheme = _screens; + + _header.BackgroundColor = ToColor(theme.StatusBackground); + _header.FocusedLinkForegroundColor = ToColor(theme.Resolve(TerminalColor.Default, isBackground: true)); + _window.ForegroundColor = ToColor(theme.Resolve(TerminalColor.Default, isBackground: false)); + foreach (var control in _panes.Values) + { + control.SelectionBackgroundColor = ToColor(WorkspacePalette.SelectionBand(theme)); + control.SelectionForegroundColor = ToColor(WorkspacePalette.SelectionInk(theme)); + } + + RebuildPaneArea(); + RefreshPanels(); + Notice( + $"Theme {theme.Name}. Output already on screen keeps the colours it arrived in.", + Core.Diagnostics.MessageSeverity.Info, + "theme"); + } + + /// A theme's name and colours as one string, so two resolutions of one theme compare equal. + private static string Signature(Theme theme) => string.Join( + ' ', + new[] + { + theme.Name, theme.Foreground.ToHex(), theme.Background.ToHex(), theme.StatusForeground.ToHex(), + theme.StatusBackground.ToHex(), theme.Border.ToHex(), theme.SystemMessage.ToHex(), theme.LocalEcho.ToHex(), + theme.Prompt.ToHex(), + }.Concat(theme.Palette16?.Select(c => c.ToHex()) ?? [])); +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index e7f81a73..29d08923 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -53,14 +53,14 @@ internal sealed partial class SharpMUTermApp : IAsyncDisposable private readonly AppConfiguration _config; private readonly SessionManager _sessions = new(); private readonly TerminalCapabilities _capabilities; - private readonly Theme _theme; + private Theme _theme; /// /// The settings screens' palette, resolved from once (). /// Handed to every surface built from 's roles — F1–F10, the deletion review /// and the package and send lists — so they follow a Light theme instead of staying dark. /// - private readonly ScreenTheme _screens; + private ScreenTheme _screens; /// /// The colours this client paints in its own voice, resolved from and held to @@ -68,9 +68,9 @@ internal sealed partial class SharpMUTermApp : IAsyncDisposable /// hexes written into the markup at each use site, each picked against a dark theme and then painted /// on whatever plane the workspace happened to have. /// - private readonly ChromeInk _ink; - private readonly MarkupFormatter _formatter; - private readonly MarkupFormatter _promptFormatter; + private ChromeInk _ink; + private MarkupFormatter _formatter; + private MarkupFormatter _promptFormatter; private readonly Workspace _workspace; private readonly Dictionary _panes = new(StringComparer.Ordinal); @@ -765,7 +765,7 @@ public SharpMUTermApp( _ownsDiagnostics = diagnostics is null; _messages = _diagnostics.Messages; _sessions.Logger = _diagnostics.For("SharpMUTerm.Session"); - _theme = ResolveTheme(config); + _theme = SharpMUTerm.Client.Settings.ThemeChoices.Resolve(config); _ink = WorkspacePalette.Chrome(_theme); _formatter = new MarkupFormatter(_theme, config.Text); @@ -2100,10 +2100,35 @@ public string RenderSnapshot(string? view = null) // demo's game data holds. The game data is written through SetGmcp, the call the wire makes. // `settings-changed` is F7 after two real edits — Space on `emoji substitution`, and `8` typed into // the tab width — so the frame carries the `● changed` marks and the header's `r reset`. + // `settings-themes` is F7 opened and ↓ pressed once: the cursor on the second theme, so the screen is painted + // in it and its preview is drawn — the theme picker's live preview, before anything is committed. + // `settings-themes-solarized` presses ↓ twice. `settings-themes-used` presses ⏎ on the second theme, so the + // frame is the client after a theme was committed live. + if (view is not null && view.StartsWith("settings-themes", StringComparison.OrdinalIgnoreCase)) + { + _settings.OpenForSnapshot(ConsoleKey.F7, TextAnsiScreen()); + var downs = view.EndsWith("-solarized", StringComparison.OrdinalIgnoreCase) ? 2 : 1; + for (var down = 0; down < downs; down++) + { + _settings.SimulateKey(Stroke('\0', ConsoleKey.DownArrow)); + } + + if (view.EndsWith("-used", StringComparison.OrdinalIgnoreCase)) + { + _settings.SimulateKey(Stroke('\r', ConsoleKey.Enter)); + } + + SyncInputWidth(); + return RenderFrame(); + } + if (string.Equals(view, "settings-changed", StringComparison.OrdinalIgnoreCase)) { _settings.OpenForSnapshot(ConsoleKey.F7, TextAnsiScreen()); - for (var down = 0; down < 5; down++) + + // Past the theme picker's rows first, then down to `emoji substitution`. + var themes = SharpMUTerm.Client.Settings.ThemeChoices.Names(_config).Count; + for (var down = 0; down < themes + 5; down++) { _settings.SimulateKey(Stroke('\0', ConsoleKey.DownArrow)); } @@ -7166,6 +7191,10 @@ private void ReloadAutomation() /// internal void SaveConfiguration() { + // F7's theme picker (or the desktop's theme cards): a new theme is put into force first, so everything + // repainted below is painted in it. See SharpMUTermApp.Theme.cs. + ApplyThemeIfChanged(); + // F8 edits the live InputSettings, so a committed height applies to the bars immediately rather // than at the next launch. SyncInputBars(); @@ -7540,7 +7569,20 @@ private ScreenBinding TimersScreen() } /// Opens the F7 Text & display screen, drawn from its declared section. - private ScreenBinding TextAnsiScreen() => OptionsScreen(TextProjection); + private ScreenBinding TextAnsiScreen() + { + // The cursor opens on the theme in force, so opening F7 previews nothing but what is already on screen. + var binding = OptionsScreen(TextProjection); + var names = SharpMUTerm.Client.Settings.ThemeChoices.Names(_config); + var current = SharpMUTerm.Client.Settings.ThemeChoices.Current(_config); + var row = names.ToList().FindIndex(n => string.Equals(n, current, StringComparison.OrdinalIgnoreCase)); + if (row > 0) + { + binding.Session.Selection.Seed(0, row); + } + + return binding; + } /// Opens the F8 Input screen, drawn from its declared section. private ScreenBinding InputScreen() => OptionsScreen(_ => InputProjection()); @@ -7558,10 +7600,14 @@ private ScreenBinding OptionsScreen(Func { var focus = session.Focus(); + var shown = screen(session.Selection.CursorIn(0)); + + // On the theme picker the screen is painted in the theme under the cursor: the live preview. Nothing is + // committed until ⏎, so Esc closes on the theme in force. return OptionsScreenView.Build( - screen(session.Selection.CursorIn(0)), + shown, _system.DesktopDimensions.Width, - _screens, + SchemeFor(shown.Preview), focus, _system.DesktopDimensions.Height); }); @@ -13840,19 +13886,6 @@ private string StatusBarMarkup(string character, string state) private static SColor ToColor(Rgb rgb) => new(rgb.R, rgb.G, rgb.B, 255); - /// - /// Resolves the active theme: a built-in by unless - /// the config carries a customised inline . - /// - private static Theme ResolveTheme(AppConfiguration config) - { - if (config.Theme is { } inline && !string.Equals(inline.Name, config.ThemeName, StringComparison.OrdinalIgnoreCase)) - { - return inline; - } - - return ThemeLibrary.Get(config.ThemeName); - } public async ValueTask DisposeAsync() { diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 0796e858..c98bd80f 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -14,6 +14,7 @@ internal static class SnapshotViews "worlds", "settings", "triggers", "route", "highlight", "set", "aliases", "timers", "keypad", "textansi", "input", "logging", "password", "startup", "deletions", "settings-search", "settings-meters", "settings-meters-pick", "settings-changed", + "settings-themes", "settings-themes-solarized", "settings-themes-used", "triggers-edit", "logging-edit", "keypad-edit", "password-edit", "startup-edit", "freeze", "freeze-scrollback", "spawn", "split", "split-stacked", "move", "drag", "history", "history-search", "history-search-filter", "draft", "draft2", diff --git a/src/SharpMUTerm.Tui/ThemePreviews.cs b/src/SharpMUTerm.Tui/ThemePreviews.cs new file mode 100644 index 00000000..d5bdeff9 --- /dev/null +++ b/src/SharpMUTerm.Tui/ThemePreviews.cs @@ -0,0 +1,102 @@ +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; + +namespace SharpMUTerm.Tui; + +/// +/// Resolves a theme into the theme picker's model (): every plane and ink the workspace +/// would paint in that theme — the surface, the focused plane, a tinted pane, the recessed tab chips, the armed +/// command line — computed by and held to as the +/// workspace holds them. The cell picker draws it () and the window's cards draw +/// the same instance, so the two hosts cannot show a theme differently. +/// +internal static class ThemePreviews +{ + /// Every theme the picker lists, each with its preview. + internal static IReadOnlyList Cards(AppConfiguration config) + { + ArgumentNullException.ThrowIfNull(config); + return [.. ThemeChoices.All(config).Select(Card)]; + } + + /// One theme, with its preview. + internal static ThemeCard Card(Theme theme) + { + ArgumentNullException.ThrowIfNull(theme); + return new ThemeCard(theme.Name, IsDark(theme), ThemeChoices.IsCustom(theme.Name), Preview(theme)); + } + + /// Whether a theme's background is darker than mid-grey. + internal static bool IsDark(Theme theme) + { + var bg = theme.Resolve(TerminalColor.Default, isBackground: true); + return (0.2126 * bg.R) + (0.7152 * bg.G) + (0.0722 * bg.B) < 128; + } + + /// The preview of . + internal static ThemePreview Preview(Theme theme) + { + var surface = WorkspacePalette.Surface(theme); + var focused = WorkspacePalette.Focus(surface); + var tinted = WorkspacePalette.Tint(theme, ThemePreviewContent.Tint); + var other = WorkspacePalette.Recessed(WorkspacePalette.Focus(WorkspacePalette.Tint(theme, PaneTint.Rose))); + + var panes = new[] + { + Pane(theme, "ANSI colours", surface, false, ThemePreviewContent.Ansi, [Tab(theme, "Aetherfall", surface, true, false)]), + Pane(theme, "focused", focused, true, ThemePreviewContent.Focused, + [ + Tab(theme, ThemePreviewContent.Character, focused, true, true), + Tab(theme, "Chat", WorkspacePalette.Recessed(focused), false, false, "3"), + Tab(theme, "Ash", other, false, false), + ]), + Pane(theme, $"tinted · {ThemePreviewContent.Tint.ToString().ToLowerInvariant()}", tinted, false, ThemePreviewContent.Tinted, + [Tab(theme, ThemePreviewContent.TintedCharacter, tinted, true, false)]), + }; + + var band = WorkspacePalette.ArmedBand(theme); + var line = new PreviewCommandLine( + $"{ThemePreviewContent.Character} ›", + Contrast.Legible(theme.Prompt, band), + ThemePreviewContent.Typed, + Contrast.Legible(theme.Resolve(TerminalColor.Default, isBackground: false), band), + band); + return new ThemePreview(WorkspacePalette.Backdrop(theme), panes, line); + } + + private static PreviewPane Pane( + Theme theme, + string role, + Rgb plane, + bool focused, + IReadOnlyList> sample, + IReadOnlyList tabs) + { + var lines = sample + .Select(runs => (IReadOnlyList)[.. runs.Select(r => new PreviewRun(r.Text, Ink(theme, r.Colour, plane), r.Bold))]) + .ToList(); + return new PreviewPane(role, plane, tabs, lines, focused); + } + + private static PreviewTab Tab(Theme theme, string title, Rgb chip, bool selected, bool focused, string? badge = null) + { + var ink = selected + ? Contrast.Legible(theme.Resolve(TerminalColor.Default, isBackground: false), chip) + : Contrast.Legible(WorkspacePalette.IdleInk(theme), chip); + return new PreviewTab( + focused ? "▌" + title : title, + chip, + ink, + selected, + badge, + badge is null ? null : Contrast.Legible(ChromeInk.BaseAccent, chip)); + } + + private static Rgb Ink(Theme theme, int? colour, Rgb plane) + { + var given = colour is { } index ? theme.ResolveIndex(index) : theme.Resolve(TerminalColor.Default, isBackground: false); + return Contrast.Legible(given, plane); + } +} diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index b5b6940e..e4e62262 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -1,3 +1,5 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Layouts; using System.Globalization; using SharpMUTerm.Core.Configuration; @@ -103,37 +105,34 @@ internal static class WorldsScreenRenderer internal const int JoinWrapsField = 16; /// F5's words for : off shows rows as the server sent them. - internal static readonly string[] JoinWrapChoices = ["off", "join"]; + internal static readonly IReadOnlyList JoinWrapChoices = WorldFieldValues.JoinWrapChoices; /// What a world with no layout of its own reads as: the suggestion it accepted, else Roleplay. - internal const string WorldLayoutDefault = "(suggested)"; + internal const string WorldLayoutDefault = WorldFieldValues.WorldLayoutDefault; /// What a character with no layout of its own reads as. - internal const string CharacterLayoutDefault = "(world default)"; + internal const string CharacterLayoutDefault = WorldFieldValues.CharacterLayoutDefault; /// The layout row's choices: the default word, then every layout by name. - internal static IReadOnlyList LayoutChoices(IReadOnlyList layouts, string unset) => - [unset, .. layouts.Select(l => l.Name)]; + internal static IReadOnlyList LayoutChoices(IReadOnlyList layouts, string unset) => WorldFieldValues.LayoutChoices(layouts, unset); /// The name of the layout names, or null for none (or one that is gone). - internal static string? LayoutName(IReadOnlyList layouts, string? id) => - id is null ? null : layouts.FirstOrDefault(l => string.Equals(l.Id, id, StringComparison.Ordinal))?.Name; + internal static string? LayoutName(IReadOnlyList layouts, string? id) => WorldFieldValues.LayoutName(layouts, id); /// The id of the layout called , or null for the default word. - internal static string? LayoutId(IReadOnlyList layouts, string name) => - layouts.FirstOrDefault(l => string.Equals(l.Name, name, StringComparison.OrdinalIgnoreCase))?.Id; + internal static string? LayoutId(IReadOnlyList layouts, string name) => WorldFieldValues.LayoutId(layouts, name); /// F5's words for . - internal static readonly string[] DiscordChoices = ["off", "show status"]; + internal static readonly IReadOnlyList DiscordChoices = WorldFieldValues.DiscordChoices; /// F5's words for : how a character with a saved password logs in. - internal static readonly string[] LoginChoices = ["off", "if offered"]; + internal static readonly IReadOnlyList LoginChoices = WorldFieldValues.LoginChoices; /// The prefix the grab row suggests while it is off: AresMUSH's, and the one its /edit commands use. internal const string SuggestedGrabPrefix = "FugueEdit >"; /// F5's words for : on fetches what the game asks for. - internal static readonly string[] SoundChoices = ["download", "cached only"]; + internal static readonly IReadOnlyList SoundChoices = WorldFieldValues.SoundChoices; /// /// The character row's field ordinals, in the order ⇥ steps through them — which is the order the @@ -338,8 +337,7 @@ internal static string HeaderLine( /// and is the default: it follows CHARSET negotiation. Every other entry is an override — /// used whatever the server says — which is why the detail column labels them as one. /// - private static readonly string[] Encodings = - { TelnetSessionOptions.AutoEncodingName, "UTF-8", "ISO-8859-1", "ASCII", "CP437", "CP1252" }; + /// The label the WORLDS list's add button carries, and the row the renderer draws for it. internal const string AddWorldLabel = "+ world"; @@ -371,16 +369,16 @@ internal static string HeaderLine( internal const string StartupLabel = "at start"; /// Marked: this character is dialled when the client launches. - internal const string StartupOn = "connect"; + internal const string StartupOn = WorldFieldValues.StartupOn; /// /// Unmarked — the default. It reads off rather than no so it matches the world's /// keepalive row four lines above it, the screen's other "this feature is simply not on" /// value, and is drawn in the same muted ink for the same reason. /// - internal const string StartupOff = "off"; + internal const string StartupOff = WorldFieldValues.StartupOff; - private static readonly string[] StartupChoices = { StartupOn, StartupOff }; + /// /// The row for . It says restore and not "restore @@ -399,15 +397,15 @@ internal static string HeaderLine( internal const string RestoreNote = "panes refill after a restart"; /// The default: the panes come back. - internal const string RestoreOn = "on"; + internal const string RestoreOn = WorldFieldValues.RestoreOn; /// /// Opted out. It reads off to match at start and the world's keepalive row — /// the screen's other "this feature is simply not on" values — and is drawn in the same muted ink. /// - internal const string RestoreOff = "off"; + internal const string RestoreOff = WorldFieldValues.RestoreOff; - private static readonly string[] RestoreChoices = { RestoreOn, RestoreOff }; + /// /// The row for . One word, because the CHARACTER panel is 48 @@ -486,44 +484,14 @@ internal static ScreenModel Model( (selectedWorld, selectedCharacter) = Resolve(worlds, selectedWorld, selectedCharacter); - var worldRows = ScreenModel.Rows(worlds, w => ScreenRow.Of( - ScreenField.Name("name", () => w.Name, v => w.Name = v), - ScreenField.Text("host", () => w.Host, v => w.Host = v), - ScreenField.Integer("port", () => w.Port, v => w.Port = v, 1, 65535), - ScreenField.Choice("encoding", () => w.Encoding, v => w.Encoding = v, Encodings), - ScreenField.Integer("keepalive", () => w.KeepaliveSeconds, v => w.KeepaliveSeconds = v, 0, 86400), - ScreenField.Optional("gmcp modules", () => JoinModules(w), v => SplitModules(w, v)), - ScreenField.Choice("content", () => ContentName(w.ContentFormat), v => w.ContentFormat = ContentOf(v), ContentChoices), - ScreenField.Choice("emoji", () => EmojiName(w.Emoji), v => SetEmoji(w.Emoji, v), EmojiChoices), - ScreenField.OptionalPattern("map room", () => w.Map.RoomNamePattern, v => w.Map.RoomNamePattern = v), - ScreenField.OptionalPattern("map exits", () => w.Map.ExitsPattern, v => w.Map.ExitsPattern = v), - ScreenField.OptionalPattern("walk fail", () => w.Map.WalkFailurePattern, v => w.Map.WalkFailurePattern = v), - ScreenField.Choice( - "sounds", - () => w.DownloadMedia ? SoundChoices[0] : SoundChoices[1], - v => w.DownloadMedia = v == SoundChoices[0], - SoundChoices), - ScreenField.Optional("edit grab", () => w.GrabPrefix, v => w.GrabPrefix = v), - ScreenField.Choice( - "gmcp login", - () => w.GmcpLogin ? LoginChoices[1] : LoginChoices[0], - v => w.GmcpLogin = v == LoginChoices[1], - LoginChoices), - ScreenField.Choice( - "discord", - () => w.DiscordPresence ? DiscordChoices[1] : DiscordChoices[0], - v => w.DiscordPresence = v == DiscordChoices[1], - DiscordChoices), - ScreenField.Choice( - "layout", - () => LayoutName(all, w.Layout) ?? WorldLayoutDefault, - v => w.Layout = LayoutId(all, v), - LayoutChoices(all, WorldLayoutDefault)), - ScreenField.Choice( - "join wraps", - () => w.JoinWrappedLines ? JoinWrapChoices[1] : JoinWrapChoices[0], - v => w.JoinWrappedLines = v == JoinWrapChoices[1], - JoinWrapChoices))) + // The world's and character's fields are the declared ones (BuiltInSettings.World/.Character), built into cell + // fields through their own bindings, so this screen and the desktop's settings window edit one object one way. + // The bindings look a layout up in the configuration, so they are handed one holding these layouts. + var context = new AppConfiguration + { + Layouts = [.. all.Where(l => !BuiltInLayouts.All.Any(b => string.Equals(b.Id, l.Id, StringComparison.Ordinal)))], + }; + var worldRows = ScreenModel.Rows(worlds, w => ScreenRow.Of(DeclaredRow(BuiltInSettings.World, WorldFieldOrder, new SettingTarget(context, w)))) .Concat(WorldButtons(worlds, selectedWorld, info)) .ToArray(); @@ -536,34 +504,11 @@ internal static ScreenModel Model( // Every remaining ScreenToggle in this file is drawn where it is bound; see the security // rows and the trigger-set assignments, both of which render a real `[x]`. : ScreenModel.Rows(world.Characters, c => ScreenRow.Of( - ScreenField.Name("name", () => c.Name, v => c.Name = v), - ScreenField.Password("password", () => c.Password, v => c.Password = v), - ScreenField.Defaulted( - "connect", () => c.ConnectString, v => c.ConnectString = v, ConnectStringTemplate.Default), - ScreenField.Optional("on connect", () => c.OnConnect, v => c.OnConnect = v), - ScreenField.Optional("disconnect", () => c.OnDisconnect, v => c.OnDisconnect = v), - ScreenField.Choice( - StartupLabel, - () => c.ConnectAtStartup ? StartupOn : StartupOff, - v => c.ConnectAtStartup = string.Equals(v, StartupOn, StringComparison.OrdinalIgnoreCase), - StartupChoices), - ScreenField.Enumeration("log", () => c.Logging.Format, v => c.Logging.Format = v), - ScreenField.Optional("log folder", () => c.Logging.Directory, v => c.Logging.Directory = v), - ScreenField.Choice( - RestoreLabel, - () => c.Logging.RestoreLog ? RestoreOn : RestoreOff, - v => c.Logging.RestoreLog = string.Equals(v, RestoreOn, StringComparison.OrdinalIgnoreCase), - RestoreChoices), - ScreenField.Enumeration(TintLabel, () => c.Tint, v => c.Tint = v), - ScreenField.Choice( - "layout", - () => LayoutName(all, c.Layout) ?? CharacterLayoutDefault, - v => c.Layout = LayoutId(all, v), - LayoutChoices(all, CharacterLayoutDefault)))) + DeclaredRow(BuiltInSettings.Character, CharacterFieldOrder, new SettingTarget(context, world, c)))) .Concat(CharacterButtons(world, selectedCharacter)) .ToArray(); - var securityRows = world is null ? Array.Empty() : SecurityRows(world); + var securityRows = world is null ? Array.Empty() : SecurityRows(new SettingTarget(context, world)); if (!HasCharacter(worlds, selectedWorld, selectedCharacter)) { @@ -629,8 +574,7 @@ internal static ScreenModel Model( }); /// A world's extra GMCP modules as the well shows and edits them, or null for none. - internal static string? JoinModules(WorldDefinition world) => - world.GmcpModules.Count == 0 ? null : string.Join(", ", world.GmcpModules); + internal static string? JoinModules(WorldDefinition world) => WorldFieldValues.JoinModules(world); /// /// Writes the well back: split on commas, and only entries accepts are @@ -639,18 +583,7 @@ internal static ScreenModel Model( private static string PatternDetail(string? pattern, string unset) => string.IsNullOrWhiteSpace(pattern) ? $"[{Label}]{unset}[/]" : $"[{Value}]{Escape(pattern)}[/]"; - internal static void SplitModules(WorldDefinition world, string? value) - { - world.GmcpModules.Clear(); - foreach (var part in (value ?? string.Empty).Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries)) - { - if (GmcpHandshake.Parse(part) is { } module - && !world.GmcpModules.Any(m => m.StartsWith(module.Name + " ", StringComparison.OrdinalIgnoreCase))) - { - world.GmcpModules.Add($"{module.Name} {module.Version.ToString(CultureInfo.InvariantCulture)}"); - } - } - } + internal static void SplitModules(WorldDefinition world, string? value) => WorldFieldValues.SplitModules(world, value); /// A set's script files as the well shows and edits them, or null for none. internal static string? JoinScripts(TriggerSet set) => @@ -806,12 +739,34 @@ private static string DescribeWorld(WorldDefinition world) => /// be one negation away from silently turning verification off. /// /// - private static ScreenRow[] SecurityRows(WorldDefinition world) => new[] - { - ScreenRow.Of(ScreenToggle.Bind(() => world.UseTls, v => world.UseTls = v)), - ScreenRow.Of(ScreenToggle.Bind( - () => world.AllowInvalidCertificates, v => world.AllowInvalidCertificates = v)), - }; + private static ScreenRow[] SecurityRows(SettingTarget world) => + [ + .. SecurityFieldOrder.Select(id => ScreenRow.Of(DeclaredFields.Toggle(DeclaredFields.Find(BuiltInSettings.World, id), world))), + ]; + + /// + /// The world row's fields, in the order ⇥ steps through them and the ordinals above number them ( …), by declared id. The declaration's own order is the settings window's grouping; this is + /// the cell screen's, which tests and muscle memory address by position. + /// + internal static readonly IReadOnlyList WorldFieldOrder = + [ + "name", "host", "port", "encoding", "keepalive", "gmcp-modules", "content", "emoji", "map-room", "map-exits", + "walk-fail", "sounds", "edit-grab", "gmcp-login", "discord", "layout", "join-wraps", + ]; + + /// The world's two security checkboxes, drawn in the WORLD block (), by declared id. + internal static readonly IReadOnlyList SecurityFieldOrder = ["tls", "invalid-certificates"]; + + /// The character row's fields, in ⇥ order ( …), by declared id. + internal static readonly IReadOnlyList CharacterFieldOrder = + [ + "name", "password", "connect", "on-connect", "disconnect", "at-start", "log", "log-folder", "restore", "tint", "layout", + ]; + + /// A row of cell fields built from the declared fields names, editing . + private static ScreenField[] DeclaredRow(SettingsSectionContribution section, IReadOnlyList order, SettingTarget target) => + [.. order.Select(id => DeclaredFields.Screen(DeclaredFields.Find(section, id), target))]; /// /// The WORLDS pane's buttons, in the order needs them: the cursor @@ -1310,50 +1265,23 @@ internal static List FormColumn( /// The content field's words. auto is , the stored default, /// which starts on ANSI and follows a negotiated MXP; ansi is the deliberate choice not to. /// - internal static readonly IReadOnlyList ContentChoices = ["auto", "ansi", "mxp", "pueblo"]; + internal static readonly IReadOnlyList ContentChoices = WorldFieldValues.ContentChoices; - internal static string ContentName(ContentFormat format) => format switch - { - ContentFormat.AnsiOnly => "ansi", - ContentFormat.Mxp => "mxp", - ContentFormat.Pueblo => "pueblo", - _ => "auto", - }; + internal static string ContentName(ContentFormat format) => WorldFieldValues.ContentName(format); - internal static ContentFormat ContentOf(string name) => name.ToLowerInvariant() switch - { - "ansi" => ContentFormat.AnsiOnly, - "mxp" => ContentFormat.Mxp, - "pueblo" => ContentFormat.Pueblo, - _ => ContentFormat.Ansi, - }; + internal static ContentFormat ContentOf(string name) => WorldFieldValues.ContentOf(name); - internal const string EmojiOff = "off"; + internal const string EmojiOff = WorldFieldValues.EmojiOff; /// /// The emoji field's words: which of the two substitutions run. Three switches in the /// configuration, one field here, because "on, with neither kind" is not a state anybody wants. /// - internal static readonly IReadOnlyList EmojiChoices = [EmojiOff, "emoticons", "shortcodes", "both"]; + internal static readonly IReadOnlyList EmojiChoices = WorldFieldValues.EmojiChoices; - internal static string EmojiName(EmojiSettings emoji) => (emoji.Enabled, emoji.Emoticons, emoji.Shortcodes) switch - { - (false, _, _) or (true, false, false) => EmojiOff, - (true, true, false) => "emoticons", - (true, false, true) => "shortcodes", - _ => "both", - }; + internal static string EmojiName(EmojiSettings emoji) => WorldFieldValues.EmojiName(emoji); - internal static void SetEmoji(EmojiSettings emoji, string name) - { - var choice = name.ToLowerInvariant(); - emoji.Enabled = choice != EmojiOff; - if (emoji.Enabled) - { - emoji.Emoticons = choice is "emoticons" or "both"; - emoji.Shortcodes = choice is "shortcodes" or "both"; - } - } + internal static void SetEmoji(EmojiSettings emoji, string name) => WorldFieldValues.SetEmoji(emoji, name); /// /// What an unset log directory reads as. The field itself holds null — the logger picks a diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs index d37b677a..64957aa2 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -40,7 +40,9 @@ public SettingsForm Form(string initial = "text") initial, isDark: true, () => [new ReceivedValue("Char.Vitals.hp", "412"), new ReceivedValue("Char.Vitals.maxhp", "500")], - meter => meter.Value == "Char.Vitals.hp" ? "412/500" : null); + meter => meter.Value == "Char.Vitals.hp" ? "412/500" : null, + () => ThemePreviews.Cards(Config), + () => ThemePreviews.IsDark(ThemeChoices.Resolve(Config))); return form; } } @@ -158,6 +160,110 @@ public async Task AnUndeclaredSectionOpensItsOwnScreen() await Assert.That(shown).IsEqualTo("text"); } + /// The theme field is a card per theme, the one in use marked; a click uses another and the mark follows. + [Test] + public async Task TheThemeFieldIsCardsAndAClickUsesTheTheme() + { + var harness = new Harness(); + var (names, before, after, dark) = await Run(harness, "text", window => + { + var cards = window.ThemeCards; + var names = cards.Select(c => c.Card.Name).ToArray(); + var before = cards.Single(c => c.InUse).Card.Name; + cards.Single(c => c.Card.Name == "Light").RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); + Dispatcher.UIThread.RunJobs(); + return (names, before, window.ThemeCards.Single(c => c.InUse).Card.Name, window.RequestedThemeVariant == global::Avalonia.Styling.ThemeVariant.Dark); + }); + + await Assert.That(names).IsEquivalentTo(ThemeChoices.Names(new AppConfiguration())); + await Assert.That(before).IsEqualTo("Dark"); + await Assert.That(harness.Config.ThemeName).IsEqualTo("Light"); + await Assert.That(harness.Commits).IsEqualTo(1); + await Assert.That(after).IsEqualTo("Light"); + await Assert.That(dark).IsFalse(); + } + + private static Harness TwoWorlds() + { + var harness = new Harness(); + harness.Config.Worlds.Clear(); + harness.Config.Worlds.Add(new WorldDefinition { Name = "Aetherfall", Host = "aether.example", Characters = { new CharacterDefinition { Name = "Corvid" } } }); + harness.Config.Worlds.Add(new WorldDefinition { Name = "Brightwater", Host = "bright.example", Characters = { new CharacterDefinition { Name = "Wren" } } }); + return harness; + } + + /// F5's section is drawn here: a world picker over the declared fields, and an edit lands on the world picked. + [Test] + public async Task AWorldSectionPicksItsWorldAndEditsIt() + { + var harness = TwoWorlds(); + var (fields, subjects) = await Run(harness, "worlds", window => + { + var subjects = window.SubjectPicker!.ItemCount; + window.SubjectPicker.SelectedIndex = 1; + Dispatcher.UIThread.RunJobs(); + var box = (TextBox)window.FieldControls["edit-grab"]; + box.Text = "Edit>"; + box.RaiseEvent(new global::Avalonia.Input.KeyEventArgs { RoutedEvent = global::Avalonia.Input.InputElement.KeyDownEvent, Key = global::Avalonia.Input.Key.Enter }); + Dispatcher.UIThread.RunJobs(); + return (window.ShownFields.ToArray(), subjects); + }); + + await Assert.That(subjects).IsEqualTo(2); + await Assert.That(fields).IsEquivalentTo(BuiltInSettings.World.Fields.Select(f => f.Id).ToArray()); + await Assert.That(harness.Config.Worlds[1].GrabPrefix).IsEqualTo("Edit>"); + await Assert.That(harness.Config.Worlds[0].GrabPrefix).IsNull(); + await Assert.That(harness.Commits).IsEqualTo(1); + } + + /// A text the cell screen would refuse is refused here too, and the box shows the value kept. + [Test] + public async Task ARefusedTextIsPutBack() + { + var harness = TwoWorlds(); + var shown = await Run(harness, "worlds", window => + { + var box = (TextBox)window.FieldControls["host"]; + box.Text = " "; + box.RaiseEvent(new global::Avalonia.Input.KeyEventArgs { RoutedEvent = global::Avalonia.Input.InputElement.KeyDownEvent, Key = global::Avalonia.Input.Key.Enter }); + Dispatcher.UIThread.RunJobs(); + return box.Text; + }); + + await Assert.That(shown).IsEqualTo("aether.example"); + await Assert.That(harness.Config.Worlds[0].Host).IsEqualTo("aether.example"); + await Assert.That(harness.Commits).IsEqualTo(0); + } + + /// The lists F5 holds (characters, trigger sets, adding and deleting) are its cell screen's; the door opens it. + [Test] + public async Task TheWorldSectionsDoorOpensTheCellScreen() + { + var harness = TwoWorlds(); + await Run(harness, "worlds", window => + { + window.ScreenDoor!.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); + Dispatcher.UIThread.RunJobs(); + return 0; + }); + + await Assert.That(harness.Opened).IsEquivalentTo(new[] { "worlds" }); + } + + /// With no world there is nothing to edit: no fields, a sentence saying so, and the door to F5. + [Test] + public async Task AWorldSectionWithNoWorldsShowsOnlyTheDoor() + { + var harness = new Harness(); + harness.Config.Worlds.Clear(); + var (fields, door, picker) = await Run(harness, "worlds", window => + (window.ShownFields.Count, window.ScreenDoor is not null, window.SubjectPicker is not null)); + + await Assert.That(fields).IsEqualTo(0); + await Assert.That(door).IsTrue(); + await Assert.That(picker).IsFalse(); + } + /// F7 in the window host reaches the presenter, which opens the settings window on that section. [Test] public async Task F7InTheWindowHostOpensTheSettingsWindow() diff --git a/tests/SharpMUTerm.Client.Tests/ScopedSettingsTests.cs b/tests/SharpMUTerm.Client.Tests/ScopedSettingsTests.cs new file mode 100644 index 00000000..5ecab3cb --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/ScopedSettingsTests.cs @@ -0,0 +1,183 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Tests; + +/// +/// F5's world fields and F9's character fields, declared with scoped bindings, and the theme field: a scoped field reads +/// and writes the world or character it is aimed at and no other, resets to a fresh world's or character's default, +/// refuses what the cell screen refuses, and is found by the search; the theme field keeps a customised theme when +/// another is tried. +/// +public class ScopedSettingsTests +{ + private static AppConfiguration TwoWorlds() + { + var config = new AppConfiguration(); + config.Worlds.Clear(); + config.Worlds.Add(new WorldDefinition { Name = "Aetherfall", Host = "aether.example", Characters = { new CharacterDefinition { Name = "Corvid" } } }); + config.Worlds.Add(new WorldDefinition { Name = "Brightwater", Host = "bright.example", Characters = { new CharacterDefinition { Name = "Wren" } } }); + return config; + } + + private static SettingsField World(string id) => BuiltInSettings.World.Fields.Single(f => f.Id == id); + + private static SettingsField Character(string id) => BuiltInSettings.Character.Fields.Single(f => f.Id == id); + + [Test] + public async Task TheWorldAndCharacterSectionsAreScoped() + { + await Assert.That(BuiltInSettings.World.Scope).IsEqualTo(SettingScope.World); + await Assert.That(BuiltInSettings.Character.Scope).IsEqualTo(SettingScope.Character); + await Assert.That(BuiltInSettings.Text.Scope).IsEqualTo(SettingScope.App); + await Assert.That(BuiltInSettings.World.Fields.All(f => f.Binding!.Scope == SettingScope.World)).IsTrue(); + await Assert.That(BuiltInSettings.Character.Fields.All(f => f.Binding!.Scope == SettingScope.Character)).IsTrue(); + } + + [Test] + public async Task AWorldFieldWritesTheWorldItIsAimedAtAndResetsToAFreshWorldsDefault() + { + var config = TwoWorlds(); + var second = config.Worlds[1]; + var grab = (SettingBinding)World("edit-grab").Binding!; + var target = new SettingTarget(config, second); + + grab.Set(target, "FugueEdit > "); + + await Assert.That(second.GrabPrefix).IsEqualTo("FugueEdit > "); + await Assert.That(config.Worlds[0].GrabPrefix).IsNull(); + await Assert.That(grab.IsDefault(target)).IsFalse(); + await Assert.That(grab.IsDefault(new SettingTarget(config, config.Worlds[0]))).IsTrue(); + + grab.Reset(target); + await Assert.That(second.GrabPrefix).IsEqualTo(new WorldDefinition().GrabPrefix); + } + + [Test] + public async Task AScopedFieldWithNoSubjectSaysSoAndChangesNothing() + { + var config = new AppConfiguration(); + var grab = World("edit-grab").Binding!; + + await Assert.That(grab.IsDefault(config)).IsTrue(); + await Assert.That(grab.Text(config)).IsEqualTo("per world"); + await Assert.That(Character("tint").Binding!.Text(config)).IsEqualTo("per character"); + } + + [Test] + public async Task IdentityFieldsAreNotReset() + { + foreach (var id in new[] { "name", "host", "port" }) + { + await Assert.That(World(id).Binding!.Resettable).IsFalse(); + } + + await Assert.That(Character("name").Binding!.Resettable).IsFalse(); + await Assert.That(Character("password").Binding!.Resettable).IsFalse(); + await Assert.That(World("edit-grab").Binding!.Resettable).IsTrue(); + } + + [Test] + public async Task TheFormEditsTheChosenSubjectThroughOneCommitEach() + { + var config = TwoWorlds(); + var commits = 0; + var form = new SettingsForm(BuiltInSettings.All, config, change => { change(); commits++; }, _ => { }, "worlds", isDark: true); + + await Assert.That(form.Subject(SettingScope.World)!.World).IsSameReferenceAs(config.Worlds[0]); + form.Choose(form.Subjects(SettingScope.World)[1]); + await Assert.That(form.Subject(SettingScope.Character)!.Character!.Name).IsEqualTo("Wren"); + + var grab = (TextField)World("edit-grab"); + await Assert.That(form.SetText(grab, " Edit> ")).IsNull(); + await Assert.That(commits).IsEqualTo(1); + await Assert.That(config.Worlds[1].GrabPrefix).IsEqualTo("Edit>"); + await Assert.That(config.Worlds[0].GrabPrefix).IsNull(); + + form.Reset(grab); + await Assert.That(commits).IsEqualTo(2); + await Assert.That(config.Worlds[1].GrabPrefix).IsNull(); + + var tint = (SettingBinding)Character("tint").Binding!; + form.Set(tint, "Moss"); + await Assert.That(config.Worlds[1].Characters[0].Tint).IsEqualTo(PaneTint.Moss); + await Assert.That(config.Worlds[0].Characters[0].Tint).IsEqualTo(PaneTint.None); + } + + [Test] + public async Task TheFormRefusesWhatTheCellScreenRefuses() + { + var config = TwoWorlds(); + var commits = 0; + var form = new SettingsForm(BuiltInSettings.All, config, change => { change(); commits++; }, _ => { }, "worlds", isDark: true); + + await Assert.That(form.SetText((TextField)World("host"), " ")).IsNotNull(); + await Assert.That(form.SetText((TextField)World("walk-fail"), "(unclosed")).IsNotNull(); + await Assert.That(commits).IsEqualTo(0); + await Assert.That(config.Worlds[0].Host).IsEqualTo("aether.example"); + } + + [Test] + public async Task AConnectLineLeftUnsetShowsTheDefaultTemplate() + { + var config = TwoWorlds(); + var form = new SettingsForm(BuiltInSettings.All, config, change => change(), _ => { }, "logging", isDark: true); + var connect = (TextField)Character("connect"); + + await Assert.That(form.Text(connect)).IsEqualTo(connect.Fallback!); + } + + [Test] + public async Task TheSearchFindsWorldAndCharacterFields() + { + var grab = SettingsSearch.Find(BuiltInSettings.All, "edit grab"); + await Assert.That(grab.Any(m => m.Section.Id == BuiltInSettings.World.Id && m.Field?.Id == "edit-grab")).IsTrue(); + + var tint = SettingsSearch.Find(BuiltInSettings.All, "pane colour"); + await Assert.That(tint.Any(m => m.Section.Id == BuiltInSettings.Character.Id && m.Field?.Id == "tint")).IsTrue(); + + var theme = SettingsSearch.Find(BuiltInSettings.All, "solarized"); + await Assert.That(theme.Any(m => m.Field?.Id == BuiltInSettings.ThemeFieldId)).IsTrue(); + } + + [Test] + public async Task PickingAThemeSetsItsNameAndColours() + { + var config = new AppConfiguration(); + ThemeChoices.Apply(config, "Light"); + + await Assert.That(config.ThemeName).IsEqualTo("Light"); + await Assert.That(config.Theme.Name).IsEqualTo("Light"); + await Assert.That(ThemeChoices.Current(config)).IsEqualTo("Light"); + await Assert.That(ThemeChoices.Names(config)).Contains("Solarized Dark"); + } + + [Test] + public async Task TryingAnotherThemeKeepsTheCustomisedOne() + { + var config = new AppConfiguration(); + var mine = config.Theme.Clone(); + mine.Name = "Midnight"; + config.Theme = mine; + config.ThemeName = "Midnight"; + await Assert.That(ThemeChoices.Current(config)).IsEqualTo("Midnight"); + + ThemeChoices.Apply(config, "Dark"); + + await Assert.That(ThemeChoices.Current(config)).IsEqualTo("Dark"); + await Assert.That(config.CustomThemes.Select(t => t.Name)).Contains("Midnight"); + await Assert.That(ThemeChoices.Names(config)).Contains("Midnight"); + + ThemeChoices.Apply(config, "Midnight"); + await Assert.That(ThemeChoices.Current(config)).IsEqualTo("Midnight"); + } + + [Test] + public async Task ANameThePickerDoesNotListChangesNothing() + { + var config = new AppConfiguration(); + ThemeChoices.Apply(config, "No Such Theme"); + await Assert.That(config.ThemeName).IsEqualTo("Dark"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/CommandSurfaceSettingsTests.cs b/tests/SharpMUTerm.Tui.Tests/CommandSurfaceSettingsTests.cs index 3bc30549..9f8c64b2 100644 --- a/tests/SharpMUTerm.Tui.Tests/CommandSurfaceSettingsTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/CommandSurfaceSettingsTests.cs @@ -53,7 +53,12 @@ public async Task ACommittedSettingsEditIsPersistedThroughTheAppsSaveAction() new HeadlessConsoleDriver(Width, Height), save: _ => saves++); - app.DispatchCommand("screen:textansi"); // F7: every row a checkbox + app.DispatchCommand("screen:textansi"); // F7: past the theme rows, a checkbox + foreach (var _ in Enumerable.Range(0, 3)) + { + app.SimulateSettingsKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + } + app.SimulateSettingsKey(new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false)); await Assert.That(saves).IsGreaterThan(0); @@ -75,7 +80,12 @@ public async Task AnAppWithNoSaveActionPersistsNothing() { var app = App(); - app.DispatchCommand("screen:textansi"); + app.DispatchCommand("screen:textansi"); // F7: past the theme rows, a checkbox + foreach (var _ in Enumerable.Range(0, 3)) + { + app.SimulateSettingsKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + } + app.SimulateSettingsKey(new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false)); // Nothing threw and nothing was written: the only route to disk is the action the entry point diff --git a/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs b/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs new file mode 100644 index 00000000..81a7e2ed --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs @@ -0,0 +1,186 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// F5's world fields and F9's character fields are declared, and the cell screen and the desktop's settings window are +/// both drawn from the declarations: they list the same fields, an edit in either reaches the same property through the +/// one save funnel, and F7's theme picker previews as the cursor moves, reverts on Esc and commits once on ⏎. +/// +[NotInParallel] +public class DeclaredWorldSettingsTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static (SharpMUTermApp App, AppConfiguration Config, Func Saves) App() + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + var saves = 0; + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 40), save: _ => saves++); + return (app, config, () => saves); + } + + private static void Key(SharpMUTermApp app, ConsoleKey key, char ch = '\0') => + app.SimulateSettingsKey(new ConsoleKeyInfo(ch, key, false, false, false)); + + private static void Type(SharpMUTermApp app, string text) + { + foreach (var ch in text) + { + app.SimulateSettingsKey(new ConsoleKeyInfo(ch, char.IsLetter(ch) ? (ConsoleKey)char.ToUpperInvariant(ch) : ConsoleKey.Oem1, char.IsUpper(ch), false, false)); + } + } + + [Test] + public async Task TheCellScreenAndTheWindowListTheSameWorldFields() + { + var declared = BuiltInSettings.World.Fields.Select(f => f.Id).ToHashSet(StringComparer.Ordinal); + var drawn = WorldsScreenRenderer.WorldFieldOrder.Concat(WorldsScreenRenderer.SecurityFieldOrder).ToList(); + + await Assert.That(drawn.Count).IsEqualTo(declared.Count); + await Assert.That(drawn.ToHashSet(StringComparer.Ordinal).SetEquals(declared)).IsTrue(); + + var worlds = DemoScene.Build().Worlds; + var model = WorldsScreenRenderer.Model(worlds, [], 0, 0); + for (var i = 0; i < WorldsScreenRenderer.WorldFieldOrder.Count; i++) + { + var field = BuiltInSettings.World.Fields.Single(f => f.Id == WorldsScreenRenderer.WorldFieldOrder[i]); + await Assert.That(model.FieldAt(0, 0, i)!.Value.Label).IsEqualTo(field.Label); + } + } + + [Test] + public async Task TheCellScreenAndTheWindowListTheSameCharacterFields() + { + var declared = BuiltInSettings.Character.Fields.Select(f => f.Id).ToList(); + await Assert.That(WorldsScreenRenderer.CharacterFieldOrder.ToHashSet(StringComparer.Ordinal).SetEquals(declared)).IsTrue(); + await Assert.That(WorldsScreenRenderer.CharacterFieldOrder.Count).IsEqualTo(declared.Count); + + var worlds = DemoScene.Build().Worlds; + var model = WorldsScreenRenderer.Model(worlds, [], 0, 0); + for (var i = 0; i < WorldsScreenRenderer.CharacterFieldOrder.Count; i++) + { + var field = BuiltInSettings.Character.Fields.Single(f => f.Id == WorldsScreenRenderer.CharacterFieldOrder[i]); + await Assert.That(model.FieldAt(1, 0, i)!.Value.Label).IsEqualTo(field.Label); + } + } + + [Test] + public async Task AWindowEditReachesTheWorldAndIsSavedOnce() + { + var (app, config, saves) = App(); + var form = app.NativeSettingsForm("worlds"); + var world = form.Subject(SettingScope.World)!.World; + + await Assert.That(form.SetText((TextField)BuiltInSettings.World.Fields.Single(f => f.Id == "edit-grab"), "Edit> ")).IsNull(); + + await Assert.That(world.GrabPrefix).IsEqualTo("Edit>"); + await Assert.That(config.Worlds.Contains(world)).IsTrue(); + await Assert.That(saves()).IsEqualTo(1); + + form.Reset(BuiltInSettings.World.Fields.Single(f => f.Id == "edit-grab")); + await Assert.That(world.GrabPrefix).IsNull(); + await Assert.That(saves()).IsEqualTo(2); + } + + [Test] + public async Task AWindowEditOfACharacterReachesTheCellScreensCharacter() + { + var (app, config, saves) = App(); + var form = app.NativeSettingsForm("logging"); + var character = form.Subject(SettingScope.Character)!.Character!; + + form.Set((SettingBinding)BuiltInSettings.Character.Fields.Single(f => f.Id == "tint").Binding!, "Rose"); + + await Assert.That(character.Tint).IsEqualTo(PaneTint.Rose); + await Assert.That(saves()).IsEqualTo(1); + + // The cell screen's tint field reads the same property through the same declaration. + var world = config.Worlds.First(w => w.Characters.Contains(character)); + var model = WorldsScreenRenderer.Model(config.Worlds, [], config.Worlds.IndexOf(world), world.Characters.IndexOf(character)); + var tint = WorldsScreenRenderer.CharacterFieldOrder.ToList().IndexOf("tint"); + var row = world.Characters.IndexOf(character); + await Assert.That(model.FieldAt(1, row, tint)!.Value.Get()).IsEqualTo("Rose"); + } + + [Test] + public async Task ACellEditReachesTheSamePropertyThroughTheSaveFunnel() + { + var (app, config, saves) = App(); + var world = config.Worlds[0]; + var grab = WorldsScreenRenderer.WorldFieldOrder.ToList().IndexOf("edit-grab"); + + app.DispatchCommand("screen:worlds"); + Key(app, ConsoleKey.Enter); + for (var i = 0; i < grab; i++) + { + Key(app, ConsoleKey.Tab, '\t'); + } + + Type(app, "Edit;"); + Key(app, ConsoleKey.Enter, '\r'); + + await Assert.That(world.GrabPrefix).IsEqualTo("Edit;"); + await Assert.That(saves()).IsGreaterThan(0); + } + + [Test] + public async Task MovingOverAThemePreviewsItAndEscCommitsNothing() + { + var (app, config, saves) = App(); + app.DispatchCommand("screen:textansi"); + Key(app, ConsoleKey.DownArrow); + + await Assert.That(app.ThemeName).IsEqualTo("Dark"); + await Assert.That(config.ThemeName).IsEqualTo("Dark"); + + Key(app, ConsoleKey.Escape, '\u001b'); + + await Assert.That(app.SettingsOpenKey).IsNull(); + await Assert.That(app.ThemeName).IsEqualTo("Dark"); + await Assert.That(saves()).IsEqualTo(0); + } + + [Test] + public async Task EnterOnAThemeUsesItAndSavesOnce() + { + var (app, config, saves) = App(); + app.DispatchCommand("screen:textansi"); + Key(app, ConsoleKey.DownArrow); + Key(app, ConsoleKey.Enter, '\r'); + + await Assert.That(config.ThemeName).IsEqualTo("Light"); + await Assert.That(app.ThemeName).IsEqualTo("Light"); + await Assert.That(saves()).IsEqualTo(1); + } + + [Test] + public async Task F7OpensWithTheCursorOnTheThemeInForce() + { + var (app, config, _) = App(); + ThemeChoices.Apply(config, "Solarized Dark"); + app.DispatchCommand("screen:textansi"); + + await Assert.That(app.SettingsFocus!.Value.Index).IsEqualTo(ThemeChoices.Names(config).ToList().IndexOf("Solarized Dark")); + } + + [Test] + public async Task TheWindowsThemeCardsAreTheCellPickersThemes() + { + var (app, config, _) = App(); + var form = app.NativeSettingsForm("text"); + + await Assert.That(form.Themes().Select(c => c.Name)).IsEquivalentTo(ThemeChoices.Names(config)); + + form.SetTheme((ThemeField)BuiltInSettings.Text.Fields.Single(f => f.Id == BuiltInSettings.ThemeFieldId), "Light"); + await Assert.That(app.ThemeName).IsEqualTo("Light"); + await Assert.That(form.IsDark).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index 44e96147..36a6b72d 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -76,6 +76,7 @@ public class FrameContrastTests // The settings search marks its matches in the accent and the changed marks wear it too; the meter // editor's dropdown carries the received values as muted notes beside each path. "settings-search", "settings-meters", "settings-meters-pick", "settings-changed", + "settings-themes", "settings-themes-solarized", "settings-themes-used", // The prompt row is the only thing this client paints outside a pane that carries the // *game's* colours rather than its own, so the floor is applied against the idle input band diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs index 18c1570b..07d2a790 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenCursorTests.cs @@ -112,10 +112,11 @@ public async Task Keypad_BarsTheFocusedBinding() [Test] public async Task Options_BarsTheFocusedOptionAndNeverASectionHeader() { - // Navigable row 5 is "emoji substitution" — the headings and spacers are skipped, the four - // COLOUR & LEGIBILITY rows come first, and "tab width (spaces)" sits at 4 above it in TEXT. + // Navigable row 5 past the three theme rows is "emoji substitution" — the headings, spacers and the + // theme preview are skipped, the four COLOUR & LEGIBILITY rows come first, and "tab width (spaces)" + // sits at 4 above it in TEXT. var screen = OptionsScreenRenderer.TextAnsiScreen(); - var lines = OptionsScreenRenderer.BodyColumn(screen.Rows, new ScreenFocus(0, 5)); + var lines = OptionsScreenRenderer.BodyColumn(screen.Rows, new ScreenFocus(0, 3 + 5)); await Assert.That(Barred(lines)).IsEqualTo(1); await Assert.That(lines.Single(l => l.Contains(Bar, StringComparison.Ordinal))).Contains("emoji substitution"); diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs index 693276af..8b52b543 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs @@ -370,9 +370,11 @@ public async Task Options_NavigableRowsSkipSectionHeadersAndSpacers() // settings. Since F7 was drawn from its declared section the groups are COLOUR & LEGIBILITY, TEXT, // LINKS & PICTURES, STATUS ROW & METERS, ACTIVITY and SCROLLBACK; it was 21/10 with one row for the // meters as a typed line, and 23/13 before SCROLLBACK. - await Assert.That(screen.Rows.Count).IsEqualTo(26); + // The THEME group on top adds thirteen rows and three stops: its heading and spacer, a row per built-in + // theme, and the preview's caption and seven rows, which are drawn and never a stop. + await Assert.That(screen.Rows.Count).IsEqualTo(39); await Assert.That(model.PaneCount).IsEqualTo(1); - await Assert.That(model.Sizes[0]).IsEqualTo(14); + await Assert.That(model.Sizes[0]).IsEqualTo(17); } /// @@ -387,33 +389,36 @@ public async Task Options_TextAnsiRowsWriteBackToTheTextSettings() var text = new TextSettings(); var model = OptionsScreenRenderer.Model(OptionsScreenRenderer.TextAnsiScreen(text)); - model.ToggleAt(0, 0)!.Value.Flip(); + // The three built-in themes are the first three stops; the ordinals below count from after them. + const int Themes = 3; + + model.ToggleAt(0, Themes + 0)!.Value.Flip(); await Assert.That(text.StripIncomingColour).IsTrue(); // 1 is "keep text legible", which sits directly under the row above because the two are the ends // of one question's range — discard every colour the server sent, or keep them and move the few // that cannot be read. - model.ToggleAt(0, 1)!.Value.Flip(); + model.ToggleAt(0, Themes + 1)!.Value.Flip(); await Assert.That(text.KeepTextLegible).IsFalse(); - model.ToggleAt(0, 6)!.Value.Flip(); + model.ToggleAt(0, Themes + 6)!.Value.Flip(); await Assert.That(text.UnderlineHyperlinks).IsFalse(); - model.ToggleAt(0, 7)!.Value.Flip(); + model.ToggleAt(0, Themes + 7)!.Value.Flip(); await Assert.That(text.DetectLinks).IsFalse(); - model.ToggleAt(0, 5)!.Value.Flip(); + model.ToggleAt(0, Themes + 5)!.Value.Flip(); await Assert.That(text.EmojiSubstitution).IsFalse(); // Row 4 is the tab width — a count, so it is a field rather than a toggle, and it is what makes // this screen carry an editable row at all. - await Assert.That(model.ToggleAt(0, 4)).IsNull(); + await Assert.That(model.ToggleAt(0, Themes + 4)).IsNull(); await Assert.That(model.HasEditableRow).IsTrue(); // Row 3 is the background transparency, a percentage rather than the checkbox it started as, at the // foot of COLOUR & LEGIBILITY. - await Assert.That(model.ToggleAt(0, 3)).IsNull(); - var transparency = model.FieldAt(0, 3, 0)!.Value; + await Assert.That(model.ToggleAt(0, Themes + 3)).IsNull(); + var transparency = model.FieldAt(0, Themes + 3, 0)!.Value; await Assert.That(transparency.Validate("101")).IsNotNull(); transparency.Set("60"); await Assert.That(text.BackgroundTransparency).IsEqualTo(60); diff --git a/tests/SharpMUTerm.Tui.Tests/SessionStateAccountingTests.cs b/tests/SharpMUTerm.Tui.Tests/SessionStateAccountingTests.cs index 8e190630..c5c8b914 100644 --- a/tests/SharpMUTerm.Tui.Tests/SessionStateAccountingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SessionStateAccountingTests.cs @@ -124,7 +124,12 @@ public async Task ACommittedEditOnAnySettingsScreen_IsWhatMakesAnAutomationChang var wired = await Wired(); wired.Config.Worlds[0].Characters[0].TriggerSets.Add("Comms"); - wired.App.DispatchCommand("screen:textansi"); + wired.App.DispatchCommand("screen:textansi"); // F7: past the theme rows, a checkbox + foreach (var _ in Enumerable.Range(0, 3)) + { + wired.App.SimulateSettingsKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + } + wired.App.SimulateSettingsKey(new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false)); wired.Receive(wired.MannazWire, PublicLine); From 9a7311220847b0967275ac2d16fa61e53246e5f5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 08:17:15 +0000 Subject: [PATCH 029/113] Theme switch repaints history; sidebar keys, scrolling and row menus A theme change now formats every pane line again against the new reading plane, in place: a PaneLine keeps the StyledLine it was formatted from (Source) and a chrome bar the function that draws it (Bar), so freeze, away/missed/search bars, picture anchors and the selection all survive. About 106 ms and 743 KiB at the 2,000-line pane cap. Space on a theme row does what Enter does. Alt+C moves the keyboard into the connection sidebar in both hosts (SidebarModel.Cursor, layout:rail-keys, the rail-keys view): arrows, Home and End walk, Enter goes, Esc or any other key returns. The cell rail bands the row; the native sidebar rings it. The native sidebar scrolls with the wheel and an overlay bar, and a right click on a row opens the client's menu of registry commands for it (SidebarRowMenu), which the cell rail's pointer menu also uses. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 9 + CLAUDE.md | 33 ++- src/SharpMUTerm.Avalonia/NativeChrome.cs | 273 +++++++++++++++++- src/SharpMUTerm.Client/Chrome/SidebarModel.cs | 25 +- .../Commands/BuiltInCommands.cs | 6 + .../Surfaces/SurfaceCatalog.cs | 4 + src/SharpMUTerm.Tui/MacroKeys.cs | 4 + src/SharpMUTerm.Tui/OptionsScreenRenderer.cs | 2 +- src/SharpMUTerm.Tui/PaneLine.cs | 17 +- src/SharpMUTerm.Tui/PictureSlots.cs | 18 +- .../Pointer/SharpMUTermApp.Chrome.cs | 22 +- .../Pointer/SharpMUTermApp.Pointer.cs | 25 +- src/SharpMUTerm.Tui/RailRenderer.cs | 48 ++- src/SharpMUTerm.Tui/SettingsSession.cs | 6 +- .../SharpMUTermApp.RailKeys.cs | 268 +++++++++++++++++ .../SharpMUTermApp.ReflowScene.cs | 6 +- src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs | 60 +++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 138 +++++++-- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- .../NativeChromeTests.cs | 133 ++++++++- .../SurfaceParityTests.cs | 15 + .../DeclaredWorldSettingsTests.cs | 15 + .../FrameContrastTests.cs | 2 +- tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs | 164 +++++++++++ .../SnapshotViewEmptyConfigTests.cs | 2 +- .../ThemeRepaintTests.cs | 247 ++++++++++++++++ 26 files changed, 1445 insertions(+), 99 deletions(-) create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/ThemeRepaintTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a258638..373f0e01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,15 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Alt+C moves the keyboard into the connection sidebar, in the terminal and the desktop window: the arrow keys, + Home and End walk its rows, Enter goes to the one you are on, and Esc (or Alt+C, or just typing) returns to the + command line. +- Desktop window: a sidebar with more rows than fit scrolls, with the mouse wheel or a scrollbar like the panes', + and a right click on a world, character or window opens a menu of what you can do with it (switch, connect or + disconnect, edit, go to, close, clear), each with its key. +- Switching theme repaints the output already on screen, not only what arrives next, and Space on a theme in the + picker uses it as Enter does. + - A narrow terminal gives its room to the game: below 100 columns the connection rail folds to its slim strip on its own (in the desktop window, the sidebar does), and below 100 columns or 30 rows an empty command line is one row tall and grows as you type. At 80×24 a pane is now 72 columns wide instead of 60, two rows taller, diff --git a/CLAUDE.md b/CLAUDE.md index c13d83e6..f3b52bba 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1155,9 +1155,24 @@ fallbacks) for inline images/maps. exists for), and covering both arrangements means the layout a person actually runs in the window is held to the terminal's cell for cell, rather than compared below an offset or skipped. What the native header and sidebar *say* is held to the cells by the shared models (`NativeChromeModelTests`), not by pixels. - - **Not done**: no keyboard navigation of the native views (the keys are the client's: ⌥N, ⌥J/⌥K, ⌃P), no - scrolling of an overlong sidebar (rows past the foot are cut), no right-click menu on a sidebar row, no - animation when the sidebar folds. + - **An overlong sidebar scrolls** under the title and above the foot button, with the wheel or the panes' overlay + bar (4 px, 8 px under the pointer, dragged by its thumb); rows are laid out unscrolled, the scroll clamped, and + a row half under the title is clickable only where it shows (hit areas intersect the list). + - **⌥C moves the keyboard into the sidebar, in both hosts** (`SharpMUTermApp.RailKeys.cs`; `SidebarModel.Cursor`; + ⌃P `layout:rail-keys`; the `rail-keys` view). ↑↓ Home End walk `NavigableRows()`, ⏎ goes where a click goes + (`DispatchRailTarget`), Esc or ⌥C hands the keys back, and any other key hands them back *and* does what it does + on the command line. Focus never moves: the cursor is client state `HandleWindowKey` reads first (`TryRailKey`), + the way an armed ⌃B is, and every other global shortcut leaves it before acting. The cell rail draws the row on + the armed band padded to the rail's widest row (no cell spent; inks re-held to the floor on the band, + `RailRenderer.OnBand`); the native sidebar draws an accent ring and scrolls the row into view. ⌥C because it + is `ESC c` (one Alt chord in a terminal), C names CONNECTIONS, and nothing claimed it — not `AppShortcuts`, the + bar's table, nor the window's `HostKeys.Reserved`. + - **A right click on a sidebar row opens the client's menu for that row** (`SidebarRowMenu`, `RunSidebarMenuEntry`; + `ChromeOverlay.RowMenu`/`RunRowMenu`; the cell rail's pointer menu reads the same method). Entries are registry + commands with their keys (switch, connect/disconnect, edit in F5/F9, go to, close, clear), each offered only if + the registry resolves it; running one brings the row forward first, and an id the menu did not offer is refused. + - **Not done**: no animation when the sidebar folds; the command line keeps its armed band while the sidebar holds + the keys; the terminal has no row menu (no pointer menus there), its entries are ⌃P's. - **Layouts are realised as panes, one per panel that has data** (`Core/Layouts`: `LayoutFold` → `LayoutRealiser` → `WorkspaceLayout.ReplaceTree`, `LayoutCapture` for the way back; Tui `SharpMUTermApp.Layouts.cs`, @@ -1664,9 +1679,15 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] theme** (`OptionsScreen.Preview` → `SchemeFor`), so Esc closing with nothing committed is the revert; ⏎ commits through `ScreenEdits.Apply`. F7 opens with the cursor on the theme in force. **A theme change is noticed in `SaveConfiguration`** (`ApplyThemeIfChanged`, by colour signature) and `ApplyTheme` re-derives the chrome, the - formatters, every overlay's `Scheme` and the panes' planes. **Output already in a pane keeps its colours** — - it is markup by then — and the notice says so; on a light theme the old dark-theme greys are faint until they - scroll away. A customised theme replaced by the picker is kept in `AppConfiguration.CustomThemes` (no schema + formatters, every overlay's `Scheme` and the panes' planes. **Output already in a pane is repainted too** + (`RestylePaneLines`, the `theme-switched` view): a `PaneLine` keeps the `StyledLine` it was formatted from + (`Source`) and a chrome bar the function that draws it (`Bar`), and the switch formats each again against the new + reading plane *in place*, so no index moves — freeze point, away/missed/search bars, picture anchors (a reserved + picture's pieces through `PictureSlots.Cuts`/`Restyle`) — and the selection is kept (`keepSelection`), since only + colours changed. Rows nothing holds a source for (a picture's own rows, the restore replay) keep their markup. + Measured at the 2,000-line pane cap: ~106 ms for the switch, ~743 KiB of `StyledLine`s for a window whose lines + are not shared with the session's ring (a spawn window; a session window shares the ring's instances). + Space on a theme row does what ⏎ does (`SettingsSession.Toggle` on an `Apply` button). A customised theme replaced by the picker is kept in `AppConfiguration.CustomThemes` (no schema bump), and listed. Unstyled text on a settings screen takes the scheme's ink (`ScreenChrome.Panel`/`Band` set `ForegroundColor`), not the window's, because the window is still the theme in force while one is previewed. - Not declared yet: F2–F4, F6 and F10 are listed by title only. diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 50eb41ef..e7bcaa49 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -1,8 +1,10 @@ using System.Globalization; using Avalonia; using Avalonia.Controls; +using Avalonia.Controls.Primitives; using Avalonia.Input; using Avalonia.Media; +using Avalonia.Threading; using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Palette; using SharpMUTerm.Core.Text; @@ -571,6 +573,13 @@ private void DrawPrefix(DrawingContext context, HeaderPrefix prefix, ChromeOverl /// desktop app's size: an unfold button, an accent mark per world, and a dot with an initial per character (filled /// while connected, with an unread mark), each still a click on its target, with the name in its tooltip. /// +/// +/// More rows than fit scroll under the title and above the foot button, with the wheel or by dragging an overlay +/// scrollbar drawn like the panes' (thin, widening under the pointer). A right click on a row opens a native menu of the +/// client's entries for that row (, the registry's commands with their keys); and +/// while the keyboard is on the sidebar (⌥C, ) its row wears a focus ring and is +/// scrolled into view. The keys themselves are the client's: nothing here is focusable. +/// /// internal sealed class NativeSidebar(TerminalView view) : NativeChromeView(view) { @@ -587,6 +596,22 @@ internal sealed record Row(RailRowKind Kind, Rect Area, RailWorld World, RailCha private Rect _add; private Rect _fold; + /// How far the rows are scrolled, in pixels, and the list area they scroll in. + private double _scroll; + private double _content; + private Rect _list; + private bool _barHovered; + private double? _barGrab; + + /// How far the rows are scrolled, in pixels. Internal for tests. + internal double ScrollOffset => _scroll; + + /// The most the rows can be scrolled: zero when they all fit. Internal for tests. + internal double ScrollRange => Math.Max(0, _content - _list.Height); + + /// The row menu last opened, for a test. + internal ContextMenu? OpenedMenu { get; private set; } + /// The rows as last laid out. Internal for tests. internal IReadOnlyList Rows => _rows; @@ -608,17 +633,13 @@ protected override void Layout(ChromeOverlay overlay, List<(Rect Area, string Ta var row = folded ? 32 : RowHeight; _add = folded ? new Rect((width - 32) / 2, Height - 32 - 10, 32, 32) : new Rect(10, Height - row - 12, Math.Max(0, width - 20), row + 2); var bottom = _add.Top - 6; + _list = new Rect(0, TitleHeight, width, Math.Max(0, bottom - TitleHeight)); var y = TitleHeight; - void Add(Row r, string target, string tip) - { - if (r.Area.Bottom > bottom) - { - return; - } - _rows.Add(r); - hits.Add((r.Area, target, tip)); - } + // Laid out unscrolled first: the scroll is clamped to what the rows need, and moved to keep the keyboard's row + // in view, before anything is placed. + var laid = new List<(Row Row, string Target, string Tip)>(); + void Add(Row r, string target, string tip) => laid.Add((r, target, tip)); foreach (var world in overlay.Sidebar.Worlds) { @@ -667,6 +688,32 @@ void Add(Row r, string target, string tip) } } + _content = y + 4 - TitleHeight; + if (overlay.Sidebar.Cursor is { } cursor && laid.FirstOrDefault(l => KeyOf(l.Row) == cursor) is { Row: { } focused }) + { + if (focused.Area.Top - _scroll < _list.Top) + { + _scroll = focused.Area.Top - _list.Top - 4; + } + else if (focused.Area.Bottom - _scroll > _list.Bottom) + { + _scroll = focused.Area.Bottom - _list.Bottom + 4; + } + } + + _scroll = Math.Clamp(_scroll, 0, ScrollRange); + foreach (var (r, target, tip) in laid) + { + var area = r.Area.Translate(new Vector(0, -_scroll)); + if (area.Bottom <= _list.Top || area.Top >= _list.Bottom) + { + continue; + } + + _rows.Add(r with { Area = area }); + hits.Add((area.Intersect(_list), target, tip)); + } + if (_add.Width > 20 && _add.Top > TitleHeight) { hits.Add((_add, SidebarModel.AddGameTarget, "Connect to a game, or add one")); @@ -677,6 +724,178 @@ void Add(Row r, string target, string tip) } } + /// A drawn row's identity, as the client keys it (). + internal static string KeyOf(Row row) => SidebarModel.KeyOf(row.Kind, TargetOf(row)); + + /// The target the cell rail gives the same row. + internal static string TargetOf(Row row) => row.Kind switch + { + RailRowKind.Window => SidebarModel.TargetOf(row.Window!), + RailRowKind.Character => SidebarModel.TargetOf(row.Character!), + RailRowKind.Empty => RailModel.NoCharactersTarget(row.World.Name), + _ => SidebarModel.TargetOf(row.World), + }; + + /// The row under , inside the list area, or null. + private Row? RowAt(Point point) => + _list.Contains(point) ? _rows.FirstOrDefault(r => r.Area.Contains(point)) : null; + + /// Scrolls the rows by (positive is down the list) and lays them out again. + internal void ScrollBy(double pixels) + { + var before = _scroll; + _scroll = Math.Clamp(_scroll + pixels, 0, ScrollRange); + if (_scroll != before) + { + Show(Overlay, Plane, Ink); + } + } + + protected override void OnPointerWheelChanged(PointerWheelEventArgs e) + { + base.OnPointerWheelChanged(e); + ScrollBy(-e.Delta.Y * RowHeight * 3); + } + + /// + /// Asks the client for 's menu and opens it at the pointer. The client builds it on its own + /// thread and answers there; the menu is opened on this one. Internal for tests. + /// + internal void OpenRowMenu(string rowKey) + { + if (Overlay is not { } overlay || Inert) + { + return; + } + + overlay.RowMenu(rowKey, model => Dispatcher.UIThread.Post(() => + { + if (model.Entries.Count == 0) + { + return; + } + + var menu = NativeMenu.Build(model, overlay.RunRowMenu, PlacementMode.Pointer, this); + OpenedMenu = menu; + menu.Open(this); + })); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + var point = e.GetCurrentPoint(this); + if (!Inert && point.Properties.IsRightButtonPressed && RowAt(point.Position) is { } row) + { + e.Handled = true; + OpenRowMenu(KeyOf(row)); + return; + } + + if (!Inert && point.Properties.IsLeftButtonPressed && Bar() is { } bar && bar.Zone.Contains(point.Position)) + { + e.Handled = true; + _barGrab = bar.Thumb.Contains(point.Position) ? point.Position.Y - bar.Thumb.Top : bar.Thumb.Height / 2; + e.Pointer.Capture(this); + DragBar(point.Position.Y); + return; + } + + base.OnPointerPressed(e); + } + + protected override void OnPointerMoved(PointerEventArgs e) + { + var position = e.GetPosition(this); + if (_barGrab is not null) + { + DragBar(position.Y); + e.Handled = true; + return; + } + + var hovered = Bar() is { } bar && bar.Zone.Contains(position); + if (hovered != _barHovered) + { + _barHovered = hovered; + InvalidateVisual(); + } + + base.OnPointerMoved(e); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + if (_barGrab is not null) + { + _barGrab = null; + e.Pointer.Capture(null); + e.Handled = true; + InvalidateVisual(); + return; + } + + base.OnPointerReleased(e); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + _barHovered = false; + base.OnPointerExited(e); + } + + /// The panes' bar, at the panes' sizes: over the list's right edge, never in a column of it. + private const double BarWidth = 4, BarWidthHovered = 8, BarZone = 12, MinimumThumb = 18; + + /// The scrollbar's zone and thumb, or null when every row fits. Internal for tests. + internal (Rect Zone, Rect Thumb, double Travel)? Bar() + { + if (ScrollRange <= 0 || _list.Height <= 0) + { + return null; + } + + var thumb = Math.Min(_list.Height, Math.Max(MinimumThumb, _list.Height * _list.Height / _content)); + var travel = _list.Height - thumb; + var y = _list.Top + (travel * _scroll / ScrollRange); + var width = _barHovered || _barGrab is not null ? BarWidthHovered : BarWidth; + return (new Rect(_list.Right - BarZone, _list.Top, BarZone, _list.Height), new Rect(_list.Right - width - 2, y, width, thumb), travel); + } + + private void DragBar(double y) + { + if (Bar() is not { } bar || bar.Travel <= 0 || _barGrab is not { } grab) + { + return; + } + + var fraction = Math.Clamp((y - grab - bar.Zone.Top) / bar.Travel, 0, 1); + ScrollBy((fraction * ScrollRange) - _scroll); + } + + private void DrawBar(DrawingContext context) + { + if (Bar() is not { } bar) + { + return; + } + + var active = _barHovered || _barGrab is not null; + if (active) + { + var track = new Rect(bar.Thumb.X, bar.Zone.Y, bar.Thumb.Width, bar.Zone.Height); + context.DrawRectangle(new SolidColorBrush(Faint(0x22)), null, track, bar.Thumb.Width / 2, bar.Thumb.Width / 2); + } + + context.DrawRectangle(new SolidColorBrush(Faint(active ? (byte)0xB0 : (byte)0x60)), null, bar.Thumb, bar.Thumb.Width / 2, bar.Thumb.Width / 2); + } + + /// The keyboard's row: a ring in the client's accent, over a lifted plate, so it reads apart from a hover. + private void DrawCursor(DrawingContext context, Row row) + { + var accent = Legible(Parse(Overlay?.Palette.Accent)); + context.DrawRectangle(null, new Pen(new SolidColorBrush(accent), 1.6), row.Area.Deflate(1), 6, 6); + } + public override void Render(DrawingContext context) { // The plane runs on through the gutter to the panes (NativeLayout.SidebarGutter): the pane's own raised surface @@ -699,18 +918,40 @@ public override void Render(DrawingContext context) Text(context, "CONNECTIONS", 16, _fold.Center.Y, size - 2.5, Dim, bold: true); } - foreach (var r in _rows) + using (context.PushClip(_list)) { + foreach (var r in _rows) + { + var focused = overlay.Sidebar.Cursor is { } cursor && KeyOf(r) == cursor; + DrawRow(context, r, overlay, focused, size); + if (focused) + { + DrawCursor(context, r); + } + } + } + + DrawBar(context); + DrawFoot(context, size); + DrawVeil(context); + } + + private void DrawRow(DrawingContext context, Row r, ChromeOverlay overlay, bool focused, double size) + { if (Folded) { DrawFolded(context, r, overlay); - continue; + return; } var middle = r.Area.Center.Y; - var hovered = Hovered(r.Area); + var hovered = Hovered(r.Area.Intersect(_list)); var selected = r.Window is { } w && overlay.Sidebar.IsSelected(w) || r.Kind == RailRowKind.Character && r.Character!.Active; - if (selected || hovered) + if (focused) + { + context.DrawRectangle(new SolidColorBrush(Raised(0.14)), null, r.Area, 6, 6); + } + else if (selected || hovered) { context.DrawRectangle(new SolidColorBrush(Raised(selected && hovered ? 0.16 : selected ? 0.11 : 0.07)), null, r.Area, 6, 6); } @@ -736,8 +977,10 @@ public override void Render(DrawingContext context) DrawWindow(context, r, r.Window!, accent, overlay.Sidebar.IsSelected(r.Window!), middle, right, size); break; } - } + } + private void DrawFoot(DrawingContext context, double size) + { if (_add.Width > 0) { var fill = Hovered(_add) ? Raised(0.12) : Raised(0.05); @@ -754,8 +997,6 @@ public override void Render(DrawingContext context) Text(context, AddGameText, _add.Center.X - (Math.Min(Measure(AddGameText, size), _add.Width - 12) / 2), _add.Center.Y, size, Ink, maxWidth: _add.Width - 12); } } - - DrawVeil(context); } private void DrawFolded(DrawingContext context, Row r, ChromeOverlay overlay) diff --git a/src/SharpMUTerm.Client/Chrome/SidebarModel.cs b/src/SharpMUTerm.Client/Chrome/SidebarModel.cs index 3ddff292..8d464679 100644 --- a/src/SharpMUTerm.Client/Chrome/SidebarModel.cs +++ b/src/SharpMUTerm.Client/Chrome/SidebarModel.cs @@ -19,7 +19,12 @@ namespace SharpMUTerm.Client.Chrome; /// The worlds in configuration order, each with its characters. /// The window in front of the focused pane, or null. /// Whether the rail is the narrow strip (⌃B b) rather than the full sidebar. -public sealed record SidebarModel(IReadOnlyList Worlds, string? SelectedWindowId, bool Collapsed) +/// +/// The row the keyboard is on () while the sidebar holds the keys (⌥C), or null. Both views +/// draw it — the cell rail as a band across the row, the native sidebar as a focus ring — so a reader sees where ⏎ goes +/// in either host. +/// +public sealed record SidebarModel(IReadOnlyList Worlds, string? SelectedWindowId, bool Collapsed, string? Cursor = null) { /// No worlds: the sidebar of a client with nothing configured. public static SidebarModel Empty { get; } = new([], null, false); @@ -40,6 +45,22 @@ public sealed record SidebarModel(IReadOnlyList Worlds, string? Selec /// The flat rows the cell rail draws (). public IReadOnlyList Rows() => RailModel.Build(Worlds); + /// + /// A row's identity, which outlives a rebuild of the model: its kind and its click target. The kind is part of it + /// because a world's target is one of its characters', and the two rows are different places to stand. + /// + public static string KeyOf(RailRowKind kind, string? target) => $"{kind}|{target}"; + + /// + public static string KeyOf(RailRow row) => KeyOf(row.Kind, row.Target); + + /// + /// The rows the keyboard walks, in the order both views draw them: every row with a target, and while folded only + /// the worlds and characters, because the strip draws nothing else. + /// + public IReadOnlyList NavigableRows() => + [.. Rows().Where(r => r.Target is not null && (!Collapsed || r.Kind is RailRowKind.World or RailRowKind.Character))]; + /// Where a click on a world goes: the character already in front there, else a live one, else the first. public static string TargetOf(RailWorld world) => RailModel.TargetFor(world); @@ -77,6 +98,7 @@ public IEnumerable Targets() public bool Equals(SidebarModel? other) => other is not null && Collapsed == other.Collapsed + && string.Equals(Cursor, other.Cursor, StringComparison.Ordinal) && string.Equals(SelectedWindowId, other.SelectedWindowId, StringComparison.Ordinal) && Worlds.Count == other.Worlds.Count && Worlds.Zip(other.Worlds).All(p => SameWorld(p.First, p.Second)); @@ -86,6 +108,7 @@ public override int GetHashCode() var hash = new HashCode(); hash.Add(Collapsed); hash.Add(SelectedWindowId); + hash.Add(Cursor); foreach (var world in Worlds) { hash.Add(world.Name); diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index bcffae17..b19863ae 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -17,6 +17,9 @@ namespace SharpMUTerm.Client.Commands; /// public static class BuiltInCommands { + /// The command that moves the keyboard into the connection sidebar (⌥C). + public const string RailKeysCommand = "layout:rail-keys"; + /// /// Registers every built-in command. does the work for an id and returns false when /// it did not do what the label promised; it is called for every id these contributions handle, offered or not. @@ -204,6 +207,9 @@ void Family(string id, string prefix, Func new string(' ', AffordanceWidth) + caption)); for (var line = 0; line < PreviewRows; line++) { diff --git a/src/SharpMUTerm.Tui/PaneLine.cs b/src/SharpMUTerm.Tui/PaneLine.cs index 8c44793b..bf47639c 100644 --- a/src/SharpMUTerm.Tui/PaneLine.cs +++ b/src/SharpMUTerm.Tui/PaneLine.cs @@ -57,9 +57,24 @@ namespace SharpMUTerm.Tui; /// drawn there and is rebuilt from these; keeps the text the /// server sent, so a search still finds the picture's label. /// +/// +/// The world's line this markup was formatted from, or null when the row is not one (client replies, a picture's +/// rows, the numbered demo scene). Held so the colour decision is a render-time one, like the gutter: a theme +/// change re-formats every line that has one against the new theme's reading plane +/// (SharpMUTermApp.RestylePaneLines), where markup alone would keep the colours the old theme resolved — +/// faint greys on a light theme until they scrolled away. A spawn window's history exists nowhere else, so it has to +/// be kept here rather than re-read from WorldSession.Scrollback. For a session window the instance is usually +/// the one the session's ring already holds, so it costs a reference. +/// +/// +/// For a chrome row (the restore, away, activity and search bars), how to draw it again in a given accent, so a +/// theme change recolours the bars as well as the lines between them. Null on every other row. +/// internal readonly record struct PaneLine( string Markup, string? Stamp = null, string Plain = "", long ImageAnchor = 0, - PictureSlots? Pictures = null); + PictureSlots? Pictures = null, + Core.Text.StyledLine? Source = null, + Func? Bar = null); diff --git a/src/SharpMUTerm.Tui/PictureSlots.cs b/src/SharpMUTerm.Tui/PictureSlots.cs index 081f86ae..201ffad0 100644 --- a/src/SharpMUTerm.Tui/PictureSlots.cs +++ b/src/SharpMUTerm.Tui/PictureSlots.cs @@ -14,7 +14,7 @@ namespace SharpMUTerm.Tui; /// internal sealed class PictureSlots { - private readonly string[] _pieces; + private string[] _pieces; private readonly Slot[] _slots; /// @@ -36,6 +36,22 @@ public PictureSlots(string[] pieces, IReadOnlyList<(long Picture, int Row, int C } /// Whether a row of is on this line. + /// Where each slot was cut from the line (start column and width), so the pieces can be cut again. + public IReadOnlyList<(int Start, int Length)> Cuts { get; init; } = []; + + /// + /// Replaces the text either side of the slots with the same text formatted again — a theme change re-formats the + /// line it was cut from (), and the pictures drawn in the slots stay as they are. + /// + public void Restyle(string[] pieces) + { + ArgumentNullException.ThrowIfNull(pieces); + if (pieces.Length == _pieces.Length) + { + _pieces = pieces; + } + } + public bool Holds(long picture) => _slots.Any(slot => slot.Picture == picture); /// diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs index dcc86098..b56f1ae0 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs @@ -63,6 +63,14 @@ private void PublishHostChrome() internal ChromeOverlay BuildChromeOverlay() { _chromeActivate ??= target => OnUiThread(() => ActivateChromeTarget(target)); + _sidebarMenuRequest ??= (row, show) => OnUiThread(() => + { + if (MainWindowInFront()) + { + show(SidebarRowMenu(row)); + } + }); + _sidebarMenuRun ??= id => OnUiThread(() => RunSidebarMenuEntry(id)); var header = BuildHeaderModel(); var brand = FillHex(AccentPalette[2]); var palette = new ChromePalette( @@ -82,7 +90,9 @@ internal ChromeOverlay BuildChromeOverlay() header, BuildSidebar(), palette, - _chromeActivate); + _chromeActivate, + _sidebarMenuRequest, + _sidebarMenuRun); } /// @@ -167,13 +177,21 @@ internal bool ActivateChromeTarget(string target) /// Acts on a target from or ; safe to call from any thread. The same /// instance for the life of the app, so an overlay compares equal from frame to frame. /// +/// +/// Asks the client for a sidebar row's menu, by the row's key (); the client +/// builds it on its thread and hands it to the callback, which runs there (the host marshals). Nothing is handed back +/// while a modal of the client's is in front. Same instance for the life of the app. +/// +/// Runs an entry of the menu last built, by its command id; safe from any thread. internal sealed record ChromeOverlay( HostChrome Drawn, bool Interactive, HeaderModel HeaderModel, SidebarModel Sidebar, ChromePalette Palette, - Action Activate) + Action Activate, + Action> RowMenu, + Action RunRowMenu) { /// Whether is one this overlay offered a click on. public bool Offers(string target) => diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index b683ee27..c76b56c9 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -554,26 +554,13 @@ internal IReadOnlyList PointerMenu(System.Drawing.Point point) break; case PointerKind.RailRow: - var railTarget = target.Key["rail:".Length..]; - if (railTarget.StartsWith(CommandIds.CharacterPrefix, StringComparison.Ordinal) || - railTarget.StartsWith(CommandIds.WindowPrefix, StringComparison.Ordinal)) + // The native sidebar's row menu, entry for entry (SidebarRowMenu): one menu for one row, whichever + // host draws the rail. + foreach (var entry in SidebarRowMenu(RailRowKeyFor(target.Key["rail:".Length..])).Entries) { - var go = BuildCatalog().FirstOrDefault(c => c.Id == railTarget); - items.Add(new PointerMenuItem(go?.Title ?? "Go to it", null, () => OnUiThread(() => DispatchRailTarget(railTarget)))); - } - - if (railTarget.StartsWith(CommandIds.CharacterPrefix, StringComparison.Ordinal)) - { - items.Add(new PointerMenuItem("Connect", "⌥R", () => OnUiThread(() => - { - DispatchRailTarget(railTarget); - DispatchCommand("world:reconnect"); - }))); - items.Add(new PointerMenuItem("Disconnect", "⌥D", () => OnUiThread(() => - { - DispatchRailTarget(railTarget); - DispatchCommand("world:disconnect"); - }))); + items.Add(entry.IsSeparator + ? PointerMenuItem.Separator + : new PointerMenuItem(entry.Label, entry.Key, () => OnUiThread(() => RunSidebarMenuEntry(entry.Command!)), entry.Enabled)); } break; diff --git a/src/SharpMUTerm.Tui/RailRenderer.cs b/src/SharpMUTerm.Tui/RailRenderer.cs index fe03f7cf..60788df6 100644 --- a/src/SharpMUTerm.Tui/RailRenderer.cs +++ b/src/SharpMUTerm.Tui/RailRenderer.cs @@ -18,19 +18,61 @@ namespace SharpMUTerm.Tui; /// rail lands on nothing. /// /// -internal static class RailRenderer +internal static partial class RailRenderer { /// /// The sidebar's cells, drawn from the model the window's native sidebar is drawn from: the collapsed strip /// when the model says collapsed, else the full rail fitted to . /// - public static List Render(SidebarModel model, int maxWidth, ChromeInk? ink) + /// + /// The band the keyboard cursor's row is drawn on while the sidebar holds the keys (, + /// ⌥C): a background, or #ink on #band for the row's unstyled text. The row is padded to the widest row so the band runs the width of the rail and costs no column. + /// + public static List Render(SidebarModel model, int maxWidth, ChromeInk? ink, string? cursorBand = null) { ArgumentNullException.ThrowIfNull(model); var rows = model.Rows(); - return model.Collapsed ? RenderCollapsed(rows, ink) : Render(rows, maxWidth, ink); + var lines = model.Collapsed ? RenderCollapsed(rows, ink) : Render(rows, maxWidth, ink); + if (model.Cursor is not { } cursor || cursorBand is null) + { + return lines; + } + + // Which line each row became: one per row expanded, worlds and characters only when folded. + var drawn = model.Collapsed ? rows.Where(r => r.Kind is RailRowKind.World or RailRowKind.Character).ToList() : rows.ToList(); + var at = drawn.FindIndex(r => r.Target is not null && SidebarModel.KeyOf(r) == cursor); + if (at >= 0 && at < lines.Count) + { + var widest = lines.Max(SharpMUTermApp.MarkupWidth); + var pad = new string(' ', Math.Max(0, widest - SharpMUTermApp.MarkupWidth(lines[at]))); + var on = cursorBand.IndexOf(" on ", StringComparison.Ordinal); + var band = on < 0 ? cursorBand : cursorBand[(on + 4)..]; + lines[at] = $"[{(on < 0 ? "on " + cursorBand : cursorBand)}]{OnBand(lines[at], band)}{pad}[/]"; + } + + return lines; } + /// + /// The row's inks held to the floor on the band it is drawn on: they were resolved against the rail's plane, and a + /// quiet one (`offline`, a chord) can fall under 3:1 on the brighter band. A span with a background of its own + /// keeps its pair; escaped text ([[) is never a tag. + /// + private static string OnBand(string line, string band) + { + var plane = Hex(band); + return Tag().Replace(line, tag => Ink().Replace(tag.Value, ink => Contrast.Legible(Hex(ink.Value), plane).ToHex())); + + static Rgb Hex(string hex) => new( + Convert.ToByte(hex.Substring(1, 2), 16), Convert.ToByte(hex.Substring(3, 2), 16), Convert.ToByte(hex.Substring(5, 2), 16)); + } + + [System.Text.RegularExpressions.GeneratedRegex(@"(?The rail's rows, as projects them. /// /// The widest a row may be in visible cells. The sidebar's width is the widest row's clamped diff --git a/src/SharpMUTerm.Tui/SettingsSession.cs b/src/SharpMUTerm.Tui/SettingsSession.cs index 6bb03c9b..d082b48c 100644 --- a/src/SharpMUTerm.Tui/SettingsSession.cs +++ b/src/SharpMUTerm.Tui/SettingsSession.cs @@ -336,7 +336,11 @@ private ScreenAction Toggle(ScreenModel model) { if (model.ToggleAt(Selection.Pane, Selection.Index) is not { } toggle) { - return ScreenAction.Consumed; + // A choice row (a theme on F7: the cursor already previews it) takes Space as a checkbox does — as + // the commit — so Space is ⏎ there. Every other row with nothing to toggle swallows it, as before. + return model.RowAt(Selection.Pane, Selection.Index).Button is { Kind: ScreenButtonKind.Apply } + ? Activate(model) + : ScreenAction.Consumed; } Edits.Apply(toggle); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs new file mode 100644 index 00000000..6b5d1f12 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs @@ -0,0 +1,268 @@ +using SharpConsoleUI; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Tui; + +/// +/// The connection sidebar from the keyboard, and the menu a right click on one of its rows opens — in both hosts, from +/// one model. ⌥C puts a cursor on the sidebar (); ↑↓, Home and End walk its rows, ⏎ goes +/// where a click on that row goes (), and Esc or ⌥C hands the keys back to the command +/// line. Any other key does too, and then does what it does there, so a reader who starts typing is never stuck. +/// +/// Focus does not move. The framework's focus stays pinned to the armed command line +/// (); the cursor is client state the main window's key chain reads first, the way an +/// armed ⌃B is. That is what makes it the same feature in the terminal and the window: the cell rail draws the cursor as +/// a band across its row, the native sidebar as a ring, and both read it off the same model. +/// +/// +/// The row menu is the ⌃P catalog's entries for that row (): switch, reconnect or +/// disconnect, edit in F5 or F9, go to, close, clear. Each names a registry command and the key that does the same, so a +/// menu cannot offer what the keyboard lacks; choosing one first brings the row forward (a right click on a tab does the +/// same), then runs the command, and a command the menu did not offer is refused. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The key () of the row the keyboard is on, or null. + private string? _railCursor; + + /// The menu the sidebar was last offered, and the row it was for. + private (string Row, MenuModel Menu) _sidebarMenuOffered = (string.Empty, MenuModel.Empty); + + /// The two delegates the chrome overlay carries for the row menu; one instance each, so overlays compare equal. + private Action>? _sidebarMenuRequest; + + private Action? _sidebarMenuRun; + + /// Whether the sidebar holds the keys. Internal for tests. + internal bool RailKeysActive => _railCursor is not null; + + /// The row the keyboard is on, for a test. + internal string? RailCursor => _railCursor; + + /// ⌥C: into the sidebar, or back out of it. + private void ToggleRailKeys() + { + if (_railCursor is not null) + { + LeaveRailKeys(); + return; + } + + var rows = BuildSidebar().NavigableRows(); + if (rows.Count == 0) + { + RefuseCommand("the sidebar has nothing to walk yet — ⌃P ▸ Welcome adds a game"); + return; + } + + // Start where the reader is: the window in front, else the character in front, else the top. + var selected = CommandIds.Window(ActiveWindowId()); + var start = rows.FirstOrDefault(r => r.Kind == RailRowKind.Window && r.Target == selected) + ?? rows.FirstOrDefault(r => r.Kind == RailRowKind.Character && r.Active) + ?? rows[0]; + _railCursor = SidebarModel.KeyOf(start); + RefreshRail(); + Notice("sidebar: ↑↓ walk · ⏎ goes · Esc returns", MessageSeverity.Info, "⌥C"); + } + + /// Hands the keys back to the command line. Does nothing when the sidebar does not hold them. + private void LeaveRailKeys() + { + if (_railCursor is null) + { + return; + } + + _railCursor = null; + RefreshRail(); + } + + /// + /// A key while the sidebar holds the keyboard. Returns true for the keys it answers; anything else gives the keys + /// back and returns false, so the key goes on down the chain to the command line. + /// + private bool TryRailKey(KeyPressedEventArgs e) + { + if (_railCursor is null) + { + return false; + } + + var key = e.KeyInfo; + var bare = key.Modifiers == 0; + switch (key.Key) + { + case ConsoleKey.UpArrow when bare: + MoveRailCursor(-1); + break; + case ConsoleKey.DownArrow when bare: + MoveRailCursor(1); + break; + case ConsoleKey.Home when bare: + MoveRailCursor(int.MinValue); + break; + case ConsoleKey.End when bare: + MoveRailCursor(int.MaxValue); + break; + case ConsoleKey.Escape: + LeaveRailKeys(); + break; + case ConsoleKey.Enter when bare: + var row = BuildSidebar().NavigableRows().FirstOrDefault(r => SidebarModel.KeyOf(r) == _railCursor); + LeaveRailKeys(); + if (row?.Target is { } target) + { + DispatchRailTarget(target); + } + + break; + default: + LeaveRailKeys(); + return false; + } + + e.Handled = true; + return true; + } + + /// Moves the cursor by rows, clamped; the extremes of int go to the ends. + private void MoveRailCursor(int step) + { + var rows = BuildSidebar().NavigableRows(); + if (rows.Count == 0) + { + LeaveRailKeys(); + return; + } + + var at = rows.ToList().FindIndex(r => SidebarModel.KeyOf(r) == _railCursor); + var next = step switch + { + int.MinValue => 0, + int.MaxValue => rows.Count - 1, + _ => Math.Clamp((at < 0 ? 0 : at) + step, 0, rows.Count - 1), + }; + _railCursor = SidebarModel.KeyOf(rows[next]); + RefreshRail(); + } + + /// + /// The band the cell rail draws the keyboard cursor's row on: the armed command line's, because it says the same + /// thing there — this is where the keys go. + /// + private string RailCursorBand() + { + var band = WorkspacePalette.ArmedBand(_theme); + return $"{Contrast.Legible(_theme.Foreground, band).ToHex()} on {band.ToHex()}"; + } + + /// Drives a key into the sidebar's key handling as the main window would. Internal for tests. + internal bool SimulateRailKey(ConsoleKeyInfo key) => TryRailKey(new KeyPressedEventArgs(key, false)); + + /// + /// The menu for one row of the sidebar, by its key (): the ⌃P entries that + /// act on what the row names, each with its key. Remembered as offered, so the answer can be checked. Internal for + /// tests and for the cell rail's own pointer menu. + /// + internal MenuModel SidebarRowMenu(string rowKey) + { + var model = BuildSidebar(); + var row = model.Rows().FirstOrDefault(r => r.Target is not null && SidebarModel.KeyOf(r) == rowKey); + var entries = new List(); + if (row?.Target is { } target) + { + var world = model.Worlds.FirstOrDefault(w => RowsOf(w).Contains(rowKey)); + var character = world?.Characters.FirstOrDefault(c => c.Windows.Any(w => CommandIds.Window(w.Id) == target) + || CommandIds.Character(c.SessionKey) == target); + var title = Snippet(row.Label); + switch (row.Kind) + { + case RailRowKind.World: + var pick = world?.Characters.FirstOrDefault(c => CommandIds.Character(c.SessionKey) == target); + Offer(entries, $"Switch to {Snippet(pick?.Name ?? title)}", pick?.Chord, target); + entries.Add(MenuEntry.Separator); + Offer(entries, $"Edit {title} in F5", "F5", ScreenCommandPrefix + "worlds"); + break; + + case RailRowKind.Empty: + Offer(entries, $"Add a character to {Snippet(world?.Name ?? string.Empty)} in F5", "F5", ScreenCommandPrefix + "worlds"); + break; + + case RailRowKind.Character: + Offer(entries, row.Active ? $"{title} is in front" : $"Switch to {title}", row.Chord, target, enabled: !row.Active); + Offer(entries, row.Connected ? "Disconnect" : "Connect", row.Connected ? "⌥D" : "⌥R", + row.Connected ? "world:disconnect" : "world:reconnect"); + entries.Add(MenuEntry.Separator); + Offer(entries, $"Edit {Snippet(world?.Name ?? string.Empty)} in F5", "F5", ScreenCommandPrefix + "worlds"); + Offer(entries, $"Edit {title} in F9", "F9", ScreenCommandPrefix + "logging"); + break; + + case RailRowKind.Window: + var window = character?.Windows.FirstOrDefault(w => CommandIds.Window(w.Id) == target); + var front = model.IsSelected(window ?? new RailWindow(string.Empty, string.Empty, null, 0, false, false)); + Offer(entries, front ? $"{title} is in front" : $"Go to {title}", row.Chord, target, enabled: !front && !row.Closed); + if (!row.Closed) + { + // ⌃W closes the window in front; the session's main window is the session and never closes. + Offer(entries, "Close this window", "⌃W", "layout:close", enabled: window?.Id != MainWindowId); + Offer(entries, "Clear this window", null, "term:clear"); + } + + break; + } + } + + var menu = new MenuModel(entries); + _sidebarMenuOffered = (rowKey, menu); + return menu; + + IEnumerable RowsOf(RailWorld w) => RailModel.Build([w]).Where(r => r.Target is not null).Select(SidebarModel.KeyOf); + } + + /// An entry, only when the registry runs its command. + private void Offer(List entries, string label, string? key, string command, bool enabled = true) + { + if (_contributions.Commands.Resolve(command) is not null) + { + entries.Add(new MenuEntry(label, key, command, Enabled: enabled)); + } + } + + /// + /// An entry chosen from a sidebar row's menu: the row is brought forward first (unless the entry is that very + /// step), then the command runs, as a right click on a tab focuses it before its menu acts. A command the menu last + /// offered did not carry is refused. Internal so a test can drive it as the window does. + /// + internal bool RunSidebarMenuEntry(string id) + { + var (rowKey, menu) = _sidebarMenuOffered; + if (!menu.Commands().Contains(id, StringComparer.Ordinal)) + { + RefuseCommand($"the sidebar's menu never offered {Snippet(id)}"); + return false; + } + + var target = rowKey[(rowKey.IndexOf('|', StringComparison.Ordinal) + 1)..]; + if (!string.Equals(id, target, StringComparison.Ordinal) + && (target.StartsWith(CommandIds.CharacterPrefix, StringComparison.Ordinal) || target.StartsWith(CommandIds.WindowPrefix, StringComparison.Ordinal))) + { + DispatchRailTarget(target); + } + + return string.Equals(id, target, StringComparison.Ordinal) ? DispatchRailTarget(id) : DispatchCommand(id); + } + + /// The row key a cell rail target is drawn as: its character or window row, else its world row. + private string RailRowKeyFor(string target) + { + var rows = BuildSidebar().Rows().Where(r => r.Target == target).ToList(); + var row = rows.FirstOrDefault(r => r.Kind is RailRowKind.Character or RailRowKind.Window) ?? rows.FirstOrDefault(); + return row is null ? SidebarModel.KeyOf(RailRowKind.Character, target) : SidebarModel.KeyOf(row); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ReflowScene.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ReflowScene.cs index ee8bb794..966171d7 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ReflowScene.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ReflowScene.cs @@ -38,7 +38,7 @@ private void LoadReflowScene() AppendWindowLine(MainWindowId, $"[dim]── join wraps off · as sent, wrapped at {ReflowSceneColumn}[/]"); foreach (var row in rows) { - AppendWindowLine(MainWindowId, _formatter.ToMarkup(row)); + AppendWindowLine(MainWindowId, row); } AppendWindowLine(MainWindowId, "[dim]── join wraps on · the same rows, joined[/]"); @@ -58,13 +58,13 @@ private void LoadReflowScene() { foreach (var ready in joiner.Push(row)) { - AppendWindowLine(MainWindowId, _formatter.ToMarkup(ready)); + AppendWindowLine(MainWindowId, ready); } } if (joiner.Flush() is { } held) { - AppendWindowLine(MainWindowId, _formatter.ToMarkup(held)); + AppendWindowLine(MainWindowId, held); } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs index 50d1fbb8..e7ba65b0 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs @@ -8,9 +8,8 @@ namespace SharpMUTerm.Tui; /// The theme, changed while the client runs. F7's theme picker and the desktop's theme cards both commit through /// , and that is where a new theme is noticed and put into force: every colour the client /// derives from it — the workspace planes, the bars, the header, the settings screens and the popups — is re-derived and -/// repainted. What it cannot recolour is output already in a pane: a line's colours were resolved against the theme it -/// arrived under and held there as markup (), so the notice says so rather than leaving a reader to -/// wonder why the old lines look different. +/// repainted — output already in a pane included: every world line is kept beside its markup +/// () and formatted again against the new theme (). /// internal sealed partial class SharpMUTermApp { @@ -80,12 +79,59 @@ private void ApplyTheme(Theme theme) control.SelectionForegroundColor = ToColor(WorkspacePalette.SelectionInk(theme)); } + RestylePaneLines(); RebuildPaneArea(); RefreshPanels(); - Notice( - $"Theme {theme.Name}. Output already on screen keeps the colours it arrived in.", - Core.Diagnostics.MessageSeverity.Info, - "theme"); + Notice($"Painting in {theme.Name}, output on screen included.", Core.Diagnostics.MessageSeverity.Info, "theme"); + } + + /// + /// Formats every buffered world line again against the theme in force, redraws every bar in its accent, and + /// re-feeds the panes. A line's colours were resolved against the reading plane of the theme it arrived under + /// (, ), so without this a switch from Dark to Light left the + /// history in greys lifted for a dark plane — faint on a light one until it scrolled away. + /// + /// Nothing moves. Each row is replaced in place, so the count and the order of every buffer are what they + /// were, and every index into one — the freeze point, the away and activity marks, the NEW boundary, the + /// search bar, a picture's anchor — still names the row it named. The plain text is not touched (it is the same + /// text), so ⌃F finds what it found. A row with no (a picture's rows, a client + /// reply, the demo's numbered lines) keeps its markup: a picture's pixels are not the theme's, and a reply is + /// [dim], which the framework resolves to one grey whatever the theme. The re-feed keeps the selection, + /// because only colours changed. + /// + /// + /// This is the whole-buffer path the timestamp toggle uses (), bounded by the same kind + /// of event: one deliberate commit of a new theme. + /// + /// + internal void RestylePaneLines() + { + var accent = FrozenAccentHex(); + foreach (var buffer in _lines.Values) + { + for (var i = 0; i < buffer.Count; i++) + { + var line = buffer[i]; + if (line.Bar is { } bar) + { + buffer[i] = line with { Markup = bar(accent) }; + } + else if (line.Source is { } source) + { + if (line.Pictures is { } pictures) + { + pictures.Restyle(_formatter.ToMarkupPieces(source, pictures.Cuts)); + buffer[i] = line with { Markup = pictures.Compose() }; + } + else + { + buffer[i] = line with { Markup = _formatter.ToMarkup(source) }; + } + } + } + } + + RepaintPanes(keepSelection: true); } /// A theme's name and colours as one string, so two resolutions of one theme compare equal. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 5dbb1822..37511402 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1170,6 +1170,28 @@ public string RenderSnapshot(string? view = null) DispatchCommand("term:timestamps-on"); } + // A theme switched while the scene is on screen, over a split so a session window and a spawn window are + // both in the frame: every line already there is formatted again against Light (PaneLine.Source), so this + // frame's output matches what `--theme Light` draws from the start. Before the repaint the history kept the + // colours it arrived in, and the white and grey lines were faint on the light planes. + if (string.Equals(view, "theme-switched", StringComparison.OrdinalIgnoreCase)) + { + PaneCommands.Apply(_workspace.Layout, PaneCommand.SplitRight); + RebuildPaneArea(); + Client.Settings.ThemeChoices.Apply(_config, "Light"); + SaveConfiguration(); + SettleScroll(); + } + + // The sidebar holding the keys (⌥C), its cursor walked one row down by a real ↓: the cell rail draws the row on + // the armed command line's band, padded to the rail's width, so the frame shows where ⏎ will go and that no + // cell moved. The window's sidebar draws the same cursor as a ring. Nothing when the rail has no rows. + if (string.Equals(view, "rail-keys", StringComparison.OrdinalIgnoreCase)) + { + SimulateKey(new ConsoleKeyInfo('c', ConsoleKey.C, false, true, false)); + SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + } + // Bring the Chat spawn window to the front, so one frame shows a *routed* window as the active tab // with the character's own window sitting behind it in the same strip. It used to exist for the dim // "⇱ capture …" header a spawn pane drew over its output; that header is gone (the user asked for @@ -1447,7 +1469,7 @@ public string RenderSnapshot(string? view = null) { foreach (var line in parser.Feed(text + "\n")) { - AppendWindowLine(MainWindowId, _formatter.ToMarkup(line), StampNow()); + AppendWindowLine(MainWindowId, line, StampNow()); } } } @@ -2332,7 +2354,7 @@ private void SimulateSnapshotDrag() private void AppendDemoLine(string windowId, StyledLine line) { var shown = _config.Text.DetectLinks ? UrlDetector.ApplyToLine(line) : line; - AppendWindowLine(windowId, _formatter.ToMarkup(shown), StampNow()); + AppendWindowLine(windowId, shown, StampNow()); } private void LoadDemoScene() @@ -2361,13 +2383,13 @@ void Feed(string windowId, string ansiLine) new StyledSpan(" ", TextStyle.Default), Link("east"), }); - AppendWindowLine(MainWindowId, _formatter.ToMarkup(exits), StampNow()); + AppendWindowLine(MainWindowId, exits, StampNow()); // A trigger-highlighted line: carries a left-rule colour, so it gets the 2-col rule treatment. var highlighted = new StyledLine( new[] { new StyledSpan("[public] Rivane: to the crypt, then!", TextStyle.Default) }, TerminalColor.FromRgb(0x00, 0xf5, 0xb7)); - AppendWindowLine(MainWindowId, _formatter.ToMarkup(highlighted), StampNow()); + AppendWindowLine(MainWindowId, highlighted, StampNow()); // The Chat spawn window already exists (opened by the resumed session); feed its backlog and // leave it in the background with unread, as if lines arrived while another tab was focused. @@ -2382,7 +2404,7 @@ void Feed(string windowId, string ansiLine) { foreach (var line in chatParser.Feed(text + "\n")) { - AppendWindowLine(chatId, _formatter.ToMarkup(line), StampNow()); + AppendWindowLine(chatId, line, StampNow()); } _workspace.NoteActivity(chatId); // each line accrues unread while Chat is in the background @@ -2517,14 +2539,17 @@ private void RestorePreviousSession() foreach (var line in window.Lines) { - AppendWindowLine(windowId, _formatter.ToMarkup(line.Line), line.Stamp); + AppendWindowLine(windowId, line.Line, line.Stamp); } // The boundary marker carries no stamp: it did not arrive, it was drawn, and a timestamp // gutter beside it would be claiming a time for a row the game never sent. + var restored = window.Lines.Count; + var written = window.LastWritten; AppendWindowLine( windowId, - RestoreBarRenderer.Bar(window.Lines.Count, window.LastWritten, FrozenAccentHex())); + RestoreBarRenderer.Bar(restored, written, FrozenAccentHex()), + bar: accent => RestoreBarRenderer.Bar(restored, written, accent)); restoredWindows++; restoredLines += window.Lines.Count; @@ -3029,7 +3054,7 @@ private void BindSession(WorldSession session, string? windowId = null) PaneContentFor(windowId, session.World.Name); foreach (var line in session.Scrollback.Snapshot()) { - AppendWindowLine(windowId, _formatter.ToMarkup(line)); + AppendWindowLine(windowId, line); } session.LinePrinted += (_, line) => OnUi(() => OnLine(session, windowId, line)); @@ -3320,6 +3345,13 @@ private bool ShowTimestamps private string Compose(PaneLine line) => MarkupFormatter.WithTimestamp(line.Markup, ShowTimestamps ? line.Stamp : null); + /// + /// Appends one of a world's lines to a window, formatted against the theme in force and kept beside its markup + /// () so a theme change can format it again. + /// + private void AppendWindowLine(string windowId, StyledLine line, string? stamp = null) => + AppendWindowLine(windowId, _formatter.ToMarkup(line), stamp, source: line); + /// /// Appends one already-formatted markup line to a window: records it in the scrollback buffer and, /// if the window has a live control, paints it. A frozen pane's live control is its tail region, so @@ -3334,7 +3366,9 @@ private void AppendWindowLine( string markup, string? stamp = null, long imageAnchor = 0, - PictureSlots? pictures = null) + PictureSlots? pictures = null, + StyledLine? source = null, + Func? bar = null) { if (!_lines.TryGetValue(windowId, out var buffer)) { @@ -3361,7 +3395,7 @@ private void AppendWindowLine( // The plain text is computed here, once, and not on demand: ⌃F refilters on every keystroke over // every line of every window (see PaneLine.Plain). - buffer.Add(new PaneLine(markup, stamp, MarkupText.Plain(markup), imageAnchor, pictures)); + buffer.Add(new PaneLine(markup, stamp, MarkupText.Plain(markup), imageAnchor, pictures, source, bar)); // Cap what the pane holds, and trim its control with it. The control re-parses every line it @@ -3563,7 +3597,7 @@ private void RecordForRestore(WorldSession session, string windowId, string titl /// Keep new callers going through here rather than touching a control's content directly. /// /// - private void FeedRange(MarkupControl control, List buffer, int from, int count) + private void FeedRange(MarkupControl control, List buffer, int from, int count, bool keepSelection = false) { var start = Math.Clamp(from, 0, buffer.Count); var length = Math.Clamp(count, 0, buffer.Count - start); @@ -3582,7 +3616,15 @@ private void FeedRange(MarkupControl control, List buffer, int from, i // // MarkupControl.SetContent does not do this itself — only its append path does // (OnContentAppended) — so it cannot be left to the framework. - control.ClearSelection(); + // + // The one exception is a re-feed that changes colours and nothing else (a theme change, + // RestylePaneLines): every row holds the same text in the same place, so the selection still + // describes exactly what was dragged across, and dropping it would punish a reader for opening F7. + if (!keepSelection) + { + control.ClearSelection(); + } + control.SetContent(markup); } @@ -3632,11 +3674,11 @@ private void SetTimestamps(bool on) /// no arrival times and have no gutter to gain. /// /// - private void RepaintPanes() + private void RepaintPanes(bool keepSelection = false) { foreach (var windowId in _lines.Keys) { - RepaintPane(windowId); + RepaintPane(windowId, keepSelection); } } @@ -3647,7 +3689,7 @@ private void RepaintPanes() /// () is one — it happens when the reader comes back and when they have /// read what they missed, not per line and not per frame. /// - private void RepaintPane(string windowId) + private void RepaintPane(string windowId, bool keepSelection = false) { // Skipped for the reason RepaintPanes gives: the web view's pane is not fed from this buffer at // all, so re-feeding it would replace the page with whatever last printed into that window. @@ -3662,12 +3704,12 @@ private void RepaintPane(string windowId) var split = Math.Clamp(point, 0, buffer.Count); if (_frozenPanes.TryGetValue(windowId, out var frozen)) { - FeedRange(frozen, buffer, 0, split); + FeedRange(frozen, buffer, 0, split, keepSelection); } if (_panes.TryGetValue(windowId, out var tail)) { - FeedRange(tail, buffer, split, buffer.Count - split); + FeedRange(tail, buffer, split, buffer.Count - split, keepSelection); } return; @@ -3675,7 +3717,7 @@ private void RepaintPane(string windowId) if (_panes.TryGetValue(windowId, out var control)) { - FeedRange(control, buffer, 0, buffer.Count); + FeedRange(control, buffer, 0, buffer.Count, keepSelection); } RefreshScrollTail(windowId); @@ -3749,7 +3791,6 @@ private void NoteReaderInput(long at) /// private void MarkWhereTheReaderLeft(TimeSpan away) { - var accent = FrozenAccentHex(); foreach (var windowId in _lines.Keys.ToArray()) { if (string.Equals(windowId, WebWindowId, StringComparison.Ordinal)) @@ -3790,7 +3831,7 @@ private void MarkWhereTheReaderLeft(TimeSpan away) continue; } - InsertChromeRow(windowId, at, AwayBarRenderer.Bar(missed, away, accent)); + InsertChromeRow(windowId, at, ink => AwayBarRenderer.Bar(missed, away, ink)); var mark = new AwayMark { Index = at, DrawnAfter = _focus.InputCount, DrawnAt = _time.GetUtcNow() }; _awayMarks[windowId] = mark; @@ -3861,7 +3902,8 @@ private void MarkMissedLines(bool reveal) at = Math.Clamp(at, 0, buffer.Count); } - InsertChromeRow(windowId, at, AwayBarRenderer.Missed(buffer.Count - at, FrozenAccentHex())); + var count = buffer.Count - at; + InsertChromeRow(windowId, at, accent => AwayBarRenderer.Missed(count, accent)); var mark = new AwayMark { @@ -4116,9 +4158,13 @@ private void AppendSessionLine(string windowId, StyledLine line, string stamp) else { slots.Sort((a, b) => a.Start.CompareTo(b.Start)); + var cuts = slots.Select(slot => (slot.Start, slot.Columns)).ToArray(); pictures = new PictureSlots( - _formatter.ToMarkupPieces(line, slots.Select(slot => (slot.Start, slot.Columns)).ToArray()), - slots.Select(slot => (slot.Picture, slot.Row, slot.Columns)).ToArray()); + _formatter.ToMarkupPieces(line, cuts), + slots.Select(slot => (slot.Picture, slot.Row, slot.Columns)).ToArray()) + { + Cuts = cuts, + }; foreach (var picture in arrived) { pictures.Draw(picture.Id, picture.Drawn!); @@ -4127,7 +4173,7 @@ private void AppendSessionLine(string windowId, StyledLine line, string stamp) markup = pictures.Compose(); } - AppendWindowLine(windowId, markup, stamp, anchor, pictures); + AppendWindowLine(windowId, markup, stamp, anchor, pictures, line); IGraphicsProtocol? Kitty() => WebGraphicsSurface().CanPlaceKitty ? _system.ConsoleDriver as IGraphicsProtocol : null; if (anchor != 0) @@ -4215,7 +4261,7 @@ private void PlaceInlinePicture(string windowId, long anchor, InlinePictureLine // picture by its name. if (first && empty) { - buffer[at] = buffer[at] with { Markup = rows[0] }; + buffer[at] = buffer[at] with { Markup = rows[0], Source = null }; InsertImageRows(windowId, anchor, rows.Skip(1).ToArray(), repaint: true); } else if (empty && at + 1 < buffer.Count && buffer[at + 1].ImageAnchor == -anchor) @@ -4223,13 +4269,13 @@ private void PlaceInlinePicture(string windowId, long anchor, InlinePictureLine // The last label of a line holding only pictures, with the earlier ones already under it. This // picture cannot take the line, or it would sit above them; the first row under the line moves // up into it instead, so no blank row is left above the pictures. - buffer[at] = buffer[at] with { Markup = buffer[at + 1].Markup }; + buffer[at] = buffer[at] with { Markup = buffer[at + 1].Markup, Source = buffer[at + 1].Source }; RemoveChromeRow(windowId, at + 1); InsertImageRows(windowId, anchor, rows, repaint: true); } else { - buffer[at] = buffer[at] with { Markup = _formatter.ToMarkup(rest) }; + buffer[at] = buffer[at] with { Markup = _formatter.ToMarkup(rest), Source = rest }; InsertImageRows(windowId, anchor, rows, repaint: true); } } @@ -4577,7 +4623,7 @@ private void InsertImageRows(string windowId, long anchor, IReadOnlyList /// The row carries no plain text, so a search cannot find it (see ). /// /// - private void InsertChromeRow(string windowId, int at, string markup) + private void InsertChromeRow(string windowId, int at, Func bar) { if (!_lines.TryGetValue(windowId, out var buffer)) { @@ -4585,7 +4631,7 @@ private void InsertChromeRow(string windowId, int at, string markup) } at = Math.Clamp(at, 0, buffer.Count); - buffer.Insert(at, new PaneLine(markup)); + buffer.Insert(at, new PaneLine(bar(FrozenAccentHex()), Bar: bar)); if (_freezePoints.TryGetValue(windowId, out var freeze) && freeze > at) { @@ -4731,7 +4777,7 @@ private void GoToSearchHit(SearchRow row, string query, int ordinal, int total) } var at = Math.Clamp(row.LineIndex, 0, buffer.Count); - InsertChromeRow(row.WindowId, at, SearchBarRenderer.Bar(query, ordinal, total, FrozenAccentHex())); + InsertChromeRow(row.WindowId, at, accent => SearchBarRenderer.Bar(query, ordinal, total, accent)); _searchMark = (row.WindowId, at); RepaintPane(row.WindowId); @@ -6881,6 +6927,14 @@ private void RegisterGlobalShortcuts() action = () => { DisarmPrefix(); return claimed(); }; } + // And every one but ⌥C itself hands the keys back from the sidebar: a chord that opens a surface leaves + // the reader somewhere else, and arrows arriving later must not walk a sidebar nobody is looking at. + if (claim.Modifiers != ConsoleModifiers.Alt || claim.Key != ConsoleKey.C) + { + var claimed = action; + action = () => { LeaveRailKeys(); return claimed(); }; + } + _system.RegisterGlobalShortcut(claim.Modifiers, claim.Key, action); _shortcuts[(claim.Modifiers, claim.Key)] = action; } @@ -7013,6 +7067,12 @@ private void RegisterFocusReportTab() return () => { ShowLayouts(); return true; }; } + // ⌥C moves the keyboard into the connection sidebar, and back. ESC c, like the rest. + if (claim.Key == ConsoleKey.C) + { + return () => { ToggleRailKeys(); return true; }; + } + // ⌥F freezes and resumes the focused pane. It was ⌃F, and moved so that search could have the // chord every reader on every platform reaches for. Same delivery story as ⌥D and ⌥R: ESC + a // printable byte, decoded as that letter with Alt set. @@ -7955,7 +8015,10 @@ internal SidebarModel BuildSidebar() index++; } - return new SidebarModel(worlds, ActiveWindowId(), _railCollapsed); + var sidebar = new SidebarModel(worlds, ActiveWindowId(), _railCollapsed); + return _railCursor is { } cursor && sidebar.NavigableRows().Any(r => SidebarModel.KeyOf(r) == cursor) + ? sidebar with { Cursor = cursor } + : sidebar; } /// @@ -8553,6 +8616,9 @@ private bool RunBuiltInCommand(string id) case "layout:toggle-rail": ToggleRail(); // ⌃B b's fold, and the window sidebar's fold button return true; + case Client.Commands.BuiltInCommands.RailKeysCommand: + ToggleRailKeys(); // ⌥C + return true; case "term:newline": // The same edit Alt+⏎ makes, through the same key table, so the surface cannot drift from // the chord it advertises. @@ -10708,7 +10774,8 @@ private void RefreshPaneFocus() /// private List RenderRailLines() { - return RailRenderer.Render(Drawing(SurfaceCatalog.Sidebar, string.Empty, BuildSidebar()), RailMaxWidth - RailMargin, _ink); + return RailRenderer.Render( + Drawing(SurfaceCatalog.Sidebar, string.Empty, BuildSidebar()), RailMaxWidth - RailMargin, _ink, RailCursorBand()); } /// @@ -11758,6 +11825,13 @@ private bool RouteToInput(ConsoleKeyInfo key) return null; } + // ⌥C put the keys on the connection sidebar: its arrows, ⏎ and Esc come first, and anything else hands + // the keys back and carries on down this chain (SharpMUTermApp.RailKeys.cs). + if (TryRailKey(e)) + { + return null; + } + // A docked composer holding the keyboard takes the keys an editor takes; see HandleComposerKey. if (ArmedComposer() is { } composer) { diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 5592140d..f07a8b45 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -25,7 +25,7 @@ internal static class SnapshotViews "search", "search-regex", "search-all", "search-landed", "activity-bar", "mxp-image", "mxp-figure", "input-selection", "selection", "trigger-builder", "prefix", "prefix-panel", "focus", "focus-moved", "tabs", "tabs-many", - "collapsed", "timestamps", "timestamps-toggled", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", + "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", "welcome", "welcome-connect", "tour", diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs index db436713..62104f46 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs @@ -55,13 +55,33 @@ public class NativeChromeTests : null, }; - private static ChromeOverlay Overlay(Action activate, bool interactive = true, bool collapsed = false, bool prefix = false) => new( + private static ChromeOverlay Overlay(Action activate, bool interactive = true, bool collapsed = false, bool prefix = false) => + Overlay(activate, Sidebar(collapsed), interactive, prefix); + + /// A sidebar with more rows than the window holds: one character with forty windows. + private static SidebarModel LongSidebar(string? cursor = null) => new( + [ + new RailWorld("Aetherfall", "aether.example", 4000, Teal, + [ + new RailCharacter("Corvid", "Aetherfall.Corvid", Connected: true, Active: true, Unread: 0, + [.. Enumerable.Range(1, 40).Select(i => new RailWindow($"Channel {i}", $"spawn:{i}", null, 0, i == 1, false))]), + ]), + ], + "spawn:1", + false, + cursor); + + private static ChromeOverlay Overlay( + Action activate, SidebarModel sidebar, bool interactive = true, bool prefix = false, + Action>? rowMenu = null) => new( HostChrome.HeaderAndRail, interactive, Header(prefix), - Sidebar(collapsed), + sidebar, new ChromePalette("#9d7cff", "#00f5b7", "#00f5b7", "#ffd700", "#00f5b7", "#ffaf00", "#202028", "#18181d", "#e0e0e0"), - activate); + activate, + rowMenu ?? ((_, show) => show(SharpMUTerm.Client.Commands.MenuModel.Empty)), + _ => { }); [Test] public async Task TheHeaderAndTheSidebarSitBesideTheCellsAndNoCellIsUnderThem() @@ -181,6 +201,113 @@ await Assert.That(activated).IsEquivalentTo(new[] await Assert.That(rows).IsEquivalentTo(new[] { RailRowKind.World, RailRowKind.Character, RailRowKind.Window, RailRowKind.Window, RailRowKind.Character }); } + /// + /// More rows than fit scroll under the title, with the wheel and with an overlay bar like the panes': the rows + /// move, the hit areas stay inside the list, and nothing reaches the client. + /// + [Test] + public async Task ALongSidebarScrollsWithTheWheelAndItsBarAndNothingReachesTheClient() + { + var (range, bar, wheeled, firstBefore, firstAfter, hitsInside, dragged, clientSaw) = await Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { }, LongSidebar())); + Drain(); + window.UpdateLayout(); + Drain(); + var clientSaw = 0; + driver.MouseEvent += (_, _, _) => clientSaw++; + var sidebar = layer.Sidebar; + var range = sidebar.ScrollRange; + var bar = sidebar.Bar(); + var firstBefore = sidebar.Rows[0].Kind; + + var middle = sidebar.TranslatePoint(new Point(sidebar.Bounds.Width / 2, sidebar.Bounds.Height / 2), window)!.Value; + window.MouseWheel(middle, new Vector(0, -2)); + Drain(); + var wheeled = sidebar.ScrollOffset; + var firstAfter = sidebar.Rows[0].Kind; + var hitsInside = sidebar.Hits.Where(h => h.Target.StartsWith(CommandIds.WindowPrefix, StringComparison.Ordinal)) + .All(h => h.Area.Top >= bar!.Value.Zone.Top - 0.5 && h.Area.Bottom <= bar.Value.Zone.Bottom + 0.5); + + // Drag the thumb to the bottom of its track. + var thumb = sidebar.Bar()!.Value.Thumb; + var from = sidebar.TranslatePoint(thumb.Center, window)!.Value; + var to = sidebar.TranslatePoint(new Point(thumb.Center.X, sidebar.Bounds.Height), window)!.Value; + window.MouseMove(from); + window.MouseDown(from, MouseButton.Left); + window.MouseMove(to); + window.MouseUp(to, MouseButton.Left); + Drain(); + return (range, bar, wheeled, firstBefore, firstAfter, hitsInside, sidebar.ScrollOffset, clientSaw); + }); + + await Assert.That(range).IsGreaterThan(0); + await Assert.That(bar).IsNotNull(); + await Assert.That(wheeled).IsGreaterThan(0).Because("the wheel scrolls the rows"); + await Assert.That(firstBefore).IsEqualTo(RailRowKind.World); + await Assert.That(firstAfter).IsNotEqualTo(RailRowKind.World).Because("the world row scrolled out of the list"); + await Assert.That(hitsInside).IsTrue().Because("a row half under the title is clickable only where it shows"); + await Assert.That(dragged).IsEqualTo(range).Because("the thumb dragged to the end scrolls to the end"); + await Assert.That(clientSaw).IsEqualTo(0); + } + + /// The keyboard's row (⌥C) wears a ring and is scrolled into view, however far down the list it is. + [Test] + public async Task TheKeyboardsRowIsScrolledIntoView() + { + var key = SidebarModel.KeyOf(RailRowKind.Window, CommandIds.Window("spawn:40")); + var (offset, shown) = await Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { }, LongSidebar(key))); + Drain(); + window.UpdateLayout(); + Drain(); + var sidebar = layer.Sidebar; + var row = sidebar.Rows.SingleOrDefault(r => NativeSidebar.KeyOf(r) == key); + return (sidebar.ScrollOffset, row is not null && row.Area.Bottom <= sidebar.Bar()!.Value.Zone.Bottom + 0.5); + }); + + await Assert.That(offset).IsGreaterThan(0); + await Assert.That(shown).IsTrue(); + } + + /// A right click on a row asks the client for that row's menu, by the row's key, and opens it natively. + [Test] + public async Task ARightClickOnARowOpensTheClientsMenuForThatRow() + { + var (asked, opened, entries, clientSaw) = await Run((window, view, layer, driver) => + { + var asked = new List(); + var menu = new SharpMUTerm.Client.Commands.MenuModel([new SharpMUTerm.Client.Commands.MenuEntry("Close this window", "⌃W", "layout:close")]); + ((IPointerPresenter)driver.Pointer).Chrome(Overlay(_ => { }, Sidebar(), rowMenu: (row, show) => + { + asked.Add(row); + show(menu); + })); + Drain(); + window.UpdateLayout(); + Drain(); + var clientSaw = 0; + driver.MouseEvent += (_, _, _) => clientSaw++; + var chat = layer.Sidebar.Rows.Single(r => r.Window?.Id == "spawn:2"); + var centre = layer.Sidebar.TranslatePoint(chat.Area.Center, window)!.Value; + window.MouseMove(centre); + window.MouseDown(centre, MouseButton.Right); + window.MouseUp(centre, MouseButton.Right); + Drain(); + var opened = layer.Sidebar.OpenedMenu; + var entries = opened?.Items.OfType().Count() ?? 0; + opened?.Close(); + Drain(); + return (asked, opened is not null, entries, clientSaw); + }); + + await Assert.That(asked).IsEquivalentTo(new[] { SidebarModel.KeyOf(RailRowKind.Window, CommandIds.Window("spawn:2")) }); + await Assert.That(opened).IsTrue(); + await Assert.That(entries).IsEqualTo(1); + await Assert.That(clientSaw).IsEqualTo(0); + } + [Test] public async Task APressOnTheCellsLandsOnTheCellUnderThePointerPastTheChrome() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index abcfbce5..9f4bc24b 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -11,6 +11,7 @@ using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; using SharpMUTerm.Tui; using SharpMUTerm.Tui.Panels; @@ -235,6 +236,20 @@ await Same("sidebar: window", "layout-combat", await Same("sidebar: add a game", "layout-combat", (app, _) => app.ActivateChromeTarget(SidebarModel.AddGameTarget), (app, _) => app.DispatchCommand(SidebarModel.AddGameTarget)); + + // Sidebar: a window row's menu, Close this window — the row is brought forward, then ⌃W's command runs. + await Same("sidebar: row menu", "layout-combat", + (app, _) => + { + var target = OtherWindow(app); + var menu = app.SidebarRowMenu(SidebarModel.KeyOf(RailRowKind.Window, target)); + app.RunSidebarMenuEntry(menu.Entries.Single(e => e.Command == "layout:close").Command!); + }, + (app, _) => + { + app.DispatchRailTarget(OtherWindow(app)); + app.DispatchCommand("layout:close"); + }); probed.Add(SurfaceCatalog.Sidebar); // The folded rail: the strip's fold button, and the ⌃P command beside ⌃B b. diff --git a/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs b/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs index 81a7e2ed..273922d5 100644 --- a/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs @@ -161,6 +161,21 @@ public async Task EnterOnAThemeUsesItAndSavesOnce() await Assert.That(saves()).IsEqualTo(1); } + /// Space on a theme row is ⏎, as it is the commit on a checkbox row: the cursor already previews. + [Test] + public async Task SpaceOnAThemeUsesItAsEnterDoes() + { + var (app, config, saves) = App(); + app.DispatchCommand("screen:textansi"); + Key(app, ConsoleKey.DownArrow); + Key(app, ConsoleKey.Spacebar, ' '); + + await Assert.That(config.ThemeName).IsEqualTo("Light"); + await Assert.That(app.ThemeName).IsEqualTo("Light"); + await Assert.That(saves()).IsEqualTo(1); + await Assert.That(app.SettingsOpenKey).IsNotNull(); + } + [Test] public async Task F7OpensWithTheCursorOnTheThemeInForce() { diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index 36a6b72d..bbd0c3b4 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -46,7 +46,7 @@ public class FrameContrastTests // The selection band is the one plane this client invents rather than derives from a pane, and // its ink replaces the world's own colour on every selected cell — so it is the pair with the // most to lose from a theme it was not measured against. - "selection", "input-selection", "menu-fuzzy", "menu-recent", + "selection", "input-selection", "rail-keys", "menu-fuzzy", "menu-recent", // The split-scrollback band (the notice ink on a pane) and the reflowed room, whose two blocks carry // dim labels and the world's own text. diff --git a/tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs b/tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs new file mode 100644 index 00000000..b6f09dca --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs @@ -0,0 +1,164 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// ⌥C puts a cursor on the connection sidebar: ↑↓ Home End walk it, ⏎ goes where a click on the row goes, Esc and +/// ⌥C hand the keys back, and any other key does too and then does what it does on the command line. The cursor is +/// client state on the shared , so the cell rail draws it as a band and the window's +/// sidebar as a ring. Also the row menu both hosts open on a right click: registry commands only. +/// +/// Serialised: rendering redirects the process-global Console.Out. +[NotInParallel] +public class RailKeysTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static ConsoleKeyInfo Key(ConsoleKey key, char c = '\0', bool alt = false) => new(c, key, false, alt, false); + + private static readonly ConsoleKeyInfo AltC = Key(ConsoleKey.C, 'c', alt: true); + + private static async Task App(string? view = "characters") + { + Console.SetIn(TextReader.Null); + var app = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(new HeadlessConsoleDriver(120, 34), Caps)); + app.RenderSnapshot(view); + await Task.CompletedTask; + return app; + } + + [Test] + public async Task AltCPutsTheCursorOnTheWindowInFrontAndAltCTakesItOff() + { + await using var app = await App(); + var front = SidebarModel.KeyOf(RailRowKind.Window, CommandIds.Window(app.ActiveWindowId())); + + app.SimulateKey(AltC); + await Assert.That(app.RailKeysActive).IsTrue(); + await Assert.That(app.RailCursor).IsEqualTo(front); + await Assert.That(app.BuildChromeOverlay().Sidebar.Cursor).IsEqualTo(front).Because("the window's sidebar reads the same model"); + + app.SimulateKey(AltC); + await Assert.That(app.RailKeysActive).IsFalse(); + await Assert.That(app.BuildChromeOverlay().Sidebar.Cursor).IsNull(); + } + + [Test] + public async Task TheArrowsWalkTheRowsAClickWouldReachAndStopAtTheEnds() + { + await using var app = await App(); + var rows = app.BuildChromeOverlay().Sidebar.NavigableRows().Select(SidebarModel.KeyOf).ToList(); + app.SimulateKey(AltC); + + app.SimulateKey(Key(ConsoleKey.Home)); + await Assert.That(app.RailCursor).IsEqualTo(rows[0]); + app.SimulateKey(Key(ConsoleKey.UpArrow)); + await Assert.That(app.RailCursor).IsEqualTo(rows[0]).Because("clamped, not wrapped"); + app.SimulateKey(Key(ConsoleKey.DownArrow)); + await Assert.That(app.RailCursor).IsEqualTo(rows[1]); + app.SimulateKey(Key(ConsoleKey.End)); + await Assert.That(app.RailCursor).IsEqualTo(rows[^1]); + app.SimulateKey(Key(ConsoleKey.DownArrow)); + await Assert.That(app.RailCursor).IsEqualTo(rows[^1]); + } + + [Test] + public async Task EnterGoesWhereAClickOnTheRowGoesAndHandsTheKeysBack() + { + await using var app = await App(); + var before = app.ActiveWindowId(); + var target = app.BuildChromeOverlay().Sidebar.NavigableRows() + .Last(r => r.Kind == RailRowKind.Window && r.Target != CommandIds.Window(before) && !r.Closed).Target!; + + app.SimulateKey(AltC); + app.SimulateKey(Key(ConsoleKey.End)); + while (app.RailCursor != SidebarModel.KeyOf(RailRowKind.Window, target)) + { + app.SimulateKey(Key(ConsoleKey.UpArrow)); + } + + app.SimulateKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(app.RailKeysActive).IsFalse(); + await Assert.That(CommandIds.Window(app.ActiveWindowId())).IsEqualTo(target); + } + + [Test] + public async Task EscReturnsAndATypedKeyReturnsAndIsTyped() + { + await using var app = await App(); + var draft = app.PrimaryInputText; + app.SimulateKey(AltC); + app.SimulateKey(Key(ConsoleKey.Escape, '\u001b')); + await Assert.That(app.RailKeysActive).IsFalse(); + await Assert.That(app.PrimaryInputText).IsEqualTo(draft); + + app.SimulateKey(AltC); + app.SimulateKey(Key(ConsoleKey.L, 'l')); + await Assert.That(app.RailKeysActive).IsFalse(); + await Assert.That(app.PrimaryInputText).IsEqualTo(draft + "l").Because("a reader who starts typing is never stuck"); + } + + /// The cell rail draws the cursor as a band on its row, padded to the rail's width: no cell is spent. + [Test] + public async Task TheCellRailBandsTheCursorRowAndMovesNoPane() + { + await using var app = await App(); + var rects = app.PaneOutputRects().ToDictionary(p => p.Key, p => p.Value); + var widths = app.RailLines.Select(SharpMUTermApp.MarkupWidth).ToList(); + + app.SimulateKey(AltC); + + var lines = app.RailLines; + await Assert.That(lines.Count(l => System.Text.RegularExpressions.Regex.IsMatch(l, "^\\[#[0-9a-f]{6} on #"))).IsEqualTo(1); + await Assert.That(lines.Select(SharpMUTermApp.MarkupWidth).Max()).IsEqualTo(widths.Max()); + await Assert.That(app.PaneOutputRects()).IsEquivalentTo(rects); + } + + [Test] + public async Task TheRowMenuOffersOnlyRegistryCommandsWithTheirKeys() + { + await using var app = await App(); + foreach (var row in app.BuildChromeOverlay().Sidebar.NavigableRows()) + { + var menu = app.SidebarRowMenu(SidebarModel.KeyOf(row)); + foreach (var id in menu.Commands()) + { + await Assert.That(app.Contributions.Commands.Resolve(id) is not null || id == row.Target).IsTrue().Because(id); + } + } + + var character = app.BuildChromeOverlay().Sidebar.NavigableRows().First(r => r.Kind == RailRowKind.Character); + var labels = app.SidebarRowMenu(SidebarModel.KeyOf(character)).Entries.Select(e => e.Label).ToList(); + await Assert.That(labels.Any(l => l.Contains("in F5", StringComparison.Ordinal))).IsTrue(); + await Assert.That(labels.Any(l => l is "Connect" or "Disconnect")).IsTrue(); + } + + [Test] + public async Task AnEntryTheMenuNeverOfferedIsRefused() + { + await using var app = await App(); + var window = app.BuildChromeOverlay().Sidebar.NavigableRows().First(r => r.Kind == RailRowKind.Window); + app.SidebarRowMenu(SidebarModel.KeyOf(window)); + + await Assert.That(app.RunSidebarMenuEntry("app:quit")).IsFalse(); + await Assert.That(app.LastNotice).Contains("never offered"); + } + + [Test] + public async Task AnEntryBringsItsRowForwardFirst() + { + await using var app = await App(); + var settings = app.BuildChromeOverlay().Sidebar.NavigableRows().First(r => r.Kind == RailRowKind.Character); + var menu = app.SidebarRowMenu(SidebarModel.KeyOf(settings)); + var edit = menu.Entries.First(e => e.Label.Contains("in F5", StringComparison.Ordinal)).Command!; + + await Assert.That(app.RunSidebarMenuEntry(edit)).IsTrue(); + await Assert.That(app.OpenSettingsKey).IsNotNull(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs index c5b4e5db..ba737b24 100644 --- a/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SnapshotViewEmptyConfigTests.cs @@ -37,7 +37,7 @@ public class SnapshotViewEmptyConfigTests /// private static readonly string[] Views = [ - "collapsed", "prefix", "prefix-panel", "timestamps", "timestamps-toggled", "spawn", "split", + "collapsed", "prefix", "prefix-panel", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "spawn", "split", "focus", "focus-moved", "freeze", "freeze-scrollback", "move", "drag", "scrollback", "scrollback-up", "scrollback-split", "reflow", "away", "away-scrollback", "links", "web", "rail-long", "history", "history-search", "history-search-filter", "draft", "draft2", "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "notices", "quit", diff --git a/tests/SharpMUTerm.Tui.Tests/ThemeRepaintTests.cs b/tests/SharpMUTerm.Tui.Tests/ThemeRepaintTests.cs new file mode 100644 index 00000000..f3169a81 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/ThemeRepaintTests.cs @@ -0,0 +1,247 @@ +using System.Diagnostics; +using SharpConsoleUI.Drivers; +using SharpConsoleUI.Parsing; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A theme change repaints the history. A line's colours are resolved against the reading plane of the theme in +/// force (, ), and a pane line used to be held as that markup +/// alone, so after Dark → Light every old line kept greys and whites lifted for a dark plane — faint, or white on +/// near-white, until it scrolled away. Each world line is now kept beside its markup (PaneLine.Source) and +/// formatted again on the switch, in place, so nothing indexing a buffer moves. +/// +/// Serialised: rendering redirects the process-global Console.Out. +[NotInParallel] +public class ThemeRepaintTests +{ + private const int Width = 120; + private const int Height = 32; + private const string Main = "main"; + private const string Bright = "the beacon burns a pale white"; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + [Test] + public async Task AfterASwitchToLightAnOldLinesCellsClearTheFloorOnTheNewPane() + { + var world = await Connected(); + world.Receive($"\u001b[97m{Bright}\u001b[0m\n"); + world.Receive("\u001b[37mand the grey stones answer it\u001b[0m\n"); + + // On Dark the bright white is legible as it is; on Light it is the colour of the paper. + await Assert.That(WorstRatio(world.App, Bright)).IsGreaterThanOrEqualTo(Contrast.Floor - 0.05); + + SwitchTo(world.App, "Light"); + + await Assert.That(world.App.ThemeName).IsEqualTo("Light"); + await Assert.That(WorstRatio(world.App, Bright)).IsGreaterThanOrEqualTo(Contrast.Floor - 0.05); + await Assert.That(WorstRatio(world.App, "the grey stones answer it")).IsGreaterThanOrEqualTo(Contrast.Floor - 0.05); + } + + /// The line's markup after the switch is exactly what a line arriving under Light would get. + [Test] + public async Task AnOldLineIsFormattedAsANewLineWouldBe() + { + var world = await Connected(); + world.Receive($"\u001b[97m{Bright}\u001b[0m\n"); + SwitchTo(world.App, "Light"); + world.Receive($"\u001b[97m{Bright}\u001b[0m\n"); + + var rows = world.App.PaneLines(Main).Where(r => r.Contains(Bright, StringComparison.Ordinal)).ToList(); + await Assert.That(rows.Count).IsEqualTo(2); + await Assert.That(rows[0]).IsEqualTo(rows[1]); + } + + [Test] + public async Task ALinkStillClicksAfterTheSwitch() + { + var world = await Connected(); + world.Receive("\u001b[97mthe notice board:\u001b[0m https://example.org/board\n"); + SwitchTo(world.App, "Light"); + + await Assert.That(Click(world, "https://example.org/board")).IsTrue(); + await Assert.That(world.Opened).IsEquivalentTo(new[] { "https://example.org/board" }); + } + + /// + /// A bar is a row of the buffer: the switch replaces rows in place, so the away bar is at the same index, with + /// the same lines either side of it, and drawn in the new theme's accent. + /// + [Test] + public async Task TheAwayBarStaysWhereItWasAndTakesTheNewAccent() + { + var world = await Connected(); + world.Receive("\u001b[37mbefore you left\u001b[0m\n"); + world.App.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.LeftArrow, false, false, false)); + world.Receive("\u001b[97mwhile you were away\u001b[0m\n"); + world.App.SimulateReturnFromAway(TimeSpan.FromMinutes(12)); + world.App.RenderNextFrame(); + + var index = world.App.AwayBarIndex(Main); + await Assert.That(index).IsNotNull(); + var before = world.App.PaneLines(Main); + var barBefore = before[index!.Value]; + + SwitchTo(world.App, "Light"); + + var after = world.App.PaneLines(Main); + await Assert.That(world.App.AwayBarIndex(Main)).IsEqualTo(index); + await Assert.That(after.Count).IsEqualTo(before.Count); + await Assert.That(after[index.Value - 1]).Contains("before you left"); + await Assert.That(after[index.Value]).Contains(AwayBarRenderer.Label); + await Assert.That(after[index.Value + 1]).Contains("while you were away"); + await Assert.That(after[index.Value]).IsNotEqualTo(barBefore); + } + + /// Only colours change, so a selection made before the switch still names the same text. + [Test] + public async Task ASelectionSurvivesTheSwitch() + { + Console.SetIn(TextReader.Null); + var copied = new List(); + var config = DemoScene.Build(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height), clipboard: copied.Add); + app.RenderSnapshot(); + app.SimulatePaneDrag(SharpMUTermApp.MainWindowId, 0, 0, 25, 1); + var selected = app.PaneSelection(SharpMUTermApp.MainWindowId); + await Assert.That(selected).IsNotEmpty(); + + SwitchTo(app, "Light"); + app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.C, shift: false, alt: false, control: true)); + + await Assert.That(copied).HasSingleItem(); + await Assert.That(copied[0]).IsEqualTo(selected); + } + + /// + /// What the repaint costs: a window at the pane cap (2,000 lines), restyled and re-fed, and what keeping the + /// lines costs. Held to generous ceilings so a slow CI box passes; the measured figures are in CLAUDE.md. + /// + [Test] + public async Task RestylingAFullWindowIsBounded() + { + var world = await Connected(); + var text = Enumerable.Range(0, 2000) + .Select(i => $"\u001b[3{i % 8}mline {i} the courier \u001b[1mruns on past\u001b[0m the northern watch, {i % 7} leagues out\n") + .ToArray(); + foreach (var line in text) + { + world.Telnet.Receive(line); + } + + world.App.RenderNextFrame(); + var clock = Stopwatch.StartNew(); + SwitchTo(world.App, "Light"); + clock.Stop(); + + // What 2,000 such lines weigh as StyledLines, the most a window can add by keeping them (a session window's + // are the very instances its scrollback ring already holds, so there it is a reference per line). + var parser = new AnsiParser(); + var before = GC.GetTotalMemory(forceFullCollection: true); + var kept = text.SelectMany(parser.Feed).ToList(); + var after = GC.GetTotalMemory(forceFullCollection: true); + Console.Error.WriteLine( + $"theme switch over 2000 lines: {clock.ElapsedMilliseconds} ms; 2000 StyledLines: {(after - before) / 1024} KiB"); + GC.KeepAlive(kept); + + await Assert.That(kept.Count).IsEqualTo(2000); + await Assert.That(clock.Elapsed).IsLessThan(TimeSpan.FromSeconds(5)); + await Assert.That(after - before).IsLessThan(4L * 1024 * 1024); + } + + // ---- Harness --------------------------------------------------------------------------- + + private static void SwitchTo(SharpMUTermApp app, string theme) + { + ThemeChoices.Apply(app.Configuration, theme); + app.SaveConfiguration(); + app.RenderNextFrame(); + } + + /// The lowest contrast any visible cell of has against its own background. + private static double WorstRatio(SharpMUTermApp app, string text) + { + var frame = app.RenderWholeFrame(); + var cells = FrameGrid.Cells(frame, Width, Height); + var rows = FrameGrid.Decode(frame, Width, Height); + var worst = double.MaxValue; + var found = false; + for (var row = 0; row < rows.Count; row++) + { + var at = rows[row].IndexOf(text, StringComparison.Ordinal); + if (at < 0) + { + continue; + } + + found = true; + for (var col = at; col < at + text.Length; col++) + { + var cell = cells[(row, col)]; + if (cell.Glyph == ' ' || cell.Foreground is not { } fg || cell.Background is not { } bg) + { + continue; + } + + worst = Math.Min(worst, Contrast.Ratio(fg, bg)); + } + } + + if (!found) + { + throw new InvalidOperationException($"'{text}' is not on the frame:\n{string.Join('\n', rows)}"); + } + + return worst; + } + + private sealed record Wired(SharpMUTermApp App, RecordingTelnetSession Telnet, List Opened) + { + public void Receive(string text) + { + Telnet.Receive(text); + App.RenderNextFrame(); + } + } + + private static async Task Connected() + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + config.ScrollbackSpill.Enabled = false; + config.Text.ActivityBarSeconds = 0; + config.Worlds.Add(new WorldDefinition { Name = "Beacon", Host = "beacon.example.org", Port = 4000 }); + + var opened = new List(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height), openUrl: opened.Add); + var telnet = new RecordingTelnetSession(); + app.TelnetFactory = _ => telnet; + await app.BindWorldWithoutConnecting(config.Worlds[0]).ConnectAsync(); + app.RenderNextFrame(); + return new Wired(app, telnet, opened); + } + + private static bool Click(Wired world, string text) + { + var lines = world.App.PaneLines(Main); + for (var row = 0; row < lines.Count; row++) + { + MarkupParser.Parse(lines[row], SharpConsoleUI.Color.White, SharpConsoleUI.Color.Black, out var links); + foreach (var link in links) + { + if (link.Text.Contains(text, StringComparison.Ordinal)) + { + return world.App.SimulatePaneClick(Main, link.StartCol, row); + } + } + } + + throw new InvalidOperationException($"no link reading '{text}'"); + } +} From ee679308f76cff10c33116cfa2224664c01d9294 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 08:18:41 +0000 Subject: [PATCH 030/113] feat(window): the composer is a native editor in the desktop window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit F1 opens a native TextBox editor over the cell area and the docked composer is a native editor over its pane, both drawn from one Client ComposerModel (target, draft, escaping, MOO edit, dictionary, marks as ranges, key row) that the cell composers now render from too. Gestures go back through a ComposerSession to the methods the cell keys end in, so ⌃S sends the same command (ComposeMessage.Build) and a MOO edit saves its lines. Misspellings get a real wavy underline from the same SpellChecker, with suggestions and Add to dictionary in the right-click menu. New host member ClientHost.NativeComposer (INativeComposer); the terminal, headless and snapshot hosts pass null. Declared in the surface catalog (compose, composer) with model comparison and wire-level outcome probes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 52 +- .../AvaloniaConsoleDriver.cs | 3 + src/SharpMUTerm.Avalonia/ClientLaunch.cs | 7 +- src/SharpMUTerm.Avalonia/ComposerEditor.cs | 179 +++++ src/SharpMUTerm.Avalonia/ComposerOverlay.cs | 66 ++ src/SharpMUTerm.Avalonia/ComposerPresenter.cs | 90 +++ src/SharpMUTerm.Avalonia/ComposerView.cs | 627 ++++++++++++++++++ src/SharpMUTerm.Avalonia/DesktopLayer.cs | 28 + src/SharpMUTerm.Avalonia/MainWindow.cs | 9 +- src/SharpMUTerm.Avalonia/TerminalView.cs | 2 +- src/SharpMUTerm.Avalonia/WindowHost.cs | 4 + .../Composer/ComposerModel.cs | 235 +++++++ .../Composer/ComposerSession.cs | 160 +++++ .../Surfaces/SurfaceCatalog.cs | 45 ++ src/SharpMUTerm.Core/Text/SpellChecker.cs | 48 +- src/SharpMUTerm.Tui/ComposeOverlay.cs | 97 +-- src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 10 + .../Hosting/INativeComposer.cs | 32 + src/SharpMUTerm.Tui/Panels/DockedComposer.cs | 116 +++- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 12 +- .../Pointer/SharpMUTermApp.Chrome.cs | 2 +- .../Pointer/SharpMUTermApp.Desktop.cs | 11 +- .../Pointer/SharpMUTermApp.Surfaces.cs | 1 + src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs | 2 +- .../SharpMUTermApp.NativeComposer.cs | 310 +++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 17 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 26 +- .../NativeComposerTests.cs | 406 ++++++++++++ .../SharpMUTerm.Avalonia.Tests.csproj | 3 + .../SurfaceParityTests.cs | 190 +++++- .../ComposerModelTests.cs | 138 ++++ .../SurfaceCatalogTests.cs | 2 +- .../NativeComposerRoutingTests.cs | 409 ++++++++++++ 34 files changed, 3253 insertions(+), 91 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/ComposerEditor.cs create mode 100644 src/SharpMUTerm.Avalonia/ComposerOverlay.cs create mode 100644 src/SharpMUTerm.Avalonia/ComposerPresenter.cs create mode 100644 src/SharpMUTerm.Avalonia/ComposerView.cs create mode 100644 src/SharpMUTerm.Client/Composer/ComposerModel.cs create mode 100644 src/SharpMUTerm.Client/Composer/ComposerSession.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/INativeComposer.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/ComposerModelTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a258638..af25801f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Desktop window: the composer is a native text editor. F1 opens full screen over the panes and the docked composer + is an editor in its pane, with the platform's selection, undo, input methods and paste, a monospace or proportional + face (right-click), and a wavy red line under a misspelt word whose right-click menu offers suggestions and Add to + dictionary. The draft, Ctrl+S, Alt+L, Alt+W and Esc work exactly as in the terminal, and the same text sends the same + command. - A narrow terminal gives its room to the game: below 100 columns the connection rail folds to its slim strip on its own (in the desktop window, the sidebar does), and below 100 columns or 30 rows an empty command line is one row tall and grows as you type. At 80×24 a pane is now 72 columns wide instead of 60, two rows taller, diff --git a/CLAUDE.md b/CLAUDE.md index c13d83e6..4b6569c7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -737,7 +737,7 @@ fallbacks) for inline images/maps. named only while a dictionary is open. - **Spelling is a colour, not an underline** (`SpellChecker`, Core; `SpellingHighlighter`, Tui). The marks go through `MultilineEditControl.SyntaxHighlighter`, whose tokens carry a foreground and nothing else; - an underline needs a styling hook upstream. Hunspell via WeCantSpell.Hunspell, **no dictionary + an underline needs a styling hook upstream (the window's native editor draws a real one, see below). Hunspell via WeCantSpell.Hunspell, **no dictionary bundled**: `dictionaries/` beside `config.json`, then the system folders, chosen by the POSIX locale variables — not `CultureInfo`, because the build is `InvariantGlobalization` and every culture is the invariant one. The dictionary is opened the first time F1 opens, never at startup, and the app takes a @@ -1092,7 +1092,7 @@ fallbacks) for inline images/maps. target fit as name-over-bar, else side by side, where the words shrink (`Mana · low 23 / 120`, then `mp! 23/120`, then `mp 23`) before a bar goes under 24 px. The UI font, not the cell font: this is the window's presentation. `hp`/`mp`/`mv` read as Health/Mana/Movement (`VitalsMeter.Title`). - - **Not done**: the docked composer is still cells in the window; no animation on a + - **Not done**: no animation on a gauge change; the map draws one level and area (other levels show only as stairs marks, other areas only as a coloured spur), with no room symbols beyond the game's own; the button's icon is the only header action. The window's menu is Avalonia's `ContextMenu`, which needs a second click under a WM-less X server to take the first item (seen under Xvfb only). @@ -1253,7 +1253,7 @@ one `SharpMUTermApp`; a host is only the place it runs. What differs between hos (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it -draws ⌃P natively (`INativePalette`, null for the cell popup), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until @@ -1730,6 +1730,52 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] - **Hover selects on movement only** (`PointerMoved`, not `PointerEntered`), so the row that opens under a resting pointer is not chosen. ↑↓ wrap as in the cells; PgUp/PgDn stop at the ends. - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave5/native-palette-*.png`). +- **In the window, the composer is a native editor: F1 over the cells, and the docked panel over its pane** + (`ClientHost.NativeComposer` → `INativeComposer`; Client `ComposerModel`, `ComposerMarks`, `ComposerSession`; + Avalonia `ComposerView`, `ComposerEditor`, `ComposerOverlay`, `ComposerPresenter` on the driver; + `SharpMUTermApp.NativeComposer.cs`). A `TextBox`: wrapping, undo and redo, selection, IME, paste and the platform's + caret, with a monospace face by default and a proportional one from its right-click menu (for the run). Decisions + not to relitigate: + - **One model, both hosts.** `ComposerModel` (target, draft, escaping, MOO edit, dictionary, marks as ranges, the + key row) is what the cell F1 (`ComposeOverlay.Render(model)`), the cell panel (`DockedComposer.Render(model)`) and + the native views draw. `ComposeOverlay.ModelFor` is the F1 model in both hosts; `DescribeDocked` is the panel's, + recorded as drawn (`SurfaceCatalog.Compose`, `PanelIds.Composer`). The marks are `SpellChecker.Misspellings` per + line, the call the cell highlighter makes, so both hosts mark the same words. + - **F1 goes through one funnel** (`OpenComposer`/`CloseComposer`): the key, ⌃P, a MOO edit arriving and the demo + views. With an available host editor it opens there and the cell modal is never built; `ComposerOpen` (either) + feeds every refusal the cell modal fed (`AnyOverlayOpen`, the quit facts, `MainWindowInFront`, the panes being + covered). Closing keeps the draft through `KeepComposeDraft`, exactly as the cell window's `Closed` does, so a send + still closes first and forgets after. `Available` is false until the main window attaches the presenter, so + `--render-png`, the parity harness and any test without a window get the cells. + - **Every gesture goes back through the session**, on the client's thread (`OnUiThread`): ⌃S to `SendComposed` / + `SendDocked` (a MOO edit saves its lines), ⌥L, ⌥W (the word at the caret, `ComposerMarks.WordAt`), Esc (F1 closes + keeping the draft; the panel releases to the command line), a click (the panel arms, `ArmComposer`). A session the + client has ended passes nothing on. The window never builds a command. + - **The draft is the client's; the editor keeps its own caret.** The host hands its text back as it changes; the + client's text replaces the editor's only when `ComposerModel.Revision` moved — a send clearing it, F1 closing over + the panel, a key the cells took. `DockedComposer.SetFromHost` writes without moving it. + - **The docked editor lies over its cells, which stay the draft** (`CellsUnderNative`): it rides the panel channel + (`PanelOverlay.Composer`/`ComposerSession`) and `DesktopLayer` places it like any panel. It takes the keyboard when + the model says armed and gives it to `TerminalView` when it says not. It hands the client the chords it has no + use for (`ComposerView.ReachesTheClient`: F-keys, ⌃P, ⌃O, ⌃↑/↓, ⌃←/→, ⌥J/K, ⌥digits) through the driver, as its + cells would receive them; ⌃A/C/X/V/Z/Y, word movement and typing stay the editor's. While F1 is open natively the + panels are not published, so F1 is never under a docked editor. + - **F1 is an overlay over the cell area, under the desktop layer**, so the native header and sidebar stay (inert, as + under a modal) and a toast is still seen over it. ⌥⏎ is the window's (it maximises); ⏎, ⌃⏎ and ⇧⏎ are newlines. + ⌃Q in F1 closes it first and then asks to quit, so the cell quit prompt is never hidden under it. + - **The misspelling is a real wavy line**, drawn by a layer over the editor (`ComposerView.MarkLayer`) from the + editor's own text layout (`TextLayout.HitTestTextRange`), so it follows wrapping and scrolling. The right-click menu + offers WeCantSpell's suggestions (`SpellChecker.Suggest`, six at most), Add to dictionary, the editor's edits and the + face. Its colour is the settings screens' warning, which the cell editor marks in (`ComposerInk`). + - **Parity**: `HostParityTests` builds both drivers with no attached presenter, so the cells it compares are the cell + composer's in both. The native side is held by `SurfaceParityTests` instead — F1's model equals the cell window's + for `compose`, `compose-literal` and `moo-edit`, the panel's equals the cells' in `panel-composer`, and ⌃S from the + native session puts the same command on a `RecordingTelnetSession` as the cell keys do, as typed and literal, one + line and several paragraphs. `NativeComposerRoutingTests` (Tui) and `NativeComposerTests` (Avalonia, headless) + drive the routing and the editor. + - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave7/composer-*.png`). `--demo-config` in the + window opens the installed dictionary read-only. Not done: no per-character face choice saved, no find bar, and + the window's ⌥W adds to the run's dictionary in the demo only (a live client writes `user-words.txt` as F1 does). - **Settings screens have no `IPasteTarget` and cannot easily have one.** They are markup rebuilt wholesale every key, with the edited field a buffer in `SettingsSession`. `SettingsOverlay` listens at `IConsoleDriver.Paste` instead. That can't double-fire *only* because no control on diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index e3aa00fb..e67b927d 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -76,6 +76,9 @@ public AvaloniaConsoleDriver(int columns, int rows) /// The window's native ⌃P, drawn over everything in the main window (). public PalettePresenter Palette { get; } = new(); + /// The window's native F1, drawn over the cells in the main window (). + public ComposerPresenter Composer { get; } = new(); + public bool IsRunning { get; private set; } // ── IConsoleDriver: output ──────────────────────────────────────────────────────────────── diff --git a/src/SharpMUTerm.Avalonia/ClientLaunch.cs b/src/SharpMUTerm.Avalonia/ClientLaunch.cs index 31d0e4e6..edfed745 100644 --- a/src/SharpMUTerm.Avalonia/ClientLaunch.cs +++ b/src/SharpMUTerm.Avalonia/ClientLaunch.cs @@ -1,4 +1,5 @@ using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; using SharpMUTerm.Tui; namespace SharpMUTerm.Avalonia; @@ -43,7 +44,11 @@ public static int Run(WindowOptions options, AppConfiguration config, IReadOnlyL /// The demo client, with its --view scene laid out and not yet running. public static SharpMUTermApp Demo(WindowOptions options, AppConfiguration config, AvaloniaConsoleDriver driver, Action? clipboard) { - var app = new SharpMUTermApp(config, WindowHost.Create(driver, clipboard, options.Chrome)); + // The installed dictionary, read-only: the demo's ⌥W adds a word for the run and writes no user-words file. + var app = new SharpMUTermApp( + config, + WindowHost.Create(driver, clipboard, options.Chrome), + spelling: () => SpellChecker.Find(SpellChecker.SearchFolders(null), SpellChecker.PreferredLanguage(), null)); // The snapshot's scene builder is the demo: it pours the demo output in and opens the named view. What // it returns is the headless driver's capture, which on this driver is empty and not wanted. It is queued diff --git a/src/SharpMUTerm.Avalonia/ComposerEditor.cs b/src/SharpMUTerm.Avalonia/ComposerEditor.cs new file mode 100644 index 00000000..840110b6 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ComposerEditor.cs @@ -0,0 +1,179 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Presenters; +using Avalonia.Controls.Primitives; +using Avalonia.Media; +using SharpMUTerm.Client.Composer; + +namespace SharpMUTerm.Avalonia; + +/// +/// The composer's text: a native — wrapping, undo and redo, selection, the platform's IME and +/// paste — that draws a wavy underline under each word the dictionary does not know. The underline is drawn over the +/// text from the box's own layout (), so it follows wrapping, scrolling and the +/// face exactly; the ranges are , the function the client marks its cells by. +/// +/// Lines are broken by \n whatever the platform (), so an offset into +/// is an offset into the client's buffer and a mark lands on the word it names. +/// +/// +internal sealed class ComposerEditor : TextBox +{ + private TextPresenter? _presenter; + private ScrollViewer? _scroller; + private IReadOnlyList _marks = []; + + public ComposerEditor() + { + AcceptsReturn = true; + AcceptsTab = false; + TextWrapping = TextWrapping.Wrap; + NewLine = "\n"; + BorderThickness = new Thickness(0); + Padding = new Thickness(12, 10); + MinHeight = 0; + ClipToBounds = true; + } + + /// The TextBox's own look: this is a text box, not a new control to style. + protected override Type StyleKeyOverride => typeof(TextBox); + + /// The wavy line's colour. + public Color MarkColour { get; set; } = Color.FromRgb(0xff, 0x6b, 0x6b); + + /// The words underlined now, as ranges of . + public IReadOnlyList Marks + { + get => _marks; + set + { + if (!_marks.SequenceEqual(value)) + { + _marks = value; + MarksMoved?.Invoke(); + } + } + } + + protected override void OnApplyTemplate(TemplateAppliedEventArgs e) + { + base.OnApplyTemplate(e); + if (_scroller is not null) + { + _scroller.ScrollChanged -= OnScrolled; + } + + _presenter = e.NameScope.Find("PART_TextPresenter"); + _scroller = e.NameScope.Find("PART_ScrollViewer"); + if (_scroller is not null) + { + _scroller.ScrollChanged += OnScrolled; + } + + if (_presenter is not null) + { + _presenter.LayoutUpdated += (_, _) => MarksMoved?.Invoke(); + } + } + + private void OnScrolled(object? sender, ScrollChangedEventArgs e) => MarksMoved?.Invoke(); + + /// Raised when the marks, or where the text lies, changed: the layer drawing the lines repaints. + public event Action? MarksMoved; + + /// The box's own text layout, for a test and the context menu; null before the template is applied. + internal TextPresenter? Presenter => _presenter; + + /// The offset into at a point in this control's coordinates, or null. + internal int? OffsetAt(Point point) + { + if (_presenter is not { TextLayout: { } layout } presenter || this.TranslatePoint(point, presenter) is not { } at) + { + return null; + } + + var hit = layout.HitTestPoint(at); + return Math.Clamp(hit.TextPosition + (hit.IsTrailing ? 1 : 0), 0, (Text ?? string.Empty).Length); + } + + /// + /// The rectangles each mark covers, in this control's coordinates, clipped to what is in view: one per line a + /// wrapped word lands on. Empty before the template is applied. + /// + public IReadOnlyList MarkRects() + { + if (_presenter is not { } presenter || _marks.Count == 0 || presenter.TextLayout is not { } layout) + { + return []; + } + + var text = Text ?? string.Empty; + var view = new Rect(Bounds.Size); + var rects = new List(); + foreach (var mark in _marks) + { + if (mark.Start < 0 || mark.Start + mark.Length > text.Length || mark.Length <= 0) + { + continue; + } + + foreach (var hit in layout.HitTestTextRange(mark.Start, mark.Length)) + { + if (presenter.TranslatePoint(hit.TopLeft, this) is { } at) + { + var rect = new Rect(at, hit.Size); + if (rect.Intersects(view)) + { + rects.Add(rect); + } + } + } + } + + return rects; + } + + /// + /// Draws the wavy lines onto . A paints its text and its own + /// background in children of its template, which are drawn after anything the box itself draws, so the lines are + /// drawn by a layer lying over the editor (), which calls this. + /// + public void DrawMarks(DrawingContext context, Visual surface) + { + var rects = MarkRects(); + if (rects.Count == 0) + { + return; + } + + var pen = new Pen(new SolidColorBrush(MarkColour), 1.2, lineCap: PenLineCap.Round); + foreach (var rect in rects) + { + if (this.TranslatePoint(rect.BottomLeft, surface) is not { } origin) + { + continue; + } + + var y = origin.Y - 1.5; + var geometry = new StreamGeometry(); + using (var g = geometry.Open()) + { + const double step = 2.0; + var x = origin.X; + var end = origin.X + rect.Width; + g.BeginFigure(new Point(x, y), false); + var up = true; + while (x < end) + { + x = Math.Min(end, x + step); + g.LineTo(new Point(x, up ? y - 1.6 : y)); + up = !up; + } + + g.EndFigure(false); + } + + context.DrawGeometry(null, pen, geometry); + } + } +} diff --git a/src/SharpMUTerm.Avalonia/ComposerOverlay.cs b/src/SharpMUTerm.Avalonia/ComposerOverlay.cs new file mode 100644 index 00000000..e3f24ee6 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ComposerOverlay.cs @@ -0,0 +1,66 @@ +using Avalonia.Controls; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// F1 drawn by the window: a over the whole cell area, in the theme's own colours, in place +/// of the cell modal. The native header and sidebar stay where they are (inert while it is up, as under any modal); +/// the toasts are drawn over it, so a refusal is still seen. It follows its : the client +/// publishes a new model when the escaping flips or a word is added, and that is all it ever redraws from. +/// +internal sealed class ComposerOverlay : Border +{ + private readonly TerminalView _view; + private readonly ComposerSession _session; + private readonly PanelInk _ink; + private readonly ComposerView _composer; + + public ComposerOverlay(TerminalView view, ComposerSession session, PanelInk ink) + { + _view = view; + _session = session; + _ink = ink; + Focusable = false; + Margin = view.Margin; + _composer = new ComposerView(view, fullScreen: true); + Child = _composer; + _session.Changed += OnChanged; + _view.PropertyChanged += OnViewChanged; + Show(_session.Model); + } + + /// The session it draws. Internal for tests. + internal ComposerSession Session => _session; + + /// The editor and its bands. Internal for tests. + internal ComposerView Composer => _composer; + + /// Stops following the session and the view; the presenter calls it when the overlay goes. + internal void Detach() + { + _session.Changed -= OnChanged; + _view.PropertyChanged -= OnViewChanged; + } + + private void OnChanged(ComposerModel model) => Dispatcher.UIThread.Post(() => Show(model)); + + private void OnViewChanged(object? sender, global::Avalonia.AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == MarginProperty) + { + Margin = _view.Margin; + } + } + + private void Show(ComposerModel model) + { + var plane = DesktopLayer.Colour(_view.Renderer.DefaultBackground); + var text = DesktopLayer.Colour(_view.Renderer.DefaultForeground); + Background = new SolidColorBrush(plane); + _composer.Show(model, _session, _ink, plane, text); + } +} diff --git a/src/SharpMUTerm.Avalonia/ComposerPresenter.cs b/src/SharpMUTerm.Avalonia/ComposerPresenter.cs new file mode 100644 index 00000000..a1f7a80c --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ComposerPresenter.cs @@ -0,0 +1,90 @@ +using Avalonia.Controls; +using Avalonia.Threading; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window host's : F1 as a over the cell area, under +/// the desktop layer (so the toasts are drawn over it) and over the cells. The client calls in on its own thread, so +/// everything here is posted to the window's. A host never attached — --render-png, a test that builds no +/// window — is not , and the client opens its cell composer instead. +/// +internal sealed class ComposerPresenter : INativeComposer +{ + private volatile bool _attached; + private Panel? _root; + private Control? _below; + private TerminalView? _view; + private Action? _refocus; + private ComposerOverlay? _overlay; + + /// The open F1, for a test; read on the window's thread. + public ComposerOverlay? Overlay => _overlay; + + public bool Available => _attached; + + /// + /// Where F1 is drawn: in , just under (the desktop layer), over the + /// cells of ; and what takes the keyboard back when it closes. On the window's thread. + /// + public void Attach(Panel root, Control below, TerminalView view, Action refocus) + { + _root = root; + _below = below; + _view = view; + _refocus = refocus; + _attached = true; + } + + public void Open(ComposerSession session, PanelInk ink) => Dispatcher.UIThread.Post(() => OpenNow(session, ink)); + + public void Close() => Dispatcher.UIThread.Post(CloseNow); + + /// Shows F1 for now, replacing one already open; on the window's thread. + internal ComposerOverlay? OpenNow(ComposerSession session, PanelInk ink) + { + if (_overlay is { } open) + { + Remove(open, refocus: false); + } + + if (_root is not { } root || _view is not { } view || session.IsEnded) + { + return null; + } + + var overlay = new ComposerOverlay(view, session, ink); + _overlay = overlay; + var at = _below is not null ? root.Children.IndexOf(_below) : -1; + root.Children.Insert(at < 0 ? root.Children.Count : at, overlay); + overlay.Composer.Editor.Focus(); + return overlay; + } + + /// Takes F1 down now; on the window's thread. + internal void CloseNow() + { + if (_overlay is { } open) + { + Remove(open, refocus: true); + } + } + + private void Remove(ComposerOverlay overlay, bool refocus) + { + if (!ReferenceEquals(_overlay, overlay)) + { + return; + } + + _overlay = null; + overlay.Detach(); + _root?.Children.Remove(overlay); + if (refocus) + { + _refocus?.Invoke(); + } + } +} diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs new file mode 100644 index 00000000..a51c59ec --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -0,0 +1,627 @@ +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// A composer drawn by the window: a header (what it is, who it goes to, the escaping mode, the dictionary), a native +/// editor (), and the key row — all read off the client's , the +/// model the cell composer is drawn from. Used for the docked panel, over its pane's cells, and for F1, over the whole +/// cell area (). +/// +/// Every gesture goes back through the , so it ends in the client method the cell +/// composer's key ends in: ⌃S sends (or saves a MOO edit), ⌥L flips the escaping, ⌥W adds the word at the caret, Esc +/// releases a docked composer to the command line or closes F1 keeping the draft. The text the editor holds is handed +/// back as it changes; the client's text replaces it only when the model's revision moved, so typing here never has +/// its caret or its undo taken away by its own echo. +/// +/// +/// Arming is the client's one fact. A click in a docked editor asks to arm it, and the editor takes the keyboard +/// when the model says it is armed and gives it back to the cells when the model says it is not. ⌥⏎ is the window's +/// (it maximises), so a newline is ⏎, ⌃⏎ or ⇧⏎ here. Chords the editor has no use for — ⌃P, ⌃O, ⌃↑/⌃↓, ⌥J, the +/// function keys — reach the client from a docked editor exactly as they would from its cells. +/// +/// +internal sealed class ComposerView : Border +{ + private readonly TerminalView _view; + private readonly bool _fullScreen; + private readonly ComposerEditor _editor; + private readonly MarkLayer _marks; + private readonly Border _header; + private readonly TextBlock _title; + private readonly TextBlock _target; + private readonly StackPanel _chips; + private readonly Border _footer; + private readonly WrapPanel _keys; + private readonly Border _rule; + private ComposerSession? _session; + private ComposerModel? _model; + private long _applied = -1; + private bool _applying; + private bool? _armed; + private PanelInk _ink = new("#5fafff", "#ff5f5f", "#3a3a40"); + private Color _plane = Colors.Black; + private Color _text = Colors.White; + + /// The cells: where the keyboard goes back to, and the face the editor's monospace text uses. + /// F1 rather than the docked panel. + public ComposerView(TerminalView view, bool fullScreen) + { + _view = view; + _fullScreen = fullScreen; + ClipToBounds = true; + Focusable = false; + + _editor = new ComposerEditor + { + Background = Brushes.Transparent, + Padding = fullScreen ? new Thickness(22, 14) : new Thickness(12, 6), + }; + AutomationProperties.SetName(_editor, fullScreen ? "Compose a post" : "Docked composer"); + _editor.TextChanged += (_, _) => OnTextChanged(); + _editor.AddHandler(KeyDownEvent, OnEditorKeyDown, RoutingStrategies.Tunnel); + _editor.AddHandler(PointerPressedEvent, (_, _) => AskToArm(), RoutingStrategies.Tunnel, handledEventsToo: true); + _editor.GotFocus += (_, _) => AskToArm(); + _editor.ContextRequested += OnContextRequested; + _marks = new MarkLayer(_editor); + + _title = new TextBlock { FontWeight = FontWeight.Bold, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 10, 0) }; + _target = new TextBlock { VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; + _chips = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, VerticalAlignment = VerticalAlignment.Center }; + var headerRow = new DockPanel { LastChildFill = true }; + DockPanel.SetDock(_title, Dock.Left); + DockPanel.SetDock(_chips, Dock.Right); + headerRow.Children.Add(_title); + headerRow.Children.Add(_chips); + headerRow.Children.Add(_target); + _header = new Border { Child = headerRow, Padding = fullScreen ? new Thickness(22, 10) : new Thickness(12, 3, 8, 3) }; + + _keys = new WrapPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center }; + _footer = new Border { Child = _keys, Padding = fullScreen ? new Thickness(22, 8) : new Thickness(12, 2, 8, 3) }; + + // The armed rule down the docked editor's left edge: the cell composer's ▌ marker, in the accent. + _rule = new Border { Width = 3, HorizontalAlignment = HorizontalAlignment.Left }; + + var body = new Panel(); + body.Children.Add(_editor); + body.Children.Add(_marks); + body.Children.Add(_rule); + + var grid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto") }; + Grid.SetRow(_header, 0); + Grid.SetRow(body, 1); + Grid.SetRow(_footer, 2); + grid.Children.Add(_header); + grid.Children.Add(body); + grid.Children.Add(_footer); + Child = grid; + ApplyFont(); + } + + /// + /// Whether the editors write in the UI's proportional face rather than the cells' monospace one. For the run, for + /// every composer the window draws; chosen from the editor's right-click menu. + /// + internal static bool Proportional { get; set; } + + /// Raised when the face changes, so every composer on screen follows. + internal static event Action? FaceChanged; + + /// The editor. Internal for tests. + internal ComposerEditor Editor => _editor; + + /// What it shows now. Internal for tests. + internal ComposerModel? Model => _model; + + /// The session it hands gestures to. Internal for tests. + internal ComposerSession? Session => _session; + + /// The header's words, joined, for a test. + internal string HeaderText => string.Join(" ", new[] { _title.Text, _target.Text } + .Concat(_chips.Children.OfType().Select(b => (b.Child as TextBlock)?.Text)).Where(t => !string.IsNullOrEmpty(t))); + + /// The key row's words, joined, for a test. + internal string FooterText => string.Join(" · ", _keys.Children.OfType() + .Select(p => string.Join(" ", p.Children.OfType().Select(Words).Where(t => t.Length > 0)))); + + /// The menu the editor last opened. Internal for tests. + internal ContextMenu? OpenedMenu { get; private set; } + + private static string Words(Control control) => control switch + { + TextBlock t => t.Text ?? string.Empty, + Border { Child: TextBlock t } => t.Text ?? string.Empty, + _ => string.Empty, + }; + + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnAttachedToVisualTree(e); + FaceChanged += ApplyFont; + if (_model is { Armed: true }) + { + Dispatcher.UIThread.Post(() => _editor.Focus(), DispatcherPriority.Input); + } + } + + protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) + { + FaceChanged -= ApplyFont; + base.OnDetachedFromVisualTree(e); + } + + /// + /// Shows , handing gestures to , in the pane's colours: the accent + /// and warning of , on , in . + /// + public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Color plane, Color text) + { + if (!ReferenceEquals(session, _session)) + { + _session = session; + _applied = -1; + _armed = null; + } + + var coloursChanged = ink != _ink || plane != _plane || text != _text; + _ink = ink; + _plane = plane; + _text = text; + var previous = _model; + _model = model; + + if (model.Revision != _applied) + { + _applied = model.Revision; + if (!string.Equals(_editor.Text ?? string.Empty, model.Body, StringComparison.Ordinal)) + { + _applying = true; + try + { + _editor.Text = model.Body; + _editor.CaretIndex = model.Body.Length; + _editor.ClearSelection(); + } + finally + { + _applying = false; + } + } + } + + if (previous is null || !previous.Equals(model)) + { + _editor.Marks = session.Marks(_editor.Text ?? string.Empty); + } + + if (coloursChanged || previous is null) + { + Paint(); + } + + if (previous is null || !SameChrome(previous, model) || coloursChanged) + { + Label(model); + } + + _rule.IsVisible = !_fullScreen && model.Armed; + if (_armed != model.Armed) + { + var was = _armed; + _armed = model.Armed; + if (model.Armed) + { + if (VisualRoot is not null) + { + Dispatcher.UIThread.Post(() => _editor.Focus(), DispatcherPriority.Input); + } + } + else if (was == true && _editor.IsKeyboardFocusWithin) + { + _view.Focus(); + } + } + } + + private static bool SameChrome(ComposerModel a, ComposerModel b) => + a.Target == b.Target && a.Escaping == b.Escaping && a.Edit == b.Edit && a.Dictionary == b.Dictionary + && a.CanSend == b.CanSend && a.Armed == b.Armed && a.Keys.SequenceEqual(b.Keys) && a.Verb == b.Verb; + + // ── drawing ────────────────────────────────────────────────────────────────────────────── + + private Color Accent => Parse(_ink.Bar, Color.FromRgb(0x5f, 0xaf, 0xff)); + + private Color Warn => Parse(_ink.Low, Color.FromRgb(0xff, 0x6b, 0x6b)); + + private Color Dim => Mix(_text, _plane, 0.42); + + /// The bands' plane: the pane's, one step toward the text, so the editor reads as the page between them. + private Color Band => Mix(_plane, _text, _fullScreen ? 0.06 : 0.045); + + private void Paint() + { + Background = new SolidColorBrush(_plane); + _header.Background = new SolidColorBrush(Band); + _footer.Background = new SolidColorBrush(Band); + _header.BorderBrush = new SolidColorBrush(Mix(_plane, _text, 0.12)); + _header.BorderThickness = new Thickness(0, 0, 0, 1); + _footer.BorderBrush = _header.BorderBrush; + _footer.BorderThickness = new Thickness(0, 1, 0, 0); + _rule.Background = new SolidColorBrush(Accent); + _editor.Foreground = new SolidColorBrush(_text); + _editor.CaretBrush = new SolidColorBrush(Accent); + _editor.SelectionBrush = new SolidColorBrush(Color.FromArgb(0x70, Accent.R, Accent.G, Accent.B)); + _editor.SelectionForegroundBrush = new SolidColorBrush(_text); + _editor.MarkColour = Warn; + _title.Foreground = new SolidColorBrush(Accent); + _target.Foreground = new SolidColorBrush(_text); + _marks.InvalidateVisual(); + } + + private void ApplyFont() + { + var cell = _view.CellExtent.Height > 0 ? _view.CellExtent.Height : 17; + var ui = Math.Clamp(cell * 0.72, 11, 15); + _title.FontSize = ui; + _target.FontSize = ui; + _editor.FontSize = Proportional ? Math.Clamp(cell * 0.86, 12, 19) : Math.Clamp(cell * 0.8, 11, 18); + _editor.FontFamily = Proportional + ? FontFamily.Default + : new FontFamily($"{_view.Renderer.Fonts.FamilyName}, {CellFonts.BundledFamily}, DejaVu Sans Mono, Liberation Mono, Consolas, Menlo, monospace"); + if (_model is { } model) + { + Label(model); + } + } + + /// The header and the key row, from the model. + private void Label(ComposerModel model) + { + var ui = _title.FontSize; + if (model.Edit is { } edit) + { + _title.Text = "EDIT"; + _target.Text = $"{edit.Name} {edit.Type} · from {(model.Target.Length == 0 ? "no connection" : model.Target)}"; + } + else + { + _title.Text = "COMPOSE"; + var verb = !_fullScreen && model.Verb.Length > 0 ? $"{model.Verb} " : string.Empty; + _target.Text = model.Target.Length == 0 ? $"{verb}no connection" : $"{verb}to {model.Target}"; + } + + _target.Foreground = new SolidColorBrush(model.Target.Length == 0 ? Warn : _text); + + _chips.Children.Clear(); + if (model.Edit is null) + { + _chips.Children.Add(Chip(model.Escaping == ComposeEscaping.Literal ? "literal" : "as typed", + model.Escaping == ComposeEscaping.Literal ? Accent : _text, ui - 1.5)); + if (_fullScreen || model.Armed) + { + _chips.Children.Add(Chip(model.Dictionary ?? "no dictionary", model.Dictionary is null ? Dim : _text, ui - 1.5)); + } + } + + _keys.Children.Clear(); + var narrow = !_fullScreen && Bounds.Width is > 0 and < 560; + foreach (var key in model.Keys) + { + var item = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, Margin = new Thickness(0, 1, 14, 1) }; + if (key.Key.Length > 0) + { + item.Children.Add(Chip(key.Key, Accent, ui - 1.5)); + } + + item.Children.Add(new TextBlock + { + Text = narrow && key.Short is { } brief ? brief : key.Label, + FontSize = ui - 1, + Foreground = new SolidColorBrush(Dim), + VerticalAlignment = VerticalAlignment.Center, + }); + _keys.Children.Add(item); + } + + // A docked composer too short for its key row keeps the editor and drops the row. + _footer.IsVisible = _fullScreen || Bounds.Height is 0 or >= 64; + _editor.PlaceholderText = model.Armed || _fullScreen ? null : "Click to write a post"; + _editor.PlaceholderForeground = new SolidColorBrush(Dim); + } + + private Border Chip(string words, Color ink, double size) => new() + { + Background = new SolidColorBrush(Mix(_plane, ink, 0.14)), + BorderBrush = new SolidColorBrush(Mix(_plane, ink, 0.32)), + BorderThickness = new Thickness(1), + CornerRadius = new CornerRadius(4), + Padding = new Thickness(6, 0, 6, 1), + VerticalAlignment = VerticalAlignment.Center, + Child = new TextBlock { Text = words, FontSize = Math.Max(9, size), Foreground = new SolidColorBrush(ink) }, + }; + + protected override void OnSizeChanged(SizeChangedEventArgs e) + { + base.OnSizeChanged(e); + if (_model is { } model) + { + Label(model); + } + } + + // ── text ───────────────────────────────────────────────────────────────────────────────── + + private void OnTextChanged() + { + var text = _editor.Text ?? string.Empty; + if (_session is { } session) + { + _editor.Marks = session.Marks(text); + if (!_applying) + { + session.Edited(text); + } + } + } + + private void AskToArm() + { + if (!_fullScreen && _model is { Armed: false } && _session is { } session) + { + session.Arm(); + } + } + + // ── keys ───────────────────────────────────────────────────────────────────────────────── + + private void OnEditorKeyDown(object? sender, KeyEventArgs e) + { + if (_session is not { } session || _model is not { } model) + { + return; + } + + var mods = e.KeyModifiers & (KeyModifiers.Control | KeyModifiers.Alt | KeyModifiers.Shift); + var text = _editor.Text ?? string.Empty; + var mapped = KeyMapper.FromKeyDown(e.Key, e.KeyModifiers); + + // ⌥⏎ is the window's: it maximises here, so the client's ⌥⏎ newline is ⌃⏎ or ⇧⏎ (and ⏎ itself, in an editor). + if (mapped is { } chord && WindowHost.Maximise.Chord.Matches(chord)) + { + e.Handled = true; + _view.ToggleMaximised(); + return; + } + + switch (e.Key, mods) + { + case (Key.S, KeyModifiers.Control): + e.Handled = true; + session.Send(text); + return; + + case (Key.L, KeyModifiers.Alt): + e.Handled = true; + session.ToggleEscaping(); + return; + + case (Key.W, KeyModifiers.Alt): + e.Handled = true; + if (session.CanAddWords && ComposerMarks.WordAt(text, _editor.CaretIndex) is { } word) + { + session.AddWord(word); + } + + return; + + case (Key.Escape, KeyModifiers.None): + e.Handled = true; + if (_fullScreen) + { + session.Close(text); + } + else + { + session.Release(); + _view.Focus(); + } + + return; + + case (Key.Enter, KeyModifiers.Control): + case (Key.Enter, KeyModifiers.Shift): + e.Handled = true; + Type("\n"); + return; + + case (Key.V, KeyModifiers.Control | KeyModifiers.Shift): + e.Handled = true; + _editor.Paste(); + return; + } + + if (_fullScreen) + { + // F1 again closes it, as the cell window's F1 does; ⌃Q closes it first so the quit prompt is not under it. + if (e.Key == Key.F1 && mods == KeyModifiers.None) + { + e.Handled = true; + session.Close(text); + } + else if (e.Key == Key.Q && mods == KeyModifiers.Control && mapped is { } quit) + { + e.Handled = true; + session.Close(text); + _view.Driver.RaiseKey(quit); + } + + return; + } + + if (mapped is { } forward && ReachesTheClient(e.Key, mods)) + { + e.Handled = true; + _view.Driver.RaiseKey(forward); + } + } + + /// + /// Whether a docked editor hands a key on to the client: the function keys, and every Ctrl or Alt chord the editor + /// has no use for of its own — so ⌃P, ⌃O, ⌃B, ⌃↑/⌃↓, ⌃←/⌃→, ⌥J/⌥K and ⌥1–⌥9 do from here what they do from the + /// cells. Typing, the caret keys, selection, ⌃A/⌃C/⌃X/⌃V/⌃Z/⌃Y and word deletion stay the editor's. + /// + internal static bool ReachesTheClient(Key key, KeyModifiers mods) + { + if (key is >= Key.F1 and <= Key.F24) + { + return true; + } + + var ctrl = (mods & KeyModifiers.Control) != 0; + var alt = (mods & KeyModifiers.Alt) != 0; + var shift = (mods & KeyModifiers.Shift) != 0; + if (alt && !ctrl) + { + // ⌥←/→ are word movement in the editor, as on the command line. + return key is not (Key.Left or Key.Right or Key.Back or Key.Delete); + } + + if (!ctrl || alt) + { + return false; + } + + if (shift) + { + // ⌃⇧←/→ extend by a word; ⌃⇧Z is redo. + return key is not (Key.Left or Key.Right or Key.Home or Key.End or Key.Z); + } + + return key is not (Key.A or Key.C or Key.X or Key.V or Key.Z or Key.Y or Key.Home or Key.End + or Key.Back or Key.Delete or Key.Insert); + } + + /// Types text at the caret through the editor's own input path, so it is one undo step like any typing. + private void Type(string text) => _editor.RaiseEvent(new TextInputEventArgs { RoutedEvent = TextInputEvent, Text = text }); + + // ── the right-click menu ───────────────────────────────────────────────────────────────── + + private void OnContextRequested(object? sender, ContextRequestedEventArgs e) + { + e.Handled = true; + var at = e.TryGetPosition(_editor, out var point) ? _editor.OffsetAt(point) : _editor.CaretIndex; + OpenMenu(at ?? _editor.CaretIndex); + } + + /// + /// Opens the editor's menu for the text at : the dictionary's suggestions and Add to + /// dictionary when a marked word is there, then the editor's own edits and the face. Internal for tests. + /// + internal ContextMenu OpenMenu(int offset) + { + var text = _editor.Text ?? string.Empty; + var items = new List(); + var mark = _editor.Marks.FirstOrDefault(m => offset >= m.Start && offset <= m.Start + m.Length); + if (_session is { } session && mark.Length > 0 && mark.Start + mark.Length <= text.Length) + { + var word = text.Substring(mark.Start, mark.Length); + var suggestions = session.Suggestions(word); + foreach (var suggestion in suggestions) + { + var replacement = suggestion; + items.Add(Item(replacement, () => Replace(mark, replacement), bold: true)); + } + + if (suggestions.Count == 0) + { + items.Add(new MenuItem { Header = "No suggestions", IsEnabled = false }); + } + + if (session.CanAddWords) + { + items.Add(Item($"Add “{word}” to dictionary", () => session.AddWord(word))); + } + + items.Add(new Separator()); + } + + items.Add(Item("Undo", _editor.Undo, enabled: _editor.CanUndo)); + items.Add(Item("Redo", _editor.Redo, enabled: _editor.CanRedo)); + items.Add(new Separator()); + items.Add(Item("Cut", _editor.Cut, enabled: _editor.CanCut)); + items.Add(Item("Copy", _editor.Copy, enabled: _editor.CanCopy)); + items.Add(Item("Paste", _editor.Paste, enabled: _editor.CanPaste)); + items.Add(Item("Select all", _editor.SelectAll)); + items.Add(new Separator()); + items.Add(Item(Proportional ? "Monospace font" : "Proportional font", () => + { + Proportional = !Proportional; + FaceChanged?.Invoke(); + })); + + var menu = new ContextMenu { ItemsSource = items }; + menu.Closed += (_, _) => _editor.Focus(); + OpenedMenu = menu; + menu.Open(_editor); + return menu; + } + + private static MenuItem Item(string header, Action act, bool enabled = true, bool bold = false) + { + var item = new MenuItem { Header = header, IsEnabled = enabled }; + if (bold) + { + item.FontWeight = FontWeight.SemiBold; + } + + item.Click += (_, _) => act(); + return item; + } + + /// Replaces a marked word with a suggestion, through the editor's input path so it can be undone. + private void Replace(SpellRange mark, string replacement) + { + _editor.SelectionStart = mark.Start; + _editor.SelectionEnd = mark.Start + mark.Length; + Type(replacement); + } + + // ── colours ────────────────────────────────────────────────────────────────────────────── + + internal static Color Mix(Color a, Color b, double t) => Color.FromRgb( + (byte)Math.Round(a.R + ((b.R - a.R) * t)), + (byte)Math.Round(a.G + ((b.G - a.G) * t)), + (byte)Math.Round(a.B + ((b.B - a.B) * t))); + + private static Color Parse(string hex, Color fallback) => Color.TryParse(hex, out var colour) ? colour : fallback; + + /// + /// The wavy lines under the misspelt words, drawn over the editor: the editor's own template paints its background + /// and text after anything the editor draws itself. It takes no input. + /// + internal sealed class MarkLayer : Control + { + private readonly ComposerEditor _editor; + + public MarkLayer(ComposerEditor editor) + { + _editor = editor; + IsHitTestVisible = false; + Focusable = false; + ClipToBounds = true; + editor.MarksMoved += InvalidateVisual; + } + + public override void Render(DrawingContext context) => _editor.DrawMarks(context, this); + } +} diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index d454a25f..e384b6ed 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -46,6 +46,7 @@ internal sealed class DesktopLayer : Canvas private readonly NativeSidebar _sidebar; private readonly Dictionary _whoHere = new(StringComparer.Ordinal); private readonly Dictionary _quickBars = new(StringComparer.Ordinal); + private readonly Dictionary _composers = new(StringComparer.Ordinal); private readonly NoticeToasts _toasts; private int _noticeAboveRow; @@ -134,6 +135,24 @@ protected override void OnSizeChanged(SizeChangedEventArgs e) /// The native quick bars by window id. Internal for tests. internal IReadOnlyDictionary QuickBars => _quickBars; + /// The native docked composers by window id. Internal for tests. + internal IReadOnlyDictionary Composers => _composers; + + /// + /// Gives the keyboard to the docked composer the client says is armed, or else to the cells: where it goes back to + /// when ⌃P or F1 closes. + /// + internal void FocusArmedComposer() + { + if (_composers.Values.FirstOrDefault(c => c.Model is { Armed: true }) is { } armed) + { + armed.Editor.Focus(); + return; + } + + _view.Focus(); + } + /// The last header menu opened. Internal for tests. internal ContextMenu? OpenedMenu { get; private set; } @@ -302,6 +321,15 @@ private void SyncPanels(ScreenFrame frame, Size cell) frame, cell, (bar, panel, plane) => bar.Show(panel.QuickBar!, panel.Ink, plane, text, cell.Height, panel.Pick, panel.Dispatch)); + + // The docked composer: a native editor over its pane, the cell editor still drawn (and still the draft) under it. + Place( + _composers, + _pointer.Panels.Where(p => p.PanelId == PanelIds.Composer && p.Composer is not null && p.ComposerSession is not null), + () => new ComposerView(_view, fullScreen: false), + frame, + cell, + (composer, panel, plane) => composer.Show(panel.Composer!, panel.ComposerSession!, panel.Ink, plane, text)); } /// diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index ff470f55..1822306e 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -66,10 +66,15 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime // The window's native views: the header band and the connections sidebar beside the cells (the layer moves the // view out of their way, so no cell lies under either), the Layouts button, and native panels over their panes. - root.Children.Add(new DesktopLayer(_view, options.Chrome)); + var layer = new DesktopLayer(_view, options.Chrome); + root.Children.Add(layer); + + // F1, over the cells and under the layer, so a toast is still seen over it. Closing it gives the keyboard to an + // armed docked composer if there is one, else to the cells. + _driver.Composer.Attach(root, layer, _view, () => layer.FocusArmedComposer()); // ⌃P, over everything above; it is added last when it opens, and gives the keyboard back to the cells. - _driver.Palette.Attach(root, () => _view.Focus()); + _driver.Palette.Attach(root, () => layer.FocusArmedComposer()); Content = root; AutomationProperties.SetName(_view, "SharpMUTerm"); diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index 0ca2dd51..49c139b7 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -462,7 +462,7 @@ internal bool ResizeFromChrome(PointerPressedEventArgs e) /// How many presses this view has turned into a move or a maximise. Internal for tests. internal int WindowGestures { get; private set; } - private void ToggleMaximised() + internal void ToggleMaximised() { if (TopLevel.GetTopLevel(this) is Window window) { diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index c35ea924..5d379300 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -74,5 +74,9 @@ internal static class WindowHost Chrome = chrome ?? HostChrome.HeaderAndRail, // ⌃P is a native palette over the window, listing the same rows as the cell one. NativePalette = driver.Palette, + + // F1 and the docked composer are a native editor: a proportional or monospace face, IME, native selection and + // a real underline under a misspelling. The draft, the send and the keys stay the client's. + NativeComposer = driver.Composer, }; } diff --git a/src/SharpMUTerm.Client/Composer/ComposerModel.cs b/src/SharpMUTerm.Client/Composer/ComposerModel.cs new file mode 100644 index 00000000..b1a556d3 --- /dev/null +++ b/src/SharpMUTerm.Client/Composer/ComposerModel.cs @@ -0,0 +1,235 @@ +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Client.Composer; + +/// Where a composer is drawn: F1's full screen, or a pane of a layout. +public enum ComposerPlace +{ + /// F1: a modal over the workspace. + FullScreen, + + /// The docked composer panel, in a pane. + Docked, +} + +/// A word the dictionary does not know, as a range of the whole buffer (lines broken by \n). +/// Offset into the buffer. +/// How many characters. +public readonly record struct SpellRange(int Start, int Length); + +/// +/// One entry of a composer's key row: a chord in the cell glyphs (⌃S, ⌥L, Esc) and what it does. +/// A host that draws keys in words (the window) spells the chord with KeyGlyphs.Words. +/// +/// The chord; empty for a hint that is no key (click here to write). +/// What it does. +/// A shorter label for a narrow pane; null when is already short. +public sealed record ComposerKey(string Key, string Label, string? Short = null); + +/// A MOO buffer being edited (MCP simpleedit): what it is called and its type. +public sealed record ComposerEdit(string Name, string Type); + +/// +/// A composer, as both hosts draw it. The terminal draws F1 and the docked panel in cells; the window draws them +/// with a native editor. Both read this: who the post goes to, the draft, the escaping mode, the MOO edit it is (if it +/// is one), which dictionary marks it and the words it marks, and the keys the footer offers. +/// +/// The draft is the client's. is the character's draft as the client holds it, and +/// moves only when the client replaced it — F1 closing over a docked copy, a send clearing it, +/// a key the cells took. A native editor that typed the change itself sees the revision unmoved and keeps its own +/// text (and its caret and undo); one that sees it move takes the client's. +/// +/// +/// Equal by value, lists included, because the window is told about a panel only when it changed and a +/// model rebuilt on every frame must compare equal to the last one. +/// +/// +/// F1 or the docked panel. +/// Who it sends to, as the window title names the connection; empty when nothing is connected. +/// The draft, lines broken by \n. +/// ⌥L's mode. +/// The MOO buffer this is an edit of, or null for a post. +/// The dictionary's name (en_GB), or null for none — and none for a MOO edit. +/// Whether there is a connection for ⌃S to reach. +/// Whether typing goes here: always for F1; for the docked panel, the client's one fact. +/// Moves when the client replaced . +/// The words the dictionary does not know, over . +/// The key row. +public sealed record ComposerModel( + ComposerPlace Place, + string Target, + string Body, + ComposeEscaping Escaping, + ComposerEdit? Edit, + string? Dictionary, + bool CanSend, + bool Armed, + long Revision, + IReadOnlyList Marks, + IReadOnlyList Keys) +{ + /// What ⌃S sends for this draft: , or null for nothing (or an edit). + public string? Command => Edit is null ? ComposeMessage.Build(Body, Escaping) : null; + + /// + /// The verb the post starts with — +pose, say — for the docked header, so a reader can see what the + /// buffer will be sent as without reading it. Empty for an empty buffer. + /// + public string Verb => VerbOf(Body); + + /// + /// The model for a composer's state. The keys are worked out here, so the cells and the window offer the same row: + /// F1 names ⌃S, ⌥L (a post only), ⌥W (while a dictionary marks it) and Esc; the docked panel adds F1 and says what + /// Esc does there. + /// + /// The dictionary, or null; ignored for a MOO edit, whose buffer is as often code as prose. + public static ComposerModel Create( + ComposerPlace place, + string target, + string body, + ComposeEscaping escaping, + ComposerEdit? edit, + SpellChecker? spelling, + bool canSend, + bool armed, + long revision) + { + ArgumentNullException.ThrowIfNull(target); + ArgumentNullException.ThrowIfNull(body); + body = body.Replace("\r\n", "\n", StringComparison.Ordinal); + var checker = edit is null ? spelling : null; + return new ComposerModel( + place, + target, + body, + escaping, + edit, + checker?.Name, + canSend, + armed, + revision, + ComposerMarks.For(body, checker), + KeysFor(place, edit is not null, checker is not null, canSend, armed)); + } + + /// The key row for a composer in this state. + public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, bool dictionary, bool canSend, bool armed) + { + if (place == ComposerPlace.Docked) + { + if (!armed) + { + return [new(string.Empty, "click here to write", "click to write"), new("F1", "full screen", "full")]; + } + + var docked = new List { new("⌃S", "send"), new("⌥L", "literal") }; + if (dictionary) + { + docked.Add(new("⌥W", "add word", "word")); + } + + docked.Add(new("F1", "full screen", "full")); + docked.Add(new("Esc", "command line", "back")); + return docked; + } + + if (edit) + { + return + [ + new("⌃S", canSend ? "save" : "save (nothing connected)"), + new("Esc", "close (keeps the edit)"), + ]; + } + + var keys = new List + { + new("⌃S", canSend ? "send" : "send (nothing connected)"), + new("⌥L", "escaping"), + }; + if (dictionary) + { + keys.Add(new("⌥W", "add word")); + } + + keys.Add(new("Esc", "close (keeps the draft)")); + return keys; + } + + /// The first word of the first non-blank line, at most sixteen characters. + public static string VerbOf(string body) + { + ArgumentNullException.ThrowIfNull(body); + var first = body.Split('\n').Select(l => l.Trim()).FirstOrDefault(l => l.Length > 0) ?? string.Empty; + var space = first.IndexOfAny([' ', '\t']); + var verb = space < 0 ? first : first[..space]; + return verb.Length <= 16 ? verb : verb[..15] + "…"; + } + + /// + public bool Equals(ComposerModel? other) => + other is not null + && Place == other.Place + && Target == other.Target + && Body == other.Body + && Escaping == other.Escaping + && Equals(Edit, other.Edit) + && Dictionary == other.Dictionary + && CanSend == other.CanSend + && Armed == other.Armed + && Revision == other.Revision + && Marks.SequenceEqual(other.Marks) + && Keys.SequenceEqual(other.Keys); + + /// + public override int GetHashCode() => HashCode.Combine(Place, Body, Escaping, Armed, Revision, Marks.Count, Keys.Count); +} + +/// The words a dictionary marks in a whole buffer, as one list of ranges. +public static class ComposerMarks +{ + /// + /// The words does not know in , each as a range of the whole + /// buffer. Line by line, through — the very call the cell editor's + /// highlighter makes per line — so the two hosts mark the same words. Empty with no dictionary. + /// + public static IReadOnlyList For(string body, SpellChecker? spelling) + { + ArgumentNullException.ThrowIfNull(body); + if (spelling is null || body.Length == 0) + { + return []; + } + + var marks = new List(); + var offset = 0; + foreach (var line in body.Replace("\r\n", "\n", StringComparison.Ordinal).Split('\n')) + { + foreach (var miss in spelling.Misspellings(line)) + { + marks.Add(new SpellRange(offset + miss.Start, miss.Length)); + } + + offset += line.Length + 1; + } + + return marks; + } + + /// + /// The word at in (in it, or just after it), or null: the word ⌥W + /// adds. on the caret's line, the cell composer's rule. + /// + public static string? WordAt(string body, int caret) + { + ArgumentNullException.ThrowIfNull(body); + body = body.Replace("\r\n", "\n", StringComparison.Ordinal); + caret = Math.Clamp(caret, 0, body.Length); + var start = caret == 0 ? 0 : body.LastIndexOf('\n', caret - 1) + 1; + + var end = body.IndexOf('\n', caret); + var line = body[start..(end < 0 ? body.Length : end)]; + return SpellChecker.WordAt(line, caret - start); + } +} diff --git a/src/SharpMUTerm.Client/Composer/ComposerSession.cs b/src/SharpMUTerm.Client/Composer/ComposerSession.cs new file mode 100644 index 00000000..42c4755e --- /dev/null +++ b/src/SharpMUTerm.Client/Composer/ComposerSession.cs @@ -0,0 +1,160 @@ +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Client.Composer; + +/// +/// What a native composer hands back to the client. Each is called from the host's own thread; the client marshals +/// onto its own and runs the path the cell composer's key runs (⌃S, ⌥L, ⌥W, Esc), so a gesture in either host ends in +/// the same client method. Any may be null where a composer has no such gesture (F1 is never released or armed). +/// +public sealed record ComposerCallbacks +{ + /// The writer changed the text: the whole buffer, lines broken by \n. + public Action? Edited { get; init; } + + /// ⌃S, with the buffer as it stands. + public Action? Send { get; init; } + + /// ⌥L. + public Action? ToggleEscaping { get; init; } + + /// ⌥W, or the menu's Add to dictionary, with the word. + public Action? AddWord { get; init; } + + /// Esc in a docked composer: the keyboard goes back to the command line. + public Action? Release { get; init; } + + /// A click in a docked composer: it takes the keyboard. + public Action? Arm { get; init; } + + /// Esc (or F1) in F1: the window closes, with the buffer to keep. + public Action? Closed { get; init; } +} + +/// +/// One composer, for a host that draws it with its own editor: the model the client publishes, the dictionary to mark +/// and suggest from on the host's thread, and the way back. F1 gets a session per opening; a docked composer one per +/// panel window, for as long as the panel lives. +/// +/// The client publishes; the host draws. is the client's (on its thread), and raises +/// only when the model differs, so a host can redraw on every one. Everything else is the host's. +/// Once the client has ed a session (F1 closed by a send, the panel gone), nothing the host says is +/// passed on: a late Esc cannot close a composer that already closed. +/// +/// +public sealed class ComposerSession +{ + private readonly Func? _spelling; + private readonly ComposerCallbacks _callbacks; + private ComposerModel _model; + private int _ended; + + /// The model to open on. + /// + /// The dictionary the client marks with, read on the host's thread; it must not open one (a dictionary is opened by + /// the client, which then says so in ). Null for none. + /// + /// Where the host's gestures go. + public ComposerSession(ComposerModel model, Func? spelling, ComposerCallbacks callbacks) + { + ArgumentNullException.ThrowIfNull(model); + ArgumentNullException.ThrowIfNull(callbacks); + _model = model; + _spelling = spelling; + _callbacks = callbacks; + } + + /// The model last published. + public ComposerModel Model => Volatile.Read(ref _model); + + /// Raised on the client's thread when a published model differs from the last; a host marshals. + public event Action? Changed; + + /// Whether the client has ended the session. + public bool IsEnded => Volatile.Read(ref _ended) != 0; + + /// The client's: a new model, passed on when it differs from the last. + public void Publish(ComposerModel model) + { + ArgumentNullException.ThrowIfNull(model); + var old = Interlocked.Exchange(ref _model, model); + if (!model.Equals(old)) + { + Changed?.Invoke(model); + } + } + + /// The client's: nothing the host says from now on is passed on. + public void End() => Volatile.Write(ref _ended, 1); + + /// + /// The words to mark in — the host's text as it is now, which may be a keystroke ahead of + /// . The same function the model's are made by, so for the + /// same text the two agree. None for a MOO edit or with no dictionary. + /// + public IReadOnlyList Marks(string body) => + Model is { Edit: null, Dictionary: not null } ? ComposerMarks.For(body ?? string.Empty, _spelling?.Invoke()) : []; + + /// The dictionary's suggestions for a marked word, for the host's menu; empty with none. + public IReadOnlyList Suggestions(string word) => + CanAddWords && _spelling?.Invoke() is { } checker ? checker.Suggest(word) : []; + + /// Whether ⌥W does anything here: a post marked by a dictionary. + public bool CanAddWords => Model is { Edit: null, Dictionary: not null }; + + /// The host's: the writer changed the text. + public void Edited(string body) => Pass(_callbacks.Edited, Normalise(body)); + + /// The host's: ⌃S. + public void Send(string body) => Pass(_callbacks.Send, Normalise(body)); + + /// The host's: ⌥L. Nothing for a MOO edit, which is saved as its lines. + public void ToggleEscaping() + { + if (Model.Edit is null && !IsEnded) + { + _callbacks.ToggleEscaping?.Invoke(); + } + } + + /// The host's: ⌥W on . + public void AddWord(string word) + { + if (CanAddWords && !string.IsNullOrWhiteSpace(word)) + { + Pass(_callbacks.AddWord, word.Trim()); + } + } + + /// The host's: Esc in a docked composer. + public void Release() + { + if (!IsEnded) + { + _callbacks.Release?.Invoke(); + } + } + + /// The host's: a click in a docked composer. + public void Arm() + { + if (!IsEnded) + { + _callbacks.Arm?.Invoke(); + } + } + + /// The host's: F1 closing by Esc, with the buffer. + public void Close(string body) => Pass(_callbacks.Closed, Normalise(body)); + + private void Pass(Action? action, string value) + { + if (!IsEnded) + { + action?.Invoke(value); + } + } + + /// Lines broken by \n: a native text box on Windows writes CRLF. + private static string Normalise(string? body) => (body ?? string.Empty).Replace("\r\n", "\n", StringComparison.Ordinal); +} diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 89c93b44..4060bce7 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -1,5 +1,6 @@ using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Composer; using SharpMUTerm.Client.Contributions; using SharpMUTerm.Client.Palette; using SharpMUTerm.Client.Panels; @@ -41,6 +42,12 @@ public enum SurfaceActionKind /// A change to a declared setting, committed through the client's save funnel. Edit, + + /// + /// A composer's gesture — its text sent, the escaping flipped, a word added, the keyboard released or taken — + /// handed back through the composer's session (ComposerSession). + /// + Compose, } /// @@ -142,6 +149,9 @@ public static class SurfaceCatalog /// A notice: the status row's message in cells, and in the window a toast over them as well. public const string Notice = "notice"; + /// F1, the full-screen composer: a cell modal in a terminal, the window's native editor in its place. + public const string Compose = "compose"; + /// /// The header and the rail: cells in a terminal; in the window (HostChrome.HeaderAndRail) native views /// beside the cells, which then leave them out. @@ -284,6 +294,41 @@ public static class SurfaceCatalog CellsUnderNative, "SharpMUTerm.Tui.SharpMUTermApp.NoticeMarkup", ["SharpMUTerm.Avalonia.NoticeToasts"]), + new( + Compose, + typeof(ComposerModel), + [ + // ⌃S: the buffer through ComposeMessage.Build to the window's character (a MOO edit saves as lines). + new(SurfaceActionKind.Compose, "send", "SendComposed"), + + // Esc: the window closes and the buffer is kept as the character's draft. + new(SurfaceActionKind.Compose, "close", "CloseComposer"), + new(SurfaceActionKind.Compose, "add word", "AddComposerWord"), + ], + new Dictionary + { + [SurfaceHosts.Terminal] = SurfaceDrawing.Cells, + + // A window with a native composer opens F1 there instead of the cell modal (ClientHost.NativeComposer). + [SurfaceHosts.Window] = SurfaceDrawing.Native, + }, + "SharpMUTerm.Tui.ComposeOverlay.Render", + ["SharpMUTerm.Avalonia.ComposerOverlay", "SharpMUTerm.Avalonia.ComposerView", "SharpMUTerm.Avalonia.ComposerEditor"]), + new( + PanelIds.Composer, + typeof(ComposerModel), + [ + new(SurfaceActionKind.Compose, "send", "SendDocked"), + new(SurfaceActionKind.Compose, "release", "ReleaseComposer"), + + // A click on the cell editor arms it through the framework's focus (ArmClickedComposer); the native + // editor asks for the same thing by name. + new(SurfaceActionKind.Compose, "arm", "ArmComposer"), + new(SurfaceActionKind.Compose, "add word", "AddComposerWord"), + ], + CellsUnderNative, + "SharpMUTerm.Tui.Panels.DockedComposer.Render", + ["SharpMUTerm.Avalonia.ComposerView", "SharpMUTerm.Avalonia.ComposerEditor"]), ]; /// The surface with , or null. diff --git a/src/SharpMUTerm.Core/Text/SpellChecker.cs b/src/SharpMUTerm.Core/Text/SpellChecker.cs index 65de70bc..4ffb930e 100644 --- a/src/SharpMUTerm.Core/Text/SpellChecker.cs +++ b/src/SharpMUTerm.Core/Text/SpellChecker.cs @@ -33,6 +33,14 @@ public sealed class SpellChecker private readonly Dictionary _cache = new(StringComparer.Ordinal); private readonly string? _userWordsPath; + /// + /// Held around every read and write of the word list, the added words and the cache. The terminal asks from the + /// client's thread only; the window's native composer marks and suggests from its own thread while the client + /// adds a word from the other, and a written on one thread and read on + /// another throws. + /// + private readonly Lock _gate = new(); + /// Most cached answers kept; past this the cache is dropped and refilled. private const int CacheLimit = 20_000; @@ -173,6 +181,14 @@ public static IReadOnlyList SearchFolders(string? own) /// Whether a word is spelt right, or was added. public bool Check(string word) + { + lock (_gate) + { + return CheckLocked(word); + } + } + + private bool CheckLocked(string word) { if (_added.Contains(word)) { @@ -221,9 +237,12 @@ public bool Add(string word) return false; } - if (!_added.Add(word)) + lock (_gate) { - return true; + if (!_added.Add(word)) + { + return true; + } } if (_userWordsPath is { } path) @@ -242,6 +261,31 @@ public bool Add(string word) return true; } + /// + /// The dictionary's suggestions for , best first, at most ; empty for a + /// word it knows, or one this checker would never mark. Hunspell's suggester is slow beside a check (a few + /// milliseconds a word), so this is for a menu opened on one word, never for a whole buffer. + /// + public IReadOnlyList Suggest(string word, int max = 6) + { + ArgumentNullException.ThrowIfNull(word); + word = word.Trim(); + if (word.Length == 0 || max <= 0) + { + return []; + } + + lock (_gate) + { + if (CheckLocked(word)) + { + return []; + } + + return _words.Suggest(word).Take(max).ToArray(); + } + } + /// The word at on (or just before it), or null. public static string? WordAt(string line, int column) { diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 36285219..3f2c94a3 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -2,6 +2,7 @@ using SharpConsoleUI.Builders; using SharpConsoleUI.Controls; using SharpConsoleUI.Layout; +using SharpMUTerm.Client.Composer; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Telnet; using SharpMUTerm.Core.Text; @@ -107,7 +108,30 @@ internal ComposeOverlay(ConsoleWindowSystem system, Func? spellin internal MooEdit? Edit => _edit; /// The header row's markup, so a test can read who the window says it will send to. - internal string HeaderMarkup => Header(); + internal string HeaderMarkup => Render(Model).Header; + + /// + /// What the window draws, as the shared model a native composer draws: the target, the buffer as it stands, the + /// mode, the edit, the dictionary and its marks, and the key row. + /// + internal ComposerModel Model => ModelFor(_target, Body, _escaping, _edit, Spelling, _canSend); + + /// + /// F1's model for a draft, in either host: the cell window builds its own from this, and a native F1 is opened on + /// it, so the two say the same thing for the same draft. Revision 1: F1 opens on a draft and nothing replaces it + /// while it is open. + /// + internal static ComposerModel ModelFor(string target, string body, ComposeEscaping escaping, MooEdit? edit, SpellChecker? spelling, bool canSend) => + ComposerModel.Create( + ComposerPlace.FullScreen, + target, + body, + escaping, + edit is null ? null : new ComposerEdit(edit.Name, edit.Type), + spelling, + canSend, + armed: true, + revision: 1); /// /// Opens the composer on , or closes it when it is already open — the same @@ -356,71 +380,56 @@ private void Redraw() /// private MarkupControl HeaderBand() { - var band = ScreenChrome.Band(Header(), ScreenPalette.HeaderBg, _scheme); + var band = ScreenChrome.Band(Render(Model).Header, ScreenPalette.HeaderBg, _scheme); band.StickyPosition = StickyPosition.Top; return band; } private MarkupControl FooterBand() { - var band = ScreenChrome.Band(Footer(), ScreenPalette.FooterBg, _scheme); + var band = ScreenChrome.Band(Render(Model).Footer, ScreenPalette.FooterBg, _scheme); band.StickyPosition = StickyPosition.Bottom; return band; } /// - /// The title row: what this is, who it sends to, and which mode it is in. The target is escaped - /// because a character's name is configuration and a world's name can be anything. + /// The two chrome rows for . The title row says what this is, who it sends to, and which + /// mode it is in; the target is escaped because a character's name is configuration and a world's name can be + /// anything. The key row is the model's keys and nothing else, because this screen is held to the same honesty + /// rule as the settings screens: every key printed here works, and none that works is hidden. There is + /// deliberately no ⌃F find — the control has a find API but no chord bound to it. /// - private string Header() + internal static (string Header, string Footer) Render(ComposerModel model) { - var target = _target.Length == 0 + var target = model.Target.Length == 0 ? $"[{ScreenPalette.Warn}]no connection[/]" - : $"[{ScreenPalette.Value}]{Escape(_target)}[/]"; + : $"[{ScreenPalette.Value}]{Escape(model.Target)}[/]"; - if (_edit is { } edit) + string header; + if (model.Edit is { } edit) { - return $"[{ScreenPalette.Accent}]EDIT[/] [{ScreenPalette.Value}]{Escape(edit.Name)}[/]" + header = $"[{ScreenPalette.Accent}]EDIT[/] [{ScreenPalette.Value}]{Escape(edit.Name)}[/]" + $"[{ScreenPalette.Label}] {Escape(edit.Type)} · from [/]{target}"; } + else + { + var mode = model.Escaping == ComposeEscaping.Literal + ? $"[{ScreenPalette.Accent}]literal[/]" + : $"[{ScreenPalette.Value}]as typed[/]"; - var mode = _escaping == ComposeEscaping.Literal - ? $"[{ScreenPalette.Accent}]literal[/]" - : $"[{ScreenPalette.Value}]as typed[/]"; - - var spelling = _spelling is { } checker - ? $"[{ScreenPalette.Value}]{Escape(checker.Name)}[/]" - : $"[{ScreenPalette.Muted}]no dictionary[/]"; - - return $"[{ScreenPalette.Accent}]COMPOSE[/][{ScreenPalette.Label}] to [/]{target}" - + $"[{ScreenPalette.Label}] · text [/]{mode}" - + $"[{ScreenPalette.Label}] · spelling [/]{spelling}"; - } + var spelling = model.Dictionary is { } name + ? $"[{ScreenPalette.Value}]{Escape(name)}[/]" + : $"[{ScreenPalette.Muted}]no dictionary[/]"; - /// - /// The key row. It names ⌃S, ⌥L, ⌥W (while there is a dictionary) and Esc and nothing else, because this screen is held to the same - /// honesty rule as the settings screens: every key printed here works, and none that works is - /// hidden. There is deliberately no ⌃F find — the control has a find API but no chord bound - /// to it, and advertising one would send a reader to press a key that does nothing. - /// - private string Footer() - { - if (_edit is not null) - { - return (_canSend - ? $"[{ScreenPalette.Accent}]⌃S[/][{ScreenPalette.Label}] save[/]" - : $"[{ScreenPalette.Accent}]⌃S[/][{ScreenPalette.Label}] save (nothing connected)[/]") - + $"[{ScreenPalette.Label}] · [/][{ScreenPalette.Accent}]Esc[/][{ScreenPalette.Label}] close (keeps the edit)[/]"; + header = $"[{ScreenPalette.Accent}]COMPOSE[/][{ScreenPalette.Label}] to [/]{target}" + + $"[{ScreenPalette.Label}] · text [/]{mode}" + + $"[{ScreenPalette.Label}] · spelling [/]{spelling}"; } - var send = _canSend - ? $"[{ScreenPalette.Accent}]⌃S[/][{ScreenPalette.Label}] send[/]" - : $"[{ScreenPalette.Accent}]⌃S[/][{ScreenPalette.Label}] send (nothing connected)[/]"; - - return send - + $"[{ScreenPalette.Label}] · [/][{ScreenPalette.Accent}]⌥L[/][{ScreenPalette.Label}] escaping[/]" - + (Spelling is null ? string.Empty : $"[{ScreenPalette.Label}] · [/][{ScreenPalette.Accent}]⌥W[/][{ScreenPalette.Label}] add word[/]") - + $"[{ScreenPalette.Label}] · [/][{ScreenPalette.Accent}]Esc[/][{ScreenPalette.Label}] close (keeps the draft)[/]"; + var footer = string.Join( + $"[{ScreenPalette.Label}] · [/]", + model.Keys.Select(k => $"[{ScreenPalette.Accent}]{Escape(k.Key)}[/][{ScreenPalette.Label}] {Escape(k.Label)}[/]")); + return (header, footer); } /// diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index df52a465..dd7195f9 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -111,6 +111,14 @@ internal sealed record ClientHost /// public required INativePalette? NativePalette { get; init; } + /// + /// Draws the composer — F1 and the docked panel — with the host's own editor, or null for a host whose composer is + /// cells. F1 opens there instead of the cell modal; a docked composer keeps its cells and the host's editor lies + /// over them, kept to the same draft. Null in the terminal, the snapshot, the tests and the parity harness, so every + /// cell frame is unchanged. + /// + public required INativeComposer? NativeComposer { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -151,6 +159,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) NativeSettings = null, Chrome = HostChrome.None, NativePalette = null, + NativeComposer = null, }; /// @@ -176,6 +185,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) NativeSettings = null, Chrome = HostChrome.None, NativePalette = null, + NativeComposer = null, }; /// diff --git a/src/SharpMUTerm.Tui/Hosting/INativeComposer.cs b/src/SharpMUTerm.Tui/Hosting/INativeComposer.cs new file mode 100644 index 00000000..3eeaaba3 --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/INativeComposer.cs @@ -0,0 +1,32 @@ +using SharpMUTerm.Client.Composer; + +namespace SharpMUTerm.Tui; + +/// +/// A host that draws the composer with its own editor (the desktop window's native text editor) instead of cells: F1 +/// as a full-screen editor in place of the cell modal, and each docked composer panel as an editor over its pane's +/// cells. The client hands it a ; the host draws the session's +/// and hands every gesture back through it, so ⌃S, ⌥L, ⌥W and Esc end in the client methods the cell composer's keys +/// end in. +/// +/// The docked editors arrive with the panels (), placed like every native panel; +/// only F1, which has no pane, comes through here. +/// +/// +internal interface INativeComposer +{ + /// + /// Whether the host has somewhere to draw a composer now. False for a host built without a window (the window's + /// --render-png, a test), which then gets the cell composer. Read on the client's thread. + /// + bool Available { get; } + + /// + /// Shows F1 for , in : the accent its title and keys wear, and the + /// colour of the line under a misspelling. Called on the client's thread; the host marshals. + /// + void Open(ComposerSession session, PanelInk ink); + + /// Closes F1 if it is open, saying nothing back. Called on the client's thread. + void Close(); +} diff --git a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs index 13c5192e..d7e0d9c7 100644 --- a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs +++ b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs @@ -2,7 +2,9 @@ using SharpConsoleUI.Builders; using SharpConsoleUI.Controls; using SharpConsoleUI.Layout; +using SharpMUTerm.Client.Composer; using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Text; using static SharpMUTerm.Tui.MarkupText; namespace SharpMUTerm.Tui.Panels; @@ -23,6 +25,12 @@ namespace SharpMUTerm.Tui.Panels; /// line follows, and it is what keeps one fact behind "which control gets a keystroke". /// /// +/// It draws from a , the one the window's native editor draws: the host describes the +/// composer (describe) and turns the model into the header and key rows, so +/// the two hosts offer the same keys and say the same mode. moves whenever the buffer changes by +/// any hand but a native editor's (), which is how that editor knows to take the text. +/// +/// /// The grid is kept and re-parented across pane rebuilds. A disposed GridControl disposes its children and /// nothing else, and none of these three keeps state that a dispose clears, so the same instance serves for the /// life of the panel (pinned by DockedComposerTests). @@ -33,14 +41,20 @@ internal sealed class DockedComposer private readonly MarkupControl _header; private readonly MarkupControl _footer; private readonly string _accent; + private readonly Func _describe; private bool _armed; private bool _quiet; + private bool _fromHost; - internal DockedComposer(string windowId, string sessionKey, ScreenTheme scheme, string accent) + /// + /// The model for this composer's state, which the host also records as drawn and hands a native editor. + /// + internal DockedComposer(string windowId, string sessionKey, ScreenTheme scheme, string accent, Func describe) { WindowId = windowId; SessionKey = sessionKey; _accent = accent; + _describe = describe; Editor = new MultilineEditControl { WrapMode = WrapMode.WrapWords, @@ -65,6 +79,11 @@ internal DockedComposer(string windowId, string sessionKey, ScreenTheme scheme, }; Editor.ContentChanged += (_, _) => { + if (!_fromHost) + { + Revision++; + } + if (!_quiet) { Redraw(); @@ -118,6 +137,50 @@ internal bool Armed } } + /// + /// Moves whenever the buffer is replaced or edited by anything but : a key the cells took, + /// F1 closing over this copy, a send clearing it. A native editor takes the text only when this has moved. + /// + internal long Revision { get; private set; } + + /// The model last drawn. + internal ComposerModel? Model { get; private set; } + + /// The dictionary marking this buffer, once one is opened for it. + internal SpellChecker? Spelling { get; private set; } + + /// Marks the words does not know, in , as F1 does. + internal void UseSpelling(SpellChecker checker, Color marked) + { + Spelling = checker; + Editor.SyntaxHighlighter = new SpellingHighlighter(checker, marked); + Redraw(); + } + + /// + /// The text a native editor over this composer now holds: written into the buffer without moving + /// , so the editor that sent it keeps its own caret and undo, and raising + /// like a keystroke, so the draft store follows. + /// + internal void SetFromHost(string body) + { + body = body.Replace("\r\n", "\n", StringComparison.Ordinal); + if (string.Equals(Body, body, StringComparison.Ordinal)) + { + return; + } + + _fromHost = true; + try + { + Editor.SetContent(body); + } + finally + { + _fromHost = false; + } + } + /// Raised after the buffer or the mode changed by the writer's hand (never by ). internal event EventHandler? Changed; @@ -131,6 +194,7 @@ internal bool Armed internal void Load(string body, ComposeEscaping escaping) { Escaping = escaping; + Revision++; if (!string.Equals(Body, body, StringComparison.Ordinal)) { _quiet = true; @@ -178,38 +242,54 @@ internal void Fit(int width, int height) /// The verb the post starts with — +pose, say — for the header, so a reader can see what the /// buffer will be sent as without reading it. Empty for an empty buffer. /// - internal static string Verb(string body) + internal static string Verb(string body) => ComposerModel.VerbOf(body); + + /// Re-describes the composer and draws the model. + internal void Redraw() { - var first = body.Split('\n').Select(l => l.Trim()).FirstOrDefault(l => l.Length > 0) ?? string.Empty; - var space = first.IndexOfAny([' ', '\t']); - var verb = space < 0 ? first : first[..space]; - return verb.Length <= 16 ? verb : verb[..15] + "…"; + var model = _describe(this); + Model = model; + Render(model); } - private void Redraw() + /// + /// The cell header and key row for : ▌COMPOSE +pose literal, and the model's keys + /// in the long form, or the short one when the pane is too narrow for it. Both forms list the same keys, so a + /// narrow pane hides no gesture. + /// + internal void Render(ComposerModel model) { - var verb = Verb(Body); - var mode = Escaping == ComposeEscaping.Literal ? $"[{_accent}]literal[/]" : "[dim]as typed[/]"; - var marker = _armed ? $"[{_accent}]▌[/]" : " "; + var verb = model.Verb; + var mode = model.Escaping == ComposeEscaping.Literal ? $"[{_accent}]literal[/]" : "[dim]as typed[/]"; + var marker = model.Armed ? $"[{_accent}]▌[/]" : " "; _header.SetContent(new List { $"{marker}[bold {_accent}]COMPOSE[/]" + (verb.Length > 0 ? $" {Escape(verb)}" : string.Empty) + $" {mode}", }); - // The long form names what each key does; the short one, for a narrow column, keeps every key and the - // two words that matter. Both list the same keys, so a narrow pane hides no gesture. - var footer = _armed - ? $" {Key("⌃S")}[dim] send · [/]{Key("⌥L")}[dim] literal · [/]{Key("F1")}[dim] full screen · [/]{Key("Esc")}[dim] command line[/]" - : $" [dim]click here to write · [/]{Key("F1")}[dim] full screen[/]"; + var footer = KeyRow(model.Keys, shortForm: false); if (_width > 0 && VisibleLength(footer) > _width) { - footer = _armed - ? $" {Key("⌃S")}[dim] send · [/]{Key("⌥L")}[dim] literal · [/]{Key("F1")}[dim] full · [/]{Key("Esc")}[dim] back[/]" - : $" [dim]click to write · [/]{Key("F1")}[dim] full[/]"; + footer = KeyRow(model.Keys, shortForm: true); } _footer.SetContent(new List { _width > 0 ? ElideVisible(footer, _width) : footer }); } + /// The key row: ⌃S send · ⌥L literal · …, a key in the accent and its word dimmed. + private string KeyRow(IReadOnlyList keys, bool shortForm) + { + var row = new System.Text.StringBuilder(" "); + for (var i = 0; i < keys.Count; i++) + { + var key = keys[i]; + var label = Escape(shortForm ? key.Short ?? key.Label : key.Label); + row.Append(key.Key.Length > 0 ? $"{Key(key.Key)}[dim] {label}" : $"[dim]{label}"); + row.Append(i < keys.Count - 1 ? " · [/]" : "[/]"); + } + + return row.ToString(); + } + private string Key(string key) => $"[{_accent}]{key}[/]"; } diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 6493ad39..a01cce55 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -194,6 +194,14 @@ void Notice(NoticeOverlay notice) /// Runs a command id through the client's registry (the quick bar's F4 edits keys is /// ). Safe to call from any thread; one instance. /// +/// +/// For the docked composer, its content: the model its cell header, editor and key row are drawn from. Only for a +/// host with a native composer (). +/// +/// +/// For the docked composer, the way a native editor's text and keys go back to the client: one instance for as long as +/// the panel lives, so an overlay compares equal from frame to frame. +/// internal sealed record PanelOverlay( string PanelId, string WindowId, @@ -205,7 +213,9 @@ internal sealed record PanelOverlay( SharpMUTerm.Client.Panels.WhoHereModel? WhoHere = null, SharpMUTerm.Client.Panels.QuickBarModel? QuickBar = null, Action? Pick = null, - Action? Dispatch = null); + Action? Dispatch = null, + SharpMUTerm.Client.Composer.ComposerModel? Composer = null, + SharpMUTerm.Client.Composer.ComposerSession? ComposerSession = null); /// A panel's colours as #rrggbb: a bar or fill, the warning, and the empty part of a bar. internal sealed record PanelInk(string Bar, string Low, string Track); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs index dcc86098..1430d3d8 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs @@ -91,7 +91,7 @@ internal ChromeOverlay BuildChromeOverlay() /// frame) reports false with nothing over it. /// private bool MainWindowInFront() => - _system.ActiveWindow is not { } front || ReferenceEquals(front, _window); + _nativeCompose is null && (_system.ActiveWindow is not { } front || ReferenceEquals(front, _window)); /// /// A click on a native header or sidebar, by the target the client put in the model. Internal so a test can drive diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs index 069b2a8f..d7990f80 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -202,7 +202,9 @@ private void PublishPanels() // A modal over the main window (a settings screen, ⌃P, F1) is drawn in cells over the panes; a native view // would sit on top of it, so while one is up no panel is on screen as far as the host is concerned. var overlays = new List(); - foreach (var (paneId, rect) in !_system.ModalStateService.HasModals ? PaneOutputRects() : new Dictionary()) + // F1 drawn by the host covers the panes the same way, though it is no framework modal. + var covered = _system.ModalStateService.HasModals || _nativeCompose is not null; + foreach (var (paneId, rect) in !covered ? PaneOutputRects() : new Dictionary()) { if (_workspace.Layout.FindPane(paneId) is not { ActiveTab: { } windowId }) { @@ -244,6 +246,13 @@ private void PublishPanels() panelId, windowId, rect, PanelListInk(), null, QuickBar: QuickBarEntries(key), Pick: PickerFor(windowId, key), Dispatch: _panelDispatch ??= id => OnUiThread(() => DispatchCommand(id)))); } + else if (panelId == PanelIds.Composer && NativeComposerHost is not null + && _dockedComposers.TryGetValue(windowId, out var docked) && docked.Model is { } composer) + { + // Only to a host with its own editor: the cells stay underneath it, and the editor is kept to them. + overlays.Add(new PanelOverlay( + panelId, windowId, rect, ComposerInk(), null, Composer: composer, ComposerSession: DockedSessionFor(docked))); + } } if (overlays.SequenceEqual(_panelOverlays)) diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs index 388e3f43..4ff89cf5 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs @@ -27,6 +27,7 @@ private T Drawing(string surface, string key, T model) internal object? DrawnModel(string surface, string key = "") => surface == SurfaceCatalog.Palette ? (_palette.IsOpen ? _palette.View : null) : surface == SurfaceCatalog.Prefix ? (_prefixPanel.IsOpen ? _prefixPanel.Drawn : null) + : surface == SurfaceCatalog.Compose ? (_composer.IsOpen ? _composer.Model : null) : _drawnModels.TryGetValue((surface, key), out var model) ? model : null; /// A click on a header link, as the header's own handler receives it. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs index 56070887..42ab5d42 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs @@ -48,7 +48,7 @@ private void ReceiveMooEdit(WorldSession session, MooEdit edit) /// private void SaveMooEdit(WorldSession session, MooEdit edit, string body) { - _composer.Close(); + CloseComposer(); var key = session.SessionKey; var lines = MooEditing.LinesOf(body); _ = SaveAsync(); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs new file mode 100644 index 00000000..56f32614 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs @@ -0,0 +1,310 @@ +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Telnet; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Tui.Panels; + +namespace SharpMUTerm.Tui; + +/// +/// The composer in a host that draws it with its own editor (), and the model +/// both hosts draw it from (). +/// +/// F1 opens there instead of the cell modal, through one funnel () that every way in +/// takes — the key, ⌃P, a MOO edit arriving, the demo views. It is closed through one funnel too +/// (), which keeps the draft exactly as the cell window's Closed does, so the +/// send path's "close first, forget after" holds for both. +/// +/// +/// A docked composer keeps its cells, and the host's editor lies over them. The cell editor stays the draft: +/// the native editor's text is written into it as it changes (), and the model +/// handed back carries a revision that moves only when something else changed the buffer. Arming stays the client's +/// one fact: a click in the native editor asks to arm, Esc in it releases, and the model says which it is. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// F1 drawn by the host: the session and the draft it holds, or null while none is open. + private NativeCompose? _nativeCompose; + + /// The native editor's channel for each docked composer, by window id; one per panel window. + private readonly Dictionary _dockedSessions = new(StringComparer.Ordinal); + + /// The dictionary, once opened: by the first F1, or the first time a docked composer is armed. + private SpellChecker? _composerSpelling; + + private bool _composerSpellingOpened; + + /// The host's composer, when it has somewhere to draw one; null for cells. + private INativeComposer? NativeComposerHost => Host.NativeComposer is { Available: true } native ? native : null; + + /// Whether F1 is open, in cells or natively. + internal bool ComposerOpen => _composer.IsOpen || _nativeCompose is not null; + + /// Whether F1 is open in the host's own editor, for the tests. + internal bool NativeComposerIsOpen => _nativeCompose is not null; + + /// The native F1's session, for the tests; null while none is open. + internal ComposerSession? NativeComposerSession => _nativeCompose?.Session; + + /// The buffer F1 holds now, in either host. + private string ComposerBody => _nativeCompose?.Body ?? _composer.Body; + + /// + /// The composer's dictionary, opened the first time anything asks — never at startup, so a client nobody writes a + /// post in reads none. + /// + private SpellChecker? ComposerSpelling() + { + if (!_composerSpellingOpened) + { + _composerSpellingOpened = true; + _composerSpelling = _spelling?.Invoke(); + } + + return _composerSpelling; + } + + /// + /// Opens F1 on a draft: in the host's editor when it has one, else the cell window. Both are given the same draft + /// and say the same thing about it (). + /// + private void OpenComposer(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null) + { + if (NativeComposerHost is not { } native) + { + _composer.Toggle(target, draft, escaping, canSend, edit); + return; + } + + var open = new NativeCompose(target, canSend, edit) { Body = draft.Replace("\r\n", "\n", StringComparison.Ordinal), Escaping = escaping }; + open.Session = new ComposerSession( + NativeComposeModel(open), + () => _composerSpelling, + new ComposerCallbacks + { + Edited = body => OnUiThread(() => + { + if (ReferenceEquals(_nativeCompose, open)) + { + // The model follows the text, so the marks it carries are the marks the cell window would draw. + open.Body = body; + open.Session.Publish(NativeComposeModel(open)); + } + }), + Send = body => OnUiThread(() => + { + if (ReferenceEquals(_nativeCompose, open)) + { + open.Body = body; + SendComposed(new ComposeResult(body, open.Escaping, open.Edit)); + } + }), + ToggleEscaping = () => OnUiThread(() => + { + if (ReferenceEquals(_nativeCompose, open) && open.Edit is null) + { + open.Escaping = open.Escaping == ComposeEscaping.Literal ? ComposeEscaping.AsTyped : ComposeEscaping.Literal; + open.Session.Publish(NativeComposeModel(open)); + } + }), + AddWord = word => OnUiThread(() => AddComposerWord(word)), + Closed = body => OnUiThread(() => + { + if (ReferenceEquals(_nativeCompose, open)) + { + open.Body = body; + CloseComposer(); + } + }), + }); + _nativeCompose = open; + native.Open(open.Session, ComposerInk()); + PublishPanels(); + PublishHostChrome(); + } + + /// + /// A host editor's colours: the accent its title and keys wear, and the settings screens' warning for the line under + /// a misspelling — the colour the cell editor marks the word in. + /// + internal PanelInk ComposerInk() => PanelListInk() with { Low = _screens.Role(ScreenPalette.Warn) }; + + /// The native F1's model for what it holds now; the cell window's for the same draft. + private ComposerModel NativeComposeModel(NativeCompose open) => + ComposeOverlay.ModelFor(open.Target, open.Body, open.Escaping, open.Edit, open.Edit is null ? ComposerSpelling() : null, open.CanSend); + + /// + /// Closes F1, in whichever host it is open, keeping its buffer as the character's draft (or MOO edit) exactly as the + /// cell window's Closed does. A send closes through here first and forgets the draft after. + /// + private void CloseComposer() + { + if (_nativeCompose is not { } open) + { + _composer.Close(); + return; + } + + _nativeCompose = null; + open.Session.End(); + Host.NativeComposer?.Close(); + KeepComposeDraft(new ComposeResult(open.Body, open.Escaping, open.Edit)); + PublishPanels(); + PublishHostChrome(); + } + + /// + /// Adds a word to the dictionary from either composer, and re-marks everything a composer shows: the cell editors + /// and the models handed to native editors. + /// + private void AddComposerWord(string word) + { + if (ComposerSpelling() is not { } checker || !checker.Add(word)) + { + return; + } + + foreach (var docked in _dockedComposers.Values) + { + docked.Editor.RefreshSyntaxHighlighting(); + docked.Redraw(); + } + + if (_nativeCompose is { } open) + { + open.Session.Publish(NativeComposeModel(open)); + } + } + + // --- The docked composer's model and native channel ---------------------------------------------------------- + + /// + /// The docked composer's model: what its cells draw, recorded as drawn, and handed to its native editor. The target + /// is the session's title, or the character's name while it has none (and then nothing can be sent). + /// + private ComposerModel DescribeDocked(DockedComposer composer) + { + var session = FindSession(composer.SessionKey); + var target = session is not null + ? SessionTitle(session) + : FindCharacter(composer.SessionKey)?.Character.Name ?? string.Empty; + var model = ComposerModel.Create( + ComposerPlace.Docked, + target, + composer.Body, + composer.Escaping, + edit: null, + composer.Spelling, + canSend: session is not null, + composer.Armed, + composer.Revision); + Drawing(PanelIds.Composer, composer.WindowId, model); + if (_dockedSessions.TryGetValue(composer.WindowId, out var native)) + { + native.Publish(model); + } + + return model; + } + + /// + /// The native editor's channel for a docked composer: its text written into the cells, ⌃S through + /// , ⌥L, ⌥W, Esc through and a click through + /// — the methods the cell composer's keys and clicks end in. + /// + private ComposerSession DockedSessionFor(DockedComposer composer) + { + if (_dockedSessions.TryGetValue(composer.WindowId, out var known)) + { + return known; + } + + var session = new ComposerSession( + composer.Model ?? DescribeDocked(composer), + () => composer.Spelling, + new ComposerCallbacks + { + Edited = body => OnUiThread(() => composer.SetFromHost(body)), + Send = body => OnUiThread(() => + { + composer.SetFromHost(body); + SendDocked(composer); + }), + ToggleEscaping = () => OnUiThread(composer.ToggleEscaping), + AddWord = word => OnUiThread(() => AddComposerWord(word)), + Release = () => OnUiThread(() => + { + if (ReferenceEquals(ArmedComposer(), composer)) + { + ReleaseComposer(); + } + }), + Arm = () => OnUiThread(() => ArmComposer(composer)), + }); + _dockedSessions[composer.WindowId] = session; + return session; + } + + /// + /// A click in a docked composer's native editor: arm it, bringing its window to the front when it is not — what a + /// click on its cell editor does (). Refused while a modal owns the screen. + /// + private void ArmComposer(DockedComposer composer) + { + if (!_window.GetIsActive() || ComposerOpen) + { + return; + } + + if (!string.Equals(ActiveWindowId(), composer.WindowId, StringComparison.Ordinal)) + { + _pinningFocus = true; + try + { + Activate(composer.WindowId); + } + finally + { + _pinningFocus = false; + } + } + + _composerArmWindow = composer.WindowId; + _composerReleased = false; + SyncComposerArm(); + } + + /// + /// ⌥W in a docked composer's cells: adds the word the caret is in (or just after) to the dictionary, as F1's ⌥W. + /// + private void AddDockedWordAtCaret(DockedComposer composer) + { + var lines = composer.Body.Split('\n'); + var row = composer.Editor.CurrentLine - 1; + if (row >= 0 && row < lines.Length && SpellChecker.WordAt(lines[row], composer.Editor.CurrentColumn - 1) is { } word) + { + AddComposerWord(word); + } + } + + /// The native editor's channel for the docked composer in , for the tests. + internal ComposerSession? DockedComposerSession(string windowId) => _dockedSessions.GetValueOrDefault(windowId); + + /// F1 open in the host's editor: what it was opened for, and what it holds now. Read on the client's thread. + private sealed class NativeCompose(string target, bool canSend, MooEdit? edit) + { + internal string Target { get; } = target; + + internal bool CanSend { get; } = canSend; + + internal MooEdit? Edit { get; } = edit; + + internal string Body { get; set; } = string.Empty; + + internal ComposeEscaping Escaping { get; set; } + + internal ComposerSession Session { get; set; } = null!; + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index e8a7a11d..99d4bcee 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -284,7 +284,7 @@ private void RunQuickMacro(string sessionKey, string descriptor) private IWindowControl NewDockedComposer(TerminalPanelContext context) { - var composer = new DockedComposer(context.WindowId, context.SessionKey, _screens, _ink.Accent); + var composer = new DockedComposer(context.WindowId, context.SessionKey, _screens, _ink.Accent, DescribeDocked); if (_composeDrafts.TryGetValue(context.SessionKey, out var draft)) { composer.Load(draft.Body, draft.Escaping); @@ -362,6 +362,14 @@ private void SyncDockedComposers(string? sessionKey) private void SyncComposerBands() { var armed = ArmedComposer(); + + // The dictionary is opened the first time a docked composer takes the keyboard, as F1 opens it on its first + // opening: a client that never writes a post reads none. + if (armed is { Spelling: null } && ComposerSpelling() is { } checker) + { + armed.UseSpelling(checker, _screens.Colour(ScreenPalette.Warn)); + } + foreach (var composer in _dockedComposers.Values) { composer.Armed = ReferenceEquals(composer, armed); @@ -474,6 +482,13 @@ private void ArmClickedComposer() return null; } + if (alt && key.Key == ConsoleKey.W && composer.Spelling is not null) + { + e.Handled = true; + AddDockedWordAtCaret(composer); + return null; + } + if (key.Key == ConsoleKey.Escape && key.Modifiers == 0) { e.Handled = true; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 5dbb1822..cbdc7fd1 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -927,7 +927,7 @@ public SharpMUTermApp( _gameData = new GameDataOverlay(_system, _time); _screens = ScreenTheme.For(_theme); _settings = new SettingsOverlay(_system, _screens) { SearchHost = SettingsSearchHost() }; - _composer = new ComposeOverlay(_system, _spelling, _screens); + _composer = new ComposeOverlay(_system, ComposerSpelling, _screens); _packageView = new ListOverlay(_system, _screens); _sendMenu = new ListOverlay(_system, _screens); _layoutsView = new ListOverlay(_system, _screens); @@ -1193,7 +1193,7 @@ public string RenderSnapshot(string? view = null) if (string.Equals(view, "compose", StringComparison.OrdinalIgnoreCase) || string.Equals(view, "compose-literal", StringComparison.OrdinalIgnoreCase)) { - _composer.Toggle( + OpenComposer( DemoScene.MainCharacterName, "+bbpost 12=The Long Winter\n\nThe caravan reached the pass at dusk, 100% frozen and\n" + "short two horses. [Nobody] said what everyone was thinking.\n\n" @@ -1208,7 +1208,7 @@ public string RenderSnapshot(string? view = null) // save and no escaping. The demo has no MCP session, so the edit is handed in as the composer takes it. if (string.Equals(view, "moo-edit", StringComparison.OrdinalIgnoreCase)) { - _composer.Toggle( + OpenComposer( DemoScene.MainCharacterName, "\"Usage: look [object]\";\nif (!args)\n player:tell(this.location:description());\n return 1;\nendif\n" + "thing = player:my_match_object(argstr);\nthing:look_self();", @@ -5085,15 +5085,15 @@ private void ToggleComposer() // Any surface, not just a settings screen. The settings screens are the case with teeth — see the // paste reasoning above — but the rule this app already states is that a modal surface owns the // screen, and the composer is one, so it may not be stacked on top of another. - if (!_composer.IsOpen && AnyOverlayOpen) + if (!ComposerOpen && AnyOverlayOpen) { RefuseCommand($"close {OpenOverlayName()} first — the composer cannot open over it"); return; } - if (_composer.IsOpen) + if (ComposerOpen) { - _composer.Close(); + CloseComposer(); return; } @@ -5106,7 +5106,7 @@ private void ToggleComposer() ? kept : new ComposeResult(string.Empty, ComposeEscaping.AsTyped); - _composer.Toggle( + OpenComposer( session is null ? string.Empty : SessionTitle(session), draft.Body, draft.Escaping, @@ -5172,7 +5172,7 @@ private void SendComposed(ComposeResult result) // Close first, then forget: closing raises Closed, which is what keeps a draft, so a removal // before it is undone by the very act of shutting the window — the post came back next time it // was opened, already sent. - _composer.Close(); + CloseComposer(); _composeDrafts.Remove(session.SessionKey); SyncDockedComposers(session.SessionKey); HistoryFor(BarKind(ActiveBar())).Add(line); @@ -5409,7 +5409,7 @@ private void ToggleHistorySearch() /// private bool AnyOverlayOpen => PaletteIsOpen || _settings.IsOpen || _quit.IsOpen || _messageLog.IsOpen || _historySearch.IsOpen - || _prefixPanel.IsOpen || _composer.IsOpen || _search.IsOpen || _gameData.IsOpen || _packageView.IsOpen || _sendMenu.IsOpen + || _prefixPanel.IsOpen || ComposerOpen || _search.IsOpen || _gameData.IsOpen || _packageView.IsOpen || _sendMenu.IsOpen || _layoutsView.IsOpen || _welcomeView.IsOpen; /// @@ -5429,7 +5429,7 @@ private void ToggleSearch() return; } - if (_composer.IsOpen) + if (ComposerOpen) { RefuseCommand("close the composer first — search cannot open over it"); return; @@ -5504,7 +5504,7 @@ private IReadOnlyList SearchableWindows(bool all) /// private bool ComposerIsInTheWay(string surface) { - if (!_composer.IsOpen) + if (!ComposerOpen) { return false; } @@ -7095,9 +7095,9 @@ private QuitFacts QuitFactsNow() // The open composer's *own* character is then excluded from the stored count, because after Esc // and F1 that post is in both places at once: the dictionary kept it on the way out and the // window is holding it again. Counting both said "2 unsent drafts" for one post. - var openKey = _composer.IsOpen ? ComposeDraftKey(activeId) : null; + var openKey = ComposerOpen ? ComposeDraftKey(activeId) : null; var posts = _composeDrafts.Count(d => d.Key != openKey) - + (_composer.IsOpen && _composer.Body.Trim().Length > 0 ? 1 : 0); + + (ComposerOpen && ComposerBody.Trim().Length > 0 ? 1 : 0); var drafts = holding.Count(w => w.Id != activeId) + bars + posts; // An open settings screen is deliberately not among the facts. It used to contribute "F5 is open diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs new file mode 100644 index 00000000..0f3dedda --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs @@ -0,0 +1,406 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Input; +using Avalonia.Interactivity; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Telnet; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Tui; +using SharpMUTerm.Tui.Tests; +using SkiaSharp; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's composer, driven from the real client in the window host over a connected session: F1 opens the native +/// editor over the cells, typing and ⌃S send exactly what the cell composer sends, Esc keeps the draft, the wavy lines +/// are the model's marks, ⌥W and the right-click menu reach the dictionary, a MOO edit saves its lines, and the docked +/// composer's editor arms, sends and releases through the client's one fact. +/// +[NotInParallel] +public class NativeComposerTests +{ + private static readonly MooEdit Look = new("#98.look", "Test:look", "moo-code", ["player:tell(\"Hi.\");", "return 1;"]); + + private sealed record Rig(Window Window, TerminalView View, DesktopLayer Layer, SharpMUTermApp App, AvaloniaConsoleDriver Driver, RecordingTelnetSession Telnet); + + private static SpellChecker Dictionary() => + SpellChecker.FromStreams(new MemoryStream("5\nhello\nthe\nworld\nwaves\nsits\n"u8.ToArray()), new MemoryStream("SET UTF-8\n"u8.ToArray()), "en_GB"); + + private static Task Run(Func body, bool spelling = false) => + Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(120, 34); + var view = new TerminalView(driver, SKColors.White, new SKColor(0x1e, 0x1e, 0x24), 14, null); + var root = new Panel(); + root.Children.Add(view); + var layer = new DesktopLayer(view, HostChrome.HeaderAndRail); + root.Children.Add(layer); + driver.Composer.Attach(root, layer, view, layer.FocusArmedComposer); + var window = new Window { Content = root, Width = 1100, Height = 760 }; + window.Show(); + view.Focus(); + + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }); + config.Worlds.Add(world); + var checker = spelling ? Dictionary() : null; + var app = new SharpMUTermApp( + config, + WindowHost.Create(driver, clipboard: null) with + { + Audio = null, + Presence = null, + Announcer = null, + NativeSettings = null, + NativePalette = null, + RunsInline = true, + }, + spelling: checker is null ? null : () => checker); + var telnet = new RecordingTelnetSession(); + app.TelnetFactory = _ => telnet; + + // No loop runs here, so a key the window hands the driver is delivered the way the loop would deliver it. + driver.KeyPressed += (_, key) => app.SimulateKey(key); + try + { + app.BindWorldWithoutConnecting(world).ConnectAsync().GetAwaiter().GetResult(); + app.RenderNextFrame(); + Drain(); + return body(new Rig(window, view, layer, app, driver, telnet)); + } + finally + { + app.DisposeAsync().AsTask().GetAwaiter().GetResult(); + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + private static void Drain() + { + DesktopLayerTests.Drain(); + DesktopLayerTests.Drain(); + } + + private static ComposerOverlay OpenF1(Rig rig) + { + rig.App.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + Drain(); + rig.Window.UpdateLayout(); + Drain(); + return rig.Driver.Composer.Overlay ?? throw new InvalidOperationException("F1 did not open in the window"); + } + + private static void Type(ComposerEditor editor, string text) + { + editor.RaiseEvent(new TextInputEventArgs { RoutedEvent = InputElement.TextInputEvent, Text = text, Source = editor }); + Drain(); + } + + private static void Press(ComposerEditor editor, Key key, KeyModifiers modifiers = KeyModifiers.None) + { + editor.RaiseEvent(new KeyEventArgs { RoutedEvent = InputElement.KeyDownEvent, Key = key, KeyModifiers = modifiers, Source = editor }); + Drain(); + } + + // ── F1 ─────────────────────────────────────────────────────────────────────────────────── + + [Test] + public async Task F1OpensTheNativeEditorFocusedOverTheCellsAndNotTheCellModal() + { + var (focused, cellOpen, header, footer, below, margin) = await Run(rig => + { + var overlay = OpenF1(rig); + var root = (Panel)rig.Window.Content!; + return (overlay.Composer.Editor.IsFocused, rig.App.Composer.IsOpen, overlay.Composer.HeaderText, overlay.Composer.FooterText, + root.Children.IndexOf(overlay) == root.Children.IndexOf(rig.Layer) - 1, overlay.Margin == rig.View.Margin); + }); + + await Assert.That(focused).IsTrue(); + await Assert.That(cellOpen).IsFalse(); + await Assert.That(header).Contains("COMPOSE").And.Contains("to Ann").And.Contains("as typed").And.Contains("no dictionary"); + await Assert.That(footer).Contains("⌃S send").And.Contains("⌥L escaping").And.Contains("Esc close (keeps the draft)"); + await Assert.That(below).IsTrue().Because("under the layer, so a toast is drawn over it"); + await Assert.That(margin).IsTrue().Because("over the cells, clear of the native header and sidebar"); + } + + [Test] + [Arguments("+pose waves\nand sits", false)] + [Arguments("+bbpost 1=Title\n\nFirst, 50% [done].\n", true)] + public async Task TypingAndCtrlSSendWhatTheCellComposerSends(string draft, bool literal) + { + var (sent, open) = await Run(rig => + { + var overlay = OpenF1(rig); + var editor = overlay.Composer.Editor; + Type(editor, draft); + if (literal) + { + Press(editor, Key.L, KeyModifiers.Alt); + } + + Press(editor, Key.S, KeyModifiers.Control); + return (rig.Telnet.Lines.ToList(), rig.Driver.Composer.Overlay is not null); + }); + + await Assert.That(sent).IsEquivalentTo(new[] { ComposeMessage.Build(draft, literal ? ComposeEscaping.Literal : ComposeEscaping.AsTyped) }); + await Assert.That(open).IsFalse().Because("a send closes it"); + } + + [Test] + public async Task AltLFlipsTheHeadersModeFromTheClientsModel() + { + var header = await Run(rig => + { + var overlay = OpenF1(rig); + Press(overlay.Composer.Editor, Key.L, KeyModifiers.Alt); + return overlay.Composer.HeaderText; + }); + + await Assert.That(header).Contains("literal"); + } + + [Test] + public async Task EscKeepsTheDraftForTheNextF1() + { + var (closed, sent, reopened, focusBack) = await Run(rig => + { + var first = OpenF1(rig); + Type(first.Composer.Editor, "half a post"); + Press(first.Composer.Editor, Key.Escape); + var closed = rig.Driver.Composer.Overlay is null; + var focus = rig.View.IsFocused; + var second = OpenF1(rig); + return (closed, rig.Telnet.Lines.ToList(), second.Composer.Editor.Text, focus); + }); + + await Assert.That(closed).IsTrue(); + await Assert.That(sent).IsEmpty(); + await Assert.That(reopened).IsEqualTo("half a post"); + await Assert.That(focusBack).IsTrue().Because("the keyboard goes back to the cells"); + } + + [Test] + public async Task CtrlEnterAndShiftEnterAreNewlinesAndAltEnterIsTheWindows() + { + var text = await Run(rig => + { + var editor = OpenF1(rig).Composer.Editor; + Type(editor, "one"); + Press(editor, Key.Enter, KeyModifiers.Control); + Type(editor, "two"); + Press(editor, Key.Enter, KeyModifiers.Shift); + Type(editor, "three"); + return editor.Text; + }); + + await Assert.That(text).IsEqualTo("one\ntwo\nthree"); + } + + // ── spelling ───────────────────────────────────────────────────────────────────────────── + + [Test] + public async Task TheWavyLinesAreTheModelsMarks() + { + var (marks, model, cell, rects, header) = await Run( + rig => + { + var overlay = OpenF1(rig); + Type(overlay.Composer.Editor, "hello wrold\nthe waves zork"); + rig.Window.UpdateLayout(); + Drain(); + var session = overlay.Session; + var text = overlay.Composer.Editor.Text!; + return (overlay.Composer.Editor.Marks.ToList(), session.Model.Marks.ToList(), + ComposeOverlay.ModelFor("Ann", text, ComposeEscaping.AsTyped, null, Dictionary(), true).Marks.ToList(), + overlay.Composer.Editor.MarkRects().Count, overlay.Composer.HeaderText); + }, + spelling: true); + + await Assert.That(marks).IsEquivalentTo(new[] { new SpellRange(6, 5), new SpellRange(22, 4) }); + await Assert.That(marks).IsEquivalentTo(model); + await Assert.That(marks).IsEquivalentTo(cell).Because("the cell composer marks the same words"); + await Assert.That(rects).IsEqualTo(2).Because("each mark is a rectangle of the laid-out text, so a line is drawn under it"); + await Assert.That(header).Contains("en_GB"); + } + + [Test] + public async Task AltWAddsTheWordAtTheCaret() + { + var marks = await Run( + rig => + { + var editor = OpenF1(rig).Composer.Editor; + Type(editor, "hello wrold"); + Press(editor, Key.W, KeyModifiers.Alt); + return editor.Marks.ToList(); + }, + spelling: true); + + await Assert.That(marks).IsEmpty(); + } + + [Test] + public async Task TheRightClickMenuOffersSuggestionsAndReplacesTheWord() + { + var (headers, text) = await Run( + rig => + { + var composer = OpenF1(rig).Composer; + Type(composer.Editor, "hello wrold"); + var menu = composer.OpenMenu(8); + var items = menu.ItemsSource!.OfType().ToList(); + var headers = items.Select(i => i.Header?.ToString() ?? string.Empty).ToList(); + items.First(i => (string?)i.Header == "world").RaiseEvent(new RoutedEventArgs(MenuItem.ClickEvent)); + menu.Close(); + Drain(); + return (headers, composer.Editor.Text); + }, + spelling: true); + + await Assert.That(headers).Contains("world"); + await Assert.That(headers).Contains("Add “wrold” to dictionary"); + await Assert.That(headers).Contains("Proportional font"); + await Assert.That(text).IsEqualTo("hello world"); + } + + // ── MOO edits ──────────────────────────────────────────────────────────────────────────── + + [Test] + public async Task AMooEditOpensNativelyAndCtrlSSavesItsLines() + { + var (header, footer, saved, sent) = await Run(rig => + { + rig.Telnet.ReceiveMooEdit(Look); + Drain(); + var overlay = rig.Driver.Composer.Overlay!; + var editor = overlay.Composer.Editor; + editor.CaretIndex = editor.Text!.Length; + Type(editor, "\n// 100% [sure]; done\n"); + var header = overlay.Composer.HeaderText; + var footer = overlay.Composer.FooterText; + Press(editor, Key.S, KeyModifiers.Control); + return (header, footer, rig.Telnet.SavedEdits.Single().Lines.ToList(), rig.Telnet.Lines.ToList()); + }); + + await Assert.That(header).Contains("EDIT").And.Contains("Test:look").And.DoesNotContain("as typed"); + await Assert.That(footer).Contains("⌃S save").And.DoesNotContain("⌥L"); + await Assert.That(saved).IsEquivalentTo(new[] { "player:tell(\"Hi.\");", "return 1;", "// 100% [sure]; done" }); + await Assert.That(sent).IsEmpty(); + } + + // ── the docked composer ────────────────────────────────────────────────────────────────── + + private static ComposerView Dock(Rig rig) + { + rig.App.DispatchCommand("panel:composer"); + rig.App.RenderNextFrame(); + rig.App.RenderNextFrame(); + Drain(); + rig.Window.UpdateLayout(); + Drain(); + return rig.Layer.Composers.Values.Single(); + } + + [Test] + public async Task TheDockedEditorLiesOverItsPaneAndTakesTheKeyboardWhenArmed() + { + var (focused, armed, header, footer, width) = await Run(rig => + { + var composer = Dock(rig); + return (composer.Editor.IsFocused, composer.Model!.Armed, composer.HeaderText, composer.FooterText, composer.Bounds.Width); + }); + + await Assert.That(armed).IsTrue(); + await Assert.That(focused).IsTrue(); + await Assert.That(header).Contains("COMPOSE").And.Contains("to Ann"); + await Assert.That(footer).Contains("⌃S").And.Contains("Esc"); + await Assert.That(width).IsGreaterThan(0); + } + + [Test] + public async Task TypingInTheDockedEditorIsTheDraftAndCtrlSSendsIt() + { + var (draft, sent, after) = await Run(rig => + { + var composer = Dock(rig); + var windowId = composer.Session!.Model.Place == ComposerPlace.Docked ? rig.Layer.Composers.Keys.Single() : string.Empty; + Type(composer.Editor, "+pose waves\nand sits"); + var draft = rig.App.DockedComposerIn(windowId)!.Body; + Press(composer.Editor, Key.S, KeyModifiers.Control); + rig.App.RenderNextFrame(); + Drain(); + return (draft, rig.Telnet.Lines.ToList(), rig.Layer.Composers.Values.Single().Editor.Text); + }); + + await Assert.That(draft).IsEqualTo("+pose waves\nand sits"); + await Assert.That(sent).IsEquivalentTo(new[] { "+pose waves%rand sits" }); + await Assert.That(after).IsEqualTo(string.Empty).Because("the client cleared the draft, and the editor takes the client's text"); + } + + [Test] + public async Task EscReleasesToTheCellsAndAClickArmsAgain() + { + var (releasedArmed, viewFocused, rearmed, editorFocused) = await Run(rig => + { + var composer = Dock(rig); + Press(composer.Editor, Key.Escape); + rig.App.RenderNextFrame(); + Drain(); + var released = rig.App.ComposerArmed; + var view = rig.View.IsFocused; + + var centre = composer.Editor.TranslatePoint(new Point(composer.Editor.Bounds.Width / 2, composer.Editor.Bounds.Height / 2), rig.Window)!.Value; + rig.Window.MouseDown(centre, MouseButton.Left); + rig.Window.MouseUp(centre, MouseButton.Left); + Drain(); + rig.App.RenderNextFrame(); + Drain(); + return (released, view, rig.App.ComposerArmed, rig.Layer.Composers.Values.Single().Editor.IsKeyboardFocusWithin); + }); + + await Assert.That(releasedArmed).IsFalse(); + await Assert.That(viewFocused).IsTrue(); + await Assert.That(rearmed).IsTrue(); + await Assert.That(editorFocused).IsTrue(); + } + + [Test] + public async Task F1FromTheDockedEditorOpensTheSameDraftFullScreen() + { + var (body, docked) = await Run(rig => + { + var composer = Dock(rig); + Type(composer.Editor, "half a post"); + Press(composer.Editor, Key.F1); + rig.App.RenderNextFrame(); + Drain(); + return (rig.Driver.Composer.Overlay?.Composer.Editor.Text, rig.Layer.Composers.Count); + }); + + await Assert.That(body).IsEqualTo("half a post"); + await Assert.That(docked).IsEqualTo(0).Because("F1 covers the panes, as the cell modal does"); + } + + [Test] + public async Task TheDockedEditorHandsTheClientsChordsOnAndKeepsItsOwn() + { + await Assert.That(ComposerView.ReachesTheClient(Key.P, KeyModifiers.Control)).IsTrue(); + await Assert.That(ComposerView.ReachesTheClient(Key.Up, KeyModifiers.Control)).IsTrue(); + await Assert.That(ComposerView.ReachesTheClient(Key.J, KeyModifiers.Alt)).IsTrue(); + await Assert.That(ComposerView.ReachesTheClient(Key.F2, KeyModifiers.None)).IsTrue(); + await Assert.That(ComposerView.ReachesTheClient(Key.C, KeyModifiers.Control)).IsFalse(); + await Assert.That(ComposerView.ReachesTheClient(Key.Z, KeyModifiers.Control)).IsFalse(); + await Assert.That(ComposerView.ReachesTheClient(Key.Left, KeyModifiers.Alt)).IsFalse(); + await Assert.That(ComposerView.ReachesTheClient(Key.A, KeyModifiers.None)).IsFalse(); + } + + private static HeadlessUnitTestSession Session => TerminalViewTests.Session; +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SharpMUTerm.Avalonia.Tests.csproj b/tests/SharpMUTerm.Avalonia.Tests/SharpMUTerm.Avalonia.Tests.csproj index ad6993ea..1ce5bad6 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SharpMUTerm.Avalonia.Tests.csproj +++ b/tests/SharpMUTerm.Avalonia.Tests/SharpMUTerm.Avalonia.Tests.csproj @@ -17,6 +17,9 @@ + + + diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index abcfbce5..bc149d46 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -3,6 +3,7 @@ using Avalonia.Input; using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Composer; using SharpMUTerm.Client.Palette; using SharpMUTerm.Client.Panels; using SharpMUTerm.Client.Settings; @@ -200,6 +201,45 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! covered.Add(SurfaceCatalog.Notice); } + // F1: the window's editor is handed the model the cell window draws for the same draft, in each mode and for a + // MOO edit. Two clients, one with the window's editor and one without, opened on the same scene. + foreach (var view in new[] { "compose", "compose-literal", "moo-edit" }) + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + var composer = new FakeComposer(); + await using var native = App(nativeDriver, DemoScene.Build(), composer: composer); + native.RenderSnapshot(view); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var cells = App(cellDriver, DemoScene.Build()); + cells.RenderSnapshot(view); + + await Assert.That(composer.Session).IsNotNull().Because($"{view}: F1 opened in the window's editor"); + await Assert.That(native.Composer.IsOpen).IsFalse().Because($"{view}: and not in cells under it"); + await Assert.That(cells.DrawnModel(SurfaceCatalog.Compose)).IsEqualTo((object)composer.Session!.Model).Because(view); + } + + covered.Add(SurfaceCatalog.Compose); + + // The docked composer: the panel's model is the one its cells drew in that frame, and the one a client with no + // native editor draws for the same scene. + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + await using var native = App(nativeDriver, DemoScene.Build(), composer: new FakeComposer()); + native.RenderSnapshot("panel-composer"); + var panel = nativeDriver.Pointer.Panels.Single(p => p.PanelId == PanelIds.Composer); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var cells = App(cellDriver, DemoScene.Build()); + cells.RenderSnapshot("panel-composer"); + + await Assert.That(panel.Composer).IsNotNull(); + await Assert.That(panel.Composer!.Body).IsNotEmpty().Because("the scene types a draft"); + await Assert.That(native.DrawnModel(PanelIds.Composer, panel.WindowId)).IsEqualTo((object)panel.Composer).Because("panel-composer"); + await Assert.That(cells.DrawnModel(PanelIds.Composer, panel.WindowId)).IsEqualTo((object)panel.Composer).Because("panel-composer: the cell client"); + covered.Add(PanelIds.Composer); + } + var drawnNatively = SurfaceCatalog.All.Where(s => s.On(SurfaceHosts.Window).HasFlag(SurfaceDrawing.Native)).Select(s => s.Id); await Assert.That(covered).IsEquivalentTo(drawnNatively).Because("every surface the window draws natively has its model compared here"); } @@ -323,10 +363,144 @@ await Same("notice: action", "layout-combat", }); probed.Add(SurfaceCatalog.Notice); + // F1: ⌃S in the window's editor and ⌃S in the cell window send the same command for the same draft — as typed and + // literal, one line and several paragraphs. Esc keeps the draft, and its mode, in both. + foreach (var (draft, literal) in new[] + { + ("+pose waves\nand sits", false), + ("say 100% [sure]; {x}", true), + ("+bbpost 1=Title\n\nFirst paragraph.\n\nSecond, 50% [done].\n", false), + ("+bbpost 1=Title\n\nFirst paragraph.\n\nSecond, 50% [done].\n", true), + }) + { + var native = await ComposeOnTheWire(native: true, draft, literal, send: true); + var cells = await ComposeOnTheWire(native: false, draft, literal, send: true); + await Assert.That(native.Sent).IsNotEmpty(); + await Assert.That(native.Sent).IsEquivalentTo(cells.Sent).Because($"compose: send '{draft}' literal={literal}"); + await Assert.That(native.Outcome).IsEqualTo(cells.Outcome); + } + + { + var native = await ComposeOnTheWire(native: true, "half a post", literal: true, send: false); + var cells = await ComposeOnTheWire(native: false, "half a post", literal: true, send: false); + await Assert.That(native.Sent).IsEmpty(); + await Assert.That(native.Outcome).IsEqualTo(cells.Outcome).Because("compose: close keeps the draft"); + await Assert.That(native.Outcome).Contains("draft=half a post literal"); + } + + probed.Add(SurfaceCatalog.Compose); + + // The docked composer: ⌃S from the window's editor and from the cells send one command to its character, and + // Esc releases it to the command line in both. + { + var native = await DockedOnTheWire(native: true); + var cells = await DockedOnTheWire(native: false); + await Assert.That(native.Sent).IsEquivalentTo(new[] { "+pose waves%rand sits" }); + await Assert.That(native.Sent).IsEquivalentTo(cells.Sent).Because("composer: send"); + await Assert.That(native.Outcome).IsEqualTo(cells.Outcome).Because("composer: release"); + probed.Add(PanelIds.Composer); + } + var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); await Assert.That(probed).IsEquivalentTo(acting).Because("every native surface with actions has a probe here"); } + /// + /// A connected client writes in F1 — the window's editor through its session, or the cell + /// window through its keys — and sends it with ⌃S or closes it with Esc. What reached the wire, and the state left. + /// + private static async Task<(IReadOnlyList Sent, string Outcome)> ComposeOnTheWire(bool native, string draft, bool literal, bool send) + { + using var driver = new AvaloniaConsoleDriver(140, 36); + var composer = native ? new FakeComposer() : null; + var (app, telnet) = await Connected(driver, composer); + await using var _ = app; + app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + if (composer is not null) + { + var session = composer.Session!; + session.Edited(draft); + if (literal) + { + session.ToggleEscaping(); + } + + if (send) + { + session.Send(draft); + } + else + { + session.Close(draft); + } + } + else + { + app.Composer.SimulateTyping(draft); + if (literal) + { + app.Composer.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.L, false, true, false)); + } + + app.Composer.SimulateKey(send + ? new ConsoleKeyInfo('\x13', ConsoleKey.S, false, false, true) + : new ConsoleKeyInfo('\x1b', ConsoleKey.Escape, false, false, false)); + } + + // Where the draft went: reopened, F1 says what it holds and in which mode. + app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + var held = composer is not null + ? $"{composer.Session!.Model.Body} {(composer.Session.Model.Escaping == ComposeEscaping.Literal ? "literal" : "as typed")}" + : $"{app.Composer.Body} {(app.Composer.HeaderMarkup.Contains("literal", StringComparison.Ordinal) ? "literal" : "as typed")}"; + return (telnet.Lines.ToList(), Outcome(app) + " | draft=" + held); + } + + /// + /// A connected client docks its composer, types into it — the window's editor through its session, or the cells + /// through the composer's keys — sends with ⌃S, types again and releases with Esc. + /// + private static async Task<(IReadOnlyList Sent, string Outcome)> DockedOnTheWire(bool native) + { + using var driver = new AvaloniaConsoleDriver(140, 36); + var (app, telnet) = await Connected(driver, native ? new FakeComposer() : null); + await using var _ = app; + app.DispatchCommand("panel:composer"); + app.RenderNextFrame(); + var windowId = TerminalPanels.WindowId(PanelIds.Composer, "Quiet.Ann"); + var session = native ? driver.Pointer.Panels.Single(p => p.PanelId == PanelIds.Composer).ComposerSession! : null; + if (session is not null) + { + session.Edited("+pose waves\nand sits"); + session.Send("+pose waves\nand sits"); + session.Edited("next"); + session.Release(); + } + else + { + app.SimulateComposerTyping("+pose waves\nand sits"); + app.SimulateKey(new ConsoleKeyInfo('\x13', ConsoleKey.S, false, false, true)); + app.SimulateComposerTyping("next"); + app.SimulateKey(new ConsoleKeyInfo('\x1b', ConsoleKey.Escape, false, false, false)); + } + + return (telnet.Lines.ToList(), $"{Outcome(app)} | armed={app.ComposerArmed} | docked={app.DockedComposerIn(windowId)!.Body}"); + } + + private static async Task<(SharpMUTermApp App, SharpMUTerm.Tui.Tests.RecordingTelnetSession Telnet)> Connected( + AvaloniaConsoleDriver driver, INativeComposer? composer) + { + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }); + config.Worlds.Add(world); + var app = App(driver, config, composer: composer); + var telnet = new SharpMUTerm.Tui.Tests.RecordingTelnetSession(); + app.TelnetFactory = _ => telnet; + await app.BindWorldWithoutConnecting(world).ConnectAsync(); + app.RenderNextFrame(); + return (app, telnet); + } + private static (bool Echo, int Saves) SettingsReset(bool native) { using var driver = new AvaloniaConsoleDriver(140, 36); @@ -464,7 +638,8 @@ private static SharpMUTermApp App( INativeSettings? settings = null, INativePalette? palette = null, Action? save = null, - HostKeys? keys = null) => + HostKeys? keys = null, + INativeComposer? composer = null) => new(config, WindowHost.Create(driver, clipboard: null) with { Capabilities = WindowOptions.Capabilities, @@ -475,8 +650,21 @@ private static SharpMUTermApp App( NativeSettings = settings, NativePalette = palette, Keys = keys ?? WindowHost.Keys, + NativeComposer = composer, }, save: save); + /// A window editor that only records the session it was handed, so the client's side can be driven. + private sealed class FakeComposer : INativeComposer + { + public ComposerSession? Session { get; private set; } + + public bool Available => true; + + public void Open(ComposerSession session, PanelInk ink) => Session = session; + + public void Close() => Session = null; + } + private sealed class FakeSettings : INativeSettings { public SettingsForm? Form { get; private set; } diff --git a/tests/SharpMUTerm.Client.Tests/ComposerModelTests.cs b/tests/SharpMUTerm.Client.Tests/ComposerModelTests.cs new file mode 100644 index 00000000..b5ef0d60 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/ComposerModelTests.cs @@ -0,0 +1,138 @@ +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Client.Tests; + +/// +/// The composer's model both hosts draw (), the marks a dictionary puts on a whole buffer +/// (), and the channel a host's editor talks back through (). +/// +public class ComposerModelTests +{ + private static SpellChecker Dictionary() => + SpellChecker.FromStreams(new MemoryStream("4\nhello\nthe\nworld\npose\n"u8.ToArray()), new MemoryStream("SET UTF-8\n"u8.ToArray()), "en_GB"); + + private static ComposerModel Post(string body, ComposeEscaping escaping = ComposeEscaping.AsTyped, SpellChecker? spelling = null) => + ComposerModel.Create(ComposerPlace.FullScreen, "Ann", body, escaping, null, spelling, canSend: true, armed: true, revision: 1); + + [Test] + public async Task TheCommandIsComposeMessageBuildOfTheDraft() + { + foreach (var escaping in new[] { ComposeEscaping.AsTyped, ComposeEscaping.Literal }) + { + const string draft = "+bbpost 1=Title\n\nFirst, 50% [done].\n"; + await Assert.That(Post(draft, escaping).Command).IsEqualTo(ComposeMessage.Build(draft, escaping)); + } + } + + [Test] + public async Task AMooEditHasNoCommandNoDictionaryAndOnlySaveAndClose() + { + var model = ComposerModel.Create(ComposerPlace.FullScreen, "Ann", "return 1;", ComposeEscaping.Literal, + new ComposerEdit("Test:look", "moo-code"), Dictionary(), canSend: true, armed: true, revision: 1); + + await Assert.That(model.Command).IsNull(); + await Assert.That(model.Dictionary).IsNull(); + await Assert.That(model.Marks).IsEmpty(); + await Assert.That(model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "Esc" }); + await Assert.That(model.Keys[0].Label).IsEqualTo("save"); + } + + [Test] + public async Task LineEndingsAreTheClientsBreaks() + { + await Assert.That(Post("a\r\nb").Body).IsEqualTo("a\nb"); + } + + [Test] + public async Task TwoModelsBuiltFromTheSameDraftAreEqual() + { + var spelling = Dictionary(); + var a = Post("hello wrold\nthe pose", spelling: spelling); + var b = Post("hello wrold\nthe pose", spelling: spelling); + + await Assert.That(a).IsEqualTo(b); + await Assert.That(a.GetHashCode()).IsEqualTo(b.GetHashCode()); + await Assert.That(a).IsNotEqualTo(a with { Revision = 2 }); + await Assert.That(a).IsNotEqualTo(Post("hello wrold\nthe pose", ComposeEscaping.Literal, spelling)); + } + + [Test] + public async Task MarksAreRangesOfTheWholeBufferOnEveryLine() + { + var body = "hello wrold\nthe pose zork"; + var marks = ComposerMarks.For(body, Dictionary()); + + await Assert.That(marks.Select(m => body.Substring(m.Start, m.Length))).IsEquivalentTo(new[] { "wrold", "zork" }); + await Assert.That(ComposerMarks.For(body, null)).IsEmpty(); + } + + [Test] + public async Task TheWordAtTheCaretIsTheOneItIsInOrJustAfter() + { + const string body = "hello wrold\nthe zork"; + await Assert.That(ComposerMarks.WordAt(body, 8)).IsEqualTo("wrold"); + await Assert.That(ComposerMarks.WordAt(body, 11)).IsEqualTo("wrold").Because("just after the word, at the line's end"); + await Assert.That(ComposerMarks.WordAt(body, body.Length)).IsEqualTo("zork"); + await Assert.That(ComposerMarks.WordAt(body, 0)).IsEqualTo("hello"); + } + + [Test] + public async Task TheDockedKeyRowSaysWhatTheCellsSay() + { + await Assert.That(ComposerModel.KeysFor(ComposerPlace.Docked, false, false, true, armed: false).Select(k => k.Label)) + .IsEquivalentTo(new[] { "click here to write", "full screen" }); + await Assert.That(ComposerModel.KeysFor(ComposerPlace.Docked, false, true, true, armed: true).Select(k => k.Key)) + .IsEquivalentTo(new[] { "⌃S", "⌥L", "⌥W", "F1", "Esc" }); + } + + [Test] + public async Task ASessionPassesGesturesOnUntilItEnds() + { + var sent = new List(); + var edited = new List(); + var session = new ComposerSession(Post(string.Empty), null, new ComposerCallbacks + { + Send = sent.Add, + Edited = edited.Add, + }); + + session.Edited("a\r\nb"); + session.Send("a\nb"); + session.End(); + session.Send("late"); + + await Assert.That(edited).IsEquivalentTo(new[] { "a\nb" }); + await Assert.That(sent).IsEquivalentTo(new[] { "a\nb" }); + await Assert.That(session.IsEnded).IsTrue(); + } + + [Test] + public async Task ASessionRaisesChangedOnlyWhenTheModelDiffers() + { + var session = new ComposerSession(Post("x"), null, new ComposerCallbacks()); + var raised = 0; + session.Changed += _ => raised++; + + session.Publish(Post("x")); + session.Publish(Post("y")); + + await Assert.That(raised).IsEqualTo(1); + await Assert.That(session.Model.Body).IsEqualTo("y"); + } + + [Test] + public async Task ASessionMarksWithTheClientsDictionaryOnlyOnceTheModelSaysOne() + { + var spelling = Dictionary(); + var none = new ComposerSession(Post("wrold"), () => spelling, new ComposerCallbacks()); + var some = new ComposerSession(Post("wrold", spelling: spelling), () => spelling, new ComposerCallbacks()); + + await Assert.That(none.Marks("wrold")).IsEmpty().Because("the model says no dictionary is open"); + await Assert.That(some.Marks("hello wrold")).IsEquivalentTo(new[] { new SpellRange(6, 5) }); + await Assert.That(some.Suggestions("wrold")).Contains("world"); + await Assert.That(some.CanAddWords).IsTrue(); + await Assert.That(none.CanAddWords).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs index 48366e94..98f9c273 100644 --- a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -72,7 +72,7 @@ public async Task PanelSurfacesAreKnownPanels() { var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette - or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice)); + or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose)); foreach (var surface in panels) { await Assert.That(PanelIds.Known).Contains(surface.Id); diff --git a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs new file mode 100644 index 00000000..23e1d779 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs @@ -0,0 +1,409 @@ +using System.Drawing; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Telnet; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The composer in a host with its own editor (): F1 opens there instead of the +/// cell modal, on the same draft and the same model; what the host hands back through the session ends in the methods +/// the cell composer's keys end in, so the command a world receives is the cell path's for the same text. The docked +/// composer keeps its cells, and the host's editor rides the panel channel with a session of its own. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class NativeComposerRoutingTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static readonly MooEdit Look = new("#98.look", "Test:look", "moo-code", ["player:tell(\"Hi.\");", "return 1;"]); + + private static ConsoleKeyInfo Key(ConsoleKey key, ConsoleModifiers modifiers = 0) => + new('\0', key, modifiers.HasFlag(ConsoleModifiers.Shift), + modifiers.HasFlag(ConsoleModifiers.Alt), modifiers.HasFlag(ConsoleModifiers.Control)); + + /// A host's editor that records what it was asked to show. + private sealed class FakeComposer(bool available = true) : INativeComposer + { + public bool Available { get; set; } = available; + + public List Opened { get; } = []; + + public int Closed { get; private set; } + + public ComposerSession? Last => Opened.Count > 0 ? Opened[^1] : null; + + public void Open(ComposerSession session, PanelInk ink) => Opened.Add(session); + + public void Close() => Closed++; + } + + /// Records the panels the client publishes, which is how a docked composer's editor reaches a host. + private sealed class PanelPresenter : IPointerPresenter + { + public IReadOnlyList Last { get; private set; } = []; + + public void Hover(PointerTarget target) + { + } + + public void ShowMenu(Point cell, IReadOnlyList items) + { + } + + public bool DrawsMenus => true; + + public void Scrollbars(IReadOnlyList bars) + { + } + + public void Panels(IReadOnlyList panels) => Last = panels; + } + + private sealed record Wired(SharpMUTermApp App, RecordingTelnetSession Telnet, FakeComposer Native, PanelPresenter Pointer, string Key); + + private static async Task Connected(bool native = true) + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }); + config.Worlds.Add(world); + + var fake = new FakeComposer(native); + var pointer = new PanelPresenter(); + var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, null) with + { + NativeComposer = fake, + Pointer = pointer, + }; + var app = new SharpMUTermApp(config, host); + var telnet = new RecordingTelnetSession(); + app.TelnetFactory = _ => telnet; + var session = app.BindWorldWithoutConnecting(world); + await session.ConnectAsync(); + app.RenderNextFrame(); + return new Wired(app, telnet, fake, pointer, session.SessionKey); + } + + /// The cell path's command for a draft: typed into the cell F1 and sent with ⌃S, escaping as given. + private static async Task SentThroughTheCells(string draft, bool literal) + { + var world = await Connected(native: false); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F1)); + world.App.Composer.SimulateTyping(draft); + if (literal) + { + world.App.Composer.SimulateKey(Key(ConsoleKey.L, ConsoleModifiers.Alt)); + } + + world.App.Composer.SimulateKey(Key(ConsoleKey.S, ConsoleModifiers.Control)); + return world.Telnet.Lines.Single(); + } + + // ── F1 ─────────────────────────────────────────────────────────────────────────────────── + + [Test] + public async Task F1OpensTheHostsEditorAndNotTheCellModal() + { + var world = await Connected(); + await using var _ = world.App; + + world.App.SimulateKey(Key(ConsoleKey.F1)); + + await Assert.That(world.Native.Opened.Count).IsEqualTo(1); + await Assert.That(world.App.Composer.IsOpen).IsFalse().Because("the cell modal is not opened under the native editor"); + await Assert.That(world.App.NativeComposerIsOpen).IsTrue(); + + var model = world.Native.Last!.Model; + await Assert.That(model.Place).IsEqualTo(ComposerPlace.FullScreen); + await Assert.That(model.Target).IsEqualTo("Ann"); + await Assert.That(model.CanSend).IsTrue(); + await Assert.That(model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "⌥L", "Esc" }); + } + + [Test] + public async Task AHostWithNowhereToDrawItGetsTheCellComposer() + { + var world = await Connected(native: false); + await using var _ = world.App; + + world.App.SimulateKey(Key(ConsoleKey.F1)); + + await Assert.That(world.Native.Opened).IsEmpty(); + await Assert.That(world.App.Composer.IsOpen).IsTrue(); + } + + [Test] + public async Task TheNativeModelIsTheModelTheCellWindowDrawsForTheSameDraft() + { + var world = await Connected(); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F1)); + var session = world.Native.Last!; + + session.Edited("+pose waves\r\nand sits"); + session.ToggleEscaping(); + + var cell = ComposeOverlay.ModelFor("Ann", "+pose waves\nand sits", ComposeEscaping.Literal, null, null, canSend: true); + await Assert.That(session.Model).IsEqualTo(cell); + await Assert.That(ComposeOverlay.Render(session.Model)).IsEqualTo(ComposeOverlay.Render(cell)); + } + + [Test] + [Arguments("+pose waves\nand sits", false)] + [Arguments("100% [sure]; {x}", true)] + [Arguments("100% [sure]; {x}", false)] + [Arguments("+bbpost 1=Title\n\nFirst paragraph.\n\nSecond, 50% [done].\n", true)] + [Arguments("+bbpost 1=Title\n\nFirst paragraph.\n\nSecond, 50% [done].\n", false)] + public async Task CtrlSInTheHostsEditorSendsWhatTheCellComposerSends(string draft, bool literal) + { + var expected = await SentThroughTheCells(draft, literal); + + var world = await Connected(); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F1)); + var session = world.Native.Last!; + if (literal) + { + session.ToggleEscaping(); + } + + session.Send(draft); + + await Assert.That(world.Telnet.Lines).IsEquivalentTo(new[] { expected }); + await Assert.That(expected).IsEqualTo(ComposeMessage.Build(draft, literal ? ComposeEscaping.Literal : ComposeEscaping.AsTyped)); + await Assert.That(world.App.NativeComposerIsOpen).IsFalse().Because("a send closes it"); + await Assert.That(world.Native.Closed).IsEqualTo(1); + + // Close first, forget after: the next F1 opens empty. + world.App.SimulateKey(Key(ConsoleKey.F1)); + await Assert.That(world.Native.Last!.Model.Body).IsEqualTo(string.Empty); + } + + [Test] + public async Task EscKeepsTheDraftForTheNextF1() + { + var world = await Connected(); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F1)); + var first = world.Native.Last!; + first.ToggleEscaping(); + + first.Close("half a post"); + + await Assert.That(world.App.NativeComposerIsOpen).IsFalse(); + await Assert.That(world.Telnet.Lines).IsEmpty(); + await Assert.That(first.IsEnded).IsTrue(); + + world.App.SimulateKey(Key(ConsoleKey.F1)); + var second = world.Native.Last!; + await Assert.That(second).IsNotSameReferenceAs(first); + await Assert.That(second.Model.Body).IsEqualTo("half a post"); + await Assert.That(second.Model.Escaping).IsEqualTo(ComposeEscaping.Literal).Because("the mode travels with the draft"); + } + + [Test] + public async Task AGestureFromAnEndedSessionDoesNothing() + { + var world = await Connected(); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F1)); + var session = world.Native.Last!; + session.Close("kept"); + + session.Send("sent late"); + + await Assert.That(world.Telnet.Lines).IsEmpty(); + } + + [Test] + public async Task F1StillRefusesOverASettingsScreen() + { + var world = await Connected(); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F7)); + + world.App.SimulateKey(Key(ConsoleKey.F1)); + + await Assert.That(world.Native.Opened).IsEmpty(); + await Assert.That(world.App.StatusMarkup).Contains("close the settings screen first"); + } + + [Test] + public async Task NothingOpensOverTheHostsEditor() + { + var world = await Connected(); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F1)); + + world.App.SimulateKey(Key(ConsoleKey.P, ConsoleModifiers.Control)); + world.App.SimulateKey(Key(ConsoleKey.F7)); + + await Assert.That(world.App.MenuIsOpen).IsFalse(); + await Assert.That(world.App.OpenSettingsKey).IsNull(); + await Assert.That(world.App.NativeComposerIsOpen).IsTrue(); + } + + // ── MOO edits ──────────────────────────────────────────────────────────────────────────── + + [Test] + public async Task AMooEditOpensInTheHostsEditorAndSavesItsLines() + { + var world = await Connected(); + await using var _ = world.App; + + world.Telnet.ReceiveMooEdit(Look); + + var session = world.Native.Last; + await Assert.That(session).IsNotNull(); + await Assert.That(session!.Model.Edit).IsEqualTo(new ComposerEdit("Test:look", "moo-code")); + await Assert.That(session.Model.Dictionary).IsNull().Because("a MOO edit is not checked"); + await Assert.That(session.Model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "Esc" }); + await Assert.That(session.Model.Body).IsEqualTo("player:tell(\"Hi.\");\nreturn 1;"); + + session.Send(session.Model.Body + "\n// 100% [sure]; done\n"); + + var saved = world.Telnet.SavedEdits.Single(); + await Assert.That(saved.Lines).IsEquivalentTo(new[] { "player:tell(\"Hi.\");", "return 1;", "// 100% [sure]; done" }); + await Assert.That(world.Telnet.Lines).IsEmpty(); + await Assert.That(world.App.HeldMooEdit(world.Key)).IsNull(); + } + + [Test] + public async Task AMooEditIsHeldWhileSomethingElseIsOpen() + { + var world = await Connected(); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F7)); + + world.Telnet.ReceiveMooEdit(Look); + + await Assert.That(world.Native.Opened).IsEmpty(); + await Assert.That(world.App.HeldMooEdit(world.Key)).IsEqualTo(Look); + + world.App.SimulateKey(Key(ConsoleKey.F7)); + world.App.SimulateKey(Key(ConsoleKey.F1)); + await Assert.That(world.Native.Last!.Model.Edit).IsNotNull(); + } + + [Test] + public async Task AMooEditIsHeldWhileTheHostsEditorHasAPostOpen() + { + var world = await Connected(); + await using var _ = world.App; + world.App.SimulateKey(Key(ConsoleKey.F1)); + world.Native.Last!.Edited("+bbpost 1=half written"); + + world.Telnet.ReceiveMooEdit(Look); + + await Assert.That(world.Native.Opened.Count).IsEqualTo(1).Because("a post being written is not replaced by wire input"); + await Assert.That(world.App.HeldMooEdit(world.Key)).IsEqualTo(Look); + } + + // ── the docked composer ────────────────────────────────────────────────────────────────── + + private static string OpenDocked(Wired world) + { + world.App.DispatchCommand("panel:composer"); + world.App.RenderNextFrame(); + world.App.RenderNextFrame(); + return TerminalPanels.WindowId(PanelIds.Composer, world.Key); + } + + private static PanelOverlay? DockedPanel(Wired world, string windowId) => + world.Pointer.Last.FirstOrDefault(p => p.PanelId == PanelIds.Composer && p.WindowId == windowId); + + [Test] + public async Task TheDockedComposerReachesTheHostWithTheModelItsCellsDrew() + { + var world = await Connected(); + await using var _ = world.App; + var windowId = OpenDocked(world); + + var panel = DockedPanel(world, windowId); + await Assert.That(panel).IsNotNull(); + await Assert.That((object?)panel!.Composer).IsEqualTo(world.App.DrawnModel(PanelIds.Composer, windowId)); + await Assert.That(panel.ComposerSession).IsSameReferenceAs(world.App.DockedComposerSession(windowId)); + await Assert.That(panel.Composer!.Armed).IsTrue(); + await Assert.That(panel.Composer.Place).IsEqualTo(ComposerPlace.Docked); + } + + [Test] + public async Task TheHostsTextIsTheDockedDraftAndCtrlSSendsIt() + { + var world = await Connected(); + await using var _ = world.App; + var windowId = OpenDocked(world); + var session = world.App.DockedComposerSession(windowId)!; + var before = session.Model.Revision; + + session.Edited("+pose waves\nand sits"); + + var docked = world.App.DockedComposerIn(windowId)!; + await Assert.That(docked.Body).IsEqualTo("+pose waves\nand sits"); + await Assert.That(session.Model.Body).IsEqualTo("+pose waves\nand sits"); + await Assert.That(session.Model.Revision).IsEqualTo(before).Because("the host's own typing does not move the revision"); + + session.Send("+pose waves\nand sits"); + + await Assert.That(world.Telnet.Lines).IsEquivalentTo(new[] { "+pose waves%rand sits" }); + await Assert.That(docked.Body).IsEqualTo(string.Empty); + await Assert.That(session.Model.Revision).IsGreaterThan(before).Because("the client cleared it, so the host takes the client's text"); + } + + [Test] + public async Task EscFromTheHostsEditorReleasesAndAClickArmsAgain() + { + var world = await Connected(); + await using var _ = world.App; + var windowId = OpenDocked(world); + var session = world.App.DockedComposerSession(windowId)!; + + session.Release(); + await Assert.That(world.App.ComposerArmed).IsFalse(); + await Assert.That(session.Model.Armed).IsFalse(); + await Assert.That(world.App.ArmedBarHasFocus).IsTrue(); + + session.Arm(); + await Assert.That(world.App.ComposerArmed).IsTrue(); + await Assert.That(session.Model.Armed).IsTrue(); + } + + [Test] + public async Task TheDockedEditorIsNotPublishedWhileF1IsOpenNatively() + { + var world = await Connected(); + await using var _ = world.App; + var windowId = OpenDocked(world); + world.App.DockedComposerSession(windowId)!.Edited("half a post"); + + world.App.SimulateKey(Key(ConsoleKey.F1)); + world.App.RenderNextFrame(); + + await Assert.That(DockedPanel(world, windowId)).IsNull().Because("F1 covers the panes, as the cell modal does"); + await Assert.That(world.Native.Last!.Model.Body).IsEqualTo("half a post").Because("the docked buffer is the draft F1 opens"); + + world.Native.Last!.Close("half a post and the rest"); + world.App.RenderNextFrame(); + await Assert.That(world.App.DockedComposerIn(windowId)!.Body).IsEqualTo("half a post and the rest"); + await Assert.That(DockedPanel(world, windowId)).IsNotNull(); + } + + [Test] + public async Task WithoutAHostEditorTheDockedPanelCarriesNoSession() + { + var world = await Connected(native: false); + await using var _ = world.App; + var windowId = OpenDocked(world); + + await Assert.That(DockedPanel(world, windowId)).IsNull(); + } +} From 6ff71718b4830e01a2556c1b3dbfadf023190fc9 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 08:18:50 +0000 Subject: [PATCH 031/113] Declare F2, F3, F4 and F6 as list sections, with a native master-detail editor A list declaration kind in Client (SettingsCollection, item-scoped bindings, SettingsContext): add, duplicate, delete, reorder, enable and move to another set, every change through the form's one commit and replacing lists rather than editing them. Package sets are listed read-only with copy-to-edit. The cell screens build their rows from the declarations with every ordinal and frame unchanged, plus Alt+Up/Down to move an item within its set. The desktop window draws each list section as a master-detail editor with the F2 live test under the pattern, and the trigger builder opens it on the new rule. F4's key field asks the host's own MacroKeys verdict. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 6 + CLAUDE.md | 42 +- src/SharpMUTerm.Avalonia/ListEditorView.cs | 891 ++++++++++++++++++ src/SharpMUTerm.Avalonia/SettingsWindow.cs | 50 + .../Contributions/Descriptors.cs | 40 + .../Settings/BuiltInLists.cs | 437 +++++++++ .../Settings/BuiltInSettings.cs | 18 +- src/SharpMUTerm.Client/Settings/ItemValues.cs | 175 ++++ .../Settings/SettingBinding.cs | 58 +- .../Settings/SettingsCollection.cs | 303 ++++++ .../Settings/SettingsForm.cs | 256 ++++- .../Settings/SettingsSearch.cs | 15 +- src/SharpMUTerm.Client/Settings/TextRules.cs | 51 +- .../Surfaces/SurfaceCatalog.cs | 2 +- src/SharpMUTerm.Tui/AliasesScreenRenderer.cs | 43 +- src/SharpMUTerm.Tui/DeclaredFields.cs | 85 ++ src/SharpMUTerm.Tui/KeypadScreenRenderer.cs | 41 +- src/SharpMUTerm.Tui/ScreenChrome.cs | 17 +- src/SharpMUTerm.Tui/ScreenColours.cs | 95 +- src/SharpMUTerm.Tui/ScreenLists.cs | 32 + src/SharpMUTerm.Tui/ScreenModel.cs | 7 +- src/SharpMUTerm.Tui/SettingsSession.cs | 29 + .../SharpMUTermApp.Settings.cs | 24 +- .../SharpMUTermApp.TriggerBuilder.cs | 7 + src/SharpMUTerm.Tui/TimersScreenRenderer.cs | 51 +- src/SharpMUTerm.Tui/TriggersScreenRenderer.cs | 102 +- .../DesktopLayerTests.cs | 9 +- .../ListEditorTests.cs | 220 +++++ .../NativePanelTests.cs | 30 +- .../SettingsWindowTests.cs | 4 +- .../ListSettingsTests.cs | 204 ++++ .../SettingsDeclarationTests.cs | 8 +- .../DeclaredListScreensTests.cs | 158 ++++ .../NativeSettingsRoutingTests.cs | 6 +- 34 files changed, 3274 insertions(+), 242 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/ListEditorView.cs create mode 100644 src/SharpMUTerm.Client/Settings/BuiltInLists.cs create mode 100644 src/SharpMUTerm.Client/Settings/ItemValues.cs create mode 100644 src/SharpMUTerm.Client/Settings/SettingsCollection.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/ListEditorTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/ListSettingsTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/DeclaredListScreensTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a258638..6a866600 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Triggers, aliases, key bindings and timers (F2, F3, F4, F6) open in the desktop window's settings as a list + beside the selected item's fields: tick a box to switch one on or off, add, copy, delete or move it up and down, + and watch the trigger's live test mark the matching lines as you type its pattern. A package's sets are shown + read-only with *Copy to edit*. *Make a trigger from the selection* opens there on the new rule. In the terminal, + Alt+Up and Alt+Down move the item under the cursor within its set, and the settings search finds every one of + their fields. - A narrow terminal gives its room to the game: below 100 columns the connection rail folds to its slim strip on its own (in the desktop window, the sidebar does), and below 100 columns or 30 rows an empty command line is one row tall and grows as you type. At 80×24 a pane is now 72 columns wide instead of 60, two rows taller, diff --git a/CLAUDE.md b/CLAUDE.md index c13d83e6..42c92908 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1669,7 +1669,33 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] scroll away. A customised theme replaced by the picker is kept in `AppConfiguration.CustomThemes` (no schema bump), and listed. Unstyled text on a settings screen takes the scheme's ink (`ScreenChrome.Panel`/`Band` set `ForegroundColor`), not the window's, because the window is still the theme in force while one is previewed. - - Not declared yet: F2–F4, F6 and F10 are listed by title only. + - **F2, F3, F4 and F6 are list sections** (`SettingsCollection`/`SettingsCollection`, `SettingsContext`, + `SettingsItemGroup`, Client; `BuiltInSettings.Triggers`/`Aliases`/`Keypad`/`Timers` in `BuiltInLists.cs`). A + list section has `Scope = SettingScope.Item` and a `Collection`: the noun, the item fields (ordinary descriptors + whose bindings are `SettingBinding.ForItem`, reading `SettingTarget.Item`, defaults off a fresh item), and how + to list, make, copy, rename, add, delete, move within a set (`Move`) and move to another set (`MoveTo`, a + `ChoiceField` with `MovesItem`). Every list operation **replaces** the set's list rather than editing it, the + reads-cross-threads rule below. New kinds for item fields: `DecimalField` (timer interval), `HighlightField` + (`HighlightColours`, the palette F2's picker offers), `FlagsField` (`FlagWords`), `KeyField` (a chord), and + `TextRule` gains `RequiredPattern`, `TriggerPattern` (checked against the rule's own match kind), `Template`, + `Lines` and `Window`. `TextField.Suggest` gives the route its windows and the script its callbacks. Decisions: + - **A package's set is listed, read-only, and never written.** `SettingsForm.Groups` lists the player's sets, + then each installed package's (`set · Package`), and every write to one of those items is refused + (`ReadOnlyRefusal`); `CopyToEdit` copies the set into the player's own through the commit, F10's `c`. + - **What a list needs from the host is a `SettingsContext`** built on the client's thread (`ListContext`): the + route targets, the panes' recent lines (`TriggerTestLines`, so `SettingsForm.Preview` is the cell live test's + `TriggerPreview` over the same corpus), and the host's own answer to which chords a binding can have + (`MacroKeys.Verdict(Host.Keys, …)`, `MacroKeys.Bindable(Host.Keys)`). F4's key field is refused in the window + for what the *window* cannot deliver; `SetKey` also refuses a chord another binding holds. + - **The cell screens build their rows from the declarations** (`DeclaredFields.Item`, which maps each + descriptor to the cell field it always was), in the order `RowFieldOrder`/`EditorFieldOrder` name, so the + ordinals, ⇥ order and every frame are unchanged: F2's match kind is still field 10 on the heading row. + `DeclaredListScreensTests.EachCellScreenDrawsExactlyTheDeclaredFields` holds the two lists together. + - **⌥↑/⌥↓ move an item within its set on the cell screens** (`ScreenRow.Move`, `ScreenLists.Mover`, + `SettingsSession.Reorder`), saved only when it moved, the cursor following; a `⌥↑↓ moves …` hint row sits + under `Del removes …`. That is the one cell row this added. Order is meaning for a trigger (first stop wins). + - The search searches item fields too (`SettingsSearch.Searchable`). F10 is the one section left listed by + title only. - **In the window, a declared section opens a native settings window, generated from the declarations** (`ClientHost.NativeSettings` → `INativeSettings`; Client `SettingsForm`; Avalonia `SettingsWindow`, `SettingsPresenter` on the driver; `OpenSettingsScreen`/`TryOpenNativeSettings` in `SharpMUTermApp.Settings.cs`). @@ -1704,8 +1730,15 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] follows the client's theme (`SettingsForm.IsDark`, read live), so a theme card clicked here flips the window's variant and rebuilds the page. The rest of the window stays on the Simple theme the native menu and tooltips were built against. + - **A list section is a master-detail editor** (`ListEditorView`, Avalonia; `SettingsWindow.ListEditor`): the + sets and their items on the left (an enable check box per item, `+ Add`/`Copy`/`Delete`/`↑`/`↓` over it, ⌥↑/⌥↓, + Delete and Space on the list), the item's declared fields on the right, grouped. It fills the page below the + title and scrolls in its two halves. A package's set is drawn read-only with *Copy to edit*. F2's pattern field + has the live test under it, re-run on every keystroke, each matching line with the match marked. The trigger + builder opens it on the rule it made (`TryOpenNativeSettings(section, item)`); with no window it opens the cell + F2 as before. - Not done: the window is not modal. Screenshots come from a real window under Xvfb, driven with XTest - (`ux-wave4/native-settings-*.png`, `ux-wave6/settings-themes-window-*.png`). + (`ux-wave4/native-settings-*.png`, `ux-wave6/settings-themes-window-*.png`, `ux-wave7/lists-*.png`). - **In the window, ⌃P is a native palette over the window, listing the cell palette's rows** (`ClientHost.NativePalette` → `INativePalette`; Client `PaletteSession`; Avalonia `PaletteOverlay`, `PalettePresenter` on the driver; `SharpMUTermApp.NativePalette.cs`). The terminal, the snapshot, the tests and the parity harness pass null. Decisions @@ -2546,7 +2579,10 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] rows so typing never moves the rows below. - **The match kind is field 10, appended**, though it is drawn on the `match pattern` heading row: that keeps every ordinal and costs no row in a pane that already fills a 24-row screen. Switching *to* a - regex rewrites the pattern as the regex it meant, so the rule keeps matching what it matched. + regex rewrites the pattern as the regex it meant, so the rule keeps matching what it matched + (`BuiltInSettings.SetMatchType`, the one both surfaces call). + - **In the window the rule opens in the native F2** (`TryOpenNativeSettings(Section("triggers"), trigger)`), selected, + with its live test; elsewhere the cell F2 opens with the pattern being typed. - **The send group is session keys in memory** (`SendGroup`, Core; `SharpMUTermApp.SendGroup.cs`; ⌃P `group:` ids). It is never saved, because a saved group would be a standing order to send one line to several worlds. It is offered once two characters are open. Members are marked on the rail by swapping the dot for ◆/◇ in diff --git a/src/SharpMUTerm.Avalonia/ListEditorView.cs b/src/SharpMUTerm.Avalonia/ListEditorView.cs new file mode 100644 index 00000000..5c26deba --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ListEditorView.cs @@ -0,0 +1,891 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Controls.Templates; +using Avalonia.Controls.Documents; +using Avalonia.Input; +using Avalonia.Layout; +using Avalonia.Media; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// A list section (F2 triggers, F3 aliases, F4 key bindings, F6 timers) as a master-detail editor, drawn from its +/// : the items down the left grouped by trigger set, each with its enable check box, +/// and add, duplicate, delete and move above them; the selected item's declared fields on the right under their group +/// headings. A package's sets are listed read-only, with a button that copies one into the player's sets to edit. +/// F2's pattern carries the live test: how many of the recent lines it matches, and the newest few with the match +/// marked, re-run as the pattern is typed. +/// +/// Nothing here writes the configuration: every change goes to the form, which commits it through the client's own +/// save funnel; catches up once the change has landed. +/// +/// +internal sealed class ListEditorView : Grid +{ + private readonly SettingsForm _form; + private readonly SettingsSectionContribution _section; + private readonly SettingsCollection _collection; + private readonly Func _visible; + private readonly IBrush _accent; + private readonly ListBox _list; + private readonly StackPanel _detail; + private readonly List _refreshers = []; + private readonly Dictionary _controls = new(StringComparer.Ordinal); + private readonly List<(object Item, ListBoxItem Row, CheckBox Enabled)> _rows = []; + private readonly List public SettingScope Scope { get; init; } = SettingScope.App; + + /// + /// For a list section (F2, F3, F4, F6): the items it holds, grouped by the trigger set each lives in, with each + /// item's fields as ordinary s over bindings. Null for a + /// section of plain fields. A list section is drawn as a list with an editor beside it, and the settings search finds + /// its item fields like any other. + /// + public SettingsCollection? Collection { get; init; } } /// @@ -96,6 +104,12 @@ public sealed record ChoiceField(string Id, string Label, IReadOnlyList /// The choices over . public IReadOnlyList ChoicesIn(AppConfiguration config) => ChoicesFrom?.Invoke(config) ?? Choices; + + /// + /// Whether choosing moves the item to another list — an item's set: the choices are the trigger sets, and + /// a surface that keeps a cursor on the item follows it there. + /// + public bool MovesItem { get; init; } } /// A whole number within bounds. @@ -111,8 +125,34 @@ public sealed record TextField(string Id, string Label, int? MaxLength = null, b /// For : the value an unset field stands for, and is shown and opened as. public string? Fallback { get; init; } + + /// + /// Values offered as suggestions — not the permitted set — over the item being edited and what the host knows + /// (the windows a route can name), or null for none. + /// + public Func>? Suggest { get; init; } } +/// A number that may have a fraction (a timer's interval in seconds), within bounds. +public sealed record DecimalField(string Id, string Label, double Minimum, double Maximum, string? Help = null) + : SettingsField(Id, Label, Help); + +/// +/// A highlight colour, or none: a name from , or #rrggbb / idx:N for +/// one no name covers. Its binding holds a , null for none. +/// +public sealed record HighlightField(string Id, string Label, string? Help = null) : SettingsField(Id, Label, Help); + +/// Several independent flags, held as their words (): are the words. +public sealed record FlagsField(string Id, string Label, IReadOnlyList Names, string? Help = null) + : SettingsField(Id, Label, Help); + +/// +/// A key binding's chord, taken from the keyboard rather than typed. Whether a chord can fire is the host's to say — +/// — because a window and a terminal deliver different chords. +/// +public sealed record KeyField(string Id, string Label, string? Help = null) : SettingsField(Id, Label, Help); + /// /// The client's theme, picked from a list where each theme is shown as a preview (): a pane /// in a world's colours, a tinted pane, the focused pane, the command line and a tab strip, all in that theme. Its diff --git a/src/SharpMUTerm.Client/Settings/BuiltInLists.cs b/src/SharpMUTerm.Client/Settings/BuiltInLists.cs new file mode 100644 index 00000000..469ff55c --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/BuiltInLists.cs @@ -0,0 +1,437 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Client.Settings; + +/// +/// The list sections — F2 triggers, F3 aliases, F4 key bindings, F6 timers — declared: each a +/// whose item fields are ordinary descriptors over +/// bindings. The cell screens build their rows from these fields (in their own ⇥ order, by id) and the window draws +/// them as a master-detail editor, so both list the same fields and edit the same objects. +/// +public static partial class BuiltInSettings +{ + /// F2's item groups. + public const string RuleGroup = "Rule"; + + /// Where a matched line goes and how it looks. + public const string DeliveryGroup = "Route & highlight"; + + /// What a matched line makes happen. + public const string ActionsGroup = "Actions"; + + /// The rule's switches. + public const string BehaviourGroup = "Behaviour"; + + /// + /// What the route field calls a rule that delivers nowhere of its own (a null SpawnTarget): the line goes + /// where the other matched rules send it, else to the session's own window. A new rule's route. + /// + public const string NoRoute = "(none)"; + + /// A new trigger's name and pattern — a placeholder rather than blank, because a blank pattern is refused. + public const string NewTriggerName = "New Trigger"; + + /// A new trigger's pattern. + public const string NewTriggerPattern = "text to match"; + + /// A new alias's name. + public const string NewAliasName = "New Alias"; + + /// A new alias's pattern. + public const string NewAliasPattern = "^alias$"; + + /// A new alias's expansion. + public const string NewAliasSubstitution = "look"; + + /// A new timer's name. + public const string NewTimerName = "New Timer"; + + /// A new timer's interval: a minute, long enough that a timer switched on by accident is not a flood. + public const double NewTimerIntervalSeconds = 60; + + /// A new timer's command. + public const string NewTimerCommand = "look"; + + /// A new key binding's name. + public const string NewBindingName = "New Binding"; + + /// A new key binding's command. + public const string NewBindingCommand = "look"; + + /// The shortest interval a timer may have; zero is "off", which is what its check box is for. + public const double MinIntervalSeconds = 0.1; + + /// A day: past this an interval is likelier a typo than a schedule. + public const double MaxIntervalSeconds = 86400; + + /// The words F2's match field offers, in 's order. + public static IReadOnlyList MatchTypeNames { get; } = + TriggerPatterns.Offered.Select(TriggerPatterns.Describe).ToArray(); + + /// The words F2's attributes field accepts. + public static IReadOnlyList AttributeNames { get; } = FlagWords.Names(); + + /// F2: the trigger rules of every set. + public static SettingsSectionContribution Triggers { get; } = new() + { + Id = "triggers", + Title = "Triggers & spawn routing", + Key = "F2", + Order = 20, + Scope = SettingScope.Item, + Collection = new SettingsCollection + { + Noun = "trigger", + Plural = "triggers", + Items = s => s.Triggers, + SetItems = (s, v) => s.Triggers = v, + New = (_, _) => new Trigger { Name = NewTriggerName, Pattern = NewTriggerPattern }, + Copy = t => t.Clone(), + Name = t => t.Name, + Rename = (t, v) => t.Name = v, + Title = t => t.Pattern, + Detail = t => $"{TriggerPatterns.Describe(t.MatchType)}: {t.Pattern}", + Fields = + [ + ItemFlag("enabled", "enabled", RuleGroup, t => t.Enabled, (t, v) => t.Enabled = v, + "whether the rule runs", "on off disable", () => NewTrigger()), + ItemText("name", "name", TextRule.Name, RuleGroup, (_, t) => t.Name, (_, t, v) => t.Name = v ?? t.Name, + "what the rule is called in the list", NewTrigger), + new ChoiceField("match", "match", MatchTypeNames, "how the pattern is read") + { + Group = RuleGroup, + Keywords = "contains starts wildcard regex regular expression kind", + Binding = SettingBinding.ForItem( + (_, t) => TriggerPatterns.Describe(t.MatchType), + (_, t, v) => SetMatchType(t, TriggerPatterns.Parse(v) ?? t.MatchType), + NewTrigger), + }, + ItemText("pattern", "match pattern", TextRule.TriggerPattern, RuleGroup, + (_, t) => t.Pattern, (_, t, v) => t.Pattern = v ?? t.Pattern, + "the text a line is matched against; the live test shows what it matches", NewTrigger, + "regex wildcard test preview"), + new ChoiceField("set", "set", [], "the trigger set the rule lives in") + { + Group = RuleGroup, + MovesItem = true, + Keywords = "trigger set group", + ChoicesFrom = c => c.TriggerSets.Select(s => s.Name).ToArray(), + Binding = SettingBinding.ForItem( + (c, t) => c.TriggerSets.FirstOrDefault(s => s.Triggers.Contains(t))?.Name ?? string.Empty, + (c, t, v) => Triggers!.Collection!.MoveTo(c, t, v), + NewTrigger), + }, + + new TextField("route", "route", Help: "the window the line goes to; (none) leaves it where other rules send it") + { + Group = DeliveryGroup, + Rule = TextRule.Window, + Keywords = "spawn window capture channel tab destination", + Suggest = (t, context) => Routes((Trigger)t.Item!, context.Windows), + Binding = SettingBinding.ForItem( + (_, t) => t.Actions.SpawnTarget ?? NoRoute, + (_, t, v) => t.Actions.SpawnTarget = v is null || v == NoRoute ? null : v.Trim(), + NewTrigger), + }, + new HighlightField("fg", "highlight fg", "the colour the matched text is drawn in") + { + Group = DeliveryGroup, + Keywords = "colour color foreground", + Binding = SettingBinding.ForItem( + (_, t) => t.Actions.HighlightForeground, (_, t, v) => t.Actions.HighlightForeground = v, NewTrigger, + HighlightColours.Format), + }, + new HighlightField("bg", "highlight bg", "the colour behind the matched text") + { + Group = DeliveryGroup, + Keywords = "colour color background", + Binding = SettingBinding.ForItem( + (_, t) => t.Actions.HighlightBackground, (_, t, v) => t.Actions.HighlightBackground = v, NewTrigger, + HighlightColours.Format), + }, + new FlagsField("attributes", "attributes", AttributeNames, "added to the matched text") + { + Group = DeliveryGroup, + Keywords = "bold underline italic", + Binding = SettingBinding.ForItem( + (_, t) => FlagWords.Format(t.Actions.AddAttributes), + (_, t, v) => t.Actions.AddAttributes = FlagWords.Parse(v), + NewTrigger), + }, + ItemFlag("gag", "gag line", DeliveryGroup, t => t.Actions.Gag, (t, v) => t.Actions.Gag = v, + "keep the line out of its usual window", "hide suppress", () => NewTrigger()), + + ItemText("rewrite", "rewrite", TextRule.Template, ActionsGroup, + (_, t) => t.Actions.Rewrite, (_, t, v) => t.Actions.Rewrite = v, + "replace the line with this; $1..$9 insert captures", NewTrigger, "substitute replace"), + ItemText("respond", "respond", TextRule.Template, ActionsGroup, + (_, t) => t.Actions.SendResponse, (_, t, v) => t.Actions.SendResponse = v, + "send this to the game; $1..$9 insert captures", NewTrigger, "send command reply"), + new TextField("script", "script", Help: "a Lua function to call") + { + Group = ActionsGroup, + Rule = TextRule.Template, + Keywords = "lua callback function", + Suggest = (t, _) => Callbacks(t.Config, ((Trigger)t.Item!).Actions.ScriptCallback), + Binding = SettingBinding.ForItem( + (_, t) => t.Actions.ScriptCallback, (_, t, v) => t.Actions.ScriptCallback = v, NewTrigger), + }, + + ItemFlag("stop", "stop processing", BehaviourGroup, t => t.StopProcessing, (t, v) => t.StopProcessing = v, + "no later rule sees a line this one matched", "halt last", () => NewTrigger()), + ItemFlag("case", "case sensitive", BehaviourGroup, t => t.CaseSensitive, (t, v) => t.CaseSensitive = v, + "match capitals exactly", "uppercase", () => NewTrigger()), + ], + }, + }; + + /// F3: the aliases of every set. + public static SettingsSectionContribution Aliases { get; } = new() + { + Id = "aliases", + Title = "Aliases", + Key = "F3", + Order = 30, + Scope = SettingScope.Item, + Collection = new SettingsCollection + { + Noun = "alias", + Plural = "aliases", + Items = s => s.Aliases, + SetItems = (s, v) => s.Aliases = v, + New = (_, _) => NewAlias(), + Copy = a => a.Clone(), + Name = a => a.Name, + Rename = (a, v) => a.Name = v, + Title = a => a.Pattern, + Detail = a => $"{a.Pattern} → {a.Substitution.Replace('\n', ';')}", + Fields = + [ + ItemFlag("enabled", "enabled", RuleGroup, a => a.Enabled, (a, v) => a.Enabled = v, + "whether the alias runs", "on off disable", NewAlias), + ItemText("name", "name", TextRule.Name, RuleGroup, (_, a) => a.Name, (_, a, v) => a.Name = v ?? a.Name, + "what the alias is called in the list", NewAlias), + ItemText("pattern", "match pattern", TextRule.RequiredPattern, RuleGroup, + (_, a) => a.Pattern, (_, a, v) => a.Pattern = v ?? a.Pattern, + "a regular expression matched against what you type", NewAlias, "regex command"), + ItemText("expansion", "expansion", TextRule.Lines, RuleGroup, + (_, a) => a.Substitution, (_, a, v) => a.Substitution = v ?? a.Substitution, + "what is sent instead, one command per line; $1..$9 insert captures", NewAlias, "substitution send"), + OwnerField(s => s.Aliases, NewAlias, () => Aliases!), + ItemFlag("case", "case sensitive", BehaviourGroup, a => a.CaseSensitive, (a, v) => a.CaseSensitive = v, + "match capitals exactly", "uppercase", NewAlias), + ], + }, + }; + + /// F6: the timers of every set. + public static SettingsSectionContribution Timers { get; } = new() + { + Id = "timers", + Title = "Timers", + Key = "F6", + Order = 50, + Scope = SettingScope.Item, + Collection = new SettingsCollection + { + Noun = "timer", + Plural = "timers", + CanDuplicate = false, + Items = s => s.Timers, + SetItems = (s, v) => s.Timers = v, + New = (_, _) => NewTimer(), + Copy = t => new TimerDefinition + { + Name = t.Name, IntervalSeconds = t.IntervalSeconds, Command = t.Command, OneShot = t.OneShot, + Enabled = t.Enabled, ScriptCallback = t.ScriptCallback, + }, + Name = t => t.Name, + Rename = (t, v) => t.Name = v, + Title = t => t.Command, + Detail = t => $"every {t.IntervalSeconds.ToString("0.####", System.Globalization.CultureInfo.InvariantCulture)} s: {t.Command}", + Fields = + [ + ItemFlag("enabled", "enabled", RuleGroup, t => t.Enabled, (t, v) => t.Enabled = v, + "whether the timer fires", "on off disable", NewTimer), + ItemText("name", "name", TextRule.Name, RuleGroup, (_, t) => t.Name, (_, t, v) => t.Name = v ?? t.Name, + "what the timer is called in the list", NewTimer), + new DecimalField("interval", "interval", MinIntervalSeconds, MaxIntervalSeconds, "seconds between firings") + { + Group = RuleGroup, + Keywords = "period seconds every repeat", + Binding = SettingBinding.ForItem( + (_, t) => t.IntervalSeconds, (_, t, v) => t.IntervalSeconds = v, NewTimer), + }, + ItemText("command", "command", TextRule.Required, RuleGroup, + (_, t) => t.Command, (_, t, v) => t.Command = v ?? t.Command, "what is sent each time", NewTimer, "send"), + OwnerField(s => s.Timers, NewTimer, () => Timers!), + ItemFlag("one-shot", "one-shot", BehaviourGroup, t => t.OneShot, (t, v) => t.OneShot = v, + "fire once and stop", "once single", NewTimer), + ], + }, + }; + + /// F4: the key bindings of every set. + public static SettingsSectionContribution Keypad { get; } = new() + { + Id = "keypad", + Title = "Keypad & hotkeys", + Key = "F4", + Order = 40, + Scope = SettingScope.Item, + Collection = new SettingsCollection + { + Noun = "binding", + Plural = "bindings", + CanDuplicate = false, + Items = s => s.Macros, + SetItems = (s, v) => s.Macros = v, + New = (context, all) => context.Bindable.FirstOrDefault(k => !all.Any(m => string.Equals(m.Key, k, StringComparison.OrdinalIgnoreCase))) + is { } key + ? new Macro { Name = NewBindingName, Key = key, Command = NewBindingCommand } + : null, + Copy = m => new Macro { Name = m.Name, Key = m.Key, Enabled = m.Enabled, Command = m.Command, ScriptCallback = m.ScriptCallback }, + Name = m => m.Name, + Rename = (m, v) => m.Name = v, + Title = m => m.Key, + Detail = m => $"{m.Key}: {m.Command}", + Fields = + [ + ItemFlag("enabled", "enabled", RuleGroup, m => m.Enabled, (m, v) => m.Enabled = v, + "whether the binding answers its key", "on off disable", NewMacro), + ItemText("name", "name", TextRule.Name, RuleGroup, (_, m) => m.Name, (_, m, v) => m.Name = v ?? m.Name, + "what the binding is called in the list", NewMacro), + ItemText("command", "command", TextRule.Required, RuleGroup, + (_, m) => m.Command, (_, m, v) => m.Command = v ?? m.Command, "what the key sends", NewMacro, "send"), + new KeyField("key", "key", "the chord that runs it; press it to set it") + { + Group = RuleGroup, + Keywords = "hotkey chord shortcut macro keypad", + Binding = SettingBinding.ForItem((_, m) => m.Key, (_, m, v) => m.Key = v, NewMacro), + }, + OwnerField(s => s.Macros, NewMacro, () => Keypad!), + ], + }, + }; + + /// + /// Changes how a rule's pattern is read. Moving to a regex rewrites the pattern as the regex it already + /// meant, so the rule goes on matching exactly what it matched; moving away leaves the text as typed. + /// + public static void SetMatchType(Trigger trigger, TriggerMatchType type) + { + ArgumentNullException.ThrowIfNull(trigger); + if (type == TriggerMatchType.Regex && trigger.MatchType != TriggerMatchType.Regex) + { + trigger.Pattern = TriggerPatterns.ToRegex(trigger.MatchType, trigger.Pattern); + } + + trigger.MatchType = type; + } + + /// + /// The routes offered for : (none), main, every window the host knows, and + /// the rule's own — suggestions, not the permitted set: a new name makes a new capture window. + /// + public static IReadOnlyList Routes(Trigger trigger, IReadOnlyList? windows) + { + ArgumentNullException.ThrowIfNull(trigger); + var routes = new List { NoRoute, TriggerActions.MainWindow }; + foreach (var target in (windows ?? []).Append(trigger.Actions.SpawnTarget ?? NoRoute)) + { + if (!string.IsNullOrEmpty(target) && !routes.Contains(target, StringComparer.Ordinal)) + { + routes.Add(target); + } + } + + return routes; + } + + /// Every script callback the configuration names (and ), as suggestions. + public static IReadOnlyList Callbacks(AppConfiguration config, string? own) + { + ArgumentNullException.ThrowIfNull(config); + var named = new List(); + var all = config.TriggerSets.SelectMany(set => set.Triggers.Select(t => t.Actions.ScriptCallback) + .Concat(set.Aliases.Select(a => a.ScriptCallback)) + .Concat(set.Timers.Select(t => t.ScriptCallback)) + .Concat(set.Macros.Select(m => m.ScriptCallback))) + .Append(own); + foreach (var callback in all) + { + if (!string.IsNullOrWhiteSpace(callback) && !named.Contains(callback, StringComparer.Ordinal)) + { + named.Add(callback); + } + } + + return named; + } + + private static Trigger NewTrigger() => new() { Name = NewTriggerName, Pattern = NewTriggerPattern }; + + private static Alias NewAlias() => + new() { Name = NewAliasName, Pattern = NewAliasPattern, Substitution = NewAliasSubstitution }; + + private static TimerDefinition NewTimer() => new() + { + Name = NewTimerName, IntervalSeconds = NewTimerIntervalSeconds, Command = NewTimerCommand, Enabled = false, + }; + + private static Macro NewMacro() => new() { Name = NewBindingName, Key = "F12", Command = NewBindingCommand }; + + private static BoolField ItemFlag( + string id, + string label, + string group, + Func get, + Action set, + string? help, + string? keywords, + Func fresh) + where TItem : class => + new(id, label, help) + { + Group = group, + Keywords = keywords, + Binding = SettingBinding.ForItem((_, i) => get(i), (_, i, v) => set(i, v), fresh, v => v ? "on" : "off"), + }; + + private static TextField ItemText( + string id, + string label, + TextRule rule, + string group, + Func get, + Action set, + string? help, + Func fresh, + string? keywords = null) + where TItem : class => + new(id, label, Help: help) + { + Group = group, + Rule = rule, + Keywords = keywords, + Binding = SettingBinding.ForItem(get, set, fresh), + }; + + private static ChoiceField OwnerField( + Func> items, Func fresh, Func section) + where TItem : class => + new("set", "set", [], "the trigger set it lives in") + { + Group = RuleGroup, + MovesItem = true, + Keywords = "trigger set group", + ChoicesFrom = c => c.TriggerSets.Select(s => s.Name).ToArray(), + Binding = SettingBinding.ForItem( + (c, i) => c.TriggerSets.FirstOrDefault(s => items(s).Contains(i))?.Name ?? string.Empty, + (c, i, v) => section().Collection!.MoveTo(c, i, v), + fresh), + }; +} diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index 5f00f041..c5053f78 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -15,7 +15,7 @@ namespace SharpMUTerm.Client.Settings; /// else written — the default is read off a fresh , never restated here. /// /// -public static class BuiltInSettings +public static partial class BuiltInSettings { /// F7's groups, in the order they are drawn. The theme: the client's own colours, picked with a preview. public const string ThemeGroup = "Theme"; @@ -359,19 +359,25 @@ public static class BuiltInSettings }; /// Every section the client declares, in their order: the screens F2 to F10. - public static IReadOnlyList All { get; } = + /// + /// Built on first read rather than in a field initializer: the list sections are declared in another file of this + /// partial class, and the order static initializers run in across files is not one to depend on. + /// + public static IReadOnlyList All => _all ??= [ World, - Listed("triggers", "Triggers & spawn routing", "F2", 20), - Listed("aliases", "Aliases", "F3", 30), - Listed("keypad", "Keypad & hotkeys", "F4", 40), - Listed("timers", "Timers", "F6", 50), + Triggers, + Aliases, + Keypad, + Timers, Text, Input, Character, Listed("packages", "Packages", "F10", 90), ]; + private static IReadOnlyList? _all; + /// Registers every built-in section. public static void Register(SettingsSectionList sections) { diff --git a/src/SharpMUTerm.Client/Settings/ItemValues.cs b/src/SharpMUTerm.Client/Settings/ItemValues.cs new file mode 100644 index 00000000..31ce5e9c --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/ItemValues.cs @@ -0,0 +1,175 @@ +using System.Globalization; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Client.Settings; + +/// +/// The colours a trigger's highlight is picked from, and how one is written as text: a short palette of names, plus +/// #rrggbb and idx:N for a colour already in the configuration that no name covers. Both hosts read +/// and write a highlight through this, so the cell field and the native picker accept and show the same things. +/// +public static class HighlightColours +{ + /// What "no colour" reads and is typed as. + public const string None = "none"; + + /// The terminal's default colour, as a name. + public const string DefaultName = "default"; + + /// The names a picker steps through, first. + public static IReadOnlyList Palette { get; } = + [ + None, "red", "orange", "gold", "yellow", "lime", "green", "cyan", "teal", + "blue", "magenta", "purple", "pink", "white", "silver", "grey", "black", + ]; + + /// A colour as text: a palette name where one matches, else #rrggbb or idx:N. + public static string Format(TerminalColor? colour) + { + if (colour is not { } value) + { + return None; + } + + foreach (var name in Palette) + { + if (name != None && WebColors.TryParse(name, out var named) && named == value) + { + return name; + } + } + + return value.Kind switch + { + TerminalColorKind.Rgb => $"#{value.R:x2}{value.G:x2}{value.B:x2}", + TerminalColorKind.Indexed => $"idx:{value.Index.ToString(CultureInfo.InvariantCulture)}", + _ => DefaultName, + }; + } + + /// Reads a colour as writes it (or any web colour name); false when it is none of those. + public static bool TryParse(string text, out TerminalColor? colour) + { + ArgumentNullException.ThrowIfNull(text); + + colour = null; + var trimmed = text.Trim(); + if (trimmed.Length == 0 || trimmed.Equals(None, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + if (trimmed.Equals(DefaultName, StringComparison.OrdinalIgnoreCase)) + { + colour = TerminalColor.Default; + return true; + } + + if (trimmed.StartsWith("idx:", StringComparison.OrdinalIgnoreCase) + && int.TryParse(trimmed.AsSpan(4), NumberStyles.Integer, CultureInfo.InvariantCulture, out var index) + && index is >= 0 and <= 255) + { + colour = TerminalColor.FromIndex(index); + return true; + } + + if (WebColors.TryParse(trimmed, out var parsed)) + { + colour = parsed; + return true; + } + + return false; + } + + /// A colour as #rrggbb for a swatch, or null for none and the terminal's default. + public static string? Hex(TerminalColor? colour) => colour switch + { + { Kind: TerminalColorKind.Rgb } c => $"#{c.R:x2}{c.G:x2}{c.B:x2}", + { Kind: TerminalColorKind.Indexed } c => AnsiPalette.ToRgb(c.Index).ToHex(), + _ => null, + }; +} + +/// +/// A [Flags] enumeration written as words — bold underline, or none — the way a trigger's added +/// attributes are typed on the cell screen and ticked in the window. +/// +public static class FlagWords +{ + /// What a set with nothing in it reads and is typed as. + public const string NoFlags = "none"; + + private static readonly char[] Separators = [' ', '\t', ',', '|', '+']; + + /// Every non-zero member, lower-cased, in declaration order. + public static IReadOnlyList Names() + where TEnum : struct, Enum => + Enum.GetValues() + .Where(v => Convert.ToInt64(v, CultureInfo.InvariantCulture) != 0) + .Select(v => v.ToString().ToLowerInvariant()) + .ToArray(); + + /// A value as its words, or . + public static string Format(TEnum value) + where TEnum : struct, Enum + { + var bits = Convert.ToInt64(value, CultureInfo.InvariantCulture); + var set = Enum.GetValues() + .Select(v => (Name: v.ToString().ToLowerInvariant(), Bits: Convert.ToInt64(v, CultureInfo.InvariantCulture))) + .Where(f => f.Bits != 0 && (bits & f.Bits) == f.Bits) + .Select(f => f.Name) + .ToArray(); + + return set.Length == 0 ? NoFlags : string.Join(' ', set); + } + + /// Whether a typed list names . + public static bool IsListed(string spec, string name) + { + ArgumentNullException.ThrowIfNull(spec); + return spec.Split(Separators, StringSplitOptions.RemoveEmptyEntries) + .Any(word => string.Equals(word, name, StringComparison.OrdinalIgnoreCase)); + } + + /// The first word of a typed list that names nothing in , or null. + public static string? Unknown(string value, IReadOnlyList names) + { + ArgumentNullException.ThrowIfNull(value); + ArgumentNullException.ThrowIfNull(names); + foreach (var word in value.Split(Separators, StringSplitOptions.RemoveEmptyEntries)) + { + if (!string.Equals(word, NoFlags, StringComparison.OrdinalIgnoreCase) + && !names.Contains(word, StringComparer.OrdinalIgnoreCase)) + { + return word; + } + } + + return null; + } + + /// The value a typed list names; words that name nothing are ignored. + public static TEnum Parse(string value) + where TEnum : struct, Enum + { + ArgumentNullException.ThrowIfNull(value); + var members = Enum.GetValues() + .Select(v => (Name: v.ToString(), Bits: Convert.ToInt64(v, CultureInfo.InvariantCulture))) + .ToArray(); + + var bits = 0L; + foreach (var word in value.Split(Separators, StringSplitOptions.RemoveEmptyEntries)) + { + foreach (var member in members) + { + if (string.Equals(member.Name, word, StringComparison.OrdinalIgnoreCase)) + { + bits |= member.Bits; + } + } + } + + return (TEnum)Enum.ToObject(typeof(TEnum), bits); + } +} diff --git a/src/SharpMUTerm.Client/Settings/SettingBinding.cs b/src/SharpMUTerm.Client/Settings/SettingBinding.cs index 690f3aa1..8c9120b4 100644 --- a/src/SharpMUTerm.Client/Settings/SettingBinding.cs +++ b/src/SharpMUTerm.Client/Settings/SettingBinding.cs @@ -18,6 +18,12 @@ public enum SettingScope /// One character: a property of a . Character, + + /// + /// One item of a list section (): a property of a rule, an alias, a timer or a key + /// binding, edited on the item a surface has selected (). + /// + Item, } /// @@ -28,8 +34,9 @@ public enum SettingScope /// The live configuration. /// The world a world-scoped field edits, or null. /// The character a character-scoped field edits, or null. +/// The item (a trigger, an alias, a timer, a key binding) an item-scoped field edits, or null. public readonly record struct SettingTarget( - AppConfiguration Config, WorldDefinition? World = null, CharacterDefinition? Character = null) + AppConfiguration Config, WorldDefinition? World = null, CharacterDefinition? Character = null, object? Item = null) { /// An app-wide target over . public static implicit operator SettingTarget(AppConfiguration config) => new(config); @@ -39,6 +46,7 @@ public readonly record struct SettingTarget( { SettingScope.World => World is not null, SettingScope.Character => Character is not null, + SettingScope.Item => Item is not null, _ => true, }; } @@ -95,6 +103,7 @@ public sealed class SettingBinding : SettingBinding private readonly Func? _format; private readonly Func? _describe; private readonly Lazy _defaultText; + private readonly Func _fresh = FreshTarget; /// Reads the value. It must not change the configuration. /// Writes the value. @@ -127,9 +136,11 @@ private SettingBinding( Action set, Func? format, Func? describe, - bool resettable) + bool resettable, + Func? fresh = null) { _scope = scope; + _fresh = fresh ?? FreshTarget; _get = get; _set = set; _format = format; @@ -177,6 +188,37 @@ public static SettingBinding ForCharacter( resettable); } + /// + /// A field of one item of a list section — a trigger, an alias, a timer, a key binding — read and written on the + /// item a surface has selected, which must be a . Not resettable unless asked: a rule's + /// pattern has no default worth going back to, and an item's fields are its identity. + /// + /// Reads the value; the configuration is there for what a value is looked up in (the sets). + /// Writes the value. + /// A new item, which is what the default is read off. + /// As for the app-wide constructor. + /// Whether the field offers a reset. + public static SettingBinding ForItem( + Func get, + Action set, + Func fresh, + Func? format = null, + bool resettable = false) + where TItem : class + { + ArgumentNullException.ThrowIfNull(get); + ArgumentNullException.ThrowIfNull(set); + ArgumentNullException.ThrowIfNull(fresh); + return new SettingBinding( + SettingScope.Item, + t => get(t.Config, (TItem)t.Item!), + (t, v) => set(t.Config, (TItem)t.Item!, v), + format, + null, + resettable, + () => new SettingTarget(new AppConfiguration(), Item: fresh())); + } + /// public override SettingScope Scope => _scope; @@ -190,7 +232,10 @@ public static SettingBinding ForCharacter( /// The default, read off a fresh configuration (and a fresh world and character) each time — so a default /// that is a list is never one instance shared between every configuration that is reset to it. /// - public T Default => _get(new SettingTarget(new AppConfiguration(), new WorldDefinition(), new CharacterDefinition())); + public T Default => _get(_fresh()); + + private static SettingTarget FreshTarget() => + new(new AppConfiguration(), new WorldDefinition(), new CharacterDefinition()); /// A value as text. public string Format(T value) => @@ -219,7 +264,12 @@ public override string Text(SettingTarget target) { if (!target.Reaches(_scope)) { - return _scope == SettingScope.World ? "per world" : "per character"; + return _scope switch + { + SettingScope.World => "per world", + SettingScope.Character => "per character", + _ => "per item", + }; } var value = Get(target); diff --git a/src/SharpMUTerm.Client/Settings/SettingsCollection.cs b/src/SharpMUTerm.Client/Settings/SettingsCollection.cs new file mode 100644 index 00000000..37dca1df --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/SettingsCollection.cs @@ -0,0 +1,303 @@ +using System.Globalization; +using System.Text.Json; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Settings; + +/// +/// What a host knows that a list section's fields need and the configuration does not hold: the windows a trigger can +/// route to (the workspace's), the recent output a trigger's pattern is tested against (the panes'), and which chords +/// this host can deliver to a key binding. Captured on the client's thread when a surface opens. +/// +/// The windows a route can name beyond (none) and main. +/// Recent output, oldest first, the newest of which a pattern is tested against. +/// Why a chord cannot fire in this host, or null when it can. +/// The chords a new key binding may be born on, in the order a host offers them. +public sealed record SettingsContext( + IReadOnlyList Windows, + IReadOnlyList Lines, + Func KeyProblem, + IReadOnlyList Bindable) +{ + /// Nothing known: no windows, no output, every chord allowed, none offered to a new binding. + public static SettingsContext Empty { get; } = new([], [], _ => null, []); +} + +/// +/// One trigger set as a list section shows it: its items of the section's kind, and whether they may be edited. A +/// package's sets are listed read-only — a package update replaces them wholesale, so an edit there would be lost +/// — and offer a copy into the player's own sets instead. +/// +/// The set. +/// What the list calls it: the set's name, and the package's for a package's set. +/// Whether it is a package's, and refuses edits. +/// The package it came from, or null for one of the player's own. +/// Its items of the section's kind, in order. +public sealed record SettingsItemGroup( + TriggerSet Set, string Label, bool ReadOnly, string? PackageId, IReadOnlyList Items); + +/// +/// A list section's declaration (F2's triggers, F3's aliases, F4's key bindings, F6's timers): the items, each held in +/// a ; each item's fields as ordinary s over +/// bindings; and add, duplicate, delete, reorder and enable. Both hosts draw a list +/// section from this — the cells as their list-and-editor screen, the window as a master-detail editor — so the two +/// list the same fields and edit the same objects. +/// +/// Lists are replaced, never edited in place: an add, a delete or a move builds the set's new list and assigns +/// it, so a host reading the configuration on its own thread never meets a list half-way through a change. The +/// operations here are pure over the configuration; a surface runs them through its save funnel. +/// +/// +public abstract class SettingsCollection +{ + /// What one item is called (trigger). + public required string Noun { get; init; } + + /// What several are called (triggers). + public required string Plural { get; init; } + + /// Every field of an item, in the order a form shows them. + public required IReadOnlyList Fields { get; init; } + + /// The id of the field that enables the item, which a list shows as each row's check box. + public string EnabledField { get; init; } = "enabled"; + + /// The id of the field naming the item. + public string NameField { get; init; } = "name"; + + /// Whether an item can be duplicated (a timer cannot: its copy would differ in everything). + public bool CanDuplicate { get; init; } = true; + + /// A field by id. + public SettingsField Field(string id) => + Fields.FirstOrDefault(f => string.Equals(f.Id, id, StringComparison.Ordinal)) + ?? throw new InvalidOperationException($"The {Plural} declare no field '{id}'."); + + /// The items of , in order. + public abstract IReadOnlyList ItemsIn(TriggerSet set); + + /// Whether is one of this collection's kind. + public abstract bool IsItem(object item); + + /// What a list row says for : its name, or what it does when it has none. + public abstract string TitleOf(object item); + + /// The second line a list row says (a pattern, an interval), or null. + public abstract string? DetailOf(object item); + + /// Whether is enabled. + public bool IsEnabled(AppConfiguration config, object item) => + Field(EnabledField).Binding is SettingBinding flag && flag.Get(new SettingTarget(config, Item: item)); + + /// + /// A new item for , named so it can be told from the rest, not yet added; null when none can + /// be made (every chord a key binding could be born on is taken). + /// + public abstract object? Create(AppConfiguration config, SettingsContext context); + + /// A deep copy of , renamed, not yet added. + public abstract object Duplicate(AppConfiguration config, object item); + + /// Replaces 's items with . + protected abstract void Replace(TriggerSet set, IEnumerable items); + + /// The set holding among , or null. + public TriggerSet? OwnerOf(IEnumerable sets, object item) + { + ArgumentNullException.ThrowIfNull(sets); + return sets.FirstOrDefault(s => ItemsIn(s).Any(i => ReferenceEquals(i, item))); + } + + /// Adds at the end of . + public void Add(TriggerSet set, object item) + { + ArgumentNullException.ThrowIfNull(set); + ArgumentNullException.ThrowIfNull(item); + Replace(set, [.. ItemsIn(set), item]); + } + + /// Puts straight after in the set that holds it. + public void InsertAfter(AppConfiguration config, object source, object copy) + { + ArgumentNullException.ThrowIfNull(config); + if (OwnerOf(config.TriggerSets, source) is not { } set) + { + return; + } + + var items = ItemsIn(set).ToList(); + items.Insert(items.FindIndex(i => ReferenceEquals(i, source)) + 1, copy); + Replace(set, items); + } + + /// Takes out of whichever of the configuration's sets holds it. + public bool Delete(AppConfiguration config, object item) + { + ArgumentNullException.ThrowIfNull(config); + if (OwnerOf(config.TriggerSets, item) is not { } set) + { + return false; + } + + Replace(set, ItemsIn(set).Where(i => !ReferenceEquals(i, item))); + return true; + } + + /// + /// Moves places within its set — order is meaning for a trigger + /// (the first match that stops processing wins) — and false when it is already at that end. + /// + public bool Move(AppConfiguration config, object item, int delta) + { + ArgumentNullException.ThrowIfNull(config); + if (OwnerOf(config.TriggerSets, item) is not { } set) + { + return false; + } + + var items = ItemsIn(set).ToList(); + var at = items.FindIndex(i => ReferenceEquals(i, item)); + var to = at + delta; + if (to < 0 || to >= items.Count || to == at) + { + return false; + } + + items.RemoveAt(at); + items.Insert(to, item); + Replace(set, items); + return true; + } + + /// Moves to the end of the set named . + public void MoveTo(AppConfiguration config, object item, string name) + { + ArgumentNullException.ThrowIfNull(config); + var target = config.TriggerSets.FirstOrDefault(s => string.Equals(s.Name, name?.Trim(), StringComparison.OrdinalIgnoreCase)); + if (target is null || OwnerOf(config.TriggerSets, item) is not { } owner || ReferenceEquals(owner, target)) + { + return; + } + + Replace(owner, ItemsIn(owner).Where(i => !ReferenceEquals(i, item))); + Add(target, item); + } + + /// + /// , or — when another item already has it — the first of name 2, name 3… that + /// none has. The cell screens' rule (ScreenLists.Available). + /// + public static string Available(IEnumerable taken, string name) + { + ArgumentNullException.ThrowIfNull(taken); + var used = new HashSet(taken, StringComparer.OrdinalIgnoreCase); + var candidate = name; + for (var n = 2; used.Contains(candidate); n++) + { + candidate = $"{name} {n.ToString(CultureInfo.InvariantCulture)}"; + } + + return candidate; + } + + /// + /// A copy of a package's among the player's own, named (copy) when its name is taken + /// — F10's c, one set at a time. The copy is a deep one, so editing it never touches the package's. + /// + public static TriggerSet CopyToEdit(AppConfiguration config, TriggerSet set) + { + ArgumentNullException.ThrowIfNull(config); + ArgumentNullException.ThrowIfNull(set); + var copy = JsonSerializer.Deserialize( + JsonSerializer.SerializeToUtf8Bytes(set, ConfigurationStore.SerializerOptions), ConfigurationStore.SerializerOptions)!; + var name = set.Name; + for (var n = 1; config.TriggerSets.Any(s => string.Equals(s.Name, name, StringComparison.OrdinalIgnoreCase)); n++) + { + name = n == 1 ? $"{set.Name} (copy)" : $"{set.Name} (copy {n.ToString(CultureInfo.InvariantCulture)})"; + } + + copy.Name = name; + config.TriggerSets.Add(copy); + return copy; + } +} + +/// A list section's declaration over items of type . +public sealed class SettingsCollection : SettingsCollection + where TItem : class +{ + /// The list of a set that holds the items. + public required Func> Items { get; init; } + + /// Replaces that list. + public required Action> SetItems { get; init; } + + /// A new item, before it is named; null when none can be made in this host. + public required Func, TItem?> New { get; init; } + + /// A deep copy. + public required Func Copy { get; init; } + + /// The item's name. + public required Func Name { get; init; } + + /// Renames the item. + public required Action Rename { get; init; } + + /// A list row's title when the name is blank, or null to show the name. + public Func? Title { get; init; } + + /// A list row's second line, or null. + public Func? Detail { get; init; } + + /// + public override IReadOnlyList ItemsIn(TriggerSet set) + { + ArgumentNullException.ThrowIfNull(set); + return Items(set).ToArray(); + } + + /// + public override bool IsItem(object item) => item is TItem; + + /// + public override string TitleOf(object item) + { + var typed = (TItem)item; + var name = Name(typed); + return string.IsNullOrWhiteSpace(name) && Title is not null ? Title(typed) : name; + } + + /// + public override string? DetailOf(object item) => Detail?.Invoke((TItem)item); + + /// + public override object? Create(AppConfiguration config, SettingsContext context) + { + ArgumentNullException.ThrowIfNull(config); + ArgumentNullException.ThrowIfNull(context); + var all = config.TriggerSets.SelectMany(Items).ToList(); + if (New(context, all) is not { } item) + { + return null; + } + + Rename(item, Available(all.Select(Name), Name(item))); + return item; + } + + /// + public override object Duplicate(AppConfiguration config, object item) + { + ArgumentNullException.ThrowIfNull(config); + var source = (TItem)item; + var copy = Copy(source); + Rename(copy, Available(config.TriggerSets.SelectMany(Items).Select(Name), Name(source) + " copy")); + return copy; + } + + /// + protected override void Replace(TriggerSet set, IEnumerable items) => + SetItems(set, items.Cast().ToList()); +} diff --git a/src/SharpMUTerm.Client/Settings/SettingsForm.cs b/src/SharpMUTerm.Client/Settings/SettingsForm.cs index edc98640..9f845f97 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsForm.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsForm.cs @@ -1,4 +1,5 @@ using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; namespace SharpMUTerm.Client.Settings; @@ -35,8 +36,10 @@ public sealed class SettingsForm private readonly Func _now; private readonly Func> _themes; private readonly Func _isDark; + private readonly SettingsContext _context; private WorldDefinition? _world; private CharacterDefinition? _character; + private object? _item; /// Every settings section, in order — declared ones and the ones only listed by title. /// The live configuration the values are read from and written to. @@ -50,6 +53,8 @@ public sealed class SettingsForm /// Whether the client's theme is dark now — it changes when a theme is picked here. /// The world a world-scoped section is edited for first, or null for the first world. /// The character a character-scoped section is edited for first, or null for the first. + /// What the host knows that a list section's fields need (windows, recent output, chords). + /// The item a list section opens on (the trigger builder's new rule), or null for the first. public SettingsForm( IReadOnlyList sections, AppConfiguration config, @@ -62,7 +67,9 @@ public SettingsForm( Func>? themes = null, Func? isDarkNow = null, WorldDefinition? world = null, - CharacterDefinition? character = null) + CharacterDefinition? character = null, + SettingsContext? context = null, + object? item = null) { ArgumentNullException.ThrowIfNull(sections); ArgumentNullException.ThrowIfNull(config); @@ -77,6 +84,8 @@ public SettingsForm( _received = received ?? (() => Array.Empty()); _now = now ?? (_ => null); _themes = themes ?? (() => Array.Empty()); + _context = context ?? SettingsContext.Empty; + _item = item; var worlds = config.Worlds.ToArray(); _character = character; _world = world ?? (character is null ? null : worlds.FirstOrDefault(w => w.Characters.Contains(character))) @@ -147,7 +156,7 @@ public bool HasSubject(SettingsSectionContribution section) } /// Where every binding reads and writes now: the configuration and the chosen world and character. - private SettingTarget Target => new(_config, _world, _character); + private SettingTarget Target => new(_config, _world, _character, _item); /// The choices offers now (a layout row lists the player's own layouts). public IReadOnlyList Choices(ChoiceField field) @@ -177,7 +186,7 @@ public void SetTheme(ThemeField field, string name) public static bool IsDeclared(SettingsSectionContribution section) { ArgumentNullException.ThrowIfNull(section); - return section.Fields.Count > 0; + return section.Fields.Count > 0 || section.Collection is not null; } /// A section by id, or null. @@ -211,11 +220,18 @@ public static string DefaultText(SettingsField field) /// surface can store what the other would refuse. A scoped field is written to the world or character chosen /// when the change was made, even if the choice moves before the client runs it. /// - public void Set(SettingBinding binding, T value) + /// False when the value is not written: an item of a package's set (). + public bool Set(SettingBinding binding, T value) { ArgumentNullException.ThrowIfNull(binding); var target = Target; + if (binding.Scope == SettingScope.Item && (target.Item is null || IsReadOnly(target.Item))) + { + return false; + } + _commit(() => binding.Set(target, value)); + return true; } /// Writes a number, held to 's bounds. @@ -224,7 +240,7 @@ public void SetNumber(NumberField field, int value) ArgumentNullException.ThrowIfNull(field); if (field.Binding is SettingBinding binding) { - Set(binding, Math.Clamp(value, field.Minimum, field.Maximum)); + _ = Set(binding, Math.Clamp(value, field.Minimum, field.Maximum)); } } @@ -240,7 +256,12 @@ public void SetNumber(NumberField field, int value) return null; } - if (TextRules.Check(field, value) is { } refused) + if (field.Binding.Scope == SettingScope.Item && _item is { } item && IsReadOnly(item)) + { + return ReadOnlyRefusal; + } + + if (TextRules.Check(field, value, Target) is { } refused) { return refused; } @@ -267,6 +288,229 @@ public void Reset(SettingsField field) } } + // ── list sections ──────────────────────────────────────────────────────────────────────────── + + /// What an edit to a package's set is refused with. + public const string ReadOnlyRefusal = "this set is a package's and is replaced when it updates — copy it to edit"; + + /// What the host knows that a list section's fields need. + public SettingsContext Context => _context; + + /// The item a list section's fields edit now, or null. + public object? Item => _item; + + /// Edits 's fields from now on (null for none). + public void Select(object? item) => _item = item; + + /// + /// 's items, by set: the player's own sets in order, then every installed package's sets, + /// read-only. Each set's items are a snapshot of its list now. + /// + public IReadOnlyList Groups(SettingsSectionContribution section) + { + ArgumentNullException.ThrowIfNull(section); + if (section.Collection is not { } collection) + { + return []; + } + + var groups = _config.TriggerSets.ToArray() + .Select(s => new SettingsItemGroup(s, s.Name, false, null, collection.ItemsIn(s))) + .ToList(); + foreach (var package in _config.Packages) + { + groups.AddRange(package.Sets.Select(s => + new SettingsItemGroup(s, $"{s.Name} · {package.Manifest.Name}", true, package.Manifest.Id, collection.ItemsIn(s)))); + } + + return groups; + } + + /// Whether lives in a package's set, and so refuses edits. + public bool IsReadOnly(object item) => + _config.Packages.Any(p => p.Sets.Any(s => ItemsOf(s).Any(i => ReferenceEquals(i, item)))); + + /// + /// Adds a new item to through the funnel and selects it; null when the set is a package's or + /// no item can be made (every chord a binding could be born on is taken). + /// + public object? Add(SettingsSectionContribution section, TriggerSet set) + { + ArgumentNullException.ThrowIfNull(section); + ArgumentNullException.ThrowIfNull(set); + if (section.Collection is not { } collection || IsPackageSet(set) + || collection.Create(_config, _context) is not { } item) + { + return null; + } + + _item = item; + _commit(() => collection.Add(set, item)); + return item; + } + + /// Adds a copy of after it through the funnel and selects it; null when refused. + public object? Duplicate(SettingsSectionContribution section, object item) + { + ArgumentNullException.ThrowIfNull(section); + ArgumentNullException.ThrowIfNull(item); + if (section.Collection is not { CanDuplicate: true } collection || IsReadOnly(item)) + { + return null; + } + + var copy = collection.Duplicate(_config, item); + _item = copy; + _commit(() => collection.InsertAfter(_config, item, copy)); + return copy; + } + + /// Deletes through the funnel; false when it is a package's. + public bool Delete(SettingsSectionContribution section, object item) + { + ArgumentNullException.ThrowIfNull(section); + ArgumentNullException.ThrowIfNull(item); + if (section.Collection is not { } collection || IsReadOnly(item)) + { + return false; + } + + if (ReferenceEquals(_item, item)) + { + _item = null; + } + + _commit(() => collection.Delete(_config, item)); + return true; + } + + /// Moves up (−1) or down (+1) within its set, through the funnel. + public bool Move(SettingsSectionContribution section, object item, int delta) + { + ArgumentNullException.ThrowIfNull(section); + ArgumentNullException.ThrowIfNull(item); + if (section.Collection is not { } collection || IsReadOnly(item) + || collection.OwnerOf(_config.TriggerSets, item) is not { } set) + { + return false; + } + + var items = collection.ItemsIn(set).ToList(); + var at = items.FindIndex(i => ReferenceEquals(i, item)); + if (at + delta < 0 || at + delta >= items.Count) + { + return false; + } + + _commit(() => collection.Move(_config, item, delta)); + return true; + } + + /// Switches on or off through the funnel; false when it is a package's. + public bool SetEnabled(SettingsSectionContribution section, object item, bool on) + { + ArgumentNullException.ThrowIfNull(section); + ArgumentNullException.ThrowIfNull(item); + if (section.Collection?.Field(section.Collection.EnabledField).Binding is not SettingBinding flag + || IsReadOnly(item)) + { + return false; + } + + var target = new SettingTarget(_config, _world, _character, item); + _commit(() => flag.Set(target, on)); + return true; + } + + /// Whether is enabled now. + public bool IsEnabled(SettingsSectionContribution section, object item) + { + ArgumentNullException.ThrowIfNull(section); + return section.Collection?.IsEnabled(_config, item) ?? false; + } + + /// + /// Copies a package's into the player's own sets through the funnel, where it can be edited. + /// The copy is made on the client's thread with the commit; false when is not a package's. + /// + public bool CopyToEdit(TriggerSet set) + { + ArgumentNullException.ThrowIfNull(set); + if (!IsPackageSet(set)) + { + return false; + } + + _commit(() => SettingsCollection.CopyToEdit(_config, set)); + return true; + } + + /// The suggestions offers for the item selected now. + public IReadOnlyList Suggestions(TextField field) + { + ArgumentNullException.ThrowIfNull(field); + return field.Suggest is { } suggest && Target.Reaches(field.Binding?.Scope ?? SettingScope.App) + ? suggest(Target, _context) + : []; + } + + /// Writes a fractional number, held to 's bounds. + public bool SetDecimal(DecimalField field, double value) + { + ArgumentNullException.ThrowIfNull(field); + return field.Binding is SettingBinding binding + && Set(binding, Math.Clamp(value, field.Minimum, field.Maximum)); + } + + /// + /// Sets a key binding's chord, refused (with the reason) when this host cannot deliver it or another binding holds + /// it — the two refusals the cell screen's key capture makes. + /// + public string? SetKey(KeyField field, string chord) + { + ArgumentNullException.ThrowIfNull(field); + ArgumentNullException.ThrowIfNull(chord); + if (field.Binding is not SettingBinding binding || _item is not { } item) + { + return null; + } + + if (IsReadOnly(item)) + { + return ReadOnlyRefusal; + } + + var canonical = MacroKey.Canonicalise(chord) ?? chord.Trim(); + if (_context.KeyProblem(canonical) is { } problem) + { + return problem; + } + + if (_config.TriggerSets.SelectMany(s => s.Macros) + .FirstOrDefault(m => !ReferenceEquals(m, item) && string.Equals(m.Key, canonical, StringComparison.OrdinalIgnoreCase)) is { } holder) + { + return $"already bound to {(string.IsNullOrWhiteSpace(holder.Name) ? holder.Key : holder.Name)}"; + } + + _ = Set(binding, canonical); + return null; + } + + /// + /// The live test for the trigger selected now, with in place of its own while one is being + /// typed: how many of the recent lines it matches, and the newest few with where. + /// + public TriggerPreviewResult? Preview(string? pattern = null, int samples = 6) => + _item is Trigger trigger + ? TriggerPreview.Run(_context.Lines, trigger.MatchType, pattern ?? trigger.Pattern, trigger.CaseSensitive, samples) + : null; + + private bool IsPackageSet(TriggerSet set) => _config.Packages.Any(p => p.Sets.Contains(set)); + + private static IEnumerable ItemsOf(TriggerSet set) => + set.Triggers.Cast().Concat(set.Aliases).Concat(set.Timers).Concat(set.Macros); + + /// The meters now — a copy, so a host can edit it and hand it back to . public List Meters(ListField field) { diff --git a/src/SharpMUTerm.Client/Settings/SettingsSearch.cs b/src/SharpMUTerm.Client/Settings/SettingsSearch.cs index 9f1eef47..33b1e590 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsSearch.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsSearch.cs @@ -17,7 +17,8 @@ public sealed record SettingsMatch( SettingsSectionContribution Section, SettingsField? Field, string Text, int Start, int Length); /// -/// The settings search: a query matched against every declared field's label, group, help line and keywords, +/// The settings search: a query matched against every declared field's label, group, help line and keywords — +/// a list section's item fields included — /// and against every section's title — so a screen whose fields are not declared yet is still found by name. /// Case is ignored and the match is a plain substring, the rule ⌃R and ⌃F already follow. Pure, so the whole /// contract is testable without a screen. @@ -42,7 +43,7 @@ public static IReadOnlyList Find(IEnumerable= 0 || Contains(field.Group, q) || Contains(field.Help, q) || Contains(field.Keywords, q)) @@ -70,6 +71,16 @@ public static IReadOnlyDictionary CountBySection(IEnumerable g.Key, g => g.Count(), StringComparer.Ordinal); } + /// + /// A section's searchable fields: its own, then — for a list section — every field of its items, so route or + /// expansion finds the screen that edits one. + /// + public static IEnumerable Searchable(SettingsSectionContribution section) + { + ArgumentNullException.ThrowIfNull(section); + return section.Collection is { } collection ? section.Fields.Concat(collection.Fields) : section.Fields; + } + private static bool Contains(string? text, string query) => text is not null && text.Contains(query, StringComparison.OrdinalIgnoreCase); } diff --git a/src/SharpMUTerm.Client/Settings/TextRules.cs b/src/SharpMUTerm.Client/Settings/TextRules.cs index d8efd279..0d042885 100644 --- a/src/SharpMUTerm.Client/Settings/TextRules.cs +++ b/src/SharpMUTerm.Client/Settings/TextRules.cs @@ -1,5 +1,6 @@ using System.Text.RegularExpressions; using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Automation; namespace SharpMUTerm.Client.Settings; @@ -26,6 +27,24 @@ public enum TextRule /// blank or the fallback itself stores null again, so "unset" has one spelling. /// Defaulted, + + /// A regular expression that may not be blank and must parse (an alias's pattern); not trimmed. + RequiredPattern, + + /// + /// A trigger's pattern, read as the trigger's own : only a regex can fail to parse, + /// and the plain kinds refuse only a pattern that would match every line. + /// + TriggerPattern, + + /// Optional text with no control characters, stored trimmed or as null when blank (a response, a rewrite). + Template, + + /// Text that may hold line breaks (an alias's expansion) and may not be empty; stored as typed. + Lines, + + /// The name of a window: not blank, no control characters; trimmed (a route). + Window, } /// @@ -35,12 +54,25 @@ public enum TextRule public static class TextRules { /// Why is refused for , or null when it is accepted. - public static string? Check(TextField field, string? value) + public static string? Check(TextField field, string? value) => Check(field, value, default); + + /// + /// Why is refused for on 's item (a trigger's + /// pattern is read as that trigger's match kind), or null when it is accepted. + /// + public static string? Check(TextField field, string? value, SettingTarget target) { ArgumentNullException.ThrowIfNull(field); var text = value ?? string.Empty; return field.Rule switch { + TextRule.RequiredPattern => text.Length == 0 ? "pattern cannot be empty" : RegexError(text), + TextRule.TriggerPattern => TriggerPatterns.Validate( + target.Item is Trigger trigger ? trigger.MatchType : TriggerMatchType.Regex, text), + TextRule.Template when text.Any(char.IsControl) => $"{field.Label} cannot contain control characters", + TextRule.Lines when text.Length == 0 => $"{field.Label} cannot be empty", + TextRule.Window when string.IsNullOrWhiteSpace(text) => $"{field.Label} cannot be empty", + TextRule.Window when text.Any(char.IsControl) => $"{field.Label} cannot contain control characters", TextRule.Required when string.IsNullOrWhiteSpace(text) => $"{field.Label} cannot be empty", TextRule.Name when string.IsNullOrWhiteSpace(text) => $"{field.Label} cannot be empty", TextRule.Name or TextRule.Secret or TextRule.Defaulted when text.Any(char.IsControl) => @@ -57,7 +89,9 @@ TextRule.Name or TextRule.Secret or TextRule.Defaulted when text.Any(char.IsCont var text = value ?? string.Empty; string? stored = field.Rule switch { - TextRule.Required or TextRule.Name => text.Trim(), + TextRule.Required or TextRule.Name or TextRule.Window => text.Trim(), + TextRule.RequiredPattern or TextRule.TriggerPattern or TextRule.Lines => text, + TextRule.Template => string.IsNullOrWhiteSpace(text) ? null : text.Trim(), TextRule.Pattern => string.IsNullOrWhiteSpace(text) ? null : text, TextRule.Secret => text.Length == 0 ? null : text, TextRule.Defaulted => text.Trim() is var t && (t.Length == 0 || string.Equals(t, field.Fallback, StringComparison.Ordinal)) @@ -81,6 +115,19 @@ public static string Shown(TextField field, string? stored) return stored ?? (field.Rule == TextRule.Defaulted ? field.Fallback ?? string.Empty : string.Empty); } + private static string? RegexError(string pattern) + { + try + { + _ = new Regex(pattern); + return null; + } + catch (ArgumentException e) + { + return "not a valid regex: " + e.Message.Split('\n')[0].Trim(); + } + } + private static string? PatternError(string pattern) { try diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 89c93b44..9f8fbe86 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -238,7 +238,7 @@ public static class SurfaceCatalog [SurfaceHosts.Window] = SurfaceDrawing.Native, }, "SharpMUTerm.Tui.OptionsScreenRenderer.FromSection", - ["SharpMUTerm.Avalonia.SettingsWindow", "SharpMUTerm.Avalonia.ThemeCardView"]), + ["SharpMUTerm.Avalonia.SettingsWindow", "SharpMUTerm.Avalonia.ThemeCardView", "SharpMUTerm.Avalonia.ListEditorView"]), new( LayoutsMenu, typeof(MenuModel), diff --git a/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs b/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs index 298d4dd9..01ade1fa 100644 --- a/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; using static SharpMUTerm.Tui.MarkupText; @@ -70,11 +71,11 @@ internal static class AliasesScreenRenderer /// empty expansion — so a new alias is a working placeholder rather than an empty shell that /// couldn't be committed. It is left enabled because an alias only acts on input the user types. /// - private const string NewAliasName = "New Alias"; + private const string NewAliasName = BuiltInSettings.NewAliasName; - private const string NewAliasPattern = "^alias$"; + private const string NewAliasPattern = BuiltInSettings.NewAliasPattern; - private const string NewAliasSubstitution = "look"; + private const string NewAliasSubstitution = BuiltInSettings.NewAliasSubstitution; /// /// Merges every sub-block into one line list (header, alias list | editor, footer). Used by the @@ -123,17 +124,31 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo /// draws them. Both values hang off the list row rather than becoming /// rows of their own, so the editor pane's cursor indices keep meaning what they meant. /// + /// F3's declared list (), whose item fields the rows are built from. + internal static SettingsCollection Declared => BuiltInSettings.Aliases.Collection!; + + /// The alias row's fields by declared id, in ⇥ order. + internal static IReadOnlyList RowFieldOrder { get; } = ["name", "pattern", "expansion", "set"]; + + /// The editor pane's check boxes by declared id. + internal static IReadOnlyList EditorFieldOrder { get; } = ["case"]; + internal static ScreenModel Model(IReadOnlyList sets, int selected) { ArgumentNullException.ThrowIfNull(sets); var entries = Flatten(sets); - var list = ScreenModel.Rows(entries, entry => ScreenRow.Of( - ScreenToggle.Bind(() => entry.Alias.Enabled, v => entry.Alias.Enabled = v), - ScreenField.Name("name", () => entry.Alias.Name, v => entry.Alias.Name = v), - ScreenField.Pattern("match pattern", () => entry.Alias.Pattern, v => entry.Alias.Pattern = v), - ScreenField.Lines("expansion", () => entry.Alias.Substitution, v => entry.Alias.Substitution = v), - ScreenLists.Owner(sets, s => s.Aliases, entry.Alias))) + var config = DeclaredFields.Over(sets); + var list = ScreenModel.Rows(entries, entry => + { + var target = new SettingTarget(config, Item: entry.Alias); + return ScreenRow.Of( + DeclaredFields.Toggle(Declared.Field(Declared.EnabledField), target), + RowFieldOrder.Select(id => DeclaredFields.Item( + Declared.Field(id), target, SettingsContext.Empty, + () => ScreenLists.Owner(sets, s => s.Aliases, entry.Alias))).ToArray()) + with { Move = ScreenLists.Mover(sets, s => s.Aliases, entry.Alias) }; + }) .Concat(Buttons(sets, selected)) .ToArray(); @@ -143,10 +158,10 @@ internal static ScreenModel Model(IReadOnlyList sets, int selected) } var alias = entries[selected].Alias; - var editor = new[] - { - ScreenRow.Of(ScreenToggle.Bind(() => alias.CaseSensitive, v => alias.CaseSensitive = v)), - }; + var selectedTarget = new SettingTarget(config, Item: alias); + var editor = EditorFieldOrder + .Select(id => ScreenRow.Of(DeclaredFields.Toggle(Declared.Field(id), selectedTarget))) + .ToArray(); return new ScreenModel(list, editor); } @@ -260,7 +275,7 @@ internal static List ListColumn( } lines.Add(string.Empty); - lines.AddRange(ScreenChrome.Buttons(Buttons(sets, selected), cursor, 0, entries.Count, width)); + lines.AddRange(ScreenChrome.Buttons(Buttons(sets, selected), cursor, 0, entries.Count, width, movable: true)); lines.Add(string.Empty); var picked = selected >= 0 && selected < entries.Count ? entries[selected].Alias : null; lines.AddRange(ScreenChrome.Legend( diff --git a/src/SharpMUTerm.Tui/DeclaredFields.cs b/src/SharpMUTerm.Tui/DeclaredFields.cs index 7872efb2..80bec5d4 100644 --- a/src/SharpMUTerm.Tui/DeclaredFields.cs +++ b/src/SharpMUTerm.Tui/DeclaredFields.cs @@ -1,5 +1,8 @@ using SharpMUTerm.Client.Contributions; using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; namespace SharpMUTerm.Tui; @@ -11,6 +14,19 @@ namespace SharpMUTerm.Tui; /// internal static class DeclaredFields { + private static readonly System.Runtime.CompilerServices.ConditionalWeakTable, AppConfiguration> Configs = new(); + + /// + /// A configuration over a list screen's , for the item bindings that look a value up in the + /// sets (the scripts the configuration already names). The list screens are handed the sets rather than the whole + /// configuration; this holds the very same list, so a binding reads and moves the screen's own sets. + /// + internal static AppConfiguration Over(IReadOnlyList sets) + { + ArgumentNullException.ThrowIfNull(sets); + return Configs.GetValue(sets, s => new AppConfiguration { TriggerSets = s as List ?? s.ToList() }); + } + /// The field with in . internal static SettingsField Find(SettingsSectionContribution section, string id) => section.Fields.FirstOrDefault(f => string.Equals(f.Id, id, StringComparison.Ordinal)) @@ -53,6 +69,75 @@ internal static ScreenField Screen(SettingsField field, SettingTarget target) } } + /// + /// The cell screen's field for one of a list section's item fields (), editing + /// 's item: the same factory each list screen used to call by hand, so a declared field + /// refuses and stores exactly what that row always did. Suggestions come from the field's own + /// over . + /// + /// The row's set field, which moves the item and so needs the screen's own sets. + /// For a key field: the host whose chords it may take. + /// For a key field: names the binding already holding a chord. + internal static ScreenField Item( + SettingsField field, + SettingTarget target, + SettingsContext context, + Func? owner = null, + HostKeys? keys = null, + Func? taken = null) + { + ArgumentNullException.ThrowIfNull(field); + ArgumentNullException.ThrowIfNull(context); + switch (field) + { + case ChoiceField { MovesItem: true } when owner is not null: + return owner() with { Label = field.Label }; + + case TextField text when field.Binding is SettingBinding binding: + { + string? Get() => binding.Get(target); + void Set(string? value) => binding.Set(target, value); + var known = text.Suggest?.Invoke(target, context); + return text.Rule switch + { + TextRule.Name => ScreenField.Name(field.Label, () => Get() ?? string.Empty, v => Set(v)), + TextRule.Required => ScreenField.Text(field.Label, () => Get() ?? string.Empty, v => Set(v), known), + TextRule.TriggerPattern => ScreenField.TriggerPattern( + field.Label, + () => Get() ?? string.Empty, + v => Set(v), + () => target.Item is Trigger trigger ? trigger.MatchType : TriggerMatchType.Regex), + TextRule.RequiredPattern => ScreenField.Pattern(field.Label, () => Get() ?? string.Empty, v => Set(v)), + TextRule.Template => ScreenField.Template(field.Label, Get, Set, known), + TextRule.Lines => ScreenField.Lines(field.Label, () => Get() ?? string.Empty, v => Set(v)), + TextRule.Window => ScreenField.WindowName( + field.Label, () => Get() ?? string.Empty, v => Set(v), known ?? Array.Empty()), + _ => Screen(field, target), + }; + } + + case DecimalField number when field.Binding is SettingBinding value: + return ScreenField.Number( + field.Label, () => value.Get(target), v => value.Set(target, v), number.Minimum, number.Maximum); + + case HighlightField when field.Binding is SettingBinding colour: + return ScreenField.Colour(field.Label, () => colour.Get(target), v => colour.Set(target, v)); + + case FlagsField flags when field.Binding is SettingBinding words: + return new ScreenField( + field.Label, + () => words.Get(target), + value => FlagWords.Unknown(value, flags.Names) is { } bad ? $"{field.Label} has no '{bad}'" : null, + value => words.Set(target, value)); + + case KeyField when field.Binding is SettingBinding chord && keys is not null: + return ScreenField.Key(keys, field.Label, () => chord.Get(target), v => chord.Set(target, v), taken ?? (_ => null)); + + default: + return Screen(field, target); + } + } + /// The cell screen's checkbox for a declared flag, editing . internal static ScreenToggle Toggle(SettingsField field, SettingTarget target) => field.Binding is SettingBinding flag diff --git a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs index 8a02f865..040124ac 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Settings; using System.Globalization; using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; @@ -96,9 +97,9 @@ internal static class KeypadScreenRenderer internal const string AddBindingLabel = "+ binding"; /// What a brand-new binding is called and sends, before it is edited. - private const string NewBindingName = "New Binding"; + private const string NewBindingName = BuiltInSettings.NewBindingName; - private const string NewBindingCommand = "look"; + private const string NewBindingCommand = BuiltInSettings.NewBindingCommand; /// /// Longest command a numpad cell shows when the column has no width to reason from — the merged @@ -220,6 +221,12 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo /// without them the screen simply offers no buttons rather than offering ones that would throw. /// /// Which binding the cursor has anchored, or -1 for none. + /// F4's declared list (), whose item fields the rows are built from. + internal static SettingsCollection Declared => BuiltInSettings.Keypad.Collection!; + + /// The binding row's fields by declared id, in ⇥ order; set only when the screen knows the sets. + internal static IReadOnlyList RowFieldOrder { get; } = ["name", "command", "key", "set"]; + internal static ScreenModel Model( HostKeys keys, IReadOnlyList macros, IReadOnlyList? sets = null, int selected = -1) @@ -238,20 +245,20 @@ internal static ScreenModel Model( private static ScreenRow BindingRow( HostKeys keys, Macro macro, IReadOnlyList macros, IReadOnlyList? sets) { - var fields = new List - { - ScreenField.Name("name", () => macro.Name, v => macro.Name = v), - ScreenField.Text("command", () => macro.Command, v => macro.Command = v), - ScreenField.Key(keys, "key", () => macro.Key, v => macro.Key = v, key => AlreadyBound(macros, macro, key)), - }; - - if (sets is not null) - { - fields.Add(ScreenLists.Owner(sets, s => s.Macros, macro)); - } - - return ScreenRow.Of( - ScreenToggle.Bind(() => macro.Enabled, v => macro.Enabled = v), fields.ToArray()); + var target = new SettingTarget(DeclaredFields.Over(sets ?? Array.Empty()), Item: macro); + var fields = RowFieldOrder + .Where(id => sets is not null || id != "set") + .Select(id => DeclaredFields.Item( + Declared.Field(id), + target, + SettingsContext.Empty, + () => ScreenLists.Owner(sets!, s => s.Macros, macro), + keys, + key => AlreadyBound(macros, macro, key))) + .ToArray(); + + return ScreenRow.Of(DeclaredFields.Toggle(Declared.Field(Declared.EnabledField), target), fields) + with { Move = sets is null ? null : ScreenLists.Mover(sets, s => s.Macros, macro) }; } /// @@ -487,7 +494,7 @@ internal static List HotkeysColumn( lines.Add(string.Empty); lines.AddRange(ScreenChrome.Buttons( - Buttons(keys, sets, selected), cursor, 0, macros.Count, width)); + Buttons(keys, sets, selected), cursor, 0, macros.Count, width, movable: sets is not null)); return ScreenChrome.Choices(lines, cursor.Edit, width); } diff --git a/src/SharpMUTerm.Tui/ScreenChrome.cs b/src/SharpMUTerm.Tui/ScreenChrome.cs index 6bbca503..526b6aa2 100644 --- a/src/SharpMUTerm.Tui/ScreenChrome.cs +++ b/src/SharpMUTerm.Tui/ScreenChrome.cs @@ -657,8 +657,12 @@ internal static string EmptySet(string set, string noun) => /// Which pane these belong to. /// The pane row index of the first button — i.e. the list's length. /// How wide the cursor bar runs, matching the pane's other rows. + /// + /// Whether the list's items can be moved with ⌥↑/⌥↓; a row under the removal row then says so, naming the same + /// item — the key acts on the row the cursor is on, as Delete does, so it is drawn the way Delete's row is. + /// internal static List Buttons( - IReadOnlyList buttons, ScreenFocus cursor, int pane, int firstIndex, int width) + IReadOnlyList buttons, ScreenFocus cursor, int pane, int firstIndex, int width, bool movable = false) { ArgumentNullException.ThrowIfNull(buttons); @@ -676,6 +680,11 @@ internal static List Buttons( ScreenButtonKind.Detail => KeyHintRow(button, InfoWords), _ => Cursor(AddRow(button), cursor.IsOn(pane, firstIndex + i), width), }); + + if (movable && button.Kind == ScreenButtonKind.Remove) + { + lines.Add(KeyHintRow(button with { Label = MoveKeyLabel }, MovesWord)); + } } return lines; @@ -700,6 +709,12 @@ private static string KeyHintRow(ScreenButton button, string verb) => + $" [{ScreenPalette.Label}]{verb}[/] " + $"[{ScreenPalette.Value}]{MarkupText.Escape(button.Target ?? string.Empty)}[/]"; + /// The keys a list row is moved with, as its hint row names them. + internal const string MoveKeyLabel = "⌥↑↓"; + + /// The verb on the move row. + internal const string MovesWord = "moves"; + /// The verb on a removal row, between the key and what it would take. internal const string RemovesWord = "removes"; diff --git a/src/SharpMUTerm.Tui/ScreenColours.cs b/src/SharpMUTerm.Tui/ScreenColours.cs index 9e632052..f5a99dd8 100644 --- a/src/SharpMUTerm.Tui/ScreenColours.cs +++ b/src/SharpMUTerm.Tui/ScreenColours.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Text; namespace SharpMUTerm.Tui; @@ -18,95 +19,21 @@ namespace SharpMUTerm.Tui; /// internal static class ScreenColours { - /// The name for "no colour at all" — the null a highlight is unset with. - internal const string None = "none"; + /// What "no colour" reads as — . + internal const string None = HighlightColours.None; - /// The name for the terminal's own default colour. - internal const string DefaultName = "default"; + /// The terminal's default colour, as a name. + internal const string DefaultName = HighlightColours.DefaultName; - /// - /// The named choices ↑↓ steps through, in the order they cycle: "no colour" first, then a spread - /// wide enough to tell two highlights apart at a glance. Every name resolves through - /// , so the picker and MXP/Pueblo markup agree on what "gold" means. - /// - internal static readonly IReadOnlyList Palette = new[] - { - None, "red", "orange", "gold", "yellow", "lime", "green", "cyan", "teal", - "blue", "magenta", "purple", "pink", "white", "silver", "grey", "black", - }; - - /// - /// The text a field shows for a colour: the palette name when one matches exactly, else the - /// literal syntax reads back. Null — an unset highlight — is - /// . - /// - internal static string Format(TerminalColor? colour) - { - if (colour is not { } value) - { - return None; - } - - foreach (var name in Palette) - { - if (name != None && WebColors.TryParse(name, out var named) && named == value) - { - return name; - } - } - - return value.Kind switch - { - TerminalColorKind.Rgb => $"#{value.R:x2}{value.G:x2}{value.B:x2}", - TerminalColorKind.Indexed => $"idx:{value.Index}", - _ => DefaultName, - }; - } - - /// - /// Reads a typed colour. Returns false when the text names nothing — the field's validator, so a - /// misspelling is refused at commit rather than silently becoming "no highlight". - /// is null for , which is a legal value. - /// - internal static bool TryParse(string text, out TerminalColor? colour) - { - ArgumentNullException.ThrowIfNull(text); - - colour = null; - var trimmed = text.Trim(); - if (trimmed.Length == 0 || trimmed.Equals(None, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - if (trimmed.Equals(DefaultName, StringComparison.OrdinalIgnoreCase)) - { - colour = TerminalColor.Default; - return true; - } - - if (trimmed.StartsWith("idx:", StringComparison.OrdinalIgnoreCase) - && int.TryParse(trimmed.AsSpan(4), out var index) - && index is >= 0 and <= 255) - { - colour = TerminalColor.FromIndex(index); - return true; - } + /// The names ↑↓ steps through — the Client's palette, so both hosts offer the same. + internal static readonly IReadOnlyList Palette = HighlightColours.Palette; - if (WebColors.TryParse(trimmed, out var parsed)) - { - colour = parsed; - return true; - } + /// A colour as text (). + internal static string Format(TerminalColor? colour) => HighlightColours.Format(colour); - return false; - } + /// Reads a colour (). + internal static bool TryParse(string text, out TerminalColor? colour) => HighlightColours.TryParse(text, out colour); - /// - /// The markup hex a swatch is painted with. Indexed colours resolve through the xterm palette - /// rather than falling back to the accent, so a swatch shows the colour the terminal will - /// actually use; only the terminal *default* has no hex of its own. - /// internal static string Hex(TerminalColor colour, string fallback) => colour.Kind switch { TerminalColorKind.Rgb => $"#{colour.R:x2}{colour.G:x2}{colour.B:x2}", diff --git a/src/SharpMUTerm.Tui/ScreenLists.cs b/src/SharpMUTerm.Tui/ScreenLists.cs index ef8bc597..403254d7 100644 --- a/src/SharpMUTerm.Tui/ScreenLists.cs +++ b/src/SharpMUTerm.Tui/ScreenLists.cs @@ -202,6 +202,38 @@ private static void Move( /// The row an item occupies in the flattened pane: every earlier set's items, then its own position. /// -1 when no set holds it. /// + /// + /// A list row's ⌥↑/⌥↓: moves one place within the set holding it and answers its new + /// flattened index, or null at either end of its set — a move never carries an item into the next set, which is + /// what is for. + /// + internal static Func Mover(IReadOnlyList sets, Func> items, T item) + where T : class + { + ArgumentNullException.ThrowIfNull(sets); + ArgumentNullException.ThrowIfNull(items); + ArgumentNullException.ThrowIfNull(item); + return delta => + { + if (OwnerOf(sets, items, item) is not { } owner) + { + return null; + } + + var list = items(owner); + var at = IndexOf(list, item); + var to = at + delta; + if (to < 0 || to >= list.Count) + { + return null; + } + + list.RemoveAt(at); + list.Insert(to, item); + return Flattened(sets, items, item); + }; + } + internal static int Flattened(IReadOnlyList sets, Func> items, T item) where T : class { diff --git a/src/SharpMUTerm.Tui/ScreenModel.cs b/src/SharpMUTerm.Tui/ScreenModel.cs index ad1b5fa6..1e5d5d66 100644 --- a/src/SharpMUTerm.Tui/ScreenModel.cs +++ b/src/SharpMUTerm.Tui/ScreenModel.cs @@ -221,11 +221,16 @@ internal enum ScreenButtonKind /// Puts the row's value back to its default, or null when the row is at its default or has none to go back /// to — so r reset is offered exactly where it would do something. Only declared settings carry one. /// +/// +/// Moves the row's item up (−1) or down (+1) within its list — ⌥↑/⌥↓ on a list screen — and answers the row it now +/// sits at, or null when it is already at that end. Only the list screens' item rows carry one. +/// internal readonly record struct ScreenRow( ScreenToggle? Toggle = null, IReadOnlyList? Fields = null, ScreenButton? Button = null, - Action? Reset = null) + Action? Reset = null, + Func? Move = null) { /// A selectable row with nothing to press and nothing to type into. internal static ScreenRow Stop => default; diff --git a/src/SharpMUTerm.Tui/SettingsSession.cs b/src/SharpMUTerm.Tui/SettingsSession.cs index 6bb03c9b..a988f9af 100644 --- a/src/SharpMUTerm.Tui/SettingsSession.cs +++ b/src/SharpMUTerm.Tui/SettingsSession.cs @@ -208,6 +208,12 @@ private ScreenAction Interpret(ConsoleKeyInfo key) case ConsoleKey.Enter: return Activate(model); + case ConsoleKey.UpArrow when key.Modifiers == ConsoleModifiers.Alt: + return Reorder(model, -1); + + case ConsoleKey.DownArrow when key.Modifiers == ConsoleModifiers.Alt: + return Reorder(model, 1); + case ConsoleKey.UpArrow: return Changed(Selection.MoveVertically(-1, model.Sizes, model.Layout)); @@ -332,6 +338,29 @@ private ScreenAction Reset(ScreenModel model) return ScreenAction.Redraw; } + /// + /// ⌥↑/⌥↓ on a list screen's item moves that item one place within its set — order is meaning for a trigger, + /// since the first rule that stops processing wins — through , and the cursor goes with it. + /// At either end of its set, and on a row that is not an item, the key is not ours. + /// + private ScreenAction Reorder(ScreenModel model, int delta) + { + if (model.RowAt(Selection.Pane, Selection.Index).Move is not { } move) + { + return ScreenAction.None; + } + + // The move is made first and saved only if it happened: at the end of its set nothing changed to save. + if (move(delta) is not { } row) + { + return ScreenAction.None; + } + + Edits.Apply(() => { }); + Selection.Seed(Selection.Pane, row); + return ScreenAction.Redraw; + } + private ScreenAction Toggle(ScreenModel model) { if (model.ToggleAt(Selection.Pane, Selection.Index) is not { } toggle) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs index c3f1680d..480b8e65 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs @@ -115,7 +115,9 @@ private void OpenSettingsScreen(ConsoleKey key, Func open) /// host has none (the terminal, the snapshot, the tests) or the section declares no fields, which keep their /// cell screens. /// - private bool TryOpenNativeSettings(SettingsSectionContribution? section) + /// The section to open on. + /// For a list section, the item to open on (the trigger builder's new rule), or null. + private bool TryOpenNativeSettings(SettingsSectionContribution? section, object? item = null) { if (Host.NativeSettings is not { } native || section is null || !SettingsForm.IsDeclared(section)) { @@ -123,10 +125,22 @@ private bool TryOpenNativeSettings(SettingsSectionContribution? section) } _settings.CloseAll(); - native.Show(NativeSettingsForm(section.Id)); + native.Show(NativeSettingsForm(section.Id, item)); return true; } + /// + /// What the list sections need that the configuration does not hold, read here on the client's thread: the windows a + /// route can name, the panes' recent output for F2's live test, and this host's own answer to which chords a key + /// binding can be given ( over ), so the window's F4 says + /// what is true of the window and the terminal's what is true of the terminal. + /// + private SettingsContext ListContext() => new( + RouteTargets(), + TriggerTestLines(), + key => MacroKeys.Verdict(Host.Keys, key) is { Fires: false } verdict ? verdict.Reason : null, + MacroKeys.Bindable(Host.Keys)); + /// /// The declared settings as a form a host draws natively, opening on . Every change it /// makes goes through a over — the cell screens' own @@ -134,7 +148,7 @@ private bool TryOpenNativeSettings(SettingsSectionContribution? section) /// meter table reads the game data of the window focused when the form opened (), /// captured here because the store is thread-safe and the focus is not. /// - internal SettingsForm NativeSettingsForm(string initial) + internal SettingsForm NativeSettingsForm(string initial, object? item = null) { var edits = new ScreenEdits(SaveConfiguration); var data = SettingsGameData(); @@ -162,7 +176,9 @@ internal SettingsForm NativeSettingsForm(string initial) themes, () => ThemePreviews.IsDark(_theme), world, - character); + character, + ListContext(), + item); return form; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs index bae7a12b..9b6741bd 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs @@ -85,6 +85,13 @@ private bool MakeTriggerFromSelection() set.Triggers.Add(trigger); SaveConfiguration(); + // The declared editor in either host: the window's native list on the new rule, or the cell F2 with its pattern + // being typed. + if (TryOpenNativeSettings(Section("triggers"), trigger)) + { + return true; + } + var index = _config.TriggerSets.SelectMany(s => s.Triggers).ToList().IndexOf(trigger); _settings.Toggle(ConsoleKey.F2, () => TriggersScreen(editPattern: index)); return true; diff --git a/src/SharpMUTerm.Tui/TimersScreenRenderer.cs b/src/SharpMUTerm.Tui/TimersScreenRenderer.cs index a5a84937..b5ea5e9d 100644 --- a/src/SharpMUTerm.Tui/TimersScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/TimersScreenRenderer.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Settings; using System.Globalization; using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; @@ -70,11 +71,11 @@ internal static class TimersScreenRenderer /// nobody asked for. A new trigger only reacts to output and a new binding only to a keypress, so /// those stay live. /// - private const string NewTimerName = "New Timer"; + private const string NewTimerName = BuiltInSettings.NewTimerName; private const double NewTimerIntervalSeconds = 60; - private const string NewTimerCommand = "look"; + private const string NewTimerCommand = BuiltInSettings.NewTimerCommand; /// /// Merges every sub-block into one line list (header, timer list | editor, footer). Used by the @@ -123,22 +124,31 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo /// draws them. Both values hang off the list row rather than becoming /// rows of their own, so the editor pane's cursor indices keep meaning what they meant. /// + /// F6's declared list (), whose item fields the rows are built from. + internal static SettingsCollection Declared => BuiltInSettings.Timers.Collection!; + + /// The timer row's fields by declared id, in ⇥ order. + internal static IReadOnlyList RowFieldOrder { get; } = ["name", "interval", "command", "set"]; + + /// The editor pane's check boxes by declared id, in the order the pane draws them. + internal static IReadOnlyList EditorFieldOrder { get; } = ["one-shot", "enabled"]; + internal static ScreenModel Model(IReadOnlyList sets, int selected) { ArgumentNullException.ThrowIfNull(sets); var entries = Flatten(sets); - var list = ScreenModel.Rows(entries, entry => ScreenRow.Of( - ScreenToggle.Bind(() => entry.Timer.Enabled, v => entry.Timer.Enabled = v), - ScreenField.Name("name", () => entry.Timer.Name, v => entry.Timer.Name = v), - ScreenField.Number( - "interval", - () => entry.Timer.IntervalSeconds, - v => entry.Timer.IntervalSeconds = v, - MinIntervalSeconds, - MaxIntervalSeconds), - ScreenField.Text("command", () => entry.Timer.Command, v => entry.Timer.Command = v), - ScreenLists.Owner(sets, s => s.Timers, entry.Timer))) + var config = DeclaredFields.Over(sets); + var list = ScreenModel.Rows(entries, entry => + { + var target = new SettingTarget(config, Item: entry.Timer); + return ScreenRow.Of( + DeclaredFields.Toggle(Declared.Field(Declared.EnabledField), target), + RowFieldOrder.Select(id => DeclaredFields.Item( + Declared.Field(id), target, SettingsContext.Empty, + () => ScreenLists.Owner(sets, s => s.Timers, entry.Timer))).ToArray()) + with { Move = ScreenLists.Mover(sets, s => s.Timers, entry.Timer) }; + }) .Concat(Buttons(sets, selected)) .ToArray(); @@ -148,11 +158,10 @@ internal static ScreenModel Model(IReadOnlyList sets, int selected) } var timer = entries[selected].Timer; - var editor = new[] - { - ScreenRow.Of(ScreenToggle.Bind(() => timer.OneShot, v => timer.OneShot = v)), - ScreenRow.Of(ScreenToggle.Bind(() => timer.Enabled, v => timer.Enabled = v)), - }; + var selectedTarget = new SettingTarget(config, Item: timer); + var editor = EditorFieldOrder + .Select(id => ScreenRow.Of(DeclaredFields.Toggle(Declared.Field(id), selectedTarget))) + .ToArray(); return new ScreenModel(list, editor); } @@ -162,10 +171,10 @@ internal static ScreenModel Model(IReadOnlyList sets, int selected) /// is what the Enabled checkbox is for — typing it into the interval would silently turn the timer /// off while it still read as on. /// - private const double MinIntervalSeconds = 0.1; + private const double MinIntervalSeconds = BuiltInSettings.MinIntervalSeconds; /// A day; past this the value is far likelier to be a typo than a schedule. - private const double MaxIntervalSeconds = 86400; + private const double MaxIntervalSeconds = BuiltInSettings.MaxIntervalSeconds; /// /// The timer list's buttons. A timer is added to the set that owns the selection, so a new one @@ -264,7 +273,7 @@ internal static List ListColumn( } lines.Add(string.Empty); - lines.AddRange(ScreenChrome.Buttons(Buttons(sets, selected), cursor, 0, entries.Count, width)); + lines.AddRange(ScreenChrome.Buttons(Buttons(sets, selected), cursor, 0, entries.Count, width, movable: true)); lines.Add(string.Empty); var picked = selected >= 0 && selected < entries.Count ? entries[selected].Timer : null; lines.AddRange(ScreenChrome.Legend( diff --git a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs index 8ef9fcac..527b0ecf 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Theming; using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; @@ -102,8 +103,21 @@ internal static class TriggersScreenRenderer internal const int MatchTypeField = 10; /// The words the match field offers, in the order gives. - internal static IReadOnlyList MatchTypeNames { get; } = - TriggerPatterns.Offered.Select(TriggerPatterns.Describe).ToArray(); + internal static IReadOnlyList MatchTypeNames => BuiltInSettings.MatchTypeNames; + + /// F2's declared list (), whose item fields this screen's rows are built from. + internal static SettingsCollection Declared => BuiltInSettings.Triggers.Collection!; + + /// + /// The rule row's fields by declared id, in ⇥ order — so position holds name, + /// holds match, and every ordinal addresses what it always did. The declaration's + /// own order is the window's grouping; this is the cell screen's. + /// + internal static IReadOnlyList RowFieldOrder { get; } = + ["name", "pattern", "route", "fg", "bg", "attributes", "rewrite", "respond", "script", "set", "match"]; + + /// The editor pane's check boxes by declared id, in the order the pane draws them. + internal static IReadOnlyList EditorFieldOrder { get; } = ["gag", "stop", "case"]; /// /// How many sample rows the live test always draws, matching or not, so the rows under it do not jump @@ -144,9 +158,9 @@ internal static class TriggersScreenRenderer /// matches, which is why a new trigger is left enabled while a new timer is not (a timer fires /// without being provoked; a trigger with nothing to do does not). /// - private const string NewTriggerName = "New Trigger"; + private const string NewTriggerName = BuiltInSettings.NewTriggerName; - private const string NewTriggerPattern = "text to match"; + private const string NewTriggerPattern = BuiltInSettings.NewTriggerPattern; /// The window a rule routes to, as the route field reads and writes it. private static string Route(Trigger trigger) => trigger.Actions.SpawnTarget ?? NoRoute; @@ -311,49 +325,20 @@ internal static ScreenModel Model( ArgumentNullException.ThrowIfNull(sets); var flattened = Flatten(sets); - var callbacks = NamedCallbacks(sets); - var rules = ScreenModel.Rows(flattened, entry => ScreenRow.Of( - ScreenToggle.Bind(() => entry.Trigger.Enabled, v => entry.Trigger.Enabled = v), - ScreenField.Name("name", () => entry.Trigger.Name, v => entry.Trigger.Name = v), - ScreenField.TriggerPattern( - "match pattern", - () => entry.Trigger.Pattern, - v => entry.Trigger.Pattern = v, - () => entry.Trigger.MatchType), - ScreenField.WindowName( - "route", - () => Route(entry.Trigger), - v => entry.Trigger.Actions.SpawnTarget = v == NoRoute ? null : v.Trim(), - Routes(entry.Trigger, routeTargets)), - ScreenField.Colour( - "highlight fg", - () => entry.Trigger.Actions.HighlightForeground, - v => entry.Trigger.Actions.HighlightForeground = v), - ScreenField.Colour( - "highlight bg", - () => entry.Trigger.Actions.HighlightBackground, - v => entry.Trigger.Actions.HighlightBackground = v), - ScreenField.Flags( - "attributes", - () => entry.Trigger.Actions.AddAttributes, - v => entry.Trigger.Actions.AddAttributes = v), - ScreenField.Template( - "rewrite", () => entry.Trigger.Actions.Rewrite, v => entry.Trigger.Actions.Rewrite = v), - ScreenField.Template( - "respond", - () => entry.Trigger.Actions.SendResponse, - v => entry.Trigger.Actions.SendResponse = v), - ScreenField.Template( - "script", - () => entry.Trigger.Actions.ScriptCallback, - v => entry.Trigger.Actions.ScriptCallback = v, - Callbacks(entry.Trigger, callbacks)), - ScreenLists.Owner(sets, s => s.Triggers, entry.Trigger), - ScreenField.Choice( - "match", - () => TriggerPatterns.Describe(entry.Trigger.MatchType), - v => SetMatchType(entry.Trigger, TriggerPatterns.Parse(v) ?? entry.Trigger.MatchType), - MatchTypeNames))) + var config = DeclaredFields.Over(sets); + var context = SettingsContext.Empty with { Windows = routeTargets ?? Array.Empty() }; + var rules = ScreenModel.Rows(flattened, entry => + { + var target = new SettingTarget(config, Item: entry.Trigger); + return ScreenRow.Of( + DeclaredFields.Toggle(Declared.Field(Declared.EnabledField), target), + RowFieldOrder.Select(id => DeclaredFields.Item( + Declared.Field(id), + target, + context, + () => ScreenLists.Owner(sets, s => s.Triggers, entry.Trigger))).ToArray()) + with { Move = ScreenLists.Mover(sets, s => s.Triggers, entry.Trigger) }; + }) .Concat(Buttons(sets, selectedTrigger)) .ToArray(); @@ -365,12 +350,10 @@ internal static ScreenModel Model( var trigger = flattened[selectedTrigger].Trigger; // Appended rather than inserted: these are the pane's cursor stops, and putting the new one // above the two that were here would renumber rows the screen (and its tests) already address. - var editor = new[] - { - ScreenRow.Of(ScreenToggle.Bind(() => trigger.Actions.Gag, v => trigger.Actions.Gag = v)), - ScreenRow.Of(ScreenToggle.Bind(() => trigger.StopProcessing, v => trigger.StopProcessing = v)), - ScreenRow.Of(ScreenToggle.Bind(() => trigger.CaseSensitive, v => trigger.CaseSensitive = v)), - }; + var selected = new SettingTarget(config, Item: trigger); + var editor = EditorFieldOrder + .Select(id => ScreenRow.Of(DeclaredFields.Toggle(Declared.Field(id), selected))) + .ToArray(); return new ScreenModel(rules, editor); } @@ -381,16 +364,7 @@ internal static ScreenModel Model( /// form of what they built; moving away leaves the text as typed, because there is no plain-language /// reading of an arbitrary regex to convert it to. /// - internal static void SetMatchType(Trigger trigger, TriggerMatchType type) - { - ArgumentNullException.ThrowIfNull(trigger); - if (type == TriggerMatchType.Regex && trigger.MatchType != TriggerMatchType.Regex) - { - trigger.Pattern = TriggerPatterns.ToRegex(trigger.MatchType, trigger.Pattern); - } - - trigger.MatchType = type; - } + internal static void SetMatchType(Trigger trigger, TriggerMatchType type) => BuiltInSettings.SetMatchType(trigger, type); /// /// The rule list's buttons. A rule is added to the set that owns the selection rather than to some @@ -504,7 +478,7 @@ internal static List RulesColumn( left.Add(string.Empty); left.AddRange(ScreenChrome.Buttons( - Buttons(sets, selectedTrigger), cursor, 0, flattened.Count, width)); + Buttons(sets, selectedTrigger), cursor, 0, flattened.Count, width, movable: true)); left.Add(string.Empty); left.AddRange(FlagLegend(Selected(flattened, selectedTrigger), width)); return left; diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs index 12a3e0f6..cd4387ab 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -312,15 +312,18 @@ [new MapViewExit(1, 2)], // ── helpers ────────────────────────────────────────────────────────────────────────────────── - internal static SharpMUTermApp InlineWindowApp(AvaloniaConsoleDriver driver) => - new(DemoScene.Build(), WindowHost.Create(driver, clipboard: null) with + internal static SharpMUTermApp InlineWindowApp(AvaloniaConsoleDriver driver) => new(DemoScene.Build(), InlineHost(driver)); + + /// The window's host as builds it, for a test that changes one member. + internal static ClientHost InlineHost(AvaloniaConsoleDriver driver) => + WindowHost.Create(driver, clipboard: null) with { Capabilities = WindowOptions.Capabilities, Audio = null, Presence = null, Announcer = null, RunsInline = true, - }); + }; private static void Offer(AvaloniaConsoleDriver driver, Action> menu, Action? dispatch = null) { diff --git a/tests/SharpMUTerm.Avalonia.Tests/ListEditorTests.cs b/tests/SharpMUTerm.Avalonia.Tests/ListEditorTests.cs new file mode 100644 index 00000000..de37fbab --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/ListEditorTests.cs @@ -0,0 +1,220 @@ +using Avalonia.Controls; +using Avalonia.Controls.Documents; +using Avalonia.Headless; +using Avalonia.Interactivity; +using Avalonia.Threading; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Packages; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The settings window's list sections (F2, F3, F4, F6): a master-detail editor whose detail is one control per +/// declared item field, whose buttons add, duplicate, delete and reorder through the form's one commit, which +/// refuses a package's set and offers to copy it, and whose F2 page runs the live test over recent output. +/// +[NotInParallel] +public class ListEditorTests +{ + private sealed class Harness + { + public Harness() + { + Config.TriggerSets.Clear(); + Config.TriggerSets.Add(Own); + Config.Packages = [new InstalledPackage(new PackageManifest { Id = "pack", Name = "Pack", Version = "1.0.0" }, [Package])]; + } + + public AppConfiguration Config { get; } = new(); + + public TriggerSet Own { get; } = new() + { + Name = "public", + Triggers = + { + new Trigger { Name = "xp", Pattern = "You gain * experience", MatchType = TriggerMatchType.Wildcard }, + new Trigger { Name = "tell", Pattern = "tells you" }, + }, + }; + + public TriggerSet Package { get; } = new() { Name = "combat", Triggers = { new Trigger { Name = "theirs", Pattern = "x" } } }; + + public int Commits { get; set; } + + public SettingsForm Form(string initial, object? item = null) + { + SettingsForm? form = null; + var context = new SettingsContext( + ["Chat"], + ["You gain 40 experience points.", "A guard nods.", "You gain 7 experience points."], + _ => null, + ["F10", "F11", "F12"]); + form = new SettingsForm( + BuiltInSettings.All, + Config, + change => + { + change(); + Commits++; + form!.NotifyChanged(); + }, + _ => { }, + initial, + isDark: true, + context: context, + item: item); + return form; + } + } + + private static void Click(Button button) => button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); + + [Test] + public async Task EachListPageDrawsOneControlPerDeclaredItemField() + { + foreach (var section in new[] { BuiltInSettings.Triggers, BuiltInSettings.Aliases, BuiltInSettings.Timers }) + { + var harness = new Harness(); + harness.Own.Aliases.Add(new Alias { Name = "a", Pattern = "^a$", Substitution = "look" }); + harness.Own.Timers.Add(new TimerDefinition { Name = "t", Command = "look" }); + var (shown, controls) = await Run(harness, section.Id, window => + (window.ShownFields.ToArray(), window.FieldControls.Keys.ToArray())); + + var declared = section.Collection!.Fields.Select(f => f.Id).ToArray(); + await Assert.That(shown).IsEquivalentTo(declared); + await Assert.That(controls.Except([section.Collection.EnabledField])).IsEquivalentTo(declared.Except([section.Collection.EnabledField])); + } + } + + [Test] + public async Task TheButtonsAddDuplicateMoveAndDeleteThroughTheCommit() + { + var harness = new Harness(); + var own = harness.Own; + var xp = own.Triggers[0]; + var (afterAdd, afterDuplicate, afterMove, afterDelete) = await Run(harness, "triggers", window => + { + var editor = window.ListEditor!; + editor.Choose(xp); + + Click(editor.AddButton); + Dispatcher.UIThread.RunJobs(); + var added = own.Triggers.Count; + + editor.Choose(xp); + Click(editor.DuplicateButton); + Dispatcher.UIThread.RunJobs(); + var duplicated = own.Triggers.Select(t => t.Name).ToArray(); + + editor.Choose(xp); + Click(editor.DownButton); + Dispatcher.UIThread.RunJobs(); + var moved = own.Triggers.IndexOf(xp); + + Click(editor.DeleteButton); + Dispatcher.UIThread.RunJobs(); + return (added, duplicated, moved, own.Triggers.Contains(xp)); + }); + + await Assert.That(afterAdd).IsEqualTo(3); + await Assert.That(afterDuplicate.Take(2)).IsEquivalentTo(new[] { "xp", "xp copy" }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(afterMove).IsEqualTo(1); + await Assert.That(afterDelete).IsFalse(); + await Assert.That(harness.Commits).IsEqualTo(4); + } + + [Test] + public async Task APackagesRuleIsReadOnlyAndItsSetCanBeCopiedToEdit() + { + var harness = new Harness(); + var theirs = harness.Package.Triggers[0]; + var (enabledControls, rowEnabled, copies) = await Run(harness, "triggers", window => + { + var editor = window.ListEditor!; + editor.Choose(theirs); + var controls = editor.FieldControls.Values.Count(c => c.IsEnabled); + var row = editor.Rows.Single(r => ReferenceEquals(r.Item, theirs)).Enabled.IsEnabled; + Click(editor.DeleteButton); + Dispatcher.UIThread.RunJobs(); + var buttons = editor.CopyButtons.Count; + Click(editor.CopyButtons.Single()); + Dispatcher.UIThread.RunJobs(); + return (controls, row, buttons); + }); + + await Assert.That(enabledControls).IsEqualTo(0); + await Assert.That(rowEnabled).IsFalse(); + await Assert.That(copies).IsEqualTo(1); + await Assert.That(harness.Package.Triggers.Single()).IsSameReferenceAs(theirs).Because("nothing deleted it"); + await Assert.That(harness.Config.TriggerSets.Count).IsEqualTo(2); + await Assert.That(harness.Config.TriggerSets[1].Triggers.Single().Name).IsEqualTo("theirs"); + await Assert.That(harness.Commits).IsEqualTo(1); + } + + [Test] + public async Task TheLiveTestListsTheMatchingLinesWithTheMatchMarked() + { + var harness = new Harness(); + var (lines, marked) = await Run(harness, "triggers", window => + { + var editor = window.ListEditor!; + editor.Choose(harness.Own.Triggers[0]); + var blocks = editor.PreviewLines; + var bold = blocks.Skip(1) + .Select(b => b.Inlines?.OfType().FirstOrDefault(r => r.FontWeight == global::Avalonia.Media.FontWeight.Bold)?.Text) + .ToArray(); + return (blocks.Select(b => b.Text ?? string.Concat(b.Inlines!.OfType().Select(r => r.Text))).ToArray(), bold); + }); + + await Assert.That(lines[0]).Contains("matches 2 of the last 3"); + await Assert.That(lines.Skip(1).Count()).IsEqualTo(2); + await Assert.That(marked).All().Satisfy(m => m.StartsWith("You gain", StringComparison.Ordinal), m => m.IsTrue()); + } + + [Test] + public async Task AFormOpenedOnARuleSelectsIt() + { + var harness = new Harness(); + var tell = harness.Own.Triggers[1]; + var (selected, row) = await Run(harness, "triggers", window => + (window.ListEditor!.SelectedItem, (window.ListEditor.List.SelectedItem as ListBoxItem)?.Tag), tell); + + await Assert.That(selected).IsSameReferenceAs(tell); + await Assert.That(row).IsSameReferenceAs(tell); + } + + [Test] + public async Task TheSearchFindsAnItemFieldAndShowsOnlyIt() + { + var harness = new Harness(); + var shown = await Run(harness, "text", window => + { + window.SearchBox.Text = "gag line"; + Dispatcher.UIThread.RunJobs(); + return (window.ShownSection, window.ShownFields.ToArray()); + }); + + await Assert.That(shown.ShownSection).IsEqualTo("triggers"); + await Assert.That(shown.Item2).Contains("gag"); + await Assert.That(shown.Item2).DoesNotContain("pattern"); + } + + private static Task Run(Harness harness, string initial, Func body, object? item = null) => + TerminalViewTests.Session.Dispatch(() => + { + var window = new SettingsWindow(harness.Form(initial, item)); + window.Show(); + Dispatcher.UIThread.RunJobs(); + try + { + return body(window); + } + finally + { + window.Close(); + } + }, CancellationToken.None); +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs index d7278ce3..0751fcf8 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs @@ -131,20 +131,46 @@ await Assert.That(ReferenceEquals(driver.Pointer.Panels.Single(p => p.PanelId == } [Test] - public async Task TheEditLinkDispatchesTheF4ScreenAndNoNativePanelCoversIt() + public async Task TheEditLinkOpensTheDeclaredKeyEditorInTheSettingsWindow() { using var driver = new AvaloniaConsoleDriver(140, 36); - await using var app = InlineWindowApp(driver); + var settings = new RecordingSettings(); + await using var app = new SharpMUTermApp(DemoScene.Build(), InlineHost(driver) with { NativeSettings = settings }); app.RenderSnapshot("layout-combat"); var panel = driver.Pointer.Panels.Single(p => p.PanelId == PanelIds.QuickBar); await Assert.That(app.Contributions.Commands.Resolve(QuickBarModel.EditCommand)).IsNotNull(); panel.Dispatch!(QuickBarModel.EditCommand); app.RenderNextFrame(); + await Assert.That(settings.Shown.Single().Initial).IsEqualTo("keypad"); + await Assert.That(app.OpenSettingsKey).IsNull().Because("F4 is declared, so the window draws it and no cell modal opens"); + } + + [Test] + public async Task WithNoSettingsWindowTheEditLinkOpensF4AndNoNativePanelCoversIt() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = new SharpMUTermApp(DemoScene.Build(), InlineHost(driver) with { NativeSettings = null }); + app.RenderSnapshot("layout-combat"); + + var panel = driver.Pointer.Panels.Single(p => p.PanelId == PanelIds.QuickBar); + panel.Dispatch!(QuickBarModel.EditCommand); + app.RenderNextFrame(); await Assert.That(app.OpenSettingsKey).IsEqualTo(ConsoleKey.F4); await Assert.That(driver.Pointer.Panels).IsEmpty().Because("a native view would sit over the modal's cells"); } + private sealed class RecordingSettings : INativeSettings + { + public List Shown { get; } = []; + + public void Show(SharpMUTerm.Client.Settings.SettingsForm form) => Shown.Add(form); + + public void Close() + { + } + } + // ── The window's half ──────────────────────────────────────────────────────────────────────── [Test] diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs index 64957aa2..f4bf0a9a 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -150,13 +150,13 @@ public async Task AnUndeclaredSectionOpensItsOwnScreen() var harness = new Harness(); var shown = await Run(harness, "text", window => { - var item = window.SectionList.Items.OfType().Single(i => Equals(i.Tag, "triggers")); + var item = window.SectionList.Items.OfType().Single(i => Equals(i.Tag, "packages")); window.SectionList.SelectedItem = item; Dispatcher.UIThread.RunJobs(); return window.ShownSection; }); - await Assert.That(harness.Opened).IsEquivalentTo(new[] { "triggers" }); + await Assert.That(harness.Opened).IsEquivalentTo(new[] { "packages" }); await Assert.That(shown).IsEqualTo("text"); } diff --git a/tests/SharpMUTerm.Client.Tests/ListSettingsTests.cs b/tests/SharpMUTerm.Client.Tests/ListSettingsTests.cs new file mode 100644 index 00000000..4bcebef5 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/ListSettingsTests.cs @@ -0,0 +1,204 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Packages; + +namespace SharpMUTerm.Client.Tests; + +/// +/// The list declaration kind: F2, F3, F4 and F6 are sections over trigger sets whose item fields are ordinary +/// descriptors bound to the item itself. Every change goes through the form's one commit, a package's set refuses +/// every edit and can be copied to edit, and the search finds item fields. +/// +public class ListSettingsTests +{ + private static (AppConfiguration Config, TriggerSet Own, TriggerSet Package) Configuration() + { + var config = new AppConfiguration(); + config.TriggerSets.Clear(); + var own = new TriggerSet + { + Name = "public", + Triggers = + { + new Trigger { Name = "first", Pattern = "a" }, + new Trigger { Name = "second", Pattern = "b" }, + new Trigger { Name = "third", Pattern = "c" }, + }, + }; + config.TriggerSets.Add(own); + var package = new TriggerSet { Name = "combat", Triggers = { new Trigger { Name = "theirs", Pattern = "x" } } }; + config.Packages = + [ + new InstalledPackage(new PackageManifest { Id = "pack", Name = "Pack", Version = "1.0.0" }, [package]), + ]; + return (config, own, package); + } + + private static SettingsForm Form(AppConfiguration config, Action count, object? item = null, string section = "triggers") => + new(BuiltInSettings.All, config, change => { change(); count(); }, _ => { }, section, isDark: true, item: item); + + [Test] + public async Task TheListScreensAreDeclaredWithACollection() + { + foreach (var id in new[] { "triggers", "aliases", "keypad", "timers" }) + { + var section = BuiltInSettings.All.Single(s => s.Id == id); + await Assert.That(section.Collection).IsNotNull(); + await Assert.That(section.Scope).IsEqualTo(SettingScope.Item); + await Assert.That(SettingsForm.IsDeclared(section)).IsTrue(); + await Assert.That(section.Collection!.Fields.All(f => f.Binding?.Scope == SettingScope.Item)).IsTrue(); + } + + var triggers = BuiltInSettings.Triggers.Collection!.Fields.Select(f => f.Id).ToList(); + await Assert.That(triggers).IsEquivalentTo( + new[] { "enabled", "name", "match", "pattern", "set", "route", "fg", "bg", "attributes", "gag", "rewrite", "respond", "script", "stop", "case" }); + } + + [Test] + public async Task AnItemFieldEditsTheItemAndCommitsOnce() + { + var (config, own, _) = Configuration(); + var commits = 0; + var second = own.Triggers[1]; + var form = Form(config, () => commits++, second); + var collection = BuiltInSettings.Triggers.Collection!; + var gag = (BoolField)collection.Field("gag"); + + await Assert.That(form.Set((SettingBinding)gag.Binding!, true)).IsTrue(); + await Assert.That(second.Actions.Gag).IsTrue(); + await Assert.That(own.Triggers[0].Actions.Gag).IsFalse(); + await Assert.That(commits).IsEqualTo(1); + + var pattern = (TextField)collection.Field("pattern"); + await Assert.That(form.SetText(pattern, "you gain *")).IsNull(); + await Assert.That(second.Pattern).IsEqualTo("you gain *"); + await Assert.That(commits).IsEqualTo(2); + } + + [Test] + public async Task APatternThatIsNotARegexIsRefusedForARegexRule() + { + var (config, own, _) = Configuration(); + var commits = 0; + var form = Form(config, () => commits++, own.Triggers[0]); + var pattern = (TextField)BuiltInSettings.Triggers.Collection!.Field("pattern"); + + await Assert.That(form.SetText(pattern, "(")).IsNotNull(); + await Assert.That(own.Triggers[0].Pattern).IsEqualTo("a"); + await Assert.That(commits).IsEqualTo(0); + } + + [Test] + public async Task AddDuplicateDeleteAndMoveEditTheSet() + { + var (config, own, _) = Configuration(); + var commits = 0; + var form = Form(config, () => commits++); + var section = BuiltInSettings.Triggers; + + var added = form.Add(section, own) as Trigger; + await Assert.That(added).IsNotNull(); + await Assert.That(own.Triggers[^1]).IsSameReferenceAs(added!); + await Assert.That(form.Item).IsSameReferenceAs(added); + + var copy = form.Duplicate(section, own.Triggers[0]) as Trigger; + await Assert.That(own.Triggers[1]).IsSameReferenceAs(copy!); + await Assert.That(copy!.Name).IsEqualTo("first copy"); + + var third = own.Triggers.Single(t => t.Name == "third"); + await Assert.That(form.Move(section, third, -1)).IsTrue(); + await Assert.That(own.Triggers.Select(t => t.Name).ToList()) + .IsEquivalentTo(new[] { "first", "first copy", "third", "second", added!.Name }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(form.Move(section, own.Triggers[0], -1)).IsFalse(); + + await Assert.That(form.Delete(section, copy)).IsTrue(); + await Assert.That(own.Triggers.Contains(copy)).IsFalse(); + await Assert.That(commits).IsEqualTo(4); + } + + [Test] + public async Task APackagesSetRefusesEveryEditAndCanBeCopiedToEdit() + { + var (config, _, package) = Configuration(); + var commits = 0; + var theirs = package.Triggers[0]; + var form = Form(config, () => commits++, theirs); + var section = BuiltInSettings.Triggers; + var collection = section.Collection!; + + var groups = form.Groups(section); + await Assert.That(groups.Single(g => ReferenceEquals(g.Set, package)).ReadOnly).IsTrue(); + await Assert.That(form.IsReadOnly(theirs)).IsTrue(); + await Assert.That(form.Set((SettingBinding)collection.Field("gag").Binding!, true)).IsFalse(); + await Assert.That(form.SetText((TextField)collection.Field("pattern"), "y")).IsEqualTo(SettingsForm.ReadOnlyRefusal); + await Assert.That(form.Add(section, package)).IsNull(); + await Assert.That(form.Duplicate(section, theirs)).IsNull(); + await Assert.That(form.Delete(section, theirs)).IsFalse(); + await Assert.That(form.SetEnabled(section, theirs, false)).IsFalse(); + await Assert.That(theirs.Actions.Gag).IsFalse(); + await Assert.That(theirs.Pattern).IsEqualTo("x"); + await Assert.That(commits).IsEqualTo(0); + + await Assert.That(form.CopyToEdit(package)).IsTrue(); + var copied = config.TriggerSets.Single(s => s.Name.StartsWith("combat", StringComparison.Ordinal)); + await Assert.That(copied.Triggers.Single().Name).IsEqualTo("theirs"); + await Assert.That(copied.Triggers.Single()).IsNotSameReferenceAs(theirs); + await Assert.That(commits).IsEqualTo(1); + } + + [Test] + public async Task MovingARuleToAnotherSetMovesIt() + { + var (config, own, _) = Configuration(); + var other = new TriggerSet { Name = "other" }; + config.TriggerSets.Add(other); + var commits = 0; + var rule = own.Triggers[0]; + var form = Form(config, () => commits++, rule); + var set = (ChoiceField)BuiltInSettings.Triggers.Collection!.Field("set"); + + await Assert.That(form.Choices(set)).Contains("other"); + await Assert.That(form.Set((SettingBinding)set.Binding!, "other")).IsTrue(); + await Assert.That(other.Triggers.Single()).IsSameReferenceAs(rule); + await Assert.That(own.Triggers.Contains(rule)).IsFalse(); + } + + [Test] + public async Task AKeyBindingRefusesAChordTheHostCannotDeliverOrAnotherHolds() + { + var config = new AppConfiguration(); + config.TriggerSets.Clear(); + var set = new TriggerSet + { + Name = "keys", + Macros = { new Macro { Name = "north", Key = "F12", Command = "n" }, new Macro { Name = "south", Key = "F11", Command = "s" } }, + }; + config.TriggerSets.Add(set); + var context = new SettingsContext([], [], key => key == "Ctrl+H" ? "arrives as Backspace" : null, ["F10", "F11", "F12"]); + var form = new SettingsForm(BuiltInSettings.All, config, change => change(), _ => { }, "keypad", isDark: true, context: context, item: set.Macros[1]); + var key = (KeyField)BuiltInSettings.Keypad.Collection!.Field("key"); + + await Assert.That(form.SetKey(key, "Ctrl+H")).IsEqualTo("arrives as Backspace"); + await Assert.That(form.SetKey(key, "F12")).Contains("north"); + await Assert.That(form.SetKey(key, "F10")).IsNull(); + await Assert.That(set.Macros[1].Key).IsEqualTo("F10"); + } + + [Test] + public async Task TheLiveTestRunsTheSelectedRuleOverTheContextsLines() + { + var config = new AppConfiguration(); + config.TriggerSets.Clear(); + var rule = new Trigger { Name = "xp", Pattern = "You gain * experience", MatchType = TriggerMatchType.Wildcard }; + config.TriggerSets.Add(new TriggerSet { Name = "s", Triggers = { rule } }); + var context = new SettingsContext([], ["You gain 40 experience points.", "A guard nods.", "You gain 7 experience points."], _ => null, []); + var form = new SettingsForm(BuiltInSettings.All, config, change => change(), _ => { }, "triggers", isDark: true, context: context, item: rule); + + var result = form.Preview(); + await Assert.That(result).IsNotNull(); + await Assert.That(result!.Value.Matched).IsEqualTo(2); + await Assert.That(form.Preview("dragon")!.Value.Matched).IsEqualTo(0); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/SettingsDeclarationTests.cs b/tests/SharpMUTerm.Client.Tests/SettingsDeclarationTests.cs index 68680102..2d364b0c 100644 --- a/tests/SharpMUTerm.Client.Tests/SettingsDeclarationTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SettingsDeclarationTests.cs @@ -79,9 +79,13 @@ public async Task TheSearchFindsLabelsKeywordsAndTitles() await Assert.That(byKeyword.Single().Field!.Id).IsEqualTo("transparency"); await Assert.That(byKeyword.Single().Start).IsEqualTo(-1); - var byTitle = SettingsSearch.Find(BuiltInSettings.All, "alias"); + // A section with no fields (F10) is found by its title. + var byTitle = SettingsSearch.Find(BuiltInSettings.All, "packages").Where(m => m.Section.Id == "packages").ToList(); await Assert.That(byTitle.Single().Field).IsNull(); - await Assert.That(byTitle.Single().Section.Id).IsEqualTo("aliases"); + + // A list section's item fields are searched like any other field. + var byItemField = SettingsSearch.Find(BuiltInSettings.All, "gag"); + await Assert.That(byItemField.Any(m => m.Section.Id == "triggers" && m.Field?.Id == "gag")).IsTrue(); await Assert.That(SettingsSearch.Find(BuiltInSettings.All, " ")).IsEmpty(); } diff --git a/tests/SharpMUTerm.Tui.Tests/DeclaredListScreensTests.cs b/tests/SharpMUTerm.Tui.Tests/DeclaredListScreensTests.cs new file mode 100644 index 00000000..ee5aec89 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/DeclaredListScreensTests.cs @@ -0,0 +1,158 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// F2, F3, F4 and F6 drawn from their declarations: the cell screens' fields are the declared collection's, an edit +/// on one lands on the rule and is saved once, ⌥↑/⌥↓ reorder a rule within its set, and a host with a settings window +/// shows them there — the trigger builder included, on the rule it made. +/// +[NotInParallel] +public class DeclaredListScreensTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class Presenter : INativeSettings + { + public List Shown { get; } = []; + + public void Show(SettingsForm form) => Shown.Add(form); + + public void Close() + { + } + } + + private static (SharpMUTermApp App, Presenter Native, List Saves) App(bool native) + { + Console.SetIn(TextReader.Null); + var presenter = new Presenter(); + var saves = new List(); + var host = ClientHost.Headless(new HeadlessConsoleDriver(120, 32), Caps) with + { + NativeSettings = native ? presenter : null, + }; + return (new SharpMUTermApp(DemoScene.Build(), host, save: saves.Add), presenter, saves); + } + + private static ConsoleKeyInfo Key(ConsoleKey key, bool alt = false) => new('\0', key, false, alt, false); + + [Test] + public async Task EachCellScreenDrawsExactlyTheDeclaredFields() + { + static IEnumerable Ids(SettingsSectionContribution section) => + section.Collection!.Fields.Select(f => f.Id).OrderBy(id => id, StringComparer.Ordinal); + + static IEnumerable Cells(IEnumerable row, IEnumerable editor) => + row.Concat(editor).Append("enabled").Distinct().OrderBy(id => id, StringComparer.Ordinal); + + await Assert.That(Cells(TriggersScreenRenderer.RowFieldOrder, TriggersScreenRenderer.EditorFieldOrder)) + .IsEquivalentTo(Ids(BuiltInSettings.Triggers)); + await Assert.That(Cells(AliasesScreenRenderer.RowFieldOrder, AliasesScreenRenderer.EditorFieldOrder)) + .IsEquivalentTo(Ids(BuiltInSettings.Aliases)); + await Assert.That(Cells(TimersScreenRenderer.RowFieldOrder, TimersScreenRenderer.EditorFieldOrder)) + .IsEquivalentTo(Ids(BuiltInSettings.Timers)); + await Assert.That(Cells(KeypadScreenRenderer.RowFieldOrder, [])) + .IsEquivalentTo(Ids(BuiltInSettings.Keypad)); + + // The ordinals the screen, the snapshot keys and the tests address are where the declarations put them. + await Assert.That(TriggersScreenRenderer.RowFieldOrder[TriggersScreenRenderer.MatchTypeField]).IsEqualTo("match"); + await Assert.That(TriggersScreenRenderer.RowFieldOrder[TriggersScreenRenderer.PatternField]).IsEqualTo("pattern"); + } + + [Test] + public async Task ACellEditLandsOnTheRuleAndIsSavedOnce() + { + var (app, _, saves) = App(native: false); + app.SimulateKey(Key(ConsoleKey.F2)); + var first = app.Configuration.TriggerSets.SelectMany(s => s.Triggers).First(); + var was = first.Enabled; + + app.Settings.SimulateKey(new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false)); + + await Assert.That(first.Enabled).IsEqualTo(!was); + await Assert.That(saves.Count).IsEqualTo(1); + } + + [Test] + public async Task AltArrowsMoveARuleWithinItsSetAndTheCursorGoesWithIt() + { + var (app, _, saves) = App(native: false); + app.SimulateKey(Key(ConsoleKey.F2)); + var set = app.Configuration.TriggerSets.First(s => s.Triggers.Count >= 2); + var top = set.Triggers[0]; + var next = set.Triggers[1]; + + app.Settings.SimulateKey(Key(ConsoleKey.DownArrow, alt: true)); + + await Assert.That(set.Triggers[0]).IsSameReferenceAs(next); + await Assert.That(set.Triggers[1]).IsSameReferenceAs(top); + await Assert.That(saves.Count).IsEqualTo(1); + await Assert.That(app.SettingsFocus!.Value.Index).IsEqualTo(1); + + // At the top of its set the key does nothing and saves nothing. + app.Settings.SimulateKey(Key(ConsoleKey.UpArrow, alt: true)); + app.Settings.SimulateKey(Key(ConsoleKey.UpArrow, alt: true)); + await Assert.That(set.Triggers[0]).IsSameReferenceAs(top); + await Assert.That(saves.Count).IsEqualTo(2); + } + + [Test] + public async Task TheListKeysOpenTheHostsWindowOnTheirSection() + { + var (app, native, _) = App(native: true); + + foreach (var (key, id) in new[] { (ConsoleKey.F2, "triggers"), (ConsoleKey.F3, "aliases"), (ConsoleKey.F4, "keypad"), (ConsoleKey.F6, "timers") }) + { + app.SimulateKey(Key(key)); + await Assert.That(native.Shown[^1].Initial).IsEqualTo(id); + await Assert.That(app.SettingsOpenKey).IsNull(); + } + } + + [Test] + public async Task AnEditInTheWindowLandsOnTheSameRuleAndIsSavedOnce() + { + var (app, native, saves) = App(native: true); + app.SimulateKey(Key(ConsoleKey.F2)); + var form = native.Shown.Single(); + var rule = app.Configuration.TriggerSets.SelectMany(s => s.Triggers).First(); + form.Select(rule); + + await Assert.That(form.SetText((TextField)BuiltInSettings.Triggers.Collection!.Field("pattern"), "you gain")).IsNull(); + + await Assert.That(rule.Pattern).IsEqualTo("you gain"); + await Assert.That(saves.Count).IsEqualTo(1); + } + + [Test] + public async Task TheTriggerBuilderOpensTheWindowOnTheRuleItMade() + { + var (app, native, _) = App(native: true); + + app.RenderSnapshot("trigger-builder"); + + var made = app.Configuration.TriggerSets.SelectMany(s => s.Triggers).Last(t => t.Name.StartsWith("You gain", StringComparison.Ordinal)); + var form = native.Shown.Single(); + await Assert.That(form.Initial).IsEqualTo("triggers"); + await Assert.That(form.Item).IsSameReferenceAs(made); + await Assert.That(app.SettingsOpenKey).IsNull(); + await Assert.That(form.Preview()!.Value.Matched).IsEqualTo(2); + } + + [Test] + public async Task TheTriggerBuilderOpensTheCellEditorWhereThereIsNoWindow() + { + var (app, _, _) = App(native: false); + + app.RenderSnapshot("trigger-builder"); + + await Assert.That(app.SettingsOpenKey).IsEqualTo(ConsoleKey.F2); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/NativeSettingsRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeSettingsRoutingTests.cs index 2684d6b5..ca824cee 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeSettingsRoutingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeSettingsRoutingTests.cs @@ -59,14 +59,14 @@ public async Task F7AndF8OpenTheHostsWindowAndNoCellScreen() } [Test] - public async Task AnUndeclaredScreenStaysACellScreen() + public async Task AListScreenOpensTheHostsWindowToo() { var (app, native, _) = App(); app.SimulateKey(F(ConsoleKey.F2)); - await Assert.That(native.Shown).IsEmpty(); - await Assert.That(app.SettingsOpenKey).IsEqualTo(ConsoleKey.F2); + await Assert.That(native.Shown.Single().Initial).IsEqualTo("triggers"); + await Assert.That(app.SettingsOpenKey).IsNull(); } [Test] From e9ceb07b30d2c6f542883f005e0c3fa838a82f9a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 09:10:17 +0000 Subject: [PATCH 032/113] feat(packages): declare F10 in Client, native package manager in the window F10 is a declared list section (BuiltInSettings.Packages, PackageCollection): an enabled switch whose binding replaces DisabledPackages, read-only fields for name, version, games, author, description, sets, scripts, media, update and characters, and the Space/c/Del/b actions. The cell modal and the window's PackagePageView draw the same fields in the same order. The window gets a package manager page: an Installed tab (switches, details, copy sets, remove) and a Browse tab that fetches the index only when asked and lists the focused world's packages first. Install opens a native review drawn from the same PackageReviewModel as the cell review, leading with what can act as the player; both end in AcceptPackage, which refuses a stale review, so nothing is written until the player installs. Every gesture goes to the client through IPackageHost. A settings --view opens the native window in the window host; the parity harness still compares cells. The demo scene serves a fake index from memory. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 6 + CLAUDE.md | 30 +- src/SharpMUTerm.Avalonia/PackagePageView.cs | 715 ++++++++++++++++++ src/SharpMUTerm.Avalonia/SettingsWindow.cs | 55 ++ .../Contributions/Descriptors.cs | 18 + .../Packages/PackageManager.cs | 200 +++++ .../Packages/PackageModels.cs | 181 +++++ .../Settings/BuiltInSettings.cs | 5 +- .../Settings/PackageCollection.cs | 247 ++++++ .../Settings/SettingsForm.cs | 8 +- .../Settings/SettingsSearch.cs | 4 +- .../Surfaces/SurfaceCatalog.cs | 2 +- src/SharpMUTerm.Core/Packages/PackageStore.cs | 41 +- src/SharpMUTerm.Tui/PackageScreen.cs | 154 ++-- .../SharpMUTermApp.Packages.cs | 387 +++++++--- .../SharpMUTermApp.Settings.cs | 19 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 9 + .../PackagePageTests.cs | 224 ++++++ .../SettingsWindowTests.cs | 14 +- .../PackageSettingsTests.cs | 242 ++++++ .../NativePackagesTests.cs | 407 ++++++++++ .../SharpMUTerm.Tui.Tests/PackagesAppTests.cs | 2 +- 22 files changed, 2767 insertions(+), 203 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/PackagePageView.cs create mode 100644 src/SharpMUTerm.Client/Packages/PackageManager.cs create mode 100644 src/SharpMUTerm.Client/Packages/PackageModels.cs create mode 100644 src/SharpMUTerm.Client/Settings/PackageCollection.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/PackagePageTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/PackageSettingsTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NativePackagesTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 063f7b42..02bb12d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Packages (F10) open in the desktop window's settings as a package manager: switch each installed package on or + off, see what it adds, who it applies to and whether the index offers an update, copy its sets to edit or remove + it. The Browse tab fetches the package index only when you ask, lists your world's packages first, and Install + shows a review that leads with what can act as you; nothing is written until you install. In the terminal, F10 + now also shows each package's author, description, scripts, media and update, and the install review opens with + what can send commands as you. - Triggers, aliases, key bindings and timers (F2, F3, F4, F6) open in the desktop window's settings as a list beside the selected item's fields: tick a box to switch one on or off, add, copy, delete or move it up and down, and watch the trigger's live test mark the matching lines as you type its pattern. A package's sets are shown diff --git a/CLAUDE.md b/CLAUDE.md index 763a96aa..5917cb2a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -191,7 +191,9 @@ fallbacks) for inline images/maps. character's own, so an update replaces them wholesale and never touches the player's edits; `c` on F10 copies them into the player's sets to edit. The only thing saved is `DisabledPackages`. - **The review is the consent step**: nothing is written until ⏎, and it leads with what can act as the - player (rules that send, scripts that run). Downloads are https only, capped while streaming. + player (rules that send, scripts that run). Downloads are https only, capped while streaming. The review is one + `PackageReviewModel` (Client) drawn by both hosts, and F10 itself is declared in Client + (`BuiltInSettings.Packages`); see *F10 is a package manager page* under the native settings window. - **Scripts are `package:/`** and `SessionScripts` resolves them only under that package's `scripts/`, through `PackageStore.ResolveScript`. They still need the scripts root, like any script. - One folder per package (`packages//`, beside `config.json`), swapped in through a `.id.new` staging @@ -1715,8 +1717,7 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] - **⌥↑/⌥↓ move an item within its set on the cell screens** (`ScreenRow.Move`, `ScreenLists.Mover`, `SettingsSession.Reorder`), saved only when it moved, the cursor following; a `⌥↑↓ moves …` hint row sits under `Del removes …`. That is the one cell row this added. Order is meaning for a trigger (first stop wins). - - The search searches item fields too (`SettingsSearch.Searchable`). F10 is the one section left listed by - title only. + - The search searches item fields too (`SettingsSearch.Searchable`), F10's package fields included. - **In the window, a declared section opens a native settings window, generated from the declarations** (`ClientHost.NativeSettings` → `INativeSettings`; Client `SettingsForm`; Avalonia `SettingsWindow`, `SettingsPresenter` on the driver; `OpenSettingsScreen`/`TryOpenNativeSettings` in `SharpMUTermApp.Settings.cs`). @@ -1758,6 +1759,29 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] has the live test under it, re-run on every keystroke, each matching line with the match marked. The trigger builder opens it on the rule it made (`TryOpenNativeSettings(section, item)`); with no window it opens the cell F2 as before. + - **F10 is a package manager page** (`PackagePageView`, Avalonia; Client `PackageCollection`, `PackageManager`, + `PackageReviewModel`, `PackageBrowseModel`; `SharpMUTermApp.Packages.cs`). F10 is declared as a list of + installed packages (`SettingsSectionContribution.Packages`): one `BoolField` (`enabled`, whose binding replaces + `DisabledPackages`, the one thing it writes) and read-only `InfoField`s (name, version, games, by, about, sets, + scripts, media, update, characters), plus four actions (Space, `c`, Del, `b`). The cell modal + (`PackageScreen.List`) and the page draw the same fields in the same order + (`PackagePageTests.ThePageDrawsTheDeclaredFieldsTheCellScreenDraws`). Decisions: + - **Every gesture goes to the client** through `IPackageHost` (`PackageHostCalls`, marshalled with `OnUiThread`): + on/off (`SetPackageEnabled`, one `SaveConfiguration`), remove, copy sets, fetch the index, install, accept, + cancel. The page writes nothing; `PackageManager` is what the client publishes for it to read + (`PublishIndex`/`PublishReview`/`PublishStatus`, `Changed`). + - **One consent path in both hosts**: `ReviewPackage` checks the SHA-256, id and version, then builds one + `PackageReviewModel`; the cell overlay draws it with `PackageScreen.Review`, the window as a card over the page. + Both end in `AcceptPackage(model)`, which refuses a model that is not the pending one, so a stale review + cannot install. It leads with `WHAT CAN ACT AS YOU`. + - **The index is fetched only from the Browse tab's button** (or `b`/⌃P ▸ *Browse packages*, which bring the tab + forward through `BrowseRequests`), never when the page opens. The browse list is `PackageBrowseModel`, the + focused world's packages first, as on the cells. + - The `--demo-config` scene installs two fake packages and serves a fake index from memory (`DemoFetch`, real + SHA-256s); screenshots `ux-wave8/packages-window-*.png` and `packages-terminal-*.png`. + - **A settings `--view` opens the native window when the host has one** (`RenderSnapshot`: a declared screen with + no `-edit` goes through `TryOpenNativeSettings`, as do `packages`/`package-browse`/`package-review`). The parity + harness passes `NativeSettings = null`, so its cells are still compared. - Not done: the window is not modal. Screenshots come from a real window under Xvfb, driven with XTest (`ux-wave4/native-settings-*.png`, `ux-wave6/settings-themes-window-*.png`, `ux-wave7/lists-*.png`). - **In the window, ⌃P is a native palette over the window, listing the cell palette's rows** (`ClientHost.NativePalette` diff --git a/src/SharpMUTerm.Avalonia/PackagePageView.cs b/src/SharpMUTerm.Avalonia/PackagePageView.cs new file mode 100644 index 00000000..f504b23f --- /dev/null +++ b/src/SharpMUTerm.Avalonia/PackagePageView.cs @@ -0,0 +1,715 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Layout; +using Avalonia.Media; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Packages; +using SharpMUTerm.Client.Settings; + +namespace SharpMUTerm.Avalonia; + +/// +/// F10 in the settings window: a package manager drawn from F10's declaration () and the +/// client's . Installed lists the packages with an on/off switch each and the selected +/// one's declared fields beside it, with Copy sets to edit and Remove; Browse lists the package index, +/// the focused window's world's packages first — fetched only when the player opens it; and an install opens the +/// review over the page, drawn from , the model the cell review draws. +/// +/// Nothing here installs, removes or switches anything: every gesture goes to the manager, which hands it to the client +/// on the client's thread, and catches up once the client has published what happened. +/// +/// +internal sealed class PackagePageView : Grid +{ + private readonly PackageManager _manager; + private readonly PackageCollection _declaration; + private readonly Func _visible; + private readonly IBrush _accent; + private readonly bool _dark; + private readonly TabControl _tabs; + private readonly ListBox _installed = new() { Background = Brushes.Transparent }; + private readonly StackPanel _detail = new() { Spacing = 2, Margin = new Thickness(4, 0, 4, 16) }; + private readonly ListBox _browse = new() { Background = Brushes.Transparent }; + private readonly StackPanel _browseDetail = new() { Spacing = 6, Margin = new Thickness(4, 0, 4, 16) }; + private readonly ContentControl _browseBody = new(); + private readonly Border _reviewLayer; + private readonly TextBlock _status = new() { Opacity = 0.8, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 0) }; + private readonly Dictionary _values = new(StringComparer.Ordinal); + private readonly List<(PackageItem Item, ToggleSwitch Switch)> _rows = []; + private string? _selected; + private int _browseSelected; + private bool _confirmRemove; + private bool _syncing; + private PackageBrowseModel? _shownBrowse; + private bool _shownFetching; + private PackageReviewModel? _shownReview; + + public PackagePageView(PackageManager manager, Func visible, IBrush accent, bool dark) + { + _manager = manager; + _declaration = manager.Declaration; + _visible = visible; + _accent = accent; + _dark = dark; + RowDefinitions = new RowDefinitions("*,Auto"); + Margin = new Thickness(0, 6, 0, 0); + + _installed.SelectionChanged += (_, _) => + { + if (!_syncing && _installed.SelectedItem is ListBoxItem { Tag: string id }) + { + _selected = id; + _confirmRemove = false; + BuildDetail(); + } + }; + AutomationProperties.SetName(_installed, "Installed packages"); + _browse.SelectionChanged += (_, _) => + { + if (!_syncing && _browse.SelectedIndex >= 0) + { + _browseSelected = _browse.SelectedIndex; + BuildBrowseDetail(); + } + }; + AutomationProperties.SetName(_browse, "The package index"); + + InstalledTab = new TabItem { Header = "Installed", Content = MasterDetail(_installed, _detail), FontSize = 17 }; + BrowseTab = new TabItem { Header = "Browse", Content = _browseBody, FontSize = 17 }; + foreach (var tab in new[] { InstalledTab, BrowseTab }) + { + // The header's size only: the page under it keeps the window's own. + if (tab.Content is Control content) + { + content.SetValue(global::Avalonia.Controls.Documents.TextElement.FontSizeProperty, 14d); + } + } + _tabs = new TabControl { ItemsSource = new[] { InstalledTab, BrowseTab } }; + _tabs.SelectionChanged += (_, _) => + { + if (!_syncing && ReferenceEquals(_tabs.SelectedItem, BrowseTab)) + { + BuildBrowse(); + } + }; + Children.Add(_tabs); + + SetRow(_status, 1); + Children.Add(_status); + + _reviewLayer = new Border + { + Background = new SolidColorBrush(Color.FromArgb(0x99, 0, 0, 0)), + IsVisible = false, + }; + SetRowSpan(_reviewLayer, 2); + Children.Add(_reviewLayer); + + Refresh(); + } + + /// The Installed tab. + public TabItem InstalledTab { get; } + + /// The Browse tab. + public TabItem BrowseTab { get; } + + /// Whether the Browse tab is in front. + public bool Browsing => ReferenceEquals(_tabs.SelectedItem, BrowseTab); + + /// The ids of the fields drawn — the switch, the row's fields, then the detail's — for a test. + public IReadOnlyList ShownFields { get; private set; } = []; + + /// The installed packages listed, each with its switch, for a test. + public IReadOnlyList<(PackageItem Item, ToggleSwitch Switch)> Rows => _rows; + + /// What each detail field says now, by id, for a test. + public IReadOnlyDictionary Values => _values.ToDictionary(v => v.Key, v => v.Value.Text ?? string.Empty, StringComparer.Ordinal); + + /// The remove button of the selected package, for a test. + public Button? RemoveButton { get; private set; } + + /// The copy-its-sets button of the selected package, for a test. + public Button? CopyButton { get; private set; } + + /// The button that fetches the index, while it has not been fetched, for a test. + public Button? FetchButton { get; private set; } + + /// The selected index entry's install button, for a test. + public Button? InstallButton { get; private set; } + + /// The review on show, for a test; null when none is. + public PackageReviewModel? ShownReview => _shownReview; + + /// The review's lines as drawn, in order (headings, then each row's label and value), for a test. + public IReadOnlyList ReviewLines { get; private set; } = []; + + /// The review's install button, for a test. + public Button? AcceptButton { get; private set; } + + /// The review's cancel button, for a test. + public Button? CancelButton { get; private set; } + + /// Catches up with what the client published: the installed list, the index, the review, the status. + public void Refresh() + { + BuildInstalled(); + if (_manager.BrowseRequests != _manager.BrowseRequestsSeen) + { + // The player asked for the index (here, or ⌃P ▸ Browse packages): the list it arrives in comes forward. + _manager.BrowseRequestsSeen = _manager.BrowseRequests; + _syncing = true; + _tabs.SelectedItem = BrowseTab; + _syncing = false; + BuildBrowse(); + } + else if (!ReferenceEquals(_manager.BrowseModel, _shownBrowse) || _manager.Fetching != _shownFetching) + { + BuildBrowse(); + } + + if (!ReferenceEquals(_manager.Review, _shownReview)) + { + BuildReview(); + } + + _status.Text = _manager.Status ?? string.Empty; + _status.IsVisible = _manager.Status is not null; + } + + // ── installed ──────────────────────────────────────────────────────────────────────────────── + + private Grid MasterDetail(Control list, Control detail) + { + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("260,*"), Margin = new Thickness(0, 10, 0, 0) }; + grid.Children.Add(new Border + { + Child = list, + BorderThickness = new Thickness(1), + BorderBrush = Hairline, + CornerRadius = new CornerRadius(6), + Margin = new Thickness(0, 0, 14, 0), + }); + var scroller = new ScrollViewer { Content = detail, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }; + SetColumn(scroller, 1); + grid.Children.Add(scroller); + return grid; + } + + private IBrush Hairline => new SolidColorBrush(_dark ? Color.Parse("#46464e") : Color.Parse("#c8c8d0")); + + private IBrush Warning => new SolidColorBrush(_dark ? Color.Parse("#ffb454") : Color.Parse("#a4410e")); + + private void BuildInstalled() + { + var items = _manager.Items; + _syncing = true; + try + { + _rows.Clear(); + var rows = new List(); + foreach (var item in items) + { + var toggle = new ToggleSwitch + { + IsChecked = _manager.IsEnabled(item), + OnContent = null, + OffContent = null, + MinWidth = 0, + VerticalAlignment = VerticalAlignment.Center, + }; + AutomationProperties.SetName(toggle, $"{item.Package.Manifest.Name} on"); + ToolTip.SetTip(toggle, _declaration.Action(PackageCollection.Toggle).Help); + var captured = item; + toggle.IsCheckedChanged += (_, _) => + { + if (!_syncing && toggle.IsChecked is bool on) + { + _manager.SetEnabled(captured, on); + } + }; + _rows.Add((item, toggle)); + + var words = new StackPanel { Spacing = 1, VerticalAlignment = VerticalAlignment.Center }; + words.Children.Add(new TextBlock { Text = Text("name", item), FontSize = 14, TextTrimming = TextTrimming.CharacterEllipsis }); + var tail = string.Join(" · ", _declaration.RowFields.Skip(1).Select(id => Text(id, item))); + words.Children.Add(new TextBlock { Text = tail, FontSize = 12, Opacity = 0.7, TextTrimming = TextTrimming.CharacterEllipsis }); + if (item.Update is { } newer) + { + words.Children.Add(new TextBlock { Text = $"update {newer} available", FontSize = 12, Foreground = _accent }); + } + + var row = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") }; + row.Children.Add(toggle); + SetColumn(words, 1); + words.Margin = new Thickness(6, 0, 0, 0); + row.Children.Add(words); + rows.Add(new ListBoxItem { Content = row, Tag = item.Id, Padding = new Thickness(8, 6) }); + } + + _installed.ItemsSource = rows; + if (items.Count > 0 && (_selected is null || items.All(i => i.Id != _selected))) + { + _selected = items[0].Id; + } + + _installed.SelectedItem = rows.FirstOrDefault(r => Equals(r.Tag, _selected)); + } + finally + { + _syncing = false; + } + + BuildDetail(); + } + + private string Text(string id, PackageItem item) => + _declaration.Field(id) is InfoField info ? _manager.Text(info, item) : string.Empty; + + private void BuildDetail() + { + _detail.Children.Clear(); + _values.Clear(); + RemoveButton = null; + CopyButton = null; + var item = _manager.Items.FirstOrDefault(i => i.Id == _selected); + if (item is null) + { + ShownFields = []; + _detail.Children.Add(new TextBlock + { + Text = "No package is installed. Browse the index, or use ⌃P ▸ Install package… with a file or an https link.", + TextWrapping = TextWrapping.Wrap, + Opacity = 0.75, + Margin = new Thickness(0, 8, 0, 8), + }); + _detail.Children.Add(BrowseDoor()); + return; + } + + var shown = new List { _declaration.EnabledField }; + shown.AddRange(_declaration.RowFields); + _detail.Children.Add(new TextBlock { Text = Text("name", item), FontSize = 20, FontWeight = FontWeight.SemiBold }); + var subtitle = string.Join(" · ", _declaration.RowFields.Skip(1).Select(id => Text(id, item))); + _detail.Children.Add(new TextBlock { Text = subtitle, Opacity = 0.7, Margin = new Thickness(0, 0, 0, 6) }); + + string? group = null; + foreach (var field in _declaration.DetailFields.Where(_visible)) + { + if (field.Group is { } heading && heading != group) + { + group = heading; + _detail.Children.Add(new TextBlock + { + Text = heading, + FontSize = 15, + FontWeight = FontWeight.SemiBold, + Margin = new Thickness(0, 14, 0, 4), + Foreground = _accent, + }); + } + + var row = new Grid { ColumnDefinitions = new ColumnDefinitions("120,*"), Margin = new Thickness(0, 3) }; + var label = new TextBlock { Text = Capitalise(field.Label), Opacity = 0.75 }; + if (field.Help is { } help) + { + ToolTip.SetTip(label, Capitalise(help)); + } + + var value = new TextBlock { Text = Text(field.Id, item), TextWrapping = TextWrapping.Wrap }; + if (field.Id == "update" && item.Update is not null) + { + value.Foreground = _accent; + } + + AutomationProperties.SetName(value, field.Label); + _values[field.Id] = value; + row.Children.Add(label); + SetColumn(value, 1); + row.Children.Add(value); + _detail.Children.Add(row); + shown.Add(field.Id); + } + + ShownFields = shown; + + var actions = new WrapPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 18, 0, 0) }; + var copy = ActionButton(PackageCollection.CopySets, "Copy sets to edit"); + copy.IsEnabled = item.Package.Sets.Count > 0; + copy.Click += (_, _) => _manager.CopySets(item); + CopyButton = copy; + actions.Children.Add(copy); + + var remove = ActionButton(PackageCollection.Remove, _confirmRemove ? $"Remove {item.Package.Manifest.Name} and its files" : "Remove…"); + if (_confirmRemove) + { + remove.Foreground = Warning; + } + + remove.Click += (_, _) => + { + if (!_confirmRemove) + { + // The cell screen's Del, Del: the first press asks. + _confirmRemove = true; + BuildDetail(); + return; + } + + _confirmRemove = false; + _manager.Remove(item); + }; + RemoveButton = remove; + actions.Children.Add(remove); + actions.Children.Add(BrowseDoor()); + _detail.Children.Add(actions); + if (_confirmRemove) + { + _detail.Children.Add(new TextBlock + { + Text = "Click again to remove it; its sets stop applying and its folder is deleted.", + Foreground = Warning, + Margin = new Thickness(0, 6, 0, 0), + TextWrapping = TextWrapping.Wrap, + }); + } + } + + private Button BrowseDoor() + { + var browse = ActionButton(PackageCollection.Browse, "Browse the index"); + browse.Click += (_, _) => + { + _tabs.SelectedItem = BrowseTab; + }; + return browse; + } + + private Button ActionButton(string action, string text) + { + var button = new Button { Content = text, Margin = new Thickness(0, 0, 8, 6), Padding = new Thickness(12, 5) }; + var declared = _declaration.Action(action); + ToolTip.SetTip(button, $"{Capitalise(declared.Help)} ({declared.Key} on the cell screen)"); + AutomationProperties.SetName(button, text); + return button; + } + + // ── browse ─────────────────────────────────────────────────────────────────────────────────── + + private void BuildBrowse() + { + _shownBrowse = _manager.BrowseModel; + _shownFetching = _manager.Fetching; + FetchButton = null; + InstallButton = null; + if (_manager.BrowseModel is not { } model) + { + var empty = new StackPanel { Spacing = 10, Margin = new Thickness(4, 24, 4, 0), MaxWidth = 520, HorizontalAlignment = HorizontalAlignment.Left }; + empty.Children.Add(new TextBlock { Text = "The package index", FontSize = 18, FontWeight = FontWeight.SemiBold }); + empty.Children.Add(new TextBlock + { + Text = "Rule sets, scripts and sounds other players have shared, this game's first. The index is fetched only when you ask, over https; every package is checked against it before you see its review.", + TextWrapping = TextWrapping.Wrap, + Opacity = 0.8, + }); + if (_manager.Fetching) + { + empty.Children.Add(new StackPanel + { + Orientation = Orientation.Horizontal, + Spacing = 10, + Children = { new ProgressBar { IsIndeterminate = true, Width = 120 }, new TextBlock { Text = "Fetching the index…", VerticalAlignment = VerticalAlignment.Center } }, + }); + } + else + { + var fetch = new Button { Content = "Fetch the index", Padding = new Thickness(14, 6), Classes = { "accent" } }; + AutomationProperties.SetName(fetch, "Fetch the package index"); + fetch.Click += (_, _) => _manager.Browse(); + FetchButton = fetch; + empty.Children.Add(fetch); + } + + _browseBody.Content = empty; + return; + } + + var head = new StackPanel { Spacing = 2, Margin = new Thickness(0, 10, 0, 0) }; + head.Children.Add(new TextBlock + { + Text = PackageCollection.Of(model.Rows.Count, "package") + (model.World is { } world ? $" · {world}'s first" : string.Empty), + Opacity = 0.75, + }); + if (model.Dropped > 0) + { + head.Children.Add(new TextBlock + { + Text = model.Dropped == 1 ? "1 entry in the index breaks its rules and is not listed" : $"{model.Dropped.ToString(CultureInfo.InvariantCulture)} entries in the index break its rules and are not listed", + Foreground = Warning, + }); + } + + _syncing = true; + var rows = new List(); + foreach (var row in model.Rows) + { + var words = new StackPanel { Spacing = 1 }; + var title = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8 }; + title.Children.Add(new TextBlock { Text = row.Entry.Name, FontSize = 14 }); + if (row.ForWorld) + { + title.Children.Add(Chip(model.World ?? "this game", _accent)); + } + + if (row.State != PackageBrowseState.New) + { + title.Children.Add(Chip(row.State == PackageBrowseState.Update ? "update" : "installed", row.State == PackageBrowseState.Update ? _accent : Hairline)); + } + + words.Children.Add(title); + words.Children.Add(new TextBlock + { + Text = $"{row.Entry.Version} · {string.Join(", ", row.Entry.Games)}" + (row.StateText.Length == 0 ? string.Empty : $" · {row.StateText}"), + FontSize = 12, + Opacity = 0.7, + TextTrimming = TextTrimming.CharacterEllipsis, + }); + rows.Add(new ListBoxItem { Content = words, Padding = new Thickness(8, 6) }); + } + + _browse.ItemsSource = rows; + _browseSelected = Math.Clamp(_browseSelected, 0, Math.Max(0, rows.Count - 1)); + _browse.SelectedIndex = rows.Count == 0 ? -1 : _browseSelected; + _syncing = false; + + var dock = new DockPanel { LastChildFill = true }; + DockPanel.SetDock(head, Dock.Top); + dock.Children.Add(head); + dock.Children.Add(MasterDetail(_browse, _browseDetail)); + _browseBody.Content = dock; + BuildBrowseDetail(); + } + + private Border Chip(string text, IBrush brush) => new() + { + Child = new TextBlock { Text = text, FontSize = 11, Foreground = brush }, + BorderBrush = brush, + BorderThickness = new Thickness(1), + CornerRadius = new CornerRadius(8), + Padding = new Thickness(6, 0), + VerticalAlignment = VerticalAlignment.Center, + }; + + private void BuildBrowseDetail() + { + _browseDetail.Children.Clear(); + InstallButton = null; + if (_manager.BrowseModel is not { Rows.Count: > 0 } model) + { + _browseDetail.Children.Add(new TextBlock { Text = "The index lists nothing.", Opacity = 0.75 }); + return; + } + + var row = model.Rows[Math.Clamp(_browseSelected, 0, model.Rows.Count - 1)]; + var entry = row.Entry; + _browseDetail.Children.Add(new TextBlock { Text = entry.Name, FontSize = 20, FontWeight = FontWeight.SemiBold }); + _browseDetail.Children.Add(new TextBlock + { + Text = entry.Version + (entry.Author is { } author ? $" · by {author}" : string.Empty), + Opacity = 0.7, + }); + if (!string.IsNullOrWhiteSpace(entry.Description)) + { + _browseDetail.Children.Add(new TextBlock { Text = entry.Description, TextWrapping = TextWrapping.Wrap }); + } + + _browseDetail.Children.Add(Pair("Games", string.Join(", ", entry.Games))); + _browseDetail.Children.Add(Pair("From", entry.Url)); + if (row.InstalledVersion is { } installed) + { + _browseDetail.Children.Add(Pair("Installed", installed)); + } + + var install = new Button + { + Content = row.State switch + { + PackageBrowseState.Update => $"Review update to {entry.Version}…", + PackageBrowseState.Installed => "Review and reinstall…", + _ => "Review and install…", + }, + Padding = new Thickness(14, 6), + Margin = new Thickness(0, 12, 0, 0), + Classes = { "accent" }, + }; + ToolTip.SetTip(install, "Downloads it, checks it against the index's SHA-256, and shows what it adds — nothing is installed until you agree"); + install.Click += (_, _) => _manager.Install(row); + InstallButton = install; + _browseDetail.Children.Add(install); + } + + private static Grid Pair(string label, string value) + { + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("120,*") }; + grid.Children.Add(new TextBlock { Text = label, Opacity = 0.75 }); + var text = new TextBlock { Text = value, TextWrapping = TextWrapping.Wrap }; + SetColumn(text, 1); + grid.Children.Add(text); + return grid; + } + + // ── review ─────────────────────────────────────────────────────────────────────────────────── + + private void BuildReview() + { + _shownReview = _manager.Review; + AcceptButton = null; + CancelButton = null; + if (_manager.Review is not { } review) + { + _reviewLayer.IsVisible = false; + _reviewLayer.Child = null; + ReviewLines = []; + return; + } + + var lines = new List(); + var header = new StackPanel { Spacing = 2, Margin = new Thickness(0, 0, 0, 4) }; + header.Children.Add(new TextBlock { Text = review.Title, FontSize = 13, Opacity = 0.7 }); + header.Children.Add(new TextBlock + { + Text = $"{review.Name} {review.Version}", + FontSize = 20, + FontWeight = FontWeight.SemiBold, + TextWrapping = TextWrapping.Wrap, + }); + var byline = string.Join(" · ", new[] + { + review.Author is { } author ? $"by {author}" : null, + review.Replaces is { } replaces ? $"replaces version {replaces}, and its sets with it" : null, + }.Where(t => t is not null)); + if (byline.Length > 0) + { + header.Children.Add(new TextBlock { Text = byline, Opacity = 0.75, TextWrapping = TextWrapping.Wrap }); + } + + var card = new StackPanel { Spacing = 4 }; + if (review.Description is { } description) + { + card.Children.Add(new TextBlock { Text = description, TextWrapping = TextWrapping.Wrap }); + } + + foreach (var section in review.Sections) + { + lines.Add(section.Heading); + var acts = section.Heading == PackageReviewModel.ActsHeading; + var box = new StackPanel { Spacing = 3 }; + box.Children.Add(new TextBlock + { + Text = Capitalise(section.Heading.ToLowerInvariant()), + FontWeight = FontWeight.SemiBold, + FontSize = 15, + Foreground = acts && review.Acts ? Warning : _accent, + Margin = new Thickness(0, 0, 0, 2), + }); + foreach (var row in section.Rows) + { + lines.Add(row.Label.Length == 0 ? row.Value : $"{row.Label}: {row.Value}"); + var ink = row.Tone switch + { + PackageReviewTone.Warning => Warning, + _ => null, + }; + var value = new TextBlock + { + Text = row.Value, + TextWrapping = TextWrapping.Wrap, + FontWeight = row.Tone == PackageReviewTone.Warning ? FontWeight.SemiBold : FontWeight.Normal, + Opacity = row.Tone == PackageReviewTone.Quiet ? 0.7 : 1, + }; + if (ink is not null) + { + value.Foreground = ink; + } + + if (row.Label.Length == 0) + { + box.Children.Add(value); + continue; + } + + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("110,*") }; + grid.Children.Add(new TextBlock { Text = Capitalise(row.Label), Opacity = 0.75 }); + SetColumn(value, 1); + grid.Children.Add(value); + box.Children.Add(grid); + } + + card.Children.Add(new Border + { + Child = box, + Padding = new Thickness(12, 10), + Margin = new Thickness(0, 8, 0, 0), + CornerRadius = new CornerRadius(6), + BorderThickness = new Thickness(acts && review.Acts ? 1 : 0), + BorderBrush = Warning, + Background = new SolidColorBrush(_dark ? Color.Parse("#2a2a30") : Color.Parse("#f3f3f6")), + }); + } + + var footer = new DockPanel { Margin = new Thickness(0, 12, 0, 0) }; + var consent = new TextBlock + { + Text = Capitalise(PackageReviewModel.Consent) + ".", + Opacity = 0.75, + VerticalAlignment = VerticalAlignment.Center, + TextWrapping = TextWrapping.Wrap, + }; + var accept = new Button { Content = review.Replaces is null ? "Install" : "Update", Padding = new Thickness(18, 6), Classes = { "accent" } }; + AutomationProperties.SetName(accept, "Install the package"); + accept.Click += (_, _) => _manager.Accept(); + var cancel = new Button { Content = "Cancel", Padding = new Thickness(18, 6) }; + cancel.Click += (_, _) => _manager.Cancel(); + AcceptButton = accept; + CancelButton = cancel; + var buttons = new StackPanel + { + Orientation = Orientation.Horizontal, + Spacing = 8, + Margin = new Thickness(12, 0, 0, 0), + Children = { cancel, accept }, + }; + DockPanel.SetDock(buttons, Dock.Right); + footer.Children.Add(buttons); + footer.Children.Add(consent); + + // The title and the buttons stay put; only the facts between them scroll, so Install is always in reach. + var layout = new DockPanel { LastChildFill = true }; + DockPanel.SetDock(header, Dock.Top); + DockPanel.SetDock(footer, Dock.Bottom); + layout.Children.Add(header); + layout.Children.Add(footer); + layout.Children.Add(new ScrollViewer { Content = card, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }); + + ReviewLines = lines; + _reviewLayer.Child = new Border + { + Child = layout, + Background = new SolidColorBrush(_dark ? Color.Parse("#202024") : Colors.White), + CornerRadius = new CornerRadius(8), + Padding = new Thickness(22, 16), + MaxWidth = 620, + Margin = new Thickness(16), + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + BoxShadow = BoxShadows.Parse("0 8 32 0 #66000000"), + }; + _reviewLayer.IsVisible = true; + } + + private static string Capitalise(string text) => + text.Length == 0 ? text : char.ToUpper(text[0], CultureInfo.InvariantCulture) + text[1..]; +} diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index 4957ba0b..8ce7edf8 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -79,6 +79,11 @@ public SettingsWindow(SettingsForm form) { editor.Height = ListEditorHeight(); } + + if (PackagePage is { } packages) + { + packages.Height = ListEditorHeight(); + } }; var dock = new DockPanel { LastChildFill = true }; @@ -93,6 +98,10 @@ public SettingsWindow(SettingsForm form) { _clock.Stop(); _form.Changed -= OnChanged; + if (_form.Packages is { } packages) + { + packages.Changed -= OnPackagesChanged; + } }; KeyDown += OnKey; @@ -111,6 +120,9 @@ public SettingsWindow(SettingsForm form) /// The height a list editor takes: the page's viewport less the title above it. private double ListEditorHeight() => Math.Max(360, _scroller.Bounds.Height - 96); + /// F10's package manager page, or null on any other page. + internal PackagePageView? PackagePage { get; private set; } + /// The master-detail editor a list section (F2, F3, F4, F6) is drawn as, or null on any other page. internal ListEditorView? ListEditor { get; private set; } @@ -143,8 +155,17 @@ public SettingsWindow(SettingsForm form) public void Load(SettingsForm form) { _form.Changed -= OnChanged; + if (_form.Packages is { } before) + { + before.Changed -= OnPackagesChanged; + } + _form = form; _form.Changed += OnChanged; + if (_form.Packages is { } after) + { + after.Changed += OnPackagesChanged; + } RequestedThemeVariant = form.IsDark ? ThemeVariant.Dark : ThemeVariant.Light; _shown = null; _matches = _form.Search(_search.Text); @@ -266,6 +287,7 @@ private void BuildPage() _themeCards.Clear(); SubjectPicker = null; ListEditor = null; + PackagePage = null; ScreenDoor = null; MeterGrid = null; _meterRows = -1; @@ -281,6 +303,29 @@ private void BuildPage() _page.Children.Add(new TextBlock { Text = $"{key} in the client · changes apply as you make them", Opacity = 0.7, Margin = new Thickness(0, 0, 0, 6) }); } + if (section.Packages is not null) + { + if (_form.Packages is not { } manager) + { + _page.Children.Add(new TextBlock { Text = "This client offers no packages.", Opacity = 0.7, Margin = new Thickness(0, 16, 0, 0) }); + ShownFields = []; + return; + } + + var packages = new PackagePageView( + manager, + f => !Searching || _matches.Any(m => ReferenceEquals(m.Field, f)), + Accent, + _form.IsDark) + { + Height = ListEditorHeight(), + }; + PackagePage = packages; + _page.Children.Add(packages); + ShownFields = packages.ShownFields; + return; + } + if (section.Collection is not null) { var editor = new ListEditorView( @@ -850,6 +895,16 @@ private void Tick() /// Raised on the client's thread once a change has landed; the page catches up on this one. private void OnChanged() => Dispatcher.UIThread.Post(Refresh); + /// Raised on the client's thread when the packages moved; F10's page catches up on this one. + private void OnPackagesChanged() => Dispatcher.UIThread.Post(() => + { + if (PackagePage is { } page) + { + page.Refresh(); + ShownFields = page.ShownFields; + } + }); + /// Re-reads every value and indicator on the page. A meter added or removed rebuilds the page, whose rows moved. internal void Refresh() { diff --git a/src/SharpMUTerm.Client/Contributions/Descriptors.cs b/src/SharpMUTerm.Client/Contributions/Descriptors.cs index 6988cb6a..45cc1c89 100644 --- a/src/SharpMUTerm.Client/Contributions/Descriptors.cs +++ b/src/SharpMUTerm.Client/Contributions/Descriptors.cs @@ -66,6 +66,14 @@ public sealed class SettingsSectionContribution : IContribution /// its item fields like any other. /// public SettingsCollection? Collection { get; init; } + + /// + /// For F10: the installed packages as a list, each package's fields as ordinary s over + /// bindings (the item is a ), and the actions a package row + /// offers. Null for every other section. Both hosts draw F10 from it — the cells as their list screen, the window + /// as its package manager page. + /// + public PackageCollection? Packages { get; init; } } /// @@ -89,6 +97,16 @@ public abstract record SettingsField(string Id, string Label, string? Help = nul public string? Keywords { get; init; } } +/// +/// A value a surface shows and nobody edits — a package's version, its games, what it adds. says +/// it for the item a surface has selected. +/// +public sealed record InfoField(string Id, string Label, string? Help = null) : SettingsField(Id, Label, Help) +{ + /// The text shown for target's item. + public required Func Read { get; init; } +} + /// A tick box. public sealed record BoolField(string Id, string Label, string? Help = null) : SettingsField(Id, Label, Help); diff --git a/src/SharpMUTerm.Client/Packages/PackageManager.cs b/src/SharpMUTerm.Client/Packages/PackageManager.cs new file mode 100644 index 00000000..3f494f5a --- /dev/null +++ b/src/SharpMUTerm.Client/Packages/PackageManager.cs @@ -0,0 +1,200 @@ +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Packages; + +namespace SharpMUTerm.Client.Packages; + +/// +/// What the client does when a host's package page asks: the same methods the cell F10 keys and the cell browse and +/// review call, so there is one way to switch a package, one way to remove it and one consent path for an install. +/// Every call arrives on the client's thread. +/// +public interface IPackageHost +{ + /// Switches a package on or off, and saves. + void SetEnabled(string id, bool on); + + /// Removes a package and its files, and saves. + void Remove(string id); + + /// Copies a package's sets into the player's own, and saves. + void CopySets(string id); + + /// Fetches the package index — the only time it is fetched — and publishes it. + void Browse(); + + /// Fetches the archive an index entry names, checks it against the entry and publishes its review. + void Install(PackageIndexEntry entry); + + /// Installs what described, if it is still the review waiting. + void Accept(PackageReviewModel review); + + /// Drops without writing anything. + void Cancel(PackageReviewModel review); +} + +/// +/// F10 as a host's native page reads it: the declared packages over the live configuration, the index once the player +/// has asked for it, the review waiting for consent and the last thing said. The client publishes into it on its own +/// thread; a host reads it on its own, and every value it reads is a model replaced whole, never edited. Every gesture +/// goes back through , so the window never installs, removes or switches anything itself. +/// +public sealed class PackageManager +{ + private readonly AppConfiguration _config; + private readonly IPackageHost _host; + + /// The live configuration (its installed packages and which are off). + /// F10's declaration. + /// The client's side. + public PackageManager(AppConfiguration config, PackageCollection declaration, IPackageHost host) + { + ArgumentNullException.ThrowIfNull(config); + ArgumentNullException.ThrowIfNull(declaration); + ArgumentNullException.ThrowIfNull(host); + _config = config; + Declaration = declaration; + _host = host; + } + + /// F10's declaration: the fields and actions both hosts draw. + public PackageCollection Declaration { get; } + + /// The live configuration, for a binding to read through. + public AppConfiguration Configuration => _config; + + /// The installed packages now, each with what the index said of it. + public IReadOnlyList Items => PackageCollection.Items(_config, Index); + + /// The index, once fetched this run; null before the player first browses. + public PackageIndex? Index { get; private set; } + + /// The index as the browse list shows it, or null before it has arrived. + public PackageBrowseModel? BrowseModel { get; private set; } + + /// + /// How many times the player has asked for the index (here or by ⌃P ▸ Browse packages). A host compares it with + /// to bring its browse list forward once per ask. + /// + public int BrowseRequests { get; private set; } + + /// The a host has answered by showing its browse list; the host's to write. + public int BrowseRequestsSeen { get; set; } + + /// Whether the index is being fetched. + public bool Fetching { get; private set; } + + /// The review waiting for consent, or null. + public PackageReviewModel? Review { get; private set; } + + /// The last thing the client said about packages (installed, removed, refused), or null. + public string? Status { get; private set; } + + /// Raised on the client's thread after anything here has changed. + public event Action? Changed; + + /// Whether the package is on. + public bool IsEnabled(PackageItem item) + { + ArgumentNullException.ThrowIfNull(item); + return PackageCollection.IsEnabled(_config, item.Id); + } + + /// What says for . + public string Text(InfoField field, PackageItem item) + { + ArgumentNullException.ThrowIfNull(field); + return field.Read(new SettingTarget(_config, Item: item)); + } + + // ── gestures, handed to the client ─────────────────────────────────────────────────────────── + + /// Switches on or off. + public void SetEnabled(PackageItem item, bool on) + { + ArgumentNullException.ThrowIfNull(item); + _host.SetEnabled(item.Id, on); + } + + /// Removes . + public void Remove(PackageItem item) + { + ArgumentNullException.ThrowIfNull(item); + _host.Remove(item.Id); + } + + /// Copies 's sets into the player's own. + public void CopySets(PackageItem item) + { + ArgumentNullException.ThrowIfNull(item); + _host.CopySets(item.Id); + } + + /// Fetches the index. Nothing fetches it before this is called. + public void Browse() => _host.Browse(); + + /// Fetches and checks the package names, and opens its review. + public void Install(PackageBrowseRow row) + { + ArgumentNullException.ThrowIfNull(row); + _host.Install(row.Entry); + } + + /// Installs the package under review: the consent. + public void Accept() + { + if (Review is { } review) + { + _host.Accept(review); + } + } + + /// Drops the review; nothing is written. + public void Cancel() + { + if (Review is { } review) + { + _host.Cancel(review); + } + } + + // ── what the client publishes, on its own thread ───────────────────────────────────────────── + + /// Says the index is on its way. + public void PublishFetching() + { + Fetching = true; + BrowseRequests++; + Changed?.Invoke(); + } + + /// Publishes the index and the browse list built from it. + public void PublishIndex(PackageIndex index, PackageBrowseModel model) + { + ArgumentNullException.ThrowIfNull(index); + ArgumentNullException.ThrowIfNull(model); + Index = index; + BrowseModel = model; + Fetching = false; + Changed?.Invoke(); + } + + /// Publishes a review waiting for consent, or null for none. + public void PublishReview(PackageReviewModel? review) + { + Review = review; + Changed?.Invoke(); + } + + /// Publishes what the client said. + public void PublishStatus(string? status) + { + Status = status; + Fetching = false; + Changed?.Invoke(); + } + + /// Raises : the installed list or which are on moved. + public void NotifyChanged() => Changed?.Invoke(); +} diff --git a/src/SharpMUTerm.Client/Packages/PackageModels.cs b/src/SharpMUTerm.Client/Packages/PackageModels.cs new file mode 100644 index 00000000..475c26ed --- /dev/null +++ b/src/SharpMUTerm.Client/Packages/PackageModels.cs @@ -0,0 +1,181 @@ +using System.Globalization; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Packages; + +namespace SharpMUTerm.Client.Packages; + +/// How a review row is drawn: as plain information, as a warning, or as a quiet aside. +public enum PackageReviewTone +{ + /// A plain row. + Plain, + + /// Something that can act as the player: drawn in the warning ink. + Warning, + + /// An aside, in the label ink. + Quiet, +} + +/// One row of a review: a label and its value, or — with no label — a sentence. +/// The label (scripts), or empty for a sentence row. +/// What it says. +/// How it is drawn. +public sealed record PackageReviewRow(string Label, string Value, PackageReviewTone Tone = PackageReviewTone.Plain); + +/// A heading and its rows. +public sealed record PackageReviewSection(string Heading, IReadOnlyList Rows); + +/// +/// What the review says before a package is installed — the consent step — as one model both hosts draw: the cell +/// review's rows and the window's review card are this, in this order. It leads with what can act as the player (the +/// rules that send commands and the scripts that run), then what else it adds, then who it applies to. +/// +/// Install package or Update package. +/// The package's name. +/// Its version. +/// Its author, or null. +/// The version it replaces, or null for a first install. +/// What it says it does, or null. +/// The sections, in order. +/// Whether anything in it can act as the player. +public sealed record PackageReviewModel( + string Title, + string Name, + string Version, + string? Author, + string? Replaces, + string? Description, + IReadOnlyList Sections, + bool Acts) +{ + /// The first section's heading: what can act as the player. + public const string ActsHeading = "WHAT CAN ACT AS YOU"; + + /// The second: everything else it adds. + public const string AddsHeading = "WHAT ELSE IT ADDS"; + + /// The third: who it applies to. + public const string WhoHeading = "WHO IT APPLIES TO"; + + /// The sentence under the review: nothing is written until it is accepted. + public const string Consent = "nothing is written until you install"; + + /// The review of . + /// The archive, read. + /// The player's characters it would apply to, as Corvid (Aetherfall). + /// The installed version it would replace, or null. + public static PackageReviewModel From(PackageContents contents, IReadOnlyList characters, InstalledPackage? existing) + { + ArgumentNullException.ThrowIfNull(contents); + ArgumentNullException.ThrowIfNull(characters); + var manifest = contents.Manifest; + var review = contents.Review(); + var rules = review.Triggers + review.Aliases + review.Macros + review.Timers; + + var acts = new List + { + review.Sending > 0 + ? new("sending", $"{(review.Sending == 1 ? "1 rule sends" : $"{Count(review.Sending)} rules send")} commands as you", PackageReviewTone.Warning) + : new("sending", "no rule sends a command", PackageReviewTone.Quiet), + new("scripts", review.Scripts.Count == 0 + ? "none" + : string.Join(", ", review.Scripts.Select(s => $"{s.Name} ({PackageCollection.Size(s.Bytes)})"))), + }; + if (review.Scripts.Count > 0) + { + acts.Add(new(string.Empty, "Lua runs in the sandbox, and can send commands as you", PackageReviewTone.Warning)); + } + + var adds = new List + { + new("rule sets", Count(review.Sets)), + new("rules", rules == 0 + ? "none" + : $"{PackageCollection.Of(review.Triggers, "trigger")} · {PackageCollection.Of(review.Aliases, "alias", "aliases")} · " + + $"{PackageCollection.Of(review.Macros, "key")} · {PackageCollection.Of(review.Timers, "timer")}"), + new("media", review.MediaFiles == 0 + ? "none" + : $"{PackageCollection.Of(review.MediaFiles, "file")}, {PackageCollection.Size(review.MediaBytes)}"), + }; + if (review.Ignored.Count > 0) + { + adds.Add(new("left out", $"{PackageCollection.Of(review.Ignored.Count, "file")} outside sets/, scripts/ and media/", PackageReviewTone.Quiet)); + } + + var who = new List + { + new("games", string.Join(", ", manifest.Games)), + new("characters", characters.Count == 0 ? "none of yours, yet" : string.Join(", ", characters)), + }; + + return new PackageReviewModel( + existing is null ? "Install package" : "Update package", + manifest.Name, + manifest.Version, + manifest.Author, + existing?.Manifest.Version, + string.IsNullOrWhiteSpace(manifest.Description) ? null : manifest.Description, + [new(ActsHeading, acts), new(AddsHeading, adds), new(WhoHeading, who)], + review.Sending > 0 || review.Scripts.Count > 0); + } + + private static string Count(int n) => n.ToString(CultureInfo.InvariantCulture); +} + +/// Where an index entry stands against what is installed. +public enum PackageBrowseState +{ + /// Not installed. + New, + + /// Installed at the version the index lists. + Installed, + + /// Installed at another version: the index offers an update. + Update, +} + +/// One package the index lists, as both hosts' browse lists draw it. +/// The index's entry. +/// Whether it is for the focused window's world (a * package does not count). +/// Where it stands against what is installed. +/// The version installed, or null. +public sealed record PackageBrowseRow(PackageIndexEntry Entry, bool ForWorld, PackageBrowseState State, string? InstalledVersion) +{ + /// What a row says after its version: installed, installed 1.1.0, update, or nothing. + public string StateText => State switch + { + PackageBrowseState.Installed => "installed", + PackageBrowseState.Update => $"installed {InstalledVersion}, update", + _ => string.Empty, + }; +} + +/// +/// The package index as both hosts list it: the focused window's world's packages first, then the rest by name, each +/// with where it stands against what is installed; and how many entries the index broke its rules on. +/// +/// The focused window's world's name, or null. +/// Entries the index listed that were not kept. +/// The rows, in order. +public sealed record PackageBrowseModel(string? World, int Dropped, IReadOnlyList Rows) +{ + /// The index over what is installed, sorted for . + public static PackageBrowseModel From(PackageIndex index, IReadOnlyList installed, WorldDefinition? world) + { + ArgumentNullException.ThrowIfNull(index); + ArgumentNullException.ThrowIfNull(installed); + var rows = index.For(world?.Host, world?.Port ?? 0).Select(entry => + { + var have = installed.FirstOrDefault(p => p.Id == entry.Id); + var forWorld = world is not null && entry.Games.Any(g => g != "*" && PackageManifest.Matches(g, world.Host, world.Port)); + var state = have is null ? PackageBrowseState.New + : have.Manifest.Version == entry.Version ? PackageBrowseState.Installed + : PackageBrowseState.Update; + return new PackageBrowseRow(entry, forWorld, state, have?.Manifest.Version); + }).ToList(); + return new PackageBrowseModel(world?.Name, index.Dropped, rows); + } +} diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index c5053f78..00598bb5 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -373,7 +373,7 @@ public static partial class BuiltInSettings Text, Input, Character, - Listed("packages", "Packages", "F10", 90), + Packages, ]; private static IReadOnlyList? _all; @@ -388,9 +388,6 @@ public static void Register(SettingsSectionList sections) } } - private static SettingsSectionContribution Listed(string id, string title, string key, int order) => - new() { Id = id, Title = title, Key = key, Order = order }; - private static BoolField Flag( string id, string label, diff --git a/src/SharpMUTerm.Client/Settings/PackageCollection.cs b/src/SharpMUTerm.Client/Settings/PackageCollection.cs new file mode 100644 index 00000000..ba7359d4 --- /dev/null +++ b/src/SharpMUTerm.Client/Settings/PackageCollection.cs @@ -0,0 +1,247 @@ +using System.Globalization; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Packages; + +namespace SharpMUTerm.Client.Settings; + +/// +/// One installed package as F10 lists it: the package, and what the package index said about it the last time the +/// player opened it — null when the index has not been fetched this run, which is the usual case, because the index +/// is fetched only when the player asks. +/// +/// The installed package. +/// The index's entry for the same id, or null. +public sealed record PackageItem(InstalledPackage Package, PackageIndexEntry? Listed) +{ + /// The package's id. + public string Id => Package.Id; + + /// The newer version the index offers, or null when it offers none (or has not been read). + public string? Update => Listed is { } entry && entry.Version != Package.Manifest.Version ? entry.Version : null; +} + +/// Something a package row offers besides its fields: on/off, copy its sets, remove it, browse the index. +/// A stable id (…). +/// What it is called, after its key on the cell screen (copy sets to yours). +/// The cell screen's key for it (Space, c, Del, b). +/// One line saying what it does. +public sealed record PackageAction(string Id, string Label, string Key, string Help); + +/// +/// F10 declared: the installed packages, each package's fields — whether it is on, its version and games, what it +/// adds (sets, scripts, media), whether the index offers an update, who it applies to — and the actions a row offers. +/// The cell screen draws its rows and its key line from this, and the window draws its package manager page from it, +/// so the two show the same fields in the same order. +/// +/// The only thing a package field writes is , and it replaces +/// that list rather than editing it, the reads-cross-threads rule every list section keeps. Installing and removing +/// change the package store, which is the client's; they are actions, not fields. +/// +/// +public sealed class PackageCollection +{ + /// The on/off action. + public const string Toggle = "toggle"; + + /// The copy-its-sets-to-edit action. + public const string CopySets = "copy"; + + /// The remove action. + public const string Remove = "remove"; + + /// The browse-the-index action. + public const string Browse = "browse"; + + /// What one item is called. + public required string Noun { get; init; } + + /// What several are called. + public required string Plural { get; init; } + + /// Every field of a package, in the order both hosts show them. + public required IReadOnlyList Fields { get; init; } + + /// The actions a package row offers, in the order the cell screen's key line names them. + public required IReadOnlyList Actions { get; init; } + + /// The id of the field that switches a package on, which a list shows as each row's check box. + public string EnabledField { get; init; } = "enabled"; + + /// The fields a list row carries beside its check box: the name, then what is said after it. + public IReadOnlyList RowFields { get; init; } = ["name", "version", "games"]; + + /// A field by id. + public SettingsField Field(string id) => + Fields.FirstOrDefault(f => string.Equals(f.Id, id, StringComparison.Ordinal)) + ?? throw new InvalidOperationException($"The {Plural} declare no field '{id}'."); + + /// An action by id. + public PackageAction Action(string id) => + Actions.FirstOrDefault(a => string.Equals(a.Id, id, StringComparison.Ordinal)) + ?? throw new InvalidOperationException($"The {Plural} declare no action '{id}'."); + + /// The fields a package's detail shows: every field but the check box and the row's own. + public IEnumerable DetailFields => + Fields.Where(f => f.Id != EnabledField && !RowFields.Contains(f.Id, StringComparer.Ordinal)); + + /// The installed packages, by name, each with what lists for it. + public static IReadOnlyList Items(AppConfiguration config, PackageIndex? index) + { + ArgumentNullException.ThrowIfNull(config); + return config.Packages + .OrderBy(p => p.Manifest.Name, StringComparer.OrdinalIgnoreCase) + .Select(p => new PackageItem(p, index?.Entries.FirstOrDefault(e => e.Id == p.Id))) + .ToList(); + } + + /// Whether the package is on. + public static bool IsEnabled(AppConfiguration config, string id) + { + ArgumentNullException.ThrowIfNull(config); + return !config.DisabledPackages.Contains(id, StringComparer.Ordinal); + } + + /// + /// Switches the package on or off by replacing ; + /// false when it was already so. + /// + public static bool SetEnabled(AppConfiguration config, string id, bool on) + { + ArgumentNullException.ThrowIfNull(config); + ArgumentNullException.ThrowIfNull(id); + if (IsEnabled(config, id) == on) + { + return false; + } + + config.DisabledPackages = on + ? config.DisabledPackages.Where(d => !string.Equals(d, id, StringComparison.Ordinal)).ToList() + : [.. config.DisabledPackages, id]; + return true; + } + + /// The characters a package applies to: everyone on a world it is for, as Corvid (Aetherfall). + public static IReadOnlyList CharactersFor(AppConfiguration config, PackageManifest manifest) + { + ArgumentNullException.ThrowIfNull(config); + ArgumentNullException.ThrowIfNull(manifest); + return config.Worlds.ToArray() + .Where(w => manifest.IsFor(w.Host, w.Port)) + .SelectMany(w => w.Characters.ToArray().Select(c => $"{c.Name} ({w.Name})")) + .ToList(); + } + + /// 1 trigger, 3 aliases. + public static string Of(int n, string one, string? many = null) => + n == 1 ? $"1 {one}" : $"{n.ToString(CultureInfo.InvariantCulture)} {many ?? one + "s"}"; + + /// A size as people read it. + public static string Size(long bytes) => bytes switch + { + < 1024 => $"{bytes.ToString(CultureInfo.InvariantCulture)} B", + < 1024 * 1024 => (bytes / 1024.0).ToString("0.#", CultureInfo.InvariantCulture) + " KB", + _ => (bytes / (1024.0 * 1024)).ToString("0.#", CultureInfo.InvariantCulture) + " MB", + }; +} + +/// F10's declaration. +public static partial class BuiltInSettings +{ + /// The heading over what a package is. + public const string PackageGroup = "Package"; + + /// The heading over what a package adds. + public const string ContributesGroup = "What it adds"; + + /// The heading over who a package applies to and whether it is current. + public const string ReachGroup = "Who it applies to"; + + /// F10: the installed packages. + public static SettingsSectionContribution Packages { get; } = new() + { + Id = "packages", + Title = "Packages", + Key = "F10", + Order = 90, + Scope = SettingScope.Item, + Packages = new PackageCollection + { + Noun = "package", + Plural = "packages", + Fields = + [ + new BoolField("enabled", "enabled", "whether its sets, scripts and sounds are used") + { + Group = PackageGroup, + Keywords = "on off disable switch", + Binding = SettingBinding.ForItem( + (c, p) => PackageCollection.IsEnabled(c, p.Id), + (c, p, v) => PackageCollection.SetEnabled(c, p.Id, v), + FreshPackage, + v => v ? "on" : "off"), + }, + Info("name", "name", PackageGroup, p => p.Package.Manifest.Name, "what the package is called"), + Info("version", "version", PackageGroup, p => p.Package.Manifest.Version, "the version installed"), + Info("games", "games", PackageGroup, p => string.Join(", ", p.Package.Manifest.Games), + "the games it is for: host[:port], *.host, or * for any", "host world server"), + Info("author", "by", PackageGroup, p => p.Package.Manifest.Author ?? "—", "who made it", "author"), + Info("description", "about", PackageGroup, p => p.Package.Manifest.Description ?? "—", "what it says it does", "description"), + Info("sets", "sets", ContributesGroup, Sets, + "its trigger sets, read-only on F2–F6; c copies them to yours to edit", "trigger alias timer rule"), + Info("scripts", "scripts", ContributesGroup, + p => p.Package.Scripts.Count == 0 ? "none" : string.Join(", ", p.Package.Scripts), + "its Lua scripts, which run in the sandbox and can send commands as you", "lua"), + Info("media", "media", ContributesGroup, + p => p.Package.Media.Count == 0 ? "none" + : $"{PackageCollection.Of(p.Package.Media.Count, "file")}, {PackageCollection.Size(p.Package.MediaBytes)}", + "its sounds", "sound music audio"), + Info("update", "update", ReachGroup, + p => p.Update is { } newer ? $"{newer} in the index" + : p.Listed is not null ? "up to date" : "not checked — the index has not been opened", + "whether the package index offers a newer version", "upgrade new version index"), + Info("characters", "characters", ReachGroup, Characters, "the characters it applies to", "who world"), + ], + Actions = + [ + new(PackageCollection.Toggle, "on/off", "Space", "switch the package on or off"), + new(PackageCollection.CopySets, "copy sets to yours", "c", "copy its sets into yours, where F2–F6 can edit them"), + new(PackageCollection.Remove, "remove", "Del", "remove the package and its files"), + new(PackageCollection.Browse, "browse", "b", "browse the package index"), + ], + }, + }; + + private static PackageItem FreshPackage() => + new(new InstalledPackage(new PackageManifest { Id = "package", Name = "package", Version = "0" }, []), null); + + private static string Sets(AppConfiguration config, PackageItem item) + { + var sets = item.Package.Sets; + if (sets.Count == 0) + { + return "none"; + } + + var rules = sets.Sum(s => s.Triggers.Count + s.Aliases.Count + s.Macros.Count + s.Timers.Count); + return $"{string.Join(", ", sets.Select(s => s.Name))} · {PackageCollection.Of(rules, "rule")}"; + } + + private static string Characters(AppConfiguration config, PackageItem item) + { + var who = PackageCollection.CharactersFor(config, item.Package.Manifest); + return who.Count == 0 ? "none" : string.Join(", ", who); + } + + private static InfoField Info(string id, string label, string group, Func read, string help, string? keywords = null) => + Info(id, label, group, (_, p) => read(p), help, keywords); + + private static InfoField Info( + string id, string label, string group, Func read, string help, string? keywords = null) => + new(id, label, help) + { + Group = group, + Keywords = keywords, + Read = t => t.Item is PackageItem item ? read(t.Config, item) : string.Empty, + }; +} diff --git a/src/SharpMUTerm.Client/Settings/SettingsForm.cs b/src/SharpMUTerm.Client/Settings/SettingsForm.cs index 9f845f97..f4334a45 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsForm.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsForm.cs @@ -100,6 +100,12 @@ public SettingsForm( /// Every section, in order. public IReadOnlyList Sections { get; } + /// + /// F10's page: the installed packages, the index once asked for, and the review waiting for consent — or null when + /// the client offers none, and the page says so. + /// + public Packages.PackageManager? Packages { get; init; } + /// The id of the section shown first. public string Initial { get; } @@ -186,7 +192,7 @@ public void SetTheme(ThemeField field, string name) public static bool IsDeclared(SettingsSectionContribution section) { ArgumentNullException.ThrowIfNull(section); - return section.Fields.Count > 0 || section.Collection is not null; + return section.Fields.Count > 0 || section.Collection is not null || section.Packages is not null; } /// A section by id, or null. diff --git a/src/SharpMUTerm.Client/Settings/SettingsSearch.cs b/src/SharpMUTerm.Client/Settings/SettingsSearch.cs index 33b1e590..9c164dac 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsSearch.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsSearch.cs @@ -78,7 +78,9 @@ public static IReadOnlyDictionary CountBySection(IEnumerable Searchable(SettingsSectionContribution section) { ArgumentNullException.ThrowIfNull(section); - return section.Collection is { } collection ? section.Fields.Concat(collection.Fields) : section.Fields; + return section.Collection is { } collection ? section.Fields.Concat(collection.Fields) + : section.Packages is { } packages ? section.Fields.Concat(packages.Fields) + : section.Fields; } private static bool Contains(string? text, string query) => diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 1f7ce1d7..aaa669f0 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -252,7 +252,7 @@ public static class SurfaceCatalog [SurfaceHosts.Window] = SurfaceDrawing.Native, }, "SharpMUTerm.Tui.OptionsScreenRenderer.FromSection", - ["SharpMUTerm.Avalonia.SettingsWindow", "SharpMUTerm.Avalonia.ThemeCardView", "SharpMUTerm.Avalonia.ListEditorView"]), + ["SharpMUTerm.Avalonia.SettingsWindow", "SharpMUTerm.Avalonia.ThemeCardView", "SharpMUTerm.Avalonia.ListEditorView", "SharpMUTerm.Avalonia.PackagePageView"]), new( LayoutsMenu, typeof(MenuModel), diff --git a/src/SharpMUTerm.Core/Packages/PackageStore.cs b/src/SharpMUTerm.Core/Packages/PackageStore.cs index c5345dfd..17f2b07f 100644 --- a/src/SharpMUTerm.Core/Packages/PackageStore.cs +++ b/src/SharpMUTerm.Core/Packages/PackageStore.cs @@ -9,6 +9,15 @@ namespace SharpMUTerm.Core.Packages; public sealed record InstalledPackage(PackageManifest Manifest, IReadOnlyList Sets) { public string Id => Manifest.Id; + + /// Its scripts, as paths under its scripts/ folder, in order. + public IReadOnlyList Scripts { get; init; } = []; + + /// Its media files, as paths under its media/ folder, in order. + public IReadOnlyList Media { get; init; } = []; + + /// The bytes its media files take. + public long MediaBytes { get; init; } } /// @@ -97,7 +106,14 @@ public void Load() } } - _installed[manifest.Id] = new InstalledPackage(manifest, Bind(manifest.Id, sets)); + var (scripts, _) = Listed(Path.Combine(folder, "scripts")); + var (media, mediaBytes) = Listed(Path.Combine(folder, "media")); + _installed[manifest.Id] = new InstalledPackage(manifest, Bind(manifest.Id, sets)) + { + Scripts = scripts, + Media = media, + MediaBytes = mediaBytes, + }; } catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or JsonException) { @@ -167,7 +183,12 @@ public void Load() } } - _installed[id] = new InstalledPackage(contents.Manifest, Bind(id, contents.Sets)); + _installed[id] = new InstalledPackage(contents.Manifest, Bind(id, contents.Sets)) + { + Scripts = contents.Scripts.Keys.Order(StringComparer.Ordinal).ToList(), + Media = contents.Media.Keys.Order(StringComparer.Ordinal).ToList(), + MediaBytes = contents.Media.Values.Sum(v => (long)v.Length), + }; return null; } @@ -239,6 +260,22 @@ private static List Bind(string id, IEnumerable sets) => return copy; }).ToList(); + /// The files under as relative paths with /, and their total size. + private static (List Files, long Bytes) Listed(string folder) + { + if (!Directory.Exists(folder)) + { + return ([], 0); + } + + var files = Directory.EnumerateFiles(folder, "*", SearchOption.AllDirectories) + .Select(f => new FileInfo(f)) + .ToList(); + return ( + files.Select(f => Path.GetRelativePath(folder, f.FullName).Replace(Path.DirectorySeparatorChar, '/')).Order(StringComparer.Ordinal).ToList(), + files.Sum(f => f.Length)); + } + private static void Write(string root, string relative, byte[] bytes) { var path = Path.Combine(root, relative); diff --git a/src/SharpMUTerm.Tui/PackageScreen.cs b/src/SharpMUTerm.Tui/PackageScreen.cs index 19817c6a..b68f2272 100644 --- a/src/SharpMUTerm.Tui/PackageScreen.cs +++ b/src/SharpMUTerm.Tui/PackageScreen.cs @@ -1,84 +1,88 @@ using System.Globalization; -using SharpMUTerm.Core.Packages; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Packages; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; using static SharpMUTerm.Tui.MarkupText; namespace SharpMUTerm.Tui; /// -/// What the two package surfaces say, as markup rows: the review a player reads before anything is installed, -/// and the list of what is installed. Pure, so a test reads the words the player would. +/// What the package surfaces say, as markup rows: the review a player reads before anything is installed, the list +/// of what is installed and the index. Each is drawn from a Client model or F10's declaration — the same ones the +/// window draws — and is pure, so a test reads the words the player would. /// internal static class PackageScreen { /// - /// The review. It is the consent step, so it leads with what can act as the player: the rules that send - /// commands and the scripts that run, then who it applies to and how much it writes. + /// The review, drawn from — the model the window's review card draws, so the two + /// say the same facts in the same order. It is the consent step, so it leads with what can act as the player: the + /// rules that send commands and the scripts that run, then what else it adds and who it applies to. /// - internal static List Review(PackageContents contents, IReadOnlyList characters, InstalledPackage? existing, int width) + internal static List Review(PackageReviewModel model, int width) { - var manifest = contents.Manifest; - var review = contents.Review(); var lines = new List { - $"[bold {ScreenPalette.Accent}]{Escape(Elide(manifest.Name, width))}[/] [{ScreenPalette.Label}]{Escape(manifest.Version)}" - + (manifest.Author is { } author ? $" · by {Escape(Elide(author, 40))}" : string.Empty) + "[/]", + $"[bold {ScreenPalette.Accent}]{Escape(Elide(model.Name, width))}[/] [{ScreenPalette.Label}]{Escape(model.Version)}" + + (model.Author is { } author ? $" · by {Escape(Elide(author, 40))}" : string.Empty) + "[/]", }; - if (existing is not null) + if (model.Replaces is { } replaces) { - lines.Add($"[{ScreenPalette.Label}]replaces version {Escape(existing.Manifest.Version)}, and its sets with it[/]"); + lines.Add($"[{ScreenPalette.Label}]replaces version {Escape(replaces)}, and its sets with it[/]"); } - if (!string.IsNullOrWhiteSpace(manifest.Description)) + if (model.Description is { } description) { - lines.Add($"[{ScreenPalette.Value}]{Escape(Elide(manifest.Description, width))}[/]"); + lines.Add($"[{ScreenPalette.Value}]{Escape(Elide(description, width))}[/]"); } - lines.Add(string.Empty); - lines.Add($"[bold {ScreenPalette.Accent}]WHAT IT ADDS[/]"); - lines.Add(Row("rule sets", Count(review.Sets))); - lines.Add(Row("rules", $"{Of(review.Triggers, "trigger")} · {Of(review.Aliases, "alias", "aliases")} · {Of(review.Macros, "key")} · {Of(review.Timers, "timer")}")); - lines.Add(review.Sending > 0 - ? $" [bold {ScreenPalette.Warn}]{(review.Sending == 1 ? "1 of them sends" : $"{Count(review.Sending)} of them send")} commands as you[/]" - : $" [{ScreenPalette.Label}]none of them sends a command[/]"); - lines.Add(Row("scripts", review.Scripts.Count == 0 - ? "none" - : string.Join(", ", review.Scripts.Select(s => $"{s.Name} ({Size(s.Bytes)})")))); - if (review.Scripts.Count > 0) - { - lines.Add($" [bold {ScreenPalette.Warn}]Lua runs in the sandbox, and can send commands as you[/]"); - } - - lines.Add(Row("media", review.MediaFiles == 0 ? "none" : $"{Of(review.MediaFiles, "file")}, {Size(review.MediaBytes)}")); - if (review.Ignored.Count > 0) + foreach (var section in model.Sections) { - lines.Add(Row("left out", $"{Of(review.Ignored.Count, "file")} outside sets/, scripts/ and media/")); + lines.Add(string.Empty); + lines.Add($"[bold {ScreenPalette.Accent}]{Escape(section.Heading)}[/]"); + foreach (var row in section.Rows) + { + lines.Add(ReviewRow(row, width)); + } } - lines.Add(string.Empty); - lines.Add($"[bold {ScreenPalette.Accent}]WHO IT APPLIES TO[/]"); - lines.Add(Row("games", string.Join(", ", manifest.Games))); - lines.Add(Row("characters", characters.Count == 0 ? "none of yours, yet" : string.Join(", ", characters))); lines.Add(string.Empty); lines.Add($"[{ScreenPalette.Label}]⏎ install · Esc cancel — nothing is written until you press ⏎[/]"); return lines; + } - string Row(string label, string value) => - $" [{ScreenPalette.Label}]{label.PadRight(11)}[/][{ScreenPalette.Value}]{Escape(Elide(value, Math.Max(10, width - 14)))}[/]"; + private static string ReviewRow(PackageReviewRow row, int width) + { + var ink = row.Tone switch + { + PackageReviewTone.Warning => $"bold {ScreenPalette.Warn}", + PackageReviewTone.Quiet => ScreenPalette.Label, + _ => ScreenPalette.Value, + }; + return row.Label.Length == 0 + ? $" [{ink}]{Escape(Elide(row.Value, Math.Max(10, width - 4)))}[/]" + : $" [{ScreenPalette.Label}]{row.Label.PadRight(11)}[/][{ink}]{Escape(Elide(row.Value, Math.Max(10, width - 14)))}[/]"; } - /// The installed packages, the selected one's detail, and the keys. + /// + /// The installed packages, the selected one's detail, and the keys — all drawn from F10's declaration: the key line + /// is its actions, a row is its check box and row fields, the detail is every other field under its label. + /// + /// When given, receives the ids of the fields drawn, in order — what a test compares with the window's. internal static List List( - IReadOnlyList packages, - IReadOnlyCollection disabled, + PackageCollection declaration, + AppConfiguration config, + IReadOnlyList packages, int selected, bool confirmingRemove, - Func> characters, - int width) + int width, + List? drawn = null) { + var keys = string.Join(" · ", declaration.Actions.Select(a => $"{a.Key} {a.Label}")); var lines = new List { - $"[{ScreenPalette.Label}]{Count(packages.Count)} installed · ↑↓ select · Space on/off · c copy sets to yours · Del remove · b browse · Esc close[/]", + $"[{ScreenPalette.Label}]{Count(packages.Count)} installed · ↑↓ select · {Escape(keys)} · Esc close[/]", string.Empty, }; @@ -88,55 +92,58 @@ internal static List List( return lines; } + string Read(string id, PackageItem item) => + declaration.Field(id) is InfoField info ? info.Read(new SettingTarget(config, Item: item)) : string.Empty; + + var enabled = (SettingBinding)declaration.Field(declaration.EnabledField).Binding!; + var name = declaration.RowFields[0]; + var after = declaration.RowFields.Skip(1).ToList(); for (var i = 0; i < packages.Count; i++) { var package = packages[i]; - var on = !disabled.Contains(package.Id); + var on = enabled.Get(new SettingTarget(config, Item: package)); var marker = i == selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; var box = on ? "[[x]]" : "[[ ]]"; - lines.Add($"{marker} {box} [{(i == selected ? "bold " : string.Empty)}{ScreenPalette.Value}]{Escape(Elide(package.Manifest.Name, 30))}[/]" - + $" [{ScreenPalette.Label}]{Escape(package.Manifest.Version)} · {Escape(Elide(string.Join(", ", package.Manifest.Games), Math.Max(10, width - 50)))}[/]"); + var tail = string.Join(" · ", after.Select(id => Read(id, package))); + lines.Add($"{marker} {box} [{(i == selected ? "bold " : string.Empty)}{ScreenPalette.Value}]{Escape(Elide(Read(name, package), 30))}[/]" + + $" [{ScreenPalette.Label}]{Escape(Elide(tail, Math.Max(10, width - 40)))}[/]"); } + drawn?.Add(declaration.EnabledField); + drawn?.AddRange(declaration.RowFields); var current = packages[Math.Clamp(selected, 0, packages.Count - 1)]; lines.Add(string.Empty); - lines.Add($"[bold {ScreenPalette.Accent}]{Escape(Elide(current.Manifest.Name, width - 4))}[/]"); - if (!string.IsNullOrWhiteSpace(current.Manifest.Description)) + lines.Add($"[bold {ScreenPalette.Accent}]{Escape(Elide(Read(name, current), width - 4))}[/]"); + foreach (var field in declaration.DetailFields) { - lines.Add($" [{ScreenPalette.Value}]{Escape(Elide(current.Manifest.Description, width - 4))}[/]"); + drawn?.Add(field.Id); + lines.Add($" [{ScreenPalette.Label}]{field.Label.PadRight(11)}[/]" + + $"[{ScreenPalette.Value}]{Escape(Elide(Read(field.Id, current), Math.Max(10, width - 14)))}[/]"); } - lines.Add($" [{ScreenPalette.Label}]sets[/] [{ScreenPalette.Value}]{Escape(Elide(string.Join(", ", current.Sets.Select(s => s.Name)), width - 14))}[/]"); - var who = characters(current); - lines.Add($" [{ScreenPalette.Label}]characters[/] [{ScreenPalette.Value}]{Escape(Elide(who.Count == 0 ? "none" : string.Join(", ", who), width - 14))}[/]"); if (confirmingRemove) { lines.Add(string.Empty); - lines.Add($"[bold {ScreenPalette.Warn}]Remove {Escape(current.Manifest.Name)} and its files? Del again removes it, any other key keeps it.[/]"); + lines.Add($"[bold {ScreenPalette.Warn}]Remove {Escape(Read(name, current))} and its files? Del again removes it, any other key keeps it.[/]"); } return lines; } - /// The index's packages, the focused world's first, with what is installed beside each. - internal static List Browse( - IReadOnlyList entries, - IReadOnlyList installed, - int selected, - string? world, - int dropped, - int width) + /// The index's packages, the focused world's first, with what is installed beside each: the browse model drawn. + internal static List Browse(PackageBrowseModel model, int selected, int width) { + var entries = model.Rows; var lines = new List { $"[{ScreenPalette.Label}]{Of(entries.Count, "package")}" - + (world is null ? string.Empty : $" · {Escape(Elide(world, 30))}'s first") + + (model.World is null ? string.Empty : $" · {Escape(Elide(model.World, 30))}'s first") + " · ↑↓ select · ⏎ review · Esc close[/]", }; - if (dropped > 0) + if (model.Dropped > 0) { - lines.Add($"[{ScreenPalette.Warn}]{(dropped == 1 ? "1 entry in the index breaks its rules and is" : $"{Count(dropped)} entries in the index break its rules and are")} not listed[/]"); + lines.Add($"[{ScreenPalette.Warn}]{(model.Dropped == 1 ? "1 entry in the index breaks its rules and is" : $"{Count(model.Dropped)} entries in the index break its rules and are")} not listed[/]"); } lines.Add(string.Empty); @@ -148,17 +155,15 @@ internal static List Browse( for (var i = 0; i < entries.Count; i++) { - var entry = entries[i]; - var have = installed.FirstOrDefault(p => p.Id == entry.Id); - var state = have is null ? string.Empty - : have.Manifest.Version == entry.Version ? " · installed" - : $" · installed {Escape(have.Manifest.Version)}, update"; + var row = entries[i]; + var entry = row.Entry; + var state = row.StateText.Length == 0 ? string.Empty : " · " + Escape(row.StateText); var marker = i == selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; lines.Add($"{marker} [{(i == selected ? "bold " : string.Empty)}{ScreenPalette.Value}]{Escape(Elide(entry.Name, 30))}[/]" + $" [{ScreenPalette.Label}]{Escape(entry.Version)} · {Escape(Elide(string.Join(", ", entry.Games), Math.Max(10, width - 60)))}{state}[/]"); } - var current = entries[Math.Clamp(selected, 0, entries.Count - 1)]; + var current = entries[Math.Clamp(selected, 0, entries.Count - 1)].Entry; lines.Add(string.Empty); lines.Add($"[bold {ScreenPalette.Accent}]{Escape(Elide(current.Name, width - 4))}[/]" + (current.Author is { } author ? $" [{ScreenPalette.Label}]by {Escape(Elide(author, 40))}[/]" : string.Empty)); @@ -176,13 +181,6 @@ internal static string Of(int n, string one, string? many = null) => internal static string Count(int n) => n.ToString(CultureInfo.InvariantCulture); - internal static string Size(long bytes) => bytes switch - { - < 1024 => $"{bytes} B", - < 1024 * 1024 => $"{bytes / 1024.0:0.#} KB", - _ => $"{bytes / (1024.0 * 1024):0.#} MB", - }; - private static string Elide(string text, int width) => text.Length <= width ? text : width <= 1 ? "…" : text[..(width - 1)] + "…"; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs index 570cf5e2..0f67fd3a 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs @@ -1,7 +1,9 @@ using System.IO.Compression; using System.Net.Http; +using System.Security.Cryptography; using System.Text; -using System.Text.Json; +using SharpMUTerm.Client.Packages; +using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; using SharpMUTerm.Core.Packages; @@ -9,8 +11,10 @@ namespace SharpMUTerm.Tui; /// -/// Packages: installing one from a file or an https link through the review, and the Packages screen (F10) -/// that lists, switches off, copies from and removes them. +/// Packages: installing one from a file, an https link or the index through the review, and F10 that lists, switches +/// off, copies from and removes them — as cell screens in a terminal and as the settings window's package page where +/// the host has one. Both surfaces call the same methods here: , +/// , , and one consent path, . /// internal sealed partial class SharpMUTermApp { @@ -25,6 +29,14 @@ internal sealed partial class SharpMUTermApp private int _packageSelected; private bool _confirmRemove; + /// The index as last fetched this run, or null: it is fetched only when the player browses. + private PackageIndex? _packageIndex; + + /// The archive under review and what its review says, until it is installed or dropped. + private (PackageContents Contents, PackageReviewModel Model)? _pendingPackage; + + private PackageManager? _packageManager; + /// How an https package is downloaded; a test supplies one, the client uses . internal Func>? PackageFetch { get; set; } @@ -32,6 +44,21 @@ internal sealed partial class SharpMUTermApp internal PackageStore Packages => _packages; + /// F10's declaration, from the registry. + private PackageCollection PackageDeclaration => Section("packages").Packages ?? BuiltInSettings.Packages.Packages!; + + /// + /// F10 as the window's package page reads it — one per app, so the index fetched and a review waiting outlive the + /// settings window being closed and opened again. + /// + internal PackageManager PackageManager => _packageManager ??= new PackageManager(_config, PackageDeclaration, new PackageHostCalls(this)); + + /// Whether packages are shown in the host's own settings window rather than as cell screens. + private bool NativePackages => Host.NativeSettings is not null; + + /// The review waiting for consent, for a test. + internal PackageReviewModel? PendingPackageReview => _pendingPackage?.Model; + /// Reads the installed packages and hands their sets and media to the rest of the client. private void LoadPackages() { @@ -56,6 +83,13 @@ private void SyncPackages() _packageMedia.Add(folder); } } + + if (_packageIndex is not null) + { + _packageManager?.PublishIndex(_packageIndex, PackageBrowseModel.From(_packageIndex, _packages.Installed, FocusedWorld())); + } + + _packageManager?.NotifyChanged(); } /// /package opens the Packages screen; /package install <file or https link> installs one. @@ -82,6 +116,13 @@ private void PackageCommand(string argument) RefuseCommand("/package, /package browse, or /package install "); } + /// Says why a package step did not happen: on the status row, and on the window's package page. + private void PackageRefused(string reason) + { + RefuseCommand(reason); + _packageManager?.PublishStatus(reason); + } + /// Reads a package from a path or an https link and opens its review. Nothing is written here. internal void InstallPackage(string source) { @@ -138,41 +179,54 @@ internal void InstallPackage(string source) } /// - /// Opens the review for an archive, or says why it is not a package. From an index, the archive must be - /// the one names — its SHA-256, id and version — before anything is shown. + /// Opens the review for an archive, or says why it is not a package. From an index, the archive must be the one + /// names — its SHA-256, id and version — before anything is shown. The review is one + /// model () whichever host draws it, and nothing is written until + /// . /// internal void ReviewPackage(byte[] archive, PackageIndexEntry? listed = null) { if (listed?.Verify(archive, inside: null) is { } mismatch) { - RefuseCommand($"not installed: {mismatch}"); + PackageRefused($"not installed: {mismatch}"); return; } var (contents, problem) = PackageArchive.Read(archive); if (contents is null) { - RefuseCommand($"not installed: {problem}"); + PackageRefused($"not installed: {problem}"); return; } if (listed?.Verify(archive, contents.Manifest) is { } different) { - RefuseCommand($"not installed: {different}"); + PackageRefused($"not installed: {different}"); return; } - if (AnyOverlayOpen && !_packageView.IsOpen) + if (!NativePackages && AnyOverlayOpen && !_packageView.IsOpen) { RefuseCommand($"close {OpenOverlayName()} first"); return; } - var existing = _packages.Find(contents.Manifest.Id); + var model = PackageReviewModel.From( + contents, + PackageCollection.CharactersFor(_config, contents.Manifest), + _packages.Find(contents.Manifest.Id)); + _pendingPackage = (contents, model); + if (NativePackages) + { + PackageManager.PublishReview(model); + TryOpenNativeSettings(Section("packages")); + return; + } + _packageView.Open( "review", - existing is null ? "Install package" : "Update package", - width => PackageScreen.Review(contents, CharactersFor(contents.Manifest), existing, width), + model.Title, + width => PackageScreen.Review(model, width), key => { if (key.Key != ConsoleKey.Enter) @@ -180,22 +234,50 @@ internal void ReviewPackage(byte[] archive, PackageIndexEntry? listed = null) return true; } - if (_packages.Install(contents) is { } failed) - { - RefuseCommand($"not installed: {failed}"); - return false; - } - - SyncPackages(); - SaveConfiguration(); - Notice( - $"Installed {contents.Manifest.Name} {contents.Manifest.Version} · F10 lists your packages", - MessageSeverity.Info, - key: "package"); + AcceptPackage(model); return false; }); } + /// + /// The consent: installs the package described — only while it is still the review + /// waiting — and saves. Both hosts' install buttons end here, and nothing else writes a package. + /// + internal bool AcceptPackage(PackageReviewModel review) + { + if (_pendingPackage is not { } pending || !ReferenceEquals(pending.Model, review)) + { + PackageRefused("that review is no longer open"); + return false; + } + + _pendingPackage = null; + _packageManager?.PublishReview(null); + var manifest = pending.Contents.Manifest; + if (_packages.Install(pending.Contents) is { } failed) + { + PackageRefused($"not installed: {failed}"); + return false; + } + + SyncPackages(); + SaveConfiguration(); + var said = $"Installed {manifest.Name} {manifest.Version} · F10 lists your packages"; + Notice(said, MessageSeverity.Info, key: "package"); + _packageManager?.PublishStatus(said); + return true; + } + + /// Drops the review without writing anything. + internal void CancelPackage(PackageReviewModel review) + { + if (_pendingPackage is { } pending && ReferenceEquals(pending.Model, review)) + { + _pendingPackage = null; + _packageManager?.PublishReview(null); + } + } + /// /// Downloads off the UI thread and hands the bytes back on it, or says why not. /// @@ -221,7 +303,7 @@ private void Fetch(Uri uri, string what, Action then) { if (bytes is null) { - RefuseCommand($"{what} not fetched: {problem}"); + PackageRefused($"{what} not fetched: {problem}"); return; } @@ -232,33 +314,41 @@ private void Fetch(Uri uri, string what, Action then) /// /// Browse packages: fetches the index — only now, never at start — and lists it with the focused world's - /// packages first. ⏎ fetches one, checks it against the index's SHA-256 and opens the review. + /// packages first. In a host with a settings window the list is the package page's Browse tab; otherwise the + /// cell list, where ⏎ fetches one, checks it against the index's SHA-256 and opens the review. /// internal void BrowsePackages() { - if (ComposerIsInTheWay("the packages") || (AnyOverlayOpen && !_packageView.IsOpen && Refuse($"close {OpenOverlayName()} first"))) + if (!NativePackages + && (ComposerIsInTheWay("the packages") || (AnyOverlayOpen && !_packageView.IsOpen && Refuse($"close {OpenOverlayName()} first")))) { return; } if (!Uri.TryCreate(_config.PackageIndexUrl, UriKind.Absolute, out var uri) || uri.Scheme != Uri.UriSchemeHttps) { - RefuseCommand("the package index is not an https link (packageIndexUrl in config.json)"); + PackageRefused("the package index is not an https link (packageIndexUrl in config.json)"); return; } + if (NativePackages) + { + PackageManager.PublishFetching(); + TryOpenNativeSettings(Section("packages")); + } + Fetch(uri, "package index", bytes => { if (bytes.Length > PackageIndex.MaxIndexBytes) { - RefuseCommand("the package index is too large"); + PackageRefused("the package index is too large"); return; } - var (index, problem) = PackageIndex.Parse(System.Text.Encoding.UTF8.GetString(bytes)); + var (index, problem) = PackageIndex.Parse(Encoding.UTF8.GetString(bytes)); if (index is null) { - RefuseCommand($"package index not read: {problem}"); + PackageRefused($"package index not read: {problem}"); return; } @@ -266,6 +356,10 @@ internal void BrowsePackages() }); } + /// Fetches the archive an index entry names and opens its review once it is the archive the entry names. + internal void InstallFromIndex(PackageIndexEntry entry) => + Fetch(new Uri(entry.Url), "package", bytes => ReviewPackage(bytes, entry)); + /// /// The world of the focused window: its session's, else its recorded owner's — so a disconnected /// character's window still names its game. Never _active. @@ -283,15 +377,23 @@ internal void BrowsePackages() : _config.Worlds.FirstOrDefault(w => w.Characters.Any(c => string.Equals($"{w.Name}.{c.Name}", owner, StringComparison.Ordinal))); } + /// The index arrived: kept for the run (so F10 can say which packages have updates), then listed. private void ShowIndex(PackageIndex index) { - var world = FocusedWorld(); - var entries = index.For(world?.Host, world?.Port ?? 0); + _packageIndex = index; + var model = PackageBrowseModel.From(index, _packages.Installed, FocusedWorld()); + if (NativePackages) + { + PackageManager.PublishIndex(index, model); + return; + } + + var entries = model.Rows; _packageSelected = 0; _packageView.Open( "browse", "Browse packages", - width => PackageScreen.Browse(entries, _packages.Installed, _packageSelected, world?.Name, index.Dropped, width), + width => PackageScreen.Browse(model, _packageSelected, width), key => { switch (key.Key) @@ -303,8 +405,7 @@ private void ShowIndex(PackageIndex index) _packageSelected = Math.Min(Math.Max(0, entries.Count - 1), _packageSelected + 1); return true; case ConsoleKey.Enter when entries.Count > 0: - var entry = entries[Math.Clamp(_packageSelected, 0, entries.Count - 1)]; - Fetch(new Uri(entry.Url), "package", bytes => ReviewPackage(bytes, entry)); + InstallFromIndex(entries[Math.Clamp(_packageSelected, 0, entries.Count - 1)].Entry); return false; default: return true; @@ -312,9 +413,18 @@ private void ShowIndex(PackageIndex index) }); } - /// The Packages screen, or closes it. + /// The installed packages as F10 lists them, each with what the index said of it this run. + private IReadOnlyList PackageItems() => PackageCollection.Items(_config, _packageIndex); + + /// The Packages screen — the settings window's package page where the host has one — or closes it. internal void ShowPackages() { + if (NativePackages) + { + TryOpenNativeSettings(Section("packages")); + return; + } + if (_packageView.IsOpen) { _packageView.Close(); @@ -330,12 +440,19 @@ internal void ShowPackages() _confirmRemove = false; _packageView.Open( "list", - "Packages", - width => PackageScreen.List( - _packages.Installed, _config.DisabledPackages, _packageSelected, _confirmRemove, p => CharactersFor(p.Manifest), width), + SectionTitle("packages"), + width => PackageScreen.List(PackageDeclaration, _config, PackageItems(), _packageSelected, _confirmRemove, width), OnPackageKey); } + /// The ids of the fields the cell F10 draws, in order, for a test to hold against the window's. + internal IReadOnlyList CellPackageFields() + { + var drawn = new List(); + PackageScreen.List(PackageDeclaration, _config, PackageItems(), _packageSelected, false, 100, drawn); + return drawn; + } + private bool Refuse(string reason) { RefuseCommand(reason); @@ -344,7 +461,7 @@ private bool Refuse(string reason) private bool OnPackageKey(ConsoleKeyInfo key) { - var installed = _packages.Installed; + var installed = PackageItems(); var confirming = _confirmRemove; _confirmRemove = false; if (key.Key == ConsoleKey.B) @@ -368,28 +485,14 @@ private bool OnPackageKey(ConsoleKeyInfo key) _packageSelected = Math.Min(installed.Count - 1, _packageSelected + 1); break; case ConsoleKey.Spacebar: - if (!_config.DisabledPackages.Remove(current.Id)) - { - _config.DisabledPackages.Add(current.Id); - } - - SyncPackages(); - SaveConfiguration(); + SetPackageEnabled(current.Id, !PackageCollection.IsEnabled(_config, current.Id)); break; case ConsoleKey.C: - CopyPackageSets(current); + CopyPackageSets(current.Id); break; case ConsoleKey.Delete or ConsoleKey.Backspace when confirming: - if (_packages.Remove(current.Id) is { } problem) - { - RefuseCommand(problem); - } - - _config.DisabledPackages.Remove(current.Id); + RemovePackage(current.Id); _packageSelected = Math.Max(0, Math.Min(_packageSelected, _packages.Installed.Count - 1)); - SyncPackages(); - SaveConfiguration(); - Notice($"Removed {current.Manifest.Name}.", MessageSeverity.Info, key: "package"); break; case ConsoleKey.Delete or ConsoleKey.Backspace: _confirmRemove = true; @@ -401,39 +504,81 @@ private bool OnPackageKey(ConsoleKeyInfo key) return true; } + /// Switches a package on or off and saves once — F10's Space and the window's check box. + internal void SetPackageEnabled(string id, bool on) + { + if (_packages.Find(id) is null || !PackageCollection.SetEnabled(_config, id, on)) + { + return; + } + + SyncPackages(); + SaveConfiguration(); + } + + /// Removes a package and its folder and saves — F10's Del Del and the window's Remove. + internal void RemovePackage(string id) + { + if (_packages.Find(id) is not { } package) + { + PackageRefused($"no package '{id}' is installed"); + return; + } + + if (_packages.Remove(id) is { } problem) + { + PackageRefused(problem); + } + + PackageCollection.SetEnabled(_config, id, on: true); + SyncPackages(); + SaveConfiguration(); + var said = $"Removed {package.Manifest.Name}."; + Notice(said, MessageSeverity.Info, key: "package"); + _packageManager?.PublishStatus(said); + } + /// /// Copies a package's sets into the player's own, where F2–F6 can edit them and an update will not /// replace them. A name already taken gets (copy). /// - private void CopyPackageSets(InstalledPackage package) + internal void CopyPackageSets(string id) { - foreach (var set in package.Sets) + if (_packages.Find(id) is not { } package) { - var copy = JsonSerializer.Deserialize( - JsonSerializer.SerializeToUtf8Bytes(set, ConfigurationStore.SerializerOptions), ConfigurationStore.SerializerOptions)!; - var name = set.Name; - for (var n = 1; _config.TriggerSets.Any(s => string.Equals(s.Name, name, StringComparison.OrdinalIgnoreCase)); n++) - { - name = n == 1 ? $"{set.Name} (copy)" : $"{set.Name} (copy {n})"; - } + PackageRefused($"no package '{id}' is installed"); + return; + } - copy.Name = name; - _config.TriggerSets.Add(copy); + foreach (var set in package.Sets) + { + SettingsCollection.CopyToEdit(_config, set); } SaveConfiguration(); - Notice( - $"Copied {package.Sets.Count} set(s) to yours; assign them on F5, and switch the package off (Space) to use only your copy.", - MessageSeverity.Info, - key: "package"); + var said = $"Copied {package.Sets.Count} set(s) to yours; assign them on F5, and switch the package off (Space) to use only your copy."; + Notice(said, MessageSeverity.Info, key: "package"); + _packageManager?.PublishStatus(said); + _packageManager?.NotifyChanged(); } - /// The characters a package would apply to: everyone on a world it is for. - private IReadOnlyList CharactersFor(PackageManifest manifest) => - _config.Worlds - .Where(w => manifest.IsFor(w.Host, w.Port)) - .SelectMany(w => w.Characters.Select(c => $"{c.Name} ({w.Name})")) - .ToList(); + /// The window's package page's gestures, each run on the client's thread. + private sealed class PackageHostCalls(SharpMUTermApp app) : IPackageHost + { + public void SetEnabled(string id, bool on) => app.OnUiThread(() => app.SetPackageEnabled(id, on)); + + public void Remove(string id) => app.OnUiThread(() => app.RemovePackage(id)); + + public void CopySets(string id) => app.OnUiThread(() => app.CopyPackageSets(id)); + + public void Browse() => app.OnUiThread(app.BrowsePackages); + + public void Install(PackageIndexEntry entry) => app.OnUiThread(() => app.InstallFromIndex(entry)); + + public void Accept(PackageReviewModel review) => app.OnUiThread(() => app.AcceptPackage(review)); + + public void Cancel(PackageReviewModel review) => app.OnUiThread(() => app.CancelPackage(review)); + } /// /// The snapshot's packages, built as archives and read through like any @@ -479,8 +624,61 @@ internal static byte[] DemoPackage(string id, string name, string version, strin """, "Health warnings, a tells window and the status gauges."); + private static readonly byte[] DemoColours = DemoPackage( + "mush.colours", + "MUSH colour names", + "0.3.1", + "\"*\"", + """{"name":"MUSH colours","triggers":[{"name":"pages","pattern":"^From afar","actions":{"spawnTarget":"Pages"}}]}""", + "Highlights pages and channel names on any game."); + + private static readonly byte[] DemoGrapevine = DemoPackage( + "grapevine.channels", "Grapevine channels", "2.0.0", "\"grapevine.haus\"", + """{"name":"Grapevine channels","triggers":[{"name":"gossip","pattern":"^\\[gossip\\]","actions":{"spawnTarget":"Gossip"}}]}""", + "Puts each Grapevine channel in a window of its own."); + + private static readonly byte[] DemoMapper = DemoPackage( + "aetherfall.mapper", "Aetherfall mapper rooms", "0.9.0", "\"aetherfall.mux\"", + """{"name":"Aetherfall mapper","triggers":[{"name":"exits","pattern":"^Obvious exits:","actions":{}}]}""", + "Reads room names and exits for the map."); + + /// The demo's index: four packages, the files it names served by , and one broken entry. + private static string DemoIndex() => $$""" + {"packages":[ + {"id":"mush.colours","name":"MUSH colour names","version":"0.3.1","games":["*"], + "description":"Highlights pages and channel names on any game.", + "url":"https://packages.example/mush-colours-0.3.1.zip","sha256":"{{Sha(DemoColours)}}"}, + {"id":"grapevine.channels","name":"Grapevine channels","version":"2.0.0","games":["grapevine.haus"], + "description":"Puts each Grapevine channel in a window of its own.", + "url":"https://packages.example/grapevine-channels-2.0.0.zip","sha256":"{{Sha(DemoGrapevine)}}"}, + {"id":"aetherfall.basics","name":"Aetherfall basics","version":"1.2.0","author":"the Aetherfall builders", + "games":["aetherfall.mux:4201"],"description":"Health warnings, a tells window and the status gauges.", + "url":"https://packages.example/aetherfall-basics-1.2.0.zip","sha256":"{{Sha(DemoBasics)}}"}, + {"id":"aetherfall.mapper","name":"Aetherfall mapper rooms","version":"0.9.0","games":["aetherfall.mux"], + "description":"Reads room names and exits for the map.", + "url":"https://packages.example/aetherfall-mapper-0.9.0.zip","sha256":"{{Sha(DemoMapper)}}"}, + {"id":"bad","name":"Bad","version":"1","games":["*"],"url":"http://x","sha256":"x"}]} + """; + + private static string Sha(byte[] bytes) => Convert.ToHexStringLower(SHA256.HashData(bytes)); + + /// + /// The demo's network: the index and the four archives it names, from memory. Only the demo scene sets it, so a + /// window demo can browse and install for real without a byte leaving the machine. + /// + private static Task DemoFetch(Uri uri, CancellationToken token) => Task.FromResult(uri.AbsolutePath switch + { + var p when p.EndsWith("index.json", StringComparison.Ordinal) => Encoding.UTF8.GetBytes(DemoIndex()), + "/mush-colours-0.3.1.zip" => DemoColours, + "/grapevine-channels-2.0.0.zip" => DemoGrapevine, + "/aetherfall-basics-1.2.0.zip" => DemoBasics, + "/aetherfall-mapper-0.9.0.zip" => DemoMapper, + _ => null, + }); + private void LoadDemoPackages(string view) { + PackageFetch ??= DemoFetch; if (view == "package-review") { ReviewPackage(DemoBasics); @@ -493,33 +691,18 @@ private void LoadDemoPackages(string view) _packages.Install(PackageArchive.Read(DemoPackage( "aetherfall.basics", "Aetherfall basics", "1.1.0", "\"aetherfall.mux:4201\"", """{"name":"Aetherfall basics"}""", "")).Contents!); SyncPackages(); - var hash = new string('0', 64); - var (index, _) = PackageIndex.Parse($$""" - {"packages":[ - {"id":"mush.colours","name":"MUSH colour names","version":"0.3.1","games":["*"], - "description":"Highlights pages and channel names on any game.", - "url":"https://packages.example/mush-colours-0.3.1.zip","sha256":"{{hash}}"}, - {"id":"grapevine.channels","name":"Grapevine channels","version":"2.0.0","games":["grapevine.haus"], - "url":"https://packages.example/grapevine-channels-2.0.0.zip","sha256":"{{hash}}"}, - {"id":"aetherfall.basics","name":"Aetherfall basics","version":"1.2.0","author":"the Aetherfall builders", - "games":["aetherfall.mux:4201"],"description":"Health warnings, a tells window and the status gauges.", - "url":"https://packages.example/aetherfall-basics-1.2.0.zip","sha256":"{{hash}}"}, - {"id":"aetherfall.mapper","name":"Aetherfall mapper rooms","version":"0.9.0","games":["aetherfall.mux"], - "url":"https://packages.example/aetherfall-mapper-0.9.0.zip","sha256":"{{hash}}"}, - {"id":"bad","name":"Bad","version":"1","games":["*"],"url":"http://x","sha256":"x"}]} - """); - ShowIndex(index!); + if (NativePackages) + { + PackageManager.PublishFetching(); + TryOpenNativeSettings(Section("packages")); + } + + ShowIndex(PackageIndex.Parse(DemoIndex()).Index!); return; } _packages.Install(PackageArchive.Read(DemoBasics).Contents!); - _packages.Install(PackageArchive.Read(DemoPackage( - "mush.colours", - "MUSH colour names", - "0.3.1", - "\"*\"", - """{"name":"MUSH colours","triggers":[{"name":"pages","pattern":"^From afar","actions":{"spawnTarget":"Pages"}}]}""", - "Highlights pages and channel names on any game.")).Contents!); + _packages.Install(PackageArchive.Read(DemoColours).Contents!); _config.DisabledPackages.Add("mush.colours"); SyncPackages(); ShowPackages(); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs index 480b8e65..170ce1a0 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs @@ -57,7 +57,7 @@ private SettingsSearchHost SettingsSearchHost() => /// private bool GoToSetting(SettingsMatch match, bool native) { - if (string.Equals(match.Section.Id, "packages", StringComparison.Ordinal)) + if (string.Equals(match.Section.Id, "packages", StringComparison.Ordinal) && !(native && NativePackages)) { _settings.CloseAll(); ShowPackages(); @@ -101,15 +101,19 @@ private bool GoToSetting(SettingsMatch match, bool native) /// private void OpenSettingsScreen(ConsoleKey key, Func open) { - var name = key.ToString(); - var section = _contributions.SettingsSections.Ordered - .FirstOrDefault(s => string.Equals(s.Key, name, StringComparison.Ordinal)); - if (!TryOpenNativeSettings(section)) + if (!TryOpenNativeSettings(SectionForKey(key))) { _settings.Toggle(key, open); } } + /// The declared section a settings screen's F-key opens, or null. + private SettingsSectionContribution? SectionForKey(ConsoleKey key) + { + var name = key.ToString(); + return _contributions.SettingsSections.Ordered.FirstOrDefault(s => string.Equals(s.Key, name, StringComparison.Ordinal)); + } + /// /// Shows in the host's settings window, closing any cell screen first; false when the /// host has none (the terminal, the snapshot, the tests) or the section declares no fields, which keep their @@ -178,7 +182,10 @@ internal SettingsForm NativeSettingsForm(string initial, object? item = null) world, character, ListContext(), - item); + item) + { + Packages = PackageManager, + }; return form; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index cc05b185..db3eabe4 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -2221,6 +2221,15 @@ public string RenderSnapshot(string? view = null) var screenView = editing ? view![..^EditViewSuffix.Length] : view; if (screenView is not null && SettingsView(screenView) is { } screen) { + // A host with its own settings window (the desktop's demo) shows a screen's --view there, the way its + // F-key would; an -edit view drives cell keys, so it stays a cell screen. The snapshot and the parity + // harness attach no settings window, so their frames are the cells as before. + if (!editing && TryOpenNativeSettings(SectionForKey(screen.Key))) + { + SyncInputWidth(); + return RenderFrame(); + } + _settings.OpenForSnapshot(screen.Key, screen.Open()); if (editing) { diff --git a/tests/SharpMUTerm.Avalonia.Tests/PackagePageTests.cs b/tests/SharpMUTerm.Avalonia.Tests/PackagePageTests.cs new file mode 100644 index 00000000..dc9ddb4c --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/PackagePageTests.cs @@ -0,0 +1,224 @@ +using System.IO.Compression; +using System.Text; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Threading; +using SharpMUTerm.Client.Packages; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Packages; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// F10 in the settings window (): the declared fields — the same the cell screen draws — +/// every gesture handed to the client and none performed here, the index fetched only from the Browse tab, and the +/// review drawn from the model the cell review draws, with Install the only way to consent. +/// +public class PackagePageTests +{ + private static PackageContents Contents() + { + using var buffer = new MemoryStream(); + using (var zip = new ZipArchive(buffer, ZipArchiveMode.Create, leaveOpen: true)) + { + foreach (var (name, text) in new[] + { + ("package.json", """{"id":"aether.basics","name":"Aether basics","version":"1.0.0","author":"builders","description":"Warnings.","games":["aetherfall.example:4000"]}"""), + ("sets/basics.json", """{"name":"Basics","triggers":[{"name":"hp","pattern":"^HP low","actions":{"sendResponse":"quaff"}}]}"""), + ("scripts/basics.lua", "x = 1"), + }) + { + using var stream = zip.CreateEntry(name).Open(); + stream.Write(Encoding.UTF8.GetBytes(text)); + } + } + + return PackageArchive.Read(buffer.ToArray()).Contents!; + } + + private sealed class Calls : IPackageHost + { + public List Log { get; } = []; + + public void SetEnabled(string id, bool on) => Log.Add($"enable {id} {on}"); + + public void Remove(string id) => Log.Add($"remove {id}"); + + public void CopySets(string id) => Log.Add($"copy {id}"); + + public void Browse() => Log.Add("browse"); + + public void Install(PackageIndexEntry entry) => Log.Add($"install {entry.Id}"); + + public void Accept(PackageReviewModel review) => Log.Add($"accept {review.Name}"); + + public void Cancel(PackageReviewModel review) => Log.Add($"cancel {review.Name}"); + } + + private sealed class Harness + { + public Harness() + { + Config.Worlds.Add(new WorldDefinition + { + Name = "Aetherfall", + Host = "aetherfall.example", + Port = 4000, + Characters = { new CharacterDefinition { Name = "Corvid" } }, + }); + var store = new PackageStore(); + store.Install(Contents()); + Config.Packages = store.Installed; + Manager = new PackageManager(Config, BuiltInSettings.Packages.Packages!, Calls); + } + + public AppConfiguration Config { get; } = new(); + + public Calls Calls { get; } = new(); + + public PackageManager Manager { get; } + + public SettingsForm Form() => new( + BuiltInSettings.All, + Config, + change => change(), + _ => { }, + "packages", + isDark: true) + { + Packages = Manager, + }; + } + + private static void Click(Button button) + { + button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); + Dispatcher.UIThread.RunJobs(); + } + + [Test] + public async Task ThePageDrawsTheDeclaredFieldsTheCellScreenDraws() + { + var harness = new Harness(); + var (shown, values) = await Run(harness, window => (window.ShownFields.ToArray(), window.PackagePage!.Values)); + var cells = new List(); + PackageScreen.List( + BuiltInSettings.Packages.Packages!, harness.Config, PackageCollection.Items(harness.Config, null), 0, false, 100, cells); + + await Assert.That(shown).IsEquivalentTo(cells, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(shown).IsEquivalentTo(BuiltInSettings.Packages.Packages!.Fields.Select(f => f.Id), TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(values["scripts"]).IsEqualTo("basics.lua"); + await Assert.That(values["characters"]).IsEqualTo("Corvid (Aetherfall)"); + } + + [Test] + public async Task TheSwitchCopyAndRemoveAreHandedToTheClient() + { + var harness = new Harness(); + var (afterOneRemove, log) = await Run(harness, window => + { + var page = window.PackagePage!; + page.Rows.Single().Switch.IsChecked = false; + Dispatcher.UIThread.RunJobs(); + Click(page.CopyButton!); + Click(page.RemoveButton!); + var asked = harness.Calls.Log.Count(l => l.StartsWith("remove", StringComparison.Ordinal)); + Click(page.RemoveButton!); + return (asked, harness.Calls.Log.ToArray()); + }); + + await Assert.That(afterOneRemove).IsEqualTo(0).Because("the first press asks, as Del does on the cell screen"); + await Assert.That(log).IsEquivalentTo(new[] { "enable aether.basics False", "copy aether.basics", "remove aether.basics" }, + TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(harness.Config.DisabledPackages).IsEmpty().Because("the page writes nothing itself"); + } + + [Test] + public async Task TheIndexIsFetchedOnlyFromTheBrowseTab() + { + var harness = new Harness(); + var (before, fetch, after) = await Run(harness, window => + { + var page = window.PackagePage!; + var opened = harness.Calls.Log.ToArray(); + page.BrowseTab.IsSelected = true; + Dispatcher.UIThread.RunJobs(); + var button = page.FetchButton is not null; + Click(page.FetchButton!); + return (opened, button, harness.Calls.Log.ToArray()); + }); + + await Assert.That(before).IsEmpty(); + await Assert.That(fetch).IsTrue(); + await Assert.That(after).IsEquivalentTo(new[] { "browse" }); + } + + [Test] + public async Task TheBrowseListComesForwardWhenTheIndexIsAskedForAndInstallIsHandedToTheClient() + { + var harness = new Harness(); + var (browsing, rows, log) = await Run(harness, window => + { + var page = window.PackagePage!; + var (index, _) = PackageIndex.Parse($$""" + {"packages":[{"id":"aether.basics","name":"Aether basics","version":"1.1.0","games":["aetherfall.example"], + "url":"https://p.example/a.zip","sha256":"{{new string('a', 64)}}"}]} + """); + harness.Manager.PublishFetching(); + harness.Manager.PublishIndex(index!, PackageBrowseModel.From(index!, harness.Config.Packages, harness.Config.Worlds[0])); + page.Refresh(); + Dispatcher.UIThread.RunJobs(); + Click(page.InstallButton!); + return (page.Browsing, harness.Manager.Items.Single().Update, harness.Calls.Log.ToArray()); + }); + + await Assert.That(browsing).IsTrue(); + await Assert.That(rows).IsEqualTo("1.1.0"); + await Assert.That(log).IsEquivalentTo(new[] { "install aether.basics" }); + } + + [Test] + public async Task TheReviewIsTheModelsRowsAndInstallIsTheConsent() + { + var harness = new Harness(); + var model = PackageReviewModel.From(Contents(), ["Corvid (Aetherfall)"], harness.Config.Packages.Single()); + var (lines, shown, log, gone) = await Run(harness, window => + { + var page = window.PackagePage!; + harness.Manager.PublishReview(model); + page.Refresh(); + var drawn = page.ReviewLines.ToArray(); + var on = page.ShownReview; + Click(page.AcceptButton!); + var calls = harness.Calls.Log.ToArray(); + harness.Manager.PublishReview(null); + page.Refresh(); + return (drawn, on, calls, page.ShownReview is null); + }); + + var expected = model.Sections.SelectMany(s => new[] { s.Heading }.Concat(s.Rows.Select(r => r.Label.Length == 0 ? r.Value : $"{r.Label}: {r.Value}"))); + await Assert.That(lines).IsEquivalentTo(expected, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(lines[0]).IsEqualTo(PackageReviewModel.ActsHeading); + await Assert.That(ReferenceEquals(shown, model)).IsTrue(); + await Assert.That(log).IsEquivalentTo(new[] { "accept Aether basics" }); + await Assert.That(gone).IsTrue(); + } + + private static Task Run(Harness harness, Func body) => + TerminalViewTests.Session.Dispatch(() => + { + var window = new SettingsWindow(harness.Form()); + window.Show(); + Dispatcher.UIThread.RunJobs(); + try + { + return body(window); + } + finally + { + window.Close(); + } + }, CancellationToken.None); +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs index f4bf0a9a..649cb3a5 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -24,11 +24,14 @@ private sealed class Harness public List Opened { get; } = []; + /// The sections the form lists; every built-in one is declared now, so a test adds one that is not. + public IReadOnlyList Sections { get; init; } = BuiltInSettings.All; + public SettingsForm Form(string initial = "text") { SettingsForm? form = null; form = new SettingsForm( - BuiltInSettings.All, + Sections, Config, change => { @@ -147,16 +150,19 @@ public async Task TheMeterTableHasARowPerMeterAndReadsNow() [Test] public async Task AnUndeclaredSectionOpensItsOwnScreen() { - var harness = new Harness(); + var harness = new Harness + { + Sections = [.. BuiltInSettings.All, new SettingsSectionContribution { Id = "elsewhere", Title = "Elsewhere", Key = "F11", Order = 95 }], + }; var shown = await Run(harness, "text", window => { - var item = window.SectionList.Items.OfType().Single(i => Equals(i.Tag, "packages")); + var item = window.SectionList.Items.OfType().Single(i => Equals(i.Tag, "elsewhere")); window.SectionList.SelectedItem = item; Dispatcher.UIThread.RunJobs(); return window.ShownSection; }); - await Assert.That(harness.Opened).IsEquivalentTo(new[] { "packages" }); + await Assert.That(harness.Opened).IsEquivalentTo(new[] { "elsewhere" }); await Assert.That(shown).IsEqualTo("text"); } diff --git a/tests/SharpMUTerm.Client.Tests/PackageSettingsTests.cs b/tests/SharpMUTerm.Client.Tests/PackageSettingsTests.cs new file mode 100644 index 00000000..4a19f487 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/PackageSettingsTests.cs @@ -0,0 +1,242 @@ +using System.IO.Compression; +using System.Text; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Packages; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Packages; + +namespace SharpMUTerm.Client.Tests; + +/// +/// F10 declared: the packages as a list section with its fields and actions, the one binding it writes +/// (DisabledPackages, replaced), the review model both hosts draw, the browse model, and the manager the window +/// reads — which fetches nothing on its own and hands every gesture to the client. +/// +public class PackageSettingsTests +{ + private static PackageContents Contents(string id, string name, string version, string games, string set, bool script) + { + using var buffer = new MemoryStream(); + using (var zip = new ZipArchive(buffer, ZipArchiveMode.Create, leaveOpen: true)) + { + var entries = new List<(string, string)> + { + ("package.json", $$"""{"id":"{{id}}","name":"{{name}}","version":"{{version}}","games":[{{games}}]}"""), + ("sets/main.json", set), + }; + if (script) + { + entries.Add(("scripts/main.lua", "x = 1")); + } + + foreach (var (entry, text) in entries) + { + using var stream = zip.CreateEntry(entry).Open(); + stream.Write(Encoding.UTF8.GetBytes(text)); + } + } + + return PackageArchive.Read(buffer.ToArray()).Contents!; + } + + private const string SendingSet = """ + {"name":"Basics","triggers":[{"name":"hp","pattern":"^HP low","actions":{"sendResponse":"quaff"}}]} + """; + + private static (AppConfiguration Config, PackageStore Store) Installed() + { + var config = new AppConfiguration(); + config.Worlds.Add(new WorldDefinition + { + Name = "Aetherfall", + Host = "aetherfall.example", + Port = 4000, + Characters = { new CharacterDefinition { Name = "Corvid" } }, + }); + var store = new PackageStore(); + store.Install(Contents("aether.basics", "Aether basics", "1.0.0", "\"aetherfall.example:4000\"", SendingSet, script: true)); + config.Packages = store.Installed; + return (config, store); + } + + private sealed class Calls : IPackageHost + { + public List Log { get; } = []; + + public void SetEnabled(string id, bool on) => Log.Add($"enable {id} {on}"); + + public void Remove(string id) => Log.Add($"remove {id}"); + + public void CopySets(string id) => Log.Add($"copy {id}"); + + public void Browse() => Log.Add("browse"); + + public void Install(PackageIndexEntry entry) => Log.Add($"install {entry.Id}"); + + public void Accept(PackageReviewModel review) => Log.Add($"accept {review.Name}"); + + public void Cancel(PackageReviewModel review) => Log.Add($"cancel {review.Name}"); + } + + [Test] + public async Task F10IsDeclaredAsAListOfPackagesWithItsFieldsAndActions() + { + var section = BuiltInSettings.Packages; + var packages = section.Packages!; + + await Assert.That(BuiltInSettings.All).Contains(section); + await Assert.That(SettingsForm.IsDeclared(section)).IsTrue(); + await Assert.That(section.Key).IsEqualTo("F10"); + await Assert.That(section.Scope).IsEqualTo(SettingScope.Item); + await Assert.That(packages.Fields.Select(f => f.Id)).IsEquivalentTo( + new[] { "enabled", "name", "version", "games", "author", "description", "sets", "scripts", "media", "update", "characters" }); + await Assert.That(packages.Actions.Select(a => a.Id)).IsEquivalentTo( + new[] { PackageCollection.Toggle, PackageCollection.CopySets, PackageCollection.Remove, PackageCollection.Browse }); + await Assert.That(packages.Fields.All(f => f.Group is not null)).IsTrue(); + } + + [Test] + public async Task TheSearchFindsAPackagesFields() + { + var matches = SettingsSearch.Find(BuiltInSettings.All, "lua"); + + await Assert.That(matches.Any(m => m.Section.Id == "packages" && m.Field?.Id == "scripts")).IsTrue(); + } + + [Test] + public async Task TheFieldsSayWhatThePackageIsAndAdds() + { + var (config, _) = Installed(); + var item = PackageCollection.Items(config, null).Single(); + var packages = BuiltInSettings.Packages.Packages!; + string Read(string id) => ((InfoField)packages.Field(id)).Read(new SettingTarget(config, Item: item)); + + await Assert.That(Read("version")).IsEqualTo("1.0.0"); + await Assert.That(Read("games")).IsEqualTo("aetherfall.example:4000"); + await Assert.That(Read("sets")).IsEqualTo("Basics · 1 rule"); + await Assert.That(Read("scripts")).IsEqualTo("main.lua"); + await Assert.That(Read("media")).IsEqualTo("none"); + await Assert.That(Read("characters")).IsEqualTo("Corvid (Aetherfall)"); + await Assert.That(Read("update")).Contains("not checked"); + } + + [Test] + public async Task AnIndexWithANewerVersionIsAnUpdate() + { + var (config, _) = Installed(); + var (index, _) = PackageIndex.Parse($$""" + {"packages":[{"id":"aether.basics","name":"Aether basics","version":"1.1.0","games":["*"], + "url":"https://p.example/a.zip","sha256":"{{new string('a', 64)}}"}]} + """); + + var item = PackageCollection.Items(config, index).Single(); + + await Assert.That(item.Update).IsEqualTo("1.1.0"); + await Assert.That(((InfoField)BuiltInSettings.Packages.Packages!.Field("update")).Read(new SettingTarget(config, Item: item))) + .IsEqualTo("1.1.0 in the index"); + } + + [Test] + public async Task SwitchingAPackageOffReplacesTheListAndItsSetsStopApplying() + { + var (config, _) = Installed(); + var character = config.Worlds[0].Characters[0]; + var item = PackageCollection.Items(config, null).Single(); + var enabled = (SettingBinding)BuiltInSettings.Packages.Packages!.Field("enabled").Binding!; + var before = config.DisabledPackages; + await Assert.That(config.ResolveTriggerSets(character, config.Worlds[0]).Select(s => s.Name)).Contains("Basics"); + + enabled.Set(new SettingTarget(config, Item: item), false); + + await Assert.That(ReferenceEquals(before, config.DisabledPackages)).IsFalse().Because("lists are replaced, never edited"); + await Assert.That(config.DisabledPackages).Contains("aether.basics"); + await Assert.That(config.ResolveTriggerSets(character, config.Worlds[0]).Select(s => s.Name)).DoesNotContain("Basics"); + await Assert.That(PackageCollection.SetEnabled(config, "aether.basics", false)).IsFalse().Because("already off"); + } + + [Test] + public async Task TheReviewLeadsWithWhatCanActAsThePlayer() + { + var contents = Contents("aether.basics", "Aether basics", "1.0.0", "\"*\"", SendingSet, script: true); + + var review = PackageReviewModel.From(contents, ["Corvid (Aetherfall)"], existing: null); + + await Assert.That(review.Title).IsEqualTo("Install package"); + await Assert.That(review.Acts).IsTrue(); + await Assert.That(review.Sections.Select(s => s.Heading)).IsEquivalentTo( + new[] { PackageReviewModel.ActsHeading, PackageReviewModel.AddsHeading, PackageReviewModel.WhoHeading }); + var acts = review.Sections[0].Rows; + await Assert.That(acts[0].Value).IsEqualTo("1 rule sends commands as you"); + await Assert.That(acts[0].Tone).IsEqualTo(PackageReviewTone.Warning); + await Assert.That(acts[1].Value).Contains("main.lua"); + await Assert.That(acts[2].Tone).IsEqualTo(PackageReviewTone.Warning); + } + + [Test] + public async Task AQuietPackageSaysNothingActsAsThePlayerAndAnUpdateNamesWhatItReplaces() + { + var (config, store) = Installed(); + var contents = Contents("aether.basics", "Aether basics", "2.0.0", "\"*\"", """{"name":"Quiet","triggers":[{"name":"x","pattern":"^x"}]}""", script: false); + + var review = PackageReviewModel.From(contents, [], store.Find("aether.basics")); + + await Assert.That(review.Acts).IsFalse(); + await Assert.That(review.Title).IsEqualTo("Update package"); + await Assert.That(review.Replaces).IsEqualTo("1.0.0"); + await Assert.That(review.Sections[0].Rows[0].Tone).IsEqualTo(PackageReviewTone.Quiet); + await Assert.That(review.Sections[2].Rows[1].Value).IsEqualTo("none of yours, yet"); + _ = config; + } + + [Test] + public async Task TheBrowseListPutsTheWorldsOwnFirstAndSaysWhatIsInstalled() + { + var (config, store) = Installed(); + var hash = new string('a', 64); + var (index, _) = PackageIndex.Parse($$""" + {"packages":[ + {"id":"any.thing","name":"Any thing","version":"1.0.0","games":["*"],"url":"https://p.example/1.zip","sha256":"{{hash}}"}, + {"id":"aether.basics","name":"Aether basics","version":"1.1.0","games":["aetherfall.example"],"url":"https://p.example/2.zip","sha256":"{{hash}}"}, + {"id":"bad","name":"Bad","version":"1","games":["*"],"url":"http://x","sha256":"x"}]} + """); + + var model = PackageBrowseModel.From(index!, store.Installed, config.Worlds[0]); + + await Assert.That(model.World).IsEqualTo("Aetherfall"); + await Assert.That(model.Dropped).IsEqualTo(1); + await Assert.That(model.Rows.Select(r => r.Entry.Id)).IsEquivalentTo(new[] { "aether.basics", "any.thing" }); + await Assert.That(model.Rows[0].ForWorld).IsTrue(); + await Assert.That(model.Rows[0].State).IsEqualTo(PackageBrowseState.Update); + await Assert.That(model.Rows[0].StateText).IsEqualTo("installed 1.0.0, update"); + await Assert.That(model.Rows[1].ForWorld).IsFalse().Because("a * package is not the world's own"); + } + + [Test] + public async Task TheManagerFetchesNothingByItselfAndHandsEveryGestureToTheClient() + { + var (config, _) = Installed(); + var calls = new Calls(); + var manager = new PackageManager(config, BuiltInSettings.Packages.Packages!, calls); + var item = manager.Items.Single(); + + await Assert.That(calls.Log).IsEmpty(); + await Assert.That(manager.Index).IsNull(); + manager.Accept(); // nothing to accept + await Assert.That(calls.Log).IsEmpty(); + + manager.SetEnabled(item, false); + manager.CopySets(item); + manager.Remove(item); + manager.Browse(); + var review = PackageReviewModel.From(Contents("x", "X", "1.0.0", "\"*\"", SendingSet, false), [], null); + manager.PublishReview(review); + manager.Accept(); + manager.Cancel(); + + await Assert.That(calls.Log).IsEquivalentTo(new[] + { + "enable aether.basics False", "copy aether.basics", "remove aether.basics", "browse", "accept X", "cancel X", + }); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/NativePackagesTests.cs b/tests/SharpMUTerm.Tui.Tests/NativePackagesTests.cs new file mode 100644 index 00000000..793cd1ff --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NativePackagesTests.cs @@ -0,0 +1,407 @@ +using System.IO.Compression; +using System.Security.Cryptography; +using System.Text; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Packages; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Packages; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// F10 from its declaration in both hosts: the cell screen draws the declared fields, a host with a settings window +/// opens its package page instead, switching and removing save once through the same methods either way, the review +/// is one model with nothing written before it is accepted, the index is fetched only when asked and an archive that is +/// not the one listed never reaches the review; and a settings --view goes to the window when one is attached. +/// +[NotInParallel] +public class NativePackagesTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private const string Manifest = """ + {"id":"aether.basics","name":"Aether basics","version":"1.0.0","games":["aetherfall.example:4000"]} + """; + + private const string Set = """ + {"name":"Basics","triggers":[{"name":"hp","pattern":"^HP low","actions":{"sendResponse":"quaff"}}]} + """; + + private static byte[] Archive() + { + using var buffer = new MemoryStream(); + using (var zip = new ZipArchive(buffer, ZipArchiveMode.Create, leaveOpen: true)) + { + foreach (var (name, text) in new[] { ("package.json", Manifest), ("sets/basics.json", Set), ("scripts/basics.lua", "x = 1"), ("media/bell.ogg", "OggS") }) + { + using var stream = zip.CreateEntry(name).Open(); + stream.Write(Encoding.UTF8.GetBytes(text)); + } + } + + return buffer.ToArray(); + } + + private sealed class Presenter : INativeSettings + { + public List Shown { get; } = []; + + public void Show(SettingsForm form) => Shown.Add(form); + + public void Close() + { + } + } + + private sealed class Rig : IAsyncDisposable + { + public required SharpMUTermApp App { get; init; } + + public required AppConfiguration Config { get; init; } + + public required string Root { get; init; } + + public required Presenter Native { get; init; } + + public int Saves { get; set; } + + public int Fetches; + + public CharacterDefinition Character => Config.Worlds[0].Characters[0]; + + public bool Applies => Config.ResolveTriggerSets(Character, Config.Worlds[0]).Any(s => s.Name == "Basics"); + + public async ValueTask DisposeAsync() + { + await App.DisposeAsync(); + Directory.Delete(Root, recursive: true); + } + } + + private static Rig Open(bool native, string? sha = null) + { + Console.SetIn(TextReader.Null); + var root = Directory.CreateTempSubdirectory("sharpmuterm-nativepkg-").FullName; + var config = new AppConfiguration(); + config.Worlds.Add(new WorldDefinition + { + Name = "Aetherfall", + Host = "aetherfall.example", + Port = 4000, + Characters = { new CharacterDefinition { Name = "Corvid", Logging = new LoggingSettings() } }, + }); + + var presenter = new Presenter(); + Rig? rig = null; + var host = ClientHost.ForHarness(Caps, new HeadlessConsoleDriver(120, 32), null, null, null) with + { + NativeSettings = native ? presenter : null, + }; + var app = new SharpMUTermApp(config, host, save: _ => rig!.Saves++, packages: new PackageStore(Path.Combine(root, "packages"))); + rig = new Rig { App = app, Config = config, Root = root, Native = presenter }; + var archive = Archive(); + app.PackageFetch = (uri, _) => + { + Interlocked.Increment(ref rig!.Fetches); + return Task.FromResult(uri.AbsolutePath.EndsWith("index.json", StringComparison.Ordinal) + ? Encoding.UTF8.GetBytes(Index(archive, sha)) + : archive); + }; + return rig; + } + + private static string Index(byte[] archive, string? sha) => $$""" + {"packages":[ + {"id":"aether.basics","name":"Aether basics","version":"1.0.0","games":["aetherfall.example:4000"], + "url":"https://packages.example/basics.zip", + "sha256":"{{sha ?? Convert.ToHexStringLower(SHA256.HashData(archive))}}"}]} + """; + + private static async Task Until(Func condition) + { + for (var i = 0; i < 300 && !condition(); i++) + { + await Task.Delay(10); + } + } + + private static ConsoleKeyInfo Key(ConsoleKey key, char ch = '\0') => new(ch, key, false, false, false); + + private static IReadOnlyList Flatten(PackageReviewModel model) => + new[] { model.Title, model.Name, model.Version, model.Author ?? string.Empty, model.Replaces ?? string.Empty, model.Description ?? string.Empty } + .Concat(model.Sections.SelectMany(s => new[] { s.Heading }.Concat(s.Rows.Select(r => $"{r.Label}|{r.Value}|{r.Tone}")))) + .ToList(); + + private static void Install(Rig rig) + { + rig.App.ReviewPackage(Archive()); + if (rig.App.PackageView.IsOpen) + { + rig.App.PackageView.SimulateKey(Key(ConsoleKey.Enter, '\r')); + } + else + { + rig.App.AcceptPackage(rig.App.PendingPackageReview!); + } + } + + [Test] + public async Task TheCellScreenDrawsEveryDeclaredField() + { + await using var rig = Open(native: false); + Install(rig); + + var drawn = rig.App.CellPackageFields(); + + await Assert.That(drawn).IsEquivalentTo(BuiltInSettings.Packages.Packages!.Fields.Select(f => f.Id), TUnit.Assertions.Enums.CollectionOrdering.Matching); + } + + [Test] + public async Task F10OpensTheWindowsPackagePageAndNoCellScreen() + { + await using var rig = Open(native: true); + + rig.App.SimulateKey(Key(ConsoleKey.F10)); + + var form = rig.Native.Shown.Single(); + await Assert.That(form.Initial).IsEqualTo("packages"); + await Assert.That(form.Packages).IsNotNull(); + await Assert.That(rig.App.PackageView.IsOpen).IsFalse(); + } + + [Test] + public async Task SwitchingOffInTheWindowSavesOnceAndTheSetsStopApplying() + { + await using var rig = Open(native: true); + Install(rig); + var saves = rig.Saves; + var manager = rig.App.PackageManager; + await Assert.That(rig.Applies).IsTrue(); + + manager.SetEnabled(manager.Items.Single(), false); + + await Assert.That(rig.Saves - saves).IsEqualTo(1); + await Assert.That(rig.Applies).IsFalse(); + + manager.SetEnabled(manager.Items.Single(), true); + await Assert.That(rig.Saves - saves).IsEqualTo(2); + await Assert.That(rig.Applies).IsTrue(); + } + + [Test] + public async Task SwitchingOffOnTheCellScreenSavesOnceAndTheSetsStopApplying() + { + await using var rig = Open(native: false); + Install(rig); + rig.App.ShowPackages(); + var saves = rig.Saves; + + rig.App.PackageView.SimulateKey(Key(ConsoleKey.Spacebar, ' ')); + + await Assert.That(rig.Saves - saves).IsEqualTo(1); + await Assert.That(rig.Applies).IsFalse(); + } + + [Test] + public async Task RemovingInTheWindowDeletesThePackageAndItsFolder() + { + await using var rig = Open(native: true); + Install(rig); + await Assert.That(Directory.Exists(Path.Combine(rig.Root, "packages", "aether.basics"))).IsTrue(); + var manager = rig.App.PackageManager; + var changes = 0; + manager.Changed += () => changes++; + + manager.Remove(manager.Items.Single()); + + await Assert.That(rig.App.Packages.Installed).IsEmpty(); + await Assert.That(manager.Items).IsEmpty(); + await Assert.That(Directory.Exists(Path.Combine(rig.Root, "packages", "aether.basics"))).IsFalse(); + await Assert.That(rig.Applies).IsFalse(); + await Assert.That(manager.Status).Contains("Removed Aether basics"); + await Assert.That(changes).IsGreaterThan(0); + } + + [Test] + public async Task CopyInTheWindowMakesTheSetsThePlayersOwn() + { + await using var rig = Open(native: true); + Install(rig); + + rig.App.PackageManager.CopySets(rig.App.PackageManager.Items.Single()); + + await Assert.That(rig.Config.TriggerSets.Single(s => s.Name == "Basics").Triggers.Single().Name).IsEqualTo("hp"); + } + + [Test] + public async Task TheReviewIsOneModelInBothHostsAndNothingIsWrittenBeforeItIsAccepted() + { + await using var cells = Open(native: false); + await using var window = Open(native: true); + + cells.App.ReviewPackage(Archive()); + window.App.ReviewPackage(Archive()); + + var cellModel = cells.App.PendingPackageReview!; + var nativeModel = window.App.PackageManager.Review!; + await Assert.That(Flatten(nativeModel)).IsEquivalentTo(Flatten(cellModel), TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(nativeModel.Sections[0].Heading).IsEqualTo(PackageReviewModel.ActsHeading); + + // The cell review draws the model's rows, in its order. + var text = string.Join("\n", cells.App.PackageView.Lines.Select(MarkupText.Plain)); + var at = -1; + foreach (var row in cellModel.Sections.SelectMany(s => s.Rows)) + { + var next = text.IndexOf(row.Value, at + 1, StringComparison.Ordinal); + await Assert.That(next).IsGreaterThan(at); + at = next; + } + + // The window opened on its package page, and nothing is on disk yet. + await Assert.That(window.Native.Shown.Single().Initial).IsEqualTo("packages"); + await Assert.That(window.App.Packages.Installed).IsEmpty(); + await Assert.That(Directory.Exists(Path.Combine(window.Root, "packages"))).IsFalse(); + await Assert.That(window.Saves).IsEqualTo(0); + + window.App.PackageManager.Accept(); + + await Assert.That(window.App.PackageManager.Review).IsNull(); + await Assert.That(window.App.Packages.Installed.Single().Id).IsEqualTo("aether.basics"); + await Assert.That(File.Exists(Path.Combine(window.Root, "packages", "aether.basics", "package.json"))).IsTrue(); + await Assert.That(window.Applies).IsTrue(); + } + + [Test] + public async Task CancellingTheReviewInTheWindowWritesNothing() + { + await using var rig = Open(native: true); + rig.App.ReviewPackage(Archive()); + + rig.App.PackageManager.Cancel(); + + await Assert.That(rig.App.PackageManager.Review).IsNull(); + await Assert.That(rig.App.Packages.Installed).IsEmpty(); + await Assert.That(Directory.Exists(Path.Combine(rig.Root, "packages"))).IsFalse(); + } + + [Test] + public async Task AStaleReviewCannotBeAccepted() + { + await using var rig = Open(native: true); + rig.App.ReviewPackage(Archive()); + var first = rig.App.PendingPackageReview!; + rig.App.CancelPackage(first); + + await Assert.That(rig.App.AcceptPackage(first)).IsFalse(); + await Assert.That(rig.App.Packages.Installed).IsEmpty(); + } + + [Test] + public async Task TheIndexIsNeverFetchedAtStartOrWhenThePageOpens() + { + await using var rig = Open(native: true); + Install(rig); + + rig.App.SimulateKey(Key(ConsoleKey.F10)); + await Assert.That(rig.Native.Shown.Last().Initial).IsEqualTo("packages"); + _ = rig.Native.Shown.Last().Packages!.Items; + await Task.Delay(50); + + await Assert.That(rig.Fetches).IsEqualTo(0); + await Assert.That(rig.App.PackageManager.Index).IsNull(); + await Assert.That(rig.App.PackageManager.BrowseModel).IsNull(); + + rig.App.PackageManager.Browse(); + await Until(() => rig.App.PackageManager.BrowseModel is not null); + + await Assert.That(rig.Fetches).IsEqualTo(1); + await Assert.That(rig.App.PackageManager.BrowseModel!.Rows.Single().State).IsEqualTo(PackageBrowseState.Installed); + await Assert.That(rig.App.PackageManager.BrowseRequests).IsEqualTo(1); + } + + [Test] + public async Task InstallingFromTheWindowsBrowseListReviewsAVerifiedPackage() + { + await using var rig = Open(native: true); + var manager = rig.App.PackageManager; + manager.Browse(); + await Until(() => manager.BrowseModel is not null); + + manager.Install(manager.BrowseModel!.Rows.Single()); + await Until(() => manager.Review is not null); + + await Assert.That(manager.Review!.Name).IsEqualTo("Aether basics"); + await Assert.That(rig.App.Packages.Installed).IsEmpty(); + } + + [Test] + public async Task AnArchiveWhoseHashDiffersNeverReachesTheWindowsReview() + { + await using var rig = Open(native: true, sha: new string('c', 64)); + var manager = rig.App.PackageManager; + manager.Browse(); + await Until(() => manager.BrowseModel is not null); + + manager.Install(manager.BrowseModel!.Rows.Single()); + await Until(() => manager.Status?.Contains("SHA-256", StringComparison.Ordinal) == true); + + await Assert.That(manager.Review).IsNull(); + await Assert.That(rig.App.PendingPackageReview).IsNull(); + await Assert.That(manager.Status).Contains("does not match the index's SHA-256"); + await Assert.That(rig.App.Packages.Installed).IsEmpty(); + } + + [Test] + public async Task ASettingsViewGoesToTheWindowWhenOneIsAttached() + { + Console.SetIn(TextReader.Null); + var presenter = new Presenter(); + var host = ClientHost.Headless(new HeadlessConsoleDriver(120, 32), Caps) with { NativeSettings = presenter }; + await using var app = new SharpMUTermApp(DemoScene.Build(), host); + + app.RenderSnapshot("keypad"); + + await Assert.That(presenter.Shown.Single().Initial).IsEqualTo("keypad"); + await Assert.That(app.SettingsOpenKey).IsNull(); + } + + [Test] + public async Task ASettingsViewIsTheCellScreenWithNoWindow() + { + Console.SetIn(TextReader.Null); + await using var app = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(new HeadlessConsoleDriver(120, 32), Caps)); + + app.RenderSnapshot("keypad"); + + await Assert.That(app.SettingsOpenKey).IsEqualTo(ConsoleKey.F4); + } + + [Test] + public async Task ThePackagesViewsGoToTheWindowWhenOneIsAttached() + { + foreach (var view in new[] { "packages", "package-review", "package-browse" }) + { + Console.SetIn(TextReader.Null); + var presenter = new Presenter(); + var host = ClientHost.Headless(new HeadlessConsoleDriver(120, 32), Caps) with { NativeSettings = presenter }; + await using var app = new SharpMUTermApp(DemoScene.Build(), host); + + app.RenderSnapshot(view); + + await Assert.That(presenter.Shown.Last().Initial).IsEqualTo("packages"); + await Assert.That(app.PackageView.IsOpen).IsFalse(); + if (view == "package-review") + { + await Assert.That(app.PackageManager.Review).IsNotNull(); + } + + if (view == "package-browse") + { + await Assert.That(app.PackageManager.BrowseModel!.Rows.Count).IsEqualTo(4); + } + } + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs b/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs index 9fb9261f..223eb8f6 100644 --- a/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs @@ -98,7 +98,7 @@ public async Task TheReviewSaysWhatTheArchiveAddsAndInstallsNothingUntilEnter() await Assert.That(rig.App.PackageView.Mode).IsEqualTo("review"); var text = string.Join("\n", rig.App.PackageView.Lines.Select(MarkupText.Plain)); - await Assert.That(text).Contains("1 of them sends commands as you"); + await Assert.That(text).Contains("1 rule sends commands as you"); await Assert.That(text).Contains("basics.lua"); await Assert.That(text).Contains("Corvid (Aetherfall)"); await Assert.That(rig.App.Packages.Installed).IsEmpty(); From 8f96ec205936f3b547a40fd8d8b87e583fc28474 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 09:10:46 +0000 Subject: [PATCH 033/113] Open telnet:// links, keep passwords in the OS store, title the window, expose output to screen readers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - telnet:// and telnets:// links connect through the same reader as /connect (ConnectEndpoint, TelnetLink), matched on the endpoint, never sending anything; credentials, paths, queries, control characters and bad ports are refused. --open-link drops every other argument. A second launch hands its link to the running client over a Unix domain socket (LinkHandoff). The .desktop file declares the schemes and the Inno Setup script registers them as an unchecked per-user task. - Character passwords go to Windows Credential Manager, the Secret Service (secret-tool) or the macOS Keychain (CredentialStores, in Hosting/), with secrets.json behind them (CredentialVault). Existing entries migrate at load; an unreachable store keeps every reference through a save. Only the live entry points make a vault. - The window and the terminal are titled Character@World — SharpMUTerm from the header's model (WindowTitle, ClientHost.Title: Window.Title, or OSC 2 with the title stack pushed and popped). - The window's output view has an automation peer: a read-only document holding the front window's newest lines (IAnnouncer.Reading, TerminalViewAutomationPeer). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 11 + CLAUDE.md | 53 ++- docs/PACKAGING.md | 27 ++ packaging/linux/sharpmuterm.desktop | 6 +- packaging/windows/sharpmuterm.iss | 14 + .../AvaloniaConsoleDriver.cs | 27 ++ src/SharpMUTerm.Avalonia/ClientLaunch.cs | 9 +- src/SharpMUTerm.Avalonia/MainWindow.cs | 5 +- src/SharpMUTerm.Avalonia/Program.cs | 9 + src/SharpMUTerm.Avalonia/TerminalView.cs | 7 + .../TerminalViewAutomationPeer.cs | 65 ++++ src/SharpMUTerm.Avalonia/WindowAnnouncer.cs | 24 ++ src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + src/SharpMUTerm.Client/Chrome/WindowTitle.cs | 62 ++++ .../Accessibility/IAnnouncer.cs | 14 + .../Configuration/ConfigurationStore.cs | 31 +- .../Configuration/ConnectEndpoint.cs | 73 ++++ .../Configuration/CredentialVault.cs | 210 +++++++++++ .../Configuration/ICredentialStore.cs | 40 ++ .../Configuration/SecretsStore.cs | 7 +- src/SharpMUTerm.Core/Links/TelnetLink.cs | 149 ++++++++ src/SharpMUTerm.Tui/ClientUsage.cs | 31 +- src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 10 + .../Hosting/CredentialStores.cs | 347 ++++++++++++++++++ src/SharpMUTerm.Tui/Hosting/LinkHandoff.cs | 222 +++++++++++ src/SharpMUTerm.Tui/Hosting/TerminalTitle.cs | 54 +++ src/SharpMUTerm.Tui/Program.cs | 61 ++- .../SharpMUTermApp.Announce.cs | 44 ++- src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs | 155 ++++---- src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs | 45 +++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 11 +- .../OutputAutomationTests.cs | 81 ++++ .../WindowTitleTests.cs | 45 +++ .../Configuration/CredentialVaultTests.cs | 275 ++++++++++++++ .../Links/TelnetLinkTests.cs | 122 ++++++ .../TelnetLinkClientTests.cs | 248 +++++++++++++ 36 files changed, 2499 insertions(+), 98 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/TerminalViewAutomationPeer.cs create mode 100644 src/SharpMUTerm.Client/Chrome/WindowTitle.cs create mode 100644 src/SharpMUTerm.Core/Configuration/ConnectEndpoint.cs create mode 100644 src/SharpMUTerm.Core/Configuration/CredentialVault.cs create mode 100644 src/SharpMUTerm.Core/Configuration/ICredentialStore.cs create mode 100644 src/SharpMUTerm.Core/Links/TelnetLink.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/CredentialStores.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/LinkHandoff.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/TerminalTitle.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/OutputAutomationTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/WindowTitleTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Configuration/CredentialVaultTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Links/TelnetLinkTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/TelnetLinkClientTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 063f7b42..def4aefd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,17 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- `telnet://` and `telnets://` links open the client: it adds the world (or dials the one you already have for that + address) and connects, and never logs in or sends anything a link names. Links with a user name, a password or + anything after the address are refused, and say why. If SharpMUTerm is already running the link opens there. The + Windows installer has an option to register the links, and the Linux desktop file declares them. +- Character passwords are kept in the system's credential store — Windows Credential Manager, the Secret Service + keyring on Linux, the Keychain on macOS — when there is one, and moved there from `secrets.json` the first time. + Without one, `secrets.json` works as before. +- The window's title, and the terminal's, say who is in front: `Character@World — SharpMUTerm`. The terminal's own + title comes back when you quit. +- Desktop window: a screen reader that moves to the output finds a read-only document holding the newest lines of the + window in front, alongside the lines it already hears as they arrive. - Triggers, aliases, key bindings and timers (F2, F3, F4, F6) open in the desktop window's settings as a list beside the selected item's fields: tick a box to switch one on or off, add, copy, delete or move it up and down, and watch the trigger's live test mark the matching lines as you type its pattern. A package's sets are shown diff --git a/CLAUDE.md b/CLAUDE.md index 763a96aa..c5f0a65a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1268,7 +1268,7 @@ one `SharpMUTermApp`; a host is only the place it runs. What differs between hos (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it -draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until @@ -2615,8 +2615,55 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] framework is handed `TextReader.Null`, and the pump is started from the loop (`RunLive`'s `ready`), because a key raised before `Run()` has no listener and is lost. The window (`WindowAnnouncer`) uses two hidden live regions: output is polite and notices are assertive, posted to Avalonia's thread. This was built against the - API and has not been tried with NVDA or Orca. Not done: no speech engine of our own, and no per-line - automation peer on `TerminalView`. + API and has not been tried with NVDA or Orca. Not done: no speech engine of our own. + - **The window's output view has an automation peer** (`TerminalViewAutomationPeer`): a read-only `Document` named + `SharpMUTerm output: `, whose Value pattern holds the front window's newest 50 lines, oldest first. Fed by + `IAnnouncer.Reading` (a default-implemented member, so `--plain` ignores it), said on `Activate` and on every line + landing in the front window, quiet or not — read from `PaneLine.Plain`, so chrome rows are left out and it is the + text ⌃F searches. A change raises the Value property's change. Avalonia 12 has no text pattern (`ITextProvider`), + so this is a value, not a caret-navigable text range. Pinned through Avalonia's headless peers + (`OutputAutomationTests`); **not tried with NVDA, Narrator, VoiceOver or Orca.** +- **`telnet://` and `telnets://` links connect, and do nothing else** (`TelnetLink`, `ConnectEndpoint`, Core; + `SharpMUTermApp.OpenLink`; `LinkHandoff`, `ClientOptions.NarrowToLink`, Tui). A link is server text. Decisions not to + relitigate: + - **One reader with `/connect`** (`ConnectEndpoint.Parse`): a link reaches no host `/connect host port` would refuse. + Default ports are telnet's 23 and telnets' 992, not `/connect`'s 4000. Refused, not tidied: user information + (it would be a login the link chose), any path/query/fragment past a lone `/`, any control character, space, + non-ASCII, `%` or `\`, a port not 1–65535 in plain digits, an unbracketed IPv6 address, over 512 characters. + - **Matched on the endpoint, never a name.** A world already configured for the same host, port and TLS is dialled; + otherwise one is added with **no character**, so nothing logs in. An existing world logs in as its own + configuration says — that is the player's world, not the link's choice. + - **`--open-link ` drops every other argument** before anything reads them. Windows builds the handler's + command line by pasting the link into quotes, and a link holding a quote could add `--render-png` and write a file. + - **A second launch hands its link to the first** over a Unix domain socket (`$XDG_RUNTIME_DIR/sharpmuterm/links.sock`, + else beside `config.json`; `0600`), one line, acknowledged with `ok`, and exits. The receiver re-reads it through + `OpenLink(string)`. Nobody listening, or a stale socket: the launch runs its own client and listens. Only the live + entry point listens (`RunLive`); the window's `Program` and the terminal's hand off before building anything. + Verified between two `--plain` clients and two windows under Xvfb on Linux; Windows' AF_UNIX path is untried. + - **Registration is the package's, never the program's** — the `.desktop` file's `MimeType=` and an unchecked Inno + Setup task (`HKA\Software\Classes\telnet[s]`). See `docs/PACKAGING.md`. +- **Passwords go to the OS credential store, with `secrets.json` behind it** (`ICredentialStore`, `CredentialVault`, + Core; `CredentialStores` in `Hosting/`). The `passwordRef` GUID is unchanged and is the key in both places. + - **One vault per run, from the live entry points only** (`Program.LiveVault`, `ClientLaunch`): a snapshot, a test + and the demo window never make one, so no test reads or writes a real keychain — `CredentialVaultTests` uses a fake. + `ConfigurationStore.Load/Save` without a vault are `secrets.json` alone, exactly as before. + - **The vault remembers what the store holds**, so a save that changed nothing spawns no `secret-tool` (saves happen + on every committed edit). A store that does not answer (`CredentialLookup.Unavailable`: no Secret Service over ssh) + **keeps the reference through a save** — otherwise the first save of such a run would forget every password. + - Migration is at load: a `secrets.json` entry the store accepts is moved and the file rewritten without it; one it + refuses stays. A changed password the store refuses goes to the file under a **new** reference, because the store, + read first, would otherwise win with the old one. + - Windows: `CredWriteW/CredReadW/CredDeleteW`, generic credentials `SharpMUTerm/` (built, never run). Linux: + `secret-tool` with `application=sharpmuterm ref=`, password on stdin (exercised against gnome-keyring on a + private D-Bus). macOS: `security`, the write through `security -i` on stdin so the password is not on a command + line (built, never run). Each call is bounded at 30 s so an unanswered unlock prompt does not hold the start. +- **The title says who is in front** (`WindowTitle`, Client; `SharpMUTermApp.Title.cs`; `ClientHost.Title`). + `Character@World — SharpMUTerm`, worked out from the header's own `HeaderModel` whenever the header is built, so the + two cannot disagree (a command-line world that is not in the configuration names no world in either). Nothing is + written before `Run` (`StartTitle`). The terminal (`TerminalTitle`) pushes the title stack (`CSI 22;2t`), writes + OSC 2 through the `?1004` raw write, and pops it after the loop; the window sets `Window.Title`. Control + characters are stripped twice (names, then the sequence). Not a surface in `SurfaceCatalog`: nothing draws it in + cells and it hands nothing back. - **Discord presence is a host member and a per-world opt-in** (`ClientHost.Presence`, a lazy `Func?`; `GamePresence`/`DiscordIpc`, Core; F5 ▸ `discord`, off by default). The world asks for `External.Discord 1`. `WorldSession.GamePresence` folds `Info` (application id: digits only) and `Status` diff --git a/docs/PACKAGING.md b/docs/PACKAGING.md index 627c2166..6c0c77b5 100644 --- a/docs/PACKAGING.md +++ b/docs/PACKAGING.md @@ -56,6 +56,33 @@ dotnet publish src/SharpMUTerm.Avalonia -p:PublishProfile=linux-x64 -o out/linux Both use `packaging/icons/sharpmuterm.png` / `.ico`; the `.ico` is also each executable's Windows icon. +### `telnet://` links + +Both packages can make `telnet://` and `telnets://` links open the window. The program never registers itself; +the package does, and only where the player agreed to it: + +- **Linux** — `sharpmuterm.desktop` declares `MimeType=x-scheme-handler/telnet;x-scheme-handler/telnets;` and runs + `sharpmuterm-window --open-link %U`. It takes effect once the desktop integrates the AppImage (AppImageLauncher, + appimaged), or by hand: copy the desktop file to `~/.local/share/applications/`, point its `Exec=` at the AppImage, + and run `xdg-mime default sharpmuterm.desktop x-scheme-handler/telnet x-scheme-handler/telnets`. +- **Windows** — the installer's *Open telnet:// and telnets:// links in SharpMUTerm* task (unchecked by default) + writes `Software\Classes\telnet` and `…\telnets` under `HKA` (the current user in the default per-user install) + with `"…\sharpmuterm-window.exe" --open-link "%1"`. Uninstalling removes both keys. + +`--open-link` is why the handler can be trusted with a link: with it on the command line, the client reads the one +argument after it and drops every other (`ClientOptions.NarrowToLink`), so a link holding a quote cannot add +arguments of its own. The link itself is read as server text (`TelnetLink`): host, port and TLS only — no user +name or password, no path, no command. A running client is handed the link over a socket in +`$XDG_RUNTIME_DIR/sharpmuterm/` (or beside `config.json`), and the new launch exits. + +### Passwords + +Character passwords go to the system's credential store when there is one that answers: Windows Credential Manager +(built in), the Secret Service through libsecret's `secret-tool` on Linux (`libsecret-tools` on Debian and Ubuntu, +`libsecret` on Fedora and Arch — recommend it, do not require it), and the login Keychain through `security` on +macOS. Without one, or for a password it refuses, they stay in `secrets.json` beside `config.json`, as before. +Existing `secrets.json` entries move into the store the first time the client starts with one. + ## CI / releases `.github/workflows/release.yml` runs on `v*` tags (and manual dispatch). For `linux-x64` and `win-x64` it diff --git a/packaging/linux/sharpmuterm.desktop b/packaging/linux/sharpmuterm.desktop index 3893a62e..5aa262f7 100644 --- a/packaging/linux/sharpmuterm.desktop +++ b/packaging/linux/sharpmuterm.desktop @@ -3,9 +3,13 @@ Type=Application Name=SharpMUTerm GenericName=MU* Client Comment=A MUSH, MUCK and MUD client -Exec=sharpmuterm-window %U +Exec=sharpmuterm-window --open-link %U Icon=sharpmuterm Terminal=false Categories=Game;RolePlaying; Keywords=MUD;MUSH;MUCK;MU*;telnet; StartupWMClass=sharpmuterm-window +# telnet:// and telnets:// links open the client. Registered only when the desktop integrates the AppImage +# (AppImageLauncher, appimaged, or `xdg-mime default sharpmuterm.desktop x-scheme-handler/telnet`); the program never +# registers itself. +MimeType=x-scheme-handler/telnet;x-scheme-handler/telnets; diff --git a/packaging/windows/sharpmuterm.iss b/packaging/windows/sharpmuterm.iss index a29c3d75..a97a52c3 100644 --- a/packaging/windows/sharpmuterm.iss +++ b/packaging/windows/sharpmuterm.iss @@ -45,6 +45,7 @@ WizardStyle=modern [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "addtopath"; Description: "Add the install folder to PATH, so sharpmuterm runs from any terminal"; GroupDescription: "Terminal:" +Name: "telnetlinks"; Description: "Open telnet:// and telnets:// links in SharpMUTerm"; GroupDescription: "Links:"; Flags: unchecked [Files] Source: "{#PublishDir}\sharpmuterm-window.exe"; DestDir: "{app}"; Flags: ignoreversion @@ -55,6 +56,19 @@ Source: "..\..\LICENSE"; DestDir: "{app}"; DestName: "LICENSE.txt"; Flags: ignor Name: "{autoprograms}\SharpMUTerm"; Filename: "{app}\sharpmuterm-window.exe" Name: "{autodesktop}\SharpMUTerm"; Filename: "{app}\sharpmuterm-window.exe"; Tasks: desktopicon +; telnet:// and telnets:// links, for this user (HKA is HKCU in the default per-user install). Only with the task above; +; the program never registers itself. --open-link makes the client read the link and nothing else, so a link holding a +; quote cannot add arguments of its own to the command line Windows builds from this template. +[Registry] +Root: HKA; Subkey: "Software\Classes\telnet"; ValueType: string; ValueName: ""; ValueData: "URL:Telnet Protocol"; Flags: uninsdeletekey; Tasks: telnetlinks +Root: HKA; Subkey: "Software\Classes\telnet"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Tasks: telnetlinks +Root: HKA; Subkey: "Software\Classes\telnet\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: """{app}\sharpmuterm-window.exe"",0"; Tasks: telnetlinks +Root: HKA; Subkey: "Software\Classes\telnet\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\sharpmuterm-window.exe"" --open-link ""%1"""; Tasks: telnetlinks +Root: HKA; Subkey: "Software\Classes\telnets"; ValueType: string; ValueName: ""; ValueData: "URL:Telnet over TLS Protocol"; Flags: uninsdeletekey; Tasks: telnetlinks +Root: HKA; Subkey: "Software\Classes\telnets"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Tasks: telnetlinks +Root: HKA; Subkey: "Software\Classes\telnets\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: """{app}\sharpmuterm-window.exe"",0"; Tasks: telnetlinks +Root: HKA; Subkey: "Software\Classes\telnets\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\sharpmuterm-window.exe"" --open-link ""%1"""; Tasks: telnetlinks + [Run] Filename: "{app}\sharpmuterm-window.exe"; Description: "{cm:LaunchProgram,SharpMUTerm}"; Flags: nowait postinstall skipifsilent diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index e67b927d..9bdc13cd 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -79,6 +79,9 @@ public AvaloniaConsoleDriver(int columns, int rows) /// The window's native F1, drawn over the cells in the main window (). public ComposerPresenter Composer { get; } = new(); + /// The window's title for what is in front, which the main window shows (). + public WindowTitleBar TitleBar { get; } = new(); + public bool IsRunning { get; private set; } // ── IConsoleDriver: output ──────────────────────────────────────────────────────────────── @@ -165,3 +168,27 @@ public void Resize(int columns, int rows) public void Dispose() => Pictures.Dispose(); } + +/// +/// The window's half of : the client hands it Character@World — SharpMUTerm on its own +/// thread, and the main window, which subscribes, puts it on the title bar and the taskbar entry on Avalonia's. +/// +internal sealed class WindowTitleBar : IWindowTitle +{ + /// The last title, or null before the client has said one. + public string? Current { get; private set; } + + /// Raised on the client's thread with each new title. + public event Action? Changed; + + public void Show(string title) + { + Current = title; + Changed?.Invoke(title); + } + + /// A window's title goes with the window; there is nothing to give back. + public void Restore() + { + } +} diff --git a/src/SharpMUTerm.Avalonia/ClientLaunch.cs b/src/SharpMUTerm.Avalonia/ClientLaunch.cs index edfed745..e1047361 100644 --- a/src/SharpMUTerm.Avalonia/ClientLaunch.cs +++ b/src/SharpMUTerm.Avalonia/ClientLaunch.cs @@ -15,6 +15,10 @@ namespace SharpMUTerm.Avalonia; /// internal static class ClientLaunch { + // The live client's passwords: the OS credential store first, secrets.json behind it. Made by the live load and + // handed to the live run, whose saves need what the load learned; the demo has none and touches neither. + private static CredentialVault? _vault; + public static AppConfiguration LoadConfiguration(WindowOptions options, List notices) { if (options.Demo) @@ -26,7 +30,8 @@ public static AppConfiguration LoadConfiguration(WindowOptions options, ListRuns the client on until it quits; blocks the calling thread. @@ -38,7 +43,7 @@ public static int Run(WindowOptions options, AppConfiguration config, IReadOnlyL return app.Run([]); } - return Tui.Program.RunLive(options.ClientArgs, config, notices, WindowHost.Create(driver, clipboard, options.Chrome)); + return Tui.Program.RunLive(options.ClientArgs, config, notices, WindowHost.Create(driver, clipboard, options.Chrome), vault: _vault); } /// The demo client, with its --view scene laid out and not yet running. diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index 1822306e..83d67c16 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -39,7 +39,10 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime _driver = new AvaloniaConsoleDriver(options.Columns, options.Rows); _view = new TerminalView(_driver, foreground, background, options.FontPoints * 96f / 72f, options.FontFamily); - Title = "SharpMUTerm"; + Title = SharpMUTerm.Client.Chrome.WindowTitle.Product; + + // Character@World — SharpMUTerm for what is in front, from the client's own header (WindowTitle). + _driver.TitleBar.Changed += title => Dispatcher.UIThread.Post(() => Title = title); _driver.Settings.Owner = this; // The window's own pop-ups (tooltips, the right-click menu) follow the client's theme: a light menu diff --git a/src/SharpMUTerm.Avalonia/Program.cs b/src/SharpMUTerm.Avalonia/Program.cs index 751ffb87..057231a3 100644 --- a/src/SharpMUTerm.Avalonia/Program.cs +++ b/src/SharpMUTerm.Avalonia/Program.cs @@ -8,6 +8,8 @@ internal static class Program [STAThread] private static int Main(string[] args) { + // A desktop link handler's launch: the link and nothing else (ClientOptions.NarrowToLink says why). + args = Tui.ClientOptions.NarrowToLink(args); // A window has no stdin to read, and the framework reads a redirected one as piped input, behind a modal // "Reading input" dialog that stays up for as long as the pipe is open. Launched from anything that // leaves stdin a pipe, the client would open on that dialog. The terminal snapshot does the same. @@ -26,6 +28,13 @@ private static int Main(string[] args) return RenderPng.Run(options); } + // A telnet:// link (the desktop runs `sharpmuterm-window %U` when one is clicked) goes to the client already + // running, when there is one, before any window of this launch is shown. Otherwise this launch follows it. + if (!options.Demo && Tui.Program.LinkArgument(options.ClientArgs) is { } link && Tui.LinkHandoff.TrySend(link)) + { + return 0; + } + App.Options = options; return BuildAvaloniaApp().StartWithClassicDesktopLifetime(options.ClientArgs); } diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index 49c139b7..b71ad19c 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -93,6 +93,13 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba pointer.MenuRequested += (_, items) => Dispatcher.UIThread.Post(() => OpenMenu(items)); } + /// + /// A screen reader finds the window in front's newest lines here, as a read-only document + /// (), rather than an unnamed picture of cells. + /// + protected override global::Avalonia.Automation.Peers.AutomationPeer OnCreateAutomationPeer() => + new TerminalViewAutomationPeer(this, _driver.Announcer); + /// The cell size in logical units, for placing a native view over cells (). internal Size CellExtent => CellSize; diff --git a/src/SharpMUTerm.Avalonia/TerminalViewAutomationPeer.cs b/src/SharpMUTerm.Avalonia/TerminalViewAutomationPeer.cs new file mode 100644 index 00000000..7e79ba31 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/TerminalViewAutomationPeer.cs @@ -0,0 +1,65 @@ +using Avalonia.Automation; +using Avalonia.Automation.Peers; +using Avalonia.Automation.Provider; +using Avalonia.Threading; + +namespace SharpMUTerm.Avalonia; + +/// +/// What a screen reader finds when it reaches the cells: a read-only document named after the window in front, whose +/// value is that window's newest lines as plain text, oldest first (). The cells +/// themselves are a picture to the platform's accessibility API — a paints with Skia and +/// has no text elements — so without this a reader moving to the output found an unnamed graphic. +/// +/// It sits beside the two live regions, not in place of them: those speak each line as it arrives, this is the text a +/// reader can go back over at its own pace (UI Automation's Value pattern on Windows, AT-SPI's text on Linux). A change +/// to it raises the Value property's change, posted to Avalonia's thread, so a reader watching the view hears that it +/// changed without being read every line twice. +/// +/// +internal sealed class TerminalViewAutomationPeer : ControlAutomationPeer, IValueProvider +{ + private readonly WindowAnnouncer _announcer; + private string _value; + + public TerminalViewAutomationPeer(TerminalView owner, WindowAnnouncer announcer) + : base(owner) + { + _announcer = announcer; + _value = Text(announcer.Front); + announcer.ReadingChanged += () => Dispatcher.UIThread.Post(Refresh); + } + + /// The name a reader announces for the view: the window in front, after the product. + internal static string NameFor(string? window) => + string.IsNullOrEmpty(window) ? "SharpMUTerm output" : $"SharpMUTerm output: {window}"; + + public bool IsReadOnly => true; + + public string? Value => _value; + + /// The output is the game's; a reader may read it, never write it. + public void SetValue(string? value) => throw new InvalidOperationException("The output is read-only."); + + protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Document; + + protected override string GetClassNameCore() => "SharpMUTermOutput"; + + protected override string? GetNameCore() => NameFor(_announcer.Front.Window); + + protected override bool IsContentElementCore() => true; + + protected override bool IsControlElementCore() => true; + + private void Refresh() + { + var old = _value; + _value = Text(_announcer.Front); + if (old != _value) + { + RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, old, _value); + } + } + + private static string Text((string? Window, IReadOnlyList Lines) front) => string.Join('\n', front.Lines); +} diff --git a/src/SharpMUTerm.Avalonia/WindowAnnouncer.cs b/src/SharpMUTerm.Avalonia/WindowAnnouncer.cs index 1cb84ccf..206e4585 100644 --- a/src/SharpMUTerm.Avalonia/WindowAnnouncer.cs +++ b/src/SharpMUTerm.Avalonia/WindowAnnouncer.cs @@ -18,6 +18,30 @@ internal sealed class WindowAnnouncer : IAnnouncer { private TextBlock? _output; private TextBlock? _notices; + private Tuple> _front = Tuple.Create>(null, []); + + /// + /// The window in front and its newest lines, as the client last said them (): the + /// text the output view's automation peer exposes (). Safe from any thread: + /// the pair is swapped whole. + /// + public (string? Window, IReadOnlyList Lines) Front + { + get + { + var front = Volatile.Read(ref _front); + return (front.Item1, front.Item2); + } + } + + /// Raised on the client's thread when changes. + public event Action? ReadingChanged; + + public void Reading(string window, IReadOnlyList lines) + { + Volatile.Write(ref _front, Tuple.Create>(window, lines.ToArray())); + ReadingChanged?.Invoke(); + } /// The two regions, built once for the window that shows them. public IReadOnlyList Regions() diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 5d379300..5310bf71 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -78,5 +78,8 @@ internal static class WindowHost // F1 and the docked composer are a native editor: a proportional or monospace face, IME, native selection and // a real underline under a misspelling. The draft, the send and the keys stay the client's. NativeComposer = driver.Composer, + + // The title bar and the taskbar entry say who is in front: Character@World — SharpMUTerm. + Title = driver.TitleBar, }; } diff --git a/src/SharpMUTerm.Client/Chrome/WindowTitle.cs b/src/SharpMUTerm.Client/Chrome/WindowTitle.cs new file mode 100644 index 00000000..9826bab9 --- /dev/null +++ b/src/SharpMUTerm.Client/Chrome/WindowTitle.cs @@ -0,0 +1,62 @@ +using System.Text; + +namespace SharpMUTerm.Client.Chrome; + +/// +/// The title the window — the desktop window's title bar and taskbar entry, or the terminal's tab — wears for what is +/// in front: Character@World — SharpMUTerm. One function, read off the same the +/// header band is drawn from, so the title and the header cannot name different characters. +/// +/// The names are the player's configuration, but a world a telnet:// link added is named after the link's host, +/// so they are cleaned like any outside text: control characters are dropped (a title is written into an escape +/// sequence in a terminal, where a BEL or ESC would end it early) and each part is bounded. +/// +/// +public static class WindowTitle +{ + /// The product name every title ends with, and the whole title when nothing is in front. + public const string Product = "SharpMUTerm"; + + /// The longest a character or world name runs in a title before it is cut with an ellipsis. + public const int MaxPart = 48; + + /// The title for what the header says is in front. + public static string For(HeaderModel header) => For(header.Character?.Name, header.World?.Name); + + /// + /// Character@World — SharpMUTerm; World — SharpMUTerm for a world with no character in front; and + /// SharpMUTerm alone when nothing is. + /// + public static string For(string? character, string? world) + { + var who = Clean(character); + var where = Clean(world); + return (who, where) switch + { + ({ Length: > 0 }, { Length: > 0 }) => $"{who}@{where} — {Product}", + ({ Length: > 0 }, _) => $"{who} — {Product}", + (_, { Length: > 0 }) => $"{where} — {Product}", + _ => Product, + }; + } + + private static string Clean(string? text) + { + if (string.IsNullOrWhiteSpace(text)) + { + return string.Empty; + } + + var clean = new StringBuilder(Math.Min(text.Length, MaxPart + 1)); + foreach (var c in text) + { + if (!char.IsControl(c) && char.GetUnicodeCategory(c) is not (System.Globalization.UnicodeCategory.LineSeparator or System.Globalization.UnicodeCategory.ParagraphSeparator)) + { + clean.Append(c); + } + } + + var result = clean.ToString().Trim(); + return result.Length > MaxPart ? result[..(MaxPart - 1)] + "…" : result; + } +} diff --git a/src/SharpMUTerm.Core/Accessibility/IAnnouncer.cs b/src/SharpMUTerm.Core/Accessibility/IAnnouncer.cs index 8240e067..beef9807 100644 --- a/src/SharpMUTerm.Core/Accessibility/IAnnouncer.cs +++ b/src/SharpMUTerm.Core/Accessibility/IAnnouncer.cs @@ -20,4 +20,18 @@ public enum AnnouncementKind public interface IAnnouncer { void Announce(string text, AnnouncementKind kind); + + /// + /// The window in front and its most recent lines, oldest first, as plain text: what a screen reader finds when it + /// asks the output view for its text, rather than what it is told as lines arrive. Said when the window in front + /// changes and when a line lands in it. A host with nothing to expose ignores it (the default). + /// + /// The window's title. + /// Its newest lines, at most ; chrome rows (bars) left out. + void Reading(string window, IReadOnlyList lines) + { + } + + /// How many of the front window's lines carries. + public const int ReadingLines = 50; } diff --git a/src/SharpMUTerm.Core/Configuration/ConfigurationStore.cs b/src/SharpMUTerm.Core/Configuration/ConfigurationStore.cs index 2768b50f..994a5c13 100644 --- a/src/SharpMUTerm.Core/Configuration/ConfigurationStore.cs +++ b/src/SharpMUTerm.Core/Configuration/ConfigurationStore.cs @@ -73,7 +73,13 @@ public static string DefaultPath /// permission problem on every settings edit would be trained away in a day. /// /// - public static AppConfiguration Load(string path, Action? report = null) + /// The configuration file. + /// Called with anything worth one line in the diagnostics log. + /// + /// Where the passwords are: the OS credential store first and then the file (), or + /// null for the file alone. The same vault is handed to every save after this load. + /// + public static AppConfiguration Load(string path, Action? report = null, CredentialVault? vault = null) { ArgumentException.ThrowIfNullOrEmpty(path); if (!File.Exists(path)) @@ -82,7 +88,21 @@ public static AppConfiguration Load(string path, Action? report = null) } var configuration = Deserialize(File.ReadAllText(path)); - ApplySecrets(configuration, SecretsStore.Read(SecretsStore.PathFor(path)), report); + var secretsPath = SecretsStore.PathFor(path); + var read = SecretsStore.Read(secretsPath); + if (vault is null) + { + ApplySecrets(configuration, read, report); + } + else + { + vault.Load(configuration, read, secretsPath, report); + if (read.Problem is { } problem) + { + report?.Invoke(problem); + } + } + return configuration; } @@ -142,14 +162,17 @@ public static string Serialize(AppConfiguration configuration) /// transaction; this is the ordering whose partial state costs less. /// /// - public static void Save(string path, AppConfiguration configuration) + /// The configuration file. + /// What to write. + /// The vault the configuration was loaded through, or null for the file alone. + public static void Save(string path, AppConfiguration configuration, CredentialVault? vault = null) { ArgumentException.ThrowIfNullOrEmpty(path); ArgumentNullException.ThrowIfNull(configuration); var full = Path.GetFullPath(path); Directory.CreateDirectory(Path.GetDirectoryName(full)!); - var secrets = ReconcileSecrets(configuration); + var secrets = vault is null ? ReconcileSecrets(configuration) : vault.Reconcile(configuration); SecretsStore.Write(SecretsStore.PathFor(full), secrets); File.WriteAllText(full, Serialize(configuration)); } diff --git a/src/SharpMUTerm.Core/Configuration/ConnectEndpoint.cs b/src/SharpMUTerm.Core/Configuration/ConnectEndpoint.cs new file mode 100644 index 00000000..bec75abc --- /dev/null +++ b/src/SharpMUTerm.Core/Configuration/ConnectEndpoint.cs @@ -0,0 +1,73 @@ +using System.Globalization; + +namespace SharpMUTerm.Core.Configuration; + +/// +/// Reads a host and port the way /connect takes them: host port, host:port, or a bare host. A +/// bracketed IPv6 address keeps its colons. One reader for every way in — the command line's /connect, the +/// welcome's form and a telnet:// link () — so none of them can reach a host the +/// others would refuse. +/// +public static class ConnectEndpoint +{ + /// The port a host given without one is dialled on, the same default as the command line's. + public const int DefaultPort = 4000; + + /// + /// The host and port in , or null when they are not one host with at most one port, so a + /// mistyped world name is refused rather than saved as a world that dials a host called "my world". + /// + /// One or two words. + /// The port when the words name none. + public static (string Host, int Port)? Parse(IReadOnlyList words, int defaultPort = DefaultPort) + { + if (words.Count is 0 or > 2) + { + return null; + } + + var host = words[0]; + var port = defaultPort; + + // An opening bracket is an IPv6 address, and is closed at the end or just before a port. + if (host.StartsWith('[') && host.IndexOf(']') is var end + && (end < 0 || host.IndexOf(']', end + 1) >= 0 || (end + 1 < host.Length && host[end + 1] != ':'))) + { + return null; + } + + if (words.Count == 2) + { + if (!TryPort(words[1], out port)) + { + return null; + } + } + else if (host.StartsWith('[') && host.IndexOf("]:", StringComparison.Ordinal) is var close and > 0) + { + if (!TryPort(host[(close + 2)..], out port)) + { + return null; + } + + host = host[..(close + 1)]; + } + else if (host.Count(c => c == ':') == 1) + { + var colon = host.IndexOf(':'); + if (!TryPort(host[(colon + 1)..], out port)) + { + return null; + } + + host = host[..colon]; + } + + host = host.Trim('[', ']'); + return host.Length == 0 || Uri.CheckHostName(host) == UriHostNameType.Unknown ? null : (host, port); + } + + /// A port: digits only (no sign, no spaces), 1 to 65535. + public static bool TryPort(string text, out int port) => + int.TryParse(text, NumberStyles.None, CultureInfo.InvariantCulture, out port) && port is > 0 and <= 65535; +} diff --git a/src/SharpMUTerm.Core/Configuration/CredentialVault.cs b/src/SharpMUTerm.Core/Configuration/CredentialVault.cs new file mode 100644 index 00000000..ee8f5234 --- /dev/null +++ b/src/SharpMUTerm.Core/Configuration/CredentialVault.cs @@ -0,0 +1,210 @@ +namespace SharpMUTerm.Core.Configuration; + +/// +/// Where character passwords are kept: the OS credential store when the machine has one that answers, and +/// secrets.json () for any password the store would not take. The configuration still +/// carries only , the same GUID in both places, so a password moves +/// between them without config.json changing. +/// +/// One vault per run, handed to +/// and every after it, because it +/// remembers what the run has learned: which references the store holds and with what (so a save that changed nothing +/// writes nothing to the store — saves happen on every committed settings edit, and a store write can be a process), +/// and which references the store could not be asked about. +/// +/// +/// A password the store could not be asked about is not a password the player removed. A Linux session with no +/// Secret Service running (over ssh, say) loads every stored character with no password. The reference is kept, and a +/// save keeps it, so the next run with a store reads the password again. Without that, the first save of such a run +/// would forget every reference and with it every password. +/// +/// +/// Moving in. A password found in secrets.json while the store answers is written to the store at load, +/// and the file is rewritten without it once the store has it. A password the store refuses stays in the file. +/// +/// +/// A vault with no store is secrets.json alone, exactly the behaviour from before there was a store; that is +/// what a test, a snapshot and a machine with no store use. +/// +/// +public sealed class CredentialVault +{ + private readonly object _gate = new(); + private readonly Dictionary _inStore = []; + private readonly HashSet _unresolved = []; + + /// The machine's store, or null for secrets.json alone. + public CredentialVault(ICredentialStore? store) => Store = store; + + /// The OS store, or null. + public ICredentialStore? Store { get; } + + /// The references whose password is in the store, for the tests. + internal IReadOnlyCollection InStore + { + get + { + lock (_gate) + { + return [.. _inStore.Keys]; + } + } + } + + /// + /// Fills in each character's password: from the store first, then from the file. Moves what the file holds into + /// the store when the store takes it, and rewrites the file without it. + /// + internal void Load(AppConfiguration configuration, SecretsStore.ReadResult file, string secretsPath, Action? report) + { + lock (_gate) + { + var migrated = new HashSet(); + var unreachable = 0; + foreach (var character in configuration.Worlds.SelectMany(w => w.Characters)) + { + character.Password = null; + if (character.PasswordRef is not { } id) + { + continue; + } + + var lookup = CredentialLookup.Missing; + if (Store is not null) + { + lookup = Store.TryRead(id, out var stored); + if (lookup == CredentialLookup.Found && !string.IsNullOrEmpty(stored)) + { + character.Password = stored; + _inStore[id] = stored; + continue; + } + } + + if (file.Secrets.TryGetValue(id, out var password)) + { + character.Password = password; + if (Store is not null && lookup == CredentialLookup.Missing && file.Readable && Store.Write(id, password)) + { + _inStore[id] = password; + migrated.Add(id); + } + + continue; + } + + if (lookup == CredentialLookup.Unavailable) + { + _unresolved.Add(id); + unreachable++; + } + } + + if (migrated.Count > 0) + { + var kept = file.Secrets.Where(entry => !migrated.Contains(entry.Key)).ToDictionary(e => e.Key, e => e.Value); + try + { + SecretsStore.Write(secretsPath, kept); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + // Both places hold the password now; the store is read first, and the next save prunes the file. + } + + report?.Invoke($"moved {migrated.Count} password{(migrated.Count == 1 ? "" : "s")} from {SecretsStore.FileName} into {Store!.Name}"); + } + + if (unreachable > 0) + { + report?.Invoke( + $"{Store!.Name} could not be reached, so {unreachable} character{(unreachable == 1 ? " starts" : "s start")} " + + "with no password this run; they are kept and read again next time"); + } + } + } + + /// + /// Brings every reference into line with the password its character holds, writes to the store what changed, and + /// hands back what secrets.json must hold: the passwords the store did not take. + /// + /// It mutates the configuration it is given, as the save always has: the GUID has to outlive the call, or + /// every save would mint a new one and orphan the last. + /// + /// + internal Dictionary Reconcile(AppConfiguration configuration) + { + lock (_gate) + { + var file = new Dictionary(); + var referenced = new HashSet(); + foreach (var character in configuration.Worlds.SelectMany(w => w.Characters)) + { + if (string.IsNullOrEmpty(character.Password)) + { + // A password the store could not be asked about this run is kept, reference and all. + if (character.PasswordRef is { } kept && _unresolved.Contains(kept) && referenced.Add(kept)) + { + continue; + } + + // No password, no reference. A GUID pointing at nothing would say "this character has a stored + // password" to anyone reading the config, and it would keep a row alive. + character.PasswordRef = null; + continue; + } + + // Two characters on one row — a hand-edited config, or one copied between machines — would mean + // editing one password silently changed the other. Give this one a row of its own. + var id = character.PasswordRef ?? Guid.NewGuid(); + if (!referenced.Add(id)) + { + id = Guid.NewGuid(); + referenced.Add(id); + } + + _unresolved.Remove(id); + if (Store is not null) + { + if (_inStore.TryGetValue(id, out var known) && known == character.Password) + { + character.PasswordRef = id; + continue; + } + + if (Store.Write(id, character.Password)) + { + _inStore[id] = character.Password; + character.PasswordRef = id; + continue; + } + + // The store holds an older password under this reference and refused the new one. Read first, it + // would win over the file, so the new password goes to the file under a reference of its own. + if (_inStore.Remove(id)) + { + Store.Delete(id); + referenced.Remove(id); + id = Guid.NewGuid(); + referenced.Add(id); + } + } + + file[id] = character.Password; + character.PasswordRef = id; + } + + // What the store holds for a character that is gone, or whose password moved to the file, goes too. + foreach (var stale in _inStore.Keys.Where(id => !referenced.Contains(id) || file.ContainsKey(id)).ToList()) + { + if (Store?.Delete(stale) ?? true) + { + _inStore.Remove(stale); + } + } + + _unresolved.IntersectWith(referenced); + return file; + } + } +} diff --git a/src/SharpMUTerm.Core/Configuration/ICredentialStore.cs b/src/SharpMUTerm.Core/Configuration/ICredentialStore.cs new file mode 100644 index 00000000..30d1069c --- /dev/null +++ b/src/SharpMUTerm.Core/Configuration/ICredentialStore.cs @@ -0,0 +1,40 @@ +namespace SharpMUTerm.Core.Configuration; + +/// What a read from an OS credential store found. +public enum CredentialLookup +{ + /// The store has a password under that reference. + Found, + + /// The store answered, and has nothing under that reference. + Missing, + + /// The store could not be asked: no service, locked and not unlocked, timed out, or failed. + Unavailable, +} + +/// +/// An operating system's credential store — Windows Credential Manager, the Secret Service (libsecret) on Linux, the +/// macOS Keychain — keyed by a character's . The implementations are the +/// hosts' (SharpMUTerm.Tui/Hosting), because which store a machine has is a host fact; this side only says what +/// the configuration needs from one, so the reconciling in can be tested against a fake. +/// +/// Every member must answer rather than throw, and must not block for long: a store that cannot be reached is +/// and a write that fails is false, and the caller falls back to +/// secrets.json () for that password. +/// +/// +public interface ICredentialStore +{ + /// What the store is called, for a message: Windows Credential Manager. + string Name { get; } + + /// Reads the password stored under . + CredentialLookup TryRead(Guid id, out string? password); + + /// Stores under , replacing any. False when it was not stored. + bool Write(Guid id, string password); + + /// Removes what is stored under . True when nothing is left there, removed or never present. + bool Delete(Guid id); +} diff --git a/src/SharpMUTerm.Core/Configuration/SecretsStore.cs b/src/SharpMUTerm.Core/Configuration/SecretsStore.cs index ed758395..a53c942e 100644 --- a/src/SharpMUTerm.Core/Configuration/SecretsStore.cs +++ b/src/SharpMUTerm.Core/Configuration/SecretsStore.cs @@ -22,9 +22,10 @@ namespace SharpMUTerm.Core.Configuration; /// read them. What the split buys is that accidental disclosure and deliberate sharing stop being the same /// action — which is the failure that actually happens to people. What the file mode buys is that "anyone /// who can read the file" is one account. Reversible obfuscation would buy neither and would cost a -/// permanent migration burden plus a field that looks protected and is not. An OS credential store -/// (DPAPI/Keychain/libsecret) is the thing that would make these secrets at rest; it remains a legitimate -/// future option and nothing here claims it exists. +/// permanent migration burden plus a field that looks protected and is not. An OS credential store is the +/// thing that makes these secrets at rest, and the live client uses one where the machine has it +/// (); this file is what holds a password when there is none, or when the store +/// refuses it. /// /// /// Everything degrades to "no password". A missing file, an unparseable one, a key that is not a diff --git a/src/SharpMUTerm.Core/Links/TelnetLink.cs b/src/SharpMUTerm.Core/Links/TelnetLink.cs new file mode 100644 index 00000000..88ff20fa --- /dev/null +++ b/src/SharpMUTerm.Core/Links/TelnetLink.cs @@ -0,0 +1,149 @@ +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Links; + +/// +/// A telnet:// or telnets:// link, read into the one thing it may ask for: a connection to a host and +/// port, over TLS for telnets. +/// +/// A link is server text. It arrives from a web page, a chat message, another program: anybody can write one, +/// and the desktop hands it to this client when it is clicked. So it is read strictly and can do exactly what +/// /connect host port can (the host and port go through , the same reader) +/// and nothing more. It never names a world, a character or a command, and it never sends anything: a world it adds +/// has no character, so nothing logs in. +/// +/// Refused rather than tidied, each for a reason: +/// +/// User information (telnet://user:password@host). RFC 4248 allows it; this client would have to +/// send it as a login, which is a command the link would be choosing. +/// A path, query or fragment beyond a lone /. A telnet URL has nothing to say there, and text that +/// means nothing to a reader is somewhere for a payload to ride. +/// Any control character, space, non-ASCII character or percent-escape, anywhere. A CR or LF in a host +/// would be a second line on any wire it reached, and an escape is a second reading of the same bytes. +/// A port that is not 1–65535 in plain digits, and an unbracketed IPv6 address (its colons would be read +/// as a port). +/// +/// +/// The host, without brackets. +/// The port. +/// Whether the link was telnets://. +public sealed record TelnetLink(string Host, int Port, bool Tls) +{ + /// The plain scheme. + public const string Scheme = "telnet"; + + /// The TLS scheme. + public const string SecureScheme = "telnets"; + + /// Telnet's registered port, for a telnet:// link that names none. + public const int DefaultPort = 23; + + /// Telnet-over-TLS's registered port, for a telnets:// link that names none. + public const int DefaultSecurePort = 992; + + /// The longest link read at all; anything longer is refused before it is looked at. + public const int MaxLength = 512; + + /// Whether is meant as a link: it starts with one of the two schemes. + public static bool LooksLikeLink(string? text) => + text is not null + && (text.StartsWith(Scheme + "://", StringComparison.OrdinalIgnoreCase) + || text.StartsWith(SecureScheme + "://", StringComparison.OrdinalIgnoreCase)); + + /// Reads , or says in a few words why it was refused. + public static TelnetLink? TryParse(string? text, out string? refusal) + { + refusal = Refuse(text, out var link); + return link; + } + + /// Reads , or null when it is not a link this client will follow. + public static TelnetLink? TryParse(string? text) => TryParse(text, out _); + + private static string? Refuse(string? text, out TelnetLink? link) + { + link = null; + if (string.IsNullOrEmpty(text)) + { + return "the link is empty"; + } + + if (text.Length > MaxLength) + { + return "the link is too long"; + } + + foreach (var c in text) + { + if (c <= ' ' || c > '~') + { + return "the link holds a space, a line break or another character a link cannot hold"; + } + } + + bool tls; + string rest; + if (text.StartsWith(SecureScheme + "://", StringComparison.OrdinalIgnoreCase)) + { + tls = true; + rest = text[(SecureScheme.Length + 3)..]; + } + else if (text.StartsWith(Scheme + "://", StringComparison.OrdinalIgnoreCase)) + { + tls = false; + rest = text[(Scheme.Length + 3)..]; + } + else + { + return "only telnet:// and telnets:// links are followed"; + } + + var end = rest.IndexOfAny(['/', '?', '#']); + var authority = end < 0 ? rest : rest[..end]; + var tail = end < 0 ? string.Empty : rest[end..]; + if (tail.Length > 0 && tail != "/") + { + return "the link has a path, query or fragment; a telnet link names only a host and port"; + } + + if (authority.Contains('@')) + { + return "the link carries a user name or password, which this client will not send"; + } + + if (authority.Contains('%') || authority.Contains('\\')) + { + return "the link's host is escaped"; + } + + if (authority.Length == 0) + { + return "the link names no host"; + } + + if (!authority.StartsWith('[') && authority.Count(c => c == ':') > 1) + { + return "an IPv6 address in a link must be in brackets"; + } + + if (authority.EndsWith(':')) + { + return "the link's port is empty"; + } + + var defaultPort = tls ? DefaultSecurePort : DefaultPort; + if (ConnectEndpoint.Parse([authority], defaultPort) is not { } endpoint) + { + return "the link's host or port is not valid (a port is 1 to 65535)"; + } + + link = new TelnetLink(endpoint.Host, endpoint.Port, tls); + return null; + } + + /// The host as /connect takes it: an IPv6 address in brackets. + public string HostForCommand => Host.Contains(':') ? $"[{Host}]" : Host; + + /// The link back as text, for a message: telnets://host:992. + public override string ToString() => $"{(Tls ? SecureScheme : Scheme)}://{HostForCommand}:{Port}"; +} diff --git a/src/SharpMUTerm.Tui/ClientUsage.cs b/src/SharpMUTerm.Tui/ClientUsage.cs index 1577bc43..9c450d5b 100644 --- a/src/SharpMUTerm.Tui/ClientUsage.cs +++ b/src/SharpMUTerm.Tui/ClientUsage.cs @@ -23,12 +23,35 @@ internal static class ClientOptions new("--tls", "Connect over TLS."), new("--insecure", "Accept invalid TLS certificates."), new("--name ", "Display name for the world."), + new("telnet://host[:port]", "A telnet:// or telnets:// link: connect to it as '/connect host port' would.", + "A client already running is handed the link instead, and this launch exits."), + new(OpenLink + " ", "What a desktop runs when a link is clicked: the link, and nothing else on the", + "command line is read."), ]; + /// + /// The flag the desktop's link handlers pass the link after (sharpmuterm-window --open-link %U on Linux, + /// "…sharpmuterm-window.exe" --open-link "%1" on Windows). + /// + public const string OpenLink = "--open-link"; + + /// + /// With on the command line, only the argument after it — every other argument is dropped, + /// before anything reads them. A link is text from a web page, and a Windows handler builds a command line by + /// pasting it into quotes: a link holding a quote could close them and add arguments of its own + /// (--render-png writes a file). Whatever it adds lands after the link, and is thrown away here. With no + /// , the arguments are returned as they were. + /// + public static string[] NarrowToLink(string[] args) + { + var at = Array.IndexOf(args, OpenLink); + return at < 0 ? args : at + 1 < args.Length ? [args[at + 1]] : []; + } + /// The options that take a value, so their value is never mistaken for the host. public static IReadOnlySet TakingValues { get; } = new HashSet(StringComparer.Ordinal) { - "--name", "--size", "--view", "--out", "--theme", "--transparency", "--font", "--font-size", "--render-png", + "--name", "--size", "--view", "--out", "--theme", "--transparency", "--font", "--font-size", "--render-png", OpenLink, }; /// The arguments that are not an option or an option's value: the host, then the port. @@ -119,8 +142,10 @@ public static void Write(TextWriter usage, UsageLauncher launcher, HostKeys keys // Named because it is the file a user has to know about to look after it — and because "where did my // password go" should be answerable without reading the source. Config is safe to share; this is not. - usage.WriteLine($"Secrets: {SecretsStore.PathFor(ConfigurationStore.DefaultPath)}" - + " — character passwords, plain text, owner-only. Not the file to paste."); + usage.WriteLine("Passwords: the system's credential store (Windows Credential Manager, the Secret Service"); + usage.WriteLine("keyring, the macOS Keychain) where there is one that answers; otherwise, and for any it refuses,"); + usage.WriteLine($" {SecretsStore.PathFor(ConfigurationStore.DefaultPath)}" + + " — plain text, owner-only. Not the file to paste."); // Named for the same reason: it is a file this client creates in the user's own directory, and // "what is this and can I delete it" should be answerable from the help page. It can: it is a diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index dd7195f9..2155f61a 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -119,6 +119,13 @@ internal sealed record ClientHost /// public required INativeComposer? NativeComposer { get; init; } + /// + /// Where the title for what is in front goes (Character@World — SharpMUTerm, + /// ): the desktop window's title bar, or the terminal's own + /// title through OSC 2. Null in the snapshot, the tests and --plain, which have no title to set. + /// + public required IWindowTitle? Title { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -160,6 +167,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Chrome = HostChrome.None, NativePalette = null, NativeComposer = null, + Title = new TerminalTitle(driver), }; /// @@ -186,6 +194,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Chrome = HostChrome.None, NativePalette = null, NativeComposer = null, + Title = null, }; /// @@ -234,6 +243,7 @@ internal static ClientHost HarnessTerminal( FocusReporting = focusReporting ?? PlatformDecodesFocusReports, Audio = null, // a test never makes a noise Presence = null, // nor talks to Discord + Title = null, // nor retitles the terminal running the suite }; } diff --git a/src/SharpMUTerm.Tui/Hosting/CredentialStores.cs b/src/SharpMUTerm.Tui/Hosting/CredentialStores.cs new file mode 100644 index 00000000..9b29d772 --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/CredentialStores.cs @@ -0,0 +1,347 @@ +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; +using System.Text; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Tui; + +/// +/// Which OS credential store this machine has, for . In Hosting/ because it asks +/// which platform it is on, and that question is a host's. Only the live entry points (Program, the window) +/// call ; a snapshot, a test and the parity harness never do, so none of them reads or +/// writes a real keychain. +/// +internal static class CredentialStores +{ + /// + /// The store this machine offers: Windows Credential Manager, the Secret Service through secret-tool on + /// Linux and the BSDs, the login Keychain through security on macOS. Null when there is none to try — then + /// secrets.json holds every password, as it always did. A store that is present but does not answer (no + /// Secret Service in an ssh session) is still returned; its reads say + /// and the vault falls back per password. + /// + public static ICredentialStore? ForThisMachine() + { + if (OperatingSystem.IsWindows()) + { + return new WindowsCredentialStore(); + } + + if (OperatingSystem.IsMacOS()) + { + return ProgramRunner.Find("security") is { } security ? new MacKeychainStore(security) : null; + } + + return ProgramRunner.Find("secret-tool") is { } secretTool ? new SecretToolStore(secretTool) : null; + } + + /// The name an entry is stored under, the same on every platform: SharpMUTerm/<guid>. + internal static string TargetFor(Guid id) => $"SharpMUTerm/{id:D}"; +} + +/// +/// Windows Credential Manager, through CredWriteW/CredReadW/CredDeleteW: a generic credential per +/// password, named SharpMUTerm/<guid>, kept for the local machine's user (not roamed). Built here, never +/// run by a test; nobody has run it on Windows yet. +/// +[SupportedOSPlatform("windows")] +internal sealed class WindowsCredentialStore : ICredentialStore +{ + private const int CredTypeGeneric = 1; + private const int CredPersistLocalMachine = 2; + private const int ErrorNotFound = 1168; + + public string Name => "Windows Credential Manager"; + + public CredentialLookup TryRead(Guid id, out string? password) + { + password = null; + try + { + if (!CredRead(CredentialStores.TargetFor(id), CredTypeGeneric, 0, out var handle)) + { + return Marshal.GetLastWin32Error() == ErrorNotFound ? CredentialLookup.Missing : CredentialLookup.Unavailable; + } + + try + { + var credential = Marshal.PtrToStructure(handle); + if (credential.CredentialBlobSize > 0 && credential.CredentialBlob != IntPtr.Zero) + { + password = Marshal.PtrToStringUni(credential.CredentialBlob, (int)credential.CredentialBlobSize / 2); + } + + return string.IsNullOrEmpty(password) ? CredentialLookup.Missing : CredentialLookup.Found; + } + finally + { + CredFree(handle); + } + } + catch (Exception e) when (e is DllNotFoundException or EntryPointNotFoundException or Win32Exception) + { + return CredentialLookup.Unavailable; + } + } + + public bool Write(Guid id, string password) + { + var blob = Marshal.StringToCoTaskMemUni(password); + try + { + var credential = new Credential + { + Type = CredTypeGeneric, + TargetName = CredentialStores.TargetFor(id), + Comment = "A character password saved by SharpMUTerm", + CredentialBlobSize = (uint)(password.Length * 2), + CredentialBlob = blob, + Persist = CredPersistLocalMachine, + UserName = Environment.UserName, + }; + return CredWrite(ref credential, 0); + } + catch (Exception e) when (e is DllNotFoundException or EntryPointNotFoundException or Win32Exception) + { + return false; + } + finally + { + Marshal.ZeroFreeCoTaskMemUnicode(blob); + } + } + + public bool Delete(Guid id) + { + try + { + return CredDelete(CredentialStores.TargetFor(id), CredTypeGeneric, 0) || Marshal.GetLastWin32Error() == ErrorNotFound; + } + catch (Exception e) when (e is DllNotFoundException or EntryPointNotFoundException or Win32Exception) + { + return false; + } + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + private struct Credential + { + public int Flags; + public int Type; + public string TargetName; + public string? Comment; + public long LastWritten; + public uint CredentialBlobSize; + public IntPtr CredentialBlob; + public int Persist; + public int AttributeCount; + public IntPtr Attributes; + public string? TargetAlias; + public string? UserName; + } + + [DllImport("advapi32.dll", EntryPoint = "CredReadW", CharSet = CharSet.Unicode, SetLastError = true)] + private static extern bool CredRead(string target, int type, int flags, out IntPtr credential); + + [DllImport("advapi32.dll", EntryPoint = "CredWriteW", CharSet = CharSet.Unicode, SetLastError = true)] + private static extern bool CredWrite(ref Credential credential, int flags); + + [DllImport("advapi32.dll", EntryPoint = "CredDeleteW", CharSet = CharSet.Unicode, SetLastError = true)] + private static extern bool CredDelete(string target, int type, int flags); + + [DllImport("advapi32.dll", SetLastError = true)] + private static extern void CredFree(IntPtr buffer); +} + +/// +/// The freedesktop Secret Service (GNOME Keyring, KWallet, KeePassXC) through libsecret's secret-tool, with the +/// attributes application=sharpmuterm and ref=<guid>. The password goes over the tool's stdin and +/// comes back on its stdout, never on a command line. Exercised against a gnome-keyring daemon on a private D-Bus. +/// +/// secret-tool lookup exits 1 with nothing on stderr when there is no such item, and exits 1 with a message +/// when there is no service ("Cannot autolaunch D-Bus…"): the second is . +/// A locked collection may put up its unlock prompt; the wait is bounded, and a prompt left unanswered reads as +/// unavailable, so the client starts. +/// +/// +internal sealed class SecretToolStore(string executable) : ICredentialStore +{ + private const string Application = "sharpmuterm"; + + public string Name => "the Secret Service keyring"; + + public CredentialLookup TryRead(Guid id, out string? password) + { + password = null; + var result = ProgramRunner.Run(executable, ["lookup", "application", Application, "ref", id.ToString("D")], null); + if (result is null) + { + return CredentialLookup.Unavailable; + } + + if (result.Value.ExitCode == 0) + { + password = result.Value.Output; + return string.IsNullOrEmpty(password) ? CredentialLookup.Missing : CredentialLookup.Found; + } + + return result.Value.ExitCode == 1 && string.IsNullOrWhiteSpace(result.Value.Error) + ? CredentialLookup.Missing + : CredentialLookup.Unavailable; + } + + public bool Write(Guid id, string password) => + ProgramRunner.Run( + executable, + ["store", "--label", $"SharpMUTerm character password ({id:D})", "application", Application, "ref", id.ToString("D")], + password) is { ExitCode: 0 }; + + public bool Delete(Guid id) + { + var result = ProgramRunner.Run(executable, ["clear", "application", Application, "ref", id.ToString("D")], null); + + // `clear` exits 1 with nothing to say when there was nothing to clear. + return result is { ExitCode: 0 } || result is { ExitCode: 1, Error: var error } && string.IsNullOrWhiteSpace(error); + } +} + +/// +/// The macOS login Keychain, through security: a generic password per character, service SharpMUTerm, +/// account the GUID. The write goes through security -i reading its command from stdin, so the password is never +/// on a command line where ps would show it. Built here, never run: nobody has tried it on a Mac. +/// +internal sealed class MacKeychainStore(string executable) : ICredentialStore +{ + private const string Service = "SharpMUTerm"; + private const int ItemNotFound = 44; + + public string Name => "the macOS Keychain"; + + public CredentialLookup TryRead(Guid id, out string? password) + { + password = null; + var result = ProgramRunner.Run(executable, ["find-generic-password", "-s", Service, "-a", id.ToString("D"), "-w"], null); + if (result is null) + { + return CredentialLookup.Unavailable; + } + + if (result.Value.ExitCode == ItemNotFound) + { + return CredentialLookup.Missing; + } + + if (result.Value.ExitCode != 0) + { + return CredentialLookup.Unavailable; + } + + // `-w` prints the password and a newline. + password = result.Value.Output.EndsWith('\n') ? result.Value.Output[..^1] : result.Value.Output; + return string.IsNullOrEmpty(password) ? CredentialLookup.Missing : CredentialLookup.Found; + } + + public bool Write(Guid id, string password) + { + // security -i reads one command per line, with double-quoted words and backslash escapes; a password holding a + // line break cannot be said that way, and goes to the file instead. + if (password.Contains('\n') || password.Contains('\r')) + { + return false; + } + + var quoted = password.Replace("\\", "\\\\", StringComparison.Ordinal).Replace("\"", "\\\"", StringComparison.Ordinal); + var command = $"add-generic-password -U -s {Service} -a {id:D} -l \"SharpMUTerm character password\" -w \"{quoted}\"\n"; + return ProgramRunner.Run(executable, ["-i"], command) is { ExitCode: 0, Error: var error } && string.IsNullOrWhiteSpace(error); + } + + public bool Delete(Guid id) + { + var result = ProgramRunner.Run(executable, ["delete-generic-password", "-s", Service, "-a", id.ToString("D")], null); + return result is { ExitCode: 0 or ItemNotFound }; + } +} + +/// Runs a credential tool with its arguments as a list (never a shell string), a bounded wait, and stdin. +internal static class ProgramRunner +{ + /// + /// How long a store may take. Long enough to answer an unlock prompt the store puts up; short enough that a store + /// nobody answers does not hold the client's start for ever. + /// + public static readonly TimeSpan Patience = TimeSpan.FromSeconds(30); + + /// The full path of on PATH, or null. + public static string? Find(string name) + { + foreach (var folder in (Environment.GetEnvironmentVariable("PATH") ?? string.Empty).Split(Path.PathSeparator)) + { + if (folder.Length > 0 && Path.Combine(folder, name) is var candidate && File.Exists(candidate)) + { + return candidate; + } + } + + return null; + } + + /// Exit code, stdout and stderr; null when the program could not be started or did not finish in time. + public static (int ExitCode, string Output, string Error)? Run(string executable, IReadOnlyList arguments, string? input) + { + var start = new ProcessStartInfo(executable) + { + RedirectStandardInput = true, + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + CreateNoWindow = true, + StandardOutputEncoding = Encoding.UTF8, + StandardErrorEncoding = Encoding.UTF8, + StandardInputEncoding = new UTF8Encoding(false), + }; + foreach (var argument in arguments) + { + start.ArgumentList.Add(argument); + } + + try + { + using var process = Process.Start(start); + if (process is null) + { + return null; + } + + var output = process.StandardOutput.ReadToEndAsync(); + var error = process.StandardError.ReadToEndAsync(); + using (var stdin = process.StandardInput) + { + if (input is not null) + { + stdin.Write(input); + } + } + + if (!process.WaitForExit(Patience)) + { + try + { + process.Kill(entireProcessTree: true); + } + catch (Exception e) when (e is InvalidOperationException or Win32Exception) + { + } + + return null; + } + + return (process.ExitCode, output.GetAwaiter().GetResult(), error.GetAwaiter().GetResult()); + } + catch (Exception e) when (e is Win32Exception or InvalidOperationException or IOException) + { + return null; + } + } +} diff --git a/src/SharpMUTerm.Tui/Hosting/LinkHandoff.cs b/src/SharpMUTerm.Tui/Hosting/LinkHandoff.cs new file mode 100644 index 00000000..4d53505f --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/LinkHandoff.cs @@ -0,0 +1,222 @@ +using System.Net.Sockets; +using System.Text; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Links; + +namespace SharpMUTerm.Tui; + +/// +/// Hands a telnet:// link to a client that is already running, so a click in a browser opens a window in the +/// client the player has open rather than a second one beside it. A launch that finds nobody listening runs as a +/// client of its own and listens from then on, so the second instance always works; this only saves it. +/// +/// The channel is a Unix domain socket (Windows 10 and later have them too) in a folder only the user can reach: +/// $XDG_RUNTIME_DIR/sharpmuterm where there is one, else the folder config.json is in. The socket file +/// is made owner-only as well. What crosses it is one line holding the link, at most +/// bytes, and the receiver reads it as the untrusted text it is +/// ( runs it through again): whoever writes to +/// the socket can do what clicking a link does, and nothing more. +/// +/// +/// A socket file nobody answers on is a client that ended without removing it; it is deleted and taken over. The +/// running client answers ok once it has the link, so a sender never exits on a link nobody took. +/// +/// +internal sealed class LinkHandoff : IDisposable +{ + private const string Acknowledgement = "ok"; + private static readonly TimeSpan Patience = TimeSpan.FromSeconds(2); + + private readonly Socket _listener; + private readonly string _path; + private readonly CancellationTokenSource _stop = new(); + + private LinkHandoff(Socket listener, string path) + { + _listener = listener; + _path = path; + } + + /// Where the socket is: in the user's runtime folder, else beside the configuration. + public static string SocketPath() + { + var runtime = Environment.GetEnvironmentVariable("XDG_RUNTIME_DIR"); + var folder = !OperatingSystem.IsWindows() && !string.IsNullOrEmpty(runtime) && Directory.Exists(runtime) + ? Path.Combine(runtime, "sharpmuterm") + : Path.GetDirectoryName(ConfigurationStore.DefaultPath)!; + return Path.Combine(folder, "links.sock"); + } + + /// + /// Gives to a running client. True once that client has said it has it; false when no + /// client is listening, or it did not answer, and this launch should run the link itself. + /// + public static bool TrySend(string link, string? path = null) + { + path ??= SocketPath(); + if (!File.Exists(path) || link.Length > TelnetLink.MaxLength || link.Contains('\n')) + { + return false; + } + + try + { + using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified); + socket.ReceiveTimeout = (int)Patience.TotalMilliseconds; + socket.SendTimeout = (int)Patience.TotalMilliseconds; + socket.Connect(new UnixDomainSocketEndPoint(path)); + socket.Send(Encoding.ASCII.GetBytes(link + "\n")); + var reply = new byte[8]; + var read = socket.Receive(reply); + return Encoding.ASCII.GetString(reply, 0, read).StartsWith(Acknowledgement, StringComparison.Ordinal); + } + catch (Exception e) when (e is SocketException or IOException or ObjectDisposedException or ArgumentException) + { + return false; + } + } + + /// + /// Starts listening for links from later launches, raising on a pool thread with each + /// line as it arrived (unparsed). Null when another client is already listening, or the socket cannot be made — + /// later launches then run their links themselves. + /// + public static LinkHandoff? Listen(Action received, string? path = null) + { + path ??= SocketPath(); + try + { + var folder = Path.GetDirectoryName(path)!; + if (OperatingSystem.IsWindows()) + { + Directory.CreateDirectory(folder); + } + else + { + Directory.CreateDirectory(folder, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute); + } + + if (File.Exists(path)) + { + if (Answers(path)) + { + return null; + } + + File.Delete(path); + } + + var listener = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified); + listener.Bind(new UnixDomainSocketEndPoint(path)); + if (!OperatingSystem.IsWindows()) + { + File.SetUnixFileMode(path, UnixFileMode.UserRead | UnixFileMode.UserWrite); + } + + listener.Listen(4); + var handoff = new LinkHandoff(listener, path); + _ = Task.Run(() => handoff.AcceptAsync(received)); + return handoff; + } + catch (Exception e) when (e is SocketException or IOException or UnauthorizedAccessException or PlatformNotSupportedException or ArgumentException) + { + return null; + } + } + + private static bool Answers(string path) + { + try + { + using var probe = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified); + probe.Connect(new UnixDomainSocketEndPoint(path)); + return true; + } + catch (SocketException) + { + return false; + } + } + + private async Task AcceptAsync(Action received) + { + while (!_stop.IsCancellationRequested) + { + Socket connection; + try + { + connection = await _listener.AcceptAsync(_stop.Token); + } + catch (Exception e) when (e is OperationCanceledException or ObjectDisposedException or SocketException) + { + return; + } + + _ = Task.Run(async () => + { + using (connection) + { + if (await ReadLineAsync(connection) is { } line) + { + received(line); + try + { + await connection.SendAsync(Encoding.ASCII.GetBytes(Acknowledgement + "\n")); + } + catch (Exception e) when (e is SocketException or ObjectDisposedException) + { + // The sender gave up waiting; the link is taken all the same. + } + } + } + }); + } + } + + /// One line, bounded in length and in time; null for anything else. + private async Task ReadLineAsync(Socket connection) + { + using var timeout = CancellationTokenSource.CreateLinkedTokenSource(_stop.Token); + timeout.CancelAfter(Patience); + var buffer = new byte[TelnetLink.MaxLength + 2]; + var filled = 0; + try + { + while (filled < buffer.Length) + { + var read = await connection.ReceiveAsync(buffer.AsMemory(filled), timeout.Token); + if (read == 0) + { + break; + } + + var newline = Array.IndexOf(buffer, (byte)'\n', filled, read); + filled += read; + if (newline >= 0) + { + return Encoding.ASCII.GetString(buffer, 0, newline); + } + } + } + catch (Exception e) when (e is OperationCanceledException or SocketException or ObjectDisposedException) + { + } + + return null; + } + + public void Dispose() + { + _stop.Cancel(); + _listener.Dispose(); + try + { + File.Delete(_path); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + } + + _stop.Dispose(); + } +} diff --git a/src/SharpMUTerm.Tui/Hosting/TerminalTitle.cs b/src/SharpMUTerm.Tui/Hosting/TerminalTitle.cs new file mode 100644 index 00000000..d9100470 --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/TerminalTitle.cs @@ -0,0 +1,54 @@ +using SharpConsoleUI.Drivers; + +namespace SharpMUTerm.Tui; + +/// Where the client's title goes (), as a host shows it. +internal interface IWindowTitle +{ + /// Shows . Called on the client's thread, only when the title changed. + void Show(string title); + + /// Gives the title back to whatever had it before the client: called once, as the client's loop ends. + void Restore(); +} + +/// +/// The terminal's title (its window or tab), set with OSC 2 (ESC ] 2 ; title ST), which every terminal this +/// client runs in implements. Written through the driver's one raw write that is serialised against frame painting, +/// the path uses for ?1004. +/// +/// Before the first title the terminal is asked to keep the one it had (xterm's title stack, CSI 22 ; 2 t), and +/// on the way out to put it back (CSI 23 ; 2 t), so the shell's own title returns when the client quits. +/// kitty, foot, WezTerm, xterm and VTE honour the stack; a terminal that does not ignores the request, and keeps the +/// client's last title until the shell sets its own. +/// +/// +internal sealed class TerminalTitle(IConsoleDriver driver) : IWindowTitle +{ + private const string PushTitle = "\u001b[22;2t"; + private const string PopTitle = "\u001b[23;2t"; + private bool _pushed; + + public void Show(string title) + { + var prefix = _pushed ? string.Empty : PushTitle; + _pushed = true; + driver.WriteClipboardOsc52($"{prefix}{Sequence(title)}"); + } + + public void Restore() + { + if (_pushed) + { + _pushed = false; + driver.WriteClipboardOsc52(PopTitle); + } + } + + /// The OSC 2 for , with every control character taken out so nothing ends it early. + internal static string Sequence(string title) + { + var clean = new string(title.Where(c => !char.IsControl(c)).ToArray()); + return $"\u001b]2;{clean}\u001b\\"; + } +} diff --git a/src/SharpMUTerm.Tui/Program.cs b/src/SharpMUTerm.Tui/Program.cs index 655baf21..eda9ac30 100644 --- a/src/SharpMUTerm.Tui/Program.cs +++ b/src/SharpMUTerm.Tui/Program.cs @@ -2,6 +2,7 @@ using SharpMUTerm.Core.Theming; using Microsoft.Extensions.Logging; using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Links; using SharpMUTerm.Core.Mapping; using SharpMUTerm.Core.Media; using SharpMUTerm.Core.Packages; @@ -16,6 +17,8 @@ internal static class Program { private static int Main(string[] args) { + // A desktop link handler's launch: the link and nothing else (ClientOptions.NarrowToLink says why). + args = ClientOptions.NarrowToLink(args); if (args.Contains("--help") || args.Contains("-h")) { PrintUsage(); @@ -27,11 +30,22 @@ private static int Main(string[] args) return WindowHandoff.Run(args, Console.Error); } + // A telnet:// link a desktop launched us with goes to the client already running, when there is one; this + // launch then has nothing left to do. Not for a snapshot, which never talks to a running client. + var snapshot = args.Contains("--snapshot"); + if (!snapshot && LinkArgument(args) is { } link && LinkHandoff.TrySend(link)) + { + return 0; + } + // Anything the load wants to say about the secrets file is collected here and logged once diagnostics // exist — the pipeline is built further down, and this runs before it. It is deliberately a list that // is drained exactly once: a secrets problem is a startup fact, not a recurring notice. + // A snapshot reads passwords from secrets.json alone: it never asks the OS credential store, which can put + // up an unlock prompt and is nothing a rendered frame needs. var loadNotices = new List(); - var config = LoadConfiguration(loadNotices.Add); + var vault = snapshot ? null : LiveVault(); + var config = LoadConfiguration(loadNotices.Add, vault); var capabilities = DetectCapabilities(config); // Headless snapshot: render one demo frame to ANSI (for docs images / CI golden files) and @@ -106,10 +120,10 @@ private static int Main(string[] args) var stdout = Console.Out; Console.SetIn(TextReader.Null); var plain = PlainHost.Create(capabilities, stdout); - return RunLive(args, config, loadNotices, plain, app => PlainHost.PumpInput(stdin, (HeadlessConsoleDriver)plain.Driver, app)); + return RunLive(args, config, loadNotices, plain, app => PlainHost.PumpInput(stdin, (HeadlessConsoleDriver)plain.Driver, app), vault); } - return RunLive(args, config, loadNotices, ClientHost.Terminal(capabilities)); + return RunLive(args, config, loadNotices, ClientHost.Terminal(capabilities), vault: vault); } /// @@ -123,7 +137,8 @@ internal static int RunLive( AppConfiguration config, IReadOnlyList loadNotices, ClientHost host, - Action? ready = null) + Action? ready = null, + CredentialVault? vault = null) { // What this launch connects: the command line's host if one was typed, else whatever is marked // `at start` on F5, else nothing at all. The precedence lives in Core (StartupConnections) so it @@ -201,7 +216,7 @@ internal static int RunLive( config, host, diagnostics: diagnostics, - save: saved => ConfigurationStore.Save(ConfigurationStore.DefaultPath, saved), + save: saved => ConfigurationStore.Save(ConfigurationStore.DefaultPath, saved, vault), logRoot: logRoot, restore: restore, mssp: mssp, @@ -213,6 +228,16 @@ internal static int RunLive( spelling: () => OpenDictionary(loadLogger), autoLayout: true); ready?.Invoke(liveApp); + + // A telnet:// link on the command line is followed once the loop runs, the way /connect host port would be; + // links later launches hand over (LinkHandoff) are followed the same way, as they arrive. Both are read as the + // untrusted text they are by OpenLink. + if (LinkArgument(args) is { } link) + { + liveApp.OnUiThread(() => liveApp.OpenLink(link)); + } + + using var links = LinkHandoff.Listen(text => liveApp.OnUiThread(() => liveApp.OpenLink(text))); int exitCode; try { @@ -235,7 +260,7 @@ internal static int RunLive( try { config.LastSession = liveApp.CaptureSession(); - ConfigurationStore.Save(ConfigurationStore.DefaultPath, config); + ConfigurationStore.Save(ConfigurationStore.DefaultPath, config, vault); } catch { @@ -265,11 +290,16 @@ private static (int Width, int Height) ParseSize(string[] args) /// Loads the configuration, collecting anything the store wants reported into /// for the caller to log once diagnostics exist. /// - internal static AppConfiguration LoadConfiguration(Action report) + /// Collects anything worth a line in the diagnostics log. + /// + /// Where the passwords are kept (), or null for secrets.json alone. The same vault + /// goes to , whose saves need what this load learned. + /// + internal static AppConfiguration LoadConfiguration(Action report, CredentialVault? vault = null) { try { - return ConfigurationStore.Load(ConfigurationStore.DefaultPath, report); + return ConfigurationStore.Load(ConfigurationStore.DefaultPath, report, vault); } catch { @@ -301,7 +331,7 @@ internal static TerminalCapabilities DetectCapabilities(AppConfiguration config) /// private static WorldDefinition? CommandLineWorld(string[] args) { - var positional = ClientOptions.Positional(args); + var positional = ClientOptions.Positional(args).Where(word => !TelnetLink.LooksLikeLink(word)).ToArray(); if (positional.Length >= 1) { var host = positional[0]; @@ -319,6 +349,19 @@ internal static TerminalCapabilities DetectCapabilities(AppConfiguration config) return null; } + /// + /// The telnet:// or telnets:// link on the command line — what a desktop passes when a link is + /// clicked (sharpmuterm-window %U) — unread; reads it. + /// + internal static string? LinkArgument(string[] args) => + ClientOptions.Positional(args).FirstOrDefault(TelnetLink.LooksLikeLink); + + /// + /// The live client's password vault: the OS credential store this machine has (), + /// with secrets.json behind it. Only the live entry points make one. + /// + internal static CredentialVault LiveVault() => new(CredentialStores.ForThisMachine()); + internal static string? GetOption(string[] args, string name) { var index = Array.IndexOf(args, name); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Announce.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Announce.cs index 785349ab..a83e7883 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Announce.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Announce.cs @@ -17,10 +17,51 @@ internal sealed partial class SharpMUTermApp private void AnnounceLine(string windowId, string text) { - if (Host.Announcer is { } announcer && !_quietWindows.Contains(windowId) && text.Trim().Length > 0) + if (Host.Announcer is not { } announcer) + { + return; + } + + if (!_quietWindows.Contains(windowId) && text.Trim().Length > 0) { announcer.Announce(text, AnnouncementKind.Output); } + + // A quiet window is not spoken as lines arrive, but a reader that asks the output view for its text still + // gets the window in front, quiet or not. + if (windowId == ActiveWindowId()) + { + PublishReading(windowId); + } + } + + /// + /// Hands the host the window in front and its newest lines (), which the window + /// exposes as its output view's text for a screen reader to read at its own pace. Plain text from the pane's own + /// buffer, so it is what ⌃F searches: chrome rows carry none and are left out. + /// + private void PublishReading(string windowId) + { + if (Host.Announcer is not { } announcer) + { + return; + } + + var lines = new List(IAnnouncer.ReadingLines); + if (_lines.TryGetValue(windowId, out var buffer)) + { + for (var i = buffer.Count - 1; i >= 0 && lines.Count < IAnnouncer.ReadingLines; i--) + { + if (buffer[i].Plain is { Length: > 0 } plain) + { + lines.Add(plain); + } + } + + lines.Reverse(); + } + + announcer.Reading(WindowTitle(windowId), lines); } private void AnnounceNotice(string text) => Host.Announcer?.Announce(text, AnnouncementKind.Notice); @@ -30,6 +71,7 @@ private void AnnounceFocus(string windowId) if (Host.Announcer is { } announcer) { announcer.Announce(WindowTitle(windowId), AnnouncementKind.Focus); + PublishReading(windowId); } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs index 445c76a2..739caff5 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Connect.cs @@ -1,5 +1,6 @@ using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Links; using SharpMUTerm.Core.Session; using static SharpMUTerm.Tui.MarkupText; @@ -10,11 +11,15 @@ namespace SharpMUTerm.Tui; /// is read as a host (and port), saved as a new world and dialled. It exists because --plain has no /// settings screens a screen reader can use, so a first run there had no way to add a world at all, and it is /// the quickest way in everywhere else too. +/// +/// A telnet:// link () ends in the same place, through the same reader, so a link can do +/// nothing /connect cannot. +/// /// internal sealed partial class SharpMUTermApp { /// The port a host given without one is dialled on, the same default as the command line's. - internal const int DefaultConnectPort = 4000; + internal const int DefaultConnectPort = ConnectEndpoint.DefaultPort; /// What /connect with nothing after it says. internal const string ConnectUsage = "/connect , or /connect [port] [tls] to add one"; @@ -43,35 +48,87 @@ private void ConnectCommand(string windowId, string arguments, Action string.Equals(known.Name, string.Join(' ', words), StringComparison.OrdinalIgnoreCase)); - if (world is null) + if (world is not null) { - if (ParseEndpoint(words) is not { } endpoint) - { - RefuseCommand($"no world called {Snippet(string.Join(' ', words))}, and that is not a host — {ConnectUsage}"); - return; - } + DialWorld(world); + return; + } - world = new WorldDefinition - { - Name = UniqueWorldName(endpoint.Host), - Host = endpoint.Host, - Port = endpoint.Port, - UseTls = tls, - }; - - // A configuration's first world takes the layout the welcome was left at, whether it came from - // the welcome's form or from a /connect typed under it. - if (_config.Worlds.Count == 0) - { - ApplyWelcomeLayout(world); - } + if (ParseEndpoint(words) is not { } endpoint) + { + RefuseCommand($"no world called {Snippet(string.Join(' ', words))}, and that is not a host — {ConnectUsage}"); + return; + } + + ConnectToEndpoint(endpoint.Host, endpoint.Port, tls, shape); + } - shape?.Invoke(world); - _config.Worlds.Add(world); - SaveConfiguration(); - Notice($"added {world.Name} ({world.Host}:{world.Port}) — F5 edits it", MessageSeverity.Info, "F5"); + /// + /// Follows a telnet:// or telnets:// link: the link from the command line a desktop launched the + /// client with, or one a second launch handed to this one. The link is server text, read by + /// ; all it can do is what /connect host port does. A world already configured for + /// the same host, port and TLS is dialled rather than added again — matched on the endpoint and never on a name, + /// so a link cannot reach a world by naming it. Nothing is sent: a world a link adds has no character, and an + /// existing world logs in only as its own configuration says. + /// + internal void OpenLink(string text) + { + if (TelnetLink.TryParse(text, out var refusal) is not { } link) + { + RefuseCommand($"not following that link: {refusal}"); + return; + } + + OpenLink(link); + } + + /// + internal void OpenLink(TelnetLink link) + { + var world = _config.Worlds.FirstOrDefault(known => + string.Equals(known.Host, link.Host, StringComparison.OrdinalIgnoreCase) + && known.Port == link.Port + && known.UseTls == link.Tls); + if (world is not null) + { + DialWorld(world); + return; } + ConnectToEndpoint(link.Host, link.Port, link.Tls); + } + + /// + /// Adds a world for and dials it: what /connect host port does once the words are + /// read, and all a telnet:// link can do. + /// + private void ConnectToEndpoint(string host, int port, bool tls, Action? shape = null) + { + var world = new WorldDefinition + { + Name = UniqueWorldName(host), + Host = host, + Port = port, + UseTls = tls, + }; + + // A configuration's first world takes the layout the welcome was left at, whether it came from + // the welcome's form or from a /connect typed under it. + if (_config.Worlds.Count == 0) + { + ApplyWelcomeLayout(world); + } + + shape?.Invoke(world); + _config.Worlds.Add(world); + SaveConfiguration(); + Notice($"added {world.Name} ({world.Host}:{world.Port}) — F5 edits it", MessageSeverity.Info, "F5"); + DialWorld(world); + } + + /// Opens 's first character (or the world alone), brings it forward and dials it. + private void DialWorld(WorldDefinition world) + { var character = world.Characters.FirstOrDefault(); var key = character is null ? world.Name : $"{world.Name}.{character.Name}"; var session = _sessions.Find(key); @@ -96,52 +153,10 @@ private static bool IsTlsWord(string word) => || word.Equals("--tls", StringComparison.OrdinalIgnoreCase); /// - /// Reads host port, host:port or a bare host. A bracketed IPv6 address keeps its colons. Null - /// when the words are not one host with at most one port, so a mistyped world name is refused rather than - /// saved as a world that dials a host called "my world". + /// Reads host port, host:port or a bare host (, the one reader + /// /connect, the welcome and a telnet:// link share). /// - internal static (string Host, int Port)? ParseEndpoint(IReadOnlyList words) - { - if (words.Count is 0 or > 2) - { - return null; - } - - var host = words[0]; - var port = DefaultConnectPort; - if (words.Count == 2) - { - if (!TryPort(words[1], out port)) - { - return null; - } - } - else if (host.StartsWith('[') && host.IndexOf("]:", StringComparison.Ordinal) is var close and > 0) - { - if (!TryPort(host[(close + 2)..], out port)) - { - return null; - } - - host = host[..(close + 1)]; - } - else if (host.Count(c => c == ':') == 1) - { - var colon = host.IndexOf(':'); - if (!TryPort(host[(colon + 1)..], out port)) - { - return null; - } - - host = host[..colon]; - } - - host = host.Trim('[', ']'); - return Uri.CheckHostName(host) == UriHostNameType.Unknown ? null : (host, port); - } - - private static bool TryPort(string text, out int port) => - int.TryParse(text, out port) && port is > 0 and <= 65535; + internal static (string Host, int Port)? ParseEndpoint(IReadOnlyList words) => ConnectEndpoint.Parse(words); /// A world name not already taken: the host, then the host with a number after it. private string UniqueWorldName(string host) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs new file mode 100644 index 00000000..49fb5dbc --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs @@ -0,0 +1,45 @@ +using SharpMUTerm.Client.Chrome; + +namespace SharpMUTerm.Tui; + +/// +/// The window's title: Character@World — SharpMUTerm for what is in front (), handed +/// to the host's — the desktop window's title bar, the terminal's OSC 2. Worked out +/// whenever the header is, from the header's own model, so the title and the header always name the same character; +/// the header is rebuilt on every activation, connect and disconnect. +/// +internal sealed partial class SharpMUTermApp +{ + private string? _shownTitle; + + // Nothing is written to the host before Run: a terminal is not ours to write to until the loop has it. + private bool _titleLive; + + /// What was last handed to the host, for the tests; null before the first header. + internal string? ShownTitle => _shownTitle; + + private void PublishTitle(HeaderModel header) + { + var title = SharpMUTerm.Client.Chrome.WindowTitle.For(header); + if (title == _shownTitle) + { + return; + } + + _shownTitle = title; + if (_titleLive) + { + Host.Title?.Show(title); + } + } + + /// Called by : from now on the title goes to the host, starting with the one already worked out. + internal void StartTitle() + { + _titleLive = true; + if (_shownTitle is { } title) + { + Host.Title?.Show(title); + } + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index cc05b185..12229613 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1067,11 +1067,15 @@ public int Run(IReadOnlyList startup) // Here and not in the constructor: this is the one method that means "there is a live terminal // in front of this app", and asking a terminal to report focus is a write to it. _focus.Start(); + StartTitle(); var exitCode = _system.Run(); // The colours are kitty's, not this window's: left set, they would go on drawing the shell's own // output translucent wherever it happens to use one of them. ResetTransparentColours(); + + // The terminal's own title goes back to the shell's, as the colours do. + Host.Title?.Restore(); return exitCode; } @@ -13534,7 +13538,12 @@ private void RefreshHeader() /// The design header row: the brand affordance on the left, the active world (with its accent) /// in the middle, and connection/graphics/palette hints on the right. /// - private string HeaderMarkup() => HeaderMarkup(BuildHeaderModel()); + private string HeaderMarkup() + { + var model = BuildHeaderModel(); + PublishTitle(model); + return HeaderMarkup(model); + } /// /// The header as a view-model (): what the band says, with no presentation. The cell diff --git a/tests/SharpMUTerm.Avalonia.Tests/OutputAutomationTests.cs b/tests/SharpMUTerm.Avalonia.Tests/OutputAutomationTests.cs new file mode 100644 index 00000000..41084050 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/OutputAutomationTests.cs @@ -0,0 +1,81 @@ +using Avalonia.Automation; +using Avalonia.Automation.Peers; +using Avalonia.Automation.Provider; +using Avalonia.Threading; +using SkiaSharp; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// What the platform's accessibility API finds on the cells, read through Avalonia's own automation peers in a +/// headless window. Not tried with NVDA, Narrator, VoiceOver or Orca: this proves what the peer says, not what a +/// screen reader then does with it. +/// +public class OutputAutomationTests +{ + [Test] + public async Task TheOutputViewIsAReadOnlyDocumentHoldingTheFrontWindowsLines() + { + var seen = await TerminalViewTests.Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(10, 4); + var view = new TerminalView(driver, SKColors.White, SKColors.Black, 16, null); + var window = new Window { Content = view, Width = 200, Height = 100 }; + window.Show(); + try + { + var peer = ControlAutomationPeer.CreatePeerForElement(view); + var before = (peer.GetName(), peer.GetProvider()?.Value); + + var changes = new List(); + peer.PropertyChanged += (_, e) => changes.Add(e.Property); + driver.Announcer.Reading("Ann", ["You are in the plaza.", "Bea arrives."]); + Dispatcher.UIThread.RunJobs(); + + var value = peer.GetProvider()!; + var threw = false; + try + { + value.SetValue("typed into the output"); + } + catch (InvalidOperationException) + { + threw = true; + } + + return (Before: before, Name: peer.GetName(), Type: peer.GetAutomationControlType(), value.IsReadOnly, + value.Value, Changed: changes.Contains(ValuePatternIdentifiers.ValueProperty), Threw: threw, + Content: peer.IsContentElement()); + } + finally + { + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + await Assert.That(seen.Before.Item1).IsEqualTo("SharpMUTerm output"); + await Assert.That(seen.Before.Item2).IsEqualTo(string.Empty); + await Assert.That(seen.Name).IsEqualTo("SharpMUTerm output: Ann"); + await Assert.That(seen.Type).IsEqualTo(AutomationControlType.Document); + await Assert.That(seen.IsReadOnly).IsTrue(); + await Assert.That(seen.Value).IsEqualTo("You are in the plaza.\nBea arrives."); + await Assert.That(seen.Changed).IsTrue(); + await Assert.That(seen.Threw).IsTrue(); + await Assert.That(seen.Content).IsTrue(); + } + + [Test] + public async Task TheWindowTitleBarCarriesWhatTheClientSaid() + { + var bar = new WindowTitleBar(); + var heard = new List(); + bar.Changed += heard.Add; + + bar.Show("Ann@Mush — SharpMUTerm"); + + await Assert.That(bar.Current).IsEqualTo("Ann@Mush — SharpMUTerm"); + await Assert.That(heard).IsEquivalentTo(new[] { "Ann@Mush — SharpMUTerm" }); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/WindowTitleTests.cs b/tests/SharpMUTerm.Client.Tests/WindowTitleTests.cs new file mode 100644 index 00000000..16744534 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/WindowTitleTests.cs @@ -0,0 +1,45 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Client.Tests; + +/// The one title both hosts show for what is in front: Character@World — SharpMUTerm. +public class WindowTitleTests +{ + [Test] + [Arguments("Corvid", "Aetherfall", "Corvid@Aetherfall — SharpMUTerm")] + [Arguments(null, "Aetherfall", "Aetherfall — SharpMUTerm")] + [Arguments("", "Aetherfall", "Aetherfall — SharpMUTerm")] + [Arguments(null, null, "SharpMUTerm")] + [Arguments(" ", " ", "SharpMUTerm")] + public async Task TheTitleNamesWhoIsInFrontAndWhere(string? character, string? world, string expected) => + await Assert.That(WindowTitle.For(character, world)).IsEqualTo(expected); + + [Test] + public async Task TheTitleIsReadOffTheHeadersOwnModel() + { + var header = HeaderModel.Empty with + { + World = new HeaderWorld("Aetherfall", TerminalColor.Default), + Character = new HeaderCharacter("Corvid", "Aetherfall.Corvid", CharacterPresence.Online, "aetherfall.mux", 4201, false, "x"), + }; + + await Assert.That(WindowTitle.For(header)).IsEqualTo("Corvid@Aetherfall — SharpMUTerm"); + await Assert.That(WindowTitle.For(HeaderModel.Empty)).IsEqualTo(WindowTitle.Product); + } + + /// A title is written into an escape sequence in a terminal, where a BEL or ESC would end it early. + [Test] + public async Task ControlCharactersAreDroppedAndLongNamesAreCut() + { + var title = WindowTitle.For("Cor\u0007vid\u001b]2;x", "evil\r\nworld"); + + await Assert.That(title).IsEqualTo("Corvid]2;x@evilworld — SharpMUTerm"); + await Assert.That(title.Any(char.IsControl)).IsFalse(); + + var longName = new string('n', 200); + var cut = WindowTitle.For(longName, "w"); + await Assert.That(cut).StartsWith(new string('n', WindowTitle.MaxPart - 1) + "…@w"); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Configuration/CredentialVaultTests.cs b/tests/SharpMUTerm.Core.Tests/Configuration/CredentialVaultTests.cs new file mode 100644 index 00000000..fa82cf5a --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Configuration/CredentialVaultTests.cs @@ -0,0 +1,275 @@ +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Tests.Configuration; + +/// +/// Passwords in the OS credential store with secrets.json behind it. Every test uses : +/// nothing here reaches a real keychain, and the files are in a throwaway folder. +/// +public class CredentialVaultTests +{ + /// A credential store in memory that can be told to stop answering or to refuse writes. + internal sealed class FakeStore : ICredentialStore + { + public Dictionary Items { get; } = []; + + public bool Reachable { get; set; } = true; + + public bool RefusesWrites { get; set; } + + public int Writes { get; private set; } + + public string Name => "the fake store"; + + public CredentialLookup TryRead(Guid id, out string? password) + { + password = null; + if (!Reachable) + { + return CredentialLookup.Unavailable; + } + + return Items.TryGetValue(id, out password) ? CredentialLookup.Found : CredentialLookup.Missing; + } + + public bool Write(Guid id, string password) + { + Writes++; + if (!Reachable || RefusesWrites) + { + return false; + } + + Items[id] = password; + return true; + } + + public bool Delete(Guid id) + { + if (!Reachable) + { + return false; + } + + Items.Remove(id); + return true; + } + } + + private sealed class TempRoot : IDisposable + { + public TempRoot() + { + Directory = Path.Combine(Path.GetTempPath(), $"smuterm-vault-{Guid.NewGuid():N}"); + System.IO.Directory.CreateDirectory(Directory); + } + + public string Directory { get; } + + public string ConfigPath => Path.Combine(Directory, "SharpMUTerm", "config.json"); + + public string SecretsPath => Path.Combine(Directory, "SharpMUTerm", SecretsStore.FileName); + + public void Dispose() + { + try + { + System.IO.Directory.Delete(Directory, recursive: true); + } + catch (Exception) + { + } + } + } + + private static AppConfiguration WithPasswords(params string?[] passwords) + { + var world = new WorldDefinition { Name = "Aetherfall", Host = "aetherfall.mux", Port = 4201 }; + for (var i = 0; i < passwords.Length; i++) + { + world.Characters.Add(new CharacterDefinition { Name = $"Corvid{i}", Password = passwords[i] }); + } + + var config = new AppConfiguration(); + config.Worlds.Add(world); + return config; + } + + private static CharacterDefinition First(AppConfiguration config) => config.Worlds[0].Characters[0]; + + [Test] + public async Task WithAStoreThePasswordGoesToItAndNotToTheFile() + { + using var temp = new TempRoot(); + var store = new FakeStore(); + var config = WithPasswords("hunter2"); + + ConfigurationStore.Save(temp.ConfigPath, config, new CredentialVault(store)); + + var id = First(config).PasswordRef!.Value; + await Assert.That(store.Items[id]).IsEqualTo("hunter2"); + await Assert.That(File.Exists(temp.SecretsPath)).IsFalse(); + await Assert.That(File.ReadAllText(temp.ConfigPath)).DoesNotContain("hunter2"); + + var reloaded = ConfigurationStore.Load(temp.ConfigPath, vault: new CredentialVault(store)); + await Assert.That(First(reloaded).Password).IsEqualTo("hunter2"); + await Assert.That(First(reloaded).PasswordRef).IsEqualTo(id); + } + + [Test] + public async Task ASaveThatChangedNothingWritesNothingToTheStore() + { + using var temp = new TempRoot(); + var store = new FakeStore(); + var vault = new CredentialVault(store); + var config = WithPasswords("hunter2", "swordfish"); + + ConfigurationStore.Save(temp.ConfigPath, config, vault); + var afterFirst = store.Writes; + ConfigurationStore.Save(temp.ConfigPath, config, vault); + ConfigurationStore.Save(temp.ConfigPath, config, vault); + + await Assert.That(afterFirst).IsEqualTo(2); + await Assert.That(store.Writes).IsEqualTo(2); + } + + [Test] + public async Task SecretsJsonEntriesMoveIntoTheStoreAtLoad() + { + using var temp = new TempRoot(); + var config = WithPasswords("hunter2", "swordfish"); + ConfigurationStore.Save(temp.ConfigPath, config); // the old way: secrets.json + await Assert.That(File.Exists(temp.SecretsPath)).IsTrue(); + + var store = new FakeStore(); + var notes = new List(); + var loaded = ConfigurationStore.Load(temp.ConfigPath, notes.Add, new CredentialVault(store)); + + await Assert.That(loaded.Worlds[0].Characters.Select(c => c.Password ?? "")).IsEquivalentTo(new[] { "hunter2", "swordfish" }); + await Assert.That(store.Items.Values).IsEquivalentTo(new[] { "hunter2", "swordfish" }); + await Assert.That(File.Exists(temp.SecretsPath)).IsFalse(); + await Assert.That(notes.Single()).Contains("moved 2 passwords"); + } + + [Test] + public async Task APasswordTheStoreRefusesStaysInTheFile() + { + using var temp = new TempRoot(); + ConfigurationStore.Save(temp.ConfigPath, WithPasswords("hunter2")); + var store = new FakeStore { RefusesWrites = true }; + + var loaded = ConfigurationStore.Load(temp.ConfigPath, vault: new CredentialVault(store)); + + await Assert.That(First(loaded).Password).IsEqualTo("hunter2"); + await Assert.That(SecretsStore.Read(temp.SecretsPath).Secrets.Values.Single()).IsEqualTo("hunter2"); + } + + [Test] + public async Task WithNoStoreReachableThePasswordGoesToTheFile() + { + using var temp = new TempRoot(); + var store = new FakeStore { Reachable = false }; + var config = WithPasswords("hunter2"); + + ConfigurationStore.Save(temp.ConfigPath, config, new CredentialVault(store)); + + await Assert.That(store.Items).IsEmpty(); + await Assert.That(SecretsStore.Read(temp.SecretsPath).Secrets[First(config).PasswordRef!.Value]).IsEqualTo("hunter2"); + } + + /// + /// The headless-Linux case: the passwords are in a keyring this run cannot reach. The characters start with no + /// password — and the first save must not forget the references, or the next run with a keyring finds nothing. + /// + [Test] + public async Task AStoreThatCannotBeReachedKeepsEveryReferenceThroughASave() + { + using var temp = new TempRoot(); + var store = new FakeStore(); + var config = WithPasswords("hunter2"); + ConfigurationStore.Save(temp.ConfigPath, config, new CredentialVault(store)); + var id = First(config).PasswordRef!.Value; + + store.Reachable = false; + var notes = new List(); + var offline = new CredentialVault(store); + var loaded = ConfigurationStore.Load(temp.ConfigPath, notes.Add, offline); + await Assert.That(First(loaded).Password).IsNull(); + await Assert.That(notes.Single()).Contains("could not be reached"); + + ConfigurationStore.Save(temp.ConfigPath, loaded, offline); + await Assert.That(First(loaded).PasswordRef).IsEqualTo(id); + + store.Reachable = true; + var back = ConfigurationStore.Load(temp.ConfigPath, vault: new CredentialVault(store)); + await Assert.That(First(back).Password).IsEqualTo("hunter2"); + } + + [Test] + public async Task ClearingAPasswordOrDeletingACharacterRemovesItFromTheStore() + { + using var temp = new TempRoot(); + var store = new FakeStore(); + var vault = new CredentialVault(store); + var config = WithPasswords("hunter2", "swordfish"); + ConfigurationStore.Save(temp.ConfigPath, config, vault); + await Assert.That(store.Items.Count).IsEqualTo(2); + + First(config).Password = null; + config.Worlds[0].Characters.RemoveAt(1); + ConfigurationStore.Save(temp.ConfigPath, config, vault); + + await Assert.That(store.Items).IsEmpty(); + await Assert.That(First(config).PasswordRef).IsNull(); + } + + [Test] + public async Task ADeletedCharacterFromAnEarlierRunIsRemovedFromTheStore() + { + using var temp = new TempRoot(); + var store = new FakeStore(); + ConfigurationStore.Save(temp.ConfigPath, WithPasswords("hunter2"), new CredentialVault(store)); + + var vault = new CredentialVault(store); + var loaded = ConfigurationStore.Load(temp.ConfigPath, vault: vault); + loaded.Worlds[0].Characters.Clear(); + ConfigurationStore.Save(temp.ConfigPath, loaded, vault); + + await Assert.That(store.Items).IsEmpty(); + } + + /// + /// A changed password the store refuses goes to the file — under a new reference, because the store, read first, + /// still holds the old one under the old reference and would win. + /// + [Test] + public async Task AChangedPasswordTheStoreRefusesIsNotShadowedByTheOldOne() + { + using var temp = new TempRoot(); + var store = new FakeStore(); + var vault = new CredentialVault(store); + var config = WithPasswords("old"); + ConfigurationStore.Save(temp.ConfigPath, config, vault); + + store.RefusesWrites = true; + First(config).Password = "new"; + ConfigurationStore.Save(temp.ConfigPath, config, vault); + + var reloaded = ConfigurationStore.Load(temp.ConfigPath, vault: new CredentialVault(store)); + await Assert.That(First(reloaded).Password).IsEqualTo("new"); + await Assert.That(store.Items.Values).DoesNotContain("old"); + } + + [Test] + public async Task AVaultWithNoStoreIsSecretsJsonAlone() + { + using var temp = new TempRoot(); + var config = WithPasswords("hunter2"); + + ConfigurationStore.Save(temp.ConfigPath, config, new CredentialVault(null)); + var reloaded = ConfigurationStore.Load(temp.ConfigPath, vault: new CredentialVault(null)); + + await Assert.That(SecretsStore.Read(temp.SecretsPath).Secrets.Values.Single()).IsEqualTo("hunter2"); + await Assert.That(First(reloaded).Password).IsEqualTo("hunter2"); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Links/TelnetLinkTests.cs b/tests/SharpMUTerm.Core.Tests/Links/TelnetLinkTests.cs new file mode 100644 index 00000000..2ac2781b --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Links/TelnetLinkTests.cs @@ -0,0 +1,122 @@ +using SharpMUTerm.Core.Links; + +namespace SharpMUTerm.Core.Tests.Links; + +/// +/// telnet:// links are text anybody can write and the desktop hands this client on a click, so the reader is +/// held to what /connect host port can do: a host, a port, TLS for telnets, and nothing else. +/// +public class TelnetLinkTests +{ + [Test] + [Arguments("telnet://mud.example.org:4201", "mud.example.org", 4201, false)] + [Arguments("telnet://mud.example.org:4201/", "mud.example.org", 4201, false)] + [Arguments("TELNET://Mud.Example.org:4201", "Mud.Example.org", 4201, false)] + [Arguments("telnet://mud.example.org", "mud.example.org", 23, false)] + [Arguments("telnets://mud.example.org", "mud.example.org", 992, true)] + [Arguments("telnets://mud.example.org:6666", "mud.example.org", 6666, true)] + [Arguments("telnet://192.0.2.7:4000", "192.0.2.7", 4000, false)] + [Arguments("telnet://[2001:db8::1]:4000", "2001:db8::1", 4000, false)] + [Arguments("telnet://[::1]", "::1", 23, false)] + public async Task AWellFormedLinkIsAHostAPortAndWhetherItIsTls(string text, string host, int port, bool tls) + { + var link = TelnetLink.TryParse(text, out var refusal); + + await Assert.That(refusal).IsNull(); + await Assert.That(link).IsEqualTo(new TelnetLink(host, port, tls)); + } + + [Test] + [Arguments("telnet://mud.example.org:0")] + [Arguments("telnet://mud.example.org:65536")] + [Arguments("telnet://mud.example.org:99999999999")] + [Arguments("telnet://mud.example.org:-23")] + [Arguments("telnet://mud.example.org:+23")] + [Arguments("telnet://mud.example.org:23a")] + [Arguments("telnet://mud.example.org:")] + public async Task APortOutOfRangeOrNotPlainDigitsIsRefused(string text) => + await Assert.That(TelnetLink.TryParse(text)).IsNull(); + + [Test] + [Arguments("telnet://wizard:hunter2@mud.example.org:4201")] + [Arguments("telnet://wizard@mud.example.org")] + [Arguments("telnet://@mud.example.org")] + [Arguments("telnet://mud.example.org:4201@evil.example")] + public async Task EmbeddedCredentialsAreRefusedRatherThanSentOrDropped(string text) + { + var link = TelnetLink.TryParse(text, out var refusal); + + await Assert.That(link).IsNull(); + await Assert.That(refusal).Contains("user name or password"); + } + + [Test] + [Arguments("telnet://mud.example.org:4201/say hello")] + [Arguments("telnet://mud.example.org:4201/connect%20wizard%20pw")] + [Arguments("telnet://mud.example.org:4201/?cmd=@shutdown")] + [Arguments("telnet://mud.example.org:4201?cmd=quit")] + [Arguments("telnet://mud.example.org:4201#frag")] + [Arguments("telnet://mud.example.org:4201//")] + [Arguments("telnet://mud.example.org/path")] + public async Task APathQueryOrFragmentIsRefused(string text) => + await Assert.That(TelnetLink.TryParse(text)).IsNull(); + + [Test] + [Arguments("telnet://mud.example.org:4201\r\n@shutdown")] + [Arguments("telnet://mud.example.org\r\n")] + [Arguments("telnet://mud.example.org\n:4201")] + [Arguments("telnet://mud.example.org:4201\u0000")] + [Arguments("telnet://mud.example.org\u001b]2;owned\u0007")] + [Arguments("telnet://mud example.org")] + [Arguments(" telnet://mud.example.org")] + [Arguments("telnet://mud.example.org\t")] + [Arguments("telnet://mud%2Eexample.org")] + [Arguments("telnet://mud.example.org%0d%0a")] + [Arguments("telnet://mud\\example.org")] + [Arguments("telnet://müd.example.org")] + public async Task ControlCharactersSpacesEscapesAndNonAsciiAreRefused(string text) => + await Assert.That(TelnetLink.TryParse(text)).IsNull(); + + [Test] + [Arguments("")] + [Arguments("telnet://")] + [Arguments("telnet:///")] + [Arguments("telnet:mud.example.org")] + [Arguments("http://mud.example.org")] + [Arguments("ssh://mud.example.org")] + [Arguments("telnet://2001:db8::1")] + [Arguments("telnet://[2001:db8::1")] + [Arguments("telnet://[]:23")] + [Arguments("telnet://mud..example")] + [Arguments("telnet://a:b:c")] + public async Task AnythingElseIsRefused(string text) => + await Assert.That(TelnetLink.TryParse(text)).IsNull(); + + [Test] + public async Task AnOverlongLinkIsRefusedBeforeItIsRead() + { + var text = "telnet://" + new string('a', TelnetLink.MaxLength) + ".example"; + + var link = TelnetLink.TryParse(text, out var refusal); + + await Assert.That(link).IsNull(); + await Assert.That(refusal).Contains("too long"); + } + + [Test] + public async Task AnIpv6HostIsBracketedAgainForTheCommand() + { + var link = TelnetLink.TryParse("telnets://[2001:db8::1]:992")!; + + await Assert.That(link.HostForCommand).IsEqualTo("[2001:db8::1]"); + await Assert.That(link.ToString()).IsEqualTo("telnets://[2001:db8::1]:992"); + } + + [Test] + [Arguments("telnet://x", true)] + [Arguments("TelNetS://x", true)] + [Arguments("mud.example.org", false)] + [Arguments("--tls", false)] + public async Task OnlyTheTwoSchemesLookLikeALink(string text, bool expected) => + await Assert.That(TelnetLink.LooksLikeLink(text)).IsEqualTo(expected); +} diff --git a/tests/SharpMUTerm.Tui.Tests/TelnetLinkClientTests.cs b/tests/SharpMUTerm.Tui.Tests/TelnetLinkClientTests.cs new file mode 100644 index 00000000..2f3e3fef --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/TelnetLinkClientTests.cs @@ -0,0 +1,248 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Accessibility; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A telnet:// link in the client: it connects, as /connect host port does, and it never sends. Plus the +/// two other things a desktop expects of the client — the window title and the screen reader's text — and the hand-off +/// that gives a second launch's link to the first. +/// +[NotInParallel] +public class TelnetLinkClientTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static (SharpMUTermApp App, RecordingTelnetSession Wire, AppConfiguration Config) Open( + Action? configure = null, IAnnouncer? announcer = null, IWindowTitle? title = null) + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + configure?.Invoke(config); + var wire = new RecordingTelnetSession(); + var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, null) with + { + Announcer = announcer, + Title = title, + }; + var app = new SharpMUTermApp(config, host); + app.TelnetFactory = _ => wire; + return (app, wire, config); + } + + [Test] + public async Task ALinkAddsAWorldWithNoCharacterAndDialsItSendingNothing() + { + var (app, wire, config) = Open(); + await using var _app = app; + + app.OpenLink("telnets://mud.example.org:6666/"); + await app.LastCommand; + + var world = config.Worlds.Single(); + await Assert.That(world.Host).IsEqualTo("mud.example.org"); + await Assert.That(world.Port).IsEqualTo(6666); + await Assert.That(world.UseTls).IsTrue(); + await Assert.That(world.Characters).IsEmpty(); + await Assert.That(app.FindSession("mud.example.org")!.State).IsEqualTo(ConnectionState.Connected); + await Assert.That(wire.Lines).IsEmpty(); + } + + [Test] + public async Task ALinkToAConfiguredEndpointDialsThatWorldAndAddsNone() + { + var (app, _, config) = Open(c => c.Worlds.Add(new WorldDefinition { Name = "Home", Host = "mud.example.org", Port = 4201 })); + await using var _app = app; + + app.OpenLink("telnet://MUD.example.org:4201"); + await app.LastCommand; + + await Assert.That(config.Worlds.Count).IsEqualTo(1); + await Assert.That(app.FindSession("Home")!.State).IsEqualTo(ConnectionState.Connected); + } + + /// A link is matched on its endpoint, never on a name: one naming a world reaches nothing of it. + [Test] + public async Task ALinkCannotReachAWorldByNamingIt() + { + var (app, _, config) = Open(c => c.Worlds.Add(new WorldDefinition { Name = "Home", Host = "home.example.org", Port = 4201 })); + await using var _app = app; + + app.OpenLink("telnet://Home"); + await app.LastCommand; + + await Assert.That(config.Worlds.Count).IsEqualTo(2); + await Assert.That(config.Worlds[1].Host).IsEqualTo("Home"); + await Assert.That(app.FindSession("Home 2")).IsNotNull(); + } + + [Test] + [Arguments("telnet://wizard:pw@mud.example.org")] + [Arguments("telnet://mud.example.org:70000")] + [Arguments("telnet://mud.example.org:4201/@shutdown")] + [Arguments("telnet://mud.example.org\r\n@shutdown")] + [Arguments("javascript:alert(1)")] + public async Task AHostileLinkAddsNothingDialsNothingAndSaysWhy(string text) + { + var (app, wire, config) = Open(); + await using var _app = app; + + app.OpenLink(text); + + await Assert.That(config.Worlds).IsEmpty(); + await Assert.That(wire.ConnectAttempts).IsEqualTo(0); + await Assert.That(app.Messages.Entries.Any(m => m.Text.Contains("not following that link"))).IsTrue(); + } + + [Test] + public async Task TheLinkOnTheCommandLineIsFoundAndIsNotReadAsAHost() + { + string[] args = ["--name", "telnet://not-this", "telnet://mud.example.org:23", "--tls"]; + + await Assert.That(Program.LinkArgument(args)).IsEqualTo("telnet://mud.example.org:23"); + await Assert.That(Program.LinkArgument(["mud.example.org", "4201"])).IsNull(); + } + + /// + /// A Windows link handler pastes the link into a quoted command line; a link holding a quote can close it and add + /// arguments. With --open-link, everything but the argument after it is dropped before anything reads it. + /// + [Test] + public async Task ALinkHandlersLaunchReadsTheLinkAndNothingElse() + { + string[] injected = ["--open-link", "telnet://mud.example.org", "--render-png", "C:\\evil.png", "--demo-config"]; + + await Assert.That(ClientOptions.NarrowToLink(injected)).IsEquivalentTo(new[] { "telnet://mud.example.org" }); + await Assert.That(ClientOptions.NarrowToLink(["--open-link"])).IsEmpty(); + await Assert.That(ClientOptions.NarrowToLink(["mud.example.org", "4201"])).IsEquivalentTo(new[] { "mud.example.org", "4201" }); + } + + private sealed class Titles : IWindowTitle + { + public List Shown { get; } = []; + + public void Show(string title) => Shown.Add(title); + + public void Restore() => Shown.Add(""); + } + + [Test] + public async Task TheTitleFollowsTheWindowInFrontAndReachesTheHostOnlyOnceTheLoopRuns() + { + var titles = new Titles(); + var (app, _, _) = Open( + c => + { + var world = new WorldDefinition { Name = "Mush", Host = "mush.example", Port = 4201 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann" }); + world.Characters.Add(new CharacterDefinition { Name = "Bea" }); + c.Worlds.Add(world); + }, + title: titles); + await using var _app = app; + + // Worked out from the first header, but not written anywhere until the loop runs. + await Assert.That(app.ShownTitle).IsNotNull(); + await Assert.That(titles.Shown).IsEmpty(); + + app.StartTitle(); + app.DispatchCommand(CommandIds.Character("Mush.Ann")); + await Assert.That(app.ShownTitle).IsEqualTo("Ann@Mush — SharpMUTerm"); + + app.DispatchCommand(CommandIds.Character("Mush.Bea")); + await Assert.That(app.ShownTitle).IsEqualTo("Bea@Mush — SharpMUTerm"); + await Assert.That(titles.Shown.Count).IsGreaterThanOrEqualTo(3); + await Assert.That(titles.Shown[^2..]).IsEquivalentTo(new[] { "Ann@Mush — SharpMUTerm", "Bea@Mush — SharpMUTerm" }); + } + + [Test] + public async Task TheTerminalsTitleSequenceCannotBeEndedEarly() + { + var sequence = TerminalTitle.Sequence("Ann\u0007@\u001b\\Mush"); + + await Assert.That(sequence).IsEqualTo("\u001b]2;Ann@\\Mush\u001b\\"); + } + + private sealed class Reader : IAnnouncer + { + public (string Window, IReadOnlyList Lines)? Last { get; private set; } + + public void Announce(string text, AnnouncementKind kind) + { + } + + public void Reading(string window, IReadOnlyList lines) => Last = (window, lines); + } + + [Test] + public async Task TheReaderIsGivenTheWindowInFrontAndItsNewestLines() + { + var reader = new Reader(); + var (app, wire, _) = Open( + c => + { + var world = new WorldDefinition { Name = "Mush", Host = "mush.example", Port = 4201 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann" }); + c.Worlds.Add(world); + }, + announcer: reader); + await using var _app = app; + app.DispatchCommand(CommandIds.Character("Mush.Ann")); + await app.FindSession("Mush.Ann")!.ConnectAsync(); + + for (var i = 0; i < IAnnouncer.ReadingLines + 5; i++) + { + wire.Receive($"line {i}"); + } + + app.RenderNextFrame(); + + var (window, lines) = reader.Last!.Value; + await Assert.That(window).IsEqualTo("Ann"); + await Assert.That(lines.Count).IsEqualTo(IAnnouncer.ReadingLines); + await Assert.That(lines[^1]).IsEqualTo($"line {IAnnouncer.ReadingLines + 4}"); + await Assert.That(lines[0]).IsEqualTo("line 5"); + } + + [Test] + public async Task ASecondLaunchHandsItsLinkToTheFirst() + { + var path = Path.Combine(Path.GetTempPath(), $"smt-{Guid.NewGuid():N}"[..16] + ".sock"); + var received = new TaskCompletionSource(); + using (var listener = LinkHandoff.Listen(received.SetResult, path)) + { + await Assert.That(listener).IsNotNull(); + + // A second listener on the same socket stands down: one client takes the links. + await Assert.That(LinkHandoff.Listen(_ => { }, path)).IsNull(); + + await Assert.That(LinkHandoff.TrySend("telnet://mud.example.org:4201", path)).IsTrue(); + await Assert.That(await received.Task.WaitAsync(TimeSpan.FromSeconds(5))).IsEqualTo("telnet://mud.example.org:4201"); + } + + // Nobody listening: the launch runs the link itself. + await Assert.That(LinkHandoff.TrySend("telnet://mud.example.org:4201", path)).IsFalse(); + await Assert.That(LinkHandoff.TrySend("telnet://x\ny", path)).IsFalse(); + } + + [Test] + public async Task AStaleSocketFileIsTakenOver() + { + var path = Path.Combine(Path.GetTempPath(), $"smt-{Guid.NewGuid():N}"[..16] + ".sock"); + await File.WriteAllTextAsync(path, string.Empty); + try + { + using var listener = LinkHandoff.Listen(_ => { }, path); + await Assert.That(listener).IsNotNull(); + } + finally + { + File.Delete(path); + } + } +} From 546544e53a3617ab9243cd66cd4511998567bb34 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 09:12:12 +0000 Subject: [PATCH 034/113] feat(window): native quit prompt, search, history, layouts and welcome In the desktop window the quit prompt, Ctrl+F, Ctrl+R, the Alt+M layouts list and the first-run welcome are native modals over the window, drawn from the Client model the cell modal draws and ending every gesture in the cell key's method. One host member, ClientHost.NativeModals (INativeModals), covers all five: the presenter owns stacking, focus return and theme. The quit prompt is never refused and always ends in front, so closing the window while F1 is open no longer hides the prompt under the composer. The terminal is unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 4 + CLAUDE.md | 41 +- .../AvaloniaConsoleDriver.cs | 6 + src/SharpMUTerm.Avalonia/ComposerView.cs | 4 +- src/SharpMUTerm.Avalonia/HistoryView.cs | 196 +++++++++ src/SharpMUTerm.Avalonia/LayoutsView.cs | 410 ++++++++++++++++++ src/SharpMUTerm.Avalonia/MainWindow.cs | 4 + src/SharpMUTerm.Avalonia/ModalOverlay.cs | 227 ++++++++++ src/SharpMUTerm.Avalonia/ModalParts.cs | 209 +++++++++ src/SharpMUTerm.Avalonia/ModalPresenter.cs | 206 +++++++++ src/SharpMUTerm.Avalonia/QuitView.cs | 151 +++++++ src/SharpMUTerm.Avalonia/SearchView.cs | 310 +++++++++++++ src/SharpMUTerm.Avalonia/WelcomeView.cs | 344 +++++++++++++++ src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + src/SharpMUTerm.Client/Modals/HistoryModel.cs | 67 +++ src/SharpMUTerm.Client/Modals/LayoutsModel.cs | 108 +++++ src/SharpMUTerm.Client/Modals/ModalSession.cs | 126 ++++++ src/SharpMUTerm.Client/Modals/QuitModel.cs | 109 +++++ src/SharpMUTerm.Client/Modals/SearchModel.cs | 107 +++++ src/SharpMUTerm.Client/Modals/WelcomeModel.cs | 160 +++++++ .../Surfaces/SurfaceCatalog.cs | 93 ++++ src/SharpMUTerm.Tui/HistorySearchPrompt.cs | 22 +- src/SharpMUTerm.Tui/HistorySurface.cs | 15 +- src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 12 + src/SharpMUTerm.Tui/Hosting/INativeModals.cs | 35 ++ .../Pointer/SharpMUTermApp.Surfaces.cs | 5 + src/SharpMUTerm.Tui/QuitOverlay.cs | 13 +- src/SharpMUTerm.Tui/QuitPrompt.cs | 72 +-- src/SharpMUTerm.Tui/SearchPrompt.cs | 60 +-- src/SharpMUTerm.Tui/SearchSurface.cs | 134 +++--- src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs | 243 ++++++++--- .../SharpMUTermApp.NativeModals.cs | 285 ++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs | 70 ++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 105 +++-- src/SharpMUTerm.Tui/WelcomeSurface.cs | 135 +++--- .../NativeModalTests.cs | 232 ++++++++++ .../SurfaceParityTests.cs | 279 +++++++++++- .../SurfaceCatalogTests.cs | 3 +- .../HistorySearchEndToEndTests.cs | 1 + .../NativeModalRoutingTests.cs | 222 ++++++++++ .../SharpMUTerm.Tui.Tests/QuitPromptTests.cs | 17 +- .../SearchEndToEndTests.cs | 1 + .../SearchPromptTests.cs | 1 + .../SpawnWindowIdUpgradeTests.cs | 1 + tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs | 1 + 45 files changed, 4473 insertions(+), 376 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/HistoryView.cs create mode 100644 src/SharpMUTerm.Avalonia/LayoutsView.cs create mode 100644 src/SharpMUTerm.Avalonia/ModalOverlay.cs create mode 100644 src/SharpMUTerm.Avalonia/ModalParts.cs create mode 100644 src/SharpMUTerm.Avalonia/ModalPresenter.cs create mode 100644 src/SharpMUTerm.Avalonia/QuitView.cs create mode 100644 src/SharpMUTerm.Avalonia/SearchView.cs create mode 100644 src/SharpMUTerm.Avalonia/WelcomeView.cs create mode 100644 src/SharpMUTerm.Client/Modals/HistoryModel.cs create mode 100644 src/SharpMUTerm.Client/Modals/LayoutsModel.cs create mode 100644 src/SharpMUTerm.Client/Modals/ModalSession.cs create mode 100644 src/SharpMUTerm.Client/Modals/QuitModel.cs create mode 100644 src/SharpMUTerm.Client/Modals/SearchModel.cs create mode 100644 src/SharpMUTerm.Client/Modals/WelcomeModel.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/INativeModals.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NativeModalRoutingTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 063f7b42..421d12fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Desktop window: the quit prompt, search (Ctrl+F), history search (Ctrl+R), the layouts list (Alt+M) and the + first-run welcome are native dialogs in the window's light or dark look, worked from the keyboard exactly as in the + terminal. The quit prompt always comes up in front of whatever is open — closing the window while writing a post + no longer hides it behind the composer — and Stay takes you back to what you were doing. - Triggers, aliases, key bindings and timers (F2, F3, F4, F6) open in the desktop window's settings as a list beside the selected item's fields: tick a box to switch one on or off, add, copy, delete or move it up and down, and watch the trigger's live test mark the matching lines as you type its pattern. A package's sets are shown diff --git a/CLAUDE.md b/CLAUDE.md index 763a96aa..54be9043 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1268,7 +1268,7 @@ one `SharpMUTermApp`; a host is only the place it runs. What differs between hos (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it -draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M and the welcome itself (`INativeModals`, null for cells), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until @@ -1816,7 +1816,9 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] panels are not published, so F1 is never under a docked editor. - **F1 is an overlay over the cell area, under the desktop layer**, so the native header and sidebar stay (inert, as under a modal) and a toast is still seen over it. ⌥⏎ is the window's (it maximises); ⏎, ⌃⏎ and ⇧⏎ are newlines. - ⌃Q in F1 closes it first and then asks to quit, so the cell quit prompt is never hidden under it. + ⌃Q in F1 goes to the client and leaves F1 open: the native quit prompt is drawn in front of it, and Stay comes back + to the post. (A host with the native F1 but no native modals closes F1 first, keeping the draft, so the cell prompt + is not hidden — `ToggleQuit`.) - **The misspelling is a real wavy line**, drawn by a layer over the editor (`ComposerView.MarkLayer`) from the editor's own text layout (`TextLayout.HitTestTextRange`), so it follows wrapping and scrolling. The right-click menu offers WeCantSpell's suggestions (`SpellChecker.Suggest`, six at most), Add to dictionary, the editor's edits and the @@ -1830,6 +1832,41 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave7/composer-*.png`). `--demo-config` in the window opens the installed dictionary read-only. Not done: no per-character face choice saved, no find bar, and the window's ⌥W adds to the run's dictionary in the demo only (a live client writes `user-words.txt` as F1 does). +- **In the window, the quit prompt, ⌃F, ⌃R, ⌥M and the welcome are native modals** (`ClientHost.NativeModals` → + `INativeModals`; Client `Modals/`: `ModalSession`, `QuitModel`/`QuitSession`, `SearchModel`/`SearchSession`, + `HistoryModel`/`HistorySession`, `LayoutsModel`/`LayoutsSession`, `WelcomeModel`/`WelcomeSession`; Avalonia + `ModalPresenter` on the driver, `ModalOverlay`, `QuitView`, `SearchView`, `HistoryView`, `LayoutsView`, `WelcomeView`, + `ModalParts`; `SharpMUTermApp.NativeModals.cs`). Decisions not to relitigate: + - **One host member for five modals**, not five. What they share is the hard part — stacking (the quit prompt in + front of everything), giving the keyboard back, the theme — and one presenter decides it once. A session per modal + carries its model and the gestures; `Available` is false until the main window attaches it, so `--render-png`, the + parity harness and every test without a window get the cells. + - **The model is the cell modal's.** `QuitPrompt.Render(QuitModel)`, `SearchPrompt.Render(SearchModel)`, + `HistorySearchPrompt.Render(HistoryModel, …)`, `LayoutsListLines(LayoutsModel)` and `WelcomeSurface.Render(WelcomeModel)` + draw the same records the views draw. ⌃F's hits come from one function (`SearchModelFor`, which the cell surface + asks too); ⌃R's rows are `HistoryModel.View` (= `HistorySearch.Match`) in both. + - **Every gesture ends in the cell key's method**: Y → `Quit`; ⏎ on a hit → `GoToSearchHit(model, index)`; ⏎ in ⌃R → + `InsertHistoryEntry`; every ⌥M key and button → `RunLayoutsVerb`, which returns the `LayoutActionResult` both lists + show as their status; the welcome's choices → `RunWelcomeAction`, and its form → `WelcomeSurface.Submit(form)` → + `ConnectFromWelcome` → `ConnectCommand`. The views read keys through the pure prompts' `Interpret`, so a key means + the same in both hosts; ⌥M's ↑↓ stop at the ends as the cell list does. + - **The quit prompt is never refused and always ends in front.** `ModalPresenter` adds it last, moves it back to the + end when anything is added to the root after it (⌃P, F1, a toast), activates the main window over the settings + window, and opens any other modal under it. ⌃Q from inside another modal is forwarded to the client, which opens + the prompt over it; Stay returns to what was open. The client funnels are `ToggleQuit`, `ToggleSearch`, + `ToggleHistorySearch`, `ShowLayouts`, `ShowWelcome`; each closes its own native modal on its chord. + - **Fluent scoped to the card** (the palette's rule), in the client's dark or light variant (`ModalColours.Dark`/ + `Light`, the palette's colours and accent). A press on the scrim is Esc (the quit prompt: Stay). Focus goes back to + what had it when the modal opened if it is still on screen, else to the cells, whose pin puts it on the command line. + - **Parity**: `HostParityTests` has no presenter attached, so it compares the cell modals. `SurfaceParityTests` + holds the native side: the session's model equals the cell modal's for `quit`, `search`, `search-regex`, + `search-all`, `history-search` (and the filtered rows), `layouts`, `welcome` and `welcome-connect`; and quit Y/N, + search ⏎ / ⌥A / ⌥E, history ⏎, layouts apply / save as new / rename / delete, and the welcome's connect and + layout+settings end in the same `Outcome` as the cell keys. `NativeModalRoutingTests` (Tui) and `NativeModalTests` + (Avalonia, headless) drive the routing, the stacking and the views. The `search*` and `history-search` snapshot + views open the native surface when there is one (that is how the window's screenshots are taken). + - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave8/modals-*.png`). Not done: the native ⌃R + filters in its own box, so the `history-search-filter` view shows its list unfiltered in the window. - **Settings screens have no `IPasteTarget` and cannot easily have one.** They are markup rebuilt wholesale every key, with the edited field a buffer in `SettingsSession`. `SettingsOverlay` listens at `IConsoleDriver.Paste` instead. That can't double-fire *only* because no control on diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index e67b927d..1b3a60e4 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -79,6 +79,12 @@ public AvaloniaConsoleDriver(int columns, int rows) /// The window's native F1, drawn over the cells in the main window (). public ComposerPresenter Composer { get; } = new(); + /// + /// The window's native quit prompt, ⌃F, ⌃R, ⌥M and welcome, drawn over everything in the main window, the quit prompt + /// always in front (). + /// + public ModalPresenter Modals { get; } = new(); + public bool IsRunning { get; private set; } // ── IConsoleDriver: output ──────────────────────────────────────────────────────────────── diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index a51c59ec..1de23852 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -452,7 +452,8 @@ private void OnEditorKeyDown(object? sender, KeyEventArgs e) if (_fullScreen) { - // F1 again closes it, as the cell window's F1 does; ⌃Q closes it first so the quit prompt is not under it. + // F1 again closes it, as the cell window's F1 does. ⌃Q goes to the client and leaves F1 open: the quit prompt + // is drawn in front of it (ModalPresenter), so Stay comes back to the post. if (e.Key == Key.F1 && mods == KeyModifiers.None) { e.Handled = true; @@ -461,7 +462,6 @@ private void OnEditorKeyDown(object? sender, KeyEventArgs e) else if (e.Key == Key.Q && mods == KeyModifiers.Control && mapped is { } quit) { e.Handled = true; - session.Close(text); _view.Driver.RaiseKey(quit); } diff --git a/src/SharpMUTerm.Avalonia/HistoryView.cs b/src/SharpMUTerm.Avalonia/HistoryView.cs new file mode 100644 index 00000000..eaa76b79 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/HistoryView.cs @@ -0,0 +1,196 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Media; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Input; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's ⌃R: whose list it is, a filter box, and the command line's history newest first with the match +/// marked. The list is the client's snapshot () filtered by the same function the cells use +/// (), so a query lists the same rows; ⏎ places the entry on the command line and +/// sends nothing. The keys that are not typing are read by the cells' rules (). +/// +internal sealed class HistoryView : DockPanel, IModalView +{ + private readonly HistorySession _session; + private readonly ModalColours _colours; + private readonly Action _done; + private readonly TextBox _box; + private readonly TextBlock _count; + private readonly StackPanel _list; + private readonly List _rows = []; + private IReadOnlyList _matches = []; + private int _selected; + + public HistoryView(HistorySession session, ModalColours colours, Action done) + { + _session = session; + _colours = colours; + _done = done; + var model = session.Model; + + _box = ModalParts.SearchBox("Filter the history…", "Filter the history"); + SetDock(_box, Dock.Top); + Children.Add(_box); + + var header = new DockPanel { Margin = new Thickness(20, 0, 20, 6) }; + var whose = new TextBlock { Text = model.BarLabel, FontSize = 12.5, Foreground = colours.Brush(colours.Dim) }; + _count = new TextBlock { FontSize = 12.5, Foreground = colours.Brush(colours.Dim), HorizontalAlignment = global::Avalonia.Layout.HorizontalAlignment.Right }; + SetDock(whose, Dock.Left); + header.Children.Add(whose); + header.Children.Add(_count); + SetDock(header, Dock.Top); + Children.Add(header); + + var footer = ModalParts.Footer("↑↓ pick · Enter places it on the command line · Esc cancel", colours); + SetDock(footer, Dock.Bottom); + Children.Add(footer); + + var (frame, list, _) = ModalParts.List(colours); + _list = list; + frame.MinHeight = 120; + Children.Add(frame); + + _box.TextChanged += (_, _) => + { + _selected = 0; + Draw(); + }; + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + Draw(); + } + + public string Title => "Command history"; + + public double PreferredWidth => 680; + + public bool Centred => false; + + /// The rows listed now, for a test. + public IReadOnlyList Matches => _matches; + + /// The row ⏎ places. + public int Selected => _selected; + + /// The filter box, for a test. + public TextBox Box => _box; + + public void FocusFirst() => _box.Focus(); + + public void Detach() + { + } + + /// ⏎ on listed row . + public void Insert(int row) + { + if (row >= 0 && row < _matches.Count) + { + _session.Insert(_matches[row].Index); + _done(); + } + } + + private void Draw() + { + var model = _session.Model; + _matches = model.View(_box.Text ?? string.Empty); + _count.Text = model.CountText(_matches.Count); + _list.Children.Clear(); + _rows.Clear(); + _selected = _matches.Count == 0 ? 0 : Math.Clamp(_selected, 0, _matches.Count - 1); + if (_matches.Count == 0) + { + _list.Children.Add(new TextBlock + { + Text = model.Entries.Count == 0 ? HistoryModel.NothingEntered : HistoryModel.NoMatches, + Foreground = _colours.Brush(_colours.Dim), + Margin = new Thickness(12, 10), + TextWrapping = TextWrapping.Wrap, + }); + return; + } + + var mono = new FontFamily($"{CellFonts.BundledFamily}, DejaVu Sans Mono, Consolas, Menlo, monospace"); + for (var i = 0; i < _matches.Count; i++) + { + var match = _matches[i]; + var index = i; + var text = new TextBlock + { + Foreground = _colours.Brush(_colours.Text), + FontFamily = mono, + FontSize = 13, + TextTrimming = TextTrimming.CharacterEllipsis, + }; + text.Inlines = ModalParts.Marked(match.Text, match.MatchStart, match.MatchLength, _colours); + var row = ModalParts.Row(text, match.Text, () => Select(index), () => Insert(index)); + _rows.Add(row); + _list.Children.Add(row); + } + + Highlight(); + } + + private void Select(int index) + { + if (index != _selected) + { + _selected = index; + Highlight(); + } + } + + private void Highlight() + { + for (var i = 0; i < _rows.Count; i++) + { + _rows[i].Background = i == _selected ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + } + + if (_selected < _rows.Count) + { + _rows[_selected].BringIntoView(); + } + } + + private void OnKey(object? sender, KeyEventArgs e) + { + if (ModalParts.Console(e) is not { } key) + { + return; + } + + var bare = key.Modifiers == 0; + if (bare && key.Key is not (ConsoleKey.UpArrow or ConsoleKey.DownArrow or ConsoleKey.Enter or ConsoleKey.Escape)) + { + return; + } + + var decision = HistorySearchPrompt.Interpret(key, _box.Text ?? string.Empty, _selected, _matches.Count); + if (!bare && decision.Action == HistoryAction.None) + { + return; + } + + e.Handled = true; + switch (decision.Action) + { + case HistoryAction.Insert: + Insert(_selected); + break; + case HistoryAction.Cancel: + _session.Dismiss(); + _done(); + break; + case HistoryAction.Redraw: + Select(decision.Selected); + break; + } + } +} diff --git a/src/SharpMUTerm.Avalonia/LayoutsView.cs b/src/SharpMUTerm.Avalonia/LayoutsView.cs new file mode 100644 index 00000000..351b75f5 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/LayoutsView.cs @@ -0,0 +1,410 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's ⌥M: the character's layouts, BUILT IN then YOURS, with what each is in use for, and a row of buttons +/// for what can be done to the one pointed at. Every button and key is a the client runs +/// through the method the cell list's key runs, and what it said comes back as the list's status. The keys are the +/// cell list's: ⏎ apply, S save changes, N save as new, W use for the world, C use for this character, R rename and D +/// delete (a layout of the player's own only), ↑↓ move, Esc closes. +/// +internal sealed class LayoutsView : DockPanel, IModalView +{ + private readonly LayoutsSession _session; + private readonly ModalColours _colours; + private readonly Action _done; + private readonly StackPanel _list; + private readonly TextBlock _status; + private readonly WrapPanel _buttons; + private readonly TextBox _rename; + private readonly List _rows = []; + private readonly List _rowIndex = []; + private LayoutsModel _model; + private int _selected; + private bool _renaming; + private bool _confirming; + + public LayoutsView(LayoutsSession session, ModalColours colours, Action done) + { + _session = session; + _colours = colours; + _done = done; + _model = session.Model; + _selected = _model.Selected; + + var heading = ModalParts.Heading("Layouts", colours); + SetDock(heading, Dock.Top); + Children.Add(heading); + var whose = ModalParts.Dim($"How {_model.Subject}'s panes are arranged. Applying one never closes a window.", colours); + SetDock(whose, Dock.Top); + Children.Add(whose); + + _rename = new TextBox + { + Margin = new Thickness(14, 4, 14, 4), + Padding = new Thickness(10, 6), + CornerRadius = new CornerRadius(7), + IsVisible = false, + PlaceholderText = "New name", + }; + global::Avalonia.Automation.AutomationProperties.SetName(_rename, "New name"); + + var footer = ModalParts.Footer("↑↓ pick · Enter apply · Esc close", colours); + SetDock(footer, Dock.Bottom); + Children.Add(footer); + + _buttons = new WrapPanel { Margin = new Thickness(14, 8, 14, 0), HorizontalAlignment = HorizontalAlignment.Right }; + SetDock(_buttons, Dock.Bottom); + Children.Add(_buttons); + + _status = ModalParts.Dim(string.Empty, colours, new Thickness(20, 8, 20, 0)); + SetDock(_status, Dock.Bottom); + Children.Add(_status); + + SetDock(_rename, Dock.Bottom); + Children.Add(_rename); + + var (frame, list, _) = ModalParts.List(colours); + _list = list; + Children.Add(frame); + + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + _session.Changed += OnChanged; + Draw(); + } + + public string Title => "Layouts"; + + public double PreferredWidth => 640; + + public bool Centred => false; + + /// The model drawn now, for a test. + public LayoutsModel Model => _model; + + /// The row pointed at. + public int Selected => _selected; + + /// The buttons offered now, by label, for a test. + public IReadOnlyList Compose, + + /// + /// A modal's gesture — a query typed, a toggle flipped, a row chosen, an answer given — handed back through the + /// modal's session (ModalSession). + /// + Modal, } /// @@ -152,6 +159,34 @@ public static class SurfaceCatalog /// F1, the full-screen composer: a cell modal in a terminal, the window's native editor in its place. public const string Compose = "compose"; + /// The ⌃Q confirmation: a cell modal in a terminal, a native prompt in the window. + public const string Quit = "quit"; + + /// ⌃F, the search over the pane buffers. + public const string Search = "search"; + + /// ⌃R, the armed command line's history. + public const string History = "history"; + + /// ⌥M, the layouts list. + public const string Layouts = "layouts"; + + /// The first-run welcome and its connect form. + public const string Welcome = "welcome"; + + /// The modals the window draws with its own controls in place of the cell modal (ClientHost.NativeModals). + public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome]; + + /// A cell modal in a terminal; the window's own modal in its place. + private static readonly IReadOnlyDictionary NativeModal = new Dictionary + { + [SurfaceHosts.Terminal] = SurfaceDrawing.Cells, + [SurfaceHosts.Window] = SurfaceDrawing.Native, + }; + + /// The window's overlay every native modal is drawn in, and the view of one. + private static string[] ModalViews(string view) => ["SharpMUTerm.Avalonia.ModalOverlay", "SharpMUTerm.Avalonia." + view]; + /// /// The header and the rail: cells in a terminal; in the window (HostChrome.HeaderAndRail) native views /// beside the cells, which then leave them out. @@ -333,6 +368,64 @@ public static class SurfaceCatalog CellsUnderNative, "SharpMUTerm.Tui.Panels.DockedComposer.Render", ["SharpMUTerm.Avalonia.ComposerView", "SharpMUTerm.Avalonia.ComposerEditor"]), + new( + Quit, + typeof(QuitModel), + [ + // y: the client's quit. n, Esc and ⌃Q again: the prompt closes and nothing else happens. + new(SurfaceActionKind.Modal, "quit", "Quit"), + new(SurfaceActionKind.Modal, "stay", "QuitPromptClosed"), + ], + NativeModal, + "SharpMUTerm.Tui.QuitPrompt.Render", + ModalViews("QuitView")), + new( + Search, + typeof(SearchModel), + [ + // Typing, ⌥E and ⌥A re-run the search over the pane buffers; ⏎ goes to the row through the one path to a hit. + new(SurfaceActionKind.Modal, "query", "SearchModelFor"), + new(SurfaceActionKind.Modal, "go", "GoToSearchHit"), + ], + NativeModal, + "SharpMUTerm.Tui.SearchPrompt.Render", + ModalViews("SearchView")), + new( + History, + typeof(HistoryModel), + [new(SurfaceActionKind.Modal, "insert", "InsertHistoryEntry")], + NativeModal, + "SharpMUTerm.Tui.HistorySearchPrompt.Render", + ModalViews("HistoryView")), + new( + Layouts, + typeof(LayoutsModel), + [ + new(SurfaceActionKind.Modal, nameof(LayoutVerb.Apply), "RunLayoutsVerb"), + new(SurfaceActionKind.Modal, nameof(LayoutVerb.SaveChanges), "RunLayoutsVerb"), + new(SurfaceActionKind.Modal, nameof(LayoutVerb.SaveAsNew), "RunLayoutsVerb"), + new(SurfaceActionKind.Modal, nameof(LayoutVerb.UseForWorld), "RunLayoutsVerb"), + new(SurfaceActionKind.Modal, nameof(LayoutVerb.UseForCharacter), "RunLayoutsVerb"), + new(SurfaceActionKind.Modal, nameof(LayoutVerb.Rename), "RunLayoutsVerb"), + new(SurfaceActionKind.Modal, nameof(LayoutVerb.Delete), "RunLayoutsVerb"), + ], + NativeModal, + "SharpMUTerm.Tui.SharpMUTermApp.LayoutsListLines", + ModalViews("LayoutsView")), + new( + Welcome, + typeof(WelcomeModel), + [ + // Browse and Open settings close it and open what they name; Connect opens the form. + new(SurfaceActionKind.Modal, "choose", "RunWelcomeAction"), + new(SurfaceActionKind.Modal, "layout", "SetWelcomeLayout"), + + // The form goes through /connect's own path (ConnectCommand), so it can add nothing the command line cannot. + new(SurfaceActionKind.Modal, "connect", "ConnectFromWelcome"), + ], + NativeModal, + "SharpMUTerm.Tui.WelcomeSurface.Render", + ModalViews("WelcomeView")), ]; /// The surface with , or null. diff --git a/src/SharpMUTerm.Tui/HistorySearchPrompt.cs b/src/SharpMUTerm.Tui/HistorySearchPrompt.cs index 92794fe4..a3ed692f 100644 --- a/src/SharpMUTerm.Tui/HistorySearchPrompt.cs +++ b/src/SharpMUTerm.Tui/HistorySearchPrompt.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using SharpMUTerm.Core.Input; using static SharpMUTerm.Tui.MarkupText; using static SharpMUTerm.Tui.ScreenPalette; @@ -133,6 +134,23 @@ internal static HistoryDecision Interpret(ConsoleKeyInfo key, string query, int private static int Step(int selected, int delta, int count) => count == 0 ? -1 : ((selected + delta) % count + count) % count; + /// + /// The surface over — the cells of the model the window's native history draws too — + /// listing , which are for . + /// + internal static List Render( + HistoryModel model, + IReadOnlyList matches, + string query, + int selected, + int width = 0, + int listRows = 0, + int first = 0) + { + ArgumentNullException.ThrowIfNull(model); + return Render(matches, query, selected, model.Entries.Count, model.BarLabel, width, listRows, first); + } + /// /// The whole surface as markup lines: the query line, the rows newest-first with the pointed-at one /// filled, and the keys. is the surface's content width when known, which @@ -173,11 +191,11 @@ internal static List Render( var body = new List(); if (total == 0) { - body.Add($"[{Muted}] nothing has been entered on this command line yet[/]"); + body.Add($"[{Muted}] {HistoryModel.NothingEntered}[/]"); } else if (matches.Count == 0) { - body.Add($"[{Muted}] no matches — ⌫ widens the filter[/]"); + body.Add($"[{Muted}] {HistoryModel.NoMatches}[/]"); } var top = Math.Clamp(first, 0, Math.Max(0, matches.Count - 1)); diff --git a/src/SharpMUTerm.Tui/HistorySurface.cs b/src/SharpMUTerm.Tui/HistorySurface.cs index c0c3caeb..c1736979 100644 --- a/src/SharpMUTerm.Tui/HistorySurface.cs +++ b/src/SharpMUTerm.Tui/HistorySurface.cs @@ -1,6 +1,7 @@ using SharpConsoleUI; using SharpConsoleUI.Builders; using SharpConsoleUI.Controls; +using SharpMUTerm.Client.Modals; using SharpMUTerm.Core.Input; namespace SharpMUTerm.Tui; @@ -46,6 +47,7 @@ internal sealed class HistorySurface private readonly Func> _entries; private readonly Func _label; private readonly Action _insert; + private readonly Action? _closed; private Window? _window; private MarkupControl? _body; @@ -71,8 +73,10 @@ public HistorySurface( ConsoleWindowSystem system, Func> entries, Func label, - Action insert) + Action insert, + Action? closed = null) { + _closed = closed; _system = system; _entries = entries; _label = label; @@ -83,7 +87,13 @@ public HistorySurface( /// What the surface is currently showing, for a headless test to read back. internal IReadOnlyList Lines => HistorySearchPrompt.Render( - _matches, _query, _selected, _snapshot.Count, _barLabel, _contentWidth - 1, _listRows, _first); + Snapshot, _matches, _query, _selected, _contentWidth - 1, _listRows, _first); + + /// The history and whose it is, as captured when the surface opened. + private HistoryModel Snapshot => new(_snapshot, _barLabel); + + /// The model the open surface is drawn from, or null while it is closed. + internal HistoryModel? Model => _window is null ? null : Snapshot; /// The filter as typed so far. internal string Query => _query; @@ -242,5 +252,6 @@ private void Reset() { _window = null; _body = null; + _closed?.Invoke(); } } diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index dd7195f9..8e545d3f 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -105,6 +105,8 @@ internal sealed record ClientHost /// the terminal, the snapshot and the tests, so their frames are the ones they always were. /// public required HostChrome Chrome { get; init; } + + /// /// Draws ⌃P with the host's own controls, or null for a host whose palette is the cell popup. Every way in (⌃P, /// the header, the pointer menu's More commands…) goes through one funnel that asks this first. Null in /// the terminal, the snapshot, the tests and the parity harness, so every cell frame is unchanged. @@ -119,6 +121,14 @@ internal sealed record ClientHost /// public required INativeComposer? NativeComposer { get; init; } + /// + /// Draws the client's modals — the quit prompt, ⌃F search, ⌃R history, the ⌥M layouts list and the first-run welcome — + /// with the host's own controls, or null for a host whose modals are cell windows. One member for all five, because + /// their stacking (the quit prompt always in front), focus and theme are the host's to get right once. Null in the + /// terminal, the snapshot, the tests and the parity harness, so every cell frame is unchanged. + /// + public required INativeModals? NativeModals { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -160,6 +170,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Chrome = HostChrome.None, NativePalette = null, NativeComposer = null, + NativeModals = null, }; /// @@ -186,6 +197,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Chrome = HostChrome.None, NativePalette = null, NativeComposer = null, + NativeModals = null, }; /// diff --git a/src/SharpMUTerm.Tui/Hosting/INativeModals.cs b/src/SharpMUTerm.Tui/Hosting/INativeModals.cs new file mode 100644 index 00000000..67863def --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/INativeModals.cs @@ -0,0 +1,35 @@ +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Tui; + +/// +/// A host that draws the client's modals with its own controls (the desktop window's native modals) instead of cell +/// windows: the quit prompt, ⌃F search, ⌃R history, the ⌥M layouts list and the first-run welcome. The client hands it +/// a built on the client's thread — one of , +/// , , or +/// — and the host draws its model and hands every gesture back through it. +/// +/// One member for five modals, because what they share is exactly what a host must get right once: where a +/// modal is drawn (over the cells, the native panels and the chrome), what is in front when two are open (the quit +/// prompt, always), where the keyboard goes when one closes, and which theme it wears. Five interfaces would be five +/// places to get the stacking wrong. +/// +/// +internal interface INativeModals +{ + /// + /// Whether the host has somewhere to draw a modal now. False for a host built without a window (the window's + /// --render-png, the parity harness, a test), which then gets the cell modals. Read on the client's thread. + /// + bool Available { get; } + + /// + /// Shows . A session that is (the quit prompt) is + /// drawn over everything, including another modal, which stays open under it; any other replaces the modal open. + /// Called on the client's thread; the host marshals. + /// + void Show(ModalSession session); + + /// Closes if it is shown, saying nothing back. Called on the client's thread. + void Close(ModalSession session); +} diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs index 4ff89cf5..4ba87a0d 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs @@ -28,6 +28,11 @@ private T Drawing(string surface, string key, T model) surface == SurfaceCatalog.Palette ? (_palette.IsOpen ? _palette.View : null) : surface == SurfaceCatalog.Prefix ? (_prefixPanel.IsOpen ? _prefixPanel.Drawn : null) : surface == SurfaceCatalog.Compose ? (_composer.IsOpen ? _composer.Model : null) + : surface == SurfaceCatalog.Quit ? _quit.Model + : surface == SurfaceCatalog.Search ? _search.Model + : surface == SurfaceCatalog.History ? _historySearch.Model + : surface == SurfaceCatalog.Layouts ? (_layoutsView.IsOpen && _layoutsView.Mode == "layouts" && LayoutsKey() is { } key2 ? LayoutsModelFor(key2) : null) + : surface == SurfaceCatalog.Welcome ? (_welcomeView.IsOpen ? _welcome?.Model : null) : _drawnModels.TryGetValue((surface, key), out var model) ? model : null; /// A click on a header link, as the header's own handler receives it. diff --git a/src/SharpMUTerm.Tui/QuitOverlay.cs b/src/SharpMUTerm.Tui/QuitOverlay.cs index f8c8eeaa..ac11b860 100644 --- a/src/SharpMUTerm.Tui/QuitOverlay.cs +++ b/src/SharpMUTerm.Tui/QuitOverlay.cs @@ -1,6 +1,7 @@ using SharpConsoleUI; using SharpConsoleUI.Builders; using SharpConsoleUI.Controls; +using SharpMUTerm.Client.Modals; using static SharpMUTerm.Tui.MarkupText; namespace SharpMUTerm.Tui; @@ -22,12 +23,13 @@ internal sealed class QuitOverlay private const int MinimumWidth = 34; private readonly ConsoleWindowSystem _system; - private readonly Func _facts; + private readonly Func _facts; private readonly Action _quit; + private readonly Action? _closed; private Window? _window; private MarkupControl? _body; - private QuitFacts _current = QuitFacts.Nothing; + private QuitModel _current = QuitModel.Nothing; private QuitChoice _selected = QuitChoice.Stay; /// @@ -35,8 +37,9 @@ internal sealed class QuitOverlay /// about is the state their keystroke arrived in. is what a confirmed answer /// runs; the overlay never ends the loop itself. /// - public QuitOverlay(ConsoleWindowSystem system, Func facts, Action quit) + public QuitOverlay(ConsoleWindowSystem system, Func facts, Action quit, Action? closed = null) { + _closed = closed; _system = system; _facts = facts; _quit = quit; @@ -44,6 +47,9 @@ public QuitOverlay(ConsoleWindowSystem system, Func facts, Action qui public bool IsOpen => _window is not null; + /// The model the open prompt was drawn from, or null while it is closed. + internal QuitModel? Model => _window is null ? null : _current; + /// What the prompt is currently showing, for a headless test to read back. internal IReadOnlyList Lines => QuitPrompt.Render(_current, _selected); @@ -152,5 +158,6 @@ private void Reset() { _window = null; _body = null; + _closed?.Invoke(); } } diff --git a/src/SharpMUTerm.Tui/QuitPrompt.cs b/src/SharpMUTerm.Tui/QuitPrompt.cs index d9f6b28f..ad36895b 100644 --- a/src/SharpMUTerm.Tui/QuitPrompt.cs +++ b/src/SharpMUTerm.Tui/QuitPrompt.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using static SharpMUTerm.Tui.MarkupText; using static SharpMUTerm.Tui.ScreenPalette; @@ -32,39 +33,6 @@ internal enum QuitAction /// The answer to one keystroke: what to do, and which button is pointed at afterwards. internal readonly record struct QuitDecision(QuitAction Action, QuitChoice Selection); -/// -/// What a quit would end, as of the keystroke that asked. The app gathers it (only the app can see -/// sessions, windows and the open settings screen) and the prompt only renders it, so "what the -/// question says, given N connections and M drafts" is answerable without a terminal. -/// -/// -/// The connections a quit drops, by world.character (a world's own name for an anonymous one) — -/// the same list and the same unit the header's fraction counts, from the app's single derivation. It -/// used to be distinct world names, so two characters logged in on one world were announced as -/// "1 world connected" while the user was looking at two, and the one thing this prompt exists to do is -/// be trustworthy about what is at stake. -/// -/// -/// How many unsent lines there are, counted per command line rather than per window: the second bar -/// holds a line of its own, and a window counted once would hide it. -/// -/// The windows those drafts are sitting in, by title. -/// -/// An open settings screen used to be a fact here, carrying how many edits it held that were never -/// saved. It no longer is: a screen writes each change out as it is committed -/// (), so there is no such thing as an unsaved edit to warn about, and a -/// consequence line that could never be reached is worse than one fact fewer. -/// -internal readonly record struct QuitFacts( - IReadOnlyList ConnectedCharacters, - int Drafts, - IReadOnlyList DraftWindows) -{ - /// A client holding nothing: nothing connected and nothing typed. - internal static QuitFacts Nothing { get; } = - new(Array.Empty(), 0, Array.Empty()); -} - /// /// The quit confirmation, minus the window: what a keystroke means to it, and what it says. Pure, for /// the same reason is — the rules of a modal are exactly the part that a @@ -86,9 +54,6 @@ internal readonly record struct QuitFacts( /// internal static class QuitPrompt { - /// How many names a consequence line spells out before it starts counting instead. - private const int MaxNames = 3; - /// /// What one keystroke does, and where it leaves the pointer. y/n answer outright /// whatever is pointed at, Esc is the way out of every modal state in this client and stays here @@ -151,34 +116,16 @@ internal static QuitDecision Interpret(ConsoleKeyInfo key, QuitChoice selected) } /// - /// What quitting now would cost, one plain sentence per fact, and empty when it would cost nothing. - /// A bare "are you sure?" is a ritual; this client knows what it is holding, so the question names it - /// and becomes answerable. + /// What quitting now would cost, one plain sentence per fact (, which the + /// window's native prompt says too), and empty when it would cost nothing. /// - internal static IReadOnlyList Consequences(QuitFacts facts) - { - var lines = new List(); - - if (facts.ConnectedCharacters.Count > 0) - { - var n = facts.ConnectedCharacters.Count; - lines.Add($"{n} character{Plural(n)} connected — {Names(facts.ConnectedCharacters)}"); - } - - if (facts.Drafts > 0) - { - var where = facts.DraftWindows.Count > 0 ? $" — {Names(facts.DraftWindows)}" : string.Empty; - lines.Add($"{facts.Drafts} unsent draft{Plural(facts.Drafts)}{where}"); - } - - return lines; - } + internal static IReadOnlyList Consequences(QuitModel facts) => facts.Consequences; /// /// The whole surface as markup lines: the question, what it would cost, the two buttons with the /// pointed-at one filled, and the keys that answer it. /// - internal static List Render(QuitFacts facts, QuitChoice selected) + internal static List Render(QuitModel facts, QuitChoice selected) { var lines = new List { $"[bold {Value}]Quit SharpMUTerm?[/]", string.Empty }; @@ -187,7 +134,7 @@ internal static List Render(QuitFacts facts, QuitChoice selected) { // Still worth saying: "nothing is connected and nothing is unsent" is the answer to the // question the prompt just asked, and it is the state in which y is safe without reading on. - lines.Add($"[{Muted}]Nothing is connected and nothing is unsent.[/]"); + lines.Add($"[{Muted}]{QuitModel.NothingAtStake}[/]"); } else { @@ -216,11 +163,4 @@ private static string Chip(string label, bool chosen) => ? $"[{Ink} on {Accent}] ▸ {Escape(label)} [/]" : $"[{Label} on {EditBg}] {Escape(label)} [/]"; - private static string Plural(int count) => count == 1 ? string.Empty : "s"; - - /// Names, capped: past a few they stop identifying anything and only cost the line's width. - private static string Names(IReadOnlyList names) => - names.Count <= MaxNames - ? string.Join(", ", names) - : $"{string.Join(", ", names.Take(MaxNames))} +{names.Count - MaxNames} more"; } diff --git a/src/SharpMUTerm.Tui/SearchPrompt.cs b/src/SharpMUTerm.Tui/SearchPrompt.cs index 63cc7a99..68f3d991 100644 --- a/src/SharpMUTerm.Tui/SearchPrompt.cs +++ b/src/SharpMUTerm.Tui/SearchPrompt.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using static SharpMUTerm.Tui.MarkupText; using static SharpMUTerm.Tui.ScreenPalette; @@ -23,13 +24,6 @@ internal enum SearchAction internal readonly record struct SearchDecision( SearchAction Action, string Query, int Selected, bool Regex, bool AllWindows); -/// -/// One row of results: which window the line is in, where it sits in that window's buffer, and where the -/// query landed inside it. -/// -internal readonly record struct SearchRow( - string WindowId, string WindowLabel, int LineIndex, string Text, int MatchStart, int MatchLength); - /// /// The search surface (⌃F), minus the window: what a keystroke means to it, and what it says. Pure, for /// the same reason is — the rules and the wording are exactly the part @@ -182,6 +176,23 @@ internal static List Render( { ArgumentNullException.ThrowIfNull(rows); ArgumentNullException.ThrowIfNull(query); + return Render(new SearchModel(query, regex, all, scope, held, error, rows), selected, width, listRows, first); + } + + /// + /// The surface for — the cells of the model the window's native search draws too. + /// + /// The query, the toggles, the bound and the matches. + /// Which row the pointer is on. + /// The surface's content width, when known. + /// How many rows the list area holds; zero means "as many as there are". + /// Which match is drawn at the top of the list area. + internal static List Render(SearchModel model, int selected, int width = 0, int listRows = 0, int first = 0) + { + ArgumentNullException.ThrowIfNull(model); + var rows = model.Rows; + var query = model.Query; + var all = model.AllWindows; var labelWidth = all ? Math.Min(MaxLabelWidth, rows.Select(r => r.WindowLabel.Length).DefaultIfEmpty(0).Max()) @@ -190,22 +201,14 @@ internal static List Render( var lines = new List { - SpreadLR($"[{Label}]search[/] {QueryMarkup(query)}", $"[{Label}]{Escape(State(regex, all, scope))}[/]", width), - SpreadLR(string.Empty, $"[{Label}]{Escape(Counted(rows.Count, error, held))}[/]", width), + SpreadLR($"[{Label}]search[/] {QueryMarkup(query)}", $"[{Label}]{Escape(model.StateText)}[/]", width), + SpreadLR(string.Empty, $"[{Label}]{Escape(model.CountText)}[/]", width), }; var body = new List(); - if (error is not null) + if (model.EmptyText is { } empty) { - body.Add($"[{Muted}] {Escape(error)}[/]"); - } - else if (query.Length == 0) - { - body.Add($"[{Muted}] type to search {Escape(all ? "every window" : scope)}[/]"); - } - else if (rows.Count == 0) - { - body.Add($"[{Muted}] no matches — ⌫ widens the query[/]"); + body.Add($"[{Muted}] {Escape(empty)}[/]"); } var top = Math.Clamp(first, 0, Math.Max(0, rows.Count - 1)); @@ -241,25 +244,6 @@ internal static int Scroll(int first, int selected, int count, int listRows) return Math.Clamp(top, 0, count - listRows); } - /// - /// The two toggles and what they currently mean, in words rather than in glyphs: the surface has to - /// be able to say which way they are set, because both change what a query finds and neither - /// is visible in the results themselves. - /// - private static string State(bool regex, bool all, string scope) => - $"{(regex ? "regex" : "text")} · {(all ? "every window" : scope)}"; - - /// - /// How many lines matched out of how many were looked at. The second figure is the bound this search - /// actually had — the pane buffer, not a session's whole history — and it is on the frame so a reader - /// who cannot find an old line can see why rather than concluding the search is broken. - /// - private static string Counted(int shown, string? error, int held) - { - var searched = $"{held:n0} line{(held == 1 ? string.Empty : "s")} held"; - return error is not null ? searched : $"{shown} found · {searched}"; - } - /// /// The query, with the accent block caret after it — the same caret the settings screens draw on an /// open field, so this reads as something being typed into. diff --git a/src/SharpMUTerm.Tui/SearchSurface.cs b/src/SharpMUTerm.Tui/SearchSurface.cs index fbf71c7f..0a2e8cf9 100644 --- a/src/SharpMUTerm.Tui/SearchSurface.cs +++ b/src/SharpMUTerm.Tui/SearchSurface.cs @@ -1,6 +1,7 @@ using SharpConsoleUI; using SharpConsoleUI.Builders; using SharpConsoleUI.Controls; +using SharpMUTerm.Client.Modals; using SharpMUTerm.Core.Text; namespace SharpMUTerm.Tui; @@ -44,55 +45,90 @@ internal sealed class SearchSurface private const int ChromeRows = 4; private readonly ConsoleWindowSystem _system; - private readonly Func> _corpus; - private readonly Action _go; + private readonly Func _search; + private readonly Action _go; + private readonly Action? _closed; private Window? _window; private MarkupControl? _body; - private IReadOnlyList _rows = Array.Empty(); - private string _query = string.Empty; - private string? _error; - private string _scope = string.Empty; - private bool _regex; - private bool _all; - private int _held; + private SearchModel _model = Empty; private int _selected = -1; private int _contentWidth; private int _listRows; private int _first; + /// A search that has not been typed yet. + private static readonly SearchModel Empty = new(string.Empty, false, false, string.Empty, 0, null, []); + /// - /// is asked for the windows to search — all of them, or just the focused - /// one — and is read afresh on every keystroke. is handed the chosen row, the - /// query, and its ordinal out of the total, which is what the bar above the landed line says. + /// runs the search for a query and the two toggles, reading the windows + /// afresh — the client's SearchModelFor, which the window's native search calls too. + /// is handed the model and the chosen row's index in it, which is everything the + /// bar above the landed line says. /// public SearchSurface( ConsoleWindowSystem system, - Func> corpus, - Action go) + Func search, + Action go, + Action? closed = null) { _system = system; - _corpus = corpus; + _search = search; _go = go; + _closed = closed; + } + + /// + /// The search for over : every window's matches in + /// buffer order, or none and the reason when the pattern does not parse. The one place a search is run, + /// for the cell surface and the window's native one alike. + /// + internal static SearchModel Compute(IReadOnlyList windows, string query, bool regex, bool all) + { + var scope = windows.Count == 1 ? windows[0].Label : "the focused window"; + var held = windows.Sum(w => w.Lines.Count); + + var rows = new List(); + string? error = null; + foreach (var window in windows) + { + var result = OutputSearch.Match(window.Lines, query, regex); + if (result.Error is not null) + { + // One bad pattern is bad for every window, so it is reported once and the list is empty + // — a result set holding whatever the earlier windows managed would be a search that + // half-worked without saying which half. + error = result.Error; + rows.Clear(); + break; + } + + rows.AddRange(result.Matches.Select(m => + new SearchRow(window.WindowId, window.Label, m.LineIndex, m.Text, m.MatchStart, m.MatchLength))); + } + + return new SearchModel(query, regex, all, scope, held, error, rows); } public bool IsOpen => _window is not null; /// What the surface is currently showing, for a headless test to read back. - internal IReadOnlyList Lines => SearchPrompt.Render( - _rows, _query, _error, _regex, _all, _scope, _held, _selected, _contentWidth - 1, _listRows, _first); + internal IReadOnlyList Lines => SearchPrompt.Render(_model, _selected, _contentWidth - 1, _listRows, _first); + + /// The model the surface is drawn from now, or null while it is closed. + internal SearchModel? Model => _window is null ? null : _model; /// The query as typed so far. - internal string Query => _query; + internal string Query => _model.Query; /// The rows currently listed, in buffer order — what ↑↓ walk and ⏎ picks from. - internal IReadOnlyList Rows => _rows; + internal IReadOnlyList Rows => _model.Rows; /// Whether the query is being read as a pattern. - internal bool Regex => _regex; + internal bool Regex => _model.Regex; /// Whether every window is being searched rather than the focused one. - internal bool AllWindows => _all; + internal bool AllWindows => _model.AllWindows; /// Opens the surface, or closes it when ⌃F arrives a second time. public void Toggle() @@ -127,13 +163,10 @@ public void SimulateTyping(string text) private void Open() { - _query = string.Empty; - _error = null; - _regex = false; - _all = false; + _model = Empty; _selected = -1; _first = 0; - Refilter(_query, -1); + Refilter(string.Empty, false, false, -1); var desktop = _system.DesktopDimensions; @@ -178,7 +211,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) return; } - var decision = SearchPrompt.Interpret(e.KeyInfo, _query, _selected, _rows.Count, _regex, _all); + var decision = SearchPrompt.Interpret(e.KeyInfo, _model.Query, _selected, _model.Rows.Count, _model.Regex, _model.AllWindows); e.Handled = true; switch (decision.Action) @@ -186,12 +219,10 @@ private void OnKey(object? sender, KeyPressedEventArgs e) case SearchAction.Go: // Closed first: the reader is about to be looking at the pane this row is in, and a modal // still painted over it would hide the thing they asked to see. - var row = _rows[_selected]; - var ordinal = _selected + 1; - var total = _rows.Count; - var query = _query; + var model = _model; + var index = _selected; Close(); - _go(row, query, ordinal, total); + _go(model, index); break; case SearchAction.Cancel: @@ -199,9 +230,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) break; case SearchAction.Redraw: - _regex = decision.Regex; - _all = decision.AllWindows; - Refilter(decision.Query, decision.Selected); + Refilter(decision.Query, decision.Regex, decision.AllWindows, decision.Selected); Paint(); _window.Invalidate(redrawAll: true); break; @@ -216,37 +245,11 @@ private void OnKey(object? sender, KeyPressedEventArgs e) /// Re-reads the corpus and re-runs the search. The pointer is clamped to what the query actually /// matched: a narrowing must not leave ⏎ aimed past the end of the list. /// - private void Refilter(string query, int selected) + private void Refilter(string query, bool regex, bool all, int selected) { - _query = query; - - var windows = _corpus(_all); - _scope = windows.Count == 1 ? windows[0].Label : "the focused window"; - _held = windows.Sum(w => w.Lines.Count); - - var rows = new List(); - string? error = null; - foreach (var window in windows) - { - var result = OutputSearch.Match(window.Lines, query, _regex); - if (result.Error is not null) - { - // One bad pattern is bad for every window, so it is reported once and the list is empty - // — a result set holding whatever the earlier windows managed would be a search that - // half-worked without saying which half. - error = result.Error; - rows.Clear(); - break; - } - - rows.AddRange(result.Matches.Select(m => - new SearchRow(window.WindowId, window.Label, m.LineIndex, m.Text, m.MatchStart, m.MatchLength))); - } - - _error = error; - _rows = rows; - _selected = _rows.Count == 0 ? -1 : Math.Clamp(selected, 0, _rows.Count - 1); - _first = SearchPrompt.Scroll(_first, _selected, _rows.Count, _listRows); + _model = _search(query, regex, all); + _selected = _model.Rows.Count == 0 ? -1 : Math.Clamp(selected, 0, _model.Rows.Count - 1); + _first = SearchPrompt.Scroll(_first, _selected, _model.Rows.Count, _listRows); } private void Paint() => _body?.SetContent(new List(Lines)); @@ -263,5 +266,6 @@ private void Reset() { _window = null; _body = null; + _closed?.Invoke(); } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs index d9d21a1a..eb8b25aa 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -1,5 +1,7 @@ using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Surfaces; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; using SharpMUTerm.Core.Layouts; @@ -453,7 +455,8 @@ internal void AcceptLayoutSuggestion(WorldSession session) ?? (_sessions.Sessions.Count == 0 ? _demoActiveKey ?? DemoScene.ActiveSessionKey : null); /// Whether the ⌥M list is up. - internal bool LayoutsOpen => _layoutsView.IsOpen && _layoutsView.Mode == "layouts"; + internal bool LayoutsOpen => + (_layoutsView.IsOpen && _layoutsView.Mode == "layouts") || NativeModalOf(SurfaceCatalog.Layouts) is not null; /// What the ⌥M list shows, for a test. internal IReadOnlyList LayoutsLines => _layoutsView.Lines; @@ -464,6 +467,12 @@ internal void AcceptLayoutSuggestion(WorldSession session) /// ⌥M and ⌃P ▸ Layouts: the list of layouts for the focused character, or closes it. private void ShowLayouts() { + if (NativeModalOf(SurfaceCatalog.Layouts) is { } native) + { + CloseNativeModal(native); + return; + } + if (LayoutsOpen) { _layoutsView.Close(); @@ -489,6 +498,11 @@ private void ShowLayouts() _layoutsStatus = null; _layoutsRenaming = null; _layoutsConfirmingDelete = false; + if (TryOpenNativeLayouts(key)) + { + return; + } + _layoutsView.Open( "layouts", $"Layouts · {Snippet(key)}", @@ -519,30 +533,18 @@ private bool LayoutsEscape() } /// A key while a name is being typed: letters build it, ⏎ keeps it, ⌫ takes a letter back. - private bool LayoutsRenameKey(LayoutDefinition selected, ConsoleKeyInfo k) + private bool LayoutsRenameKey(string key, LayoutDefinition selected, ConsoleKeyInfo k) { var typed = _layoutsRenaming ?? string.Empty; switch (k.Key) { case ConsoleKey.Enter: - var name = typed.Trim(); - if (name.Length == 0) + var result = RunLayoutsVerb(key, LayoutVerb.Rename, selected.Id, typed); + if (result.Done) { - _layoutsStatus = "a layout needs a name — type one, or Esc keeps the old"; - return true; + _layoutsRenaming = null; } - if (!Layouts.Rename(selected.Id, name)) - { - _layoutsStatus = Layouts.IsNameTaken(name, selected.Id) - ? $"a layout is already called {name}" - : $"{selected.Name} cannot be renamed"; - return true; - } - - PersistConfiguration(); - _layoutsRenaming = null; - _layoutsStatus = $"renamed to {name}"; return true; case ConsoleKey.Backspace: _layoutsRenaming = typed.Length == 0 ? typed : typed[..^1]; @@ -569,25 +571,7 @@ private bool LayoutsDeleteAnswer(string key, LayoutDefinition selected, ConsoleK return true; } - if (!Layouts.Delete(selected.Id)) - { - _layoutsStatus = $"{selected.Name} cannot be deleted"; - return true; - } - - // The panes stay as they are; with the layout they were drawn from gone, they are the player's own now. - if (_liveLayout is { } live && live.LayoutId == selected.Id) - { - _liveLayout = null; - } - - PersistConfiguration(); - _layoutsSelected = Math.Clamp(_layoutsSelected, 0, Layouts.All.Count - 1); - var (world, character) = LayoutOwner(key); - var named = character?.Layout == selected.Id || world?.Layout == selected.Id; - _layoutsStatus = named - ? $"deleted {selected.Name} — this character falls back to the next layout" - : $"deleted {selected.Name}"; + RunLayoutsVerb(key, LayoutVerb.Delete, selected.Id, null); return true; } @@ -596,10 +580,9 @@ private bool LayoutsKeyPressed(string key, ConsoleKeyInfo k) var all = Layouts.All; _layoutsSelected = Math.Clamp(_layoutsSelected, 0, all.Count - 1); var selected = all[_layoutsSelected]; - var (world, character) = LayoutOwner(key); if (_layoutsRenaming is not null) { - return LayoutsRenameKey(selected, k); + return LayoutsRenameKey(key, selected, k); } if (_layoutsConfirmingDelete) @@ -617,19 +600,13 @@ private bool LayoutsKeyPressed(string key, ConsoleKeyInfo k) _layoutsSelected = Math.Min(all.Count - 1, _layoutsSelected + 1); return true; case ConsoleKey.Enter: - if (!ApplyLayout(key, selected)) - { - RefuseCommand($"no window to arrange for {Snippet(key)} — switch to the character first"); - return false; - } - - Notice($"{selected.Name} layout applied — c keeps it for this character, w for the world", MessageSeverity.Info, "⌥M"); + RunLayoutsVerb(key, LayoutVerb.Apply, selected.Id, null); return false; case ConsoleKey.S when k.Modifiers == 0: - _layoutsStatus = SaveLayoutChanges(key, selected, world, character).Status; + RunLayoutsVerb(key, LayoutVerb.SaveChanges, selected.Id, null); return true; case ConsoleKey.N when k.Modifiers == 0: - _layoutsStatus = SaveLayoutAsNew(key, selected).Status; + RunLayoutsVerb(key, LayoutVerb.SaveAsNew, selected.Id, null); return true; case ConsoleKey.R when k.Modifiers == 0: if (selected.IsBuiltIn) @@ -650,16 +627,119 @@ private bool LayoutsKeyPressed(string key, ConsoleKeyInfo k) _layoutsConfirmingDelete = true; return true; case ConsoleKey.W when k.Modifiers == 0: - _layoutsStatus = UseLayoutForWorld(key, selected, world).Status; + RunLayoutsVerb(key, LayoutVerb.UseForWorld, selected.Id, null); return true; case ConsoleKey.C when k.Modifiers == 0: - _layoutsStatus = UseLayoutForCharacter(key, selected, character).Status; + RunLayoutsVerb(key, LayoutVerb.UseForCharacter, selected.Id, null); return true; default: return true; } } + /// + /// What the ⌥M list does to a layout, from either list: the cell list's keys and the window's native list's + /// buttons both end here, so the two leave the client in the same state and say the same words. The result is the + /// list's status line; the pointer follows a layout a save created. Apply says what it did in a notice (the list + /// closes behind it) and refuses out loud with no window to arrange. + /// + private LayoutActionResult RunLayoutsVerb(string key, LayoutVerb verb, string layoutId, string? name) + { + var all = Layouts.All; + var index = all.ToList().FindIndex(l => l.Id == layoutId); + if (index < 0) + { + var gone = new LayoutActionResult(false, $"there is no layout {Snippet(layoutId)}"); + _layoutsStatus = gone.Status; + return gone; + } + + _layoutsSelected = index; + var selected = all[index]; + var (world, character) = LayoutOwner(key); + var result = verb switch + { + LayoutVerb.Apply => ApplyFromList(key, selected), + LayoutVerb.SaveChanges => SaveLayoutChanges(key, selected, world, character), + LayoutVerb.SaveAsNew => SaveLayoutAsNew(key, selected), + LayoutVerb.UseForWorld => UseLayoutForWorld(key, selected, world), + LayoutVerb.UseForCharacter => UseLayoutForCharacter(key, selected, character), + LayoutVerb.Rename => RenameLayout(selected, name ?? string.Empty), + LayoutVerb.Delete => DeleteLayout(key, selected), + _ => new LayoutActionResult(false, $"{verb} is not something the list does"), + }; + _layoutsStatus = result.Status; + return result; + } + + /// ⏎: the panes are arranged by now, and a notice says so. + private LayoutActionResult ApplyFromList(string key, LayoutDefinition selected) + { + if (!ApplyLayout(key, selected)) + { + var refused = $"no window to arrange for {Snippet(key)} — switch to the character first"; + RefuseCommand(refused); + return new(false, refused); + } + + var said = $"{selected.Name} layout applied — c keeps it for this character, w for the world"; + Notice(said, MessageSeverity.Info, "⌥M"); + return new(true, said); + } + + /// r then ⏎: a layout of the player's own takes as its name. + private LayoutActionResult RenameLayout(LayoutDefinition selected, string typed) + { + var name = typed.Trim(); + if (selected.IsBuiltIn) + { + return new(false, $"{selected.Name} is built in — n saves a copy you can rename"); + } + + if (name.Length == 0) + { + return new(false, "a layout needs a name — type one, or Esc keeps the old"); + } + + if (name.Length > LayoutNameMaxLength) + { + name = name[..LayoutNameMaxLength]; + } + + if (!Layouts.Rename(selected.Id, name)) + { + return new(false, Layouts.IsNameTaken(name, selected.Id) + ? $"a layout is already called {name}" + : $"{selected.Name} cannot be renamed"); + } + + PersistConfiguration(); + return new(true, $"renamed to {name}"); + } + + /// d then y: a layout of the player's own is deleted, and the panes it drew become theirs. + private LayoutActionResult DeleteLayout(string key, LayoutDefinition selected) + { + if (!Layouts.Delete(selected.Id)) + { + return new(false, selected.IsBuiltIn ? $"{selected.Name} is built in and cannot be deleted" : $"{selected.Name} cannot be deleted"); + } + + // The panes stay as they are; with the layout they were drawn from gone, they are the player's own now. + if (_liveLayout is { } live && live.LayoutId == selected.Id) + { + _liveLayout = null; + } + + PersistConfiguration(); + _layoutsSelected = Math.Clamp(_layoutsSelected, 0, Layouts.All.Count - 1); + var (world, character) = LayoutOwner(key); + var named = character?.Layout == selected.Id || world?.Layout == selected.Id; + return new(true, named + ? $"deleted {selected.Name} — this character falls back to the next layout" + : $"deleted {selected.Name}"); + } + /// After w or c: applies the layout now resolves to, if the panes show another. private void ReapplyIfResolvedChanged(string key) { @@ -780,8 +860,8 @@ private void AdoptArrangementAs(string key, LayoutDefinition layout) _ => string.Join(", ", layout.KnownPlacements.Where(p => p.TabOf is null).Select(p => PanelTitle(p.PanelId).ToLowerInvariant())), }; - /// The ⌥M list for at a width. - internal List LayoutsListLines(string key, int width) + /// The ⌥M list's model for : every layout, which is pointed at, and what was last said. + internal LayoutsModel LayoutsModelFor(string key) { var (world, _) = LayoutOwner(key); var inUse = _liveLayout is { } live && string.Equals(live.SessionKey, key, StringComparison.Ordinal) @@ -789,32 +869,52 @@ internal List LayoutsListLines(string key, int width) : ResolveLayout(key).Layout.Id; var worldDefault = world?.Layout ?? world?.AcceptedLayoutSuggestion; var all = Layouts.All; - var nameColumn = Math.Clamp(all.Max(l => Snippet(l.Name).Length) + 2, 12, 24); + var rows = all + .Select(l => new LayoutRow(l.Id, Snippet(l.Name), LayoutDescription(l), l.IsBuiltIn, l.Id == inUse, l.Id == worldDefault)) + .ToArray(); + return new LayoutsModel( + key, + rows, + Math.Clamp(_layoutsSelected, 0, Math.Max(0, rows.Length - 1)), + _layoutsStatus, + _layoutsRenaming, + _layoutsConfirmingDelete); + } + + /// The ⌥M list for at a width, drawn from its model. + internal List LayoutsListLines(string key, int width) => + LayoutsListLines(Drawing(SurfaceCatalog.Layouts, string.Empty, LayoutsModelFor(key)), width); + + /// The ⌥M list at a width: the cells of the model the window's native list draws too. + internal static List LayoutsListLines(LayoutsModel model, int width) + { + var rows = model.Rows; + var nameColumn = Math.Clamp(rows.Select(l => l.Name.Length).DefaultIfEmpty(0).Max() + 2, 12, 24); var lines = new List(); - void Row(int index, LayoutDefinition layout) + void Row(int index, LayoutRow layout) { - var selected = index == _layoutsSelected; + var selected = index == model.Selected; var mark = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; - var renaming = selected && _layoutsRenaming is not null; - var name = renaming ? _layoutsRenaming! + "▏" : Snippet(layout.Name); + var renaming = selected && model.Renaming is not null; + var name = renaming ? model.Renaming! + "▏" : layout.Name; name = renaming ? (name.Length > nameColumn - 1 ? "…" + name[^(nameColumn - 2)..] : name) : (name.Length > nameColumn - 1 ? name[..(nameColumn - 2)] + "…" : name); var tags = new List(); - if (layout.Id == inUse) + if (layout.InUse) { tags.Add("● in use"); } - if (layout.Id == worldDefault) + if (layout.WorldDefault) { tags.Add("● world default"); } var tag = tags.Count == 0 ? string.Empty : string.Join(" ", tags); var room = Math.Max(0, width - 2 - nameColumn - tag.Length - 1); - var description = LayoutDescription(layout); + var description = layout.Description; description = description.Length > room ? (room > 1 ? description[..(room - 1)] + "…" : string.Empty) : description; lines.Add( $"{mark} [{(selected ? "bold " : string.Empty)}{ScreenPalette.Value}]{Escape(name.PadRight(nameColumn))}[/]" @@ -823,19 +923,19 @@ void Row(int index, LayoutDefinition layout) } lines.Add($"[{ScreenPalette.Label}]built in[/]"); - for (var i = 0; i < all.Count && all[i].IsBuiltIn; i++) + for (var i = 0; i < rows.Count && rows[i].BuiltIn; i++) { - Row(i, all[i]); + Row(i, rows[i]); } lines.Add(string.Empty); lines.Add($"[{ScreenPalette.Label}]yours[/]"); var own = 0; - for (var i = 0; i < all.Count; i++) + for (var i = 0; i < rows.Count; i++) { - if (!all[i].IsBuiltIn) + if (!rows[i].BuiltIn) { - Row(i, all[i]); + Row(i, rows[i]); own++; } } @@ -846,15 +946,16 @@ void Row(int index, LayoutDefinition layout) } string Key(string chord, string what) => $"[{ScreenPalette.Accent}]{chord}[/] [{ScreenPalette.Label}]{what}[/]"; - var current = all[Math.Clamp(_layoutsSelected, 0, all.Count - 1)]; - var statusLine = _layoutsStatus is { } status ? $"[{ScreenPalette.Value}]{Escape(status)}[/]" : string.Empty; + var current = model.Current; + var currentName = current?.Name ?? string.Empty; + var statusLine = model.Status is { } status ? $"[{ScreenPalette.Value}]{Escape(status)}[/]" : string.Empty; // Every row below is always present, blank when it has nothing to say, so the modal (sized once, when it // opens) never has a line pushed off its bottom by a status or a question. lines.Add(string.Empty); - if (_layoutsRenaming is not null) + if (model.Renaming is not null) { - lines.Add($"[{ScreenPalette.Label}]type a new name for[/] [{ScreenPalette.Value}]{Escape(Snippet(current.Name))}[/]"); + lines.Add($"[{ScreenPalette.Label}]type a new name for[/] [{ScreenPalette.Value}]{Escape(currentName)}[/]"); lines.Add(string.Empty); lines.Add(string.Empty); lines.Add(statusLine); @@ -863,9 +964,9 @@ void Row(int index, LayoutDefinition layout) return lines; } - if (_layoutsConfirmingDelete) + if (model.ConfirmingDelete) { - lines.Add($"[{ScreenPalette.Value}]delete {Escape(Snippet(current.Name))}?[/] [{ScreenPalette.Label}]it cannot be brought back[/]"); + lines.Add($"[{ScreenPalette.Value}]delete {Escape(currentName)}?[/] [{ScreenPalette.Label}]it cannot be brought back[/]"); lines.Add(string.Empty); lines.Add(string.Empty); lines.Add(string.Empty); @@ -878,7 +979,7 @@ void Row(int index, LayoutDefinition layout) lines.Add($"{Key("w", "use for world")} {Key("c", "use for this character")}"); // r and d are named only over a layout of the player's own: on a built-in neither does anything but say so. - lines.Add(current.IsBuiltIn ? string.Empty : $"{Key("r", "rename")} {Key("d", "delete")}"); + lines.Add(current is null || current.BuiltIn ? string.Empty : $"{Key("r", "rename")} {Key("d", "delete")}"); lines.Add(statusLine); lines.Add(string.Empty); lines.Add($"[{ScreenPalette.Label}]↑↓ pick [[Esc]] Close [[⏎]] Apply[/]"); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs new file mode 100644 index 00000000..bdb1730a --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs @@ -0,0 +1,285 @@ +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Surfaces; + +namespace SharpMUTerm.Tui; + +/// +/// The client's modals in a host that draws them with its own controls (): the +/// quit prompt, ⌃F search, ⌃R history, the ⌥M layouts list and the first-run welcome. Each has one funnel every way in +/// goes through (, , , +/// , ), and the funnel asks the host first. A host without one — the +/// terminal, the snapshot, the tests, the parity harness — gets the cell modal, unchanged. +/// +/// The model is the cell modal's. Each session carries the Client model the cell modal draws (the quit facts, +/// the search results, the history, the layout rows, the welcome's state), and every gesture comes back to the client +/// method the cell modal's key ends in: , , +/// , , . +/// +/// +/// The quit prompt is always in front. It can be asked for from anywhere — ⌃Q from any modal, the window's close +/// button while F1 is open — and is never refused: it opens over an open modal, which stays under it, and in the +/// window the host keeps it the topmost thing drawn. With a host that has no native modals the cell prompt is a +/// framework modal window, and anything the host draws over the cells would hide it, so the host's F1 and ⌃P are +/// closed first (F1 keeping its draft). +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The native quit prompt, or null while none is open. + private QuitSession? _nativeQuit; + + /// The native search, history, layouts list or welcome, or null while none is open. + private ModalSession? _nativeModal; + + /// The host's modals, when it has somewhere to draw them; null for cells. + private INativeModals? NativeModalsHost => Host.NativeModals is { Available: true } native ? native : null; + + /// Whether a native modal is open, the quit prompt included. + private bool NativeModalOpen => _nativeQuit is not null || _nativeModal is not null; + + /// The native modal open under the quit prompt, for the tests; null for none. + internal ModalSession? NativeModal => _nativeModal; + + /// The native quit prompt, for the tests; null for none. + internal QuitSession? NativeQuit => _nativeQuit; + + /// The native search's session while one is open, for the tests. + internal SearchSession? NativeSearch => _nativeModal as SearchSession; + + /// The native history's session while one is open, for the tests. + internal HistorySession? NativeHistory => _nativeModal as HistorySession; + + /// The native layouts list's session while one is open, for the tests. + internal LayoutsSession? NativeLayouts => _nativeModal as LayoutsSession; + + /// The native welcome's session while one is open, for the tests. + internal WelcomeSession? NativeWelcome => _nativeModal as WelcomeSession; + + /// What the native modal open is called in a refusal, or null with none. + private string? NativeModalName => _nativeQuit is not null ? "the quit prompt" : _nativeModal?.Surface switch + { + SurfaceCatalog.Search => "the search surface", + SurfaceCatalog.History => "the history search", + SurfaceCatalog.Layouts => "the layouts", + SurfaceCatalog.Welcome => "the welcome", + null => null, + _ => "what is open", + }; + + // ── the quit prompt ───────────────────────────────────────────────────────────────────────── + + /// + /// ⌃Q, and the window's close button (which sends it): opens the quit prompt, or dismisses it when it is up — the + /// toggle explains. Never refused, whatever is open. + /// + private void ToggleQuit() + { + if (_nativeQuit is { } open) + { + CloseNativeModal(open); + return; + } + + if (_quit.IsOpen) + { + _quit.Toggle(); + return; + } + + if (NativeModalsHost is { } native) + { + QuitSession? session = null; + session = new QuitSession( + QuitFactsNow(), + ThemeIsDark(), + () => OnUiThread(Quit), + () => OnUiThread(() => NativeModalClosed(session!))); + _nativeQuit = session; + native.Show(session); + return; + } + + // The cell prompt is a framework window drawn in the cells. Anything the host draws over the cells would hide + // it, so the host's F1 (keeping its draft, which the prompt then counts) and ⌃P go first. + if (_nativeCompose is not null) + { + CloseComposer(); + } + + CloseNativePalette(); + _quit.Toggle(); + } + + /// The quit prompt closed without quitting, in either host: n, Esc, ⌃Q again. + private void QuitPromptClosed() => _header.SetContent(new List { HeaderMarkup() }); + + // ── ⌃F, ⌃R, ⌥M and the welcome ────────────────────────────────────────────────────────────── + + /// + /// The search for over the windows ⌃F looks in now — the one function both the cell + /// surface and the native one ask, so the two list the same rows. + /// + internal SearchModel SearchModelFor(string query, bool regex, bool all) => + SearchSurface.Compute(SearchableWindows(all), query, regex, all); + + /// Opens ⌃F in the host's controls; false when the host has none. + private bool TryOpenNativeSearch() + { + if (NativeModalsHost is not { } native) + { + return false; + } + + SearchSession? session = null; + session = new SearchSession( + SearchModelFor(string.Empty, false, false), + ThemeIsDark(), + (query, regex, all) => OnUiThread(() => + { + if (ReferenceEquals(_nativeModal, session)) + { + session!.Publish(SearchModelFor(query, regex, all)); + } + }), + (model, index) => OnUiThread(() => GoToSearchHit(model, index)), + () => OnUiThread(() => NativeModalClosed(session!))); + ShowNativeModal(native, session); + return true; + } + + /// Opens ⌃R in the host's controls; false when the host has none. + private bool TryOpenNativeHistory() + { + if (NativeModalsHost is not { } native) + { + return false; + } + + HistorySession? session = null; + session = new HistorySession( + new HistoryModel(HistoryFor(BarKind(ActiveBar())).Entries.ToArray(), HistoryBarLabel()), + ThemeIsDark(), + index => OnUiThread(() => InsertHistoryEntry(index)), + () => OnUiThread(() => NativeModalClosed(session!))); + ShowNativeModal(native, session); + return true; + } + + /// Opens ⌥M for in the host's controls; false when the host has none. + private bool TryOpenNativeLayouts(string key) + { + if (NativeModalsHost is not { } native) + { + return false; + } + + LayoutsSession? session = null; + session = new LayoutsSession( + LayoutsModelFor(key), + ThemeIsDark(), + (verb, id, name) => OnUiThread(() => + { + RunLayoutsVerb(key, verb, id, name); + if (ReferenceEquals(_nativeModal, session)) + { + session!.Publish(LayoutsModelFor(key)); + } + }), + () => OnUiThread(() => NativeModalClosed(session!))); + ShowNativeModal(native, session); + return true; + } + + /// Opens the welcome over in the host's controls; false when the host has none. + private bool TryOpenNativeWelcome(WelcomeSurface welcome) + { + if (NativeModalsHost is not { } native) + { + return false; + } + + WelcomeSession? session = null; + void Republish() + { + if (ReferenceEquals(_nativeModal, session)) + { + session!.Publish(welcome.Model); + } + } + + session = new WelcomeSession( + welcome.Model, + ThemeIsDark(), + choice => OnUiThread(() => + { + if (ReferenceEquals(_nativeModal, session) && RunWelcomeAction(welcome, welcome.Choose(choice))) + { + Republish(); + } + }), + layout => OnUiThread(() => + { + SetWelcomeLayout(welcome, layout); + Republish(); + }), + form => OnUiThread(() => + { + if (ReferenceEquals(_nativeModal, session) + && RunWelcomeAction(welcome, welcome.Submit(form, words => ParseEndpoint(words)))) + { + Republish(); + } + }), + () => OnUiThread(() => + { + welcome.Back(); + Republish(); + }), + () => OnUiThread(() => NativeModalClosed(session!))); + ShowNativeModal(native, session); + return true; + } + + private void ShowNativeModal(INativeModals native, ModalSession session) + { + if (_nativeModal is { } previous) + { + previous.End(); + } + + _nativeModal = session; + native.Show(session); + } + + /// Closes a native modal the client is done with, running nothing. + private void CloseNativeModal(ModalSession session) + { + session.End(); + Host.NativeModals?.Close(session); + NativeModalClosed(session); + } + + /// A native modal has closed, however it did; a session an earlier opening left behind is ignored. + private void NativeModalClosed(ModalSession session) + { + if (ReferenceEquals(_nativeQuit, session)) + { + _nativeQuit = null; + QuitPromptClosed(); + } + else if (ReferenceEquals(_nativeModal, session)) + { + _nativeModal = null; + if (session is WelcomeSession && _welcome is { } welcome) + { + _welcomeLayout = welcome.Layout; + } + + _header.SetContent(new List { HeaderMarkup() }); + } + } + + /// The native modal of , if that is the one open. + private ModalSession? NativeModalOf(string surface) => + _nativeModal is { } open && open.Surface == surface ? open : null; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs index f1ffa912..f14e5533 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; using SharpMUTerm.Core.Session; @@ -38,7 +39,7 @@ internal sealed partial class SharpMUTermApp private string? _tourWindow; /// Whether the welcome surface is up, for the tests. - internal bool WelcomeIsOpen => _welcomeView.IsOpen; + internal bool WelcomeIsOpen => _welcomeView.IsOpen || NativeModalOf(Client.Surfaces.SurfaceCatalog.Welcome) is not null; /// What the welcome shows now, for the tests. internal IReadOnlyList WelcomeLines => _welcomeView.Lines; @@ -47,7 +48,28 @@ internal sealed partial class SharpMUTermApp internal WelcomeSurface? Welcome => _welcome; /// Feeds a key to the welcome surface the way the window's own handler would. - internal void SimulateWelcomeKey(ConsoleKeyInfo key) => _welcomeView.SimulateKey(key); + internal void SimulateWelcomeKey(ConsoleKeyInfo key) + { + // The native welcome takes the same keys through the same surface, and says what they did by republishing. + if (NativeWelcome is { } native && _welcome is { } welcome) + { + var stays = key.Key == ConsoleKey.Escape + ? welcome.Back() + : RunWelcomeAction(welcome, welcome.Interpret(key, words => ParseEndpoint(words))); + if (stays) + { + native.Publish(welcome.Model); + } + else if (key.Key == ConsoleKey.Escape) + { + CloseNativeModal(native); + } + + return; + } + + _welcomeView.SimulateKey(key); + } /// Why the package index cannot be browsed, or null when it can be asked for. private string? PackageIndexProblem() => @@ -79,18 +101,21 @@ internal void ShowWelcome() // Already up: left as it is, form and all. Asking again (a second /welcome, or the startup pass a live // loop runs after a scene was laid out) must not throw away what the player has typed. - if (_welcomeView.IsOpen && _welcome is not null) + if (WelcomeIsOpen && _welcome is not null) { return; } - if (ComposerIsInTheWay("the welcome") || (AnyOverlayOpen && !_welcomeView.IsOpen && Refuse($"close {OpenOverlayName()} first"))) + if (ComposerIsInTheWay("the welcome") || (AnyOverlayOpen && Refuse($"close {OpenOverlayName()} first"))) { return; } _welcome = new WelcomeSurface(problem) { Layout = _welcomeLayout }; - OpenWelcomeView(); + if (!TryOpenNativeWelcome(_welcome)) + { + OpenWelcomeView(); + } } private void OpenWelcomeView() @@ -108,19 +133,26 @@ private void OpenWelcomeView() }); } - private bool WelcomeKey(WelcomeSurface welcome, ConsoleKeyInfo key) + private bool WelcomeKey(WelcomeSurface welcome, ConsoleKeyInfo key) => + RunWelcomeAction(welcome, welcome.Interpret(key, words => ParseEndpoint(words))); + + /// + /// What the welcome asked for, from either host: the cell surface's key and the native welcome's click both end + /// here. Browse and Open settings close it and open what they name; Connect closes it and dials the form through + /// /connect's path. Anything else keeps it open, which is the return value. + /// + private bool RunWelcomeAction(WelcomeSurface welcome, WelcomeAction action) { - var action = welcome.Interpret(key, words => ParseEndpoint(words)); _welcomeLayout = welcome.Layout; switch (action) { case WelcomeAction.Browse: - _welcomeView.Close(); + CloseWelcome(); BrowsePackages(); return false; case WelcomeAction.Settings: - _welcomeView.Close(); + CloseWelcome(); if (!ComposerIsInTheWay("a settings screen")) { _settings.Toggle(ConsoleKey.F5, WorldsScreen); @@ -129,7 +161,7 @@ private bool WelcomeKey(WelcomeSurface welcome, ConsoleKeyInfo key) return false; case WelcomeAction.Connect when welcome.Request is { } request: - _welcomeView.Close(); + CloseWelcome(); ConnectFromWelcome(request); return false; @@ -138,6 +170,24 @@ private bool WelcomeKey(WelcomeSurface welcome, ConsoleKeyInfo key) } } + /// A layout chip: the welcome's starting layout, for the run. + private void SetWelcomeLayout(WelcomeSurface welcome, WelcomeLayout layout) + { + welcome.Layout = layout; + _welcomeLayout = layout; + } + + /// Closes the welcome in whichever host it is open. + private void CloseWelcome() + { + if (NativeModalOf(Client.Surfaces.SurfaceCatalog.Welcome) is { } native) + { + CloseNativeModal(native); + } + + _welcomeView.Close(); + } + /// The form's answer, through /connect's own path, with the character the form named. private void ConnectFromWelcome(WelcomeConnect request) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index cc05b185..1aab0312 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1,6 +1,7 @@ using System.Text; using Microsoft.Extensions.Logging; using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Modals; using SharpMUTerm.Client.Palette; using SharpMUTerm.Client.Surfaces; using SharpMUTerm.Core.Commands; @@ -934,7 +935,7 @@ public SharpMUTermApp( _welcomeView = new ListOverlay(_system, _screens); _composer.Send += (_, result) => SendComposed(result); _composer.Closed += (_, result) => KeepComposeDraft(result); - _quit = new QuitOverlay(_system, QuitFactsNow, Quit); + _quit = new QuitOverlay(_system, QuitFactsNow, Quit, QuitPromptClosed); // The ⌃B which-key panel. Its facts are read at the moment it opens, so it explains the workspace // the user is actually looking at, and the key that ends it goes back through the very consumer a @@ -949,7 +950,7 @@ public SharpMUTermApp( HistoryBarLabel, InsertHistoryEntry); - _search = new SearchSurface(_system, SearchableWindows, GoToSearchHit); + _search = new SearchSurface(_system, SearchModelFor, GoToSearchHit); _window.OnResize += (_, _) => { @@ -1652,27 +1653,38 @@ public string RenderSnapshot(string? view = null) AppendWindowLine(DemoScene.ChatWindowId, MarkupText.Escape(" Ana: the goblin room is bugged")); SettleScroll(); - OpenSearchForSnapshot(); - if (string.Equals(view, "search-all", StringComparison.OrdinalIgnoreCase)) + // In a host that draws ⌃F itself, the same query through the native surface's session (the window's + // screenshots); the parity harness and the terminal have none and take the cell path below. + if (!string.Equals(view, "search-landed", StringComparison.OrdinalIgnoreCase) && TryOpenNativeSearch()) { - SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.A, false, true, false)); - } - - if (string.Equals(view, "search-regex", StringComparison.OrdinalIgnoreCase)) - { - SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.E, false, true, false)); - SimulateSearchTyping(@"gobl\w+ (corpse|for)"); + var all = string.Equals(view, "search-all", StringComparison.OrdinalIgnoreCase); + var regex = string.Equals(view, "search-regex", StringComparison.OrdinalIgnoreCase); + NativeSearch!.Search(regex ? @"gobl\w+ (corpse|for)" : "goblin", regex, all); } else { - SimulateSearchTyping("goblin"); - } + OpenSearchForSnapshot(); + if (string.Equals(view, "search-all", StringComparison.OrdinalIgnoreCase)) + { + SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.A, false, true, false)); + } - if (string.Equals(view, "search-landed", StringComparison.OrdinalIgnoreCase)) - { - SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); - SimulateSearchKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); - SettleScroll(); + if (string.Equals(view, "search-regex", StringComparison.OrdinalIgnoreCase)) + { + SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.E, false, true, false)); + SimulateSearchTyping(@"gobl\w+ (corpse|for)"); + } + else + { + SimulateSearchTyping("goblin"); + } + + if (string.Equals(view, "search-landed", StringComparison.OrdinalIgnoreCase)) + { + SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + SimulateSearchKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + SettleScroll(); + } } ReArmWholeFrame(); @@ -1763,10 +1775,14 @@ public string RenderSnapshot(string? view = null) // seeded here on purpose: the frame is where "the password is not in the list" is visible. HistoryFor(InputBar.Primary).Add("connect Corvid hunter2"); - _historySearch.OpenForSnapshot(); - if (view.EndsWith("-filter", StringComparison.OrdinalIgnoreCase)) + // A host that draws ⌃R itself filters in its own box, so only the list is handed over there. + if (!TryOpenNativeHistory()) { - _historySearch.SimulateTyping("north"); + _historySearch.OpenForSnapshot(); + if (view.EndsWith("-filter", StringComparison.OrdinalIgnoreCase)) + { + _historySearch.SimulateTyping("north"); + } } } @@ -4751,9 +4767,13 @@ private bool RemoveAwayBar(string windowId) /// a search bar was on screen, which is a defect nobody would connect to search. /// /// - private void GoToSearchHit(SearchRow row, string query, int ordinal, int total) + private void GoToSearchHit(SearchModel model, int index) => + GoToSearchHit(model.Rows[index], model.Query, model.Regex, model.AllWindows, index + 1, model.Rows.Count); + + /// Goes to , the th of hits for a search. + private void GoToSearchHit(SearchRow row, string query, bool regex, bool all, int ordinal, int total) { - _lastSearch = (query, _search.Regex, _search.AllWindows); + _lastSearch = (query, regex, all); var previous = RemoveSearchBar(); if (previous is { } cleared && !string.Equals(cleared, row.WindowId, StringComparison.Ordinal)) @@ -4841,7 +4861,7 @@ private void NextSearchHit() next = current >= 0 ? (current + 1) % rows.Count : 0; } - GoToSearchHit(rows[next], last.Query, next + 1, rows.Count); + GoToSearchHit(rows[next], last.Query, last.Regex, last.All, next + 1, rows.Count); } /// @@ -5439,12 +5459,21 @@ private void ToggleHistorySearch() return; } + if (NativeModalOf(SurfaceCatalog.History) is { } open) + { + CloseNativeModal(open); + return; + } + if (AnyOverlayOpen || _moveMode) { return; } - _historySearch.Toggle(); + if (!TryOpenNativeHistory()) + { + _historySearch.Toggle(); + } } /// @@ -5454,7 +5483,7 @@ private void ToggleHistorySearch() /// how the framework happens to dispatch, and the next surface may not be modal. /// private bool AnyOverlayOpen => - PaletteIsOpen || _settings.IsOpen || _quit.IsOpen || _messageLog.IsOpen || _historySearch.IsOpen + PaletteIsOpen || _settings.IsOpen || _quit.IsOpen || NativeModalOpen || _messageLog.IsOpen || _historySearch.IsOpen || _prefixPanel.IsOpen || ComposerOpen || _search.IsOpen || _gameData.IsOpen || _packageView.IsOpen || _sendMenu.IsOpen || _layoutsView.IsOpen || _welcomeView.IsOpen; @@ -5475,6 +5504,12 @@ private void ToggleSearch() return; } + if (NativeModalOf(SurfaceCatalog.Search) is { } open) + { + CloseNativeModal(open); + return; + } + if (ComposerOpen) { RefuseCommand("close the composer first — search cannot open over it"); @@ -5486,7 +5521,10 @@ private void ToggleSearch() return; } - _search.Toggle(); + if (!TryOpenNativeSearch()) + { + _search.Toggle(); + } } /// @@ -5568,6 +5606,7 @@ private string OpenOverlayName() => _settings.IsOpen ? "the settings screen" : PaletteIsOpen ? "the command surface" : _quit.IsOpen ? "the quit prompt" + : NativeModalName is { } native ? native : _messageLog.IsOpen ? "the client messages" : _gameData.IsOpen ? "the game data" : _packageView.IsOpen ? "the packages" @@ -7101,7 +7140,7 @@ private void RegisterFocusReportTab() // ⌃Q asks first. A second ⌃Q dismisses the question rather than answering it — the same // toggle every other surface in this client is on, and the only reading under which a held // or twice-fumbled chord cannot quit on its own. See QuitPrompt. - ConsoleKey.Q => () => { _quit.Toggle(); return true; }, + ConsoleKey.Q => () => { ToggleQuit(); return true; }, // Next window. ⌃Tab used to be listed here as a second spelling "where the terminal reports // it"; no terminal does — it writes 0x09, which is a bare Tab — so the arm was dead and the // claim behind it was telling F4 a chord was taken that cannot arrive. ⌃N is the chord. @@ -7141,7 +7180,7 @@ private void Quit() /// holding an OOC line is exactly the draft a per-window count would hide. /// /// - private QuitFacts QuitFactsNow() + private QuitModel QuitFactsNow() { var activeId = ActiveWindowId(); var holding = _workspace.Windows.Where(w => w.HasUnsentInput).ToList(); @@ -7164,7 +7203,7 @@ private QuitFacts QuitFactsNow() // — 3 unsaved edits", which was true while closing a screen could throw its edits away; now every // committed value is already written to disk when it is committed, so the count is always zero and a // line that could never appear is a line to delete rather than to leave hanging. - return new QuitFacts(ConnectedCharacters(), drafts, holding.Select(w => w.Title).ToList()); + return new QuitModel(ConnectedCharacters(), drafts, holding.Select(w => w.Title).ToList()); } /// @@ -11699,7 +11738,7 @@ private bool RouteToInput(ConsoleKeyInfo key) internal string StatusMarkup => _statusBar.Text; /// Whether the ⌃Q confirmation is up. - internal bool QuitPromptOpen => _quit.IsOpen; + internal bool QuitPromptOpen => _quit.IsOpen || _nativeQuit is not null; /// What the ⌃Q confirmation is asking — the rendered markup, for a headless test to read. internal IReadOnlyList QuitPromptLines => _quit.Lines; @@ -11724,7 +11763,7 @@ private bool RouteToInput(ConsoleKeyInfo key) internal void SimulateReviewKey(ConsoleKeyInfo key) => _settings.Review.SimulateKey(key); /// Whether the ⌃R history surface is up. - internal bool HistorySearchOpen => _historySearch.IsOpen; + internal bool HistorySearchOpen => _historySearch.IsOpen || NativeModalOf(SurfaceCatalog.History) is not null; /// What the ⌃R surface is showing — the rendered markup, for a headless test to read. internal IReadOnlyList HistorySearchLines => _historySearch.Lines; @@ -11744,7 +11783,7 @@ private bool RouteToInput(ConsoleKeyInfo key) internal void SimulateHistorySearchKey(ConsoleKeyInfo key) => _historySearch.SimulateKey(key); /// Whether the ⌃F search surface is up. - internal bool SearchIsOpen => _search.IsOpen; + internal bool SearchIsOpen => _search.IsOpen || NativeModalOf(SurfaceCatalog.Search) is not null; /// What the search surface is currently listing — what ↑↓ walk and ⏎ picks from. internal IReadOnlyList SearchRows => _search.Rows; diff --git a/src/SharpMUTerm.Tui/WelcomeSurface.cs b/src/SharpMUTerm.Tui/WelcomeSurface.cs index 5a735d9d..39c92e08 100644 --- a/src/SharpMUTerm.Tui/WelcomeSurface.cs +++ b/src/SharpMUTerm.Tui/WelcomeSurface.cs @@ -1,43 +1,9 @@ +using SharpMUTerm.Client.Modals; using SharpMUTerm.Core.Layouts; using static SharpMUTerm.Tui.MarkupText; namespace SharpMUTerm.Tui; -/// What the welcome's menu offers, in the order it lists them. -internal enum WelcomeChoice -{ - /// The small form: host, port, TLS, a character name. - Connect, - - /// The package index browser, fetched only now. - Browse, - - /// F5, to add a world by hand. - Settings, -} - -/// -/// The starting layout a first world is given. sets nothing, so the client's own -/// suggestion () still applies when it first connects; the other two are the -/// player's choice outright and are written to WorldDefinition.Layout. -/// -internal enum WelcomeLayout -{ - Suggested, - Roleplay, - Combat, -} - -/// The connect form's rows, top to bottom. -internal enum WelcomeField -{ - Host, - Port, - Tls, - Character, - Password, -} - /// What a key on the welcome asks the app to do. internal enum WelcomeAction { @@ -71,16 +37,14 @@ internal sealed record WelcomeConnect(string Host, int Port, bool Tls, string? C internal sealed class WelcomeSurface { /// The example the surface names, a host nobody owns (RFC 2606). - internal const string ExampleCommand = "/connect mud.example.org 4201 tls"; + internal const string ExampleCommand = WelcomeModel.ExampleCommand; /// The width the surface asks for; the overlay narrows it on a small terminal. internal const int PreferredWidth = 66; - /// The longest host the form takes: a DNS name's limit. - private const int MaxHost = 253; + private const int MaxHost = WelcomeModel.MaxHost; - /// A character name long enough for any game's. - private const int MaxCharacter = 40; + private const int MaxCharacter = WelcomeModel.MaxCharacter; private readonly string? _indexProblem; @@ -112,6 +76,37 @@ internal sealed class WelcomeSurface /// The checked form, once ⏎ has accepted it. public WelcomeConnect? Request { get; private set; } + /// Everything the surface says now: what the cells draw and the window's native welcome draws. + public WelcomeModel Model => + new(InForm, Selected, Layout, Field, Host, Port, Tls, Character, PasswordLater, Problem, _indexProblem); + + /// + /// A menu choice made outright — the native welcome's click, or ⏎ on the cell menu once the pointer is on it. The + /// cell menu's own rules: Connect opens the form, Browse with no index says so in place. + /// + public WelcomeAction Choose(WelcomeChoice choice) + { + Selected = choice; + Problem = null; + return MenuKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + } + + /// + /// The native form's Connect: the fields as typed, held to the cell form's limits, then checked as ⏎ checks them. + /// + public WelcomeAction Submit(WelcomeForm form, Func, (string Host, int Port)?> parse) + { + ArgumentNullException.ThrowIfNull(form); + InForm = true; + Host = new string(form.Host.Trim().Where(c => !char.IsWhiteSpace(c) && !char.IsControl(c)).Take(MaxHost).ToArray()); + Port = new string(form.Port.Trim().Where(char.IsAsciiDigit).Take(5).ToArray()); + Tls = form.Tls; + Character = new string(form.Character.Where(c => !char.IsControl(c)).Take(MaxCharacter).ToArray()).TrimStart(); + PasswordLater = form.PasswordLater; + Problem = null; + return Submit(parse); + } + /// The built-in layout id names, or null for the suggestion. public string? LayoutId => LayoutIdOf(Layout); @@ -313,17 +308,21 @@ private static string Pad(string markup, int width) => /// either — the form's footer sits where the menu's does, and nothing has to be closed and reopened to switch, /// which a window running its own loop does not do in the order a headless one does. /// - public List Render(int width) + public List Render(int width) => Render(Model, width); + + /// The surface for at a width — the cells of the model the window's native welcome draws. + public static List Render(WelcomeModel model, int width) { - if (!InForm) + ArgumentNullException.ThrowIfNull(model); + if (!model.InForm) { - return RenderMenu(width); + return RenderMenu(model, width); } - var form = RenderForm(width); + var form = RenderForm(model, width); var footer = form[^1]; form.RemoveAt(form.Count - 1); - var height = RenderMenu(width).Count; + var height = RenderMenu(model, width).Count; while (form.Count < height - 1) { form.Add(string.Empty); @@ -333,7 +332,7 @@ public List Render(int width) return form; } - private List RenderMenu(int width) + private static List RenderMenu(WelcomeModel model, int width) { var lines = new List { @@ -344,28 +343,21 @@ private List RenderMenu(int width) foreach (var choice in Enum.GetValues()) { - var selected = choice == Selected; - var (title, detail) = choice switch - { - WelcomeChoice.Connect => ("Connect to a host", "type a host and port"), - WelcomeChoice.Browse => ("Browse games", _indexProblem is null ? "from the package index" : "no package index set"), - _ => ("Open settings", "F5, add a world by hand"), - }; + var selected = choice == model.Selected; + var (title, detail) = model.Describe(choice); var marker = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; lines.Add($"{marker} {Pad(Value(title, selected), 20)} {Label(detail)}"); } - lines.Add(Problem is null ? string.Empty : $" [{ScreenPalette.Caution}]{Escape(Problem)}[/]"); + lines.Add(model.Problem is null ? string.Empty : $" [{ScreenPalette.Caution}]{Escape(model.Problem)}[/]"); lines.Add(Label("Or type it on the command line below:")); lines.Add(" " + Value(ExampleCommand)); lines.Add(string.Empty); - lines.Add(Label(Layout == WelcomeLayout.Suggested - ? "Starting layout, picked from what the game sends:" - : "Starting layout, whatever the game sends:")); + lines.Add(Label(model.LayoutHeading)); var chips = string.Join(" ", Enum.GetValues().Select(layout => { - var name = layout == WelcomeLayout.Suggested ? "suggested" : layout.ToString(); - return layout == Layout + var name = WelcomeModel.LayoutName(layout); + return layout == model.Layout ? $"[bold {ScreenPalette.Ink} on {ScreenPalette.Accent}] {Escape(name)} [/]" : $"[{ScreenPalette.Value}] {Escape(name)} [/]"; })); @@ -376,7 +368,7 @@ private List RenderMenu(int width) return lines; } - private List RenderForm(int width) + private static List RenderForm(WelcomeModel model, int width) { var lines = new List { @@ -386,25 +378,24 @@ private List RenderForm(int width) }; var boxWidth = Math.Clamp(width - 16, 12, 44); - lines.Add(Row(WelcomeField.Host, "host", Box(Host, boxWidth, Field == WelcomeField.Host, "mud.example.org"))); - lines.Add(Row(WelcomeField.Port, "port", Box(Port, 7, Field == WelcomeField.Port, null))); - lines.Add(Row(WelcomeField.Tls, "TLS", Toggle(Tls, "on, encrypted", "off"))); - lines.Add(Row(WelcomeField.Character, "character", Box(Character, boxWidth, Field == WelcomeField.Character, "optional, the name you log in as"))); - lines.Add(Row(WelcomeField.Password, "password", Toggle(PasswordLater, "save it on F5 after connecting", "type it at the login prompt"))); + var field = model.Field; + lines.Add(Row(field, WelcomeField.Host, "host", Box(model.Host, boxWidth, field == WelcomeField.Host, "mud.example.org"))); + lines.Add(Row(field, WelcomeField.Port, "port", Box(model.Port, 7, field == WelcomeField.Port, null))); + lines.Add(Row(field, WelcomeField.Tls, "TLS", Toggle(model.Tls, "on, encrypted", "off"))); + lines.Add(Row(field, WelcomeField.Character, "character", Box(model.Character, boxWidth, field == WelcomeField.Character, "optional, the name you log in as"))); + lines.Add(Row(field, WelcomeField.Password, "password", Toggle(model.PasswordLater, "save it on F5 after connecting", "type it at the login prompt"))); lines.Add(string.Empty); - lines.Add(Problem is null - ? Label(Layout == WelcomeLayout.Suggested - ? "Layout: suggested from what the game sends." - : $"Layout: {Layout}.") - : $"[{ScreenPalette.Caution}]{Escape(Problem)}[/]"); + lines.Add(model.Problem is null + ? Label(model.FormLayoutLine) + : $"[{ScreenPalette.Caution}]{Escape(model.Problem)}[/]"); lines.Add(string.Empty); lines.Add(Footer(width, "↑↓ field · Space toggle", "Esc back · ⏎ connect")); return lines; } - private string Row(WelcomeField field, string label, string value) + private static string Row(WelcomeField current, WelcomeField field, string label, string value) { - var selected = Field == field; + var selected = current == field; var marker = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; return $"{marker} {Pad(selected ? Value(label, bold: true) : Label(label), 11)} {value}"; } diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs new file mode 100644 index 00000000..4381048d --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs @@ -0,0 +1,232 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Input; +using Avalonia.Interactivity; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Tui; +using SkiaSharp; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's native modals (), driven from the real client in the window host: each opens +/// as an overlay over everything with its first control focused and no cell modal under it; the quit prompt stays the +/// last child of the root whatever is added after it, F1 included; keys mean what they mean in cells; Esc gives the +/// keyboard back; and the card follows the client's dark or light theme. +/// +[NotInParallel] +public class NativeModalTests +{ + private sealed record Rig(Window Window, Panel Root, TerminalView View, SharpMUTermApp App, AvaloniaConsoleDriver Driver); + + private static readonly ConsoleKeyInfo CtrlQ = new('\x11', ConsoleKey.Q, false, false, true); + private static readonly ConsoleKeyInfo CtrlF = new('\x06', ConsoleKey.F, false, false, true); + + private static Task Run(Func body, string theme = "Dark") => + TerminalViewTests.Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(120, 34); + var view = new TerminalView(driver, SKColors.White, new SKColor(0x1e, 0x1e, 0x24), 14, null); + var root = new Panel(); + root.Children.Add(view); + var layer = new DesktopLayer(view, HostChrome.HeaderAndRail); + root.Children.Add(layer); + driver.Composer.Attach(root, layer, view, () => view.Focus()); + driver.Palette.Attach(root, () => view.Focus()); + var window = new Window { Content = root, Width = 1000, Height = 700 }; + driver.Modals.Attach(window, root, () => view.Focus(), driver.RaiseKey); + window.Show(); + view.Focus(); + var config = DemoScene.Build(); + config.ThemeName = theme; + config.Theme = ThemeLibrary.Get(theme); + var app = new SharpMUTermApp(config, WindowHost.Create(driver, clipboard: null) with + { + Audio = null, + Presence = null, + Announcer = null, + NativeSettings = null, + RunsInline = true, + }); + driver.KeyPressed += (_, key) => app.SimulateKey(key); + try + { + DesktopLayerTests.Drain(); + return body(new Rig(window, root, view, app, driver)); + } + finally + { + app.DisposeAsync().AsTask().GetAwaiter().GetResult(); + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + private static void Press(Control target, Key key, KeyModifiers modifiers = KeyModifiers.None) + { + target.RaiseEvent(new KeyEventArgs { RoutedEvent = InputElement.KeyDownEvent, Key = key, KeyModifiers = modifiers, Source = target }); + DesktopLayerTests.Drain(); + } + + private static void Key(Rig rig, ConsoleKeyInfo key) + { + rig.App.SimulateKey(key); + DesktopLayerTests.Drain(); + } + + [Test] + public async Task CtrlFOpensTheNativeSearchOverEverythingWithTheBoxFocused() + { + var (focused, cellOpen, onTop, colours) = await Run(rig => + { + Key(rig, CtrlF); + var overlay = rig.Driver.Modals.Modal!; + var view = (SearchView)overlay.View; + return (view.Box.IsFocused, rig.App.DrawnModel(Client.Surfaces.SurfaceCatalog.Search) is not null, + ReferenceEquals(rig.Root.Children[^1], overlay), overlay.Colours); + }); + + await Assert.That(focused).IsTrue(); + await Assert.That(cellOpen).IsFalse().Because("no cell search under the native one"); + await Assert.That(onTop).IsTrue().Because("nothing native draws over it"); + await Assert.That(colours).IsEqualTo(ModalColours.Dark).Because("the demo's theme is Dark"); + } + + [Test] + public async Task TheCardFollowsALightTheme() + { + var colours = await Run(rig => + { + Key(rig, CtrlQ); + return rig.Driver.Modals.Quit!.Colours; + }, theme: "Light"); + + await Assert.That(colours).IsEqualTo(ModalColours.Light); + } + + [Test] + public async Task TypingSearchesThroughTheClientAndEnterLandsAndGivesTheKeyboardBack() + { + var (rows, expected, bar, closed, viewFocused) = await Run(rig => + { + rig.App.RenderSnapshot(null); + rig.View.Focus(); + Key(rig, CtrlF); + var view = (SearchView)rig.Driver.Modals.Modal!.View; + view.Box.Text = "the"; + DesktopLayerTests.Drain(); + var drawn = view.Model.Rows.ToArray(); + var model = rig.App.SearchModelFor("the", false, false).Rows.ToArray(); + Press(view.Box, global::Avalonia.Input.Key.Enter); + return (drawn, model, rig.App.SearchBarIndex(rig.App.ActiveWindowId()), rig.Driver.Modals.Modal is null, rig.View.IsFocused); + }); + + await Assert.That(rows).IsNotEmpty(); + await Assert.That(rows).IsEquivalentTo(expected, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(bar).IsNotNull().Because("⏎ went to the hit through the client's path"); + await Assert.That(closed).IsTrue(); + await Assert.That(viewFocused).IsTrue().Because("the keyboard goes back to the cells, and so to the command line"); + } + + [Test] + public async Task AltEAndAltATogglesAreTheCellSurfacesKeys() + { + var (regex, all) = await Run(rig => + { + Key(rig, CtrlF); + var view = (SearchView)rig.Driver.Modals.Modal!.View; + Press(view.Box, global::Avalonia.Input.Key.E, KeyModifiers.Alt); + Press(view.Box, global::Avalonia.Input.Key.A, KeyModifiers.Alt); + return (view.Model.Regex, view.Model.AllWindows); + }); + + await Assert.That(regex).IsTrue(); + await Assert.That(all).IsTrue(); + } + + [Test] + public async Task EscClosesAndGivesTheKeyboardBack() + { + var (open, focused) = await Run(rig => + { + Key(rig, CtrlF); + Press(((SearchView)rig.Driver.Modals.Modal!.View).Box, global::Avalonia.Input.Key.Escape); + return (rig.App.SearchIsOpen, rig.View.IsFocused); + }); + + await Assert.That(open).IsFalse(); + await Assert.That(focused).IsTrue(); + } + + [Test] + public async Task TheQuitPromptStaysInFrontOfAnythingAddedAfterIt() + { + var (afterSearch, afterAdd, searchUnder) = await Run(rig => + { + Key(rig, CtrlF); + Key(rig, CtrlQ); + var quit = rig.Driver.Modals.Quit!; + var first = ReferenceEquals(rig.Root.Children[^1], quit); + + // Something native added later (a toast, ⌃P, F1) goes under the prompt. + rig.Root.Children.Add(new Border()); + DesktopLayerTests.Drain(); + var second = ReferenceEquals(rig.Root.Children[^1], quit); + var under = rig.Root.Children.IndexOf(rig.Driver.Modals.Modal!) < rig.Root.Children.IndexOf(quit); + return (first, second, under); + }); + + await Assert.That(afterSearch).IsTrue(); + await Assert.That(afterAdd).IsTrue().Because("the prompt is moved back to the end"); + await Assert.That(searchUnder).IsTrue(); + } + + /// + /// The known bug: the window's close button (⌃Q) while F1 is open left the cell prompt under the composer. Now the + /// prompt is native and in front, F1 stays open under it, and Stay (N) goes back to the post. + /// + [Test] + public async Task CtrlQOverTheNativeComposerPutsThePromptInFrontAndStayReturnsToThePost() + { + var (composerOpen, quitOnTop, quitFocused, afterStay, cellPrompt) = await Run(rig => + { + Key(rig, new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + var composer = rig.Driver.Composer.Overlay; + Key(rig, CtrlQ); + var quit = rig.Driver.Modals.Quit!; + var onTop = ReferenceEquals(rig.Root.Children[^1], quit); + var view = (QuitView)quit.View; + var focused = view.StayButton.IsFocused; + var cell = rig.App.DrawnModel(Client.Surfaces.SurfaceCatalog.Quit) is not null; + Press(view.StayButton, global::Avalonia.Input.Key.N); + return (composer is not null && rig.Root.Children.Contains(composer), onTop, focused, rig.App.NativeComposerIsOpen, cell); + }); + + await Assert.That(composerOpen).IsTrue(); + await Assert.That(quitOnTop).IsTrue(); + await Assert.That(quitFocused).IsTrue().Because("Stay is chosen and has the keyboard"); + await Assert.That(afterStay).IsTrue().Because("Stay goes back to F1"); + await Assert.That(cellPrompt).IsFalse().Because("no cell prompt is drawn under the native composer"); + } + + [Test] + public async Task YInTheNativePromptQuitsAndTabMovesTheChoice() + { + var (afterTab, exited) = await Run(rig => + { + Key(rig, CtrlQ); + var view = (QuitView)rig.Driver.Modals.Quit!.View; + Press(view.StayButton, global::Avalonia.Input.Key.Tab); + var selected = view.Selected; + Press(view.QuitButton, global::Avalonia.Input.Key.Y); + return (selected, rig.App.ExitRequested); + }); + + await Assert.That(afterTab).IsEqualTo(QuitChoice.Quit); + await Assert.That(exited).IsTrue(); + } +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 8803726e..bde59a53 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -4,6 +4,7 @@ using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Commands; using SharpMUTerm.Client.Composer; +using SharpMUTerm.Client.Modals; using SharpMUTerm.Client.Palette; using SharpMUTerm.Client.Panels; using SharpMUTerm.Client.Settings; @@ -241,6 +242,54 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! covered.Add(PanelIds.Composer); } + // The modals: the session the window was handed carries the model the cell modal drew for the same scene — the + // quit prompt's facts (connections and a draft), ⌃F's hits in each of its toggles, ⌃R's list, ⌥M's rows and the + // welcome's menu and filled-in form. + foreach (var (surface, view) in new[] + { + (SurfaceCatalog.Quit, "quit"), + (SurfaceCatalog.Search, "search"), + (SurfaceCatalog.Search, "search-regex"), + (SurfaceCatalog.Search, "search-all"), + (SurfaceCatalog.History, "history-search"), + (SurfaceCatalog.Layouts, "layouts"), + (SurfaceCatalog.Welcome, "welcome"), + (SurfaceCatalog.Welcome, "welcome-connect"), + }) + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + var modals = new FakeModals(); + await using var native = App(nativeDriver, DemoScene.Build(), modals: modals); + native.RenderSnapshot(view); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var cells = App(cellDriver, DemoScene.Build()); + cells.RenderSnapshot(view); + + var session = modals.Open(surface); + await Assert.That(session).IsNotNull().Because($"{view}: opened in the window's controls"); + var drawn = cells.DrawnModel(surface); + await Assert.That(drawn).IsNotNull().Because($"{view}: the cell modal is open in the cell client"); + await Assert.That(drawn).IsEqualTo(ModelOf(session!)).Because(view); + covered.Add(surface); + } + + // ⌃R filtered: the native list's rows for a query are the cell list's rows for it. + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + var modals = new FakeModals(); + await using var native = App(nativeDriver, DemoScene.Build(), modals: modals); + native.RenderSnapshot("history-search"); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var cells = App(cellDriver, DemoScene.Build()); + cells.RenderSnapshot("history-search-filter"); + + var rows = ((HistorySession)modals.Open(SurfaceCatalog.History)!).Model.View("north").Select(m => m.Text).ToArray(); + await Assert.That(rows).IsNotEmpty(); + await Assert.That(rows).IsEquivalentTo(cells.HistorySearchRows, TUnit.Assertions.Enums.CollectionOrdering.Matching); + } + var drawnNatively = SurfaceCatalog.All.Where(s => s.On(SurfaceHosts.Window).HasFlag(SurfaceDrawing.Native)).Select(s => s.Id); await Assert.That(covered).IsEquivalentTo(drawnNatively).Because("every surface the window draws natively has its model compared here"); } @@ -416,6 +465,150 @@ await Same("notice: action", "layout-combat", probed.Add(PanelIds.Composer); } + // The quit prompt: Y quits and N stays, from the window's buttons and from the cell prompt's keys. + await SameModal("quit: yes", "quit", + (app, m) => ((QuitSession)m.Open(SurfaceCatalog.Quit)!).Answer(true), + app => app.SimulateQuitKey(new ConsoleKeyInfo('y', ConsoleKey.Y, false, false, false))); + await SameModal("quit: no", "quit", + (app, m) => ((QuitSession)m.Open(SurfaceCatalog.Quit)!).Answer(false), + app => app.SimulateQuitKey(new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false))); + probed.Add(SurfaceCatalog.Quit); + + // ⌃F: ⏎ on the second hit lands on the same line; ⌥A widens and ⌥E reads a pattern, then ⏎ on the last hit. + await SameModal("search: go", "search", + (app, m) => ((SearchSession)m.Open(SurfaceCatalog.Search)!).Go(1), + app => + { + app.SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + app.SimulateSearchKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + await SameModal("search: every window", "search", + (app, m) => + { + var search = (SearchSession)m.Open(SurfaceCatalog.Search)!; + search.Search(search.Model.Query, regex: false, allWindows: true); + search.Go(search.Model.Rows.Count - 1); + }, + app => + { + app.SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.A, false, true, false)); + app.SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.UpArrow, false, false, false)); + app.SimulateSearchKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + await SameModal("search: regex", "search", + (app, m) => + { + var search = (SearchSession)m.Open(SurfaceCatalog.Search)!; + search.Search("gob+lin c", regex: true, allWindows: false); + search.Go(0); + }, + app => + { + app.SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.E, false, true, false)); + foreach (var _ in "goblin") + { + app.SimulateSearchKey(new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false)); + } + + app.SimulateSearchTyping("gob+lin c"); + app.SimulateSearchKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + probed.Add(SurfaceCatalog.Search); + + // ⌃R: ⏎ on the first row for "north" places the same text on the command line, and sends nothing. + await SameModal("history: insert", "history-search", + (app, m) => + { + var history = (HistorySession)m.Open(SurfaceCatalog.History)!; + history.Insert(history.Model.View("north")[0].Index); + }, + app => + { + app.SimulateHistorySearchTyping("north"); + app.SimulateHistorySearchKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + probed.Add(SurfaceCatalog.History); + + // ⌥M: apply Roleplay, save as new, rename the copy and delete it — each through the one verb method, so the + // status, the library and the panes agree. + await SameModal("layouts: apply", "layouts", + (app, m) => + { + var layouts = (LayoutsSession)m.Open(SurfaceCatalog.Layouts)!; + layouts.Run(LayoutVerb.Apply, BuiltInLayouts.RoleplayId); + }, + app => LayoutsKeysTo(app, BuiltInLayouts.RoleplayId, new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); + await SameModal("layouts: save as new", "layouts", + (app, m) => + { + var layouts = (LayoutsSession)m.Open(SurfaceCatalog.Layouts)!; + layouts.Run(LayoutVerb.SaveAsNew, BuiltInLayouts.CombatId); + }, + app => LayoutsKeysTo(app, BuiltInLayouts.CombatId, new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false))); + await SameModal("layouts: rename", "layouts", + (app, m) => + { + var layouts = (LayoutsSession)m.Open(SurfaceCatalog.Layouts)!; + layouts.Run(LayoutVerb.SaveAsNew, BuiltInLayouts.CombatId); + layouts.Run(LayoutVerb.Rename, layouts.Model.Current!.Id, "Raid night"); + }, + app => + { + LayoutsKeysTo(app, BuiltInLayouts.CombatId, new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false)); + app.SimulateLayoutsKey(new ConsoleKeyInfo('r', ConsoleKey.R, false, false, false)); + for (var i = 0; i < 40; i++) + { + app.SimulateLayoutsKey(new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false)); + } + + foreach (var c in "Raid night") + { + app.SimulateLayoutsKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateLayoutsKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + await SameModal("layouts: delete", "layouts", + (app, m) => + { + var layouts = (LayoutsSession)m.Open(SurfaceCatalog.Layouts)!; + layouts.Run(LayoutVerb.SaveAsNew, BuiltInLayouts.CombatId); + layouts.Run(LayoutVerb.Delete, layouts.Model.Current!.Id); + }, + app => + { + LayoutsKeysTo(app, BuiltInLayouts.CombatId, new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false)); + app.SimulateLayoutsKey(new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false)); + app.SimulateLayoutsKey(new ConsoleKeyInfo('y', ConsoleKey.Y, false, false, false)); + }); + probed.Add(SurfaceCatalog.Layouts); + + // The welcome: the form filled in, then Connect in the window and ⏎ in the cells — through /connect's path, to + // the same world and character, connected. + await SameModal("welcome: connect", "welcome-connect", + (app, m) => + { + var welcome = (WelcomeSession)m.Open(SurfaceCatalog.Welcome)!; + var form = welcome.Model; + welcome.Connect(new WelcomeForm(form.Host, form.Port, form.Tls, form.Character, form.PasswordLater)); + }, + app => app.SimulateWelcomeKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); + await SameModal("welcome: layout and browse", "welcome", + (app, m) => + { + var welcome = (WelcomeSession)m.Open(SurfaceCatalog.Welcome)!; + welcome.SetLayout(WelcomeLayout.Combat); + welcome.Choose(WelcomeChoice.Settings); + }, + app => + { + app.SimulateWelcomeKey(new ConsoleKeyInfo('\0', ConsoleKey.LeftArrow, false, false, false)); + app.SimulateWelcomeKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + app.SimulateWelcomeKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + app.SimulateWelcomeKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + probed.Add(SurfaceCatalog.Welcome); + var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); await Assert.That(probed).IsEquivalentTo(acting).Because("every native surface with actions has a probe here"); } @@ -565,9 +758,67 @@ private static async Task Same( await Assert.That(Outcome(a)).IsEqualTo(Outcome(b)).Because(probe); } + /// + /// A modal probe: two clients on the same view, one handed native modals and one drawing them in cells; the + /// native gesture on one, the cell keys on the other, and the client's state after each the same. + /// + private static async Task SameModal( + string probe, string view, Action native, Action cells) + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + var modals = new FakeModals(); + await using var a = App(nativeDriver, DemoScene.Build(), modals: modals); + a.TelnetFactory = _ => new SharpMUTerm.Tui.Tests.RecordingTelnetSession(); + a.RenderSnapshot(view); + var before = Outcome(a); + native(a, modals); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var b = App(cellDriver, DemoScene.Build()); + b.TelnetFactory = _ => new SharpMUTerm.Tui.Tests.RecordingTelnetSession(); + b.RenderSnapshot(view); + cells(b); + + await Assert.That(Outcome(a)).IsNotEqualTo(before).Because($"{probe}: the native action did something"); + await Assert.That(Outcome(a)).IsEqualTo(Outcome(b)).Because(probe); + } + + /// Moves the cell ⌥M list's pointer to with ↑↓, then presses . + private static void LayoutsKeysTo(SharpMUTermApp app, string layoutId, ConsoleKeyInfo key) + { + var model = app.LayoutsModelFor(DemoScene.ActiveSessionKey); + var target = model.Rows.ToList().FindIndex(r => r.Id == layoutId); + var step = target > model.Selected + ? new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false) + : new ConsoleKeyInfo('\0', ConsoleKey.UpArrow, false, false, false); + for (var i = 0; i < Math.Abs(target - model.Selected); i++) + { + app.SimulateLayoutsKey(step); + } + + app.SimulateLayoutsKey(key); + } + + private static object ModelOf(ModalSession session) => session switch + { + QuitSession quit => quit.Model, + SearchSession search => search.Model, + HistorySession history => history.Model, + LayoutsSession layouts => layouts.Model, + WelcomeSession welcome => welcome.Model, + _ => throw new ArgumentException(session.GetType().Name), + }; + /// Everything a surface's action can change, read off the client. private static string Outcome(SharpMUTermApp app) => string.Join( " | ", + "quit=" + app.QuitPromptOpen, + "exit=" + app.ExitRequested, + "search=" + app.SearchIsOpen + "@" + app.SearchBarIndex(app.ActiveWindowId()), + "history=" + app.HistorySearchOpen, + "layouts=" + app.LayoutsOpen + " " + Layouts(app), + "worlds=" + string.Join(",", app.Configuration.Worlds.Select(w => $"{w.Name}:{w.Host}:{w.Port}:{w.UseTls}:{w.Layout}:{string.Join("+", w.Characters.Select(c => c.Name))}")), + "sessions=" + string.Join(",", app.Configuration.Worlds.SelectMany(w => w.Characters.Select(c => $"{w.Name}.{c.Name}")).Select(k => k + ":" + app.FindSession(k)?.State)), "input=" + app.PrimaryInputText, "window=" + app.ActiveWindowId(), "panes=" + app.PaneIds.Count, @@ -581,6 +832,12 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "notice=" + app.LastNotice, "recent=" + string.Join(",", app.RecentCommandIds)); + private static string Layouts(SharpMUTermApp app) + { + var model = app.LayoutsModelFor(DemoScene.ActiveSessionKey); + return $"{model.Status} [{string.Join(",", model.Rows.Select(r => r.Name + (r.InUse ? "*" : string.Empty) + (r.WorldDefault ? "^" : string.Empty)))}]"; + } + private static PanelOverlay Panel(AvaloniaConsoleDriver driver, string id) => driver.Pointer.Panels.First(p => p.PanelId == id); @@ -654,7 +911,8 @@ private static SharpMUTermApp App( INativePalette? palette = null, Action? save = null, HostKeys? keys = null, - INativeComposer? composer = null) => + INativeComposer? composer = null, + INativeModals? modals = null) => new(config, WindowHost.Create(driver, clipboard: null) with { Capabilities = WindowOptions.Capabilities, @@ -666,6 +924,7 @@ private static SharpMUTermApp App( NativePalette = palette, Keys = keys ?? WindowHost.Keys, NativeComposer = composer, + NativeModals = modals, }, save: save); /// A window editor that only records the session it was handed, so the client's side can be driven. @@ -689,6 +948,24 @@ private sealed class FakeSettings : INativeSettings public void Close() => Form = null; } + /// Native modals that only record the sessions they were handed, so the client's side can be driven. + private sealed class FakeModals : INativeModals + { + public List Shown { get; } = []; + + public List Closed { get; } = []; + + public bool Available => true; + + /// The session of shown last and not closed since, or null. + public ModalSession? Open(string surface) => + Shown.LastOrDefault(s => s.Surface == surface && !Closed.Contains(s) && !s.IsEnded); + + public void Show(ModalSession session) => Shown.Add(session); + + public void Close(ModalSession session) => Closed.Add(session); + } + private sealed class FakePalette : INativePalette { public PaletteSession? Session { get; private set; } diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs index 98f9c273..c85c9a0f 100644 --- a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -72,7 +72,8 @@ public async Task PanelSurfacesAreKnownPanels() { var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette - or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose)); + or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose) + && !SurfaceCatalog.Modals.Contains(s.Id)); foreach (var surface in panels) { await Assert.That(PanelIds.Known).Contains(surface.Id); diff --git a/tests/SharpMUTerm.Tui.Tests/HistorySearchEndToEndTests.cs b/tests/SharpMUTerm.Tui.Tests/HistorySearchEndToEndTests.cs index 704f680b..fb511653 100644 --- a/tests/SharpMUTerm.Tui.Tests/HistorySearchEndToEndTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/HistorySearchEndToEndTests.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using System.Collections.Concurrent; using SharpConsoleUI.Drivers; using SharpMUTerm.Core.Configuration; diff --git a/tests/SharpMUTerm.Tui.Tests/NativeModalRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeModalRoutingTests.cs new file mode 100644 index 00000000..8cce79c2 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NativeModalRoutingTests.cs @@ -0,0 +1,222 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The quit prompt, ⌃F, ⌃R and ⌥M in a host that draws them itself (): each +/// funnel asks the host first, the cell modal is not opened under it, and a host whose modals are not attached gets +/// the cells. The quit prompt is never refused and always ends up in front: over a native modal or the native F1 it +/// opens beside them and N leaves them as they were; with no native modals the host's F1 is closed first, keeping its +/// draft, so the cell prompt is not drawn under it. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class NativeModalRoutingTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static ConsoleKeyInfo Key(ConsoleKey key, ConsoleModifiers modifiers = 0, char c = '\0') => + new(c, key, modifiers.HasFlag(ConsoleModifiers.Shift), + modifiers.HasFlag(ConsoleModifiers.Alt), modifiers.HasFlag(ConsoleModifiers.Control)); + + private static readonly ConsoleKeyInfo CtrlQ = new('\x11', ConsoleKey.Q, false, false, true); + + private sealed class FakeModals(bool available = true) : INativeModals + { + public bool Available { get; } = available; + + public List Shown { get; } = []; + + public List Closed { get; } = []; + + public void Show(ModalSession session) => Shown.Add(session); + + public void Close(ModalSession session) => Closed.Add(session); + } + + private sealed class FakeComposer : INativeComposer + { + public bool Available => true; + + public List Opened { get; } = []; + + public int Closed { get; private set; } + + public void Open(ComposerSession session, PanelInk ink) => Opened.Add(session); + + public void Close() => Closed++; + } + + private static async Task<(SharpMUTermApp App, FakeModals? Modals, FakeComposer? Composer)> Connected( + FakeModals? modals, FakeComposer? composer = null) + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }); + config.Worlds.Add(world); + var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, null) with + { + NativeModals = modals, + NativeComposer = composer, + }; + var app = new SharpMUTermApp(config, host); + app.TelnetFactory = _ => new RecordingTelnetSession(); + await app.BindWorldWithoutConnecting(world).ConnectAsync(); + app.RenderNextFrame(); + return (app, modals, composer); + } + + [Test] + public async Task EachModalOpensInTheHostsControlsAndNotInCells() + { + var (app, modals, _) = await Connected(new FakeModals()); + await using var _ = app; + + foreach (var (chord, surface) in new[] + { + (Key(ConsoleKey.F, ConsoleModifiers.Control, '\x06'), SurfaceCatalog.Search), + (Key(ConsoleKey.R, ConsoleModifiers.Control, '\x12'), SurfaceCatalog.History), + (Key(ConsoleKey.M, ConsoleModifiers.Alt, 'm'), SurfaceCatalog.Layouts), + }) + { + app.SimulateKey(chord); + await Assert.That(modals!.Shown[^1].Surface).IsEqualTo(surface); + await Assert.That(app.DrawnModel(surface)).IsNull().Because($"{surface}: no cell modal under the native one"); + + // The chord again closes it, as it closes the cell modal. + app.SimulateKey(chord); + await Assert.That(modals.Closed).Contains(modals.Shown[^1]).Because($"{surface}: the chord closes it"); + await Assert.That(modals.Shown[^1].IsEnded).IsTrue(); + } + + await Assert.That(app.SearchIsOpen || app.HistorySearchOpen || app.LayoutsOpen).IsFalse(); + } + + [Test] + public async Task AHostWhoseModalsAreNotAttachedGetsTheCells() + { + var (app, modals, _) = await Connected(new FakeModals(available: false)); + await using var _ = app; + + app.SimulateKey(Key(ConsoleKey.F, ConsoleModifiers.Control, '\x06')); + await Assert.That(modals!.Shown).IsEmpty(); + await Assert.That(app.DrawnModel(SurfaceCatalog.Search)).IsNotNull().Because("the cell search is open"); + } + + [Test] + public async Task EscInTheHostClosesTheModalAndRunsNothing() + { + var (app, modals, _) = await Connected(new FakeModals()); + await using var _ = app; + + app.SimulateKey(Key(ConsoleKey.F, ConsoleModifiers.Control, '\x06')); + var search = (SearchSession)modals!.Shown.Single(); + search.Dismiss(); + + await Assert.That(app.SearchIsOpen).IsFalse(); + search.Go(0); + await Assert.That(app.SearchBarIndex(app.ActiveWindowId())).IsNull().Because("a late gesture on a closed session does nothing"); + } + + [Test] + public async Task TheQuitPromptOpensOverANativeModalAndStayLeavesItOpen() + { + var (app, modals, _) = await Connected(new FakeModals()); + await using var _ = app; + + app.SimulateKey(Key(ConsoleKey.F, ConsoleModifiers.Control, '\x06')); + var search = modals!.Shown.Single(); + + app.SimulateKey(CtrlQ); + var quit = modals.Shown.OfType().Single(); + await Assert.That(quit.AlwaysInFront).IsTrue(); + await Assert.That(quit.Model.ConnectedCharacters).IsEquivalentTo(new[] { "Quiet.Ann" }); + await Assert.That(search.IsEnded).IsFalse().Because("the search stays under the prompt"); + + quit.Answer(false); + await Assert.That(app.QuitPromptOpen).IsFalse(); + await Assert.That(app.SearchIsOpen).IsTrue().Because("Stay goes back to the search"); + await Assert.That(app.ExitRequested).IsFalse(); + } + + [Test] + public async Task CtrlQAgainClosesTheNativePrompt() + { + var (app, modals, _) = await Connected(new FakeModals()); + await using var _ = app; + + app.SimulateKey(CtrlQ); + var quit = modals!.Shown.OfType().Single(); + app.SimulateKey(CtrlQ); + + await Assert.That(modals.Closed).Contains(quit); + await Assert.That(app.QuitPromptOpen).IsFalse(); + await Assert.That(app.ExitRequested).IsFalse(); + } + + [Test] + public async Task YesInTheNativePromptQuits() + { + var (app, modals, _) = await Connected(new FakeModals()); + await using var _ = app; + + app.SimulateKey(CtrlQ); + modals!.Shown.OfType().Single().Answer(true); + + await Assert.That(app.ExitRequested).IsTrue(); + } + + /// + /// Closing the window while the native F1 is open: the window sends ⌃Q. With native modals the prompt opens in front + /// of F1, which stays open under it, and Stay goes back to the post. + /// + [Test] + public async Task TheQuitPromptOpensInFrontOfTheNativeComposerWhichStaysOpen() + { + var (app, modals, composer) = await Connected(new FakeModals(), new FakeComposer()); + await using var _ = app; + + app.SimulateKey(Key(ConsoleKey.F1)); + composer!.Opened.Single().Edited("half a post"); + app.SimulateKey(CtrlQ); + + var quit = modals!.Shown.OfType().Single(); + await Assert.That(app.NativeComposerIsOpen).IsTrue().Because("F1 is not closed to make room for the prompt"); + await Assert.That(composer.Closed).IsEqualTo(0); + + quit.Answer(false); + await Assert.That(app.NativeComposerIsOpen).IsTrue(); + await Assert.That(app.NativeComposerSession!.Model.Body).IsEqualTo("half a post"); + } + + /// + /// The known bug: with a host that draws F1 but not the modals, the cell prompt is a framework window in the cells, + /// and F1 drawn over the cells would hide it. F1 is closed first, keeping its draft, and the prompt counts it. + /// + [Test] + public async Task WithNoNativeModalsTheNativeComposerClosesSoTheCellPromptIsInFront() + { + var (app, _, composer) = await Connected(modals: null, new FakeComposer()); + await using var _ = app; + + app.SimulateKey(Key(ConsoleKey.F1)); + composer!.Opened.Single().Edited("half a post"); + app.SimulateKey(CtrlQ); + + await Assert.That(app.NativeComposerIsOpen).IsFalse().Because("nothing native is left over the cell prompt"); + await Assert.That(composer.Closed).IsGreaterThanOrEqualTo(1); + await Assert.That(app.QuitPromptOpen).IsTrue(); + await Assert.That(string.Join("\n", app.QuitPromptLines)).Contains("draft"); + + app.SimulateQuitKey(Key(ConsoleKey.N, 0, 'n')); + app.SimulateKey(Key(ConsoleKey.F1)); + await Assert.That(composer.Opened[^1].Model.Body).IsEqualTo("half a post").Because("the draft was kept"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/QuitPromptTests.cs b/tests/SharpMUTerm.Tui.Tests/QuitPromptTests.cs index b6f25625..51be67fb 100644 --- a/tests/SharpMUTerm.Tui.Tests/QuitPromptTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/QuitPromptTests.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using SharpMUTerm.Tui; namespace SharpMUTerm.Tui.Tests; @@ -23,7 +24,7 @@ private static ConsoleKeyInfo Chord(ConsoleKey key, bool ctrl = false, bool alt /// over two live characters. The unit is the character, matching the header's fraction — see /// SharpMUTermApp.ConnectedCharacters. /// - private static QuitFacts Busy() => new( + private static QuitModel Busy() => new( new[] { "Aetherfall.Corvid", "Aetherfall.Rookery" }, 2, new[] { "main", "Chat" }); @@ -138,9 +139,9 @@ public async Task EverythingElseIsSwallowed(ConsoleKey key, bool ctrl, bool alt) [Test] public async Task WithNothingAtStakeItSaysSo() { - await Assert.That(QuitPrompt.Consequences(QuitFacts.Nothing)).IsEmpty(); + await Assert.That(QuitPrompt.Consequences(QuitModel.Nothing)).IsEmpty(); - var rendered = string.Join("\n", QuitPrompt.Render(QuitFacts.Nothing, QuitChoice.Stay)); + var rendered = string.Join("\n", QuitPrompt.Render(QuitModel.Nothing, QuitChoice.Stay)); await Assert.That(rendered).Contains("Nothing is connected and nothing is unsent."); } @@ -162,7 +163,7 @@ public async Task ItNamesTheConnectionsAndTheDrafts() [Test] public async Task OneOfEachReadsAsOne() { - var facts = new QuitFacts(new[] { "Aetherfall.Corvid" }, 1, new[] { "main" }); + var facts = new QuitModel(new[] { "Aetherfall.Corvid" }, 1, new[] { "main" }); await Assert.That(QuitPrompt.Consequences(facts)).IsEquivalentTo(new[] { @@ -177,7 +178,7 @@ await Assert.That(QuitPrompt.Consequences(facts)).IsEquivalentTo(new[] [Test] public async Task ALongListIsCappedAndCounted() { - var facts = QuitFacts.Nothing with { ConnectedCharacters = new[] { "A", "B", "C", "D", "E" } }; + var facts = QuitModel.Nothing with { ConnectedCharacters = new[] { "A", "B", "C", "D", "E" } }; await Assert.That(QuitPrompt.Consequences(facts)[0]).IsEqualTo("5 characters connected — A, B, C +2 more"); } @@ -192,8 +193,8 @@ public async Task ALongListIsCappedAndCounted() [Test] public async Task AnOpenScreenIsNotAConsequence() { - await Assert.That(QuitPrompt.Consequences(QuitFacts.Nothing)).IsEmpty(); - await Assert.That(typeof(QuitFacts).GetProperty("UnsavedEdits")).IsNull(); + await Assert.That(QuitPrompt.Consequences(QuitModel.Nothing)).IsEmpty(); + await Assert.That(typeof(QuitModel).GetProperty("UnsavedEdits")).IsNull(); } /// @@ -218,7 +219,7 @@ public async Task TheDefaultIsVisiblyStay() [Test] public async Task TheButtonsCarryTheirKeys() { - var rendered = string.Join("\n", QuitPrompt.Render(QuitFacts.Nothing, QuitChoice.Stay)); + var rendered = string.Join("\n", QuitPrompt.Render(QuitModel.Nothing, QuitChoice.Stay)); await Assert.That(rendered).Contains("Quit y"); await Assert.That(rendered).Contains("Stay n"); diff --git a/tests/SharpMUTerm.Tui.Tests/SearchEndToEndTests.cs b/tests/SharpMUTerm.Tui.Tests/SearchEndToEndTests.cs index a975a991..07cab306 100644 --- a/tests/SharpMUTerm.Tui.Tests/SearchEndToEndTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SearchEndToEndTests.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using SharpConsoleUI.Drivers; using SharpMUTerm.Core.Session; using SharpMUTerm.Graphics; diff --git a/tests/SharpMUTerm.Tui.Tests/SearchPromptTests.cs b/tests/SharpMUTerm.Tui.Tests/SearchPromptTests.cs index ca4321a3..f65aae51 100644 --- a/tests/SharpMUTerm.Tui.Tests/SearchPromptTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SearchPromptTests.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using SharpMUTerm.Tui; namespace SharpMUTerm.Tui.Tests; diff --git a/tests/SharpMUTerm.Tui.Tests/SpawnWindowIdUpgradeTests.cs b/tests/SharpMUTerm.Tui.Tests/SpawnWindowIdUpgradeTests.cs index da311b40..7a991887 100644 --- a/tests/SharpMUTerm.Tui.Tests/SpawnWindowIdUpgradeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SpawnWindowIdUpgradeTests.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using SharpConsoleUI.Drivers; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Configuration; diff --git a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs index 38d4b072..e06fe74d 100644 --- a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Modals; using SharpConsoleUI.Drivers; using SharpMUTerm.Core.Accessibility; using SharpMUTerm.Core.Configuration; From c14aa5cfe05f5510c398d39b9bac5bdb1fd89020 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 10:00:25 +0000 Subject: [PATCH 035/113] feat(window): pop native panels out into floating windows The map, vitals, who-here and the quick bar can be popped out of their pane into a window of their own in the desktop host: from a button on the docked native view, the pane's right-click menu, or Ctrl+P (panel:popout:), and docked back from the floating window's Dock button, by closing it, or panel:dock:. - Floating is host-neutral: WorkspaceWindow.Floating (FloatingBounds, screen pixels) is saved with the workspace and PanelPlacement.Floating with a layout (LayoutCapture). The fold never reads it, so the terminal keeps the panel in its region and the flag survives for the next host that can float. - Host fact: ClientHost.FloatingPanels (IFloatingPanels?, required; null in the terminal and headless). Ctrl+P families, the pane menu entry and the docked overlay's PopOut callback exist only where it is set; the surface catalog declares both actions OnlyOn: Window with the Ctrl+P id as the cell route. - The pane a panel leaves goes back through the workspace operations: with the live layout owning the panes it is re-applied without the panel, so pane rectangles and NAWS equal a layout that never placed it. - The floating window draws the panel's own native view from the same overlay and callbacks (OverlayFor), follows the character's plane and theme ink, never takes focus on opening, forwards keys and text to the command line, and docks when closed. Remembered places are clamped to the screens present. - PaneOutputRects no longer throws when called before the main window exists, so resuming a workspace with a panel or map pane no longer fails at startup. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 8 + CLAUDE.md | 41 +- .../AvaloniaConsoleDriver.cs | 3 + src/SharpMUTerm.Avalonia/DesktopLayer.cs | 39 ++ src/SharpMUTerm.Avalonia/FloatingPanels.cs | 569 ++++++++++++++++++ src/SharpMUTerm.Avalonia/MainWindow.cs | 4 + src/SharpMUTerm.Avalonia/MapCanvas.cs | 12 + src/SharpMUTerm.Avalonia/QuickBarButtons.cs | 12 + src/SharpMUTerm.Avalonia/TerminalView.cs | 15 + src/SharpMUTerm.Avalonia/WhoHereList.cs | 12 + src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + .../Commands/BuiltInCommands.cs | 28 + .../Panels/FloatingPanelModel.cs | 48 ++ .../Surfaces/SurfaceCatalog.cs | 56 +- .../Commands/CommandCatalog.cs | 14 +- src/SharpMUTerm.Core/Layouts/LayoutCapture.cs | 42 +- .../Layouts/LayoutDefinition.cs | 11 + src/SharpMUTerm.Core/Layouts/LayoutFold.cs | 6 + .../Workspace/FloatingBounds.cs | 77 +++ .../Workspace/WorkspaceState.cs | 9 + .../Workspace/WorkspaceWindow.cs | 8 + src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 13 + src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 8 +- .../Pointer/SharpMUTermApp.Desktop.cs | 108 ++-- .../Pointer/SharpMUTermApp.Floating.cs | 473 +++++++++++++++ .../Pointer/SharpMUTermApp.Pointer.cs | 15 + src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs | 28 +- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 6 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 36 +- .../FloatingPanelTests.cs | 372 ++++++++++++ .../SurfaceParityTests.cs | 39 ++ .../SurfaceCatalogTests.cs | 36 +- .../Layouts/FloatingPanelLayoutTests.cs | 131 ++++ 33 files changed, 2217 insertions(+), 65 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/FloatingPanels.cs create mode 100644 src/SharpMUTerm.Client/Panels/FloatingPanelModel.cs create mode 100644 src/SharpMUTerm.Core/Workspace/FloatingBounds.cs create mode 100644 src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Floating.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/FloatingPanelTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Layouts/FloatingPanelLayoutTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 95bc530b..c5ccc7fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Desktop window: the map, vitals, who is here and the quick bar can be popped out into windows of their own — from + the button in the panel's corner, the pane's right-click menu, or Ctrl+P ▸ Pop out. The output takes the room back, + the floating window works exactly like the panel did, typing in it still goes to the command line, and closing it + (or Dock) puts the panel back in its place. Where each one floats is remembered with your layout and brought back on + screen if a monitor has gone. The terminal keeps every panel in its pane. + - Desktop window: the quit prompt, search (Ctrl+F), history search (Ctrl+R), the layouts list (Alt+M) and the first-run welcome are native dialogs in the window's light or dark look, worked from the keyboard exactly as in the terminal. The quit prompt always comes up in front of whatever is open — closing the window while writing a post @@ -281,6 +287,8 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- Starting the client with a saved workspace whose panes held a panel (vitals, who is here, the quick bar, the + composer) or the map no longer fails before the first frame. - Desktop window: the Keys screen (F4) and the quick bar now describe the window's keys rather than a terminal's. Ctrl+digit, Ctrl+Shift+letter, Ctrl+Tab and Alt+O are shown as working keys you can bind, and Alt+Enter is marked as taken because it maximises the window. diff --git a/CLAUDE.md b/CLAUDE.md index 6f73d997..4efe95bb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1262,6 +1262,45 @@ fallbacks) for inline images/maps. re-asserted on every layout change, and releasing there disarmed the composer the moment its pane was built. ⌥⏎ arrives as Esc then Enter, so an Enter within 50 ms of the releasing Esc re-arms and inserts a newline (`TryComposerAltEnter`). `DockedComposerTests` covers each of these. +- **The window can pop a native panel out into a window of its own** (map, vitals, who-here, quick bar; + `SharpMUTermApp.Floating.cs`, Avalonia `FloatingPanels.cs`: `FloatingPanelPresenter`, `FloatingPanelWindow`, + `PopOutButton`; Core `FloatingBounds`; Client `PanelFloatCommands`, `FloatingPanelModel`; ⌃P `panel:popout:` + and `panel:dock:`; the `floating-panel` surface). Three ways out — the button in the docked view's top-right + corner, the pane's right-click menu, ⌃P — and three ways back: the floating window's Dock, closing it, ⌃P. Decisions: + - **Floating is a fact about the panel's *window*** (`WorkspaceWindow.Floating`, screen pixels; `Unplaced` = the host + picks), so it is saved with the workspace, and a layout says the same per panel (`PanelPlacement.Floating`, + captured by `LayoutCapture` from `FloatingPanelsOf`). **The fold never reads it**: region, order and size stay the + place it docks back to, and a host that cannot float folds the layout exactly as if it said nothing. + - **The host fact is `ClientHost.FloatingPanels` (`IFloatingPanels?`, required, null in the terminal and headless)**, + not `HostChrome`. `HostChrome` says which chrome a host draws *instead of cells*; floating is a channel the client + publishes to (models out, moves and docks back), the `IPointerPresenter`/`INativeModals` shape, and a null member + is the one "this host cannot" every other optional channel already uses. `CanFloatPanels` reads it; ⌃P's families + list nothing without it (`CommandContext.Floats` null), the pane menu adds no entry, a docked overlay carries no + `PopOut`, and `PopOutPanel` refuses out loud. The catalog's actions say `OnlyOn: Window` with `CellsVia` the ⌃P id. + - **The pane goes through the workspace's own operations, and no cell is spent.** While the live layout owns the + panes, a pop out or a dock re-applies it (`RearrangeLiveLayout` → `ApplyLayout(adoptFloating: false)`) with the + floating window withheld (`DockedWindows`), so the panes are exactly the layout without that panel — the rectangles, + and so NAWS, are equal (`APoppedOutPanelLeavesThePanesALayoutWithoutItWouldHave`). Otherwise `RemoveWindow`/`AddWindow` + (back into the pane it left). An explicit apply takes the layout's floating state (`AdoptFloating`); a re-fold keeps + what is floating now. `OpenPanel`/`ShowMap` dock a floating panel: asking for it in a pane means the pane. + - **A floating panel is published like a docked one, from the same function** (`OverlayFor(…, docked: false)`): the + same model and the same callbacks, so a walk, a look or a quick key from the floating window runs the same method + on the panel's own character. Its control is made if it never had a pane (`EnsureFloatingControl`), and a redraw of + it republishes (`PanelView.Refreshed`, `RenderMap` → `NoteFloatingContent`), since no frame paints for it. + - **Resumed by either host**: `SettleRestoredFloating` takes a floating window out of its pane where the host floats, + and puts one back in a pane where it cannot, keeping the flag for the next host that can. A floating window has no + rail row (it would read `closed`). + - **The window**: owned by the main window, `ShowActivated = false`, not in the taskbar; first placed beside the main + window (left when the right has no room), later where the player left it, **clamped to the screens there are now** + (`FloatingBounds.ClampTo`: unchanged when wholly on a screen, else the screen holding most of it or the nearest, shrunk + to fit). Moves are reported after 300 ms of quiet. Every key and every typed character goes to `TerminalView`'s + handlers, so typing lands on the command line. Its plane is the character's pane tint on the theme, its ink the + theme's text. Closing it docks; the client closing it (a dock, the main window going) docks nothing. + - **Fixed on the way**: `PaneOutputRects` called before the main window existed threw, so a resumed workspace holding + any panel or map pane threw in the constructor; it now answers "nothing arranged yet". + - **Not done**: one floating window per panel window, not per panel kind across characters; no snapping or + always-on-top choice; the composer does not float; positions on a mixed-DPI desktop are assumed to be in the main + window's scaling. ## One client, several hosts — and how they are kept the same @@ -1270,7 +1309,7 @@ one `SharpMUTermApp`; a host is only the place it runs. What differs between hos (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it -draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M and the welcome itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M and the welcome itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), whether it can pop a panel out into a window of its own (`IFloatingPanels`, null for none), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index 4587defa..0fd07b1f 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -85,6 +85,9 @@ public AvaloniaConsoleDriver(int columns, int rows) /// public ModalPresenter Modals { get; } = new(); + /// The panels popped out into windows of their own (). + public FloatingPanelPresenter Floating { get; } = new(); + /// The window's title for what is in front, which the main window shows (). public WindowTitleBar TitleBar { get; } = new(); diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index e384b6ed..7d076aaa 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -42,6 +42,7 @@ internal sealed class DesktopLayer : Canvas private readonly Dictionary _buttons = new(StringComparer.Ordinal); private readonly Dictionary _gauges = new(StringComparer.Ordinal); private readonly Dictionary _maps = new(StringComparer.Ordinal); + private readonly Dictionary _popOuts = new(StringComparer.Ordinal); private readonly NativeHeader _header; private readonly NativeSidebar _sidebar; private readonly Dictionary _whoHere = new(StringComparer.Ordinal); @@ -123,6 +124,9 @@ protected override void OnSizeChanged(SizeChangedEventArgs e) /// The native maps by window id. Internal for tests. internal IReadOnlyDictionary Maps => _maps; + /// The pop-out buttons, by the panel window each pops out. Internal for tests. + internal IReadOnlyDictionary PopOuts => _popOuts; + /// The native header. Internal for tests. internal NativeHeader Header => _header; @@ -330,6 +334,41 @@ private void SyncPanels(ScreenFrame frame, Size cell) frame, cell, (composer, panel, plane) => composer.Show(panel.Composer!, panel.ComposerSession!, panel.Ink, plane, text)); + SyncPopOuts(frame, cell); + } + + /// + /// A pop-out button in the top right corner of every docked panel the client says can float, above the panel's + /// own view and below the toasts. A panel that cannot float (or a host that cannot) publishes no callback, and + /// gets no button. + /// + private void SyncPopOuts(ScreenFrame frame, Size cell) + { + var wanted = _pointer.Panels.Where(p => p.PopOut is not null && p.Rect.Width > 0 && p.Rect.Height > 0).ToList(); + foreach (var stale in _popOuts.Keys.Where(id => wanted.All(p => p.WindowId != id)).ToList()) + { + Children.Remove(_popOuts[stale]); + _popOuts.Remove(stale); + } + + var origin = CellOrigin; + foreach (var panel in wanted) + { + if (!_popOuts.TryGetValue(panel.WindowId, out var button)) + { + button = new PopOutButton(); + _popOuts[panel.WindowId] = button; + Children.Insert(Math.Max(0, Children.IndexOf(_toasts)), button); + } + + var size = Math.Clamp(cell.Height - 2, 12, 18); + var rect = panel.Rect; + button.Width = size; + button.Height = size; + SetLeft(button, origin.X + ((rect.X + rect.Width) * cell.Width) - size - 3); + SetTop(button, origin.Y + (rect.Y * cell.Height) + 2); + button.Show(panel, Colour(_view.Renderer.DefaultForeground)); + } } /// diff --git a/src/SharpMUTerm.Avalonia/FloatingPanels.cs b/src/SharpMUTerm.Avalonia/FloatingPanels.cs new file mode 100644 index 00000000..707f6e1e --- /dev/null +++ b/src/SharpMUTerm.Avalonia/FloatingPanels.cs @@ -0,0 +1,569 @@ +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Input; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window host's : one per panel the client says is +/// popped out, owned by the main window, opened where it was left (clamped to the screens there are now) or beside the +/// main window, and closed when the client docks it. The client calls in on its own thread; everything here is posted +/// to the window's. +/// +internal sealed class FloatingPanelPresenter : IFloatingPanels +{ + private readonly Dictionary _windows = new(StringComparer.Ordinal); + private IReadOnlyList _panels = Array.Empty(); + private Window? _owner; + private TerminalView? _view; + private bool _attached; + + /// What the client last said is floating; any thread. + public IReadOnlyList Panels => Volatile.Read(ref _panels); + + /// The open floating windows by panel window id. Window's thread; internal for tests. + internal IReadOnlyDictionary Windows => _windows; + + /// + /// The screens' working areas in screen pixels, which a remembered place is clamped to. The owner's screens by + /// default; a test hands in its own. + /// + internal Func>? Screens { get; set; } + + /// Raised on the client's thread when changes. + public event Action? Changed; + + /// Where the windows belong and whose cells their keys go to. On the window's thread. + public void Attach(Window? owner, TerminalView view) + { + _owner = owner; + _view = view; + _attached = true; + Sync(); + } + + /// The main window is going: every floating window closes with it and docks nothing. + public void Detach() + { + _attached = false; + foreach (var window in _windows.Values.ToList()) + { + window.CloseForClient(); + } + + _windows.Clear(); + } + + public void Show(IReadOnlyList panels) + { + Volatile.Write(ref _panels, panels); + Changed?.Invoke(); + if (_attached) + { + Dispatcher.UIThread.Post(Sync); + } + } + + /// Opens, updates and closes windows to match what the client last said. On the window's thread. + internal void Sync() + { + if (!_attached || _view is null) + { + return; + } + + var panels = Panels; + foreach (var gone in _windows.Keys.Where(id => panels.All(p => p.Model.WindowId != id)).ToList()) + { + _windows[gone].CloseForClient(); + _windows.Remove(gone); + } + + foreach (var panel in panels) + { + if (_windows.TryGetValue(panel.Model.WindowId, out var open)) + { + open.Update(panel, _view.CellExtent.Height); + if (panel.Model.Bounds.IsPlaced && !open.IsAt(panel.Model.Bounds)) + { + open.Place(Clamp(panel.Model.Bounds), Scaling()); + } + + continue; + } + + var window = new FloatingPanelWindow(panel, _view); + window.Update(panel, _view.CellExtent.Height); + var bounds = panel.Model.Bounds.IsPlaced ? panel.Model.Bounds : BesideOwner(panel.Model.PanelId); + window.Place(Clamp(bounds), Scaling()); + window.Closed += (_, _) => + { + if (_windows.TryGetValue(panel.Model.WindowId, out var known) && ReferenceEquals(known, window)) + { + _windows.Remove(panel.Model.WindowId); + } + }; + _windows[panel.Model.WindowId] = window; + + // Opened without taking the keyboard: the player was typing on the command line, and still is. + if (_owner is { IsVisible: true } owner) + { + window.Show(owner); + } + else + { + window.Show(); + } + + window.ReportPlace(); + } + } + + private double Scaling() => _owner?.DesktopScaling is > 0 and var scale ? scale : 1; + + /// Clamped to the screens a person can see now (a monitor unplugged since is not one of them). + private FloatingBounds Clamp(FloatingBounds bounds) => bounds.ClampTo(Screens?.Invoke() ?? OwnerScreens()); + + private IReadOnlyList OwnerScreens() => + _owner?.Screens.All.Select(s => new FloatingBounds(s.WorkingArea.X, s.WorkingArea.Y, s.WorkingArea.Width, s.WorkingArea.Height)).ToList() + ?? (IReadOnlyList)Array.Empty(); + + /// A first place for a panel: just right of the main window, top-aligned, sized for what it shows. + private FloatingBounds BesideOwner(string panelId) + { + var scale = Scaling(); + var (width, height) = panelId switch + { + PanelIds.Map => (460.0, 460.0), + PanelIds.Vitals => (300.0, 250.0), + PanelIds.WhoHere => (280.0, 380.0), + PanelIds.QuickBar => (560.0, 76.0), + _ => (360.0, 300.0), + }; + + var x = 80.0; + var y = 80.0; + if (_owner is { } owner) + { + // Right of the main window; left of it when the right has no room on the screen and the left has, else + // right anyway and the clamp brings it back over the main window's edge. + var offset = _windows.Count * 28; + var left = owner.Position.X; + var right = owner.Position.X + (owner.Bounds.Width * scale); + x = right + 8 + offset; + y = owner.Position.Y + offset; + var screens = Screens?.Invoke() ?? OwnerScreens(); + var screen = screens.FirstOrDefault(s => left >= s.X && left < s.X + s.Width) ?? screens.FirstOrDefault(); + if (screen is not null && x + (width * scale) > screen.X + screen.Width && left - 8 - (width * scale) - offset >= screen.X) + { + x = left - 8 - (width * scale) - offset; + } + } + + return new FloatingBounds(x, y, width * scale, height * scale); + } +} + +/// +/// A panel popped out into a window of its own: the panel's own native view (the map, the vitals gauges, who is here, +/// the quick bar), drawn from the same model and with the same actions as when it is docked, under a slim bar saying +/// whose it is with a way back. It never takes the keyboard on opening, and a key pressed while it is in front goes to +/// the command line, so the player keeps typing. Closing it docks the panel back. +/// +internal sealed class FloatingPanelWindow : Window +{ + private const double BarHeight = 26; + + private readonly TerminalView _view; + private readonly Control _content; + private readonly TextBlock _title; + private readonly FrameButton _dock; + private readonly Border _bar; + private readonly DispatcherTimer _report; + private bool _closingForClient; + private bool _placing; + + public FloatingPanelWindow(FloatingPanel panel, TerminalView view) + { + _view = view; + Panel = panel; + ShowActivated = false; + ShowInTaskbar = false; + CanResize = true; + MinWidth = 160; + MinHeight = 56; + WindowStartupLocation = WindowStartupLocation.Manual; + + _content = panel.Model.PanelId switch + { + PanelIds.Map => new MapCanvas(view) { RightClick = ShowOwnMenu }, + PanelIds.Vitals => new VitalsGauges(), + PanelIds.WhoHere => new WhoHereList(view) { RightClick = ShowOwnMenu }, + PanelIds.QuickBar => new QuickBarButtons(view) { RightClick = ShowOwnMenu }, + _ => new Border(), + }; + _content.Focusable = false; + + _title = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontSize = 12, Margin = new Thickness(10, 0, 0, 0) }; + _dock = new FrameButton("Dock") { Width = 52, Height = 20, Margin = new Thickness(0, 0, 6, 0), VerticalAlignment = VerticalAlignment.Center }; + _dock.Click += () => Panel.Dock(); + AutomationProperties.SetName(_dock, "Dock back into the layout"); + ToolTip.SetTip(_dock, "Dock back into its place in the layout"); + + var bar = new DockPanel { Height = BarHeight, LastChildFill = true }; + DockPanel.SetDock(_dock, Dock.Right); + bar.Children.Add(_dock); + bar.Children.Add(_title); + _bar = new Border { Child = bar }; + + var root = new DockPanel { LastChildFill = true }; + DockPanel.SetDock(_bar, Dock.Top); + root.Children.Add(_bar); + root.Children.Add(_content); + Content = root; + + _report = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(300) }; + _report.Tick += (_, _) => + { + _report.Stop(); + ReportPlace(); + }; + PositionChanged += (_, _) => Moved(); + Resized += (_, _) => Moved(); + Closing += (_, _) => + { + // The player closed it: the panel goes back to its place, never away. + if (!_closingForClient) + { + Panel.Dock(); + } + }; + + // A right click anywhere the panel's own view does not answer (the vitals gauges take no input) is the window's menu. + PointerPressed += (_, e) => + { + if (e.GetCurrentPoint(this).Properties.IsRightButtonPressed) + { + e.Handled = true; + ShowOwnMenu(e.GetPosition(this)); + } + }; + } + + /// What it is showing. + public FloatingPanel Panel { get; private set; } + + /// The panel's own native view inside it. Internal for tests. + internal Control PanelView => _content; + + /// The Dock button. Internal for tests. + internal FrameButton DockButton => _dock; + + /// The last menu the window opened. Internal for tests. + internal ContextMenu? OpenedMenu { get; private set; } + + /// Shows : its title, the client's colours, and the panel's model and actions. + public void Update(FloatingPanel panel, double cellHeight) + { + Panel = panel; + Title = panel.Model.WindowTitle; + var plane = Parse(panel.Plane, Colors.Black); + var text = Parse(panel.Text, Colors.White); + Background = new SolidColorBrush(plane); + _bar.Background = new SolidColorBrush(Shade(plane, text, 0.08)); + _title.Foreground = new SolidColorBrush(Color.FromArgb(0xD0, text.R, text.G, text.B)); + _title.Text = panel.Model.WindowTitle; + _dock.Ink = text; + _dock.Plane = plane; + + var content = panel.Content; + switch (_content) + { + case MapCanvas map when content.Map is { } model: + map.Show(model, content.Ink, plane, text, content.WalkTo); + break; + case VitalsGauges gauges when content.Vitals is { } vitals: + gauges.Show(vitals, content.Ink, plane, text, cellHeight); + break; + case WhoHereList list when content.WhoHere is { } who: + list.Show(who, content.Ink, plane, text, cellHeight, content.Pick); + break; + case QuickBarButtons bar when content.QuickBar is { } quick: + bar.Show(quick, content.Ink, plane, text, cellHeight, content.Pick, content.Dispatch); + break; + } + } + + /// Puts the window at (screen pixels), without reporting it back as a move. + public void Place(FloatingBounds bounds, double scaling) + { + _placing = true; + try + { + Position = new PixelPoint((int)Math.Round(bounds.X), (int)Math.Round(bounds.Y)); + Width = Math.Max(MinWidth, bounds.Width / scaling); + Height = Math.Max(MinHeight, bounds.Height / scaling); + } + finally + { + _placing = false; + } + } + + /// Where the window is now, in screen pixels. + public FloatingBounds CurrentBounds() + { + var scaling = DesktopScaling > 0 ? DesktopScaling : 1; + var size = ClientSize.Width > 0 ? ClientSize : new Size(Width, Height); + return new FloatingBounds(Position.X, Position.Y, Math.Round(size.Width * scaling), Math.Round(size.Height * scaling)); + } + + /// Whether the window is already at , give or take a pixel. + public bool IsAt(FloatingBounds bounds) + { + var now = CurrentBounds(); + return Math.Abs(now.X - bounds.X) <= 1 && Math.Abs(now.Y - bounds.Y) <= 1 + && Math.Abs(now.Width - bounds.Width) <= 2 && Math.Abs(now.Height - bounds.Height) <= 2; + } + + /// Tells the client where the window is, so the workspace and a saved layout remember it. + public void ReportPlace() => Panel.Moved(CurrentBounds()); + + /// Closed because the client docked the panel (or the main window went): docks nothing. + public void CloseForClient() + { + _closingForClient = true; + _report.Stop(); + Close(); + } + + private void Moved() + { + if (_placing || _closingForClient) + { + return; + } + + _report.Stop(); + _report.Start(); + } + + // Every key goes to the command line, the window's own chords included, as if the cells had it. + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + if (!e.Handled) + { + _view.HandleKeyDown(e); + } + } + + protected override void OnTextInput(TextInputEventArgs e) + { + base.OnTextInput(e); + if (!e.Handled) + { + _view.HandleTextInput(e); + } + } + + /// The window's own menu: the way back, since there is no pane under it for the client's. + private void ShowOwnMenu(Point at) + { + var items = new List + { + new($"Dock {Panel.Model.Title} back", null, () => Panel.Dock()), + }; + var menu = NativeMenu.Build(items, PlacementMode.Pointer, this); + OpenedMenu = menu; + menu.Open(this); + } + + private static Color Parse(string hex, Color fallback) => Color.TryParse(hex, out var colour) ? colour : fallback; + + /// moved a little toward : the bar a step off the panel. + private static Color Shade(Color plane, Color ink, double by) => Color.FromRgb( + (byte)(plane.R + ((ink.R - plane.R) * by)), + (byte)(plane.G + ((ink.G - plane.G) * by)), + (byte)(plane.B + ((ink.B - plane.B) * by))); + + /// A small drawn text button, in the window's colours rather than a theme's; never takes the keyboard. + internal sealed class FrameButton : Control + { + private readonly string _label; + private bool _pressed; + + public FrameButton(string label) + { + _label = label; + Focusable = false; + Cursor = new Cursor(StandardCursorType.Hand); + } + + public Color Ink { get; set; } = Colors.White; + + public Color Plane { get; set; } = Colors.Black; + + /// Raised on a left click. + public event Action? Click; + + /// Clicks it, as a left press and release would. Internal for tests. + internal void PerformClick() => Click?.Invoke(); + + protected override void OnPointerEntered(PointerEventArgs e) + { + base.OnPointerEntered(e); + InvalidateVisual(); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + InvalidateVisual(); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + _pressed = e.GetCurrentPoint(this).Properties.IsLeftButtonPressed; + e.Handled = true; + InvalidateVisual(); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + var click = _pressed && e.InitialPressMouseButton == MouseButton.Left && new Rect(Bounds.Size).Contains(e.GetPosition(this)); + _pressed = false; + InvalidateVisual(); + if (click) + { + Click?.Invoke(); + } + } + + public override void Render(DrawingContext context) + { + var bounds = new Rect(Bounds.Size); + var plate = (byte)(_pressed ? 0x55 : IsPointerOver ? 0x38 : 0x1c); + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(plate, Ink.R, Ink.G, Ink.B)), null, bounds, 4, 4); + var text = new FormattedText( + _label, + System.Globalization.CultureInfo.InvariantCulture, + FlowDirection.LeftToRight, + Typeface.Default, + 11.5, + new SolidColorBrush(Color.FromArgb(0xE8, Ink.R, Ink.G, Ink.B))); + context.DrawText(text, new Point(Math.Round((bounds.Width - text.Width) / 2), Math.Round((bounds.Height - text.Height) / 2))); + } + } +} + +/// +/// The small button over a docked native panel's top-right corner that pops it out into a window of its own — only +/// where the window can float that panel (the client hands a callback). Drawn, never focused; its presses are the +/// window's and never reach the cells under it. +/// +internal sealed class PopOutButton : Control +{ + private bool _pressed; + + public PopOutButton() + { + Focusable = false; + Cursor = new Cursor(StandardCursorType.Hand); + AutomationProperties.SetName(this, "Pop out into its own window"); + ToolTip.SetTip(this, "Pop out into its own window"); + } + + /// The panel it pops out, as the client last published it. + public PanelOverlay? Panel { get; private set; } + + public Color Ink { get; set; } = Colors.White; + + /// Shows the button for , in . + public void Show(PanelOverlay panel, Color ink) + { + Panel = panel; + if (Ink != ink) + { + Ink = ink; + InvalidateVisual(); + } + } + + /// Clicks it, as a left press and release would. Internal for tests. + internal void PerformClick() => Panel?.PopOut?.Invoke(); + + protected override void OnPointerEntered(PointerEventArgs e) + { + base.OnPointerEntered(e); + InvalidateVisual(); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + InvalidateVisual(); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + _pressed = e.GetCurrentPoint(this).Properties.IsLeftButtonPressed; + e.Handled = true; + InvalidateVisual(); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + var click = _pressed && e.InitialPressMouseButton == MouseButton.Left && new Rect(Bounds.Size).Contains(e.GetPosition(this)); + _pressed = false; + InvalidateVisual(); + if (click) + { + PerformClick(); + } + } + + protected override void OnPointerWheelChanged(PointerWheelEventArgs e) + { + base.OnPointerWheelChanged(e); + e.Handled = true; + } + + public override void Render(DrawingContext context) + { + var bounds = new Rect(Bounds.Size); + var plate = (byte)(_pressed ? 0x60 : IsPointerOver ? 0x40 : 0x18); + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(plate, Ink.R, Ink.G, Ink.B)), null, bounds, 3, 3); + + // A frame with an arrow leaving its corner: out into a window of its own. + var alpha = (byte)(IsPointerOver ? 0xF0 : 0xA8); + var pen = new Pen(new SolidColorBrush(Color.FromArgb(alpha, Ink.R, Ink.G, Ink.B)), 1.2); + var side = Math.Min(bounds.Width, bounds.Height); + var inset = Math.Round(side * 0.24) + 0.5; + var box = new Rect(inset, inset + 1, side - (2 * inset) - 1, side - (2 * inset) - 1); + var gap = box.Width * 0.45; + context.DrawLine(pen, new Point(box.Right - gap, box.Top), new Point(box.Left, box.Top)); + context.DrawLine(pen, new Point(box.Left, box.Top), new Point(box.Left, box.Bottom)); + context.DrawLine(pen, new Point(box.Left, box.Bottom), new Point(box.Right, box.Bottom)); + context.DrawLine(pen, new Point(box.Right, box.Bottom), new Point(box.Right, box.Top + gap)); + var tip = new Point(box.Right + 1, box.Top - 1); + context.DrawLine(pen, new Point(box.Left + (box.Width * 0.45), box.Bottom - (box.Height * 0.45)), tip); + context.DrawLine(pen, tip, new Point(tip.X - (box.Width * 0.38), tip.Y)); + context.DrawLine(pen, tip, new Point(tip.X, tip.Y + (box.Height * 0.38))); + } +} diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index 107f7c6d..252618df 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -82,6 +82,10 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime // The modals, over everything; the quit prompt is kept the last child whatever is added after it, and brings // this window forward. ⌃Q from any other modal goes to the client, which opens the prompt over it. _driver.Modals.Attach(this, root, () => layer.FocusArmedComposer(), key => _driver.RaiseKey(key)); + + // Panels popped out into windows of their own, owned by this one so they stay above it and go with it. + _driver.Floating.Attach(this, _view); + Closed += (_, _) => _driver.Floating.Detach(); Content = root; AutomationProperties.SetName(_view, "SharpMUTerm"); diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index 9d2787f5..b81e6a6c 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -28,6 +28,12 @@ internal sealed class MapCanvas : Control private const double MinZoom = 0.35, MaxZoom = 3, DragThreshold = 4; private readonly TerminalView _view; + + /// + /// What a right click does instead of reaching the cell under it: set in a floating panel's window, which has no + /// cell under it, to open that window's own menu. Null over a pane, where the client's menu for the pane opens. + /// + internal Action? RightClick { get; set; } private MapViewModel _model = new(null, 0, [], [], null); private PanelInk _ink = new("#5fafff", "#ffaf5f", "#6a6a72"); private Color _plane = Colors.Black; @@ -104,6 +110,12 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) e.Handled = true; if (point.Properties.IsRightButtonPressed) { + if (RightClick is { } own) + { + own(e.GetPosition(this)); + return; + } + _view.ForwardRightClick(e.GetPosition(_view), e.KeyModifiers); return; } diff --git a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs index de494bcb..f2d8f794 100644 --- a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs +++ b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs @@ -46,6 +46,12 @@ internal enum SlotKind private const double Gap = 6, PadX = 8; private readonly TerminalView _view; + + /// + /// What a right click does instead of reaching the cell under it: set in a floating panel's window, which has no + /// cell under it, to open that window's own menu. Null over a pane, where the client's menu for the pane opens. + /// + internal Action? RightClick { get; set; } private readonly List _slots = []; private QuickBarModel _model = QuickBarModel.Empty; private PanelInk _ink = new("#5fafff", "#ff5f5f", "#3a3a40"); @@ -242,6 +248,12 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) var point = e.GetCurrentPoint(this); if (point.Properties.IsRightButtonPressed) { + if (RightClick is { } own) + { + own(e.GetPosition(this)); + return; + } + _view.ForwardRightClick(e.GetPosition(_view), e.KeyModifiers); return; } diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index b71ad19c..fe9bfda6 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -208,6 +208,15 @@ private void OnFrameReady() protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); + HandleKeyDown(e); + } + + /// + /// A key, as the cells take it: the window's own chords first, then the client. Also how a key pressed in another of + /// the window's windows (a floating panel) reaches the command line, so the player keeps typing. + /// + internal void HandleKeyDown(KeyEventArgs e) + { _swallowText = null; var mapped = KeyMapper.FromKeyDown(e.Key, e.KeyModifiers); @@ -241,6 +250,12 @@ protected override void OnKeyDown(KeyEventArgs e) protected override void OnTextInput(TextInputEventArgs e) { base.OnTextInput(e); + HandleTextInput(e); + } + + /// Typed text, as the cells take it; also what a floating panel's window forwards. + internal void HandleTextInput(TextInputEventArgs e) + { foreach (var key in KeyMapper.FromText(e.Text)) { if (_swallowText is { } swallowed && char.ToLowerInvariant(swallowed) == char.ToLowerInvariant(key.KeyChar)) diff --git a/src/SharpMUTerm.Avalonia/WhoHereList.cs b/src/SharpMUTerm.Avalonia/WhoHereList.cs index bc910ebe..71ce2cb1 100644 --- a/src/SharpMUTerm.Avalonia/WhoHereList.cs +++ b/src/SharpMUTerm.Avalonia/WhoHereList.cs @@ -24,6 +24,12 @@ namespace SharpMUTerm.Avalonia; internal sealed class WhoHereList : Control { private readonly TerminalView _view; + + /// + /// What a right click does instead of reaching the cell under it: set in a floating panel's window, which has no + /// cell under it, to open that window's own menu. Null over a pane, where the client's menu for the pane opens. + /// + internal Action? RightClick { get; set; } private readonly List<(int Index, Rect Rect)> _rows = []; private WhoHereModel _model = WhoHereModel.Unknown; private PanelInk _ink = new("#5fafff", "#ff5f5f", "#3a3a40"); @@ -188,6 +194,12 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) var point = e.GetCurrentPoint(this); if (point.Properties.IsRightButtonPressed) { + if (RightClick is { } own) + { + own(e.GetPosition(this)); + return; + } + _view.ForwardRightClick(e.GetPosition(_view), e.KeyModifiers); return; } diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 480795ba..ba3b418e 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -83,5 +83,8 @@ internal static class WindowHost NativeModals = driver.Modals, // The title bar and the taskbar entry say who is in front: Character@World — SharpMUTerm. Title = driver.TitleBar, + + // A panel popped out is a window of its own, owned by the main one, for a second monitor. + FloatingPanels = driver.Floating, }; } diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index b19863ae..2cf52d0d 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -130,6 +130,12 @@ void Family(string id, string prefix, Func c.State.Walking); // Game sound, for this run. The levels and the off switch are F7's; this is the quick one. @@ -415,6 +421,28 @@ private static IEnumerable Panes(ICommandContext context) } } + private static IEnumerable PopOuts(ICommandContext context) => + (context.State.Floats ?? []).Where(f => !f.Floating).Select(f => + new CommandItem( + CommandGroup.Layout, + $"Pop out {f.Title}", + Client.Panels.PanelFloatCommands.PopOut(f.WindowId), + $"{f.Character} · in a window of its own") + { + Detail = $"{f.Character} · in a window of its own", + }); + + private static IEnumerable Docks(ICommandContext context) => + (context.State.Floats ?? []).Where(f => f.Floating).Select(f => + new CommandItem( + CommandGroup.Layout, + $"Dock {f.Title} back", + Client.Panels.PanelFloatCommands.Dock(f.WindowId), + $"{f.Character} · into its place in the layout") + { + Detail = $"{f.Character} · into its place in the layout", + }); + private static IEnumerable Screens(ICommandContext context) => context.Settings.Select(screen => new CommandItem(CommandGroup.Settings, $"Open {screen.Title}", screen.Id, screen.Shortcut) diff --git a/src/SharpMUTerm.Client/Panels/FloatingPanelModel.cs b/src/SharpMUTerm.Client/Panels/FloatingPanelModel.cs new file mode 100644 index 00000000..8d025823 --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/FloatingPanelModel.cs @@ -0,0 +1,48 @@ +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Panels; + +/// +/// The commands that pop a panel out into a window of its own and dock it back, and which panels can. Offered only by +/// a host that can float a panel (the desktop window); in a terminal a floating panel is simply in its region. +/// +public static class PanelFloatCommands +{ + /// The prefix of panel:popout:<window id>. + public const string PopOutPrefix = "panel:popout:"; + + /// The prefix of panel:dock:<window id>. + public const string DockPrefix = "panel:dock:"; + + /// The panels drawn natively from a model of their own, and so drawable in a window apart from the cells. + public static IReadOnlySet Floatable { get; } = new HashSet(StringComparer.Ordinal) + { + PanelIds.Map, PanelIds.Vitals, PanelIds.WhoHere, PanelIds.QuickBar, + }; + + /// Pops the panel drawn in out into a window of its own. + public static string PopOut(string windowId) => PopOutPrefix + windowId; + + /// Docks the floating panel in back into its region. + public static string Dock(string windowId) => DockPrefix + windowId; +} + +/// +/// One panel popped out into a window of its own: which panel, whose, and where its window sits. What the window shows +/// inside is the panel's own model (, , …), the same one its cells +/// draw when it is docked; this is the frame around it. +/// +/// The panel's window in the workspace, out of the pane tree while it floats. +/// Which panel (). +/// What it is called (Map). +/// Whose it is; its actions run on this character's session. +/// Where its window sits, in screen pixels; until placed. +public sealed record FloatingPanelModel(string WindowId, string PanelId, string Title, string Character, FloatingBounds Bounds) +{ + /// The command that docks it back, as the window's close and its Dock button run it. + public string DockCommand => PanelFloatCommands.Dock(WindowId); + + /// The window's title: the panel, then whose. + public string WindowTitle => $"{Title} — {Character}"; +} diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 072acac8..3d6938bb 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -68,7 +68,13 @@ public enum SurfaceActionKind /// this names where the cells offer the same thing: another surface's id, or a command id (a key, a ⌃P entry). A /// native view may add a door; it may not add a room. /// -public sealed record SurfaceAction(SurfaceActionKind Kind, string Name, string Reaches, string? CellsVia = null); +/// +/// Null when every host that draws the surface offers the action. Otherwise the one host () +/// that can do it at all — popping a panel out into a window of its own is the window's, since a terminal has nowhere +/// to put a second window — and must then name the command that reaches it from the cells +/// on that host. +/// +public sealed record SurfaceAction(SurfaceActionKind Kind, string Name, string Reaches, string? CellsVia = null, string? OnlyOn = null); /// The hosts a surface is declared for, by ClientHost.Name. public static class SurfaceHosts @@ -174,6 +180,22 @@ public static class SurfaceCatalog /// The first-run welcome and its connect form. public const string Welcome = "welcome"; + /// + /// A panel popped out into a window of its own (the desktop window only; a terminal keeps every panel in its + /// region). The frame around the panel's own native view: its title, whose it is, and the way back. + /// + public const string FloatingPanel = "floating-panel"; + + /// + /// Pop the panel out into a window of its own: the window's alone, offered by a button on the panel's native view, + /// the pane's right-click menu and ⌃P (panel:popout:<window>), all ending in one client method. + /// + private static readonly SurfaceAction PopOut = new( + SurfaceActionKind.Command, PanelFloatCommands.PopOutPrefix, "PopOutPanel", CellsVia: PanelFloatCommands.PopOutPrefix, OnlyOn: SurfaceHosts.Window); + + /// The window's views of a panel: its own view, and the pop-out button over it. + private static string[] PanelViews(string view) => ["SharpMUTerm.Avalonia." + view, "SharpMUTerm.Avalonia.PopOutButton"]; + /// The modals the window draws with its own controls in place of the cell modal (ClientHost.NativeModals). public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome]; @@ -247,34 +269,35 @@ public static class SurfaceCatalog new( PanelIds.Vitals, typeof(VitalsModel), - [], + [PopOut], CellsUnderNative, "SharpMUTerm.Tui.Panels.VitalsStripRenderer.Render", - ["SharpMUTerm.Avalonia.VitalsGauges"]), + PanelViews("VitalsGauges")), new( PanelIds.Map, typeof(MapViewModel), - [new(SurfaceActionKind.Walk, "room", "WalkFromMap")], + [new(SurfaceActionKind.Walk, "room", "WalkFromMap"), PopOut], CellsUnderNative, "SharpMUTerm.Tui.MapRenderer.Render", - ["SharpMUTerm.Avalonia.MapCanvas"]), + PanelViews("MapCanvas")), new( PanelIds.WhoHere, typeof(WhoHereModel), - [new(SurfaceActionKind.Pick, "row", "OfferLook")], + [new(SurfaceActionKind.Pick, "row", "OfferLook"), PopOut], CellsUnderNative, "SharpMUTerm.Tui.Panels.WhoHereRenderer.Render", - ["SharpMUTerm.Avalonia.WhoHereList"]), + PanelViews("WhoHereList")), new( PanelIds.QuickBar, typeof(QuickBarModel), [ new(SurfaceActionKind.Pick, "item", "RunQuickMacro"), new(SurfaceActionKind.Command, QuickBarModel.EditCommand, "DispatchCommand"), + PopOut, ], CellsUnderNative, "SharpMUTerm.Tui.Panels.QuickBarRenderer.Render", - ["SharpMUTerm.Avalonia.QuickBarButtons"]), + PanelViews("QuickBarButtons")), new( Settings, typeof(SettingsSectionContribution), @@ -426,6 +449,23 @@ public static class SurfaceCatalog NativeModal, "SharpMUTerm.Tui.WelcomeSurface.Render", ModalViews("WelcomeView")), + new( + FloatingPanel, + typeof(FloatingPanelModel), + [ + // Its Dock button and closing the window both dock it back; the cells' way is the ⌃P entry, offered + // only where the host can float a panel at all. + new(SurfaceActionKind.Command, PanelFloatCommands.DockPrefix, "DockPanel", CellsVia: PanelFloatCommands.DockPrefix, OnlyOn: SurfaceHosts.Window), + ], + new Dictionary + { + // A terminal has nowhere to put a second window: a floating panel is drawn in its region there, as cells. + [SurfaceHosts.Terminal] = SurfaceDrawing.None, + [SurfaceHosts.Window] = SurfaceDrawing.Native, + }, + null, + ["SharpMUTerm.Avalonia.FloatingPanelWindow"], + KeyboardPath: PanelFloatCommands.DockPrefix), ]; /// The surface with , or null. diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index 768d1fa8..1cba2e48 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -49,6 +49,10 @@ public sealed record CharacterRef( /// How many F4 bindings share a chord with the client or with each other, so Key clashes (N) is offered /// only when there is one to show. /// +/// +/// Null where the host cannot float a panel in a window of its own (the terminal), so nothing is offered; otherwise +/// every panel that can pop out, docked or floating, so Pop out … and Dock … back name real windows. +/// public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -62,7 +66,15 @@ public sealed record CommandContext( bool? Sound = null, bool? Announced = null, bool OutputSelected = false, - int KeyClashes = 0); + int KeyClashes = 0, + IReadOnlyList? Floats = null); + +/// A panel window that can pop out into a window of its own, for the command surface's entries. +/// The panel's window (map:World.Char, panel:vitals:World.Char). +/// What the panel is called (Map, Vitals). +/// Whose panel it is, as the entry's detail. +/// Whether it is popped out now: offered to dock back, else to pop out. +public sealed record PanelFloatRef(string WindowId, string Title, string Character, bool Floating); /// /// A configuration screen the command surface can open: what it calls itself, the id the host diff --git a/src/SharpMUTerm.Core/Layouts/LayoutCapture.cs b/src/SharpMUTerm.Core/Layouts/LayoutCapture.cs index 81901b26..88d16366 100644 --- a/src/SharpMUTerm.Core/Layouts/LayoutCapture.cs +++ b/src/SharpMUTerm.Core/Layouts/LayoutCapture.cs @@ -17,6 +17,14 @@ public sealed record CapturedLayout( /// and not a terminal's size. Panels the previous layout placed that are not on screen now (a map on a session /// that has recorded no room yet) keep their old placement, so saving from a quiet session does not lose them. /// +/// +/// Floating panels. A host that can float panels passes where each popped-out panel's window is +/// (floating): each is captured with set and the region, order and size it +/// had before (the side column for a panel the previous layout did not place), which is where it docks back to; every +/// panel in a pane is captured docked. A host that cannot float passes null, and a panel it shows in a pane keeps the +/// the previous layout gave it — the terminal draws a floating panel in its +/// region, and saving there must not undo the window's choice. +/// /// public static class LayoutCapture { @@ -27,7 +35,11 @@ public static class LayoutCapture /// window that belongs to no panel of this session (another character's, the web view). Null when no pane holds /// the output, since a layout is arranged around it. /// - public static CapturedLayout? Capture(LayoutNode root, Func panelOf, LayoutDefinition? previous = null) + public static CapturedLayout? Capture( + LayoutNode root, + Func panelOf, + LayoutDefinition? previous = null, + IReadOnlyDictionary? floating = null) { ArgumentNullException.ThrowIfNull(root); ArgumentNullException.ThrowIfNull(panelOf); @@ -57,6 +69,9 @@ LayoutRegion RegionOf(PaneRect r) => : r.Y >= m.Y + m.Height ? LayoutRegion.Bottom : LayoutRegion.Main; + // Shown in a pane: docked, where the host floats; whatever the previous layout said, where it cannot. + FloatingBounds? KeptFloating(string panel) => floating is null ? previous?.PlacementOf(panel)?.Floating : null; + var placements = new List(); foreach (var group in panes.GroupBy(p => RegionOf(p.Rect))) { @@ -74,6 +89,7 @@ LayoutRegion RegionOf(PaneRect r) => Region = group.Key, Order = order, Size = Math.Round(Math.Max(1, size) / 100.0, 2), + Floating = KeptFloating(host), }); placements.AddRange(panels.Skip(1).Select(tab => new PanelPlacement { @@ -81,14 +97,36 @@ LayoutRegion RegionOf(PaneRect r) => Region = group.Key, Order = order, TabOf = host, + Floating = KeptFloating(tab), })); order++; } } + // Floating: where it docks back to is where it was, or the side column for a panel the layout never placed. + foreach (var (panel, bounds) in (floating ?? new Dictionary()).Where(f => PanelIds.IsKnown(f.Key))) + { + if (!seen.Add(panel)) + { + continue; // in a pane as well: the pane wins, the host is mid-way through docking it + } + + var before = previous?.PlacementOf(panel); + placements.Add(new PanelPlacement + { + PanelId = panel, + Region = before?.Region ?? LayoutRegion.Side, + Order = before?.Order ?? placements.Count, + Size = before?.Size ?? 1, + Floating = bounds, + }); + } + if (previous is not null) { - placements.AddRange(previous.KnownPlacements.Where(p => !seen.Contains(p.PanelId))); + // Not on screen and not floating: where the host floats, it is docked now (the host passed every float). + placements.AddRange(previous.KnownPlacements.Where(p => !seen.Contains(p.PanelId)) + .Select(p => floating is null ? p : p with { Floating = null })); } return new CapturedLayout(placements, Shares(panes.Select(p => (p.Rect, RegionOf(p.Rect))).ToList(), m)); diff --git a/src/SharpMUTerm.Core/Layouts/LayoutDefinition.cs b/src/SharpMUTerm.Core/Layouts/LayoutDefinition.cs index 70043ac3..39e6c742 100644 --- a/src/SharpMUTerm.Core/Layouts/LayoutDefinition.cs +++ b/src/SharpMUTerm.Core/Layouts/LayoutDefinition.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using SharpMUTerm.Core.Workspaces; namespace SharpMUTerm.Core.Layouts; @@ -47,6 +48,16 @@ public sealed record PanelPlacement /// (unknown, collapsed, or without data yet), this one takes a pane of its own in its own region. /// public string? TabOf { get; init; } + + /// + /// Non-null when the panel is popped out into a window of its own, with where that window sits + /// ( when no place was remembered). Host-neutral, and read only by a host + /// that can float a panel. ignores it and places the panel in its + /// as always, so a host that cannot float (the terminal) draws a floating panel in its region; + /// a host that can withholds the panel's windows from that pane and draws them in a window of their own instead. + /// The region, order and size are therefore kept for a floating panel too: they are where it docks back to. + /// + public FloatingBounds? Floating { get; init; } } /// diff --git a/src/SharpMUTerm.Core/Layouts/LayoutFold.cs b/src/SharpMUTerm.Core/Layouts/LayoutFold.cs index b6c8df6b..c70ca4fb 100644 --- a/src/SharpMUTerm.Core/Layouts/LayoutFold.cs +++ b/src/SharpMUTerm.Core/Layouts/LayoutFold.cs @@ -29,6 +29,12 @@ public sealed record LayoutFoldResult( /// A tab joins its host's pane only when the host has a pane of its own (is drawn and is not itself a tab); /// otherwise it takes a pane in its own region. One level, so there are no chains or cycles to resolve. /// +/// +/// is not read here. A floating panel is folded into its region like any +/// other, which is exactly what a host that cannot float draws. A host that can float withholds that panel's windows +/// when it realises the fold ( drops a pane left with no window), so the panes it draws +/// are the layout without that panel, and docking it back is the same fold with the windows returned. +/// /// public static class LayoutFold { diff --git a/src/SharpMUTerm.Core/Workspace/FloatingBounds.cs b/src/SharpMUTerm.Core/Workspace/FloatingBounds.cs new file mode 100644 index 00000000..4f32f803 --- /dev/null +++ b/src/SharpMUTerm.Core/Workspace/FloatingBounds.cs @@ -0,0 +1,77 @@ +using System.Text.Json.Serialization; + +namespace SharpMUTerm.Core.Workspaces; + +/// +/// Where a popped-out panel's own window sits on the desktop, in screen pixels: its left and top edge, and its width +/// and height. Host-neutral data: a host that can float a panel in a window of its own (the desktop window) puts it +/// here; a host that cannot (the terminal) reads a floating panel as placed in its region and ignores this, so the +/// same workspace and the same layout serve both. +/// +/// (no size) means "popped out, nowhere chosen yet": the host picks a place beside its main +/// window the first time it shows the panel and reports where it put it. +/// +/// +/// The left edge, in screen pixels (may be negative on a screen left of the primary one). +/// The top edge, in screen pixels. +/// The width, in screen pixels; zero or less is . +/// The height, in screen pixels; zero or less is . +public sealed record FloatingBounds(double X, double Y, double Width, double Height) +{ + /// Popped out with no place chosen yet. + public static FloatingBounds Unplaced { get; } = new(0, 0, 0, 0); + + /// How much of a window must stay on a screen, each way, for it to count as reachable there. + public const double MinimumVisible = 48; + + /// Whether a place has been chosen (a size on both axes). + [JsonIgnore] + public bool IsPlaced => Width > 0 && Height > 0; + + private double Right => X + Width; + + private double Bottom => Y + Height; + + /// + /// These bounds moved and shrunk onto the screens a person can see, given each screen's working area in the same + /// pixels. A window remembered on a monitor that has since been unplugged, or a size larger than the screen it is + /// now on, would otherwise open somewhere nobody can reach to close it. The screen the window overlaps most is the + /// one it is kept on (the nearest, by centre, when it overlaps none); it is shrunk to fit that screen's working area + /// and then moved the least distance that puts all of it inside. Bounds already wholly on a screen come back + /// unchanged; and an empty screen list come back as they are. + /// + public FloatingBounds ClampTo(IReadOnlyList screens) + { + ArgumentNullException.ThrowIfNull(screens); + var usable = screens.Where(s => s.IsPlaced).ToList(); + if (!IsPlaced || usable.Count == 0) + { + return this; + } + + if (usable.Any(s => X >= s.X && Y >= s.Y && Right <= s.Right && Bottom <= s.Bottom)) + { + return this; + } + + double Overlap(FloatingBounds s) => + Math.Max(0, Math.Min(Right, s.Right) - Math.Max(X, s.X)) * Math.Max(0, Math.Min(Bottom, s.Bottom) - Math.Max(Y, s.Y)); + + double Distance(FloatingBounds s) + { + var dx = (X + (Width / 2)) - (s.X + (s.Width / 2)); + var dy = (Y + (Height / 2)) - (s.Y + (s.Height / 2)); + return (dx * dx) + (dy * dy); + } + + var screen = usable.Max(Overlap) > 0 + ? usable.OrderByDescending(Overlap).First() + : usable.OrderBy(Distance).First(); + + var width = Math.Min(Width, screen.Width); + var height = Math.Min(Height, screen.Height); + var x = Math.Clamp(X, screen.X, screen.Right - width); + var y = Math.Clamp(Y, screen.Y, screen.Bottom - height); + return new FloatingBounds(x, y, width, height); + } +} diff --git a/src/SharpMUTerm.Core/Workspace/WorkspaceState.cs b/src/SharpMUTerm.Core/Workspace/WorkspaceState.cs index eb8bba04..8dc09462 100644 --- a/src/SharpMUTerm.Core/Workspace/WorkspaceState.cs +++ b/src/SharpMUTerm.Core/Workspace/WorkspaceState.cs @@ -20,6 +20,13 @@ public sealed class WorkspaceWindowState /// /// public int Sequence { get; set; } = WorkspaceWindow.Unsequenced; + + /// + /// Where the window floats when it is a panel popped out into a window of its own + /// (); null for a window in the pane tree. Absent in a file written before + /// panels could float, which reads as not floating. + /// + public FloatingBounds? Floating { get; set; } } /// @@ -86,6 +93,7 @@ public static WorkspaceState Capture(Workspace workspace) SessionKey = w.SessionKey, OwnerLabel = w.OwnerLabel, Sequence = w.Sequence, + Floating = w.Floating, }).ToList(), Root = CaptureNode(workspace.Layout.Root), FocusedPaneId = workspace.Layout.FocusedPaneId, @@ -101,6 +109,7 @@ public Workspace Restore() { OwnerLabel = w.OwnerLabel, Sequence = w.Sequence, + Floating = w.Floating, }); var layout = new WorkspaceLayout(BuildNode(Root), FocusedPaneId, ZoomedPaneId); diff --git a/src/SharpMUTerm.Core/Workspace/WorkspaceWindow.cs b/src/SharpMUTerm.Core/Workspace/WorkspaceWindow.cs index 362e3d8c..7b359577 100644 --- a/src/SharpMUTerm.Core/Workspace/WorkspaceWindow.cs +++ b/src/SharpMUTerm.Core/Workspace/WorkspaceWindow.cs @@ -99,4 +99,12 @@ public WorkspaceWindow(string id, string title, WindowKind kind = WindowKind.Mai /// pane stays visibly tied to its character. Null for a character's own main window. /// public string? OwnerLabel { get; set; } + + /// + /// Non-null while this window is a panel popped out into a window of its own, with where that window sits + /// ( before a host has placed it). Host-neutral: a host that floats panels + /// keeps such a window out of the pane tree and draws it apart; a host that cannot keeps it in a pane like any + /// other and leaves this alone, so a workspace saved by either host means the same thing to the other. + /// + public FloatingBounds? Floating { get; set; } } diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 65dbffbe..8396649d 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -136,6 +136,17 @@ internal sealed record ClientHost /// public required IWindowTitle? Title { get; init; } + /// + /// Draws panels popped out into windows of their own — the map on a second monitor, vitals floating beside the + /// game — or null for a host that cannot put a panel anywhere but its pane (the terminal, the snapshot, the tests, + /// --plain). One member is both the fact and the channel: a flag beside a presenter could say "can + /// float" with nothing to float into. Where it is null the pop-out commands are not offered (⌃P lists none, the pane + /// menu has no entry, no native view carries the button) and a floating panel, from a layout or a workspace another + /// host saved, is drawn in its region as cells. It is not part of : that says which of the + /// client's own rows and columns the host draws beside the cells, while a floating panel leaves the cells entirely. + /// + public required IFloatingPanels? FloatingPanels { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -179,6 +190,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) NativeComposer = null, NativeModals = null, Title = new TerminalTitle(driver), + FloatingPanels = null, }; /// @@ -207,6 +219,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) NativeComposer = null, NativeModals = null, Title = null, + FloatingPanels = null, }; /// diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index a01cce55..d36c1e55 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -202,6 +202,11 @@ void Notice(NoticeOverlay notice) /// For the docked composer, the way a native editor's text and keys go back to the client: one instance for as long as /// the panel lives, so an overlay compares equal from frame to frame. /// +/// +/// Pops the panel out into a window of its own (PopOutPanel, what ⌃P's panel:popout: entry runs), for a +/// host that can float a panel (); null elsewhere, and for a panel that cannot +/// float. Safe to call from any thread; one instance per window. +/// internal sealed record PanelOverlay( string PanelId, string WindowId, @@ -215,7 +220,8 @@ internal sealed record PanelOverlay( Action? Pick = null, Action? Dispatch = null, SharpMUTerm.Client.Composer.ComposerModel? Composer = null, - SharpMUTerm.Client.Composer.ComposerSession? ComposerSession = null); + SharpMUTerm.Client.Composer.ComposerSession? ComposerSession = null, + Action? PopOut = null); /// A panel's colours as #rrggbb: a bar or fill, the warning, and the empty part of a bar. internal sealed record PanelInk(string Bar, string Low, string Track); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs index d7990f80..f51c7a82 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -206,62 +206,79 @@ private void PublishPanels() var covered = _system.ModalStateService.HasModals || _nativeCompose is not null; foreach (var (paneId, rect) in !covered ? PaneOutputRects() : new Dictionary()) { - if (_workspace.Layout.FindPane(paneId) is not { ActiveTab: { } windowId }) + if (_workspace.Layout.FindPane(paneId) is { ActiveTab: { } windowId } && OverlayFor(windowId, rect, docked: true) is { } overlay) { - continue; + overlays.Add(overlay); } + } - if (IsMapWindow(windowId)) - { - if (MapViewFor(windowId) is { } view) - { - var walker = _mapWalkers.TryGetValue(windowId, out var known) - ? known - : _mapWalkers[windowId] = room => OnUiThread(() => WalkFromMap(windowId, room)); - overlays.Add(new PanelOverlay( - PanelIds.Map, windowId, rect, new PanelInk(_ink.Accent, _ink.Draft, _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))), null, view, walker)); - } - - continue; - } + if (overlays.SequenceEqual(_panelOverlays)) + { + return; + } - if (!TerminalPanels.TryParseWindowId(windowId, out var panelId, out var key)) - { - continue; - } + _panelOverlays = overlays; + _pointer.Panels(overlays); + } - if (panelId == PanelIds.Vitals) - { - var ink = VitalsInk(); - overlays.Add(new PanelOverlay(panelId, windowId, rect, new PanelInk(ink.Bar, ink.Low, ink.Empty), ReadVitals(key))); - } - else if (panelId == PanelIds.WhoHere) - { - overlays.Add(new PanelOverlay( - panelId, windowId, rect, PanelListInk(), null, WhoHere: ReadWhoHere(key), Pick: PickerFor(windowId, key))); - } - else if (panelId == PanelIds.QuickBar) - { - overlays.Add(new PanelOverlay( - panelId, windowId, rect, PanelListInk(), null, QuickBar: QuickBarEntries(key), Pick: PickerFor(windowId, key), - Dispatch: _panelDispatch ??= id => OnUiThread(() => DispatchCommand(id)))); - } - else if (panelId == PanelIds.Composer && NativeComposerHost is not null - && _dockedComposers.TryGetValue(windowId, out var docked) && docked.Model is { } composer) + /// + /// What a host is told about the panel drawn in : its model, its colours and its actions, + /// over (a pane's output rectangle, or empty for a panel floating in a window of its own). + /// Null for a window that is no native panel, or one with nothing to draw yet. One function for a docked panel and a + /// floating one, so the two are handed the same model and the same callbacks. A docked panel that can float also + /// carries its pop-out callback, where the host can float one. + /// + private PanelOverlay? OverlayFor(string windowId, Core.Workspaces.PaneRect rect, bool docked) + { + var popOut = docked ? PopOuterFor(windowId) : null; + if (IsMapWindow(windowId)) + { + if (MapViewFor(windowId) is not { } view) { - // Only to a host with its own editor: the cells stay underneath it, and the editor is kept to them. - overlays.Add(new PanelOverlay( - panelId, windowId, rect, ComposerInk(), null, Composer: composer, ComposerSession: DockedSessionFor(docked))); + return null; } + + var walker = _mapWalkers.TryGetValue(windowId, out var known) + ? known + : _mapWalkers[windowId] = room => OnUiThread(() => WalkFromMap(windowId, room)); + return new PanelOverlay( + PanelIds.Map, windowId, rect, new PanelInk(_ink.Accent, _ink.Draft, _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))), null, view, walker, + PopOut: popOut); } - if (overlays.SequenceEqual(_panelOverlays)) + if (!TerminalPanels.TryParseWindowId(windowId, out var panelId, out var key)) { - return; + return null; } - _panelOverlays = overlays; - _pointer.Panels(overlays); + if (panelId == PanelIds.Vitals) + { + var ink = VitalsInk(); + return new PanelOverlay(panelId, windowId, rect, new PanelInk(ink.Bar, ink.Low, ink.Empty), ReadVitals(key), PopOut: popOut); + } + + if (panelId == PanelIds.WhoHere) + { + return new PanelOverlay( + panelId, windowId, rect, PanelListInk(), null, WhoHere: ReadWhoHere(key), Pick: PickerFor(windowId, key), PopOut: popOut); + } + + if (panelId == PanelIds.QuickBar) + { + return new PanelOverlay( + panelId, windowId, rect, PanelListInk(), null, QuickBar: QuickBarEntries(key), Pick: PickerFor(windowId, key), + Dispatch: _panelDispatch ??= id => OnUiThread(() => DispatchCommand(id)), PopOut: popOut); + } + + if (docked && panelId == PanelIds.Composer && NativeComposerHost is not null + && _dockedComposers.TryGetValue(windowId, out var docked2) && docked2.Model is { } composer) + { + // Only to a host with its own editor: the cells stay underneath it, and the editor is kept to them. + return new PanelOverlay( + panelId, windowId, rect, ComposerInk(), null, Composer: composer, ComposerSession: DockedSessionFor(docked2)); + } + + return null; } /// The list panels' colours: the accent their cells draw an active dot and a key in, and the warning. @@ -278,7 +295,8 @@ private Action PickerFor(string windowId, string sessionKey) => private void PickFromPanel(string windowId, string sessionKey, int index) { - var published = _panelOverlays.FirstOrDefault(p => p.WindowId == windowId); + var published = _panelOverlays.FirstOrDefault(p => p.WindowId == windowId) + ?? _floatingPublished.FirstOrDefault(f => f.Content.WindowId == windowId)?.Content; if (published?.WhoHere is { } who && index >= 0 && index < who.Rows.Count) { OfferLook(windowId, sessionKey, who.Rows[index].Name); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Floating.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Floating.cs new file mode 100644 index 00000000..695c1501 --- /dev/null +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Floating.cs @@ -0,0 +1,473 @@ +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// The host's half of a floating panel: it draws each panel the client says is popped out in a window of its own, and +/// hands back where the player put it and when they closed it. A member of , null for a host +/// that cannot float a panel. Called on the client's thread; a host that draws on another thread marshals itself. +/// +internal interface IFloatingPanels +{ + /// + /// Every panel popped out now, whenever one appears, goes, moves or changes what it shows. A panel missing from the + /// list is docked (or its character is gone): its window closes without docking anything. + /// + void Show(IReadOnlyList panels); +} + +/// One panel in a window of its own, for . +/// The window: which panel, whose, and where it sits (the floating-panel surface's model). +/// +/// What the panel shows and does, exactly as a docked one is handed it (, with an empty +/// rectangle): the same model its cells draw and the same callbacks, so a walk, a look or a quick key from the floating +/// window runs the same client method on the panel's own character. +/// +/// The panel's plane, #rrggbb: its character's pane colour on the client's theme. +/// The theme's text colour, #rrggbb. +/// Where the player moved or sized the window to, in screen pixels. Any thread; one instance. +/// Docks the panel back (what closing the window does). Any thread; one instance. +internal sealed record FloatingPanel( + FloatingPanelModel Model, + PanelOverlay Content, + string Plane, + string Text, + Action Moved, + Action Dock); + +/// +/// Panels popped out into windows of their own: the map on a second monitor, vitals floating beside the game. +/// +/// Floating is a fact about the panel's window (), so it is saved with the +/// workspace and means the same to every host: a host that can float () keeps +/// such a window out of the pane tree and draws it apart; a host that cannot keeps it in a pane and leaves the flag for +/// the next host that can. A layout says the same thing per panel (). +/// +/// +/// The pane it leaves goes back into the layout, through the workspace's own operations. While the live layout +/// still owns the panes, popping out re-realises it with the panel's windows withheld, so the panes are exactly the +/// layout without that panel — the same rectangles, and so the same NAWS, as a layout that never placed it. Otherwise +/// the window is removed from its pane (), which prunes a pane it emptied. +/// Docking is the same re-realisation with the windows returned, or the window put back in the pane it left. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// A floating panel named by a layout whose window does not exist yet (a map before its first room). + private readonly record struct PendingFloat(string SessionKey, string PanelId, FloatingBounds Bounds); + + private readonly Dictionary _floatPending = new(StringComparer.Ordinal); + + /// Where each panel window last floated, so popping it out again puts it back there. + private readonly Dictionary _floatRemembered = new(StringComparer.Ordinal); + + /// The pane each floating window left, for a dock with no live layout to put it back by. + private readonly Dictionary _floatOrigin = new(StringComparer.Ordinal); + + private readonly Dictionary _popOuters = new(StringComparer.Ordinal); + private readonly Dictionary _dockers = new(StringComparer.Ordinal); + private readonly Dictionary> _movers = new(StringComparer.Ordinal); + + private IReadOnlyList _floatingPublished = Array.Empty(); + private bool _publishingFloating; + + /// Whether this host can put a panel in a window of its own. + internal bool CanFloatPanels => Host.FloatingPanels is not null; + + /// What the floating host was last told. Internal for tests. + internal IReadOnlyList FloatingPublished => _floatingPublished; + + /// The panel a window draws, when it is one that can float; else null. + private static string? FloatablePanelOf(string windowId) + { + if (IsMapWindow(windowId)) + { + return PanelIds.Map; + } + + return TerminalPanels.TryParseWindowId(windowId, out var panel, out _) && PanelFloatCommands.Floatable.Contains(panel) + ? panel + : null; + } + + /// The window that draws a floatable panel for a character, or null for a panel that cannot float. + private static string? FloatWindowId(string panelId, string sessionKey) => + panelId == PanelIds.Map ? MapWindowId(sessionKey) + : PanelFloatCommands.Floatable.Contains(panelId) ? TerminalPanels.WindowId(panelId, sessionKey) + : null; + + /// Whether a window is popped out here: floating, and in a host that floats. Internal for tests. + internal bool IsFloating(string windowId) => CanFloatPanels && _workspace.FindWindow(windowId)?.Floating is not null; + + /// A docked panel's pop-out callback, where this host can float it; one instance per window. + private Action? PopOuterFor(string windowId) + { + if (!CanFloatPanels || FloatablePanelOf(windowId) is null) + { + return null; + } + + return _popOuters.TryGetValue(windowId, out var known) + ? known + : _popOuters[windowId] = () => OnUiThread(() => PopOutPanel(windowId)); + } + + /// Who a character is, for a window title and a ⌃P detail. + private string CharacterLabel(string sessionKey) => + FindSession(sessionKey)?.Character?.Name ?? FindCharacter(sessionKey)?.Character.Name ?? Snippet(sessionKey); + + /// Every panel window that can pop out or dock back, for ⌃P; null where this host cannot float. + private IReadOnlyList? FloatRefs() + { + if (!CanFloatPanels) + { + return null; + } + + return _workspace.Windows + .Where(w => w.SessionKey is not null && FloatablePanelOf(w.Id) is not null + && (w.Floating is not null || _workspace.Layout.FindWindow(w.Id) is not null)) + .OrderBy(w => w.Sequence) + .Select(w => new Core.Commands.PanelFloatRef( + w.Id, PanelTitle(FloatablePanelOf(w.Id)!), CharacterLabel(w.SessionKey!), w.Floating is not null)) + .ToList(); + } + + /// + /// Pops the panel drawn in out into a window of its own: the button on its native view, + /// its pane's right-click menu and ⌃P's panel:popout: all end here. Refused where the host cannot float, for a + /// window that is no floatable panel, and for the last window the panes hold. Internal so a test drives it as the + /// window does. + /// + internal bool PopOutPanel(string windowId) + { + if (!CanFloatPanels) + { + RefuseCommand("this client draws every panel in its pane — pop out is the desktop window's"); + return false; + } + + if (FloatablePanelOf(windowId) is not { } panelId || _workspace.FindWindow(windowId) is not { SessionKey: { } key } window) + { + RefuseCommand($"{Snippet(windowId)} is not a panel that can pop out"); + return false; + } + + if (window.Floating is not null) + { + RefuseCommand($"{PanelTitle(panelId)} is already in a window of its own"); + return false; + } + + if (_workspace.Layout.Root.Panes().Sum(p => p.Tabs.Count) <= 1) + { + RefuseCommand($"{PanelTitle(panelId)} is the only window here — it has nowhere to leave from"); + return false; + } + + var focus = ActiveWindowId(); + if (_workspace.Layout.FindWindow(windowId) is { } pane) + { + _floatOrigin[windowId] = pane.Id; + } + + window.Floating = _floatRemembered.GetValueOrDefault(windowId) + ?? LiveLayoutPlacement(key, panelId)?.Floating + ?? FloatingBounds.Unplaced; + if (!RearrangeLiveLayout(key, focus == windowId ? null : focus)) + { + _workspace.Layout.RemoveWindow(windowId); + RebuildPaneArea(); + Activate(focus != windowId && _workspace.Layout.FindWindow(focus) is not null ? focus : OutputWindowOf(key) ?? ActiveWindowId()); + } + + RefreshRail(); + PublishFloating(); + Notice($"{PanelTitle(panelId)} is in a window of its own — close it to dock it back", MessageSeverity.Info, "⌃P"); + return true; + } + + /// + /// Docks a floating panel back into its region — the floating window's Dock button, closing that window, and ⌃P's + /// panel:dock: all end here. With the live layout still owning the panes it is re-realised with the panel's + /// windows returned, so the panel is back exactly where the layout places it; otherwise it goes back into the pane it + /// left, or the focused one. Internal so a test drives it as the window does. + /// + internal bool DockPanel(string windowId) + { + if (_workspace.FindWindow(windowId) is not { Floating: { } bounds, SessionKey: { } key } window) + { + RefuseCommand($"{Snippet(windowId)} is not in a window of its own"); + return false; + } + + if (bounds.IsPlaced) + { + _floatRemembered[windowId] = bounds; + } + + window.Floating = null; + _floatPending.Remove(windowId); + if (!RearrangeLiveLayout(key, ActiveWindowId()) || _workspace.Layout.FindWindow(windowId) is null) + { + var origin = _floatOrigin.GetValueOrDefault(windowId); + _workspace.Layout.AddWindow(windowId, origin is not null && _workspace.Layout.FindPane(origin) is not null ? origin : null); + RebuildPaneArea(); + } + + _floatOrigin.Remove(windowId); + RefreshRail(); + PublishFloating(); + Notice($"{PanelTitle(FloatablePanelOf(windowId) ?? windowId)} docked back", MessageSeverity.Info, "⌃P"); + return true; + } + + /// The player moved or sized a floating panel's window. Remembered on the window, so the workspace and a saved layout keep it. + private void MoveFloatingPanel(string windowId, FloatingBounds bounds) + { + if (!bounds.IsPlaced || _workspace.FindWindow(windowId) is not { Floating: not null } window || window.Floating == bounds) + { + return; + } + + window.Floating = bounds; + _floatRemembered[windowId] = bounds; + PublishFloating(); + } + + /// A floating panel window moved, as the host reports it. Internal so a test drives it as the window does. + internal void SimulateFloatingMoved(string windowId, FloatingBounds bounds) => MoveFloatingPanel(windowId, bounds); + + /// The live layout's placement of a panel, when 's layout owns the panes. + private PanelPlacement? LiveLayoutPlacement(string key, string panelId) => + _liveLayout is { } live && string.Equals(live.SessionKey, key, StringComparison.Ordinal) + ? Layouts.Find(live.LayoutId)?.PlacementOf(panelId) + : null; + + /// + /// Re-realises the live layout after a panel popped out or docked, when it is 's and the panes + /// are still its own; false when there is none to follow (the player has rearranged the panes, or no layout applies). + /// + private bool RearrangeLiveLayout(string key, string? focus) + { + if (_liveLayout is not { } live + || !string.Equals(live.SessionKey, key, StringComparison.Ordinal) + || _workspace.Layout.ZoomedPaneId is not null + || !string.Equals(LayoutRealiser.TreeShape(_workspace.Layout.Root), live.TreeShape, StringComparison.Ordinal) + || Layouts.Find(live.LayoutId) is not { } layout) + { + return false; + } + + return ApplyLayout(key, layout, focus, adoptFloating: false); + } + + /// + /// The windows that draw in panes, for the realiser: , less a + /// panel window that floats here — taken out of whatever pane it was put in on the way, so the pane it held is + /// dropped and its split collapsed. + /// + private IReadOnlyList DockedWindows(string key, string panel) + { + var windows = PanelWindows(key, panel); + if (!CanFloatPanels || FloatWindowId(panel, key) is not { } floatId || !windows.Contains(floatId)) + { + return windows; + } + + var window = _workspace.FindWindow(floatId); + if (window is not null && _floatPending.Remove(floatId, out var pending)) + { + window.Floating = pending.Bounds; + } + + if (window?.Floating is null) + { + return windows; + } + + _workspace.Layout.RemoveWindow(floatId); + return windows.Where(w => w != floatId).ToList(); + } + + /// Whether a window is kept out of the panes because it floats here. + private bool FloatsHere(string windowId) => CanFloatPanels && _workspace.FindWindow(windowId)?.Floating is not null; + + /// + /// An explicit apply takes the layout's floating panels as they are saved: each it floats floats (at its saved place + /// when it has one), each it places docked is docked. Panels the layout does not place keep what they have. + /// + private void AdoptFloating(string key, LayoutDefinition layout) + { + foreach (var placement in layout.KnownPlacements) + { + if (FloatWindowId(placement.PanelId, key) is not { } id) + { + continue; + } + + var window = _workspace.FindWindow(id); + if (placement.Floating is { } bounds) + { + if (window is null) + { + _floatPending[id] = new PendingFloat(key, placement.PanelId, bounds); + } + else + { + window.Floating = bounds.IsPlaced ? bounds : window.Floating ?? _floatRemembered.GetValueOrDefault(id) ?? bounds; + } + } + else + { + _floatPending.Remove(id); + if (window?.Floating is { } was) + { + if (was.IsPlaced) + { + _floatRemembered[id] = was; + } + + window.Floating = null; + } + } + } + } + + /// A character's floating panels, by panel id, with where each sits: what "save changes" captures. + private Dictionary FloatingPanelsOf(string key) + { + var floating = new Dictionary(StringComparer.Ordinal); + foreach (var window in _workspace.Windows) + { + if (window.Floating is { } bounds && string.Equals(window.SessionKey, key, StringComparison.Ordinal) + && FloatablePanelOf(window.Id) is { } panel) + { + floating[panel] = bounds; + } + } + + foreach (var pending in _floatPending.Values.Where(p => string.Equals(p.SessionKey, key, StringComparison.Ordinal))) + { + floating.TryAdd(pending.PanelId, pending.Bounds); + } + + return floating; + } + + /// + /// A workspace resumed from the last run, by either host: where this host floats, a floating window comes out of the + /// pane a host that cannot float kept it in; where it cannot, a floating window no pane holds is put back in one, and + /// keeps its flag for the next host that can. + /// + private void SettleRestoredFloating() + { + foreach (var window in _workspace.Windows.Where(w => w.Floating is not null).OrderBy(w => w.Sequence).ToList()) + { + if (FloatablePanelOf(window.Id) is null) + { + window.Floating = null; + continue; + } + + var placed = _workspace.Layout.FindWindow(window.Id) is not null; + if (CanFloatPanels && placed && _workspace.Layout.Root.Panes().Sum(p => p.Tabs.Count) > 1) + { + _workspace.Layout.RemoveWindow(window.Id); + } + else if (!CanFloatPanels && !placed) + { + _workspace.Layout.AddWindow(window.Id, activate: false); + } + } + } + + /// + /// Tells the floating host which panels are popped out and what each shows, when any of that changed: on the frame + /// (' reason), when a panel's content is redrawn, and after a pop-out or a dock. + /// + private void PublishFloating() + { + if (Host.FloatingPanels is not { } host || _publishingFloating) + { + return; + } + + _publishingFloating = true; + try + { + var panels = new List(); + foreach (var window in _workspace.Windows.Where(w => w.Floating is not null && w.SessionKey is not null).OrderBy(w => w.Sequence).ToList()) + { + if (FloatablePanelOf(window.Id) is not { } panelId) + { + continue; + } + + var key = window.SessionKey!; + EnsureFloatingControl(window.Id, panelId, key); + if (OverlayFor(window.Id, default, docked: false) is not { } content) + { + continue; + } + + var id = window.Id; + var model = Drawing( + SurfaceCatalog.FloatingPanel, id, new FloatingPanelModel(id, panelId, PanelTitle(panelId), CharacterLabel(key), window.Floating!)); + panels.Add(new FloatingPanel( + model, + content, + WorkspacePalette.Tint(_theme, TintOf(key)).ToHex(), + Hex(_theme.Resolve(Core.Text.TerminalColor.Default, isBackground: false)), + _movers.TryGetValue(id, out var mover) ? mover : _movers[id] = bounds => OnUiThread(() => MoveFloatingPanel(id, bounds)), + _dockers.TryGetValue(id, out var docker) ? docker : _dockers[id] = () => OnUiThread(() => DockPanel(id)))); + } + + if (panels.SequenceEqual(_floatingPublished)) + { + return; + } + + _floatingPublished = panels; + host.Show(panels); + } + finally + { + _publishingFloating = false; + } + } + + /// + /// A floating panel's content is drawn from the same control its pane would hold, which redraws it as its data + /// changes; one that has never been in a pane (a layout that floats it from the start) has its control made here. + /// + private void EnsureFloatingControl(string windowId, string panelId, string key) + { + if (panelId == PanelIds.Map) + { + if (!_mapControls.ContainsKey(windowId)) + { + MapControlFor(windowId); + RenderMap(windowId); + } + + return; + } + + Panels.GetOrCreate(new TerminalPanelContext(panelId, key, FindSession(key), windowId)); + } + + /// A panel's content changed: a floating one is told, since no frame may be painted for it. + private void NoteFloatingContent(string windowId) + { + if (CanFloatPanels && _workspace.FindWindow(windowId)?.Floating is not null) + { + PublishFloating(); + } + } +} diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index c76b56c9..bbf438e0 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -574,6 +574,7 @@ internal IReadOnlyList PointerMenu(System.Drawing.Point point) } AddCommands(items, "layout:next-tab", null, "layout:split-right", "layout:split-down", "layout:zoom", "layout:unzoom", "layout:close"); + AddPopOut(items); break; case PointerKind.Link: @@ -595,6 +596,7 @@ internal IReadOnlyList PointerMenu(System.Drawing.Point point) "term:copy", "term:trigger-from-selection", null, "layout:split-right", "layout:split-down", "layout:zoom", "layout:unzoom", "layout:close", null, "term:freeze", "term:unfreeze", "term:scroll-live", "term:clear", "term:timestamps-on", "term:timestamps-off"); + AddPopOut(items); break; case PointerKind.CommandLine: @@ -670,6 +672,19 @@ private void AddLinkItems(List items, PointerTarget target) } } + /// + /// The focused pane's front window, popped out into a window of its own — when it is a panel that can float and the + /// host can float it (the entry is ⌃P's, which lists it only then), after a rule. + /// + private void AddPopOut(List items) + { + var front = ActiveWindowId(); + if (FloatablePanelOf(front) is not null) + { + AddCommands(items, null, SharpMUTerm.Client.Panels.PanelFloatCommands.PopOut(front)); + } + } + /// Adds the ⌃P entries with these ids that the surface lists right now, in this order; null is a rule. private void AddCommands(List items, params string?[] ids) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs index eb8b25aa..59445535 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -157,6 +157,12 @@ private string EnsurePanelWindow(string panelId, string key) return null; } + // Asked for in a pane: a panel floating in a window of its own docks back first. + if (IsFloating(TerminalPanels.WindowId(panelId, sessionKey))) + { + DockPanel(TerminalPanels.WindowId(panelId, sessionKey)); + } + var id = EnsurePanelWindow(panelId, sessionKey); RebuildPaneArea(); return id; @@ -250,18 +256,30 @@ internal ResolvedLayout ResolveLayout(string key) /// other window kept, the session's own window focused — or , when a re-fold must /// not move the reader. False when the session has no window to arrange around. /// - internal bool ApplyLayout(string key, LayoutDefinition layout, string? focusWindow = null) + /// + /// Whether the layout's floating panels are taken as saved (): true for an explicit apply, + /// false for a re-fold, a pop-out or a dock, which keep the panels floating as they are now. + /// + internal bool ApplyLayout(string key, LayoutDefinition layout, string? focusWindow = null, bool adoptFloating = true) { if (OutputWindowOf(key) is not { } output) { return false; } + if (CanFloatPanels && adoptFloating) + { + AdoptFloating(key, layout); + } + + // A floating panel is folded into its region like any other; its windows are withheld here (DockedWindows) and + // never kept, so the pane it would have had is dropped and the panes are the layout without it. var fold = LayoutFold.Fold(layout, LayoutAvailability(key)); var keep = _workspace.Layout.Root.Panes() .SelectMany(p => p.Tabs.Select(t => (t, (string?)p.Id))) + .Where(k => !FloatsHere(k.t)) .ToList(); - if (LayoutRealiser.Realise(layout, fold, panel => PanelWindows(key, panel), output, keep) is not { } realised) + if (LayoutRealiser.Realise(layout, fold, panel => DockedWindows(key, panel), output, keep) is not { } realised) { return false; } @@ -273,6 +291,7 @@ internal bool ApplyLayout(string key, LayoutDefinition layout, string? focusWind var focus = focusWindow is not null && _workspace.Layout.FindWindow(focusWindow) is not null ? focusWindow : output; Activate(focus); RefreshRail(); + PublishFloating(); return true; } @@ -338,7 +357,7 @@ internal void RefoldLayout() return; } - ApplyLayout(live.SessionKey, layout, ActiveWindowId()); + ApplyLayout(live.SessionKey, layout, ActiveWindowId(), adoptFloating: false); } /// @@ -756,7 +775,8 @@ private void ReapplyIfResolvedChanged(string key) /// The current arrangement, read back as 's placements. private CapturedLayout? CaptureArrangement(string key, LayoutDefinition? previous) => - LayoutCapture.Capture(_workspace.Layout.Root, window => PanelOf(key, window), previous); + LayoutCapture.Capture( + _workspace.Layout.Root, window => PanelOf(key, window), previous, CanFloatPanels ? FloatingPanelsOf(key) : null); /// What one of the list's actions did: whether it did it, and the line that says so. private readonly record struct LayoutActionResult(bool Done, string Status); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index 99d4bcee..7d9828f2 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -596,6 +596,9 @@ private sealed class PanelView(string windowId, MarkupControl control, Func? Click { get; set; } + /// Told after every redraw, so a panel floating in a window of its own is republished with it. + internal Action? Refreshed { get; init; } + internal List Markup { get; private set; } = []; internal void Refresh() @@ -603,6 +606,7 @@ internal void Refresh() Size = box(WindowId); Markup = render(Size.Width, Size.Height); Control.SetContent(Markup.ToList()); + Refreshed?.Invoke(WindowId); } } @@ -613,7 +617,7 @@ private PanelView NewPanelView(TerminalPanelContext context, Func view.Click?.Invoke(e.Url); _panelViews[context.WindowId] = view; view.Refresh(); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 103ff25a..944756b1 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -788,6 +788,7 @@ public SharpMUTermApp( // otherwise start with a single main window. Real startup and the demo share this path. _workspace = ResumeOrNew(config); NoteRestoredOwners(); + SettleRestoredFloating(); RegisterTerminalPanels(); AnnounceHeaderActions(); @@ -1013,6 +1014,7 @@ public SharpMUTermApp( DrawSixelOverlay(buffer); PublishScrollbars(); PublishPanels(); + PublishFloating(); PublishChrome(); SyncMapSizes(); SyncPanelSizes(); @@ -8100,6 +8102,13 @@ private IReadOnlyList BuildRailWindows( continue; } + // Nor is a panel popped out into a window of its own: it is not in a pane to go to (it would read + // "closed"), and its own window is on screen with the way back on it. + if (FloatsHere(window.Id)) + { + continue; + } + windows.Add(new RailWindow( RailWindowLabel(window, mine), window.Id, @@ -8276,7 +8285,8 @@ private CommandContext CommandState() Sound: CanPlaySound ? !_muted : null, Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId()), OutputSelected: HasOutputSelection, - KeyClashes: KeyClashes.Count(Host.Keys, Macros())); + KeyClashes: KeyClashes.Count(Host.Keys, Macros()), + Floats: FloatRefs()); } /// @@ -8547,6 +8557,17 @@ private bool RunBuiltInCommand(string id) return true; } + // Before the panels' own prefix, which they share: panel:popout: and panel:dock:. + if (id.StartsWith(SharpMUTerm.Client.Panels.PanelFloatCommands.PopOutPrefix, StringComparison.Ordinal)) + { + return PopOutPanel(id[SharpMUTerm.Client.Panels.PanelFloatCommands.PopOutPrefix.Length..]); + } + + if (id.StartsWith(SharpMUTerm.Client.Panels.PanelFloatCommands.DockPrefix, StringComparison.Ordinal)) + { + return DockPanel(id[SharpMUTerm.Client.Panels.PanelFloatCommands.DockPrefix.Length..]); + } + if (id.StartsWith(PanelCommandPrefix, StringComparison.Ordinal)) { ShowPanel(id[PanelCommandPrefix.Length..]); @@ -8997,6 +9018,10 @@ private void ShowMap() _workspace.OpenWindow(windowId, "Map", WindowKind.Auxiliary, key); RebuildPaneArea(); } + else if (IsFloating(windowId)) + { + DockPanel(windowId); // asked for in a pane: a map in a window of its own docks back + } Activate(windowId); RenderMap(windowId); @@ -9080,6 +9105,7 @@ private void RenderMap(string windowId) var lines = MapRenderer.Render(view, map.Map, width, height, ink); _mapMarkup[windowId] = lines; control.SetContent(lines.ToList()); + NoteFloatingContent(windowId); } /// What a map window was last drawn as, for a test to read. @@ -12559,6 +12585,14 @@ internal IReadOnlyDictionary PaneWindows() internal IReadOnlyDictionary PaneOutputRects() { var rects = new Dictionary(StringComparer.Ordinal); + + // A resumed workspace builds its panel and map panes in the constructor, before the main window exists to + // measure them in: nothing is arranged yet, and each falls back to its default box until the first frame. + if (_window is null) + { + return rects; + } + foreach (var (paneId, tabs, rect) in RealisedPanes()) { var margin = tabs.Margin; diff --git a/tests/SharpMUTerm.Avalonia.Tests/FloatingPanelTests.cs b/tests/SharpMUTerm.Avalonia.Tests/FloatingPanelTests.cs new file mode 100644 index 00000000..f64ec633 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/FloatingPanelTests.cs @@ -0,0 +1,372 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; +using SharpMUTerm.Tui.Panels; +using SkiaSharp; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// Panels popped out into windows of their own (, the client's +/// SharpMUTermApp.Floating.cs): the pane a panel leaves goes back into the layout and costs no cell, the +/// floating window runs the same client methods as the docked view, a remembered place is clamped to the screens there +/// are, the window never takes the keyboard and hands keys to the command line, and a host that cannot float keeps the +/// panel in its region. +/// +public class FloatingPanelTests +{ + private static readonly SKColor Back = new(0x10, 0x20, 0x30); + + // ── The client's half ──────────────────────────────────────────────────────────────────────── + + [Test] + public async Task PoppingOutTakesThePanelOutOfThePanesAndDockingPutsItBack() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = DesktopLayerTests.InlineWindowApp(driver); + app.RenderSnapshot("layout-combat"); + var vitals = Panel(driver, PanelIds.Vitals).WindowId; + var before = Rects(app); + await Assert.That(Panel(driver, PanelIds.Vitals).PopOut is not null).IsTrue().Because("the window can float vitals, so its view offers it"); + + await Assert.That(app.PopOutPanel(vitals)).IsTrue(); + app.RenderWholeFrame(); + await Assert.That(app.IsFloating(vitals)).IsTrue(); + await Assert.That(Tabs(app)).DoesNotContain(vitals).Because("no pane holds a floating panel"); + await Assert.That(driver.Floating.Panels.Select(p => p.Model.WindowId)).IsEquivalentTo(new[] { vitals }); + await Assert.That(driver.Floating.Panels[0].Model.Title).IsEqualTo("Vitals"); + await Assert.That(driver.Pointer.Panels.Any(p => p.WindowId == vitals)).IsFalse().Because("nothing is drawn over a pane it left"); + await Assert.That(app.PopOutPanel(vitals)).IsFalse().Because("it is already out"); + + // ⌃P offers the way back, and not the way out, while it floats. + var catalog = app.BuildCatalog().Select(i => i.Id).ToArray(); + await Assert.That(catalog).Contains(PanelFloatCommands.Dock(vitals)); + await Assert.That(catalog).DoesNotContain(PanelFloatCommands.PopOut(vitals)); + + await Assert.That(app.DispatchCommand(PanelFloatCommands.Dock(vitals))).IsTrue(); + app.RenderWholeFrame(); + await Assert.That(app.IsFloating(vitals)).IsFalse(); + await Assert.That(driver.Floating.Panels).IsEmpty(); + await Assert.That(Rects(app)).IsEquivalentTo(before).Because("docking back puts the panel exactly where the layout places it"); + await Assert.That(app.BuildCatalog().Select(i => i.Id)).Contains(PanelFloatCommands.PopOut(vitals)); + } + + [Test] + public async Task APoppedOutPanelLeavesThePanesALayoutWithoutItWouldHave() + { + using var floatingDriver = new AvaloniaConsoleDriver(140, 36); + await using var floated = DesktopLayerTests.InlineWindowApp(floatingDriver); + floated.RenderSnapshot("layout-combat"); + var vitals = Panel(floatingDriver, PanelIds.Vitals).WindowId; + await Assert.That(floated.PopOutPanel(vitals)).IsTrue(); + floated.RenderWholeFrame(); + + // The same scene, with the vitals window closed and Combat applied less its vitals placement. + using var plainDriver = new AvaloniaConsoleDriver(140, 36); + await using var plain = DesktopLayerTests.InlineWindowApp(plainDriver); + plain.RenderSnapshot("layout-combat"); + plain.SimulateWindowChange(vitals); + await Assert.That(plain.DispatchCommand("layout:close")).IsTrue(); + var without = BuiltInLayouts.Combat with + { + Placements = BuiltInLayouts.Combat.Placements.Where(p => p.PanelId != PanelIds.Vitals).ToList(), + }; + await Assert.That(plain.ApplyLayout(DemoScene.ActiveSessionKey, without)).IsTrue(); + plain.RenderWholeFrame(); + + await Assert.That(Rects(floated)).IsEquivalentTo(Rects(plain)).Because("no cell is spent on a panel that floats"); + + // NAWS is the session window's pane rectangle (ReportPaneSizes): the same in both. + var output = Rects(plain).Keys.Single(k => !k.StartsWith("panel:", StringComparison.Ordinal) && !k.StartsWith("map:", StringComparison.Ordinal) && Rects(plain)[k].Width > 60); + await Assert.That(Rects(floated)[output]).IsEqualTo(Rects(plain)[output]); + } + + [Test] + public async Task TheFloatingPanelRunsTheSameClientMethodsAsTheDockedOne() + { + // The map: a room walked to from the floating window and the same room's cell link in a docked map. + using var aDriver = new AvaloniaConsoleDriver(140, 36); + await using var a = DesktopLayerTests.InlineWindowApp(aDriver); + a.RenderSnapshot("layout-combat"); + var map = Panel(aDriver, PanelIds.Map); + var room = map.Map!.Rooms.First(r => !r.Current && r.Id != map.Map.AnchorId).Id; + await Assert.That(a.PopOutPanel(map.WindowId)).IsTrue(); + var floatingMap = aDriver.Floating.Panels.Single().Content; + await Assert.That(floatingMap.WalkTo).IsSameReferenceAs(map.WalkTo).Because("one walk callback per window, docked or floating"); + floatingMap.WalkTo!(room); + + using var bDriver = new AvaloniaConsoleDriver(140, 36); + await using var b = DesktopLayerTests.InlineWindowApp(bDriver); + b.RenderSnapshot("layout-combat"); + b.SimulateMapClick(map.WindowId, MapRenderer.LinkPrefix + room); + await Assert.That(a.WalkState).IsNotEqualTo(string.Empty); + await Assert.That(a.WalkState).IsEqualTo(b.WalkState); + + // The quick bar: its first key, from the floating window and from the docked cells. + var quick = Panel(aDriver, PanelIds.QuickBar); + await Assert.That(a.PopOutPanel(quick.WindowId)).IsTrue(); + var floatingQuick = aDriver.Floating.Panels.Single(p => p.Model.PanelId == PanelIds.QuickBar).Content; + await Assert.That(floatingQuick.QuickBar).IsEqualTo(quick.QuickBar); + floatingQuick.Pick!(0); + b.SimulatePanelClick(quick.WindowId, QuickBarRenderer.LinkPrefix + "0"); + // The demo has no session, so both end in the same refusal, on the panel's own character. + await Assert.That(a.LastNotice).IsNotNull(); + await Assert.That(a.LastNotice).IsEqualTo(b.LastNotice); + await Assert.That(a.LastQuickMacro).IsEqualTo(b.LastQuickMacro); + } + + [Test] + public async Task APopOutIsOfferedOnThePanesMenuAndRemembersWhereItWasMoved() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = DesktopLayerTests.InlineWindowApp(driver); + app.RenderSnapshot("layout-combat"); + var map = Panel(driver, PanelIds.Map); + app.SimulateWindowChange(map.WindowId); + var at = new System.Drawing.Point(map.Rect.X + (map.Rect.Width / 2), map.Rect.Y + (map.Rect.Height / 2)); + var entry = app.PointerMenu(at).SingleOrDefault(i => i.Label.StartsWith("Pop out", StringComparison.Ordinal)); + await Assert.That(entry).IsNotNull().Because("the pane's menu offers the pop out"); + entry!.Run(); + await Assert.That(app.IsFloating(map.WindowId)).IsTrue(); + + // Where the player puts it is remembered on the window (and so the workspace), and by "save changes". + var moved = new FloatingBounds(1200, 90, 420, 400); + driver.Floating.Panels.Single().Moved(moved); + await Assert.That(driver.Floating.Panels.Single().Model.Bounds).IsEqualTo(moved); + var saved = app.CaptureSession().Windows.Single(w => w.Id == map.WindowId); + await Assert.That(saved.Floating).IsEqualTo(moved); + await Assert.That(app.DispatchCommand(LayoutCommands.SaveAsNew)).IsTrue(); + var layout = app.Layouts.All.Single(l => !l.IsBuiltIn); + await Assert.That(layout.PlacementOf(PanelIds.Map)!.Floating).IsEqualTo(moved); + + // Docked and popped out again, it goes back where it was. + await Assert.That(app.DockPanel(map.WindowId)).IsTrue(); + await Assert.That(app.PopOutPanel(map.WindowId)).IsTrue(); + await Assert.That(driver.Floating.Panels.Single().Model.Bounds).IsEqualTo(moved); + + // Applying the saved layout floats it at its saved place; applying Combat docks it. + await Assert.That(app.DispatchCommand(LayoutCommands.Apply(BuiltInLayouts.CombatId))).IsTrue(); + await Assert.That(app.IsFloating(map.WindowId)).IsFalse(); + await Assert.That(app.DispatchCommand(LayoutCommands.Apply(layout.Id))).IsTrue(); + await Assert.That(app.IsFloating(map.WindowId)).IsTrue(); + await Assert.That(driver.Floating.Panels.Single().Model.Bounds).IsEqualTo(moved); + } + + // ── A host that cannot float ───────────────────────────────────────────────────────────────── + + [Test] + public async Task TheTerminalKeepsAFloatingPanelInItsRegionAndOffersNoPopOut() + { + // A workspace saved by the window with vitals floating, resumed by the terminal. + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var window = DesktopLayerTests.InlineWindowApp(driver); + window.RenderSnapshot("layout-combat"); + var vitals = Panel(driver, PanelIds.Vitals).WindowId; + await Assert.That(window.PopOutPanel(vitals)).IsTrue(); + var state = window.CaptureSession(); + await Assert.That(state.Windows.Single(w => w.Id == vitals).Floating).IsNotNull(); + + var config = DemoScene.Build(); + config.LastSession = state; + using var headless = new HeadlessConsoleDriver(140, 36); + await using var terminal = new SharpMUTermApp(config, ClientHost.Headless(headless, WindowOptions.Capabilities)); + terminal.RenderWholeFrame(); + + await Assert.That(terminal.CanFloatPanels).IsFalse(); + await Assert.That(Tabs(terminal)).Contains(vitals).Because("the terminal draws every panel in its pane"); + await Assert.That(terminal.IsFloating(vitals)).IsFalse(); + await Assert.That(terminal.CaptureSession().Windows.Single(w => w.Id == vitals).Floating).IsNotNull() + .Because("the flag is kept for the next host that can float"); + await Assert.That(terminal.BuildCatalog().Any(i => i.Id.StartsWith(PanelFloatCommands.PopOutPrefix, StringComparison.Ordinal) + || i.Id.StartsWith(PanelFloatCommands.DockPrefix, StringComparison.Ordinal))).IsFalse(); + await Assert.That(terminal.DispatchCommand(PanelFloatCommands.PopOut(vitals))).IsFalse(); + + // A layout that floats a panel is folded the same as one that does not, in the terminal. + using var other = new HeadlessConsoleDriver(140, 36); + await using var plain = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(other, WindowOptions.Capabilities)); + plain.RenderSnapshot("layout-combat"); + var floats = BuiltInLayouts.Combat with + { + Placements = BuiltInLayouts.Combat.Placements + .Select(p => p.PanelId == PanelIds.Vitals ? p with { Floating = new FloatingBounds(10, 10, 300, 200) } : p).ToList(), + }; + var rects = Rects(plain); + await Assert.That(plain.ApplyLayout(DemoScene.ActiveSessionKey, floats)).IsTrue(); + plain.RenderWholeFrame(); + await Assert.That(Rects(plain)).IsEquivalentTo(rects); + + // And the window's own workspace, resumed by the window, floats it again and keeps it out of the panes. + var again = DemoScene.Build(); + again.LastSession = state; + using var windowDriver = new AvaloniaConsoleDriver(140, 36); + await using var resumed = new SharpMUTermApp(again, DesktopLayerTests.InlineHost(windowDriver)); + resumed.RenderWholeFrame(); + await Assert.That(resumed.IsFloating(vitals)).IsTrue(); + await Assert.That(Tabs(resumed)).DoesNotContain(vitals); + } + + // ── The window's half ──────────────────────────────────────────────────────────────────────── + + [Test] + public async Task ARememberedPlaceIsClampedToTheScreensThereAreNow() + { + var (position, reported, activated) = await Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(40, 10); + var view = new TerminalView(driver, SKColors.White, Back, 16, null); + var presenter = driver.Floating; + presenter.Screens = () => [new FloatingBounds(0, 0, 1920, 1080)]; + presenter.Attach(owner: null, view); + var reported = new List(); + + // Left on a second monitor, to the right of this one, that is no longer plugged in. + presenter.Show([Floating(PanelIds.Vitals, new FloatingBounds(2500, 300, 400, 200), reported.Add, () => { })]); + DesktopLayerTests.Drain(); + var window = presenter.Windows.Values.Single(); + var result = (window.Position, reported.ToList(), window.ShowActivated); + presenter.Detach(); + driver.Dispose(); + return result; + }, CancellationToken.None); + + await Assert.That(position).IsEqualTo(new PixelPoint(1520, 300)); + await Assert.That(reported.Last()).IsEqualTo(new FloatingBounds(1520, 300, 400, 200)).Because("the clamped place is the one remembered"); + await Assert.That(activated).IsFalse().Because("a floating window never takes the keyboard on opening"); + } + + [Test] + public async Task ClosingTheWindowDocksThePanelAndTheClientClosingItDocksNothing() + { + var (docksOnClose, docksOnClientClose, closed) = await Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(40, 10); + var view = new TerminalView(driver, SKColors.White, Back, 16, null); + var presenter = driver.Floating; + presenter.Screens = () => [new FloatingBounds(0, 0, 1920, 1080)]; + presenter.Attach(owner: null, view); + var docks = 0; + var map = Floating(PanelIds.Map, new FloatingBounds(100, 100, 400, 400), _ => { }, () => docks++); + var vitals = Floating(PanelIds.Vitals, new FloatingBounds(600, 100, 300, 200), _ => { }, () => docks++); + presenter.Show([map, vitals]); + DesktopLayerTests.Drain(); + + // The player closes the map's window. + presenter.Windows[map.Model.WindowId].Close(); + DesktopLayerTests.Drain(); + var onClose = docks; + + // The client docks vitals: its window closes without docking it a second time. + presenter.Show([]); + DesktopLayerTests.Drain(); + var result = (onClose, docks - onClose, presenter.Windows.Count); + presenter.Detach(); + driver.Dispose(); + return result; + }, CancellationToken.None); + + await Assert.That(docksOnClose).IsEqualTo(1); + await Assert.That(docksOnClientClose).IsEqualTo(0); + await Assert.That(closed).IsEqualTo(0); + } + + [Test] + public async Task ThePopOutButtonTheFloatingViewAndTheKeysGoThroughTheClient() + { + var result = await Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(140, 36); + var view = new TerminalView(driver, SKColors.White, Back, 16, null); + var layer = new DesktopLayer(view, HostChrome.HeaderAndRail); + var root = new Panel(); + root.Children.Add(view); + root.Children.Add(layer); + var owner = new Window { Content = root, Width = 1300, Height = 760 }; + owner.Show(); + view.Focus(); + driver.Floating.Screens = () => [new FloatingBounds(0, 0, 3840, 2160)]; + driver.Floating.Attach(owner, view); + + var app = DesktopLayerTests.InlineWindowApp(driver); + driver.KeyPressed += (_, key) => app.SimulateKey(key); + try + { + app.RenderSnapshot("layout-combat"); + DesktopLayerTests.Drain(); + var vitals = driver.Pointer.Panels.First(p => p.PanelId == PanelIds.Vitals).WindowId; + var hadButton = layer.PopOuts.ContainsKey(vitals); + + layer.PopOuts[vitals].PerformClick(); + DesktopLayerTests.Drain(); + app.RenderWholeFrame(); + DesktopLayerTests.Drain(); + var floating = driver.Floating.Windows.GetValueOrDefault(vitals); + var content = floating?.PanelView.GetType().Name; + var buttonGone = !layer.PopOuts.ContainsKey(vitals); + var focusKept = view.IsFocused; + + // Typing while the floating window is in front lands on the command line. + floating!.KeyTextInput("n"); + DesktopLayerTests.Drain(); + var typed = app.PrimaryInputText; + + // Closing it docks the panel back. + floating!.Close(); + DesktopLayerTests.Drain(); + app.RenderWholeFrame(); + DesktopLayerTests.Drain(); + return (hadButton, content, buttonGone, focusKept, typed, app.IsFloating(vitals), layer.PopOuts.ContainsKey(vitals), driver.Floating.Windows.Count); + } + finally + { + driver.Floating.Detach(); + app.DisposeAsync().AsTask().GetAwaiter().GetResult(); + owner.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + await Assert.That(result.hadButton).IsTrue().Because("a docked vitals strip carries the pop-out button"); + await Assert.That(result.content).IsEqualTo(nameof(VitalsGauges)).Because("the floating window draws the panel's own native view"); + await Assert.That(result.buttonGone).IsTrue(); + await Assert.That(result.focusKept).IsTrue().Because("the command line keeps the keyboard"); + await Assert.That(result.typed).EndsWith("n"); + await Assert.That(result.Item6).IsFalse().Because("closing the floating window docks the panel"); + await Assert.That(result.Item7).IsTrue().Because("docked, it offers the pop out again"); + await Assert.That(result.Item8).IsEqualTo(0); + } + + // ── helpers ────────────────────────────────────────────────────────────────────────────────── + + private static PanelOverlay Panel(AvaloniaConsoleDriver driver, string id) => + driver.Pointer.Panels.First(p => p.PanelId == id); + + /// Each pane's output rectangle by the window in front of it, so two clients' pane ids need not agree. + private static Dictionary Rects(SharpMUTermApp app) + { + var windows = app.PaneWindows(); + return app.PaneOutputRects().ToDictionary(r => windows.GetValueOrDefault(r.Key) ?? r.Key, r => r.Value, StringComparer.Ordinal); + } + + private static List Tabs(SharpMUTermApp app) => Flatten(app.CaptureSession().Root).SelectMany(p => p.Tabs).ToList(); + + private static List Flatten(LayoutNodeState node) => + node.Children is { Count: > 0 } children ? children.SelectMany(Flatten).ToList() : [node]; + + private static FloatingPanel Floating(string panelId, FloatingBounds bounds, Action moved, Action dock) + { + var windowId = panelId == PanelIds.Map ? "map:demo" : $"panel:{panelId}:demo"; + var vitals = new VitalsModel([new VitalsMeter("hp", "412", "500", true, 412 / 500.0, false)], null); + var content = new PanelOverlay(panelId, windowId, default, new PanelInk("#3ccf6a", "#ff5555", "#333338"), panelId == PanelIds.Vitals ? vitals : null); + return new FloatingPanel( + new FloatingPanelModel(windowId, panelId, panelId, "Corvid", bounds), content, "#202024", "#e0e0e0", moved, dock); + } + + private static HeadlessUnitTestSession Session => TerminalViewTests.Session; +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index bde59a53..40802fce 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -290,6 +290,20 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! await Assert.That(rows).IsEquivalentTo(cells.HistorySearchRows, TUnit.Assertions.Enums.CollectionOrdering.Matching); } + // A floating panel: the window it is drawn in is handed the model the client recorded for it, and the panel + // inside is the model the docked strip's cells were drawn from. + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot("layout-combat"); + var vitals = Panel(driver, PanelIds.Vitals); + await Assert.That(app.DispatchCommand(PanelFloatCommands.PopOut(vitals.WindowId))).IsTrue(); + var floating = driver.Floating.Panels.Single(); + await Assert.That(app.DrawnModel(SurfaceCatalog.FloatingPanel, vitals.WindowId)).IsEqualTo((object)floating.Model).Because("floating-panel"); + await Assert.That(floating.Content.Vitals).IsEqualTo(app.ReadVitals(DemoScene.ActiveSessionKey)).Because("floating-panel: the panel inside"); + covered.Add(SurfaceCatalog.FloatingPanel); + } + var drawnNatively = SurfaceCatalog.All.Where(s => s.On(SurfaceHosts.Window).HasFlag(SurfaceDrawing.Native)).Select(s => s.Id); await Assert.That(covered).IsEquivalentTo(drawnNatively).Because("every surface the window draws natively has its model compared here"); } @@ -351,8 +365,32 @@ await Same("rail-strip: fold", "layout-combat", await Same("map: walk", "layout-combat", (app, d) => Panel(d, PanelIds.Map).WalkTo!(OtherRoom(Panel(d, PanelIds.Map).Map!)), (app, d) => app.SimulateMapClick(Panel(d, PanelIds.Map).WindowId, MapRenderer.LinkPrefix + OtherRoom(Panel(d, PanelIds.Map).Map!))); + await Same("map: pop out", "layout-combat", + (app, d) => Panel(d, PanelIds.Map).PopOut!(), + (app, d) => app.DispatchCommand(PanelFloatCommands.PopOut(Panel(d, PanelIds.Map).WindowId))); probed.Add(PanelIds.Map); + // Vitals: the pop-out button, and ⌃P's entry for the same window. + await Same("vitals: pop out", "layout-combat", + (app, d) => Panel(d, PanelIds.Vitals).PopOut!(), + (app, d) => app.DispatchCommand(PanelFloatCommands.PopOut(Panel(d, PanelIds.Vitals).WindowId))); + probed.Add(PanelIds.Vitals); + + // A floating panel: its window's Dock (and closing it), and ⌃P's dock entry. + await Same("floating-panel: dock", "layout-combat", + (app, d) => + { + Panel(d, PanelIds.Vitals).PopOut!(); + d.Floating.Panels.Single().Dock(); + }, + (app, d) => + { + var id = Panel(d, PanelIds.Vitals).WindowId; + app.DispatchCommand(PanelFloatCommands.PopOut(id)); + app.DispatchCommand(PanelFloatCommands.Dock(id)); + }); + probed.Add(SurfaceCatalog.FloatingPanel); + // Who is here: the first row. await Same("who-here: pick", "layout-roleplay", (app, d) => Panel(d, PanelIds.WhoHere).Pick!(0), @@ -829,6 +867,7 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "quick=" + app.LastQuickMacro, "walk=" + app.WalkState, "rail=" + (app.BuildChromeOverlay().Sidebar.Collapsed ? "folded" : "open"), + "floating=" + string.Join(",", app.FloatingPublished.Select(f => f.Model.WindowId)), "notice=" + app.LastNotice, "recent=" + string.Join(",", app.RecentCommandIds)); diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs index c85c9a0f..14ccb389 100644 --- a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -72,7 +72,8 @@ public async Task PanelSurfacesAreKnownPanels() { var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette - or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose) + or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose + or SurfaceCatalog.FloatingPanel) && !SurfaceCatalog.Modals.Contains(s.Id)); foreach (var surface in panels) { @@ -99,4 +100,37 @@ public async Task ANativeOnlyActionNamesWhereTheCellsOfferIt() } } } + + /// + /// An action only one host can do (a panel popped out into a window of its own) is declared for that host, which + /// draws the surface natively, and names the command that reaches it from the cells there. + /// + [Test] + public async Task AHostOnlyActionNamesItsHostAndItsCellRoute() + { + var hostOnly = SurfaceCatalog.All.SelectMany(s => s.Actions.Where(a => a.OnlyOn is not null).Select(a => (Surface: s, Action: a))).ToList(); + await Assert.That(hostOnly).IsNotEmpty(); + foreach (var (surface, action) in hostOnly) + { + await Assert.That(SurfaceHosts.All).Contains(action.OnlyOn!).Because($"{surface.Id}: {action.Name}"); + await Assert.That(surface.On(action.OnlyOn!).HasFlag(SurfaceDrawing.Native)).IsTrue().Because($"{surface.Id}: {action.Name}"); + await Assert.That(action.CellsVia).IsNotNull().Because($"{surface.Id}: {action.Name}"); + await Assert.That(action.CellsVia!).Contains(":").Because("the cell route is a command, a ⌃P entry"); + } + } + + /// Every panel the window draws natively from a model can pop out, and only the window offers it. + [Test] + public async Task EveryFloatablePanelDeclaresPopOutForTheWindowOnly() + { + foreach (var panel in SharpMUTerm.Client.Panels.PanelFloatCommands.Floatable) + { + var surface = SurfaceCatalog.Find(panel)!; + var popOut = surface.Actions.SingleOrDefault(a => a.Name == SharpMUTerm.Client.Panels.PanelFloatCommands.PopOutPrefix); + await Assert.That(popOut).IsNotNull().Because(panel); + await Assert.That(popOut!.OnlyOn).IsEqualTo(SurfaceHosts.Window).Because(panel); + } + + await Assert.That(SurfaceCatalog.Find(SurfaceCatalog.FloatingPanel)!.On(SurfaceHosts.Terminal)).IsEqualTo(SurfaceDrawing.None); + } } diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/FloatingPanelLayoutTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/FloatingPanelLayoutTests.cs new file mode 100644 index 00000000..58a3d635 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Layouts/FloatingPanelLayoutTests.cs @@ -0,0 +1,131 @@ +using System.Text.Json; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Core.Tests.Layouts; + +/// +/// The host-neutral half of a floating panel: (and its clamp to the screens there are), +/// carried through a saved workspace, +/// captured into a layout, and a fold that does not read it, so a host that cannot float keeps the panel in its region. +/// +public class FloatingPanelLayoutTests +{ + private static readonly FloatingBounds Left = new(0, 0, 1920, 1080); + private static readonly FloatingBounds Right = new(1920, 0, 2560, 1440); + + // ── Clamping ───────────────────────────────────────────────────────────────────────────────── + + [Test] + public async Task BoundsWhollyOnAScreenAreLeftAlone() + { + var onSecond = new FloatingBounds(2400, 200, 500, 400); + await Assert.That(onSecond.ClampTo([Left, Right])).IsEqualTo(onSecond); + } + + [Test] + public async Task BoundsOnAScreenThatIsGoneComeBackOnTheNearestOne() + { + var onSecond = new FloatingBounds(2400, 200, 500, 400); + await Assert.That(onSecond.ClampTo([Left])).IsEqualTo(new FloatingBounds(1420, 200, 500, 400)); + + var aboveEverything = new FloatingBounds(-900, -700, 300, 200); + await Assert.That(aboveEverything.ClampTo([Left])).IsEqualTo(new FloatingBounds(0, 0, 300, 200)); + } + + [Test] + public async Task BoundsAcrossTwoScreensGoToTheOneHoldingMostOfThem() + { + var straddling = new FloatingBounds(1800, 100, 400, 300); + await Assert.That(straddling.ClampTo([Left, Right])).IsEqualTo(new FloatingBounds(1920, 100, 400, 300)); + } + + [Test] + public async Task BoundsLargerThanTheScreenAreShrunkToIt() + { + var huge = new FloatingBounds(100, 100, 4000, 3000); + await Assert.That(huge.ClampTo([Left])).IsEqualTo(Left); + } + + [Test] + public async Task UnplacedBoundsAndNoScreensChangeNothing() + { + await Assert.That(FloatingBounds.Unplaced.ClampTo([Left])).IsEqualTo(FloatingBounds.Unplaced); + var somewhere = new FloatingBounds(5000, 5000, 300, 200); + await Assert.That(somewhere.ClampTo([])).IsEqualTo(somewhere); + } + + // ── The workspace and the layout carry it ─────────────────────────────────────────────────── + + [Test] + public async Task AFloatingWindowSurvivesASavedWorkspace() + { + var workspace = new Workspace("main", "Main"); + workspace.OpenWindow("map:W.C", "Map", WindowKind.Auxiliary, "W.C"); + workspace.FindWindow("map:W.C")!.Floating = new FloatingBounds(1200, 80, 460, 460); + + var json = JsonSerializer.Serialize(WorkspaceState.Capture(workspace)); + var restored = JsonSerializer.Deserialize(json)!.Restore(); + + await Assert.That(restored.FindWindow("map:W.C")!.Floating).IsEqualTo(new FloatingBounds(1200, 80, 460, 460)); + await Assert.That(restored.FindWindow("main")!.Floating).IsNull(); + await Assert.That(json).DoesNotContain("IsPlaced"); + } + + [Test] + public async Task CapturingAFloatingPanelKeepsItsRegionAndSaysWhereItFloats() + { + var fold = LayoutFold.Fold(BuiltInLayouts.Combat, new PanelAvailability(RoomsRecorded: 3, MeterValueArrived: true, SpawnWindows: 0)); + var map = new FloatingBounds(1200, 80, 460, 460); + + // The map floats, so the realiser was handed no window for it and its pane is gone. + var realised = LayoutRealiser.Realise( + BuiltInLayouts.Combat, + fold, + panel => panel switch { PanelIds.Output => ["main"], PanelIds.Vitals => ["panel:vitals:W.C"], _ => [] }, + "main")!; + string? PanelOf(string window) => window switch { "main" => PanelIds.Output, "panel:vitals:W.C" => PanelIds.Vitals, _ => null }; + + var captured = LayoutCapture.Capture( + realised.Root, PanelOf, BuiltInLayouts.Combat, new Dictionary { [PanelIds.Map] = map })!; + var placement = captured.Placements.Single(p => p.PanelId == PanelIds.Map); + await Assert.That(placement.Floating).IsEqualTo(map); + await Assert.That(placement.Region).IsEqualTo(BuiltInLayouts.Combat.PlacementOf(PanelIds.Map)!.Region) + .Because("docking back returns it to the region it was taken from"); + await Assert.That(captured.Placements.Single(p => p.PanelId == PanelIds.Vitals).Floating).IsNull(); + + // A host that cannot float captures with no floating list, and keeps what the layout already said. + var floats = BuiltInLayouts.Combat with + { + Placements = BuiltInLayouts.Combat.Placements.Select(p => p.PanelId == PanelIds.Map ? p with { Floating = map } : p).ToList(), + }; + var terminal = LayoutCapture.Capture(realised.Root, PanelOf, floats)!; + await Assert.That(terminal.Placements.Single(p => p.PanelId == PanelIds.Map).Floating).IsEqualTo(map); + } + + [Test] + public async Task TheFoldDoesNotReadFloating() + { + var availability = new PanelAvailability(RoomsRecorded: 3, MeterValueArrived: true, SpawnWindows: 2); + var floats = BuiltInLayouts.Combat with + { + Placements = BuiltInLayouts.Combat.Placements + .Select(p => p with { Floating = new FloatingBounds(10, 10, 300, 200) }).ToList(), + }; + + var plain = LayoutFold.Fold(BuiltInLayouts.Combat, availability); + var floating = LayoutFold.Fold(floats, availability); + await Assert.That(LayoutRealiser.FoldShape(floating)).IsEqualTo(LayoutRealiser.FoldShape(plain)); + } + + [Test] + public async Task AFloatingPlacementRoundTripsThroughJson() + { + var placement = new PanelPlacement { PanelId = PanelIds.Vitals, Region = LayoutRegion.TopStrip, Floating = new FloatingBounds(5, 6, 300, 120) }; + var json = JsonSerializer.Serialize(placement); + await Assert.That(JsonSerializer.Deserialize(json)).IsEqualTo(placement); + + var docked = new PanelPlacement { PanelId = PanelIds.Vitals }; + await Assert.That(JsonSerializer.Deserialize(JsonSerializer.Serialize(docked))!.Floating).IsNull(); + } +} From f79f690f16fdfc174b2aeca427e1c9d51bd5e03f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 10:03:20 +0000 Subject: [PATCH 036/113] Fix ten two-host papercuts, plus settings focus and one key spelling - Startup runs once: the window's welcome demo no longer raises its notice twice. - The window's history-search-filter view opens native Ctrl+R with its query typed. - search-landed lands through the native search in the window. - A hovered toast freezes the stack so it keeps its place; toasts stack clear of the map legend. - F10 fits 80x24: ListOverlay sizes from measured wrapped rows, confirm rows always emitted. - Every native surface spells keys in words (NativeKeys.Words, Enter for the return glyph), with a runtime and source scan (NativeKeySpellingTests). - The settings window takes the keyboard on open and returns it on close. - The composer face is saved per character through PersistConfiguration. - List editors remember their selection per section for the run. - The command line goes idle while Alt+C sidebar navigation holds the keys. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 13 + CLAUDE.md | 47 ++- src/SharpMUTerm.Avalonia/ComposerView.cs | 36 ++- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 14 +- src/SharpMUTerm.Avalonia/HistoryView.cs | 2 + src/SharpMUTerm.Avalonia/LayoutsView.cs | 2 +- src/SharpMUTerm.Avalonia/ListEditorView.cs | 50 +++- src/SharpMUTerm.Avalonia/MainWindow.cs | 3 + src/SharpMUTerm.Avalonia/MapCanvas.cs | 31 +- src/SharpMUTerm.Avalonia/ModalParts.cs | 12 +- src/SharpMUTerm.Avalonia/NativeChrome.cs | 16 +- src/SharpMUTerm.Avalonia/NativeKeys.cs | 31 ++ src/SharpMUTerm.Avalonia/NativeMenu.cs | 6 +- src/SharpMUTerm.Avalonia/NoticeToasts.cs | 150 ++++++++-- src/SharpMUTerm.Avalonia/PackagePageView.cs | 10 +- src/SharpMUTerm.Avalonia/PaletteOverlay.cs | 8 +- src/SharpMUTerm.Avalonia/QuickBarButtons.cs | 6 +- src/SharpMUTerm.Avalonia/QuitView.cs | 2 +- src/SharpMUTerm.Avalonia/SearchView.cs | 6 +- src/SharpMUTerm.Avalonia/SettingsPresenter.cs | 6 +- src/SharpMUTerm.Avalonia/SettingsWindow.cs | 30 +- src/SharpMUTerm.Avalonia/WelcomeView.cs | 6 +- .../Composer/ComposerSession.cs | 21 ++ src/SharpMUTerm.Client/Modals/HistoryModel.cs | 6 + .../Settings/SettingsForm.cs | 20 ++ .../Configuration/CharacterDefinition.cs | 8 + src/SharpMUTerm.Tui/ListOverlay.cs | 21 +- src/SharpMUTerm.Tui/PackageScreen.cs | 11 +- .../SharpMUTermApp.NativeComposer.cs | 29 ++ .../SharpMUTermApp.NativeModals.cs | 9 +- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 8 +- .../SharpMUTermApp.RailKeys.cs | 4 + .../SharpMUTermApp.Settings.cs | 7 + src/SharpMUTerm.Tui/SharpMUTermApp.cs | 34 ++- .../ListEditorTests.cs | 38 +++ .../NativeComposerTests.cs | 6 +- .../NativeKeySpellingTests.cs | 276 ++++++++++++++++++ .../NativeModalTests.cs | 21 ++ .../NativePaletteTests.cs | 4 +- .../NoticeToastTests.cs | 81 +++++ .../SettingsWindowTests.cs | 53 ++++ .../SurfaceParityTests.cs | 32 +- .../NativeComposerRoutingTests.cs | 41 +++ .../PackageScreenFitTests.cs | 37 +++ tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs | 15 + tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs | 19 ++ 46 files changed, 1160 insertions(+), 128 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/NativeKeys.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NativeKeySpellingTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/PackageScreenFitTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 95bc530b..f87fafc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -281,6 +281,19 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- Desktop window: the "no world configured" notice at first start shows once, not as two identical toasts. +- Desktop window: a notice you point at stays where it is while the others fade, and notices no longer cover the + map's legend. +- Desktop window: every key is written in words everywhere in the window — the menus, notices, Ctrl+P, the composer, + dialogs and settings now all say Ctrl+P, Alt+M and Enter rather than mixing them with ⌃P, ⌥M and ⏎. +- Desktop window: the settings window takes the keyboard when it opens, so you can type in its search straight away, + and gives it back to the command line when it closes. +- Desktop window: the composer's proportional or monospace font is remembered for each character, and kept after a + restart. +- Desktop window: the trigger, alias, timer and key lists in settings remember which item you had selected when you + switch section or reopen the window. +- Packages (F10) fit an 80×24 terminal: the list no longer scrolls to hide its last rows or the close key. +- While Alt+C has the keyboard in the sidebar, the command line is drawn idle, since Enter goes to the sidebar row. - Desktop window: the Keys screen (F4) and the quick bar now describe the window's keys rather than a terminal's. Ctrl+digit, Ctrl+Shift+letter, Ctrl+Tab and Alt+O are shown as working keys you can bind, and Alt+Enter is marked as taken because it maximises the window. diff --git a/CLAUDE.md b/CLAUDE.md index 6f73d997..80c4a8a7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -199,6 +199,10 @@ fallbacks) for inline images/maps. - One folder per package (`packages//`, beside `config.json`), swapped in through a `.id.new` staging folder; a snapshot's store has no folder and writes nothing. F10 is claimed (`opens Packages`); GNOME Terminal may take it for its menu, so ⌃P ▸ *Packages* is the way in that always works. + - **A `ListOverlay` is as tall as its lines *wrapped*** (`ListOverlay.Rows`, measured by the framework's own + `MarkupControl.MeasureDOM` at the modal's inner width), not as its line count: F10's header wraps at 80 columns, + and counting lines made the modal a row short, so it scrolled its close key out of sight at 80×24. F10 always + emits its two confirm rows (blank when idle), so the modal sized once at open still fits a confirmation. - **The index** (`PackageIndex`; ⌃P ▸ *Browse packages*, `b` on F10) is `{"packages":[…]}`, each entry a manifest plus an https `url` and a `sha256`, at `AppConfiguration.PackageIndexUrl`. **It is fetched only when the player opens it, never at start.** An entry that breaks a rule is dropped and counted, not @@ -627,7 +631,9 @@ fallbacks) for inline images/maps. in that order and then dials them **concurrently**: focus is taken by the first before any packet leaves, so several auto-connects always land you in the same place, and a black-holed host cannot hold the other worlds' windows hostage. `ConnectAtStartup` is *not* `AutoLogin` — one opens the socket, the - other sends the connect line once one is open, and either is useful alone. + other sends the connect line once one is open, and either is useful alone. **`StartAsync` runs once per app** + (`_startupRan`): the window's demo lays out a scene that may itself start up (the welcome does) before `Run` schedules + startup, and running it twice said every startup notice twice — two identical toasts. - **A client with no worlds opens on a welcome, and the first connect of a new configuration leaves a key tour** (`WelcomeSurface`, `SharpMUTermApp.Welcome.cs`; `/welcome`, ⌃P ▸ *Welcome* / *Key tour*). The welcome is a `ListOverlay` over a pure model (the `QuitPrompt` split): *Connect to a host* (a form: host, port 4000, TLS, an @@ -1168,7 +1174,9 @@ fallbacks) for inline images/maps. the armed band padded to the rail's widest row (no cell spent; inks re-held to the floor on the band, `RailRenderer.OnBand`); the native sidebar draws an accent ring and scrolls the row into view. ⌥C because it is `ESC c` (one Alt chord in a terminal), C names CONNECTIONS, and nothing claimed it — not `AppShortcuts`, the - bar's table, nor the window's `HostKeys.Reserved`. + bar's table, nor the window's `HostKeys.Reserved`. **While the sidebar holds the keys both command lines wear the + idle band** (`SyncComposerBands` reads `_railCursor`, and `UpdateInputChrome` repaints the prompt to match): ⏎ goes + to a row, not to the game. The window's command line is cells, so it follows with nothing of its own. - **A right click on a sidebar row opens the client's menu for that row** (`SidebarRowMenu`, `RunSidebarMenuEntry`; `ChromeOverlay.RowMenu`/`RunRowMenu`; the cell rail's pointer menu reads the same method). Entries are registry commands with their keys (switch, connect/disconnect, edit in F5/F9, go to, close, clear), each offered only if @@ -1324,6 +1332,10 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw the window's, a press beside the stack goes to the cells. The stack is bottom-right inside the cell area, ending above the row the pane area ends at (`NoticeOverlay.AboveRow`), newest at the bottom, four at most. It fades after `NoticeModel.Duration`, held while hovered (plus a 2 s grace). Right click dismisses. + **While the pointer is on a toast the stack is frozen** (`NoticeToasts.Frozen`): every toast keeps its place as the + ones around it fade, so the card under the pointer never slides out from under it; a toast arriving meanwhile + stacks above, and the freeze ends when the pointer leaves or the window resizes. **The stack is lifted clear of + the map's legend** (`NoticeToasts.Avoid`, from `MapCanvas.LegendRect`), which sits in the same corner. - **An action is a registry command the client offered**: a click runs `NoticeOverlay.Run` → `RunNoticeAction`, which refuses a command no recent notice carried, then `DispatchCommand`. The cells' way to the same door is ⌃P (`CellsVia: term:messages`). Three notices carry one so far: the layout suggestion @@ -1758,7 +1770,12 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] title and scrolls in its two halves. A package's set is drawn read-only with *Copy to edit*. F2's pattern field has the live test under it, re-run on every keystroke, each matching line with the match marked. The trigger builder opens it on the rule it made (`TryOpenNativeSettings(section, item)`); with no window it opens the cell - F2 as before. + F2 as before. **Each list keeps its selection for the run** (`SettingsForm.Selections`, the app's + `_listSelections`, by section id; never saved): switching section and back, or closing and reopening the window, + lands on the item last chosen while it still exists. An item the form was opened on wins. + - **The window takes the keyboard when it opens and gives it back when it closes** (`SettingsWindow.FocusFirst` + on `Opened` and when an open window is reused; `SettingsPresenter.Refocus` → `DesktopLayer.FocusArmedComposer` + after `Owner.Activate()`), as a cell screen does. - **F10 is a package manager page** (`PackagePageView`, Avalonia; Client `PackageCollection`, `PackageManager`, `PackageReviewModel`, `PackageBrowseModel`; `SharpMUTermApp.Packages.cs`). F10 is declared as a list of installed packages (`SettingsSectionContribution.Packages`): one `BoolField` (`enabled`, whose binding replaces @@ -1803,8 +1820,8 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] native chrome. A scrim covers the rest; a press on it closes. Closing gives the keyboard back to `TerminalView`, which is the client's command line by the focus pin. Fluent is applied to the card alone (`ThemeVariantScope`), in the client's variant. - - **Keys are words** (`KeyGlyphs.Words`, as the native chrome does): the UI font draws `Ctrl+⏎` better than `⌃⏎`, - and the window's catalog already carries the window's newline. A sequence (`⌃B |`) is one chip per key. + - **Keys are words** (`NativeKeys.Words`, the rule every native surface follows — see below). A sequence (`⌃B |`) + is one chip per key. - **Hover selects on movement only** (`PointerMoved`, not `PointerEntered`), so the row that opens under a resting pointer is not chosen. ↑↓ wrap as in the cells; PgUp/PgDn stop at the ends. - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave5/native-palette-*.png`). @@ -1853,8 +1870,12 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] native session puts the same command on a `RecordingTelnetSession` as the cell keys do, as typed and literal, one line and several paragraphs. `NativeComposerRoutingTests` (Tui) and `NativeComposerTests` (Avalonia, headless) drive the routing and the editor. + - **The face is the character's** (`CharacterDefinition.ComposerProportional`, false by default with no migration): + the right-click menu's choice goes `ComposerSession.ChooseFace` → `ChooseComposerFace`, which saves through + `PersistConfiguration` (a view preference; `SaveConfiguration` would re-periodise timers), and each composer reads + it live (`ComposerCallbacks.Proportional`), so F1 and the docked panel of one character agree. - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave7/composer-*.png`). `--demo-config` in the - window opens the installed dictionary read-only. Not done: no per-character face choice saved, no find bar, and + window opens the installed dictionary read-only. Not done: no find bar, and the window's ⌥W adds to the run's dictionary in the demo only (a live client writes `user-words.txt` as F1 does). - **In the window, the quit prompt, ⌃F, ⌃R, ⌥M and the welcome are native modals** (`ClientHost.NativeModals` → `INativeModals`; Client `Modals/`: `ModalSession`, `QuitModel`/`QuitSession`, `SearchModel`/`SearchSession`, @@ -1888,9 +1909,17 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] search ⏎ / ⌥A / ⌥E, history ⏎, layouts apply / save as new / rename / delete, and the welcome's connect and layout+settings end in the same `Outcome` as the cell keys. `NativeModalRoutingTests` (Tui) and `NativeModalTests` (Avalonia, headless) drive the routing, the stacking and the views. The `search*` and `history-search` snapshot - views open the native surface when there is one (that is how the window's screenshots are taken). - - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave8/modals-*.png`). Not done: the native ⌃R - filters in its own box, so the `history-search-filter` view shows its list unfiltered in the window. + views open the native surface when there is one (that is how the window's screenshots are taken): + `history-search-filter` opens ⌃R with its query typed (`HistorySession.InitialQuery`), and `search-landed` lands + through the native search's own close and `GoToSearchHit`, so the cells it leaves match the terminal's. + - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave8/modals-*.png`). +- **Every native surface spells a key in words** (`NativeKeys.Words`, Avalonia: `KeyGlyphs.Words` plus `⏎` → `Enter`): + `Ctrl+P`, `Alt+M`, `Ctrl+B b`, never `⌃P`/`⌥M`/`⏎`. The client writes keys in glyphs because the cells draw them + well; whatever it hands a native view — menu keys, a toast's chip and text, palette details and chips, the + composer's key row, modal footers and sentences, settings help, tooltips — goes through `Words` on the way to the + screen. `NativeKeySpellingTests` reads every native surface at run time and scans the Avalonia sources for a glyph + literal outside `NativeKeys`. **The cells keep their glyphs**, the window's cell status row included: parity + compares cells, so that row says `⌥9` beside a toast saying `Alt+9`. - **Settings screens have no `IPasteTarget` and cannot easily have one.** They are markup rebuilt wholesale every key, with the edited field a buffer in `SettingsSession`. `SettingsOverlay` listens at `IConsoleDriver.Paste` instead. That can't double-fire *only* because no control on diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 1de23852..322669d8 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -109,14 +109,19 @@ public ComposerView(TerminalView view, bool fullScreen) } /// - /// Whether the editors write in the UI's proportional face rather than the cells' monospace one. For the run, for - /// every composer the window draws; chosen from the editor's right-click menu. + /// Whether this editor writes in the UI's proportional face rather than the cells' monospace one: its character's + /// choice, kept in the configuration (CharacterDefinition.ComposerProportional) and chosen from the editor's + /// right-click menu. Until the session says (and with no session) it is the last face chosen in this window, so a + /// choice shows at once rather than when the client has stored it. /// - internal static bool Proportional { get; set; } + internal bool Proportional => _faceChosen ?? _session?.Proportional ?? false; - /// Raised when the face changes, so every composer on screen follows. + /// Raised when a face is chosen, so every composer on screen re-reads its own. internal static event Action? FaceChanged; + // The face just chosen here, until the client has it; cleared when any face changes. + private bool? _faceChosen; + /// The editor. Internal for tests. internal ComposerEditor Editor => _editor; @@ -171,6 +176,10 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col _session = session; _applied = -1; _armed = null; + + // Another character's composer, or the same one opened again: its face is the session's. + _faceChosen = null; + ApplyFont(); } var coloursChanged = ink != _ink || plane != _plane || text != _text; @@ -320,12 +329,12 @@ private void Label(ComposerModel model) var item = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, Margin = new Thickness(0, 1, 14, 1) }; if (key.Key.Length > 0) { - item.Children.Add(Chip(key.Key, Accent, ui - 1.5)); + item.Children.Add(Chip(NativeKeys.Words(key.Key), Accent, ui - 1.5)); } item.Children.Add(new TextBlock { - Text = narrow && key.Short is { } brief ? brief : key.Label, + Text = NativeKeys.Words(narrow && key.Short is { } brief ? brief : key.Label), FontSize = ui - 1, Foreground = new SolidColorBrush(Dim), VerticalAlignment = VerticalAlignment.Center, @@ -563,11 +572,7 @@ internal ContextMenu OpenMenu(int offset) items.Add(Item("Paste", _editor.Paste, enabled: _editor.CanPaste)); items.Add(Item("Select all", _editor.SelectAll)); items.Add(new Separator()); - items.Add(Item(Proportional ? "Monospace font" : "Proportional font", () => - { - Proportional = !Proportional; - FaceChanged?.Invoke(); - })); + items.Add(Item(Proportional ? "Monospace font" : "Proportional font", () => ChooseFace(!Proportional))); var menu = new ContextMenu { ItemsSource = items }; menu.Closed += (_, _) => _editor.Focus(); @@ -576,6 +581,15 @@ internal ContextMenu OpenMenu(int offset) return menu; } + /// The menu's face entry: the character keeps it (through the session), and every composer re-reads its own. + internal void ChooseFace(bool proportional) + { + _faceChosen = proportional; + _session?.ChooseFace(proportional); + FaceChanged?.Invoke(); + ApplyFont(); + } + private static MenuItem Item(string header, Action act, bool enabled = true, bool bold = false) { var item = new MenuItem { Header = header, IsEnabled = enabled }; diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index e384b6ed..04b88ae0 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -177,6 +177,18 @@ private void SyncToasts(ScreenFrame frame, Size cell) _toasts.Height = Math.Max(0, frame.Height * cell.Height); var above = _noticeAboveRow > 0 && _noticeAboveRow < frame.Height ? _noticeAboveRow : Math.Max(0, frame.Height - 2); _toasts.Bottom = above * cell.Height; + + // The native maps' legends, in the toasts' coordinates: a toast is stacked clear of one rather than over it. + var avoid = new List(); + foreach (var map in _maps.Values) + { + if (map.LegendRect(new Size(map.Width, map.Height)) is { } legend) + { + avoid.Add(legend.Translate(new Vector(GetLeft(map) - origin.X, GetTop(map) - origin.Y))); + } + } + + _toasts.Avoid = avoid; } /// The notice toasts. Internal for tests. @@ -244,7 +256,7 @@ private void SyncButtons(ScreenFrame frame, Size cell) button = new HeaderButton(action.Id); button.Click += () => OpenMenu(action, button); AutomationProperties.SetName(button, action.Label); - ToolTip.SetTip(button, action.Hint is { } hint ? $"{action.Label} ({hint})" : action.Label); + ToolTip.SetTip(button, NativeKeys.Words(action.Hint is { } hint ? $"{action.Label} ({hint})" : action.Label)); _buttons[action.Id] = button; Children.Add(button); } diff --git a/src/SharpMUTerm.Avalonia/HistoryView.cs b/src/SharpMUTerm.Avalonia/HistoryView.cs index eaa76b79..f762441c 100644 --- a/src/SharpMUTerm.Avalonia/HistoryView.cs +++ b/src/SharpMUTerm.Avalonia/HistoryView.cs @@ -56,6 +56,8 @@ public HistoryView(HistorySession session, ModalColours colours, Action done) frame.MinHeight = 120; Children.Add(frame); + _box.Text = session.InitialQuery; + _box.CaretIndex = session.InitialQuery.Length; _box.TextChanged += (_, _) => { _selected = 0; diff --git a/src/SharpMUTerm.Avalonia/LayoutsView.cs b/src/SharpMUTerm.Avalonia/LayoutsView.cs index 351b75f5..68b95a42 100644 --- a/src/SharpMUTerm.Avalonia/LayoutsView.cs +++ b/src/SharpMUTerm.Avalonia/LayoutsView.cs @@ -164,7 +164,7 @@ private void Draw() _status.Text = _confirming && _model.Current is { } doomed ? $"Delete {doomed.Name}? Y deletes, any other key keeps it." - : _model.Status ?? string.Empty; + : NativeKeys.Words(_model.Status); _status.Foreground = _colours.Brush(_confirming ? _colours.Warn : _colours.Dim); _status.IsVisible = _status.Text.Length > 0; _rename.IsVisible = _renaming; diff --git a/src/SharpMUTerm.Avalonia/ListEditorView.cs b/src/SharpMUTerm.Avalonia/ListEditorView.cs index 5c26deba..a26866c3 100644 --- a/src/SharpMUTerm.Avalonia/ListEditorView.cs +++ b/src/SharpMUTerm.Avalonia/ListEditorView.cs @@ -96,9 +96,15 @@ public ListEditorView(SettingsForm form, SettingsSectionContribution section, Fu SetColumn(scroller, 1); Children.Add(scroller); - if (_form.Item is not { } chosen || !_collection.IsItem(chosen)) + // The item this section had selected last (switched away from, or the window closed) wins over the first — + // unless the form opened on an item of this list (the trigger builder's new rule). + if (_form.Item is not { } chosen || !_collection.IsItem(chosen) || FindGroup(chosen) is null) { - _form.Select(FirstItem()); + Select(_form.Recall(_section.Id) is { } kept && _collection.IsItem(kept) && FindGroup(kept) is not null ? kept : FirstItem()); + } + else + { + _form.Remember(_section.Id, chosen); } BuildList(); @@ -144,7 +150,7 @@ public ListEditorView(SettingsForm form, SettingsSectionContribution section, Fu /// Selects and shows its fields. public void Choose(object? item) { - _form.Select(item); + Select(item); SelectRow(item); BuildDetail(); } @@ -155,7 +161,12 @@ public void Refresh() if (_form.Item is { } item && FindGroup(item) is null) { // The selected item went (deleted, or moved by another surface): take the first there is. - _form.Select(FirstItem()); + Select(FirstItem()); + } + else + { + // An add or a duplicate selected its new item through the form. + _form.Remember(_section.Id, _form.Item); } BuildList(); @@ -188,11 +199,18 @@ public void Refresh() private static Button ToolButton(string text, string tip) { var button = new Button { Content = text, Padding = new Thickness(8, 3), MinWidth = 32, HorizontalContentAlignment = HorizontalAlignment.Center }; - ToolTip.SetTip(button, tip); + ToolTip.SetTip(button, NativeKeys.Words(tip)); AutomationProperties.SetName(button, tip); return button; } + // Every selection goes through here, so the section remembers it for the run. + private void Select(object? item) + { + _form.Select(item); + _form.Remember(_section.Id, item); + } + private object? FirstItem() => _form.Groups(_section).SelectMany(g => g.Items).FirstOrDefault(); private SettingsItemGroup? FindGroup(object item) => @@ -286,7 +304,7 @@ private ListBoxItem ItemRow(SettingsItemGroup group, object item) var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center }; var title = _collection.TitleOf(item); - words.Children.Add(new TextBlock { Text = title.Length == 0 ? "(unnamed)" : title, TextTrimming = TextTrimming.CharacterEllipsis }); + words.Children.Add(new TextBlock { Text = title.Length == 0 ? "(unnamed)" : NativeKeys.Words(title), TextTrimming = TextTrimming.CharacterEllipsis }); if (_collection.DetailOf(item) is { Length: > 0 } detail) { words.Children.Add(new TextBlock @@ -329,7 +347,7 @@ private void OnRowChosen() return; } - _form.Select(item); + Select(item); BuildDetail(); } @@ -422,7 +440,7 @@ private void BuildDetail() } var title = _collection.TitleOf(item); - _detail.Children.Add(new TextBlock { Text = title.Length == 0 ? "(unnamed)" : title, FontSize = 18, FontWeight = FontWeight.SemiBold, TextTrimming = TextTrimming.CharacterEllipsis }); + _detail.Children.Add(new TextBlock { Text = title.Length == 0 ? "(unnamed)" : NativeKeys.Words(title), FontSize = 18, FontWeight = FontWeight.SemiBold, TextTrimming = TextTrimming.CharacterEllipsis }); if (group.ReadOnly) { var banner = new DockPanel { LastChildFill = true, Margin = new Thickness(0, 6, 0, 4) }; @@ -498,11 +516,11 @@ private static Grid Row(SettingsField field, Control control) { var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("118,*"), Margin = new Thickness(0, 3), MinHeight = 34 }; var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 12, 0) }; - words.Children.Add(new TextBlock { Text = Capitalise(field.Label), FontSize = 13, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = 13, TextWrapping = TextWrapping.Wrap }); if (field.Help is { } help) { - ToolTip.SetTip(words, Capitalise(help)); - ToolTip.SetTip(control, Capitalise(help)); + ToolTip.SetTip(words, NativeKeys.Words(Capitalise(help))); + ToolTip.SetTip(control, NativeKeys.Words(Capitalise(help))); } grid.Children.Add(words); @@ -766,7 +784,7 @@ void Commit() } else { - ToolTip.SetTip(control, text.Help); + ToolTip.SetTip(control, NativeKeys.Words(text.Help)); } } @@ -811,15 +829,15 @@ void Commit() /// private Control KeyCapture(KeyField field, SettingBinding chord) { - var button = new Button { Content = _form.Get(chord), MinWidth = 160, HorizontalAlignment = HorizontalAlignment.Left, HorizontalContentAlignment = HorizontalAlignment.Left }; + var button = new Button { Content = NativeKeys.Words(_form.Get(chord)), MinWidth = 160, HorizontalAlignment = HorizontalAlignment.Left, HorizontalContentAlignment = HorizontalAlignment.Left }; var note = new TextBlock { FontSize = 11, Opacity = 0.75, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 0) }; var capturing = false; void Show() { - button.Content = capturing ? "Press a key… (Esc cancels)" : _form.Get(chord); + button.Content = capturing ? "Press a key… (Esc cancels)" : NativeKeys.Words(_form.Get(chord)); if (!capturing) { - note.Text = _form.Context.KeyProblem(_form.Get(chord)) is { } problem ? $"▲ {problem}" : string.Empty; + note.Text = _form.Context.KeyProblem(_form.Get(chord)) is { } problem ? $"▲ {NativeKeys.Words(problem)}" : string.Empty; } } @@ -858,7 +876,7 @@ void Show() Show(); if (refused is not null) { - note.Text = $"{descriptor}: {refused}"; + note.Text = NativeKeys.Words($"{descriptor}: {refused}"); } }; Show(); diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index 107f7c6d..b88fae4b 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -76,6 +76,9 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime // armed docked composer if there is one, else to the cells. _driver.Composer.Attach(root, layer, _view, () => layer.FocusArmedComposer()); + // The settings window takes the keyboard when it opens and hands it back here when it closes. + _driver.Settings.Refocus = () => layer.FocusArmedComposer(); + // ⌃P, over everything above; it is added last when it opens, and gives the keyboard back to the cells. _driver.Palette.Attach(root, () => layer.FocusArmedComposer()); diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index 9d2787f5..b9277e6b 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -389,19 +389,36 @@ private void DrawName(DrawingContext context, string name, Point centre, double /// The legend, in the bottom-left corner on a plate: you, the stairs, a walk, and each area in its colour. Drawn only /// where it fits, and it never takes the pointer from a room under it (the canvas hit-tests rooms only). /// - private void DrawLegend(DrawingContext context, Rect bounds) + private const double LegendSize = 11, LegendRow = 16, LegendPad = 8, LegendSwatch = 9; + + /// + /// Where the legend's plate is drawn in a canvas of , in the canvas's coordinates; null when + /// none is drawn (no rooms, or it would not fit). The window keeps its toasts off it (). + /// + internal Rect? LegendRect(Size size) { + if (_model.Rooms.Count == 0) + { + return null; + } + var entries = LegendEntries(); - const double size = 11, row = 16, pad = 8, swatch = 9; - var widest = entries.Max(e => PanelText.Measure(e.Label, size, bold: false)); - var width = pad + swatch + 6 + widest + pad; - var height = (pad * 2) + (entries.Count * row) - (row - size - 3); - if (width > bounds.Width * 0.6 || height > bounds.Height * 0.6) + var widest = entries.Max(e => PanelText.Measure(e.Label, LegendSize, bold: false)); + var width = LegendPad + LegendSwatch + 6 + widest + LegendPad; + var height = (LegendPad * 2) + (entries.Count * LegendRow) - (LegendRow - LegendSize - 3); + return width > size.Width * 0.6 || height > size.Height * 0.6 ? null : new Rect(10, size.Height - height - 10, width, height); + } + + private void DrawLegend(DrawingContext context, Rect bounds) + { + if (LegendRect(bounds.Size) is not { } plate) { return; } - var plate = new Rect(10, bounds.Height - height - 10, width, height); + var entries = LegendEntries(); + const double size = LegendSize, row = LegendRow, pad = LegendPad, swatch = LegendSwatch; + var widest = entries.Max(e => PanelText.Measure(e.Label, size, bold: false)); context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0xE6, _plane.R, _plane.G, _plane.B)), new Pen(new SolidColorBrush(Faded(0.25)), 1), plate, 5, 5); var y = plate.Y + pad; foreach (var (label, colour) in entries) diff --git a/src/SharpMUTerm.Avalonia/ModalParts.cs b/src/SharpMUTerm.Avalonia/ModalParts.cs index ff4f2827..84373e40 100644 --- a/src/SharpMUTerm.Avalonia/ModalParts.cs +++ b/src/SharpMUTerm.Avalonia/ModalParts.cs @@ -13,7 +13,7 @@ internal static class ModalParts /// The modal's title line. public static TextBlock Heading(string text, ModalColours colours) => new() { - Text = text, + Text = NativeKeys.Words(text), FontSize = 18, FontWeight = FontWeight.SemiBold, Foreground = colours.Brush(colours.Text), @@ -24,7 +24,7 @@ internal static class ModalParts /// A quiet line: a count, a scope, an explanation. public static TextBlock Dim(string text, ModalColours colours, Thickness? margin = null) => new() { - Text = text, + Text = NativeKeys.Words(text), FontSize = 12.5, Foreground = colours.Brush(colours.Dim), Margin = margin ?? new Thickness(20, 0, 20, 6), @@ -34,7 +34,7 @@ internal static class ModalParts /// The keys the modal answers, right-aligned under it, in the window's words. public static TextBlock Footer(string text, ModalColours colours) => new() { - Text = text, + Text = NativeKeys.Words(text), FontSize = 11.5, Foreground = colours.Brush(colours.Dim), Margin = new Thickness(20, 8, 20, 12), @@ -149,19 +149,19 @@ public static InlineCollection Marked(string text, int start, int length, ModalC Padding = new Thickness(6, 0), Margin = new Thickness(6, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center, - Child = new TextBlock { Text = key, FontSize = 11.5, Foreground = colours.Brush(colours.KeyInk) }, + Child = new TextBlock { Text = NativeKeys.Words(key), FontSize = 11.5, Foreground = colours.Brush(colours.KeyInk) }, }; /// A button whose label is followed by the key that presses it. public static Button Button(string label, string? key, ModalColours colours, Action click, bool accent = false) { var content = new StackPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center }; - content.Children.Add(new TextBlock { Text = label, VerticalAlignment = VerticalAlignment.Center }); + content.Children.Add(new TextBlock { Text = NativeKeys.Words(label), VerticalAlignment = VerticalAlignment.Center }); if (key is not null) { content.Children.Add(new TextBlock { - Text = key, + Text = NativeKeys.Words(key), FontSize = 11.5, Opacity = 0.7, Margin = new Thickness(8, 0, 0, 0), diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index e7bcaa49..91c0154c 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -63,6 +63,12 @@ public void Show(ChromeOverlay? overlay, Color plane, Color ink) if (overlay is not null && !double.IsNaN(Width) && !double.IsNaN(Height)) { Layout(overlay, _hits); + + // Every tooltip in the window's words, whatever the client's model said it in. + for (var i = 0; i < _hits.Count; i++) + { + _hits[i] = _hits[i] with { Tip = NativeKeys.Words(_hits[i].Tip) }; + } } InvalidateVisual(); @@ -415,12 +421,12 @@ private void LayoutPrefix(HeaderPrefix prefix, double start, double right, doubl _prefix = new Rect(start, plateTop, Math.Min(lead, Math.Max(0, right - start)), plateHeight); hits.Add((_prefix, string.Empty, $"{KeyGlyphs.Words(HeaderPrefix.Chord)} is armed: the next key acts on the workspace. {prefix.Exit}.")); - var exitWidth = Measure(prefix.Exit, size - 1) + 8; + var exitWidth = Measure(NativeKeys.Words(prefix.Exit), size - 1) + 8; var x = _prefix.Right + 12; var limit = right - exitWidth - 12; foreach (var key in prefix.Keys) { - var width = Measure(key.Keys, size, bold: true) + 16; + var width = Measure(NativeKeys.Words(key.Keys), size, bold: true) + 16; if (x + width > limit) { break; @@ -552,12 +558,12 @@ private void DrawPrefix(DrawingContext context, HeaderPrefix prefix, ChromeOverl { var colour = key.Available ? Ink : Faint(0x60); context.DrawRectangle(new SolidColorBrush(Raised(key.Available ? 0.12 : 0.04)), new Pen(new SolidColorBrush(Faint(key.Available ? (byte)0x40 : (byte)0x20)), 1), area.Deflate(0.5), 5, 5); - Text(context, key.Keys, area.X + 8, middle, size, colour, bold: true); + Text(context, NativeKeys.Words(key.Keys), area.X + 8, middle, size, colour, bold: true); } if (_exit.Width > 0) { - Text(context, prefix.Exit, _exit.Right, middle, size - 1, Dim, alignRight: true); + Text(context, NativeKeys.Words(prefix.Exit), _exit.Right, middle, size - 1, Dim, alignRight: true); } } } @@ -587,7 +593,7 @@ internal sealed class NativeSidebar(TerminalView view) : NativeChromeView(view) internal const string AddGameText = "+ Add a game or connect"; /// The fold button's tooltip, open and folded. - internal const string FoldTip = "Fold the sidebar (⌃B b)", UnfoldTip = "Open the sidebar (⌃B b)"; + internal const string FoldTip = "Fold the sidebar (Ctrl+B b)", UnfoldTip = "Open the sidebar (Ctrl+B b)"; /// One drawn row: what it is, where, and its node. internal sealed record Row(RailRowKind Kind, Rect Area, RailWorld World, RailCharacter? Character = null, RailWindow? Window = null); diff --git a/src/SharpMUTerm.Avalonia/NativeKeys.cs b/src/SharpMUTerm.Avalonia/NativeKeys.cs new file mode 100644 index 00000000..e2e8fba6 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/NativeKeys.cs @@ -0,0 +1,31 @@ +using SharpMUTerm.Client.Palette; + +namespace SharpMUTerm.Avalonia; + +/// +/// How every native surface in the window spells a key: in words (Alt+2, Ctrl+W, Ctrl+B b), the way a +/// desktop application labels one, never the terminal's glyphs (⌥2, ⌃W). The client writes its keys and its +/// sentences about keys in glyphs, because the terminal draws them in a cell font where they read well; the window draws +/// in a UI font, where they read smaller than the words around them, and a menu saying ⌥2 beside a sidebar saying +/// Alt+2 reads as two different modifiers. So whatever the client hands a native view to show — a menu's keys, a +/// notice and its key chip, a palette entry's detail, the composer's key row, a modal's sentences, a tooltip — passes +/// through on its way to the screen. NativeKeySpellingTests scans the native surfaces for a +/// glyph that got through. The cells keep their glyphs. +/// +internal static class NativeKeys +{ + /// The key glyphs the window never shows: the three modifiers and the Enter key. + internal static readonly char[] Glyphs = ['⌃', '⌥', '⇧', '⏎']; + + /// + /// with every key glyph spelt as a word — ⌃⏎ is Ctrl+Enter, as the modal footers + /// and the window's own chords (HostChord's words) say it; null is empty. + /// + public static string Words(string? text) => + string.IsNullOrEmpty(text) || text.IndexOfAny(Glyphs) < 0 + ? text ?? string.Empty + : KeyGlyphs.Words(text).Replace("⏎", "Enter", StringComparison.Ordinal); + + /// Whether still holds a modifier glyph. + public static bool HasGlyph(string? text) => text is not null && text.IndexOfAny(Glyphs) >= 0; +} diff --git a/src/SharpMUTerm.Avalonia/NativeMenu.cs b/src/SharpMUTerm.Avalonia/NativeMenu.cs index e541dc15..4fec29b2 100644 --- a/src/SharpMUTerm.Avalonia/NativeMenu.cs +++ b/src/SharpMUTerm.Avalonia/NativeMenu.cs @@ -65,16 +65,16 @@ private static ContextMenu Build( return menu; } - /// An entry's label with its key after it, the keys lined up in a column of their own. + /// An entry's label with its key after it, the keys lined up in a column of their own, both in the window's words. private static Control Header(string label, string? hint) { var grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "label" }); grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "hint" }); - grid.Children.Add(new TextBlock { Text = label, VerticalAlignment = VerticalAlignment.Center }); + grid.Children.Add(new TextBlock { Text = NativeKeys.Words(label), VerticalAlignment = VerticalAlignment.Center }); if (hint is { } key) { - var text = new TextBlock { Text = key, Opacity = 0.6, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; + var text = new TextBlock { Text = NativeKeys.Words(key), Opacity = 0.6, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; Grid.SetColumn(text, 1); grid.Children.Add(text); } diff --git a/src/SharpMUTerm.Avalonia/NoticeToasts.cs b/src/SharpMUTerm.Avalonia/NoticeToasts.cs index 2b1f0fc8..8adbc0fb 100644 --- a/src/SharpMUTerm.Avalonia/NoticeToasts.cs +++ b/src/SharpMUTerm.Avalonia/NoticeToasts.cs @@ -18,7 +18,11 @@ namespace SharpMUTerm.Avalonia; /// message log stays the history: a toast fades after and is not kept. /// /// Input. Only a toast is hit: the control paints nothing between its toasts, and Avalonia hits only what was -/// painted, so everywhere else in the control the pointer goes through to the cells. While the pointer is over a toast it stays, and for a moment after it leaves. A left click on +/// painted, so everywhere else in the control the pointer goes through to the cells. While the pointer is over a toast it stays, and for a moment after it leaves. +/// And while the pointer is over any toast the stack does not move: every toast keeps the place it had when the pointer +/// arrived (), so an older one fading out leaves a gap instead of letting the stack fall and carry the +/// hovered toast out from under the pointer; a notice arriving meanwhile goes above the stack. The stack closes up once +/// the pointer leaves. A left click on /// a toast with an action runs it — through , the registry, never a command the window /// built — and a click without one, or a right click, dismisses it. Nothing here is focusable, so a toast never takes /// the keyboard from the command line. @@ -42,6 +46,11 @@ internal sealed class NoticeToasts : Control private readonly DispatcherTimer _timer; private Point? _pointer; + // Where each toast was when the pointer came onto the stack, and the bounds that was measured in; null while the + // pointer is off it. While set, the stack holds still under the pointer. + private Dictionary? _frozen; + private Rect _frozenBounds; + public NoticeToasts() { Focusable = false; @@ -57,6 +66,28 @@ public NoticeToasts() /// The bottom of the stack, in this control's coordinates: just above the pane area's last row. internal double Bottom { get; set; } + /// + /// What a toast must not cover, in this control's coordinates — the native map's legend. A toast that would land on + /// one is lifted to sit above it, and the rest of the stack goes up with it. + /// + internal IReadOnlyList Avoid + { + get => _avoid; + set + { + if (!_avoid.SequenceEqual(value)) + { + _avoid = value; + InvalidateVisual(); + } + } + } + + private IReadOnlyList _avoid = []; + + /// Whether the stack is holding still because the pointer is over a toast. Internal for tests. + internal bool Frozen => _frozen is not null; + /// Shows a notice the client said. A toast for the same notice (by sequence) is not shown twice. public void Show(NoticeOverlay overlay) { @@ -67,9 +98,11 @@ public void Show(NoticeOverlay overlay) } _toasts.Add(new Toast(overlay, _clock.Elapsed)); + var hovered = HoveredToast(); while (_toasts.Count > MaxShown) { - _toasts.RemoveAt(0); + // The oldest goes, unless the pointer is on it: then the next oldest. + _toasts.Remove(_toasts.First(t => t != hovered)); } _timer.Start(); @@ -109,12 +142,24 @@ internal void Advance(TimeSpan by) Tick(); } + /// The words each toast draws — its key chip, its text and its action — oldest first. Internal for tests. + internal IReadOnlyList DrawnText() => + Layout().SelectMany(l => new[] { ChipText(l.Toast), BodyText(l.Toast), ActionText(l.Toast) }).OfType().ToList(); + + // What a toast says, in the window's words (NativeKeys): the key chip, the text, the action line. + private static string? ChipText(Toast toast) => toast.Overlay.Notice.Key is { } key ? NativeKeys.Words(key) : null; + + private static string BodyText(Toast toast) => NativeKeys.Words(toast.Overlay.Notice.Text); + + private static string? ActionText(Toast toast) => toast.Overlay.Notice.Action is { } a ? $"{NativeKeys.Words(a.Label)} ›" : null; + /// Where each toast is drawn, oldest first, in this control's coordinates. Internal for tests. internal IReadOnlyList Rects() => Layout().Select(l => l.Rect).ToList(); private void Tick() { var now = _clock.Elapsed; + SyncFreeze(); var hovered = HoveredToast(); foreach (var toast in _toasts) { @@ -150,12 +195,40 @@ private static double FadeOf(Toast toast, TimeSpan now) private Toast? HoveredToast() => _pointer is { } at ? Layout().LastOrDefault(l => l.Rect.Contains(at)).Toast : null; + /// + /// Freezes the stack where it is when the pointer comes onto a toast, and lets it close up when the pointer leaves + /// every toast (or the control is resized, which re-measures everything anyway). + /// + private void SyncFreeze() + { + if (_frozen is not null && (_pointer is null || _frozenBounds != Bounds || HoveredToast() is null)) + { + _frozen = null; + InvalidateVisual(); + } + + if (_frozen is null && _pointer is { } at) + { + var placed = Layout(); + if (placed.Any(l => l.Rect.Contains(at))) + { + _frozen = placed.ToDictionary(l => l.Toast); + _frozenBounds = Bounds; + } + } + } + // ── Layout ─────────────────────────────────────────────────────────────────────────────── private readonly record struct Placed(Toast Toast, Rect Rect, FormattedText Text, FormattedText? Chip, FormattedText? Action); private List Layout() { + if (_frozen is not null) + { + return FrozenLayout(_frozen); + } + var placed = new List(); var width = Math.Min(CardWidth, Bounds.Width - (2 * Inset)); if (width < 120 || _toasts.Count == 0) @@ -164,33 +237,74 @@ private List Layout() } var bottom = (Bottom > 0 ? Math.Min(Bottom, Bounds.Height) : Bounds.Height) - Gap; - var x = Bounds.Width - Inset - width; // Newest at the bottom: lay out from the newest upwards, then hand them back oldest first. for (var i = _toasts.Count - 1; i >= 0; i--) { - var toast = _toasts[i]; - var palette = toast.Overlay.Palette; - var ink = PanelText.Parse(palette.Text); - var inner = width - EdgeWidth - (2 * Padding); - var chip = toast.Overlay.Notice.Key is { } key ? Format(key, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; - var textWidth = inner - (chip is null ? 0 : chip.Width + 8); - var text = Format(toast.Overlay.Notice.Text, TextSize, ink, bold: false, Math.Max(40, textWidth), lines: 3); - var action = toast.Overlay.Notice.Action is { } a ? Format($"{a.Label} ›", ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; - var height = (2 * Padding) + text.Height + (action is null ? 0 : action.Height + 6); - var top = bottom - height; - if (top < Inset) + var one = Measure(_toasts[i], width, bottom); + while (one is { } landed && _avoid.FirstOrDefault(a => a.Intersects(landed.Rect.Inflate(Gap / 2))) is { Height: > 0 } obstacle) + { + one = Measure(_toasts[i], width, obstacle.Top - Gap); + } + + if (one is null) { break; } - placed.Insert(0, new Placed(toast, new Rect(x, top, width, height), text, chip, action)); - bottom = top - Gap; + placed.Insert(0, one.Value); + bottom = one.Value.Rect.Top - Gap; } return placed; } + /// + /// The stack while the pointer is on it: every toast that was there keeps its place (a gap where one has gone), and a + /// toast that has arrived since is stacked above the topmost, newest nearest the stack, while there is room. + /// + private List FrozenLayout(Dictionary frozen) + { + var kept = _toasts.Where(frozen.ContainsKey).Select(t => frozen[t]).ToList(); + var arrived = _toasts.Where(t => !frozen.ContainsKey(t)).ToList(); + if (arrived.Count == 0) + { + return kept; + } + + var top = frozen.Values.Min(p => p.Rect.Top) - Gap; + var above = new List(); + for (var i = arrived.Count - 1; i >= 0; i--) + { + if (Measure(arrived[i], frozen.Values.First().Rect.Width, top) is not { } placed) + { + break; + } + + above.Insert(0, placed); + top = placed.Rect.Top - Gap; + } + + // Oldest first, as the open layout hands them back: everything above the frozen block is newer than it. + return [.. kept, .. above]; + } + + /// One toast placed with its bottom at , or null when it would not fit below the inset. + private Placed? Measure(Toast toast, double width, double bottom) + { + var x = Bounds.Width - Inset - width; + var palette = toast.Overlay.Palette; + var ink = PanelText.Parse(palette.Text); + var inner = width - EdgeWidth - (2 * Padding); + var chip = ChipText(toast) is { } key ? Format(key, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var textWidth = inner - (chip is null ? 0 : chip.Width + 8); + var text = Format(BodyText(toast), TextSize, ink, bold: false, Math.Max(40, textWidth), lines: 3); + var action = ActionText(toast) is { } a ? Format(a, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var height = (2 * Padding) + text.Height + (action is null ? 0 : action.Height + 6); + var top = bottom - height; + return top < Inset ? null : new Placed(toast, new Rect(x, top, width, height), text, chip, action); + } + private static FormattedText Format(string text, double size, Color colour, bool bold, double maxWidth, int lines = 1) => new(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(FontFamily.Default, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), size, new SolidColorBrush(colour)) @@ -208,9 +322,10 @@ protected override void OnPointerMoved(PointerEventArgs e) { base.OnPointerMoved(e); _pointer = e.GetPosition(this); + SyncFreeze(); var over = HoveredToast(); Cursor = new Cursor(over?.Overlay.Notice.Action is not null ? StandardCursorType.Hand : StandardCursorType.Arrow); - ToolTip.SetTip(this, over?.Overlay.Notice.Action is { } action ? $"{action.Label} — click" : over is null ? null : "Click to dismiss"); + ToolTip.SetTip(this, over?.Overlay.Notice.Action is { } action ? $"{NativeKeys.Words(action.Label)} — click" : over is null ? null : "Click to dismiss"); e.Handled = true; Tick(); } @@ -219,6 +334,7 @@ protected override void OnPointerExited(PointerEventArgs e) { base.OnPointerExited(e); _pointer = null; + SyncFreeze(); ToolTip.SetTip(this, null); } diff --git a/src/SharpMUTerm.Avalonia/PackagePageView.cs b/src/SharpMUTerm.Avalonia/PackagePageView.cs index f504b23f..6ea88a2f 100644 --- a/src/SharpMUTerm.Avalonia/PackagePageView.cs +++ b/src/SharpMUTerm.Avalonia/PackagePageView.cs @@ -176,7 +176,7 @@ public void Refresh() BuildReview(); } - _status.Text = _manager.Status ?? string.Empty; + _status.Text = NativeKeys.Words(_manager.Status); _status.IsVisible = _manager.Status is not null; } @@ -222,7 +222,7 @@ private void BuildInstalled() VerticalAlignment = VerticalAlignment.Center, }; AutomationProperties.SetName(toggle, $"{item.Package.Manifest.Name} on"); - ToolTip.SetTip(toggle, _declaration.Action(PackageCollection.Toggle).Help); + ToolTip.SetTip(toggle, NativeKeys.Words(_declaration.Action(PackageCollection.Toggle).Help)); var captured = item; toggle.IsCheckedChanged += (_, _) => { @@ -281,7 +281,7 @@ private void BuildDetail() ShownFields = []; _detail.Children.Add(new TextBlock { - Text = "No package is installed. Browse the index, or use ⌃P ▸ Install package… with a file or an https link.", + Text = "No package is installed. Browse the index, or use Ctrl+P ▸ Install package… with a file or an https link.", TextWrapping = TextWrapping.Wrap, Opacity = 0.75, Margin = new Thickness(0, 8, 0, 8), @@ -316,7 +316,7 @@ private void BuildDetail() var label = new TextBlock { Text = Capitalise(field.Label), Opacity = 0.75 }; if (field.Help is { } help) { - ToolTip.SetTip(label, Capitalise(help)); + ToolTip.SetTip(label, NativeKeys.Words(Capitalise(help))); } var value = new TextBlock { Text = Text(field.Id, item), TextWrapping = TextWrapping.Wrap }; @@ -392,7 +392,7 @@ private Button ActionButton(string action, string text) { var button = new Button { Content = text, Margin = new Thickness(0, 0, 8, 6), Padding = new Thickness(12, 5) }; var declared = _declaration.Action(action); - ToolTip.SetTip(button, $"{Capitalise(declared.Help)} ({declared.Key} on the cell screen)"); + ToolTip.SetTip(button, NativeKeys.Words($"{Capitalise(declared.Help)} ({declared.Key} on the cell screen)")); AutomationProperties.SetName(button, text); return button; } diff --git a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs index 0f674b7a..80e9180e 100644 --- a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs +++ b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs @@ -17,7 +17,7 @@ namespace SharpMUTerm.Avalonia; /// The window's ⌃P: a rounded card near the top of the window over a faint scrim, with a search box that has the /// keyboard, the status line the cell palette leads with, and the rows of — group /// headers, each entry's title with the matched characters in the accent, its detail dimmed, and its key in a -/// right-aligned column in the host's words (). ↑↓ and PgUp/PgDn walk the entries, +/// right-aligned column in the host's words (). ↑↓ and PgUp/PgDn walk the entries, /// ⏎ runs the selected one, Esc (or ⌃P, or a click outside the card) closes. The pointer selects what it hovers /// and runs what it clicks. /// @@ -82,7 +82,7 @@ public PaletteOverlay(PaletteSession session, Action remove) var footer = new TextBlock { - Text = "↑↓ move ⏎ run Esc close", + Text = "↑↓ move Enter run Esc close", FontSize = 11.5, Foreground = new SolidColorBrush(_colours.Dim), Margin = new Thickness(20, 6, 20, 10), @@ -237,7 +237,7 @@ private void Refresh(bool resetSelection) break; case PaletteEntry entry: _rowTexts.Add(entry.Item.Title); - var key = entry.Key is null ? null : KeyGlyphs.Words(entry.Key); + var key = entry.Key is null ? null : NativeKeys.Words(entry.Key); _keyTexts.Add(key); var drawn = EntryRow(entry, key, _entryRows.Count); _entryRows.Add(drawn); @@ -283,7 +283,7 @@ private Border EntryRow(PaletteEntry entry, string? key, int index) { var words = new TextBlock { - Text = detail, + Text = NativeKeys.Words(detail), FontSize = 12.5, Foreground = new SolidColorBrush(_colours.Dim), Margin = new Thickness(12, 0, 0, 0), diff --git a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs index de494bcb..507b8efa 100644 --- a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs +++ b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs @@ -119,7 +119,7 @@ private double ItemWidth(QuickBarItem item) { var size = FontSize; var title = Math.Min(MaxTitleWidth, PanelText.Measure(Trim(item), size, false)); - return PadX + PanelText.Measure(item.Key, size, true) + 5 + title + PadX; + return PadX + PanelText.Measure(NativeKeys.Words(item.Key), size, true) + 5 + title + PadX; } private double MoreWidth(int hidden) => PadX + PanelText.Measure($"+{hidden.ToString(CultureInfo.InvariantCulture)}", FontSize, true) + PadX; @@ -214,7 +214,7 @@ private void Hover(Slot? slot) private string? Tip(Slot slot) => slot.Kind switch { - SlotKind.Item when slot.Index < _model.Items.Count => $"{_model.Items[slot.Index].Title} ({_model.Items[slot.Index].Key})", + SlotKind.Item when slot.Index < _model.Items.Count => $"{_model.Items[slot.Index].Title} ({NativeKeys.Words(_model.Items[slot.Index].Key)})", SlotKind.More => $"{slot.Index.ToString(CultureInfo.InvariantCulture)} more", SlotKind.Edit => "Edit the keys (F4)", _ => null, @@ -339,7 +339,7 @@ public override void Render(DrawingContext context) var keyInk = item.Fires ? accent : dim; var titleInk = item.Fires ? _text : dim; var x = rect.Left + PadX; - x += PanelText.Draw(context, item.Key, x, middle, size, keyInk, true, rect.Width) + 5; + x += PanelText.Draw(context, NativeKeys.Words(item.Key), x, middle, size, keyInk, true, rect.Width) + 5; PanelText.Draw(context, Trim(item), x, middle, size, titleInk, false, rect.Right - PadX - x + 0.5); break; } diff --git a/src/SharpMUTerm.Avalonia/QuitView.cs b/src/SharpMUTerm.Avalonia/QuitView.cs index 00210887..1e255fde 100644 --- a/src/SharpMUTerm.Avalonia/QuitView.cs +++ b/src/SharpMUTerm.Avalonia/QuitView.cs @@ -50,7 +50,7 @@ public QuitView(QuitSession session, ModalColours colours, Action done) var dot = new TextBlock { Text = "●", Foreground = colours.Brush(colours.Accent), Margin = new Thickness(0, 0, 10, 0), FontSize = 11, VerticalAlignment = VerticalAlignment.Center }; SetDock(dot, Dock.Left); line.Children.Add(dot); - line.Children.Add(new TextBlock { Text = consequence, Foreground = colours.Brush(colours.Text), TextWrapping = TextWrapping.Wrap, FontSize = 14 }); + line.Children.Add(new TextBlock { Text = NativeKeys.Words(consequence), Foreground = colours.Brush(colours.Text), TextWrapping = TextWrapping.Wrap, FontSize = 14 }); facts.Children.Add(line); } diff --git a/src/SharpMUTerm.Avalonia/SearchView.cs b/src/SharpMUTerm.Avalonia/SearchView.cs index 48b2af3e..13915b8a 100644 --- a/src/SharpMUTerm.Avalonia/SearchView.cs +++ b/src/SharpMUTerm.Avalonia/SearchView.cs @@ -132,8 +132,8 @@ public void Go(int index) private ToggleButton Toggle(string label, string key, bool on) { var content = new StackPanel { Orientation = Orientation.Horizontal }; - content.Children.Add(new TextBlock { Text = label, VerticalAlignment = VerticalAlignment.Center }); - content.Children.Add(new TextBlock { Text = key, FontSize = 11, Opacity = 0.7, Margin = new Thickness(6, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }); + content.Children.Add(new TextBlock { Text = NativeKeys.Words(label), VerticalAlignment = VerticalAlignment.Center }); + content.Children.Add(new TextBlock { Text = NativeKeys.Words(key), FontSize = 11, Opacity = 0.7, Margin = new Thickness(6, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }); var toggle = new ToggleButton { Content = content, @@ -184,7 +184,7 @@ private void Draw() _syncing = false; } - _state.Text = _model.StateText; + _state.Text = NativeKeys.Words(_model.StateText); _count.Text = _model.CountText; _list.Children.Clear(); _rows.Clear(); diff --git a/src/SharpMUTerm.Avalonia/SettingsPresenter.cs b/src/SharpMUTerm.Avalonia/SettingsPresenter.cs index 1d6a01c0..57d73173 100644 --- a/src/SharpMUTerm.Avalonia/SettingsPresenter.cs +++ b/src/SharpMUTerm.Avalonia/SettingsPresenter.cs @@ -16,6 +16,9 @@ internal sealed class SettingsPresenter : INativeSettings /// The window the settings window belongs to, set once the main window exists. public Window? Owner { get; set; } + /// Gives the keyboard back to the client's command line (or an armed docked composer) once the window closes. + public Action? Refocus { get; set; } + /// The open settings window, for a test; read on the window's thread. public SettingsWindow? Window => _window; @@ -29,7 +32,7 @@ internal SettingsWindow ShowNow(SettingsForm form) if (_window is { } open) { open.Load(form); - open.Activate(); + open.FocusFirst(); return open; } @@ -43,6 +46,7 @@ internal SettingsWindow ShowNow(SettingsForm form) // The keyboard goes back to the client, as it does when a cell screen closes. Owner?.Activate(); + Refocus?.Invoke(); }; _window = window; if (Owner is { IsVisible: true } owner) diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index 8ce7edf8..a0050f79 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -93,7 +93,11 @@ public SettingsWindow(SettingsForm form) Content = dock; _clock = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Background, (_, _) => Tick()); - Opened += (_, _) => _clock.Start(); + Opened += (_, _) => + { + _clock.Start(); + FocusFirst(); + }; Closed += (_, _) => { _clock.Stop(); @@ -108,6 +112,18 @@ public SettingsWindow(SettingsForm form) Load(form); } + /// + /// Takes the keyboard: the window comes forward and the search box has focus, as the palette's does. Without it a + /// window manager that does not activate a new window (or none, under Xvfb) left the keys in the main window, where + /// the focus pin put them on the command line — so what the player typed into "the settings" went into a line ⏎ + /// would send to the game. + /// + public void FocusFirst() + { + Activate(); + _search.Focus(); + } + /// The section on the right, by id. public string? ShownSection => _shown; @@ -461,10 +477,10 @@ private StackPanel ThemePicker(ThemeField field) { var outer = new StackPanel { Spacing = 6, Margin = new Thickness(0, 4, 0, 4) }; var words = new StackPanel { Spacing = 1 }; - words.Children.Add(new TextBlock { Text = Capitalise(field.Label), FontSize = 14 }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = 14 }); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = Capitalise(help), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); } outer.Children.Add(words); @@ -510,10 +526,10 @@ private Grid FieldRow(SettingsField field) var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto,Auto"), Margin = new Thickness(0, 4), MinHeight = 44 }; var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Spacing = 1, Margin = new Thickness(0, 0, 16, 0) }; - words.Children.Add(new TextBlock { Text = Capitalise(field.Label), FontSize = 14, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = 14, TextWrapping = TextWrapping.Wrap }); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = Capitalise(help), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); } grid.Children.Add(words); @@ -711,10 +727,10 @@ private StackPanel MeterTable(ListField field) var top = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; var words = new StackPanel { Spacing = 1 }; - words.Children.Add(new TextBlock { Text = Capitalise(field.Label), FontSize = 14 }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = 14 }); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = Capitalise(help), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); } top.Children.Add(words); diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index 72248144..f3016d15 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -165,8 +165,8 @@ private void DrawMenu() var index = i; var (title, detail) = _model.Describe(choice); var words = new StackPanel(); - words.Children.Add(new TextBlock { Text = title, FontSize = 14.5, FontWeight = FontWeight.Medium, Foreground = _colours.Brush(_colours.Text) }); - words.Children.Add(new TextBlock { Text = detail, FontSize = 12, Foreground = _colours.Brush(_colours.Dim) }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(title), FontSize = 14.5, FontWeight = FontWeight.Medium, Foreground = _colours.Brush(_colours.Text) }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(detail), FontSize = 12, Foreground = _colours.Brush(_colours.Dim) }); var row = ModalParts.Row(words, title, () => SelectChoice(index), () => Choose(choice)); row.Padding = new Thickness(12, 8); _choiceRows.Add(row); @@ -268,7 +268,7 @@ private void DrawProblem() { if (_body.Children.OfType().FirstOrDefault(t => t.Name == "Problem") is { } problem) { - problem.Text = _model.Problem ?? string.Empty; + problem.Text = NativeKeys.Words(_model.Problem); problem.IsVisible = _model.Problem is not null; } } diff --git a/src/SharpMUTerm.Client/Composer/ComposerSession.cs b/src/SharpMUTerm.Client/Composer/ComposerSession.cs index 42c4755e..f5868763 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerSession.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerSession.cs @@ -29,6 +29,15 @@ public sealed record ComposerCallbacks /// Esc (or F1) in F1: the window closes, with the buffer to keep. public Action? Closed { get; init; } + + /// + /// Whether the composer's character writes in a proportional face — read by the host on its own thread, so it reads + /// the character's saved choice live and every composer of that character follows a change. Null: monospace. + /// + public Func? Proportional { get; init; } + + /// The editor's menu chose a face (true for proportional), for the character to keep. + public Action? ChooseFace { get; init; } } /// @@ -144,6 +153,18 @@ public void Arm() } } + /// Whether this composer's character writes in a proportional face; false (monospace) with nobody to ask. + public bool Proportional => _callbacks.Proportional?.Invoke() ?? false; + + /// The host's: the editor's menu chose a face. + public void ChooseFace(bool proportional) + { + if (!IsEnded) + { + _callbacks.ChooseFace?.Invoke(proportional); + } + } + /// The host's: F1 closing by Esc, with the buffer. public void Close(string body) => Pass(_callbacks.Closed, Normalise(body)); diff --git a/src/SharpMUTerm.Client/Modals/HistoryModel.cs b/src/SharpMUTerm.Client/Modals/HistoryModel.cs index d4b5d6a7..5890b810 100644 --- a/src/SharpMUTerm.Client/Modals/HistoryModel.cs +++ b/src/SharpMUTerm.Client/Modals/HistoryModel.cs @@ -56,6 +56,12 @@ public HistorySession(HistoryModel model, bool isDark, Action insert, Actio public override string Surface => "history"; + /// + /// What the filter box opens with typed in; empty for nothing. The history-search-filter view hands its query + /// here, as menu-fuzzy hands its query to the palette, so the window's frame is filtered as the cells' is. + /// + public string InitialQuery { get; init; } = string.Empty; + /// The host's: ⏎ on the entry at in . public void Insert(int entryIndex) { diff --git a/src/SharpMUTerm.Client/Settings/SettingsForm.cs b/src/SharpMUTerm.Client/Settings/SettingsForm.cs index f4334a45..8296e85e 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsForm.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsForm.cs @@ -308,6 +308,26 @@ public void Reset(SettingsField field) /// Edits 's fields from now on (null for none). public void Select(object? item) => _item = item; + /// + /// The item each list section last had selected, by section id, for the run: the host's, so it outlives this form + /// and a list opened again (or a section switched back to) lands where it was left. Null keeps nothing. Read and + /// written on the window's thread only. + /// + public IDictionary? Selections { get; init; } + + /// The item last had selected, or null. + public object? Recall(string sectionId) => + Selections is { } kept && kept.TryGetValue(sectionId, out var item) ? item : null; + + /// Keeps as 's selection for the run. + public void Remember(string sectionId, object? item) + { + if (Selections is { } kept && item is not null) + { + kept[sectionId] = item; + } + } + /// /// 's items, by set: the player's own sets in order, then every installed package's sets, /// read-only. Each set's items are a snapshot of its list now. diff --git a/src/SharpMUTerm.Core/Configuration/CharacterDefinition.cs b/src/SharpMUTerm.Core/Configuration/CharacterDefinition.cs index 2cd142e0..11c08262 100644 --- a/src/SharpMUTerm.Core/Configuration/CharacterDefinition.cs +++ b/src/SharpMUTerm.Core/Configuration/CharacterDefinition.cs @@ -143,6 +143,13 @@ public sealed class CharacterDefinition /// public string? Layout { get; set; } + /// + /// Whether this character's posts are written in a proportional face in the window's native composer, rather than + /// the cells' monospace one (the editor's right-click menu). The window's presentation only: the terminal's composer + /// is cells and has one face. False — monospace — by default, so no migration marks anybody. + /// + public bool ComposerProportional { get; set; } + /// Logging is configured per character. public LoggingSettings Logging { get; set; } = new(); @@ -187,6 +194,7 @@ public sealed class CharacterDefinition TriggerSets = new List(TriggerSets), Tint = Tint, Layout = Layout, + ComposerProportional = ComposerProportional, Logging = new LoggingSettings { Format = Logging.Format, diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index ef463426..f5feef89 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -1,6 +1,7 @@ using SharpConsoleUI; using SharpConsoleUI.Builders; using SharpConsoleUI.Controls; +using SharpConsoleUI.Layout; using SharpMUTerm.Core.Packages; namespace SharpMUTerm.Tui; @@ -68,7 +69,7 @@ public void Open( var widest = Math.Clamp(desktop.Width - 8, 44, 110); var outer = width is { } asked ? Math.Clamp(asked + 4, 24, widest) : widest; var lines = render(outer - 4); - var height = Math.Clamp(lines.Count + 2, 8, Math.Max(8, desktop.Height - 2)); + var height = Math.Clamp(Rows(lines, outer - 3) + 2, 8, Math.Max(8, desktop.Height - 2)); _content = new MarkupControl(_scheme.Lines(lines, ScreenPalette.MenuBg)); // Centered() after WithSize(), for CommandPalette's reason. @@ -102,6 +103,24 @@ public void Open( Mode = mode; } + /// + /// The rows take at , wrapped the way the window's control will wrap + /// them — measured by the framework, never counted. A line wider than the window (F10's key line at 80 columns) is + /// two rows, and sizing the modal by the line count left the last row of F10's detail under its bottom edge. One + /// column narrower than the content, so a scroll bar's column cannot add a row the measure missed. + /// + internal static int Rows(IReadOnlyList lines, int width) + { + if (lines.Count == 0) + { + return 0; + } + + var probe = new MarkupControl(lines.ToList()); + width = Math.Max(1, width); + return Math.Max(lines.Count, probe.MeasureDOM(new LayoutConstraints(width, width, 0, int.MaxValue)).Height); + } + public void Repaint() { if (_render is not null && _content is not null) diff --git a/src/SharpMUTerm.Tui/PackageScreen.cs b/src/SharpMUTerm.Tui/PackageScreen.cs index b68f2272..ce6ee8b8 100644 --- a/src/SharpMUTerm.Tui/PackageScreen.cs +++ b/src/SharpMUTerm.Tui/PackageScreen.cs @@ -121,11 +121,12 @@ string Read(string id, PackageItem item) => + $"[{ScreenPalette.Value}]{Escape(Elide(Read(field.Id, current), Math.Max(10, width - 14)))}[/]"); } - if (confirmingRemove) - { - lines.Add(string.Empty); - lines.Add($"[bold {ScreenPalette.Warn}]Remove {Escape(Read(name, current))} and its files? Del again removes it, any other key keeps it.[/]"); - } + // The question's rows are always there, blank until Del asks it: the modal is sized once, when it opens, and a + // question added later would land under its bottom edge. Elided to one row for the same reason. + lines.Add(string.Empty); + lines.Add(confirmingRemove + ? $"[bold {ScreenPalette.Warn}]{Escape(Elide($"Remove {Read(name, current)} and its files? Del again removes it, any other key keeps it.", width))}[/]" + : string.Empty); return lines; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs index 56f32614..706e3499 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs @@ -110,6 +110,8 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, } }), AddWord = word => OnUiThread(() => AddComposerWord(word)), + Proportional = ComposerFaceOf(ComposeDraftKey(ActiveWindowId())), + ChooseFace = ChooseComposerFace(ComposeDraftKey(ActiveWindowId())), Closed = body => OnUiThread(() => { if (ReferenceEquals(_nativeCompose, open)) @@ -125,6 +127,31 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, PublishHostChrome(); } + /// + /// The face a character's native composer writes in, read on the host's thread: the character's saved choice + /// (), looked up afresh each time so a change made in one of its + /// composers reaches the other. A composer that belongs to nobody writes in monospace. + /// + private Func ComposerFaceOf(string? sessionKey) + { + var character = sessionKey is null ? null : CharacterFor(sessionKey); + return () => character?.ComposerProportional ?? false; + } + + /// + /// Keeps a face chosen in a character's native composer as that character's, on disk. Through + /// — a view preference, which must not go through SaveConfiguration, whose + /// automation reload re-periodises every running timer. + /// + private Action ChooseComposerFace(string? sessionKey) => proportional => OnUiThread(() => + { + if (sessionKey is not null && CharacterFor(sessionKey) is { } character && character.ComposerProportional != proportional) + { + character.ComposerProportional = proportional; + PersistConfiguration(); + } + }); + /// /// A host editor's colours: the accent its title and keys wear, and the settings screens' warning for the line under /// a misspelling — the colour the cell editor marks the word in. @@ -242,6 +269,8 @@ private ComposerSession DockedSessionFor(DockedComposer composer) } }), Arm = () => OnUiThread(() => ArmComposer(composer)), + Proportional = ComposerFaceOf(composer.SessionKey), + ChooseFace = ChooseComposerFace(composer.SessionKey), }); _dockedSessions[composer.WindowId] = session; return session; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs index bdb1730a..e5e6e6b0 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs @@ -147,8 +147,8 @@ private bool TryOpenNativeSearch() return true; } - /// Opens ⌃R in the host's controls; false when the host has none. - private bool TryOpenNativeHistory() + /// Opens ⌃R in the host's controls, typed into its filter; false when the host has none. + private bool TryOpenNativeHistory(string query = "") { if (NativeModalsHost is not { } native) { @@ -160,7 +160,10 @@ private bool TryOpenNativeHistory() new HistoryModel(HistoryFor(BarKind(ActiveBar())).Entries.ToArray(), HistoryBarLabel()), ThemeIsDark(), index => OnUiThread(() => InsertHistoryEntry(index)), - () => OnUiThread(() => NativeModalClosed(session!))); + () => OnUiThread(() => NativeModalClosed(session!))) + { + InitialQuery = query, + }; ShowNativeModal(native, session); return true; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index 99d4bcee..7673d611 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -357,7 +357,8 @@ private void SyncDockedComposers(string? sessionKey) /// /// Paints who holds the keyboard: the armed composer's header marker, and both command lines idle while a - /// composer has it — ⏎ there inserts a line, it does not send. + /// composer has it — ⏎ there inserts a line, it does not send — or while ⌥C has put the keys on the sidebar, where ⏎ + /// goes to a row. Cells in both hosts, so the window's command line follows with nothing of its own. /// private void SyncComposerBands() { @@ -375,8 +376,9 @@ private void SyncComposerBands() composer.Armed = ReferenceEquals(composer, armed); } - _input.Armed = armed is null && ReferenceEquals(_armed, _input); - _second.Armed = armed is null && ReferenceEquals(_armed, _second); + var barHolds = armed is null && _railCursor is null; + _input.Armed = barHolds && ReferenceEquals(_armed, _input); + _second.Armed = barHolds && ReferenceEquals(_armed, _second); SyncStatusMode(); // the composer's keys on the status row, or the pane's again } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs index 6b5d1f12..9cec4dc2 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs @@ -68,6 +68,8 @@ private void ToggleRailKeys() ?? rows[0]; _railCursor = SidebarModel.KeyOf(start); RefreshRail(); + SyncComposerBands(); // the command line goes idle: ⏎ goes to a row now, not to the game + UpdateInputChrome(); // and its prompt with it, which is painted to match the band Notice("sidebar: ↑↓ walk · ⏎ goes · Esc returns", MessageSeverity.Info, "⌥C"); } @@ -81,6 +83,8 @@ private void LeaveRailKeys() _railCursor = null; RefreshRail(); + SyncComposerBands(); + UpdateInputChrome(); } /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs index 170ce1a0..7c490e18 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs @@ -152,6 +152,12 @@ private bool TryOpenNativeSettings(SettingsSectionContribution? section, object? /// meter table reads the game data of the window focused when the form opened (), /// captured here because the store is thread-safe and the focus is not. /// + /// + /// Each native list section's last selected item, by section id, for the run — never saved (which rule was being + /// looked at is not configuration). Touched only on the window's thread, through the form. + /// + private readonly Dictionary _listSelections = new(StringComparer.Ordinal); + internal SettingsForm NativeSettingsForm(string initial, object? item = null) { var edits = new ScreenEdits(SaveConfiguration); @@ -185,6 +191,7 @@ internal SettingsForm NativeSettingsForm(string initial, object? item = null) item) { Packages = PackageManager, + Selections = _listSelections, }; return form; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 103ff25a..0bed1259 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1659,11 +1659,20 @@ public string RenderSnapshot(string? view = null) // In a host that draws ⌃F itself, the same query through the native surface's session (the window's // screenshots); the parity harness and the terminal have none and take the cell path below. - if (!string.Equals(view, "search-landed", StringComparison.OrdinalIgnoreCase) && TryOpenNativeSearch()) + // `search-landed` goes there too: ↓ then ⏎ on the native list is the second hit's row handed to + // GoToSearchHit, the method the cell ⏎ ends in, so the frame left behind is the cells' landing. + if (TryOpenNativeSearch()) { var all = string.Equals(view, "search-all", StringComparison.OrdinalIgnoreCase); var regex = string.Equals(view, "search-regex", StringComparison.OrdinalIgnoreCase); NativeSearch!.Search(regex ? @"gobl\w+ (corpse|for)" : "goblin", regex, all); + if (string.Equals(view, "search-landed", StringComparison.OrdinalIgnoreCase) && NativeSearch is { } landing && landing.Model.Rows.Count > 0) + { + var hits = landing.Model; + CloseNativeModal(landing); + GoToSearchHit(hits, Math.Min(1, hits.Rows.Count - 1)); + SettleScroll(); + } } else { @@ -1779,13 +1788,15 @@ public string RenderSnapshot(string? view = null) // seeded here on purpose: the frame is where "the password is not in the list" is visible. HistoryFor(InputBar.Primary).Add("connect Corvid hunter2"); - // A host that draws ⌃R itself filters in its own box, so only the list is handed over there. - if (!TryOpenNativeHistory()) + // A host that draws ⌃R itself filters in its own box, so there the query is handed over as the box's + // opening text — `menu-fuzzy`'s way with the native palette — and the frame is filtered in both hosts. + var filter = view.EndsWith("-filter", StringComparison.OrdinalIgnoreCase) ? "north" : string.Empty; + if (!TryOpenNativeHistory(filter)) { _historySearch.OpenForSnapshot(); - if (view.EndsWith("-filter", StringComparison.OrdinalIgnoreCase)) + if (filter.Length > 0) { - _historySearch.SimulateTyping("north"); + _historySearch.SimulateTyping(filter); } } } @@ -2752,6 +2763,16 @@ internal async Task StartAsync(IReadOnlyList startup) { ArgumentNullException.ThrowIfNull(startup); + // A launch has one startup pass. The window's demo lays its scene out on the loop's first tick and the + // welcome scene runs this pass itself, and then Run schedules its own — which raised the empty + // configuration's notice twice, two identical toasts stacked in the window. The second is the one ignored. + if (_startupRan) + { + return; + } + + _startupRan = true; + if (startup.Count == 0) { // Two different states, and telling them apart is the whole value of the message: nothing @@ -2800,6 +2821,9 @@ internal async Task StartAsync(IReadOnlyList startup) /// the welcome leaves behind when it is closed, so it names the welcome's way back as well as the two ways /// in; and it is short enough for an 80-column status row, which a longer one wrapped onto a second row. /// + /// Set by the first ; a launch runs its startup pass once. + private bool _startupRan; + internal const string NoWorldsNotice = "No world configured · /connect · F5 adds one · /welcome"; diff --git a/tests/SharpMUTerm.Avalonia.Tests/ListEditorTests.cs b/tests/SharpMUTerm.Avalonia.Tests/ListEditorTests.cs index de37fbab..c4662808 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/ListEditorTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/ListEditorTests.cs @@ -186,6 +186,44 @@ public async Task AFormOpenedOnARuleSelectsIt() await Assert.That(row).IsSameReferenceAs(tell); } + [Test] + public async Task AListKeepsItsSelectionAcrossASectionSwitchAndAReopen() + { + var harness = new Harness(); + harness.Config.TriggerSets[0].Aliases.Add(new Alias { Name = "n", Pattern = "n" }); + var kept = new Dictionary(StringComparer.Ordinal); + var tell = harness.Own.Triggers[1]; + var (afterSwitch, afterReopen) = await TerminalViewTests.Session.Dispatch(() => + { + static void Pick(SettingsWindow window, string id) + { + window.SectionList.SelectedItem = window.SectionList.Items.OfType().First(i => Equals(i.Tag, id)); + Dispatcher.UIThread.RunJobs(); + } + + var form = new SettingsForm(BuiltInSettings.All, harness.Config, c => c(), _ => { }, "triggers", isDark: true) { Selections = kept }; + var window = new SettingsWindow(form); + window.Show(); + Dispatcher.UIThread.RunJobs(); + window.ListEditor!.Choose(tell); + Pick(window, "aliases"); + Pick(window, "triggers"); + var switched = window.ListEditor!.SelectedItem; + window.Close(); + + // A new window, on a new form, as F2 opens one: the run's memory brings it back to the same rule. + var again = new SettingsWindow(new SettingsForm(BuiltInSettings.All, harness.Config, c => c(), _ => { }, "triggers", isDark: true) { Selections = kept }); + again.Show(); + Dispatcher.UIThread.RunJobs(); + var reopened = again.ListEditor!.SelectedItem; + again.Close(); + return (switched, reopened); + }, CancellationToken.None); + + await Assert.That(afterSwitch).IsSameReferenceAs(tell); + await Assert.That(afterReopen).IsSameReferenceAs(tell); + } + [Test] public async Task TheSearchFindsAnItemFieldAndShowsOnlyIt() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs index 0f3dedda..ce708831 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs @@ -126,7 +126,7 @@ public async Task F1OpensTheNativeEditorFocusedOverTheCellsAndNotTheCellModal() await Assert.That(focused).IsTrue(); await Assert.That(cellOpen).IsFalse(); await Assert.That(header).Contains("COMPOSE").And.Contains("to Ann").And.Contains("as typed").And.Contains("no dictionary"); - await Assert.That(footer).Contains("⌃S send").And.Contains("⌥L escaping").And.Contains("Esc close (keeps the draft)"); + await Assert.That(footer).Contains("Ctrl+S send").And.Contains("Alt+L escaping").And.Contains("Esc close (keeps the draft)"); await Assert.That(below).IsTrue().Because("under the layer, so a toast is drawn over it"); await Assert.That(margin).IsTrue().Because("over the cells, clear of the native header and sidebar"); } @@ -291,7 +291,7 @@ public async Task AMooEditOpensNativelyAndCtrlSSavesItsLines() }); await Assert.That(header).Contains("EDIT").And.Contains("Test:look").And.DoesNotContain("as typed"); - await Assert.That(footer).Contains("⌃S save").And.DoesNotContain("⌥L"); + await Assert.That(footer).Contains("Ctrl+S save").And.DoesNotContain("Alt+L"); await Assert.That(saved).IsEquivalentTo(new[] { "player:tell(\"Hi.\");", "return 1;", "// 100% [sure]; done" }); await Assert.That(sent).IsEmpty(); } @@ -321,7 +321,7 @@ public async Task TheDockedEditorLiesOverItsPaneAndTakesTheKeyboardWhenArmed() await Assert.That(armed).IsTrue(); await Assert.That(focused).IsTrue(); await Assert.That(header).Contains("COMPOSE").And.Contains("to Ann"); - await Assert.That(footer).Contains("⌃S").And.Contains("Esc"); + await Assert.That(footer).Contains("Ctrl+S").And.Contains("Esc"); await Assert.That(width).IsGreaterThan(0); } diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeKeySpellingTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeKeySpellingTests.cs new file mode 100644 index 00000000..2c506e76 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeKeySpellingTests.cs @@ -0,0 +1,276 @@ +using System.Text.RegularExpressions; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Documents; +using Avalonia.Controls.Primitives; +using Avalonia.LogicalTree; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Tui; +using SkiaSharp; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window spells a key one way on every native surface — in words (Alt+2, Ctrl+W), through +/// — while the terminal keeps its glyphs. A menu saying ⌥2 beside a sidebar saying +/// Alt+2 was the report. Each native surface is opened over the demo in a real window and every word it shows — +/// text, key chips, buttons, menu entries, tooltips, a toast — is scanned for a modifier glyph; and the window's own +/// source holds none in a string. +/// +[NotInParallel] +public class NativeKeySpellingTests +{ + private sealed record Rig(Window Window, Panel Root, TerminalView View, DesktopLayer Layer, SharpMUTermApp App, AvaloniaConsoleDriver Driver); + + private static Task Run(Func body) => + TerminalViewTests.Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(120, 34); + var view = new TerminalView(driver, SKColors.White, new SKColor(0x1e, 0x1e, 0x24), 14, null); + var root = new Panel(); + root.Children.Add(view); + var layer = new DesktopLayer(view, HostChrome.HeaderAndRail); + root.Children.Add(layer); + driver.Composer.Attach(root, layer, view, () => view.Focus()); + driver.Palette.Attach(root, () => view.Focus()); + var window = new Window { Content = root, Width = 1200, Height = 760 }; + driver.Modals.Attach(window, root, () => view.Focus(), driver.RaiseKey); + window.Show(); + view.Focus(); + var app = new SharpMUTermApp(DemoScene.Build(), WindowHost.Create(driver, clipboard: null) with + { + Audio = null, + Presence = null, + Announcer = null, + NativeSettings = null, + RunsInline = true, + }); + driver.KeyPressed += (_, key) => app.SimulateKey(key); + try + { + app.RenderSnapshot(null); + DesktopLayerTests.Drain(); + return body(new Rig(window, root, view, layer, app, driver)); + } + finally + { + app.DisposeAsync().AsTask().GetAwaiter().GetResult(); + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + private static void Key(Rig rig, ConsoleKeyInfo key) + { + rig.App.SimulateKey(key); + DesktopLayerTests.Drain(); + } + + private static ConsoleKeyInfo Ctrl(char letter, ConsoleKey key) => new((char)(letter - 'a' + 1), key, false, false, true); + + /// Every word a native view shows: text (and its runs), string content, headers and tooltips. + internal static IEnumerable Words(ILogical root) + { + foreach (var node in root.GetLogicalDescendants().Prepend(root)) + { + if (node is TextBlock block) + { + if (block.Text is { Length: > 0 } text) + { + yield return text; + } + + if (block.Inlines is { } inlines) + { + yield return string.Concat(inlines.OfType().Select(r => r.Text)); + } + } + + if (node is ContentControl { Content: string content }) + { + yield return content; + } + + if (node is HeaderedItemsControl { Header: string header }) + { + yield return header; + } + + if (node is Control control && ToolTip.GetTip(control) is string tip) + { + yield return tip; + } + } + } + + private static List Glyphed(string surface, IEnumerable words) => + words.Where(NativeKeys.HasGlyph).Select(w => $"{surface}: {w}").ToList(); + + [Test] + public async Task NoNativeSurfaceSpellsAKeyInGlyphs() + { + var (found, scanned) = await Run(rig => + { + var found = new List(); + var scanned = new List(); + + // The right-click menu over the output: the client's entries with their keys (⌥2, ⌃W in the cells). + var menu = NativeMenu.Build(rig.App.PointerMenu(new System.Drawing.Point(40, 8)), PlacementMode.Pointer, rig.View); + var menuWords = Words(menu).ToList(); + found.AddRange(Glyphed("menu", menuWords)); + scanned.Add($"menu:{menuWords.Count}"); + if (!menuWords.Any(w => w.Contains("Ctrl+", StringComparison.Ordinal) || w.Contains("Alt+", StringComparison.Ordinal))) + { + found.Add("menu: no key in words either — " + string.Join(" | ", menuWords)); + } + + // The header's Layouts menu. + var layouts = NativeMenu.Build(rig.App.LayoutsMenu(), _ => { }, PlacementMode.Bottom, rig.View); + found.AddRange(Glyphed("layouts menu", Words(layouts))); + + // A toast whose text, key chip and action all name keys. + rig.App.SimulateNotice("⌃P ▸ Layouts, or ⌥M", MessageSeverity.Warning, "⌥M", new NoticeAction("layout:layouts", "Open ⌥M")); + DesktopLayerTests.Drain(); + rig.Driver.Flush(); + DesktopLayerTests.Drain(); + var toast = rig.Layer.Toasts.DrawnText(); + found.AddRange(Glyphed("toast", toast)); + scanned.Add($"toast:{toast.Count}"); + if (!toast.Contains("Alt+M")) + { + found.Add("toast: the key chip is not Alt+M — " + string.Join(" | ", toast)); + } + + // The native header and sidebar: their tooltips, and the armed ⌃B keymap. + found.AddRange(Glyphed("header", rig.Layer.Header.Hits.Select(h => h.Tip))); + found.AddRange(Glyphed("sidebar", rig.Layer.Sidebar.Hits.Select(h => h.Tip))); + Key(rig, Ctrl('b', ConsoleKey.B)); + found.AddRange(Glyphed("prefix", rig.Layer.Header.Hits.Select(h => h.Tip))); + Key(rig, new ConsoleKeyInfo('\x1b', ConsoleKey.Escape, false, false, false)); + + // ⌃P: every row's title, detail and key chips. + Key(rig, Ctrl('p', ConsoleKey.P)); + if (rig.Driver.Palette.Overlay is { } palette) + { + var words = Words(palette).ToList(); + found.AddRange(Glyphed("palette", words)); + scanned.Add($"palette:{words.Count}"); + Key(rig, Ctrl('p', ConsoleKey.P)); + } + else + { + found.Add("palette: did not open natively"); + } + + // F1: the composer's key row. + Key(rig, new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + if (rig.Driver.Composer.Overlay is { } composer) + { + var words = Words(composer).ToList(); + found.AddRange(Glyphed("composer", words)); + scanned.Add($"composer:{words.Count}"); + Key(rig, new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + } + else + { + found.Add("composer: did not open natively"); + } + + // The modals: ⌃F, ⌃R, ⌥M, and the quit prompt. + foreach (var (name, key) in new[] + { + ("search", Ctrl('f', ConsoleKey.F)), + ("history", Ctrl('r', ConsoleKey.R)), + ("layouts", new ConsoleKeyInfo('m', ConsoleKey.M, false, true, false)), + ("quit", Ctrl('q', ConsoleKey.Q)), + }) + { + Key(rig, key); + if ((rig.Driver.Modals.Quit ?? rig.Driver.Modals.Modal) is { } modal) + { + var words = Words(modal).ToList(); + found.AddRange(Glyphed(name, words)); + scanned.Add($"{name}:{words.Count}"); + Key(rig, new ConsoleKeyInfo('\x1b', ConsoleKey.Escape, false, false, false)); + if ((rig.Driver.Modals.Quit ?? rig.Driver.Modals.Modal) is { } still) + { + still.Session.Dismiss(); + rig.Driver.Modals.Close(still.Session); + DesktopLayerTests.Drain(); + } + } + else + { + found.Add($"{name}: did not open natively"); + } + } + + return (found, scanned); + }); + + await Assert.That(found).IsEmpty().Because(string.Join("\n", found)); + await Assert.That(scanned.Count).IsGreaterThanOrEqualTo(7).Because("every surface was opened and read: " + string.Join(", ", scanned)); + } + + /// The window's own strings — a footer, a tooltip, an empty state — name keys in words too. + [Test] + public async Task TheWindowsOwnStringsSpellKeysInWords() + { + var root = Path.Combine(RepositoryRoot(), "src", "SharpMUTerm.Avalonia"); + var literal = new Regex("\"(?:[^\"\\\\]|\\\\.)*\"", RegexOptions.Compiled); + var offenders = new List(); + foreach (var file in Directory.EnumerateFiles(root, "*.cs", SearchOption.TopDirectoryOnly)) + { + var lines = File.ReadAllLines(file); + for (var i = 0; i < lines.Length; i++) + { + var line = lines[i].Trim(); + if (line.StartsWith("//", StringComparison.Ordinal)) + { + continue; + } + + // The list of glyphs names them, and the host contract carries the chords' glyph spellings for the + // client's cells (the palette's rows reach the window through NativeKeys like everything else). + if (Path.GetFileName(file) is "NativeKeys.cs" or "WindowHost.cs") + { + continue; + } + + foreach (Match match in literal.Matches(line)) + { + if (NativeKeys.HasGlyph(match.Value)) + { + offenders.Add($"{Path.GetFileName(file)}:{i + 1}: {match.Value}"); + } + } + } + } + + await Assert.That(offenders).IsEmpty().Because(string.Join("\n", offenders)); + } + + [Test] + public async Task WordsSpellsEveryModifierAndLeavesTheRestAlone() + { + await Assert.That(NativeKeys.Words("⌥2 · ⌃W · ⌥⇧→ · ⌃B b")).IsEqualTo("Alt+2 · Ctrl+W · Alt+Shift+→ · Ctrl+B b"); + await Assert.That(NativeKeys.Words("F4 edits keys")).IsEqualTo("F4 edits keys"); + await Assert.That(NativeKeys.Words("⌃⏎ newline · ⏎ goes")).IsEqualTo("Ctrl+Enter newline · Enter goes"); + await Assert.That(NativeKeys.Words(null)).IsEqualTo(string.Empty); + } + + private static string RepositoryRoot() + { + for (var dir = new DirectoryInfo(AppContext.BaseDirectory); dir is not null; dir = dir.Parent) + { + if (File.Exists(Path.Combine(dir.FullName, "SharpMUTerm.slnx"))) + { + return dir.FullName; + } + } + + throw new InvalidOperationException("SharpMUTerm.slnx not found above " + AppContext.BaseDirectory); + } +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs index 4381048d..4dc5cb68 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs @@ -96,6 +96,27 @@ public async Task CtrlFOpensTheNativeSearchOverEverythingWithTheBoxFocused() await Assert.That(colours).IsEqualTo(ModalColours.Dark).Because("the demo's theme is Dark"); } + /// + /// The history-search-filter view opens the native ⌃R with its query in the box, so the window's frame lists + /// the filtered rows the cells list — not the whole history. + /// + [Test] + public async Task TheHistoryFilterViewOpensTheNativeListFiltered() + { + var (text, rows, all) = await Run(rig => + { + rig.App.RenderSnapshot("history-search-filter"); + DesktopLayerTests.Drain(); + var view = (HistoryView)rig.Driver.Modals.Modal!.View; + return (view.Box.Text, view.Matches.Select(m => m.Text).ToArray(), ((HistorySession)rig.App.NativeHistory!).Model.Entries.Count); + }); + + await Assert.That(text).IsEqualTo("north"); + await Assert.That(rows).IsNotEmpty(); + await Assert.That(rows.Length).IsLessThan(all).Because("the list is filtered, not the whole history"); + await Assert.That(rows.All(r => r.Contains("north", StringComparison.OrdinalIgnoreCase))).IsTrue(); + } + [Test] public async Task TheCardFollowsALightTheme() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs index 58d0f3de..00b3fc17 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs @@ -222,8 +222,8 @@ public async Task TheKeyColumnIsInTheWindowsKeys() return (index < 0 ? null : overlay.KeyTexts[index], overlay.KeyTexts.Where(k => k is not null).ToArray()); }); - await Assert.That(newline).IsEqualTo("Ctrl+⏎"); - await Assert.That(any).DoesNotContain("Alt+⏎"); + await Assert.That(newline).IsEqualTo("Ctrl+Enter"); + await Assert.That(any).DoesNotContain("Alt+Enter"); await Assert.That(any.Any(k => k!.Contains('⌃') || k.Contains('⌥'))).IsFalse().Because("the window's UI font reads keys in words"); } diff --git a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs index 457f0cd2..4d965023 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs @@ -96,6 +96,87 @@ public async Task AToastFadesAfterItsTimeButStaysWhileHovered() await Assert.That(gone).IsEqualTo(0); } + /// + /// A hovered toast is held past its time, so the newer toasts under it fade first. The stack used to close up as they + /// went and carry the hovered toast out from under the pointer; it now holds still while the pointer is on it, and a + /// notice arriving meanwhile goes above it. Once the pointer leaves, the stack closes up. + /// + [Test] + public async Task AHoveredToastKeepsItsPlaceWhileTheToastsUnderItFade() + { + var (before, during, frozen, shown, arrivedAbove, after, closedUp) = await Run((window, view, layer, driver) => + { + var notices = (IPointerPresenter)driver.Pointer; + notices.Notice(Overlay(1, "first", null, _ => { })); + notices.Notice(Overlay(2, "second", null, _ => { })); + Drain(); + window.UpdateLayout(); + var toasts = layer.Toasts; + var before = toasts.Rects()[0]; + window.MouseMove(toasts.TranslatePoint(before.Center, window)!.Value); + + // The newer toast's time and fade run out while the pointer holds the older one. + toasts.Advance(NoticeModel.Duration + NoticeToasts.FadeTime + TimeSpan.FromSeconds(1)); + var shown = toasts.Shown.Select(n => n.Sequence).ToList(); + var during = toasts.Rects()[0]; + var frozen = toasts.Frozen; + + notices.Notice(Overlay(3, "third", null, _ => { })); + Drain(); + var rects = toasts.Rects(); + var arrivedAbove = rects.Count == 2 && rects[0] == during && rects[1].Bottom < during.Top; + + // The pointer leaves: the stack closes up again. + window.MouseMove(toasts.TranslatePoint(new Point(2, 2), window)!.Value); + var after = toasts.Rects(); + return (before, during, frozen, shown, arrivedAbove, after, !toasts.Frozen); + }, columns: 80, rows: 16); + + await Assert.That(shown).IsEquivalentTo(new long[] { 1 }).Because("the toast under the hovered one has gone"); + await Assert.That(frozen).IsTrue(); + await Assert.That(during).IsEqualTo(before).Because("the hovered toast stays under the pointer"); + await Assert.That(arrivedAbove).IsTrue().Because("a notice arriving while the stack is held goes above it"); + await Assert.That(closedUp).IsTrue(); + await Assert.That(after[^1].Bottom).IsGreaterThan(before.Bottom).Because("off the stack, it closes up to the bottom"); + } + + /// + /// In the combat layout the map sits right of the output, down to the command line, and its legend is in its bottom-left + /// corner — under the toasts' column. A toast is stacked above the legend rather than over it. + /// + [Test] + public async Task AToastIsStackedClearOfTheMapsLegend() + { + var (legend, rects) = await Run((window, view, layer, driver) => + { + var model = new MapViewModel( + "Town", + 0, + [ + new MapViewRoom(1, "Plaza", 0, 0, Current: true, Ahead: false, Locked: false), + new MapViewRoom(2, "North Road", 0, -1, Current: false, Ahead: false, Locked: false), + ], + [new MapViewExit(1, 2)], + null); + var notices = (IPointerPresenter)driver.Pointer; + notices.Panels( + [new PanelOverlay(PanelIds.Map, "map:demo", new PaneRect(44, 1, 36, 17), new PanelInk("#33ccff", "#ffaa33", "#555555"), null, model, _ => { })]); + notices.Notice(Overlay(1, "Using the Combat layout: the game sends vitals.", new NoticeAction("layout:layouts", "Change layout"), _ => { }, aboveRow: 18)); + Drain(); + window.UpdateLayout(); + driver.Flush(); + Drain(); + var canvas = layer.Maps.Values.Single(); + var plate = canvas.LegendRect(canvas.Bounds.Size)!.Value; + var topLeft = canvas.TranslatePoint(plate.TopLeft, layer.Toasts)!.Value; + return (new Rect(topLeft, plate.Size), layer.Toasts.Rects()); + }, columns: 80, rows: 20); + + await Assert.That(rects).IsNotEmpty(); + await Assert.That(rects.Any(r => r.Intersects(legend))).IsFalse().Because("no toast covers the map's legend"); + await Assert.That(rects[^1].Bottom).IsLessThanOrEqualTo(legend.Top).Because("the stack sits above the legend"); + } + [Test] public async Task TheNativeMapDrawsItsAreasInTheModelsColours() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs index 649cb3a5..4b7de06f 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -304,6 +304,59 @@ public async Task F7InTheWindowHostOpensTheSettingsWindow() await Assert.That(section.SettingsOpenKey).IsNull().Because("no cell screen opens under it"); } + /// + /// F7 in the window takes the keyboard: the settings window's search box has focus, so typing goes there and not + /// into the command line behind it, where ⏎ would send it. Closing gives the keyboard back to the cells. + /// + [Test] + public async Task TheSettingsWindowTakesTheKeyboardAndGivesItBack() + { + var (searchFocused, typed, line, viewFocused) = await Session.Dispatch(() => + { + using var driver = new AvaloniaConsoleDriver(120, 34); + var view = new TerminalView(driver, SkiaSharp.SKColors.White, new SkiaSharp.SKColor(0x1e, 0x1e, 0x24), 14, null); + var main = new Window { Content = view, Width = 1000, Height = 700 }; + driver.Settings.Owner = main; + driver.Settings.Refocus = () => view.Focus(); + main.Show(); + view.Focus(); + var app = new SharpMUTermApp(DemoScene.Build(), WindowHost.Create(driver, clipboard: null) with + { + Capabilities = WindowOptions.Capabilities, + Audio = null, + Presence = null, + Announcer = null, + RunsInline = true, + }); + driver.KeyPressed += (_, key) => app.SimulateKey(key); + try + { + var before = app.ArmedInputText; + app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.F7, false, false, false)); + Dispatcher.UIThread.RunJobs(); + var window = driver.Settings.Window!; + var focused = window.SearchBox.IsFocused; + window.KeyTextInput("theme"); + Dispatcher.UIThread.RunJobs(); + var typed = window.SearchBox.Text; + var line = app.ArmedInputText == before ? string.Empty : app.ArmedInputText; + window.Close(); + Dispatcher.UIThread.RunJobs(); + return (focused, typed, line, view.IsFocused); + } + finally + { + app.DisposeAsync().AsTask().GetAwaiter().GetResult(); + main.Close(); + } + }, CancellationToken.None); + + await Assert.That(searchFocused).IsTrue(); + await Assert.That(typed).IsEqualTo("theme").Because("what is typed after F7 goes into the settings window"); + await Assert.That(line).IsEmpty().Because("nothing reached the command line behind it"); + await Assert.That(viewFocused).IsTrue().Because("closing gives the keyboard back to the cells, and so the command line"); + } + private static Task Run(Harness harness, string initial, Func body) => Session.Dispatch(() => { diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index bde59a53..d5471ae7 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -274,18 +274,20 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! covered.Add(surface); } - // ⌃R filtered: the native list's rows for a query are the cell list's rows for it. + // ⌃R filtered: the view hands its query to the native box, and the native list's rows for it are the cell list's. { using var nativeDriver = new AvaloniaConsoleDriver(140, 36); var modals = new FakeModals(); await using var native = App(nativeDriver, DemoScene.Build(), modals: modals); - native.RenderSnapshot("history-search"); + native.RenderSnapshot("history-search-filter"); using var cellDriver = new AvaloniaConsoleDriver(140, 36); await using var cells = App(cellDriver, DemoScene.Build()); cells.RenderSnapshot("history-search-filter"); - var rows = ((HistorySession)modals.Open(SurfaceCatalog.History)!).Model.View("north").Select(m => m.Text).ToArray(); + var history = (HistorySession)modals.Open(SurfaceCatalog.History)!; + await Assert.That(history.InitialQuery).IsEqualTo("north").Because("the filter view types its query into the native box"); + var rows = history.Model.View(history.InitialQuery).Select(m => m.Text).ToArray(); await Assert.That(rows).IsNotEmpty(); await Assert.That(rows).IsEquivalentTo(cells.HistorySearchRows, TUnit.Assertions.Enums.CollectionOrdering.Matching); } @@ -294,6 +296,30 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! await Assert.That(covered).IsEquivalentTo(drawnNatively).Because("every surface the window draws natively has its model compared here"); } + /// + /// search-landed goes through the window's native ⌃F: the query is searched there, and ⏎ on the second row + /// ends in the cell ⏎'s method, so the native search has closed and the bar sits where the cell landing puts it. + /// + [Test] + public async Task TheLandedSearchViewLandsThroughTheNativeSearchWhereTheCellsLand() + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + var modals = new FakeModals(); + await using var native = App(nativeDriver, DemoScene.Build(), modals: modals); + native.RenderSnapshot("search-landed"); + + using var cellDriver = new AvaloniaConsoleDriver(140, 36); + await using var cells = App(cellDriver, DemoScene.Build()); + cells.RenderSnapshot("search-landed"); + + await Assert.That(modals.Shown.Any(s => s.Surface == SurfaceCatalog.Search)).IsTrue().Because("the search ran in the window's controls"); + await Assert.That(modals.Open(SurfaceCatalog.Search)).IsNull().Because("⏎ closed it"); + await Assert.That(native.SearchIsOpen).IsFalse().Because("no cell search was opened either"); + var bar = native.SearchBarIndex(native.ActiveWindowId()); + await Assert.That(bar).IsNotNull(); + await Assert.That(bar).IsEqualTo(cells.SearchBarIndex(cells.ActiveWindowId())); + } + private static string[] Rows(PaletteView view) => view.Rows.Select(r => r is PaletteHeader h ? "# " + h.Label : ((PaletteEntry)r).Item.Id + " " + ((PaletteEntry)r).Item.Key).ToArray(); diff --git a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs index 23e1d779..092acc8f 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs @@ -110,6 +110,47 @@ private static async Task SentThroughTheCells(string draft, bool literal // ── F1 ─────────────────────────────────────────────────────────────────────────────────── + /// + /// The window's editor writes in monospace or a proportional face, chosen from its menu. The choice is the + /// character's and is kept on disk through the write-only save (PersistConfiguration) — not the settings + /// funnel, which would re-periodise the timers — so F1 opened again, or next run, writes in the same face. + /// + [Test] + public async Task TheComposersFaceIsTheCharactersAndIsSaved() + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + var ann = new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }; + world.Characters.Add(ann); + config.Worlds.Add(world); + var fake = new FakeComposer(); + var saved = new List(); + var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, null) with { NativeComposer = fake }; + await using var app = new SharpMUTermApp(config, host, save: c => saved.Add(c.Worlds[0].Characters[0].ComposerProportional)); + app.TelnetFactory = _ => new RecordingTelnetSession(); + var session = app.BindWorldWithoutConnecting(world); + await session.ConnectAsync(); + app.RenderNextFrame(); + + app.SimulateKey(Key(ConsoleKey.F1)); + var first = fake.Last!; + await Assert.That(first.Proportional).IsFalse().Because("monospace by default"); + + first.ChooseFace(true); + await Assert.That(ann.ComposerProportional).IsTrue(); + await Assert.That(saved).IsEquivalentTo(new[] { true }).Because("saved once, with the choice in it"); + await Assert.That(first.Proportional).IsTrue(); + + first.Close(string.Empty); + app.SimulateKey(Key(ConsoleKey.F1)); + await Assert.That(fake.Last).IsNotSameReferenceAs(first); + await Assert.That(fake.Last!.Proportional).IsTrue().Because("F1 opened again writes in the character's face"); + + fake.Last.ChooseFace(true); + await Assert.That(saved.Count).IsEqualTo(1).Because("choosing the face it already has writes nothing"); + } + [Test] public async Task F1OpensTheHostsEditorAndNotTheCellModal() { diff --git a/tests/SharpMUTerm.Tui.Tests/PackageScreenFitTests.cs b/tests/SharpMUTerm.Tui.Tests/PackageScreenFitTests.cs new file mode 100644 index 00000000..16a77dec --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/PackageScreenFitTests.cs @@ -0,0 +1,37 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// F10 at the smallest terminal this client supports. Its key line is wider than the modal at 80 columns and wraps to a +/// second row; the modal used to be sized by its line count, so the last detail row sat under its bottom edge. +/// +[NotInParallel] +public class PackageScreenFitTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + [Test] + public async Task ThePackagesListFitsItsModalAt80By24() + { + Console.SetIn(TextReader.Null); + await using var app = new SharpMUTermApp(DemoScene.Build(), Headless, new HeadlessConsoleDriver(80, 24)); + var rows = FrameGrid.Decode(app.RenderSnapshot("packages"), 80, 24); + var text = string.Join("\n", rows); + + await Assert.That(text).Contains("Packages"); + await Assert.That(text).Contains("characters").Because("the last detail row is on screen, inside the modal"); + await Assert.That(text).Contains("Esc close").Because("the wrapped key line is whole"); + await Assert.That(text).DoesNotContain("░").Because("nothing scrolls: the modal is as tall as what it holds"); + } + + [Test] + public async Task TheRowsAreMeasuredWrappedNotCounted() + { + var lines = new List { new string('x', 50), "short" }; + await Assert.That(ListOverlay.Rows(lines, 30)).IsEqualTo(3); + await Assert.That(ListOverlay.Rows(lines, 60)).IsEqualTo(2); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs b/tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs index b6f09dca..940468e8 100644 --- a/tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/RailKeysTests.cs @@ -48,6 +48,21 @@ public async Task AltCPutsTheCursorOnTheWindowInFrontAndAltCTakesItOff() await Assert.That(app.BuildChromeOverlay().Sidebar.Cursor).IsNull(); } + /// While the sidebar holds the keys the command line is drawn idle — ⏎ goes to a row, not to the game. + [Test] + public async Task TheCommandLineIsIdleWhileTheSidebarHoldsTheKeys() + { + await using var app = await App(); + var (armed, idle) = app.InputBandColors; + await Assert.That(app.PrimaryBandColor).IsEqualTo(armed); + + app.SimulateKey(AltC); + await Assert.That(app.PrimaryBandColor).IsEqualTo(idle); + + app.SimulateKey(Key(ConsoleKey.Escape)); + await Assert.That(app.PrimaryBandColor).IsEqualTo(armed).Because("handing the keys back arms the bar again"); + } + [Test] public async Task TheArrowsWalkTheRowsAClickWouldReachAndStopAtTheEnds() { diff --git a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs index e06fe74d..5bc5587f 100644 --- a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs @@ -90,6 +90,25 @@ public async Task AClientWithNoWorldsOpensOnTheWelcomeAndKeepsTheNotice() await Assert.That(run.App.StatusMarkup).Contains("No world configured"); } + /// + /// The window's demo lays the welcome scene out (which runs the startup pass) and then its loop's + /// Run schedules the startup pass again. That raised the notice twice — two identical toasts in the + /// window. A launch has one startup pass. + /// + [Test] + public async Task TheWelcomeSceneThenTheLoopsStartupRaiseTheNoticeOnce() + { + Console.SetIn(TextReader.Null); + await using var app = new SharpMUTermApp(DemoScene.Build(), ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, null)); + + app.RenderSnapshot("welcome"); + app.ScheduleStartup([]); + + var raised = app.Messages.Entries.Count(e => e.Text.Contains("No world configured", StringComparison.Ordinal)); + await Assert.That(raised).IsEqualTo(1); + await Assert.That(app.WelcomeIsOpen).IsTrue(); + } + [Test] public async Task AClientWithWorldsDoesNotOpenIt() { From 4b0866532b468fd2a93ccb3814f00149835643c1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 10:49:55 +0000 Subject: [PATCH 037/113] feat(ui): one design language for the window, themed terminal popups NativeTokens (Avalonia) derives the window's planes, inks, radii and type ramp from the client's theme the way ScreenTheme does, with every ink held to 4.5:1. Settings, list editor, package page, theme cards, menus, palette and modals read it; Fluent's blue is gone. A test forbids literal font sizes and colours outside the token file. The settings window gets the palette's modal frame (title bar, close, Esc, scrim) and docks to the right half when the trigger builder opens it. Light themes: header fills deepened under light ink (4.5:1), muted header text and the low-vitals cue held to the floor, in both hosts. The terminal popups (Ctrl+P, quit, search, history, prefix panel, game data, message log) follow ScreenTheme. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 8 + CLAUDE.md | 27 +- src/SharpMUTerm.Avalonia/ComposerView.cs | 2 +- src/SharpMUTerm.Avalonia/FloatingPanels.cs | 2 +- src/SharpMUTerm.Avalonia/HistoryView.cs | 10 +- src/SharpMUTerm.Avalonia/LayoutsView.cs | 16 +- src/SharpMUTerm.Avalonia/ListEditorView.cs | 45 +-- src/SharpMUTerm.Avalonia/ModalOverlay.cs | 86 +---- src/SharpMUTerm.Avalonia/ModalParts.cs | 38 +-- src/SharpMUTerm.Avalonia/NativeChrome.cs | 8 +- src/SharpMUTerm.Avalonia/NativeMenu.cs | 18 +- src/SharpMUTerm.Avalonia/NativeTokens.cs | 306 ++++++++++++++++++ src/SharpMUTerm.Avalonia/PackagePageView.cs | 75 +++-- src/SharpMUTerm.Avalonia/PaletteOverlay.cs | 60 +--- src/SharpMUTerm.Avalonia/QuitView.cs | 8 +- src/SharpMUTerm.Avalonia/SearchView.cs | 14 +- src/SharpMUTerm.Avalonia/SettingsPresenter.cs | 65 ++++ src/SharpMUTerm.Avalonia/SettingsWindow.cs | 153 ++++++--- src/SharpMUTerm.Avalonia/TerminalView.cs | 4 +- src/SharpMUTerm.Avalonia/ThemeCardView.cs | 26 +- src/SharpMUTerm.Avalonia/WelcomeView.cs | 14 +- src/SharpMUTerm.Client/Modals/ModalSession.cs | 6 + .../Palette/PaletteSession.cs | 3 + .../Settings/SettingsForm.cs | 12 + src/SharpMUTerm.Tui/CommandPalette.cs | 24 +- src/SharpMUTerm.Tui/GameDataOverlay.cs | 13 +- src/SharpMUTerm.Tui/HistorySurface.cs | 11 +- src/SharpMUTerm.Tui/MessageLogOverlay.cs | 13 +- .../Pointer/SharpMUTermApp.Chrome.cs | 15 +- src/SharpMUTerm.Tui/PrefixOverlay.cs | 11 +- src/SharpMUTerm.Tui/QuitOverlay.cs | 13 +- src/SharpMUTerm.Tui/SearchSurface.cs | 11 +- .../SharpMUTermApp.NativeModals.cs | 21 +- .../SharpMUTermApp.NativePalette.cs | 5 +- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 5 +- .../SharpMUTermApp.Settings.cs | 2 + src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs | 20 ++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 42 +-- src/SharpMUTerm.Tui/WorkspacePalette.cs | 60 ++++ .../NativeModalTests.cs | 4 +- .../NativeTokenTests.cs | 211 ++++++++++++ 41 files changed, 1142 insertions(+), 345 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/NativeTokens.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b4db941..83a20205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -266,6 +266,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- Desktop window: one look across settings, menus, the command palette and every prompt — the client's own teal + instead of a stock blue, one set of text sizes and corner radii, and every colour readable on Dark, Light and + Solarized Dark. The settings panel now has a title bar with a close button, dims the window behind it, and when + opened from "Make a trigger from the selection" sits on the right half so the line you picked stays visible. +- Light themes: the header's coloured segments are deeper, with light text that is easy to read, and the low + vitals warning is a readable dark orange instead of a pale yellow — in the terminal and the window. +- The terminal's command palette, quit prompt, search, history, Ctrl+B panel, game data and message log now + follow the theme instead of staying dark on Light. - Panes stacked one above the other no longer have an empty row between them when the lower pane shows its tabs: the tab row is the boundary, and the panes get the row back. Drag the empty part of that tab row to resize, or double-click it to even the panes out. The vitals and quick-bar strips sit flush against their diff --git a/CLAUDE.md b/CLAUDE.md index 63dc629b..d3a0fc78 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -912,9 +912,15 @@ fallbacks) for inline images/maps. that happens to be `#00f5b7`); a foreground that is no role (a world's accent) is held to the floor on the plane it lands on, except on Dark, which stays as it was. - A bordered modal's title, border and unstyled text are the framework's cyan and `#eeeeee`, 1.4:1 on a - light backdrop; `ScreenTheme.Frame` recolours them off Dark. **Not themed**: the workspace popups that do - not sit on a settings screen (⌃P, quit, ⌃B panel, search, game data, message log, history) still paint - `ScreenPalette.MenuBg` raw. They pass the floor on Light and look dark; same recipe when someone wants it. + light backdrop; `ScreenTheme.Frame` recolours them off Dark. **The workspace popups follow it too** (⌃P, quit, ⌃B panel, + search, game data, message log, history): each has a `Scheme` the app sets in `SchemePopups()` (on + `ApplyTheme`), paints its plane with `Scheme.Colour(MenuBg)`, its lines with `Scheme.Lines` and its frame + with `Scheme.Frame`; ⌃P's prompt well takes `EditBg` off Dark. Dark is byte for byte unchanged. + - **The header's fills are derived per theme** (`WorkspacePalette.HeaderFill`/`HeaderInk`/`HeaderMuted`): on a + light theme a segment's fill is deepened until light ink clears 4.5:1 on it, and the muted right cluster is + held to 4.5:1 on the status plane; a dark theme's fills are as they were. The native header reads the same + inks through `ChromePalette.BrandInk`/`HeaderMuted`. The low-vitals cue is `WorkspacePalette.Low`: the notice + ink on dark, a deep orange held to 4.5:1 on light, in the status row, the vitals strip and the gauges. - **A trigger's `route` says three things, and the third is "nothing"** (`TriggerActions.MainWindow`, Core; F2's `route` list). `SpawnTarget = null` has always meant *this rule adds no destination — the line follows whatever the other matched rules decided*, which is exactly what a highlight rule wants. @@ -1952,6 +1958,21 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] `history-search-filter` opens ⌃R with its query typed (`HistorySession.InitialQuery`), and `search-landed` lands through the native search's own close and `GoToSearchHit`, so the cells it leaves match the terminal's. - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave8/modals-*.png`). +- **The window has one design language: `NativeTokens`** (Avalonia). Planes (card, raised, selected, scrim), edge + and rule, inks (text, dim, header, accent, warn, notice, accent and key inks), radii `RadiusS/M/L` 4/8/12 and + the type ramp `Small/Body/Title/Heading` 11/12/14/18 (`Miniature` 9 only for a theme card's preview). Derived + from the client's `Theme` the `ScreenTheme` way: a canonical Dark (`#1e1e25` card) and Light (white) set, the + theme background's hue shift added, every ink held to `TextFloor` 4.5:1 on each plane it is drawn on; the + accent is the client's teal, never Fluent's blue. `Apply` sets the Fluent keys on a scope and `ApplySimple` + the Simple theme's (menus). The settings window, list editor, package page, theme cards, menus, palette and + modals all read it; sessions carry the theme (`ModalSession.Theme`, `PaletteSession.Theme`, + `SettingsForm.Theme`). `NativeTokenTests.NoViewWritesALiteralFontSizeOrColour` fails on a literal + `FontSize =` number or `Color.Parse("#` anywhere in the window's assembly outside `NativeTokens.cs`; widen its + allow-list only with a reason. A quiet line is the `Dim` ink, never an opacity (an opacity is not floor-checked). + - **The settings window is the palette's modal**: undecorated with its own title bar (title, ✕, Esc, drag to + move), the tokens' card and edge, and a scrim over the main window (`SettingsPresenter.Scrim`; a press on it + closes). Opened from the trigger builder (`SettingsForm.BesideOutput`) it is docked to the main window's right + half with no scrim, so the line the rule came from stays in view. Still a separate OS window, not an overlay. - **Every native surface spells a key in words** (`NativeKeys.Words`, Avalonia: `KeyGlyphs.Words` plus `⏎` → `Enter`): `Ctrl+P`, `Alt+M`, `Ctrl+B b`, never `⌃P`/`⌥M`/`⏎`. The client writes keys in glyphs because the cells draw them well; whatever it hands a native view — menu keys, a toast's chip and text, palette details and chips, the diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 322669d8..a019729b 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -353,7 +353,7 @@ private void Label(ComposerModel model) Background = new SolidColorBrush(Mix(_plane, ink, 0.14)), BorderBrush = new SolidColorBrush(Mix(_plane, ink, 0.32)), BorderThickness = new Thickness(1), - CornerRadius = new CornerRadius(4), + CornerRadius = new CornerRadius(NativeTokens.RadiusS), Padding = new Thickness(6, 0, 6, 1), VerticalAlignment = VerticalAlignment.Center, Child = new TextBlock { Text = words, FontSize = Math.Max(9, size), Foreground = new SolidColorBrush(ink) }, diff --git a/src/SharpMUTerm.Avalonia/FloatingPanels.cs b/src/SharpMUTerm.Avalonia/FloatingPanels.cs index 707f6e1e..e031c84e 100644 --- a/src/SharpMUTerm.Avalonia/FloatingPanels.cs +++ b/src/SharpMUTerm.Avalonia/FloatingPanels.cs @@ -213,7 +213,7 @@ public FloatingPanelWindow(FloatingPanel panel, TerminalView view) }; _content.Focusable = false; - _title = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontSize = 12, Margin = new Thickness(10, 0, 0, 0) }; + _title = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontSize = NativeTokens.Body, Margin = new Thickness(10, 0, 0, 0) }; _dock = new FrameButton("Dock") { Width = 52, Height = 20, Margin = new Thickness(0, 0, 6, 0), VerticalAlignment = VerticalAlignment.Center }; _dock.Click += () => Panel.Dock(); AutomationProperties.SetName(_dock, "Dock back into the layout"); diff --git a/src/SharpMUTerm.Avalonia/HistoryView.cs b/src/SharpMUTerm.Avalonia/HistoryView.cs index f762441c..eb8e2ba7 100644 --- a/src/SharpMUTerm.Avalonia/HistoryView.cs +++ b/src/SharpMUTerm.Avalonia/HistoryView.cs @@ -18,7 +18,7 @@ namespace SharpMUTerm.Avalonia; internal sealed class HistoryView : DockPanel, IModalView { private readonly HistorySession _session; - private readonly ModalColours _colours; + private readonly NativeTokens _colours; private readonly Action _done; private readonly TextBox _box; private readonly TextBlock _count; @@ -27,7 +27,7 @@ internal sealed class HistoryView : DockPanel, IModalView private IReadOnlyList _matches = []; private int _selected; - public HistoryView(HistorySession session, ModalColours colours, Action done) + public HistoryView(HistorySession session, NativeTokens colours, Action done) { _session = session; _colours = colours; @@ -39,8 +39,8 @@ public HistoryView(HistorySession session, ModalColours colours, Action done) Children.Add(_box); var header = new DockPanel { Margin = new Thickness(20, 0, 20, 6) }; - var whose = new TextBlock { Text = model.BarLabel, FontSize = 12.5, Foreground = colours.Brush(colours.Dim) }; - _count = new TextBlock { FontSize = 12.5, Foreground = colours.Brush(colours.Dim), HorizontalAlignment = global::Avalonia.Layout.HorizontalAlignment.Right }; + var whose = new TextBlock { Text = model.BarLabel, FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim) }; + _count = new TextBlock { FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), HorizontalAlignment = global::Avalonia.Layout.HorizontalAlignment.Right }; SetDock(whose, Dock.Left); header.Children.Add(whose); header.Children.Add(_count); @@ -127,7 +127,7 @@ private void Draw() { Foreground = _colours.Brush(_colours.Text), FontFamily = mono, - FontSize = 13, + FontSize = NativeTokens.Title, TextTrimming = TextTrimming.CharacterEllipsis, }; text.Inlines = ModalParts.Marked(match.Text, match.MatchStart, match.MatchLength, _colours); diff --git a/src/SharpMUTerm.Avalonia/LayoutsView.cs b/src/SharpMUTerm.Avalonia/LayoutsView.cs index 68b95a42..ffa400cd 100644 --- a/src/SharpMUTerm.Avalonia/LayoutsView.cs +++ b/src/SharpMUTerm.Avalonia/LayoutsView.cs @@ -19,7 +19,7 @@ namespace SharpMUTerm.Avalonia; internal sealed class LayoutsView : DockPanel, IModalView { private readonly LayoutsSession _session; - private readonly ModalColours _colours; + private readonly NativeTokens _colours; private readonly Action _done; private readonly StackPanel _list; private readonly TextBlock _status; @@ -32,7 +32,7 @@ internal sealed class LayoutsView : DockPanel, IModalView private bool _renaming; private bool _confirming; - public LayoutsView(LayoutsSession session, ModalColours colours, Action done) + public LayoutsView(LayoutsSession session, NativeTokens colours, Action done) { _session = session; _colours = colours; @@ -51,13 +51,13 @@ public LayoutsView(LayoutsSession session, ModalColours colours, Action done) { Margin = new Thickness(14, 4, 14, 4), Padding = new Thickness(10, 6), - CornerRadius = new CornerRadius(7), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), IsVisible = false, PlaceholderText = "New name", }; global::Avalonia.Automation.AutomationProperties.SetName(_rename, "New name"); - var footer = ModalParts.Footer("↑↓ pick · Enter apply · Esc close", colours); + var footer = ModalParts.Footer("↑↓ pick · Esc close", colours); SetDock(footer, Dock.Bottom); Children.Add(footer); @@ -190,11 +190,11 @@ private void AddRow(int index) SetDock(tags, Dock.Right); line.Children.Add(tags); var words = new StackPanel(); - words.Children.Add(new TextBlock { Text = layout.Name, FontSize = 14, FontWeight = FontWeight.Medium, Foreground = _colours.Brush(_colours.Text) }); + words.Children.Add(new TextBlock { Text = layout.Name, FontSize = NativeTokens.Title, FontWeight = FontWeight.Medium, Foreground = _colours.Brush(_colours.Text) }); words.Children.Add(new TextBlock { Text = layout.Description, - FontSize = 12, + FontSize = NativeTokens.Body, Foreground = _colours.Brush(_colours.Dim), TextTrimming = TextTrimming.CharacterEllipsis, }); @@ -212,9 +212,9 @@ private void AddRow(int index) private Border Chip(string text) => new() { Background = _colours.Brush(_colours.Selected), - CornerRadius = new CornerRadius(9), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Padding = new Thickness(8, 1), - Child = new TextBlock { Text = text, FontSize = 11, Foreground = _colours.Brush(_colours.Accent) }, + Child = new TextBlock { Text = text, FontSize = NativeTokens.Small, Foreground = _colours.Brush(_colours.Accent) }, }; private void DrawButtons() diff --git a/src/SharpMUTerm.Avalonia/ListEditorView.cs b/src/SharpMUTerm.Avalonia/ListEditorView.cs index a26866c3..e0250950 100644 --- a/src/SharpMUTerm.Avalonia/ListEditorView.cs +++ b/src/SharpMUTerm.Avalonia/ListEditorView.cs @@ -34,6 +34,7 @@ internal sealed class ListEditorView : Grid private readonly SettingsCollection _collection; private readonly Func _visible; private readonly IBrush _accent; + private readonly NativeTokens _tokens; private readonly ListBox _list; private readonly StackPanel _detail; private readonly List _refreshers = []; @@ -45,13 +46,14 @@ internal sealed class ListEditorView : Grid private bool _syncing; private bool _choosing; - public ListEditorView(SettingsForm form, SettingsSectionContribution section, Func visible, IBrush accent) + public ListEditorView(SettingsForm form, SettingsSectionContribution section, Func visible, NativeTokens tokens) { _form = form; _section = section; _collection = section.Collection!; _visible = visible; - _accent = accent; + _tokens = tokens; + _accent = tokens.Brush(tokens.Accent); ColumnDefinitions = new ColumnDefinitions("292,*"); Margin = new Thickness(0, 10, 0, 0); @@ -87,7 +89,7 @@ public ListEditorView(SettingsForm form, SettingsSectionContribution section, Fu Child = _list, BorderThickness = new Thickness(1), BorderBrush = Hairline, - CornerRadius = new CornerRadius(6), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), }); Children.Add(left); @@ -194,7 +196,10 @@ public void Refresh() // ── the list ───────────────────────────────────────────────────────────────────────────────── - private IBrush Hairline => new SolidColorBrush(_form.IsDark ? Color.Parse("#46464e") : Color.Parse("#c8c8d0")); + private IBrush Hairline => _tokens.Brush(_tokens.Edge); + + /// A quiet line's ink, held to the floor (an opacity would not be). + private IBrush DimInk => _tokens.Brush(_tokens.Dim); private static Button ToolButton(string text, string tip) { @@ -229,7 +234,7 @@ private void BuildList() { items.Add(new ListBoxItem { - Content = new TextBlock { Text = $"no {_collection.Plural}", Opacity = 0.6, FontStyle = FontStyle.Italic }, + Content = new TextBlock { Text = $"no {_collection.Plural}", Foreground = DimInk, FontStyle = FontStyle.Italic }, IsEnabled = false, Padding = new Thickness(30, 2), }); @@ -245,7 +250,7 @@ private void BuildList() { items.Add(new ListBoxItem { - Content = new TextBlock { Text = "No trigger set yet — make one on F5.", Opacity = 0.7, TextWrapping = TextWrapping.Wrap }, + Content = new TextBlock { Text = "No trigger set yet — make one on F5.", Foreground = DimInk, TextWrapping = TextWrapping.Wrap }, IsEnabled = false, }); } @@ -262,7 +267,7 @@ private ListBoxItem GroupHeader(SettingsItemGroup group) var row = new DockPanel { LastChildFill = true }; if (group.ReadOnly) { - var copy = new Button { Content = "Copy to edit", Padding = new Thickness(8, 1), FontSize = 11, VerticalAlignment = VerticalAlignment.Center }; + var copy = new Button { Content = "Copy to edit", Padding = new Thickness(8, 1), FontSize = NativeTokens.Small, VerticalAlignment = VerticalAlignment.Center }; ToolTip.SetTip(copy, "A package's set is replaced when the package updates; copy it into your own sets to change it"); AutomationProperties.SetName(copy, $"Copy {group.Set.Name} to edit"); var set = group.Set; @@ -273,10 +278,10 @@ private ListBoxItem GroupHeader(SettingsItemGroup group) } var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center }; - words.Children.Add(new TextBlock { Text = group.Label, FontWeight = FontWeight.SemiBold, FontSize = 12, Foreground = _accent, TextTrimming = TextTrimming.CharacterEllipsis }); + words.Children.Add(new TextBlock { Text = group.Label.ToUpperInvariant(), FontWeight = FontWeight.SemiBold, FontSize = NativeTokens.Small, LetterSpacing = 0.8, Foreground = _tokens.Brush(_tokens.Header), TextTrimming = TextTrimming.CharacterEllipsis }); if (group.ReadOnly) { - words.Children.Add(new TextBlock { Text = "package · read-only", FontSize = 11, Opacity = 0.65 }); + words.Children.Add(new TextBlock { Text = "package · read-only", FontSize = NativeTokens.Small, Foreground = DimInk }); } row.Children.Add(words); @@ -310,7 +315,7 @@ private ListBoxItem ItemRow(SettingsItemGroup group, object item) words.Children.Add(new TextBlock { Text = detail, - FontSize = 11, + FontSize = NativeTokens.Small, Opacity = 0.65, FontFamily = Mono, TextTrimming = TextTrimming.CharacterEllipsis, @@ -440,7 +445,7 @@ private void BuildDetail() } var title = _collection.TitleOf(item); - _detail.Children.Add(new TextBlock { Text = title.Length == 0 ? "(unnamed)" : NativeKeys.Words(title), FontSize = 18, FontWeight = FontWeight.SemiBold, TextTrimming = TextTrimming.CharacterEllipsis }); + _detail.Children.Add(new TextBlock { Text = title.Length == 0 ? "(unnamed)" : NativeKeys.Words(title), FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold, TextTrimming = TextTrimming.CharacterEllipsis }); if (group.ReadOnly) { var banner = new DockPanel { LastChildFill = true, Margin = new Thickness(0, 6, 0, 4) }; @@ -461,7 +466,7 @@ private void BuildDetail() } else { - _detail.Children.Add(new TextBlock { Text = $"in {group.Label}", Opacity = 0.65, Margin = new Thickness(0, 0, 0, 4) }); + _detail.Children.Add(new TextBlock { Text = $"in {group.Label}", Foreground = DimInk, Margin = new Thickness(0, 0, 0, 4) }); } var shown = new List(); @@ -485,7 +490,7 @@ private void BuildDetail() if (field.Group is { } g && !string.Equals(g, heading, StringComparison.Ordinal)) { heading = g; - _detail.Children.Add(new TextBlock { Text = g, FontSize = 14, FontWeight = FontWeight.SemiBold, Foreground = _accent, Margin = new Thickness(0, 14, 0, 2) }); + _detail.Children.Add(new TextBlock { Text = g.ToUpperInvariant(), FontSize = NativeTokens.Small, FontWeight = FontWeight.SemiBold, LetterSpacing = 0.8, Foreground = _tokens.Brush(_tokens.Header), Margin = new Thickness(0, 16, 0, 4) }); } var control = ControlFor(field); @@ -501,7 +506,7 @@ private void BuildDetail() Child = _preview, BorderThickness = new Thickness(1), BorderBrush = Hairline, - CornerRadius = new CornerRadius(6), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Padding = new Thickness(10, 6), Margin = new Thickness(0, 2, 0, 6), }); @@ -516,7 +521,7 @@ private static Grid Row(SettingsField field, Control control) { var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("118,*"), Margin = new Thickness(0, 3), MinHeight = 34 }; var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 12, 0) }; - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = 13, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Title, TextWrapping = TextWrapping.Wrap }); if (field.Help is { } help) { ToolTip.SetTip(words, NativeKeys.Words(Capitalise(help))); @@ -540,7 +545,7 @@ private void ShowPreview(string? typed) return; } - var summary = new TextBlock { FontSize = 12, FontWeight = FontWeight.SemiBold, TextWrapping = TextWrapping.Wrap }; + var summary = new TextBlock { FontSize = NativeTokens.Body, FontWeight = FontWeight.SemiBold, TextWrapping = TextWrapping.Wrap }; if (result.Problem is { } problem) { summary.Text = $"Live test: {problem}"; @@ -561,7 +566,7 @@ private void ShowPreview(string? typed) _preview.Children.Add(summary); foreach (var sample in result.Samples) { - var line = new TextBlock { FontFamily = Mono, FontSize = 12, TextTrimming = TextTrimming.CharacterEllipsis }; + var line = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Body, TextTrimming = TextTrimming.CharacterEllipsis }; var text = sample.Text; var start = Math.Clamp(sample.MatchStart, 0, text.Length); var length = Math.Clamp(sample.MatchLength, 0, text.Length - start); @@ -719,7 +724,7 @@ void Pick() => combo.SelectedItem = names.FirstOrDefault(n => return TextControl(text); default: - return new TextBlock { Text = "set on its own screen", Opacity = 0.7 }; + return new TextBlock { Text = "set on its own screen", Foreground = DimInk }; } } @@ -830,7 +835,7 @@ void Commit() private Control KeyCapture(KeyField field, SettingBinding chord) { var button = new Button { Content = NativeKeys.Words(_form.Get(chord)), MinWidth = 160, HorizontalAlignment = HorizontalAlignment.Left, HorizontalContentAlignment = HorizontalAlignment.Left }; - var note = new TextBlock { FontSize = 11, Opacity = 0.75, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 0) }; + var note = new TextBlock { FontSize = NativeTokens.Small, Foreground = DimInk, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 0) }; var capturing = false; void Show() { @@ -895,7 +900,7 @@ private static StackPanel Swatch(string name) { Width = 14, Height = 14, - CornerRadius = new CornerRadius(3), + CornerRadius = new CornerRadius(NativeTokens.RadiusS), Background = hex is null ? Brushes.Transparent : new SolidColorBrush(Color.Parse(hex)), BorderBrush = Brushes.Gray, BorderThickness = new Thickness(hex is null ? 1 : 0), diff --git a/src/SharpMUTerm.Avalonia/ModalOverlay.cs b/src/SharpMUTerm.Avalonia/ModalOverlay.cs index 5ae99ff3..18a4c005 100644 --- a/src/SharpMUTerm.Avalonia/ModalOverlay.cs +++ b/src/SharpMUTerm.Avalonia/ModalOverlay.cs @@ -34,7 +34,7 @@ public ModalOverlay(ModalSession session, Action remove, Action remove, Action remove, ActionThe colours the card is drawn in: the client's variant. - public ModalColours Colours { get; } + public NativeTokens Colours { get; } /// The view inside the card, for a test. public Control View => (Control)_view; @@ -147,81 +147,3 @@ internal interface IModalView /// Stops listening to the session. void Detach(); } - -/// -/// The native modals' colours, one set per variant — the palette's card, with the client's accent for a match, the -/// pointed-at row and the default button. hands Fluent the same accent, so its own accent buttons -/// and focus rings wear it too, with an ink on it that is legible in both variants. -/// -internal sealed record ModalColours( - Color Scrim, - Color Card, - Color Edge, - Color Rule, - Color Text, - Color Dim, - Color Header, - Color Selected, - Color Accent, - Color AccentInk, - Color KeyFill, - Color KeyInk, - Color Warn) -{ - public static ModalColours Dark { get; } = new( - Color.FromArgb(0x59, 0, 0, 0), - Color.Parse("#1e1e25"), - Color.Parse("#3a3a46"), - Color.Parse("#2c2c36"), - Color.Parse("#ececf1"), - Color.Parse("#9a9aab"), - Color.Parse("#80808f"), - Color.Parse("#22403a"), - Color.Parse("#00f5b7"), - Color.Parse("#06231b"), - Color.Parse("#2a2a34"), - Color.Parse("#cfcfdb"), - Color.Parse("#ffb454")); - - public static ModalColours Light { get; } = new( - Color.FromArgb(0x33, 0, 0, 0), - Color.Parse("#ffffff"), - Color.Parse("#d4d4dd"), - Color.Parse("#e6e6ec"), - Color.Parse("#1d1d24"), - Color.Parse("#626270"), - Color.Parse("#7a7a88"), - Color.Parse("#d5efe7"), - Color.Parse("#007a63"), - Color.Parse("#ffffff"), - Color.Parse("#f1f1f5"), - Color.Parse("#40404c"), - Color.Parse("#a34a00")); - - /// Fluent's accent, in the client's colour, for the card's scope. - public void Apply(IResourceDictionary resources) - { - foreach (var key in new[] - { - "SystemAccentColor", "SystemAccentColorDark1", "SystemAccentColorDark2", "SystemAccentColorDark3", - "SystemAccentColorLight1", "SystemAccentColorLight2", "SystemAccentColorLight3", - }) - { - resources[key] = Accent; - } - - var ink = new SolidColorBrush(AccentInk); - foreach (var key in new[] - { - "AccentButtonForeground", "AccentButtonForegroundPointerOver", "AccentButtonForegroundPressed", - "ToggleButtonForegroundChecked", "ToggleButtonForegroundCheckedPointerOver", "ToggleButtonForegroundCheckedPressed", - "CheckBoxCheckGlyphForegroundChecked", "CheckBoxCheckGlyphForegroundCheckedPointerOver", - "CheckBoxCheckGlyphForegroundCheckedPressed", - }) - { - resources[key] = ink; - } - } - - public SolidColorBrush Brush(Color colour) => new(colour); -} diff --git a/src/SharpMUTerm.Avalonia/ModalParts.cs b/src/SharpMUTerm.Avalonia/ModalParts.cs index 84373e40..b523c738 100644 --- a/src/SharpMUTerm.Avalonia/ModalParts.cs +++ b/src/SharpMUTerm.Avalonia/ModalParts.cs @@ -11,10 +11,10 @@ namespace SharpMUTerm.Avalonia; internal static class ModalParts { /// The modal's title line. - public static TextBlock Heading(string text, ModalColours colours) => new() + public static TextBlock Heading(string text, NativeTokens colours) => new() { Text = NativeKeys.Words(text), - FontSize = 18, + FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold, Foreground = colours.Brush(colours.Text), Margin = new Thickness(20, 16, 20, 4), @@ -22,20 +22,20 @@ internal static class ModalParts }; /// A quiet line: a count, a scope, an explanation. - public static TextBlock Dim(string text, ModalColours colours, Thickness? margin = null) => new() + public static TextBlock Dim(string text, NativeTokens colours, Thickness? margin = null) => new() { Text = NativeKeys.Words(text), - FontSize = 12.5, + FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), Margin = margin ?? new Thickness(20, 0, 20, 6), TextWrapping = TextWrapping.Wrap, }; /// The keys the modal answers, right-aligned under it, in the window's words. - public static TextBlock Footer(string text, ModalColours colours) => new() + public static TextBlock Footer(string text, NativeTokens colours) => new() { Text = NativeKeys.Words(text), - FontSize = 11.5, + FontSize = NativeTokens.Small, Foreground = colours.Brush(colours.Dim), Margin = new Thickness(20, 8, 20, 12), HorizontalAlignment = HorizontalAlignment.Right, @@ -43,10 +43,10 @@ internal static class ModalParts }; /// A group header in a list (BUILT IN, YOURS), the palette's. - public static TextBlock GroupHeader(string text, ModalColours colours, bool first) => new() + public static TextBlock GroupHeader(string text, NativeTokens colours, bool first) => new() { Text = text.ToUpperInvariant(), - FontSize = 11, + FontSize = NativeTokens.Small, FontWeight = FontWeight.SemiBold, LetterSpacing = 0.8, Foreground = colours.Brush(colours.Header), @@ -59,17 +59,17 @@ public static TextBox SearchBox(string placeholder, string name) var box = new TextBox { PlaceholderText = placeholder, - FontSize = 15, + FontSize = NativeTokens.Title, Margin = new Thickness(14, 14, 14, 6), Padding = new Thickness(12, 8), - CornerRadius = new CornerRadius(8), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), }; global::Avalonia.Automation.AutomationProperties.SetName(box, name); return box; } /// A list of rows that scrolls, ruled above and below. - public static (Border Frame, StackPanel List, ScrollViewer Scroller) List(ModalColours colours) + public static (Border Frame, StackPanel List, ScrollViewer Scroller) List(NativeTokens colours) { var list = new StackPanel { Margin = new Thickness(8, 4, 8, 4) }; var scroller = new ScrollViewer @@ -92,7 +92,7 @@ public static Border Row(Control content, string name, Action select, Action cho { var row = new Border { - CornerRadius = new CornerRadius(7), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Padding = new Thickness(12, 6), Background = Brushes.Transparent, Child = content, @@ -116,7 +116,7 @@ public static Border Row(Control content, string name, Action select, Action cho /// with the run at marked in the accent and bold — where a query /// matched, as the cells mark it. /// - public static InlineCollection Marked(string text, int start, int length, ModalColours colours) + public static InlineCollection Marked(string text, int start, int length, NativeTokens colours) { var inlines = new InlineCollection(); if (start < 0 || length <= 0 || start + length > text.Length) @@ -140,20 +140,20 @@ public static InlineCollection Marked(string text, int start, int length, ModalC } /// A key chip, as the palette draws a key. - public static Border Key(string key, ModalColours colours) => new() + public static Border Key(string key, NativeTokens colours) => new() { Background = colours.Brush(colours.KeyFill), BorderBrush = colours.Brush(colours.Edge), BorderThickness = new Thickness(1), - CornerRadius = new CornerRadius(5), + CornerRadius = new CornerRadius(NativeTokens.RadiusS), Padding = new Thickness(6, 0), Margin = new Thickness(6, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center, - Child = new TextBlock { Text = NativeKeys.Words(key), FontSize = 11.5, Foreground = colours.Brush(colours.KeyInk) }, + Child = new TextBlock { Text = NativeKeys.Words(key), FontSize = NativeTokens.Small, Foreground = colours.Brush(colours.KeyInk) }, }; /// A button whose label is followed by the key that presses it. - public static Button Button(string label, string? key, ModalColours colours, Action click, bool accent = false) + public static Button Button(string label, string? key, NativeTokens colours, Action click, bool accent = false) { var content = new StackPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center }; content.Children.Add(new TextBlock { Text = NativeKeys.Words(label), VerticalAlignment = VerticalAlignment.Center }); @@ -162,7 +162,7 @@ public static Button Button(string label, string? key, ModalColours colours, Act content.Children.Add(new TextBlock { Text = NativeKeys.Words(key), - FontSize = 11.5, + FontSize = NativeTokens.Small, Opacity = 0.7, Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center, @@ -173,7 +173,7 @@ public static Button Button(string label, string? key, ModalColours colours, Act { Content = content, Padding = new Thickness(14, 6), - CornerRadius = new CornerRadius(7), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), }; if (accent) { diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 91c0154c..d7220f2d 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -188,7 +188,7 @@ protected override void OnPointerWheelChanged(PointerWheelEventArgs e) // ── Drawing ──────────────────────────────────────────────────────────────────────────────── /// The UI font size the chrome's text is set in. - protected const double FontSize = 13; + protected const double FontSize = NativeTokens.Body + 1; protected Color Dim => Color.FromArgb(0xA8, Ink.R, Ink.G, Ink.B); @@ -474,7 +474,7 @@ public override void Render(DrawingContext context) } context.DrawRectangle(new SolidColorBrush(brand), null, _brand, radius, radius); - var brandInk = On(brand, Colors.Black); + var brandInk = Parse(overlay.Palette.BrandInk); var menu = new Pen(new SolidColorBrush(brandInk), 1.6, lineCap: PenLineCap.Round); var mx = _brand.X + 12; foreach (var dy in new[] { -4.0, 0, 4 }) @@ -491,7 +491,7 @@ public override void Render(DrawingContext context) if (_counts.Width > 0) { - Text(context, CountsText(model), _counts.X, middle, size - 1, Dim); + Text(context, CountsText(model), _counts.X, middle, size - 1, Parse(overlay.Palette.HeaderMuted)); } if (model.Prefix is { } prefix) @@ -512,7 +512,7 @@ public override void Render(DrawingContext context) x += nameWidth + 10; if (_pill.Right - 12 - x > 12) { - Text(context, character.Detail(world.Name), x, middle, size - 1, Dim, maxWidth: _pill.Right - 12 - x); + Text(context, character.Detail(world.Name), x, middle, size - 1, Parse(overlay.Palette.HeaderMuted), maxWidth: _pill.Right - 12 - x); } } diff --git a/src/SharpMUTerm.Avalonia/NativeMenu.cs b/src/SharpMUTerm.Avalonia/NativeMenu.cs index 4fec29b2..b85cfafc 100644 --- a/src/SharpMUTerm.Avalonia/NativeMenu.cs +++ b/src/SharpMUTerm.Avalonia/NativeMenu.cs @@ -40,7 +40,21 @@ public static ContextMenu Build(MenuModel model, Action dispatch, Placem private static ContextMenu Build( IEnumerable<(string Label, string? Hint, bool Enabled, bool Checked, Action Run)?> items, PlacementMode placement, Control target) { - var menu = new ContextMenu { Placement = placement, PlacementTarget = target }; + // The palette's card: the client's planes, ink and highlight, a rounded edge — not Simple's grey square. + var tokens = NativeTokens.For(null, target.ActualThemeVariant != global::Avalonia.Styling.ThemeVariant.Light); + var menu = new ContextMenu + { + Placement = placement, + PlacementTarget = target, + Background = tokens.Brush(tokens.Card), + Foreground = tokens.Brush(tokens.Text), + BorderBrush = tokens.Brush(tokens.Edge), + BorderThickness = new Thickness(1), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), + Padding = new Thickness(4), + FontSize = NativeTokens.Body, + }; + tokens.ApplySimple(menu.Resources); Grid.SetIsSharedSizeScope(menu, true); foreach (var item in items) { @@ -74,7 +88,7 @@ private static Control Header(string label, string? hint) grid.Children.Add(new TextBlock { Text = NativeKeys.Words(label), VerticalAlignment = VerticalAlignment.Center }); if (hint is { } key) { - var text = new TextBlock { Text = NativeKeys.Words(key), Opacity = 0.6, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; + var text = new TextBlock { Text = NativeKeys.Words(key), Opacity = 0.7, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; Grid.SetColumn(text, 1); grid.Children.Add(text); } diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.cs b/src/SharpMUTerm.Avalonia/NativeTokens.cs new file mode 100644 index 00000000..d2e7dd81 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/NativeTokens.cs @@ -0,0 +1,306 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Media; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's one design language: every native surface — the palette, the modals, the welcome, the settings +/// window and its list editors, the packages page, the right-click menu, the composer — takes its planes, inks, +/// corner radii and type sizes from here, so they read as one application rather than as the waves they were built in. +/// +/// Derived from the client's theme the way is. Two canonical sets, one per side of +/// mid-grey (the palette's card as it was drawn before there were tokens), are laid onto the theme: its background's +/// hue shift is added to every plane (so Solarized Dark gets teal cards, not the Dark theme's grey ones), and then every +/// ink is held to on every plane it is drawn on. The Dark and Light themes resolve to the +/// canonical sets exactly. The accent is the client's own (, the cells' teal), moved +/// only as far as the floor asks; the warning and the notice are the cells' amber hues, likewise. +/// +/// +/// The only literal colours and sizes in the window's views are here; NativeTokenLiteralTests fails on a +/// FontSize = 12 or a Color.Parse("#…") anywhere else in the assembly, apart from the few it lists with +/// their reasons. +/// +/// +internal sealed record NativeTokens( + bool IsDark, + Color Scrim, + Color Card, + Color Edge, + Color Rule, + Color Text, + Color Dim, + Color Header, + Color Selected, + Color Accent, + Color AccentInk, + Color KeyFill, + Color KeyInk, + Color Warn, + Color Notice) +{ + // ── the scales ────────────────────────────────────────────────────────────────────────────── + + /// The type ramp: captions and keys. + public const double Small = 11; + + /// The type ramp: body text, help, rows. + public const double Body = 12; + + /// The type ramp: a field's label, a list item's name, a search box. + public const double Title = 14; + + /// The type ramp: a surface's or a page's heading. + public const double Heading = 18; + + /// + /// Not on the ramp: the theme cards' miniature of the cells (F7), which is a picture of a terminal at a quarter of + /// its size rather than text to read. + /// + public const double Miniature = 9; + + /// Corner radius of a key cap, a chip, a check. + public const double RadiusS = 4; + + /// Corner radius of a row, an input, a button, a card inside a page. + public const double RadiusM = 8; + + /// Corner radius of a surface: the palette, a modal, the settings frame. + public const double RadiusL = 12; + + /// The floor every ink is held to on every plane it is drawn on: WCAG AA for body text. + public const double TextFloor = 4.5; + + /// The shadow a surface casts on what it floats over. + public static BoxShadows Shadow { get; } = new(new BoxShadow + { + OffsetY = 16, + Blur = 40, + Color = Color.FromArgb(0x66, 0, 0, 0), + }); + + /// The raised plane an input, a key cap or a hovered row sits on. + public Color Raised => KeyFill; + + /// The Dark theme's tokens: the canonical dark set. + public static NativeTokens Dark => DarkTokens.Value; + + /// The Light theme's tokens: the canonical light set. + public static NativeTokens Light => LightTokens.Value; + + // Lazy, because a static initialiser here would run before the canonical sets below are assigned. + private static readonly Lazy DarkTokens = new(() => For(ThemeLibrary.Dark())); + private static readonly Lazy LightTokens = new(() => For(ThemeLibrary.Light())); + + /// The tokens for a theme, or for the built-in theme of the variant when the host was told no theme. + public static NativeTokens For(Theme? theme, bool isDark) => + theme is not null ? For(theme) : isDark ? Dark : Light; + + /// The tokens for . + public static NativeTokens For(Theme theme) + { + ArgumentNullException.ThrowIfNull(theme); + var light = Contrast.RelativeLuminance(theme.Background) >= 0.18; + var canon = light ? LightCanon : DarkCanon; + var reference = light ? new Rgb(0xfa, 0xfa, 0xfa) : new Rgb(0x1e, 0x1e, 0x1e); + var shift = (theme.Background.R - reference.R, theme.Background.G - reference.G, theme.Background.B - reference.B); + + var card = Shift(canon.Card, shift); + var edge = Shift(canon.Edge, shift); + var rule = Shift(canon.Rule, shift); + var selected = Shift(canon.Selected, shift); + var keyFill = Shift(canon.KeyFill, shift); + Rgb[] planes = [card, selected, keyFill]; + + var accent = Held(ChromeInk.BaseAccent, planes); + var accentInk = Contrast.Legible( + Contrast.RelativeLuminance(accent) < 0.18 ? new Rgb(0xff, 0xff, 0xff) : canon.AccentInk, accent, TextFloor); + + return new NativeTokens( + !light, + canon.Scrim, + Colour(card), + Colour(edge), + Colour(rule), + Colour(Held(canon.Text, planes)), + Colour(Held(canon.Dim, planes)), + Colour(Held(canon.Header, planes)), + Colour(selected), + Colour(accent), + Colour(accentInk), + Colour(keyFill), + Colour(Held(canon.KeyInk, [keyFill])), + Colour(Held(canon.Warn, planes)), + Colour(Held(ChromeInk.BaseNotice, planes))); + } + + /// A brush of . + public SolidColorBrush Brush(Color colour) => new(colour); + + /// + /// drawn as a quiet fill behind text in it (a chip, a tag): the colour at low alpha over + /// the card, which keeps it the colour's tag on either variant. + /// + public SolidColorBrush Tint(Color colour) => new(Color.FromArgb(0x2a, colour.R, colour.G, colour.B)); + + /// + /// Hands Fluent the tokens, for a scope (the palette's card, a modal's, the settings window): the accent for its own + /// accent buttons, checks, toggles and focus rings, with an ink on it that is legible in both variants, and the + /// tokens' planes for its inputs, buttons, lists and menus — so a Fluent control inside a surface wears the surface's + /// language and not Fluent's blue on black. + /// + public void Apply(IResourceDictionary resources) + { + ArgumentNullException.ThrowIfNull(resources); + foreach (var key in new[] + { + "SystemAccentColor", "SystemAccentColorDark1", "SystemAccentColorDark2", "SystemAccentColorDark3", + "SystemAccentColorLight1", "SystemAccentColorLight2", "SystemAccentColorLight3", + }) + { + resources[key] = Accent; + } + + void Set(SolidColorBrush brush, params string[] keys) + { + foreach (var key in keys) + { + resources[key] = brush; + } + } + + Set(new SolidColorBrush(AccentInk), + "AccentButtonForeground", "AccentButtonForegroundPointerOver", "AccentButtonForegroundPressed", + "ToggleButtonForegroundChecked", "ToggleButtonForegroundCheckedPointerOver", "ToggleButtonForegroundCheckedPressed", + "CheckBoxCheckGlyphForegroundChecked", "CheckBoxCheckGlyphForegroundCheckedPointerOver", + "CheckBoxCheckGlyphForegroundCheckedPressed", "ToggleSwitchKnobFillOn", "ToggleSwitchKnobFillOnPointerOver", + "ToggleSwitchKnobFillOnPressed"); + Set(Brush(Accent), + "TextControlBorderBrushFocused", "ToggleSwitchFillOn", "ToggleSwitchFillOnPointerOver", "ToggleSwitchFillOnPressed", + "CheckBoxCheckBackgroundFillChecked", "CheckBoxCheckBackgroundFillCheckedPointerOver", + "CheckBoxCheckBackgroundStrokeChecked", "CheckBoxCheckBackgroundStrokeCheckedPointerOver", + "SliderThumbBackground", "SliderTrackValueFill"); + Set(Brush(Raised), + "TextControlBackground", "TextControlBackgroundPointerOver", "TextControlBackgroundFocused", + "ButtonBackground", "ComboBoxBackground", "ComboBoxBackgroundPointerOver", "ComboBoxBackgroundFocused", + "RepeatButtonBackground", "ToggleSwitchFillOff", "ToggleSwitchFillOffPointerOver"); + Set(Brush(Selected), + "ButtonBackgroundPointerOver", "ButtonBackgroundPressed", "ComboBoxBackgroundPressed", + "RepeatButtonBackgroundPointerOver", "ListBoxItemBackgroundPointerOver", "ComboBoxItemBackgroundPointerOver", + "ListBoxItemBackgroundSelected", "ListBoxItemBackgroundSelectedPointerOver", "ListBoxItemBackgroundSelectedPressed", + "ComboBoxItemBackgroundSelected", "ComboBoxItemBackgroundSelectedPointerOver", "MenuFlyoutItemBackgroundPointerOver", + "TabItemHeaderBackgroundSelected"); + Set(Brush(Edge), + "TextControlBorderBrush", "TextControlBorderBrushPointerOver", "ButtonBorderBrush", "ButtonBorderBrushPointerOver", + "ComboBoxBorderBrush", "ComboBoxBorderBrushPointerOver", "RepeatButtonBorderBrush", "ToggleSwitchStrokeOff", + "ToggleSwitchStrokeOffPointerOver", "CheckBoxCheckBackgroundStrokeUnchecked", + "CheckBoxCheckBackgroundStrokeUncheckedPointerOver", "ComboBoxDropDownBorderBrush", "MenuFlyoutPresenterBorderBrush"); + Set(Brush(Card), "ComboBoxDropDownBackground", "MenuFlyoutPresenterBackground", "FlyoutPresenterBackground"); + Set(Brush(Text), + "TextControlForeground", "TextControlForegroundPointerOver", "TextControlForegroundFocused", "ButtonForeground", + "ButtonForegroundPointerOver", "ButtonForegroundPressed", "ComboBoxForeground", "ListBoxItemForeground", + "ListBoxItemForegroundSelected", "ListBoxItemForegroundPointerOver", "ComboBoxItemForeground", + "ComboBoxItemForegroundSelected", "TabItemHeaderForegroundSelected", "TabItemHeaderForegroundSelectedPointerOver", + "ToggleSwitchKnobFillOff", "ToggleSwitchContentForeground", "CheckBoxForegroundUnchecked", "CheckBoxForegroundChecked"); + Set(Brush(Dim), + "TextControlPlaceholderForeground", "TextControlPlaceholderForegroundPointerOver", + "TextControlPlaceholderForegroundFocused", "TabItemHeaderForegroundUnselected", + "TabItemHeaderForegroundUnselectedPointerOver"); + Set(Brush(Accent), "TabItemHeaderSelectedPipeFill"); + resources["ControlCornerRadius"] = new CornerRadius(RadiusM); + resources["OverlayCornerRadius"] = new CornerRadius(RadiusM); + } + + /// + /// Hands the Simple theme the tokens, for a control drawn in it rather than in Fluent (the right-click and header + /// menus): its background, ink, borders and highlight, so a menu wears the palette's card and not Simple's grey. + /// + public void ApplySimple(IResourceDictionary resources) + { + ArgumentNullException.ThrowIfNull(resources); + resources["ThemeBackgroundColor"] = Card; + resources["ThemeBackgroundBrush"] = Brush(Card); + resources["ThemeForegroundColor"] = Text; + resources["ThemeForegroundBrush"] = Brush(Text); + resources["ThemeForegroundLowBrush"] = Brush(Dim); + foreach (var key in new[] { "ThemeBorderLowBrush", "ThemeBorderMidBrush", "ThemeBorderHighBrush" }) + { + resources[key] = Brush(Edge); + } + + foreach (var key in new[] + { + "ThemeControlLowBrush", "ThemeControlMidBrush", "ThemeControlHighlightLowBrush", "ThemeControlHighlightMidBrush", + "ThemeControlHighlightHighBrush", "ThemeAccentBrush3", "ThemeAccentBrush4", + }) + { + resources[key] = Brush(Selected); + } + + resources["ThemeAccentBrush"] = Brush(Accent); + resources["ThemeAccentBrush2"] = Brush(Accent); + resources["HighlightBrush"] = Brush(Selected); + resources["HighlightForegroundBrush"] = Brush(Text); + } + + // ── the canonical sets ────────────────────────────────────────────────────────────────────── + + /// One side of mid-grey's set, before a theme is laid onto it. + private sealed record Canon( + Color Scrim, Rgb Card, Rgb Edge, Rgb Rule, Rgb Text, Rgb Dim, Rgb Header, Rgb Selected, Rgb AccentInk, Rgb KeyFill, + Rgb KeyInk, Rgb Warn); + + /// The palette's dark card, as it was drawn before there were tokens. + private static readonly Canon DarkCanon = new( + Color.FromArgb(0x59, 0, 0, 0), + new Rgb(0x1e, 0x1e, 0x25), + new Rgb(0x3a, 0x3a, 0x46), + new Rgb(0x2c, 0x2c, 0x36), + new Rgb(0xec, 0xec, 0xf1), + new Rgb(0x9a, 0x9a, 0xab), + new Rgb(0x80, 0x80, 0x8f), + new Rgb(0x22, 0x40, 0x3a), + new Rgb(0x06, 0x23, 0x1b), + new Rgb(0x2a, 0x2a, 0x34), + new Rgb(0xcf, 0xcf, 0xdb), + new Rgb(0xff, 0xb4, 0x54)); + + /// The palette's light card. + private static readonly Canon LightCanon = new( + Color.FromArgb(0x33, 0, 0, 0), + new Rgb(0xff, 0xff, 0xff), + new Rgb(0xd4, 0xd4, 0xdd), + new Rgb(0xe6, 0xe6, 0xec), + new Rgb(0x1d, 0x1d, 0x24), + new Rgb(0x62, 0x62, 0x70), + new Rgb(0x6a, 0x6a, 0x78), + new Rgb(0xd5, 0xef, 0xe7), + new Rgb(0xff, 0xff, 0xff), + new Rgb(0xf1, 0xf1, 0xf5), + new Rgb(0x40, 0x40, 0x4c), + new Rgb(0xa3, 0x4a, 0x00)); + + /// An ink moved, if it must be, until it clears on every plane given. + private static Rgb Held(Rgb ink, IReadOnlyList planes) + { + for (var pass = 0; pass < 2; pass++) + { + foreach (var plane in planes) + { + ink = Contrast.Legible(ink, plane, TextFloor); + } + } + + return ink; + } + + private static Rgb Shift(Rgb rgb, (int R, int G, int B) d) => + new(Channel(rgb.R + d.R), Channel(rgb.G + d.G), Channel(rgb.B + d.B)); + + private static byte Channel(int value) => (byte)Math.Clamp(value, 0, 255); + + private static Color Colour(Rgb rgb) => Color.FromRgb(rgb.R, rgb.G, rgb.B); +} diff --git a/src/SharpMUTerm.Avalonia/PackagePageView.cs b/src/SharpMUTerm.Avalonia/PackagePageView.cs index 6ea88a2f..235fa095 100644 --- a/src/SharpMUTerm.Avalonia/PackagePageView.cs +++ b/src/SharpMUTerm.Avalonia/PackagePageView.cs @@ -29,6 +29,7 @@ internal sealed class PackagePageView : Grid private readonly Func _visible; private readonly IBrush _accent; private readonly bool _dark; + private readonly NativeTokens _tokens; private readonly TabControl _tabs; private readonly ListBox _installed = new() { Background = Brushes.Transparent }; private readonly StackPanel _detail = new() { Spacing = 2, Margin = new Thickness(4, 0, 4, 16) }; @@ -36,7 +37,7 @@ internal sealed class PackagePageView : Grid private readonly StackPanel _browseDetail = new() { Spacing = 6, Margin = new Thickness(4, 0, 4, 16) }; private readonly ContentControl _browseBody = new(); private readonly Border _reviewLayer; - private readonly TextBlock _status = new() { Opacity = 0.8, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 0) }; + private readonly TextBlock _status = new() { TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 0) }; private readonly Dictionary _values = new(StringComparer.Ordinal); private readonly List<(PackageItem Item, ToggleSwitch Switch)> _rows = []; private string? _selected; @@ -47,13 +48,14 @@ internal sealed class PackagePageView : Grid private bool _shownFetching; private PackageReviewModel? _shownReview; - public PackagePageView(PackageManager manager, Func visible, IBrush accent, bool dark) + public PackagePageView(PackageManager manager, Func visible, NativeTokens tokens) { _manager = manager; _declaration = manager.Declaration; _visible = visible; - _accent = accent; - _dark = dark; + _tokens = tokens; + _accent = tokens.Brush(tokens.Accent); + _dark = tokens.IsDark; RowDefinitions = new RowDefinitions("*,Auto"); Margin = new Thickness(0, 6, 0, 0); @@ -77,8 +79,8 @@ public PackagePageView(PackageManager manager, Func visible }; AutomationProperties.SetName(_browse, "The package index"); - InstalledTab = new TabItem { Header = "Installed", Content = MasterDetail(_installed, _detail), FontSize = 17 }; - BrowseTab = new TabItem { Header = "Browse", Content = _browseBody, FontSize = 17 }; + InstalledTab = new TabItem { Header = "Installed", Content = MasterDetail(_installed, _detail), FontSize = NativeTokens.Title }; + BrowseTab = new TabItem { Header = "Browse", Content = _browseBody, FontSize = NativeTokens.Title }; foreach (var tab in new[] { InstalledTab, BrowseTab }) { // The header's size only: the page under it keeps the window's own. @@ -102,7 +104,7 @@ public PackagePageView(PackageManager manager, Func visible _reviewLayer = new Border { - Background = new SolidColorBrush(Color.FromArgb(0x99, 0, 0, 0)), + Background = _tokens.Brush(_tokens.Scrim), IsVisible = false, }; SetRowSpan(_reviewLayer, 2); @@ -190,7 +192,7 @@ private Grid MasterDetail(Control list, Control detail) Child = list, BorderThickness = new Thickness(1), BorderBrush = Hairline, - CornerRadius = new CornerRadius(6), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Margin = new Thickness(0, 0, 14, 0), }); var scroller = new ScrollViewer { Content = detail, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }; @@ -199,9 +201,12 @@ private Grid MasterDetail(Control list, Control detail) return grid; } - private IBrush Hairline => new SolidColorBrush(_dark ? Color.Parse("#46464e") : Color.Parse("#c8c8d0")); + private IBrush Hairline => _tokens.Brush(_tokens.Edge); - private IBrush Warning => new SolidColorBrush(_dark ? Color.Parse("#ffb454") : Color.Parse("#a4410e")); + /// A quiet line's ink, held to the floor (an opacity would not be). + private IBrush DimInk => _tokens.Brush(_tokens.Dim); + + private IBrush Warning => _tokens.Brush(_tokens.Warn); private void BuildInstalled() { @@ -234,12 +239,12 @@ private void BuildInstalled() _rows.Add((item, toggle)); var words = new StackPanel { Spacing = 1, VerticalAlignment = VerticalAlignment.Center }; - words.Children.Add(new TextBlock { Text = Text("name", item), FontSize = 14, TextTrimming = TextTrimming.CharacterEllipsis }); + words.Children.Add(new TextBlock { Text = Text("name", item), FontSize = NativeTokens.Title, TextTrimming = TextTrimming.CharacterEllipsis }); var tail = string.Join(" · ", _declaration.RowFields.Skip(1).Select(id => Text(id, item))); - words.Children.Add(new TextBlock { Text = tail, FontSize = 12, Opacity = 0.7, TextTrimming = TextTrimming.CharacterEllipsis }); + words.Children.Add(new TextBlock { Text = tail, FontSize = NativeTokens.Body, Foreground = DimInk, TextTrimming = TextTrimming.CharacterEllipsis }); if (item.Update is { } newer) { - words.Children.Add(new TextBlock { Text = $"update {newer} available", FontSize = 12, Foreground = _accent }); + words.Children.Add(new TextBlock { Text = $"update {newer} available", FontSize = NativeTokens.Body, Foreground = _accent }); } var row = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") }; @@ -292,9 +297,9 @@ private void BuildDetail() var shown = new List { _declaration.EnabledField }; shown.AddRange(_declaration.RowFields); - _detail.Children.Add(new TextBlock { Text = Text("name", item), FontSize = 20, FontWeight = FontWeight.SemiBold }); + _detail.Children.Add(new TextBlock { Text = Text("name", item), FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold }); var subtitle = string.Join(" · ", _declaration.RowFields.Skip(1).Select(id => Text(id, item))); - _detail.Children.Add(new TextBlock { Text = subtitle, Opacity = 0.7, Margin = new Thickness(0, 0, 0, 6) }); + _detail.Children.Add(new TextBlock { Text = subtitle, Foreground = DimInk, Margin = new Thickness(0, 0, 0, 6) }); string? group = null; foreach (var field in _declaration.DetailFields.Where(_visible)) @@ -305,7 +310,7 @@ private void BuildDetail() _detail.Children.Add(new TextBlock { Text = heading, - FontSize = 15, + FontSize = NativeTokens.Title, FontWeight = FontWeight.SemiBold, Margin = new Thickness(0, 14, 0, 4), Foreground = _accent, @@ -313,7 +318,7 @@ private void BuildDetail() } var row = new Grid { ColumnDefinitions = new ColumnDefinitions("120,*"), Margin = new Thickness(0, 3) }; - var label = new TextBlock { Text = Capitalise(field.Label), Opacity = 0.75 }; + var label = new TextBlock { Text = Capitalise(field.Label), Foreground = DimInk }; if (field.Help is { } help) { ToolTip.SetTip(label, NativeKeys.Words(Capitalise(help))); @@ -408,7 +413,7 @@ private void BuildBrowse() if (_manager.BrowseModel is not { } model) { var empty = new StackPanel { Spacing = 10, Margin = new Thickness(4, 24, 4, 0), MaxWidth = 520, HorizontalAlignment = HorizontalAlignment.Left }; - empty.Children.Add(new TextBlock { Text = "The package index", FontSize = 18, FontWeight = FontWeight.SemiBold }); + empty.Children.Add(new TextBlock { Text = "The package index", FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold }); empty.Children.Add(new TextBlock { Text = "Rule sets, scripts and sounds other players have shared, this game's first. The index is fetched only when you ask, over https; every package is checked against it before you see its review.", @@ -458,7 +463,7 @@ private void BuildBrowse() { var words = new StackPanel { Spacing = 1 }; var title = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8 }; - title.Children.Add(new TextBlock { Text = row.Entry.Name, FontSize = 14 }); + title.Children.Add(new TextBlock { Text = row.Entry.Name, FontSize = NativeTokens.Title }); if (row.ForWorld) { title.Children.Add(Chip(model.World ?? "this game", _accent)); @@ -473,7 +478,7 @@ private void BuildBrowse() words.Children.Add(new TextBlock { Text = $"{row.Entry.Version} · {string.Join(", ", row.Entry.Games)}" + (row.StateText.Length == 0 ? string.Empty : $" · {row.StateText}"), - FontSize = 12, + FontSize = NativeTokens.Body, Opacity = 0.7, TextTrimming = TextTrimming.CharacterEllipsis, }); @@ -495,10 +500,10 @@ private void BuildBrowse() private Border Chip(string text, IBrush brush) => new() { - Child = new TextBlock { Text = text, FontSize = 11, Foreground = brush }, + Child = new TextBlock { Text = text, FontSize = NativeTokens.Small, Foreground = brush }, BorderBrush = brush, BorderThickness = new Thickness(1), - CornerRadius = new CornerRadius(8), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Padding = new Thickness(6, 0), VerticalAlignment = VerticalAlignment.Center, }; @@ -509,13 +514,13 @@ private void BuildBrowseDetail() InstallButton = null; if (_manager.BrowseModel is not { Rows.Count: > 0 } model) { - _browseDetail.Children.Add(new TextBlock { Text = "The index lists nothing.", Opacity = 0.75 }); + _browseDetail.Children.Add(new TextBlock { Text = "The index lists nothing.", Foreground = DimInk }); return; } var row = model.Rows[Math.Clamp(_browseSelected, 0, model.Rows.Count - 1)]; var entry = row.Entry; - _browseDetail.Children.Add(new TextBlock { Text = entry.Name, FontSize = 20, FontWeight = FontWeight.SemiBold }); + _browseDetail.Children.Add(new TextBlock { Text = entry.Name, FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold }); _browseDetail.Children.Add(new TextBlock { Text = entry.Version + (entry.Author is { } author ? $" · by {author}" : string.Empty), @@ -551,10 +556,10 @@ private void BuildBrowseDetail() _browseDetail.Children.Add(install); } - private static Grid Pair(string label, string value) + private Grid Pair(string label, string value) { var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("120,*") }; - grid.Children.Add(new TextBlock { Text = label, Opacity = 0.75 }); + grid.Children.Add(new TextBlock { Text = label, Foreground = DimInk }); var text = new TextBlock { Text = value, TextWrapping = TextWrapping.Wrap }; SetColumn(text, 1); grid.Children.Add(text); @@ -578,11 +583,11 @@ private void BuildReview() var lines = new List(); var header = new StackPanel { Spacing = 2, Margin = new Thickness(0, 0, 0, 4) }; - header.Children.Add(new TextBlock { Text = review.Title, FontSize = 13, Opacity = 0.7 }); + header.Children.Add(new TextBlock { Text = review.Title, FontSize = NativeTokens.Title, Foreground = DimInk }); header.Children.Add(new TextBlock { Text = $"{review.Name} {review.Version}", - FontSize = 20, + FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold, TextWrapping = TextWrapping.Wrap, }); @@ -593,7 +598,7 @@ private void BuildReview() }.Where(t => t is not null)); if (byline.Length > 0) { - header.Children.Add(new TextBlock { Text = byline, Opacity = 0.75, TextWrapping = TextWrapping.Wrap }); + header.Children.Add(new TextBlock { Text = byline, Foreground = DimInk, TextWrapping = TextWrapping.Wrap }); } var card = new StackPanel { Spacing = 4 }; @@ -611,7 +616,7 @@ private void BuildReview() { Text = Capitalise(section.Heading.ToLowerInvariant()), FontWeight = FontWeight.SemiBold, - FontSize = 15, + FontSize = NativeTokens.Title, Foreground = acts && review.Acts ? Warning : _accent, Margin = new Thickness(0, 0, 0, 2), }); @@ -642,7 +647,7 @@ private void BuildReview() } var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("110,*") }; - grid.Children.Add(new TextBlock { Text = Capitalise(row.Label), Opacity = 0.75 }); + grid.Children.Add(new TextBlock { Text = Capitalise(row.Label), Foreground = DimInk }); SetColumn(value, 1); grid.Children.Add(value); box.Children.Add(grid); @@ -653,10 +658,10 @@ private void BuildReview() Child = box, Padding = new Thickness(12, 10), Margin = new Thickness(0, 8, 0, 0), - CornerRadius = new CornerRadius(6), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), BorderThickness = new Thickness(acts && review.Acts ? 1 : 0), BorderBrush = Warning, - Background = new SolidColorBrush(_dark ? Color.Parse("#2a2a30") : Color.Parse("#f3f3f6")), + Background = _tokens.Brush(_tokens.Raised), }); } @@ -698,8 +703,8 @@ private void BuildReview() _reviewLayer.Child = new Border { Child = layout, - Background = new SolidColorBrush(_dark ? Color.Parse("#202024") : Colors.White), - CornerRadius = new CornerRadius(8), + Background = _tokens.Brush(_tokens.Card), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Padding = new Thickness(22, 16), MaxWidth = 620, Margin = new Thickness(16), diff --git a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs index 80e9180e..925992c9 100644 --- a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs +++ b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs @@ -35,7 +35,7 @@ internal sealed class PaletteOverlay : Panel private readonly PaletteSession _session; private readonly Action _remove; - private readonly Colours _colours; + private readonly NativeTokens _colours; private readonly Border _card; private readonly TextBox _search; private readonly TextBlock _status; @@ -53,7 +53,7 @@ public PaletteOverlay(PaletteSession session, Action remove) { _session = session; _remove = remove; - _colours = session.IsDark ? Colours.Dark : Colours.Light; + _colours = NativeTokens.For(session.Theme, session.IsDark); _view = session.View(string.Empty); Background = new SolidColorBrush(_colours.Scrim); @@ -63,10 +63,10 @@ public PaletteOverlay(PaletteSession session, Action remove) _search = new TextBox { PlaceholderText = "Type a command, a character, a window or a setting", - FontSize = 16, + FontSize = NativeTokens.Title, Margin = new Thickness(14, 14, 14, 6), Padding = new Thickness(12, 9), - CornerRadius = new CornerRadius(8), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), }; AutomationProperties.SetName(_search, "Search commands"); _search.TextChanged += (_, _) => Refresh(resetSelection: true); @@ -74,7 +74,7 @@ public PaletteOverlay(PaletteSession session, Action remove) _status = new TextBlock { - FontSize = 12, + FontSize = NativeTokens.Body, Foreground = new SolidColorBrush(_colours.Dim), Margin = new Thickness(20, 0, 20, 6), }; @@ -83,7 +83,7 @@ public PaletteOverlay(PaletteSession session, Action remove) var footer = new TextBlock { Text = "↑↓ move Enter run Esc close", - FontSize = 11.5, + FontSize = NativeTokens.Small, Foreground = new SolidColorBrush(_colours.Dim), Margin = new Thickness(20, 6, 20, 10), HorizontalAlignment = HorizontalAlignment.Right, @@ -114,8 +114,8 @@ public PaletteOverlay(PaletteSession session, Action remove) Background = new SolidColorBrush(_colours.Card), BorderBrush = new SolidColorBrush(_colours.Edge), BorderThickness = new Thickness(1), - CornerRadius = new CornerRadius(12), - BoxShadow = BoxShadows.Parse("0 16 40 0 #66000000"), + CornerRadius = new CornerRadius(NativeTokens.RadiusL), + BoxShadow = NativeTokens.Shadow, ClipToBounds = true, Child = dock, }; @@ -131,6 +131,7 @@ public PaletteOverlay(PaletteSession session, Action remove) Child = _card, }; scope.Styles.Add(new FluentTheme()); + _colours.Apply(scope.Resources); Children.Add(scope); AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); @@ -228,7 +229,7 @@ private void Refresh(bool resetSelection) _list.Children.Add(new TextBlock { Text = header.Label, - FontSize = 11, + FontSize = NativeTokens.Small, FontWeight = FontWeight.SemiBold, LetterSpacing = 0.8, Foreground = new SolidColorBrush(_colours.Header), @@ -271,7 +272,7 @@ private Border EntryRow(PaletteEntry entry, string? key, int index) { var title = new TextBlock { - FontSize = 14, + FontSize = NativeTokens.Title, Foreground = new SolidColorBrush(_colours.Text), VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis, @@ -284,7 +285,7 @@ private Border EntryRow(PaletteEntry entry, string? key, int index) var words = new TextBlock { Text = NativeKeys.Words(detail), - FontSize = 12.5, + FontSize = NativeTokens.Body, Foreground = new SolidColorBrush(_colours.Dim), Margin = new Thickness(12, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center, @@ -312,10 +313,10 @@ private Border EntryRow(PaletteEntry entry, string? key, int index) Background = new SolidColorBrush(_colours.KeyFill), BorderBrush = new SolidColorBrush(_colours.Edge), BorderThickness = new Thickness(1), - CornerRadius = new CornerRadius(5), + CornerRadius = new CornerRadius(NativeTokens.RadiusS), Padding = new Thickness(7, 1), VerticalAlignment = VerticalAlignment.Center, - Child = new TextBlock { Text = part, FontSize = 12, Foreground = new SolidColorBrush(_colours.KeyInk) }, + Child = new TextBlock { Text = part, FontSize = NativeTokens.Body, Foreground = new SolidColorBrush(_colours.KeyInk) }, }); } @@ -325,7 +326,7 @@ private Border EntryRow(PaletteEntry entry, string? key, int index) var row = new Border { - CornerRadius = new CornerRadius(7), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Padding = new Thickness(12, 7), Background = Brushes.Transparent, Child = grid, @@ -459,35 +460,4 @@ private void OnScrimPressed(object? sender, PointerPressedEventArgs e) Dismiss(); } } - - /// The card's colours, one set per variant: the client's accent marks a match, as in the cells. - private sealed record Colours( - Color Scrim, Color Card, Color Edge, Color Rule, Color Text, Color Dim, Color Header, Color Selected, Color Accent, Color KeyFill, Color KeyInk) - { - public static Colours Dark { get; } = new( - Color.FromArgb(0x59, 0, 0, 0), - Color.Parse("#1e1e25"), - Color.Parse("#3a3a46"), - Color.Parse("#2c2c36"), - Color.Parse("#ececf1"), - Color.Parse("#9a9aab"), - Color.Parse("#80808f"), - Color.Parse("#22403a"), - Color.Parse("#00f5b7"), - Color.Parse("#2a2a34"), - Color.Parse("#cfcfdb")); - - public static Colours Light { get; } = new( - Color.FromArgb(0x33, 0, 0, 0), - Color.Parse("#ffffff"), - Color.Parse("#d4d4dd"), - Color.Parse("#e6e6ec"), - Color.Parse("#1d1d24"), - Color.Parse("#626270"), - Color.Parse("#7a7a88"), - Color.Parse("#d5efe7"), - Color.Parse("#007a63"), - Color.Parse("#f1f1f5"), - Color.Parse("#40404c")); - } } diff --git a/src/SharpMUTerm.Avalonia/QuitView.cs b/src/SharpMUTerm.Avalonia/QuitView.cs index 1e255fde..5b962847 100644 --- a/src/SharpMUTerm.Avalonia/QuitView.cs +++ b/src/SharpMUTerm.Avalonia/QuitView.cs @@ -19,14 +19,14 @@ namespace SharpMUTerm.Avalonia; internal sealed class QuitView : DockPanel, IModalView { private readonly QuitSession _session; - private readonly ModalColours _colours; + private readonly NativeTokens _colours; private readonly Action _done; private readonly Button _quit; private readonly Button _stay; private readonly TextBlock _footer; private QuitChoice _selected = QuitChoice.Stay; - public QuitView(QuitSession session, ModalColours colours, Action done) + public QuitView(QuitSession session, NativeTokens colours, Action done) { _session = session; _colours = colours; @@ -47,10 +47,10 @@ public QuitView(QuitSession session, ModalColours colours, Action done) foreach (var consequence in model.Consequences) { var line = new DockPanel(); - var dot = new TextBlock { Text = "●", Foreground = colours.Brush(colours.Accent), Margin = new Thickness(0, 0, 10, 0), FontSize = 11, VerticalAlignment = VerticalAlignment.Center }; + var dot = new TextBlock { Text = "●", Foreground = colours.Brush(colours.Accent), Margin = new Thickness(0, 0, 10, 0), FontSize = NativeTokens.Small, VerticalAlignment = VerticalAlignment.Center }; SetDock(dot, Dock.Left); line.Children.Add(dot); - line.Children.Add(new TextBlock { Text = NativeKeys.Words(consequence), Foreground = colours.Brush(colours.Text), TextWrapping = TextWrapping.Wrap, FontSize = 14 }); + line.Children.Add(new TextBlock { Text = NativeKeys.Words(consequence), Foreground = colours.Brush(colours.Text), TextWrapping = TextWrapping.Wrap, FontSize = NativeTokens.Title }); facts.Children.Add(line); } diff --git a/src/SharpMUTerm.Avalonia/SearchView.cs b/src/SharpMUTerm.Avalonia/SearchView.cs index 13915b8a..8bf90e32 100644 --- a/src/SharpMUTerm.Avalonia/SearchView.cs +++ b/src/SharpMUTerm.Avalonia/SearchView.cs @@ -20,7 +20,7 @@ namespace SharpMUTerm.Avalonia; internal sealed class SearchView : DockPanel, IModalView { private readonly SearchSession _session; - private readonly ModalColours _colours; + private readonly NativeTokens _colours; private readonly Action _done; private readonly TextBox _box; private readonly ToggleButton _regex; @@ -34,7 +34,7 @@ internal sealed class SearchView : DockPanel, IModalView private int _selected; private bool _syncing; - public SearchView(SearchSession session, ModalColours colours, Action done) + public SearchView(SearchSession session, NativeTokens colours, Action done) { _session = session; _colours = colours; @@ -56,7 +56,7 @@ public SearchView(SearchSession session, ModalColours colours, Action done) toggles.Children.Add(switches); _count = new TextBlock { - FontSize = 12.5, + FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, @@ -133,13 +133,13 @@ private ToggleButton Toggle(string label, string key, bool on) { var content = new StackPanel { Orientation = Orientation.Horizontal }; content.Children.Add(new TextBlock { Text = NativeKeys.Words(label), VerticalAlignment = VerticalAlignment.Center }); - content.Children.Add(new TextBlock { Text = NativeKeys.Words(key), FontSize = 11, Opacity = 0.7, Margin = new Thickness(6, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }); + content.Children.Add(new TextBlock { Text = NativeKeys.Words(key), FontSize = NativeTokens.Small, Opacity = 0.7, Margin = new Thickness(6, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }); var toggle = new ToggleButton { Content = content, IsChecked = on, Padding = new Thickness(10, 4), - CornerRadius = new CornerRadius(6), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Focusable = false, }; global::Avalonia.Automation.AutomationProperties.SetName(toggle, label); @@ -214,7 +214,7 @@ private void Draw() Width = 130, TextTrimming = TextTrimming.CharacterEllipsis, Foreground = _colours.Brush(_colours.Header), - FontSize = 12.5, + FontSize = NativeTokens.Body, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 10, 0), }; @@ -226,7 +226,7 @@ private void Draw() { Foreground = _colours.Brush(_colours.Text), FontFamily = new FontFamily($"{CellFonts.BundledFamily}, DejaVu Sans Mono, Consolas, Menlo, monospace"), - FontSize = 13, + FontSize = NativeTokens.Title, TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center, }; diff --git a/src/SharpMUTerm.Avalonia/SettingsPresenter.cs b/src/SharpMUTerm.Avalonia/SettingsPresenter.cs index 57d73173..7304ed9f 100644 --- a/src/SharpMUTerm.Avalonia/SettingsPresenter.cs +++ b/src/SharpMUTerm.Avalonia/SettingsPresenter.cs @@ -1,4 +1,7 @@ +using Avalonia; using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; using Avalonia.Threading; using SharpMUTerm.Client.Settings; using SharpMUTerm.Tui; @@ -8,10 +11,17 @@ namespace SharpMUTerm.Avalonia; /// /// The window host's : one at a time, owned by the main /// window. The client calls in on its own thread, so everything here is posted to the window's. +/// +/// It is drawn as the palette's modal: its own frame, Esc and a close button to leave, and the main window under a +/// scrim (a press on it closes the settings, as a press on the palette's scrim does). Opened from the trigger builder +/// () it is docked to the right half of the main window instead, with no scrim, +/// so the line the rule was made from stays in view beside the rule's live test. +/// /// internal sealed class SettingsPresenter : INativeSettings { private SettingsWindow? _window; + private Border? _scrim; /// The window the settings window belongs to, set once the main window exists. public Window? Owner { get; set; } @@ -32,16 +42,19 @@ internal SettingsWindow ShowNow(SettingsForm form) if (_window is { } open) { open.Load(form); + Place(open, form); open.FocusFirst(); return open; } var window = new SettingsWindow(form); + Place(window, form); window.Closed += (_, _) => { if (ReferenceEquals(_window, window)) { _window = null; + Unveil(); } // The keyboard goes back to the client, as it does when a cell screen closes. @@ -60,4 +73,56 @@ internal SettingsWindow ShowNow(SettingsForm form) return window; } + + /// The scrim over the main window while the settings are open, for a test; null when there is none. + internal Border? Scrim => _scrim; + + /// + /// Centres over the main window under a scrim, or — opened beside the output — docks it to + /// the main window's right half with none. + /// + private void Place(SettingsWindow window, SettingsForm form) + { + if (Owner is not { IsVisible: true } owner) + { + return; + } + + if (form.BesideOutput) + { + Unveil(); + var scale = owner.RenderScaling; + var size = owner.ClientSize; + window.WindowStartupLocation = WindowStartupLocation.Manual; + window.Width = Math.Max(window.MinWidth, size.Width / 2); + window.Height = Math.Max(window.MinHeight, size.Height); + window.Position = new PixelPoint( + owner.Position.X + (int)Math.Round((size.Width - window.Width) * scale), + owner.Position.Y); + return; + } + + if (_scrim is null && owner.Content is Panel root) + { + var tokens = window.Tokens; + _scrim = new Border { Background = tokens.Brush(tokens.Scrim), Focusable = false }; + _scrim.PointerPressed += (_, e) => + { + e.Handled = true; + _window?.Close(); + }; + root.Children.Add(_scrim); + } + } + + /// Takes the scrim off the main window. + private void Unveil() + { + if (_scrim is { Parent: Panel root } scrim) + { + root.Children.Remove(scrim); + } + + _scrim = null; + } } diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index a0050f79..c1978367 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -41,7 +41,10 @@ internal sealed class SettingsWindow : Window private readonly Dictionary _badges = new(StringComparer.Ordinal); private readonly List<(StatusMeter Meter, TextBlock Now)> _meterNow = []; private readonly List _themeCards = []; + private readonly Border _frame; + private readonly TextBlock _title; private SettingsForm _form; + private NativeTokens _tokens; private IReadOnlyList _matches = []; private string? _shown; private bool _syncing; @@ -51,15 +54,59 @@ internal sealed class SettingsWindow : Window public SettingsWindow(SettingsForm form) { _form = form; + _tokens = TokensFor(form); Title = "Settings"; Width = 960; Height = 680; MinWidth = 640; MinHeight = 420; WindowStartupLocation = WindowStartupLocation.CenterOwner; + + // The palette's frame, not the platform's: the window draws its own title, close button and edge, so it reads + // as one of the client's surfaces (and looks the same under every window manager, or none). + WindowDecorations = WindowDecorations.None; Styles.Add(new FluentTheme()); - _search = new TextBox { PlaceholderText = "Search settings", Margin = new Thickness(16, 14, 16, 10) }; + _title = new TextBlock + { + Text = "Settings", + FontSize = NativeTokens.Title, + FontWeight = FontWeight.SemiBold, + VerticalAlignment = VerticalAlignment.Center, + Margin = new Thickness(16, 0, 0, 0), + }; + CloseButton = new Button + { + Content = "✕", + Padding = new Thickness(10, 4), + Margin = new Thickness(0, 0, 8, 0), + VerticalAlignment = VerticalAlignment.Center, + Background = Brushes.Transparent, + BorderThickness = new Thickness(0), + }; + AutomationProperties.SetName(CloseButton, "Close settings"); + ToolTip.SetTip(CloseButton, "Close (Esc)"); + CloseButton.Click += (_, _) => Close(); + var bar = new DockPanel { Height = 40, LastChildFill = true, Background = Brushes.Transparent }; + DockPanel.SetDock(CloseButton, Dock.Right); + bar.Children.Add(CloseButton); + bar.Children.Add(_title); + bar.PointerPressed += (_, e) => + { + if (e.GetCurrentPoint(bar).Properties.IsLeftButtonPressed && !ReferenceEquals(e.Source, CloseButton)) + { + BeginMoveDrag(e); + } + }; + DockPanel.SetDock(bar, Dock.Top); + + _search = new TextBox + { + PlaceholderText = "Search settings", + Margin = new Thickness(16, 4, 16, 10), + FontSize = NativeTokens.Title, + Padding = new Thickness(12, 7), + }; AutomationProperties.SetName(_search, "Search settings"); _search.TextChanged += (_, _) => OnQuery(); DockPanel.SetDock(_search, Dock.Top); @@ -87,10 +134,12 @@ public SettingsWindow(SettingsForm form) }; var dock = new DockPanel { LastChildFill = true }; + dock.Children.Add(bar); dock.Children.Add(_search); dock.Children.Add(_sections); dock.Children.Add(_scroller); - Content = dock; + _frame = new Border { BorderThickness = new Thickness(1), Child = dock }; + Content = _frame; _clock = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Background, (_, _) => Tick()); Opened += (_, _) => @@ -127,6 +176,27 @@ public void FocusFirst() /// The section on the right, by id. public string? ShownSection => _shown; + /// The frame's close button, for a test. + public Button CloseButton { get; } + + /// The tokens the window is drawn in now: the client's theme, followed when one is picked here. + public NativeTokens Tokens => _tokens; + + private static NativeTokens TokensFor(SettingsForm form) => NativeTokens.For(form.Theme?.Invoke(), form.IsDark); + + /// Wears : the variant, the planes, Fluent's resources and the frame. + private void ApplyTokens(NativeTokens tokens) + { + _tokens = tokens; + RequestedThemeVariant = tokens.IsDark ? ThemeVariant.Dark : ThemeVariant.Light; + tokens.Apply(Resources); + Background = tokens.Brush(tokens.Card); + Foreground = tokens.Brush(tokens.Text); + _frame.BorderBrush = tokens.Brush(tokens.Edge); + _title.Foreground = tokens.Brush(tokens.Text); + CloseButton.Foreground = tokens.Brush(tokens.Dim); + } + /// The ids of the fields drawn on the right, in order, for a test. public IReadOnlyList ShownFields { get; private set; } = []; @@ -182,7 +252,7 @@ public void Load(SettingsForm form) { after.Changed += OnPackagesChanged; } - RequestedThemeVariant = form.IsDark ? ThemeVariant.Dark : ThemeVariant.Light; + ApplyTokens(TokensFor(form)); _shown = null; _matches = _form.Search(_search.Text); BuildSectionList(); @@ -202,7 +272,7 @@ private void BuildSectionList() foreach (var section in _form.Sections) { var title = new TextBlock { Text = section.Title, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; - var badge = new TextBlock { Opacity = 0.7, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8, 0, 0, 0) }; + var badge = new TextBlock { Foreground = DimInk, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8, 0, 0, 0) }; _badges[section.Id] = badge; var row = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; row.Children.Add(title); @@ -313,17 +383,17 @@ private void BuildPage() return; } - _page.Children.Add(new TextBlock { Text = section.Title, FontSize = 24, FontWeight = FontWeight.SemiBold, Margin = new Thickness(0, 0, 0, 2) }); + _page.Children.Add(new TextBlock { Text = section.Title, FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold, Margin = new Thickness(0, 0, 0, 2) }); if (section.Key is { } key) { - _page.Children.Add(new TextBlock { Text = $"{key} in the client · changes apply as you make them", Opacity = 0.7, Margin = new Thickness(0, 0, 0, 6) }); + _page.Children.Add(new TextBlock { Text = $"{key} in the client · changes apply as you make them", Foreground = DimInk, Margin = new Thickness(0, 0, 0, 6) }); } if (section.Packages is not null) { if (_form.Packages is not { } manager) { - _page.Children.Add(new TextBlock { Text = "This client offers no packages.", Opacity = 0.7, Margin = new Thickness(0, 16, 0, 0) }); + _page.Children.Add(new TextBlock { Text = "This client offers no packages.", Foreground = DimInk, Margin = new Thickness(0, 16, 0, 0) }); ShownFields = []; return; } @@ -331,8 +401,7 @@ private void BuildPage() var packages = new PackagePageView( manager, f => !Searching || _matches.Any(m => ReferenceEquals(m.Field, f)), - Accent, - _form.IsDark) + _tokens) { Height = ListEditorHeight(), }; @@ -348,7 +417,7 @@ private void BuildPage() _form, section, f => !Searching || _matches.Any(m => ReferenceEquals(m.Field, f)), - Accent) + _tokens) { Height = ListEditorHeight(), Margin = new Thickness(0, 8, 0, 0), @@ -390,7 +459,7 @@ private void BuildPage() : section.Fields.ToList(); if (visible.Count == 0) { - _page.Children.Add(new TextBlock { Text = "No setting here matches the search.", Opacity = 0.7, Margin = new Thickness(0, 16, 0, 0) }); + _page.Children.Add(new TextBlock { Text = "No setting here matches the search.", Foreground = DimInk, Margin = new Thickness(0, 16, 0, 0) }); } string? group = null; @@ -401,11 +470,12 @@ private void BuildPage() group = heading; _page.Children.Add(new TextBlock { - Text = heading, - FontSize = 15, + Text = heading.ToUpperInvariant(), + FontSize = NativeTokens.Small, FontWeight = FontWeight.SemiBold, - Margin = new Thickness(0, 18, 0, 4), - Foreground = Accent, + LetterSpacing = 0.8, + Margin = new Thickness(0, 20, 0, 6), + Foreground = _tokens.Brush(_tokens.Header), }); } @@ -432,7 +502,7 @@ private StackPanel SubjectRow(SettingsSectionContribution section) var noun = section.Scope == SettingScope.World ? "world" : "character"; if (subjects.Count == 0) { - row.Children.Add(new TextBlock { Text = $"There is no {noun} yet.", VerticalAlignment = VerticalAlignment.Center, Opacity = 0.8 }); + row.Children.Add(new TextBlock { Text = $"There is no {noun} yet.", VerticalAlignment = VerticalAlignment.Center, Foreground = DimInk }); } else { @@ -477,10 +547,10 @@ private StackPanel ThemePicker(ThemeField field) { var outer = new StackPanel { Spacing = 6, Margin = new Thickness(0, 4, 0, 4) }; var words = new StackPanel { Spacing = 1 }; - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = 14 }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Title }); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap }); } outer.Children.Add(words); @@ -489,7 +559,7 @@ private StackPanel ThemePicker(ThemeField field) var inUse = CurrentTheme(field); foreach (var card in _form.Themes()) { - var view = new ThemeCardView(card, string.Equals(card.Name, inUse, StringComparison.OrdinalIgnoreCase), _form.IsDark); + var view = new ThemeCardView(card, string.Equals(card.Name, inUse, StringComparison.OrdinalIgnoreCase), _tokens); view.Click += (_, _) => { if (!string.Equals(card.Name, CurrentTheme(field), StringComparison.OrdinalIgnoreCase)) @@ -507,7 +577,7 @@ private StackPanel ThemePicker(ThemeField field) var now = CurrentTheme(field); foreach (var view in _themeCards) { - view.SetInUse(string.Equals(view.Card.Name, now, StringComparison.OrdinalIgnoreCase), _form.IsDark); + view.SetInUse(string.Equals(view.Card.Name, now, StringComparison.OrdinalIgnoreCase), _tokens); } }); outer.Children.Add(wrap); @@ -517,8 +587,11 @@ private StackPanel ThemePicker(ThemeField field) private string? CurrentTheme(ThemeField field) => field.Binding is SettingBinding binding ? _form.Get(binding) : null; - /// The accent the changed dot and headings wear: Fluent's own, for the theme variant. - private SolidColorBrush Accent => new(_form.IsDark ? Color.Parse("#60cdff") : Color.Parse("#005fb8")); + /// The accent the changed dot wears: the client's, as every native surface's. + private SolidColorBrush Accent => _tokens.Brush(_tokens.Accent); + + /// A quiet line's ink, held to the floor (an opacity would not be). + private SolidColorBrush DimInk => _tokens.Brush(_tokens.Dim); /// One field: label and help on the left, its control, then the changed dot and the reset. private Grid FieldRow(SettingsField field) @@ -526,10 +599,10 @@ private Grid FieldRow(SettingsField field) var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto,Auto"), Margin = new Thickness(0, 4), MinHeight = 44 }; var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Spacing = 1, Margin = new Thickness(0, 0, 16, 0) }; - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = 14, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Title, TextWrapping = TextWrapping.Wrap }); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap }); } grid.Children.Add(words); @@ -703,7 +776,7 @@ void Commit() } default: - return new TextBlock { Text = "set on its own screen", Opacity = 0.7 }; + return new TextBlock { Text = "set on its own screen", Foreground = DimInk }; } } @@ -712,7 +785,7 @@ private static StackPanel Swatch(string name) var panel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Tag = name }; if (Color.TryParse(name, out var colour)) { - panel.Children.Add(new Border { Width = 14, Height = 14, CornerRadius = new CornerRadius(3), Background = new SolidColorBrush(colour) }); + panel.Children.Add(new Border { Width = 14, Height = 14, CornerRadius = new CornerRadius(NativeTokens.RadiusS), Background = new SolidColorBrush(colour) }); } panel.Children.Add(new TextBlock { Text = name }); @@ -727,10 +800,10 @@ private StackPanel MeterTable(ListField field) var top = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; var words = new StackPanel { Spacing = 1 }; - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = 14 }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Title }); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = 12, Opacity = 0.72, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap }); } top.Children.Add(words); @@ -749,7 +822,7 @@ private StackPanel MeterTable(ListField field) grid.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); for (var c = 0; c < headings.Length; c++) { - var heading = new TextBlock { Text = headings[c], FontSize = 12, FontWeight = FontWeight.SemiBold, Opacity = 0.78 }; + var heading = new TextBlock { Text = headings[c], FontSize = NativeTokens.Body, FontWeight = FontWeight.SemiBold, Foreground = DimInk }; Grid.SetColumn(heading, c); grid.Children.Add(heading); } @@ -814,17 +887,17 @@ private StackPanel MeterTable(ListField field) // What this connection has received, to pick a path from: a click puts it in the path box last used. var box = new StackPanel { Spacing = 2 }; - box.Children.Add(new TextBlock { Text = "Received on this connection", FontSize = 12, FontWeight = FontWeight.SemiBold, Opacity = 0.78, Margin = new Thickness(0, 2, 0, 2) }); + box.Children.Add(new TextBlock { Text = "Received on this connection", FontSize = NativeTokens.Body, FontWeight = FontWeight.SemiBold, Foreground = DimInk, Margin = new Thickness(0, 2, 0, 2) }); if (received.Count == 0) { - box.Children.Add(new TextBlock { Text = "Nothing yet — a meter shows once its value arrives.", FontSize = 12, Opacity = 0.72 }); + box.Children.Add(new TextBlock { Text = "Nothing yet — a meter shows once its value arrives.", FontSize = NativeTokens.Body, Foreground = DimInk }); } foreach (var item in received.Take(40)) { var line = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; - line.Children.Add(new TextBlock { Text = item.Path, FontFamily = FontFamily.Parse("monospace"), FontSize = 12 }); - var v = new TextBlock { Text = item.Value, FontSize = 12, Opacity = 0.72, Margin = new Thickness(16, 0, 0, 0) }; + line.Children.Add(new TextBlock { Text = item.Path, FontFamily = FontFamily.Parse("monospace"), FontSize = NativeTokens.Body }); + var v = new TextBlock { Text = item.Value, FontSize = NativeTokens.Body, Foreground = DimInk, Margin = new Thickness(16, 0, 0, 0) }; Grid.SetColumn(v, 1); line.Children.Add(v); var pick = new Button @@ -851,8 +924,8 @@ private StackPanel MeterTable(ListField field) { Child = box, BorderThickness = new Thickness(1), - BorderBrush = new SolidColorBrush(_form.IsDark ? Color.Parse("#46464e") : Color.Parse("#c8c8d0")), - CornerRadius = new CornerRadius(6), + BorderBrush = _tokens.Brush(_tokens.Edge), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), Padding = new Thickness(10, 6, 10, 8), Margin = new Thickness(0, 4, 0, 0), }); @@ -924,9 +997,13 @@ private void OnPackagesChanged() => Dispatcher.UIThread.Post(() => /// Re-reads every value and indicator on the page. A meter added or removed rebuilds the page, whose rows moved. internal void Refresh() { - var variant = _form.IsDark ? ThemeVariant.Dark : ThemeVariant.Light; - var flipped = RequestedThemeVariant != variant; - RequestedThemeVariant = variant; + var tokens = TokensFor(_form); + var flipped = tokens != _tokens; + if (flipped) + { + ApplyTokens(tokens); + } + if (flipped || (_meterRows >= 0 && _form.Section(_shown ?? string.Empty)?.Fields.OfType().FirstOrDefault() is { } meters diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index fe9bfda6..1114961a 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -63,7 +63,7 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba _driver.FrameReady += OnFrameReady; _repeat = new DispatcherTimer(TimeSpan.FromMilliseconds(100), DispatcherPriority.Input, (_, _) => RepeatPress()); - _tipText = new TextBlock { Foreground = Brush(foreground), FontSize = 12, MaxWidth = 420, TextWrapping = TextWrapping.Wrap }; + _tipText = new TextBlock { Foreground = Brush(foreground), FontSize = NativeTokens.Body, MaxWidth = 420, TextWrapping = TextWrapping.Wrap }; _tip = new Popup { PlacementTarget = this, @@ -75,7 +75,7 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba Background = Brush(Mix(background, foreground, 0.12f)), BorderBrush = Brush(Mix(background, foreground, 0.35f)), BorderThickness = new Thickness(1), - CornerRadius = new CornerRadius(3), + CornerRadius = new CornerRadius(NativeTokens.RadiusS), Padding = new Thickness(7, 4), Child = _tipText, }, diff --git a/src/SharpMUTerm.Avalonia/ThemeCardView.cs b/src/SharpMUTerm.Avalonia/ThemeCardView.cs index b122db5a..b8dc3162 100644 --- a/src/SharpMUTerm.Avalonia/ThemeCardView.cs +++ b/src/SharpMUTerm.Avalonia/ThemeCardView.cs @@ -20,7 +20,7 @@ internal sealed class ThemeCardView : Button private readonly Border _frame; private readonly TextBlock _state; - public ThemeCardView(ThemeCard card, bool inUse, bool windowIsDark) + public ThemeCardView(ThemeCard card, bool inUse, NativeTokens tokens) { ArgumentNullException.ThrowIfNull(card); Card = card; @@ -33,8 +33,8 @@ public ThemeCardView(ThemeCard card, bool inUse, bool windowIsDark) AutomationProperties.SetName(this, $"Use the {card.Name} theme"); ToolTip.SetTip(this, $"Use {card.Name}"); - var name = new TextBlock { Text = card.Name, FontSize = 14, FontWeight = FontWeight.SemiBold }; - _state = new TextBlock { FontSize = 12, Opacity = 0.72 }; + var name = new TextBlock { Text = card.Name, FontSize = NativeTokens.Title, FontWeight = FontWeight.SemiBold }; + _state = new TextBlock { FontSize = NativeTokens.Body }; var words = new StackPanel { Margin = new Thickness(10, 8, 10, 8), Spacing = 1 }; words.Children.Add(name); words.Children.Add(_state); @@ -46,13 +46,12 @@ public ThemeCardView(ThemeCard card, bool inUse, bool windowIsDark) _frame = new Border { Child = body, - CornerRadius = new CornerRadius(8), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), ClipToBounds = true, BorderThickness = new Thickness(2), - Background = new SolidColorBrush(windowIsDark ? Color.Parse("#2b2b30") : Color.Parse("#f3f3f5")), }; Content = _frame; - SetInUse(inUse, windowIsDark); + SetInUse(inUse, tokens); } /// The theme this card shows. @@ -62,14 +61,15 @@ public ThemeCardView(ThemeCard card, bool inUse, bool windowIsDark) public bool InUse { get; private set; } /// Marks the card as the theme in use, or not. - public void SetInUse(bool inUse, bool windowIsDark) + public void SetInUse(bool inUse, NativeTokens tokens) { + ArgumentNullException.ThrowIfNull(tokens); + _frame.Background = tokens.Brush(tokens.Raised); + _state.Foreground = tokens.Brush(tokens.Dim); InUse = inUse; var kind = $"{(Card.IsDark ? "dark" : "light")} · {(Card.IsCustom ? "your own" : "built in")}"; _state.Text = inUse ? $"In use · {kind}" : kind; - _frame.BorderBrush = inUse - ? new SolidColorBrush(windowIsDark ? Color.Parse("#60cdff") : Color.Parse("#005fb8")) - : new SolidColorBrush(windowIsDark ? Color.Parse("#46464e") : Color.Parse("#c8c8d0")); + _frame.BorderBrush = tokens.Brush(inUse ? tokens.Accent : tokens.Edge); } private static readonly FontFamily Mono = FontFamily.Parse("monospace"); @@ -89,7 +89,7 @@ private static Border Preview(ThemePreview preview) } var line = preview.CommandLine; - var command = new TextBlock { FontFamily = Mono, FontSize = 9, Padding = new Thickness(4, 2), TextTrimming = TextTrimming.CharacterEllipsis }; + var command = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Miniature, Padding = new Thickness(4, 2), TextTrimming = TextTrimming.CharacterEllipsis }; command.Inlines!.Add(new Run(line.Prompt + " ") { Foreground = Brush(line.PromptInk), FontWeight = FontWeight.Bold }); command.Inlines.Add(new Run(line.Text) { Foreground = Brush(line.Ink) }); @@ -105,7 +105,7 @@ private static Border Pane(PreviewPane pane) var tabs = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 1 }; foreach (var tab in pane.Tabs) { - var title = new TextBlock { FontFamily = Mono, FontSize = 9, Padding = new Thickness(3, 1) }; + var title = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Miniature, Padding = new Thickness(3, 1) }; title.Inlines!.Add(new Run(tab.Title) { Foreground = Brush(tab.Ink), FontWeight = tab.Selected ? FontWeight.Bold : FontWeight.Normal }); if (tab.Badge is { } badge) { @@ -118,7 +118,7 @@ private static Border Pane(PreviewPane pane) var lines = new StackPanel { Margin = new Thickness(4, 3, 4, 4) }; foreach (var runs in pane.Lines) { - var text = new TextBlock { FontFamily = Mono, FontSize = 9, TextTrimming = TextTrimming.CharacterEllipsis }; + var text = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Miniature, TextTrimming = TextTrimming.CharacterEllipsis }; foreach (var run in runs) { text.Inlines!.Add(new Run(run.Text) { Foreground = Brush(run.Ink), FontWeight = run.Bold ? FontWeight.Bold : FontWeight.Normal }); diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index f3016d15..24f9ad08 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -22,7 +22,7 @@ internal sealed class WelcomeView : DockPanel, IModalView private static readonly WelcomeLayout[] Layouts = [WelcomeLayout.Suggested, WelcomeLayout.Roleplay, WelcomeLayout.Combat]; private readonly WelcomeSession _session; - private readonly ModalColours _colours; + private readonly NativeTokens _colours; private readonly Action _done; private readonly StackPanel _body = new(); private readonly TextBlock _footer; @@ -37,7 +37,7 @@ internal sealed class WelcomeView : DockPanel, IModalView private CheckBox? _passwordLater; private bool _drawnInForm; - public WelcomeView(WelcomeSession session, ModalColours colours, Action done) + public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) { _session = session; _colours = colours; @@ -165,8 +165,8 @@ private void DrawMenu() var index = i; var (title, detail) = _model.Describe(choice); var words = new StackPanel(); - words.Children.Add(new TextBlock { Text = NativeKeys.Words(title), FontSize = 14.5, FontWeight = FontWeight.Medium, Foreground = _colours.Brush(_colours.Text) }); - words.Children.Add(new TextBlock { Text = NativeKeys.Words(detail), FontSize = 12, Foreground = _colours.Brush(_colours.Dim) }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(title), FontSize = NativeTokens.Title, FontWeight = FontWeight.Medium, Foreground = _colours.Brush(_colours.Text) }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(detail), FontSize = NativeTokens.Body, Foreground = _colours.Brush(_colours.Dim) }); var row = ModalParts.Row(words, title, () => SelectChoice(index), () => Choose(choice)); row.Padding = new Thickness(12, 8); _choiceRows.Add(row); @@ -175,7 +175,7 @@ private void DrawMenu() _body.Children.Add(list); - var example = new TextBlock { Margin = new Thickness(22, 6, 22, 0), FontSize = 12.5, Foreground = _colours.Brush(_colours.Dim), TextWrapping = TextWrapping.Wrap }; + var example = new TextBlock { Margin = new Thickness(22, 6, 22, 0), FontSize = NativeTokens.Body, Foreground = _colours.Brush(_colours.Dim), TextWrapping = TextWrapping.Wrap }; example.Inlines!.Add(new global::Avalonia.Controls.Documents.Run("Or type on the command line: ")); example.Inlines.Add(new global::Avalonia.Controls.Documents.Run(WelcomeModel.ExampleCommand) { @@ -221,7 +221,7 @@ TextBlock Label(string text, int row) TextBox Field(string name, string text, string placeholder, int row, int max) { - var box = new TextBox { Text = text, PlaceholderText = placeholder, MaxLength = max, Margin = new Thickness(0, 4), Padding = new Thickness(10, 6), CornerRadius = new CornerRadius(7) }; + var box = new TextBox { Text = text, PlaceholderText = placeholder, MaxLength = max, Margin = new Thickness(0, 4), Padding = new Thickness(10, 6), CornerRadius = new CornerRadius(NativeTokens.RadiusM) }; global::Avalonia.Automation.AutomationProperties.SetName(box, name); Grid.SetRow(box, row); Grid.SetColumn(box, 1); @@ -260,7 +260,7 @@ CheckBox Check(string text, bool on, int row) buttons.Children.Add(back); buttons.Children.Add(connect); _body.Children.Add(buttons); - _footer.Text = "Tab moves · Enter connects · Esc back"; + _footer.Text = "Tab moves between the fields"; DrawProblem(); } diff --git a/src/SharpMUTerm.Client/Modals/ModalSession.cs b/src/SharpMUTerm.Client/Modals/ModalSession.cs index 6ed18f43..fda5509a 100644 --- a/src/SharpMUTerm.Client/Modals/ModalSession.cs +++ b/src/SharpMUTerm.Client/Modals/ModalSession.cs @@ -28,6 +28,12 @@ protected ModalSession(bool isDark, Action closed) /// Whether the client's theme is a dark one. public bool IsDark { get; } + /// + /// A copy of the client's theme when the modal opened, so the host can derive its colours from it as the cells do; + /// null leaves the host the built-in theme of 's variant. + /// + public Core.Theming.Theme? Theme { get; init; } + /// The surface this is (SurfaceCatalog's id). public abstract string Surface { get; } diff --git a/src/SharpMUTerm.Client/Palette/PaletteSession.cs b/src/SharpMUTerm.Client/Palette/PaletteSession.cs index 664128bd..13a3b682 100644 --- a/src/SharpMUTerm.Client/Palette/PaletteSession.cs +++ b/src/SharpMUTerm.Client/Palette/PaletteSession.cs @@ -66,6 +66,9 @@ public PaletteSession( /// Whether the client's theme is a dark one. public bool IsDark { get; } + /// A copy of the client's theme when the palette opened, for the host's colours; null for the variant's built-in. + public Core.Theming.Theme? Theme { get; init; } + /// How many entries the catalog held when the palette opened. public int Total => _catalog.Count; diff --git a/src/SharpMUTerm.Client/Settings/SettingsForm.cs b/src/SharpMUTerm.Client/Settings/SettingsForm.cs index 8296e85e..f7e16590 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsForm.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsForm.cs @@ -112,6 +112,18 @@ public SettingsForm( /// Whether the client's theme is dark — now, so a theme picked here is followed. public bool IsDark => _isDark(); + /// + /// The client's theme now — a copy, read from the host's thread — so the host derives its colours from it as the + /// cells do and follows a theme picked here; null leaves the host the built-in theme of 's variant. + /// + public Func? Theme { get; init; } + + /// + /// Whether the form was opened on an item made from what is on screen (the trigger builder's new rule), so the host + /// should leave the output it was made from in view rather than cover it. + /// + public bool BesideOutput { get; init; } + /// /// Every world (for ) or every character (for ) /// a scoped section can be edited for, in configuration order; empty for an app-wide section. diff --git a/src/SharpMUTerm.Tui/CommandPalette.cs b/src/SharpMUTerm.Tui/CommandPalette.cs index 6bfcab80..92ca51b2 100644 --- a/src/SharpMUTerm.Tui/CommandPalette.cs +++ b/src/SharpMUTerm.Tui/CommandPalette.cs @@ -23,6 +23,12 @@ internal sealed class CommandPalette private readonly Func> _suggested; private Window? _window; + + /// + /// The settings screens' palette for the active theme, so this popup follows Light and Solarized as they do + /// (): its plane, frame and markup are resolved through it. Set by the app on a theme change. + /// + internal ScreenTheme Scheme { get; set; } = ScreenTheme.Dark; private PromptControl? _search; private MarkupControl? _results; private PaletteView _view = Empty; @@ -84,7 +90,18 @@ public void Toggle() private void Open() { _selected = 0; - _search = Controls.Prompt("›").Build(); + var prompt = Controls.Prompt("›"); + if (!Scheme.IsIdentity) + { + // Off Dark the framework's own dark-grey well would be a dark island on the themed surface. + prompt = prompt + .WithInputBackgroundColor(Scheme.Colour(ScreenPalette.EditBg)) + .WithInputFocusedBackgroundColor(Scheme.Colour(ScreenPalette.EditBg)) + .WithInputForegroundColor(Scheme.Colour(ScreenPalette.Value)) + .WithInputFocusedForegroundColor(Scheme.Colour(ScreenPalette.Value)); + } + + _search = prompt.Build(); _search.InputChanged += (_, query) => Refresh(query); _search.Entered += (_, _) => Commit(); @@ -113,7 +130,7 @@ private void Open() .WithTitle("Command surface") .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(width, height) @@ -122,6 +139,7 @@ private void Open() .AddControl(_results) .OnClosed((_, _) => Reset()) .Build(); + Scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); @@ -143,7 +161,7 @@ private void Refresh(string query) } private void Paint() => - _results?.SetContent(CommandSurfaceRenderer.Render(_view, _selected, _context(), _contentWidth)); + _results?.SetContent(Scheme.Lines(CommandSurfaceRenderer.Render(_view, _selected, _context(), _contentWidth), ScreenPalette.MenuBg)); private void Move(int delta) { diff --git a/src/SharpMUTerm.Tui/GameDataOverlay.cs b/src/SharpMUTerm.Tui/GameDataOverlay.cs index 6b3df9e4..006d1a6d 100644 --- a/src/SharpMUTerm.Tui/GameDataOverlay.cs +++ b/src/SharpMUTerm.Tui/GameDataOverlay.cs @@ -22,6 +22,12 @@ internal sealed class GameDataOverlay private readonly TimeProvider _time; private Window? _window; + + /// + /// The settings screens' palette for the active theme, so this popup follows Light and Solarized as they do + /// (): its plane, frame and markup are resolved through it. Set by the app on a theme change. + /// + internal ScreenTheme Scheme { get; set; } = ScreenTheme.Dark; private MarkupControl? _content; private IReadOnlyList _entries = []; private string _owner = string.Empty; @@ -51,14 +57,14 @@ public void Toggle(GameDataStore data, string owner) var desktop = _system.DesktopDimensions; var width = Math.Max(44, desktop.Width - 8); var height = Math.Max(10, desktop.Height - 4); - _content = new MarkupControl(Lines(width - 3, height - 2)); + _content = new MarkupControl(Scheme.Lines(Lines(width - 3, height - 2), ScreenPalette.MenuBg)); // Centered() after WithSize(), for CommandPalette's reason. _window = new WindowBuilder(_system) .WithTitle("Game data") .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(width, height) @@ -66,6 +72,7 @@ public void Toggle(GameDataStore data, string owner) .AddControl(_content) .OnClosed((_, _) => Reset()) .Build(); + Scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); @@ -137,7 +144,7 @@ private void Repaint() { if (_window is { } window) { - _content?.SetContent(Lines(Math.Max(20, window.Width - 3), Math.Max(6, window.Height - 2))); + _content?.SetContent(Scheme.Lines(Lines(Math.Max(20, window.Width - 3), Math.Max(6, window.Height - 2)), ScreenPalette.MenuBg)); } } diff --git a/src/SharpMUTerm.Tui/HistorySurface.cs b/src/SharpMUTerm.Tui/HistorySurface.cs index c1736979..129fa1ed 100644 --- a/src/SharpMUTerm.Tui/HistorySurface.cs +++ b/src/SharpMUTerm.Tui/HistorySurface.cs @@ -50,6 +50,12 @@ internal sealed class HistorySurface private readonly Action? _closed; private Window? _window; + + /// + /// The settings screens' palette for the active theme, so this popup follows Light and Solarized as they do + /// (): its plane, frame and markup are resolved through it. Set by the app on a theme change. + /// + internal ScreenTheme Scheme { get; set; } = ScreenTheme.Dark; private MarkupControl? _body; private IReadOnlyList _snapshot = Array.Empty(); private IReadOnlyList _matches = Array.Empty(); @@ -176,7 +182,7 @@ private void Open() .WithTitle("Command history") .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(width, height) @@ -184,6 +190,7 @@ private void Open() .AddControl(_body) .OnClosed((_, _) => Reset()) .Build(); + Scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); @@ -238,7 +245,7 @@ private void Refilter(string query, int selected) _first = HistorySearchPrompt.Scroll(_first, _selected, _matches.Count, _listRows); } - private void Paint() => _body?.SetContent(new List(Lines)); + private void Paint() => _body?.SetContent(Scheme.Lines(Lines, ScreenPalette.MenuBg)); private void Close() { diff --git a/src/SharpMUTerm.Tui/MessageLogOverlay.cs b/src/SharpMUTerm.Tui/MessageLogOverlay.cs index a4a90cc7..10289014 100644 --- a/src/SharpMUTerm.Tui/MessageLogOverlay.cs +++ b/src/SharpMUTerm.Tui/MessageLogOverlay.cs @@ -31,6 +31,12 @@ internal sealed class MessageLogOverlay private readonly ClientDiagnostics _diagnostics; private Window? _window; + + /// + /// The settings screens' palette for the active theme, so this popup follows Light and Solarized as they do + /// (): its plane, frame and markup are resolved through it. Set by the app on a theme change. + /// + internal ScreenTheme Scheme { get; set; } = ScreenTheme.Dark; private MarkupControl? _content; public MessageLogOverlay(ConsoleWindowSystem system, ClientDiagnostics diagnostics) @@ -55,7 +61,7 @@ public void Toggle() var width = Math.Clamp(ClientMessageRenderer.MaxWidth(entries) + 3, 44, Math.Max(44, desktop.Width - 6)); var height = Math.Clamp(entries.Count + 4, 8, Math.Max(8, desktop.Height - 2)); - _content = new MarkupControl(Lines(width - 3)); + _content = new MarkupControl(Scheme.Lines(Lines(width - 3), ScreenPalette.MenuBg)); // Centered() after WithSize(): the builder reads the bounds set so far and falls back to 80x25, // so centring first places the window as if it were that size (see CommandPalette). @@ -63,7 +69,7 @@ public void Toggle() .WithTitle("Client messages") .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(width, height) @@ -71,6 +77,7 @@ public void Toggle() .AddControl(_content) .OnClosed((_, _) => Reset()) .Build(); + Scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); @@ -95,7 +102,7 @@ internal void StepLevel(int delta) var index = Array.IndexOf(Levels, _diagnostics.MinimumLevel); index = index < 0 ? Array.IndexOf(Levels, LogLevel.Information) : index; _diagnostics.MinimumLevel = Levels[Math.Clamp(index + delta, 0, Levels.Length - 1)]; - _content?.SetContent(Lines(_window is { } window ? Math.Max(20, window.Width - 3) : 80)); + _content?.SetContent(Scheme.Lines(Lines(_window is { } window ? Math.Max(20, window.Width - 3) : 80), ScreenPalette.MenuBg)); } private static string Level(LogLevel level) => level.ToString().ToLowerInvariant(); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs index b6a2e0e4..1b6b908f 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs @@ -82,7 +82,11 @@ internal ChromeOverlay BuildChromeOverlay() _ink.Notice, Hex(_theme.StatusBackground), Hex(WorkspacePalette.Backdrop(_theme)), - Hex(_theme.Resolve(Core.Text.TerminalColor.Default, isBackground: false))); + Hex(_theme.Resolve(Core.Text.TerminalColor.Default, isBackground: false))) + { + BrandInk = WorkspacePalette.HeaderInk(_theme, ParseHex(brand)).ToHex(), + HeaderMuted = WorkspacePalette.HeaderMuted(_theme).ToHex(), + }; return new ChromeOverlay( Host.Chrome, @@ -214,4 +218,11 @@ internal sealed record ChromePalette( string Notice, string HeaderPlane, string RailPlane, - string Ink); + string Ink) +{ + /// The ink on , held to the header's floor — light on a light theme's deep fill. + public string BrandInk { get; init; } = "#000000"; + + /// The header's quiet text (counts, a pill's detail, the search hint), held to the header's floor on its band. + public string HeaderMuted { get; init; } = "#808080"; +} diff --git a/src/SharpMUTerm.Tui/PrefixOverlay.cs b/src/SharpMUTerm.Tui/PrefixOverlay.cs index 00eeec1a..f66d7cb2 100644 --- a/src/SharpMUTerm.Tui/PrefixOverlay.cs +++ b/src/SharpMUTerm.Tui/PrefixOverlay.cs @@ -40,6 +40,12 @@ internal sealed class PrefixOverlay private readonly Action _run; private Window? _window; + + /// + /// The settings screens' palette for the active theme, so this popup follows Light and Solarized as they do + /// (): its plane, frame and markup are resolved through it. Set by the app on a theme change. + /// + internal ScreenTheme Scheme { get; set; } = ScreenTheme.Dark; private PrefixFacts _current = PrefixFacts.Fresh; /// @@ -99,14 +105,15 @@ public void Open() .WithTitle("⌃B — pane commands") .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(width, height) .Centered() - .AddControl(new MarkupControl(new List(lines))) + .AddControl(new MarkupControl(Scheme.Lines(lines, ScreenPalette.MenuBg))) .OnClosed((_, _) => Reset()) .Build(); + Scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); diff --git a/src/SharpMUTerm.Tui/QuitOverlay.cs b/src/SharpMUTerm.Tui/QuitOverlay.cs index ac11b860..4f5ae4b6 100644 --- a/src/SharpMUTerm.Tui/QuitOverlay.cs +++ b/src/SharpMUTerm.Tui/QuitOverlay.cs @@ -28,6 +28,12 @@ internal sealed class QuitOverlay private readonly Action? _closed; private Window? _window; + + /// + /// The settings screens' palette for the active theme, so this popup follows Light and Solarized as they do + /// (): its plane, frame and markup are resolved through it. Set by the app on a theme change. + /// + internal ScreenTheme Scheme { get; set; } = ScreenTheme.Dark; private MarkupControl? _body; private QuitModel _current = QuitModel.Nothing; private QuitChoice _selected = QuitChoice.Stay; @@ -85,7 +91,7 @@ private void Open() _selected = QuitChoice.Stay; var lines = QuitPrompt.Render(_current, _selected); - _body = new MarkupControl(new List(lines)); + _body = new MarkupControl(Scheme.Lines(lines, ScreenPalette.MenuBg)); // Hug the content: the question is as tall as it has things to say. Centred *after* WithSize, // because the builder reads the bounds set so far and falls back to 80x25 otherwise. @@ -98,7 +104,7 @@ private void Open() .WithTitle("Quit") .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(width, height) @@ -106,6 +112,7 @@ private void Open() .AddControl(_body) .OnClosed((_, _) => Reset()) .Build(); + Scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); @@ -136,7 +143,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) break; case QuitAction.Redraw: - _body?.SetContent(new List(QuitPrompt.Render(_current, _selected))); + _body?.SetContent(Scheme.Lines(QuitPrompt.Render(_current, _selected), ScreenPalette.MenuBg)); _window.Invalidate(redrawAll: true); break; diff --git a/src/SharpMUTerm.Tui/SearchSurface.cs b/src/SharpMUTerm.Tui/SearchSurface.cs index 0a2e8cf9..5b54d370 100644 --- a/src/SharpMUTerm.Tui/SearchSurface.cs +++ b/src/SharpMUTerm.Tui/SearchSurface.cs @@ -50,6 +50,12 @@ internal sealed class SearchSurface private readonly Action? _closed; private Window? _window; + + /// + /// The settings screens' palette for the active theme, so this popup follows Light and Solarized as they do + /// (): its plane, frame and markup are resolved through it. Set by the app on a theme change. + /// + internal ScreenTheme Scheme { get; set; } = ScreenTheme.Dark; private MarkupControl? _body; private SearchModel _model = Empty; private int _selected = -1; @@ -190,7 +196,7 @@ private void Open() .WithTitle("Search output") .AsModal() .WithBorderStyle(BorderStyle.Single) - .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) + .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) .WithSize(width, height) @@ -198,6 +204,7 @@ private void Open() .AddControl(_body) .OnClosed((_, _) => Reset()) .Build(); + Scheme.Frame(_window); _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); @@ -252,7 +259,7 @@ private void Refilter(string query, bool regex, bool all, int selected) _first = SearchPrompt.Scroll(_first, _selected, _model.Rows.Count, _listRows); } - private void Paint() => _body?.SetContent(new List(Lines)); + private void Paint() => _body?.SetContent(Scheme.Lines(Lines, ScreenPalette.MenuBg)); private void Close() { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs index e5e6e6b0..58f69dcb 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs @@ -93,7 +93,10 @@ private void ToggleQuit() QuitFactsNow(), ThemeIsDark(), () => OnUiThread(Quit), - () => OnUiThread(() => NativeModalClosed(session!))); + () => OnUiThread(() => NativeModalClosed(session!))) + { + Theme = _theme.Clone(), + }; _nativeQuit = session; native.Show(session); return; @@ -142,7 +145,10 @@ private bool TryOpenNativeSearch() } }), (model, index) => OnUiThread(() => GoToSearchHit(model, index)), - () => OnUiThread(() => NativeModalClosed(session!))); + () => OnUiThread(() => NativeModalClosed(session!))) + { + Theme = _theme.Clone(), + }; ShowNativeModal(native, session); return true; } @@ -162,6 +168,7 @@ private bool TryOpenNativeHistory(string query = "") index => OnUiThread(() => InsertHistoryEntry(index)), () => OnUiThread(() => NativeModalClosed(session!))) { + Theme = _theme.Clone(), InitialQuery = query, }; ShowNativeModal(native, session); @@ -188,7 +195,10 @@ private bool TryOpenNativeLayouts(string key) session!.Publish(LayoutsModelFor(key)); } }), - () => OnUiThread(() => NativeModalClosed(session!))); + () => OnUiThread(() => NativeModalClosed(session!))) + { + Theme = _theme.Clone(), + }; ShowNativeModal(native, session); return true; } @@ -238,7 +248,10 @@ void Republish() welcome.Back(); Republish(); }), - () => OnUiThread(() => NativeModalClosed(session!))); + () => OnUiThread(() => NativeModalClosed(session!))) + { + Theme = _theme.Clone(), + }; ShowNativeModal(native, session); return true; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs index abb9e151..6d3d5a6f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs @@ -74,7 +74,10 @@ private bool TryOpenNativePalette() ThemeIsDark(), _openingQuery ?? string.Empty, id => OnUiThread(() => RunFromPalette(id)), - () => OnUiThread(() => NativePaletteClosed(session!))); + () => OnUiThread(() => NativePaletteClosed(session!))) + { + Theme = _theme.Clone(), + }; _nativePaletteSession = session; native.Show(session); return true; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index a3790853..760a2ca4 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -213,7 +213,10 @@ private IWindowControl NewVitalsPanel(TerminalPanelContext context) /// meaning, so they are lifted like text; the empty part of a bar is a grey that still reads as a track. /// private VitalsStripRenderer.Ink VitalsInk() => - new(_ink.Accent, _ink.Notice, _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))); + new(_ink.Accent, LowInk(_ink.Plane), _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))); + + /// The low cue's ink on (), as markup. + private string LowInk(Rgb plane) => WorkspacePalette.Low(_theme, ParseHex(_ink.Notice), plane).ToHex(); // --- Quick bar -------------------------------------------------------------------------------------------- diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs index 7c490e18..101dd054 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs @@ -192,6 +192,8 @@ internal SettingsForm NativeSettingsForm(string initial, object? item = null) { Packages = PackageManager, Selections = _listSelections, + Theme = () => _theme.Clone(), + BesideOutput = item is not null, }; return form; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs index e7ba65b0..51c57933 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs @@ -49,6 +49,23 @@ private void ApplyThemeIfChanged() } } + /// + /// Hands the workspace popups — ⌃P, the quit prompt, ⌃F, ⌃R, the ⌃B panel, the game data and the message log — the + /// settings screens' palette for the active theme (), so they follow Light and Solarized + /// as the settings screens do rather than painting the Dark theme's navy over a light workspace. Each resolves its + /// plane, frame and markup through it the next time it opens. + /// + private void SchemePopups() + { + _palette.Scheme = _screens; + _quit.Scheme = _screens; + _search.Scheme = _screens; + _historySearch.Scheme = _screens; + _prefixPanel.Scheme = _screens; + _gameData.Scheme = _screens; + _messageLog.Scheme = _screens; + } + /// /// Re-derives everything the client paints from . The caller () /// goes on to repaint the header, the rail, the pane planes, the bars and the backdrop, which all read @@ -69,9 +86,12 @@ private void ApplyTheme(Theme theme) _sendMenu.Scheme = _screens; _layoutsView.Scheme = _screens; _welcomeView.Scheme = _screens; + SchemePopups(); _header.BackgroundColor = ToColor(theme.StatusBackground); _header.FocusedLinkForegroundColor = ToColor(theme.Resolve(TerminalColor.Default, isBackground: true)); + var brand = AccentPalette[2]; + _header.FocusedLinkBackgroundColor = ToColor(WorkspacePalette.HeaderFill(theme, new Rgb(brand.R, brand.G, brand.B))); _window.ForegroundColor = ToColor(theme.Resolve(TerminalColor.Default, isBackground: false)); foreach (var control in _panes.Values) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 56cc8777..e979cbf0 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -838,7 +838,7 @@ public SharpMUTermApp( _header.BackgroundColor = ToColor(_theme.StatusBackground); // the menu bar is a distinct chrome band // Keep the clickable brand button on-brand (violet) instead of the driver's default link highlight. var brand = AccentPalette[2]; - _header.FocusedLinkBackgroundColor = ToColor(new Rgb(brand.R, brand.G, brand.B)); + _header.FocusedLinkBackgroundColor = ToColor(WorkspacePalette.HeaderFill(_theme, new Rgb(brand.R, brand.G, brand.B))); _header.FocusedLinkForegroundColor = ToColor(_theme.Resolve(TerminalColor.Default, isBackground: true)); // A host that draws the header (the window) gets no header row at all: hidden, a sticky band takes no row, @@ -952,6 +952,7 @@ public SharpMUTermApp( InsertHistoryEntry); _search = new SearchSurface(_system, SearchModelFor, GoToSearchHit); + SchemePopups(); _window.OnResize += (_, _) => { @@ -8015,19 +8016,16 @@ private string AccentHex(TerminalColor accent) => /// A world's accent as a fill — the header ribbon's segments. Deliberately not lifted: /// a fill is identity, the same reasoning the pane tints are built on, and holding one to a floor /// against a plane it covers rather than sits on would flatten the ribbon's own hues to a row of - /// near-identical pastels. What has to clear the floor is the text on it, which is . + /// near-identical pastels. What has to clear the floor is the text on it, which is . + /// A light theme deepens it () so its ink can be light. /// private string FillHex(TerminalColor accent) => - accent.Kind == TerminalColorKind.Rgb - ? new Rgb(accent.R, accent.G, accent.B).ToHex() - : _ink.Accent; + WorkspacePalette.HeaderFill( + _theme, + accent.Kind == TerminalColorKind.Rgb ? new Rgb(accent.R, accent.G, accent.B) : ParseHex(_ink.Accent)).ToHex(); - /// - /// Text on a known fill, held to the floor against that fill rather than against any plane — - /// the ribbon's segment labels and the ● that wears the world's colour on the character chip. - /// - private static string Ink(string inkHex, string fillHex) => - ChromeInk.On(ParseHex(inkHex), ParseHex(fillHex)); + /// The ink on a header segment's , held to the header's floor. + private string SegmentInk(string fillHex) => WorkspacePalette.HeaderInk(_theme, ParseHex(fillHex)).ToHex(); /// A #rrggbb markup colour back as a colour. private static Rgb ParseHex(string hex) => new( @@ -13704,7 +13702,6 @@ private string HeaderMarkup(HeaderModel model) // The menu affordance opens the command surface (caret flips to ▾ while it's open). The whole // identity cluster is a powerline ribbon — menu ▸ world ▸ character — flowing accent colours. var caret = model.MenuOpen ? "▾" : Glyphs.Menu; - var dark = Hex(_theme.Resolve(TerminalColor.Default, isBackground: true)); var headerBg = Hex(_theme.StatusBackground); // The dim chrome the character segment sits on. Derived rather than the literal #3f4859 it was: // the header is painted on the theme's own chrome band, and a fixed dark chip under a *light* @@ -13720,14 +13717,14 @@ private string HeaderMarkup(HeaderModel model) // legible is the text *on* it, so each segment's ink is measured against the fill it lands on. var brandBg = FillHex(AccentPalette[2]); // violet var sb = new System.Text.StringBuilder(); - sb.Append($"[link={HeaderModel.PaletteTarget}][bold {Ink(dark, brandBg)} on {brandBg}] {caret} muterm [/][/]"); + sb.Append($"[link={HeaderModel.PaletteTarget}][bold {SegmentInk(brandBg)} on {brandBg}] {caret} muterm [/][/]"); var tail = brandBg; if (model.World is { } active) { var worldAccent = FillHex(active.Accent); sb.Append($"[{tail} on {worldAccent}]{Glyphs.PowerRight}[/]"); - sb.Append($"[bold {Ink(dark, worldAccent)} on {worldAccent}] {Escape(active.Name)} [/]"); + sb.Append($"[bold {SegmentInk(worldAccent)} on {worldAccent}] {Escape(active.Name)} [/]"); tail = worldAccent; if (model.Character?.Name is { } name) { @@ -13736,7 +13733,7 @@ private string HeaderMarkup(HeaderModel model) // The ● wears the world's colour and is *text* here rather than a fill, so it is the one // place on this row the accent has to clear the floor — against the chip, which is the // plane it actually lands on. - sb.Append($"[{Ink(worldAccent, chip)} on {chip}] ● {Escape(name)} [/]"); + sb.Append($"[{Contrast.Legible(ParseHex(worldAccent), chipRgb, WorkspacePalette.HeaderTextFloor).ToHex()} on {chip}] ● {Escape(name)} [/]"); tail = chip; } } @@ -13765,17 +13762,20 @@ private string HeaderMarkup(HeaderModel model) // graphics readout, which took the 80-column layout to precisely 80 cells; dropping that (see // below) gave the width back. InputAreaLayoutTests.TheFirstFrameFitsTheTerminalItIsOn(80) is the // test that says so, and anything added here has to keep it passing. + // The quiet half of the row is held to the header's floor on its band rather than left to the framework's + // fixed [dim] grey, which is 3.4:1 on Dark's band and less on Light's. + var muted = WorkspacePalette.HeaderMuted(_theme).ToHex(); var conn = model.HasWorlds ? $"{model.ConnectedText} " : string.Empty; var log = model.Log == LogFormat.None - ? $"[dim]{Glyphs.Log} {model.LogText}[/]" - : $"[{_ink.Accent}]{Glyphs.Log}[/] [dim]{model.LogText}[/]"; + ? $"[{muted}]{Glyphs.Log} {model.LogText}[/]" + : $"[{Contrast.Legible(ParseHex(_ink.Accent), _theme.StatusBackground, WorkspacePalette.HeaderTextFloor).ToHex()}]{Glyphs.Log}[/] [{muted}]{model.LogText}[/]"; // No graphics readout here. Which protocol the probe settled on is decided once at startup and // never changes, so a permanent cell of chrome spends the row's scarcest resource on a fact that // cannot become news — and it was already said twice elsewhere: the session prints // "*** SharpMUTerm — theme '…', graphics: …" when it opens, and the not-connected status line // repeats it. A startup fact belongs where startup facts are read, not in the row that has to // fit an identity ribbon and a live count at eighty columns. - var right = $"[dim]{conn}[/]{log} "; + var right = $"[{muted}]{conn}[/]{log} "; // Right-align the status cluster to the far edge so the menu bar spans the whole console. var gap = Math.Max(3, HeaderWidth() - MarkupWidth(leftBar) - MarkupWidth(right)); @@ -13970,7 +13970,7 @@ private string StatusBarMarkup(string character, string state) _statusMetersHidden = VitalsStripShowing(); var meters = _statusMetersHidden ? string.Empty - : StatusMeterRenderer.Render(StatusMeters(), StatusData(), $"{_ink.Notice}"); + : StatusMeterRenderer.Render(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground)); var right = new List(); @@ -14037,7 +14037,7 @@ private string StatusBarMarkup(string character, string state) // either of those two cells, and they used to be the thing that lost — at 80 columns a world // publishing HP showed none of it. var compactMeters = meters.Length > 0 - ? StatusMeterRenderer.Render(StatusMeters(), StatusData(), $"{_ink.Notice}", compact: true) + ? StatusMeterRenderer.Render(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground), compact: true) : string.Empty; var meterCost = compactMeters.Length > 0 ? 3 + MarkupWidth(compactMeters) + MeterSlack : 0; foreach (var droppable in new[] { encodingCell, paletteCell }) @@ -14072,7 +14072,7 @@ private string StatusBarMarkup(string character, string state) && MarkupWidth(left) + 3 + MarkupWidth(meters) + MarkupWidth(rightBar) + MinStatusGap + MeterSlack > HeaderWidth()) { // Too narrow for value/max: the share alone, in a field just as fixed. - meters = StatusMeterRenderer.Render(StatusMeters(), StatusData(), $"{_ink.Notice}", compact: true); + meters = StatusMeterRenderer.Render(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground), compact: true); } if (meters.Length > 0 diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index 614d95bf..b05b1814 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -293,6 +293,66 @@ internal static Rgb HeaderChip(Theme theme) return Mix(theme.StatusBackground, theme.Foreground, ChipLift); } + /// + /// The floor the header's text is held to — WCAG AA for body text. The header is the one row every frame carries, + /// and its segment labels are names a reader looks for, not de-emphasis; (3:1) is for + /// the workspace's own chrome and left Light's ribbon at exactly 3.01:1. + /// + internal const double HeaderTextFloor = 4.5; + + /// + /// A header ribbon segment's fill for . A dark theme keeps the segment's own neon (the + /// identity the ribbon exists to show, inked in the dark background). A light theme gets a deep fill of the + /// same hue — darkened until the theme's own light background reads on it at — and is + /// inked light, because Dark's neon with ink driven down to the floor read washed out. Both hosts read it: the cell + /// header and the native one (ChromePalette.Brand). + /// + internal static Rgb HeaderFill(Theme theme, Rgb fill) + { + ArgumentNullException.ThrowIfNull(theme); + return Contrast.RelativeLuminance(theme.Background) < LightPlaneLuminance + ? fill + : Contrast.Legible(fill, theme.Background, HeaderTextFloor); + } + + /// + /// The ink on a header segment's fill: the theme's own background (dark on a dark theme's neon, light on a light + /// theme's deep fill), held to against the fill it lands on. + /// + internal static Rgb HeaderInk(Theme theme, Rgb fill) + { + ArgumentNullException.ThrowIfNull(theme); + return Contrast.Legible(theme.Background, fill, HeaderTextFloor); + } + + /// The header's quiet text (the counts, the log state), held to on its band. + internal static Rgb HeaderMuted(Theme theme) + { + ArgumentNullException.ThrowIfNull(theme); + return Contrast.Legible(Mix(theme.StatusBackground, theme.StatusForeground, MutedLean), theme.StatusBackground, HeaderTextFloor); + } + + /// + /// The low cue on a meter (a vital below StatusMeterRenderer.LowShare): its bar, its value and its low + /// mark, in both hosts. A dark theme keeps the client's notice amber (), which reads as a + /// warning on a dark plane. A light theme gets a deep orange held to on + /// : the amber pushed down to a light plane's floor turns olive, and the cue then read as a + /// grey word over an olive bar — no warning at all (UX audit #29). + /// + internal static Rgb Low(Theme theme, Rgb notice, Rgb plane) + { + ArgumentNullException.ThrowIfNull(theme); + return Contrast.RelativeLuminance(theme.Background) < LightPlaneLuminance + ? notice + : Contrast.Legible(LowBase, plane, HeaderTextFloor); + } + + /// The light themes' low cue before the plane has said how deep it must be: a warm, saturated orange. + private static readonly Rgb LowBase = new(0xe8, 0x59, 0x0c); + + /// How far the header's quiet text leans from its band toward its ink before the floor is applied. + private const double MutedLean = 0.55; + /// /// How far the header chip is lifted toward the theme's ink: enough that the wedge between the two /// reads as a shape, no further, since this is a background for a name and not a highlight. diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs index 4dc5cb68..9ab00c43 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs @@ -93,7 +93,7 @@ public async Task CtrlFOpensTheNativeSearchOverEverythingWithTheBoxFocused() await Assert.That(focused).IsTrue(); await Assert.That(cellOpen).IsFalse().Because("no cell search under the native one"); await Assert.That(onTop).IsTrue().Because("nothing native draws over it"); - await Assert.That(colours).IsEqualTo(ModalColours.Dark).Because("the demo's theme is Dark"); + await Assert.That(colours).IsEqualTo(NativeTokens.Dark).Because("the demo's theme is Dark"); } /// @@ -126,7 +126,7 @@ public async Task TheCardFollowsALightTheme() return rig.Driver.Modals.Quit!.Colours; }, theme: "Light"); - await Assert.That(colours).IsEqualTo(ModalColours.Light); + await Assert.That(colours).IsEqualTo(NativeTokens.Light); } [Test] diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs new file mode 100644 index 00000000..265ce032 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs @@ -0,0 +1,211 @@ +using System.Text.RegularExpressions; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window has one design language (): its planes, inks, radii and type sizes come from one +/// place, derived from the client's theme, and every ink clears the text floor on the planes it is drawn on. The audit +/// that asked for it counted 15 font sizes, 8 radii and 33 literal colours across the window's views, and a Fluent blue +/// settings window beside a teal palette. +/// +[NotInParallel] +public class NativeTokenTests +{ + /// + /// Files allowed a literal size or colour, and why. Nothing else in the window's assembly may write one: a new view + /// takes its sizes from the ramp and its colours from the tokens, or it is a second design language again. + /// + private static readonly Dictionary Allowed = new(StringComparer.Ordinal) + { + ["NativeTokens.cs"] = "the tokens themselves", + }; + + [Test] + public async Task NoViewWritesALiteralFontSizeOrColour() + { + var root = Path.Combine(RepositoryRoot(), "src", "SharpMUTerm.Avalonia"); + var size = new Regex(@"\bFontSize\s*=\s*[0-9]", RegexOptions.Compiled); + var colour = new Regex("Color\\.Parse\\(\"#", RegexOptions.Compiled); + var offenders = new List(); + foreach (var file in Directory.EnumerateFiles(root, "*.cs", SearchOption.TopDirectoryOnly)) + { + if (Allowed.ContainsKey(Path.GetFileName(file))) + { + continue; + } + + var lines = File.ReadAllLines(file); + for (var i = 0; i < lines.Length; i++) + { + var line = lines[i].Trim(); + if (line.StartsWith("//", StringComparison.Ordinal)) + { + continue; + } + + if (size.IsMatch(line) || colour.IsMatch(line)) + { + offenders.Add($"{Path.GetFileName(file)}:{i + 1}: {line}"); + } + } + } + + await Assert.That(offenders).IsEmpty().Because(string.Join("\n", offenders)); + } + + [Test] + public async Task TheDarkAndLightThemesResolveToThePalettesOwnCards() + { + await Assert.That(NativeTokens.Dark.Card).IsEqualTo(Color.Parse("#1e1e25")); + await Assert.That(NativeTokens.Dark.Accent).IsEqualTo(Color.Parse("#00f5b7")).Because("the client's own teal, already legible on a dark card"); + await Assert.That(NativeTokens.Light.Card).IsEqualTo(Colors.White); + await Assert.That(NativeTokens.Dark.IsDark).IsTrue(); + await Assert.That(NativeTokens.Light.IsDark).IsFalse(); + } + + [Test] + public async Task SolarizedGetsItsOwnHueNotTheDarkThemesGrey() + { + var solarized = NativeTokens.For(ThemeLibrary.SolarizedDark()); + await Assert.That(solarized.Card).IsNotEqualTo(NativeTokens.Dark.Card); + await Assert.That(solarized.Card.B).IsGreaterThan(solarized.Card.R).Because("Solarized's background is a blue-green"); + } + + [Test] + [Arguments("Dark")] + [Arguments("Light")] + [Arguments("Solarized Dark")] + public async Task EveryInkClearsTheTextFloorOnEveryPlaneItIsDrawnOn(string name) + { + var tokens = NativeTokens.For(ThemeLibrary.Get(name)); + Color[] planes = [tokens.Card, tokens.Selected, tokens.Raised]; + var misses = new List(); + foreach (var (ink, label) in new[] + { + (tokens.Text, "text"), (tokens.Dim, "dim"), (tokens.Header, "header"), (tokens.Accent, "accent"), + (tokens.Warn, "warn"), (tokens.Notice, "notice"), + }) + { + foreach (var plane in planes) + { + var ratio = Contrast.Ratio(Rgb(ink), Rgb(plane)); + if (ratio < NativeTokens.TextFloor) + { + misses.Add($"{label} {ink} on {plane}: {ratio:0.00}"); + } + } + } + + misses.AddRange(Contrast.Ratio(Rgb(tokens.AccentInk), Rgb(tokens.Accent)) < NativeTokens.TextFloor ? ["accent ink"] : []); + misses.AddRange(Contrast.Ratio(Rgb(tokens.KeyInk), Rgb(tokens.KeyFill)) < NativeTokens.TextFloor ? ["key ink"] : []); + await Assert.That(misses).IsEmpty().Because(string.Join("\n", misses)); + } + + /// + /// The settings window wears the tokens: its plane is the palette's card and Fluent's accent is the client's, not + /// Fluent's own blue (#60cdff/#005fb8) — and it follows a Light theme the same way. + /// + [Test] + [Arguments("Dark")] + [Arguments("Light")] + public async Task TheSettingsWindowWearsTheTokens(string name) + { + var theme = ThemeLibrary.Get(name); + var (background, accent, close) = await TerminalViewTests.Session.Dispatch(() => + { + var config = new AppConfiguration(); + var form = new SettingsForm(BuiltInSettings.All, config, c => c(), _ => { }, "text", isDark: name != "Light") + { + Theme = () => theme, + }; + var window = new SettingsWindow(form); + window.Show(); + Dispatcher.UIThread.RunJobs(); + try + { + return (((ISolidColorBrush)window.Background!).Color, (Color)window.Resources["SystemAccentColor"]!, window.CloseButton.IsVisible); + } + finally + { + window.Close(); + } + }, CancellationToken.None); + + var tokens = NativeTokens.For(theme); + await Assert.That(background).IsEqualTo(tokens.Card); + await Assert.That(accent).IsEqualTo(tokens.Accent); + await Assert.That(close).IsTrue().Because("the frame has its own close button"); + } + + /// + /// The settings window is a modal over the main window: a scrim lies over it while it is open (a press on it closes + /// the settings) and goes with it. Opened beside the output — the trigger builder — it is docked to the main window's + /// right half with no scrim, so the line the rule was made from stays in view. + /// + [Test] + public async Task TheSettingsAreAModalUnlessTheyOpenBesideTheOutput() + { + var (veiled, unveiled, besideScrim, left, width, mainWidth) = await TerminalViewTests.Session.Dispatch(() => + { + var presenter = new SettingsPresenter(); + var root = new Panel(); + var main = new Window { Content = root, Width = 1400, Height = 700 }; + presenter.Owner = main; + main.Show(); + var config = new AppConfiguration(); + try + { + var window = presenter.ShowNow(new SettingsForm(BuiltInSettings.All, config, c => c(), _ => { }, "text", isDark: true)); + Dispatcher.UIThread.RunJobs(); + var veiled = presenter.Scrim is { } scrim && root.Children.Contains(scrim); + window.Close(); + Dispatcher.UIThread.RunJobs(); + var unveiled = presenter.Scrim is null && root.Children.Count == 0; + + var beside = presenter.ShowNow(new SettingsForm(BuiltInSettings.All, config, c => c(), _ => { }, "triggers", isDark: true) + { + BesideOutput = true, + }); + Dispatcher.UIThread.RunJobs(); + var result = (veiled, unveiled, presenter.Scrim is not null, beside.Position.X - main.Position.X, beside.Width, main.ClientSize.Width); + beside.Close(); + return result; + } + finally + { + main.Close(); + } + }, CancellationToken.None); + + await Assert.That(veiled).IsTrue().Because("the main window is under a scrim while the settings are open"); + await Assert.That(unveiled).IsTrue().Because("the scrim goes with the settings"); + await Assert.That(besideScrim).IsFalse().Because("beside the output nothing covers the output"); + await Assert.That(width).IsEqualTo(mainWidth / 2).Because("docked to the right half"); + await Assert.That((double)left).IsEqualTo(mainWidth / 2).Within(1); + } + + private static Rgb Rgb(Color colour) => new(colour.R, colour.G, colour.B); + + private static string RepositoryRoot() + { + for (var dir = new DirectoryInfo(AppContext.BaseDirectory); dir is not null; dir = dir.Parent) + { + if (File.Exists(Path.Combine(dir.FullName, "SharpMUTerm.slnx"))) + { + return dir.FullName; + } + } + + throw new InvalidOperationException("SharpMUTerm.slnx not found above " + AppContext.BaseDirectory); + } +} From 9b5942524ee876a7377571025a0541bbeb21133b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 10:55:45 +0000 Subject: [PATCH 038/113] UX wave 10: bars fit their pane, one name per character, palette, F4, welcome MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Away/activity/search/restore bars are sized to the pane (BarRule), elide the label first, and redraw in place on resize (SyncChromeBarWidths). - PaneLine.Plain comes from the line's spans, so anchored patterns match highlighted lines in Ctrl+F and F2's live test. - CharacterNames / DisplayName: "Corvid · Aetherfall" on every surface. - Ctrl+F footer drop ladder; the surface fits 80 columns. - Command palette naming, OUTPUT group, strict short-word fuzzy matching. - F4 and quick bar keys in glyphs; F4 footer ladder. - Window delivers numpad keys (HostKeys.DeliversNumpad, KeyMapper). - Collapsed rail world marks and two-letter initials. - Welcome copy in WelcomeModel, shared by both hosts; editable route combo. - Reconnect hints name the key; F1 names an offline window's owner. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 21 +++ CLAUDE.md | 29 +++- src/SharpMUTerm.Avalonia/KeyMapper.cs | 5 + src/SharpMUTerm.Avalonia/ListEditorView.cs | 26 ++- src/SharpMUTerm.Avalonia/NativeChrome.cs | 4 +- src/SharpMUTerm.Avalonia/PaletteOverlay.cs | 2 +- src/SharpMUTerm.Avalonia/TerminalView.cs | 4 +- src/SharpMUTerm.Avalonia/WelcomeView.cs | 35 ++-- src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + .../Chrome/CharacterNames.cs | 71 ++++++++ .../Commands/BuiltInCommands.cs | 6 +- src/SharpMUTerm.Client/Modals/LayoutsModel.cs | 2 +- src/SharpMUTerm.Client/Modals/WelcomeModel.cs | 59 ++++++- .../Palette/CommandPaletteModel.cs | 2 +- src/SharpMUTerm.Client/Palette/FuzzyMatch.cs | 66 ++++--- .../Settings/PackageCollection.cs | 4 +- src/SharpMUTerm.Tui/AwayBarRenderer.cs | 18 +- src/SharpMUTerm.Tui/BarRule.cs | 49 ++++++ src/SharpMUTerm.Tui/CommandPalette.cs | 2 +- src/SharpMUTerm.Tui/Hosting/HostKeys.cs | 9 + src/SharpMUTerm.Tui/KeypadScreenRenderer.cs | 29 +++- src/SharpMUTerm.Tui/MacroKeys.cs | 7 +- src/SharpMUTerm.Tui/MarkupText.cs | 19 ++ src/SharpMUTerm.Tui/PaneLine.cs | 4 +- src/SharpMUTerm.Tui/RailRenderer.cs | 38 +++- src/SharpMUTerm.Tui/RestoreBarRenderer.cs | 9 +- src/SharpMUTerm.Tui/SearchBarRenderer.cs | 13 +- src/SharpMUTerm.Tui/SearchPrompt.cs | 20 ++- src/SharpMUTerm.Tui/SearchSurface.cs | 7 +- .../SharpMUTermApp.ChromeBars.cs | 57 ++++++ .../SharpMUTermApp.Contributions.cs | 14 ++ src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs | 6 +- src/SharpMUTerm.Tui/SharpMUTermApp.Names.cs | 27 +++ .../SharpMUTermApp.NativePalette.cs | 2 +- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 2 +- .../SharpMUTermApp.SendGroup.cs | 4 +- .../SharpMUTermApp.TriggerBuilder.cs | 2 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 49 +++--- src/SharpMUTerm.Tui/WelcomeSurface.cs | 35 ++-- .../PackagePageTests.cs | 4 +- .../SurfaceParityTests.cs | 14 +- .../CharacterNamesTests.cs | 35 ++++ .../CommandPaletteModelTests.cs | 40 ++++- .../PackageSettingsTests.cs | 4 +- .../ClientHostContractTests.cs | 1 + .../ConnectionKeysTests.cs | 2 +- .../KeypadScreenRendererTests.cs | 6 +- .../MacroKeyCaptureTests.cs | 2 +- .../NativeModalRoutingTests.cs | 2 +- .../SharpMUTerm.Tui.Tests/PackagesAppTests.cs | 2 +- .../PaletteDiscoverabilityTests.cs | 2 +- .../PaneActivationTests.cs | 4 +- .../RailRendererTests.cs | 2 +- .../SessionStateAccountingTests.cs | 4 +- .../SharpMUTerm.Tui.Tests/SurfaceCellTests.cs | 2 +- tests/SharpMUTerm.Tui.Tests/WaveTenTests.cs | 163 ++++++++++++++++++ tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs | 2 +- 57 files changed, 861 insertions(+), 191 deletions(-) create mode 100644 src/SharpMUTerm.Client/Chrome/CharacterNames.cs create mode 100644 src/SharpMUTerm.Tui/BarRule.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.ChromeBars.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Names.cs create mode 100644 tests/SharpMUTerm.Client.Tests/CharacterNamesTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/WaveTenTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b4db941..94b5a707 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -266,6 +266,19 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- A character is named the same way everywhere — `Corvid · Aetherfall` — in the quit prompt, the command palette, + the layouts list, Packages and the client's messages, instead of `Aetherfall.Corvid` in some places and + `Corvid (Aetherfall)` in others. +- The command palette is called that everywhere, its output commands are grouped under OUTPUT, and a short word + you type (four letters or fewer) now matches only at the start of words, so `layo` finds the layout commands + rather than unrelated entries that happen to contain those letters. +- The keypad screen (F4) and the quick bar show keys as `⌃F1`, `⌥M` like every other surface. +- The welcome says *world* throughout, labels every field of its connect form, and the desktop window's version + matches the terminal's word for word. +- The folded sidebar marks each world with a coloured bar and gives two characters with the same initial two + letters each, so they can be told apart. +- Desktop window: a trigger's route on F2 is a drop-down listing every window, and still takes a new name typed in. +- "Offline" notices and messages that tell you how to reconnect name the key (`⌥R`) as well as the palette entry. - Panes stacked one above the other no longer have an empty row between them when the lower pane shows its tabs: the tab row is the boundary, and the panes get the row back. Drag the empty part of that tab row to resize, or double-click it to even the panes out. The vitals and quick-bar strips sit flush against their @@ -287,6 +300,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- The away, new-activity, search and restore bars fit the pane they are in: their rule runs to the pane's edge, + never past it, and the words shorten before the rule does in a narrow pane. They redraw when the pane is resized. +- Search (Ctrl+F) fits an 80-column terminal: its key hints shorten instead of pushing the window wider than the + screen. +- A trigger pattern anchored at the start of the line (`^\[public\]`) now finds lines in search and in F2's live + test that a highlight rule has marked, as it already did in the game. +- Desktop window: number-pad keys bound on F4 fire, and F4 no longer marks them as keys that never arrive. +- F1 opened from an offline character's window names that character instead of no one. - Starting the client with a saved workspace whose panes held a panel (vitals, who is here, the quick bar, the composer) or the map no longer fails before the first frame. - Desktop window: the "no world configured" notice at first start shows once, not as two identical toasts. diff --git a/CLAUDE.md b/CLAUDE.md index 63dc629b..ec7e816f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -227,11 +227,14 @@ fallbacks) for inline images/maps. `CharacterCycle`. - **⌃P's ranking and grouping are the Client's, so both hosts list the same rows** (`CommandPaletteModel`, `FuzzyMatch`, `RecentCommands`, `KeyGlyphs` in `Client/Palette`; the Tui only draws, `CommandSurfaceRenderer`). - Core's `CommandMatcher` is gone. Decisions not to relitigate: + Core's `CommandMatcher` is gone. The surface is called *Command palette* everywhere (title, the native header's + search box, its automation name), and the group of output commands is `OUTPUT`. Decisions not to relitigate: - **Matching is subsequence, word by word, in order**, scored per character: +1 matched, +8 at a word start, +6 straight after the previous match, +4 on the first character, −1 per skipped character (−4 at most per gap), +20 when the title starts with the whole query. Each word is aligned by dynamic programming, - falling back to the leftmost alignment so anything that is a subsequence matches. A title match always + falling back to the earliest-ending alignment. **A query word of `FuzzyMatch.StrictLength` (4) letters or + fewer must start at a word start and continue in runs or at word starts** (`layo` no longer finds "Clear + window, say you"); a longer word may match as any subsequence. A title match always lists above a match on the detail, the key or the group's name; ties keep catalog order. Groups keep their headers but are ordered by their best entry, so the best match is the first row. - **An empty query lists RECENT, then SUGGESTED, then the groups**, each entry once. SUGGESTED is read off @@ -310,6 +313,8 @@ fallbacks) for inline images/maps. mid-word cannot split a match and `#ff0000` cannot find every red line (`UrlDetector`'s rule, one layer down) — and it is computed once at append, because the surface refilters over every line of every window on every keystroke. Chrome rows carry none, so a search cannot find its own bars. + It is the line's span text (`StyledLine.Text`), not the stripped markup: the `▌ ` a highlight rule draws + is markup only, so `^\[public\]` matches in ⌃F and in F2's live test as it does in the engine. - **Case is ignored in both modes**, matching `HistorySearch`; `(?-i)` is the way back, which is why there is no third toggle. An invalid pattern is a *state* (a regex is unparseable most of the time it is being typed), and there is a match timeout, because this runs on the UI thread per keystroke. @@ -327,6 +332,10 @@ fallbacks) for inline images/maps. - **Two kinds of client chrome now live in the line buffers**, so `InsertChromeRow`/`RemoveChromeRow` are the one place that fixes up everything indexing into one — the freeze point, the pending boundary, the activity bar and the search bar move together or none of them do. + - **A bar's rule is sized to its pane** (`BarRule.Fit`): each bar's `Bar` closure reads `BarWidth(windowId)` (the + viewport width) when drawn, the label elides before the rule shrinks, and `SyncChromeBarWidths` (on + `PostBufferPaint`) redraws a window's bars in place when its width moves. Width 0 (not arranged) draws 48 cells. + ⌃F's footer is a drop ladder (`SearchPrompt.HintLadder`), so the surface fits from 44 columns. - **The demo scene loads with `_watching` off.** It pours a spawn window's whole history in before the first frame, and every line would otherwise count as missed — so any frame that later made such a window visible carried an activity bar reporting the client's own setup as news. @@ -640,6 +649,8 @@ fallbacks) for inline images/maps. optional character, a password reminder), *Browse games* (`BrowsePackages`, so the index is still fetched only when asked; with no https `PackageIndexUrl` it says so on the row instead), *Open settings* (F5), the `/connect` example, and a starting layout. Decisions not to relitigate: + - **Its words live on `WelcomeModel`** (headings, intro, field labels, key rows), so both hosts say the same thing; + the client calls a game a *world* on every surface of it. - **The form goes through `ConnectCommand`**, with a `shape` callback that adds the character — so it can do nothing `/connect` cannot. Esc on the form goes back to the menu; on the menu it closes, leaving `NoWorldsNotice` (short enough for an 80-column row, and it names `/welcome`), and nothing reopens it that @@ -733,7 +744,7 @@ fallbacks) for inline images/maps. - **Drafts are per character and in memory only**, for the life of the run. Not on disk deliberately: a post is a few minutes' work, and a file would be a fourth thing this client writes, a purge entry, a `--help` line and somebody's unsent post in their home directory. Keyed by the *window's* owner, never - `_active`; a window belonging to no connection keeps none. **`Close()` raises `Closed`, which is what + `_active`; a window belonging to no connection keeps none. The header names that owner even while it is offline. **`Close()` raises `Closed`, which is what stores the draft, so a send must close first and forget after** — the other order posts the text and hands it straight back next time the window opens. - **F1 is claimed in `MacroKeys.AppShortcuts` but is not a settings screen**, so `ShortcutAction` answers @@ -1152,6 +1163,8 @@ fallbacks) for inline images/maps. settings screens and F1 size to the driver's screen, which is the cell area, so they fit and centre there. - **Folded, the sidebar is a 48 px strip**: the unfold chevron, an accent mark per world, a disc with the initial per character (filled while connected, an unread dot), "+" at the foot; names in tooltips. + The cell rail's folded strip marks each world with an accent `▌` row and gives characters two letters where two + share an initial (`RailRenderer.CollapsedWorldMark`, `InitialLength`). - **Input**: every press, release and wheel over the native views is the window's (`NativeChromeView`); a right press does nothing (there is no cell under it to forward to), and nothing is focusable. A left press on empty header space calls `TerminalView.WindowGestureFromChrome`: edge band resizes, the rest moves the window, @@ -1405,6 +1418,13 @@ an optional PATH entry so `sharpmuterm` runs from any terminal. delivers a modified key as itself (the window: ⌃digit, ⌃⇧letter, ⌃Tab and ⌥O fire) or as the terminal's bytes; a chord in `HostKeys.Reserved` or the host's newline is *Taken* with the host's own reason (the window's ⌥⏎ maximises). `SurfaceCellTests.F4TellsTheTerminalsTruth` and `SurfaceParityTests.F4TellsTheWindowsTruth` pin each. +`HostKeys.DeliversNumpad` (true in the window, whose `KeyMapper` maps `NumPad0–9`) makes a `Num…` binding fire there; +the terminal still says *no numpad key ever arrives*. F4 and the quick bar print keys through `KeyGlyphs.Normalize`. + +**A character is named one way on every surface: `Corvid · Aetherfall`** (Client `CharacterNames`; Tui +`DisplayName(sessionKey)`, open sessions first, then the configuration, so a dotted world still splits). The quit +prompt, ⌃P's *acting on*, ⌥M, F10, refusals and notices read it; the dotted session key is an address and is never +shown. Not changed: tab titles (`Corvid - Chat`) and the prompt's `Corvid@Aetherfall`. ## Building and testing @@ -1807,7 +1827,8 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] sets and their items on the left (an enable check box per item, `+ Add`/`Copy`/`Delete`/`↑`/`↓` over it, ⌥↑/⌥↓, Delete and Space on the list), the item's declared fields on the right, grouped. It fills the page below the title and scrolls in its two halves. A package's set is drawn read-only with *Copy to edit*. F2's pattern field - has the live test under it, re-run on every keystroke, each matching line with the match marked. The trigger + has the live test under it, re-run on every keystroke, each matching line with the match marked. A text field + with suggestions (F2's route) is an editable `ComboBox` listing them all, so the windows are seen without typing. The trigger builder opens it on the rule it made (`TryOpenNativeSettings(section, item)`); with no window it opens the cell F2 as before. **Each list keeps its selection for the run** (`SettingsForm.Selections`, the app's `_listSelections`, by section id; never saved): switching section and back, or closing and reopening the window, diff --git a/src/SharpMUTerm.Avalonia/KeyMapper.cs b/src/SharpMUTerm.Avalonia/KeyMapper.cs index 05af5605..8889267b 100644 --- a/src/SharpMUTerm.Avalonia/KeyMapper.cs +++ b/src/SharpMUTerm.Avalonia/KeyMapper.cs @@ -50,6 +50,11 @@ internal static class KeyMapper case Key.Insert: return Make('\x1b', ConsoleKey.Insert); case Key.Delete: return Make('\x1b', ConsoleKey.Delete); case >= Key.F1 and <= Key.F24: return Make('\0', ConsoleKey.F1 + (key - Key.F1)); + + // The numpad as itself, so a Num7 binding fires (HostKeys.DeliversNumpad). It carries its digit, so an + // unbound numpad key still types one; the TextInput that follows is swallowed (TerminalView). + case >= Key.NumPad0 and <= Key.NumPad9: + return Make((char)('0' + (key - Key.NumPad0)), ConsoleKey.NumPad0 + (key - Key.NumPad0)); } // Ctrl together with Alt is AltGr on a European layout: the character it types is TextInput's. diff --git a/src/SharpMUTerm.Avalonia/ListEditorView.cs b/src/SharpMUTerm.Avalonia/ListEditorView.cs index a26866c3..993128da 100644 --- a/src/SharpMUTerm.Avalonia/ListEditorView.cs +++ b/src/SharpMUTerm.Avalonia/ListEditorView.cs @@ -727,16 +727,19 @@ private Control TextControl(TextField text) { var suggestions = _form.Suggestions(text); TextBox? box = null; - AutoCompleteBox? auto = null; + ComboBox? auto = null; if (suggestions.Count > 0) { - auto = new AutoCompleteBox + // An editable combo box: the cell screen offers these as a list ((none), main, the windows), so the reserved + // words have to be visible here too, not only reachable by typing; anything else can still be typed. + auto = new ComboBox { - Text = _form.Text(text), + IsEditable = true, ItemsSource = suggestions, - FilterMode = AutoCompleteFilterMode.ContainsOrdinal, - MinimumPrefixLength = 0, + Text = _form.Text(text), + HorizontalAlignment = HorizontalAlignment.Stretch, }; + AutomationProperties.SetName(auto, text.Label); } else { @@ -789,6 +792,19 @@ void Commit() } control.LostFocus += (_, _) => Commit(); + if (auto is not null) + { + // A pick from the list commits as ⏎ would; typing commits on ⏎ or leaving the box. + auto.SelectionChanged += (_, _) => + { + if (!_syncing && auto.SelectedItem is string picked) + { + auto.Text = picked; + Commit(); + } + }; + } + control.KeyDown += (_, e) => { if (e.Key == Key.Enter && (text.Rule != TextRule.Lines || e.KeyModifiers == KeyModifiers.Control)) diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 91c0154c..37402e01 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -341,7 +341,7 @@ protected static void Chevron(DrawingContext context, Rect area, bool left, Colo internal sealed class NativeHeader(TerminalView view) : NativeChromeView(view) { /// What the search box says. ⌃P lists commands, characters and windows, and settings screens. - internal const string SearchText = "Search commands, windows, settings"; + internal const string SearchText = "Command palette"; /// The prefix's leading word, beside its chord. internal const string PrefixWord = "awaiting a pane key"; @@ -590,7 +590,7 @@ private void DrawPrefix(DrawingContext context, HeaderPrefix prefix, ChromeOverl internal sealed class NativeSidebar(TerminalView view) : NativeChromeView(view) { /// What the button at the foot says. - internal const string AddGameText = "+ Add a game or connect"; + internal const string AddGameText = "+ Add a world or connect"; /// The fold button's tooltip, open and folded. internal const string FoldTip = "Fold the sidebar (Ctrl+B b)", UnfoldTip = "Open the sidebar (Ctrl+B b)"; diff --git a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs index 80e9180e..c791e997 100644 --- a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs +++ b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs @@ -68,7 +68,7 @@ public PaletteOverlay(PaletteSession session, Action remove) Padding = new Thickness(12, 9), CornerRadius = new CornerRadius(8), }; - AutomationProperties.SetName(_search, "Search commands"); + AutomationProperties.SetName(_search, "Command palette"); _search.TextChanged += (_, _) => Refresh(resetSelection: true); DockPanel.SetDock(_search, Dock.Top); diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index fe9bfda6..7586d402 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -239,7 +239,9 @@ internal void HandleKeyDown(KeyEventArgs e) if (mapped is { } key) { // An Alt chord can be followed by a TextInput for the same letter on some platforms. - _swallowText = key.Modifiers.HasFlag(ConsoleModifiers.Alt) && !key.Modifiers.HasFlag(ConsoleModifiers.Control) + // So is a numpad digit, which KeyMapper has already sent with its digit. + _swallowText = (key.Modifiers.HasFlag(ConsoleModifiers.Alt) && !key.Modifiers.HasFlag(ConsoleModifiers.Control)) + || key.Key is >= ConsoleKey.NumPad0 and <= ConsoleKey.NumPad9 ? key.KeyChar : null; _driver.RaiseKey(key); diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index f3016d15..5daf7332 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -26,6 +26,7 @@ internal sealed class WelcomeView : DockPanel, IModalView private readonly Action _done; private readonly StackPanel _body = new(); private readonly TextBlock _footer; + private readonly TextBlock _heading; private readonly List _choiceRows = []; private readonly List -/// Whose layouts these are: the character's session key. +/// Whose layouts these are, named for a person (). /// The layouts, built-ins first, in the library's order. /// Which row is pointed at. /// What the last action said, or null. diff --git a/src/SharpMUTerm.Client/Modals/WelcomeModel.cs b/src/SharpMUTerm.Client/Modals/WelcomeModel.cs index 27a7f8d0..efe7c7d3 100644 --- a/src/SharpMUTerm.Client/Modals/WelcomeModel.cs +++ b/src/SharpMUTerm.Client/Modals/WelcomeModel.cs @@ -61,11 +61,66 @@ public sealed record WelcomeModel( /// A character name long enough for any game's. public const int MaxCharacter = 40; + // The welcome's words, said once here so both hosts say the same thing in the same case. One noun, "world": + // it is what F5, the rail and every other surface call a place you connect to. + + /// The welcome's heading. + public const string Heading = "Welcome to SharpMUTerm"; + + /// The line under the heading on the menu. + public const string Intro = "No worlds yet. Pick a way in — you can add more at any time."; + + /// What leads the example command. + public const string ExampleLead = "Or type it on the command line:"; + + /// The line under the layout chips. + public const string LayoutNote = "Saved per world · ⌥M changes it later"; + + /// The form's heading. + public const string FormHeading = "Connect to a world"; + + /// The line under the form's heading. + public const string FormIntro = "Saved as a world, so you can come back to it."; + + /// The TLS row's words when on; the window's check box carries these words. + public const string TlsOn = "On, encrypted"; + + /// The TLS row's words when off. + public const string TlsOff = "Off"; + + /// The password row's words when on (no password now); the window's check box carries these words. + public const string PasswordOn = "Set it on F5 after connecting"; + + /// The password row's words when off. + public const string PasswordOff = "Type it at the login prompt"; + + /// The host box's placeholder. + public const string HostPlaceholder = "mud.example.org"; + + /// The character box's placeholder. + public const string CharacterPlaceholder = "Optional, the name you log in as"; + + /// The menu's keys: what moves (left) and what acts (right). The window joins the two. + public static (string Left, string Right) MenuKeys => ("↑↓ pick · ←→ layout", "⏎ choose · Esc closes"); + + /// The form's keys that act, in both hosts (how a host moves between fields is its own). + public const string FormKeys = "⏎ connect · Esc back"; + + /// A form row's label, as both hosts write it. + public static string FieldLabel(WelcomeField field) => field switch + { + WelcomeField.Host => "Host", + WelcomeField.Port => "Port", + WelcomeField.Tls => "TLS", + WelcomeField.Character => "Character", + _ => "Password", + }; + /// A choice's title and the words beside it. public (string Title, string Detail) Describe(WelcomeChoice choice) => choice switch { - WelcomeChoice.Connect => ("Connect to a host", "type a host and port"), - WelcomeChoice.Browse => ("Browse games", IndexProblem is null ? "from the package index" : "no package index set"), + WelcomeChoice.Connect => ("Connect to a world", "Type a host and port"), + WelcomeChoice.Browse => ("Browse worlds", IndexProblem is null ? "From the package index" : "No package index set"), _ => ("Open settings", "F5, add a world by hand"), }; diff --git a/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs b/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs index 385b209e..079396dc 100644 --- a/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs +++ b/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs @@ -92,7 +92,7 @@ public static class CommandPaletteModel { CommandGroup.GoTo => "GO TO", CommandGroup.World => "WORLD", - CommandGroup.Terminal => "TERMINAL", + CommandGroup.Terminal => "OUTPUT", CommandGroup.Layout => "LAYOUT", CommandGroup.Settings => "SETTINGS", _ => group.ToString().ToUpperInvariant(), diff --git a/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs b/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs index a8e898a0..87eb004c 100644 --- a/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs +++ b/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs @@ -21,7 +21,15 @@ public sealed record FuzzyResult(int Score, IReadOnlyList Positions); /// /// Each word is aligned by dynamic programming over every place its characters could land, so the best /// alignment is found rather than the leftmost; if aligning the words one by one leaves a later word nowhere -/// to go, the leftmost alignment of all of them is scored instead, so anything that is a subsequence matches. +/// to go, the earliest-ending alignment of each word in turn is scored instead. +/// +/// +/// A short word may not scatter. A query word of letters or fewer matches only +/// where each of its letters begins a word of the text or follows the one before it: trig finds +/// Make a trigger… and fp still finds Freeze pane, but trig no longer finds +/// Stop reading this window aloud (a t, r, i and g spread over four words) or Start logging. A few +/// letters is a prefix or an acronym; scattered across a title they match nearly everything. A longer word keeps the +/// plain subsequence rule, where scattered letters are rare enough to mean something (tstamp). /// /// public static class FuzzyMatch @@ -47,6 +55,9 @@ public static class FuzzyMatch /// Added when the text starts with the whole query, spaces and all. public const int WholePrefix = 20; + /// A query word this long or shorter matches only at word starts and runs (see the class remarks). + public const int StrictLength = 4; + /// /// Matches against , or returns null when it is not a /// subsequence of it. An empty or blank query matches everything with a score of zero. @@ -69,7 +80,7 @@ public static class FuzzyMatch var aligned = true; foreach (var word in words) { - var best = AlignWord(word.ToLowerInvariant(), lower, text, from); + var best = AlignWord(word.ToLowerInvariant(), lower, text, from, word.Length <= StrictLength, earliest: false); if (best is null) { aligned = false; @@ -83,27 +94,23 @@ public static class FuzzyMatch if (!aligned) { - // A word aligned for its own best score can leave the next one nowhere to go; the leftmost - // alignment of every word in turn finds a match whenever there is one. + // A word aligned for its own best score can leave the next one nowhere to go; the earliest-ending + // alignment of every word in turn leaves each later word the most room, so it finds a match whenever + // there is one. positions.Clear(); score = 0; from = 0; foreach (var word in words) { - var start = positions.Count; - foreach (var c in word.ToLowerInvariant()) + var early = AlignWord(word.ToLowerInvariant(), lower, text, from, word.Length <= StrictLength, earliest: true); + if (early is null) { - var at = lower.IndexOf(c, from); - if (at < 0) - { - return null; - } - - positions.Add(at); - from = at + 1; + return null; } - score += ScoreRun(text, positions, start); + score += early.Value.Score; + positions.AddRange(early.Value.Positions); + from = early.Value.Positions[^1] + 1; } } @@ -138,22 +145,7 @@ private static int Link(int previous, int next) => // Scored against the original text, so a capital inside a word (camelCase) counts as a word start. // ToLowerInvariant maps char for char, so an index in the lowered text is the same index here. - private static int ScoreRun(string text, List positions, int start) - { - var score = 0; - for (var i = start; i < positions.Count; i++) - { - score += CharScore(text, positions[i]); - if (i > start) - { - score += Link(positions[i - 1], positions[i]); - } - } - - return score; - } - - private static (int Score, int[] Positions)? AlignWord(string word, string text, string original, int from) + private static (int Score, int[] Positions)? AlignWord(string word, string text, string original, int from, bool strict, bool earliest) { var m = word.Length; var n = text.Length; @@ -176,7 +168,7 @@ private static (int Score, int[] Positions)? AlignWord(string word, string text, for (var j = from; j < n; j++) { - if (text[j] == word[0]) + if (text[j] == word[0] && (!strict || IsWordStart(original, j))) { best[0, j] = CharScore(original, j); back[0, j] = -1; @@ -192,11 +184,12 @@ private static (int Score, int[] Positions)? AlignWord(string word, string text, continue; } + var wordStart = IsWordStart(original, j); var top = none; var arg = -1; for (var k = from + i - 1; k < j; k++) { - if (best[i - 1, k] == none) + if (best[i - 1, k] == none || (strict && !wordStart && k != j - 1)) { continue; } @@ -221,11 +214,16 @@ private static (int Score, int[] Positions)? AlignWord(string word, string text, var score = none; for (var j = from; j < n; j++) { - // Strictly greater, so the earliest of equal endings wins and later words keep the most room. + // Strictly greater, so the earliest of equal endings wins and later words keep the most room; asked for + // the earliest outright, the first ending at all. if (best[m - 1, j] != none && best[m - 1, j] > score) { score = best[m - 1, j]; end = j; + if (earliest) + { + break; + } } } diff --git a/src/SharpMUTerm.Client/Settings/PackageCollection.cs b/src/SharpMUTerm.Client/Settings/PackageCollection.cs index ba7359d4..572586c1 100644 --- a/src/SharpMUTerm.Client/Settings/PackageCollection.cs +++ b/src/SharpMUTerm.Client/Settings/PackageCollection.cs @@ -121,14 +121,14 @@ public static bool SetEnabled(AppConfiguration config, string id, bool on) return true; } - /// The characters a package applies to: everyone on a world it is for, as Corvid (Aetherfall). + /// The characters a package applies to: everyone on a world it is for, as Corvid · Aetherfall. public static IReadOnlyList CharactersFor(AppConfiguration config, PackageManifest manifest) { ArgumentNullException.ThrowIfNull(config); ArgumentNullException.ThrowIfNull(manifest); return config.Worlds.ToArray() .Where(w => manifest.IsFor(w.Host, w.Port)) - .SelectMany(w => w.Characters.ToArray().Select(c => $"{c.Name} ({w.Name})")) + .SelectMany(w => w.Characters.ToArray().Select(c => Chrome.CharacterNames.Display(w.Name, c.Name))) .ToList(); } diff --git a/src/SharpMUTerm.Tui/AwayBarRenderer.cs b/src/SharpMUTerm.Tui/AwayBarRenderer.cs index a8aa9431..dd36e13d 100644 --- a/src/SharpMUTerm.Tui/AwayBarRenderer.cs +++ b/src/SharpMUTerm.Tui/AwayBarRenderer.cs @@ -22,9 +22,6 @@ namespace SharpMUTerm.Tui; /// internal static class AwayBarRenderer { - /// How long the trailing rule is. The same 48 cells the freeze and restore bars draw. - private const int RuleCells = 48; - /// The label, kept as a constant so a test can look for the exact words a reader will see. internal const string Label = "AWAY"; @@ -38,9 +35,10 @@ internal static class AwayBarRenderer /// /// The bar for lines that arrived over an absence of , - /// on an already-resolved #rrggbb accent. + /// on an already-resolved #rrggbb accent, sized to a pane cells wide + /// (; 0 = not arranged yet). /// - public static string Bar(int lines, TimeSpan away, string accentHex) + public static string Bar(int lines, TimeSpan away, string accentHex, int width = 0) { ArgumentException.ThrowIfNullOrEmpty(accentHex); @@ -49,9 +47,9 @@ public static string Bar(int lines, TimeSpan away, string accentHex) // scrolling is in front of me. The duration is "how far behind am I" — five minutes is a // conversation you can still join, two hours is a different evening. var count = lines == 1 ? "1 line" : $"{lines} lines"; - var rule = new string('─', RuleCells); + var (text, rule) = BarRule.Fit(Label.Length + 4, $"{count} since you left · {Duration(away)}", width); return $"[{accentHex}]{Glyphs.Away} {Label}[/] " - + $"[dim]{MarkupText.Escape($"{count} since you left · {Duration(away)}")} {rule}[/]"; + + $"[dim]{MarkupText.Escape(text)} {BarRule.Rule(rule)}[/]"; } /// @@ -64,14 +62,14 @@ public static string Bar(int lines, TimeSpan away, string accentHex) /// is watching, so a duration on it would be timing the output rather than the absence. /// /// - public static string Missed(int lines, string accentHex) + public static string Missed(int lines, string accentHex, int width = 0) { ArgumentException.ThrowIfNullOrEmpty(accentHex); var count = lines == 1 ? "1 line" : $"{lines} lines"; - var rule = new string('─', RuleCells); + var (text, rule) = BarRule.Fit(MissedLabel.Length + 4, $"{count} since you were here", width); return $"[{accentHex}]{Glyphs.Away} {MissedLabel}[/] " - + $"[dim]{MarkupText.Escape($"{count} since you were here")} {rule}[/]"; + + $"[dim]{MarkupText.Escape(text)} {BarRule.Rule(rule)}[/]"; } /// diff --git a/src/SharpMUTerm.Tui/BarRule.cs b/src/SharpMUTerm.Tui/BarRule.cs new file mode 100644 index 00000000..bad8995a --- /dev/null +++ b/src/SharpMUTerm.Tui/BarRule.cs @@ -0,0 +1,49 @@ +namespace SharpMUTerm.Tui; + +/// +/// How a boundary bar (restore, away, activity, search) fits its pane: the trailing rule runs to the pane's edge, +/// and the words are elided before the bar is allowed to wrap. A wrapped bar is three rows — label, rule, blank — +/// where the pane can afford one, which is how the old fixed 48-cell rule broke every pane narrower than about 85 +/// cells (80×24 included) and stopped short in every wider one. already sized +/// itself this way. +/// +internal static class BarRule +{ + /// The rule when the pane's width is not known yet (nothing arranged), as every bar drew it before. + internal const int Fallback = 48; + + /// The shortest rule kept before the words give way, so the bar still reads as a divider. + internal const int Minimum = 3; + + /// + /// The words and the rule length for a bar whose fixed parts take cells (label, + /// glyphs, the spaces between), with the part that may be elided, in a pane + /// cells wide. Width 0 means not arranged yet: the text is whole and the rule is + /// . + /// + public static (string Text, int Rule) Fit(int fixedCells, string text, int width) + { + ArgumentNullException.ThrowIfNull(text); + if (width <= 0) + { + return (text, Fallback); + } + + var room = width - fixedCells; + if (text.Length + Minimum <= room) + { + return (text, room - text.Length); + } + + // Not enough for the words and a short rule: the words give way first, down to nothing, and the rule keeps + // what is left (possibly none) — never a cell past the edge. + var keep = Math.Max(0, room - Minimum); + var elided = keep <= 0 ? string.Empty + : keep >= text.Length ? text + : text[..Math.Max(0, keep - 1)].TrimEnd() + "…"; + return (elided, Math.Max(0, room - elided.Length)); + } + + /// A run of rule characters. + public static string Rule(int cells) => new('─', Math.Max(0, cells)); +} diff --git a/src/SharpMUTerm.Tui/CommandPalette.cs b/src/SharpMUTerm.Tui/CommandPalette.cs index 6bfcab80..a5cf48a0 100644 --- a/src/SharpMUTerm.Tui/CommandPalette.cs +++ b/src/SharpMUTerm.Tui/CommandPalette.cs @@ -110,7 +110,7 @@ private void Open() // centring first placed the surface as if it were that size — which only became visible once // the catalog grew tall enough for the misplacement to push its bottom border off-screen. _window = new WindowBuilder(_system) - .WithTitle("Command surface") + .WithTitle("Command palette") .AsModal() .WithBorderStyle(BorderStyle.Single) .WithBackgroundColor(new Color(ScreenPalette.MenuBg)) diff --git a/src/SharpMUTerm.Tui/Hosting/HostKeys.cs b/src/SharpMUTerm.Tui/Hosting/HostKeys.cs index 70b4c04c..9fb92b6f 100644 --- a/src/SharpMUTerm.Tui/Hosting/HostKeys.cs +++ b/src/SharpMUTerm.Tui/Hosting/HostKeys.cs @@ -36,6 +36,14 @@ internal sealed record HostKeys /// public required bool ReportsChordsWhole { get; init; } + /// + /// Whether a numpad digit reaches the client as itself (Num7) rather than as the main row's 7. A + /// window reads the physical key; a terminal is never put in application-keypad mode, so its numpad types digits + /// and a Num binding never fires there. The numpad is the combat player's walking keys, which is why F4 + /// says which it is per host. + /// + public required bool DeliversNumpad { get; init; } + public bool Reserves(ConsoleKeyInfo key) => Reserved.Any(r => r.Chord.Matches(key)); /// The reserved chord a descriptor names, or null. @@ -62,5 +70,6 @@ private static bool Same(HostChord chord, MacroKeyParts parts) => Newline = new HostChord(ConsoleKey.Enter, ConsoleModifiers.Alt, "Alt+⏎", "Alt+Enter"), Reserved = [], ReportsChordsWhole = false, + DeliversNumpad = false, }; } diff --git a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs index 040124ac..e4a4e22f 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Palette; using SharpMUTerm.Client.Settings; using System.Globalization; using SharpMUTerm.Core.Automation; @@ -402,12 +403,20 @@ internal static string FooterLine( // the whole one, for the binding the cursor is actually on. var verdict = MacroKeys.Verdict(keys, macros[at].Key); var clash = KeyClashes.For(keys, macros[at], macros); - context = ScreenChrome.Context( - ScreenChrome.Position("binding", at, macros.Count), - Escape(Identify(macros[at])), - clash is { } c - ? (c.BindingRuns ? "△ " : "▲ ") + Escape(c.Reason) - : verdict.Fires ? null : "▲ " + Escape(verdict.Reason)); + var position = ScreenChrome.Position("binding", at, macros.Count); + var name = Escape(Identify(macros[at])); + var reason = clash is { } c + ? (c.BindingRuns ? "△ " : "▲ ") + Escape(c.Reason) + : verdict.Fires ? null : "▲ " + Escape(verdict.Reason); + + // A drop-order ladder, the status row's rule (FocusHints): every footer opens with the cursor's position, + // and the reason is what this one is for, so the name the cursor row already shows goes first; only then + // is the line elided. + var actionsWidth = VisibleLength(ScreenChrome.Actions(focus: focus)); + context = FirstFitting( + width <= 0 ? int.MaxValue : width - actionsWidth - 2, + ScreenChrome.Context(position, name, reason), + ScreenChrome.Context(position, reason ?? name)); } var actions = ScreenChrome.Actions(focus: focus); @@ -559,11 +568,13 @@ private static string Hotkey( // A clash is marked inside the key's own well, where the ▲ already goes, so it costs the row no // cell: △ in amber for a binding that runs and hides something (a client key, or a later binding), // ▲ for one that never runs. The footer says which side wins for the row the cursor is on. + // Spelt as every other surface spells a key (⌃F1, not Ctrl+F1); the binding keeps its stored form. + var shown = Escape(KeyGlyphs.Normalize(macro.Key)); var chord = clash is { BindingRuns: true } - ? $"[{Caution}]△ {Escape(macro.Key)}[/]" + ? $"[{Caution}]△ {shown}[/]" : verdict.Fires && clash is null - ? $"[bold]{Escape(macro.Key)}[/]" - : $"[{Muted}]▲ {Escape(macro.Key)}[/]"; + ? $"[bold]{shown}[/]" + : $"[{Muted}]▲ {shown}[/]"; var bound = ScreenChrome.Field(PadVisible(chord, KeyColumnWidth), key); // A binding that has never been named still gets its well — the name is editable whether or not diff --git a/src/SharpMUTerm.Tui/MacroKeys.cs b/src/SharpMUTerm.Tui/MacroKeys.cs index ea6b38cb..d6aef8b0 100644 --- a/src/SharpMUTerm.Tui/MacroKeys.cs +++ b/src/SharpMUTerm.Tui/MacroKeys.cs @@ -347,9 +347,10 @@ internal static MacroKeyVerdict Verdict(HostKeys keys, string? descriptor) if (parts.Key.Length == 4 && parts.Key.StartsWith("Num", StringComparison.Ordinal) && char.IsAsciiDigit(parts.Key[3])) { - // No DECKPAM is ever sent and no application-keypad SS3 is decoded, so the numpad either - // reports as the main row's digits or is dropped. Either way this descriptor never arrives. - return Never("no numpad key ever arrives"); + // A window reads the physical key (HostKeys.DeliversNumpad). A terminal is sent no DECKPAM and no + // application-keypad SS3 is decoded, so its numpad either reports as the main row's digits or is + // dropped. Either way this descriptor never arrives there. + return keys.DeliversNumpad ? new MacroKeyVerdict(MacroKeyDelivery.Fires) : Never("no numpad key ever arrives"); } if (parts.Ctrl && parts.Alt) diff --git a/src/SharpMUTerm.Tui/MarkupText.cs b/src/SharpMUTerm.Tui/MarkupText.cs index 4da7a380..603a39c6 100644 --- a/src/SharpMUTerm.Tui/MarkupText.cs +++ b/src/SharpMUTerm.Tui/MarkupText.cs @@ -56,6 +56,25 @@ internal static string PadVisible(string markup, int width) return visible >= width ? markup : markup + new string(' ', width - visible); } + /// + /// The first of (longest first) whose visible length fits , + /// else the last: a footer's drop-order ladder, so a narrow bar gives up whole parts in a chosen order rather + /// than being cut off mid-word at its end. + /// + internal static string FirstFitting(int room, params string[] candidates) + { + ArgumentNullException.ThrowIfNull(candidates); + foreach (var candidate in candidates) + { + if (VisibleLength(candidate) <= room) + { + return candidate; + } + } + + return candidates.Length == 0 ? string.Empty : candidates[^1]; + } + /// /// Lays a left- and right-hand fragment on one line, right-aligning the right to /// . A non-positive width means "width unknown" (the unit-test path), which diff --git a/src/SharpMUTerm.Tui/PaneLine.cs b/src/SharpMUTerm.Tui/PaneLine.cs index bf47639c..8ec2be2d 100644 --- a/src/SharpMUTerm.Tui/PaneLine.cs +++ b/src/SharpMUTerm.Tui/PaneLine.cs @@ -33,7 +33,9 @@ namespace SharpMUTerm.Tui; /// The line's own Spectre-style markup, with no gutter attached. /// When the line arrived, pre-formatted for the gutter, or null for no gutter. /// -/// The text the markup puts on the screen () — what ⌃F searches. +/// The text the line says — what ⌃F searches and F2's live test matches. A world's line is its spans' text +/// (), never the composed markup, which carries the client's decoration (the +/// trigger left rule ▌ ); any other row is the text its markup puts on the screen (). /// /// Held rather than derived, because the search surface refilters on every keystroke over every line of /// every window: stripping thousands of lines eight times while somebody types a word is the difference diff --git a/src/SharpMUTerm.Tui/RailRenderer.cs b/src/SharpMUTerm.Tui/RailRenderer.cs index 60788df6..1207ca46 100644 --- a/src/SharpMUTerm.Tui/RailRenderer.cs +++ b/src/SharpMUTerm.Tui/RailRenderer.cs @@ -1,3 +1,4 @@ +using System.Text; using SharpConsoleUI.Parsing; using SharpMUTerm.Client.Chrome; using SharpMUTerm.Core.Text; @@ -140,25 +141,31 @@ private static string Fit(RailRow row, int maxWidth, Func rende } /// - /// Renders the collapsed rail (⌃B b): a ~6-col strip of per-world accent separators and, under + /// Renders the collapsed rail (⌃B b): a ~6-col strip of per-world accent marks and, under /// each, its characters as a status dot + initial + unread count. Both stay clickable — an initial /// is the only handle a collapsed rail offers. + /// + /// A world is a solid ▌ in its accent, the bar the window's folded sidebar draws (a ▚ read as a + /// glyph glitch at one cell). Characters show one letter, or two for every character once two of them share a + /// first letter (): Ro and Ri rather than two Rs nobody can tell + /// apart. The length is the whole strip's, so every row keeps one width and it changes only when the set of + /// characters does. + /// /// public static List RenderCollapsed(IReadOnlyList rows, ChromeInk? ink = null) { var voice = ink ?? ChromeInk.Default; var lines = new List(); + var letters = InitialLength(rows.Where(r => r.Kind == RailRowKind.Character).Select(r => r.Label)); foreach (var row in rows) { switch (row.Kind) { case RailRowKind.World: - lines.Add(Link(row, $"[{Accent(row, voice)}]▚[/]")); + lines.Add(Link(row, $"[{Accent(row, voice)}]{CollapsedWorldMark}[/]")); break; case RailRowKind.Character: - var initial = row.Label.Length > 0 - ? Escape(row.Label.EnumerateRunes().First().ToString()) - : "?"; + var initial = Escape(Initials(row.Label, letters)); var dot = row.Connected ? "●" : "○"; var name = row.Active ? $"[bold]{initial}[/]" : initial; @@ -172,6 +179,27 @@ public static List RenderCollapsed(IReadOnlyList rows, ChromeIn return lines; } + /// The collapsed strip's mark for a world: a solid bar in the world's accent. + internal const string CollapsedWorldMark = "▌"; + + /// + /// How many letters the collapsed strip gives each character: 1, or 2 once two names share a first letter + /// (case ignored). Two at most — the strip is a handle, and past two letters the tooltip and the open rail say it. + /// + internal static int InitialLength(IEnumerable names) + { + var firsts = names.Select(n => Initials(n, 1).ToUpperInvariant()).ToList(); + return firsts.Count == firsts.Distinct(StringComparer.Ordinal).Count() ? 1 : 2; + } + + /// The first letters of a name, padded so every row is as wide; ? for none. + internal static string Initials(string name, int letters) + { + var runes = name.EnumerateRunes().Where(r => !Rune.IsWhiteSpace(r)).Take(letters).Select(r => r.ToString()).ToList(); + var text = runes.Count == 0 ? "?" : string.Concat(runes); + return text.PadRight(letters); + } + /// /// A character row: its chord, the active marker, the connected dot, the name and its unread total. /// diff --git a/src/SharpMUTerm.Tui/RestoreBarRenderer.cs b/src/SharpMUTerm.Tui/RestoreBarRenderer.cs index eaf73f71..e4337b97 100644 --- a/src/SharpMUTerm.Tui/RestoreBarRenderer.cs +++ b/src/SharpMUTerm.Tui/RestoreBarRenderer.cs @@ -23,9 +23,6 @@ namespace SharpMUTerm.Tui; /// internal static class RestoreBarRenderer { - /// How long the trailing rule is. The same 48 cells the freeze bar draws, for the same reason. - private const int RuleCells = 48; - /// The label, kept as a constant so a test can look for the exact words a reader will see. internal const string Label = "RESTORED"; @@ -33,7 +30,7 @@ internal static class RestoreBarRenderer /// The bar for lines last written at , on an /// already-resolved #rrggbb accent. /// - public static string Bar(int lines, DateTimeOffset when, string accentHex) + public static string Bar(int lines, DateTimeOffset when, string accentHex, int width = 0) { ArgumentException.ThrowIfNullOrEmpty(accentHex); @@ -43,8 +40,8 @@ public static string Bar(int lines, DateTimeOffset when, string accentHex) // a different game). Local time in the same 24-hour form the timestamp gutter uses. var count = lines == 1 ? "1 line" : $"{lines} lines"; var stamp = when.ToLocalTime().ToString("d MMM HH:mm", CultureInfo.CurrentCulture); - var rule = new string('─', RuleCells); + var (text, rule) = BarRule.Fit(Label.Length + 4, $"{count} from the previous session · {stamp}", width); return $"[{accentHex}]{Glyphs.Restored} {Label}[/] " - + $"[dim]{MarkupText.Escape($"{count} from the previous session · {stamp}")} {rule}[/]"; + + $"[dim]{MarkupText.Escape(text)} {BarRule.Rule(rule)}[/]"; } } diff --git a/src/SharpMUTerm.Tui/SearchBarRenderer.cs b/src/SharpMUTerm.Tui/SearchBarRenderer.cs index ffae1975..caf4e65d 100644 --- a/src/SharpMUTerm.Tui/SearchBarRenderer.cs +++ b/src/SharpMUTerm.Tui/SearchBarRenderer.cs @@ -19,9 +19,6 @@ namespace SharpMUTerm.Tui; /// internal static class SearchBarRenderer { - /// How long the trailing rule is. The same 48 cells the other three bars draw. - private const int RuleCells = 48; - /// The chord the bar names, and the only one it can: see MacroKeys for why ⌥⇧G is not here. internal const string NextChord = "⌥G next"; @@ -29,15 +26,17 @@ internal static class SearchBarRenderer /// The bar for hit of for /// , on an already-resolved #rrggbb accent. /// - public static string Bar(string query, int ordinal, int total, string accentHex) + public static string Bar(string query, int ordinal, int total, string accentHex, int width = 0) { ArgumentNullException.ThrowIfNull(query); ArgumentException.ThrowIfNullOrEmpty(accentHex); // The ordinal is what makes ⌥G legible: without it the bar moves and nothing says whether you // are getting closer to the end of the results or going round in circles. - var counted = MarkupText.Escape($"{query} ({ordinal} of {total})"); - var rule = new string('─', RuleCells); - return $"[{accentHex}]{Glyphs.Search} {counted}[/] [dim]{rule} {NextChord}[/]"; + // The query gives way before the count and the chord: they are what make the bar usable, the query is + // what the reader just typed. + var counted = $" ({ordinal} of {total})"; + var (text, rule) = BarRule.Fit(2 + counted.Length + 2 + NextChord.Length, query, width); + return $"[{accentHex}]{Glyphs.Search} {MarkupText.Escape(text + counted)}[/] [dim]{BarRule.Rule(rule)} {NextChord}[/]"; } } diff --git a/src/SharpMUTerm.Tui/SearchPrompt.cs b/src/SharpMUTerm.Tui/SearchPrompt.cs index 68f3d991..bcf5097f 100644 --- a/src/SharpMUTerm.Tui/SearchPrompt.cs +++ b/src/SharpMUTerm.Tui/SearchPrompt.cs @@ -57,6 +57,24 @@ internal static class SearchPrompt internal const string Hints = "type to search · ↑↓ pick · ⏎ go · ⌥E regex · ⌥A all windows · Esc cancel · ⌃F closes"; + /// + /// The footer's drop-order ladder, longest first: the status row's rule (FocusHints). + /// is 84 cells and an 80-column surface holds 74, where it used to be cut to a bare ⌃F. The prose goes + /// first, then the words after the toggles' keys, then Esc (⌃F also closes); every rung still names each key + /// that does something different. + /// + internal static readonly string[] HintLadder = + [ + Hints, + "↑↓ pick · ⏎ go · ⌥E regex · ⌥A all windows · Esc cancel · ⌃F closes", + "↑↓ pick · ⏎ go · ⌥E regex · ⌥A all · Esc cancel · ⌃F closes", + "↑↓ · ⏎ go · ⌥E regex · ⌥A all · Esc · ⌃F", + ]; + + /// The longest rung of that fits (all of it when unknown). + internal static string HintsFor(int width) => + width <= 0 ? Hints : FirstFitting(width, HintLadder); + /// The longest an entry is drawn before it is elided, when no width is supplied. private const int DefaultEntryWidth = 72; @@ -225,7 +243,7 @@ internal static List Render(SearchModel model, int selected, int width = lines.AddRange(body); lines.Add(string.Empty); - lines.Add($"[{Label}]{Hints}[/]"); + lines.Add($"[{Label}]{Escape(HintsFor(width))}[/]"); return lines; } diff --git a/src/SharpMUTerm.Tui/SearchSurface.cs b/src/SharpMUTerm.Tui/SearchSurface.cs index 0a2e8cf9..6d8130f7 100644 --- a/src/SharpMUTerm.Tui/SearchSurface.cs +++ b/src/SharpMUTerm.Tui/SearchSurface.cs @@ -32,11 +32,10 @@ namespace SharpMUTerm.Tui; internal sealed class SearchSurface { /// - /// The narrowest the surface goes. Set by the footer: a surface too narrow for its own key hints - /// would wrap them onto a second row and push the list up. Checked by test against - /// rather than trusted. + /// The narrowest the surface goes. Set by the footer's shortest rung (): a + /// surface too narrow for it would wrap the keys onto a second row and push the list up. /// - internal const int MinimumWidth = 78; + internal const int MinimumWidth = 44; /// /// The rows the surface spends on something other than results: the query line, the count line, the diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ChromeBars.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ChromeBars.cs new file mode 100644 index 00000000..1c6ebe24 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ChromeBars.cs @@ -0,0 +1,57 @@ +namespace SharpMUTerm.Tui; + +/// +/// The boundary bars in a pane's buffer (restore, away, activity, search) are as wide as the pane +/// (). Each keeps the function that draws it (), and that function +/// reads the pane's width when it runs, so a resize redraws the bars in place — no index moves. +/// +internal sealed partial class SharpMUTermApp +{ + /// The width each window's bars were last drawn at; a change redraws them. + private readonly Dictionary _chromeBarWidths = new(StringComparer.Ordinal); + + /// + /// The cells a bar in may take: its viewport's width, or 0 while the window has no + /// arranged pane (the bar then draws its fallback rule, and is redrawn once the pane is laid out). + /// + internal int BarWidth(string windowId) => + _paneScrolls.GetValueOrDefault(windowId) is { ViewportWidth: > 0 } panel ? panel.ViewportWidth : 0; + + /// + /// Redraws the bars of every window whose pane width moved since they were drawn. Rides PostBufferPaint, + /// where viewport metrics are fresh; it converges, because the next frame finds the width unchanged. + /// + private void SyncChromeBarWidths() + { + var accent = (string?)null; + foreach (var (windowId, buffer) in _lines) + { + var width = BarWidth(windowId); + if (width <= 0 || _chromeBarWidths.GetValueOrDefault(windowId) == width) + { + continue; + } + + _chromeBarWidths[windowId] = width; + var changed = false; + for (var i = 0; i < buffer.Count; i++) + { + if (buffer[i].Bar is { } bar) + { + accent ??= FrozenAccentHex(); + var markup = bar(accent); + if (!string.Equals(markup, buffer[i].Markup, StringComparison.Ordinal)) + { + buffer[i] = buffer[i] with { Markup = markup }; + changed = true; + } + } + } + + if (changed) + { + RepaintPane(windowId, keepSelection: true); + } + } + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs index bd8753c7..18bdc601 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Contributions.cs @@ -95,6 +95,20 @@ internal bool DispatchCommand(string id) private HostKeyGlyphs HostKeyGlyphs() => new(Host.Keys.Newline.Glyph); + /// + /// The key a registered command answers to on this host, spelt the way every surface spells keys + /// (), or null when it has none. A notice that names a key reads it here rather + /// than spelling it in its own text, so the key it names is the one that runs the command. + /// + internal string? CommandKey(string id) => + _contributions.Commands.Resolve(id) is SingleCommand { Key: { } key } + ? KeyGlyphs.Normalize(key.Resolve(HostKeyGlyphs())) + : null; + + /// How the status row says what reconnects: ⌥R (⌃P ▸ Reconnect). + private string ReconnectHint() => + CommandKey("world:reconnect") is { } key ? $"{key} (⌃P ▸ Reconnect)" : "⌃P ▸ Reconnect"; + private sealed class AppCommandContext(SharpMUTermApp app) : ICommandContext { private CommandContext? _state; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs index 59445535..78d54701 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -524,7 +524,7 @@ private void ShowLayouts() _layoutsView.Open( "layouts", - $"Layouts · {Snippet(key)}", + $"Layouts · {Snippet(DisplayName(key))}", width => LayoutsListLines(key, width), k => LayoutsKeyPressed(key, k), width: 64, @@ -696,7 +696,7 @@ private LayoutActionResult ApplyFromList(string key, LayoutDefinition selected) { if (!ApplyLayout(key, selected)) { - var refused = $"no window to arrange for {Snippet(key)} — switch to the character first"; + var refused = $"no window to arrange for {Snippet(DisplayName(key))} — switch to the character first"; RefuseCommand(refused); return new(false, refused); } @@ -893,7 +893,7 @@ internal LayoutsModel LayoutsModelFor(string key) .Select(l => new LayoutRow(l.Id, Snippet(l.Name), LayoutDescription(l), l.IsBuiltIn, l.Id == inUse, l.Id == worldDefault)) .ToArray(); return new LayoutsModel( - key, + DisplayName(key), rows, Math.Clamp(_layoutsSelected, 0, Math.Max(0, rows.Length - 1)), _layoutsStatus, diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Names.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Names.cs new file mode 100644 index 00000000..d4f3b630 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Names.cs @@ -0,0 +1,27 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Commands; + +namespace SharpMUTerm.Tui; + +internal sealed partial class SharpMUTermApp +{ + /// + /// A session key named for a person (): Corvid · Aetherfall. An open session + /// answers first, so a world dialled from the command line that is not in the configuration is still named; + /// then the configuration. The dotted key is an address and is never shown. + /// + internal string DisplayName(string sessionKey) + { + var open = _sessions.Sessions + .Select(s => new CharacterRef(s.World.Name, s.Character?.Name ?? string.Empty, s.SessionKey, s.IsConnected)); + foreach (var session in open) + { + if (string.Equals(session.SessionKey, sessionKey, StringComparison.Ordinal)) + { + return CharacterNames.Display(session); + } + } + + return CharacterNames.ForKey(sessionKey, _config); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs index abb9e151..4cf82c51 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativePalette.cs @@ -70,7 +70,7 @@ private bool TryOpenNativePalette() BuildCatalog(), _recentCommands.Ids, SuggestedCommandIds, - _active?.SessionKey, + _active is { } acting ? DisplayName(acting.SessionKey) : null, ThemeIsDark(), _openingQuery ?? string.Empty, id => OnUiThread(() => RunFromPalette(id)), diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index a3790853..4d133133 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -269,7 +269,7 @@ private void RunQuickMacro(string sessionKey, string descriptor) { if (FindSession(sessionKey) is not { } session) { - RefuseCommand($"{Snippet(sessionKey)} has no open session — ⌃P ▸ Switch to it opens one"); + RefuseCommand($"{Snippet(DisplayName(sessionKey))} has no open session — ⌃P ▸ Switch to it opens one"); return; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs index e450fabb..1a54911c 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs @@ -24,12 +24,12 @@ private bool DispatchGroupCommand(string id) var key = id[CommandIds.GroupTogglePrefix.Length..]; if (_sessions.Find(key) is null && !_sendGroup.Contains(key)) { - RefuseCommand($"{key} is not open"); + RefuseCommand($"{DisplayName(key)} is not open"); return true; } Notice( - _sendGroup.Toggle(key) ? $"{key} is in the send group" : $"{key} has left the send group", + _sendGroup.Toggle(key) ? $"{DisplayName(key)} is in the send group" : $"{DisplayName(key)} has left the send group", MessageSeverity.Info); RefreshRail(); return true; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs index 9b6741bd..ba38e195 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.TriggerBuilder.cs @@ -166,7 +166,7 @@ private void StageTriggerBuilder() /// are left out, so a test cannot match the client's own bars. takes the /// newest of it. /// - private IReadOnlyList TriggerTestLines() + internal IReadOnlyList TriggerTestLines() { var focused = ActiveWindowId(); var windows = SearchableWindows(all: true); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 56cc8777..64a3b067 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -921,7 +921,7 @@ public SharpMUTermApp( _palette = new CommandPalette( _system, BuildCatalog, - () => _active?.SessionKey, + () => _active is { } acting ? DisplayName(acting.SessionKey) : null, id => DispatchCommand(id), _recentCommands, () => CommandPaletteModel.Suggested(CommandState())); @@ -1019,6 +1019,7 @@ public SharpMUTermApp( SyncMapSizes(); SyncPanelSizes(); SyncScrollSplitBars(); + SyncChromeBarWidths(); SyncStatusMode(); }; @@ -1876,11 +1877,10 @@ public string RenderSnapshot(string? view = null) RefusePrefix(PrefixPanel.NoSplitRefusal); RefuseCommand("nothing to reconnect — pick a character first (⌃P ▸ Switch to …)"); Notice( - "switched to Corvid · offline — Alt+R (⌃P ▸ Reconnect) connects it", + $"switched to Corvid · offline — {ReconnectHint()} connects it", MessageSeverity.Info, - "⌃P", - new NoticeAction("world:reconnect", "Reconnect")); - Notice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error, "⌃P"); + action: new NoticeAction("world:reconnect", "Reconnect")); + Notice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error); _messageLog.Toggle(); } @@ -2590,8 +2590,8 @@ private void RestorePreviousSession() var written = window.LastWritten; AppendWindowLine( windowId, - RestoreBarRenderer.Bar(restored, written, FrozenAccentHex()), - bar: accent => RestoreBarRenderer.Bar(restored, written, accent)); + RestoreBarRenderer.Bar(restored, written, FrozenAccentHex(), BarWidth(windowId)), + bar: accent => RestoreBarRenderer.Bar(restored, written, accent, BarWidth(windowId))); restoredWindows++; restoredLines += window.Lines.Count; @@ -3315,7 +3315,7 @@ private void SwitchToCharacter(string sessionKey) { if (FindCharacter(sessionKey) is not { } found) { - Notice($"no character called {sessionKey} is configured — F5 adds one", key: "⌃P"); + Notice($"no character called {Snippet(DisplayName(sessionKey))} is configured — F5 adds one"); return; } @@ -3335,12 +3335,11 @@ private void SwitchToCharacter(string sessionKey) var state = session.IsConnected ? "connected" - : "offline — Alt+R (⌃P ▸ Reconnect) connects it"; + : $"offline — {ReconnectHint()} connects it"; Notice( $"switched to {SessionTitle(session)} · {state}", MessageSeverity.Info, - "⌃P", - session.IsConnected ? null : new NoticeAction("world:reconnect", "Reconnect")); + action: session.IsConnected ? null : new NoticeAction("world:reconnect", "Reconnect")); } /// @@ -3449,8 +3448,10 @@ private void AppendWindowLine( } // The plain text is computed here, once, and not on demand: ⌃F refilters on every keystroke over - // every line of every window (see PaneLine.Plain). - buffer.Add(new PaneLine(markup, stamp, MarkupText.Plain(markup), imageAnchor, pictures, source, bar)); + // every line of every window (see PaneLine.Plain). A world's line is read from its spans, not from the + // markup: the markup carries the client's own decoration (a highlight's `▌ ` left rule), and a search or a + // trigger's live test that saw it would miss `^[public]` on the very line that rule highlighted. + buffer.Add(new PaneLine(markup, stamp, source?.Text ?? MarkupText.Plain(markup), imageAnchor, pictures, source, bar)); // Cap what the pane holds, and trim its control with it. The control re-parses every line it @@ -3886,7 +3887,7 @@ private void MarkWhereTheReaderLeft(TimeSpan away) continue; } - InsertChromeRow(windowId, at, ink => AwayBarRenderer.Bar(missed, away, ink)); + InsertChromeRow(windowId, at, ink => AwayBarRenderer.Bar(missed, away, ink, BarWidth(windowId))); var mark = new AwayMark { Index = at, DrawnAfter = _focus.InputCount, DrawnAt = _time.GetUtcNow() }; _awayMarks[windowId] = mark; @@ -3958,7 +3959,7 @@ private void MarkMissedLines(bool reveal) } var count = buffer.Count - at; - InsertChromeRow(windowId, at, accent => AwayBarRenderer.Missed(count, accent)); + InsertChromeRow(windowId, at, accent => AwayBarRenderer.Missed(count, accent, BarWidth(windowId))); var mark = new AwayMark { @@ -4836,7 +4837,8 @@ private void GoToSearchHit(SearchRow row, string query, bool regex, bool all, in } var at = Math.Clamp(row.LineIndex, 0, buffer.Count); - InsertChromeRow(row.WindowId, at, accent => SearchBarRenderer.Bar(query, ordinal, total, accent)); + var searchWindow = row.WindowId; + InsertChromeRow(row.WindowId, at, accent => SearchBarRenderer.Bar(query, ordinal, total, accent, BarWidth(searchWindow))); _searchMark = (row.WindowId, at); RepaintPane(row.WindowId); @@ -5211,8 +5213,15 @@ private void ToggleComposer() ? kept : new ComposeResult(string.Empty, ComposeEscaping.AsTyped); + // The target is resolved the way the docked composer's is (DescribeDocked): the session's title, else the + // window's owner by name, with nothing sendable. "no connection" is left for a window that belongs to nobody. + var target = session is not null + ? SessionTitle(session) + : _workspace.FindWindow(windowId)?.SessionKey is { Length: > 0 } owner + ? FindCharacter(owner)?.Character.Name ?? string.Empty + : string.Empty; OpenComposer( - session is null ? string.Empty : SessionTitle(session), + target, draft.Body, draft.Escaping, canSend: session is not null, @@ -5328,7 +5337,7 @@ private string NothingToSendTo(string windowId) var window = _workspace.FindWindow(windowId); if (window?.SessionKey is { Length: > 0 } owner) { - return $"{owner} has no open session — ⌃P ▸ Switch to it opens one; nothing was sent"; + return $"{Snippet(DisplayName(owner))} has no open session — ⌃P ▸ Switch to it opens one; nothing was sent"; } // Through Snippet: a window's title can be a world's own text (the web view is titled from the @@ -7242,7 +7251,7 @@ private QuitModel QuitFactsNow() // — 3 unsaved edits", which was true while closing a screen could throw its edits away; now every // committed value is already written to disk when it is committed, so the count is always zero and a // line that could never appear is a line to delete rather than to leave hanging. - return new QuitModel(ConnectedCharacters(), drafts, holding.Select(w => w.Title).ToList()); + return new QuitModel(ConnectedCharacters().Select(DisplayName).ToList(), drafts, holding.Select(w => w.Title).ToList()); } /// @@ -12992,7 +13001,7 @@ private void AdoptSessionOf(string windowId) // the page it loaded — and the status row is not a place to paste an unbounded string from the wire. Notice( owner is { Length: > 0 } - ? $"{owner} has no open session — ⌃P ▸ Switch to it opens one; ⏎ sends nowhere from this pane" + ? $"{Snippet(DisplayName(owner))} has no open session — ⌃P ▸ Switch to it opens one; ⏎ sends nowhere from this pane" : $"{Snippet(_workspace.FindWindow(windowId)?.Title ?? windowId)} belongs to no connection — " + "⏎ sends nowhere from this pane"); } diff --git a/src/SharpMUTerm.Tui/WelcomeSurface.cs b/src/SharpMUTerm.Tui/WelcomeSurface.cs index 39c92e08..accf42b8 100644 --- a/src/SharpMUTerm.Tui/WelcomeSurface.cs +++ b/src/SharpMUTerm.Tui/WelcomeSurface.cs @@ -336,8 +336,8 @@ private static List RenderMenu(WelcomeModel model, int width) { var lines = new List { - Accent("Welcome to SharpMUTerm"), - Label("No games yet. Pick one of these to start."), + Accent(WelcomeModel.Heading), + Label(WelcomeModel.Intro), string.Empty, }; @@ -350,7 +350,7 @@ private static List RenderMenu(WelcomeModel model, int width) } lines.Add(model.Problem is null ? string.Empty : $" [{ScreenPalette.Caution}]{Escape(model.Problem)}[/]"); - lines.Add(Label("Or type it on the command line below:")); + lines.Add(Label(WelcomeModel.ExampleLead)); lines.Add(" " + Value(ExampleCommand)); lines.Add(string.Empty); lines.Add(Label(model.LayoutHeading)); @@ -362,9 +362,9 @@ private static List RenderMenu(WelcomeModel model, int width) : $"[{ScreenPalette.Value}] {Escape(name)} [/]"; })); lines.Add(" " + chips); - lines.Add(" " + Label("saved per world · ⌥M changes it later")); + lines.Add(" " + Label(WelcomeModel.LayoutNote)); lines.Add(string.Empty); - lines.Add(Footer(width, "↑↓ select · ←→ layout", "Esc close · ⏎ choose")); + lines.Add(Footer(width, WelcomeModel.MenuKeys.Left, WelcomeModel.MenuKeys.Right)); return lines; } @@ -372,29 +372,30 @@ private static List RenderForm(WelcomeModel model, int width) { var lines = new List { - Accent("Connect to a host"), - Label("Saved as a world, so you can come back to it."), + Accent(WelcomeModel.FormHeading), + Label(WelcomeModel.FormIntro), string.Empty, }; var boxWidth = Math.Clamp(width - 16, 12, 44); var field = model.Field; - lines.Add(Row(field, WelcomeField.Host, "host", Box(model.Host, boxWidth, field == WelcomeField.Host, "mud.example.org"))); - lines.Add(Row(field, WelcomeField.Port, "port", Box(model.Port, 7, field == WelcomeField.Port, null))); - lines.Add(Row(field, WelcomeField.Tls, "TLS", Toggle(model.Tls, "on, encrypted", "off"))); - lines.Add(Row(field, WelcomeField.Character, "character", Box(model.Character, boxWidth, field == WelcomeField.Character, "optional, the name you log in as"))); - lines.Add(Row(field, WelcomeField.Password, "password", Toggle(model.PasswordLater, "save it on F5 after connecting", "type it at the login prompt"))); + lines.Add(Row(field, WelcomeField.Host, Box(model.Host, boxWidth, field == WelcomeField.Host, WelcomeModel.HostPlaceholder))); + lines.Add(Row(field, WelcomeField.Port, Box(model.Port, 7, field == WelcomeField.Port, null))); + lines.Add(Row(field, WelcomeField.Tls, Toggle(model.Tls, WelcomeModel.TlsOn, WelcomeModel.TlsOff))); + lines.Add(Row(field, WelcomeField.Character, Box(model.Character, boxWidth, field == WelcomeField.Character, WelcomeModel.CharacterPlaceholder))); + lines.Add(Row(field, WelcomeField.Password, Toggle(model.PasswordLater, WelcomeModel.PasswordOn, WelcomeModel.PasswordOff))); lines.Add(string.Empty); lines.Add(model.Problem is null ? Label(model.FormLayoutLine) : $"[{ScreenPalette.Caution}]{Escape(model.Problem)}[/]"); lines.Add(string.Empty); - lines.Add(Footer(width, "↑↓ field · Space toggle", "Esc back · ⏎ connect")); + lines.Add(Footer(width, "↑↓ field · Space toggle", WelcomeModel.FormKeys)); return lines; } - private static string Row(WelcomeField current, WelcomeField field, string label, string value) + private static string Row(WelcomeField current, WelcomeField field, string value) { + var label = WelcomeModel.FieldLabel(field); var selected = current == field; var marker = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; return $"{marker} {Pad(selected ? Value(label, bold: true) : Label(label), 11)} {value}"; @@ -426,11 +427,11 @@ private static string Footer(int width, string left, string right) /// public static IReadOnlyList PlainLines(WelcomeLayout layout, string? indexProblem) => [ - "Welcome to SharpMUTerm. No games yet.", + "Welcome to SharpMUTerm. No worlds yet.", "To connect, type /connect, a host and a port, and tls for an encrypted connection: " + ExampleCommand, indexProblem is null - ? "To browse games from the package index, type /package browse" - : "Browsing games is not available: " + indexProblem, + ? "To browse worlds from the package index, type /package browse" + : "Browsing worlds is not available: " + indexProblem, "Starting layout: " + (layout == WelcomeLayout.Suggested ? "suggested from what the game sends" : layout.ToString()) + ". Type /welcome layout roleplay, combat or suggested to change it.", "Type /welcome to hear this again.", diff --git a/tests/SharpMUTerm.Avalonia.Tests/PackagePageTests.cs b/tests/SharpMUTerm.Avalonia.Tests/PackagePageTests.cs index dc9ddb4c..8c9855d4 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/PackagePageTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/PackagePageTests.cs @@ -110,7 +110,7 @@ public async Task ThePageDrawsTheDeclaredFieldsTheCellScreenDraws() await Assert.That(shown).IsEquivalentTo(cells, TUnit.Assertions.Enums.CollectionOrdering.Matching); await Assert.That(shown).IsEquivalentTo(BuiltInSettings.Packages.Packages!.Fields.Select(f => f.Id), TUnit.Assertions.Enums.CollectionOrdering.Matching); await Assert.That(values["scripts"]).IsEqualTo("basics.lua"); - await Assert.That(values["characters"]).IsEqualTo("Corvid (Aetherfall)"); + await Assert.That(values["characters"]).IsEqualTo("Corvid · Aetherfall"); } [Test] @@ -183,7 +183,7 @@ public async Task TheBrowseListComesForwardWhenTheIndexIsAskedForAndInstallIsHan public async Task TheReviewIsTheModelsRowsAndInstallIsTheConsent() { var harness = new Harness(); - var model = PackageReviewModel.From(Contents(), ["Corvid (Aetherfall)"], harness.Config.Packages.Single()); + var model = PackageReviewModel.From(Contents(), ["Corvid · Aetherfall"], harness.Config.Packages.Single()); var (lines, shown, log, gone) = await Run(harness, window => { var page = window.PackagePage!; diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index d4462cd5..28ae8aab 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -943,8 +943,18 @@ public async Task F4TellsTheWindowsTruth() await Assert.That(app.SimulateKey(key!.Value)).IsEqualTo("score"); var hotkeys = string.Join('\n', KeypadScreenRenderer.HotkeysColumn(app.Host.Keys, config.TriggerSets.SelectMany(s => s.Macros).ToList())); - await Assert.That(hotkeys).Contains("Ctrl+3"); - await Assert.That(hotkeys).DoesNotContain("▲ Ctrl+3"); + await Assert.That(hotkeys).Contains("⌃3"); + await Assert.That(hotkeys).DoesNotContain("▲ ⌃3"); + + // The numpad is a key the window delivers: F4 marks no numpad binding dead, and Num7 reaches its macro. + await Assert.That(MacroKeys.Verdict(WindowHost.Keys, "Num7").Fires).IsTrue(); + await Assert.That(hotkeys).DoesNotContain("▲ Num7"); + var numpad = KeyMapper.FromKeyDown(Key.NumPad7, KeyModifiers.None); + await Assert.That(numpad).IsNotNull(); + await Assert.That(numpad!.Value.Key).IsEqualTo(ConsoleKey.NumPad7); + await Assert.That(numpad.Value.KeyChar).IsEqualTo('7'); + var walk = config.TriggerSets.SelectMany(s => s.Macros).First(m => m.Key == "Num7").Command; + await Assert.That(app.SimulateKey(numpad.Value)).IsEqualTo(walk); } /// The quick bar reads the host's keys: a chord the host keeps for itself is drawn as one that does not fire. diff --git a/tests/SharpMUTerm.Client.Tests/CharacterNamesTests.cs b/tests/SharpMUTerm.Client.Tests/CharacterNamesTests.cs new file mode 100644 index 00000000..bdc1e17a --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/CharacterNamesTests.cs @@ -0,0 +1,35 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Tests; + +/// One name for a character on every surface, and never the dotted session key. +public class CharacterNamesTests +{ + [Test] + public async Task ACharacterIsNamedCharacterThenWorld() + { + await Assert.That(CharacterNames.Display("Aetherfall", "Corvid")).IsEqualTo("Corvid · Aetherfall"); + await Assert.That(CharacterNames.Display("Aetherfall", null)).IsEqualTo("Aetherfall"); + } + + [Test] + public async Task ASessionKeyIsResolvedAgainstTheConfigurationSoADottedWorldStillSplits() + { + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "mud.example.org", Host = "mud.example.org", Port = 23 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann" }); + config.Worlds.Add(world); + + await Assert.That(CharacterNames.ForKey("mud.example.org.Ann", config)).IsEqualTo("Ann · mud.example.org"); + await Assert.That(CharacterNames.ForKey("mud.example.org", config)).IsEqualTo("mud.example.org"); + } + + [Test] + public async Task AKeyNothingNamesIsSplitWhereAKeyIsJoined() + { + await Assert.That(CharacterNames.ForKey("Quiet.Cal", (IEnumerable?)null)).IsEqualTo("Cal · Quiet"); + await Assert.That(CharacterNames.ForKey("Quiet", (IEnumerable?)null)).IsEqualTo("Quiet"); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs b/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs index 474add0f..7f53fadb 100644 --- a/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs @@ -12,10 +12,31 @@ public class FuzzyMatchTests public async Task AQueryMatchesWhenItIsASubsequence_IgnoringCase() { await Assert.That(FuzzyMatch.Match("SPLIT", "Split right")).IsNotNull(); - await Assert.That(FuzzyMatch.Match("lgg", "Start logging")).IsNotNull(); + await Assert.That(FuzzyMatch.Match("loggng", "Start logging")).IsNotNull(); await Assert.That(FuzzyMatch.Match("zzz", "Start logging")).IsNull(); } + /// A short word may not scatter its letters across a title: the reported noise for trig. + [Test] + public async Task AShortWordMatchesOnlyAtWordStartsAndRuns() + { + await Assert.That(FuzzyMatch.Match("trig", "Make a trigger from the selection")).IsNotNull(); + await Assert.That(FuzzyMatch.Match("trig", "Stop reading this window aloud")).IsNull(); + await Assert.That(FuzzyMatch.Match("trig", "Start logging")).IsNull(); + await Assert.That(FuzzyMatch.Match("lgg", "Start logging")).IsNull(); + + // Acronyms are word starts, so they still match. + await Assert.That(FuzzyMatch.Match("fp", "Freeze pane")).IsNotNull(); + await Assert.That(FuzzyMatch.Match("sl", "Start logging")).IsNotNull(); + } + + /// A longer word keeps the subsequence rule, where scattered letters are rare enough to mean something. + [Test] + public async Task ALongerWordMayStillScatter() + { + await Assert.That(FuzzyMatch.Match("tstamp", "Show timestamps")).IsNotNull(); + } + [Test] public async Task WordsAreMatchedInOrder_EachAfterTheLast() { @@ -28,17 +49,20 @@ public async Task WordsAreMatchedInOrder_EachAfterTheLast() [Test] public async Task AWholePrefixBeatsAScatteredMatch() { - var prefix = FuzzyMatch.Match("lay", "Layouts")!; - var scattered = FuzzyMatch.Match("lay", "Clear window, say")!; + var prefix = FuzzyMatch.Match("layou", "Layouts")!; + var scattered = FuzzyMatch.Match("layou", "Clear window, say you")!; await Assert.That(prefix.Score).IsGreaterThan(scattered.Score); + + // And a short query cannot scatter at all. + await Assert.That(FuzzyMatch.Match("lay", "Clear window, say")).IsNull(); } [Test] public async Task WordStartsBeatTheMiddleOfAWord() { // f…p at two word starts, against an f and a p buried in words. - var starts = FuzzyMatch.Match("fp", "Freeze pane")!; - var buried = FuzzyMatch.Match("fp", "Self-help")!; + var starts = FuzzyMatch.Match("frzpn", "Freeze pane")!; + var buried = FuzzyMatch.Match("frzpn", "Fur-zip ink")!; await Assert.That(starts.Score).IsGreaterThan(buried.Score); } @@ -74,7 +98,7 @@ public class CommandPaletteModelTests public async Task AnEmptyQueryListsEveryGroupInItsFixedOrder() { var view = CommandPaletteModel.Build("", Items); - await Assert.That(Headers(view)).IsEquivalentTo(new[] { "GO TO", "TERMINAL", "LAYOUT" }, CollectionOrdering.Matching); + await Assert.That(Headers(view)).IsEquivalentTo(new[] { "GO TO", "OUTPUT", "LAYOUT" }, CollectionOrdering.Matching); await Assert.That(view.Entries.Count).IsEqualTo(Items.Length); await Assert.That(view.Total).IsEqualTo(Items.Length); } @@ -100,10 +124,10 @@ await Assert.That(first.TitleMatches) [Test] public async Task TheBestGroupComesFirst_EvenWhenItIsNotTheFirstGroup() { - // "log" is a title prefix only in TERMINAL; GO TO's entry does not match at all. + // "log" is a title prefix only in OUTPUT; GO TO's entry does not match at all. var view = CommandPaletteModel.Build("log", Items); await Assert.That(view.Entries[0].Item.Id).IsEqualTo("term:log-on"); - await Assert.That(Headers(view).First()).IsEqualTo("TERMINAL"); + await Assert.That(Headers(view).First()).IsEqualTo("OUTPUT"); } [Test] diff --git a/tests/SharpMUTerm.Client.Tests/PackageSettingsTests.cs b/tests/SharpMUTerm.Client.Tests/PackageSettingsTests.cs index 4a19f487..417c39f9 100644 --- a/tests/SharpMUTerm.Client.Tests/PackageSettingsTests.cs +++ b/tests/SharpMUTerm.Client.Tests/PackageSettingsTests.cs @@ -117,7 +117,7 @@ public async Task TheFieldsSayWhatThePackageIsAndAdds() await Assert.That(Read("sets")).IsEqualTo("Basics · 1 rule"); await Assert.That(Read("scripts")).IsEqualTo("main.lua"); await Assert.That(Read("media")).IsEqualTo("none"); - await Assert.That(Read("characters")).IsEqualTo("Corvid (Aetherfall)"); + await Assert.That(Read("characters")).IsEqualTo("Corvid · Aetherfall"); await Assert.That(Read("update")).Contains("not checked"); } @@ -160,7 +160,7 @@ public async Task TheReviewLeadsWithWhatCanActAsThePlayer() { var contents = Contents("aether.basics", "Aether basics", "1.0.0", "\"*\"", SendingSet, script: true); - var review = PackageReviewModel.From(contents, ["Corvid (Aetherfall)"], existing: null); + var review = PackageReviewModel.From(contents, ["Corvid · Aetherfall"], existing: null); await Assert.That(review.Title).IsEqualTo("Install package"); await Assert.That(review.Acts).IsTrue(); diff --git a/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs b/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs index 96636e2e..7c913819 100644 --- a/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ClientHostContractTests.cs @@ -66,6 +66,7 @@ public async Task TheCatalogNamesTheHostsNewlineChord() Newline = new HostChord(ConsoleKey.Enter, ConsoleModifiers.Control, "Ctrl+⏎", "Ctrl+Enter"), Reserved = [], ReportsChordsWhole = false, + DeliversNumpad = false, }; await using var app = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(driver, Caps) with { Keys = keys }); diff --git a/tests/SharpMUTerm.Tui.Tests/ConnectionKeysTests.cs b/tests/SharpMUTerm.Tui.Tests/ConnectionKeysTests.cs index 01eae0f8..4d0c912f 100644 --- a/tests/SharpMUTerm.Tui.Tests/ConnectionKeysTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ConnectionKeysTests.cs @@ -386,7 +386,7 @@ public async Task SwitchingToAnOfflineCharacterNamesTheChord() app.DispatchCommand($"char:{Corvid}"); - await Assert.That(app.StatusMarkup).Contains("Alt+R"); + await Assert.That(app.StatusMarkup).Contains("⌥R"); await Assert.That(app.StatusMarkup).Contains("Reconnect"); // the surface is still named too } } diff --git a/tests/SharpMUTerm.Tui.Tests/KeypadScreenRendererTests.cs b/tests/SharpMUTerm.Tui.Tests/KeypadScreenRendererTests.cs index 6f7ff135..fc14b41f 100644 --- a/tests/SharpMUTerm.Tui.Tests/KeypadScreenRendererTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/KeypadScreenRendererTests.cs @@ -76,7 +76,7 @@ public async Task Render_UnboundNumpadCellShowsPlaceholder() public async Task Render_HotkeyListShowsCtrlF1BindingCommandAndEnabledTick() { var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, Scene()); - var row = lines.Single(l => l.Contains("Ctrl+F1")); + var row = lines.Single(l => l.Contains("⌃F1")); await Assert.That(row).Contains("ping"); await Assert.That(row).Contains("✓"); } @@ -85,7 +85,7 @@ public async Task Render_HotkeyListShowsCtrlF1BindingCommandAndEnabledTick() public async Task Render_DisabledHotkeyShowsDimMarker() { var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, Scene()); - var row = lines.Single(l => l.Contains("Ctrl+F2")); + var row = lines.Single(l => l.Contains("⌃F2")); await Assert.That(row).Contains("who"); await Assert.That(row).Contains("[dim]·[/]"); } @@ -114,7 +114,7 @@ public async Task Render_EscapesMarkupBracketsInCommand() new Macro { Name = "Weird", Key = "Ctrl+F9", Enabled = true, Command = "say [hi]" }, }; var lines = KeypadScreenRenderer.Render(HostKeys.Terminal, macros); - var row = lines.Single(l => l.Contains("Ctrl+F9")); + var row = lines.Single(l => l.Contains("⌃F9")); await Assert.That(row).Contains("say [[hi]]"); } } diff --git a/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs b/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs index 923296b6..6f0ed8c7 100644 --- a/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs @@ -159,7 +159,7 @@ public async Task ABindingThatCannotFireIsMarkedOnItsRowAndExplainedInTheFooter( await Assert.That(dead).Contains("▲"); await Assert.That(dead).Contains(ScreenPalette.Muted); - var live = rows.Single(l => l.Contains("Ctrl+F1", StringComparison.Ordinal)); + var live = rows.Single(l => l.Contains("⌃F1", StringComparison.Ordinal)); await Assert.That(live).DoesNotContain("▲"); await Assert.That(rows[0]).Contains("HOTKEYS"); diff --git a/tests/SharpMUTerm.Tui.Tests/NativeModalRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeModalRoutingTests.cs index 8cce79c2..23a4e496 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeModalRoutingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeModalRoutingTests.cs @@ -137,7 +137,7 @@ public async Task TheQuitPromptOpensOverANativeModalAndStayLeavesItOpen() app.SimulateKey(CtrlQ); var quit = modals.Shown.OfType().Single(); await Assert.That(quit.AlwaysInFront).IsTrue(); - await Assert.That(quit.Model.ConnectedCharacters).IsEquivalentTo(new[] { "Quiet.Ann" }); + await Assert.That(quit.Model.ConnectedCharacters).IsEquivalentTo(new[] { "Ann · Quiet" }); await Assert.That(search.IsEnded).IsFalse().Because("the search stays under the prompt"); quit.Answer(false); diff --git a/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs b/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs index 223eb8f6..175ac4c6 100644 --- a/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs @@ -100,7 +100,7 @@ public async Task TheReviewSaysWhatTheArchiveAddsAndInstallsNothingUntilEnter() var text = string.Join("\n", rig.App.PackageView.Lines.Select(MarkupText.Plain)); await Assert.That(text).Contains("1 rule sends commands as you"); await Assert.That(text).Contains("basics.lua"); - await Assert.That(text).Contains("Corvid (Aetherfall)"); + await Assert.That(text).Contains("Corvid · Aetherfall"); await Assert.That(rig.App.Packages.Installed).IsEmpty(); await Assert.That(Directory.Exists(Path.Combine(rig.Root, "packages"))).IsFalse(); diff --git a/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs b/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs index ec4d5da1..31e8128b 100644 --- a/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PaletteDiscoverabilityTests.cs @@ -82,7 +82,7 @@ public async Task KeyClashesAreCountedOnThePalette_AndOpenTheKeypadScreen() await Assert.That(app.DispatchCommand("settings:key-clashes")).IsTrue(); await Assert.That(app.Settings.IsOpen).IsTrue(); var frame = Text(app.RenderWholeFrame()); - await Assert.That(frame).Contains("△ Ctrl+C"); + await Assert.That(frame).Contains("△ ⌃C"); await Assert.That(frame).Contains("hide a client key"); } } diff --git a/tests/SharpMUTerm.Tui.Tests/PaneActivationTests.cs b/tests/SharpMUTerm.Tui.Tests/PaneActivationTests.cs index 47cf8c00..11a69046 100644 --- a/tests/SharpMUTerm.Tui.Tests/PaneActivationTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PaneActivationTests.cs @@ -244,7 +244,7 @@ public async Task TypingInAPaneWithNoSession_ReachesNoWorldAtAll() Send(one.App, "look"); await Assert.That(one.Ann.Lines).IsEmpty(); - await Assert.That(one.App.StatusMarkup).Contains("Quiet.Cal"); + await Assert.That(one.App.StatusMarkup).Contains("Cal · Quiet"); await Assert.That(one.App.StatusMarkup).Contains("nothing was sent"); } @@ -355,7 +355,7 @@ public async Task AWindowWhoseOwnerHasNoSession_RefusesAndNamesWhatWouldOpenIt() await Assert.That(ClickTab(app, "char:Quiet.Cal")).IsTrue(); await Assert.That(app.ActiveSessionKey).IsEqualTo("Quiet.Ann"); // refused, not redirected - await Assert.That(app.StatusMarkup).Contains("Quiet.Cal"); + await Assert.That(app.StatusMarkup).Contains("Cal · Quiet"); await Assert.That(app.StatusMarkup).Contains("no open session"); } diff --git a/tests/SharpMUTerm.Tui.Tests/RailRendererTests.cs b/tests/SharpMUTerm.Tui.Tests/RailRendererTests.cs index 93d26113..3b1b6be7 100644 --- a/tests/SharpMUTerm.Tui.Tests/RailRendererTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/RailRendererTests.cs @@ -85,7 +85,7 @@ public async Task RenderCollapsed_ShowsWorldSeparatorsAndCharacterInitials() { var lines = RailRenderer.RenderCollapsed(Scene()); // Two world separators (▚), and Corvid's initial with a connected dot + unread count. - await Assert.That(lines.Count(l => l.Contains("▚"))).IsEqualTo(2); + await Assert.That(lines.Count(l => l.Contains(RailRenderer.CollapsedWorldMark))).IsEqualTo(2); await Assert.That(lines.Any(l => l.Contains("●") && l.Contains("C") && l.Contains("5"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("○") && l.Contains("R"))).IsTrue(); } diff --git a/tests/SharpMUTerm.Tui.Tests/SessionStateAccountingTests.cs b/tests/SharpMUTerm.Tui.Tests/SessionStateAccountingTests.cs index c5c8b914..4b061b3b 100644 --- a/tests/SharpMUTerm.Tui.Tests/SessionStateAccountingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SessionStateAccountingTests.cs @@ -248,8 +248,8 @@ public async Task TheQuitPromptCountsEveryConnectionRatherThanEveryWorld() var prompt = string.Join("\n", wired.App.QuitPromptLines); await Assert.That(prompt).Contains("2 characters connected"); - await Assert.That(prompt).Contains("Convergence.Mannaz"); - await Assert.That(prompt).Contains("Convergence.Riko"); + await Assert.That(prompt).Contains("Mannaz · Convergence"); + await Assert.That(prompt).Contains("Riko · Convergence"); await Assert.That(prompt).DoesNotContain("1 world connected"); } diff --git a/tests/SharpMUTerm.Tui.Tests/SurfaceCellTests.cs b/tests/SharpMUTerm.Tui.Tests/SurfaceCellTests.cs index d9044013..37f6bd2c 100644 --- a/tests/SharpMUTerm.Tui.Tests/SurfaceCellTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SurfaceCellTests.cs @@ -103,6 +103,6 @@ public async Task F4TellsTheTerminalsTruth() await Assert.That(app.SimulateKey(new ConsoleKeyInfo('3', ConsoleKey.D3, false, false, true))).IsNull(); var hotkeys = string.Join('\n', KeypadScreenRenderer.HotkeysColumn(keys, config.TriggerSets.SelectMany(s => s.Macros).ToList())); - await Assert.That(hotkeys).Contains("▲ Ctrl+3"); + await Assert.That(hotkeys).Contains("▲ ⌃3"); } } diff --git a/tests/SharpMUTerm.Tui.Tests/WaveTenTests.cs b/tests/SharpMUTerm.Tui.Tests/WaveTenTests.cs new file mode 100644 index 00000000..aea76586 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/WaveTenTests.cs @@ -0,0 +1,163 @@ +using System.Text.RegularExpressions; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The pins for the ux-wave9 audit's findings this wave closed: boundary bars as wide as their pane (#3), a pane +/// line's plain text read from its spans (#9), F4's keys in glyphs (#13), the numpad in the window (#19), the +/// collapsed rail's initials and world mark (#17) and the ⌃F and F4 footers' drop-order ladders (#23). +/// +[NotInParallel] +public class WaveTenTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp Demo(int width, int height, string? view = null) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ScrollbackSpill.Enabled = false; + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); + app.RenderSnapshot(view); + return app; + } + + // ── #3: the bars fill their pane ─────────────────────────────────────────────────────────────── + + [Test] + [Arguments(30)] + [Arguments(72)] + [Arguments(140)] + public async Task EveryBoundaryBarIsExactlyAsWideAsItsPane(int width) + { + string[] bars = + [ + AwayBarRenderer.Bar(37, TimeSpan.FromMinutes(12), "#c678dd", width), + AwayBarRenderer.Missed(3, "#c678dd", width), + SearchBarRenderer.Bar("goblin", 2, 3, "#c678dd", width), + RestoreBarRenderer.Bar(500, DateTimeOffset.Now, "#c678dd", width), + ]; + + foreach (var bar in bars) + { + await Assert.That(MarkupText.VisibleLength(bar)).IsEqualTo(width).Because(bar); + } + } + + [Test] + public async Task ANarrowPaneElidesTheWordsBeforeTheBarCouldWrap() + { + var bar = AwayBarRenderer.Bar(37, TimeSpan.FromMinutes(12), "#c678dd", 24); + await Assert.That(MarkupText.VisibleLength(bar)).IsEqualTo(24); + await Assert.That(bar).Contains("…"); + await Assert.That(bar).Contains(AwayBarRenderer.Label); + } + + [Test] + public async Task AnUnarrangedPaneKeepsTheOldRule() + { + var bar = AwayBarRenderer.Missed(3, "#c678dd"); + await Assert.That(bar).Contains(new string('─', BarRule.Fallback)); + } + + /// The live bar is drawn at the pane's viewport width, and redrawn when that width changes. + [Test] + public async Task TheActivityBarSpansThePaneAt80Columns() + { + await using var app = Demo(80, 24, "activity-bar"); + var row = app.PaneLines("main").Single(l => l.Contains(AwayBarRenderer.MissedLabel, StringComparison.Ordinal)); + var width = app.BarWidth("main"); + await Assert.That(width).IsGreaterThan(0); + await Assert.That(MarkupText.VisibleLength(row)).IsEqualTo(width); + } + + // ── #9: plain text is the line's own ─────────────────────────────────────────────────────────── + + [Test] + public async Task AHighlightedLineStillMatchesItsOwnAnchoredPattern() + { + await using var app = Demo(120, 32); + var lines = app.TriggerTestLines(); + await Assert.That(lines.Any(l => Regex.IsMatch(l, @"^\[public\] (.+)$"))).IsTrue(); + await Assert.That(lines.Any(l => l.Contains('▌', StringComparison.Ordinal))).IsFalse(); + } + + [Test] + public async Task SearchResultsShowNoRuleGlyph() + { + await using var app = Demo(120, 32); + var model = app.SearchModelFor("Rivane: to the crypt", regex: false, all: true); + await Assert.That(model.Rows.Count).IsGreaterThan(0); + foreach (var row in model.Rows) + { + await Assert.That(row.Text).DoesNotContain("▌"); + } + } + + // ── #13 / #19: F4's keys ──────────────────────────────────────────────────────────────────────── + + [Test] + public async Task F4SpellsABindingsKeyInGlyphs() + { + var macros = new List { new() { Name = "score", Key = "Ctrl+F1", Command = "score", Enabled = true } }; + var lines = KeypadScreenRenderer.HotkeysColumn(HostKeys.Terminal, macros); + await Assert.That(lines.Any(l => l.Contains("⌃F1", StringComparison.Ordinal))).IsTrue(); + await Assert.That(lines.Any(l => l.Contains("Ctrl+F1", StringComparison.Ordinal))).IsFalse(); + } + + [Test] + public async Task ANumpadKeyFiresOnlyOnAHostThatDeliversIt() + { + var window = HostKeys.Terminal with { ReportsChordsWhole = true, DeliversNumpad = true }; + await Assert.That(MacroKeys.Verdict(HostKeys.Terminal, "Num7").Fires).IsFalse(); + await Assert.That(MacroKeys.Verdict(window, "Num7").Fires).IsTrue(); + } + + // ── #17: the collapsed rail ───────────────────────────────────────────────────────────────────── + + [Test] + public async Task TheCollapsedRailGivesTwoLettersOnlyWhenTwoNamesShareOne() + { + await Assert.That(RailRenderer.InitialLength(["Corvid", "Rivane", "Thorn"])).IsEqualTo(1); + await Assert.That(RailRenderer.InitialLength(["Corvid", "Rivane", "Riko"])).IsEqualTo(2); + await Assert.That(RailRenderer.Initials("Riko", 2)).IsEqualTo("Ri"); + await Assert.That(RailRenderer.Initials("R", 2)).IsEqualTo("R "); + } + + [Test] + public async Task TwoSameInitialCharactersCanBeToldApartOnTheCollapsedRail() + { + var rows = new List + { + new(RailRowKind.World, 0, "Aetherfall", Target: "rail:w"), + new(RailRowKind.Character, 1, "Rivane", Target: "rail:a"), + new(RailRowKind.Character, 1, "Riko", Target: "rail:b"), + }; + var lines = RailRenderer.RenderCollapsed(rows); + var text = lines.Select(MarkupText.Plain).ToList(); + await Assert.That(text.Any(l => l.Contains("Ri", StringComparison.Ordinal) && l.Contains("○", StringComparison.Ordinal))).IsTrue(); + await Assert.That(text[0]).Contains(RailRenderer.CollapsedWorldMark); + await Assert.That(text[1].Length).IsEqualTo(text[2].Length); + await Assert.That(string.Join("\n", text)).DoesNotContain("▚"); + } + + // ── #23: footers do not clip at 80 ────────────────────────────────────────────────────────────── + + [Test] + public async Task TheSearchFooterFitsAnEightyColumnSurfaceWholeKeysAndAll() + { + var footer = SearchPrompt.HintsFor(74); + await Assert.That(footer.Length).IsLessThanOrEqualTo(74); + await Assert.That(footer).EndsWith("⌃F closes"); + foreach (var key in new[] { "↑↓", "⏎", "⌥E", "⌥A", "Esc", "⌃F" }) + { + await Assert.That(SearchPrompt.HintsFor(SearchSurface.MinimumWidth)).Contains(key); + } + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs index 5bc5587f..03ea255c 100644 --- a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs @@ -85,7 +85,7 @@ public async Task AClientWithNoWorldsOpensOnTheWelcomeAndKeepsTheNotice() await Assert.That(run.App.WelcomeIsOpen).IsTrue(); var text = string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain)); - await Assert.That(text).Contains("Connect to a host").And.Contains("Browse games").And.Contains("Open settings"); + await Assert.That(text).Contains("Connect to a world").And.Contains("Browse worlds").And.Contains("Open settings"); await Assert.That(text).Contains(WelcomeSurface.ExampleCommand); await Assert.That(run.App.StatusMarkup).Contains("No world configured"); } From f2eca9108c471e922b9075d1e649c77da1e20fe1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 10:59:03 +0000 Subject: [PATCH 039/113] Notices, status row, toasts, tab overflow, one-row input, composer length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Notices: a notice repeated while still on the row is said once; the status row is elided to its width in both hosts so it never wraps. - Window toasts avoid native quick bars and docked composers and are hidden while settings, Ctrl+P, a native modal or the quit prompt is open. - Join wraps: a pane narrower than the server's learnt wrap column gets a once-per-world notice with a "Join wraps" action (world:join-wraps:); never switched on by default. - Tab overflow chip "+N ▾" painted over a strip's clipped last cells, listing hidden tabs: native menu in the window, cell list in a terminal. Declared as SurfaceCatalog.TabOverflow. - InputSettings.Rows defaults to 1. - Composer: "N chars" (as sent) in F1 and the docked panel in both hosts; Alt+P toggles an "as sent" preview in F1, cells and native. New compose-preview view. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 12 + CLAUDE.md | 29 ++- src/SharpMUTerm.Avalonia/ComposerView.cs | 77 ++++++- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 18 ++ src/SharpMUTerm.Avalonia/MainWindow.cs | 4 + src/SharpMUTerm.Avalonia/TerminalView.cs | 6 +- src/SharpMUTerm.Avalonia/WindowPointer.cs | 12 + .../Commands/BuiltInCommands.cs | 7 + .../Composer/ComposerModel.cs | 37 ++- .../Composer/ComposerSession.cs | 12 + .../Surfaces/SurfaceCatalog.cs | 17 ++ .../Configuration/PreferenceSettings.cs | 7 +- src/SharpMUTerm.Core/Session/WorldSession.cs | 13 ++ src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs | 7 +- src/SharpMUTerm.Tui/ComposeOverlay.cs | 134 ++++++++++- src/SharpMUTerm.Tui/Panels/DockedComposer.cs | 9 +- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 12 + .../Pointer/SharpMUTermApp.Pointer.cs | 7 + .../SharpMUTermApp.JoinWraps.cs | 66 ++++++ .../SharpMUTermApp.NativeComposer.cs | 11 +- .../SharpMUTermApp.TabOverflow.cs | 214 ++++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 38 +++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- .../NativeComposerTests.cs | 24 ++ .../NoticeToastTests.cs | 40 ++++ .../SurfaceParityTests.cs | 40 +++- .../SurfaceCatalogTests.cs | 2 +- .../ComposerLengthTests.cs | 85 +++++++ .../InputAreaLayoutTests.cs | 7 +- .../NativeComposerRoutingTests.cs | 2 +- tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs | 120 ++++++++++ .../SharpMUTerm.Tui.Tests/ScreenModelTests.cs | 2 +- .../SharpMUTerm.Tui.Tests/TabOverflowTests.cs | 109 +++++++++ 33 files changed, 1146 insertions(+), 36 deletions(-) create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/ComposerLengthTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b4db941..b2136fca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- A tab strip too narrow for its tabs now says how many it could not draw (`+3 ▾` at its right edge); click it to + list them and go to one — a menu in the desktop window, a short list in a terminal. +- The composer shows how many characters the post will be once escaped and joined, and Alt+P shows exactly what will + be sent (both in the terminal and in the desktop window). +- When a pane is narrower than the line width a game wraps at, the client says so once and offers to turn on + "join wraps" for that world. + - Desktop window: the map, vitals, who is here and the quick bar can be popped out into windows of their own — from the button in the panel's corner, the pane's right-click menu, or Ctrl+P ▸ Pop out. The output takes the room back, the floating window works exactly like the panel did, typing in it still goes to the command line, and closing it @@ -266,6 +273,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The command line starts as one row and grows as you type; a height you set before is kept. +- The status row no longer wraps onto a second row when a message is long; it is shortened to fit. +- The same message said twice in a row is shown once. In the desktop window, notification cards no longer cover the + quick bar or the composer, and are hidden while settings, Ctrl+P or a dialog is open. + - Panes stacked one above the other no longer have an empty row between them when the lower pane shows its tabs: the tab row is the boundary, and the panes get the row back. Drag the empty part of that tab row to resize, or double-click it to even the panes out. The vitals and quick-bar strips sit flush against their diff --git a/CLAUDE.md b/CLAUDE.md index 63dc629b..a82e0129 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -550,7 +550,11 @@ fallbacks) for inline images/maps. - **Below 100 columns the layout is narrow** (`SharpMUTermApp.Narrow.cs`; `NarrowColumns`, `ShortRows`; `NarrowLayoutTests`). The rail folds itself to its strip, and below 100 columns *or* 30 rows an empty command line is one row (`SyncInputHeights`: `MinRows` becomes `InputSettings.MinRows`; it still grows to `MaxRows` as it wraps). - At 80×24 that is a 72-column pane instead of 60 and two more output rows. Decisions not to relitigate: + At 80×24 that is a 72-column pane instead of 60 and two more output rows. **`InputSettings.Rows` now defaults to 1 + too**, so a fresh client's command line is one row everywhere and grows as it wraps; a saved value is kept. + **The window's native sidebar folds by the same rule** (verified under Xvfb at `--size 60x24` and on a live resize): at + `--size 80x24` the window is ~102 columns wide with its sidebar, so it stays open and the pane is the 80 columns the + rule protects. Decisions not to relitigate: - **100 because of the server's wrap width**: the open rail, divider and spacer cost ~20 columns, so 100 still leaves the pane 80; below it a world's 80-column text orphans a word on every other row. 30 rows because above it the output keeps 24 rows with a three-row bar. Height never folds the rail. @@ -1383,6 +1387,29 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw (the default voice of `Notice`). Edge colours are the accent, `ScreenPalette.Warn` and the notice ink, held to 4.5:1 on the status plane because they also ink the key chip and the action line. - The message log (⌃P ▸ *Show client messages*) stays the history; a toast keeps nothing. + - **A notice said again while it is still on the row is said once** (`Notice` compares text, key, severity and action + with `_noticeShown`): the timer restarts, nothing is logged, announced or published twice. That was the audit's + "notices show twice" — the row-plus-toast pair is the design above, the repeat was not. + - **The row is elided to its width in both hosts** (`FitStatusRow` in `PaintStatus`), so no notice can wrap it + (`NoticeFitTests`, 80×24 down to 40×12). + - **Toasts stay off what is being used and are hidden under a modal.** Besides the map's legend, `SyncToasts` avoids the + native quick bars and docked composers; `DesktopLayer.ToastsHidden` (set by `MainWindow`: settings window, ⌃P, a + native modal or the quit prompt) hides the stack rather than leaving it clipped under a window. F1 keeps them (it + sits under the layer). The toast keeps its clock while hidden. +- **A pane narrower than its server's wrap is told about join wraps, once per world per run** (`SuggestJoinWraps`, + `SharpMUTermApp.JoinWraps.cs`; `WorldSession.ServerWrapColumn`, now learnt whether or not the world joins). Checked on + every pane-size report; the notice's action is `world:join-wraps:`. **Suggested, never on by default**: a false + join is invisible and worse than a missed one, and whether a world's output is prose is the player's call. +- **A strip that cannot draw every tab shows `+N ▾` at its right edge** (`SharpMUTermApp.TabOverflow.cs`; + `SurfaceCatalog.TabOverflow`, a `MenuModel`). Hidden tabs are read off `FrameworkHitTests.TabAt` over the strip just + painted, and the chip is painted after the frame over the strip's own last (clipped) cells, so no cell, pane or NAWS + moves. A click opens a native menu in the window (`IPointerPresenter.ShowMenu(cell, MenuModel, dispatch)`) and a cell + list (`_sendMenu`, digits) in a terminal; each entry is `win:` through `RunTabOverflowEntry`, which refuses what + the list did not offer. The keyboard's way to a hidden tab is ⌃P *Go to …* or ⌃N. +- **The composer says how long the post is as sent, and ⌥P shows it** (`ComposerModel.Characters`/`SentLength`, the + escaped and `%r`-joined command; a MOO edit counts its text). F1 and the docked panel carry the `N chars` cell in both + hosts; ⌥P toggles an *as sent* band under F1 (`ComposeOverlay.Preview`, run-wide, shared with the native editor via + `ComposerSession.TogglePreview`; not for a MOO edit). The `compose-preview` view. - **Every surface that names a key is read once per host** (`EverySurfaceNamesThisHostsKeys`): ⌃P and `--help` must name the host's newline and none of the chords the host keeps (`HostKeys.Reserved`, which `TerminalView` acts on, so the window's chords and the list are one). The help page is one writer diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 322669d8..5414d506 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -41,6 +41,10 @@ internal sealed class ComposerView : Border private readonly TextBlock _title; private readonly TextBlock _target; private readonly StackPanel _chips; + private readonly TextBlock _count; + private readonly Border _preview; + private readonly TextBlock _previewHeading; + private readonly TextBlock _previewText; private readonly Border _footer; private readonly WrapPanel _keys; private readonly Border _rule; @@ -78,10 +82,13 @@ public ComposerView(TerminalView view, bool fullScreen) _title = new TextBlock { FontWeight = FontWeight.Bold, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 10, 0) }; _target = new TextBlock { VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; _chips = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, VerticalAlignment = VerticalAlignment.Center }; + _count = new TextBlock { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(10, 0, 0, 0) }; var headerRow = new DockPanel { LastChildFill = true }; DockPanel.SetDock(_title, Dock.Left); + DockPanel.SetDock(_count, Dock.Right); DockPanel.SetDock(_chips, Dock.Right); headerRow.Children.Add(_title); + headerRow.Children.Add(_count); headerRow.Children.Add(_chips); headerRow.Children.Add(_target); _header = new Border { Child = headerRow, Padding = fullScreen ? new Thickness(22, 10) : new Thickness(12, 3, 8, 3) }; @@ -89,6 +96,17 @@ public ComposerView(TerminalView view, bool fullScreen) _keys = new WrapPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center }; _footer = new Border { Child = _keys, Padding = fullScreen ? new Thickness(22, 8) : new Thickness(12, 2, 8, 3) }; + // F1's as-sent preview (⌥P): the one command ⌃S sends, in the editor's face, under the editor. + _previewHeading = new TextBlock { Text = "AS SENT", FontWeight = FontWeight.Bold, Margin = new Thickness(0, 0, 0, 4) }; + _previewText = new TextBlock { TextWrapping = TextWrapping.Wrap, MaxLines = 4, TextTrimming = TextTrimming.CharacterEllipsis }; + _preview = new Border + { + Child = new StackPanel { Children = { _previewHeading, _previewText } }, + Padding = new Thickness(22, 8), + IsVisible = false, + }; + AutomationProperties.SetName(_preview, "As sent"); + // The armed rule down the docked editor's left edge: the cell composer's ▌ marker, in the accent. _rule = new Border { Width = 3, HorizontalAlignment = HorizontalAlignment.Left }; @@ -97,12 +115,14 @@ public ComposerView(TerminalView view, bool fullScreen) body.Children.Add(_marks); body.Children.Add(_rule); - var grid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto") }; + var grid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto,Auto") }; Grid.SetRow(_header, 0); Grid.SetRow(body, 1); - Grid.SetRow(_footer, 2); + Grid.SetRow(_preview, 2); + Grid.SetRow(_footer, 3); grid.Children.Add(_header); grid.Children.Add(body); + grid.Children.Add(_preview); grid.Children.Add(_footer); Child = grid; ApplyFont(); @@ -132,7 +152,7 @@ public ComposerView(TerminalView view, bool fullScreen) internal ComposerSession? Session => _session; /// The header's words, joined, for a test. - internal string HeaderText => string.Join(" ", new[] { _title.Text, _target.Text } + internal string HeaderText => string.Join(" ", new[] { _title.Text, _target.Text, _count.Text } .Concat(_chips.Children.OfType().Select(b => (b.Child as TextBlock)?.Text)).Where(t => !string.IsNullOrEmpty(t))); /// The key row's words, joined, for a test. @@ -242,8 +262,14 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col } } + /// The header's length cell as drawn. Internal for tests. + internal string CountText => _count.Text ?? string.Empty; + + /// The as-sent preview's command, or null while it is hidden. Internal for tests. + internal string? PreviewText => _preview.IsVisible ? _previewText.Text : null; + private static bool SameChrome(ComposerModel a, ComposerModel b) => - a.Target == b.Target && a.Escaping == b.Escaping && a.Edit == b.Edit && a.Dictionary == b.Dictionary + a.Preview == b.Preview && a.Target == b.Target && a.Escaping == b.Escaping && a.Edit == b.Edit && a.Dictionary == b.Dictionary && a.CanSend == b.CanSend && a.Armed == b.Armed && a.Keys.SequenceEqual(b.Keys) && a.Verb == b.Verb; // ── drawing ────────────────────────────────────────────────────────────────────────────── @@ -274,6 +300,12 @@ private void Paint() _editor.MarkColour = Warn; _title.Foreground = new SolidColorBrush(Accent); _target.Foreground = new SolidColorBrush(_text); + _count.Foreground = new SolidColorBrush(Dim); + _preview.Background = new SolidColorBrush(Band); + _preview.BorderBrush = _header.BorderBrush; + _preview.BorderThickness = new Thickness(0, 1, 0, 0); + _previewHeading.Foreground = new SolidColorBrush(Accent); + _previewText.Foreground = new SolidColorBrush(_text); _marks.InvalidateVisual(); } @@ -283,6 +315,10 @@ private void ApplyFont() var ui = Math.Clamp(cell * 0.72, 11, 15); _title.FontSize = ui; _target.FontSize = ui; + _count.FontSize = ui - 1; + _previewHeading.FontSize = ui - 1.5; + _previewText.FontSize = Math.Clamp(cell * 0.72, 11, 16); + _previewText.FontFamily = new FontFamily($"{_view.Renderer.Fonts.FamilyName}, {CellFonts.BundledFamily}, DejaVu Sans Mono, Liberation Mono, Consolas, Menlo, monospace"); _editor.FontSize = Proportional ? Math.Clamp(cell * 0.86, 12, 19) : Math.Clamp(cell * 0.8, 11, 18); _editor.FontFamily = Proportional ? FontFamily.Default @@ -322,6 +358,9 @@ private void Label(ComposerModel model) } } + _preview.IsVisible = _fullScreen && model.Preview && model.Edit is null; + SyncLength(); + _keys.Children.Clear(); var narrow = !_fullScreen && Bounds.Width is > 0 and < 560; foreach (var key in model.Keys) @@ -370,8 +409,29 @@ protected override void OnSizeChanged(SizeChangedEventArgs e) // ── text ───────────────────────────────────────────────────────────────────────────────── + /// + /// The length cell and the preview, from the editor's own text: the model catches up with typing a moment later, and + /// a count that lagged a keystroke would read as wrong. Counted by , the cells' rule. + /// + private void SyncLength() + { + if (_model is not { } model) + { + return; + } + + var text = _editor.Text ?? string.Empty; + _count.Text = ComposerModel.CharactersLabel(ComposerModel.SentLength(text, model.Escaping, model.Edit is not null)); + if (_preview.IsVisible) + { + var command = ComposeMessage.Build(text.Replace("\r\n", "\n", StringComparison.Ordinal), model.Escaping); + _previewText.Text = command ?? "nothing yet"; + } + } + private void OnTextChanged() { + SyncLength(); var text = _editor.Text ?? string.Empty; if (_session is { } session) { @@ -424,6 +484,15 @@ private void OnEditorKeyDown(object? sender, KeyEventArgs e) session.ToggleEscaping(); return; + case (Key.P, KeyModifiers.Alt): + e.Handled = true; + if (_fullScreen) + { + session.TogglePreview(); + } + + return; + case (Key.W, KeyModifiers.Alt): e.Handled = true; if (session.CanAddWords && ComposerMarks.WordAt(text, _editor.CaretIndex) is { } word) diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index 5855ff4a..be0d0b8d 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -192,9 +192,27 @@ private void SyncToasts(ScreenFrame frame, Size cell) } } + // The native quick bars and docked composers too: a quick bar's keys and the post being typed are what a toast must + // never sit on, so a toast is lifted above them as it is above a legend. + foreach (var view in _quickBars.Values.Cast().Concat(_composers.Values)) + { + if (view.IsVisible && view.Width > 0 && view.Height > 0) + { + avoid.Add(new Rect(GetLeft(view) - origin.X, GetTop(view) - origin.Y, view.Width, view.Height)); + } + } + _toasts.Avoid = avoid; + + // Hidden, not stacked under it, while something modal is in front: a settings window is a window of its own and a + // toast under it showed as a clipped fragment past its edge, and ⌃P and the modals have a scrim the toast would sit + // on. The status row still says the notice, and the toast keeps its clock, so it is gone when its time is. + _toasts.IsVisible = !(ToastsHidden?.Invoke() ?? false) && _pointer.Chrome is not { Interactive: false }; } + /// Whether something modal the window draws is in front, which hides the toasts. Set by the main window. + internal Func? ToastsHidden { get; set; } + /// The notice toasts. Internal for tests. internal NoticeToasts Toasts => _toasts; diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index 883cce30..37b02263 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -86,6 +86,10 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime // this window forward. ⌃Q from any other modal goes to the client, which opens the prompt over it. _driver.Modals.Attach(this, root, () => layer.FocusArmedComposer(), key => _driver.RaiseKey(key)); + // No toast while settings, ⌃P or a modal is in front of the cells (F1 keeps them: it sits under the layer). + layer.ToastsHidden = () => _driver.Settings.Window is not null || _driver.Palette.Overlay is not null + || _driver.Modals.Modal is not null || _driver.Modals.Quit is not null; + // Panels popped out into windows of their own, owned by this one so they stay above it and go with it. _driver.Floating.Attach(this, _view); Closed += (_, _) => _driver.Floating.Detach(); diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index fe9bfda6..588f0364 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -91,6 +91,7 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba InvalidateVisual(); }); pointer.MenuRequested += (_, items) => Dispatcher.UIThread.Post(() => OpenMenu(items)); + pointer.ModelMenuRequested += (_, menu, dispatch) => Dispatcher.UIThread.Post(() => OpenMenu(NativeMenu.Build(menu, dispatch, PlacementMode.Pointer, this))); } /// @@ -579,10 +580,11 @@ private void CloseTip() } /// The client's right-click menu, as a native one. Each entry runs on the client's thread by itself. - private void OpenMenu(IReadOnlyList items) + private void OpenMenu(IReadOnlyList items) => OpenMenu(NativeMenu.Build(items, PlacementMode.Pointer, this)); + + private void OpenMenu(ContextMenu menu) { CloseTip(); - var menu = NativeMenu.Build(items, PlacementMode.Pointer, this); menu.Closed += (_, _) => Focus(); OpenedMenu = menu; menu.Open(this); diff --git a/src/SharpMUTerm.Avalonia/WindowPointer.cs b/src/SharpMUTerm.Avalonia/WindowPointer.cs index 5ee7ab6b..4a3e1b33 100644 --- a/src/SharpMUTerm.Avalonia/WindowPointer.cs +++ b/src/SharpMUTerm.Avalonia/WindowPointer.cs @@ -56,6 +56,18 @@ public void Hover(PointerTarget target) public void ShowMenu(System.Drawing.Point cell, IReadOnlyList items) => MenuRequested?.Invoke(cell, items); + /// Raised on the client's thread when a menu the client built as data (the tab overflow list) is asked for. + public event Action>? ModelMenuRequested; + + /// The last menu-as-data the client asked for, with its way back. Internal for tests. + internal (SharpMUTerm.Client.Commands.MenuModel Menu, Action Dispatch)? LastModelMenu { get; private set; } + + public void ShowMenu(System.Drawing.Point cell, SharpMUTerm.Client.Commands.MenuModel menu, Action dispatch) + { + LastModelMenu = (menu, dispatch); + ModelMenuRequested?.Invoke(cell, menu, dispatch); + } + public bool DrawsMenus => true; private int _windowColumns; diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 2cf52d0d..09ccf3aa 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -20,6 +20,12 @@ public static class BuiltInCommands /// The command that moves the keyboard into the connection sidebar (⌥C). public const string RailKeysCommand = "layout:rail-keys"; + /// + /// Turns F5's join wraps on for the world named after the prefix: the action of the notice that says a pane is + /// narrower than the server's wrap column. Lists nothing on ⌃P (F5 is the setting's home). + /// + public const string JoinWrapsPrefix = "world:join-wraps:"; + /// /// Registers every built-in command. does the work for an id and returns false when /// it did not do what the label promised; it is called for every id these contributions handle, offered or not. @@ -71,6 +77,7 @@ void Family(string id, string prefix, Func []); Add("world:reload-scripts", CommandGroup.World, "Reload scripts", detail: "re-reads this character's Lua files", when: c => c.State.ScriptsOn); diff --git a/src/SharpMUTerm.Client/Composer/ComposerModel.cs b/src/SharpMUTerm.Client/Composer/ComposerModel.cs index b1a556d3..ab08cebb 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerModel.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerModel.cs @@ -72,6 +72,30 @@ public sealed record ComposerModel( /// What ⌃S sends for this draft: , or null for nothing (or an edit). public string? Command => Edit is null ? ComposeMessage.Build(Body, Escaping) : null; + /// + /// Whether F1 shows the post as it will be sent (⌥P) — the %r-joined, escaped command — under the editor. The + /// client's toggle for the run, never saved; always false for the docked panel and a MOO edit. + /// + public bool Preview { get; init; } + + /// The header's length cell for this draft: . + public int Characters => SentLength(Body, Escaping, Edit is not null); + + /// + /// How long a draft is as the game will get it: the length of 's command, with its + /// %r breaks and its escapes, because that is what a board's length limit counts. A MOO edit is saved as its + /// lines, so it counts its text. A host editor that holds text the model has not caught up with asks this directly. + /// + public static int SentLength(string body, ComposeEscaping escaping, bool edit) + { + ArgumentNullException.ThrowIfNull(body); + body = body.Replace("\r\n", "\n", StringComparison.Ordinal); + return edit ? body.TrimEnd('\n').Length : ComposeMessage.Build(body, escaping)?.Length ?? 0; + } + + /// The length cell's words: 1 char, 240 chars. + public static string CharactersLabel(int count) => count == 1 ? "1 char" : $"{count:N0} chars"; + /// /// The verb the post starts with — +pose, say — for the docked header, so a reader can see what the /// buffer will be sent as without reading it. Empty for an empty buffer. @@ -93,7 +117,8 @@ public static ComposerModel Create( SpellChecker? spelling, bool canSend, bool armed, - long revision) + long revision, + bool preview = false) { ArgumentNullException.ThrowIfNull(target); ArgumentNullException.ThrowIfNull(body); @@ -110,11 +135,15 @@ public static ComposerModel Create( armed, revision, ComposerMarks.For(body, checker), - KeysFor(place, edit is not null, checker is not null, canSend, armed)); + KeysFor(place, edit is not null, checker is not null, canSend, armed, preview)) + { + Preview = preview && place == ComposerPlace.FullScreen && edit is null, + }; } /// The key row for a composer in this state. - public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, bool dictionary, bool canSend, bool armed) + /// Whether F1's as-sent preview is showing, which names what ⌥P does next. + public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, bool dictionary, bool canSend, bool armed, bool preview = false) { if (place == ComposerPlace.Docked) { @@ -153,6 +182,7 @@ public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, keys.Add(new("⌥W", "add word")); } + keys.Add(new("⌥P", preview ? "hide as sent" : "as sent")); keys.Add(new("Esc", "close (keeps the draft)")); return keys; } @@ -179,6 +209,7 @@ other is not null && CanSend == other.CanSend && Armed == other.Armed && Revision == other.Revision + && Preview == other.Preview && Marks.SequenceEqual(other.Marks) && Keys.SequenceEqual(other.Keys); diff --git a/src/SharpMUTerm.Client/Composer/ComposerSession.cs b/src/SharpMUTerm.Client/Composer/ComposerSession.cs index f5868763..f0f9f9c3 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerSession.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerSession.cs @@ -18,6 +18,9 @@ public sealed record ComposerCallbacks /// ⌥L. public Action? ToggleEscaping { get; init; } + /// ⌥P: F1's as-sent preview on or off. Null for a composer with none (the docked panel). + public Action? TogglePreview { get; init; } + /// ⌥W, or the menu's Add to dictionary, with the word. public Action? AddWord { get; init; } @@ -127,6 +130,15 @@ public void ToggleEscaping() } /// The host's: ⌥W on . + /// ⌥P: shows or hides the post as it will be sent. Nothing for a MOO edit, or a session the client ended. + public void TogglePreview() + { + if (Model.Edit is null && !IsEnded) + { + _callbacks.TogglePreview?.Invoke(); + } + } + public void AddWord(string word) { if (CanAddWords && !string.IsNullOrWhiteSpace(word)) diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 3d6938bb..2bf3de40 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -180,6 +180,12 @@ public static class SurfaceCatalog /// The first-run welcome and its connect form. public const string Welcome = "welcome"; + /// + /// The +3 ▾ chip a tab strip carries when its tabs do not fit even at their floors, and the list of the tabs + /// past its edges it opens: a cell list in a terminal, a native menu in the window (the chip itself is cells in both). + /// + public const string TabOverflow = "tab-overflow"; + /// /// A panel popped out into a window of its own (the desktop window only; a terminal keeps every panel in its /// region). The frame around the panel's own native view: its title, whose it is, and the way back. @@ -449,6 +455,17 @@ public static class SurfaceCatalog NativeModal, "SharpMUTerm.Tui.WelcomeSurface.Render", ModalViews("WelcomeView")), + new( + TabOverflow, + typeof(MenuModel), + [ + // Each entry is a hidden tab's window, run through the registry (win:, the ⌃P "Go to …" entry), and + // refused if the chip did not offer it. + new(SurfaceActionKind.Command, SharpMUTerm.Core.Commands.CommandIds.WindowPrefix, "RunTabOverflowEntry"), + ], + CellsUnderNative, + "SharpMUTerm.Tui.SharpMUTermApp.TabOverflowLines", + ["SharpMUTerm.Avalonia.NativeMenu"]), new( FloatingPanel, typeof(FloatingPanelModel), diff --git a/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs b/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs index 258f9da3..4c7df969 100644 --- a/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs +++ b/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs @@ -217,10 +217,11 @@ public sealed class InputSettings public bool ExcludeCredentials { get; set; } = true; /// - /// How many lines tall the command line is before anything is typed into it. Three by default, so - /// a wrapped line has somewhere to wrap to without the input resizing on the first keystroke. + /// How many lines tall the command line is before anything is typed into it. One by default: the bar + /// grows a row at a time as a line wraps (up to ), so the rows it would hold empty at + /// rest go to the output instead. A configuration that saved another value keeps it. /// - public int Rows { get; set; } = 3; + public int Rows { get; set; } = 1; /// /// The most lines the command line grows to as it wraps. Past this it scrolls inside itself rather diff --git a/src/SharpMUTerm.Core/Session/WorldSession.cs b/src/SharpMUTerm.Core/Session/WorldSession.cs index ab0f9499..6f50a638 100644 --- a/src/SharpMUTerm.Core/Session/WorldSession.cs +++ b/src/SharpMUTerm.Core/Session/WorldSession.cs @@ -603,6 +603,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) // timer still pending checks it is releasing for this joiner before it does anything. _reflowRelease?.Dispose(); _wrapJoiner = new ServerWrapJoiner(); + _serverWrapColumn = 0; // Re-read with the parser, so an F5 change to the world's emoji switches reaches the next connection. _emoji = NewEmoji(World.Emoji); @@ -696,6 +697,14 @@ private void OnOutputReceived(object? sender, TelnetOutputEventArgs e) /// private ServerWrapJoiner _wrapJoiner = new(); + /// + /// The column this connection's server wraps its text at, as has learnt it + /// (whether or not this world joins), or null while it is unknown. Written on the read loop, read on any thread. + /// + public int? ServerWrapColumn => Volatile.Read(ref _serverWrapColumn) is > 0 and var column ? column : null; + + private int _serverWrapColumn; + /// /// Serialises the read loop (output, a parser swap, the disconnect) against the timer that releases a held /// line (). Nothing on the UI thread or in a script takes it, so it cannot close a @@ -723,6 +732,8 @@ private void Reflow(StyledLine line) if (!World.JoinWrappedLines) { ReleaseHeldLine(); + _wrapJoiner.Observe(line); + _serverWrapColumn = _wrapJoiner.WrapColumn ?? 0; ProcessOutputLine(line); return; } @@ -732,6 +743,8 @@ private void Reflow(StyledLine line) ProcessOutputLine(ready); } + _serverWrapColumn = _wrapJoiner.WrapColumn ?? 0; + if (_wrapJoiner.Holding) { CancelReflowHold(); diff --git a/src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs b/src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs index 881b50e9..ebd600eb 100644 --- a/src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs +++ b/src/SharpMUTerm.Core/Text/ServerWrapJoiner.cs @@ -211,8 +211,11 @@ public static StyledLine Join(StyledLine previous, StyledLine next) return new StyledLine(spans, previous.RuleColor, previous.IsPrompt); } - /// Records a line's length towards the wrap column. Blank lines say nothing about it. - private void Observe(StyledLine line) + /// + /// Records a line's length towards the wrap column. Blank lines say nothing about it. does this + /// itself; a session that is not joining calls it alone, so the wrap column is known before the player turns joining on. + /// + public void Observe(StyledLine line) { var length = line.Text.TrimEnd().Length; if (length == 0 || line.IsPrompt) diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 3f2c94a3..2a0b872e 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -54,6 +54,8 @@ internal sealed class ComposeOverlay private readonly Func? _openSpelling; private SpellChecker? _spelling; private bool _spellingOpened; + private MarkupControl? _headerBand; + private MarkupControl? _previewBand; /// The window system the composer opens in. /// @@ -114,14 +116,23 @@ internal ComposeOverlay(ConsoleWindowSystem system, Func? spellin /// What the window draws, as the shared model a native composer draws: the target, the buffer as it stands, the /// mode, the edit, the dictionary and its marks, and the key row. /// - internal ComposerModel Model => ModelFor(_target, Body, _escaping, _edit, Spelling, _canSend); + internal ComposerModel Model => ModelFor(_target, Body, _escaping, _edit, Spelling, _canSend, Preview); + + /// + /// Whether F1 shows the post as it will be sent (⌥P), under the editor. One fact for the run in both hosts — the + /// native F1 reads and flips this same property — and never saved: it is a way of looking, not a setting. + /// + internal bool Preview { get; set; } + + /// How many rows the as-sent preview takes when it is showing: a heading row and the command under it. + internal const int PreviewRows = 4; /// /// F1's model for a draft, in either host: the cell window builds its own from this, and a native F1 is opened on /// it, so the two say the same thing for the same draft. Revision 1: F1 opens on a draft and nothing replaces it /// while it is open. /// - internal static ComposerModel ModelFor(string target, string body, ComposeEscaping escaping, MooEdit? edit, SpellChecker? spelling, bool canSend) => + internal static ComposerModel ModelFor(string target, string body, ComposeEscaping escaping, MooEdit? edit, SpellChecker? spelling, bool canSend, bool preview = false) => ComposerModel.Create( ComposerPlace.FullScreen, target, @@ -131,7 +142,8 @@ internal static ComposerModel ModelFor(string target, string body, ComposeEscapi spelling, canSend, armed: true, - revision: 1); + revision: 1, + preview: preview); /// /// Opens the composer on , or closes it when it is already open — the same @@ -206,15 +218,22 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool } _editor.SetContent(draft); + _editor.ContentChanged += (_, _) => RefreshBands(); FitEditor(); - _window = new WindowBuilder(_system) + var builder = new WindowBuilder(_system) .AsModal() .Maximized() .Frameless() .WithColors(_scheme.Colour(ScreenPalette.PanelFg), _scheme.Colour(ScreenPalette.PanelBg)) .AddControl(HeaderBand()) - .AddControl(_editor) + .AddControl(_editor); + if (Model.Preview) + { + builder.AddControl(PreviewBand()); + } + + _window = builder .AddControl(FooterBand()) .OnClosed((_, _) => Reset()) .Build(); @@ -249,8 +268,28 @@ internal void SimulateTyping(string text) } _editor.SetContent(_editor.GetContent() + text); + RefreshBands(); + } + + /// + /// Re-says what changes as the post is typed — the header's length cell and the as-sent preview — without touching + /// the editor, so the caret and the undo stack stay where they were. + /// + private void RefreshBands() + { + if (_window is null) + { + return; + } + + var model = Model; + _headerBand?.SetContent(new List { _scheme.Paint(Render(model, Width).Header, ScreenPalette.HeaderBg) }); + _previewBand?.SetContent(_scheme.Lines(PreviewLines(model, Width), ScreenPalette.FooterBg)); } + /// The screen's width in cells, which the header and the preview are laid out to. + private int Width => _system.ConsoleDriver.ScreenSize.Width; + private void OnKey(object? sender, KeyPressedEventArgs e) { if (_window is null) @@ -292,6 +331,17 @@ private void OnKey(object? sender, KeyPressedEventArgs e) return; } + // ⌥P shows the post as it will be sent, and hides it again. Alt by the same rule; P for preview, and nothing in + // MacroKeys.AppShortcuts, the bar's table or a host's reserved chords takes it. A MOO edit is sent as its lines, + // which the editor already shows, so it has no preview. + if (alt && key.Key == ConsoleKey.P && _edit is null) + { + e.Handled = true; + Preview = !Preview; + Redraw(); + return; + } + if (key.Key == ConsoleKey.Escape && !ctrl && !alt) { e.Handled = true; @@ -367,7 +417,17 @@ private void Redraw() window.ClearControls(); window.AddControl(HeaderBand()); window.AddControl(_editor); + if (Model.Preview) + { + window.AddControl(PreviewBand()); + } + else + { + _previewBand = null; + } + window.AddControl(FooterBand()); + FitEditor(); window.Invalidate(redrawAll: true); window.FocusManager.SetFocus(_editor, FocusReason.Programmatic); } @@ -380,11 +440,59 @@ private void Redraw() /// private MarkupControl HeaderBand() { - var band = ScreenChrome.Band(Render(Model).Header, ScreenPalette.HeaderBg, _scheme); + var band = ScreenChrome.Band(Render(Model, Width).Header, ScreenPalette.HeaderBg, _scheme); band.StickyPosition = StickyPosition.Top; + _headerBand = band; + return band; + } + + /// The as-sent preview, pinned above the footer: rows on the footer's plane. + private MarkupControl PreviewBand() + { + var band = ScreenChrome.Panel(PreviewLines(Model, Width), _scheme, ScreenPalette.FooterBg); + band.BackgroundColor = _scheme.Colour(ScreenPalette.FooterBg); + band.HorizontalAlignment = HorizontalAlignment.Stretch; + band.StickyPosition = StickyPosition.Bottom; + _previewBand = band; return band; } + /// + /// The preview's rows for : a heading, then the command ⌃S would send, cut into rows of + /// characters — hard, not at words, because this shows the exact characters the game gets + /// and a wrap at a space would hide one — ending in … when it runs past the rows there are. Always + /// rows, so typing never moves the editor. + /// + internal static IReadOnlyList PreviewLines(ComposerModel model, int width) + { + width = Math.Max(10, width); + var command = model.Command ?? string.Empty; + var lines = new List + { + $"[{ScreenPalette.Accent}]AS SENT[/][{ScreenPalette.Label}] the one command ⌃S sends · ⌥P hides this[/]", + }; + var rows = PreviewRows - 1; + for (var row = 0; row < rows; row++) + { + var start = row * width; + if (start >= command.Length) + { + lines.Add(row == 0 && command.Length == 0 ? $"[{ScreenPalette.Muted}]nothing yet[/]" : string.Empty); + continue; + } + + var piece = command.Substring(start, Math.Min(width, command.Length - start)); + if (row == rows - 1 && start + width < command.Length) + { + piece = piece[..^1] + "…"; + } + + lines.Add($"[{ScreenPalette.Value}]{Escape(piece)}[/]"); + } + + return lines; + } + private MarkupControl FooterBand() { var band = ScreenChrome.Band(Render(Model).Footer, ScreenPalette.FooterBg, _scheme); @@ -399,7 +507,12 @@ private MarkupControl FooterBand() /// rule as the settings screens: every key printed here works, and none that works is hidden. There is /// deliberately no ⌃F find — the control has a find API but no chord bound to it. /// - internal static (string Header, string Footer) Render(ComposerModel model) + /// What to draw. + /// + /// The row's width in cells: the length cell is set at its right edge and the rest gives way before it. Zero puts the + /// length cell on the end, for a caller with no screen. + /// + internal static (string Header, string Footer) Render(ComposerModel model, int width = 0) { var target = model.Target.Length == 0 ? $"[{ScreenPalette.Warn}]no connection[/]" @@ -426,6 +539,9 @@ internal static (string Header, string Footer) Render(ComposerModel model) + $"[{ScreenPalette.Label}] · spelling [/]{spelling}"; } + var length = $"[{ScreenPalette.Value}]{ComposerModel.CharactersLabel(model.Characters)}[/] "; + header = width > 0 ? SpreadLR(header, length, width) : $"{header}[{ScreenPalette.Label}] · [/]{length}"; + var footer = string.Join( $"[{ScreenPalette.Label}] · [/]", model.Keys.Select(k => $"[{ScreenPalette.Accent}]{Escape(k.Key)}[/][{ScreenPalette.Label}] {Escape(k.Label)}[/]")); @@ -450,7 +566,7 @@ private void FitEditor() return; } - _editor.ViewportHeight = Math.Max(1, _system.ConsoleDriver.ScreenSize.Height - ChromeRows); + _editor.ViewportHeight = Math.Max(1, _system.ConsoleDriver.ScreenSize.Height - ChromeRows - (Model.Preview ? PreviewRows : 0)); } /// The header and footer bands, which the editor's height is whatever is left over from. @@ -476,5 +592,7 @@ private void Reset() _window = null; _editor = null; _edit = null; + _headerBand = null; + _previewBand = null; } } diff --git a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs index d7e0d9c7..abdc54ca 100644 --- a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs +++ b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs @@ -262,9 +262,16 @@ internal void Render(ComposerModel model) var verb = model.Verb; var mode = model.Escaping == ComposeEscaping.Literal ? $"[{_accent}]literal[/]" : "[dim]as typed[/]"; var marker = model.Armed ? $"[{_accent}]▌[/]" : " "; + var title = $"{marker}[bold {_accent}]COMPOSE[/]" + (verb.Length > 0 ? $" {Escape(verb)}" : string.Empty) + $" {mode}"; + + // The length cell at the right edge, as F1 has it; the title gives way first, and a pane too narrow for both + // keeps the title. + var length = $"[dim]{ComposerModel.CharactersLabel(model.Characters)}[/] "; _header.SetContent(new List { - $"{marker}[bold {_accent}]COMPOSE[/]" + (verb.Length > 0 ? $" {Escape(verb)}" : string.Empty) + $" {mode}", + _width <= 0 ? $"{title} {length}" + : _width >= VisibleLength(title) + VisibleLength(length) + 2 ? SpreadLR(title, length, _width) + : ElideVisible(title, _width), }); var footer = KeyRow(model.Keys, shortForm: false); diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index d36c1e55..890121c2 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -115,6 +115,18 @@ internal interface IPointerPresenter /// A right-click asked for a menu at a cell. An empty list is never passed. void ShowMenu(System.Drawing.Point cell, IReadOnlyList items); + /// + /// A menu the client built as data () asked for at a cell: the tab strip's + /// overflow list. A choice is handed back as the entry's command through , never run by the + /// host. A host that draws the plain kind only draws it as that (the default). + /// + void ShowMenu(System.Drawing.Point cell, SharpMUTerm.Client.Commands.MenuModel menu, Action dispatch) => + ShowMenu(cell, menu.Entries + .Select(e => e.IsSeparator + ? PointerMenuItem.Separator + : new PointerMenuItem(e.Label, e.Key, () => { if (e.Command is { } command) dispatch(command); }, e.Enabled, e.Checked)) + .ToList()); + /// /// Whether draws anything. Where it does not, the client opens its own chooser for /// the one menu a server can ask for, an MXP <SEND> with several commands. diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index bbf438e0..e3bc86c8 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -224,6 +224,13 @@ private void OnPointerFrame(List flags, System.Drawing.Point point) return; } + // The tab strip's +N ▾ chip lists the tabs past its edges; it is painted over the strip's last cells. + if (pressed && !dragged && TabOverflowAt(point) is { } overflowing) + { + OpenTabOverflow(overflowing, point); + return; + } + if (flags.Contains(MouseFlags.Button1DoubleClicked) && DividerAt(point) is { } evened) { if (PaneResize.Even(evened.Split)) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs new file mode 100644 index 00000000..6cf3d79d --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs @@ -0,0 +1,66 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Session; + +namespace SharpMUTerm.Tui; + +/// +/// A pane narrower than the server's wrap column: every hard-wrapped row of a room description then wraps a second time +/// and leaves a stray word on a row of its own. That is what a layout's side panels, a split or a narrow window do to an +/// 80-column server. The client says so once per world per run, with an action that turns F5's join wraps on. +/// +/// Suggested, never switched on for the player. A false join is worse than a missed one (see +/// ): it runs two lines the server meant apart into one, and nothing on screen +/// says it happened. Whether a world's output is the prose the joiner is safe on is the player's to judge, so the client +/// names the cause and the one-click fix and leaves the setting where it is. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The worlds this run has already been told about, by name. + private readonly HashSet _joinWrapsSuggested = new(StringComparer.OrdinalIgnoreCase); + + /// + /// Says, once per world, that 's pane is narrower than its server wraps — when the wrap + /// column is known, the world does not join wraps, and the pane is at least a few columns short of it. Called with + /// each pane width the client reports to the server. + /// + private void SuggestJoinWraps(WorldSession session, int paneWidth) + { + if (session.World.JoinWrappedLines + || session.ServerWrapColumn is not { } column + || paneWidth <= 0 + || paneWidth >= column - 2 + || _joinWrapsSuggested.Contains(session.World.Name)) + { + return; + } + + _joinWrapsSuggested.Add(session.World.Name); + Notice( + $"{Snippet(session.World.Name)} wraps at {column} and this pane is {paneWidth} wide · join wraps re-flows it (F5)", + MessageSeverity.Info, + action: new NoticeAction(BuiltInCommands.JoinWrapsPrefix + session.World.Name, "Join wraps")); + } + + /// world:join-wraps:<world>: turns F5's join wraps on for that world, from the next line. + private bool JoinWrapsFor(string worldName) + { + var world = _config.Worlds.FirstOrDefault(w => string.Equals(w.Name, worldName, StringComparison.OrdinalIgnoreCase)); + if (world is null) + { + RefuseCommand($"there is no world {Snippet(worldName)}"); + return true; + } + + if (!world.JoinWrappedLines) + { + world.JoinWrappedLines = true; + SaveConfiguration(); + } + + Notice($"{Snippet(world.Name)} joins its wrapped lines from the next line · F5 ▸ join wraps", MessageSeverity.Info); + return true; + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs index 706e3499..4536af72 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs @@ -109,6 +109,15 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, open.Session.Publish(NativeComposeModel(open)); } }), + TogglePreview = () => OnUiThread(() => + { + if (ReferenceEquals(_nativeCompose, open) && open.Edit is null) + { + // The cell window's fact, so F1 opens the same way in either host for the rest of the run. + _composer.Preview = !_composer.Preview; + open.Session.Publish(NativeComposeModel(open)); + } + }), AddWord = word => OnUiThread(() => AddComposerWord(word)), Proportional = ComposerFaceOf(ComposeDraftKey(ActiveWindowId())), ChooseFace = ChooseComposerFace(ComposeDraftKey(ActiveWindowId())), @@ -160,7 +169,7 @@ private Action ChooseComposerFace(string? sessionKey) => proportional => O /// The native F1's model for what it holds now; the cell window's for the same draft. private ComposerModel NativeComposeModel(NativeCompose open) => - ComposeOverlay.ModelFor(open.Target, open.Body, open.Escaping, open.Edit, open.Edit is null ? ComposerSpelling() : null, open.CanSend); + ComposeOverlay.ModelFor(open.Target, open.Body, open.Escaping, open.Edit, open.Edit is null ? ComposerSpelling() : null, open.CanSend, _composer.Preview); /// /// Closes F1, in whichever host it is open, keeping its buffer as the character's draft (or MOO edit) exactly as the diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs new file mode 100644 index 00000000..553ab6e4 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs @@ -0,0 +1,214 @@ +using SharpConsoleUI.Controls; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Workspaces; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// The tab strip's overflow chip (). Past its floors a strip cannot draw every +/// tab (): the framework scrolls it so the tab in front shows, and the rest are simply not +/// there. The chip says how many are missing — +3 ▾ at the strip's right edge — and a click on it lists them: +/// a cell list in a terminal, a native menu in the window. Choosing one goes to that window through the registry +/// (win:<id>, the ⌃P "Go to …" entry, which is also the keyboard's way to every hidden tab). +/// +/// No cell is spent. The chip is painted after the frame over the strip's own last cells, which are the clipped +/// end of a tab the framework could not finish drawing anyway; the strip, the pane and NAWS do not move. Which tabs are +/// hidden is read off the framework's own hit test of the strip it just painted (), +/// so the chip never disagrees with what is on screen. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// Each overflowing strip's list and where its chip is, in desktop cells; rebuilt every frame. + private readonly Dictionary _tabOverflow = new(StringComparer.Ordinal); + + /// The commands the last overflow list offered, so a choice can be checked against them. + private MenuModel? _tabOverflowOffered; + + /// The chip for a list: +3 ▾. + internal static string TabOverflowChip(MenuModel menu) => $"+{menu.Entries.Count} ▾"; + + /// Each overflowing pane's list of hidden tabs, by pane id. Internal for tests. + internal IReadOnlyDictionary TabOverflowMenus => + _tabOverflow.ToDictionary(p => p.Key, p => p.Value.Menu, StringComparer.Ordinal); + + /// Where a pane's chip is, in desktop cells, or null when its strip fits. Internal for tests. + internal PaneRect? TabOverflowChipAt(string paneId) => _tabOverflow.TryGetValue(paneId, out var o) ? o.Chip : null; + + /// + /// Finds the strips that drew fewer tabs than they hold, records each one's list of hidden tabs as drawn, and paints + /// its chip over the strip's last cells. On every frame, after the paint, beside the header dividers. + /// + private void PaintTabOverflow(SharpConsoleUI.Layout.CharacterBuffer buffer) + { + _tabOverflow.Clear(); + foreach (var (paneId, tabs, _) in RealisedPanes()) + { + if (!tabs.ShowTabHeader || tabs.TabCount < 2 || BoundsOf(tabs) is not { Width: > 0 } strip + || HiddenTabs(tabs, strip.Width) is not { Count: > 0 } hidden) + { + continue; + } + + var menu = Drawing(SurfaceCatalog.TabOverflow, paneId, new MenuModel(hidden)); + var chip = TabOverflowChip(menu); + if (chip.Length + 4 > strip.Width) + { + continue; + } + + var at = new PaneRect(strip.X + strip.Width - chip.Length - 1, strip.Y, chip.Length + 1, 1); + _tabOverflow[paneId] = (menu, at); + + var top = _window.Top + _system.DesktopUpperLeft.Y; + var by = at.Y - top; + var bx = at.X - _window.Left; + if (by < 0 || by >= buffer.Height || bx < 0 || bx + at.Width > buffer.Width) + { + continue; + } + + var plane = buffer.GetCell(bx, by).Background; + var planeRgb = new Rgb(plane.R, plane.G, plane.B); + var ink = TryParseRgb(_ink.Accent, out var accent) ? Contrast.Legible(accent, planeRgb) : new Rgb(0xee, 0xee, 0xee); + buffer.WriteString(bx, by, " " + chip, ToColor(ink), plane); + } + } + + /// + /// The tabs of a strip that the framework's hit test finds nowhere along it, as menu entries in strip order: each + /// says the window's name and dispatches win:<id>. Null when every tab was drawn, or the hit test answers + /// nothing at all (a framework that renamed it), which must not read as every tab hidden. + /// + private List? HiddenTabs(TabControl tabs, int width) + { + var seen = new HashSet(); + for (var x = 0; x < width; x++) + { + if (FrameworkHitTests.TabAt(tabs, x) is var index and >= 0) + { + seen.Add(index); + } + } + + if (seen.Count == 0 || seen.Count >= tabs.TabCount) + { + return null; + } + + var hidden = new List(); + var pages = tabs.TabPages; + for (var i = 0; i < pages.Count; i++) + { + if (!seen.Contains(i) && pages[i].Tag is string id && _workspace.FindWindow(id) is { } window) + { + var unread = window.Unread > 0 ? $" ({UnreadBadge.Format(window.Unread)})" : string.Empty; + hidden.Add(new MenuEntry(Snippet(TabTitles.Name(window)) + unread, null, CommandIds.Window(id))); + } + } + + return hidden; + } + + /// The overflowing strip whose chip is under , or null. + private string? TabOverflowAt(System.Drawing.Point point) => + _tabOverflow.FirstOrDefault(p => Contains(p.Value.Chip, point)).Key; + + /// + /// Opens a pane's list of hidden tabs at : the host's native menu where it draws menus, else + /// a cell list. Both hand the chosen entry's command to . Internal for tests, which + /// pass to open the cell list in a host that draws menus. + /// + internal bool OpenTabOverflow(string paneId, System.Drawing.Point? point = null, bool cells = false) + { + if (!_tabOverflow.TryGetValue(paneId, out var overflow) || AnyOverlayOpen) + { + return false; + } + + var menu = overflow.Menu; + _tabOverflowOffered = menu; + var at = point ?? new System.Drawing.Point(overflow.Chip.X, overflow.Chip.Y); + if (!cells && _pointer is { DrawsMenus: true } pointer) + { + pointer.ShowMenu(at, menu, command => OnUiThread(() => RunTabOverflowEntry(command))); + return true; + } + + _tabOverflowSelected = 0; + _sendMenu.Open( + "tabs", + $"{menu.Entries.Count} more tabs", + width => TabOverflowLines(menu, _tabOverflowSelected, width), + key => + { + switch (key.Key) + { + case ConsoleKey.UpArrow: + _tabOverflowSelected = Math.Max(0, _tabOverflowSelected - 1); + return true; + case ConsoleKey.DownArrow: + _tabOverflowSelected = Math.Min(menu.Entries.Count - 1, _tabOverflowSelected + 1); + return true; + case ConsoleKey.Enter when menu.Entries[_tabOverflowSelected].Command is { } chosen: + _sendMenu.Close(); + RunTabOverflowEntry(chosen); + return false; + case >= ConsoleKey.D1 and <= ConsoleKey.D9 when key.Key - ConsoleKey.D1 < menu.Entries.Count + && menu.Entries[key.Key - ConsoleKey.D1].Command is { } picked: + _sendMenu.Close(); + RunTabOverflowEntry(picked); + return false; + default: + return true; + } + }, + width: TabOverflowLines(menu, 0, int.MaxValue).Max(VisibleLength)); + return true; + } + + private int _tabOverflowSelected; + + /// + /// The cell list of hidden tabs: a digit and a name per tab, the selected one marked, and the keys. The cell renderer + /// of the overflow surface, drawn from the same the window's menu is. + /// + internal static List TabOverflowLines(MenuModel menu, int selected, int width) + { + ArgumentNullException.ThrowIfNull(menu); + var lines = new List(); + for (var i = 0; i < menu.Entries.Count; i++) + { + var key = i < 9 ? $"{i + 1}" : " "; + var mark = i == selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; + var weight = i == selected ? "bold " : string.Empty; + lines.Add($"{mark} [{ScreenPalette.Label}]{key}[/] [{weight}{ScreenPalette.Value}]{Escape(menu.Entries[i].Label)}[/]"); + } + + lines.Add(string.Empty); + lines.Add($"[{ScreenPalette.Label}]↑↓ select · ⏎ or a digit goes there · Esc cancels[/]"); + return lines; + } + + /// The cell list for a menu with nothing selected; for the surface tests. + internal static List TabOverflowLines(MenuModel menu) => TabOverflowLines(menu, 0, int.MaxValue); + + /// + /// A hidden tab chosen from the overflow list, in either host: the window it names comes forward through the + /// registry, as its ⌃P entry would bring it. A command the last list did not offer is refused. Internal for tests. + /// + internal bool RunTabOverflowEntry(string command) + { + if (_tabOverflowOffered is not { } offered || !offered.Commands().Contains(command, StringComparer.Ordinal)) + { + RefuseCommand($"the tab list did not offer {Snippet(command)}"); + return false; + } + + return DispatchCommand(command); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 56cc8777..37ef6889 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1011,6 +1011,7 @@ public SharpMUTermApp( SyncTabStripWidths(); SyncTransparentColours(); PaintHeaderDividers(buffer); + PaintTabOverflow(buffer); DrawSixelOverlay(buffer); PublishScrollbars(); PublishPanels(); @@ -1219,15 +1220,20 @@ public string RenderSnapshot(string? view = null) // live writer by ComposeWindowTests, which asserts that a real session's composer header reads // what SessionTitle produces. The body is prose with a '%' and brackets in it on purpose — it is // the text whose two renderings differ. + // + // compose-preview is the literal post with ⌥P's as-sent band under it, which shows the escapes and %r joins the + // header's length cell is counting. if (string.Equals(view, "compose", StringComparison.OrdinalIgnoreCase) || - string.Equals(view, "compose-literal", StringComparison.OrdinalIgnoreCase)) + string.Equals(view, "compose-literal", StringComparison.OrdinalIgnoreCase) || + string.Equals(view, "compose-preview", StringComparison.OrdinalIgnoreCase)) { + _composer.Preview = string.Equals(view, "compose-preview", StringComparison.OrdinalIgnoreCase); OpenComposer( DemoScene.MainCharacterName, "+bbpost 12=The Long Winter\n\nThe caravan reached the pass at dusk, 100% frozen and\n" + "short two horses. [Nobody] said what everyone was thinking.\n\n" + " -- Corvid, scribe", - string.Equals(view, "compose-literal", StringComparison.OrdinalIgnoreCase) + !string.Equals(view, "compose", StringComparison.OrdinalIgnoreCase) ? ComposeEscaping.Literal : ComposeEscaping.AsTyped, canSend: true); @@ -8581,6 +8587,11 @@ private bool RunBuiltInCommand(string id) return true; } + if (id.StartsWith(SharpMUTerm.Client.Commands.BuiltInCommands.JoinWrapsPrefix, StringComparison.Ordinal)) + { + return JoinWrapsFor(id[SharpMUTerm.Client.Commands.BuiltInCommands.JoinWrapsPrefix.Length..]); + } + // Before the panels' own prefix, which they share: panel:popout: and panel:dock:. if (id.StartsWith(SharpMUTerm.Client.Panels.PanelFloatCommands.PopOutPrefix, StringComparison.Ordinal)) { @@ -13268,6 +13279,7 @@ private void ReportPaneSizes() } OfferWindowSize(session, (Math.Max(1, rect.Width), Math.Max(1, rect.Height)), now); + SuggestJoinWraps(session, rect.Width); } ArmSizeFlush(now); @@ -13448,10 +13460,19 @@ private async Task AnnounceWindowSizeAsync(WorldSession session, int width, int /// private void PaintStatus(string markup) { - _statusBar.SetContent(new List { markup }); + _statusBar.SetContent(new List { FitStatusRow(markup, HeaderWidth()) }); SyncInputHeights(_second.Visible); } + /// + /// The status row's markup cut to cells, ending in …. The row is one row in every + /// host: a notice is a sentence, and a window narrower than it wrapped the row onto a second line and took that row + /// off the command line (the D1 lesson, live in the window). Everything the resting row lays out already fits; this is + /// the floor under the notices and anything else that does not measure itself. Internal for tests. + /// + internal static string FitStatusRow(string markup, int width) => + width > 0 && MarkupWidth(markup) > width ? ElideVisible(markup, width) : markup; + /// /// Sets what the status row says at rest: the connection identity, a mode prompt, the /// not-connected line. Remembered as well as painted, so a laid over the top of @@ -13497,6 +13518,7 @@ private void SetStatus(string markup, bool displace = false) /// The transient message currently laid over the resting row, or null when there is none. private string? _notice; + private NoticeModel? _noticeShown; private ITimer? _noticeTimer; /// @@ -13533,6 +13555,15 @@ private void SetStatus(string markup, bool displace = false) /// private void Notice(string text, MessageSeverity severity = MessageSeverity.Warning, string? key = null, NoticeAction? action = null) { + // The same notice raised again while it is still up is one notice: it keeps the row for another few seconds and + // is not said, toasted or announced a second time. Two identical toasts stacked in the window were the report. + if (_notice is not null && _noticeShown is { } shown && shown.Text == text && shown.Key == key + && shown.Severity == NoticeSeverityOf(severity) && shown.Action == action) + { + _noticeTimer?.Change(NoticeDuration, Timeout.InfiniteTimeSpan); + return; + } + // Through the logger, not straight into the buffer: the client's own messages and the telnet // stack's diagnostics then share one ordered history (and one rolling file), which is the point // of there being a pipeline at all. @@ -13554,6 +13585,7 @@ private void Notice(string text, MessageSeverity severity = MessageSeverity.Warn var markup = NoticeMarkup(model); _notice = markup; + _noticeShown = model; PaintStatus(markup); PublishNotice(model); _noticeTimer ??= _time.CreateTimer( diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index f07a8b45..03f453ef 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -20,7 +20,7 @@ internal static class SnapshotViews "history", "history-search", "history-search-filter", "draft", "draft2", "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "notices", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "tint-tabs", - "compose", "compose-literal", "moo-edit", "mssp", "mssp-none", "mssp-never", "web", + "compose", "compose-literal", "compose-preview", "moo-edit", "mssp", "mssp-none", "mssp-never", "web", "rail-long", "scrollback", "scrollback-up", "scrollback-split", "reflow", "links", "away", "away-scrollback", "search", "search-regex", "search-all", "search-landed", "activity-bar", "mxp-image", "mxp-figure", "input-selection", "selection", "trigger-builder", diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs index ce708831..be38b3b6 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs @@ -167,6 +167,30 @@ public async Task AltLFlipsTheHeadersModeFromTheClientsModel() await Assert.That(header).Contains("literal"); } + [Test] + public async Task TheHeaderCountsThePostAsSentAndAltPShowsIt() + { + var (count, previewShown, preview, hidden) = await Run(rig => + { + var overlay = OpenF1(rig); + Type(overlay.Composer.Editor, "+post one"); + var count = overlay.Composer.CountText; + Press(overlay.Composer.Editor, Key.P, KeyModifiers.Alt); + Drain(); + var reopened = rig.Driver.Composer.Overlay!; + var shown = reopened.Composer.PreviewText is { Length: > 0 } && rig.App.Composer.Preview; + var text = reopened.Composer.PreviewText; + Press(reopened.Composer.Editor, Key.P, KeyModifiers.Alt); + Drain(); + return (count, shown, text, !rig.App.Composer.Preview); + }); + + await Assert.That(count).IsEqualTo(ComposerModel.CharactersLabel("+post one".Length)); + await Assert.That(previewShown).IsTrue(); + await Assert.That(preview).Contains("+post one"); + await Assert.That(hidden).IsTrue().Because("⌥P again hides it"); + } + [Test] public async Task EscKeepsTheDraftForTheNextF1() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs index 4d965023..08046f7d 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs @@ -140,6 +140,46 @@ public async Task AHoveredToastKeepsItsPlaceWhileTheToastsUnderItFade() await Assert.That(after[^1].Bottom).IsGreaterThan(before.Bottom).Because("off the stack, it closes up to the bottom"); } + /// + /// A native quick bar across the bottom of the pane area: a toast is lifted above its keys, as above a legend. And + /// while something modal is in front the toasts are hidden rather than left under it. + /// + [Test] + public async Task AToastStaysOffTheQuickBarAndHidesWhileAModalIsInFront() + { + var (bar, rects, hiddenUnderModal, backAfter) = await Run((window, view, layer, driver) => + { + var model = new QuickBarModel([new QuickBarItem("F1", "F1", "look", Fires: true)]); + var notices = (IPointerPresenter)driver.Pointer; + notices.Panels( + [new PanelOverlay(PanelIds.QuickBar, "panel:quick-bar:demo", new PaneRect(0, 16, 80, 2), new PanelInk("#33ccff", "#ffaa33", "#555555"), null, QuickBar: model, Pick: _ => { })]); + notices.Notice(Overlay(1, "Using the Combat layout: the game sends vitals.", null, _ => { }, aboveRow: 18)); + Drain(); + window.UpdateLayout(); + driver.Flush(); + Drain(); + var buttons = layer.QuickBars.Values.Single(); + var topLeft = buttons.TranslatePoint(new Point(0, 0), layer.Toasts)!.Value; + var bar = new Rect(topLeft, buttons.Bounds.Size); + var rects = layer.Toasts.Rects(); + + var modal = true; + layer.ToastsHidden = () => modal; + driver.Flush(); + Drain(); + var hidden = !layer.Toasts.IsVisible; + modal = false; + driver.Flush(); + Drain(); + return (bar, rects, hidden, layer.Toasts.IsVisible); + }, columns: 80, rows: 20); + + await Assert.That(rects).IsNotEmpty(); + await Assert.That(rects.Any(r => r.Intersects(bar))).IsFalse().Because("no toast covers a quick bar key"); + await Assert.That(hiddenUnderModal).IsTrue().Because("a toast is never left under a settings window, ⌃P or a modal"); + await Assert.That(backAfter).IsTrue(); + } + /// /// In the combat layout the map sits right of the output, down to the command line, and its legend is in its bottom-left /// corner — under the toasts' column. A toast is stacked above the legend rather than over it. diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index d4462cd5..b40d65fc 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -205,7 +205,7 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! // F1: the window's editor is handed the model the cell window draws for the same draft, in each mode and for a // MOO edit. Two clients, one with the window's editor and one without, opened on the same scene. - foreach (var view in new[] { "compose", "compose-literal", "moo-edit" }) + foreach (var view in new[] { "compose", "compose-literal", "compose-preview", "moo-edit" }) { using var nativeDriver = new AvaloniaConsoleDriver(140, 36); var composer = new FakeComposer(); @@ -306,6 +306,19 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! covered.Add(SurfaceCatalog.FloatingPanel); } + // The tab overflow chip: the menu the window opens is the list the cells recorded for that strip in the same frame. + { + using var driver = new AvaloniaConsoleDriver(56, 20); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot("tabs-many"); + var (paneId, recorded) = app.TabOverflowMenus.Single(); + await Assert.That(app.OpenTabOverflow(paneId)).IsTrue(); + await Assert.That(driver.Pointer.LastModelMenu).IsNotNull().Because("tab-overflow: the window opens a native menu"); + await Assert.That((object)driver.Pointer.LastModelMenu!.Value.Menu).IsEqualTo(app.DrawnModel(SurfaceCatalog.TabOverflow, paneId)).Because("tab-overflow"); + await Assert.That(recorded.Entries).IsNotEmpty(); + covered.Add(SurfaceCatalog.TabOverflow); + } + var drawnNatively = SurfaceCatalog.All.Where(s => s.On(SurfaceHosts.Window).HasFlag(SurfaceDrawing.Native)).Select(s => s.Id); await Assert.That(covered).IsEquivalentTo(drawnNatively).Because("every surface the window draws natively has its model compared here"); } @@ -674,6 +687,31 @@ await SameModal("welcome: layout and browse", "welcome", probed.Add(SurfaceCatalog.Welcome); var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); + // The tab overflow chip: an entry chosen from the window's menu and the same digit in the cell list bring the same + // hidden tab forward. + { + using var nativeDriver = new AvaloniaConsoleDriver(56, 20); + await using var a = App(nativeDriver, DemoScene.Build()); + a.RenderSnapshot("tabs-many"); + var before = Outcome(a); + var (pane, _) = a.TabOverflowMenus.Single(); + a.OpenTabOverflow(pane); + var (menu, dispatch) = nativeDriver.Pointer.LastModelMenu!.Value; + dispatch(menu.Entries[0].Command!); + + using var cellDriver = new AvaloniaConsoleDriver(56, 20); + await using var b = App(cellDriver, DemoScene.Build()); + b.RenderSnapshot("tabs-many"); + b.OpenTabOverflow(b.TabOverflowMenus.Single().Key, cells: true); + b.SendMenu.SimulateKey(new ConsoleKeyInfo('1', ConsoleKey.D1, false, false, false)); + + await Assert.That(Outcome(a)).IsNotEqualTo(before).Because("tab-overflow: the native choice did something"); + await Assert.That(Outcome(a)).IsEqualTo(Outcome(b)).Because("tab-overflow"); + await Assert.That(a.ActiveWindowId()).IsEqualTo(b.ActiveWindowId()); + } + + probed.Add(SurfaceCatalog.TabOverflow); + await Assert.That(probed).IsEquivalentTo(acting).Because("every native surface with actions has a probe here"); } diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs index 14ccb389..0f1e4f44 100644 --- a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -73,7 +73,7 @@ public async Task PanelSurfacesAreKnownPanels() var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose - or SurfaceCatalog.FloatingPanel) + or SurfaceCatalog.FloatingPanel or SurfaceCatalog.TabOverflow) && !SurfaceCatalog.Modals.Contains(s.Id)); foreach (var surface in panels) { diff --git a/tests/SharpMUTerm.Tui.Tests/ComposerLengthTests.cs b/tests/SharpMUTerm.Tui.Tests/ComposerLengthTests.cs new file mode 100644 index 00000000..85b425dc --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/ComposerLengthTests.cs @@ -0,0 +1,85 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The composer says how long the post is as it will be sent, and ⌥P shows it as sent: escapes and %r joins +/// included, because that is what a MUSH's buffer limit counts. +/// +[NotInParallel] +public class ComposerLengthTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static ConsoleKeyInfo AltP => new('\0', ConsoleKey.P, false, true, false); + + private static async Task Connected() + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }); + config.Worlds.Add(world); + var app = new SharpMUTermApp(config, ClientHost.Headless(new HeadlessConsoleDriver(120, 32), Caps)); + app.TelnetFactory = _ => new RecordingTelnetSession(); + await app.BindWorldWithoutConnecting(world).ConnectAsync(); + app.RenderNextFrame(); + return app; + } + + [Test] + public async Task TheCountIsOfWhatWillBeSent() + { + await Assert.That(ComposerModel.SentLength("+post a\nb", ComposeEscaping.AsTyped, edit: false)) + .IsEqualTo(ComposeMessage.Build("+post a\nb", ComposeEscaping.AsTyped)!.Length); + await Assert.That(ComposerModel.SentLength("50% [x]", ComposeEscaping.Literal, edit: false)) + .IsGreaterThan("50% [x]".Length).Because("literal escapes are characters the game receives"); + await Assert.That(ComposerModel.SentLength("line\n", ComposeEscaping.Literal, edit: true)).IsEqualTo(4); + await Assert.That(ComposerModel.CharactersLabel(1)).IsEqualTo("1 char"); + await Assert.That(ComposerModel.CharactersLabel(1234)).IsEqualTo("1,234 chars"); + } + + [Test] + public async Task F1sHeaderCountsThePostAsItIsTyped() + { + var app = await Connected(); + app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + app.Composer.SimulateTyping("+post hello"); + + await Assert.That(app.Composer.HeaderMarkup).Contains(ComposerModel.CharactersLabel(app.Composer.Model.Characters)); + await Assert.That(app.Composer.Model.Characters).IsEqualTo("+post hello".Length); + } + + [Test] + public async Task AltPShowsThePostAsSentAndAgainHidesIt() + { + var app = await Connected(); + app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + app.Composer.SimulateTyping("+post one\n\ntwo"); + + await Assert.That(app.Composer.SimulateKey(AltP)).IsTrue(); + await Assert.That(app.Composer.Model.Preview).IsTrue(); + await Assert.That(app.Composer.Model.Keys.Select(k => k.Label)).Contains("hide as sent"); + var preview = ComposeOverlay.PreviewLines(app.Composer.Model, 120).Select(MarkupText.Plain).ToList(); + await Assert.That(string.Join("\n", preview)).Contains("+post one%r%rtwo"); + await Assert.That(app.RenderWholeFrame()).Contains("AS SENT"); + + app.Composer.SimulateKey(AltP); + await Assert.That(app.Composer.Model.Preview).IsFalse(); + } + + [Test] + public async Task AMooEditHasNoPreview() + { + var model = ComposerModel.Create( + ComposerPlace.FullScreen, "Ann", "x", ComposeEscaping.AsTyped, new ComposerEdit("name", "moo-code"), + spelling: null, canSend: true, armed: true, revision: 0, preview: true); + + await Assert.That(model.Preview).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/InputAreaLayoutTests.cs b/tests/SharpMUTerm.Tui.Tests/InputAreaLayoutTests.cs index 438af39d..c442fbc3 100644 --- a/tests/SharpMUTerm.Tui.Tests/InputAreaLayoutTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/InputAreaLayoutTests.cs @@ -27,7 +27,7 @@ namespace SharpMUTerm.Tui.Tests; [NotInParallel] public class InputAreaLayoutTests { - private const int DefaultRows = 3; // InputSettings.Rows — one bar's height before anything wraps + private const int DefaultRows = 1; // InputSettings.Rows — one bar's height before anything wraps private const int MaxRows = 8; // InputSettings.MaxRows — the most it grows to as it wraps private static readonly TerminalCapabilities Headless = @@ -182,8 +182,9 @@ await Assert.That(RowsPainted(frame.Ansi, width, height, frame.IdleBand)) .IsEqualTo(frame.Rows.Primary); await Assert.That(RowsPainted(frame.Ansi, width, height, frame.ArmedBand)) .IsEqualTo(frame.Rows.Second); - await Assert.That(frame.Rows.Primary).IsEqualTo(DefaultRows); - await Assert.That(frame.Rows.Second).IsEqualTo(DefaultRows); + // Each bar holds a draft, which may wrap past the one-row default; the bands still match the rows given. + await Assert.That(frame.Rows.Primary).IsGreaterThanOrEqualTo(DefaultRows); + await Assert.That(frame.Rows.Second).IsGreaterThanOrEqualTo(DefaultRows); } /// diff --git a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs index 092acc8f..91169eea 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs @@ -167,7 +167,7 @@ public async Task F1OpensTheHostsEditorAndNotTheCellModal() await Assert.That(model.Place).IsEqualTo(ComposerPlace.FullScreen); await Assert.That(model.Target).IsEqualTo("Ann"); await Assert.That(model.CanSend).IsTrue(); - await Assert.That(model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "⌥L", "Esc" }); + await Assert.That(model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "⌥L", "⌥P", "Esc" }); } [Test] diff --git a/tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs b/tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs new file mode 100644 index 00000000..b8918770 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs @@ -0,0 +1,120 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The status row never wraps, whatever a notice says and however narrow the screen; a notice said again while it is +/// still on the row is not said twice; and a pane narrower than its server's wrap column is told about join wraps once. +/// +[NotInParallel] +public class NoticeFitTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(int width, int height) + { + Console.SetIn(TextReader.Null); + return new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(new HeadlessConsoleDriver(width, height), Caps)); + } + + [Test] + [Arguments(80, 24)] + [Arguments(60, 20)] + [Arguments(40, 12)] + public async Task ALongNoticeIsElidedToTheRowAndTheRowStaysOneRow(int width, int height) + { + var app = App(width, height); + app.RenderSnapshot(); + var before = app.LaidOutRows; + + app.SimulateNotice( + string.Concat(Enumerable.Repeat("a notice far longer than any status row can hold ", 4)), + MessageSeverity.Warning, "⌃B", null); + app.RenderNextFrame(); + + await Assert.That(SharpMUTermApp.MarkupWidth(app.StatusMarkup)).IsLessThanOrEqualTo(width); + await Assert.That(app.LaidOutRows.Status).IsEqualTo(1); + await Assert.That(app.LaidOutRows.Workspace).IsEqualTo(before.Workspace).Because("a wrapped row takes a row off the panes"); + } + + [Test] + public async Task FitStatusRowLeavesARowThatFitsAlone() + { + await Assert.That(SharpMUTermApp.FitStatusRow("[dim]short[/]", 80)).IsEqualTo("[dim]short[/]"); + await Assert.That(SharpMUTermApp.MarkupWidth(SharpMUTermApp.FitStatusRow("[dim]" + new string('x', 100) + "[/]", 80))) + .IsLessThanOrEqualTo(80); + } + + [Test] + public async Task TheSameNoticeTwiceIsSaidOnce() + { + var app = App(120, 34); + var before = app.Messages.Entries.Count; + + app.SimulateNotice("Painting in Dark, output on screen included.", MessageSeverity.Info, "theme", null); + app.SimulateNotice("Painting in Dark, output on screen included.", MessageSeverity.Info, "theme", null); + + await Assert.That(app.Messages.Entries.Count).IsEqualTo(before + 1); + + app.SimulateNotice("something else", MessageSeverity.Info, null, null); + app.SimulateNotice("Painting in Dark, output on screen included.", MessageSeverity.Info, "theme", null); + await Assert.That(app.Messages.Entries.Count).IsEqualTo(before + 3).Because("a notice after another one is news again"); + } + + [Test] + public async Task APaneNarrowerThanTheServersWrapIsToldAboutJoinWrapsOnce() + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }); + config.Worlds.Add(world); + var app = new SharpMUTermApp(config, ClientHost.Headless(new HeadlessConsoleDriver(60, 24), Caps)); + var telnet = new RecordingTelnetSession(); + app.TelnetFactory = _ => telnet; + await app.BindWorldWithoutConnecting(world).ConnectAsync(); + app.RenderNextFrame(); + + for (var i = 0; i < 12; i++) + { + telnet.Receive("The plaza opens out under a white sky, its flagstones worn smooth by years of trade " + i); + } + + app.RenderNextFrame(); + app.RenderNextFrame(); + + var notices = app.Messages.Entries.Where(e => e.Text.Contains("join wraps", StringComparison.Ordinal)).ToList(); + await Assert.That(notices.Count).IsEqualTo(1); + await Assert.That(world.JoinWrappedLines).IsFalse().Because("it is suggested, never switched on for the player"); + + await Assert.That(app.DispatchCommand("world:join-wraps:Quiet")).IsTrue(); + await Assert.That(world.JoinWrappedLines).IsTrue(); + } + + [Test] + public async Task AWidePaneIsToldNothing() + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Quiet", Host = "quiet.example.org", Port = 4000 }; + world.Characters.Add(new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() }); + config.Worlds.Add(world); + var app = new SharpMUTermApp(config, ClientHost.Headless(new HeadlessConsoleDriver(160, 40), Caps)); + var telnet = new RecordingTelnetSession(); + app.TelnetFactory = _ => telnet; + await app.BindWorldWithoutConnecting(world).ConnectAsync(); + + for (var i = 0; i < 12; i++) + { + telnet.Receive("The plaza opens out under a white sky, its flagstones worn smooth by years of trade " + i); + } + + app.RenderNextFrame(); + + await Assert.That(app.Messages.Entries.Any(e => e.Text.Contains("join wraps", StringComparison.Ordinal))).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs index 8b52b543..c7e33c65 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs @@ -488,7 +488,7 @@ public async Task Options_CommandLineHeightsRefuseValuesTheBarCannotHonour() await Assert.That(edits.Apply(height, "0")).IsNotNull(); await Assert.That(edits.Apply(height, "21")).IsNotNull(); - await Assert.That(input.Rows).IsEqualTo(3); + await Assert.That(input.Rows).IsEqualTo(1); } /// diff --git a/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs b/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs new file mode 100644 index 00000000..a28b039b --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs @@ -0,0 +1,109 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The tab strip's overflow chip: past its floors a strip cannot draw every tab, and the chip at its right edge says +/// how many are missing and lists them. Read off a real 80×24 frame of the tabs-many view, where the Chat pane +/// holds more captures than it can draw. +/// +[NotInParallel] +public class TabOverflowTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static (SharpMUTermApp App, string Frame) Crowded(int width = 80, int height = 24) + { + Console.SetIn(TextReader.Null); + var app = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(new HeadlessConsoleDriver(width, height), Caps)); + var frame = app.RenderSnapshot("tabs-many"); + return (app, frame); + } + + [Test] + public async Task AStripThatCannotDrawEveryTabCarriesAChipCountingTheRest() + { + var (app, frame) = Crowded(); + + var (paneId, menu) = app.TabOverflowMenus.Single(); + await Assert.That(menu.Entries.Count).IsGreaterThan(0); + await Assert.That(FrameText(frame)).Contains(SharpMUTermApp.TabOverflowChip(menu)); + await Assert.That(menu.Entries.All(e => e.Command!.StartsWith(CommandIds.WindowPrefix, StringComparison.Ordinal))).IsTrue(); + await Assert.That(app.DrawnModel(SurfaceCatalog.TabOverflow, paneId)).IsEqualTo(menu) + .Because("the list the window's menu is handed is the one the cells recorded"); + } + + [Test] + public async Task TheChipSpendsNoCellAndMovesNoPane() + { + Console.SetIn(TextReader.Null); + var plain = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(new HeadlessConsoleDriver(80, 24), Caps)); + plain.RenderSnapshot("tabs-many"); + var (app, _) = Crowded(); + + await Assert.That(app.PaneOutputRects()).IsEquivalentTo(plain.PaneOutputRects()); + var (paneId, _) = app.TabOverflowMenus.Single(); + var chip = app.TabOverflowChipAt(paneId)!.Value; + var strip = app.PaneOutputRects()[paneId]; + await Assert.That(chip.X + chip.Width).IsLessThanOrEqualTo(strip.X + strip.Width) + .Because("the chip is painted over the strip's own last cells"); + } + + [Test] + public async Task AWideStripHasNoChip() + { + var (app, _) = Crowded(200, 40); + + await Assert.That(app.TabOverflowMenus.Count).IsEqualTo(0); + } + + [Test] + public async Task InATerminalTheChipOpensACellListAndADigitGoesToThatTab() + { + var (app, _) = Crowded(); + var (paneId, menu) = app.TabOverflowMenus.Single(); + var target = menu.Entries[0].Command![CommandIds.WindowPrefix.Length..]; + + await Assert.That(app.OpenTabOverflow(paneId)).IsTrue(); + await Assert.That(app.SendMenu.IsOpen).IsTrue(); + await Assert.That(string.Join("\n", app.SendMenu.Lines.Select(MarkupText.Plain))).Contains(menu.Entries[0].Label); + + app.SendMenu.SimulateKey(new ConsoleKeyInfo('1', ConsoleKey.D1, false, false, false)); + + await Assert.That(app.SendMenu.IsOpen).IsFalse(); + await Assert.That(app.ActiveWindowId()).IsEqualTo(target); + } + + [Test] + public async Task ACommandTheListDidNotOfferIsRefused() + { + var (app, _) = Crowded(); + var (paneId, _) = app.TabOverflowMenus.Single(); + app.OpenTabOverflow(paneId); + app.SendMenu.Close(); + + await Assert.That(app.RunTabOverflowEntry("term:quit")).IsFalse(); + } + + [Test] + public async Task TheCellListNamesEachHiddenTabWithADigit() + { + var menu = new SharpMUTerm.Client.Commands.MenuModel([ + new("Chat", null, "win:a"), + new("Ooc (3)", null, "win:b"), + ]); + + var lines = SharpMUTermApp.TabOverflowLines(menu).Select(MarkupText.Plain).ToList(); + + await Assert.That(lines[0]).Contains("1 Chat"); + await Assert.That(lines[1]).Contains("2 Ooc (3)"); + await Assert.That(SharpMUTermApp.TabOverflowChip(menu)).IsEqualTo("+2 ▾"); + } + + private static string FrameText(string ansi) => + System.Text.RegularExpressions.Regex.Replace(ansi, @"\x1b\[[0-9;?]*[A-Za-z]", string.Empty); +} From f3f55e61973bd19c43ecc3f681d83f28d35a6bb4 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 11:36:17 +0000 Subject: [PATCH 040/113] Settings resize, toasts, one name spelling, chip click, notice sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Settings window: edge resize bands (WindowChrome.WithResizeBands, as the borderless main window does) under its own frame; the centred size is kept for the run (SettingsPresenter.RememberedSize), docked-right is not. - Opening or closing the settings window re-syncs the desktop layer, so toasts hide and return at once rather than on the next frame. - One spelling of a name: prompt "Corvid · Aetherfall ›", window title "Corvid · Aetherfall — SharpMUTerm", tab owner prefix "Corvid · Chat" (CharacterNames.Window; StatusFormatter.NameSeparator). - Native palette placeholder starts with "Command palette" (CommandPalette.Title shared with the header search box). - A press on a tab strip's +N chip is struck from the driver's frame before the framework sees it, so the tab drawn under the chip is not selected or closed; pinned in both hosts. - Notices from packages, map and sound carry a Source label ("Sound:" on the row, a caption on a toast), not a word in the key chip. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 9 ++ CLAUDE.md | 24 ++- src/SharpMUTerm.Avalonia/MainWindow.cs | 5 + src/SharpMUTerm.Avalonia/NativeChrome.cs | 2 +- src/SharpMUTerm.Avalonia/NoticeToasts.cs | 28 +++- src/SharpMUTerm.Avalonia/PaletteOverlay.cs | 8 +- src/SharpMUTerm.Avalonia/SettingsPresenter.cs | 46 ++++++ src/SharpMUTerm.Avalonia/SettingsWindow.cs | 12 +- src/SharpMUTerm.Avalonia/WindowChrome.cs | 59 ++++++++ .../Chrome/CharacterNames.cs | 12 +- src/SharpMUTerm.Client/Chrome/NoticeModel.cs | 20 ++- src/SharpMUTerm.Client/Chrome/WindowTitle.cs | 6 +- src/SharpMUTerm.Core/Text/StatusFormatter.cs | 11 +- src/SharpMUTerm.Tui/CommandPalette.cs | 5 +- .../Pointer/SharpMUTermApp.Notices.cs | 8 +- .../SharpMUTermApp.Packages.cs | 8 +- src/SharpMUTerm.Tui/SharpMUTermApp.Sound.cs | 4 +- .../SharpMUTermApp.TabOverflow.cs | 103 +++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 22 ++- src/SharpMUTerm.Tui/TabStripFit.cs | 2 +- src/SharpMUTerm.Tui/TabTitles.cs | 9 +- .../NativePaletteTests.cs | 10 ++ .../NoticeToastTests.cs | 18 +++ .../OutputAutomationTests.cs | 6 +- .../SettingsWindowFrameTests.cs | 141 ++++++++++++++++++ .../SurfaceParityTests.cs | 3 +- .../TabOverflowWindowTests.cs | 33 ++++ .../WindowTitleTests.cs | 26 +++- .../Text/StatusLineTests.cs | 2 +- .../NoticeAndMapSurfaceTests.cs | 37 +++++ .../SharpMUTerm.Tui.Tests/TabOverflowTests.cs | 30 ++++ .../SharpMUTerm.Tui.Tests/TabStripFitTests.cs | 16 +- tests/SharpMUTerm.Tui.Tests/TabTitlesTests.cs | 6 +- .../TelnetLinkClientTests.cs | 6 +- 34 files changed, 667 insertions(+), 70 deletions(-) create mode 100644 tests/SharpMUTerm.Avalonia.Tests/SettingsWindowFrameTests.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/TabOverflowWindowTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 733c386b..6e6d19e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -273,6 +273,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- A character is named one way everywhere: the command line's prompt, the window title and tab titles now read + `Corvid · Aetherfall` and `Corvid · Chat` instead of `Corvid@Aetherfall` and `Corvid - Chat`. +- Messages from packages, the map and sound name where they came from as a label ("Sound: muted.") rather than in the + place a shortcut key is shown. The desktop palette's empty search box now starts with "Command palette". + - Desktop window: one look across settings, menus, the command palette and every prompt — the client's own teal instead of a stock blue, one set of text sizes and corner radii, and every colour readable on Dark, Light and Solarized Dark. The settings panel now has a title bar with a close button, dims the window behind it, and when @@ -320,6 +325,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- Desktop window: the settings window can be resized again from any edge, and opens at the size you last left it + for the rest of the session. Notification cards disappear as soon as it opens rather than showing beside it. +- Clicking a tab strip's `+N ▾` no longer also selects (or closes) the tab drawn underneath it. + - The away, new-activity, search and restore bars fit the pane they are in: their rule runs to the pane's edge, never past it, and the words shorten before the rule does in a narrow pane. They redraw when the pane is resized. - Search (Ctrl+F) fits an 80-column terminal: its key hints shorten instead of pushing the window wider than the diff --git a/CLAUDE.md b/CLAUDE.md index e83bc392..effc90f5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1382,7 +1382,9 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw it in `SurfaceCatalog.All`, and add its model and action probes to `SurfaceParityTests`, whose coverage guards fail until you do. - **A notice is a model, drawn as the status row's text in both hosts and as a toast in the window** - (`NoticeModel`/`NoticeSeverity`/`NoticeAction`, Client `Chrome/`; `SharpMUTermApp.Notices.cs`; `NoticeToasts`, + (`NoticeModel`/`NoticeSeverity`/`NoticeAction`, Client `Chrome/`; a notice carries a chord `Key` *or* a `Source` + label from `NoticeModel.Sources` — Packages, Map, Sound — drawn `Sound:` on the row and as a caption on a toast, never + in the key chip; a lowercase word passed as `key:` is a test failure; `SharpMUTermApp.Notices.cs`; `NoticeToasts`, Avalonia; surface `notice`, `CellsUnderNative`; the `notices` view). `Notice(...)` builds one model per call (`Drawing`), draws the row from it with the same markup as before (`NoticeMarkup`; terminal frames are byte-identical) and publishes it through `IPointerPresenter.Notice`. Decisions not to relitigate: @@ -1424,7 +1426,11 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw painted, and the chip is painted after the frame over the strip's own last (clipped) cells, so no cell, pane or NAWS moves. A click opens a native menu in the window (`IPointerPresenter.ShowMenu(cell, MenuModel, dispatch)`) and a cell list (`_sendMenu`, digits) in a terminal; each entry is `win:` through `RunTabOverflowEntry`, which refuses what - the list did not offer. The keyboard's way to a hidden tab is ⌃P *Go to …* or ⌃N. + the list did not offer. The keyboard's way to a hidden tab is ⌃P *Go to …* or ⌃N. **A press on the chip is taken + away from the framework** (`TakesTabOverflowPress`, in `OnDriverMouseEvent` on the input thread): the chip can sit + over the tail of a tab the framework drew, name or `×`, and the framework (subscribed later, inside `Run()`) would + select or close it on the same click. The button flags are struck from the shared list, leaving a movement; the chip + rects are a snapshot array published per frame. Both hosts go through that handler (`AClickOnTheChipDoesNotAlso…`). - **The composer says how long the post is as sent, and ⌥P shows it** (`ComposerModel.Characters`/`SentLength`, the escaped and `%r`-joined command; a MOO edit counts its text). F1 and the docked panel carry the `N chars` cell in both hosts; ⌥P toggles an *as sent* band under F1 (`ComposeOverlay.Preview`, run-wide, shared with the native editor via @@ -1457,7 +1463,9 @@ the terminal still says *no numpad key ever arrives*. F4 and the quick bar print **A character is named one way on every surface: `Corvid · Aetherfall`** (Client `CharacterNames`; Tui `DisplayName(sessionKey)`, open sessions first, then the configuration, so a dotted world still splits). The quit prompt, ⌃P's *acting on*, ⌥M, F10, refusals and notices read it; the dotted session key is an address and is never -shown. Not changed: tab titles (`Corvid - Chat`) and the prompt's `Corvid@Aetherfall`. +shown. The prompt (`Corvid · Aetherfall ›`, `StatusFormatter.NameSeparator`, which `CharacterNames.Separator` reads), +the window title (`Corvid · Aetherfall — SharpMUTerm`) and a tab's owner prefix (`Corvid · Chat`, +`CharacterNames.Window`) use the same spelling; there is no `@` or ` - ` left (`WindowTitleTests`). ## Building and testing @@ -1525,7 +1533,7 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg `menu-fuzzy` (`trig sel` typed into ⌃P after a real drag, so the trigger builder's entry is offered — the frame showing a two-word fuzzy match highlighted), `menu-recent` (⌃P opened empty after two commands ran through the palette's own path, `RunFromPalette` — RECENT at the top, newest first, listed once), - `messages`, `notices` (two notices with a refusal between them, the first carrying an action — the window shows them as toasts over the same cells), `quit`, `connections` (**two connections on one world** — the one view where the header's + `messages`, `notices` (two notices with a refusal and a `Sound` source notice between them, the first carrying an action — the window shows them as toasts over the same cells), `quit`, `connections` (**two connections on one world** — the one view where the header's fraction, the rail's dots and the quit prompt's count are all visible together and all have to agree; every other view has at most one character connected per world, which is what hid a header dividing connections by *worlds* and a quit prompt reducing them to distinct world names), `characters` (**two @@ -1827,6 +1835,12 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] `SettingsPresenter` on the driver; `OpenSettingsScreen`/`TryOpenNativeSettings` in `SharpMUTermApp.Settings.cs`). The terminal, the snapshot, the tests and the parity harness pass null, so their cells do not change. Decisions not to relitigate: + - **The frame is the window's own** (`WindowDecorations.None`: title, ✕, Esc, drag the title to move), **so is the + resize border**: `WindowChrome.WithResizeBands` lays a 5 px band along each edge that begins `BeginResizeDrag`, the + main window's rule. The size the player leaves the centred window at is reused for the run + (`SettingsPresenter.RememberedSize`, never saved); docked beside the output (trigger builder) is not remembered. + Opening or closing it calls `OpenedOrClosed` → `DesktopLayer.Sync`, so toasts hide and return at once (another OS + window paints no frame here). Under Xvfb with no window manager `BeginResizeDrag` does nothing; untried under a WM. - **Every way in goes through `OpenSettingsScreen`**: the F-key, ⌃P's `screen:` entries and the cell search's ⏎ (`GoToSetting`). A section with fields goes native and any open cell screen is closed first. A section with none is a cell screen as before. In the window's list it carries `↗`, and choosing it calls @@ -2308,7 +2322,7 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] draw it in *and* the strip has keyboard focus (which it never has here: focus is pinned to the armed command line). Measured: five captures in a split pane drew two tabs and half of a third. - **The owner prefix goes first, and goes for the whole strip.** A pane full of one character's - captures repeats `Corvid - ` on every tab; it is the cheapest thing there is to lose and the most + captures repeats `Corvid · ` on every tab; it is the cheapest thing there is to lose and the most there is of it, and what it said is still said twice over — by the chip the tab is painted on, and by the `⌁` a window belonging to another character wears. Dropping it alone is often the whole fix. - **Then names share by water-filling, not in proportion.** A cap is lowered until the strip fits and diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index 37b02263..bed2c5bf 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -90,6 +90,11 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime layer.ToastsHidden = () => _driver.Settings.Window is not null || _driver.Palette.Overlay is not null || _driver.Modals.Modal is not null || _driver.Modals.Quit is not null; + // The settings window is a window of its own, so opening or closing it paints no frame here: re-check at once, or + // a toast already up stays beside it (seen under Xvfb, where nothing stacks the windows) and one hidden under it + // stays hidden after it closes. + _driver.Settings.OpenedOrClosed = layer.Sync; + // Panels popped out into windows of their own, owned by this one so they stay above it and go with it. _driver.Floating.Attach(this, _view); Closed += (_, _) => _driver.Floating.Detach(); diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 54666bbb..0c55c4ac 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -341,7 +341,7 @@ protected static void Chevron(DrawingContext context, Rect area, bool left, Colo internal sealed class NativeHeader(TerminalView view) : NativeChromeView(view) { /// What the search box says. ⌃P lists commands, characters and windows, and settings screens. - internal const string SearchText = "Command palette"; + internal const string SearchText = CommandPalette.Title; /// The prefix's leading word, beside its chord. internal const string PrefixWord = "awaiting a pane key"; diff --git a/src/SharpMUTerm.Avalonia/NoticeToasts.cs b/src/SharpMUTerm.Avalonia/NoticeToasts.cs index 8adbc0fb..f83f45b8 100644 --- a/src/SharpMUTerm.Avalonia/NoticeToasts.cs +++ b/src/SharpMUTerm.Avalonia/NoticeToasts.cs @@ -144,10 +144,18 @@ internal void Advance(TimeSpan by) /// The words each toast draws — its key chip, its text and its action — oldest first. Internal for tests. internal IReadOnlyList DrawnText() => - Layout().SelectMany(l => new[] { ChipText(l.Toast), BodyText(l.Toast), ActionText(l.Toast) }).OfType().ToList(); + Layout().SelectMany(l => new[] { SourceText(l.Toast), ChipText(l.Toast), BodyText(l.Toast), ActionText(l.Toast) }).OfType().ToList(); + + /// Whether each toast's label is a key chip (true) or a source caption (false), oldest first; null for none. Internal for tests. + internal IReadOnlyList LabelIsChip() => + Layout().Select(l => l.Toast.Overlay.Notice.Source is not null ? false : l.Toast.Overlay.Notice.Key is not null ? true : (bool?)null).ToList(); + + // A source (Packages, Map, Sound) is a caption over the text, never a chip: in a chip a word reads as a key to press. + private static string? SourceText(Toast toast) => toast.Overlay.Notice.Source; // What a toast says, in the window's words (NativeKeys): the key chip, the text, the action line. - private static string? ChipText(Toast toast) => toast.Overlay.Notice.Key is { } key ? NativeKeys.Words(key) : null; + private static string? ChipText(Toast toast) => + toast.Overlay.Notice.Source is null && toast.Overlay.Notice.Key is { } key ? NativeKeys.Words(key) : null; private static string BodyText(Toast toast) => NativeKeys.Words(toast.Overlay.Notice.Text); @@ -220,7 +228,7 @@ private void SyncFreeze() // ── Layout ─────────────────────────────────────────────────────────────────────────────── - private readonly record struct Placed(Toast Toast, Rect Rect, FormattedText Text, FormattedText? Chip, FormattedText? Action); + private readonly record struct Placed(Toast Toast, Rect Rect, FormattedText Text, FormattedText? Chip, FormattedText? Action, FormattedText? Source = null); private List Layout() { @@ -300,9 +308,10 @@ private List FrozenLayout(Dictionary frozen) var textWidth = inner - (chip is null ? 0 : chip.Width + 8); var text = Format(BodyText(toast), TextSize, ink, bold: false, Math.Max(40, textWidth), lines: 3); var action = ActionText(toast) is { } a ? Format(a, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; - var height = (2 * Padding) + text.Height + (action is null ? 0 : action.Height + 6); + var source = SourceText(toast) is { } said ? Format(said.ToUpperInvariant(), ChipSize - 1, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var height = (2 * Padding) + text.Height + (action is null ? 0 : action.Height + 6) + (source is null ? 0 : source.Height + 2); var top = bottom - height; - return top < Inset ? null : new Placed(toast, new Rect(x, top, width, height), text, chip, action); + return top < Inset ? null : new Placed(toast, new Rect(x, top, width, height), text, chip, action, source); } private static FormattedText Format(string text, double size, Color colour, bool bold, double maxWidth, int lines = 1) => @@ -381,7 +390,7 @@ public override void Render(DrawingContext context) { var now = _clock.Elapsed; var hovered = HoveredToast(); - foreach (var (toast, rect, text, chip, action) in Layout()) + foreach (var (toast, rect, text, chip, action, source) in Layout()) { var palette = toast.Overlay.Palette; var plane = PanelText.Parse(palette.Plane); @@ -404,6 +413,13 @@ public override void Render(DrawingContext context) var x = rect.X + EdgeWidth + Padding; var y = rect.Y + Padding; + if (source is not null) + { + // The part of the client that spoke, as a small caption above the text: a label, not a key. + context.DrawText(source, new Point(x, y)); + y += source.Height + 2; + } + if (chip is not null) { var chipRect = new Rect(x - 3, y + 1, chip.Width + 6, chip.Height); diff --git a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs index dc074bc9..4b039bb0 100644 --- a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs +++ b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs @@ -49,6 +49,12 @@ internal sealed class PaletteOverlay : Panel /// What to list, and where a choice goes. /// Takes the overlay out of the window and gives the keyboard back to the cells. + /// + /// What the empty search box says: the surface's name first, as the cell popup's title and the header's search box + /// say it, then what can be typed. + /// + internal const string Placeholder = NativeHeader.SearchText + " — type a command, a character, a window or a setting"; + public PaletteOverlay(PaletteSession session, Action remove) { _session = session; @@ -62,7 +68,7 @@ public PaletteOverlay(PaletteSession session, Action remove) _search = new TextBox { - PlaceholderText = "Type a command, a character, a window or a setting", + PlaceholderText = Placeholder, FontSize = NativeTokens.Title, Margin = new Thickness(14, 14, 14, 6), Padding = new Thickness(12, 9), diff --git a/src/SharpMUTerm.Avalonia/SettingsPresenter.cs b/src/SharpMUTerm.Avalonia/SettingsPresenter.cs index 7304ed9f..2b85090d 100644 --- a/src/SharpMUTerm.Avalonia/SettingsPresenter.cs +++ b/src/SharpMUTerm.Avalonia/SettingsPresenter.cs @@ -23,6 +23,15 @@ internal sealed class SettingsPresenter : INativeSettings private SettingsWindow? _window; private Border? _scrim; + /// Whether the open window is docked beside the output (its size is then the main window's half, not the player's). + private bool _docked; + + /// The size the player last left the centred window at, kept for the run (never saved); null until they resize it. + internal Size? RememberedSize { get; private set; } + + /// Called on the window's thread once the settings window has opened or closed, so the main window can re-hide or show what sits under it. + public Action? OpenedOrClosed { get; set; } + /// The window the settings window belongs to, set once the main window exists. public Window? Owner { get; set; } @@ -48,13 +57,30 @@ internal SettingsWindow ShowNow(SettingsForm form) } var window = new SettingsWindow(form); + if (RememberedSize is { } remembered) + { + window.Width = remembered.Width; + window.Height = remembered.Height; + } + Place(window, form); + + // The size the player resizes the centred window to is the size it opens at next time, for the run. + window.Resized += (_, e) => + { + if (ReferenceEquals(_window, window) && !_docked && window.WindowState == WindowState.Normal + && e.ClientSize.Width > 0 && e.ClientSize.Height > 0) + { + RememberedSize = e.ClientSize; + } + }; window.Closed += (_, _) => { if (ReferenceEquals(_window, window)) { _window = null; Unveil(); + OpenedOrClosed?.Invoke(); } // The keyboard goes back to the client, as it does when a cell screen closes. @@ -71,6 +97,7 @@ internal SettingsWindow ShowNow(SettingsForm form) window.Show(); } + OpenedOrClosed?.Invoke(); return window; } @@ -90,6 +117,7 @@ private void Place(SettingsWindow window, SettingsForm form) if (form.BesideOutput) { + _docked = true; Unveil(); var scale = owner.RenderScaling; var size = owner.ClientSize; @@ -102,6 +130,24 @@ private void Place(SettingsWindow window, SettingsForm form) return; } + // Back from docked beside the output (or first opened): the player's size, centred over the main window. + if (_docked || window.WindowStartupLocation == WindowStartupLocation.CenterOwner) + { + var wasDocked = _docked; + _docked = false; + var size = RememberedSize ?? new Size(SettingsWindow.DefaultWidth, SettingsWindow.DefaultHeight); + window.Width = Math.Max(window.MinWidth, size.Width); + window.Height = Math.Max(window.MinHeight, size.Height); + if (wasDocked) + { + var scale = owner.RenderScaling; + var client = owner.ClientSize; + window.Position = new PixelPoint( + owner.Position.X + (int)Math.Round(Math.Max(0, client.Width - window.Width) / 2 * scale), + owner.Position.Y + (int)Math.Round(Math.Max(0, client.Height - window.Height) / 2 * scale)); + } + } + if (_scrim is null && owner.Content is Panel root) { var tokens = window.Tokens; diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index c1978367..26ab7eb1 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -51,13 +51,16 @@ internal sealed class SettingsWindow : Window private bool _choosing; private int _meterRows = -1; + /// The size the window first opens at, before the player resizes it. + internal const double DefaultWidth = 960, DefaultHeight = 680; + public SettingsWindow(SettingsForm form) { _form = form; _tokens = TokensFor(form); Title = "Settings"; - Width = 960; - Height = 680; + Width = DefaultWidth; + Height = DefaultHeight; MinWidth = 640; MinHeight = 420; WindowStartupLocation = WindowStartupLocation.CenterOwner; @@ -139,7 +142,10 @@ public SettingsWindow(SettingsForm form) dock.Children.Add(_sections); dock.Children.Add(_scroller); _frame = new Border { BorderThickness = new Thickness(1), Child = dock }; - Content = _frame; + + // The frame is ours, so the resize border is too: a band along each edge, as the borderless main window has. + CanResize = true; + Content = WindowChrome.WithResizeBands(this, _frame); _clock = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Background, (_, _) => Tick()); Opened += (_, _) => diff --git a/src/SharpMUTerm.Avalonia/WindowChrome.cs b/src/SharpMUTerm.Avalonia/WindowChrome.cs index 44f6f797..1db369b6 100644 --- a/src/SharpMUTerm.Avalonia/WindowChrome.cs +++ b/src/SharpMUTerm.Avalonia/WindowChrome.cs @@ -1,6 +1,8 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Input; +using Avalonia.Layout; +using Avalonia.Media; namespace SharpMUTerm.Avalonia; @@ -56,4 +58,61 @@ public static bool IsMoveHandle(ScreenFrame frame, System.Drawing.Point cell) => WindowEdge.SouthWest => StandardCursorType.BottomLeftCorner, _ => StandardCursorType.BottomRightCorner, }; + + /// + /// with a resize band along each edge of , for a window that draws + /// its own frame () and so gets no border to resize by from the platform. Each band + /// is wide, transparent, lies over the content's edge, shows the edge's cursor and begins the + /// platform's resize on a left press — what does for the main window. The corners are the + /// two bands' overlap, read off the press position, so a corner resizes both ways. Nothing happens while the window + /// is maximised, or cannot be resized. + /// + public static Panel WithResizeBands(Window window, Control content) + { + ArgumentNullException.ThrowIfNull(window); + ArgumentNullException.ThrowIfNull(content); + var panel = new Panel(); + panel.Children.Add(content); + foreach (var (horizontal, vertical, width, height) in new (HorizontalAlignment, VerticalAlignment, double, double)[] + { + (HorizontalAlignment.Stretch, VerticalAlignment.Top, double.NaN, EdgeBand), + (HorizontalAlignment.Stretch, VerticalAlignment.Bottom, double.NaN, EdgeBand), + (HorizontalAlignment.Left, VerticalAlignment.Stretch, EdgeBand, double.NaN), + (HorizontalAlignment.Right, VerticalAlignment.Stretch, EdgeBand, double.NaN), + }) + { + var band = new Border + { + Background = Brushes.Transparent, + HorizontalAlignment = horizontal, + VerticalAlignment = vertical, + Width = width, + Height = height, + Focusable = false, + Tag = ResizeBandTag, + }; + band.PointerMoved += (_, e) => + { + var edge = BandEdge(window, e); + band.Cursor = edge is { } at ? new Cursor(CursorFor(at)) : Cursor.Default; + }; + band.PointerPressed += (_, e) => + { + if (e.GetCurrentPoint(window).Properties.IsLeftButtonPressed && BandEdge(window, e) is { } edge) + { + e.Handled = true; + window.BeginResizeDrag(edge, e); + } + }; + panel.Children.Add(band); + } + + return panel; + } + + /// The each band of carries, so a test can find them. + internal const string ResizeBandTag = "resize-band"; + + private static WindowEdge? BandEdge(Window window, PointerEventArgs e) => + window is { WindowState: WindowState.Normal, CanResize: true } ? EdgeAt(e.GetPosition(window), window.ClientSize) : null; } diff --git a/src/SharpMUTerm.Client/Chrome/CharacterNames.cs b/src/SharpMUTerm.Client/Chrome/CharacterNames.cs index 6bd54741..25b48dfd 100644 --- a/src/SharpMUTerm.Client/Chrome/CharacterNames.cs +++ b/src/SharpMUTerm.Client/Chrome/CharacterNames.cs @@ -11,7 +11,17 @@ namespace SharpMUTerm.Client.Chrome; public static class CharacterNames { /// What goes between the character and the world. - public const string Separator = " · "; + public const string Separator = Core.Text.StatusFormatter.NameSeparator; + + /// + /// A window's name with the character it belongs to ahead of it — Corvid · Chat, the tab title of a window + /// that is not the character's own — in the same spelling as the character's name. The window alone without an owner. + /// + public static string Window(string? owner, string title) + { + ArgumentNullException.ThrowIfNull(title); + return string.IsNullOrEmpty(owner) ? title : owner + Separator + title; + } /// Corvid · Aetherfall; the world alone when there is no character. public static string Display(string world, string? character) diff --git a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs index e557033a..f5355827 100644 --- a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs +++ b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs @@ -30,8 +30,26 @@ public sealed record NoticeAction(string Command, string Label); /// A command the notice offers, or null. Only the window can offer it as a click. /// When it was said, on the client's clock. /// Counts the run's notices, so two that say the same thing are still two. -public sealed record NoticeModel(string Text, NoticeSeverity Severity, string? Key, NoticeAction? Action, DateTimeOffset At, long Sequence) +/// +/// What part of the client spoke when it is not a key (Packages, Map, Sound): a label, drawn as one — +/// Sound: on the status row, a plain caption on a toast — never in the key chip, where a word read as a chord to +/// press. A notice carries a or a source, not both. +/// +public sealed record NoticeModel(string Text, NoticeSeverity Severity, string? Key, NoticeAction? Action, DateTimeOffset At, long Sequence, string? Source = null) { + /// The source labels in use, so every notice of one part of the client names it the same way. + public static class Sources + { + /// Package installs, the index, removals. + public const string Packages = "Packages"; + + /// The map and a speedwalk. + public const string Map = "Map"; + + /// Game sound and mute. + public const string Sound = "Sound"; + } + /// How long a notice holds the status row, and how long a toast stays before it fades. public static readonly TimeSpan Duration = TimeSpan.FromSeconds(6); } diff --git a/src/SharpMUTerm.Client/Chrome/WindowTitle.cs b/src/SharpMUTerm.Client/Chrome/WindowTitle.cs index 9826bab9..52bab03e 100644 --- a/src/SharpMUTerm.Client/Chrome/WindowTitle.cs +++ b/src/SharpMUTerm.Client/Chrome/WindowTitle.cs @@ -4,7 +4,7 @@ namespace SharpMUTerm.Client.Chrome; /// /// The title the window — the desktop window's title bar and taskbar entry, or the terminal's tab — wears for what is -/// in front: Character@World — SharpMUTerm. One function, read off the same the +/// in front: Character · World — SharpMUTerm, the character named by 's rule. One function, read off the same the /// header band is drawn from, so the title and the header cannot name different characters. /// /// The names are the player's configuration, but a world a telnet:// link added is named after the link's host, @@ -24,7 +24,7 @@ public static class WindowTitle public static string For(HeaderModel header) => For(header.Character?.Name, header.World?.Name); /// - /// Character@World — SharpMUTerm; World — SharpMUTerm for a world with no character in front; and + /// Character · World — SharpMUTerm; World — SharpMUTerm for a world with no character in front; and /// SharpMUTerm alone when nothing is. /// public static string For(string? character, string? world) @@ -33,7 +33,7 @@ public static string For(string? character, string? world) var where = Clean(world); return (who, where) switch { - ({ Length: > 0 }, { Length: > 0 }) => $"{who}@{where} — {Product}", + ({ Length: > 0 }, { Length: > 0 }) => $"{CharacterNames.Display(where, who)} — {Product}", ({ Length: > 0 }, _) => $"{who} — {Product}", (_, { Length: > 0 }) => $"{where} — {Product}", _ => Product, diff --git a/src/SharpMUTerm.Core/Text/StatusFormatter.cs b/src/SharpMUTerm.Core/Text/StatusFormatter.cs index ebeb45b4..de0b81f8 100644 --- a/src/SharpMUTerm.Core/Text/StatusFormatter.cs +++ b/src/SharpMUTerm.Core/Text/StatusFormatter.cs @@ -7,7 +7,14 @@ namespace SharpMUTerm.Core.Text; /// public static class StatusFormatter { - /// The prompt label, e.g. Corvid@aetherfall ›. Falls back gracefully when disconnected. + /// + /// What goes between the character and the world: the client's one spelling of a character's name, + /// Corvid · Aetherfall (SharpMUTerm.Client.Chrome.CharacterNames, which Core cannot reference — a + /// Client test holds the two together). + /// + public const string NameSeparator = " · "; + + /// The prompt label, e.g. Corvid · Aetherfall ›. Falls back gracefully when disconnected. public static string CharacterPrompt(string? character, string? world) { if (string.IsNullOrEmpty(character)) @@ -15,6 +22,6 @@ public static string CharacterPrompt(string? character, string? world) return "› "; } - return string.IsNullOrEmpty(world) ? $"{character} › " : $"{character}@{world} › "; + return string.IsNullOrEmpty(world) ? $"{character} › " : $"{character}{NameSeparator}{world} › "; } } diff --git a/src/SharpMUTerm.Tui/CommandPalette.cs b/src/SharpMUTerm.Tui/CommandPalette.cs index ed812bb5..1bb1478e 100644 --- a/src/SharpMUTerm.Tui/CommandPalette.cs +++ b/src/SharpMUTerm.Tui/CommandPalette.cs @@ -15,6 +15,9 @@ namespace SharpMUTerm.Tui; /// internal sealed class CommandPalette { + /// The surface's name: the popup's title here, and what the window's header search box and native palette say. + internal const string Title = "Command palette"; + private readonly ConsoleWindowSystem _system; private readonly Func> _catalog; private readonly Func _context; @@ -127,7 +130,7 @@ private void Open() // centring first placed the surface as if it were that size — which only became visible once // the catalog grew tall enough for the misplacement to push its bottom border off-screen. _window = new WindowBuilder(_system) - .WithTitle("Command palette") + .WithTitle(Title) .AsModal() .WithBorderStyle(BorderStyle.Single) .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs index 16d17960..032988b4 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs @@ -50,7 +50,9 @@ internal string NoticeMarkup(NoticeModel notice) var body = notice.Severity == NoticeSeverity.Warning ? $"[{ScreenPalette.Warn}]{Escape(notice.Text)}[/]" : $"[dim]{Escape(notice.Text)}[/]"; - return notice.Key is null ? body : $"[{_ink.Notice}]{Escape(notice.Key)}[/] {body}"; + // A source is a label (Sound:), a key a chord chip (⌃P): two shapes, so a word is never read as a key to press. + return notice.Source is { } source ? $"[{_ink.Notice}]{Escape(source)}:[/] {body}" + : notice.Key is null ? body : $"[{_ink.Notice}]{Escape(notice.Key)}[/] {body}"; } /// Hands a notice to a host that draws notices natively; nothing for one that does not. @@ -141,8 +143,8 @@ private static bool TryParseRgb(string hex, out Rgb rgb) internal NoticeModel? LastNoticeModel => DrawnModel(SurfaceCatalog.Notice) as NoticeModel; /// Says a notice through the real , as a test needs one with an action. - internal void SimulateNotice(string text, MessageSeverity severity, string? key, NoticeAction? action) => - Notice(text, severity, key, action); + internal void SimulateNotice(string text, MessageSeverity severity, string? key, NoticeAction? action, string? source = null) => + Notice(text, severity, key, action, source); } /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs index 0f67fd3a..dda4127f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs @@ -263,7 +263,7 @@ internal bool AcceptPackage(PackageReviewModel review) SyncPackages(); SaveConfiguration(); var said = $"Installed {manifest.Name} {manifest.Version} · F10 lists your packages"; - Notice(said, MessageSeverity.Info, key: "package"); + Notice(said, MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Packages); _packageManager?.PublishStatus(said); return true; } @@ -283,7 +283,7 @@ internal void CancelPackage(PackageReviewModel review) /// private void Fetch(Uri uri, string what, Action then) { - Notice($"Fetching {Snippet(uri.Host)}…", MessageSeverity.Info, key: "package"); + Notice($"Fetching {Snippet(uri.Host)}…", MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Packages); var fetch = PackageFetch ?? DownloadPackageAsync; _ = Task.Run(async () => { @@ -534,7 +534,7 @@ internal void RemovePackage(string id) SyncPackages(); SaveConfiguration(); var said = $"Removed {package.Manifest.Name}."; - Notice(said, MessageSeverity.Info, key: "package"); + Notice(said, MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Packages); _packageManager?.PublishStatus(said); } @@ -557,7 +557,7 @@ internal void CopyPackageSets(string id) SaveConfiguration(); var said = $"Copied {package.Sets.Count} set(s) to yours; assign them on F5, and switch the package off (Space) to use only your copy."; - Notice(said, MessageSeverity.Info, key: "package"); + Notice(said, MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Packages); _packageManager?.PublishStatus(said); _packageManager?.NotifyChanged(); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Sound.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Sound.cs index 870ae6b4..00ce192f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Sound.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Sound.cs @@ -103,7 +103,7 @@ private void OnMedia(WorldSession session, MediaCommand command) _audio = Host.Audio?.Invoke(); if (CanPlaySound && _audio is null) { - Notice("No sound device could be opened; game sound is captions only.", MessageSeverity.Info, key: "sound"); + Notice("no device could be opened; game sound is captions only.", MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Sound); } } @@ -137,7 +137,7 @@ private void SetMuted(bool muted) { _muted = muted; ApplySoundMix(); - Notice(muted ? "Sound muted." : "Sound on.", MessageSeverity.Info, key: "sound"); + Notice(muted ? "muted." : "on.", MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Sound); RefreshStatusBar(); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs index 553ab6e4..15234794 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs @@ -1,4 +1,6 @@ using SharpConsoleUI.Controls; +using SharpConsoleUI.Drivers; +using SharpConsoleUI.Events; using SharpMUTerm.Client.Commands; using SharpMUTerm.Client.Surfaces; using SharpMUTerm.Core.Commands; @@ -44,6 +46,107 @@ internal sealed partial class SharpMUTermApp /// its chip over the strip's last cells. On every frame, after the paint, beside the header dividers. /// private void PaintTabOverflow(SharpConsoleUI.Layout.CharacterBuffer buffer) + { + try + { + PaintTabOverflowChips(buffer); + } + finally + { + // Published whole, for the driver's input thread (TakesTabOverflowPress), which must not read the dictionary + // this frame is rebuilding. + _tabOverflowChips = [.. _tabOverflow.Values.Select(o => o.Chip)]; + } + } + + /// Where every chip is, in desktop cells, as the last frame painted them; replaced whole, read on the input thread. + private volatile PaneRect[] _tabOverflowChips = []; + + /// + /// Takes a left-button frame on a chip away from the framework, on the driver's input thread before the framework's + /// own handler sees the same list (it subscribes inside Run(), after this client). The chip is painted over the + /// strip's last cells, which can be the tail of a tab the framework did draw — its name or its × — so + /// left alone the click that opens the list also selected (or closed) that tab under it. The button flags are struck + /// out of the frame, which leaves the framework a pointer movement; this client's own pointer path has its own copy and + /// still opens the list. Both hosts deliver mouse frames through this one handler, so both are covered. Internal for tests. + /// + internal bool TakesTabOverflowPress(List flags, System.Drawing.Point point) + { + var chips = _tabOverflowChips; + if (chips.Length == 0 || !chips.Any(c => Contains(c, point))) + { + return false; + } + + var removed = flags.RemoveAll(f => f is MouseFlags.Button1Pressed or MouseFlags.Button1Released + or MouseFlags.Button1Clicked or MouseFlags.Button1DoubleClicked or MouseFlags.Button1TripleClicked + or MouseFlags.Button1Dragged); + if (removed > 0 && flags.Count == 0) + { + flags.Add(MouseFlags.ReportMousePosition); + } + + return removed > 0; + } + + /// + /// The frame a press on a pane's chip leaves for the framework, delivered to that pane's tab strip at every cell of the + /// chip, as the framework would deliver it: true when any of them moved the strip's selection or asked to close a tab. + /// Internal for tests, for 's reason (the framework's mouse path runs only inside + /// Run()). + /// + internal bool AChipClickReachesTheTabUnderIt(string paneId, bool filtered) + { + TabControl? tabs; + lock (_paneTabsLock) + { + tabs = _paneTabs.GetValueOrDefault(paneId); + } + + if (tabs is null || TabOverflowChipAt(paneId) is not { } chip) + { + return false; + } + + var before = tabs.ActiveTabIndex; + var closed = false; + void OnClose(object? sender, TabEventArgs e) => closed = true; + tabs.TabCloseRequested += OnClose; + try + { + for (var x = chip.X; x < chip.X + chip.Width; x++) + { + var point = new System.Drawing.Point(x, chip.Y); + foreach (var frame in new[] { new List { MouseFlags.Button1Pressed }, [MouseFlags.Button1Released, MouseFlags.Button1Clicked] }) + { + if (filtered) + { + TakesTabOverflowPress(frame, point); + } + + var local = new System.Drawing.Point(tabs.ActualWidth - (chip.X + chip.Width - x), 0); + tabs.ProcessMouseEvent(new MouseEventArgs(frame, local, point, point, _window)); + } + + if (tabs.ActiveTabIndex != before || closed) + { + return true; + } + } + + return false; + } + finally + { + tabs.TabCloseRequested -= OnClose; + if (tabs.ActiveTabIndex != before) + { + tabs.ActiveTabIndex = before; + } + } + } + + private void PaintTabOverflowChips(SharpConsoleUI.Layout.CharacterBuffer buffer) { _tabOverflow.Clear(); foreach (var (paneId, tabs, _) in RealisedPanes()) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 6c896f39..9098b75e 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1902,6 +1902,7 @@ public string RenderSnapshot(string? view = null) "⌥M", new NoticeAction(Client.Commands.LayoutCommands.Manage, "Change layout")); RefusePrefix(PrefixPanel.NoSplitRefusal); + Notice("muted.", MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Sound); Notice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error, "⌃P"); } @@ -6746,7 +6747,7 @@ private void RefreshStatusRow() } /// - /// Refreshes the input region: each bar's character-bound prompt (Corvid@Aetherfall ›) and + /// Refreshes the input region: each bar's character-bound prompt (Corvid · Aetherfall ›) and /// the status bar (which carries the live character count now that the gutter is gone). The armed /// bar's prompt is the bright one and ends in ›; the other is dimmed and ends in ·, /// so which line ⏎ will send is readable without hunting for the caret. @@ -9114,7 +9115,7 @@ private void WalkFromMap(string windowId, long room) if (map.WalkTo(room) is { } problem) { - Notice($"Cannot walk there: {problem}.", key: "map"); + Notice($"cannot walk there: {problem}.", source: NoticeModel.Sources.Map); } } @@ -9192,7 +9193,7 @@ private void OnWalkChanged(WorldSession session, string? reason) RenderMap(MapWindowId(session.SessionKey)); if (reason is not null) { - Notice($"Walk {reason}.", MessageSeverity.Info, key: "map"); + Notice($"walk {reason}.", MessageSeverity.Info, source: NoticeModel.Sources.Map); } } @@ -12445,6 +12446,13 @@ private void OnDriverMouseEvent(object sender, List flags, System.Dr var frame = flags.ToList(); OnUiThread(() => OnPointerFrame(frame, point)); + // A press on a tab strip's +N ▾ chip opens its list and nothing else: the framework, which reads this same list + // after us, is left a pointer movement rather than a click on the tab under the chip. + if (TakesTabOverflowPress(flags, point)) + { + return; + } + // Overlays own the whole screen while they're up; a drag underneath them would target panes // the user can't even see. if (AnyOverlayOpen || _moveMode) @@ -13560,11 +13568,11 @@ private void SetStatus(string markup, bool displace = false) /// A command the notice offers. The status row never draws it (a terminal cell is not a button, and the text /// already names the key); a host that draws notices natively offers it as a click (). /// - private void Notice(string text, MessageSeverity severity = MessageSeverity.Warning, string? key = null, NoticeAction? action = null) + private void Notice(string text, MessageSeverity severity = MessageSeverity.Warning, string? key = null, NoticeAction? action = null, string? source = null) { // The same notice raised again while it is still up is one notice: it keeps the row for another few seconds and // is not said, toasted or announced a second time. Two identical toasts stacked in the window were the report. - if (_notice is not null && _noticeShown is { } shown && shown.Text == text && shown.Key == key + if (_notice is not null && _noticeShown is { } shown && shown.Text == text && shown.Key == key && shown.Source == source && shown.Severity == NoticeSeverityOf(severity) && shown.Action == action) { _noticeTimer?.Change(NoticeDuration, Timeout.InfiniteTimeSpan); @@ -13582,13 +13590,13 @@ private void Notice(string text, MessageSeverity severity = MessageSeverity.Warn _ => LogLevel.Information, }, "{Notice:l}", // :l renders the string literally; the default quotes it, and a quoted sentence reads as data - key is null ? text : $"{key} {text}"); + source is not null ? $"{source}: {text}" : key is null ? text : $"{key} {text}"); AnnounceNotice(text); var model = Drawing( SurfaceCatalog.Notice, string.Empty, - new NoticeModel(text, NoticeSeverityOf(severity), key, action, _time.GetUtcNow(), ++_noticeSequence)); + new NoticeModel(text, NoticeSeverityOf(severity), source is null ? key : null, action, _time.GetUtcNow(), ++_noticeSequence, source)); var markup = NoticeMarkup(model); _notice = markup; diff --git a/src/SharpMUTerm.Tui/TabStripFit.cs b/src/SharpMUTerm.Tui/TabStripFit.cs index 778c9a1c..aa0c1cd6 100644 --- a/src/SharpMUTerm.Tui/TabStripFit.cs +++ b/src/SharpMUTerm.Tui/TabStripFit.cs @@ -33,7 +33,7 @@ namespace SharpMUTerm.Tui; /// /// /// The owner prefix goes first, and goes for everybody. A pane full of one character's captures -/// repeats Corvid - on every tab, which is the cheapest thing in the strip to lose and the most +/// repeats Corvid · on every tab, which is the cheapest thing in the strip to lose and the most /// there is of it — dropping it is what turns eight tabs that do not fit into eight tabs that nearly do. /// It is dropped across the whole strip rather than per tab, so the tabs stay comparable, and what it /// said is still said twice over: by the chip the tab is painted on, and by the ⌁ a window diff --git a/src/SharpMUTerm.Tui/TabTitles.cs b/src/SharpMUTerm.Tui/TabTitles.cs index e7840200..fa6de88f 100644 --- a/src/SharpMUTerm.Tui/TabTitles.cs +++ b/src/SharpMUTerm.Tui/TabTitles.cs @@ -115,11 +115,10 @@ public static string Name(WorkspaceWindow window) { ArgumentNullException.ThrowIfNull(window); - var owner = window.Kind != WindowKind.Main && !string.IsNullOrEmpty(window.OwnerLabel) - ? window.OwnerLabel + " - " - : string.Empty; - - return owner + window.Title; + // The owner ahead of the title in the client's one spelling of a name (Corvid · Chat), not a dash of its own. + return window.Kind != WindowKind.Main + ? SharpMUTerm.Client.Chrome.CharacterNames.Window(window.OwnerLabel, window.Title) + : window.Title; } /// diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs index 00b3fc17..b11bedc2 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativePaletteTests.cs @@ -92,6 +92,16 @@ public async Task CtrlPOpensTheNativePaletteWithTheSearchFocusedAndNoCellPopup() await Assert.That(onTop).IsTrue().Because("nothing native draws over it: it is the root panel's last child"); } + /// The empty search box names the surface as the cell popup's title and the header's search box do. + [Test] + public async Task TheSearchBoxSaysCommandPaletteAsTheCellTitleDoes() + { + var placeholder = await Run(rig => Open(rig).SearchBox.PlaceholderText); + + await Assert.That(placeholder).StartsWith(CommandPalette.Title); + await Assert.That(NativeHeader.SearchText).IsEqualTo(CommandPalette.Title); + } + [Test] public async Task ThePaletteCentresOverTheWholeWindowAndClearsTheNativeHeader() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs index 08046f7d..c1ccea22 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs @@ -24,6 +24,24 @@ public class NoticeToastTests private static NoticeOverlay Overlay(long sequence, string text, NoticeAction? action, Action run, int aboveRow = 8) => new(new NoticeModel(text, NoticeSeverity.Info, "⌥M", action, DateTimeOffset.UnixEpoch, sequence), aboveRow, Palette, run); + /// A notice's source is a caption on the toast, not a key chip: a word in a chip reads as a key to press. + [Test] + public async Task ASourceIsACaptionAndAKeyIsAChip() + { + var (labels, words) = await Run((window, view, layer, driver) => + { + var notices = (IPointerPresenter)driver.Pointer; + notices.Notice(new NoticeOverlay(new NoticeModel("muted.", NoticeSeverity.Info, null, null, DateTimeOffset.UnixEpoch, 1, NoticeModel.Sources.Sound), 8, Palette, _ => { })); + notices.Notice(Overlay(2, "nothing to split", null, _ => { })); + Drain(); + return (layer.Toasts.LabelIsChip(), layer.Toasts.DrawnText()); + }, columns: 80, rows: 20); + + await Assert.That(labels).IsEquivalentTo(new bool?[] { false, true }); + await Assert.That(words).Contains("Sound"); + await Assert.That(words).Contains("Alt+M"); + } + [Test] public async Task AToastStacksAboveTheCommandLineAndAClickRunsItsActionWithoutTakingFocus() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/OutputAutomationTests.cs b/tests/SharpMUTerm.Avalonia.Tests/OutputAutomationTests.cs index 41084050..f4eebb2c 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/OutputAutomationTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/OutputAutomationTests.cs @@ -73,9 +73,9 @@ public async Task TheWindowTitleBarCarriesWhatTheClientSaid() var heard = new List(); bar.Changed += heard.Add; - bar.Show("Ann@Mush — SharpMUTerm"); + bar.Show("Ann · Mush — SharpMUTerm"); - await Assert.That(bar.Current).IsEqualTo("Ann@Mush — SharpMUTerm"); - await Assert.That(heard).IsEquivalentTo(new[] { "Ann@Mush — SharpMUTerm" }); + await Assert.That(bar.Current).IsEqualTo("Ann · Mush — SharpMUTerm"); + await Assert.That(heard).IsEquivalentTo(new[] { "Ann · Mush — SharpMUTerm" }); } } diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowFrameTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowFrameTests.cs new file mode 100644 index 00000000..54a6e741 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowFrameTests.cs @@ -0,0 +1,141 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Input; +using Avalonia.Threading; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Tui; +using static SharpMUTerm.Avalonia.Tests.DesktopLayerTests; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The settings window draws its own frame (title, ✕, Esc, drag to move), so it gets no resize border from the platform: +/// it carries its own bands along each edge, as the borderless main window does, and the size the player leaves it at is +/// the size it opens at for the rest of the run. And it is a window of its own, so opening or closing it re-checks the +/// main window's toasts at once. +/// +[NotInParallel] +public class SettingsWindowFrameTests +{ + private static SettingsForm Form(AppConfiguration config, string section = "text", bool beside = false) => + new(BuiltInSettings.All, config, c => c(), _ => { }, section, isDark: true) { BesideOutput = beside }; + + [Test] + public async Task TheFramelessSettingsWindowHasAResizeBandAlongEveryEdge() + { + var (resizable, bands, cursors) = await TerminalViewTests.Session.Dispatch(() => + { + var presenter = new SettingsPresenter(); + var main = new Window { Content = new Panel(), Width = 1400, Height = 900 }; + presenter.Owner = main; + main.Show(); + try + { + var window = presenter.ShowNow(Form(new AppConfiguration())); + Dispatcher.UIThread.RunJobs(); + window.UpdateLayout(); + var size = window.ClientSize; + var bands = window.GetVisualDescendantsOf().Count(b => Equals(b.Tag, WindowChrome.ResizeBandTag)); + + // What lies under each edge is a band, so a press there resizes rather than reaching the page. + var cursors = new[] + { + new Point(size.Width / 2, 1), new Point(size.Width / 2, size.Height - 1), + new Point(1, size.Height / 2), new Point(size.Width - 1, size.Height / 2), + }.Select(p => window.InputHitTest(p) is Border { Tag: WindowChrome.ResizeBandTag }).ToArray(); + window.Close(); + return (window.CanResize, bands, cursors); + } + finally + { + main.Close(); + } + }, CancellationToken.None); + + await Assert.That(resizable).IsTrue(); + await Assert.That(bands).IsEqualTo(4); + await Assert.That(cursors.All(c => c)).IsTrue().Because("every edge is a resize band"); + await Assert.That(WindowChrome.EdgeAt(new Point(1, 1), new Size(800, 600))).IsEqualTo(WindowEdge.NorthWest); + } + + [Test] + public async Task TheSizeThePlayerLeavesItAtIsTheSizeItReopensAtButDockingBesideTheOutputIsNotRemembered() + { + var (reopened, afterDock, remembered) = await TerminalViewTests.Session.Dispatch(() => + { + var presenter = new SettingsPresenter(); + var main = new Window { Content = new Panel(), Width = 1400, Height = 900 }; + presenter.Owner = main; + main.Show(); + var config = new AppConfiguration(); + try + { + var window = presenter.ShowNow(Form(config)); + Dispatcher.UIThread.RunJobs(); + window.Width = 1100; + window.Height = 720; + Dispatcher.UIThread.RunJobs(); + window.UpdateLayout(); + window.Close(); + Dispatcher.UIThread.RunJobs(); + + var again = presenter.ShowNow(Form(config)); + Dispatcher.UIThread.RunJobs(); + var reopened = new Size(again.Width, again.Height); + again.Close(); + Dispatcher.UIThread.RunJobs(); + + var beside = presenter.ShowNow(Form(config, "triggers", beside: true)); + Dispatcher.UIThread.RunJobs(); + beside.Close(); + Dispatcher.UIThread.RunJobs(); + var after = presenter.ShowNow(Form(config)); + Dispatcher.UIThread.RunJobs(); + var afterDock = new Size(after.Width, after.Height); + after.Close(); + return (reopened, afterDock, presenter.RememberedSize); + } + finally + { + main.Close(); + } + }, CancellationToken.None); + + await Assert.That(reopened).IsEqualTo(new Size(1100, 720)); + await Assert.That(afterDock).IsEqualTo(new Size(1100, 720)).Because("docked beside the output is the main window's half, not the player's size"); + await Assert.That(remembered).IsEqualTo(new Size(1100, 720)); + } + + /// + /// A toast up when the settings window opens goes at once, and comes back when it closes — without waiting for the + /// client to paint a frame, which opening another window does not cause. + /// + [Test] + public async Task ToastsHideTheMomentTheSettingsWindowOpensAndReturnWhenItCloses() + { + var (before, whileOpen, after) = await Run((window, view, layer, driver) => + { + driver.Settings.Owner = window; + layer.ToastsHidden = () => driver.Settings.Window is not null; + driver.Settings.OpenedOrClosed = layer.Sync; + var palette = new NoticePalette("#333344", "#e0e0e0", "#5fafff", "#ff6b6b", "#ffaf5f"); + ((IPointerPresenter)driver.Pointer).Notice(new NoticeOverlay( + new NoticeModel("saved", NoticeSeverity.Info, null, null, DateTimeOffset.UnixEpoch, 1), 8, palette, _ => { })); + Drain(); + var before = layer.Toasts.IsVisible; + var settings = driver.Settings.ShowNow(Form(new AppConfiguration())); + Drain(); + var whileOpen = layer.Toasts.IsVisible; + settings.Close(); + Drain(); + return (before, whileOpen, layer.Toasts.IsVisible); + }, columns: 80, rows: 20); + + await Assert.That(before).IsTrue(); + await Assert.That(whileOpen).IsFalse().Because("nothing of a toast shows beside the settings window"); + await Assert.That(after).IsTrue(); + } +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 4636e3f1..c3eeb2dd 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -196,7 +196,8 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! await using var app = App(driver, DemoScene.Build()); app.RenderSnapshot("notices"); var said = driver.Pointer.Notices; - await Assert.That(said.Count).IsEqualTo(3); + await Assert.That(said.Count).IsEqualTo(4); + await Assert.That(said.Count(n => n.Notice.Source is not null)).IsEqualTo(1).Because("one is a source label, not a key"); await Assert.That((object)said[^1].Notice).IsEqualTo(app.DrawnModel(SurfaceCatalog.Notice)).Because("notice"); await Assert.That(app.NoticeMarkup(said[^1].Notice)).IsEqualTo(app.LastNotice); await Assert.That(said[0].Notice.Action).IsNotNull().Because("the first offers its action"); diff --git a/tests/SharpMUTerm.Avalonia.Tests/TabOverflowWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/TabOverflowWindowTests.cs new file mode 100644 index 00000000..caf554da --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/TabOverflowWindowTests.cs @@ -0,0 +1,33 @@ +using SharpConsoleUI.Drivers; +using static SharpMUTerm.Avalonia.Tests.DesktopLayerTests; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The tab strip's +N ▾ chip in the window: a click on it reaches the client through the same driver handler a +/// terminal's does, and what the framework — subscribed after the client, as it is inside Run() — sees of the same +/// frame carries no button, so the tab drawn under the chip is neither selected nor closed. +/// +[NotInParallel] +public class TabOverflowWindowTests +{ + [Test] + public async Task InTheWindowAClickOnTheChipLeavesTheFrameworkNoClick() + { + using var driver = new AvaloniaConsoleDriver(56, 20); + await using var app = InlineWindowApp(driver); + app.RenderSnapshot("tabs-many"); + var (paneId, _) = app.TabOverflowMenus.Single(); + var chip = app.TabOverflowChipAt(paneId)!.Value; + + // Stands where the framework stands: a later subscriber to the driver's mouse stream. + var frameworkSaw = new List(); + driver.MouseEvent += (_, flags, _) => frameworkSaw.AddRange(flags); + var at = new System.Drawing.Point(chip.X + 1, chip.Y); + driver.RaiseMouse([MouseFlags.Button1Pressed], at); + driver.RaiseMouse([MouseFlags.Button1Released, MouseFlags.Button1Clicked], at); + + await Assert.That(frameworkSaw.Any(f => f.ToString().StartsWith("Button1", StringComparison.Ordinal))).IsFalse(); + await Assert.That(app.AChipClickReachesTheTabUnderIt(paneId, filtered: true)).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/WindowTitleTests.cs b/tests/SharpMUTerm.Client.Tests/WindowTitleTests.cs index 16744534..f4feee4b 100644 --- a/tests/SharpMUTerm.Client.Tests/WindowTitleTests.cs +++ b/tests/SharpMUTerm.Client.Tests/WindowTitleTests.cs @@ -4,11 +4,11 @@ namespace SharpMUTerm.Client.Tests; -/// The one title both hosts show for what is in front: Character@World — SharpMUTerm. +/// The one title both hosts show for what is in front: Character · World — SharpMUTerm. public class WindowTitleTests { [Test] - [Arguments("Corvid", "Aetherfall", "Corvid@Aetherfall — SharpMUTerm")] + [Arguments("Corvid", "Aetherfall", "Corvid · Aetherfall — SharpMUTerm")] [Arguments(null, "Aetherfall", "Aetherfall — SharpMUTerm")] [Arguments("", "Aetherfall", "Aetherfall — SharpMUTerm")] [Arguments(null, null, "SharpMUTerm")] @@ -25,7 +25,7 @@ public async Task TheTitleIsReadOffTheHeadersOwnModel() Character = new HeaderCharacter("Corvid", "Aetherfall.Corvid", CharacterPresence.Online, "aetherfall.mux", 4201, false, "x"), }; - await Assert.That(WindowTitle.For(header)).IsEqualTo("Corvid@Aetherfall — SharpMUTerm"); + await Assert.That(WindowTitle.For(header)).IsEqualTo("Corvid · Aetherfall — SharpMUTerm"); await Assert.That(WindowTitle.For(HeaderModel.Empty)).IsEqualTo(WindowTitle.Product); } @@ -35,11 +35,27 @@ public async Task ControlCharactersAreDroppedAndLongNamesAreCut() { var title = WindowTitle.For("Cor\u0007vid\u001b]2;x", "evil\r\nworld"); - await Assert.That(title).IsEqualTo("Corvid]2;x@evilworld — SharpMUTerm"); + await Assert.That(title).IsEqualTo("Corvid]2;x · evilworld — SharpMUTerm"); await Assert.That(title.Any(char.IsControl)).IsFalse(); var longName = new string('n', 200); var cut = WindowTitle.For(longName, "w"); - await Assert.That(cut).StartsWith(new string('n', WindowTitle.MaxPart - 1) + "…@w"); + await Assert.That(cut).StartsWith(new string('n', WindowTitle.MaxPart - 1) + "… · w"); + } + + /// + /// One spelling of a character's name everywhere: the title, the prompt and a tab's owner prefix all read + /// 's, so none of them can drift back to Corvid@Aetherfall or Corvid - Chat. + /// + [Test] + public async Task TheTitleThePromptAndATabsOwnerSpellANameTheSameWay() + { + var name = CharacterNames.Display("Aetherfall", "Corvid"); + + await Assert.That(name).IsEqualTo("Corvid · Aetherfall"); + await Assert.That(WindowTitle.For("Corvid", "Aetherfall")).IsEqualTo(name + " — " + WindowTitle.Product); + await Assert.That(StatusFormatter.CharacterPrompt("Corvid", "Aetherfall")).IsEqualTo(name + " › "); + await Assert.That(CharacterNames.Window("Corvid", "Chat")).IsEqualTo("Corvid" + CharacterNames.Separator + "Chat"); + await Assert.That(CharacterNames.Window(null, "Chat")).IsEqualTo("Chat"); } } diff --git a/tests/SharpMUTerm.Core.Tests/Text/StatusLineTests.cs b/tests/SharpMUTerm.Core.Tests/Text/StatusLineTests.cs index a6581133..426a9113 100644 --- a/tests/SharpMUTerm.Core.Tests/Text/StatusLineTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Text/StatusLineTests.cs @@ -7,7 +7,7 @@ public class StatusLineTests [Test] public async Task CharacterPrompt_BindsToCharacterAtWorld() { - await Assert.That(StatusFormatter.CharacterPrompt("Corvid", "aetherfall")).IsEqualTo("Corvid@aetherfall › "); + await Assert.That(StatusFormatter.CharacterPrompt("Corvid", "aetherfall")).IsEqualTo("Corvid · aetherfall › "); await Assert.That(StatusFormatter.CharacterPrompt(null, null)).IsEqualTo("› "); } } diff --git a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs index 0711de0d..14f2f47a 100644 --- a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs @@ -53,6 +53,43 @@ public async Task TheStatusRowDrawsANoticeAsItAlwaysHas() await Assert.That(app.LastNotice).IsEqualTo($"{chip}F5[/] [dim]saved [[x]][/]"); } + /// + /// A notice from a part of the client rather than a key (packages, the map, sound) carries a source, drawn as a label + /// — Sound: — and never in the key's place, where a word read as a chord to press. No notice in the client + /// passes a word as its key any more. + /// + [Test] + public async Task ASourceIsALabelNotAChord() + { + await using var app = App(); + app.RenderSnapshot(null); + + app.SimulateNotice("on.", MessageSeverity.Info, null, null, NoticeModel.Sources.Sound); + var model = (NoticeModel?)app.DrawnModel(SurfaceCatalog.Notice); + + await Assert.That(model!.Source).IsEqualTo("Sound"); + await Assert.That(model.Key).IsNull().Because("a source is not a key"); + await Assert.That(app.LastNotice).EndsWith("]Sound:[/] [dim]on.[/]"); + + var words = Directory.GetFiles(SourceRoot(), "*.cs", SearchOption.AllDirectories) + .SelectMany(f => File.ReadAllLines(f).Select(l => (f, l))) + .Where(x => System.Text.RegularExpressions.Regex.IsMatch(x.l, "Notice\\(.*key: \"[a-z]")) + .Select(x => $"{Path.GetFileName(x.f)}: {x.l.Trim()}") + .ToList(); + await Assert.That(words).IsEmpty().Because("a word as a notice's key reads as a chord; it is a source"); + } + + private static string SourceRoot() + { + var dir = new DirectoryInfo(AppContext.BaseDirectory); + while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "SharpMUTerm.slnx"))) + { + dir = dir.Parent; + } + + return Path.Combine(dir!.FullName, "src", "SharpMUTerm.Tui"); + } + /// The model the row was drawn from is recorded as the notice surface's drawn model, sequence and all. [Test] public async Task EachNoticeIsOneModelTheRowIsDrawnFrom() diff --git a/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs b/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs index a28b039b..df5ba4fc 100644 --- a/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs @@ -89,6 +89,36 @@ public async Task ACommandTheListDidNotOfferIsRefused() await Assert.That(app.RunTabOverflowEntry("term:quit")).IsFalse(); } + /// + /// The chip is painted over the strip's last cells, which can be the tail of a tab the framework drew. A press on it + /// opens the list and nothing else: the frame the framework is left (it reads the same list after this client) carries + /// no button, so no tab under the chip is selected or closed. + /// + [Test] + public async Task AClickOnTheChipDoesNotAlsoSelectTheTabUnderIt() + { + var (app, _) = Crowded(); + var (paneId, _) = app.TabOverflowMenus.Single(); + var chip = app.TabOverflowChipAt(paneId)!.Value; + var press = new List { MouseFlags.Button1Pressed }; + var click = new List { MouseFlags.Button1Released, MouseFlags.Button1Clicked }; + var at = new System.Drawing.Point(chip.X + 1, chip.Y); + + await Assert.That(app.AChipClickReachesTheTabUnderIt(paneId, filtered: false)).IsTrue() + .Because("unfiltered, the framework's own click on the chip's cells lands on the tab drawn under it — the defect"); + + await Assert.That(app.TakesTabOverflowPress(press, at)).IsTrue(); + await Assert.That(app.TakesTabOverflowPress(click, at)).IsTrue(); + await Assert.That(press.Concat(click).Any(f => f.ToString().StartsWith("Button1", StringComparison.Ordinal))).IsFalse() + .Because("the framework is left a movement, not a click"); + await Assert.That(app.AChipClickReachesTheTabUnderIt(paneId, filtered: true)).IsFalse() + .Because("no cell of the chip selects or closes the tab drawn under it"); + + var elsewhere = new List { MouseFlags.Button1Pressed }; + await Assert.That(app.TakesTabOverflowPress(elsewhere, new System.Drawing.Point(chip.X - 3, chip.Y))).IsFalse(); + await Assert.That(elsewhere).Contains(MouseFlags.Button1Pressed).Because("a press beside the chip is the strip's as before"); + } + [Test] public async Task TheCellListNamesEachHiddenTabWithADigit() { diff --git a/tests/SharpMUTerm.Tui.Tests/TabStripFitTests.cs b/tests/SharpMUTerm.Tui.Tests/TabStripFitTests.cs index 86bb9aae..d080b7a6 100644 --- a/tests/SharpMUTerm.Tui.Tests/TabStripFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TabStripFitTests.cs @@ -11,13 +11,13 @@ public class TabStripFitTests { /// /// One tab: is what it would draw whole, and the part after the last - /// " - " is its title — the same split TabTitles.Name makes. + /// " · " is its title — the same split TabTitles.Name makes. /// is what the tab spends besides its name; three is the ordinary case (a space either side, and the /// separator that follows it). /// private static TabCost Tab(string name, bool selected = false, int extra = 3) { - var at = name.LastIndexOf(" - ", StringComparison.Ordinal); + var at = name.LastIndexOf(" · ", StringComparison.Ordinal); return new TabCost(name.Length, at >= 0 ? name.Length - at - 3 : name.Length, extra, selected); } @@ -28,7 +28,7 @@ private static IReadOnlyList Budgets(int width, params TabCost[] tabs) => [Test] public async Task AStripThatFitsIsNotElidedAtAll() { - var tabs = new[] { Tab("Corvid - Chat"), Tab("Corvid - Public", selected: true) }; + var tabs = new[] { Tab("Corvid · Chat"), Tab("Corvid · Public", selected: true) }; await Assert.That(Budgets(100, tabs)).IsEquivalentTo(new[] { 13, 15 }); } @@ -40,7 +40,7 @@ public async Task AStripThatFitsIsNotElidedAtAll() [Test] public async Task AnUnarrangedStripElidesNothing() { - var tabs = new[] { Tab("Corvid - Chat"), Tab("Corvid - O-Gatecrashers", selected: true) }; + var tabs = new[] { Tab("Corvid · Chat"), Tab("Corvid · O-Gatecrashers", selected: true) }; await Assert.That(Budgets(0, tabs)).IsEquivalentTo(new[] { 13, 23 }); } @@ -55,9 +55,9 @@ public async Task TheOwnerPrefixGoesBeforeAnyNameIsCut() { var tabs = new[] { - Tab("Corvid - Chat", selected: true), - Tab("Corvid - Public"), - Tab("Corvid - Tells"), + Tab("Corvid · Chat", selected: true), + Tab("Corvid · Public"), + Tab("Corvid · Tells"), }; // 4 + 6 + 5 names, 9 of frame: the titles fit exactly where the prefixed names could not. @@ -132,7 +132,7 @@ public async Task EvenAStripThatCannotFitKeepsTheSelectedTabReadable() [Test] public async Task NoBudgetIsNegativeOrLongerThanTheNameItIsFor() { - var tabs = new[] { Tab("A"), Tab("Corvid - B", selected: true), Tab("Corvid - Announcements") }; + var tabs = new[] { Tab("A"), Tab("Corvid · B", selected: true), Tab("Corvid · Announcements") }; foreach (var width in new[] { 0, 1, 5, 12, 30, 400 }) { diff --git a/tests/SharpMUTerm.Tui.Tests/TabTitlesTests.cs b/tests/SharpMUTerm.Tui.Tests/TabTitlesTests.cs index 25ca6b28..a84275c1 100644 --- a/tests/SharpMUTerm.Tui.Tests/TabTitlesTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TabTitlesTests.cs @@ -81,7 +81,7 @@ public async Task ATitleWithBracketsIsEscapedRatherThanParsedAsMarkup() var window = new WorkspaceWindow("w1", "[Chat] room", WindowKind.Spawn) { OwnerLabel = "[Corvid]" }; var label = TabTitles.For(window); - await Assert.That(label).IsEqualTo("[[Corvid]] - [[Chat]] room"); + await Assert.That(label).IsEqualTo("[[Corvid]] · [[Chat]] room"); await Assert.That(MarkupParser.StripLength(label)).IsEqualTo("[Corvid] - [Chat] room".Length); } @@ -119,7 +119,7 @@ public async Task TheLabelCarriesNoCloseAffordance() public async Task ChildWindow_WithOwner_PrefixesTheConnectionOwner() { var window = new WorkspaceWindow("w1", "Chat", WindowKind.Spawn) { OwnerLabel = "Corvid" }; - await Assert.That(TabTitles.For(window)).IsEqualTo("Corvid - Chat"); + await Assert.That(TabTitles.For(window)).IsEqualTo("Corvid · Chat"); } [Test] @@ -130,7 +130,7 @@ public async Task ChildWindow_OwnerPrefixPrecedesBadges() chat.OwnerLabel = "Corvid"; ws.SetUnsentInput(chat.Id, true); await Assert.That(TabTitles.For(chat)) - .IsEqualTo($"[{UnreadBadge.TintFor(null)}]Corvid - Chat (1)[/] {Glyphs.Draft}"); + .IsEqualTo($"[{UnreadBadge.TintFor(null)}]Corvid · Chat (1)[/] {Glyphs.Draft}"); } [Test] diff --git a/tests/SharpMUTerm.Tui.Tests/TelnetLinkClientTests.cs b/tests/SharpMUTerm.Tui.Tests/TelnetLinkClientTests.cs index 2f3e3fef..92b6000b 100644 --- a/tests/SharpMUTerm.Tui.Tests/TelnetLinkClientTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TelnetLinkClientTests.cs @@ -152,12 +152,12 @@ public async Task TheTitleFollowsTheWindowInFrontAndReachesTheHostOnlyOnceTheLoo app.StartTitle(); app.DispatchCommand(CommandIds.Character("Mush.Ann")); - await Assert.That(app.ShownTitle).IsEqualTo("Ann@Mush — SharpMUTerm"); + await Assert.That(app.ShownTitle).IsEqualTo("Ann · Mush — SharpMUTerm"); app.DispatchCommand(CommandIds.Character("Mush.Bea")); - await Assert.That(app.ShownTitle).IsEqualTo("Bea@Mush — SharpMUTerm"); + await Assert.That(app.ShownTitle).IsEqualTo("Bea · Mush — SharpMUTerm"); await Assert.That(titles.Shown.Count).IsGreaterThanOrEqualTo(3); - await Assert.That(titles.Shown[^2..]).IsEquivalentTo(new[] { "Ann@Mush — SharpMUTerm", "Bea@Mush — SharpMUTerm" }); + await Assert.That(titles.Shown[^2..]).IsEquivalentTo(new[] { "Ann · Mush — SharpMUTerm", "Bea · Mush — SharpMUTerm" }); } [Test] From ebd149101d78cc82835320217ae5c27292029e4b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 11:50:14 +0000 Subject: [PATCH 041/113] Light-theme contrast, composer spelling, and status/panel polish (UX wave 12) - F2 and F4 at 80 columns draw their one column through ScreenChrome.Panel, so Light resolves it (was Dark's wells and inks, 1.05-1.34:1). - Status row: notice inks and every bare [dim] held to 4.5:1 on the backdrop; Light's backdrop (rail, status row) lifted from #b7b7b9 to #e6e6e9. - Command palette's selected row is Ink on Accent (both roles), 5.8:1 on Light. - Window chrome's secondary ink is opaque and held to the 4.5:1 text floor. - Spell check skips command tokens (+ @ & /) and every known name. - Demo: F1/docked composer can send where the header says Corvid is connected, and no "nothing connects at start" notice over that. - Who-here drops idle words before cutting names; the status room cell grows into spare width; the as-sent preview wraps at spaces; the window's docked composer stops saying "click to write" twice. - FrameContrastTests walks 80x24 too and holds the status row and the palette's selected row to 4.5:1; ScreenThemeTests covers 80-column Light settings; NativeTokenTests covers the chrome's secondary ink. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 11 +++ CLAUDE.md | 13 ++- src/SharpMUTerm.Avalonia/ComposerView.cs | 11 ++- src/SharpMUTerm.Avalonia/NativeChrome.cs | 16 +++- .../Composer/ComposerModel.cs | 12 ++- src/SharpMUTerm.Core/Text/SpellChecker.cs | 49 +++++++++++- src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs | 4 +- src/SharpMUTerm.Tui/ComposeOverlay.cs | 49 +++++++++--- src/SharpMUTerm.Tui/KeypadScreenView.cs | 2 +- src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs | 10 ++- .../Pointer/SharpMUTermApp.Notices.cs | 19 +++-- .../SharpMUTermApp.NativeComposer.cs | 34 +++++++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 60 +++++++++++--- src/SharpMUTerm.Tui/TriggersScreenView.cs | 2 +- src/SharpMUTerm.Tui/WorkspacePalette.cs | 24 +++++- .../NativeTokenTests.cs | 30 +++++++ .../ComposeSpellingTests.cs | 42 ++++++++++ .../ComposerLengthTests.cs | 22 ++++++ .../FrameContrastTests.cs | 79 +++++++++++++++++-- .../SharpMUTerm.Tui.Tests/LayoutStripTests.cs | 6 +- tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs | 15 ++++ .../NoticeAndMapSurfaceTests.cs | 74 ++++++++++++++++- .../SharpMUTerm.Tui.Tests/ScreenThemeTests.cs | 29 +++++-- .../TerminalPanelTests.cs | 17 ++++ 24 files changed, 572 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 733c386b..a4a3c1d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -320,6 +320,17 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- Light theme: the trigger and keypad screens at 80 columns are no longer drawn in the dark theme's colours, error + notices on the status row are readable, the command palette's selected row is readable, and the sidebar and status + row are a light grey rather than a mid-grey that looked disabled. The window's sidebar labels are easier to read too. +- The composer no longer marks the command word (`+bbpost`, `@emit`) or your own character's and the room's names as + misspelt. +- Who is here keeps whole names at 80 columns by dropping the "active" / "idle" words first (the dot still says it). +- The status row's room name uses the space a wide terminal has instead of being cut short. +- The composer's "as sent" preview wraps at spaces instead of in the middle of a word. +- Desktop window: the docked composer no longer says "click to write" twice. +- Demo: the composer and the startup message no longer say nothing is connected while the header says Corvid is. + - The away, new-activity, search and restore bars fit the pane they are in: their rule runs to the pane's edge, never past it, and the words shorten before the rule does in a narrow pane. They redraw when the pane is resized. - Search (Ctrl+F) fits an 80-column terminal: its key hints shorten instead of pushing the window wider than the diff --git a/CLAUDE.md b/CLAUDE.md index e83bc392..1cc2aabe 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -767,7 +767,9 @@ fallbacks) for inline images/maps. `Func` that is null by default, so a test and a snapshot read none and their header says `no dictionary`. A MOO edit is not checked (its buffer is code as often as prose). `%`-codes, a word before `(`, and any word with a digit or an inner capital are skipped. ⌥W appends to - `dictionaries/user-words.txt`. + `dictionaries/user-words.txt`. **A command token is skipped** (one starting `+ @ & /`, up to its first `=`), and so + is **every name the client knows** (`SpellChecker.KnowNames`: configured worlds and characters, each session's + `CompletionIndex.Names()`), refreshed each time F1 opens and held for the run, never written to disk. - **An MXP `` is drawn in the output pane as rows of markup under the line that named it** (`MxpParser.HandleImage` + `MxpImageSource`, Core; `InlineImageHost`/`InlineImageRows`/`InlineImageLayout`, Tui; the `mxp-image` view). The parser emits a `[image: name]` span whose `SpanInteraction.Image` carries @@ -2434,6 +2436,15 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] used to be `#222226`. A light theme is left alone: darkening it makes a grey theme, and its focus step clamps at white either way. The cost is the pane-over-backdrop step, a ratio, which is fewer L* points a range lower (Dark 4.0 → 2.8); `EveryThemeGetsARaisedSurfaceOverARecessedBackdrop` now measures L*. + - **A light theme's backdrop takes a shallower step** (`LightBackdropScale` 0.95, `Backdrop` only — `Recessed`, the + chips' step, is unchanged): the dark ratio off a near-white surface put the rail and status row at mid-grey + `#b7b7b9` (L* 75), which read as disabled. Light's backdrop is `#e6e6e9` now, about 4 L* under the panes. + - **The status row and ⌃P's selected row are small text, held to 4.5:1** (`FrameContrastTests.TheStatusRowAndThe…`). + A notice's inks are held on the backdrop (`NoticeMarkup`, `WorkspacePalette.NoticeMuted`), and every bare `[dim]` + on the row is swapped for that held grey as it is painted (`StatusInk`); ⌃P's band is `Ink on Accent`, both roles, + so a light theme re-inks the pair. The native chrome's secondary ink (`NativeChromeView.SecondaryInk`) is opaque and + held to `NativeTokens.TextFloor`. `FrameContrastTests` also walks 80×24 (F2/F4/search draw one column there, through + `ScreenChrome.Panel` like every other column), and `ScreenThemeTests` checks 80-column Light settings frames. - **F7 ▸ `background transparency (%)` (0, off, by default) is a level only kitty can honour** (`TextSettings.BackgroundTransparency`; `KittyTransparentColours`, `SyncTransparentColours`). A translucent terminal draws translucent only cells on its *default* background (`SGR 49`), at the diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 785abf32..92b7c03a 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -363,8 +363,17 @@ private void Label(ComposerModel model) _keys.Children.Clear(); var narrow = !_fullScreen && Bounds.Width is > 0 and < 560; + // The idle editor's placeholder says "Click to write a post"; the row's keyless hint saying it again was the + // panel saying one thing twice. + var placeholder = !model.Armed && !_fullScreen; + var placeholderShown = placeholder && model.Body.Length == 0; foreach (var key in model.Keys) { + if (placeholderShown && key.Key.Length == 0 && key.Label == ComposerModel.ClickHint) + { + continue; + } + var item = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, Margin = new Thickness(0, 1, 14, 1) }; if (key.Key.Length > 0) { @@ -383,7 +392,7 @@ private void Label(ComposerModel model) // A docked composer too short for its key row keeps the editor and drops the row. _footer.IsVisible = _fullScreen || Bounds.Height is 0 or >= 64; - _editor.PlaceholderText = model.Armed || _fullScreen ? null : "Click to write a post"; + _editor.PlaceholderText = placeholder ? ComposerModel.ClickToWrite : null; _editor.PlaceholderForeground = new SolidColorBrush(Dim); } diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 54666bbb..31f3833f 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -190,7 +190,21 @@ protected override void OnPointerWheelChanged(PointerWheelEventArgs e) /// The UI font size the chrome's text is set in. protected const double FontSize = NativeTokens.Body + 1; - protected Color Dim => Color.FromArgb(0xA8, Ink.R, Ink.G, Ink.B); + /// + /// Secondary text (offline, a chord, CONNECTIONS): the ink two thirds of the way from the plane, + /// opaque and held to on it. It is small text; a translucent ink was + /// 3.1–3.4:1 on Light's sidebar. + /// + protected Color Dim => SecondaryInk(Ink, Plane); + + /// for an ink on a plane. Internal for tests. + internal static Color SecondaryInk(Color ink, Color plane) + { + const double share = 0xA8 / 255.0; + byte Mix(byte a, byte b) => (byte)Math.Round((a * share) + (b * (1 - share))); + var mixed = new Rgb(Mix(ink.R, plane.R), Mix(ink.G, plane.G), Mix(ink.B, plane.B)); + return ToColour(Contrast.Legible(mixed, new Rgb(plane.R, plane.G, plane.B), NativeTokens.TextFloor)); + } protected Color Faint(byte alpha) => Color.FromArgb(alpha, Ink.R, Ink.G, Ink.B); diff --git a/src/SharpMUTerm.Client/Composer/ComposerModel.cs b/src/SharpMUTerm.Client/Composer/ComposerModel.cs index ab08cebb..ffa2065a 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerModel.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerModel.cs @@ -141,6 +141,16 @@ public static ComposerModel Create( }; } + /// + /// The window's docked editor placeholder while it does not hold the keyboard. It says what + /// says, so the window leaves that hint out of its key row (the cells draw no placeholder on an idle editor, and + /// keep it). + /// + public const string ClickToWrite = "Click to write a post"; + + /// The docked key row's keyless hint while the editor does not hold the keyboard. + public const string ClickHint = "click here to write"; + /// The key row for a composer in this state. /// Whether F1's as-sent preview is showing, which names what ⌥P does next. public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, bool dictionary, bool canSend, bool armed, bool preview = false) @@ -149,7 +159,7 @@ public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, { if (!armed) { - return [new(string.Empty, "click here to write", "click to write"), new("F1", "full screen", "full")]; + return [new(string.Empty, ClickHint, "click to write"), new("F1", "full screen", "full")]; } var docked = new List { new("⌃S", "send"), new("⌥L", "literal") }; diff --git a/src/SharpMUTerm.Core/Text/SpellChecker.cs b/src/SharpMUTerm.Core/Text/SpellChecker.cs index 4ffb930e..3041c2a1 100644 --- a/src/SharpMUTerm.Core/Text/SpellChecker.cs +++ b/src/SharpMUTerm.Core/Text/SpellChecker.cs @@ -30,6 +30,7 @@ public sealed class SpellChecker { private readonly WordList _words; private readonly HashSet _added = new(StringComparer.OrdinalIgnoreCase); + private HashSet _names = new(StringComparer.OrdinalIgnoreCase); private readonly Dictionary _cache = new(StringComparer.Ordinal); private readonly string? _userWordsPath; @@ -188,9 +189,32 @@ public bool Check(string word) } } + /// + /// The proper names never to mark — the configured characters and worlds, and the names the games have reported + /// (CompletionIndex). Replaced wholesale on every call, held for the run, never written to disk: a name a + /// game reported is not a word the player added. + /// + public void KnowNames(IEnumerable names) + { + ArgumentNullException.ThrowIfNull(names); + var known = new HashSet(StringComparer.OrdinalIgnoreCase); + foreach (var name in names) + { + foreach (var (start, length) in Runs(name)) + { + known.Add(name.Substring(start, length)); + } + } + + lock (_gate) + { + _names = known; + } + } + private bool CheckLocked(string word) { - if (_added.Contains(word)) + if (_added.Contains(word) || _names.Contains(word)) { return true; } @@ -314,7 +338,7 @@ public IReadOnlyList Suggest(string word, int max = 6) } var end = start + length; - if (length < 2 || (end < line.Length && line[end] == '(')) + if (length < 2 || (end < line.Length && line[end] == '(') || InCommandToken(line, start)) { continue; } @@ -329,6 +353,27 @@ public IReadOnlyList Suggest(string word, int max = 6) } } + /// + /// Whether the run at is part of a command word: a whitespace-delimited token that starts + /// with +, @, & or / (+bbpost, @emit, &attr, a switch such as + /// /new), up to its first =. Every board post starts with one, and it is never a word to correct. + /// + private static bool InCommandToken(string line, int start) + { + var tokenStart = start; + while (tokenStart > 0 && !char.IsWhiteSpace(line[tokenStart - 1])) + { + tokenStart--; + } + + if (line[tokenStart] is not ('+' or '@' or '&' or '/')) + { + return false; + } + + return line.IndexOf('=', tokenStart, start - tokenStart) < 0; + } + /// Letters, digits and inner apostrophes, the way a word processor splits a line. private static IEnumerable<(int Start, int Length)> Runs(string line) { diff --git a/src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs b/src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs index b40da605..2136ffdd 100644 --- a/src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs +++ b/src/SharpMUTerm.Tui/CommandSurfaceRenderer.cs @@ -26,8 +26,8 @@ internal static class CommandSurfaceRenderer /// The fewest characters of a detail worth showing; below this it is left out rather than cut to a stub. private const int MinDetail = 4; - /// The selected row's band: dark ink on the accent. - private const string SelectedBand = "#18181c on #00f5b7"; + /// The selected row's band: the popups' selected ink on the accent, both roles, so a light theme re-inks them as a pair. + private const string SelectedBand = ScreenPalette.Ink + " on " + ScreenPalette.Accent; /// A matched character on an unselected row. private static readonly string MatchInk = $"bold {ScreenPalette.Accent}"; diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 2a0b872e..c6daa761 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -458,10 +458,10 @@ private MarkupControl PreviewBand() } /// - /// The preview's rows for : a heading, then the command ⌃S would send, cut into rows of - /// characters — hard, not at words, because this shows the exact characters the game gets - /// and a wrap at a space would hide one — ending in … when it runs past the rows there are. Always - /// rows, so typing never moves the editor. + /// The preview's rows for : a heading, then the command ⌃S would send, cut into rows of at + /// most characters at a space () — the space kept at the end of its + /// row, so the rows joined are exactly the characters the game gets — ending in … when it runs past the + /// rows there are. Always rows, so typing never moves the editor. /// internal static IReadOnlyList PreviewLines(ComposerModel model, int width) { @@ -472,19 +472,19 @@ internal static IReadOnlyList PreviewLines(ComposerModel model, int widt $"[{ScreenPalette.Accent}]AS SENT[/][{ScreenPalette.Label}] the one command ⌃S sends · ⌥P hides this[/]", }; var rows = PreviewRows - 1; + var pieces = WrapExact(command, width); for (var row = 0; row < rows; row++) { - var start = row * width; - if (start >= command.Length) + if (row >= pieces.Count) { lines.Add(row == 0 && command.Length == 0 ? $"[{ScreenPalette.Muted}]nothing yet[/]" : string.Empty); continue; } - var piece = command.Substring(start, Math.Min(width, command.Length - start)); - if (row == rows - 1 && start + width < command.Length) + var piece = pieces[row]; + if (row == rows - 1 && pieces.Count > rows) { - piece = piece[..^1] + "…"; + piece = (piece.Length >= width ? piece[..^1] : piece.TrimEnd()) + "…"; } lines.Add($"[{ScreenPalette.Value}]{Escape(piece)}[/]"); @@ -493,6 +493,37 @@ internal static IReadOnlyList PreviewLines(ComposerModel model, int widt return lines; } + /// + /// cut into rows of at most characters, each ending after the last + /// space that fits (a word longer than a row is cut hard). Nothing is dropped or added: the rows joined are + /// , so the preview never hides a space the game will get. + /// + internal static IReadOnlyList WrapExact(string text, int width) + { + ArgumentNullException.ThrowIfNull(text); + width = Math.Max(1, width); + var rows = new List(); + var start = 0; + while (start < text.Length) + { + var length = Math.Min(width, text.Length - start); + if (start + length < text.Length) + { + // Break after the last space inside the row, so the next row starts with a word. + var space = text.LastIndexOf(' ', start + length - 1, length); + if (space > start) + { + length = space - start + 1; + } + } + + rows.Add(text.Substring(start, length)); + start += length; + } + + return rows; + } + private MarkupControl FooterBand() { var band = ScreenChrome.Band(Render(Model).Footer, ScreenPalette.FooterBg, _scheme); diff --git a/src/SharpMUTerm.Tui/KeypadScreenView.cs b/src/SharpMUTerm.Tui/KeypadScreenView.cs index ec9a55da..5fbe0880 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenView.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenView.cs @@ -50,7 +50,7 @@ public static IWindowControl Build( // and keeps the list, which is where every key on this screen acts. var only = KeypadScreenRenderer.HotkeysColumn(keys, macros, focus, sets, selected, width); return ScreenChrome.Single( - header, footer, ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(only, rows))), + header, footer, ScreenChrome.Stretch(ScreenChrome.Panel(ScreenChrome.Window(only, rows), scheme)), only.Count, rows); } diff --git a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs index d936b074..35cff02e 100644 --- a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs @@ -33,7 +33,8 @@ internal static class WhoHereRenderer /// /// The panel's rows for a box by cells. Never wider than the - /// box and never taller: a room fuller than the box ends in … and N more. + /// box and never taller: a room fuller than the box ends in … and N more. The idle column is dropped (the + /// dot keeps saying it) before a name would be cut to make room for it. /// internal static List Render(string? room, IReadOnlyList occupants, int width, int height, Ink ink) => Render(WhoHereModel.From(room, occupants), width, height, ink); @@ -65,10 +66,13 @@ internal static List Render(WhoHereModel model, int width, int height, I return lines; } - var showIdle = model.ShowsIdle && width >= IdleWidth + 8; - var nameWidth = width - 2 - (showIdle ? IdleWidth + 1 : 0); var rows = height - 1; var fits = rowsIn.Count <= rows ? rowsIn.Count : Math.Max(0, rows - 1); + + // The idle words go before any name is cut: the dot already says active or idle, and a name is who it is. + var longest = rowsIn.Take(fits).Select(r => r.Display.Length).DefaultIfEmpty(0).Max(); + var showIdle = model.ShowsIdle && width >= IdleWidth + 8 && longest <= width - 2 - (IdleWidth + 1); + var nameWidth = width - 2 - (showIdle ? IdleWidth + 1 : 0); for (var i = 0; i < fits; i++) { lines.Add(Row(rowsIn[i], i, nameWidth, showIdle, ink)); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs index 16d17960..784560f6 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs @@ -41,18 +41,25 @@ internal sealed partial class SharpMUTermApp /// /// The status row's markup for a notice: the key chip in the notice ink, then the text — in the warning red when - /// something failed, otherwise dim. The cell renderer of the notice surface; byte for byte what the row drew - /// before the model existed. + /// something failed, otherwise a muted grey. Every ink is held to 4.5:1 on the backdrop the row is painted on: a + /// failure in the raw red was 1.39:1 on Light, and the framework's fixed [dim] grey 2.4:1. The cell + /// renderer of the notice surface. /// internal string NoticeMarkup(NoticeModel notice) { ArgumentNullException.ThrowIfNull(notice); - var body = notice.Severity == NoticeSeverity.Warning - ? $"[{ScreenPalette.Warn}]{Escape(notice.Text)}[/]" - : $"[dim]{Escape(notice.Text)}[/]"; - return notice.Key is null ? body : $"[{_ink.Notice}]{Escape(notice.Key)}[/] {body}"; + var plane = WorkspacePalette.Backdrop(_theme); + var ink = notice.Severity == NoticeSeverity.Warning + ? HeldOn(ScreenPalette.Warn, plane) + : Hex(WorkspacePalette.NoticeMuted(_theme, plane)); + var body = $"[{ink}]{Escape(notice.Text)}[/]"; + return notice.Key is null ? body : $"[{HeldOn(_ink.Notice, plane)}]{Escape(notice.Key)}[/] {body}"; } + /// A colour held to on : notice text is small text. + private static string HeldOn(string hex, Rgb plane) => + TryParseRgb(hex, out var rgb) ? Hex(Contrast.Legible(rgb, plane, WorkspacePalette.HeaderTextFloor)) : hex; + /// Hands a notice to a host that draws notices natively; nothing for one that does not. private void PublishNotice(NoticeModel notice) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs index 4536af72..c79aeeee 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs @@ -63,15 +63,47 @@ internal sealed partial class SharpMUTermApp _composerSpelling = _spelling?.Invoke(); } + _composerSpelling?.KnowNames(SpellingNames()); return _composerSpelling; } + /// + /// The proper names the composer never marks: every configured world and character, and the names each open + /// session's game has reported (). A post that names its writer or + /// the people in the room is not misspelt. + /// + private IEnumerable SpellingNames() + { + foreach (var world in _config.Worlds) + { + yield return world.Name; + foreach (var character in world.Characters) + { + yield return character.Name; + } + } + + foreach (var session in _sessions.Sessions) + { + foreach (var name in session.Completions.Names()) + { + yield return name; + } + } + } + /// /// Opens F1 on a draft: in the host's editor when it has one, else the cell window. Both are given the same draft /// and say the same thing about it (). /// private void OpenComposer(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null) { + // The names a game reports change between openings; the dictionary learns them each time F1 opens. + if (_composerSpellingOpened) + { + ComposerSpelling(); + } + if (NativeComposerHost is not { } native) { _composer.Toggle(target, draft, escaping, canSend, edit); @@ -233,7 +265,7 @@ private ComposerModel DescribeDocked(DockedComposer composer) composer.Escaping, edit: null, composer.Spelling, - canSend: session is not null, + canSend: ComposerCanSend(session, composer.SessionKey), composer.Armed, composer.Revision); Drawing(PanelIds.Composer, composer.WindowId, model); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 6c896f39..1c6bae73 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -2465,7 +2465,7 @@ void Feed(string windowId, string ansiLine) // server agreed to UTF-8, which the row draws unqualified. A world that pinned an encoding // would read "utf-8 forced" and a server that never negotiated "utf-8 assumed". _demoEncoding = new SessionEncoding(Encoding.UTF8, EncodingSource.Negotiated); - _statusBar.SetContent(new List { StatusBarMarkup("Corvid", "connected") }); + _statusBar.SetContent(new List { StatusInk(StatusBarMarkup("Corvid", "connected")) }); RefreshHeader(); _input.SetAndNotify("say hello there"); RebuildPaneArea(); // realise the Chat spawn tab, then refresh badges @@ -2788,10 +2788,15 @@ internal async Task StartAsync(IReadOnlyList startup) // configured is a client with nothing to do yet, while worlds configured and none marked is // a client doing exactly what it was told. The second is Info for that reason — and neither // carries a key chip, because no surface refused anything; the text names the keys instead. + // The demo scene declares its connections without dialling them (_demoConnectedKeys), so the header and + // the rail already say Corvid is connected: "nothing connects at start" under them contradicted the frame. var empty = _config.Worlds.Count == 0; - Notice( - empty ? NoWorldsNotice : NothingAtStartNotice, - empty ? MessageSeverity.Warning : MessageSeverity.Info); + if (empty || _demoConnectedKeys.Count == 0) + { + Notice( + empty ? NoWorldsNotice : NothingAtStartNotice, + empty ? MessageSeverity.Warning : MessageSeverity.Info); + } // And the first run gets somewhere to start from: the welcome, over the notice it leaves behind // when it is closed. @@ -5231,10 +5236,19 @@ private void ToggleComposer() target, draft.Body, draft.Escaping, - canSend: session is not null, + canSend: ComposerCanSend(session, key), draft.Edit); } + /// + /// Whether a composer for 's window offers a send: it has a session, or — in the demo + /// scene, which opens no sockets — the scene declares that character connected (), + /// so the composer's footer never says "nothing connected" under a header and rail saying the opposite. + /// + private bool ComposerCanSend(WorldSession? session, string? ownerKey) => + session is not null + || (_sessions.Sessions.Count == 0 && ownerKey is not null && _demoConnectedKeys.Contains(ownerKey)); + /// /// Which character a composed post belongs to: the window's own owner, never _active. Null for /// a window that belongs to no connection — the web view — which keeps no draft, because there is @@ -13467,10 +13481,21 @@ private async Task AnnounceWindowSizeAsync(WorldSession session, int width, int /// private void PaintStatus(string markup) { - _statusBar.SetContent(new List { FitStatusRow(markup, HeaderWidth()) }); + _statusBar.SetContent(new List { StatusInk(FitStatusRow(markup, HeaderWidth())) }); SyncInputHeights(_second.Visible); } + /// + /// The status row's quiet text in a grey held to 4.5:1 on the backdrop it is painted on, in place of the framework's + /// fixed [dim] #808080 — 3.4:1 on Light's status plane, and the row is small text a reader looks for + /// (UX audit wave 11, #2 and #7). Only the bare tag is replaced; the cells do not move. + /// + private string StatusInk(string markup) => + BareDim.Replace(markup, $"[{Hex(WorkspacePalette.NoticeMuted(_theme, WorkspacePalette.Backdrop(_theme)))}]"); + + /// A [dim] tag that is a tag, not the escaped text [[dim]]. + private static readonly System.Text.RegularExpressions.Regex BareDim = new(@"(? /// The status row's markup cut to cells, ending in …. The row is one row in every /// host: a notice is a sentence, and a window narrower than it wrapped the row onto a second line and took that row @@ -13947,16 +13972,33 @@ private string[] FocusHints() /// The cells the status row's room field always takes, whatever the room is called. internal const int RoomCellWidth = 28; + /// The most cells the room field grows to on a wide row (). + internal const int RoomCellMaxWidth = 64; + + /// + /// How wide the room field is on this row: , grown into the row's spare cells up to + /// — after the widest focus hint is set aside, so the field never takes a hint's + /// place. A function of the row and never of the room's name, so a walk still moves nothing: at 160 columns the + /// cell read The Grand Plaza · Aetherf… with thirty cells free beside it. + /// + private int RoomCellFor(string left, string rightBar, StatusMode mode) + { + var hints = mode == StatusMode.None ? FocusHints().Select(h => MarkupWidth(h) + 3).DefaultIfEmpty(0).Max() : 0; + var moo = _active?.McpStatus is null ? 0 : MooStatusCellWidth + 3; + var spare = HeaderWidth() - MarkupWidth(left) - 3 - MarkupWidth(rightBar) - MinStatusGap - MeterSlack - hints - moo; + return Math.Clamp(spare, RoomCellWidth, RoomCellMaxWidth); + } + /// The room the active connection's map says the character is in, or null. private (long Id, string Name, string? Area)? StatusRoom() => MapOf(_active?.SessionKey ?? (_sessions.Sessions.Count == 0 ? DemoScene.ActiveSessionKey : null))?.Current; /// ⌂ Room · Area, elided and padded to . The room leads: it is what /// changes, and it is what an elision should keep. - internal static string RoomCell(string name, string? area) + internal static string RoomCell(string name, string? area, int width = RoomCellWidth) { var text = string.IsNullOrWhiteSpace(area) ? name : $"{name} · {area}"; - var room = RoomCellWidth - 2; + var room = Math.Max(RoomCellWidth, width) - 2; if (text.Length > room) { text = text[..(room - 1)] + "…"; @@ -14162,7 +14204,7 @@ bool Fits(string hint, IEnumerable cluster) => // cluster with every room name; a name too long for it is elided, never wrapped. if (StatusRoom() is { } here) { - var cell = RoomCell(here.Name, here.Area); + var cell = RoomCell(here.Name, here.Area, RoomCellFor(left, rightBar, mode)); if (MarkupWidth(left) + 3 + RoomCellWidth + MarkupWidth(rightBar) + MinStatusGap + MeterSlack <= HeaderWidth()) { left = $"{left} {cell}"; diff --git a/src/SharpMUTerm.Tui/TriggersScreenView.cs b/src/SharpMUTerm.Tui/TriggersScreenView.cs index f5404214..15361715 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenView.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenView.cs @@ -47,7 +47,7 @@ public static IWindowControl Build( ? TriggersScreenRenderer.EditorColumn(sets, selectedTrigger, routeTargets, focus, width, body, theme, recent) : TriggersScreenRenderer.RulesColumn(sets, selectedTrigger, focus, width); return ScreenChrome.Single( - header, footer, ScreenChrome.Stretch(new MarkupControl(ScreenChrome.Window(only, body))), + header, footer, ScreenChrome.Stretch(ScreenChrome.Panel(ScreenChrome.Window(only, body), scheme)), only.Count, body); } diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index b05b1814..7d4a2a13 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -263,8 +263,20 @@ internal static Rgb IdleInk(Theme theme) /// /// The plane everything that is not a pane sits on: the rail, the status line, and the gaps a split /// leaves between panes. + /// + /// A light theme takes a shallower step (): the backdrop's ratio taken off a + /// near-white surface landed at mid-grey (#b7b7b9, L* 75, 21 L* under the panes), and a rail and status + /// row that grey read as disabled. The step on Light is now about 4 L*, Solarized Dark's size. + /// /// - internal static Rgb Backdrop(Theme theme) => Recessed(Surface(theme)); + internal static Rgb Backdrop(Theme theme) + { + var surface = Surface(theme); + return Contrast.RelativeLuminance(surface) < LightPlaneLuminance ? Recessed(surface) : Scale(surface, LightBackdropScale); + } + + /// The backdrop as a fraction of a light theme's surface: about L* 91 under Light's L* 96 panes. + private const double LightBackdropScale = 0.95; /// /// One step behind a plane — the backdrop's step, reused for the chips of a tab strip's unselected @@ -325,6 +337,16 @@ internal static Rgb HeaderInk(Theme theme, Rgb fill) return Contrast.Legible(theme.Background, fill, HeaderTextFloor); } + /// + /// A notice's quiet text on the status row: the framework's [dim] grey, which is fixed and fell to 2.4:1 on + /// Light, replaced by the same grey held to on . + /// + internal static Rgb NoticeMuted(Theme theme, Rgb plane) + { + ArgumentNullException.ThrowIfNull(theme); + return Contrast.Legible(new Rgb(0x80, 0x80, 0x80), plane, HeaderTextFloor); + } + /// The header's quiet text (the counts, the log state), held to on its band. internal static Rgb HeaderMuted(Theme theme) { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs index 265ce032..9a577b8d 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs @@ -111,6 +111,36 @@ public async Task EveryInkClearsTheTextFloorOnEveryPlaneItIsDrawnOn(string name) await Assert.That(misses).IsEmpty().Because(string.Join("\n", misses)); } + /// + /// The native header's and sidebar's secondary text (offline, Alt+2, CONNECTIONS) is small + /// text, held to on the planes the client hands the chrome — the sidebar's + /// backdrop and the header's status plane. It was the ink at two-thirds alpha, 3.1–3.4:1 on Light's sidebar (UX audit + /// wave 11, #7); and Light's backdrop itself is no longer mid-grey. + /// + [Test] + [Arguments("Dark")] + [Arguments("Light")] + [Arguments("Solarized Dark")] + public async Task TheChromesSecondaryTextIsBodyText(string name) + { + var theme = ThemeLibrary.Get(name); + var ink = theme.Resolve(SharpMUTerm.Core.Text.TerminalColor.Default, isBackground: false); + foreach (var plane in new[] { SharpMUTerm.Tui.WorkspacePalette.Backdrop(theme), theme.StatusBackground }) + { + var dim = SharpMUTerm.Avalonia.NativeChromeView.SecondaryInk( + Color.FromRgb(ink.R, ink.G, ink.B), Color.FromRgb(plane.R, plane.G, plane.B)); + await Assert.That(Contrast.Ratio(Rgb(dim), plane)).IsGreaterThanOrEqualTo(NativeTokens.TextFloor) + .Because($"{name}: {dim} on {plane.ToHex()}"); + } + + if (name == "Light") + { + var backdrop = SharpMUTerm.Tui.WorkspacePalette.Backdrop(theme); + await Assert.That(Contrast.RelativeLuminance(backdrop)).IsGreaterThan(0.7) + .Because($"Light's rail and status plane {backdrop.ToHex()} read as disabled at mid-grey"); + } + } + /// /// The settings window wears the tokens: its plane is the palette's card and Fluent's accent is the client's, not /// Fluent's own blue (#60cdff/#005fb8) — and it follows a Light theme the same way. diff --git a/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs b/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs index f8f457d8..c8485dd6 100644 --- a/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs @@ -131,4 +131,46 @@ public async Task AMooEditIsNotSpellChecked() await Assert.That(app.Composer.Spelling).IsNull(); await Assert.That(ForegroundOf(app, "player")).IsNotEqualTo(Warn); } + + /// + /// A command word is not a word to correct: every board post starts with one (+bbpost), so the first two + /// marks of every post were false (UX audit wave 11, #8). A token starting with + @ & / is skipped up to + /// its first =; the text after it is still checked. + /// + [Test] + public async Task ACommandWordIsNeverMarked() + { + var checker = Dictionary(); + + await Assert.That(checker.Misspellings("+bbpost hello")).IsEmpty(); + await Assert.That(checker.Misspellings("@emit/room hello")).IsEmpty(); + await Assert.That(checker.Misspellings("&attr the=hello")).IsEmpty(); + await Assert.That(checker.Misspellings("+bbpost/wrold hello wrold").Count).IsEqualTo(1) + .Because("the switch is the command's; the body after the space is prose"); + await Assert.That(checker.Misspellings("&attr the=wrold").Count).IsEqualTo(1).Because("after = is the value"); + } + + /// + /// Nor is a name the client knows: the writer's own (every configured character and world) and the names the game + /// reported. Corvid was marked under a header naming Corvid. + /// + [Test] + public async Task TheCharactersOwnNameIsNeverMarked() + { + var checker = Dictionary(); + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "Aetherfall", Host = "a.example", Port = 4201 }; + world.Characters.Add(new CharacterDefinition { Name = "Corvid", Logging = new() }); + config.Worlds.Add(world); + Console.SetIn(TextReader.Null); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height), spelling: () => checker); + + app.SimulateKey(Key(ConsoleKey.F1)); + app.Composer.SimulateTyping("hello Corvid of Aetherfall wrold"); + + await Assert.That(ForegroundOf(app, "Corvid")).IsNotEqualTo(Warn); + await Assert.That(ForegroundOf(app, "Aetherfall")).IsNotEqualTo(Warn); + await Assert.That(ForegroundOf(app, "wrold")).IsEqualTo(Warn); + await Assert.That(checker.AddedWords).IsEmpty().Because("a known name is not a word the player added"); + } } diff --git a/tests/SharpMUTerm.Tui.Tests/ComposerLengthTests.cs b/tests/SharpMUTerm.Tui.Tests/ComposerLengthTests.cs index 85b425dc..683c291d 100644 --- a/tests/SharpMUTerm.Tui.Tests/ComposerLengthTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ComposerLengthTests.cs @@ -82,4 +82,26 @@ public async Task AMooEditHasNoPreview() await Assert.That(model.Preview).IsFalse(); } + + /// + /// The as-sent preview breaks at a space, never mid-word (it read Corv / id), and still shows every + /// character the game gets: the rows joined are the command. + /// + [Test] + [Arguments("+bbpost 12=The Long Winter%r%rThe caravan reached the pass at dusk", 20)] + [Arguments("word", 3)] + [Arguments("a b c", 2)] + [Arguments("", 10)] + public async Task ThePreviewWrapsAtWordsAndKeepsEveryCharacter(string command, int width) + { + var rows = ComposeOverlay.WrapExact(command, width); + + await Assert.That(string.Concat(rows)).IsEqualTo(command); + await Assert.That(rows.All(r => r.Length <= width)).IsTrue(); + // A word is split across rows only where its row had no space to break at. + var splits = Enumerable.Range(0, Math.Max(0, rows.Count - 1)) + .Where(i => rows[i].Length > 0 && rows[i][^1] != ' ' && rows[i + 1][0] != ' ' && rows[i][1..].Contains(' ')) + .ToList(); + await Assert.That(splits).IsEmpty().Because("a row with a space in it breaks after one"); + } } diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index bbd0c3b4..be64c780 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -89,12 +89,77 @@ from theme in ThemeLibrary.Names from view in Views select (theme, view); + /// + /// The views walked again at 80×24, where the layout is a different one: F2, F4 and the settings search draw one + /// column at a time, the rail folds, and the status row is short. The 80-column settings path kept Dark's colours on + /// Light (UX audit wave 11, #1: wells at 1.34:1, F11 at 1.05:1) while every 140-column frame here was green. + /// + private static readonly string[] NarrowViews = + [ + "", "triggers", "triggers-edit", "keypad", "keypad-edit", "settings-search", "aliases", "timers", "worlds", + "menu", "menu-fuzzy", "notices", "compose", "panel-who", "layout-roleplay", "layout-combat", + ]; + + public static IEnumerable<(string Theme, string View)> NarrowCases() => + from theme in ThemeLibrary.Names + from view in NarrowViews + select (theme, view); + [Test] [MethodDataSource(nameof(Cases))] - public async Task NoPaintedTextIsBelowTheLegibilityFloor((string Theme, string View) test) + public async Task NoPaintedTextIsBelowTheLegibilityFloor((string Theme, string View) test) => + await AssertFloor(test.Theme, test.View, Width, Height); + + [Test] + [MethodDataSource(nameof(NarrowCases))] + public async Task NoPaintedTextIsBelowTheLegibilityFloorAt80Columns((string Theme, string View) test) => + await AssertFloor(test.Theme, test.View, 80, 24); + + /// + /// Small text the reader must act on is held to 4.5:1, not 3. The status row (a notice, and an error above + /// all) and the selected row of ⌃P: an error notice was the raw warning red on Light's status plane, 1.39:1, and ⌃P's + /// selected row was grey on deep teal at exactly 3.00:1 — which the 3:1 floor passes. Every theme, both sizes. + /// + [Test] + [MethodDataSource(nameof(BodyTextCases))] + public async Task TheStatusRowAndThePalettesSelectedRowAreBodyText((string Theme, string View, int Width) test) + { + var height = test.Width == Width ? Height : 24; + var frame = Render(test.Theme, test.View, test.Width, height); + var cells = FrameGrid.Cells(frame, test.Width, height); + + // The cells to hold: the last row (the status row), and ⌃P's selected row — the cells on the band its ▸ marker + // is drawn on, in the marker's row (a pane beside the palette is not the palette). + var band = test.View.StartsWith("menu", StringComparison.Ordinal) + ? cells.Where(c => c.Value.Glyph == '▸').Select(c => (c.Key.Row, c.Value.Background)).FirstOrDefault() + : default; + var failures = cells + .Where(c => c.Key.Row == height - 1 || (c.Key.Row == band.Row && band.Background is { } bg && c.Value.Background == bg)) + .Select(c => c.Value) + .Where(c => c.Glyph is not (' ' or '\n' or '\r') && !IsFill(c.Glyph) && c.Glyph is not ('▌' or '▐' or '●' or '○' or '◆' or '◇')) + .Where(c => c.Foreground is { } && c.Background is { }) + .Select(c => (Fg: c.Foreground!.Value, Bg: c.Background!.Value)) + .Distinct() + .Select(p => (p.Fg, p.Bg, Ratio: Contrast.Ratio(p.Fg, p.Bg))) + .Where(t => t.Ratio < 4.5) + .Select(t => $"{t.Ratio:0.00} {t.Fg.ToHex()} on {t.Bg.ToHex()}") + .ToList(); + + await Assert.That(failures).IsEmpty() + .Because($"--theme \"{test.Theme}\" --view {(test.View.Length == 0 ? "(default)" : test.View)} at {test.Width} columns"); + } + + public static IEnumerable<(string Theme, string View, int Width)> BodyTextCases() => + from theme in ThemeLibrary.Names + from view in new[] { "notices", "menu", "menu-fuzzy" } + from width in new[] { 80, Width } + select (theme, view, width); + + private static async Task AssertFloor(string theme, string view, int width, int height) { - var frame = Render(test.Theme, test.View); - var pairs = Pairs(frame); + var frame = Render(theme, view, width, height); + var pairs = Pairs(frame, width, height); + var test = (Theme: theme, View: view); // A walker handed the wrong dimensions, or one that stopped recognising an escape, decodes // nothing — and an audit over nothing passes every assertion below it. That is the failure @@ -158,14 +223,14 @@ ch is '' or '' || ch is >= '\u2500' and <= '\u257f' || ch is '█' or '░' or '▒' or '▓'; - private static string Render(string themeName, string view) + private static string Render(string themeName, string view, int width = Width, int height = Height) { Console.SetIn(TextReader.Null); var config = DemoScene.Build(); config.ThemeName = themeName; config.Theme = ThemeLibrary.Get(themeName); - var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height)); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); return app.RenderSnapshot(view.Length == 0 ? null : view); } @@ -179,11 +244,11 @@ private static string Render(string themeName, string view) /// names. /// /// - private static Dictionary<(Rgb Fg, Rgb Bg), int> Pairs(string frame) + private static Dictionary<(Rgb Fg, Rgb Bg), int> Pairs(string frame, int width, int height) { var pairs = new Dictionary<(Rgb, Rgb), int>(); - foreach (var cell in FrameGrid.Cells(frame, Width, Height).Values) + foreach (var cell in FrameGrid.Cells(frame, width, height).Values) { if (cell.Glyph is ' ' or '\n' or '\r' || IsFill(cell.Glyph) || cell.Foreground is not { } ink || cell.Background is not { } plane) diff --git a/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs b/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs index 49c6da09..fab2698b 100644 --- a/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs @@ -70,7 +70,7 @@ public async Task TheStatusRowLeavesOutTheMetersWhileTheVitalsStripShowsThem() app.RenderSnapshot("layout-combat"); await Assert.That(app.VitalsStripShowing()).IsTrue(); - await Assert.That(app.StatusMarkup).DoesNotContain("[dim]hp[/]"); + await Assert.That(app.StatusMarkup).DoesNotContain("]hp[/]"); await Assert.That(app.StatusMarkup).Contains("Corvid"); } @@ -81,7 +81,7 @@ public async Task TheMetersComeBackToTheStatusRowWhenTheStripIsNotOnScreen() app.RenderSnapshot("meters"); await Assert.That(app.VitalsStripShowing()).IsFalse(); - await Assert.That(app.StatusMarkup).Contains("[dim]hp[/]"); + await Assert.That(app.StatusMarkup).Contains("]hp[/]"); } [Test] @@ -93,7 +93,7 @@ public async Task ZoomingAnotherPaneBringsTheMetersBack() app.DispatchCommand("layout:zoom"); await Assert.That(app.VitalsStripShowing()).IsFalse(); - await Assert.That(app.StatusMarkup).Contains("[dim]hp[/]"); + await Assert.That(app.StatusMarkup).Contains("]hp[/]"); } [Test] diff --git a/tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs b/tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs index abf46f1c..925c87b8 100644 --- a/tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs @@ -175,4 +175,19 @@ private static void Type(SharpMUTermApp app, string text) app.SimulateKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); } + + /// + /// On a wide row the room field grows into the spare cells, so a long name is not cut with thirty cells free beside + /// it; it is still a fixed width for the row, so a walk moves nothing. + /// + [Test] + public async Task TheStatusRoomCellGrowsToTheWidthItIsGiven() + { + var cell = SharpMUTermApp.RoomCell("The Grand Plaza", "Aetherfall Old Town", 48); + + await Assert.That(MarkupText.VisibleLength(cell)).IsEqualTo(48); + await Assert.That(MarkupText.Plain(cell)).Contains("Aetherfall Old Town"); + await Assert.That(MarkupText.VisibleLength(SharpMUTermApp.RoomCell("x", null, 10))).IsEqualTo(SharpMUTermApp.RoomCellWidth) + .Because("never narrower than the reserved field"); + } } diff --git a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs index 0711de0d..d6dddf49 100644 --- a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs @@ -29,8 +29,8 @@ private static SharpMUTermApp App() // ── notices ────────────────────────────────────────────────────────────────────────────── /// - /// The row reads exactly as before the model: a key chip in the notice ink, the text dim — or in the warning red when - /// something failed — and an action changes nothing on it, since a cell is not a button. + /// The row: a key chip in the notice ink, the text in a muted grey — or in the warning red when something failed — + /// and an action changes nothing on it, since a cell is not a button. On Dark the red is the palette's own. /// [Test] public async Task TheStatusRowDrawsANoticeAsItAlwaysHas() @@ -40,8 +40,9 @@ public async Task TheStatusRowDrawsANoticeAsItAlwaysHas() app.SimulateNotice("nothing to split", MessageSeverity.Warning, "⌃B", null); var plain = app.LastNotice!; - await Assert.That(plain).EndsWith("]⌃B[/] [dim]nothing to split[/]"); + await Assert.That(plain).Contains("]⌃B[/] [#").And.EndsWith("]nothing to split[/]").And.DoesNotContain("[dim]"); var chip = plain[..plain.IndexOf("⌃B", StringComparison.Ordinal)]; + var muted = plain[(plain.IndexOf("⌃B[/] ", StringComparison.Ordinal) + "⌃B[/] ".Length)..plain.IndexOf("nothing", StringComparison.Ordinal)]; app.SimulateNotice("nothing to split", MessageSeverity.Warning, "⌃B", new NoticeAction("layout:layouts", "Change layout")); await Assert.That(app.LastNotice).IsEqualTo(plain).Because("the action is the window's to offer; the row is unchanged"); @@ -50,7 +51,35 @@ public async Task TheStatusRowDrawsANoticeAsItAlwaysHas() await Assert.That(app.LastNotice).IsEqualTo($"[{ScreenPalette.Warn}]no route to host[/]"); app.SimulateNotice("saved [x]", MessageSeverity.Info, "F5", null); - await Assert.That(app.LastNotice).IsEqualTo($"{chip}F5[/] [dim]saved [[x]][/]"); + await Assert.That(app.LastNotice).IsEqualTo($"{chip}F5[/] {muted}saved [[x]][/]"); + } + + /// + /// On Light every ink on the row clears 4.5:1 on the plane it is drawn on: an error in the raw warning red was 1.39:1 + /// on the old mid-grey status plane, and the framework's [dim] 2.4:1 (UX audit wave 11, #2). + /// + [Test] + public async Task OnLightANoticesInksAreBodyText() + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = "Light"; + config.Theme = SharpMUTerm.Core.Theming.ThemeLibrary.Get("Light"); + await using var app = new SharpMUTermApp(config, ClientHost.Headless(new HeadlessConsoleDriver(120, 34), Caps)); + app.RenderSnapshot(null); + var plane = WorkspacePalette.Backdrop(config.Theme); + + foreach (var severity in new[] { MessageSeverity.Error, MessageSeverity.Warning, MessageSeverity.Info }) + { + app.SimulateNotice("no route to host", severity, "⌃P", null); + foreach (System.Text.RegularExpressions.Match hex in System.Text.RegularExpressions.Regex.Matches(app.LastNotice!, "#[0-9a-f]{6}")) + { + var ink = new SharpMUTerm.Core.Text.Rgb( + Convert.ToByte(hex.Value[1..3], 16), Convert.ToByte(hex.Value[3..5], 16), Convert.ToByte(hex.Value[5..7], 16)); + await Assert.That(SharpMUTerm.Core.Text.Contrast.Ratio(ink, plane)).IsGreaterThanOrEqualTo(4.5) + .Because($"{severity}: {hex.Value} on {plane.ToHex()}"); + } + } } /// The model the row was drawn from is recorded as the notice surface's drawn model, sequence and all. @@ -163,4 +192,41 @@ public async Task TheDemoMapIsDrawnFromItsRecordedModel() await Assert.That(markup).Contains($"[{view.AreaColour}]"); await Assert.That(markup).Contains($"[{view.ColourOf("Saltmarsh Docks")}]■[/]"); } + + // ── the demo agrees with itself ────────────────────────────────────────────────────────── + + /// + /// The demo says Corvid is connected — the header, the rail and the quit prompt read , + /// which falls back to the keys the scene declares. F1 in that window has to agree, as it does in a live client where + /// the window's session is connected; it said "send (nothing connected)" (UX audit wave 11, #17). The pin is the + /// header's own answer, not a constant. + /// + [Test] + public async Task TheDemosComposerCanSendWhereTheHeaderSaysItIsConnected() + { + await using var app = App(); + app.RenderSnapshot(null); + + app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); + + await Assert.That(app.ConnectedCharacters()).Contains(DemoScene.ActiveSessionKey); + await Assert.That(app.Composer.IsOpen).IsTrue(); + await Assert.That(app.Composer.Model.CanSend).IsTrue(); + await Assert.That(app.Composer.Model.Keys.Select(k => k.Label)).DoesNotContain("send (nothing connected)"); + } + + /// + /// Nor does the demo's startup pass say "nothing connects at start" under a header saying a character is connected — + /// the window's demo runs that pass with no startup list. + /// + [Test] + public async Task TheDemosStartupDoesNotSayNothingConnects() + { + await using var app = App(); + app.RenderSnapshot(null); + + await app.StartAsync([]); + + await Assert.That(app.LastNotice ?? string.Empty).DoesNotContain("nothing connects at start"); + } } diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs index d7747a68..710a788b 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs @@ -152,21 +152,40 @@ await Assert.That(scheme.Paint($"[{ScreenPalette.Ink} on {ScreenPalette.Accent}] [Arguments("compose")] [Arguments("deletions")] [Arguments("packages")] - public async Task NoLightSettingsFramePaintsADarkPlane(string view) + public async Task NoLightSettingsFramePaintsADarkPlane(string view) => await AssertNoDarkPlane(view, 120, 32); + + /// + /// The same at 80 columns, where F2, F4 and the settings search draw one column at a time + /// (ScreenChrome.Single). That path built its column from the renderer's markup unresolved, so on Light the + /// name and pattern wells kept Dark's #0a0e18 under Dark's ink (UX audit wave 11, #1) while 120 columns was + /// right. + /// + [Test] + [Arguments("triggers")] + [Arguments("triggers-edit")] + [Arguments("keypad")] + [Arguments("keypad-edit")] + [Arguments("settings-search")] + [Arguments("aliases")] + [Arguments("timers")] + [Arguments("worlds")] + public async Task NoLightSettingsFramePaintsADarkPlaneAt80Columns(string view) => await AssertNoDarkPlane(view, 80, 24); + + private static async Task AssertNoDarkPlane(string view, int width, int height) { Console.SetIn(TextReader.Null); var config = DemoScene.Build(); config.ThemeName = "Light"; config.Theme = ThemeLibrary.Get("Light"); var caps = new TerminalCapabilities(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); - var app = new SharpMUTermApp(config, caps, new HeadlessConsoleDriver(120, 32)); + var app = new SharpMUTermApp(config, caps, new HeadlessConsoleDriver(width, height)); var frame = app.RenderSnapshot(view); var dark = Planes.Select(Rgb).ToHashSet(); - var cells = FrameGrid.Cells(frame, 120, 32).Values.ToList(); + var cells = FrameGrid.Cells(frame, width, height).Values.ToList(); var offending = cells.Count(c => c.Background is { } bg && dark.Contains(bg)); - await Assert.That(cells.Count).IsGreaterThan(1000); - await Assert.That(offending).IsEqualTo(0).Because($"--theme Light --view {view}"); + await Assert.That(cells.Count).IsGreaterThan(width * height / 2); + await Assert.That(offending).IsEqualTo(0).Because($"--theme Light --view {view} --size {width}x{height}"); } } diff --git a/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs b/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs index 6e5db705..7ebb1897 100644 --- a/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TerminalPanelTests.cs @@ -243,4 +243,21 @@ private static async Task Connected() app.RenderNextFrame(); return new Wired(app, telnet, session); } + + /// + /// The idle words go before a name is cut: at 80 columns who-here cut every name to nine cells to keep + /// active/idle 4m (UX audit wave 11), when the dot already says which. + /// + [Test] + public async Task WhoHereDropsTheIdleColumnBeforeCuttingAName() + { + RoomOccupant[] here = [new("Ashlyn", "Ashlyn the Wanderer", true, 30), new("Bran", "Brannoc", true, 600)]; + + var narrow = WhoHereRenderer.Render("Plaza", here, 22, 6, new WhoHereRenderer.Ink("#00f5b7")).Select(StripMarkup).ToList(); + await Assert.That(narrow[1]).Contains("Ashlyn the Wanderer").And.DoesNotContain("active"); + await Assert.That(narrow.All(r => r.Length <= 22)).IsTrue(); + + var wide = WhoHereRenderer.Render("Plaza", here, 40, 6, new WhoHereRenderer.Ink("#00f5b7")).Select(StripMarkup).ToList(); + await Assert.That(wide[1]).Contains("Ashlyn the Wanderer").And.Contains("active"); + } } From 9ec7b167709bf366a9dffccfec2ec26d6c05b338 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 11:56:19 +0000 Subject: [PATCH 042/113] feat: auto-reconnect, attention alerts and command stacking - F5 reconnect (per world): a dropped connection is dialled again after 5/15/30/60/60 s with a status-row countdown and a notice carrying Stop; the player's own disconnect, quit, or a server close within 10 s of a command (a logout) never reconnects. Alt+R dials at once; Disconnect and Ctrl+P > Stop reconnecting cancel. Core AutoReconnect + WorldSession.LastClose. - Attention: a trigger's "alert" flag, or F5 alert on = name & pages, raises WorldSession.AttentionRequested; the client asks the host (new required ClientHost.Attention / IAttention) only while away, with F7 "alert when away" on, one per 10 s. Window: taskbar flash / osascript / notify-send. Terminal: OSC 99 (kitty, o=unfocused), OSC 777 (WezTerm, Ghostty, foot), else BEL after 30 s idle. The window title counts lines that arrived while behind. - F5 command stacking (off by default): TypedCommands splits a typed line on the world's separator, with \ escapes and #N repeats (bounded at 100), before the alias engine; composer posts, grabs, scripts and macros are never split. - Tests in Core and Tui; reconnect snapshot view; CLAUDE.md and CHANGELOG. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 11 + CLAUDE.md | 31 +- .../AvaloniaConsoleDriver.cs | 3 + src/SharpMUTerm.Avalonia/MainWindow.cs | 11 + src/SharpMUTerm.Avalonia/WindowAttention.cs | 135 +++++++ src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + src/SharpMUTerm.Client/Chrome/WindowTitle.cs | 11 + .../Commands/BuiltInCommands.cs | 7 + .../Settings/BuiltInLists.cs | 3 + .../Settings/BuiltInSettings.cs | 20 + .../Settings/WorldFieldValues.cs | 20 + .../Automation/AttentionMatcher.cs | 113 ++++++ src/SharpMUTerm.Core/Automation/Trigger.cs | 8 + .../Commands/CommandCatalog.cs | 2 + .../Configuration/PreferenceSettings.cs | 7 + .../Configuration/WorldDefinition.cs | 29 ++ src/SharpMUTerm.Core/Input/TypedCommands.cs | 151 ++++++++ src/SharpMUTerm.Core/Session/AutoReconnect.cs | 275 ++++++++++++++ src/SharpMUTerm.Core/Session/WorldSession.cs | 68 +++- src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 10 + .../Hosting/TerminalAttention.cs | 116 ++++++ .../SharpMUTermApp.Attention.cs | 117 ++++++ .../SharpMUTermApp.Reconnect.cs | 176 +++++++++ .../SharpMUTermApp.SendGroup.cs | 2 +- src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs | 17 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 39 +- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/TriggersScreenRenderer.cs | 6 +- src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 42 ++- .../ListSettingsTests.cs | 2 +- .../Automation/AttentionTests.cs | 96 +++++ .../Input/TypedCommandsTests.cs | 118 ++++++ .../Session/AutoReconnectTests.cs | 162 ++++++++ .../Session/FakeTelnetSession.cs | 15 + .../AlertsAndReconnectTests.cs | 348 ++++++++++++++++++ .../RecordingTelnetSession.cs | 9 +- .../SharpMUTerm.Tui.Tests/ScreenModelTests.cs | 8 +- .../TriggersScreenEditingTests.cs | 4 +- 38 files changed, 2180 insertions(+), 17 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/WindowAttention.cs create mode 100644 src/SharpMUTerm.Core/Automation/AttentionMatcher.cs create mode 100644 src/SharpMUTerm.Core/Input/TypedCommands.cs create mode 100644 src/SharpMUTerm.Core/Session/AutoReconnect.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Automation/AttentionTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Input/TypedCommandsTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Session/AutoReconnectTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 733c386b..d0d0f5c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,17 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- A world can reconnect by itself after its connection drops (F5 ▸ reconnect). It waits 5, 15, 30, 60 and 60 + seconds between tries, counts down on the status row, and stops after five; Alt+R dials at once, and Disconnect or + Ctrl+P ▸ Stop reconnecting cancels. Your own Disconnect, quitting, or the game closing right after you typed a + command (a logout) never reconnects. +- The client can tell your desktop when something wants you while you are in another window: tick "alert me when + away" on a trigger, or set F5 ▸ alert on to "name & pages" for a world. The desktop window flashes or shows a + notification; kitty, WezTerm, Ghostty and foot show a notification, other terminals ring the bell. At most one every + ten seconds, and F7 ▸ alert when away turns it all off. While the desktop window is behind another, its title + counts the lines that arrived. +- Command stacking, per world and off by default (F5 ▸ command stacking): `n;e;e` sends three commands and `#3 kill rat` + sends one three times. Only lines typed on the command line are split — never a composer post. - A tab strip too narrow for its tabs now says how many it could not draw (`+3 ▾` at its right edge); click it to list them and go to one — a menu in the desktop window, a short list in a terminal. - The composer shows how many characters the post will be once escaped and joined, and Alt+P shows exactly what will diff --git a/CLAUDE.md b/CLAUDE.md index e83bc392..63c4e51a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1340,7 +1340,7 @@ one `SharpMUTermApp`; a host is only the place it runs. What differs between hos (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it -draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M and the welcome itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), whether it can pop a panel out into a window of its own (`IFloatingPanels`, null for none), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M and the welcome itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), whether it can pop a panel out into a window of its own (`IFloatingPanels`, null for none), how it asks for attention while the player is elsewhere (`IAttention`, null headless), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until @@ -1610,7 +1610,8 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg (each panel in a pane of its own over the demo's game data; the composer over who-here, armed, with a draft typed through its real key path), `welcome`/`welcome-connect` (the first-run welcome over an **emptied** configuration and a main window alone — `--demo-config` has worlds, and the welcome never opens over them — and - its connect form filled in by real keys) and `tour` (the key tour row at the end of the demo's main window), plus + its connect form filled in by real keys) `tour` (the key tour row at the end of the demo's main window) and `reconnect` (Corvid dropped, the second try + counting down on the status row), plus the default workspace (no `--view`). Any settings screen also takes a `-edit` suffix, which opens it and drives real keys in so the frame shows a field mid-edit. State toggles: `collapsed`, `prefix`, `timestamps`, @@ -2862,6 +2863,32 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] OSC 2 through the `?1004` raw write, and pops it after the loop; the window sets `Window.Title`. Control characters are stripped twice (names, then the sequence). Not a surface in `SurfaceCatalog`: nothing draws it in cells and it hands nothing back. +- **Attention while the player is elsewhere is a host member** (`ClientHost.Attention` → `IAttention`, `Hosting/`; + Core `AttentionMatcher`, `AttentionThrottle`; `SharpMUTermApp.Attention.cs`). A trigger's `alert` flag, or on a world + with F5 ▸ `alert on` a line naming the character (whole word, not the line's first) or paging/telling/whispering + them (`WorldSession.AttentionRequested`, raised after the line is shown, never for a prompt or a gagged line). The + client asks only with F7 ▸ `alert when away` on, the host not in front, and one per 10 s. The window + (`WindowAttention`, `DesktopAlert`) knows its focus: Windows flashes the taskbar, macOS `osascript`, Linux + `notify-send`, all argv, errors swallowed. A terminal cannot tell focus-out, so `TerminalAttention.Focused` is null: + kitty gets OSC 99 with `o=unfocused` (kitty filters), WezTerm/Ghostty/foot OSC 777, anything else BEL, and those last + two only after 30 s with no input (`AwayAfter`). Text is stripped of control characters and base64'd for OSC 99. + While a host that knows its focus is behind, the title leads with the count of lines that arrived (`(3) …`, + `WindowTitle.WithUnread`). Null in tests, snapshots and the parity harness. +- **A dropped connection is dialled again only where F5 ▸ `reconnect` says so** (`AutoReconnect`, Core, one per + session; `SharpMUTermApp.Reconnect.cs`). `WorldSession.LastClose` says who closed: `Player` (Disconnect, quit, + dispose) never reconnects; `Failed` (an error) does; `Server` (orderly close) does **unless a command was sent in + the 10 s before** (`LogoutWindow`) — that is a `QUIT`, and dialling back would log the player in again. Waits 5, 15, + 30, 60, 60 s, then gives up; a connection that lasted 60 s (`StableAfter`) starts the count over. A dial is + `ConnectAsync`, so auto-login applies exactly as by hand. Each try prints a line and a notice (action: Stop); the + status row reads `reconnecting in 12 s · ⌥R now` (two-digit field) once the notice has gone, ticked by a one-shot + timer re-armed each second. ⌥R dials at once, ⌥D and ⌃P ▸ *Stop reconnecting* (offered only while one waits) cancel. + The `reconnect` view fakes it with the same writers (`ReconnectLine`, `ReconnectState`). +- **Command stacking is per world and off by default** (`WorldDefinition.CommandSeparator`, F5 ▸ `command stacking`: + off, `;`, `|`, `;;`; `TypedCommands`, Core; `WorldSession.SendTypedAsync`). Off because `;` is a MUSH's own + character. Only a line typed on the command line (and the send group) is split: the composer, a grab, a script's + `world.send`, a macro and a raw send never are. `\` before the separator keeps it; pieces are trimmed and empties + dropped; `#N cmd` repeats (1–100) within a piece; a line past 100 commands, or a repeat out of range, sends nothing + and says why. Each piece goes through the alias engine; the typed line is echoed once. - **Discord presence is a host member and a per-world opt-in** (`ClientHost.Presence`, a lazy `Func?`; `GamePresence`/`DiscordIpc`, Core; F5 ▸ `discord`, off by default). The world asks for `External.Discord 1`. `WorldSession.GamePresence` folds `Info` (application id: digits only) and `Status` diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index 0fd07b1f..e89dc5fa 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -91,6 +91,9 @@ public AvaloniaConsoleDriver(int columns, int rows) /// The window's title for what is in front, which the main window shows (). public WindowTitleBar TitleBar { get; } = new(); + /// The window's alerts while it is behind another (). + public WindowAttention Attention { get; } = new(); + public bool IsRunning { get; private set; } // ── IConsoleDriver: output ──────────────────────────────────────────────────────────────── diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index 37b02263..30908686 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -43,6 +43,17 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime // Character@World — SharpMUTerm for what is in front, from the client's own header (WindowTitle). _driver.TitleBar.Changed += title => Dispatcher.UIThread.Post(() => Title = title); + + // Whether the window is in front decides whether an alert is shown at all, and the title's unread count. + Activated += (_, _) => _driver.Attention.SetFocused(true); + Deactivated += (_, _) => _driver.Attention.SetFocused(false); + _driver.Attention.Requested += request => Dispatcher.UIThread.Post(() => + { + if (!IsActive) + { + DesktopAlert.Show(request, TryGetPlatformHandle()?.Handle); + } + }); _driver.Settings.Owner = this; // The window's own pop-ups (tooltips, the right-click menu) follow the client's theme: a light menu diff --git a/src/SharpMUTerm.Avalonia/WindowAttention.cs b/src/SharpMUTerm.Avalonia/WindowAttention.cs new file mode 100644 index 00000000..b8c12a24 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/WindowAttention.cs @@ -0,0 +1,135 @@ +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's half of . The main window says when it is activated and deactivated +/// (); the client hands a request over on its own thread, and the main window, which +/// subscribes to , puts it on screen on Avalonia's thread — but only while it is not the active +/// window, which is why is true. +/// +internal sealed class WindowAttention : IAttention +{ + private volatile int _focused = -1; + + public bool FiltersByFocus => true; + + public bool? Focused => _focused switch + { + 0 => false, + 1 => true, + _ => null, + }; + + public event Action? FocusChanged; + + /// Raised on the client's thread with each request. + public event Action? Requested; + + public void Request(AttentionRequest request) => Requested?.Invoke(request); + + /// Called by the main window on activation (true) and deactivation (false). + public void SetFocused(bool focused) + { + var value = focused ? 1 : 0; + if (Interlocked.Exchange(ref _focused, value) != value) + { + FocusChanged?.Invoke(focused); + } + } +} + +/// +/// What the desktop does with an alert: a notification, and on Windows the taskbar button's flash. Every way out of +/// the process is a fixed program with the text as separate arguments (), +/// never a shell string, and a missing program is a quiet no-op: an alert is a courtesy, never an error. +/// +/// Linux: notify-send (libnotify, on every desktop that runs a notification daemon). macOS: osascript, +/// the title and body passed as argv to a fixed script. Windows: FlashWindowEx until the window is +/// brought forward — a toast needs an installed AppUserModelID this client does not register. Avalonia has no +/// urgency API of its own, so an X11 window manager's urgency hint is not set. +/// +/// +internal static class DesktopAlert +{ + /// Shows for the window behind (null where there is none). + public static void Show(AttentionRequest request, IntPtr? handle) + { + try + { + if (OperatingSystem.IsWindows()) + { + if (handle is { } hwnd && hwnd != IntPtr.Zero) + { + Flash(hwnd); + } + + return; + } + + if (OperatingSystem.IsMacOS()) + { + Run("osascript", + ["-e", "on run argv", "-e", "display notification (item 2 of argv) with title (item 1 of argv)", "-e", "end run", + request.Title, request.Body]); + return; + } + + Run("notify-send", ["--app-name=SharpMUTerm", "--", request.Title, request.Body]); + } + catch (Exception ex) when (ex is Win32Exception or InvalidOperationException or PlatformNotSupportedException) + { + // No notifier on this machine: the title bar's count still says it. + } + } + + private static void Run(string program, IReadOnlyList arguments) + { + var start = new ProcessStartInfo(program) + { + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = true, + }; + foreach (var argument in arguments) + { + start.ArgumentList.Add(argument); + } + + using var process = Process.Start(start); + } + + private static void Flash(IntPtr hwnd) + { + var info = new FlashInfo + { + Size = (uint)Marshal.SizeOf(), + Window = hwnd, + Flags = FlashAll | FlashUntilForeground, + Count = 0, + Timeout = 0, + }; + FlashWindowEx(ref info); + } + + private const uint FlashAll = 3; + private const uint FlashUntilForeground = 12; + + [StructLayout(LayoutKind.Sequential)] + private struct FlashInfo + { + public uint Size; + public IntPtr Window; + public uint Flags; + public uint Count; + public uint Timeout; + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool FlashWindowEx(ref FlashInfo info); +} diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 96afa612..20e83fae 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -89,5 +89,8 @@ internal static class WindowHost // A panel popped out is a window of its own, owned by the main one, for a second monitor. FloatingPanels = driver.Floating, + + // A page while the window is behind another: a desktop notification and the taskbar's attention state. + Attention = driver.Attention, }; } diff --git a/src/SharpMUTerm.Client/Chrome/WindowTitle.cs b/src/SharpMUTerm.Client/Chrome/WindowTitle.cs index 9826bab9..f4d487b6 100644 --- a/src/SharpMUTerm.Client/Chrome/WindowTitle.cs +++ b/src/SharpMUTerm.Client/Chrome/WindowTitle.cs @@ -40,6 +40,17 @@ public static string For(string? character, string? world) }; } + /// The most a title's unread count says before it reads 99+. + public const int MaxUnread = 99; + + /// + /// led by how many lines arrived while the window was behind another — + /// (3) Corvid@Aetherfall — SharpMUTerm — or the title alone for none. Capped at 99+, so a busy + /// channel does not retitle the window with every line. + /// + public static string WithUnread(string title, int unread) => + unread <= 0 ? title : $"({(unread > MaxUnread ? $"{MaxUnread}+" : unread.ToString(System.Globalization.CultureInfo.InvariantCulture))}) {title}"; + private static string Clean(string? text) { if (string.IsNullOrWhiteSpace(text)) diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 98259241..a0461661 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -20,6 +20,9 @@ public static class BuiltInCommands /// The command that moves the keyboard into the connection sidebar (⌥C). public const string RailKeysCommand = "layout:rail-keys"; + /// Cancels a dropped connection's waiting reconnect. + public const string StopReconnectCommand = "world:stop-reconnect"; + /// /// Turns F5's join wraps on for the world named after the prefix: the action of the notice that says a pane is /// narrower than the server's wrap column. Lists nothing on ⌃P (F5 is the setting's home). @@ -76,6 +79,10 @@ void Family(string id, string prefix, Func c.State.Reconnecting); Family("world:send-group", CommandIds.GroupPrefix, SendGroup); Family("world:join-wraps", JoinWrapsPrefix, _ => []); Add("world:reload-scripts", CommandGroup.World, "Reload scripts", diff --git a/src/SharpMUTerm.Client/Settings/BuiltInLists.cs b/src/SharpMUTerm.Client/Settings/BuiltInLists.cs index 469ff55c..d3e31228 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInLists.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInLists.cs @@ -163,6 +163,9 @@ public static partial class BuiltInSettings }, ItemFlag("gag", "gag line", DeliveryGroup, t => t.Actions.Gag, (t, v) => t.Actions.Gag = v, "keep the line out of its usual window", "hide suppress", () => NewTrigger()), + ItemFlag("alert", "alert me", DeliveryGroup, t => t.Actions.Alert, (t, v) => t.Actions.Alert = v, + "tell the desktop when this matches while you are in another window", "notify notification bell flash", + () => NewTrigger()), ItemText("rewrite", "rewrite", TextRule.Template, ActionsGroup, (_, t) => t.Actions.Rewrite, (_, t, v) => t.Actions.Rewrite = v, diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index 00598bb5..0ac15685 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -35,6 +35,9 @@ public static partial class BuiltInSettings /// The status row's meters. public const string MetersGroup = "Status row & meters"; + /// Telling the desktop while the player is in another window. + public const string AlertsGroup = "Alerts"; + /// The bar marking where a reader left a window. public const string ActivityGroup = "Activity"; @@ -116,6 +119,11 @@ public static partial class BuiltInSettings c => c.Text.ActivityBarSeconds, (c, v) => c.Text.ActivityBarSeconds = v, "how long the NEW bar stays once you are back; 0 retires it at once", "unread new away"), + Flag("alerts", "alert when away", AlertsGroup, + c => c.Text.AlertWhenAway, (c, v) => c.Text.AlertWhenAway = v, + "tell the desktop when an alert trigger or a page arrives while you are in another window", + "notify notification bell flash urgent page tell mention"), + Flag("split-scrollback", "split the pane when scrolled back", ScrollbackGroup, c => c.Text.SplitScrollback, (c, v) => c.Text.SplitScrollback = v, "keep the newest lines in view below the history you are reading", "live tail history split"), @@ -235,6 +243,10 @@ public static partial class BuiltInSettings (_, w) => w.GmcpLogin ? WorldFieldValues.LoginChoices[1] : WorldFieldValues.LoginChoices[0], (_, w, v) => w.GmcpLogin = v == WorldFieldValues.LoginChoices[1], "log in over GMCP when the server offers it", "char.login password credentials"), + WorldChoice("reconnect", "reconnect", WorldFieldValues.ReconnectChoices, ConnectionGroup, + (_, w) => w.AutoReconnect ? WorldFieldValues.ReconnectChoices[1] : WorldFieldValues.ReconnectChoices[0], + (_, w, v) => w.AutoReconnect = v == WorldFieldValues.ReconnectChoices[1], + "dial again after a dropped connection, 5 s to 60 s apart, five tries", "auto reconnect drop retry"), WorldChoice("discord", "discord", WorldFieldValues.DiscordChoices, ProtocolGroup, (_, w) => w.DiscordPresence ? WorldFieldValues.DiscordChoices[1] : WorldFieldValues.DiscordChoices[0], (_, w, v) => w.DiscordPresence = v == WorldFieldValues.DiscordChoices[1], @@ -247,6 +259,14 @@ public static partial class BuiltInSettings (_, w) => w.JoinWrappedLines ? WorldFieldValues.JoinWrapChoices[1] : WorldFieldValues.JoinWrapChoices[0], (_, w, v) => w.JoinWrappedLines = v == WorldFieldValues.JoinWrapChoices[1], "join lines the server wrapped at its own width", "reflow wrap hard"), + WorldChoice("stacking", "command stacking", WorldFieldValues.SeparatorChoices, WorldTextGroup, + (_, w) => WorldFieldValues.SeparatorName(w.CommandSeparator), + (_, w, v) => w.CommandSeparator = WorldFieldValues.SeparatorOf(v), + "split a typed line on this, and #3 cmd repeats one; off for a MUSH", "separator semicolon repeat speedwalk"), + WorldChoice("alert-on", "alert on", WorldFieldValues.AlertChoices, WorldTextGroup, + (_, w) => w.AlertOnName ? WorldFieldValues.AlertChoices[1] : WorldFieldValues.AlertChoices[0], + (_, w, v) => w.AlertOnName = v == WorldFieldValues.AlertChoices[1], + "tell the desktop when a line names your character or pages you", "notify mention page tell"), WorldText("edit-grab", "edit grab", TextRule.Optional, WorldTextGroup, (_, w) => w.GrabPrefix, (_, w, v) => w.GrabPrefix = v, "a line starting with this goes on the command line instead of the output", "fugueedit mush edit prefix"), diff --git a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs index a8fc3051..6547186c 100644 --- a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs +++ b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs @@ -83,6 +83,26 @@ public static void SetEmoji(EmojiSettings emoji, string name) /// The words for . public static IReadOnlyList JoinWrapChoices { get; } = ["off", "join"]; + /// The words for . + public static IReadOnlyList ReconnectChoices { get; } = ["off", "after a drop"]; + + /// The words for . + public static IReadOnlyList AlertChoices { get; } = ["off", "name & pages"]; + + /// + /// The words for : off, or the separator itself. A closed list, so a + /// separator is never a letter or a space that would split ordinary text. + /// + public static IReadOnlyList SeparatorChoices { get; } = ["off", ";", "|", ";;"]; + + /// The stacking row's word for . + public static string SeparatorName(string? separator) => + separator is { Length: > 0 } s && SeparatorChoices.Contains(s) ? s : SeparatorChoices[0]; + + /// The separator names, or null for off. + public static string? SeparatorOf(string name) => + name != SeparatorChoices[0] && SeparatorChoices.Contains(name) ? name : null; + /// What a world's layout row says while it names none. public const string WorldLayoutDefault = "(suggested)"; diff --git a/src/SharpMUTerm.Core/Automation/AttentionMatcher.cs b/src/SharpMUTerm.Core/Automation/AttentionMatcher.cs new file mode 100644 index 00000000..14b49d53 --- /dev/null +++ b/src/SharpMUTerm.Core/Automation/AttentionMatcher.cs @@ -0,0 +1,113 @@ +using System.Text.RegularExpressions; + +namespace SharpMUTerm.Core.Automation; + +/// Why a line asked for the player's attention. +public enum AttentionReason +{ + /// A trigger marked alert matched it. + Trigger, + + /// It names the player's character. + Name, + + /// It is a page, a tell or a whisper to the player. + Page, +} + +/// A line that asked for attention, and why. +public sealed class AttentionEventArgs(AttentionReason reason, string text) : EventArgs +{ + public AttentionReason Reason { get; } = reason; + + /// The line as it is shown. + public string Text { get; } = text; +} + +/// +/// The built-in "my name and pages" rule a world opts into (). +/// +/// A page or a tell is read off the shapes the common servers use, anchored at the start of the line: +/// Bob pages: … and From afar, Bob … (PennMUSH, TinyMUX), Bob tells you … (Diku and its +/// family), Bob whispers: … / Bob whispers to you …. A line starting You is the player's own. +/// +/// +/// The name counts as a whole word, case ignored, anywhere but the start of the line: a MUSH shows the +/// player their own pose as Corvid waves., and every one of those would otherwise be an alert. A name shorter +/// than two letters is never matched. The client's own echo and system lines are not output and never reach this. +/// +/// +public static partial class AttentionMatcher +{ + /// Why asks for attention for , or null. + public static AttentionReason? Classify(string line, string? character) + { + ArgumentNullException.ThrowIfNull(line); + if (line.StartsWith("You ", StringComparison.OrdinalIgnoreCase)) + { + return null; + } + + if (PagePattern().IsMatch(line)) + { + return AttentionReason.Page; + } + + if (character is { } name && name.Trim().Length >= 2 && MentionsName(line, name.Trim())) + { + return AttentionReason.Name; + } + + return null; + } + + private static bool MentionsName(string line, string name) + { + for (var at = line.IndexOf(name, 1, StringComparison.OrdinalIgnoreCase); + at > 0; + at = at + 1 < line.Length ? line.IndexOf(name, at + 1, StringComparison.OrdinalIgnoreCase) : -1) + { + var before = line[at - 1]; + var end = at + name.Length; + if (!char.IsLetterOrDigit(before) && before != '_' + && (end >= line.Length || (!char.IsLetterOrDigit(line[end]) && line[end] != '_'))) + { + return true; + } + } + + return false; + } + + [GeneratedRegex( + @"^(?:From afar, \S|\S+ pages(?:[:,]| you\b)|\S+ tells you\b|\S+ whispers(?::| to you\b))", + RegexOptions.IgnoreCase | RegexOptions.CultureInvariant, + matchTimeoutMilliseconds: 100)] + private static partial Regex PagePattern(); +} + +/// +/// At most one alert per , so a channel spamming the player's name, or a trigger matching +/// every line of a fight, flashes the taskbar once rather than for ever. Not thread-safe: the app calls it on its own +/// thread. +/// +public sealed class AttentionThrottle(TimeProvider time) +{ + /// The shortest gap between two alerts. + public static readonly TimeSpan Interval = TimeSpan.FromSeconds(10); + + private DateTimeOffset? _last; + + /// True, and the clock starts again, when an alert may go now. + public bool TryTake() + { + var now = time.GetUtcNow(); + if (_last is { } last && now - last < Interval) + { + return false; + } + + _last = now; + return true; + } +} diff --git a/src/SharpMUTerm.Core/Automation/Trigger.cs b/src/SharpMUTerm.Core/Automation/Trigger.cs index 1042c826..d7ea3288 100644 --- a/src/SharpMUTerm.Core/Automation/Trigger.cs +++ b/src/SharpMUTerm.Core/Automation/Trigger.cs @@ -84,6 +84,13 @@ public sealed class TriggerActions /// public string? ScriptCallback { get; set; } + /// + /// Ask for the player's attention when this rule matches while they are in another window: a desktop + /// notification and a taskbar flash in the window, a notification or a bell in a terminal. Rate-limited and + /// switched off by F7 ▸ alert when away; matched lines that are gagged still alert, since the rule asked. + /// + public bool Alert { get; set; } + /// /// A copy of these actions. Every field is a value or an immutable string, so a member-wise copy /// really is a deep one — but it has to be written out rather than shared, because @@ -100,6 +107,7 @@ public sealed class TriggerActions SendResponse = SendResponse, SpawnTarget = SpawnTarget, ScriptCallback = ScriptCallback, + Alert = Alert, }; } diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index 1cba2e48..29f43751 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -37,6 +37,7 @@ public sealed record CharacterRef( /// Whether this client runs Lua at all, so Reload scripts is offered only where it can do something. /// /// Whether the focused connection is speedwalking, so Stop walking has a walk to stop. +/// Whether a dropped connection is waiting to dial again, so Stop reconnecting has one to stop. /// /// Null where the client cannot play sound, so no mute is offered; otherwise whether sound is playing /// (offer Mute sound) or muted (offer Unmute sound). @@ -63,6 +64,7 @@ public sealed record CommandContext( string NewlineChord = "Alt+⏎", bool ScriptsOn = false, bool Walking = false, + bool Reconnecting = false, bool? Sound = null, bool? Announced = null, bool OutputSelected = false, diff --git a/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs b/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs index 4c7df969..cd058ec9 100644 --- a/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs +++ b/src/SharpMUTerm.Core/Configuration/PreferenceSettings.cs @@ -163,6 +163,13 @@ public sealed class TextSettings /// public bool SplitScrollback { get; set; } = true; + /// + /// Whether a trigger marked alert, or a world's name-and-pages alert, may tell the desktop while the + /// player is in another window (F7 ▸ ALERTS, on by default). Nothing alerts until a trigger or a world asks for + /// it, so on costs nothing; off silences every alert at once, including the window title's unread count. + /// + public bool AlertWhenAway { get; set; } = true; + /// Thirty seconds: long enough to read a screenful, short enough not to become furniture. public const int DefaultActivityBarSeconds = 30; diff --git a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs index 8b64c6dc..6e4f9417 100644 --- a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs +++ b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs @@ -189,6 +189,32 @@ public sealed class WorldDefinition /// public bool JoinWrappedLines { get; set; } + /// + /// Whether a connection this world dropped is dialled again on its own (F5 ▸ reconnect). Off by default. + /// Only a drop the player did not ask for counts: never after Disconnect, Reconnect or quitting, and never after a + /// server closed the connection within of a command the player + /// sent (a QUIT). The attempts back off () and stop after the + /// last one; a connection must last before the count starts again, + /// so a login the server refuses is not retried for ever. + /// + public bool AutoReconnect { get; set; } + + /// + /// What splits a typed line into several commands (F5 ▸ command stacking), or null for nothing, the + /// default. While it is set, #N command repeats a command too (). Off by + /// default because a MUSH spends both: ; is a semipose and an attribute separator, and #123 cmd is + /// PennMUSH's force shorthand. Applied only to what the player types on the command line, never to a composed + /// post, a grab or a script's world.send. + /// + public string? CommandSeparator { get; set; } + + /// + /// Whether a line naming this world's character, or a page or a tell, asks for attention while the player is in + /// another window (F5 ▸ alert on; ). Off by default. A trigger can + /// ask for the same with its own alert flag on any world. + /// + public bool AlertOnName { get; set; } + /// /// The world's accent colour, used to keep its windows traceable to their owner once they /// scatter across panes. Default resolves to a theme-derived accent. @@ -240,6 +266,9 @@ public sealed class WorldDefinition DownloadMedia = DownloadMedia, GrabPrefix = GrabPrefix, JoinWrappedLines = JoinWrappedLines, + AutoReconnect = AutoReconnect, + CommandSeparator = CommandSeparator, + AlertOnName = AlertOnName, GmcpLogin = GmcpLogin, DiscordPresence = DiscordPresence, Layout = Layout, diff --git a/src/SharpMUTerm.Core/Input/TypedCommands.cs b/src/SharpMUTerm.Core/Input/TypedCommands.cs new file mode 100644 index 00000000..d0f08de6 --- /dev/null +++ b/src/SharpMUTerm.Core/Input/TypedCommands.cs @@ -0,0 +1,151 @@ +using System.Globalization; +using System.Text; + +namespace SharpMUTerm.Core.Input; + +/// +/// What one typed line becomes once a world's command stacking is applied +/// (): the commands to run, in order, or the reason none +/// will run. +/// +/// Each command, before alias expansion. Empty when is set. +/// Why nothing is sent, or null. +public sealed record TypedExpansion(IReadOnlyList Commands, string? Refusal = null); + +/// +/// Command stacking for a typed line: n;e;e is three commands and #3 kill rat is one command three +/// times, the way every MUD client reads them. Applied by WorldSession.SendTypedAsync — what the command line +/// sends — and nowhere else: a composed post, a grab and a script's world.send go out as written. +/// +/// Off unless the world names a separator, and the repeat comes with it, because a MUSH spends both: ; +/// is a semipose and separates attribute actions, and #123 command is PennMUSH's force shorthand. A world with +/// no separator gets the line back untouched. +/// +/// +/// \ before the separator makes it literal (say a\;b says a;b); any other backslash is left +/// alone. Each command is trimmed and empty ones are dropped. A repeat is 1 to , and a line +/// may not come to more than commands: past either bound nothing is sent, because +/// half of a stacked line is a line the player did not type. +/// +/// +public static class TypedCommands +{ + /// The most times #N repeats a command. + public const int MaxRepeat = 100; + + /// The most commands one typed line may come to, repeats included. + public const int MaxCommands = 100; + + /// Splits and repeats by ; null or blank changes nothing. + public static TypedExpansion Expand(string input, string? separator) + { + ArgumentNullException.ThrowIfNull(input); + if (string.IsNullOrWhiteSpace(separator)) + { + return new TypedExpansion([input]); + } + + var pieces = Split(input, separator); + if (pieces.Count == 0) + { + return new TypedExpansion([input]); + } + + var commands = new List(); + foreach (var piece in pieces) + { + if (Repeat(piece) is { } repeat) + { + if (repeat.Count is < 1 or > MaxRepeat) + { + return Refused($"#{repeat.Count} is not a repeat this client sends (1 to {MaxRepeat}) — nothing was sent"); + } + + for (var i = 0; i < repeat.Count; i++) + { + commands.Add(repeat.Command); + } + } + else + { + commands.Add(piece); + } + + if (commands.Count > MaxCommands) + { + return Refused($"that line comes to more than {MaxCommands} commands — nothing was sent"); + } + } + + return new TypedExpansion(commands); + } + + private static TypedExpansion Refused(string why) => new([], why); + + private static List Split(string input, string separator) + { + var pieces = new List(); + var current = new StringBuilder(); + for (var i = 0; i < input.Length; i++) + { + if (input[i] == '\\' && string.CompareOrdinal(input, i + 1, separator, 0, separator.Length) == 0) + { + current.Append(separator); + i += separator.Length; + continue; + } + + if (string.CompareOrdinal(input, i, separator, 0, separator.Length) == 0) + { + Add(pieces, current); + i += separator.Length - 1; + continue; + } + + current.Append(input[i]); + } + + Add(pieces, current); + return pieces; + + static void Add(List pieces, StringBuilder current) + { + var piece = current.ToString().Trim(); + current.Clear(); + if (piece.Length > 0) + { + pieces.Add(piece); + } + } + } + + /// #N command: the count and the command, or null for anything else (# alone, #abc). + private static (int Count, string Command)? Repeat(string piece) + { + if (piece.Length < 3 || piece[0] != '#') + { + return null; + } + + var digits = 1; + while (digits < piece.Length && char.IsAsciiDigit(piece[digits])) + { + digits++; + } + + if (digits == 1 || digits >= piece.Length || !char.IsWhiteSpace(piece[digits])) + { + return null; + } + + var command = piece[digits..].Trim(); + if (command.Length == 0) + { + return null; + } + + // Past int's range is just "too many", which the caller refuses. + var count = digits > 6 ? int.MaxValue : int.Parse(piece.AsSpan(1, digits - 1), CultureInfo.InvariantCulture); + return (count, command); + } +} diff --git a/src/SharpMUTerm.Core/Session/AutoReconnect.cs b/src/SharpMUTerm.Core/Session/AutoReconnect.cs new file mode 100644 index 00000000..c93646ae --- /dev/null +++ b/src/SharpMUTerm.Core/Session/AutoReconnect.cs @@ -0,0 +1,275 @@ +namespace SharpMUTerm.Core.Session; + +/// How a connection ended (). +public enum SessionClose +{ + /// No connection has ended yet. + None, + + /// The player closed it: Disconnect, Reconnect, quitting, closing the session. + Player, + + /// The server closed it in an orderly way. + Server, + + /// It failed: reset, timed out, a keepalive went unanswered. + Failed, +} + +/// What an just did. +public enum ReconnectStep +{ + /// A try is waiting for its time (). + Scheduled, + + /// A try is dialling now. + Dialling, + + /// The connection is back. + Connected, + + /// The last try failed; nothing more will be tried until the player connects. + GaveUp, + + /// The player stopped it, or connected by hand. + Cancelled, +} + +/// +/// Dials a dropped connection again, for a world that asks for it (). +/// One per session; it listens to the session's state and commands and does nothing until a connection ends. +/// +/// A drop is a connection that ended without the player asking. never +/// reconnects. Neither does within of a command the player +/// sent: a server that closes the socket straight after QUIT or @quit is saying goodbye, and dialling it +/// back would log the player in again. A server closing on its own (a reboot, an idle timeout) and every failure do +/// reconnect. That last-command rule errs towards not dialling: a reboot in the seconds after a command is +/// missed, and ⌥R is one key. Mudlet's rule — every close but the player's — dials straight back after a logout. +/// +/// +/// Tries back off and run out (: 5, 15, 30, 60, 60 seconds). A connection has to last +/// before the count starts again, so a server that takes the connection and then refuses the +/// login is tried five times and left alone, rather than for ever. A try that fails to connect counts as one. +/// +/// +/// Runs on whatever thread the session raises on and the clock fires on; is raised outside its +/// lock, and a host marshals it. +/// +/// +public sealed class AutoReconnect : IDisposable +{ + /// The wait before each try, in order; there are as many tries as entries. + public static readonly IReadOnlyList Delays = + [ + TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(60), + TimeSpan.FromSeconds(60), + ]; + + /// How long a connection must last before the tries are counted from the first again. + public static readonly TimeSpan StableAfter = TimeSpan.FromSeconds(60); + + /// A server closing this soon after a command the player sent is a logout, not a drop. + public static readonly TimeSpan LogoutWindow = TimeSpan.FromSeconds(10); + + private readonly WorldSession _session; + private readonly TimeProvider _time; + private readonly Func _connect; + private readonly Lock _gate = new(); + private ConnectionState _state; + private DateTimeOffset _connectedAt; + private DateTimeOffset? _lastCommandAt; + private ITimer? _timer; + private int _tries; + private bool _dialling; + private bool _disposed; + + /// The session to watch. + /// The clock the waits are measured on. + /// Dials the session; a failure is the session's to report, and counts as a try. + public AutoReconnect(WorldSession session, TimeProvider time, Func connect) + { + _session = session ?? throw new ArgumentNullException(nameof(session)); + _time = time ?? throw new ArgumentNullException(nameof(time)); + _connect = connect ?? throw new ArgumentNullException(nameof(connect)); + _state = session.State; + session.StateChanged += OnStateChanged; + session.CommandSent += OnCommandSent; + } + + /// Raised with each step; never under the lock. + public event EventHandler? Changed; + + /// When the waiting try dials, or null when none is waiting. + public DateTimeOffset? DueAt { get; private set; } + + /// The try waiting or dialling, from 1; 0 when none is. + public int Try { get; private set; } + + /// Whether a try is waiting or dialling. + public bool IsActive => DueAt is not null || _dialling; + + /// The whole seconds until the waiting try dials, rounded up, or null. + public int? SecondsLeft => + DueAt is { } due ? Math.Max(0, (int)Math.Ceiling((due - _time.GetUtcNow()).TotalSeconds)) : null; + + /// Stops a waiting try and forgets the count. Does nothing when none is waiting. + public void Cancel() + { + bool cancelled; + lock (_gate) + { + cancelled = DueAt is not null || _dialling; + Reset(); + } + + if (cancelled) + { + Changed?.Invoke(this, ReconnectStep.Cancelled); + } + } + + public void Dispose() + { + lock (_gate) + { + _disposed = true; + Reset(); + } + + _session.StateChanged -= OnStateChanged; + _session.CommandSent -= OnCommandSent; + } + + private void Reset() + { + _timer?.Dispose(); + _timer = null; + DueAt = null; + Try = 0; + _tries = 0; + _dialling = false; + } + + private void OnCommandSent(object? sender, string command) + { + lock (_gate) + { + _lastCommandAt = _time.GetUtcNow(); + } + } + + private void OnStateChanged(object? sender, ConnectionStateChangedEventArgs e) + { + ReconnectStep? step = null; + lock (_gate) + { + var was = _state; + _state = e.State; + if (_disposed) + { + return; + } + + var now = _time.GetUtcNow(); + switch (e.State) + { + case ConnectionState.Connected: + _connectedAt = now; + if (_dialling || DueAt is not null) + { + // Back, whether by our try or the player's own connect: nothing waits any more. The count + // is kept until the connection has lasted, so a login the server refuses still runs out. + _timer?.Dispose(); + _timer = null; + DueAt = null; + _dialling = false; + Try = 0; + step = ReconnectStep.Connected; + } + + break; + + case ConnectionState.Disconnected or ConnectionState.Faulted: + var droppedLive = was == ConnectionState.Connected; + var failedTry = _dialling && was == ConnectionState.Connecting; + if (!droppedLive && !failedTry) + { + break; + } + + _dialling = false; + if (droppedLive && now - _connectedAt >= StableAfter) + { + _tries = 0; + } + + if (!_session.World.AutoReconnect || IsGoodbye(now)) + { + Reset(); + break; + } + + step = Schedule(now); + break; + } + } + + if (step is { } raised) + { + Changed?.Invoke(this, raised); + } + } + + private bool IsGoodbye(DateTimeOffset now) => _session.LastClose switch + { + SessionClose.Player => true, + SessionClose.Server => _lastCommandAt is { } at && now - at <= LogoutWindow, + _ => false, + }; + + private ReconnectStep Schedule(DateTimeOffset now) + { + if (_tries >= Delays.Count) + { + Reset(); + return ReconnectStep.GaveUp; + } + + var delay = Delays[_tries]; + _tries++; + Try = _tries; + DueAt = now + delay; + _timer?.Dispose(); + _timer = _time.CreateTimer(_ => Fire(), null, delay, Timeout.InfiniteTimeSpan); + return ReconnectStep.Scheduled; + } + + private void Fire() + { + lock (_gate) + { + if (_disposed || DueAt is null) + { + return; + } + + DueAt = null; + _dialling = true; + } + + Changed?.Invoke(this, ReconnectStep.Dialling); + _ = DialAsync(); + } + + private async Task DialAsync() + { + try + { + await _connect(_session).ConfigureAwait(false); + } + catch (Exception) + { + // The session has printed and logged why; its Faulted state schedules the next try. + } + } +} diff --git a/src/SharpMUTerm.Core/Session/WorldSession.cs b/src/SharpMUTerm.Core/Session/WorldSession.cs index 6f50a638..e05b9ef7 100644 --- a/src/SharpMUTerm.Core/Session/WorldSession.cs +++ b/src/SharpMUTerm.Core/Session/WorldSession.cs @@ -25,6 +25,9 @@ public sealed class WorldSession : IAsyncDisposable private static readonly TextStyle SystemStyle = new(TerminalColor.FromIndex(6), TerminalColor.Default, TextAttributes.Italic); + /// The style of the client's own lines in a session's window (), for a demo that writes one by hand. + public static TextStyle SystemLineStyle => SystemStyle; + private readonly Func _sessionFactory; private ILineParser _parser; private EmojiSubstitutor? _emoji; @@ -608,6 +611,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) // Re-read with the parser, so an F5 change to the world's emoji switches reaches the next connection. _emoji = NewEmoji(World.Emoji); + _closingByPlayer = false; SetState(ConnectionState.Connecting, null); PrintSystem($"*** Connecting to {World.Host}:{World.Port}..."); @@ -940,8 +944,26 @@ private void ProcessOutputLine(StyledLine line, bool isPrompt = false) { Print(shown); } + + // Asked for by a rule (shown or not: the rule said so), or by the world for a line that mentions the + // character or pages them — only a line someone will see, and never a prompt. + var shownSomewhere = result.RouteMain || !result.Suppress || result.SpawnTargets.Count > 0; + var reason = result.Matched.Any(t => t.Actions.Alert) + ? AttentionReason.Trigger + : World.AlertOnName && shownSomewhere && !isPrompt ? AttentionMatcher.Classify(shown.Text, Character?.Name) : null; + if (reason is { } why) + { + AttentionRequested?.Invoke(this, new AttentionEventArgs(why, shown.Text)); + } } + /// + /// Raised on the read loop when a line asks for the player's attention: a trigger marked alert matched, + /// or (with ) the line names the character or pages them. Whether that + /// reaches the desktop — the player away, F7's switch, the rate limit — is the host's to decide. + /// + public event EventHandler? AttentionRequested; + /// /// Marks the plain-text URLs in a line clickable when F7's detect links is on; a no-op /// otherwise. Read here rather than at construction, like the settings around it, so unticking it @@ -967,9 +989,36 @@ private StyledLine ApplyEmoji(StyledLine line) => public async Task SendUserInputAsync(string input, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(input); + Echo(input); + await ExpandAndSendAsync(input, cancellationToken).ConfigureAwait(false); + } - var expansion = Aliases.Expand(input); + /// + /// Handles a line the player typed on the command line: the world's command stacking first + /// ( — n;e;e, #3 kill rat), then each command through + /// 's alias expansion. The line is echoed once, as typed. A composed post, a + /// grab and a script go through or instead, so a + /// ; in a post is never a command boundary. + /// + public async Task SendTypedAsync(string input, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(input); + var stacked = Input.TypedCommands.Expand(input, World.CommandSeparator); + Echo(input); + if (stacked.Refusal is { } refusal) + { + PrintSystem($"*** {refusal}"); + return; + } + foreach (var command in stacked.Commands) + { + await ExpandAndSendAsync(command, cancellationToken).ConfigureAwait(false); + } + } + + private void Echo(string input) + { // Two switches, and both have to be on: the world's (some servers echo for you, some don't) // and F8's app-wide one. The app-wide one is read per line, not captured, so unticking it // stops the echo on the next command rather than the next session. @@ -977,7 +1026,11 @@ public async Task SendUserInputAsync(string input, CancellationToken cancellatio { Print(StyledLine.FromText(input, EchoStyle)); } + } + private async Task ExpandAndSendAsync(string input, CancellationToken cancellationToken) + { + var expansion = Aliases.Expand(input); if (expansion.Matched) { if (expansion.Alias?.ScriptCallback is { Length: > 0 } callback && expansion.Match is { } match) @@ -1354,6 +1407,8 @@ private void OnDisconnected(object? sender, SessionDisconnectedEventArgs e) CancelGmcpLogin(); StopTimers(); ClearPrompt(); + LastClose = _closingByPlayer ? SessionClose.Player : e.IsClean ? SessionClose.Server : SessionClose.Failed; + _closingByPlayer = false; SetState(e.IsClean ? ConnectionState.Disconnected : ConnectionState.Faulted, e.Error); PrintSystem(e.IsClean ? "*** Disconnected." : $"*** Connection lost: {e.Error?.Message}"); } @@ -1388,6 +1443,7 @@ public async Task DisconnectAsync() { if (_telnet is not null) { + _closingByPlayer = true; await SendLeavingAsync().ConfigureAwait(false); await _telnet.DisconnectAsync().ConfigureAwait(false); } @@ -1481,8 +1537,18 @@ private ITelnetSession DefaultSessionFactory(ConnectionOptions options) }); } + /// + /// How the last connection ended, set before the state change that reports it: the player closed it + /// (Disconnect, Reconnect, quitting), the server closed it in an orderly way, or it failed. + /// until a connection has ended. What reads to tell a drop from a goodbye. + /// + public SessionClose LastClose { get; private set; } + + private volatile bool _closingByPlayer; + public async ValueTask DisposeAsync() { + _closingByPlayer = true; StopTimers(); Scheduler.Dispose(); DetachLog(); // flushes what the session logged before closing the file behind it diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 8396649d..3315ce2a 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -147,6 +147,13 @@ internal sealed record ClientHost /// public required IFloatingPanels? FloatingPanels { get; init; } + /// + /// How the host tells the desktop that a page, a mention or an alert trigger arrived while the player was in another + /// window (): the window's notification and taskbar flash, the terminal's OSC 99, + /// OSC 777 or bell. Null in the snapshot, the tests and --plain, which must never reach a desktop. + /// + public required IAttention? Attention { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -191,6 +198,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) NativeModals = null, Title = new TerminalTitle(driver), FloatingPanels = null, + Attention = new TerminalAttention(driver, TerminalAttention.Detect()), }; /// @@ -220,6 +228,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) NativeModals = null, Title = null, FloatingPanels = null, + Attention = null, }; /// @@ -269,6 +278,7 @@ internal static ClientHost HarnessTerminal( Audio = null, // a test never makes a noise Presence = null, // nor talks to Discord Title = null, // nor retitles the terminal running the suite + Attention = null, // nor rings its bell }; } diff --git a/src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs b/src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs new file mode 100644 index 00000000..cc77f072 --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs @@ -0,0 +1,116 @@ +using System.Text; +using SharpConsoleUI.Drivers; + +namespace SharpMUTerm.Tui; + +/// An alert for the desktop: a short title (Corvid@Aetherfall — page) and the line that raised it. +internal sealed record AttentionRequest(string Title, string Body); + +/// +/// How a host tells the desktop that something wants the player while they are in another window +/// (): a notification and a taskbar flash in the window, a notification escape or a +/// bell in a terminal. The client decides whether to ask — a rule or a world asked, F7 allows it, the rate +/// limit has room, the player is not looking — and the host only says it. +/// +internal interface IAttention +{ + /// + /// True when the host itself shows a request only while it is not in front (kitty's o=unfocused, the + /// window's own focus), so the client need not guess at absence from the time since the last key. + /// + bool FiltersByFocus { get; } + + /// Whether the host is in front, as last known; null when it cannot tell (a terminal). + bool? Focused { get; } + + /// Raised, on any thread, when changes. + event Action? FocusChanged; + + /// Says . Called on the client's thread. + void Request(AttentionRequest request); +} + +/// Which escape a terminal shows a notification for. +internal enum TerminalNotify +{ + /// BEL: every terminal; most mark the window urgent while it is not in front. + Bell, + + /// OSC 777 ; notify ; title ; body: foot, WezTerm, Ghostty, urxvt's extension. + Osc777, + + /// OSC 99, kitty's desktop notifications, shown only while the window is not in front. + Osc99, +} + +/// +/// The terminal's way to get attention: kitty's OSC 99 where the terminal is kitty, OSC 777 where it is +/// one of the terminals that read it, else a bell. Written through the driver's one raw write that is serialised +/// against frame painting, the path and use. +/// +/// A terminal cannot tell the client it is in the background (its focus-out report is dropped by the +/// framework's parser, see ), so is null. kitty decides for +/// itself (o=unfocused); for the others the client asks only after a stretch with no input. +/// +/// +internal sealed class TerminalAttention(IConsoleDriver driver, TerminalNotify kind) : IAttention +{ + /// The longest a title or body is written into an escape. + internal const int MaxText = 200; + + private int _sequence; + + public bool FiltersByFocus => kind == TerminalNotify.Osc99; + + public bool? Focused => null; + + public event Action? FocusChanged + { + add { } + remove { } + } + + /// Which escape this terminal reads, from what it says about itself. + public static TerminalNotify Detect() + { + var term = Environment.GetEnvironmentVariable("TERM") ?? string.Empty; + var program = Environment.GetEnvironmentVariable("TERM_PROGRAM") ?? string.Empty; + if (term == "xterm-kitty" || !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("KITTY_WINDOW_ID"))) + { + return TerminalNotify.Osc99; + } + + return program.Equals("WezTerm", StringComparison.OrdinalIgnoreCase) + || program.Equals("ghostty", StringComparison.OrdinalIgnoreCase) + || term.StartsWith("foot", StringComparison.Ordinal) + || term == "xterm-ghostty" + ? TerminalNotify.Osc777 + : TerminalNotify.Bell; + } + + public void Request(AttentionRequest request) => + driver.WriteClipboardOsc52(Sequence(kind, request, ++_sequence)); + + /// The bytes for in 's escape. + internal static string Sequence(TerminalNotify kind, AttentionRequest request, int id) => kind switch + { + // kitty: the title, then the body, under one id; base64 so nothing in a game's line can end the escape early. + TerminalNotify.Osc99 => + $"\u001b]99;i=smt{id}:d=0:o=unfocused:e=1;{Base64(request.Title)}\u001b\\" + + $"\u001b]99;i=smt{id}:d=1:o=unfocused:p=body:e=1;{Base64(request.Body)}\u001b\\", + + // A ';' would start a new field, so it is written as a comma. + TerminalNotify.Osc777 => $"\u001b]777;notify;{Field(request.Title)};{Field(request.Body)}\u001b\\", + _ => "\a", + }; + + private static string Base64(string text) => Convert.ToBase64String(Encoding.UTF8.GetBytes(Clean(text))); + + private static string Field(string text) => Clean(text).Replace(';', ','); + + private static string Clean(string text) + { + var clean = new string(text.Where(c => !char.IsControl(c)).ToArray()).Trim(); + return clean.Length > MaxText ? clean[..(MaxText - 1)] + "…" : clean; + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs new file mode 100644 index 00000000..781d7d96 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs @@ -0,0 +1,117 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Session; + +namespace SharpMUTerm.Tui; + +/// +/// Telling the desktop that something wants the player while they are in another window: a trigger marked +/// alert, or — on a world that opts in (F5 ▸ alert on) — a line that names the character or pages them +/// (). The host says it (); the client +/// decides whether to ask: +/// +/// F7 ▸ alert when away is on; +/// the player is not looking: the host says it is not in front, or — where the host cannot tell and does not +/// filter for itself (a terminal other than kitty) — nothing has been typed or clicked for ; +/// the rate limit has room (, one per ten seconds). +/// +/// +/// While a host that knows its focus is behind another window, the title carries a count of the lines that arrived +/// ((3) Corvid@Aetherfall — SharpMUTerm), the passive half of the same cue; it clears when the window comes +/// forward. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// With no focus to read, how long without input before the player counts as away. + internal static readonly TimeSpan AwayAfter = TimeSpan.FromSeconds(30); + + private AttentionThrottle? _attentionThrottle; + private bool? _hostFocused; + private int _unseenWhileAway; + private DateTimeOffset _lastAttendedAt; + + /// Every request handed to the host, for the tests. + internal List AttentionSent { get; } = []; + + /// How many lines arrived while the host was behind another window. + internal int UnseenWhileAway => _unseenWhileAway; + + /// Called by the constructor: listens to the host's focus. + private void WireAttention() + { + _lastAttendedAt = _time.GetUtcNow(); + if (Host.Attention is not { } attention) + { + return; + } + + _hostFocused = attention.Focused; + attention.FocusChanged += focused => OnUiThread(() => OnHostFocusChanged(focused)); + } + + private void OnHostFocusChanged(bool focused) + { + _hostFocused = focused; + if (focused) + { + _lastAttendedAt = _time.GetUtcNow(); + if (_unseenWhileAway > 0) + { + _unseenWhileAway = 0; + RepublishTitle(); + } + } + } + + /// The player did something: they are here. + private void NoteAttended() => _lastAttendedAt = _time.GetUtcNow(); + + /// A line landed in a pane; counted for the title while the host is behind another window. + private void NoteUnseenLine() + { + if (_hostFocused == false && _config.Text.AlertWhenAway) + { + _unseenWhileAway++; + RepublishTitle(); + } + } + + private void OnAttentionRequested(WorldSession session, AttentionEventArgs e) + { + if (!_config.Text.AlertWhenAway || Host.Attention is not { } host) + { + return; + } + + var focused = host.Focused ?? _hostFocused; + if (focused == true) + { + return; + } + + if (focused is null && !host.FiltersByFocus && _time.GetUtcNow() - _lastAttendedAt < AwayAfter) + { + return; + } + + _attentionThrottle ??= new AttentionThrottle(_time); + if (!_attentionThrottle.TryTake()) + { + return; + } + + var who = SharpMUTerm.Client.Chrome.WindowTitle.For(session.Character?.Name, session.World.Name); + var name = who.EndsWith(" — " + SharpMUTerm.Client.Chrome.WindowTitle.Product, StringComparison.Ordinal) + ? who[..^(SharpMUTerm.Client.Chrome.WindowTitle.Product.Length + 3)] + : who; + var why = e.Reason switch + { + AttentionReason.Page => "page", + AttentionReason.Name => "mentioned you", + _ => "alert", + }; + var request = new AttentionRequest($"{name} — {why}", e.Text); + AttentionSent.Add(request); + host.Request(request); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs new file mode 100644 index 00000000..cf6b037d --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs @@ -0,0 +1,176 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Tui; + +/// +/// Dialling a dropped connection again, for a world with F5 ▸ reconnect on. The rule — what counts as a drop, +/// the waits, when it gives up — is Core's (, one per session); this is how the client +/// says it: a line in the session's window and a notice for each try (its action stops them), and the status row's +/// state reading reconnecting in 12 s · ⌥R now while one waits, counted down each second. +/// +/// ⌥R while one waits dials at once (the wait is cancelled first); Disconnect or ⌃P ▸ Stop reconnecting cancels +/// it. A dial goes through , so the login is sent exactly as a connect by hand +/// would send it: auto-login if the character has it, nothing if not. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// Stops the focused connection's waiting reconnect. + internal const string StopReconnectCommand = SharpMUTerm.Client.Commands.BuiltInCommands.StopReconnectCommand; + + private readonly Dictionary _reconnects = []; + private ITimer? _reconnectTicker; + + /// The focused session's reconnect, for the tests and the catalog; null when the session has none. + internal AutoReconnect? ReconnectFor(WorldSession session) => _reconnects.GetValueOrDefault(session); + + private void StartReconnecting(WorldSession session) + { + if (_reconnects.ContainsKey(session)) + { + return; + } + + var auto = new AutoReconnect(session, _time, DialAgainAsync); + auto.Changed += (_, step) => OnUi(() => OnReconnectStep(session, auto, step)); + _reconnects[session] = auto; + } + + private void StopReconnecting(WorldSession session) + { + if (_reconnects.Remove(session, out var auto)) + { + auto.Dispose(); + } + } + + private async Task DialAgainAsync(WorldSession session) + { + await session.ConnectAsync().ConfigureAwait(false); + + // A freshly connected session has never been told a size (ReconnectAsync's reason). + OnUiThread(ReportPaneSizes); + } + + private void OnReconnectStep(WorldSession session, AutoReconnect auto, ReconnectStep step) + { + var title = SessionTitle(session); + switch (step) + { + case ReconnectStep.Scheduled when auto.SecondsLeft is { } seconds: + session.PrintSystem(ReconnectLine(seconds, auto.Try)); + Notice( + $"{title} dropped — reconnecting in {seconds} s · ⌥R now", + MessageSeverity.Info, + "⌥R", + new NoticeAction(StopReconnectCommand, "Stop")); + break; + + case ReconnectStep.GaveUp: + session.PrintSystem($"*** Stopped reconnecting after {AutoReconnect.Delays.Count} tries — ⌥R dials again."); + Notice($"{title} did not come back after {AutoReconnect.Delays.Count} tries — ⌥R dials again", MessageSeverity.Error, "⌥R"); + break; + } + + SyncReconnectTicker(); + UpdateStatus(); + } + + /// A one-second tick while any reconnect waits, so the status row counts down; stopped when none does. + private void SyncReconnectTicker() + { + var waiting = _reconnects.Values.Any(r => r.DueAt is not null); + if (waiting && _reconnectTicker is null) + { + _reconnectTicker = _time.CreateTimer( + _ => OnUiThread(OnReconnectTick), null, TimeSpan.FromSeconds(1), Timeout.InfiniteTimeSpan); + } + else if (!waiting && _reconnectTicker is not null) + { + _reconnectTicker.Dispose(); + _reconnectTicker = null; + } + } + + private void OnReconnectTick() + { + // Re-armed by hand each second rather than periodic, so a tick never queues behind a slow frame. + _reconnectTicker?.Change(TimeSpan.FromSeconds(1), Timeout.InfiniteTimeSpan); + SyncReconnectTicker(); + if (_active is { } session && ReconnectFor(session)?.DueAt is not null) + { + RefreshStatusBar(); + } + } + + /// + /// The status row's state while waits to dial again, or null. The seconds take a + /// two-digit field, so the row does not move as they count down. + /// + private string? ReconnectStatus(WorldSession? session) => + session is not null && ReconnectFor(session)?.SecondsLeft is { } seconds ? ReconnectState(seconds) + : session is null && _sessions.Sessions.Count == 0 && _demoReconnect is { } demo ? ReconnectState(demo) + : null; + + /// The status row's state for a reconnect away; one writer for the live row and the demo's. + internal static string ReconnectState(int seconds) => $"reconnecting in {seconds,2} s · ⌥R now"; + + /// The line a session's window gets when a try is scheduled; one writer for the live session and the demo's. + internal static string ReconnectLine(int seconds, int attempt) => + $"*** Reconnecting in {seconds} s (try {attempt} of {AutoReconnect.Delays.Count}) — ⌥R dials now, ⌃P ▸ Stop reconnecting."; + + /// The demo scene's waiting reconnect, in seconds: the `reconnect` view's, which has no live session to drop. + private int? _demoReconnect; + + /// + /// The `reconnect` view: Corvid's connection dropped and the second try waits twelve seconds. Written with the live + /// path's own writers (, ) because the demo has no session. + /// + private void ShowDemoReconnect() + { + _demoReconnect = 12; + AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connection lost: Connection reset by peer", WorldSession.SystemLineStyle), StampNow()); + AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connecting to aetherfall.mux:4201...", WorldSession.SystemLineStyle), StampNow()); + AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connection failed: Connection refused", WorldSession.SystemLineStyle), StampNow()); + AppendWindowLine(MainWindowId, StyledLine.FromText(ReconnectLine(12, 2), WorldSession.SystemLineStyle), StampNow()); + _statusIdentity = ("Corvid", "aetherfall.mux", 4201, "faulted"); + RefreshStatusBar(); + SettleScroll(); + } + + /// Cancels 's waiting reconnect; true when there was one. + private bool CancelReconnect(WorldSession session) + { + if (ReconnectFor(session) is not { IsActive: true } auto) + { + return false; + } + + auto.Cancel(); + return true; + } + + /// ⌃P ▸ Stop reconnecting, and the notice's action: the focused connection's. + private void StopReconnectCommandRun() + { + if (SendTarget() is { } session && CancelReconnect(session)) + { + session.PrintSystem("*** Stopped reconnecting."); + Notice($"stopped reconnecting {SessionTitle(session)} — ⌥R dials it", MessageSeverity.Info, "⌥R"); + return; + } + + // The notice's action can arrive after focus moved: any one waiting is the one the notice was about. + if (_reconnects.FirstOrDefault(r => r.Value.IsActive) is { Key: { } other } && CancelReconnect(other)) + { + other.PrintSystem("*** Stopped reconnecting."); + Notice($"stopped reconnecting {SessionTitle(other)}", MessageSeverity.Info); + return; + } + + RefuseCommand("nothing is waiting to reconnect"); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs index 1a54911c..205f0eda 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs @@ -75,7 +75,7 @@ private void SendToGroup() foreach (var session in reachable) { - _ = session.SendUserInputAsync(command); + _ = session.SendTypedAsync(command); // typed on the command line, so each world stacks it its own way } var kind = BarKind(bar); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs index 49fb5dbc..d72bf52c 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Title.cs @@ -18,9 +18,24 @@ internal sealed partial class SharpMUTermApp /// What was last handed to the host, for the tests; null before the first header. internal string? ShownTitle => _shownTitle; + // The title for what is in front, before the unread count (SharpMUTermApp.Attention.cs) is put in front of it. + private string? _baseTitle; + private void PublishTitle(HeaderModel header) { - var title = SharpMUTerm.Client.Chrome.WindowTitle.For(header); + _baseTitle = SharpMUTerm.Client.Chrome.WindowTitle.For(header); + RepublishTitle(); + } + + /// Hands the host the title as it stands: the header's, led by the unread count while away. + private void RepublishTitle() + { + if (_baseTitle is not { } baseTitle) + { + return; + } + + var title = SharpMUTerm.Client.Chrome.WindowTitle.WithUnread(baseTitle, _unseenWhileAway); if (title == _shownTitle) { return; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 6c896f39..ed7918ce 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -832,6 +832,7 @@ public SharpMUTermApp( // these two handlers is UI-thread state. OnUiThread runs inline when it already is one. _focus.Input += at => OnUiThread(() => NoteReaderInput(at)); _focus.Returned += away => OnUiThread(() => MarkWhereTheReaderLeft(away)); + WireAttention(); _header = Controls.Markup(HeaderMarkup()).StickyTop().Build(); _header.LinkClicked += (_, e) => OnChromeLinkClicked(e.Url); @@ -1158,6 +1159,12 @@ public string RenderSnapshot(string? view = null) LoadDemoScene(); _watching = true; + // A dropped connection waiting to dial again: the status row counts down in place of "faulted". + if (string.Equals(view, "reconnect", StringComparison.OrdinalIgnoreCase)) + { + ShowDemoReconnect(); + } + // The key tour row, as the first connect of a new configuration leaves it at the end of the window. if (string.Equals(view, "tour", StringComparison.OrdinalIgnoreCase)) { @@ -3170,6 +3177,7 @@ private void BindSession(WorldSession session, string? windowId = null) NoteSuggestionSignal(session, package); }); session.SpawnLine += (_, e) => OnUi(() => OnSpawnLine(session, e.Target, e.Line)); + session.AttentionRequested += (_, e) => OnUi(() => OnAttentionRequested(session, e)); session.MooEditReceived += (_, edit) => OnUi(() => ReceiveMooEdit(session, edit)); session.EditGrabbed += (_, text) => OnUi(() => ReceiveGrab(session, windowId, text)); session.McpStatusChanged += (_, _) => OnUi(() => @@ -3824,6 +3832,7 @@ private sealed class AwayMark /// private void NoteReaderInput(long at) { + NoteAttended(); foreach (var (windowId, buffer) in _lines) { _awayBoundary[windowId] = _awayPending.GetValueOrDefault(windowId); @@ -4986,6 +4995,7 @@ private void OnLine(WorldSession session, string windowId, StyledLine line) AppendSessionLine(windowId, line, stamp); RecordForRestore(session, windowId, WindowTitle(windowId), line, stamp); AnnounceLine(windowId, line.Text); + NoteUnseenLine(); if (!_workspace.IsCaughtUp(windowId)) { @@ -5046,6 +5056,7 @@ private void OnSpawnLine(WorldSession session, string target, StyledLine line) AppendSessionLine(window.Id, line, stamp); RecordForRestore(session, window.Id, window.Title, line, stamp); AnnounceLine(window.Id, line.Text); + NoteUnseenLine(); // A first-seen destination adds a tab to its pane, so rebuild; otherwise just refresh badges. if (existed) @@ -5150,7 +5161,7 @@ private void OnCommandEntered(InputBar bar, string command) // by the line quietly going to whichever world was active before you navigated. if (SendTarget() is { } target) { - _ = target.SendUserInputAsync(command); + _ = target.SendTypedAsync(command); return; } @@ -8319,6 +8330,7 @@ private CommandContext CommandState() NewlineChord: Host.Keys.Newline.Glyph, ScriptsOn: _scriptsRoot is not null, Walking: SendTarget() is { } walker && _recorders.TryGetValue(walker, out var map) && map.Walk.IsWalking, + Reconnecting: _reconnects.Values.Any(r => r.IsActive), Sound: CanPlaySound ? !_muted : null, Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId()), OutputSelected: HasOutputSelection, @@ -8838,6 +8850,9 @@ private bool RunBuiltInCommand(string id) case "world:disconnect": Disconnect(); break; + case StopReconnectCommand: + StopReconnectCommandRun(); + break; case "world:reload-scripts": ReloadScripts(); break; @@ -8905,6 +8920,7 @@ private void OnSessionAdded(object? sender, WorldSession session) { session.MsdpReports = StatusMeter.MsdpVariables(_config.Text.StatusMeters); WatchPresence(session); + StartReconnecting(session); StartMapping(session); StartSound(session); if (_scriptsRoot is null || _scripts.ContainsKey(session)) @@ -8920,6 +8936,7 @@ private void OnSessionAdded(object? sender, WorldSession session) private void OnSessionRemoved(object? sender, WorldSession session) { StopSound(session); + StopReconnecting(session); _sendGroup.Remove(session.SessionKey); if (_scripts.Remove(session, out var scripts)) { @@ -9422,6 +9439,8 @@ private void Reconnect() return; } + // A try waiting to dial is this key's job done sooner: the wait goes, and the dial is this one. + CancelReconnect(session); LastCommand = ReconnectAsync(session); } @@ -9477,6 +9496,14 @@ private void Disconnect() if (!session.IsConnected) { + // Not connected but waiting to dial again: Disconnect means "stay disconnected". + if (CancelReconnect(session)) + { + session.PrintSystem("*** Stopped reconnecting."); + Notice($"stopped reconnecting {SessionTitle(session)} — ⌥R dials it", MessageSeverity.Info, "⌥R"); + return; + } + RefuseCommand($"{SessionTitle(session)} is not connected"); return; } @@ -11918,6 +11945,7 @@ private bool RouteToInput(ConsoleKeyInfo key) /// private string? HandleWindowKey(KeyPressedEventArgs e) { + NoteAttended(); if (_moveMode) { HandleMoveKey(e); @@ -14004,6 +14032,8 @@ private void SyncStatusMeters() private string StatusBarMarkup(string character, string state) { + // A dropped connection waiting to dial again says when, in place of "faulted" (SharpMUTermApp.Reconnect.cs). + state = ReconnectStatus(_active) ?? state; var accent = ActiveWorld() is { } world ? AccentHex(world.Accent) : _ink.Accent; var left = $"[{accent}]●[/] [bold]{Escape(character)}[/] [dim]{Escape(state)}[/]"; // The vitals strip already draws these meters for this character, larger; the row says them only while it @@ -14211,6 +14241,13 @@ public async ValueTask DisposeAsync() _sizeFlushTimer?.Dispose(); // nothing left to tell a server we are shutting down to _noticeTimer?.Dispose(); // and no row left to put a notice back on _prefixTimer?.Dispose(); // and no window left to float a which-key panel over + _reconnectTicker?.Dispose(); // and no status row left to count down on + foreach (var reconnect in _reconnects.Values) + { + reconnect.Dispose(); // before the sessions, so no try dials a session being closed + } + + _reconnects.Clear(); _webImageCts?.Cancel(); _webImageCts?.Dispose(); _inlineImages.Dispose(); diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 03f453ef..a114d7e1 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -28,6 +28,6 @@ internal static class SnapshotViews "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", - "welcome", "welcome-connect", "tour", + "welcome", "welcome-connect", "tour", "reconnect", ]; } diff --git a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs index 527b0ecf..e9d98577 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs @@ -117,7 +117,7 @@ internal static class TriggersScreenRenderer ["name", "pattern", "route", "fg", "bg", "attributes", "rewrite", "respond", "script", "set", "match"]; /// The editor pane's check boxes by declared id, in the order the pane draws them. - internal static IReadOnlyList EditorFieldOrder { get; } = ["gag", "stop", "case"]; + internal static IReadOnlyList EditorFieldOrder { get; } = ["gag", "stop", "case", "alert"]; /// /// How many sample rows the live test always draws, matching or not, so the rows under it do not jump @@ -778,13 +778,15 @@ private static List BuildEditor( lines.Add(ActionRow("script", trigger.Actions.ScriptCallback, script)); lines.Add(string.Empty); - // The three rows below are real booleans on the trigger, and are the editor pane's navigable + // The four rows below are real booleans on the trigger, and are the editor pane's navigable // rows in this order. lines.Add(ScreenChrome.Cursor(Checkbox("gag line", trigger.Actions.Gag), cursor.IsOn(1, 0), width)); lines.Add(ScreenChrome.Cursor( Checkbox("stop processing", trigger.StopProcessing), cursor.IsOn(1, 1), width)); lines.Add(ScreenChrome.Cursor( Checkbox("case sensitive", trigger.CaseSensitive), cursor.IsOn(1, 2), width)); + lines.Add(ScreenChrome.Cursor( + Checkbox("alert me when away", trigger.Actions.Alert), cursor.IsOn(1, 3), width)); // Compacted before the dropdown is laid over it, not after: the overlay replaces rows by index, // so dropping a blank underneath it afterwards would slide the list off the field it belongs to. diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index e4e62262..b4879dda 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -104,6 +104,24 @@ internal static class WorldsScreenRenderer /// , as one of . internal const int JoinWrapsField = 16; + /// , as one of . + internal const int ReconnectField = 17; + + /// , as one of . + internal const int StackingField = 18; + + /// , as one of . + internal const int AlertOnField = 19; + + /// F5's words for . + internal static readonly IReadOnlyList ReconnectChoices = WorldFieldValues.ReconnectChoices; + + /// F5's words for . + internal static readonly IReadOnlyList SeparatorChoices = WorldFieldValues.SeparatorChoices; + + /// F5's words for . + internal static readonly IReadOnlyList AlertChoices = WorldFieldValues.AlertChoices; + /// F5's words for : off shows rows as the server sent them. internal static readonly IReadOnlyList JoinWrapChoices = WorldFieldValues.JoinWrapChoices; @@ -752,7 +770,8 @@ .. SecurityFieldOrder.Select(id => ScreenRow.Of(DeclaredFields.Toggle(DeclaredFi internal static readonly IReadOnlyList WorldFieldOrder = [ "name", "host", "port", "encoding", "keepalive", "gmcp-modules", "content", "emoji", "map-room", "map-exits", - "walk-fail", "sounds", "edit-grab", "gmcp-login", "discord", "layout", "join-wraps", + "walk-fail", "sounds", "edit-grab", "gmcp-login", "discord", "layout", "join-wraps", "reconnect", "stacking", + "alert-on", ]; /// The world's two security checkboxes, drawn in the WORLD block (), by declared id. @@ -1047,6 +1066,27 @@ world.GrabPrefix is { } grab cursor, selectedWorld, JoinWrapsField)), + WorldField("reconnect", Field( + world.AutoReconnect + ? $"[{Value}]{ReconnectChoices[1]} · 5 s to 60 s, five tries[/]" + : $"[{Label}]{ReconnectChoices[0]} · ⌥R dials again[/]", + cursor, + selectedWorld, + ReconnectField)), + WorldField("stacking", Field( + world.CommandSeparator is { } separator + ? $"[{Value}]{Escape(separator)} splits · #3 repeats[/]" + : $"[{Label}]{SeparatorChoices[0]} · lines go as typed[/]", + cursor, + selectedWorld, + StackingField)), + WorldField("alert on", Field( + world.AlertOnName + ? $"[{Value}]{AlertChoices[1]}[/]" + : $"[{Label}]{AlertChoices[0]} · alert triggers only[/]", + cursor, + selectedWorld, + AlertOnField)), string.Empty, $"[{accent}]├ CHARACTERS[/] [{Label}]a character is a connection[/]", }); diff --git a/tests/SharpMUTerm.Client.Tests/ListSettingsTests.cs b/tests/SharpMUTerm.Client.Tests/ListSettingsTests.cs index 4bcebef5..c287cdd9 100644 --- a/tests/SharpMUTerm.Client.Tests/ListSettingsTests.cs +++ b/tests/SharpMUTerm.Client.Tests/ListSettingsTests.cs @@ -53,7 +53,7 @@ public async Task TheListScreensAreDeclaredWithACollection() var triggers = BuiltInSettings.Triggers.Collection!.Fields.Select(f => f.Id).ToList(); await Assert.That(triggers).IsEquivalentTo( - new[] { "enabled", "name", "match", "pattern", "set", "route", "fg", "bg", "attributes", "gag", "rewrite", "respond", "script", "stop", "case" }); + new[] { "enabled", "name", "match", "pattern", "set", "route", "fg", "bg", "attributes", "gag", "alert", "rewrite", "respond", "script", "stop", "case" }); } [Test] diff --git a/tests/SharpMUTerm.Core.Tests/Automation/AttentionTests.cs b/tests/SharpMUTerm.Core.Tests/Automation/AttentionTests.cs new file mode 100644 index 00000000..a91b3f03 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Automation/AttentionTests.cs @@ -0,0 +1,96 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Tests.Session; + +namespace SharpMUTerm.Core.Tests.Automation; + +/// Which lines ask for the player's attention: an alert trigger, or a world's name-and-pages rule. +public class AttentionTests +{ + [Test] + [Arguments("Rivane pages: are you around?")] + [Arguments("Rivane pages you, \"hello\"")] + [Arguments("From afar, Rivane waves.")] + [Arguments("Rivane tells you 'meet me at the gate'")] + [Arguments("Rivane whispers: psst")] + [Arguments("Rivane whispers to you, \"psst\"")] + public async Task PagesTellsAndWhispersAreRecognised(string line) => + await Assert.That(AttentionMatcher.Classify(line, "Corvid")).IsEqualTo(AttentionReason.Page); + + [Test] + public async Task TheNameCountsAsAWholeWordAnywhereButTheStart() + { + await Assert.That(AttentionMatcher.Classify("Rivane says, \"corvid, look!\"", "Corvid")).IsEqualTo(AttentionReason.Name); + await Assert.That(AttentionMatcher.Classify("Rivane hands a map to Corvid.", "Corvid")).IsEqualTo(AttentionReason.Name); + + // The player's own pose, as a MUSH shows it back; a longer word containing the name; their own page. + await Assert.That(AttentionMatcher.Classify("Corvid waves.", "Corvid")).IsNull(); + await Assert.That(AttentionMatcher.Classify("The Corvidae nest is empty.", "Corvid")).IsNull(); + await Assert.That(AttentionMatcher.Classify("You paged Rivane with 'hi'.", "Corvid")).IsNull(); + await Assert.That(AttentionMatcher.Classify("A Z appears.", "Z")).IsNull(); + } + + [Test] + public async Task TheThrottleLetsOneAlertThroughPerInterval() + { + var time = new Mapping.ManualTimeProvider(); + var throttle = new AttentionThrottle(time); + + await Assert.That(throttle.TryTake()).IsTrue(); + await Assert.That(throttle.TryTake()).IsFalse(); + time.Advance(AttentionThrottle.Interval); + await Assert.That(throttle.TryTake()).IsTrue(); + } + + private static async Task<(FakeTelnetSession Telnet, List Raised)> Open(bool alertOnName, Trigger? trigger = null) + { + var telnet = new FakeTelnetSession(); + var world = new WorldDefinition { Name = "Aetherfall", Host = "h", Port = 1, AlertOnName = alertOnName }; + var set = new TriggerSet { Name = "s" }; + if (trigger is not null) + { + set.Triggers.Add(trigger); + } + + var session = new WorldSession(world, new CharacterDefinition { Name = "Corvid" }, [set], _ => telnet); + var raised = new List(); + session.AttentionRequested += (_, e) => raised.Add(e); + await session.ConnectAsync(); + return (telnet, raised); + } + + [Test] + public async Task AWorldThatOptsInIsToldOfAMentionAndAPage() + { + var (telnet, raised) = await Open(alertOnName: true); + + telnet.EmitLine("Rivane pages: hi"); + telnet.EmitLine("Rivane nods to Corvid."); + telnet.EmitLine("The fountain bubbles."); + + await Assert.That(raised.Select(e => e.Reason)).IsEquivalentTo([AttentionReason.Page, AttentionReason.Name]); + await Assert.That(raised[0].Text).IsEqualTo("Rivane pages: hi"); + } + + [Test] + public async Task AWorldThatDoesNotOptInIsToldOnlyOfAnAlertTrigger() + { + var trigger = new Trigger { Name = "attack", Pattern = "attacks you", Actions = { Alert = true, Gag = true } }; + var (telnet, raised) = await Open(alertOnName: false, trigger); + + telnet.EmitLine("Rivane pages: hi"); + telnet.EmitLine("A rat attacks you!"); + + await Assert.That(raised.Select(e => e.Reason)).IsEquivalentTo([AttentionReason.Trigger]); + } + + [Test] + public async Task TheAlertFlagIsCopiedWithTheRule() + { + var trigger = new Trigger { Name = "t", Pattern = "x", Actions = { Alert = true } }; + await Assert.That(trigger.Clone().Actions.Alert).IsTrue(); + await Assert.That(new WorldDefinition { AutoReconnect = true, CommandSeparator = ";", AlertOnName = true }.Clone() is + { AutoReconnect: true, CommandSeparator: ";", AlertOnName: true }).IsTrue(); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Input/TypedCommandsTests.cs b/tests/SharpMUTerm.Core.Tests/Input/TypedCommandsTests.cs new file mode 100644 index 00000000..df75c2e6 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Input/TypedCommandsTests.cs @@ -0,0 +1,118 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Input; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Tests.Session; + +namespace SharpMUTerm.Core.Tests.Input; + +/// Command stacking for typed lines: n;e;e, #3 kill rat, and nothing at all on a world that has none. +public class TypedCommandsTests +{ + [Test] + public async Task WithNoSeparatorALineGoesAsTypedHashAndAll() + { + await Assert.That(TypedCommands.Expand("say a;b", null).Commands).IsEquivalentTo(["say a;b"]); + await Assert.That(TypedCommands.Expand("#123 @set me=x", null).Commands).IsEquivalentTo(["#123 @set me=x"]); + } + + [Test] + public async Task ASeparatorSplitsTrimsAndDropsEmptyCommands() + { + var result = TypedCommands.Expand("n; e ;;e;", ";"); + + await Assert.That(result.Refusal).IsNull(); + await Assert.That(result.Commands).IsEquivalentTo(["n", "e", "e"]); + } + + [Test] + public async Task ABackslashMakesTheSeparatorLiteral() + { + await Assert.That(TypedCommands.Expand(@"say a\;b;look", ";").Commands).IsEquivalentTo(["say a;b", "look"]); + await Assert.That(TypedCommands.Expand(@"say c:\dir", ";").Commands).IsEquivalentTo([@"say c:\dir"]); + } + + [Test] + public async Task AMultiCharacterSeparatorLeavesASingleOneAlone() + { + await Assert.That(TypedCommands.Expand("say a;b;;look", ";;").Commands).IsEquivalentTo(["say a;b", "look"]); + } + + [Test] + public async Task HashNRepeatsACommandWithinEachPiece() + { + await Assert.That(TypedCommands.Expand("#3 kill rat;#2 e", ";").Commands) + .IsEquivalentTo(["kill rat", "kill rat", "kill rat", "e", "e"]); + await Assert.That(TypedCommands.Expand("#abc;#;#5", ";").Commands).IsEquivalentTo(["#abc", "#", "#5"]); + } + + [Test] + public async Task ARepeatOutOfBoundsSendsNothingAtAll() + { + foreach (var line in new[] { "n;#0 e", "n;#101 e", "#99999999999 e" }) + { + var result = TypedCommands.Expand(line, ";"); + await Assert.That(result.Commands).IsEmpty(); + await Assert.That(result.Refusal).IsNotNull(); + } + } + + [Test] + public async Task ALineComingToMoreThanTheCapSendsNothing() + { + var result = TypedCommands.Expand("#100 n;e", ";"); + + await Assert.That(result.Commands).IsEmpty(); + await Assert.That(result.Refusal!).Contains("100"); + await Assert.That(TypedCommands.Expand("#100 n", ";").Commands.Count).IsEqualTo(100); + } + + private static (WorldSession Session, FakeTelnetSession Telnet) Connected(string? separator, params Alias[] aliases) + { + var telnet = new FakeTelnetSession(); + var world = new WorldDefinition { Name = "T", Host = "h", Port = 1, LocalEcho = true, CommandSeparator = separator }; + var set = new TriggerSet { Name = "s", Aliases = [.. aliases] }; + var session = new WorldSession(world, triggerSets: [set], sessionFactory: _ => telnet); + return (session, telnet); + } + + [Test] + public async Task ATypedLineIsStackedThenEachCommandIsAliasExpandedAndEchoedOnce() + { + var (session, telnet) = Connected(";", new Alias { Name = "k", Pattern = "^k (.+)$", Substitution = "kill $1" }); + await session.ConnectAsync(); + var echoed = new List(); + session.LinePrinted += (_, line) => echoed.Add(line.Text); + + await session.SendTypedAsync("#2 k rat;n"); + + await Assert.That(telnet.SentLines).IsEquivalentTo(["kill rat", "kill rat", "n"]); + await Assert.That(echoed).IsEquivalentTo(["#2 k rat;n"]); + } + + [Test] + public async Task APostAndAScriptAreNeverStacked() + { + var (session, telnet) = Connected(";"); + await session.ConnectAsync(); + + await session.SendUserInputAsync("+bbpost 1=Title/one; two"); + await session.SendRawAsync("say x;y"); + + await Assert.That(telnet.SentLines).IsEquivalentTo(["+bbpost 1=Title/one; two", "say x;y"]); + } + + [Test] + public async Task ARefusedLineSaysWhyAndSendsNothing() + { + var (session, telnet) = Connected(";"); + await session.ConnectAsync(); + var printed = new List(); + session.LinePrinted += (_, line) => printed.Add(line.Text); + + await session.SendTypedAsync("#500 n"); + + await Assert.That(telnet.SentLines).IsEmpty(); + await Assert.That(printed[^1]).Contains("nothing was sent"); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Session/AutoReconnectTests.cs b/tests/SharpMUTerm.Core.Tests/Session/AutoReconnectTests.cs new file mode 100644 index 00000000..17e1b4c9 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Session/AutoReconnectTests.cs @@ -0,0 +1,162 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Tests.Mapping; + +namespace SharpMUTerm.Core.Tests.Session; + +/// Dialling a dropped connection again: what counts as a drop, the waits, and when it stops. +public class AutoReconnectTests +{ + private sealed class Rig + { + public required WorldSession Session { get; init; } + public required AutoReconnect Auto { get; init; } + public required ManualTimeProvider Time { get; init; } + public required List Wires { get; init; } + public List Steps { get; } = []; + public FakeTelnetSession Wire => Wires[^1]; + + /// When set, the next sockets refuse to connect. + public Exception? Refuse { get; set; } + } + + private static async Task Connected(bool autoReconnect = true) + { + var time = new ManualTimeProvider(); + var wires = new List(); + Rig? rig = null; + var world = new WorldDefinition { Name = "Aetherfall", Host = "h", Port = 1, AutoReconnect = autoReconnect }; + var session = new WorldSession(world, sessionFactory: _ => + { + var wire = new FakeTelnetSession { ConnectFault = rig?.Refuse }; + wires.Add(wire); + return wire; + }); + var auto = new AutoReconnect(session, time, s => s.ConnectAsync()); + rig = new Rig { Session = session, Auto = auto, Time = time, Wires = wires }; + auto.Changed += (_, step) => rig.Steps.Add(step); + await session.ConnectAsync(); + return rig; + } + + [Test] + public async Task ADropWaitsFiveSecondsThenDialsAndComesBack() + { + var rig = await Connected(); + + rig.Wire.Drop(new IOException("Connection reset by peer")); + + await Assert.That(rig.Session.LastClose).IsEqualTo(SessionClose.Failed); + await Assert.That(rig.Auto.SecondsLeft).IsEqualTo(5); + await Assert.That(rig.Auto.Try).IsEqualTo(1); + rig.Time.Advance(TimeSpan.FromSeconds(4)); + await Assert.That(rig.Wires.Count).IsEqualTo(1); + + rig.Time.Advance(TimeSpan.FromSeconds(1)); + + await Assert.That(rig.Wires.Count).IsEqualTo(2); + await Assert.That(rig.Session.State).IsEqualTo(ConnectionState.Connected); + await Assert.That(rig.Steps).IsEquivalentTo([ReconnectStep.Scheduled, ReconnectStep.Dialling, ReconnectStep.Connected]); + await Assert.That(rig.Auto.IsActive).IsFalse(); + } + + [Test] + public async Task AServerClosingOnItsOwnIsADropToo() + { + var rig = await Connected(); + + rig.Wire.Drop(); + + await Assert.That(rig.Session.LastClose).IsEqualTo(SessionClose.Server); + await Assert.That(rig.Auto.DueAt).IsNotNull(); + } + + [Test] + public async Task AServerClosingRightAfterACommandIsALogout() + { + var rig = await Connected(); + await rig.Session.SendCommandAsync("QUIT"); + rig.Time.Advance(TimeSpan.FromSeconds(2)); + + rig.Wire.Drop(); + + await Assert.That(rig.Auto.IsActive).IsFalse(); + await Assert.That(rig.Steps).IsEmpty(); + } + + [Test] + public async Task ThePlayersOwnDisconnectNeverReconnects() + { + var rig = await Connected(); + + await rig.Session.DisconnectAsync(); + rig.Time.Advance(TimeSpan.FromMinutes(5)); + + await Assert.That(rig.Session.LastClose).IsEqualTo(SessionClose.Player); + await Assert.That(rig.Wires.Count).IsEqualTo(1); + await Assert.That(rig.Steps).IsEmpty(); + } + + [Test] + public async Task AWorldThatDoesNotAskIsLeftAlone() + { + var rig = await Connected(autoReconnect: false); + + rig.Wire.Drop(new IOException("reset")); + rig.Time.Advance(TimeSpan.FromMinutes(5)); + + await Assert.That(rig.Wires.Count).IsEqualTo(1); + await Assert.That(rig.Steps).IsEmpty(); + } + + [Test] + public async Task FailedTriesBackOffAndRunOut() + { + var rig = await Connected(); + rig.Refuse = new IOException("Connection refused"); + rig.Wire.Drop(new IOException("reset")); + + var waits = new List(); + for (var i = 0; i < AutoReconnect.Delays.Count; i++) + { + waits.Add(rig.Auto.SecondsLeft ?? -1); + rig.Time.Advance(AutoReconnect.Delays[i]); + } + + await Assert.That(waits).IsEquivalentTo([5, 15, 30, 60, 60]); + await Assert.That(rig.Steps[^1]).IsEqualTo(ReconnectStep.GaveUp); + await Assert.That(rig.Auto.IsActive).IsFalse(); + rig.Time.Advance(TimeSpan.FromMinutes(10)); + await Assert.That(rig.Wires.Count).IsEqualTo(1 + AutoReconnect.Delays.Count); + } + + [Test] + public async Task AConnectionThatDropsAgainAtOnceKeepsCountingButOneThatLastedStartsOver() + { + var rig = await Connected(); + rig.Wire.Drop(new IOException("reset")); + rig.Time.Advance(TimeSpan.FromSeconds(5)); + rig.Wire.Drop(new IOException("reset")); // refused login, say: straight back out + + await Assert.That(rig.Auto.SecondsLeft).IsEqualTo(15); + + rig.Time.Advance(TimeSpan.FromSeconds(15)); + rig.Time.Advance(AutoReconnect.StableAfter); + rig.Wire.Drop(new IOException("reset")); + + await Assert.That(rig.Auto.SecondsLeft).IsEqualTo(5); + } + + [Test] + public async Task CancelStopsTheWaitingTry() + { + var rig = await Connected(); + rig.Wire.Drop(new IOException("reset")); + + rig.Auto.Cancel(); + rig.Time.Advance(TimeSpan.FromMinutes(1)); + + await Assert.That(rig.Wires.Count).IsEqualTo(1); + await Assert.That(rig.Steps[^1]).IsEqualTo(ReconnectStep.Cancelled); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Session/FakeTelnetSession.cs b/tests/SharpMUTerm.Core.Tests/Session/FakeTelnetSession.cs index 1740d4cb..4d129be0 100644 --- a/tests/SharpMUTerm.Core.Tests/Session/FakeTelnetSession.cs +++ b/tests/SharpMUTerm.Core.Tests/Session/FakeTelnetSession.cs @@ -31,12 +31,27 @@ internal sealed class FakeTelnetSession : ITelnetSession public List<(string Package, string Json)> SentGmcp { get; } = new(); + /// When set, the next connect fails with it. + public Exception? ConnectFault { get; set; } + public Task ConnectAsync(CancellationToken cancellationToken = default) { + if (ConnectFault is { } fault) + { + return Task.FromException(fault); + } + IsConnected = true; return Task.CompletedTask; } + /// The server goes away: cleanly (an orderly close) with no error, or failed with one. + public void Drop(Exception? error = null) + { + IsConnected = false; + Disconnected?.Invoke(this, new SessionDisconnectedEventArgs(error)); + } + public ValueTask SendLineAsync(string text, CancellationToken cancellationToken = default) { SentLines.Add(text); diff --git a/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs b/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs new file mode 100644 index 00000000..5c0418ed --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs @@ -0,0 +1,348 @@ +using System.Runtime.CompilerServices; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Wave 12's three: a dropped connection dialled again with a countdown on the status row, the desktop told when a +/// line wants the player while they are elsewhere, and typed command stacking reaching the wire per piece. +/// +[NotInParallel] +public class AlertsAndReconnectTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class FakeAttention : IAttention + { + public bool FiltersByFocus { get; init; } + + public bool? Focused { get; set; } + + public event Action? FocusChanged; + + public List Requests { get; } = []; + + public void Request(AttentionRequest request) => Requests.Add(request); + + public void Focus(bool focused) + { + Focused = focused; + FocusChanged?.Invoke(focused); + } + } + + private sealed record Rig( + SharpMUTermApp App, + WorldSession Session, + ManualTimeProvider Time, + List Wires, + FakeAttention Attention, + StrongBox Refuse) + { + public RecordingTelnetSession Wire => Wires[^1]; + } + + private static async Task Open( + bool autoReconnect = true, + string? separator = null, + bool alertOnName = false, + Trigger? trigger = null, + bool? focused = false) + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + var world = new WorldDefinition + { + Name = "Aetherfall", + Host = "aetherfall.example", + Port = 4201, + AutoReconnect = autoReconnect, + CommandSeparator = separator, + AlertOnName = alertOnName, + }; + world.Characters.Add(new CharacterDefinition { Name = "Corvid", Logging = new() }); + config.Worlds.Add(world); + if (trigger is not null) + { + var set = new TriggerSet { Name = "alerts" }; + set.Triggers.Add(trigger); + config.TriggerSets.Add(set); + world.Characters[0].TriggerSets.Add(set.Name); + } + + var time = new ManualTimeProvider(); + var attention = new FakeAttention { Focused = focused }; + var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, null) with + { + Attention = attention, + }; + var app = new SharpMUTermApp(config, host, time); + var wires = new List(); + var refuse = new StrongBox(); + app.TelnetFactory = _ => + { + var wire = new RecordingTelnetSession { ConnectFault = refuse.Value }; + wires.Add(wire); + return wire; + }; + app.DispatchCommand(CommandIds.Character("Aetherfall.Corvid")); + var session = app.FindSession("Aetherfall.Corvid")!; + await session.ConnectAsync(); + app.RenderNextFrame(); + return new Rig(app, session, time, wires, attention, refuse); + } + + private static string Plain(string markup) => MarkupText.Plain(markup); + + [Test] + public async Task ADropCountsDownOnTheStatusRowAndDialsAgain() + { + var rig = await Open(); + await using var _ = rig.App; + + // The first wait is said by the notice, which carries Stop and covers the row for longer than the wait. + rig.Refuse.Value = new IOException("Connection refused"); + rig.Wire.Drop(new IOException("Connection reset by peer")); + await Assert.That(rig.App.LastNotice).Contains("reconnecting in 5 s"); + await Assert.That(rig.App.BuildCatalog().Select(i => i.Title)).Contains("Stop reconnecting"); + + // That try is refused; the second waits fifteen seconds, and once its notice has gone the row counts it down. + rig.Time.Advance(TimeSpan.FromSeconds(5)); + await Assert.That(rig.Wires.Count).IsEqualTo(2); + rig.Time.Advance(SharpMUTermApp.NoticeDuration); + rig.App.RenderNextFrame(); + await Assert.That(Plain(rig.App.StatusMarkup)).Contains(SharpMUTermApp.ReconnectState(9)); + rig.Time.Advance(TimeSpan.FromSeconds(1)); + rig.App.RenderNextFrame(); + await Assert.That(Plain(rig.App.StatusMarkup)).Contains(SharpMUTermApp.ReconnectState(8)); + + rig.Refuse.Value = null; + rig.Time.Advance(TimeSpan.FromSeconds(8)); + rig.App.RenderNextFrame(); + + await Assert.That(rig.Wires.Count).IsEqualTo(3); + await Assert.That(rig.Session.State).IsEqualTo(ConnectionState.Connected); + await Assert.That(Plain(rig.App.StatusMarkup)).DoesNotContain("reconnecting"); + await Assert.That(rig.App.BuildCatalog().Select(i => i.Title)).DoesNotContain("Stop reconnecting"); + } + + [Test] + public async Task StopReconnectingCancelsTheWait() + { + var rig = await Open(); + await using var _ = rig.App; + rig.Wire.Drop(new IOException("reset")); + + rig.App.DispatchCommand(BuiltInCommands.StopReconnectCommand); + await Assert.That(rig.App.LastNotice).Contains("stopped reconnecting"); + rig.Time.Advance(TimeSpan.FromMinutes(2)); + rig.App.RenderNextFrame(); + + await Assert.That(rig.Wires.Count).IsEqualTo(1); + await Assert.That(Plain(rig.App.StatusMarkup)).DoesNotContain("reconnecting"); + } + + [Test] + public async Task ReconnectWhileWaitingDialsAtOnceAndLeavesNoSecondTry() + { + var rig = await Open(); + await using var _ = rig.App; + rig.Wire.Drop(new IOException("reset")); + + rig.App.DispatchCommand("world:reconnect"); + await Task.Delay(50); + rig.Time.Advance(TimeSpan.FromMinutes(2)); + + await Assert.That(rig.Wires.Count).IsEqualTo(2); + await Assert.That(rig.Session.State).IsEqualTo(ConnectionState.Connected); + } + + [Test] + public async Task DisconnectWhileWaitingCancelsIt() + { + var rig = await Open(); + await using var _ = rig.App; + rig.Wire.Drop(new IOException("reset")); + + rig.App.DispatchCommand("world:disconnect"); + rig.Time.Advance(TimeSpan.FromMinutes(2)); + + await Assert.That(rig.Wires.Count).IsEqualTo(1); + } + + [Test] + public async Task ThePlayersOwnDisconnectIsNeverDialledAgain() + { + var rig = await Open(); + await using var _ = rig.App; + + rig.App.DispatchCommand("world:disconnect"); + rig.Time.Advance(TimeSpan.FromMinutes(2)); + + await Assert.That(rig.Wires.Count).IsEqualTo(1); + await Assert.That(rig.Session.LastClose).IsEqualTo(SessionClose.Player); + } + + [Test] + public async Task AWorldWithReconnectOffIsLeftDown() + { + var rig = await Open(autoReconnect: false); + await using var _ = rig.App; + + rig.Wire.Drop(new IOException("reset")); + rig.Time.Advance(TimeSpan.FromMinutes(2)); + + await Assert.That(rig.Wires.Count).IsEqualTo(1); + await Assert.That(rig.App.BuildCatalog().Select(i => i.Title)).DoesNotContain("Stop reconnecting"); + } + + [Test] + public async Task ThePageReachesTheHostOnlyWhileItIsBehindAnotherWindow() + { + var rig = await Open(alertOnName: true, focused: true); + await using var _ = rig.App; + + rig.Wire.Receive("Rivane pages: are you there?\r\n"); + await Assert.That(rig.Attention.Requests).IsEmpty(); + + rig.Attention.Focus(false); + rig.Wire.Receive("Rivane pages: hello?\r\n"); + + await Assert.That(rig.Attention.Requests.Count).IsEqualTo(1); + await Assert.That(rig.Attention.Requests[0].Title).IsEqualTo("Corvid@Aetherfall — page"); + await Assert.That(rig.Attention.Requests[0].Body).IsEqualTo("Rivane pages: hello?"); + + // One per interval: the next page inside it is not said again. + rig.Wire.Receive("Rivane pages: hello??\r\n"); + await Assert.That(rig.Attention.Requests.Count).IsEqualTo(1); + rig.Time.Advance(AttentionThrottle.Interval); + rig.Wire.Receive("Rivane pages: hello???\r\n"); + await Assert.That(rig.Attention.Requests.Count).IsEqualTo(2); + } + + [Test] + public async Task TheTitleCountsWhatArrivedWhileAwayAndClearsOnReturn() + { + var rig = await Open(focused: true); + await using var _ = rig.App; + rig.App.RenderNextFrame(); + var resting = rig.App.ShownTitle!; + + rig.Attention.Focus(false); + rig.Wire.Receive("The fountain bubbles.\r\nA bird lands.\r\n"); + + await Assert.That(rig.App.ShownTitle).IsEqualTo("(2) " + resting); + + rig.Attention.Focus(true); + await Assert.That(rig.App.ShownTitle).IsEqualTo(resting); + } + + [Test] + public async Task AnAlertTriggerAsksAndF7CanTurnItOff() + { + var trigger = new Trigger { Name = "attack", Pattern = "attacks you", Actions = { Alert = true } }; + var rig = await Open(trigger: trigger); + await using var _ = rig.App; + + rig.Wire.Receive("A rat attacks you!\r\n"); + await Assert.That(rig.Attention.Requests.Select(r => r.Title)).IsEquivalentTo(["Corvid@Aetherfall — alert"]); + + rig.App.Configuration.Text.AlertWhenAway = false; + rig.Time.Advance(AttentionThrottle.Interval); + rig.Wire.Receive("A rat attacks you again!\r\n"); + await Assert.That(rig.Attention.Requests.Count).IsEqualTo(1); + } + + [Test] + public async Task AHostThatCannotTellItsFocusWaitsForTheReaderToBeIdle() + { + var trigger = new Trigger { Name = "attack", Pattern = "attacks you", Actions = { Alert = true } }; + var rig = await Open(trigger: trigger, focused: null); + await using var _ = rig.App; + + rig.App.SimulateKey(new ConsoleKeyInfo('x', ConsoleKey.X, false, false, false)); + rig.Wire.Receive("A rat attacks you!\r\n"); + await Assert.That(rig.Attention.Requests).IsEmpty(); + + rig.Time.Advance(SharpMUTermApp.AwayAfter); + rig.Wire.Receive("A rat attacks you!\r\n"); + await Assert.That(rig.Attention.Requests.Count).IsEqualTo(1); + } + + [Test] + public async Task TheCommandLineStacksOnAWorldWithASeparator() + { + var rig = await Open(separator: ";"); + await using var _ = rig.App; + + foreach (var c in "#2 n;look") + { + rig.App.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + rig.App.SimulateKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + await Task.Delay(50); + + await Assert.That(rig.Wire.Lines).IsEquivalentTo(["n", "n", "look"]); + } + + [Test] + public async Task WithNoSeparatorTheCommandLineSendsTheLineAsTyped() + { + var rig = await Open(separator: null); + await using var _ = rig.App; + + foreach (var c in "say a;b") + { + rig.App.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + rig.App.SimulateKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + await Task.Delay(50); + + await Assert.That(rig.Wire.Lines).IsEquivalentTo(["say a;b"]); + } + + [Test] + public void TheTerminalEscapesCannotBeEndedEarlyByAGamesText() + { + var request = new AttentionRequest("Corvid@Aetherfall — page", "x\u001b\\;\u0007y"); + + var kitty = TerminalAttention.Sequence(TerminalNotify.Osc99, request, 1); + var foot = TerminalAttention.Sequence(TerminalNotify.Osc777, request, 1); + + // The only ESC and BEL bytes are the escapes' own. + if (kitty.Count(c => c == '\u001b') != 4 || kitty.Contains('\u0007') || !kitty.Contains("o=unfocused")) + { + throw new InvalidOperationException(kitty); + } + + if (foot.Count(c => c == '\u001b') != 2 || foot.Contains('\u0007') || foot.Split(';').Length != 4) + { + throw new InvalidOperationException(foot); + } + + if (TerminalAttention.Sequence(TerminalNotify.Bell, request, 1) != "\a") + { + throw new InvalidOperationException("bell"); + } + } + + [Test] + public async Task TheDemoViewWritesWithTheLiveWriters() + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + await using var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32)); + app.RenderSnapshot("reconnect"); + + await Assert.That(Plain(app.StatusMarkup)).Contains(SharpMUTermApp.ReconnectState(12)); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/RecordingTelnetSession.cs b/tests/SharpMUTerm.Tui.Tests/RecordingTelnetSession.cs index d7c1b875..88beceae 100644 --- a/tests/SharpMUTerm.Tui.Tests/RecordingTelnetSession.cs +++ b/tests/SharpMUTerm.Tui.Tests/RecordingTelnetSession.cs @@ -24,7 +24,7 @@ internal sealed class RecordingTelnetSession : ITelnetSession /// connection is the case the old fire-and-forget Reconnect swallowed, so the tests need a /// transport that can refuse one. /// - public Exception? ConnectFault { get; init; } + public Exception? ConnectFault { get; set; } /// How many times a connection was asked for, refused ones included. public int ConnectAttempts { get; private set; } @@ -186,6 +186,13 @@ public ValueTask SetWindowSizeAsync(int width, int height) return ValueTask.CompletedTask; } + /// The server goes away on its own: an orderly close with no error, or failed with one. + public void Drop(Exception? error = null) + { + IsConnected = false; + Disconnected?.Invoke(this, new SessionDisconnectedEventArgs(error)); + } + public Task DisconnectAsync() { if (IsConnected) diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs index c7e33c65..7579773e 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs @@ -65,7 +65,8 @@ public async Task Triggers_HasARuleListAndTheSelectedRulesToggles() // Three checkbox rows: gag and stop-processing, plus case sensitivity — which F3 has always // offered on an alias and F2 arbitrarily did not. It is appended rather than inserted, so the // two rows below still mean what every other assertion here says they mean. - await Assert.That(model.Sizes[1]).IsEqualTo(3); + // A fourth, "alert me when away", is appended the same way. + await Assert.That(model.Sizes[1]).IsEqualTo(4); model.ToggleAt(0, 1)!.Value.Flip(); await Assert.That(sets[0].Triggers[1].Enabled).IsTrue(); @@ -372,9 +373,10 @@ public async Task Options_NavigableRowsSkipSectionHeadersAndSpacers() // meters as a typed line, and 23/13 before SCROLLBACK. // The THEME group on top adds thirteen rows and three stops: its heading and spacer, a row per built-in // theme, and the preview's caption and seven rows, which are drawn and never a stop. - await Assert.That(screen.Rows.Count).IsEqualTo(39); + // ALERTS adds three rows and one stop: its heading, its spacer and `alert when away`. + await Assert.That(screen.Rows.Count).IsEqualTo(42); await Assert.That(model.PaneCount).IsEqualTo(1); - await Assert.That(model.Sizes[0]).IsEqualTo(17); + await Assert.That(model.Sizes[0]).IsEqualTo(18); } /// diff --git a/tests/SharpMUTerm.Tui.Tests/TriggersScreenEditingTests.cs b/tests/SharpMUTerm.Tui.Tests/TriggersScreenEditingTests.cs index 72e81c29..81fb5168 100644 --- a/tests/SharpMUTerm.Tui.Tests/TriggersScreenEditingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TriggersScreenEditingTests.cs @@ -76,8 +76,8 @@ await Assert.That(model.FieldAt(0, 0, TriggersScreenRenderer.MatchTypeField)!.Va await Assert.That(model.FieldAt(0, 0, TriggersScreenRenderer.ScriptField)!.Value.Get()).IsEqualTo(string.Empty); // The editor pane holds only checkbox rows — every value it draws is a field on the rule, not a - // cursor stop of its own. It gained the third checkbox (case sensitivity) and nothing else. - await Assert.That(model.Sizes[1]).IsEqualTo(3); + // cursor stop of its own. It gained the third checkbox (case sensitivity) and the fourth (alert). + await Assert.That(model.Sizes[1]).IsEqualTo(4); } [Test] From 95eeaedfc6cb8ab796cb8a7efbce9aaa124435c8 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 11:56:37 +0000 Subject: [PATCH 043/113] test: notice source assertion follows held notice ink --- tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs index 5ae74ad7..92d6d839 100644 --- a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs @@ -98,7 +98,7 @@ public async Task ASourceIsALabelNotAChord() await Assert.That(model!.Source).IsEqualTo("Sound"); await Assert.That(model.Key).IsNull().Because("a source is not a key"); - await Assert.That(app.LastNotice).EndsWith("]Sound:[/] [dim]on.[/]"); + await Assert.That(app.LastNotice).Matches(@"\]Sound:\[/\] \[#[0-9a-f]{6}\]on\.\[/\]$"); var words = Directory.GetFiles(SourceRoot(), "*.cs", SearchOption.AllDirectories) .SelectMany(f => File.ReadAllLines(f).Select(l => (f, l))) From 6a4c83940ce9f1096c1a7102a6b5cb7c0b357433 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 12:02:35 +0000 Subject: [PATCH 044/113] Alert titles use the shared name spelling --- src/SharpMUTerm.Client/Chrome/WindowTitle.cs | 2 +- src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs | 2 +- src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs | 2 +- tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SharpMUTerm.Client/Chrome/WindowTitle.cs b/src/SharpMUTerm.Client/Chrome/WindowTitle.cs index 27bb06d0..6f630131 100644 --- a/src/SharpMUTerm.Client/Chrome/WindowTitle.cs +++ b/src/SharpMUTerm.Client/Chrome/WindowTitle.cs @@ -45,7 +45,7 @@ public static string For(string? character, string? world) /// /// led by how many lines arrived while the window was behind another — - /// (3) Corvid@Aetherfall — SharpMUTerm — or the title alone for none. Capped at 99+, so a busy + /// (3) Corvid · Aetherfall — SharpMUTerm — or the title alone for none. Capped at 99+, so a busy /// channel does not retitle the window with every line. /// public static string WithUnread(string title, int unread) => diff --git a/src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs b/src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs index cc77f072..8ac33a2a 100644 --- a/src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs +++ b/src/SharpMUTerm.Tui/Hosting/TerminalAttention.cs @@ -3,7 +3,7 @@ namespace SharpMUTerm.Tui; -/// An alert for the desktop: a short title (Corvid@Aetherfall — page) and the line that raised it. +/// An alert for the desktop: a short title (Corvid · Aetherfall — page) and the line that raised it. internal sealed record AttentionRequest(string Title, string Body); /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs index 781d7d96..03b4619e 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs @@ -16,7 +16,7 @@ namespace SharpMUTerm.Tui; /// /// /// While a host that knows its focus is behind another window, the title carries a count of the lines that arrived -/// ((3) Corvid@Aetherfall — SharpMUTerm), the passive half of the same cue; it clears when the window comes +/// ((3) Corvid · Aetherfall — SharpMUTerm), the passive half of the same cue; it clears when the window comes /// forward. /// /// diff --git a/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs b/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs index 5c0418ed..24cfb4f2 100644 --- a/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs @@ -216,7 +216,7 @@ public async Task ThePageReachesTheHostOnlyWhileItIsBehindAnotherWindow() rig.Wire.Receive("Rivane pages: hello?\r\n"); await Assert.That(rig.Attention.Requests.Count).IsEqualTo(1); - await Assert.That(rig.Attention.Requests[0].Title).IsEqualTo("Corvid@Aetherfall — page"); + await Assert.That(rig.Attention.Requests[0].Title).IsEqualTo("Corvid · Aetherfall — page"); await Assert.That(rig.Attention.Requests[0].Body).IsEqualTo("Rivane pages: hello?"); // One per interval: the next page inside it is not said again. @@ -252,7 +252,7 @@ public async Task AnAlertTriggerAsksAndF7CanTurnItOff() await using var _ = rig.App; rig.Wire.Receive("A rat attacks you!\r\n"); - await Assert.That(rig.Attention.Requests.Select(r => r.Title)).IsEquivalentTo(["Corvid@Aetherfall — alert"]); + await Assert.That(rig.Attention.Requests.Select(r => r.Title)).IsEquivalentTo(["Corvid · Aetherfall — alert"]); rig.App.Configuration.Text.AlertWhenAway = false; rig.Time.Advance(AttentionThrottle.Interval); @@ -313,7 +313,7 @@ public async Task WithNoSeparatorTheCommandLineSendsTheLineAsTyped() [Test] public void TheTerminalEscapesCannotBeEndedEarlyByAGamesText() { - var request = new AttentionRequest("Corvid@Aetherfall — page", "x\u001b\\;\u0007y"); + var request = new AttentionRequest("Corvid · Aetherfall — page", "x\u001b\\;\u0007y"); var kitty = TerminalAttention.Sequence(TerminalNotify.Osc99, request, 1); var foot = TerminalAttention.Sequence(TerminalNotify.Osc777, request, 1); From 967e0f5ce201fa997125e36a24c5387260477f64 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 12:05:33 +0000 Subject: [PATCH 045/113] In-app help, a spelling dictionary on request, and a join-wraps suggestion - /help and Ctrl+P > Help: one Client model (HelpModel) drawn as a cell ListOverlay and as a native modal in the window. It lists how-to pages, the slash commands from SlashCommands.All (the table --help now prints too), every registry key for this host and the host's own chords. It is searchable with one View in both hosts. Enter places a slash command unsent, runs a key's command, or opens a page. Declared in SurfaceCatalog with parity probes. - F1's Alt+W with no dictionary, and Ctrl+P > Get a spelling dictionary, offer LibreOffice's en_US/en_GB. Nothing is fetched until the player says yes. It is https only, capped while streaming and checked against a pinned SHA-256, then written into dictionaries/ beside config.json. The dictionaries root is null by default, so tests and snapshots fetch nothing. Native and cell offers share DictionaryOfferModel. - While a pane is narrower than a world's wrap column, Ctrl+P suggests "Join server wraps for " and F5 marks join wraps as recommended. It is still off by default. - New views: help, help-topic, dictionary-offer, join-wraps, join-wraps-f5. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 8 + CLAUDE.md | 29 +- src/SharpMUTerm.Avalonia/ComposerView.cs | 4 + .../DictionaryOfferView.cs | 121 ++++++ src/SharpMUTerm.Avalonia/HelpView.cs | 348 +++++++++++++++ src/SharpMUTerm.Avalonia/ModalOverlay.cs | 4 +- .../Commands/BuiltInCommands.cs | 32 +- .../Composer/ComposerModel.cs | 9 +- .../Composer/ComposerSession.cs | 15 + src/SharpMUTerm.Client/Help/HelpTopics.cs | 96 +++++ src/SharpMUTerm.Client/Help/SlashCommands.cs | 36 ++ .../Modals/DictionaryOfferModel.cs | 66 +++ src/SharpMUTerm.Client/Modals/HelpModel.cs | 225 ++++++++++ .../Palette/CommandPaletteModel.cs | 8 + .../Surfaces/SurfaceCatalog.cs | 30 +- .../Commands/CommandCatalog.cs | 17 +- .../Text/DictionaryDownload.cs | 205 +++++++++ src/SharpMUTerm.Tui/ClientUsage.cs | 8 + src/SharpMUTerm.Tui/ComposeOverlay.cs | 18 + src/SharpMUTerm.Tui/DictionaryOffer.cs | 32 ++ src/SharpMUTerm.Tui/HelpSurface.cs | 287 +++++++++++++ src/SharpMUTerm.Tui/ListOverlay.cs | 9 +- .../Pointer/SharpMUTermApp.Surfaces.cs | 2 + src/SharpMUTerm.Tui/Program.cs | 8 +- src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs | 402 ++++++++++++++++++ .../SharpMUTermApp.JoinWraps.cs | 42 ++ .../SharpMUTermApp.NativeComposer.cs | 1 + .../SharpMUTermApp.NativeModals.cs | 2 + src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs | 1 + src/SharpMUTerm.Tui/SharpMUTermApp.cs | 77 +++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 7 +- src/SharpMUTerm.Tui/WorldsScreenView.cs | 5 +- .../SurfaceParityTests.cs | 54 +++ .../HelpModelTests.cs | 125 ++++++ .../DictionaryDownloadTests.cs | 100 +++++ .../ComposeSpellingTests.cs | 7 +- tests/SharpMUTerm.Tui.Tests/HelpTests.cs | 211 +++++++++ .../NativeComposerRoutingTests.cs | 2 +- 39 files changed, 2626 insertions(+), 29 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/DictionaryOfferView.cs create mode 100644 src/SharpMUTerm.Avalonia/HelpView.cs create mode 100644 src/SharpMUTerm.Client/Help/HelpTopics.cs create mode 100644 src/SharpMUTerm.Client/Help/SlashCommands.cs create mode 100644 src/SharpMUTerm.Client/Modals/DictionaryOfferModel.cs create mode 100644 src/SharpMUTerm.Client/Modals/HelpModel.cs create mode 100644 src/SharpMUTerm.Core/Text/DictionaryDownload.cs create mode 100644 src/SharpMUTerm.Tui/DictionaryOffer.cs create mode 100644 src/SharpMUTerm.Tui/HelpSurface.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs create mode 100644 tests/SharpMUTerm.Client.Tests/HelpModelTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/DictionaryDownloadTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/HelpTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 733c386b..67a1da86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] be sent (both in the terminal and in the desktop window). - When a pane is narrower than the line width a game wraps at, the client says so once and offers to turn on "join wraps" for that world. +- Help is built in: `/help` (or Ctrl+P ▸ Help) lists the slash commands, every key this client answers to, and short + how-to pages on getting started, reading output, layouts, triggers and the composer. Type to search; Enter on a + slash command puts it on the command line without sending it. +- No spelling dictionary? Alt+W in the composer (or Ctrl+P ▸ Get a spelling dictionary) offers to download an English + one into your settings folder. Nothing is fetched until you say yes, and the file is checked before it is saved — + so spelling now works on Windows too. +- While a pane is narrower than the width a game wraps at, Ctrl+P suggests "Join server wraps for" that world and F5 + marks its "join wraps" setting as recommended. It stays off until you turn it on. - Desktop window: the map, vitals, who is here and the quick bar can be popped out into windows of their own — from the button in the panel's corner, the pane's right-click menu, or Ctrl+P ▸ Pop out. The output takes the room back, diff --git a/CLAUDE.md b/CLAUDE.md index e83bc392..3810220a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -603,6 +603,11 @@ fallbacks) for inline images/maps. shown out of order and only the last full row of a burst is ever late (a paragraph's last row is short and never held). The read loop and that timer share `_ingestGate`; nothing on the UI thread or in a script takes it, so it cannot close a cycle with the script host's lock. Rebuilt per connection, like the parser. + - **Suggested, never switched on** (`SharpMUTermApp.JoinWraps.cs`). While a pane reported to a server is more than + two columns narrower than its wrap column (`NoteRaggedWraps`, on each NAWS report; `RaggedWrap`, Core), ⌃P lists + *Join server wraps for * under SUGGESTED (`CommandContext.RaggedWraps`) and F5's `join wraps` row reads + `off · recommended · wraps at 78, pane is 60` (the `join-wraps`/`join-wraps-f5` views); the once-per-world notice + stays. Joining, or the pane catching up, clears it. - **Every server's MSSP report is kept, and the INFO screen reads it** (`MsspCache`, Core; `mssp.json` beside `config.json`, keyed by `host:port`; F5 ▸ `i`). Fourth of the `save:`/`logRoot:`/`restore:` family with **one deliberate difference**: the constructor parameter is null by default like the @@ -768,6 +773,14 @@ fallbacks) for inline images/maps. `no dictionary`. A MOO edit is not checked (its buffer is code as often as prose). `%`-codes, a word before `(`, and any word with a digit or an inner capital are skipped. ⌥W appends to `dictionaries/user-words.txt`. + - **With no dictionary, ⌥W offers to download one** (`DictionaryDownload`, Core; `DictionaryOfferModel`, Client; + `DictionaryOffer`/`SharpMUTermApp.Help.cs`, Tui; `DictionaryOfferView`, Avalonia; ⌃P *Get a spelling dictionary…*; + the `dictionary-offer` view). F1 closes (keeping the draft), the offer says what is fetched from where and saved + where, and F1 comes back when it closes. **Only on ⏎**, https only, each file capped at 8 MB while streaming, and + both checked against a **pinned SHA-256** before anything is written (LibreOffice's `en_US`/`en_GB` at tag + `libreoffice-24.8.4.2`; `For(locale)` picks GB for en_GB/IE/AU/NZ/ZA/IN). Written as `.new` and renamed, `.aff` + first. `dictionaries:` is a constructor root of the `save:`/`logRoot:` family, null by default, so a test and a + snapshot fetch nothing and the offer says nothing can be saved. - **An MXP `` is drawn in the output pane as rows of markup under the line that named it** (`MxpParser.HandleImage` + `MxpImageSource`, Core; `InlineImageHost`/`InlineImageRows`/`InlineImageLayout`, Tui; the `mxp-image` view). The parser emits a `[image: name]` span whose `SpanInteraction.Image` carries @@ -1340,7 +1353,7 @@ one `SharpMUTermApp`; a host is only the place it runs. What differs between hos (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it -draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M and the welcome itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), whether it can pop a panel out into a window of its own (`IFloatingPanels`, null for none), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M, the welcome, help and the dictionary offer itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), whether it can pop a panel out into a window of its own (`IFloatingPanels`, null for none), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until @@ -1610,7 +1623,10 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg (each panel in a pane of its own over the demo's game data; the composer over who-here, armed, with a draft typed through its real key path), `welcome`/`welcome-connect` (the first-run welcome over an **emptied** configuration and a main window alone — `--demo-config` has worlds, and the welcome never opens over them — and - its connect form filled in by real keys) and `tour` (the key tour row at the end of the demo's main window), plus + its connect form filled in by real keys), `tour` (the key tour row at the end of the demo's main window), + `help`/`help-topic` (in-app help's list, and its *Reading output* page), `dictionary-offer` (the spelling dictionary + offer, in a run that keeps no folder) and `join-wraps`/`join-wraps-f5` (a ragged world suggested on ⌃P, and + recommended on F5 — the row is under `14 more` below about 50 rows), plus the default workspace (no `--view`). Any settings screen also takes a `-edit` suffix, which opens it and drives real keys in so the frame shows a field mid-edit. State toggles: `collapsed`, `prefix`, `timestamps`, @@ -1970,6 +1986,15 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave7/composer-*.png`). `--demo-config` in the window opens the installed dictionary read-only. Not done: no find bar, and the window's ⌥W adds to the run's dictionary in the demo only (a live client writes `user-words.txt` as F1 does). +- **Help is one Client model drawn by both hosts** (`HelpModel`/`HelpSession`, `SlashCommands`, `HelpTopics`, Client; + `HelpSurface`, Tui; `HelpView`, Avalonia; `/help [words]`, ⌃P ▸ *Help*; surface `help`). Rows: how-to pages, then + the slash commands from **`SlashCommands.All`, the one table `--help` prints too** (`ClientUsage`), then every + registry command with a key for this host (`KeyGlyphs.Normalize`) and the host's own chords (`HostKeys`). The search + is `HelpModel.View` in both hosts (every word, in a row or in a page's text). ⏎ on a slash command **places** it on + the command line (`PlaceGrab`) and sends nothing; on a key it runs the registry command; on a how-to it opens the + page (Esc back). `--plain` says the matching rows instead. Native as an `INativeModals` session like ⌃F. Pages are + `HelpTopic.Lines` joined into `Paragraphs` and wrapped by each host. `HelpTests.EverySlashCommand…` ties the table + to the command line's handlers. - **In the window, the quit prompt, ⌃F, ⌃R, ⌥M and the welcome are native modals** (`ClientHost.NativeModals` → `INativeModals`; Client `Modals/`: `ModalSession`, `QuitModel`/`QuitSession`, `SearchModel`/`SearchSession`, `HistoryModel`/`HistorySession`, `LayoutsModel`/`LayoutsSession`, `WelcomeModel`/`WelcomeSession`; Avalonia diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 785abf32..1c5fd44c 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -499,6 +499,10 @@ private void OnEditorKeyDown(object? sender, KeyEventArgs e) { session.AddWord(word); } + else if (session.CanGetDictionary) + { + session.GetDictionary(); + } return; diff --git a/src/SharpMUTerm.Avalonia/DictionaryOfferView.cs b/src/SharpMUTerm.Avalonia/DictionaryOfferView.cs new file mode 100644 index 00000000..4da48954 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/DictionaryOfferView.cs @@ -0,0 +1,121 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's offer of a spelling dictionary: the question, what will be fetched from where and saved where (the +/// cells' consent sentences, ), and Download / Not now. Download ends in the +/// client's InstallDictionary, the method the cells' ⏎ ends in; nothing is fetched before it. +/// +internal sealed class DictionaryOfferView : DockPanel, IModalView +{ + private readonly DictionaryOfferSession _session; + private readonly Action _done; + private readonly Button _download; + private readonly Button _later; + + public DictionaryOfferView(DictionaryOfferSession session, NativeTokens colours, Action done) + { + _session = session; + _done = done; + var model = session.Model; + + var heading = ModalParts.Heading(model.Question, colours); + heading.Margin = new Thickness(22, 18, 22, 8); + SetDock(heading, Dock.Top); + Children.Add(heading); + + var facts = new StackPanel { Margin = new Thickness(22, 2, 22, 4), Spacing = 6 }; + foreach (var line in model.Lines) + { + facts.Children.Add(new TextBlock + { + Text = NativeKeys.Words(line), + Foreground = colours.Brush(line.Length == 0 ? colours.Dim : colours.Text), + TextWrapping = TextWrapping.Wrap, + FontSize = NativeTokens.Body, + }); + } + + SetDock(facts, Dock.Top); + Children.Add(facts); + + var footer = ModalParts.Footer(DictionaryOfferModel.Keys, colours); + SetDock(footer, Dock.Bottom); + + _download = ModalParts.Button("Download", "Enter", colours, Accept, accent: true); + _download.IsEnabled = model.Folder is not null && !model.Installed; + _later = ModalParts.Button("Not now", "Esc", colours, Decline); + var buttons = new StackPanel + { + Orientation = Orientation.Horizontal, + HorizontalAlignment = HorizontalAlignment.Right, + Spacing = 10, + Margin = new Thickness(22, 14, 22, 0), + }; + buttons.Children.Add(_download); + buttons.Children.Add(_later); + SetDock(buttons, Dock.Bottom); + Children.Add(footer); + Children.Add(buttons); + Children.Add(new Panel()); + + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + } + + public string Title => "Spelling dictionary"; + + public double PreferredWidth => 560; + + public bool Centred => true; + + /// The two buttons, for a test. + public Button DownloadButton => _download; + + public Button LaterButton => _later; + + public void FocusFirst() => (_download.IsEnabled ? _download : _later).Focus(); + + public void Detach() + { + } + + /// Download: the session ends and the client fetches and installs. + public void Accept() + { + _session.Accept(); + _done(); + } + + /// Not now: nothing is fetched. + public void Decline() + { + _session.Dismiss(); + _done(); + } + + private void OnKey(object? sender, KeyEventArgs e) + { + if (e.KeyModifiers != KeyModifiers.None) + { + return; + } + + if (e.Key == Key.Escape) + { + e.Handled = true; + Decline(); + } + else if (e.Key == Key.Enter && e.Source is not Button) + { + e.Handled = true; + Accept(); + } + } +} diff --git a/src/SharpMUTerm.Avalonia/HelpView.cs b/src/SharpMUTerm.Avalonia/HelpView.cs new file mode 100644 index 00000000..84f39f5d --- /dev/null +++ b/src/SharpMUTerm.Avalonia/HelpView.cs @@ -0,0 +1,348 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's help: a search box, the rows of under their headings, and a how-to page in place +/// of the list once one is chosen. The rows are for the typed query, the function the cells' +/// help lists, so both hosts list the same rows. ⏎ on a slash command places it on the command line and sends nothing; ⏎ +/// on a key runs the command it names; ⏎ on a how-to opens its page. Every word is the window's (). +/// +internal sealed class HelpView : DockPanel, IModalView +{ + private readonly HelpSession _session; + private readonly NativeTokens _colours; + private readonly Action _done; + private readonly TextBox _box; + private readonly TextBlock _count; + private readonly TextBlock _footer; + private readonly Border _frame; + private readonly StackPanel _list; + private readonly ScrollViewer _page; + private readonly StackPanel _pageText; + private readonly List _rows = []; + private IReadOnlyList _view = []; + private int _selected; + private string _query; + + public HelpView(HelpSession session, NativeTokens colours, Action done) + { + _session = session; + _colours = colours; + _done = done; + + _box = ModalParts.SearchBox("Search help: keys, slash commands, how-tos…", "Search help"); + SetDock(_box, Dock.Top); + Children.Add(_box); + + _count = ModalParts.Dim(string.Empty, colours); + _count.HorizontalAlignment = HorizontalAlignment.Right; + SetDock(_count, Dock.Top); + Children.Add(_count); + + _footer = ModalParts.Footer(string.Empty, colours); + SetDock(_footer, Dock.Bottom); + Children.Add(_footer); + + var panel = new Panel(); + var (frame, list, _) = ModalParts.List(colours); + _frame = frame; + _list = list; + frame.MinHeight = 160; + panel.Children.Add(frame); + + _pageText = new StackPanel { Margin = new Thickness(22, 4, 22, 12), Spacing = 8 }; + _page = new ScrollViewer { Content = _pageText, IsVisible = false, MinHeight = 160 }; + panel.Children.Add(_page); + Children.Add(panel); + + _box.Text = session.InitialQuery; + _box.CaretIndex = session.InitialQuery.Length; + _query = session.InitialQuery; + _box.TextChanged += (_, _) => + { + // Avalonia raises this after the fact, the initial text included; only a query that changed redraws. + var query = _box.Text ?? string.Empty; + if (query == _query) + { + return; + } + + _query = query; + _selected = 0; + ShowList(); + }; + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + + if (session.Model.Topic(session.InitialTopic) is { } topic) + { + ShowPage(topic); + } + else + { + ShowList(); + } + } + + public string Title => "Help"; + + public double PreferredWidth => 760; + + public bool Centred => false; + + /// The rows listed now, for a test. + public IReadOnlyList Rows => _view; + + /// The row ⏎ acts on. + public int Selected => _selected; + + /// The page showing, or null for the list. + public string? Page { get; private set; } + + /// The search box, for a test. + public TextBox Box => _box; + + public void FocusFirst() => _box.Focus(); + + public void Detach() + { + } + + /// ⏎ on listed row : a how-to opens its page, anything else ends help and acts. + public void Choose(int row) + { + if (row < 0 || row >= _view.Count) + { + return; + } + + var entry = _view[row]; + if (entry.Kind == HelpKind.Topic) + { + if (_session.Model.Topic(entry.Target) is { } topic) + { + ShowPage(topic); + } + + return; + } + + var index = IndexOf(entry); + if (index >= 0 && _session.Choose(index)) + { + _done(); + } + } + + /// Esc: a page goes back to the list; from the list help closes. + public void Back() + { + if (Page is not null) + { + ShowList(); + _box.Focus(); + return; + } + + _session.Dismiss(); + _done(); + } + + private int IndexOf(HelpEntry entry) + { + var entries = _session.Model.Entries; + for (var i = 0; i < entries.Count; i++) + { + if (ReferenceEquals(entries[i], entry)) + { + return i; + } + } + + return -1; + } + + private void ShowPage(HelpTopic topic) + { + Page = topic.Id; + _frame.IsVisible = false; + _page.IsVisible = true; + _box.IsVisible = false; + _count.Text = string.Empty; + _pageText.Children.Clear(); + _pageText.Children.Add(new TextBlock + { + Text = NativeKeys.Words(topic.Title), + FontSize = NativeTokens.Heading, + FontWeight = FontWeight.SemiBold, + Foreground = _colours.Brush(_colours.Text), + TextWrapping = TextWrapping.Wrap, + }); + _pageText.Children.Add(new TextBlock + { + Text = NativeKeys.Words(topic.Summary), + FontSize = NativeTokens.Body, + Foreground = _colours.Brush(_colours.Dim), + TextWrapping = TextWrapping.Wrap, + }); + foreach (var line in topic.Paragraphs) + { + _pageText.Children.Add(new TextBlock + { + Text = NativeKeys.Words(line), + FontSize = NativeTokens.Title, + Foreground = _colours.Brush(_colours.Text), + TextWrapping = TextWrapping.Wrap, + MinHeight = line.Length == 0 ? 4 : 0, + }); + } + + var back = ModalParts.Button("Back to help", "Esc", _colours, Back); + back.HorizontalAlignment = HorizontalAlignment.Left; + back.Margin = new Thickness(0, 10, 0, 0); + _pageText.Children.Add(back); + _page.Offset = default; + _footer.Text = "Up and Down scroll · Esc back to the list"; + } + + private void ShowList() + { + Page = null; + _frame.IsVisible = true; + _page.IsVisible = false; + _box.IsVisible = true; + var model = _session.Model; + _view = model.View(_box.Text ?? string.Empty); + _count.Text = _view.Count == model.Entries.Count ? $"{_view.Count} entries" : $"{_view.Count} of {model.Entries.Count}"; + _footer.Text = "Up and Down pick · Enter opens, places or runs it · Esc closes"; + _list.Children.Clear(); + _rows.Clear(); + _selected = _view.Count == 0 ? 0 : Math.Clamp(_selected, 0, _view.Count - 1); + if (_view.Count == 0) + { + _list.Children.Add(new TextBlock + { + Text = NativeKeys.Words(HelpModel.NoMatches).Replace("⌫", "Backspace", StringComparison.Ordinal), + Foreground = _colours.Brush(_colours.Dim), + Margin = new Thickness(12, 10), + TextWrapping = TextWrapping.Wrap, + }); + return; + } + + string? section = null; + for (var i = 0; i < _view.Count; i++) + { + var entry = _view[i]; + if (entry.Section != section) + { + _list.Children.Add(ModalParts.GroupHeader(entry.Section, _colours, section is null)); + section = entry.Section; + } + + var index = i; + var line = new DockPanel(); + if (entry.Key.Length > 0) + { + var chip = ModalParts.Key(entry.Key, _colours); + chip.Margin = new Thickness(10, 0, 0, 0); + SetDock(chip, Dock.Right); + line.Children.Add(chip); + } + + var title = new TextBlock + { + Text = NativeKeys.Words(entry.Title), + Foreground = _colours.Brush(_colours.Text), + FontSize = NativeTokens.Title, + Width = 240, + Margin = new Thickness(0, 0, 14, 0), + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }; + SetDock(title, Dock.Left); + line.Children.Add(title); + line.Children.Add(new TextBlock + { + Text = NativeKeys.Words(entry.Detail), + Foreground = _colours.Brush(_colours.Dim), + FontSize = NativeTokens.Body, + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }); + var row = ModalParts.Row(line, NativeKeys.Words(entry.Title), () => Select(index), () => Choose(index)); + _rows.Add(row); + _list.Children.Add(row); + } + + Highlight(); + } + + private void Select(int index) + { + if (index != _selected) + { + _selected = index; + Highlight(); + } + } + + private void Highlight() + { + for (var i = 0; i < _rows.Count; i++) + { + _rows[i].Background = i == _selected ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + } + + if (_selected < _rows.Count) + { + _rows[_selected].BringIntoView(); + } + } + + private void OnKey(object? sender, KeyEventArgs e) + { + if (e.KeyModifiers != KeyModifiers.None) + { + return; + } + + switch (e.Key) + { + case Key.Escape: + e.Handled = true; + Back(); + return; + case Key.Up when Page is null: + e.Handled = true; + Select(ModalParts.Step(_selected, -1, _view.Count)); + return; + case Key.Down when Page is null: + e.Handled = true; + Select(ModalParts.Step(_selected, 1, _view.Count)); + return; + case Key.Up: + e.Handled = true; + _page.LineUp(); + return; + case Key.Down: + e.Handled = true; + _page.LineDown(); + return; + case Key.Enter when Page is null: + e.Handled = true; + Choose(_selected); + return; + case Key.Back when Page is not null: + e.Handled = true; + Back(); + return; + } + } +} diff --git a/src/SharpMUTerm.Avalonia/ModalOverlay.cs b/src/SharpMUTerm.Avalonia/ModalOverlay.cs index 18a4c005..eed0a7f3 100644 --- a/src/SharpMUTerm.Avalonia/ModalOverlay.cs +++ b/src/SharpMUTerm.Avalonia/ModalOverlay.cs @@ -14,7 +14,7 @@ namespace SharpMUTerm.Avalonia; /// /// One native modal over the window: a faint scrim over everything, and a rounded card holding the modal's view /// (, , , , -/// ). Fluent is applied to the card alone, in the client's variant, with the client's accent; +/// , , ). Fluent is applied to the card alone, in the client's variant, with the client's accent; /// the rest of the window keeps the Simple theme its menus and tooltips were built against — the palette's rule. /// /// A press on the scrim closes the modal (the quit prompt answers it as Stay). ⌃Q in any modal but the prompt goes to @@ -45,6 +45,8 @@ public ModalOverlay(ModalSession session, Action remove, Action new HistoryView(history, Colours, Done), LayoutsSession layouts => new LayoutsView(layouts, Colours, Done), WelcomeSession welcome => new WelcomeView(welcome, Colours, Done), + HelpSession help => new HelpView(help, Colours, Done), + DictionaryOfferSession offer => new DictionaryOfferView(offer, Colours, Done), _ => throw new ArgumentException($"no native view for {session.GetType().Name}", nameof(session)), }; AutomationProperties.SetName(this, _view.Title); diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 98259241..1466910a 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -17,12 +17,21 @@ namespace SharpMUTerm.Client.Commands; /// public static class BuiltInCommands { + /// Help: keys, slash commands and how-tos (/help). + public const string HelpCommand = "term:help"; + + /// The spelling dictionary offer. + public const string DictionaryCommand = "term:get-dictionary"; + + /// The ⌃P id that joins 's server wraps. + public static string JoinWraps(string world) => JoinWrapsPrefix + world; + /// The command that moves the keyboard into the connection sidebar (⌥C). public const string RailKeysCommand = "layout:rail-keys"; /// /// Turns F5's join wraps on for the world named after the prefix: the action of the notice that says a pane is - /// narrower than the server's wrap column. Lists nothing on ⌃P (F5 is the setting's home). + /// narrower than the server's wrap column, and a ⌃P entry (listed under SUGGESTED) for as long as that is so. /// public const string JoinWrapsPrefix = "world:join-wraps:"; @@ -77,7 +86,7 @@ void Family(string id, string prefix, Func []); + Family("world:join-wraps", JoinWrapsPrefix, JoinWrapsEntries); Add("world:reload-scripts", CommandGroup.World, "Reload scripts", detail: "re-reads this character's Lua files", when: c => c.State.ScriptsOn); @@ -176,6 +185,14 @@ void Family(string id, string prefix, Func c.State.NoDictionary); Add("term:timestamps-off", CommandGroup.Terminal, "Hide timestamps", when: c => c.State.TimestampsOn); Add("term:timestamps-on", CommandGroup.Terminal, "Show timestamps", when: c => !c.State.TimestampsOn); Add("term:input2-off", CommandGroup.Terminal, "Hide second input", "⌃B i", "this window", @@ -365,6 +382,17 @@ private static IEnumerable Windows(ICommandContext context) // The send group: one line to several characters. Offered once two characters are open, since a // group of one is the command line. + /// One Join server wraps for … entry per world whose pane is narrower than its server wraps. + private static IEnumerable JoinWrapsEntries(ICommandContext context) => + (context.State.RaggedWraps ?? []).Select(r => new CommandItem( + CommandGroup.World, + $"Join server wraps for {r.World}", + JoinWraps(r.World), + $"it wraps at {r.Column}, the pane is {r.PaneWidth} wide · F5 ▸ join wraps") + { + Detail = $"it wraps at {r.Column}, the pane is {r.PaneWidth} wide · F5 ▸ join wraps", + }); + private static IEnumerable SendGroup(ICommandContext context) { var characters = context.Characters; diff --git a/src/SharpMUTerm.Client/Composer/ComposerModel.cs b/src/SharpMUTerm.Client/Composer/ComposerModel.cs index ab08cebb..159670fb 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerModel.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerModel.cs @@ -141,6 +141,9 @@ public static ComposerModel Create( }; } + /// What F1's key row calls ⌥W while no dictionary marks the post. + public const string GetDictionary = "get a dictionary"; + /// The key row for a composer in this state. /// Whether F1's as-sent preview is showing, which names what ⌥P does next. public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, bool dictionary, bool canSend, bool armed, bool preview = false) @@ -177,10 +180,8 @@ public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, new("⌃S", canSend ? "send" : "send (nothing connected)"), new("⌥L", "escaping"), }; - if (dictionary) - { - keys.Add(new("⌥W", "add word")); - } + // With no dictionary, ⌥W is the way to one: the offer, never a download on its own. + keys.Add(dictionary ? new("⌥W", "add word") : new("⌥W", GetDictionary)); keys.Add(new("⌥P", preview ? "hide as sent" : "as sent")); keys.Add(new("Esc", "close (keeps the draft)")); diff --git a/src/SharpMUTerm.Client/Composer/ComposerSession.cs b/src/SharpMUTerm.Client/Composer/ComposerSession.cs index f0f9f9c3..7667d212 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerSession.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerSession.cs @@ -24,6 +24,9 @@ public sealed record ComposerCallbacks /// ⌥W, or the menu's Add to dictionary, with the word. public Action? AddWord { get; init; } + /// ⌥W in F1 with no dictionary: the client offers to download one. + public Action? GetDictionary { get; init; } + /// Esc in a docked composer: the keyboard goes back to the command line. public Action? Release { get; init; } @@ -147,6 +150,18 @@ public void AddWord(string word) } } + /// Whether ⌥W here offers a dictionary: F1 writing a post, with none marking it. + public bool CanGetDictionary => Model is { Edit: null, Dictionary: null, Place: ComposerPlace.FullScreen }; + + /// The host's: ⌥W with no dictionary. + public void GetDictionary() + { + if (CanGetDictionary && !IsEnded) + { + _callbacks.GetDictionary?.Invoke(); + } + } + /// The host's: Esc in a docked composer. public void Release() { diff --git a/src/SharpMUTerm.Client/Help/HelpTopics.cs b/src/SharpMUTerm.Client/Help/HelpTopics.cs new file mode 100644 index 00000000..9a3549be --- /dev/null +++ b/src/SharpMUTerm.Client/Help/HelpTopics.cs @@ -0,0 +1,96 @@ +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Client.Help; + +/// +/// The short how-to pages help lists. Plain sentences, keys in glyphs (a window spells them in words on the way to the +/// screen). Each page answers one question a new player asks, and names the key or the screen that does the thing; it +/// does not try to be the manual. +/// +public static class HelpTopics +{ + /// The pages, with (the host's newline chord) where a page names it. + public static IReadOnlyList For(string newline) => + [ + new("getting-started", "Getting started", "connect to a game, and what the screen is", [ + "Connect: type /connect mud.example.org 4000 (add tls for a secure port), or open the welcome", + "with /welcome. F5 keeps worlds and their characters; a character's password and connect line", + "log you in once a connection is open.", + "", + "The screen: output fills the panes, the command line is at the bottom and ⏎ sends what is on", + "it to the character whose pane is focused. The sidebar lists worlds, characters and windows;", + "click a row, or ⌥C to walk it with the keys.", + "", + $"Typing: ↑/↓ recall what you sent, ⌃R searches it, {newline} adds a second line, ⇥ completes a name.", + "", + "Everything else: ⌃P lists every command with its key. Type a few letters to find one.", + "⌃Q quits and says first what a quit would end.", + ]), + new("reading", "Reading output", "scroll back, search, freeze, join a server's wraps", [ + "Scroll: PgUp/PgDn a page, ⇧↑/⇧↓ a line, the wheel. Scrolled back, the pane splits: history on", + "top, the live tail below. End or ⌃End goes back to live output.", + "", + "Search: ⌃F finds text in what the panes hold. ⌥E reads the query as a pattern, ⌥A widens it", + "to every window, ⏎ goes to the line, ⌥G to the next one.", + "", + "Freeze: ⌥F holds a pane still while output keeps arriving under it; ⌥F again thaws it.", + "", + "Ragged lines: a game that wraps its text at 80 columns leaves a stray word on a row of its own", + "in a narrower pane. F5 ▸ join wraps joins those lines back so they wrap to the pane. It is off", + "until you turn it on, because a wrong join runs two lines into one; while a pane is narrower than", + "its game wraps, ⌃P suggests it.", + "", + "Copy: drag across output, then ⌃C.", + ]), + new("layouts", "Layouts", "panes, panels, and saving an arrangement", [ + "⌥M lists the layouts: Roleplay (who is here, a composer), Combat (vitals, a map, a quick bar)", + "and your own. ⏎ applies one; n saves the panes as they are now as a new layout.", + "", + "Panes: ⌃B | splits right, ⌃B - splits down, ⌃B z zooms, ⌃B x closes. ⌃←→↑↓ move between panes,", + "⌃O cycles them, ⌃N cycles a pane's tabs. ⌥⇧ and an arrow make the pane bigger or smaller.", + "Drag a tab onto another pane to move it there; an edge splits.", + "", + "A layout shows a panel only once there is something for it: the map after the first room,", + "vitals after the game sends them. F5 ▸ layout picks one per world.", + ]), + new("triggers", "Triggers", "match a line, then colour it, send it to a window, or reply", [ + "F2 holds the rules. A rule matches a line (contains, a wildcard pattern with *, or a regex),", + "and then does any of: highlight it, route it to a window (Chat, say), gag it, or send a reply.", + "", + "Quickest way: drag across a line of output, then ⌃P ▸ Make a trigger from the selection.", + "F2 opens on a rule for that line with the variable parts as *, and a live test underneath", + "shows which recent lines it would match.", + "", + "Rules live in trigger sets, shared between characters: F5 says which sets a character uses.", + "Aliases (F3) rewrite what you type; macros (F4) put commands on keys; timers (F6) repeat them.", + "/triggers says why a window did or did not open.", + ]), + new("composer", "Composer", "write a long post, check its spelling", [ + "F1 opens a full-screen editor. The whole buffer is one command, verb and all (+bbpost Title=...),", + "and its line breaks are sent as %r. ⌃S sends; Esc closes and keeps the draft for that character.", + "", + "⌥L switches between sending the text as typed and escaping it, so % [ ] and ; arrive as written.", + "⌥P shows the post exactly as it will be sent.", + "", + "Spelling: with a Hunspell dictionary, misspelt words are marked and ⌥W adds the word at the caret", + "to your own list. With none, ⌥W offers to download one (English, from LibreOffice) into the", + "dictionaries folder beside your configuration. Nothing is downloaded until you say so.", + "", + "The Roleplay layout docks a composer under the output that shares F1's draft.", + ]), + new("keys", "Keys", "windows, characters, panes, and the ⌃B keys", [ + "Windows: ⌥1 to ⌥9 go to a numbered window of the character you are on — the numbers are the ones", + "the sidebar prints beside each window.", + "Characters: ⌥J and ⌥K move to the next and previous character you have open.", + "Connection: ⌥R reconnects, ⌥D disconnects. Neither asks.", + "", + "Panes: ⌃B then a key — | split right, - split down, z zoom, o next, 1-9 go to a pane, x close,", + "b fold the sidebar, m move a window, i a second command line. Pause after ⌃B to see them all.", + "", + $"Typing: {newline} newline, ⌥←/→ by word, ⌃Z/⌃Y undo and redo, ⌃A select all, ⌃C copy, ⌃X cut.", + "", + "F4 puts your own commands on keys and says which keys this terminal cannot deliver.", + "Every key below is also an entry on ⌃P.", + ]), + ]; +} diff --git a/src/SharpMUTerm.Client/Help/SlashCommands.cs b/src/SharpMUTerm.Client/Help/SlashCommands.cs new file mode 100644 index 00000000..b0031bad --- /dev/null +++ b/src/SharpMUTerm.Client/Help/SlashCommands.cs @@ -0,0 +1,36 @@ +namespace SharpMUTerm.Client.Help; + +/// One command the command line answers itself rather than sending to the game. +/// What starts it (/connect). +/// The whole form, arguments included (/connect <host> [port] [tls]). +/// What it does, in one line. +/// What help puts on the command line when it is chosen: the name, and a space when it takes words. +public sealed record SlashCommand(string Name, string Usage, string Summary, string Placed); + +/// +/// The one list of slash commands. --help prints it, /help and ⌃P ▸ Help list it, and a +/// test holds it to the command line's own dispatch, so a command added in one place and not the others fails. +/// +public static class SlashCommands +{ + public static IReadOnlyList All { get; } = + [ + new("/help", "/help [words]", "This help: keys, slash commands and short how-tos, searched for the words", "/help "), + new("/connect", "/connect ", "Open a configured world by name", "/connect "), + new("/connect", "/connect [port] [tls]", "Add a world for a host and connect to it (port 4000 by default)", "/connect "), + new("/welcome", "/welcome", "Show the first-run welcome again", "/welcome"), + new("/welcome", "/welcome layout roleplay|combat|suggested", "Choose the starting layout the welcome offers", "/welcome layout "), + new("/package", "/package", "Open the Packages screen (F10)", "/package"), + new("/package", "/package browse", "Browse the package index, this game's packages first", "/package browse"), + new("/package", "/package install ", "Read a package and open its review; nothing is written before Enter", "/package install "), + new("/walk", "/walk ", "Speedwalk to a room on this connection's map, one step at a time", "/walk "), + new("/walk", "/walk stop", "Stop walking", "/walk stop"), + new("/map", "/map lock|unlock [room]", "Keep walks out of a room, or let them through again", "/map lock "), + new("/web", "/web ", "Open a page in the built-in web view", "/web "), + new("/graphics", "/graphics", "Say how pictures are drawn in this terminal, and why", "/graphics"), + new("/triggers", "/triggers", "Say which trigger rules this window's character runs, and why a window did not open", "/triggers"), + ]; + + /// The distinct names, in table order: what the command line dispatches on. + public static IReadOnlyList Names { get; } = All.Select(c => c.Name).Distinct(StringComparer.Ordinal).ToArray(); +} diff --git a/src/SharpMUTerm.Client/Modals/DictionaryOfferModel.cs b/src/SharpMUTerm.Client/Modals/DictionaryOfferModel.cs new file mode 100644 index 00000000..bc309145 --- /dev/null +++ b/src/SharpMUTerm.Client/Modals/DictionaryOfferModel.cs @@ -0,0 +1,66 @@ +namespace SharpMUTerm.Client.Modals; + +/// +/// The spelling dictionary offer: what would be downloaded, from where, under what licence, and where it would go — +/// the consent text, drawn by the cell surface (DictionaryOffer.Render) and by the window's native modal. Nothing +/// is fetched until the player says yes, and the offer exists only because the player asked (F1's ⌥W with no +/// dictionary, ⌃P ▸ Get a spelling dictionary). +/// +/// The dictionary's file name (en_US). +/// What a reader calls it (English (US)). +/// Where it comes from. +/// Its licence. +/// The host the files are fetched from. +/// About how big it is, in words (about 0.6 MB). +/// Where it would be written, or null when this run keeps no dictionaries folder (a test, the demo). +/// Whether that folder already holds a dictionary, which a download would sit beside. +public sealed record DictionaryOfferModel( + string Name, + string Language, + string Origin, + string Licence, + string Host, + string Size, + string? Folder, + bool Installed) +{ + /// The offer's question. + public string Question => $"Download the {Language} spelling dictionary?"; + + /// What the offer says, one sentence per line. + public IReadOnlyList Lines => + [ + $"{Name} — {Origin}, {Size}, fetched over https from {Host} and checked against the file this client expects.", + $"Licence: {Licence}.", + Folder is { } folder + ? $"It is saved in {folder}, and the composer checks spelling with it from then on." + : "This run keeps no dictionaries folder, so nothing can be saved: the live client saves it beside your configuration.", + Installed + ? "That folder already has a dictionary; this one is added beside it." + : "Nothing else is downloaded, and nothing is sent about you.", + ]; + + /// The keys the cell offer answers. + public const string Keys = "⏎ download · Esc not now"; +} + +/// +/// One opening of the dictionary offer in a host's own controls. closes it and starts the +/// download through the client's own method; Esc (or a click outside) closes it and fetches nothing. +/// +public sealed class DictionaryOfferSession : ModalSession +{ + private readonly Action _accept; + + public DictionaryOfferSession(DictionaryOfferModel model, bool isDark, Action accept, Action closed) + : base(model, isDark, closed) + { + ArgumentNullException.ThrowIfNull(accept); + _accept = accept; + } + + public override string Surface => "dictionary"; + + /// The host's: yes, download it. + public void Accept() => CloseThen(_accept); +} diff --git a/src/SharpMUTerm.Client/Modals/HelpModel.cs b/src/SharpMUTerm.Client/Modals/HelpModel.cs new file mode 100644 index 00000000..97dcd793 --- /dev/null +++ b/src/SharpMUTerm.Client/Modals/HelpModel.cs @@ -0,0 +1,225 @@ +using SharpMUTerm.Client.Help; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Core.Commands; + +namespace SharpMUTerm.Client.Modals; + +/// What a help row is: a how-to page, a slash command, or a key. +public enum HelpKind +{ + /// A short page (); choosing it shows the page. + Topic, + + /// A slash command (); choosing it puts the command on the command line, unsent. + Command, + + /// A key, from the command registry or the host's own keys; choosing one with a command runs it. + Key, +} + +/// One row of help. +/// What choosing it does. +/// The heading it is listed under. +/// What it is called: a page's title, a command's usage, a key's action. +/// The key, in glyphs (⌃P), or empty. +/// A few words more, or empty. +/// A page's id, the text a command places, or the command a key runs (empty for none). +public sealed record HelpEntry(HelpKind Kind, string Section, string Title, string Key, string Detail, string Target); + +/// A short how-to page. +public sealed record HelpTopic(string Id, string Title, string Summary, IReadOnlyList Lines) +{ + public bool Equals(HelpTopic? other) => + other is not null && Id == other.Id && Title == other.Title && Summary == other.Summary && ModelLists.Same(Lines, other.Lines); + + public override int GetHashCode() => HashCode.Combine(Id, Title, Summary, ModelLists.Hash(Lines)); + + /// + /// The page as paragraphs: consecutive lines joined with a space, a blank line between paragraphs kept as an empty + /// one. The lines are broken for reading in source; each host wraps the paragraphs to the width it has. + /// + public IReadOnlyList Paragraphs + { + get + { + var paragraphs = new List(); + var current = new List(); + foreach (var line in Lines) + { + if (line.Length == 0) + { + if (current.Count > 0) + { + paragraphs.Add(string.Join(' ', current)); + current.Clear(); + } + + paragraphs.Add(string.Empty); + continue; + } + + current.Add(line); + } + + if (current.Count > 0) + { + paragraphs.Add(string.Join(' ', current)); + } + + return paragraphs; + } + } +} + +/// +/// Help: the slash commands (from , the table --help prints), every key the command +/// registry names for this host plus the keys the host keeps, and a few short how-to pages. Drawn by the cell surface +/// (HelpSurface.Render) and by the window's native one; both filter it with , so a query lists +/// the same rows. +/// +/// Every row, in the order they are listed. +/// The pages the topic rows open. +public sealed record HelpModel(IReadOnlyList Entries, IReadOnlyList Topics) +{ + /// The heading over the pages. + public const string TopicsSection = "HOW-TO"; + + /// The heading over the slash commands. + public const string CommandsSection = "SLASH COMMANDS"; + + /// The heading over the keys the host keeps for itself and its newline. + public const string HostSection = "KEYS · THIS HOST"; + + /// What the list says when nothing matches. + public const string NoMatches = "nothing matches — ⌫ widens the search"; + + /// + /// The rows for , in list order: every row with each word of the query somewhere in its + /// title, key, detail or heading — or, for a page, in its text. A blank query lists everything. + /// + public IReadOnlyList View(string? query) + { + var words = (query ?? string.Empty).Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + if (words.Length == 0) + { + return Entries; + } + + return Entries.Where(e => words.All(w => Mentions(e, w))).ToArray(); + } + + /// The page with , or null. + public HelpTopic? Topic(string? id) => Topics.FirstOrDefault(t => t.Id == id); + + private bool Mentions(HelpEntry entry, string word) + { + static bool In(string text, string w) => text.Contains(w, StringComparison.OrdinalIgnoreCase); + if (In(entry.Title, word) || In(entry.Key, word) || In(entry.Detail, word) || In(entry.Section, word)) + { + return true; + } + + return entry.Kind == HelpKind.Topic && Topic(entry.Target) is { } topic && topic.Lines.Any(l => In(l, word)); + } + + /// + /// Help for this host: the pages, the slash commands, every key names (⌃P's entries, so + /// a key is listed as the host spells it), then the host's newline and the chords it keeps. + /// + /// The command registry's entries for this host and state. + /// The host's newline chord, in glyphs (⌥⏎, ⌃⏎). + /// The chords the host keeps for itself, with what each does there. + public static HelpModel Build( + IReadOnlyList catalog, + string newline, + IReadOnlyList<(string Chord, string Action)> hostKeeps) + { + ArgumentNullException.ThrowIfNull(catalog); + ArgumentNullException.ThrowIfNull(hostKeeps); + var topics = HelpTopics.For(KeyGlyphs.Normalize(newline)); + var entries = new List(); + entries.AddRange(topics.Select(t => new HelpEntry(HelpKind.Topic, TopicsSection, t.Title, string.Empty, t.Summary, t.Id))); + entries.AddRange(SlashCommands.All.Select(c => new HelpEntry(HelpKind.Command, CommandsSection, c.Usage, string.Empty, c.Summary, c.Placed))); + + // The registry's keys, by its own groups. Go-to rows are left out: they are per character and per window, and + // the keys page says how those numberings work. + var seen = new HashSet(StringComparer.Ordinal); + foreach (var item in catalog.Where(i => i.Group != CommandGroup.GoTo && !string.IsNullOrWhiteSpace(i.Key))) + { + if (!seen.Add(item.Id)) + { + continue; + } + + entries.Add(new HelpEntry( + HelpKind.Key, + "KEYS · " + CommandPaletteModel.GroupLabel(item.Group), + item.Title, + KeyGlyphs.Normalize(item.Key!), + item.Detail ?? string.Empty, + item.Id)); + } + + entries.Add(new HelpEntry(HelpKind.Key, HostSection, "Insert a newline in the command line", KeyGlyphs.Normalize(newline), string.Empty, string.Empty)); + foreach (var (chord, action) in hostKeeps) + { + entries.Add(new HelpEntry(HelpKind.Key, HostSection, action, KeyGlyphs.Normalize(chord), "kept by this host", string.Empty)); + } + + return new HelpModel(entries, topics); + } + + public bool Equals(HelpModel? other) => + other is not null && ModelLists.Same(Entries, other.Entries) && ModelLists.Same(Topics, other.Topics); + + public override int GetHashCode() => HashCode.Combine(ModelLists.Hash(Entries), ModelLists.Hash(Topics)); +} + +/// +/// One opening of help in a host's own controls. Choosing a page shows it (the host's own business, nothing comes back); +/// choosing a slash command or a key comes back through , after help has closed, to the client +/// method the cell surface's ⏎ ends in. +/// +public sealed class HelpSession : ModalSession +{ + private readonly Action _choose; + + /// What help lists. + /// Whether the client's theme is a dark one. + /// Acts on entry N of , after help has closed. + /// Told help closed. + public HelpSession(HelpModel model, bool isDark, Action choose, Action closed) + : base(model, isDark, closed) + { + ArgumentNullException.ThrowIfNull(choose); + _choose = choose; + } + + public override string Surface => "help"; + + /// What the search box opens with typed in (/help words). + public string InitialQuery { get; init; } = string.Empty; + + /// The page help opens on, or null for the list. + public string? InitialTopic { get; init; } + + /// + /// The host's: ⏎ on entry of . A page is the host's to + /// show and returns false; a command or a key closes help and is acted on (true). A key with no command does nothing. + /// + public bool Choose(int entryIndex) + { + if (entryIndex < 0 || entryIndex >= Model.Entries.Count) + { + return false; + } + + var entry = Model.Entries[entryIndex]; + if (entry.Kind == HelpKind.Topic || entry.Target.Length == 0) + { + return false; + } + + return CloseThen(() => _choose(entryIndex)); + } +} diff --git a/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs b/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs index 079396dc..740d054e 100644 --- a/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs +++ b/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Commands; using SharpMUTerm.Core.Commands; namespace SharpMUTerm.Client.Palette; @@ -138,6 +139,13 @@ public static IReadOnlyList Suggested(CommandContext state) ids.Add("settings:key-clashes"); } + // A pane narrower than its game wraps: every hard-wrapped row leaves a stray word. Suggested while it holds, + // rather than said once, because ragged lines are the look of every room until it is fixed. + foreach (var ragged in state.RaggedWraps ?? []) + { + ids.Add(BuiltInCommands.JoinWraps(ragged.World)); + } + return ids; } diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 2bf3de40..c3af479b 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -180,6 +180,12 @@ public static class SurfaceCatalog /// The first-run welcome and its connect form. public const string Welcome = "welcome"; + /// Help: keys, slash commands and how-to pages (⌃P ▸ Help, /help). + public const string Help = "help"; + + /// The spelling dictionary offer: the consent step before anything is downloaded. + public const string Dictionary = "dictionary"; + /// /// The +3 ▾ chip a tab strip carries when its tabs do not fit even at their floors, and the list of the tabs /// past its edges it opens: a cell list in a terminal, a native menu in the window (the chip itself is cells in both). @@ -203,7 +209,7 @@ public static class SurfaceCatalog private static string[] PanelViews(string view) => ["SharpMUTerm.Avalonia." + view, "SharpMUTerm.Avalonia.PopOutButton"]; /// The modals the window draws with its own controls in place of the cell modal (ClientHost.NativeModals). - public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome]; + public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary]; /// A cell modal in a terminal; the window's own modal in its place. private static readonly IReadOnlyDictionary NativeModal = new Dictionary @@ -372,6 +378,9 @@ public static class SurfaceCatalog // Esc: the window closes and the buffer is kept as the character's draft. new(SurfaceActionKind.Compose, "close", "CloseComposer"), new(SurfaceActionKind.Compose, "add word", "AddComposerWord"), + + // ⌥W with no dictionary: F1 closes keeping the draft, and the dictionary offer opens. + new(SurfaceActionKind.Compose, "get dictionary", "OfferDictionary"), ], new Dictionary { @@ -455,6 +464,25 @@ public static class SurfaceCatalog NativeModal, "SharpMUTerm.Tui.WelcomeSurface.Render", ModalViews("WelcomeView")), + new( + Help, + typeof(HelpModel), + [ + // A slash command is put on the command line, never sent; a key runs its registry command. A page is the + // view's own to show and hands nothing back. + new(SurfaceActionKind.Modal, "place", "RunHelpEntry"), + new(SurfaceActionKind.Modal, "run", "RunHelpEntry"), + ], + NativeModal, + "SharpMUTerm.Tui.HelpSurface.Render", + ModalViews("HelpView")), + new( + Dictionary, + typeof(DictionaryOfferModel), + [new(SurfaceActionKind.Modal, "accept", "InstallDictionary")], + NativeModal, + "SharpMUTerm.Tui.DictionaryOffer.Render", + ModalViews("DictionaryOfferView")), new( TabOverflow, typeof(MenuModel), diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index 1cba2e48..4336c057 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -53,6 +53,13 @@ public sealed record CharacterRef( /// Null where the host cannot float a panel in a window of its own (the terminal), so nothing is offered; otherwise /// every panel that can pop out, docked or floating, so Pop out … and Dock … back name real windows. /// +/// +/// The worlds whose connected pane is narrower than the column their server wraps at, and which do not join wraps — so +/// Join server wraps for … is offered (and suggested) only while it would change what the pane shows. +/// +/// +/// Whether the client's own dictionaries folder holds none, so Get a spelling dictionary is offered. +/// public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -67,7 +74,15 @@ public sealed record CommandContext( bool? Announced = null, bool OutputSelected = false, int KeyClashes = 0, - IReadOnlyList? Floats = null); + IReadOnlyList? Floats = null, + IReadOnlyList? RaggedWraps = null, + bool NoDictionary = false); + +/// A world whose pane is narrower than its server's wrap column. +/// The world's name. +/// The column its server wraps at. +/// How wide its pane is. +public sealed record RaggedWrap(string World, int Column, int PaneWidth); /// A panel window that can pop out into a window of its own, for the command surface's entries. /// The panel's window (map:World.Char, panel:vitals:World.Char). diff --git a/src/SharpMUTerm.Core/Text/DictionaryDownload.cs b/src/SharpMUTerm.Core/Text/DictionaryDownload.cs new file mode 100644 index 00000000..9cb35a1e --- /dev/null +++ b/src/SharpMUTerm.Core/Text/DictionaryDownload.cs @@ -0,0 +1,205 @@ +using System.Security.Cryptography; + +namespace SharpMUTerm.Core.Text; + +/// +/// A Hunspell dictionary the client knows how to fetch: two files at pinned https addresses, each with the SHA-256 the +/// bytes must have. The address names a release tag, so what it serves cannot move; the hash is what makes that true. +/// +/// The file name the pair is saved under (en_US), which is also what the composer calls it. +/// What a reader calls it (English (US)). +/// Where it comes from, said in the consent text. +/// Its licence, said in the consent text. +/// The affix file. +/// The affix file's SHA-256, lower-case hex. +/// The word list. +/// The word list's SHA-256, lower-case hex. +/// About how big the two are together, for the consent text. +public sealed record DictionarySource( + string Name, + string Language, + string Origin, + string Licence, + Uri Aff, + string AffSha256, + Uri Dic, + string DicSha256, + long Bytes); + +/// +/// Fetches a spelling dictionary into the client's own dictionaries/ folder, only when the player asks +/// (F1's ⌥W with no dictionary, ⌃P ▸ Get a spelling dictionary). Nothing is bundled and nothing is fetched at +/// start. Windows has no system Hunspell folder, so without this a roleplayer there never has spelling. +/// +/// Server text never meets the disk here, but the network does, so the rules are the package index's: https +/// only, every file capped while it streams (), and the bytes checked against the pinned +/// SHA-256 before anything is written. The pair is written as .new files and renamed, the affix file first, +/// because looks for a .dic with an .aff beside it: a pair half written +/// is never one it opens. +/// +/// +public static class DictionaryDownload +{ + /// The most one file may be. The largest English word list is about 1.2 MB. + public const long MaxFileBytes = 8L * 1024 * 1024; + + private const string Release = "https://raw.githubusercontent.com/LibreOffice/dictionaries/libreoffice-24.8.4.2/en/"; + + private const string LibreOffice = "LibreOffice's dictionaries (release 24.8.4.2)"; + + /// English (US): the default. + public static DictionarySource EnglishUs { get; } = new( + "en_US", + "English (US)", + LibreOffice, + "SCOWL / Hunspell en_US: free to use, copy and change", + new Uri(Release + "en_US.aff"), + "e746c882dd6f303c2c46e7452804b9201115a6942cfeb15f18f8edf774d2e24e", + new Uri(Release + "en_US.dic"), + "f0b1a234bd178bdd01875b2a392a9647f888b8fe879f79c52aae62c2759b3647", + 555_000); + + /// English (GB), for a locale that asks for it. + public static DictionarySource EnglishGb { get; } = new( + "en_GB", + "English (GB)", + LibreOffice, + "Marco A.G. Pinto's en_GB: LGPL / MPL", + new Uri(Release + "en_GB.aff"), + "04755f317851defd8b9f77fd7e5d60f495221fad926d0df346cd9b61b646bfc2", + new Uri(Release + "en_GB.dic"), + "e070c64007d0f6a3423d028a53da099934b5f967dc0ef6d01b631ec2119659d4", + 1_262_000); + + /// Every dictionary this client can fetch. + public static IReadOnlyList Catalog { get; } = [EnglishUs, EnglishGb]; + + /// + /// The one to offer for (en_GB, en-AU): its own if there is one, else the + /// US list — the only languages offered are English for now, and a reader of any other gets the US one named as + /// such rather than nothing. + /// + public static DictionarySource For(string? language) + { + var wanted = (language ?? string.Empty).Replace('-', '_').Split('.')[0].ToUpperInvariant(); + return wanted is "EN_GB" or "EN_IE" or "EN_NZ" or "EN_AU" or "EN_ZA" or "EN_IN" ? EnglishGb : EnglishUs; + } + + /// Whether already holds a dictionary pair, read without opening it. + public static bool Holds(string? folder) + { + if (folder is null) + { + return false; + } + + try + { + return Directory.Exists(folder) + && Directory.GetFiles(folder, "*.dic").Any(d => File.Exists(Path.ChangeExtension(d, ".aff"))); + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) + { + return false; + } + } + + /// + /// Fetches with and writes it into . + /// Returns null when it is installed, or why not. is handed the address and the cap and + /// returns the bytes, or null for a failed or over-long download; is the real one. + /// + public static async Task InstallAsync( + string folder, + DictionarySource source, + Func> fetch, + CancellationToken token = default) + { + ArgumentNullException.ThrowIfNull(folder); + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(fetch); + + var files = new List<(string Extension, byte[] Bytes)>(); + foreach (var (uri, sha, extension) in new[] { (source.Aff, source.AffSha256, ".aff"), (source.Dic, source.DicSha256, ".dic") }) + { + if (uri.Scheme != Uri.UriSchemeHttps) + { + return $"{uri} is not https"; + } + + byte[]? bytes; + try + { + bytes = await fetch(uri, MaxFileBytes, token).ConfigureAwait(false); + } + catch (Exception ex) when (ex is HttpRequestException or IOException or TaskCanceledException) + { + return $"{source.Name}{extension} was not fetched: {ex.Message}"; + } + + if (bytes is null || bytes.Length > MaxFileBytes) + { + return $"{source.Name}{extension} was not fetched, or was too large"; + } + + if (!string.Equals(Convert.ToHexStringLower(SHA256.HashData(bytes)), sha, StringComparison.Ordinal)) + { + return $"{source.Name}{extension} is not the file this client expects (its SHA-256 differs); nothing was written"; + } + + files.Add((extension, bytes)); + } + + try + { + Directory.CreateDirectory(folder); + foreach (var (extension, bytes) in files) + { + var path = Path.Combine(folder, source.Name + extension); + var staging = path + ".new"; + await File.WriteAllBytesAsync(staging, bytes, token).ConfigureAwait(false); + File.Move(staging, path, overwrite: true); + } + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) + { + return $"{source.Name} could not be written to {folder}: {ex.Message}"; + } + + return null; + } + + private static readonly HttpClient Http = new() { Timeout = TimeSpan.FromSeconds(60) }; + + /// Downloads over https, stopping at bytes. + public static async Task DownloadAsync(Uri uri, long cap, CancellationToken token) + { + ArgumentNullException.ThrowIfNull(uri); + if (uri.Scheme != Uri.UriSchemeHttps) + { + return null; + } + + using var response = await Http.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead, token).ConfigureAwait(false); + if (!response.IsSuccessStatusCode || response.Content.Headers.ContentLength > cap) + { + return null; + } + + await using var stream = await response.Content.ReadAsStreamAsync(token).ConfigureAwait(false); + using var buffer = new MemoryStream(); + var chunk = new byte[81920]; + int read; + while ((read = await stream.ReadAsync(chunk, token).ConfigureAwait(false)) > 0) + { + if (buffer.Length + read > cap) + { + return null; + } + + buffer.Write(chunk, 0, read); + } + + return buffer.ToArray(); + } +} diff --git a/src/SharpMUTerm.Tui/ClientUsage.cs b/src/SharpMUTerm.Tui/ClientUsage.cs index 9c450d5b..17d14365 100644 --- a/src/SharpMUTerm.Tui/ClientUsage.cs +++ b/src/SharpMUTerm.Tui/ClientUsage.cs @@ -159,6 +159,14 @@ public static void Write(TextWriter usage, UsageLauncher launcher, HostKeys keys usage.WriteLine("and the client opens with no connection. A host given here connects instead of them."); usage.WriteLine("'at start' only opens the connection. What is typed once one is open follows from the"); usage.WriteLine("character's saved password and connect line — F5's 'login' row says which."); + // The slash commands, from the one table /help lists too (SlashCommands.All). + usage.WriteLine(); + usage.WriteLine("Slash commands (typed on the command line; /help lists them, the keys and how-tos in the app):"); + foreach (var command in SharpMUTerm.Client.Help.SlashCommands.All) + { + usage.WriteLine($" {command.Usage,-38}{command.Summary}"); + } + usage.WriteLine(); usage.WriteLine("In-app: Up/Down history · Ctrl+N next tab · Ctrl+W close · Ctrl+P palette · Ctrl+Q quit."); usage.WriteLine("Selection: drag across a pane's output to select it, Ctrl+C to copy."); diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 2a0b872e..5372d2b5 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -81,6 +81,16 @@ internal ComposeOverlay(ConsoleWindowSystem system, Func? spellin /// internal SpellChecker? Spelling => _edit is null ? _spelling : null; + /// ⌥W in a post with no dictionary: the host offers to download one. + internal event EventHandler? DictionaryWanted; + + /// Forgets the dictionary (or that there was none), so the next opening looks again — after a download. + internal void ForgetSpelling() + { + _spellingOpened = false; + _spelling = null; + } + /// Raised when ⌃S sends. The host decides where it goes and what it does about failure. internal event EventHandler? Send; @@ -331,6 +341,14 @@ private void OnKey(object? sender, KeyPressedEventArgs e) return; } + // ⌥W with no dictionary is the way to one: the host closes this window (keeping the draft) and asks first. + if (alt && key.Key == ConsoleKey.W && _edit is null) + { + e.Handled = true; + DictionaryWanted?.Invoke(this, EventArgs.Empty); + return; + } + // ⌥P shows the post as it will be sent, and hides it again. Alt by the same rule; P for preview, and nothing in // MacroKeys.AppShortcuts, the bar's table or a host's reserved chords takes it. A MOO edit is sent as its lines, // which the editor already shows, so it has no preview. diff --git a/src/SharpMUTerm.Tui/DictionaryOffer.cs b/src/SharpMUTerm.Tui/DictionaryOffer.cs new file mode 100644 index 00000000..f2030aa5 --- /dev/null +++ b/src/SharpMUTerm.Tui/DictionaryOffer.cs @@ -0,0 +1,32 @@ +using SharpMUTerm.Client.Modals; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// The dictionary offer in cells: the question, what would be fetched from where and saved where, and the two keys. +/// Drawn from , the model the window's native offer draws. +/// +internal static class DictionaryOffer +{ + /// The width the offer asks for. + internal const int PreferredWidth = 72; + + internal static List Render(DictionaryOfferModel model, int width) + { + width = Math.Max(30, width); + var lines = new List + { + $"[bold {ScreenPalette.Value}]{Escape(model.Question)}[/]", + string.Empty, + }; + foreach (var sentence in model.Lines) + { + lines.AddRange(HelpSurface.Wrap(sentence, width - 1).Select(l => $"[{ScreenPalette.Label}]{Escape(l)}[/]")); + } + + lines.Add(string.Empty); + lines.Add($"[{ScreenPalette.Accent}]⏎[/] [{ScreenPalette.Value}]download[/] [{ScreenPalette.Accent}]Esc[/] [{ScreenPalette.Label}]not now[/]"); + return lines; + } +} diff --git a/src/SharpMUTerm.Tui/HelpSurface.cs b/src/SharpMUTerm.Tui/HelpSurface.cs new file mode 100644 index 00000000..e232bc3e --- /dev/null +++ b/src/SharpMUTerm.Tui/HelpSurface.cs @@ -0,0 +1,287 @@ +using SharpMUTerm.Client.Modals; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// Help in cells: a search line, the matching rows of under their headings, and a how-to page +/// in place of the list once one is chosen. The state is the reader's (what is typed, which row, which page, how far +/// down it); what it lists is the model's , so the window's native help lists the same rows +/// for the same query. hosts it in a , which is sized once when it +/// opens, so always draws exactly the rows it is given. +/// +internal sealed class HelpSurface +{ + /// The width help asks for; the overlay narrows it on a small terminal. + internal const int PreferredWidth = 96; + + public HelpSurface(HelpModel model, string query = "", string? topic = null) + { + Model = model; + Query = query; + Topic = model.Topic(topic)?.Id; + } + + public HelpModel Model { get; } + + public string Query { get; private set; } + + /// The row selected in the filtered list. + public int Selected { get; private set; } + + /// The page showing, or null for the list. + public string? Topic { get; private set; } + + /// How far down the page is scrolled, in rows. + public int Scroll { get; private set; } + + /// The rows listed for the query. + public IReadOnlyList Rows => Model.View(Query); + + /// The index in of the selected row, or -1. + public int SelectedEntry => IndexOf(Model, Rows, Selected); + + /// Esc: a page goes back to the list (true, help stays open); from the list help closes (false). + public bool Back() + { + if (Topic is null) + { + return false; + } + + Topic = null; + Scroll = 0; + return true; + } + + /// + /// A key. Returns the entry index ⏎ chose when it is a command or a key to act on (help then closes), -1 when help + /// stays open (typing, moving, opening a page). + /// + public int Key(ConsoleKeyInfo key) + { + var rows = Rows; + if (Topic is not null) + { + Scroll = key.Key switch + { + ConsoleKey.UpArrow => Math.Max(0, Scroll - 1), + ConsoleKey.DownArrow => Scroll + 1, + ConsoleKey.PageUp => Math.Max(0, Scroll - 10), + ConsoleKey.PageDown or ConsoleKey.Spacebar => Scroll + 10, + ConsoleKey.Home => 0, + _ => Scroll, + }; + if (key.Key is ConsoleKey.Backspace or ConsoleKey.LeftArrow) + { + Back(); + } + + return -1; + } + + switch (key.Key) + { + case ConsoleKey.UpArrow: + Selected = rows.Count == 0 ? 0 : (Selected - 1 + rows.Count) % rows.Count; + return -1; + case ConsoleKey.DownArrow: + Selected = rows.Count == 0 ? 0 : (Selected + 1) % rows.Count; + return -1; + case ConsoleKey.PageUp: + Selected = Math.Max(0, Selected - 10); + return -1; + case ConsoleKey.PageDown: + Selected = Math.Min(Math.Max(0, rows.Count - 1), Selected + 10); + return -1; + case ConsoleKey.Backspace: + if (Query.Length > 0) + { + Query = Query[..^1]; + Selected = 0; + } + + return -1; + case ConsoleKey.Enter: + if (Selected < rows.Count) + { + var entry = rows[Selected]; + if (entry.Kind == HelpKind.Topic) + { + Topic = entry.Target; + Scroll = 0; + return -1; + } + + return entry.Target.Length == 0 ? -1 : SelectedEntry; + } + + return -1; + } + + if (key.KeyChar >= ' ' && !char.IsControl(key.KeyChar) + && (key.Modifiers & (ConsoleModifiers.Control | ConsoleModifiers.Alt)) == 0 + && Query.Length < 40) + { + Query += key.KeyChar; + Selected = 0; + } + + return -1; + } + + /// What help draws now, in rows of . + public List Render(int width, int rows) => Render(Model, Query, Selected, Topic, Scroll, width, rows); + + /// + /// Help for , with row marked — or page + /// scrolled rows down — in exactly rows. + /// + internal static List Render(HelpModel model, string query, int selected, string? topic, int scroll, int width, int rows) + { + width = Math.Max(30, width); + rows = Math.Max(8, rows); + var lines = new List(); + var body = rows - 3; + if (model.Topic(topic) is { } page) + { + lines.Add($"[{ScreenPalette.Accent}]HELP ▸[/] [bold {ScreenPalette.Value}]{Escape(page.Title)}[/]" + + $"[{ScreenPalette.Label}] · {Escape(page.Summary)}[/]"); + lines.Add(string.Empty); + var text = page.Paragraphs.SelectMany(l => Wrap(l, width - 3)).ToList(); + var top = Math.Clamp(scroll, 0, Math.Max(0, text.Count - body)); + foreach (var line in text.Skip(top).Take(body)) + { + lines.Add($" [{ScreenPalette.Value}]{Escape(line)}[/]"); + } + + Pad(lines, rows - 1); + var more = top + body < text.Count ? "↓ more · " : string.Empty; + lines.Add($"[{ScreenPalette.Label}]{more}↑↓ PgUp PgDn scroll · Esc back to the list[/]"); + return lines; + } + + var view = model.View(query); + var count = view.Count == model.Entries.Count ? $"{view.Count} entries" : $"{view.Count} of {model.Entries.Count}"; + lines.Add(SpreadLR( + $"[{ScreenPalette.Accent}]HELP[/] [{ScreenPalette.Label}]search[/] [{ScreenPalette.Value}]{Escape(query)}▏[/]", + $"[{ScreenPalette.Label}]{count}[/]", + width)); + lines.Add(string.Empty); + + // Each row is a heading (when its section starts) and the entry; the window of rows is chosen so the selected + // entry is on it, then the headings are drawn above the entries they lead. + var drawn = new List<(string Line, int Entry)>(); + var titleWidth = Math.Clamp(view.Count == 0 ? 16 : view.Max(e => e.Title.Length) + 1, 16, Math.Max(16, width * 45 / 100)); + string? section = null; + for (var i = 0; i < view.Count; i++) + { + var entry = view[i]; + if (entry.Section != section) + { + section = entry.Section; + drawn.Add(($"[{ScreenPalette.Muted}]{Escape(section)}[/]", -1)); + } + + drawn.Add((Row(entry, i == selected, width, titleWidth), i)); + } + + if (view.Count == 0) + { + drawn.Add(($" [{ScreenPalette.Label}]{Escape(HelpModel.NoMatches)}[/]", -1)); + } + + var at = Math.Max(0, drawn.FindIndex(d => d.Entry == selected)); + var first = Math.Clamp(at - (body / 2), 0, Math.Max(0, drawn.Count - body)); + var shown = drawn.Skip(first).Take(body).ToList(); + if (shown.Count > 1 && shown[^1].Entry < 0 && first + shown.Count < drawn.Count) + { + // A heading on the last row would lead nothing on screen. + shown.RemoveAt(shown.Count - 1); + } + + lines.AddRange(shown.Select(d => d.Line)); + Pad(lines, rows - 1); + lines.Add($"[{ScreenPalette.Label}]type to search · ↑↓ pick · ⏎ opens, places or runs it · Esc closes[/]"); + return lines; + } + + private static string Row(HelpEntry entry, bool selected, int width, int titleWidth) + { + var mark = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; + var key = entry.Key.Length == 0 ? string.Empty : entry.Key; + var title = Fit(entry.Title, titleWidth); + var room = Math.Max(0, width - 3 - titleWidth - (key.Length == 0 ? 0 : key.Length + 2)); + var detail = Fit(entry.Detail, room); + var weight = selected ? "bold " : string.Empty; + var left = $"{mark} [{weight}{ScreenPalette.Value}]{Escape(title.PadRight(titleWidth))}[/] [{ScreenPalette.Label}]{Escape(detail)}[/]"; + return key.Length == 0 ? left : SpreadLR(left, $"[{ScreenPalette.Accent}]{Escape(key)}[/]", width); + } + + private static string Fit(string text, int width) => + width <= 0 ? string.Empty : text.Length <= width ? text : width == 1 ? "…" : text[..(width - 1)] + "…"; + + private static void Pad(List lines, int count) + { + while (lines.Count < count) + { + lines.Add(string.Empty); + } + + if (lines.Count > count) + { + lines.RemoveRange(count, lines.Count - count); + } + } + + /// Plain text broken at spaces into rows no wider than ; an empty line stays one. + internal static IEnumerable Wrap(string text, int width) + { + if (text.Length <= width) + { + yield return text; + yield break; + } + + var line = string.Empty; + foreach (var word in text.Split(' ')) + { + if (line.Length > 0 && line.Length + 1 + word.Length > width) + { + yield return line; + line = string.Empty; + } + + line = line.Length == 0 ? word : line + " " + word; + while (line.Length > width) + { + yield return line[..width]; + line = line[width..]; + } + } + + if (line.Length > 0) + { + yield return line; + } + } + + /// The index in 's entries of row of . + internal static int IndexOf(HelpModel model, IReadOnlyList view, int row) + { + if (row < 0 || row >= view.Count) + { + return -1; + } + + for (var i = 0; i < model.Entries.Count; i++) + { + if (ReferenceEquals(model.Entries[i], view[row])) + { + return i; + } + } + + return -1; + } +} diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index f5feef89..2f30858e 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -20,6 +20,7 @@ internal sealed class ListOverlay private Func>? _render; private Func? _key; private Func? _escape; + private Action? _closed; private ScreenTheme _scheme; @@ -49,13 +50,15 @@ public ListOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) /// Asked first when Esc is pressed: true when the surface took it (to leave a sub-mode of its own — a name being /// typed, a delete awaiting its answer) and stays open; with none, or false, Esc closes. /// + /// Told once when this surface closes, however it does (not when a later one replaces it). public void Open( string mode, string title, Func> render, Func key, int? width = null, - Func? escape = null) + Func? escape = null, + Action? closed = null) { if (_window is not null) { @@ -65,6 +68,7 @@ public void Open( _render = render; _key = key; _escape = escape; + _closed = closed; var desktop = _system.DesktopDimensions; var widest = Math.Clamp(desktop.Width - 8, 44, 110); var outer = width is { } asked ? Math.Clamp(asked + 4, 24, widest) : widest; @@ -89,7 +93,9 @@ public void Open( // A window closed because the next surface replaced it must not clear the next one's state. if (_window == built) { + var closed = _closed; Reset(); + closed?.Invoke(); } }) .Build(); @@ -184,6 +190,7 @@ private void Reset() _render = null; _key = null; _escape = null; + _closed = null; Mode = null; } } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs index 4ba87a0d..c3e5ce81 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs @@ -33,6 +33,8 @@ private T Drawing(string surface, string key, T model) : surface == SurfaceCatalog.History ? _historySearch.Model : surface == SurfaceCatalog.Layouts ? (_layoutsView.IsOpen && _layoutsView.Mode == "layouts" && LayoutsKey() is { } key2 ? LayoutsModelFor(key2) : null) : surface == SurfaceCatalog.Welcome ? (_welcomeView.IsOpen ? _welcome?.Model : null) + : surface == SurfaceCatalog.Help ? CellHelp?.Model + : surface == SurfaceCatalog.Dictionary ? (_helpView.IsOpen && _helpView.Mode == "dictionary" ? _dictionaryOffer : null) : _drawnModels.TryGetValue((surface, key), out var model) ? model : null; /// A click on a header link, as the header's own handler receives it. diff --git a/src/SharpMUTerm.Tui/Program.cs b/src/SharpMUTerm.Tui/Program.cs index eda9ac30..dfdc21ef 100644 --- a/src/SharpMUTerm.Tui/Program.cs +++ b/src/SharpMUTerm.Tui/Program.cs @@ -226,7 +226,8 @@ internal static int RunLive( packages: new PackageStore(PackageStore.PathFor(ConfigurationStore.DefaultPath)) { Logger = diagnostics.For("SharpMUTerm.Packages") }, scriptStoreRoot: Path.Combine(Path.GetDirectoryName(ConfigurationStore.DefaultPath)!, "script-data"), spelling: () => OpenDictionary(loadLogger), - autoLayout: true); + autoLayout: true, + dictionaries: DictionariesFolder); ready?.Invoke(liveApp); // A telnet:// link on the command line is followed once the loop runs, the way /connect host port would be; @@ -392,9 +393,12 @@ internal static string UsageText /// The composer's dictionary: dictionaries/ beside config.json first, then the system's, in the /// locale's language. Words added with ⌥W go to dictionaries/user-words.txt. /// + /// The client's own dictionaries folder, beside config.json: where the composer looks first and a download goes. + private static string DictionariesFolder => Path.Combine(Path.GetDirectoryName(ConfigurationStore.DefaultPath)!, "dictionaries"); + private static SpellChecker? OpenDictionary(ILogger logger) { - var own = Path.Combine(Path.GetDirectoryName(ConfigurationStore.DefaultPath)!, "dictionaries"); + var own = DictionariesFolder; var checker = SpellChecker.Find(SpellChecker.SearchFolders(own), SpellChecker.PreferredLanguage(), Path.Combine(own, "user-words.txt")); if (checker is null) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs new file mode 100644 index 00000000..5794e088 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs @@ -0,0 +1,402 @@ +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Accessibility; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Tui; + +/// +/// Help (⌃P ▸ Help, /help [words]) and the spelling dictionary offer (F1's ⌥W with no dictionary, ⌃P ▸ +/// Get a spelling dictionary). Both are one Client model drawn as a cell here and as +/// a native modal in a host that has them (), and every gesture in either ends in +/// one method: and . +/// +/// Help is generated, not written twice. The slash commands are SlashCommands.All, the table --help +/// prints; the keys are the command registry's for this host and state plus ; only the how-to +/// pages are prose. A command chosen in help is put on the command line and never sent; a key chosen runs its command. +/// +/// +/// A dictionary is fetched only when asked, and the offer is the consent. It says what, from where, under what +/// licence and into which folder before anything is downloaded; the files come from a pinned https address and are +/// checked against pinned SHA-256s (). The folder is the caller's +/// (dictionaries:, the save:/logRoot: family): null in a test and a snapshot, which then refuse. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The cell help, while it is open; null otherwise. + private HelpSurface? _help; + + /// Help's and the dictionary offer's cell modal. + private readonly ListOverlay _helpView; + + /// The client's own dictionaries/ folder, or null in a run that may write none. + private readonly string? _dictionariesRoot; + + /// The dictionary offer's model while the cell offer is open. + private DictionaryOfferModel? _dictionaryOffer; + + /// Whether F1 was closed to show the offer, so it opens again (with its draft) when the offer closes. + private bool _reopenComposerAfterOffer; + + /// A download is under way. + private bool _dictionaryDownloading; + + /// + /// Fetches one dictionary file, for the tests; null uses . Handed the + /// address and the cap. + /// + internal Func>? DictionaryFetch { get; set; } + + /// The last download, for the tests to await. + internal Task? DictionaryTask { get; private set; } + + /// The dictionary a test fetches in place of the reader's language's pinned one. + internal DictionarySource? DictionaryToFetch { get; set; } + + /// Whether help is open, in cells or natively. + internal bool HelpIsOpen => (_helpView.IsOpen && _helpView.Mode == "help") || NativeModalOf(SurfaceCatalog.Help) is not null; + + /// Whether the dictionary offer is open, in cells or natively. + internal bool DictionaryOfferOpen => + (_helpView.IsOpen && _helpView.Mode == "dictionary") || NativeModalOf(SurfaceCatalog.Dictionary) is not null; + + /// What the cell help or offer shows, for a test. + internal IReadOnlyList HelpLines => _helpView.Lines; + + /// Feeds a key to the cell help or offer. + internal void SimulateHelpKey(ConsoleKeyInfo key) => _helpView.SimulateKey(key); + + /// Types into the cell help's search. + internal void SimulateHelpTyping(string text) + { + foreach (var c in text) + { + SimulateHelpKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + } + + /// The cell help's state, for a test; null while it is shut. + internal HelpSurface? CellHelp => _helpView.IsOpen && _helpView.Mode == "help" ? _help : null; + + /// The native help's session while one is open, for the tests. + internal HelpSession? NativeHelp => _nativeModal as HelpSession; + + /// The native offer's session while one is open, for the tests. + internal DictionaryOfferSession? NativeDictionaryOffer => _nativeModal as DictionaryOfferSession; + + /// Help for this host and this moment: the registry's keys as ⌃P lists them now. + internal HelpModel HelpModelNow() => HelpModel.Build( + BuildCatalog(), + Host.Keys.Newline.Glyph, + Host.Keys.Reserved.Select(r => (r.Chord.Glyph, r.Action)).ToArray()); + + /// + /// ⌃P ▸ Help and /help: opens help, typed into its search, or closes it. With no + /// screen to read (--plain) the matching rows are said as lines instead, since a modal would take the typing. + /// + private void ShowHelp(string query = "", string? topic = null) + { + if (NativeModalOf(SurfaceCatalog.Help) is { } native) + { + CloseNativeModal(native); + return; + } + + if (HelpIsOpen) + { + _helpView.Close(); + return; + } + + var model = HelpModelNow(); + if (!Host.ScreenIsSeen) + { + SayHelp(model, query); + return; + } + + if (ComposerIsInTheWay("help") || (AnyOverlayOpen && Refuse($"close {OpenOverlayName()} first"))) + { + return; + } + + if (TryOpenNativeHelp(model, query, topic)) + { + return; + } + + var help = new HelpSurface(model, query, topic); + _help = help; + var rows = Math.Clamp(_system.DesktopDimensions.Height - 6, 10, 30); + _helpView.Open( + "help", + "Help", + width => + { + Drawing(SurfaceCatalog.Help, string.Empty, help.Model); + return help.Render(width, rows); + }, + HelpKeyPressed, + width: HelpSurface.PreferredWidth, + escape: () => _help?.Back() == true); + } + + /// A key in the cell help: ⏎ on a command or a key closes help and acts on it. + private bool HelpKeyPressed(ConsoleKeyInfo key) + { + if (_help is not { } help) + { + return false; + } + + var chosen = help.Key(key); + if (chosen < 0) + { + return true; + } + + _helpView.Close(); + RunHelpEntry(help.Model, chosen); + return true; + } + + /// + /// The one place a chosen help row is acted on, from either host: a slash command is put on the command line (the + /// line already there goes into history first, as a grab's does) and never sent; a key runs its registry command. + /// + internal void RunHelpEntry(HelpModel model, int index) + { + if (index < 0 || index >= model.Entries.Count) + { + return; + } + + var entry = model.Entries[index]; + switch (entry.Kind) + { + case HelpKind.Command: + PlaceGrab(ActiveBar(), entry.Target); + UpdateInputChrome(); + break; + case HelpKind.Key when entry.Target.Length > 0: + if (!DispatchCommand(entry.Target)) + { + RefuseCommand($"{Snippet(entry.Title)} is not available here now"); + } + + break; + } + } + + /// Opens help in the host's controls; false when the host has none. + private bool TryOpenNativeHelp(HelpModel model, string query, string? topic) + { + if (NativeModalsHost is not { } native) + { + return false; + } + + HelpSession? session = null; + session = new HelpSession( + model, + ThemeIsDark(), + index => OnUiThread(() => RunHelpEntry(model, index)), + () => OnUiThread(() => NativeModalClosed(session!))) + { + Theme = _theme.Clone(), + InitialQuery = query, + InitialTopic = model.Topic(topic)?.Id, + }; + ShowNativeModal(native, session); + return true; + } + + /// Help said as lines, for a host with no screen to read: the matching rows, or the page they name. + private void SayHelp(HelpModel model, string query) + { + var lines = new List(); + var rows = model.View(query); + if (rows.Count == 1 && rows[0].Kind == HelpKind.Topic && model.Topic(rows[0].Target) is { } page) + { + lines.Add(page.Title); + lines.AddRange(page.Lines.Where(l => l.Length > 0)); + } + else + { + lines.AddRange(rows.Count == 0 + ? [HelpModel.NoMatches] + : rows.Select(r => string.Join(" — ", new[] { r.Key, r.Title, r.Detail }.Where(p => p.Length > 0)))); + } + + foreach (var line in lines) + { + AppendWindowLine(ActiveWindowId(), $"[dim]*** {MarkupText.Escape(line)}[/]"); + Host.Announcer?.Announce(line, AnnouncementKind.Notice); + } + } + + /// /help [words]. + private void HelpCommand(string argument) => ShowHelp(argument.Trim()); + + // ── the spelling dictionary ───────────────────────────────────────────────────────────────── + + /// The client's own dictionaries folder, or null in a run that keeps none (a test, a snapshot). + private string? DictionariesRoot => _dictionariesRoot; + + /// Whether the client's own folder holds no dictionary, so ⌃P offers to get one. + private bool NoOwnDictionary => _dictionariesRoot is not null && !DictionaryDownload.Holds(_dictionariesRoot); + + /// The offer for this locale and this run. + internal DictionaryOfferModel DictionaryOfferNow() + { + var source = DictionaryDownload.For(SpellChecker.PreferredLanguage()); + return new DictionaryOfferModel( + source.Name, + source.Language, + source.Origin, + source.Licence, + source.Dic.Host, + $"about {source.Bytes / 100_000 / 10.0:0.0} MB".Replace(',', '.'), + DictionariesRoot, + DictionaryDownload.Holds(DictionariesRoot)); + } + + /// + /// F1's ⌥W with no dictionary (in either host) and ⌃P ▸ Get a spelling dictionary: F1 closes, keeping its draft, and + /// the offer opens; F1 comes back when the offer closes. Nothing is fetched here. + /// + internal void OfferDictionary() + { + if (DictionaryOfferOpen) + { + return; + } + + if (_dictionaryDownloading) + { + RefuseCommand("a dictionary is already being downloaded"); + return; + } + + if (ComposerOpen) + { + _reopenComposerAfterOffer = true; + CloseComposer(); + } + + if (AnyOverlayOpen && Refuse($"close {OpenOverlayName()} first")) + { + _reopenComposerAfterOffer = false; + return; + } + + var model = DictionaryOfferNow(); + if (NativeModalsHost is { } native) + { + DictionaryOfferSession? session = null; + session = new DictionaryOfferSession( + model, + ThemeIsDark(), + () => OnUiThread(InstallDictionary), + () => OnUiThread(() => + { + NativeModalClosed(session!); + DictionaryOfferClosed(); + })) + { + Theme = _theme.Clone(), + }; + ShowNativeModal(native, session); + return; + } + + _dictionaryOffer = model; + _helpView.Open( + "dictionary", + "Spelling dictionary", + width => DictionaryOffer.Render(Drawing(SurfaceCatalog.Dictionary, string.Empty, model), width), + key => + { + if (key.Key != ConsoleKey.Enter) + { + return true; + } + + _helpView.Close(); + InstallDictionary(); + return true; + }, + width: DictionaryOffer.PreferredWidth, + closed: DictionaryOfferClosed); + } + + /// The offer closed, however it did: F1 comes back if the offer closed it. + private void DictionaryOfferClosed() + { + _dictionaryOffer = null; + if (_reopenComposerAfterOffer) + { + _reopenComposerAfterOffer = false; + ToggleComposer(); + } + } + + /// + /// Yes, from either host's offer: downloads the dictionary into the client's folder off the UI thread, and says + /// when it is in (or why not). The next F1 opens it; an F1 already open is not re-marked. + /// + internal void InstallDictionary() + { + if (DictionariesRoot is not { } root) + { + RefuseCommand("this run keeps no dictionaries folder, so nothing was downloaded"); + return; + } + + if (_dictionaryDownloading) + { + return; + } + + var source = DictionaryToFetch ?? DictionaryDownload.For(SpellChecker.PreferredLanguage()); + var fetch = DictionaryFetch ?? DictionaryDownload.DownloadAsync; + _dictionaryDownloading = true; + Notice($"Downloading the {source.Language} dictionary from {source.Dic.Host}…", MessageSeverity.Info, key: "dictionary"); + DictionaryTask = Task.Run(async () => + { + string? problem; + try + { + problem = await DictionaryDownload.InstallAsync(root, source, fetch).ConfigureAwait(false); + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidOperationException) + { + problem = ex.Message; + } + + OnUiThread(() => + { + _dictionaryDownloading = false; + if (problem is not null) + { + RefuseCommand(problem); + return; + } + + ForgetComposerSpelling(); + Notice($"{source.Name} is installed · F1 checks spelling with it", MessageSeverity.Info, key: "dictionary"); + }); + }); + } + + /// Drops the dictionary the composer opened (or found missing), so the next F1 looks again. + private void ForgetComposerSpelling() + { + _composerSpellingOpened = false; + _composerSpelling = null; + _composer.ForgetSpelling(); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs index 6cf3d79d..ccd5d75a 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs @@ -1,5 +1,7 @@ using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Commands; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; using SharpMUTerm.Core.Session; @@ -21,6 +23,43 @@ internal sealed partial class SharpMUTermApp /// The worlds this run has already been told about, by name. private readonly HashSet _joinWrapsSuggested = new(StringComparer.OrdinalIgnoreCase); + /// + /// The worlds whose pane is narrower than their server wraps right now, by name: what ⌃P suggests and F5 recommends + /// for as long as it holds. Written by with each pane width reported to a server. + /// + private readonly Dictionary _raggedWraps = new(StringComparer.OrdinalIgnoreCase); + + /// The ragged worlds, for ⌃P; null when there are none. + internal IReadOnlyList? RaggedWraps() => + _raggedWraps.Count == 0 + ? null + : _raggedWraps.Values.Where(r => WorldNamed(r.World) is { JoinWrappedLines: false }).OrderBy(r => r.World, StringComparer.OrdinalIgnoreCase).ToArray(); + + /// What F5 says beside join wraps for : a recommendation while it is ragged. + internal string? JoinWrapsAdvice(WorldDefinition world) => + !world.JoinWrappedLines && _raggedWraps.TryGetValue(world.Name, out var ragged) + ? $"recommended · wraps at {ragged.Column}, pane is {ragged.PaneWidth}" + : null; + + /// + /// Records whether 's pane ( wide) is narrower than the column + /// its server wraps at, by the same rule the notice uses. A pane that has caught up, or a world that joins, clears it. + /// + internal void NoteRaggedWraps(string world, int? column, int paneWidth) + { + if (column is { } wrap && paneWidth > 0 && paneWidth < wrap - 2 && WorldNamed(world) is { JoinWrappedLines: false }) + { + _raggedWraps[world] = new RaggedWrap(world, wrap, paneWidth); + } + else + { + _raggedWraps.Remove(world); + } + } + + private WorldDefinition? WorldNamed(string name) => + _config.Worlds.FirstOrDefault(w => string.Equals(w.Name, name, StringComparison.OrdinalIgnoreCase)); + /// /// Says, once per world, that 's pane is narrower than its server wraps — when the wrap /// column is known, the world does not join wraps, and the pane is at least a few columns short of it. Called with @@ -28,6 +67,7 @@ internal sealed partial class SharpMUTermApp /// private void SuggestJoinWraps(WorldSession session, int paneWidth) { + NoteRaggedWraps(session.World.Name, session.ServerWrapColumn, paneWidth); if (session.World.JoinWrappedLines || session.ServerWrapColumn is not { } column || paneWidth <= 0 @@ -60,6 +100,8 @@ private bool JoinWrapsFor(string worldName) SaveConfiguration(); } + _raggedWraps.Remove(world.Name); + Notice($"{Snippet(world.Name)} joins its wrapped lines from the next line · F5 ▸ join wraps", MessageSeverity.Info); return true; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs index 4536af72..4b5b5ff8 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs @@ -119,6 +119,7 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, } }), AddWord = word => OnUiThread(() => AddComposerWord(word)), + GetDictionary = () => OnUiThread(OfferDictionary), Proportional = ComposerFaceOf(ComposeDraftKey(ActiveWindowId())), ChooseFace = ChooseComposerFace(ComposeDraftKey(ActiveWindowId())), Closed = body => OnUiThread(() => diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs index 58f69dcb..9f91b082 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs @@ -62,6 +62,8 @@ internal sealed partial class SharpMUTermApp SurfaceCatalog.History => "the history search", SurfaceCatalog.Layouts => "the layouts", SurfaceCatalog.Welcome => "the welcome", + SurfaceCatalog.Help => "help", + SurfaceCatalog.Dictionary => "the dictionary offer", null => null, _ => "what is open", }; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs index 51c57933..b871d4bd 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs @@ -86,6 +86,7 @@ private void ApplyTheme(Theme theme) _sendMenu.Scheme = _screens; _layoutsView.Scheme = _screens; _welcomeView.Scheme = _screens; + _helpView.Scheme = _screens; SchemePopups(); _header.BackgroundColor = ToColor(theme.StatusBackground); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 6c896f39..47f78eba 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -689,7 +689,8 @@ public SharpMUTermApp( MediaCache? media = null, PackageStore? packages = null, string? scriptStoreRoot = null, - Func? spelling = null) + Func? spelling = null, + string? dictionaries = null) : this( config, ClientHost.ForHarness(capabilities, driver, focusReporting, openUrl, clipboard), @@ -704,7 +705,8 @@ public SharpMUTermApp( media, packages, scriptStoreRoot, - spelling) + spelling, + dictionaries: dictionaries) { } @@ -727,9 +729,11 @@ public SharpMUTermApp( PackageStore? packages = null, string? scriptStoreRoot = null, Func? spelling = null, - bool autoLayout = false) + bool autoLayout = false, + string? dictionaries = null) { _spelling = spelling; + _dictionariesRoot = string.IsNullOrWhiteSpace(dictionaries) ? null : dictionaries; _autoLayout = autoLayout; var capabilities = host.Capabilities; Host = host; @@ -934,6 +938,8 @@ public SharpMUTermApp( _sendMenu = new ListOverlay(_system, _screens); _layoutsView = new ListOverlay(_system, _screens); _welcomeView = new ListOverlay(_system, _screens); + _helpView = new ListOverlay(_system, _screens); + _composer.DictionaryWanted += (_, _) => OnUiThread(OfferDictionary); _composer.Send += (_, result) => SendComposed(result); _composer.Closed += (_, result) => KeepComposeDraft(result); _quit = new QuitOverlay(_system, QuitFactsNow, Quit, QuitPromptClosed); @@ -1864,6 +1870,46 @@ public string RenderSnapshot(string? view = null) OpenMenu(); } + // Help, opened by the ⌃P entry itself: the list, and a how-to page (the one that names join wraps). + if (string.Equals(view, "help", StringComparison.OrdinalIgnoreCase)) + { + DispatchCommand(SharpMUTerm.Client.Commands.BuiltInCommands.HelpCommand); + } + + if (string.Equals(view, "help-topic", StringComparison.OrdinalIgnoreCase)) + { + ShowHelp(topic: "reading"); + } + + // The spelling dictionary offer, through its ⌃P entry. The demo keeps no dictionaries folder, so the offer says + // nothing can be saved in this run — the text a live client shows names the folder instead. + if (string.Equals(view, "dictionary-offer", StringComparison.OrdinalIgnoreCase)) + { + DispatchCommand(SharpMUTerm.Client.Commands.BuiltInCommands.DictionaryCommand); + } + + // A pane narrower than its game wraps, recorded through the writer the live size report uses: ⌃P suggests + // joining the world's wraps; `join-wraps-f5` is F5 recommending it beside the setting. + if (string.Equals(view, "join-wraps", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "join-wraps-f5", StringComparison.OrdinalIgnoreCase)) + { + if (_config.Worlds.Count > 0) + { + NoteRaggedWraps(_config.Worlds[0].Name, 78, 60); + } + + if (string.Equals(view, "join-wraps", StringComparison.OrdinalIgnoreCase)) + { + OpenMenu(); + } + else + { + _settings.OpenForSnapshot(ConsoleKey.F5, WorldsScreen()); + SyncInputWidth(); + return RenderFrame(); + } + } + // The ⌃B which-key panel over the demo workspace: what the arming timer opens when no key has // arrived by the time it fires. `prefix` is the terse strip on its own — the first thing an armed // prefix shows — and this is what follows it, so the two views are the whole of the display. The @@ -5070,6 +5116,14 @@ private void OnCommandEntered(InputBar bar, string command) _workspace.SetUnsentInput(windowId, AnyBarHasText()); RefreshTabTitles(); + // `/help [words]` opens help, searched for the words. + if (command.StartsWith("/help", StringComparison.OrdinalIgnoreCase) + && (command.Length == 5 || command[5] == ' ')) + { + HelpCommand(command[5..]); + return; + } + // `/web ` opens the in-TUI web view; everything else goes to the world. if (command.StartsWith("/web ", StringComparison.OrdinalIgnoreCase)) { @@ -5540,7 +5594,7 @@ private void ToggleHistorySearch() private bool AnyOverlayOpen => PaletteIsOpen || _settings.IsOpen || _quit.IsOpen || NativeModalOpen || _messageLog.IsOpen || _historySearch.IsOpen || _prefixPanel.IsOpen || ComposerOpen || _search.IsOpen || _gameData.IsOpen || _packageView.IsOpen || _sendMenu.IsOpen - || _layoutsView.IsOpen || _welcomeView.IsOpen; + || _layoutsView.IsOpen || _welcomeView.IsOpen || _helpView.IsOpen; /// /// Opens the ⌃F search surface, or closes it when the chord arrives again. @@ -5670,6 +5724,7 @@ private string OpenOverlayName() => : _search.IsOpen ? "the search surface" : _prefixPanel.IsOpen ? "the pane keys panel" : _welcomeView.IsOpen ? "the welcome" + : _helpView.IsOpen ? (_helpView.Mode == "dictionary" ? "the dictionary offer" : "help") : "what is open"; /// Whether either bar is holding unsent text — what the ✎ tab marker means. @@ -7660,7 +7715,8 @@ private ScreenBinding WorldsScreen(string fkey, bool onCharacters) session.Selection.SelectionIn(WorldsScreenRenderer.TriggerSetsPane), _system.DesktopDimensions.Height, info: true, - layouts: Layouts.All)); + layouts: Layouts.All, + joinWrapsAdvice: JoinWrapsAdvice)); } /// @@ -8323,7 +8379,9 @@ private CommandContext CommandState() Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId()), OutputSelected: HasOutputSelection, KeyClashes: KeyClashes.Count(Host.Keys, Macros()), - Floats: FloatRefs()); + Floats: FloatRefs(), + RaggedWraps: RaggedWraps(), + NoDictionary: NoOwnDictionary); } /// @@ -8804,6 +8862,12 @@ private bool RunBuiltInCommand(string id) case "term:tour": ToggleKeyTour(); return true; + case SharpMUTerm.Client.Commands.BuiltInCommands.HelpCommand: + ShowHelp(); + return true; + case SharpMUTerm.Client.Commands.BuiltInCommands.DictionaryCommand: + OfferDictionary(); + return true; case "term:package-install": ActiveBar().SetAndNotify("/package install "); return true; @@ -13274,6 +13338,7 @@ private void ReportPaneSizes() if (!session.IsConnected) { _sizeReports.Remove(session); + _raggedWraps.Remove(session.World.Name); continue; } diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 03f453ef..c100d881 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -28,6 +28,6 @@ internal static class SnapshotViews "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", - "welcome", "welcome-connect", "tour", + "welcome", "welcome-connect", "tour", "help", "help-topic", "dictionary-offer", "join-wraps", "join-wraps-f5", ]; } diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index e4e62262..89636b38 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -942,7 +942,8 @@ internal static List DetailColumn( string accent, ScreenFocus? focus = null, int height = 0, - IReadOnlyList? layouts = null) + IReadOnlyList? layouts = null, + Func? joinWrapsAdvice = null) { var all = layouts ?? BuiltInLayouts.All; var cursor = focus ?? ScreenFocus.None; @@ -1043,7 +1044,9 @@ world.GrabPrefix is { } grab WorldField("join wraps", Field( world.JoinWrappedLines ? $"[{Value}]{JoinWrapChoices[1]} lines the server wrapped[/]" - : $"[{Label}]{JoinWrapChoices[0]} · rows as the server sent them[/]", + : joinWrapsAdvice?.Invoke(world) is { } advice + ? $"[{Label}]{JoinWrapChoices[0]} · [/][{ScreenPalette.Caution}]{Escape(advice)}[/]" + : $"[{Label}]{JoinWrapChoices[0]} · rows as the server sent them[/]", cursor, selectedWorld, JoinWrapsField)), diff --git a/src/SharpMUTerm.Tui/WorldsScreenView.cs b/src/SharpMUTerm.Tui/WorldsScreenView.cs index 7c6c4b3a..fb573b2a 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenView.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenView.cs @@ -29,7 +29,8 @@ public static IWindowControl Build( int selectedSet = 0, int height = 0, bool info = false, - IReadOnlyList? layouts = null) + IReadOnlyList? layouts = null, + Func? joinWrapsAdvice = null) { // Both panes end in button rows, so a raw cursor can point past its list; resolving once here // keeps every block of the screen agreeing on which world and character are selected. @@ -69,7 +70,7 @@ public static IWindowControl Build( WorldsScreenRenderer.WorldsColumn(worlds, selectedWorld, focus, rows, info), scheme)); var detailCol = ScreenChrome.Stretch(ScreenChrome.Panel( WorldsScreenRenderer - .DetailColumn(worlds, triggerSets, selectedWorld, selectedCharacter, accent, focus, rows, layouts), + .DetailColumn(worlds, triggerSets, selectedWorld, selectedCharacter, accent, focus, rows, layouts, joinWrapsAdvice), scheme)); var body = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 4636e3f1..8e3cbeca 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -255,6 +255,8 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! (SurfaceCatalog.Layouts, "layouts"), (SurfaceCatalog.Welcome, "welcome"), (SurfaceCatalog.Welcome, "welcome-connect"), + (SurfaceCatalog.Help, "help"), + (SurfaceCatalog.Dictionary, "dictionary-offer"), }) { using var nativeDriver = new AvaloniaConsoleDriver(140, 36); @@ -686,6 +688,30 @@ await SameModal("welcome: layout and browse", "welcome", }); probed.Add(SurfaceCatalog.Welcome); + // Help: a slash command placed on the command line (sent nowhere), and a key's command run — each the entry the + // other host's ⏎ picks, through RunHelpEntry. + await SameModal("help: place a slash command", "help", + (app, m) => + { + var help = (HelpSession)m.Open(SurfaceCatalog.Help)!; + help.Choose(HelpEntryIndex(help.Model, e => e.Kind == HelpKind.Command && e.Title.StartsWith("/connect", StringComparison.Ordinal))); + }, + app => HelpKeysTo(app, e => e.Kind == HelpKind.Command && e.Title.StartsWith("/connect", StringComparison.Ordinal))); + await SameModal("help: run a key", "help", + (app, m) => + { + var help = (HelpSession)m.Open(SurfaceCatalog.Help)!; + help.Choose(HelpEntryIndex(help.Model, e => e.Kind == HelpKind.Key && e.Target == "layout:toggle-rail")); + }, + app => HelpKeysTo(app, e => e.Kind == HelpKind.Key && e.Target == "layout:toggle-rail")); + probed.Add(SurfaceCatalog.Help); + + // The dictionary offer: Download in a client that keeps no dictionaries folder refuses out loud in both. + await SameModal("dictionary: download", "dictionary-offer", + (app, m) => ((DictionaryOfferSession)m.Open(SurfaceCatalog.Dictionary)!).Accept(), + app => app.SimulateHelpKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); + probed.Add(SurfaceCatalog.Dictionary); + var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); // The tab overflow chip: an entry chosen from the window's menu and the same digit in the cell list bring the same // hidden tab forward. @@ -901,6 +927,31 @@ private static void LayoutsKeysTo(SharpMUTermApp app, string layoutId, ConsoleKe app.SimulateLayoutsKey(key); } + private static int HelpEntryIndex(HelpModel model, Func match) + { + for (var i = 0; i < model.Entries.Count; i++) + { + if (match(model.Entries[i])) + { + return i; + } + } + + throw new InvalidOperationException("no such help entry"); + } + + /// Moves the cell help's pointer down to the entry picks, then presses ⏎. + private static void HelpKeysTo(SharpMUTermApp app, Func match) + { + var target = HelpEntryIndex(app.CellHelp!.Model, match); + for (var i = 0; i < 500 && app.CellHelp!.SelectedEntry != target; i++) + { + app.SimulateHelpKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + } + + app.SimulateHelpKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + } + private static object ModelOf(ModalSession session) => session switch { QuitSession quit => quit.Model, @@ -908,6 +959,8 @@ private static void LayoutsKeysTo(SharpMUTermApp app, string layoutId, ConsoleKe HistorySession history => history.Model, LayoutsSession layouts => layouts.Model, WelcomeSession welcome => welcome.Model, + HelpSession help => help.Model, + DictionaryOfferSession offer => offer.Model, _ => throw new ArgumentException(session.GetType().Name), }; @@ -928,6 +981,7 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "screen=" + app.OpenSettingsKey, "layout=" + app.LiveLayoutId, "welcome=" + app.WelcomeIsOpen, + "help=" + app.HelpIsOpen + "/" + app.DictionaryOfferOpen, "quick=" + app.LastQuickMacro, "walk=" + app.WalkState, "rail=" + (app.BuildChromeOverlay().Sidebar.Collapsed ? "folded" : "open"), diff --git a/tests/SharpMUTerm.Client.Tests/HelpModelTests.cs b/tests/SharpMUTerm.Client.Tests/HelpModelTests.cs new file mode 100644 index 00000000..b7ca3289 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/HelpModelTests.cs @@ -0,0 +1,125 @@ +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Client.Help; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Tests; + +/// +/// In-app help (), the one table of slash commands it and --help read +/// (), the dictionary offer (), and the ⌃P suggestion to +/// join a world's server wraps. +/// +public class HelpModelTests +{ + private static HelpModel Model() => HelpModel.Build( + BuiltInCommands.Catalog(new Workspace(), Array.Empty(), null, new CommandContext()), + "⌥⏎", + [("⌃Q", "quits")]); + + [Test] + public async Task HelpListsHowTosThenSlashCommandsThenKeys() + { + var model = Model(); + var sections = model.Entries.Select(e => e.Section).Distinct().ToList(); + + await Assert.That(sections[0]).IsEqualTo(HelpModel.TopicsSection); + await Assert.That(sections[1]).IsEqualTo(HelpModel.CommandsSection); + await Assert.That(sections.Skip(2).All(s => s.StartsWith("KEYS", StringComparison.Ordinal))).IsTrue(); + await Assert.That(model.Entries.Count(e => e.Kind == HelpKind.Command)).IsEqualTo(SlashCommands.All.Count); + await Assert.That(model.Topics.Select(t => t.Id)).Contains("getting-started"); + await Assert.That(model.Entries.Any(e => e.Section == HelpModel.HostSection && e.Key == "⌥⏎")).IsTrue() + .Because("the host's newline is named as this host spells it"); + } + + [Test] + public async Task EveryKeyRowIsAKeyTheRegistryOffers() + { + var model = Model(); + var catalog = BuiltInCommands.Catalog(new Workspace(), Array.Empty(), null, new CommandContext()); + foreach (var entry in model.Entries.Where(e => e.Kind == HelpKind.Key && e.Target.Length > 0)) + { + var item = catalog.Single(i => i.Id == entry.Target); + await Assert.That(entry.Key).IsEqualTo(KeyGlyphs.Normalize(item.Key!)).Because(entry.Title); + } + } + + [Test] + public async Task TheSearchNarrowsByEveryWord_AndReadsAHowTosPage() + { + var model = Model(); + var connect = model.View("connect host"); + await Assert.That(connect).IsNotEmpty(); + await Assert.That(connect.Any(e => e.Title.StartsWith("/connect", StringComparison.Ordinal))).IsTrue(); + + // "wraps" is said on the reading page, not in its title: the page is still found. + await Assert.That(model.View("join wraps").Any(e => e.Kind == HelpKind.Topic && e.Target == "reading")).IsTrue(); + await Assert.That(model.View("zzqx")).IsEmpty(); + await Assert.That(model.View(string.Empty).Count).IsEqualTo(model.Entries.Count); + } + + [Test] + public async Task ChoosingAHowToKeepsHelpOpen_AndACommandEndsIt() + { + var model = Model(); + var chosen = new List(); + var closed = 0; + var session = new HelpSession(model, isDark: true, chosen.Add, () => closed++); + var topic = model.Entries.ToList().FindIndex(e => e.Kind == HelpKind.Topic); + var command = model.Entries.ToList().FindIndex(e => e.Kind == HelpKind.Command); + + await Assert.That(session.Choose(topic)).IsFalse(); + await Assert.That(session.IsEnded).IsFalse(); + await Assert.That(session.Choose(command)).IsTrue(); + await Assert.That(chosen).IsEquivalentTo(new[] { command }); + await Assert.That(session.IsEnded).IsTrue(); + } + + [Test] + public async Task TheSlashTableNamesEachCommandOnce_WithAUsageThatStartsWithIt() + { + await Assert.That(SlashCommands.Names.Distinct().Count()).IsEqualTo(SlashCommands.Names.Count); + foreach (var command in SlashCommands.All) + { + await Assert.That(command.Usage.StartsWith(command.Name, StringComparison.Ordinal)).IsTrue().Because(command.Usage); + await Assert.That(command.Summary).IsNotEmpty(); + } + } + + [Test] + public async Task TheDictionaryOfferSaysWhereItFetchesFromAndWhereItSaves() + { + var model = new DictionaryOfferModel("English (US)", "en_US", "LibreOffice", "MIT-like", "raw.githubusercontent.com", "about 0.6 MB", "/home/a/dictionaries", false); + var text = string.Join("\n", model.Lines); + await Assert.That(text).Contains("raw.githubusercontent.com"); + await Assert.That(text).Contains("/home/a/dictionaries"); + + var none = model with { Folder = null }; + await Assert.That(string.Join("\n", none.Lines)).Contains("nothing can be saved"); + } + + [Test] + public async Task F1sKeyRowOffersADictionaryWhenThereIsNone() + { + var keys = ComposerModel.KeysFor(ComposerPlace.FullScreen, false, false, true, armed: true); + await Assert.That(keys.Any(k => k.Key == "⌥W" && k.Label == ComposerModel.GetDictionary)).IsTrue(); + var with = ComposerModel.KeysFor(ComposerPlace.FullScreen, false, true, true, armed: true); + await Assert.That(with.Any(k => k.Key == "⌥W" && k.Label == "add word")).IsTrue(); + } + + [Test] + public async Task ARaggedWorldIsSuggested_AndItsEntryNamesTheWorld() + { + var context = new CommandContext(RaggedWraps: [new RaggedWrap("Aetherfall", 78, 60)]); + var suggested = CommandPaletteModel.Suggested(context); + await Assert.That(suggested).Contains(BuiltInCommands.JoinWraps("Aetherfall")); + + var catalog = BuiltInCommands.Catalog(new Workspace(), Array.Empty(), null, context); + var item = catalog.Single(i => i.Id == BuiltInCommands.JoinWraps("Aetherfall")); + await Assert.That(item.Title).IsEqualTo("Join server wraps for Aetherfall"); + await Assert.That(CommandPaletteModel.Suggested(new CommandContext())).DoesNotContain(BuiltInCommands.JoinWraps("Aetherfall")); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/DictionaryDownloadTests.cs b/tests/SharpMUTerm.Core.Tests/DictionaryDownloadTests.cs new file mode 100644 index 00000000..1d14206a --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/DictionaryDownloadTests.cs @@ -0,0 +1,100 @@ +using System.Security.Cryptography; +using System.Text; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Tests; + +/// +/// The spelling dictionary fetched when the player asks (): https only, capped, checked +/// against a pinned SHA-256 before anything is written, and found by once it is. +/// +public class DictionaryDownloadTests +{ + private static readonly byte[] Aff = Encoding.UTF8.GetBytes("SET UTF-8\n"); + private static readonly byte[] Dic = Encoding.UTF8.GetBytes("3\nhello\nworld\npose\n"); + + private static string Sha(byte[] bytes) => Convert.ToHexStringLower(SHA256.HashData(bytes)); + + private static DictionarySource Source(string scheme = "https", string? dicSha = null) => new( + "en_TEST", "English (test)", "a test", "public domain", + new Uri($"{scheme}://example.org/en_TEST.aff"), Sha(Aff), + new Uri($"{scheme}://example.org/en_TEST.dic"), dicSha ?? Sha(Dic), + Aff.Length + Dic.Length); + + private static Task Serve(Uri uri, long cap, CancellationToken token) => + Task.FromResult(uri.AbsolutePath.EndsWith(".aff", StringComparison.Ordinal) ? Aff : Dic); + + private static string Folder() => Path.Combine(Path.GetTempPath(), "smt-dict-" + Guid.NewGuid().ToString("N")); + + [Test] + public async Task AFetchedPairIsWrittenAndFoundBySpelling() + { + var folder = Folder(); + try + { + await Assert.That(await DictionaryDownload.InstallAsync(folder, Source(), Serve)).IsNull(); + await Assert.That(DictionaryDownload.Holds(folder)).IsTrue(); + await Assert.That(Directory.GetFiles(folder, "*.new")).IsEmpty(); + var spelling = SpellChecker.Find([folder], "en_TEST", null); + await Assert.That(spelling).IsNotNull(); + await Assert.That(spelling!.Check("hello")).IsTrue(); + } + finally + { + if (Directory.Exists(folder)) + { + Directory.Delete(folder, true); + } + } + } + + [Test] + public async Task BytesThatAreNotThePinnedFileWriteNothing() + { + var folder = Folder(); + var problem = await DictionaryDownload.InstallAsync(folder, Source(dicSha: new string('0', 64)), Serve); + await Assert.That(problem).IsNotNull(); + await Assert.That(problem!).Contains("SHA-256"); + await Assert.That(Directory.Exists(folder)).IsFalse(); + } + + [Test] + public async Task OnlyHttpsIsFetched() + { + var asked = 0; + var problem = await DictionaryDownload.InstallAsync(Folder(), Source("http"), (u, c, t) => + { + asked++; + return Serve(u, c, t); + }); + await Assert.That(problem).IsNotNull(); + await Assert.That(asked).IsEqualTo(0); + } + + [Test] + public async Task ADownloadOverTheCapIsRefused() + { + var folder = Folder(); + var problem = await DictionaryDownload.InstallAsync(folder, Source(), (_, cap, _) => Task.FromResult(new byte[cap + 1])); + await Assert.That(problem).IsNotNull(); + await Assert.That(Directory.Exists(folder)).IsFalse(); + await Assert.That(DictionaryDownload.Holds(null)).IsFalse(); + } + + [Test] + public async Task ThePinnedSourcesAreHttpsAndTheLanguageChoosesOne() + { + foreach (var source in DictionaryDownload.Catalog) + { + await Assert.That(source.Aff.Scheme).IsEqualTo("https"); + await Assert.That(source.Dic.Scheme).IsEqualTo("https"); + await Assert.That(source.AffSha256.Length).IsEqualTo(64); + await Assert.That(source.DicSha256.Length).IsEqualTo(64); + } + + await Assert.That(DictionaryDownload.For("en-GB")).IsEqualTo(DictionaryDownload.EnglishGb); + await Assert.That(DictionaryDownload.For("en_AU.UTF-8")).IsEqualTo(DictionaryDownload.EnglishGb); + await Assert.That(DictionaryDownload.For("fr_FR")).IsEqualTo(DictionaryDownload.EnglishUs); + await Assert.That(DictionaryDownload.For(null)).IsEqualTo(DictionaryDownload.EnglishUs); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs b/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs index f8f457d8..326d799c 100644 --- a/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs @@ -84,16 +84,17 @@ public async Task AltWAddsTheWordAtTheCaretAndItIsNoLongerMarked() } [Test] - public async Task WithNoDictionaryTheHeaderSaysSoAndAltWIsNotOffered() + public async Task WithNoDictionaryTheHeaderSaysSoAndAltWOffersToGetOne() { var app = App(() => null); app.SimulateKey(Key(ConsoleKey.F1)); app.Composer.SimulateTyping("wrold"); await Assert.That(app.Composer.HeaderMarkup).Contains("no dictionary"); - await Assert.That(app.Composer.SimulateKey(Key(ConsoleKey.W, ConsoleModifiers.Alt))).IsFalse(); var rows = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); - await Assert.That(rows.Any(r => r.Contains("⌥W", StringComparison.Ordinal))).IsFalse(); + await Assert.That(rows.Any(r => r.Contains("⌥W", StringComparison.Ordinal) && r.Contains("get a dictionary", StringComparison.Ordinal))).IsTrue(); + await Assert.That(app.Composer.SimulateKey(Key(ConsoleKey.W, ConsoleModifiers.Alt))).IsTrue(); + await Assert.That(app.DictionaryOfferOpen).IsTrue().Because("⌥W with no dictionary offers one, and fetches nothing"); } [Test] diff --git a/tests/SharpMUTerm.Tui.Tests/HelpTests.cs b/tests/SharpMUTerm.Tui.Tests/HelpTests.cs new file mode 100644 index 00000000..54ef0bad --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/HelpTests.cs @@ -0,0 +1,211 @@ +using System.Security.Cryptography; +using System.Text; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Help; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// In-app help (/help, ⌃P ▸ Help), the spelling dictionary offered from F1 and fetched only when asked, and the +/// ⌃P / F5 suggestion to join a world's server wraps. +/// +[NotInParallel] +public class HelpTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static ConsoleKeyInfo Key(ConsoleKey key, char c = '\0', ConsoleModifiers modifiers = 0) => + new(c, key, modifiers.HasFlag(ConsoleModifiers.Shift), modifiers.HasFlag(ConsoleModifiers.Alt), modifiers.HasFlag(ConsoleModifiers.Control)); + + private static SharpMUTermApp App(string? dictionaries = null) + { + Console.SetIn(TextReader.Null); + return new SharpMUTermApp(new AppConfiguration(), Headless, new HeadlessConsoleDriver(120, 32), dictionaries: dictionaries); + } + + private static void TypeCommand(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(Key(ConsoleKey.Enter, '\r')); + } + + [Test] + public async Task SlashHelpOpensHelpWithItsQueryTyped() + { + var app = App(); + TypeCommand(app, "/help connect"); + + await Assert.That(app.HelpIsOpen).IsTrue(); + await Assert.That(app.CellHelp!.Query).IsEqualTo("connect"); + await Assert.That(app.PrimaryInputText).IsEmpty(); + await Assert.That(string.Join("\n", app.HelpLines)).Contains("/connect"); + } + + [Test] + public async Task ThePaletteEntryOpensHelpAndEscClosesIt() + { + var app = App(); + await Assert.That(app.DispatchCommand(BuiltInCommands.HelpCommand)).IsTrue(); + await Assert.That(app.HelpIsOpen).IsTrue(); + + app.SimulateHelpKey(Key(ConsoleKey.Escape, '\x1b')); + await Assert.That(app.HelpIsOpen).IsFalse(); + } + + [Test] + public async Task ChoosingASlashCommandPlacesItOnTheCommandLineAndSendsNothing() + { + var app = App(); + app.DispatchCommand(BuiltInCommands.HelpCommand); + app.SimulateHelpTyping("/walk"); + var help = app.CellHelp!; + while (help.Rows[help.Selected].Kind != HelpKind.Command) + { + app.SimulateHelpKey(Key(ConsoleKey.DownArrow)); + } + + app.SimulateHelpKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(app.HelpIsOpen).IsFalse(); + await Assert.That(app.PrimaryInputText).StartsWith("/walk"); + } + + [Test] + public async Task AHowToOpensAsAPageAndEscGoesBackToTheList() + { + var app = App(); + app.DispatchCommand(BuiltInCommands.HelpCommand); + app.SimulateHelpKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(app.CellHelp!.Topic).IsEqualTo("getting-started"); + app.SimulateHelpKey(Key(ConsoleKey.Escape, '\x1b')); + await Assert.That(app.HelpIsOpen).IsTrue(); + await Assert.That(app.CellHelp!.Topic).IsNull(); + } + + [Test] + public async Task EveryRenderIsAsTallAsItWasAsked() + { + var model = App().HelpModelNow(); + foreach (var (query, topic) in new[] { ("", (string?)null), ("zzqx", null), ("", "keys"), ("connect", null) }) + { + await Assert.That(HelpSurface.Render(model, query, 0, topic, 0, 80, 18).Count).IsEqualTo(18); + } + } + + [Test] + public async Task EverySlashCommandTheCommandLineAnswersIsInTheTable() + { + var root = AppContext.BaseDirectory; + while (!File.Exists(Path.Combine(root, "SharpMUTerm.slnx"))) + { + root = Path.GetDirectoryName(root)!; + } + + var source = File.ReadAllText(Path.Combine(root, "src", "SharpMUTerm.Tui", "SharpMUTermApp.cs")); + var handled = System.Text.RegularExpressions.Regex.Matches(source, "\"(/[a-z]+)[ \"]") + .Select(m => m.Groups[1].Value) + .Where(n => n is "/help" or "/connect" or "/welcome" or "/package" or "/walk" or "/map" or "/web" or "/graphics" or "/triggers") + .Distinct(); + foreach (var name in handled) + { + await Assert.That(SlashCommands.Names).Contains(name); + } + + await Assert.That(SlashCommands.Names).Contains("/help"); + } + + [Test] + public async Task AltWInAComposerWithNoDictionaryOffersOne_AndF1ComesBackAfter() + { + var app = App(); + app.SimulateKey(Key(ConsoleKey.F1)); + app.Composer.SimulateTyping("a post"); + app.Composer.SimulateKey(Key(ConsoleKey.W, modifiers: ConsoleModifiers.Alt)); + + await Assert.That(app.DictionaryOfferOpen).IsTrue(); + await Assert.That(app.ComposerOpen).IsFalse(); + await Assert.That(string.Join("\n", app.HelpLines)).Contains("nothing can be saved"); + + app.SimulateHelpKey(Key(ConsoleKey.Escape, '\x1b')); + await Assert.That(app.DictionaryOfferOpen).IsFalse(); + await Assert.That(app.ComposerOpen).IsTrue().Because("the offer closed F1 and gives it back"); + } + + [Test] + public async Task WithNoDictionariesFolderNothingIsFetched() + { + var app = App(); + var asked = 0; + app.DictionaryFetch = (_, _, _) => + { + asked++; + return Task.FromResult(null); + }; + app.InstallDictionary(); + + await Assert.That(app.DictionaryTask is null).IsTrue(); + await Assert.That(app.LastNotice!).Contains("no dictionaries folder"); + } + + [Test] + public async Task YesFetchesThePairIntoTheFolderAndSaysSo() + { + var folder = Path.Combine(Path.GetTempPath(), "smt-dict-" + Guid.NewGuid().ToString("N")); + try + { + var aff = Encoding.UTF8.GetBytes("SET UTF-8\n"); + var dic = Encoding.UTF8.GetBytes("2\nhello\nworld\n"); + var app = App(folder); + app.DictionaryToFetch = new DictionarySource( + "en_TEST", "English (test)", "a test", "public domain", + new Uri("https://example.org/en_TEST.aff"), Convert.ToHexStringLower(SHA256.HashData(aff)), + new Uri("https://example.org/en_TEST.dic"), Convert.ToHexStringLower(SHA256.HashData(dic)), + aff.Length + dic.Length); + app.DictionaryFetch = (uri, _, _) => Task.FromResult(uri.AbsolutePath.EndsWith(".aff", StringComparison.Ordinal) ? aff : dic); + + app.DispatchCommand(BuiltInCommands.DictionaryCommand); + await Assert.That(app.DictionaryOfferOpen).IsTrue(); + app.SimulateHelpKey(Key(ConsoleKey.Enter, '\r')); + await (app.DictionaryTask ?? Task.CompletedTask); + + await Assert.That(DictionaryDownload.Holds(folder)).IsTrue(); + await Assert.That(app.LastNotice!).Contains("en_TEST is installed"); + } + finally + { + if (Directory.Exists(folder)) + { + Directory.Delete(folder, true); + } + } + } + + [Test] + public async Task ARaggedWorldIsSuggestedOnThePalette_AndRecommendedOnF5() + { + var config = new AppConfiguration(); + config.Worlds.Add(new WorldDefinition { Name = "Aetherfall", Host = "aether.example.org", Port = 4000 }); + Console.SetIn(TextReader.Null); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32)); + app.NoteRaggedWraps("Aetherfall", 78, 60); + + await Assert.That(app.RaggedWraps()!.Select(r => r.World)).Contains("Aetherfall"); + await Assert.That(app.JoinWrapsAdvice(config.Worlds[0])).IsEqualTo("recommended · wraps at 78, pane is 60"); + + await Assert.That(app.DispatchCommand(BuiltInCommands.JoinWraps("Aetherfall"))).IsTrue(); + await Assert.That(config.Worlds[0].JoinWrappedLines).IsTrue(); + await Assert.That(app.RaggedWraps() ?? []).IsEmpty().Because("joined, there is nothing left to suggest"); + await Assert.That(app.JoinWrapsAdvice(config.Worlds[0])).IsNull(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs index 91169eea..685ae6b4 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs @@ -167,7 +167,7 @@ public async Task F1OpensTheHostsEditorAndNotTheCellModal() await Assert.That(model.Place).IsEqualTo(ComposerPlace.FullScreen); await Assert.That(model.Target).IsEqualTo("Ann"); await Assert.That(model.CanSend).IsTrue(); - await Assert.That(model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "⌥L", "⌥P", "Esc" }); + await Assert.That(model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "⌥L", "⌥W", "⌥P", "Esc" }); } [Test] From bcff583c52708c05ce6a6aabd610be7814ce56d8 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 12:11:56 +0000 Subject: [PATCH 046/113] Dictionary notices carry a Spelling source label, not a key --- src/SharpMUTerm.Client/Chrome/NoticeModel.cs | 3 +++ src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs index f5355827..c294c194 100644 --- a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs +++ b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs @@ -48,6 +48,9 @@ public static class Sources /// Game sound and mute. public const string Sound = "Sound"; + + /// Spelling dictionary downloads. + public const string Spelling = "Spelling"; } /// How long a notice holds the status row, and how long a toast stays before it fades. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs index 5794e088..d1f43619 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Help.cs @@ -364,7 +364,7 @@ internal void InstallDictionary() var source = DictionaryToFetch ?? DictionaryDownload.For(SpellChecker.PreferredLanguage()); var fetch = DictionaryFetch ?? DictionaryDownload.DownloadAsync; _dictionaryDownloading = true; - Notice($"Downloading the {source.Language} dictionary from {source.Dic.Host}…", MessageSeverity.Info, key: "dictionary"); + Notice($"Downloading the {source.Language} dictionary from {source.Dic.Host}…", MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Spelling); DictionaryTask = Task.Run(async () => { string? problem; @@ -387,7 +387,7 @@ internal void InstallDictionary() } ForgetComposerSpelling(); - Notice($"{source.Name} is installed · F1 checks spelling with it", MessageSeverity.Info, key: "dictionary"); + Notice($"{source.Name} is installed · F1 checks spelling with it", MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Spelling); }); }); } From 1fbc6de12451491db83452f0725609aa420ac667 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 12:50:25 +0000 Subject: [PATCH 047/113] feat(import): bring worlds and automation over from MUSHclient, Mudlet and TinTin++ Core/Import reads a MUSHclient .mcl, a Mudlet XML package or profile save, a Mudlet profile folder or .mpackage (read in memory, never extracted) and a TinTin++ script, bounded and tolerant: a rule that cannot be carried over exactly is skipped and listed with its reason, and script code is listed as left out and never run. ImportPlan decides what is new without touching the configuration; the rules go into a new "Imported from " set and nothing existing is overwritten. Passwords are stored only when the player asks. The review (ImportReviewModel) leads with what can act as the player and is drawn by a cell overlay and a native card in the window; nothing is written before Enter. Entry points: /import , Ctrl+P > Import from another client..., and the welcome. The window opens a native file picker (ClientHost.FilePicker, required, null elsewhere). Declared in SurfaceCatalog with parity probes; import-review snapshot view. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 4 + CLAUDE.md | 25 +- .../AvaloniaConsoleDriver.cs | 3 + src/SharpMUTerm.Avalonia/ImportReviewView.cs | 237 ++++++++ src/SharpMUTerm.Avalonia/MainWindow.cs | 1 + src/SharpMUTerm.Avalonia/ModalOverlay.cs | 1 + src/SharpMUTerm.Avalonia/WelcomeView.cs | 2 +- src/SharpMUTerm.Avalonia/WindowFilePicker.cs | 54 ++ src/SharpMUTerm.Avalonia/WindowHost.cs | 3 + src/SharpMUTerm.Client/Chrome/NoticeModel.cs | 3 + .../Commands/BuiltInCommands.cs | 4 + src/SharpMUTerm.Client/Help/SlashCommands.cs | 1 + .../Modals/ImportReviewModel.cs | 208 +++++++ src/SharpMUTerm.Client/Modals/WelcomeModel.cs | 4 + .../Surfaces/SurfaceCatalog.cs | 16 +- src/SharpMUTerm.Core/Import/ClientImport.cs | 103 ++++ src/SharpMUTerm.Core/Import/ImportPlan.cs | 214 +++++++ src/SharpMUTerm.Core/Import/ImportResult.cs | 147 +++++ src/SharpMUTerm.Core/Import/ImportText.cs | 179 ++++++ src/SharpMUTerm.Core/Import/MudletImport.cs | 530 +++++++++++++++++ .../Import/MushclientImport.cs | 347 +++++++++++ src/SharpMUTerm.Core/Import/TinTinImport.cs | 531 +++++++++++++++++ src/SharpMUTerm.Tui/DemoImport.cs | 45 ++ src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 8 + src/SharpMUTerm.Tui/Hosting/IFilePicker.cs | 17 + src/SharpMUTerm.Tui/ImportReview.cs | 108 ++++ .../Pointer/SharpMUTermApp.Surfaces.cs | 1 + src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs | 338 +++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs | 5 + src/SharpMUTerm.Tui/SharpMUTermApp.cs | 21 +- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/WelcomeSurface.cs | 8 +- .../NativeModalTests.cs | 33 ++ .../SurfaceParityTests.cs | 23 + .../ImportReviewModelTests.cs | 96 ++++ .../Import/ClientImportTests.cs | 540 ++++++++++++++++++ tests/SharpMUTerm.Tui.Tests/ImportTests.cs | 207 +++++++ 37 files changed, 4063 insertions(+), 6 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/ImportReviewView.cs create mode 100644 src/SharpMUTerm.Avalonia/WindowFilePicker.cs create mode 100644 src/SharpMUTerm.Client/Modals/ImportReviewModel.cs create mode 100644 src/SharpMUTerm.Core/Import/ClientImport.cs create mode 100644 src/SharpMUTerm.Core/Import/ImportPlan.cs create mode 100644 src/SharpMUTerm.Core/Import/ImportResult.cs create mode 100644 src/SharpMUTerm.Core/Import/ImportText.cs create mode 100644 src/SharpMUTerm.Core/Import/MudletImport.cs create mode 100644 src/SharpMUTerm.Core/Import/MushclientImport.cs create mode 100644 src/SharpMUTerm.Core/Import/TinTinImport.cs create mode 100644 src/SharpMUTerm.Tui/DemoImport.cs create mode 100644 src/SharpMUTerm.Tui/Hosting/IFilePicker.cs create mode 100644 src/SharpMUTerm.Tui/ImportReview.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs create mode 100644 tests/SharpMUTerm.Client.Tests/ImportReviewModelTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Import/ClientImportTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/ImportTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 7991b70a..ed3a9eb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Import worlds, characters, triggers, aliases, timers and keys from MUSHclient (.mcl), Mudlet (a profile folder, + an XML package or a .mpackage) and TinTin++ with `/import `, Ctrl+P ▸ Import from another client… or the welcome + screen. A review shows what can act as you, what will be added and what was left out (scripts are never imported or + run) before anything is written; nothing you already have is replaced, and passwords are stored only if you say so. - A world can reconnect by itself after its connection drops (F5 ▸ reconnect). It waits 5, 15, 30, 60 and 60 seconds between tries, counts down on the status row, and stops after five; Alt+R dials at once, and Disconnect or Ctrl+P ▸ Stop reconnecting cancels. Your own Disconnect, quitting, or the game closing right after you typed a diff --git a/CLAUDE.md b/CLAUDE.md index f768d53c..bef845b7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -210,6 +210,29 @@ fallbacks) for inline images/maps. the review opens, so the review is never shown for bytes the index did not name. The focused window's world (its session's, else its owner's, never `_active`) sorts its own packages first; a `*` package does not count as the world's own. The default index repository does not exist yet. +- **Worlds and automation can be imported from MUSHclient, Mudlet and TinTin++** (`Core/Import`: `ClientImport`, + `MushclientImport`, `MudletImport`, `TinTinImport`, `ImportPlan`; Client `ImportReviewModel`/`ImportReviewSession`; + Tui `SharpMUTermApp.Import.cs`, `ImportReview`; Avalonia `ImportReviewView`; `/import `, ⌃P ▸ *Import from another + client…*, the welcome's last row; the `import-review` view). Formats: a MUSHclient `.mcl`, a Mudlet XML package or + profile save, a Mudlet profile folder (newest `current/*.xml` plus its `url`/`port`/`login`/`password` files), a + `.mpackage`/`.zip` (read in memory, never extracted), and a TinTin++ script. Decisions not to relitigate: + - **The file is untrusted text meeting the configuration.** Read by sniffing content, not the extension; XML with no + DTD and no resolver; bounded (16 MiB, 5,000 rules, 100 worlds, 4 KiB a field, 512 zip entries, depth 32). A rule + that cannot be carried over exactly is skipped and listed with its reason (`ImportSkip`), never approximated: script + code (Lua, VBScript, a MUSHclient `script=`, a Mudlet chain or colour trigger, a TinTin `#` command in a body) is + listed as left out and never executed; a rule whose command survives keeps it and lists its script as a `part`. + - **Nothing is written before ⏎, and nothing is overwritten.** `ImportPlan.For` decides on the client's thread what + is new: a world at an existing endpoint gains only characters it lacks, a clashing name gets ` (2)`, and the rules go + into one new set `Imported from ` (suffixed if taken), listed on the *new* characters only. `Apply` re-plans + and refuses if the configuration moved since the review. Saved through `SaveConfiguration`. + - **Passwords are off unless asked.** The review says how many the file holds; `p` (the window's check box) stores + them on the new characters, which the vault then takes. They never appear in a model, a notice or a log. + - **The review is the package review's shape**: `WHAT CAN ACT AS YOU` first, then `WHAT IT ADDS`, then `LEFT OUT (n)`; + one model drawn by `ImportReview.Render` (cells, a `ListOverlay`) and the native card (`SurfaceCatalog.Import`). + - **`ClientHost.FilePicker` (`IFilePicker?`, required)** is the window's native open dialog; null in the terminal and + headless, where ⌃P puts `/import ` on the command line instead. `--plain` answers with `/import yes|no|passwords`. + - Not done: Potato and BeipMU (formats not verified), MUSHclient time-of-day timers and colour-changing triggers, + Mudlet multi-line/colour/chain triggers, TinTin `#regex`/`#if` blocks. - **The shared client shell** (`SharpMUTerm.Client`; `ContributionRegistry`). UI-agnostic, references Core only (`ClientAssemblyTests` fails on a SharpConsoleUI or Avalonia reference). The registry holds six kinds — commands, panels, settings sections (field descriptors only), status cells (reserved width, drop order), @@ -1355,7 +1378,7 @@ one `SharpMUTermApp`; a host is only the place it runs. What differs between hos (`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it -draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M, the welcome, help and the dictionary offer itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), whether it can pop a panel out into a window of its own (`IFloatingPanels`, null for none), how it asks for attention while the player is elsewhere (`IAttention`, null headless), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and +draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M, the welcome, help and the dictionary offer itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), whether it can pop a panel out into a window of its own (`IFloatingPanels`, null for none), whether it has a native file picker (`IFilePicker`, null for none), how it asks for attention while the player is elsewhere (`IAttention`, null headless), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and `WindowHost.Create` (Avalonia). Four things keep a feature from landing in one host only: - **Every `ClientHost` and `HostKeys` member is `required`**, so a member added there does not compile until diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index e89dc5fa..7d03e1a6 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -94,6 +94,9 @@ public AvaloniaConsoleDriver(int columns, int rows) /// The window's alerts while it is behind another (). public WindowAttention Attention { get; } = new(); + /// The desktop's file picker, for an import from another client (). + public WindowFilePicker FilePicker { get; } = new(); + public bool IsRunning { get; private set; } // ── IConsoleDriver: output ──────────────────────────────────────────────────────────────── diff --git a/src/SharpMUTerm.Avalonia/ImportReviewView.cs b/src/SharpMUTerm.Avalonia/ImportReviewView.cs new file mode 100644 index 00000000..f6330061 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ImportReviewView.cs @@ -0,0 +1,237 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's review of an import from another client: what can act as the player, what will be added, what was left +/// out and why (, the model the cells draw), a check box for the passwords the file held, +/// and Import / Cancel. Import ends in the client's AcceptImport, the method the cells' Enter ends in; the check +/// box ends in ToggleImportPasswords, and the client republishes. Nothing is written before Import. +/// +internal sealed class ImportReviewView : DockPanel, IModalView +{ + private readonly ImportReviewSession _session; + private readonly NativeTokens _colours; + private readonly Action _done; + private readonly StackPanel _body = new() { Spacing = 4, Margin = new Thickness(20, 2, 20, 4) }; + private readonly Button _import; + private readonly Button _cancel; + private readonly CheckBox _passwords; + private ImportReviewModel _model; + + public ImportReviewView(ImportReviewSession session, NativeTokens colours, Action done) + { + _session = session; + _colours = colours; + _done = done; + _model = session.Model; + + var heading = ModalParts.Heading(_model.Title, colours); + SetDock(heading, Dock.Top); + Children.Add(heading); + var intro = ModalParts.Dim(_model.Intro, colours); + SetDock(intro, Dock.Top); + Children.Add(intro); + + var footer = ModalParts.Footer(_model.Empty ? "Esc close" : _model.Keys, colours); + SetDock(footer, Dock.Bottom); + + _import = ModalParts.Button("Import", "Enter", colours, Accept, accent: true); + _import.IsEnabled = !_model.Empty; + _cancel = ModalParts.Button("Cancel", "Esc", colours, Decline); + _passwords = new CheckBox + { + Content = "Store the passwords", + IsVisible = _model.Passwords > 0, + IsChecked = _model.StorePasswords, + Foreground = colours.Brush(colours.Text), + FontSize = NativeTokens.Body, + VerticalAlignment = VerticalAlignment.Center, + Focusable = true, + }; + _passwords.IsCheckedChanged += (_, _) => + { + if ((_passwords.IsChecked == true) != _model.StorePasswords) + { + _session.TogglePasswords(); + } + }; + + var buttons = new DockPanel { Margin = new Thickness(20, 12, 20, 0), LastChildFill = false }; + DockPanel.SetDock(_passwords, Dock.Left); + buttons.Children.Add(_passwords); + var right = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10 }; + right.Children.Add(_import); + right.Children.Add(_cancel); + DockPanel.SetDock(right, Dock.Right); + buttons.Children.Add(right); + SetDock(buttons, Dock.Bottom); + Children.Add(footer); + Children.Add(buttons); + + Children.Add(new ScrollViewer + { + Content = _body, + MaxHeight = 460, + HorizontalScrollBarVisibility = global::Avalonia.Controls.Primitives.ScrollBarVisibility.Disabled, + }); + + Draw(); + _session.Changed += OnChanged; + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + } + + public string Title => _model.Title; + + public double PreferredWidth => 680; + + public bool Centred => true; + + /// The buttons and the check box, for a test. + public Button ImportButton => _import; + + public Button CancelButton => _cancel; + + public CheckBox PasswordsBox => _passwords; + + /// The text the body shows, for a test. + public IReadOnlyList BodyText => _body.Children.OfType() + .Select(t => t.Inlines is { Count: > 0 } inlines + ? string.Concat(inlines.OfType().Select(r => r.Text)) + : t.Text ?? string.Empty) + .ToArray(); + + public void FocusFirst() => (_import.IsEnabled ? _import : _cancel).Focus(); + + public void Detach() => _session.Changed -= OnChanged; + + /// Import: the session ends and the client writes the import. + public void Accept() + { + if (_model.Empty) + { + return; + } + + _session.Accept(); + _done(); + } + + /// Cancel: nothing is written. + public void Decline() + { + _session.Dismiss(); + _done(); + } + + private void OnChanged(ImportReviewModel model) => Dispatcher.UIThread.Post(() => + { + _model = model; + _passwords.IsChecked = model.StorePasswords; + Draw(); + }); + + private void Draw() + { + _body.Children.Clear(); + if (_model.Empty) + { + _body.Children.Add(Line("There is nothing in it this client can import.", _colours.Dim)); + } + else + { + _body.Children.Add(ModalParts.GroupHeader(ImportReviewModel.ActsHeading, _colours, first: true)); + if (_model.ActsAsYou.Count == 0) + { + _body.Children.Add(Line("Nothing: no rule in it sends a command.", _colours.Dim)); + } + + foreach (var act in _model.ActsAsYou) + { + _body.Children.Add(Line("• " + act, _colours.Text)); + } + + _body.Children.Add(ModalParts.GroupHeader(ImportReviewModel.AddsHeading, _colours, first: false)); + foreach (var row in _model.Adds) + { + _body.Children.Add(Row(row, _colours.Text)); + } + } + + if (_model.LeftOutCount > 0) + { + _body.Children.Add(ModalParts.GroupHeader($"{ImportReviewModel.LeftOutHeading} ({_model.LeftOutCount})", _colours, first: false)); + foreach (var row in _model.LeftOut) + { + _body.Children.Add(Row(row, _colours.Dim)); + } + + if (_model.MoreLeftOut is { } more) + { + _body.Children.Add(Line(more, _colours.Dim)); + } + } + + if (_model.PasswordLine is { } passwords) + { + var line = Line(passwords, _model.StorePasswords ? _colours.Text : _colours.Warn); + line.Margin = new Thickness(12, 12, 12, 0); + _body.Children.Add(line); + } + } + + private TextBlock Line(string text, Color colour) => new() + { + Text = NativeKeys.Words(text), + Foreground = _colours.Brush(colour), + FontSize = NativeTokens.Body, + TextWrapping = TextWrapping.Wrap, + Margin = new Thickness(12, 1, 12, 1), + }; + + private TextBlock Row(ImportReviewRow row, Color detail) + { + var block = new TextBlock + { + FontSize = NativeTokens.Body, + TextWrapping = TextWrapping.Wrap, + Margin = new Thickness(12, 2, 12, 2), + }; + block.Inlines ??= new global::Avalonia.Controls.Documents.InlineCollection(); + block.Inlines.Add(new global::Avalonia.Controls.Documents.Run(row.Kind + " ") { Foreground = _colours.Brush(_colours.Accent) }); + block.Inlines.Add(new global::Avalonia.Controls.Documents.Run(row.Name) { Foreground = _colours.Brush(_colours.Text), FontWeight = FontWeight.SemiBold }); + block.Inlines.Add(new global::Avalonia.Controls.Documents.Run(" " + NativeKeys.Words(row.Detail)) { Foreground = _colours.Brush(detail) }); + return block; + } + + private void OnKey(object? sender, KeyEventArgs e) + { + if (e.KeyModifiers != KeyModifiers.None) + { + return; + } + + if (e.Key == Key.Escape) + { + e.Handled = true; + Decline(); + } + else if (e.Key == Key.Enter && e.Source is not Button and not CheckBox) + { + e.Handled = true; + Accept(); + } + else if (e.Key == Key.P && _model.Passwords > 0) + { + e.Handled = true; + _session.TogglePasswords(); + } + } +} diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index 0f07c582..d3200500 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -108,6 +108,7 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime // Panels popped out into windows of their own, owned by this one so they stay above it and go with it. _driver.Floating.Attach(this, _view); + _driver.FilePicker.Attach(this); Closed += (_, _) => _driver.Floating.Detach(); Content = root; AutomationProperties.SetName(_view, "SharpMUTerm"); diff --git a/src/SharpMUTerm.Avalonia/ModalOverlay.cs b/src/SharpMUTerm.Avalonia/ModalOverlay.cs index eed0a7f3..f5d34a9d 100644 --- a/src/SharpMUTerm.Avalonia/ModalOverlay.cs +++ b/src/SharpMUTerm.Avalonia/ModalOverlay.cs @@ -47,6 +47,7 @@ public ModalOverlay(ModalSession session, Action remove, Action new WelcomeView(welcome, Colours, Done), HelpSession help => new HelpView(help, Colours, Done), DictionaryOfferSession offer => new DictionaryOfferView(offer, Colours, Done), + ImportReviewSession import => new ImportReviewView(import, Colours, Done), _ => throw new ArgumentException($"no native view for {session.GetType().Name}", nameof(session)), }; AutomationProperties.SetName(this, _view.Title); diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index 468468c6..ca321d6b 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -18,7 +18,7 @@ namespace SharpMUTerm.Avalonia; /// internal sealed class WelcomeView : DockPanel, IModalView { - private static readonly WelcomeChoice[] Choices = [WelcomeChoice.Connect, WelcomeChoice.Browse, WelcomeChoice.Settings]; + private static readonly WelcomeChoice[] Choices = [WelcomeChoice.Connect, WelcomeChoice.Browse, WelcomeChoice.Settings, WelcomeChoice.Import]; private static readonly WelcomeLayout[] Layouts = [WelcomeLayout.Suggested, WelcomeLayout.Roleplay, WelcomeLayout.Combat]; private readonly WelcomeSession _session; diff --git a/src/SharpMUTerm.Avalonia/WindowFilePicker.cs b/src/SharpMUTerm.Avalonia/WindowFilePicker.cs new file mode 100644 index 00000000..78a10929 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/WindowFilePicker.cs @@ -0,0 +1,54 @@ +using Avalonia.Controls; +using Avalonia.Platform.Storage; +using Avalonia.Threading; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// The desktop's own file picker, for an import from another client (). It hands the +/// client a local path and nothing else: what the file holds is read, bounded and reviewed by the client, the same as a +/// path typed after /import. Not available until the main window attaches it, so a test, the parity harness and +/// --render-png are told to type a path instead. +/// +internal sealed class WindowFilePicker : IFilePicker +{ + private TopLevel? _owner; + + public bool Available => Volatile.Read(ref _owner) is not null; + + /// The window the picker opens over. + public void Attach(TopLevel owner) => Volatile.Write(ref _owner, owner); + + public void Pick(string title, Action picked) + { + ArgumentNullException.ThrowIfNull(picked); + Dispatcher.UIThread.Post(async () => + { + string? path = null; + try + { + if (_owner?.StorageProvider is { CanOpen: true } storage) + { + var files = await storage.OpenFilePickerAsync(new FilePickerOpenOptions + { + Title = title, + AllowMultiple = false, + FileTypeFilter = + [ + new FilePickerFileType("Client setups") { Patterns = ["*.mcl", "*.xml", "*.mpackage", "*.zip", "*.tin", "*.tt", "*.txt"] }, + FilePickerFileTypes.All, + ], + }); + path = files.Count > 0 ? files[0].TryGetLocalPath() : null; + } + } + catch (InvalidOperationException) + { + path = null; + } + + picked(path); + }); + } +} diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 20e83fae..c3599d79 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -92,5 +92,8 @@ internal static class WindowHost // A page while the window is behind another: a desktop notification and the taskbar's attention state. Attention = driver.Attention, + + // An import from another client starts at the desktop's own file picker. + FilePicker = driver.FilePicker, }; } diff --git a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs index c294c194..1504b520 100644 --- a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs +++ b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs @@ -51,6 +51,9 @@ public static class Sources /// Spelling dictionary downloads. public const string Spelling = "Spelling"; + + /// Imports from another client. + public const string Import = "Import"; } /// How long a notice holds the status row, and how long a toast stays before it fades. diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 1a539792..ced798e8 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -20,6 +20,9 @@ public static class BuiltInCommands /// Help: keys, slash commands and how-tos (/help). public const string HelpCommand = "term:help"; + /// Import from another client: a file picker in a host that has one, else /import on the command line. + public const string ImportCommand = "term:import"; + /// The spelling dictionary offer. public const string DictionaryCommand = "term:get-dictionary"; @@ -191,6 +194,7 @@ void Family(string id, string prefix, Func [port] [tls]", "Add a world for a host and connect to it (port 4000 by default)", "/connect "), new("/welcome", "/welcome", "Show the first-run welcome again", "/welcome"), new("/welcome", "/welcome layout roleplay|combat|suggested", "Choose the starting layout the welcome offers", "/welcome layout "), + new("/import", "/import ", "Import worlds, characters and automation from MUSHclient, Mudlet or TinTin++; nothing is written before Enter", "/import "), new("/package", "/package", "Open the Packages screen (F10)", "/package"), new("/package", "/package browse", "Browse the package index, this game's packages first", "/package browse"), new("/package", "/package install ", "Read a package and open its review; nothing is written before Enter", "/package install "), diff --git a/src/SharpMUTerm.Client/Modals/ImportReviewModel.cs b/src/SharpMUTerm.Client/Modals/ImportReviewModel.cs new file mode 100644 index 00000000..1c9df9f3 --- /dev/null +++ b/src/SharpMUTerm.Client/Modals/ImportReviewModel.cs @@ -0,0 +1,208 @@ +using System.Globalization; +using SharpMUTerm.Core.Import; + +namespace SharpMUTerm.Client.Modals; + +/// One line of the import review: what it is, what it is called, and what it says about it. +/// What it is: world, set, or for a left-out entry the kind of rule. +/// Its name. +/// What happens to it, or why it was left out. +public sealed record ImportReviewRow(string Kind, string Name, string Detail); + +/// +/// The import review: what an import from another client would add and what it leaves out, with reasons — the consent +/// step, like the package review (). Drawn by the cell surface +/// (ImportReview.Render) and by the window's native modal; nothing is written until ⏎ (or Import), which ends in +/// the client's AcceptImport. +/// +/// It leads with — the rules that can send commands as the player — because that is what an +/// import can do that a player should know before saying yes. Passwords the file held are named and are not +/// stored unless is switched on here. +/// +/// +public sealed record ImportReviewModel( + string Format, + string Source, + IReadOnlyList Adds, + IReadOnlyList ActsAsYou, + IReadOnlyList LeftOut, + int LeftOutCount, + int Passwords, + bool StorePasswords) +{ + /// How many left-out entries the review lists by name; the rest are counted. + public const int ListedLeftOut = 8; + + /// The heading over the rules that can send commands. + public const string ActsHeading = "WHAT CAN ACT AS YOU"; + + /// The heading over what will be added. + public const string AddsHeading = "WHAT IT ADDS"; + + /// The heading over what was left out. + public const string LeftOutHeading = "LEFT OUT"; + + /// The promise the review makes. + public const string Consent = "Nothing is written until you press Enter, and nothing you already have is replaced."; + + /// The review's title. + public string Title => $"Import from {Format}"; + + /// The line under the title. + public string Intro => $"Read from {Source}. {Consent}"; + + /// The keys the cell review answers. + public string Keys => Passwords > 0 ? "⏎ import · p passwords · Esc cancel" : "⏎ import · Esc cancel"; + + /// What the review says about the passwords the file held, or null when it held none. + public string? PasswordLine => Passwords == 0 + ? null + : StorePasswords + ? $"{Count(Passwords, "password")} will be stored where every password is kept (the system keychain, else secrets.json)." + : $"The file holds {Count(Passwords, "password")}, which will not be stored. Store {(Passwords == 1 ? "it" : "them")}?"; + + /// What the review says when there is nothing to add. + public bool Empty => Adds.Count == 0; + + /// The left-out line for the entries past , or null. + public string? MoreLeftOut => LeftOutCount > LeftOut.Count + ? $"and {(LeftOutCount - LeftOut.Count).ToString(CultureInfo.InvariantCulture)} more" + : null; + + /// The review of . + public static ImportReviewModel From(ImportPlan plan, bool storePasswords = false) + { + ArgumentNullException.ThrowIfNull(plan); + var result = plan.Result; + var adds = new List(); + var listedOn = new List(); + foreach (var world in plan.Worlds) + { + var at = $"{world.Host}:{world.Port.ToString(CultureInfo.InvariantCulture)}"; + string detail; + if (world.Existing) + { + detail = world.NewCharacters.Count == 0 + ? $"already configured ({at}); nothing to add" + : $"already configured ({at}); adds {string.Join(", ", world.NewCharacters)}"; + } + else + { + detail = world.NewCharacters.Count == 0 + ? $"new world, {at}, no character" + : $"new world, {at}, {(world.NewCharacters.Count == 1 ? "character" : "characters")} {string.Join(", ", world.NewCharacters)}"; + } + + if (world.KeptCharacters.Count > 0) + { + detail += $" · keeps your {string.Join(", ", world.KeptCharacters)} as {(world.KeptCharacters.Count == 1 ? "is" : "they are")}"; + } + + adds.Add(new ImportReviewRow("world", world.Name, detail)); + listedOn.AddRange(world.NewCharacters); + } + + if (plan.SetName is { } setName) + { + var rules = string.Join(", ", new[] + { + Count(result.Set.Triggers.Count, "trigger"), + Count(result.Set.Aliases.Count, "alias", "aliases"), + Count(result.Set.Timers.Count, "timer"), + Count(result.Set.Macros.Count, "key"), + }.Where(s => !s.StartsWith("0 ", StringComparison.Ordinal))); + var where = listedOn.Count == 0 + ? "new set, listed on no character yet (F5 lists it on one)" + : $"new set, listed on {string.Join(", ", listedOn)}"; + adds.Add(new ImportReviewRow("set", setName, $"{rules} · {where}")); + } + + var acts = new List(); + var sendingTriggers = result.Set.Triggers.Count(t => !string.IsNullOrEmpty(t.Actions.SendResponse)); + if (sendingTriggers > 0) + { + acts.Add($"{Count(sendingTriggers, "trigger")} {(sendingTriggers == 1 ? "sends" : "send")} a command when a line matches"); + } + + if (result.Set.Aliases.Count > 0) + { + acts.Add($"{Count(result.Set.Aliases.Count, "alias", "aliases")} {(result.Set.Aliases.Count == 1 ? "turns" : "turn")} what you type into other commands"); + } + + if (result.Set.Timers.Count > 0) + { + acts.Add($"{Count(result.Set.Timers.Count, "timer")} {(result.Set.Timers.Count == 1 ? "sends" : "send")} commands on {(result.Set.Timers.Count == 1 ? "its" : "their")} own while connected"); + } + + if (result.Set.Macros.Count > 0) + { + acts.Add($"{Count(result.Set.Macros.Count, "key")} {(result.Set.Macros.Count == 1 ? "sends" : "send")} a command when pressed"); + } + + var leftOut = result.Skipped + .Take(ListedLeftOut) + .Select(s => new ImportReviewRow(s.Kind, s.Name, s.Reason)) + .ToArray(); + return new ImportReviewModel( + ImportFormats.Name(result.Format), + result.Source, + adds, + acts, + leftOut, + result.SkippedCount, + plan.PasswordCount, + storePasswords && plan.PasswordCount > 0); + } + + /// A count and its noun, singular or plural. + public static string Count(int count, string noun, string? plural = null) => + $"{count.ToString(CultureInfo.InvariantCulture)} {(count == 1 ? noun : plural ?? noun + "s")}"; + + public bool Equals(ImportReviewModel? other) => + other is not null + && Format == other.Format + && Source == other.Source + && ModelLists.Same(Adds, other.Adds) + && ModelLists.Same(ActsAsYou, other.ActsAsYou) + && ModelLists.Same(LeftOut, other.LeftOut) + && LeftOutCount == other.LeftOutCount + && Passwords == other.Passwords + && StorePasswords == other.StorePasswords; + + public override int GetHashCode() => + HashCode.Combine(Format, Source, ModelLists.Hash(Adds), ModelLists.Hash(LeftOut), LeftOutCount, Passwords, StorePasswords); +} + +/// +/// One opening of the import review in a host's own controls. closes it and writes the import +/// through the client's own method; asks the client to republish with the passwords +/// stored or not; Esc (or a click outside) closes it and writes nothing. +/// +public sealed class ImportReviewSession : ModalSession +{ + private readonly Action _accept; + private readonly Action _passwords; + + public ImportReviewSession(ImportReviewModel model, bool isDark, Action accept, Action passwords, Action closed) + : base(model, isDark, closed) + { + ArgumentNullException.ThrowIfNull(accept); + ArgumentNullException.ThrowIfNull(passwords); + _accept = accept; + _passwords = passwords; + } + + public override string Surface => "import"; + + /// The host's: import it. + public void Accept() => CloseThen(_accept); + + /// The host's: store the file's passwords, or not. The client republishes the model. + public void TogglePasswords() + { + if (!IsEnded) + { + _passwords(); + } + } +} diff --git a/src/SharpMUTerm.Client/Modals/WelcomeModel.cs b/src/SharpMUTerm.Client/Modals/WelcomeModel.cs index efe7c7d3..5b2a1003 100644 --- a/src/SharpMUTerm.Client/Modals/WelcomeModel.cs +++ b/src/SharpMUTerm.Client/Modals/WelcomeModel.cs @@ -11,6 +11,9 @@ public enum WelcomeChoice /// F5, to add a world by hand. Settings, + + /// Import worlds and automation from another client. + Import, } /// @@ -121,6 +124,7 @@ public sealed record WelcomeModel( { WelcomeChoice.Connect => ("Connect to a world", "Type a host and port"), WelcomeChoice.Browse => ("Browse worlds", IndexProblem is null ? "From the package index" : "No package index set"), + WelcomeChoice.Import => ("Import", "From MUSHclient, Mudlet or TinTin++"), _ => ("Open settings", "F5, add a world by hand"), }; diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index c3af479b..5c9377e6 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -186,6 +186,9 @@ public static class SurfaceCatalog /// The spelling dictionary offer: the consent step before anything is downloaded. public const string Dictionary = "dictionary"; + /// The review of an import from another client: the consent step before anything is written. + public const string Import = "import"; + /// /// The +3 ▾ chip a tab strip carries when its tabs do not fit even at their floors, and the list of the tabs /// past its edges it opens: a cell list in a terminal, a native menu in the window (the chip itself is cells in both). @@ -209,7 +212,7 @@ public static class SurfaceCatalog private static string[] PanelViews(string view) => ["SharpMUTerm.Avalonia." + view, "SharpMUTerm.Avalonia.PopOutButton"]; /// The modals the window draws with its own controls in place of the cell modal (ClientHost.NativeModals). - public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary]; + public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary, Import]; /// A cell modal in a terminal; the window's own modal in its place. private static readonly IReadOnlyDictionary NativeModal = new Dictionary @@ -483,6 +486,17 @@ public static class SurfaceCatalog NativeModal, "SharpMUTerm.Tui.DictionaryOffer.Render", ModalViews("DictionaryOfferView")), + new( + Import, + typeof(ImportReviewModel), + [ + // Import writes through the one method the cells' Enter ends in; the passwords toggle republishes. + new(SurfaceActionKind.Modal, "accept", "AcceptImport"), + new(SurfaceActionKind.Modal, "passwords", "ToggleImportPasswords"), + ], + NativeModal, + "SharpMUTerm.Tui.ImportReview.Render", + ModalViews("ImportReviewView")), new( TabOverflow, typeof(MenuModel), diff --git a/src/SharpMUTerm.Core/Import/ClientImport.cs b/src/SharpMUTerm.Core/Import/ClientImport.cs new file mode 100644 index 00000000..265a9fb4 --- /dev/null +++ b/src/SharpMUTerm.Core/Import/ClientImport.cs @@ -0,0 +1,103 @@ +using System.Text; + +namespace SharpMUTerm.Core.Import; + +/// +/// The one way in to the readers: a path (a file, or a Mudlet profile folder) or text already in memory, with the +/// format told apart by what the content is rather than by the file's name. Nothing here writes anything. +/// +public static class ClientImport +{ + /// + /// Reads whatever names: a Mudlet profile folder, a zip (a Mudlet .mpackage), or a + /// MUSHclient, Mudlet or TinTin++ file. The size is checked before a byte is read. + /// + public static (ImportResult? Result, string? Problem) Read(string path) + { + ArgumentNullException.ThrowIfNull(path); + try + { + var full = Path.GetFullPath(path); + if (Directory.Exists(full)) + { + return MudletImport.ReadProfile(full); + } + + var file = new FileInfo(full); + if (!file.Exists) + { + return (null, "there is no file or folder there"); + } + + if (file.Length > ImportLimits.MaxFileBytes) + { + return (null, $"that file is larger than {ImportLimits.MaxFileBytes / (1024 * 1024)} MB, too large to be a client's setup"); + } + + var bytes = File.ReadAllBytes(file.FullName); + if (bytes.Length >= 4 && bytes[0] == 'P' && bytes[1] == 'K' && bytes[2] == 3 && bytes[3] == 4) + { + return MudletImport.ReadZip(bytes, file.Name); + } + + var (result, problem) = Parse(Decode(bytes), file.Name); + if (result is { Format: ImportFormat.Mudlet }) + { + MudletImport.AddProfileWorldFor(file.FullName, result); + } + + return (result, problem); + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or NotSupportedException or System.Security.SecurityException) + { + return (null, "it could not be read: " + ex.Message); + } + } + + /// Reads text whose format is told by its content. + public static (ImportResult? Result, string? Problem) Parse(string text, string source) + { + ArgumentNullException.ThrowIfNull(text); + ArgumentNullException.ThrowIfNull(source); + if (MudletImport.Recognises(text)) + { + return MudletImport.Parse(text, source); + } + + if (MushclientImport.Recognises(text)) + { + return MushclientImport.Parse(text, source); + } + + if (TinTinImport.Recognises(text)) + { + return TinTinImport.Parse(text, source); + } + + return (null, $"not a setup this client can import (it reads {ImportFormats.Listed})"); + } + + /// UTF-8 unless it says otherwise: a byte-order mark for UTF-16, else Latin-1 when it is not valid UTF-8. + private static string Decode(byte[] bytes) + { + if (bytes.Length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE) + { + return Encoding.Unicode.GetString(bytes, 2, bytes.Length - 2); + } + + if (bytes.Length >= 2 && bytes[0] == 0xFE && bytes[1] == 0xFF) + { + return Encoding.BigEndianUnicode.GetString(bytes, 2, bytes.Length - 2); + } + + var offset = bytes.Length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF ? 3 : 0; + try + { + return new UTF8Encoding(false, throwOnInvalidBytes: true).GetString(bytes, offset, bytes.Length - offset); + } + catch (DecoderFallbackException) + { + return Encoding.Latin1.GetString(bytes); + } + } +} diff --git a/src/SharpMUTerm.Core/Import/ImportPlan.cs b/src/SharpMUTerm.Core/Import/ImportPlan.cs new file mode 100644 index 00000000..dac9d209 --- /dev/null +++ b/src/SharpMUTerm.Core/Import/ImportPlan.cs @@ -0,0 +1,214 @@ +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Import; + +/// One world of an import, as it would land. +/// The name it would have: the file's, or with a suffix when another world already has it. +/// Its host. +/// Its port. +/// Whether a world with this host and port is already configured, so the import only adds characters to it. +/// The characters it would add. +/// The characters the file names that the world already has, which are left as they are. +public sealed record PlannedWorld( + string Name, + string Host, + int Port, + bool Existing, + IReadOnlyList NewCharacters, + IReadOnlyList KeptCharacters) +{ + public bool Equals(PlannedWorld? other) => + other is not null && Name == other.Name && Host == other.Host && Port == other.Port && Existing == other.Existing + && NewCharacters.SequenceEqual(other.NewCharacters) && KeptCharacters.SequenceEqual(other.KeptCharacters); + + public override int GetHashCode() => HashCode.Combine(Name, Host, Port, Existing, NewCharacters.Count, KeptCharacters.Count); +} + +/// +/// What an import would add to a configuration, decided against it before anything is written: nothing is +/// overwritten. The automation becomes a new set named Imported from MUSHclient ((2), (3)… when +/// that name is taken); a world whose host and port are already configured gains only the characters it does not have; +/// any other world whose name is taken gets a suffix. The new set is listed on every character the import adds, and on +/// no character the player already had. +/// +public sealed class ImportPlan +{ + private ImportPlan(ImportResult result, IReadOnlyList worlds, string? setName) + { + Result = result; + Worlds = worlds; + SetName = setName; + } + + /// What the file held. + public ImportResult Result { get; } + + /// The worlds, in the file's order. + public IReadOnlyList Worlds { get; } + + /// The new set's name, or null when the file held no automation. + public string? SetName { get; } + + /// How many characters would be added. + public int NewCharacterCount => Worlds.Sum(w => w.NewCharacters.Count); + + /// How many passwords the file holds for characters this import would add — the only ones it could store. + public int PasswordCount => StorablePasswords().Count(); + + /// Decides names for against . Writes nothing. + public static ImportPlan For(AppConfiguration configuration, ImportResult result) + { + ArgumentNullException.ThrowIfNull(configuration); + ArgumentNullException.ThrowIfNull(result); + var takenWorlds = new HashSet(configuration.Worlds.Select(w => w.Name), StringComparer.OrdinalIgnoreCase); + var worlds = new List(); + foreach (var world in result.Worlds) + { + var existing = configuration.Worlds.FirstOrDefault(w => + string.Equals(w.Host, world.Host, StringComparison.OrdinalIgnoreCase) && w.Port == world.Port); + var names = world.Characters.Select(c => c.Name).Distinct(StringComparer.OrdinalIgnoreCase).ToList(); + if (existing is not null) + { + var have = existing.Characters.Select(c => c.Name).ToHashSet(StringComparer.OrdinalIgnoreCase); + worlds.Add(new PlannedWorld( + existing.Name, + existing.Host, + existing.Port, + Existing: true, + names.Where(n => !have.Contains(n)).ToArray(), + names.Where(have.Contains).ToArray())); + continue; + } + + var name = Unique(world.Name, takenWorlds); + takenWorlds.Add(name); + worlds.Add(new PlannedWorld(name, world.Host, world.Port, Existing: false, names, [])); + } + + string? setName = null; + if (result.RuleCount > 0) + { + var takenSets = new HashSet(configuration.TriggerSets.Select(s => s.Name), StringComparer.OrdinalIgnoreCase); + setName = Unique("Imported from " + ImportFormats.Name(result.Format), takenSets); + } + + return new ImportPlan(result, worlds, setName); + } + + /// Whether two plans would write the same things — so a review shown is the import done. + public bool SameAs(ImportPlan other) => + ReferenceEquals(Result, other.Result) && SetName == other.SetName && Worlds.SequenceEqual(other.Worlds); + + /// + /// Adds what the plan says to , copying every definition so nothing the review + /// holds is shared with the live configuration. A password is set only when , + /// and only on a character this import adds; the caller's save then puts it where every password goes (the OS + /// credential store, else secrets.json), never config.json. + /// + public ImportApplied Apply(AppConfiguration configuration, bool storePasswords) + { + ArgumentNullException.ThrowIfNull(configuration); + if (!SameAs(For(configuration, Result))) + { + throw new InvalidOperationException("the configuration changed since this plan was made"); + } + + if (SetName is { } setName) + { + configuration.TriggerSets.Add(new TriggerSet + { + Name = setName, + Description = $"Imported from {ImportFormats.Name(Result.Format)} ({Result.Source})", + Triggers = Result.Set.Triggers.Select(t => t.Clone()).ToList(), + Aliases = Result.Set.Aliases.Select(a => a.Clone()).ToList(), + Timers = Result.Set.Timers.Select(CloneTimer).ToList(), + Macros = Result.Set.Macros.Select(CloneMacro).ToList(), + }); + } + + var passwords = storePasswords ? StorablePasswords().ToList() : []; + var stored = 0; + for (var i = 0; i < Worlds.Count; i++) + { + var plan = Worlds[i]; + var source = Result.Worlds[i]; + WorldDefinition target; + if (plan.Existing) + { + target = configuration.Worlds.First(w => + string.Equals(w.Host, plan.Host, StringComparison.OrdinalIgnoreCase) && w.Port == plan.Port); + } + else + { + target = new WorldDefinition + { + Name = plan.Name, + Host = source.Host, + Port = source.Port, + UseTls = source.UseTls, + }; + configuration.Worlds.Add(target); + } + + foreach (var name in plan.NewCharacters) + { + var character = new CharacterDefinition { Name = name }; + if (SetName is not null) + { + character.TriggerSets.Add(SetName); + } + + if (passwords.FirstOrDefault(p => p.World == i && string.Equals(p.Character, name, StringComparison.OrdinalIgnoreCase)) is { } password) + { + character.Password = password.Password; + stored++; + } + + target.Characters.Add(character); + } + } + + return new ImportApplied(Worlds.Count(w => !w.Existing), NewCharacterCount, SetName, Result.RuleCount, stored); + } + + private IEnumerable StorablePasswords() => + Result.Passwords.Where(p => p.World >= 0 && p.World < Worlds.Count + && Worlds[p.World].NewCharacters.Contains(p.Character, StringComparer.OrdinalIgnoreCase)); + + private static string Unique(string name, HashSet taken) + { + if (!taken.Contains(name)) + { + return name; + } + + for (var n = 2; ; n++) + { + var candidate = $"{name} ({n})"; + if (!taken.Contains(candidate)) + { + return candidate; + } + } + } + + private static Automation.TimerDefinition CloneTimer(Automation.TimerDefinition timer) => new() + { + Name = timer.Name, + IntervalSeconds = timer.IntervalSeconds, + Command = timer.Command, + OneShot = timer.OneShot, + Enabled = timer.Enabled, + }; + + private static Automation.Macro CloneMacro(Automation.Macro macro) => new() + { + Name = macro.Name, + Key = macro.Key, + Command = macro.Command, + Enabled = macro.Enabled, + }; +} + +/// What an import added. +public sealed record ImportApplied(int Worlds, int Characters, string? SetName, int Rules, int PasswordsStored); diff --git a/src/SharpMUTerm.Core/Import/ImportResult.cs b/src/SharpMUTerm.Core/Import/ImportResult.cs new file mode 100644 index 00000000..989ce20b --- /dev/null +++ b/src/SharpMUTerm.Core/Import/ImportResult.cs @@ -0,0 +1,147 @@ +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Import; + +/// The other clients a setup can be imported from. +public enum ImportFormat +{ + /// A MUSHclient world file (.mcl, XML). + MushClient, + + /// A Mudlet profile folder, a profile save, or a package or module export (XML, or a zip holding one). + Mudlet, + + /// A TinTin++ script (#session, #action, #alias, #ticker, #gag). + TinTin, +} + +/// Names a format the way a player knows it. +public static class ImportFormats +{ + /// The client's name as its players write it. + public static string Name(ImportFormat format) => format switch + { + ImportFormat.MushClient => "MUSHclient", + ImportFormat.Mudlet => "Mudlet", + _ => "TinTin++", + }; + + /// The formats in the order the surfaces name them. + public static IReadOnlyList All { get; } = [ImportFormat.MushClient, ImportFormat.Mudlet, ImportFormat.TinTin]; + + /// The formats as one phrase: MUSHclient, Mudlet, TinTin++. + public static string Listed => string.Join(", ", All.Select(Name)); +} + +/// +/// The bounds every reader holds an import file to. An import file is untrusted input — written by another program, +/// often copied from a forum post — so every count and every length is capped while it is read, and an entry that +/// breaks a cap is skipped and counted rather than truncated (a truncated command is a different command). +/// +public static class ImportLimits +{ + /// The largest file read: a big Mudlet profile save is a few megabytes. + public const long MaxFileBytes = 16L * 1024 * 1024; + + /// The most triggers, aliases, timers or keys taken from one file, each. + public const int MaxItems = 5000; + + /// The most worlds taken from one file. + public const int MaxWorlds = 100; + + /// The longest pattern or command taken. + public const int MaxText = 4096; + + /// The longest name (of a world, character, rule or host) taken. + public const int MaxName = 128; + + /// The most entries of a zip looked at, and the most of its XML read. + public const int MaxZipEntries = 512; + + /// How many left-out entries are listed by name; the rest are only counted. + public const int MaxListedSkips = 200; + + /// How deep a Mudlet folder may nest before the rest of it is left out. + public const int MaxDepth = 32; +} + +/// Something an import file held that was not imported, and why. +/// What it is: trigger, alias, timer, key, script, world… +/// What it is called in the file, or its pattern when it has no name. +/// Why it was left out, in a few words a player understands. +public sealed record ImportSkip(string Kind, string Name, string Reason); + +/// A password the file held for a character. It is never stored unless the player says so on the review. +/// The index of the world in . +/// The character's name. +/// The password. +public sealed record ImportedPassword(int World, string Character, string Password) +{ + /// Never the password: a record's own ToString would print it into a log. + public override string ToString() => $"{nameof(ImportedPassword)} {{ World = {World}, Character = {Character} }}"; +} + +/// +/// What a reader made of one file: worlds with their characters, one set of automation, what was left out and why, +/// and any passwords — held apart, so nothing stores them by accident. Nothing here has touched the configuration; +/// decides names against it, and only the review's ⏎ writes. +/// +public sealed class ImportResult +{ + public ImportResult(ImportFormat format, string source) + { + ArgumentNullException.ThrowIfNull(source); + Format = format; + Source = source; + } + + /// The client the file came from. + public ImportFormat Format { get; } + + /// The file's name (not its whole path), for the review. + public string Source { get; } + + /// The worlds the file names, each with the characters it names. + public List Worlds { get; } = new(); + + /// The automation read. Its name is decided by the plan (Imported from …). + public TriggerSet Set { get; } = new(); + + /// Passwords the file held, never stored without the player's yes. + public List Passwords { get; } = new(); + + /// What was left out, by name, up to . + public List Skipped { get; } = new(); + + /// How many things were left out, including those past the listed ones. + public int SkippedCount { get; private set; } + + /// Whether there is anything to import at all. + public bool IsEmpty => + Worlds.Count == 0 && Set.Triggers.Count == 0 && Set.Aliases.Count == 0 && Set.Timers.Count == 0 && Set.Macros.Count == 0; + + /// How many rules the set holds. + public int RuleCount => Set.Triggers.Count + Set.Aliases.Count + Set.Timers.Count + Set.Macros.Count; + + /// Records something left out. + public void Skip(string kind, string? name, string reason) + { + SkippedCount++; + if (Skipped.Count < ImportLimits.MaxListedSkips) + { + Skipped.Add(new ImportSkip(kind, ImportText.Name(name) is { Length: > 0 } n ? n : "(unnamed)", reason)); + } + } + + /// Whether another may be added; when not, it is recorded as left out. + internal bool Room(string kind, int count, string? name) + { + if (count < ImportLimits.MaxItems) + { + return true; + } + + Skip(kind, name, $"past the limit of {ImportLimits.MaxItems} {kind}s in one file"); + return false; + } +} diff --git a/src/SharpMUTerm.Core/Import/ImportText.cs b/src/SharpMUTerm.Core/Import/ImportText.cs new file mode 100644 index 00000000..c4680971 --- /dev/null +++ b/src/SharpMUTerm.Core/Import/ImportText.cs @@ -0,0 +1,179 @@ +using System.Globalization; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Linq; +using SharpMUTerm.Core.Automation; + +namespace SharpMUTerm.Core.Import; + +/// +/// The pieces every reader shares: bounding the text it takes, turning another client's capture references into the +/// $1 this client's engines expand, and reading XML without letting the file reach anything but itself. +/// +internal static class ImportText +{ + /// A name: control characters gone, trimmed, at most long. + public static string Name(string? text) + { + if (string.IsNullOrEmpty(text)) + { + return string.Empty; + } + + var clean = new string(text.Where(c => !char.IsControl(c)).ToArray()).Trim(); + return clean.Length > ImportLimits.MaxName ? clean[..(ImportLimits.MaxName - 1)] + "…" : clean; + } + + /// + /// A pattern or a command: line breaks kept as \n, every other control character dropped. Null when it is + /// longer than — never cut short, because a shorter command is another command. + /// + public static string? Body(string? text) + { + if (string.IsNullOrEmpty(text)) + { + return string.Empty; + } + + var builder = new StringBuilder(text.Length); + foreach (var c in text.Replace("\r\n", "\n", StringComparison.Ordinal).Replace('\r', '\n')) + { + if (c == '\n' || !char.IsControl(c)) + { + builder.Append(c); + } + } + + var body = builder.ToString().Trim('\n'); + return body.Length > ImportLimits.MaxText ? null : body; + } + + /// Text the engines read as a substitution with nothing to substitute: every $ doubled. + public static string Literal(string text) => text.Replace("$", "$$", StringComparison.Ordinal); + + /// + /// A MUSHclient send: %0–%9 become $0–$9, %% is a percent sign, and a $ + /// is doubled so the engine does not read it as a reference. + /// + public static string PercentReferences(string text) + { + var builder = new StringBuilder(text.Length); + for (var i = 0; i < text.Length; i++) + { + var c = text[i]; + if (c == '%' && i + 1 < text.Length && char.IsAsciiDigit(text[i + 1])) + { + builder.Append('$').Append(text[i + 1]); + i++; + } + else if (c == '%' && i + 1 < text.Length && text[i + 1] == '%') + { + builder.Append('%'); + i++; + } + else if (c == '$') + { + builder.Append("$$"); + } + else + { + builder.Append(c); + } + } + + return builder.ToString(); + } + + /// A whole-line wildcard pattern (* tells you *) as an anchored regex, each * a capture. + public static string AnchoredWildcard(string pattern) => "^" + TriggerPatterns.WildcardToRegex(pattern) + "$"; + + /// Literal text as a regex matching exactly the whole line. + public static string ExactLine(string text) => "^" + TriggerPatterns.Literal(text) + "$"; + + /// Whether compiles as a .NET regex. + public static bool Compiles(string pattern) + { + try + { + _ = new Regex(pattern, RegexOptions.None, AutomationDefaults.RegexMatchTimeout); + return true; + } + catch (ArgumentException) + { + return false; + } + } + + /// + /// Reads XML that came from another program: no DTD processed (both MUSHclient and Mudlet files carry a bare + /// DOCTYPE, which is ignored), no entity expanded from outside, nothing resolved, and the size capped. + /// Null when it is not XML. + /// + public static XDocument? Xml(string text) + { + var settings = new XmlReaderSettings + { + DtdProcessing = DtdProcessing.Ignore, + XmlResolver = null, + MaxCharactersFromEntities = 1024, + MaxCharactersInDocument = ImportLimits.MaxFileBytes, + IgnoreComments = true, + IgnoreProcessingInstructions = true, + CheckCharacters = false, + }; + try + { + using var reader = XmlReader.Create(new StringReader(text), settings); + return XDocument.Load(reader, LoadOptions.None); + } + catch (XmlException) + { + return null; + } + } + + /// An attribute's value, or null. + public static string? Attr(XElement element, string name) => element.Attribute(name)?.Value; + + /// Whether a MUSHclient-style flag attribute (y/1/yes) is set. + public static bool Flag(XElement element, string name, bool fallback = false) + { + var value = Attr(element, name); + return value is null + ? fallback + : value.Equals("y", StringComparison.OrdinalIgnoreCase) + || value.Equals("yes", StringComparison.OrdinalIgnoreCase) + || value == "1" + || value.Equals("true", StringComparison.OrdinalIgnoreCase); + } + + /// An attribute read as an integer, or . + public static int Int(XElement element, string name, int fallback = 0) => + int.TryParse(Attr(element, name), NumberStyles.Integer, CultureInfo.InvariantCulture, out var value) ? value : fallback; + + /// An attribute read as a number, or . + public static double Number(XElement element, string name, double fallback = 0) => + double.TryParse(Attr(element, name), NumberStyles.Float, CultureInfo.InvariantCulture, out var value) ? value : fallback; + + /// A child element's text, or null. + public static string? Child(XElement element, string name) => element.Element(name)?.Value; + + /// A port read as one, or null when it is not 1–65535. + public static int? Port(string? text) => + int.TryParse(text?.Trim(), NumberStyles.None, CultureInfo.InvariantCulture, out var port) && port is > 0 and <= 65535 + ? port + : null; + + /// A host as one: no spaces or control characters, at most a DNS name long. Null when it is not one. + public static string? Host(string? text) + { + var host = text?.Trim() ?? string.Empty; + if (host.Length is 0 or > 253 || host.Any(c => char.IsWhiteSpace(c) || char.IsControl(c) || c is '/' or '\\' or '@')) + { + return null; + } + + return host; + } +} diff --git a/src/SharpMUTerm.Core/Import/MudletImport.cs b/src/SharpMUTerm.Core/Import/MudletImport.cs new file mode 100644 index 00000000..0ecbe64c --- /dev/null +++ b/src/SharpMUTerm.Core/Import/MudletImport.cs @@ -0,0 +1,530 @@ +using System.IO.Compression; +using System.Text; +using System.Xml.Linq; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Import; + +/// +/// Reads Mudlet's XML (MudletPackage): a profile save from a profile's current/ folder, a package or +/// module export, or a zip (.mpackage) holding one — its triggers, aliases, timers and keys, folders flattened +/// (a rule inside a disabled folder comes in disabled). A profile folder adds its world from the url, +/// port and login files Mudlet keeps beside the saves. +/// +/// Lua is never imported. Mudlet's rules carry two actions, a plain command and a Lua body; the command is kept +/// and the Lua is listed as left out. A rule whose only action is Lua is left out whole — keeping it as a rule that +/// does nothing would put a dead rule in the player's set, and translating Lua is not something an importer should +/// guess at. Scripts, buttons and chains (a trigger that gates the triggers inside it) are listed and left out too. +/// +/// +public static class MudletImport +{ + // Mudlet's trigger pattern kinds (regexCodePropertyList). + private const int Substring = 0; + private const int Perl = 1; + private const int BeginOfLine = 2; + private const int Exact = 3; + + // Qt's key codes and modifiers, which Mudlet stores as numbers. + private const int QtF1 = 0x01000030; + private const int QtShift = 0x02000000; + private const int QtControl = 0x04000000; + private const int QtAlt = 0x08000000; + private const int QtKeypad = 0x20000000; + + /// Whether looks like Mudlet's XML. + public static bool Recognises(string text) => text.Contains("Reads Mudlet's XML , or says why it is not that. + public static (ImportResult? Result, string? Problem) Parse(string text, string source) + { + ArgumentNullException.ThrowIfNull(text); + var result = new ImportResult(ImportFormat.Mudlet, source); + return Read(text, result) is { } problem ? (null, problem) : (result, null); + } + + /// + /// Reads a Mudlet profile folder: the newest save in current/, and the world from the url, port + /// and login files. Its password file, if any, is offered on the review and never stored without a yes. + /// + public static (ImportResult? Result, string? Problem) ReadProfile(string folder) + { + ArgumentNullException.ThrowIfNull(folder); + var directory = new DirectoryInfo(folder); + var result = new ImportResult(ImportFormat.Mudlet, directory.Name); + var current = new DirectoryInfo(Path.Combine(directory.FullName, "current")); + var save = current.Exists + ? current.EnumerateFiles("*.xml").Take(ImportLimits.MaxZipEntries).OrderByDescending(f => f.LastWriteTimeUtc).FirstOrDefault() + : null; + if (save is not null) + { + if (save.Length > ImportLimits.MaxFileBytes) + { + return (null, "the profile's newest save is too large to read"); + } + + if (Read(File.ReadAllText(save.FullName), result) is { } problem) + { + return (null, problem); + } + } + + AddProfileWorld(directory, directory.Name, result); + return result.IsEmpty && save is null + ? (null, "that folder is not a Mudlet profile (it has no current/ saves and no url file)") + : (result, null); + } + + /// Reads the first Mudlet XML in a zip (a .mpackage), extracting nothing to disk. + public static (ImportResult? Result, string? Problem) ReadZip(byte[] bytes, string source) + { + ArgumentNullException.ThrowIfNull(bytes); + try + { + using var zip = new ZipArchive(new MemoryStream(bytes), ZipArchiveMode.Read); + foreach (var entry in zip.Entries.Take(ImportLimits.MaxZipEntries)) + { + if (!entry.FullName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase) || entry.Length > ImportLimits.MaxFileBytes) + { + continue; + } + + var text = ReadBounded(entry); + if (text is not null && Recognises(text)) + { + return Parse(text, source); + } + } + } + catch (InvalidDataException) + { + return (null, "that zip cannot be read"); + } + + return (null, "that zip holds no Mudlet package XML"); + } + + /// + /// When is a save inside a profile's current/ folder, the profile's world is added + /// from the files beside it. + /// + public static void AddProfileWorldFor(string file, ImportResult result) + { + var current = new FileInfo(file).Directory; + if (current is { Name: "current", Parent: { } profile } && File.Exists(Path.Combine(profile.FullName, "url"))) + { + AddProfileWorld(profile, profile.Name, result); + } + } + + private static string? ReadBounded(ZipArchiveEntry entry) + { + using var stream = entry.Open(); + var buffer = new MemoryStream(); + var chunk = new byte[81920]; + int read; + while ((read = stream.Read(chunk, 0, chunk.Length)) > 0) + { + buffer.Write(chunk, 0, read); + if (buffer.Length > ImportLimits.MaxFileBytes) + { + return null; + } + } + + return Encoding.UTF8.GetString(buffer.GetBuffer(), 0, (int)buffer.Length); + } + + private static string? ReadSmallFile(DirectoryInfo folder, string name) + { + var file = new FileInfo(Path.Combine(folder.FullName, name)); + return file.Exists && file.Length <= 1024 ? File.ReadAllText(file.FullName).Trim() : null; + } + + private static void AddProfileWorld(DirectoryInfo profile, string name, ImportResult result) + { + if (result.Worlds.Count > 0) + { + return; + } + + var host = ImportText.Host(ReadSmallFile(profile, "url")); + if (host is null) + { + return; + } + + var world = new WorldDefinition + { + Name = ImportText.Name(name) is { Length: > 0 } n ? n : host, + Host = host, + Port = ImportText.Port(ReadSmallFile(profile, "port")) ?? 23, + UseTls = ReadSmallFile(profile, "ssl_tls_enabled") is "true" or "1", + }; + var login = ImportText.Name(ReadSmallFile(profile, "login")); + if (login.Length > 0) + { + world.Characters.Add(new CharacterDefinition { Name = login }); + if (ReadSmallFile(profile, "password") is { Length: > 0 and <= ImportLimits.MaxName } password) + { + result.Passwords.Add(new ImportedPassword(0, login, password)); + } + } + + result.Worlds.Add(world); + } + + private static string? Read(string text, ImportResult result) + { + if (ImportText.Xml(text) is not { Root: { } root } || root.Name.LocalName != "MudletPackage") + { + return "not a Mudlet package or profile save"; + } + + foreach (var host in root.Elements("HostPackage").Elements("Host").Take(1)) + { + ReadHost(host, result); + } + + foreach (var package in root.Elements("TriggerPackage")) + { + Walk(package, "Trigger", "TriggerGroup", 0, true, result, ReadTrigger); + } + + foreach (var package in root.Elements("AliasPackage")) + { + Walk(package, "Alias", "AliasGroup", 0, true, result, ReadAlias); + } + + foreach (var package in root.Elements("TimerPackage")) + { + Walk(package, "Timer", "TimerGroup", 0, true, result, ReadTimer); + } + + foreach (var package in root.Elements("KeyPackage")) + { + Walk(package, "Key", "KeyGroup", 0, true, result, ReadKey); + } + + foreach (var script in root.Elements("ScriptPackage").Descendants("Script").Take(ImportLimits.MaxItems)) + { + if (!string.IsNullOrWhiteSpace(script.Element("script")?.Value)) + { + result.Skip("script", script.Element("name")?.Value, "Lua scripts are never imported"); + } + } + + foreach (var button in root.Elements("ActionPackage").Descendants("Action").Take(ImportLimits.MaxItems)) + { + result.Skip("button", button.Element("name")?.Value, "buttons are not imported"); + } + + return null; + } + + private static void ReadHost(XElement host, ImportResult result) + { + var url = ImportText.Host(ImportText.Child(host, "url")); + if (url is null) + { + return; + } + + var name = ImportText.Name(ImportText.Child(host, "name")); + var world = new WorldDefinition + { + Name = name.Length > 0 ? name : url, + Host = url, + Port = ImportText.Port(ImportText.Child(host, "port")) ?? 23, + }; + var login = ImportText.Name(ImportText.Child(host, "login")); + if (login.Length > 0) + { + world.Characters.Add(new CharacterDefinition { Name = login }); + } + + result.Worlds.Add(world); + } + + /// + /// Walks a Mudlet package's folders, handing each rule that is not a folder to with whether + /// it and every folder above it are active. A rule that has rules inside it and patterns of its own is a chain, + /// which this client has no equivalent for, so it and everything in it are left out. + /// + private static void Walk( + XElement parent, + string item, + string group, + int depth, + bool active, + ImportResult result, + Action read) + { + foreach (var element in parent.Elements()) + { + var local = element.Name.LocalName; + if (local != item && local != group) + { + continue; + } + + var name = element.Element("name")?.Value; + var on = active && ImportText.Flag(element, "isActive"); + var children = element.Elements().Where(e => e.Name.LocalName == item || e.Name.LocalName == group).ToList(); + var isFolder = ImportText.Flag(element, "isFolder") || local == group; + if (depth >= ImportLimits.MaxDepth) + { + result.Skip(item.ToLowerInvariant(), name, "nested too deeply"); + continue; + } + + if (isFolder && !HasOwnPattern(element)) + { + if (!string.IsNullOrWhiteSpace(element.Element("script")?.Value)) + { + result.Skip("script", name, "a folder's Lua is never imported"); + } + + Walk(element, item, group, depth + 1, on, result, read); + continue; + } + + if (children.Count > 0) + { + var count = element.Descendants().Count(e => e.Name.LocalName == item || e.Name.LocalName == group); + result.Skip(item.ToLowerInvariant(), name, $"it is a chain gating {count} rule{(count == 1 ? string.Empty : "s")} inside it, which this client has no equivalent for"); + continue; + } + + read(element, on, result); + } + } + + private static bool HasOwnPattern(XElement element) => + element.Element("regexCodeList")?.Elements("string").Any(s => s.Value.Length > 0) == true + || !string.IsNullOrEmpty(element.Element("regex")?.Value) + || !string.IsNullOrEmpty(element.Element("time")?.Value?.Trim('0', ':', '.')); + + /// The rule's command, its Lua listed as left out; null (and the rule left out) when Lua is all it does. + private static string? Command(XElement element, string kind, string name, string commandElement, ImportResult result) + { + var command = ImportText.Body(element.Element(commandElement)?.Value); + var lua = !string.IsNullOrWhiteSpace(element.Element("script")?.Value); + if (command is null) + { + result.Skip(kind, name, "its command is too long"); + return null; + } + + if (command.Length == 0) + { + result.Skip(kind, name, lua ? "its action is Lua, which is never imported" : "it does nothing this client can import"); + return null; + } + + if (lua) + { + result.Skip("part", name, "its Lua was left out; its command was kept"); + } + + return command; + } + + private static void ReadTrigger(XElement element, bool active, ImportResult result) + { + var name = ImportText.Name(element.Element("name")?.Value); + if (!result.Room("trigger", result.Set.Triggers.Count, name)) + { + return; + } + + if (ImportText.Flag(element, "isMultiline")) + { + result.Skip("trigger", name, "it matches across several lines"); + return; + } + + var patterns = element.Element("regexCodeList")?.Elements("string").Select(s => s.Value).ToList() ?? []; + var kinds = element.Element("regexCodePropertyList")?.Elements("integer").Select(i => int.TryParse(i.Value, out var k) ? k : -1).ToList() ?? []; + if (patterns.Count == 0) + { + result.Skip("trigger", name, "it has no pattern"); + return; + } + + if (Command(element, "trigger", name, "mCommand", result) is not { } command) + { + return; + } + + var stop = ImportText.Flag(element, "isFilterTrigger"); + for (var i = 0; i < patterns.Count && i < 64; i++) + { + var label = patterns.Count == 1 ? name : $"{name} ({i + 1})"; + var kind = i < kinds.Count ? kinds[i] : Substring; + if (ImportText.Body(patterns[i]) is not { Length: > 0 } raw || raw.Contains('\n')) + { + result.Skip("trigger", label, "its pattern is empty, too long or more than one line"); + continue; + } + + (string Pattern, TriggerMatchType Type)? mapped = kind switch + { + Substring => (raw, TriggerMatchType.Contains), + BeginOfLine => (raw, TriggerMatchType.StartsWith), + Exact => (ImportText.ExactLine(raw), TriggerMatchType.Regex), + Perl when ImportText.Compiles(raw) => (raw, TriggerMatchType.Regex), + _ => null, + }; + if (mapped is not { } m) + { + result.Skip("trigger", label, kind == Perl + ? "its regular expression is not one this client can read" + : "its pattern kind (Lua function, colour, prompt or line spacer) has no equivalent here"); + continue; + } + + if (!result.Room("trigger", result.Set.Triggers.Count, label)) + { + return; + } + + result.Set.Triggers.Add(new Trigger + { + Name = label, + Pattern = m.Pattern, + MatchType = m.Type, + Enabled = active, + CaseSensitive = true, + StopProcessing = stop, + Actions = { SendResponse = ImportText.Literal(command) }, + }); + } + } + + private static void ReadAlias(XElement element, bool active, ImportResult result) + { + var name = ImportText.Name(element.Element("name")?.Value); + if (!result.Room("alias", result.Set.Aliases.Count, name)) + { + return; + } + + var pattern = ImportText.Body(element.Element("regex")?.Value); + if (string.IsNullOrEmpty(pattern) || pattern.Contains('\n') || !ImportText.Compiles(pattern)) + { + result.Skip("alias", name, string.IsNullOrEmpty(pattern) ? "it has no pattern" : "its regular expression is not one this client can read"); + return; + } + + if (Command(element, "alias", name, "command", result) is not { } command) + { + return; + } + + result.Set.Aliases.Add(new Alias + { + Name = name, + Pattern = pattern, + Enabled = active, + CaseSensitive = true, + Substitution = ImportText.Literal(command), + }); + } + + private static void ReadTimer(XElement element, bool active, ImportResult result) + { + var name = ImportText.Name(element.Element("name")?.Value); + if (!result.Room("timer", result.Set.Timers.Count, name)) + { + return; + } + + if (ImportText.Flag(element, "isTempTimer") || ImportText.Flag(element, "isOffsetTimer")) + { + result.Skip("timer", name, "it is a temporary or offset timer"); + return; + } + + var time = element.Element("time")?.Value?.Trim() ?? string.Empty; + if (!TimeSpan.TryParseExact(time, [@"hh\:mm\:ss\.fff", @"hh\:mm\:ss", @"h\:mm\:ss\.fff", @"hh\:mm\:ss\.ff", @"hh\:mm\:ss\.f"], System.Globalization.CultureInfo.InvariantCulture, out var interval) + || interval.TotalSeconds is < 0.1 or > 86400) + { + result.Skip("timer", name, "its interval is not between a tenth of a second and a day"); + return; + } + + if (Command(element, "timer", name, "command", result) is not { } command) + { + return; + } + + result.Set.Timers.Add(new TimerDefinition + { + Name = name, + IntervalSeconds = Math.Round(interval.TotalSeconds, 2), + Command = command, + Enabled = active, + }); + } + + private static void ReadKey(XElement element, bool active, ImportResult result) + { + var name = ImportText.Name(element.Element("name")?.Value); + if (!result.Room("key", result.Set.Macros.Count, name)) + { + return; + } + + var code = int.TryParse(element.Element("keyCode")?.Value, out var c) ? c : 0; + var modifiers = int.TryParse(element.Element("keyModifier")?.Value, out var m) ? m : 0; + if (KeyName(code, modifiers) is not { } descriptor || MacroKey.Canonicalise(descriptor) is not { } key) + { + result.Skip("key", name, "its key has no name here (only function keys, letters, digits and the keypad do)"); + return; + } + + if (Command(element, "key", name, "command", result) is not { } command) + { + return; + } + + if (result.Set.Macros.Any(existing => string.Equals(existing.Key, key, StringComparison.Ordinal))) + { + result.Skip("key", name, $"{key} is already bound by another key in this file"); + return; + } + + result.Set.Macros.Add(new Macro { Name = name.Length > 0 ? name : key, Key = key, Command = command, Enabled = active }); + } + + /// A Qt key code and modifier mask as a descriptor (Ctrl+F2, Num8), or null. + internal static string? KeyName(int code, int modifiers) + { + string? key = code switch + { + >= QtF1 and < QtF1 + 24 => "F" + (code - QtF1 + 1), + >= 'A' and <= 'Z' => ((char)code).ToString(), + >= '0' and <= '9' when (modifiers & QtKeypad) != 0 => "Num" + (char)code, + >= '0' and <= '9' => ((char)code).ToString(), + _ => null, + }; + if (key is null) + { + return null; + } + + var ctrl = (modifiers & QtControl) != 0; + var alt = (modifiers & QtAlt) != 0; + var shift = (modifiers & QtShift) != 0; + + // A bare letter or digit is typing, not a key to bind. + if (key.Length == 1 && !ctrl && !alt) + { + return null; + } + + return MacroKey.Describe(key, ctrl, alt, shift); + } +} diff --git a/src/SharpMUTerm.Core/Import/MushclientImport.cs b/src/SharpMUTerm.Core/Import/MushclientImport.cs new file mode 100644 index 00000000..060165ec --- /dev/null +++ b/src/SharpMUTerm.Core/Import/MushclientImport.cs @@ -0,0 +1,347 @@ +using System.Text.RegularExpressions; +using System.Xml.Linq; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Import; + +/// +/// Reads a MUSHclient world file (.mcl, the XML format MUSHclient has written since 3.x): the world's name, +/// host and port, its player, and its triggers, aliases, timers, function-key macros and keypad keys. +/// +/// Only what sends text is imported. A rule whose send_to is the world (0) or the command processor (10) +/// becomes a rule here; one that sends to a script, a variable, the notepad or the output is left out and listed. +/// A script="…" function name, the file's <script> and its plugins are never imported and never +/// run: they are VBScript, Lua, JScript or Python written for MUSHclient's own object model. +/// +/// +/// MUSHclient matches a non-regex pattern against the whole line, each * a wildcard, so such a pattern +/// becomes an anchored regex — or, when it already starts and ends with *, this client's own wildcard kind, +/// which means the same thing. +/// +/// +public static class MushclientImport +{ + private static readonly Regex FunctionKey = new(@"^((Ctrl|Shift|Alt)\+)*F([1-9]|1[0-9]|2[0-4])$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); + + /// Whether looks like a MUSHclient world file. + public static bool Recognises(string text) => text.Contains("Reads , or says why it is not a MUSHclient world file. + public static (ImportResult? Result, string? Problem) Parse(string text, string source) + { + ArgumentNullException.ThrowIfNull(text); + if (ImportText.Xml(text) is not { Root: { } root } || !root.Name.LocalName.Equals("muclient", StringComparison.OrdinalIgnoreCase)) + { + return (null, "not a MUSHclient world file (worlds saved before MUSHclient 3 are not XML and cannot be read)"); + } + + var result = new ImportResult(ImportFormat.MushClient, source); + foreach (var world in root.Elements("world")) + { + ReadWorld(world, result); + } + + foreach (var trigger in root.Elements("triggers").Elements("trigger").OrderBy(t => ImportText.Int(t, "sequence", 100))) + { + ReadTrigger(trigger, result); + } + + foreach (var alias in root.Elements("aliases").Elements("alias").OrderBy(a => ImportText.Int(a, "sequence", 100))) + { + ReadAlias(alias, result); + } + + foreach (var timer in root.Elements("timers").Elements("timer")) + { + ReadTimer(timer, result); + } + + foreach (var macro in root.Elements("macros").Elements("macro")) + { + ReadMacro(macro, result); + } + + foreach (var key in root.Elements("keypad").Elements("key")) + { + ReadKeypad(key, result); + } + + foreach (var script in root.Elements("script")) + { + if (!string.IsNullOrWhiteSpace(script.Value)) + { + result.Skip("script", "world script", "script code is never imported"); + } + } + + foreach (var plugin in root.Elements("include").Concat(root.Elements("plugins").Elements())) + { + result.Skip("plugin", ImportText.Attr(plugin, "name") ?? ImportText.Attr(plugin, "plugin"), "plugins are never imported"); + } + + return (result, null); + } + + private static void ReadWorld(XElement element, ImportResult result) + { + var name = ImportText.Name(ImportText.Attr(element, "name")); + if (result.Worlds.Count >= ImportLimits.MaxWorlds) + { + result.Skip("world", name, "past the limit of worlds in one file"); + return; + } + + var host = ImportText.Host(ImportText.Attr(element, "site")); + var port = ImportText.Port(ImportText.Attr(element, "port")) ?? 4000; + if (host is null) + { + result.Skip("world", name, "it names no host"); + return; + } + + var world = new WorldDefinition { Name = name.Length > 0 ? name : host, Host = host, Port = port }; + var player = ImportText.Name(ImportText.Attr(element, "player")); + if (player.Length > 0) + { + world.Characters.Add(new CharacterDefinition { Name = player }); + var password = ImportText.Attr(element, "password"); + if (!string.IsNullOrEmpty(password) && password.Length <= ImportLimits.MaxName) + { + result.Passwords.Add(new ImportedPassword(result.Worlds.Count, player, password)); + } + } + + result.Worlds.Add(world); + } + + /// The command a rule sends, or null (and the rule listed as left out) when it sends somewhere else. + private static string? Send(XElement element, string kind, string name, ImportResult result) + { + var sendTo = ImportText.Int(element, "send_to", 0); + var body = ImportText.Body(ImportText.Child(element, "send")); + if (body is null) + { + result.Skip(kind, name, "its command is too long"); + return null; + } + + if (sendTo is not (0 or 10) && body.Length > 0) + { + result.Skip(kind, name, sendTo is 12 or 14 ? "it sends to a script, which is never imported" : "it sends somewhere other than the world"); + return null; + } + + return ImportText.PercentReferences(body); + } + + private static string? Pattern(XElement element, string kind, string name, ImportResult result, out TriggerMatchType type) + { + type = TriggerMatchType.Regex; + var match = ImportText.Body(ImportText.Attr(element, "match")); + if (string.IsNullOrEmpty(match)) + { + result.Skip(kind, name, match is null ? "its pattern is too long" : "it has no pattern"); + return null; + } + + if (match.Contains('\n')) + { + result.Skip(kind, name, "it matches more than one line"); + return null; + } + + if (ImportText.Flag(element, "regexp")) + { + if (!ImportText.Compiles(match)) + { + result.Skip(kind, name, "its regular expression is not one this client can read"); + return null; + } + + return match; + } + + // A whole-line wildcard. `*text*` already means "anywhere", which is this client's own wildcard kind. + if (kind == "trigger" && match.Length > 2 && match[0] == '*' && match[^1] == '*' && match.Trim('*').Length > 0) + { + type = TriggerMatchType.Wildcard; + return match; + } + + return ImportText.AnchoredWildcard(match); + } + + private static void ReadTrigger(XElement element, ImportResult result) + { + var name = ImportText.Name(ImportText.Attr(element, "name") is { Length: > 0 } n ? n : ImportText.Attr(element, "match")); + if (!result.Room("trigger", result.Set.Triggers.Count, name)) + { + return; + } + + if (ImportText.Flag(element, "multi_line")) + { + result.Skip("trigger", name, "it matches more than one line"); + return; + } + + if (Pattern(element, "trigger", name, result, out var type) is not { } pattern || Send(element, "trigger", name, result) is not { } send) + { + return; + } + + var gag = ImportText.Flag(element, "omit_from_output"); + if (send.Length == 0 && !gag) + { + result.Skip("trigger", name, ImportText.Attr(element, "script") is { Length: > 0 } + ? "it only calls a script function, which is never imported" + : "it does nothing this client can import (colours or sounds only)"); + return; + } + + if (ImportText.Attr(element, "script") is { Length: > 0 } function) + { + result.Skip("part", name, $"its script function {ImportText.Name(function)} was left out"); + } + + result.Set.Triggers.Add(new Trigger + { + Name = name, + Pattern = pattern, + MatchType = type, + Enabled = ImportText.Flag(element, "enabled", fallback: true), + CaseSensitive = !ImportText.Flag(element, "ignore_case"), + StopProcessing = !ImportText.Flag(element, "keep_evaluating"), + Actions = { Gag = gag, SendResponse = send.Length > 0 ? send : null }, + }); + } + + private static void ReadAlias(XElement element, ImportResult result) + { + var name = ImportText.Name(ImportText.Attr(element, "name") is { Length: > 0 } n ? n : ImportText.Attr(element, "match")); + if (!result.Room("alias", result.Set.Aliases.Count, name) + || Pattern(element, "alias", name, result, out _) is not { } pattern + || Send(element, "alias", name, result) is not { } send) + { + return; + } + + if (send.Length == 0) + { + result.Skip("alias", name, "it sends nothing (a script function or nothing at all)"); + return; + } + + result.Set.Aliases.Add(new Alias + { + Name = name, + Pattern = pattern, + Enabled = ImportText.Flag(element, "enabled", fallback: true), + CaseSensitive = !ImportText.Flag(element, "ignore_case"), + Substitution = send, + }); + } + + private static void ReadTimer(XElement element, ImportResult result) + { + var name = ImportText.Name(ImportText.Attr(element, "name") is { Length: > 0 } n ? n : "timer"); + if (!result.Room("timer", result.Set.Timers.Count, name)) + { + return; + } + + if (ImportText.Flag(element, "at_time")) + { + result.Skip("timer", name, "it fires at a time of day, and timers here repeat on an interval"); + return; + } + + var seconds = (ImportText.Number(element, "hour") * 3600) + (ImportText.Number(element, "minute") * 60) + ImportText.Number(element, "second"); + if (seconds is < 0.1 or > 86400 || double.IsNaN(seconds)) + { + result.Skip("timer", name, "its interval is not between a tenth of a second and a day"); + return; + } + + if (Send(element, "timer", name, result) is not { } send) + { + return; + } + + if (send.Length == 0) + { + result.Skip("timer", name, "it sends nothing (a script function or nothing at all)"); + return; + } + + result.Set.Timers.Add(new TimerDefinition + { + Name = name, + IntervalSeconds = Math.Round(seconds, 2), + Command = send.Replace("$$", "$", StringComparison.Ordinal), + OneShot = ImportText.Flag(element, "one_shot"), + Enabled = ImportText.Flag(element, "enabled", fallback: true), + }); + } + + private static void ReadMacro(XElement element, ImportResult result) + { + var name = ImportText.Name(ImportText.Attr(element, "name")); + var body = ImportText.Body(ImportText.Child(element, "send")); + if (string.IsNullOrEmpty(body)) + { + return; + } + + if (!FunctionKey.IsMatch(name) || MacroKey.Canonicalise(name) is not { } key) + { + result.Skip("key", name, "only function-key macros have a key here"); + return; + } + + if (!string.Equals(ImportText.Attr(element, "type"), "send_now", StringComparison.OrdinalIgnoreCase)) + { + result.Skip("key", name, "it puts text on the command line rather than sending it"); + return; + } + + AddMacro(result, name, key, body); + } + + private static void ReadKeypad(XElement element, ImportResult result) + { + var name = ImportText.Name(ImportText.Attr(element, "name")); + var body = ImportText.Body(ImportText.Child(element, "send")); + if (string.IsNullOrEmpty(body)) + { + return; + } + + var ctrl = name.StartsWith("Ctrl+", StringComparison.OrdinalIgnoreCase); + var digit = ctrl ? name[5..] : name; + if (digit.Length != 1 || !char.IsAsciiDigit(digit[0]) || MacroKey.Canonicalise((ctrl ? "Ctrl+" : string.Empty) + "Num" + digit) is not { } key) + { + result.Skip("key", "keypad " + name, "only the keypad's digits have a key here"); + return; + } + + AddMacro(result, "keypad " + name, key, body); + } + + private static void AddMacro(ImportResult result, string name, string key, string body) + { + if (!result.Room("key", result.Set.Macros.Count, name)) + { + return; + } + + if (result.Set.Macros.Any(m => string.Equals(m.Key, key, StringComparison.Ordinal))) + { + result.Skip("key", name, $"{key} is already bound by another key in this file"); + return; + } + + result.Set.Macros.Add(new Macro { Name = name, Key = key, Command = body }); + } +} diff --git a/src/SharpMUTerm.Core/Import/TinTinImport.cs b/src/SharpMUTerm.Core/Import/TinTinImport.cs new file mode 100644 index 00000000..548b29a8 --- /dev/null +++ b/src/SharpMUTerm.Core/Import/TinTinImport.cs @@ -0,0 +1,531 @@ +using System.Globalization; +using System.Text; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.Import; + +/// +/// Reads a TinTin++ script: #session (a world), #action and #gag (triggers), #alias, and +/// #ticker (a timer), each by its full name or the prefix TinTin accepts (#act, #ali, #ses). +/// Every other # command is counted as left out. +/// +/// A pattern's %1–%99 and %* become captures, %d digits, %w a word, and a +/// leading ^ anchors it as in TinTin; one with TinTin's own {regex} blocks is left out. A command list +/// is split on ; into one command per line, and a list with a # command in it is left out whole: those +/// are TinTin's own statements, which this client does not run. +/// +/// +public static class TinTinImport +{ + private static readonly (string Name, int Shortest)[] Commands = + [ + ("session", 3), + ("action", 2), + ("alias", 3), + ("ticker", 4), + ("gag", 3), + ]; + + /// Whether looks like a TinTin++ script. + public static bool Recognises(string text) => + text.Split('\n').Take(400).Any(line => line.TrimStart().StartsWith('#') + && Command(Word(line.TrimStart()[1..])) is not null); + + /// Reads . + public static (ImportResult? Result, string? Problem) Parse(string text, string source) + { + ArgumentNullException.ThrowIfNull(text); + var result = new ImportResult(ImportFormat.TinTin, source); + var others = new SortedSet(StringComparer.Ordinal); + var otherCount = 0; + foreach (var statement in Statements(text).Take(ImportLimits.MaxItems * 4)) + { + switch (Command(statement.Command)) + { + case "session": + ReadSession(statement.Arguments, result); + break; + case "action": + ReadAction(statement.Arguments, result, gag: false); + break; + case "gag": + ReadAction(statement.Arguments, result, gag: true); + break; + case "alias": + ReadAlias(statement.Arguments, result); + break; + case "ticker": + ReadTicker(statement.Arguments, result); + break; + default: + otherCount++; + if (others.Count < 8 && statement.Command.Length is > 0 and < 20) + { + others.Add("#" + statement.Command.ToLowerInvariant()); + } + + break; + } + } + + if (otherCount > 0) + { + result.Skip( + "command", + $"{otherCount} other TinTin command{(otherCount == 1 ? string.Empty : "s")}", + string.Join(" ", others) + " — TinTin's own statements are not run here"); + } + + return result.IsEmpty && result.SkippedCount == 0 ? (null, "no TinTin++ #session, #action, #alias or #ticker lines in that file") : (result, null); + } + + /// The full command a typed word names (TinTin accepts any prefix down to a minimum), or null. + private static string? Command(string word) + { + var lower = word.ToLowerInvariant(); + foreach (var (name, shortest) in Commands) + { + if (lower.Length >= shortest && name.StartsWith(lower, StringComparison.Ordinal)) + { + return name; + } + } + + return null; + } + + private static string Word(string text) + { + var end = 0; + while (end < text.Length && char.IsAsciiLetter(text[end])) + { + end++; + } + + return text[..end]; + } + + private sealed record Statement(string Command, IReadOnlyList Arguments); + + /// + /// The script's statements: a #word and its arguments, each a {…} group (nested, across lines) or a + /// bare word, up to a newline or ; outside any group. + /// + private static IEnumerable Statements(string text) + { + var i = 0; + while (i < text.Length) + { + // To the start of the next statement: a # at the start of a line or after a ;. + while (i < text.Length && (char.IsWhiteSpace(text[i]) || text[i] == ';')) + { + i++; + } + + if (i >= text.Length) + { + yield break; + } + + if (text[i] != '#') + { + while (i < text.Length && text[i] != '\n') + { + i++; + } + + continue; + } + + i++; + var start = i; + while (i < text.Length && char.IsAsciiLetter(text[i])) + { + i++; + } + + var command = text[start..i]; + var arguments = new List(); + while (i < text.Length && text[i] != '\n' && text[i] != ';' && arguments.Count < 8) + { + if (text[i] is ' ' or '\t' or '\r') + { + i++; + } + else if (text[i] == '{') + { + var depth = 0; + var open = i; + for (; i < text.Length; i++) + { + if (text[i] == '{') + { + depth++; + } + else if (text[i] == '}' && --depth == 0) + { + break; + } + } + + arguments.Add(text[(open + 1)..Math.Min(i, text.Length)]); + i++; + } + else + { + var word = i; + while (i < text.Length && !char.IsWhiteSpace(text[i]) && text[i] != ';') + { + i++; + } + + arguments.Add(text[word..i]); + } + } + + yield return new Statement(command, arguments); + } + } + + private static void ReadSession(IReadOnlyList arguments, ImportResult result) + { + var name = ImportText.Name(arguments.ElementAtOrDefault(0)); + if (result.Worlds.Count >= ImportLimits.MaxWorlds) + { + result.Skip("world", name, "past the limit of worlds in one file"); + return; + } + + var host = ImportText.Host(arguments.ElementAtOrDefault(1)); + var port = ImportText.Port(arguments.ElementAtOrDefault(2)); + if (host is null || port is null) + { + result.Skip("world", name, "it does not name a host and a port"); + return; + } + + if (result.Worlds.Any(w => w.Host == host && w.Port == port)) + { + return; + } + + result.Worlds.Add(new WorldDefinition { Name = name.Length > 0 ? name : host, Host = host, Port = port.Value }); + } + + /// + /// A TinTin pattern as a regex: %1–%99 become named captures (so a command's %2 finds the right + /// one whatever order they appear in), %* an unnamed one, %d/%w typed ones. Null when it uses + /// TinTin's own regex blocks. + /// + internal static string? PatternToRegex(string pattern, bool anchorEnd = false) + { + if (pattern.Contains('{') || pattern.Contains('}')) + { + return null; + } + + var builder = new StringBuilder(); + var i = 0; + if (pattern.StartsWith('^')) + { + builder.Append('^'); + i = 1; + } + + var end = pattern.Length; + var anchored = anchorEnd; + if (end > i && pattern[end - 1] == '$' && (end < 2 || pattern[end - 2] != '\\')) + { + end--; + anchored = true; + } + + var literal = new StringBuilder(); + var seen = new HashSet(); + void Flush() + { + builder.Append(TriggerPatterns.Literal(literal.ToString())); + literal.Clear(); + } + + for (; i < end; i++) + { + var c = pattern[i]; + if (c != '%' || i + 1 >= end) + { + literal.Append(c); + continue; + } + + var next = pattern[i + 1]; + var last = i + 2 >= end; + if (char.IsAsciiDigit(next)) + { + var j = i + 1; + while (j < end && j < i + 3 && char.IsAsciiDigit(pattern[j])) + { + j++; + } + + var number = int.Parse(pattern[(i + 1)..j], CultureInfo.InvariantCulture); + Flush(); + last = j >= end; + var body = last ? ".*" : ".*?"; + builder.Append(seen.Add(number) ? $"(?{body})" : $"\\k"); + i = j - 1; + } + else if (next is '*' or 'd' or 'w' or 's' or 'D' or 'W' or 'S') + { + Flush(); + builder.Append(next switch + { + '*' => last ? "(.*)" : "(.*?)", + 'd' => "([0-9]+)", + 'w' => "([A-Za-z]+)", + 's' => "(\\s+)", + 'D' => "([^0-9]+)", + 'W' => "([^A-Za-z]+)", + _ => "(\\S+)", + }); + i++; + } + else if (next == '%') + { + literal.Append('%'); + i++; + } + else + { + literal.Append(c); + } + } + + Flush(); + if (anchored) + { + builder.Append('$'); + } + + var regex = builder.ToString(); + return ImportText.Compiles(regex) ? regex : null; + } + + /// + /// A TinTin command list as this client's: split on ; outside braces, one per line, %N becoming the + /// matching capture. Null when it holds a # command. + /// + internal static string? CommandsToSubstitution(string commands, Func reference) + { + var parts = new List(); + var current = new StringBuilder(); + var depth = 0; + foreach (var c in commands) + { + if (c == '{') + { + depth++; + } + else if (c == '}') + { + depth = Math.Max(0, depth - 1); + } + + if (c == ';' && depth == 0) + { + parts.Add(current.ToString()); + current.Clear(); + } + else if (c != '\n' && c != '\r') + { + current.Append(c); + } + } + + parts.Add(current.ToString()); + var lines = new List(); + foreach (var part in parts.Select(p => p.Trim()).Where(p => p.Length > 0)) + { + if (part.StartsWith('#')) + { + return null; + } + + var line = new StringBuilder(); + for (var i = 0; i < part.Length; i++) + { + var c = part[i]; + if (c == '%' && i + 1 < part.Length && char.IsAsciiDigit(part[i + 1])) + { + var j = i + 1; + while (j < part.Length && j < i + 3 && char.IsAsciiDigit(part[j])) + { + j++; + } + + line.Append(reference(int.Parse(part[(i + 1)..j], CultureInfo.InvariantCulture))); + i = j - 1; + } + else if (c == '$') + { + line.Append("$$"); + } + else if (c is '{' or '}') + { + // Braces only group in TinTin; they are not text. + } + else + { + line.Append(c); + } + } + + lines.Add(line.ToString()); + } + + return string.Join('\n', lines); + } + + private static void ReadAction(IReadOnlyList arguments, ImportResult result, bool gag) + { + var raw = arguments.ElementAtOrDefault(0) ?? string.Empty; + var name = ImportText.Name(raw); + if (!result.Room("trigger", result.Set.Triggers.Count, name)) + { + return; + } + + if (ImportText.Body(raw) is not { Length: > 0 } pattern || pattern.Contains('\n')) + { + result.Skip("trigger", name, "its pattern is empty, too long or more than one line"); + return; + } + + if (PatternToRegex(pattern) is not { } regex) + { + result.Skip("trigger", name, "it uses TinTin's own regex syntax"); + return; + } + + string? send = null; + if (!gag) + { + var commands = ImportText.Body(arguments.ElementAtOrDefault(1)); + send = commands is null ? null : CommandsToSubstitution(commands, n => n == 0 ? "$0" : $"${{t{n}}}"); + if (send is null) + { + result.Skip("trigger", name, commands is null ? "its commands are too long" : "it runs TinTin commands (#…), which are not run here"); + return; + } + + if (send.Length == 0) + { + result.Skip("trigger", name, "it sends nothing"); + return; + } + + // A reference to a capture the pattern does not have would be sent as the literal text. + for (var n = 1; n < 100; n++) + { + if (send.Contains($"${{t{n}}}", StringComparison.Ordinal) && !regex.Contains($"", StringComparison.Ordinal)) + { + send = send.Replace($"${{t{n}}}", string.Empty, StringComparison.Ordinal); + } + } + } + + result.Set.Triggers.Add(new Trigger + { + Name = (gag ? "gag " : string.Empty) + name, + Pattern = regex, + Enabled = true, + CaseSensitive = true, + StopProcessing = false, + Actions = { Gag = gag, SendResponse = send }, + }); + } + + private static void ReadAlias(IReadOnlyList arguments, ImportResult result) + { + var raw = arguments.ElementAtOrDefault(0) ?? string.Empty; + var name = ImportText.Name(raw); + if (!result.Room("alias", result.Set.Aliases.Count, name)) + { + return; + } + + var commands = ImportText.Body(arguments.ElementAtOrDefault(1)); + if (name.Length == 0 || commands is null) + { + result.Skip("alias", name, name.Length == 0 ? "it has no name" : "its commands are too long"); + return; + } + + string? pattern; + string? substitution; + if (raw.Contains('%')) + { + // The pattern names its own arguments. + pattern = PatternToRegex(raw.StartsWith('^') ? raw : "^" + raw, anchorEnd: true); + substitution = pattern is null ? null : CommandsToSubstitution(commands, n => n == 0 ? "$0" : $"${{t{n}}}"); + } + else if (raw.Any(char.IsWhiteSpace)) + { + pattern = ImportText.ExactLine(raw); + substitution = CommandsToSubstitution(commands, _ => string.Empty); + } + else + { + // A bare word: %0 is everything after it, %1–%3 its first three words. + pattern = "^" + TriggerPatterns.Literal(raw) + + @"(?:\s+(?(?\S+)(?:\s+(?\S+))?(?:\s+(?\S+))?.*))?$"; + substitution = CommandsToSubstitution(commands, n => n <= 3 ? $"${{a{n}}}" : "\u0000"); + if (substitution?.Contains('\u0000') == true) + { + result.Skip("alias", name, "it uses more than three arguments"); + return; + } + } + + if (pattern is null || substitution is null || substitution.Length == 0) + { + result.Skip("alias", name, pattern is null + ? "it uses TinTin's own regex syntax" + : substitution is null ? "it runs TinTin commands (#…), which are not run here" : "it sends nothing"); + return; + } + + result.Set.Aliases.Add(new Alias { Name = name, Pattern = pattern, CaseSensitive = true, Substitution = substitution }); + } + + private static void ReadTicker(IReadOnlyList arguments, ImportResult result) + { + var name = ImportText.Name(arguments.ElementAtOrDefault(0)); + if (!result.Room("timer", result.Set.Timers.Count, name)) + { + return; + } + + var commands = ImportText.Body(arguments.ElementAtOrDefault(1)); + var send = commands is null ? null : CommandsToSubstitution(commands, _ => string.Empty); + if (!double.TryParse(arguments.ElementAtOrDefault(2), NumberStyles.Float, CultureInfo.InvariantCulture, out var seconds) + || seconds is < 0.1 or > 86400) + { + result.Skip("timer", name, "its interval is not between a tenth of a second and a day"); + return; + } + + if (string.IsNullOrEmpty(send)) + { + result.Skip("timer", name, send is null ? "it runs TinTin commands (#…), which are not run here" : "it sends nothing"); + return; + } + + result.Set.Timers.Add(new TimerDefinition + { + Name = name, + IntervalSeconds = seconds, + Command = send.Replace("$$", "$", StringComparison.Ordinal), + }); + } +} diff --git a/src/SharpMUTerm.Tui/DemoImport.cs b/src/SharpMUTerm.Tui/DemoImport.cs new file mode 100644 index 00000000..fb012ba2 --- /dev/null +++ b/src/SharpMUTerm.Tui/DemoImport.cs @@ -0,0 +1,45 @@ +namespace SharpMUTerm.Tui; + +/// +/// A MUSHclient world file the demo's import-review view reads, written for this client (no third-party file): +/// one world with a player and a password, rules that import, and rules that cannot — a script function, a send to a +/// script, a time-of-day timer, a command-line macro and a plugin — so the review shows each of its sections. +/// +internal static class DemoImport +{ + internal const string MushclientName = "Northwind.mcl"; + + internal const string Mushclient = """ + + + + + + page %1=Away, back soon. + eat bread + + emote nods. + UpdateGauge("%1") + + + get %1 + give %1 to Wren + wake + stand + + + look + say midnight + + + score + say + + + north + south + + + + """; +} diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 3315ce2a..35b28501 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -154,6 +154,12 @@ internal sealed record ClientHost /// public required IAttention? Attention { get; init; } + /// + /// The desktop's file picker, for an import from another client (), or null where there is + /// none: the terminal (a path is typed after /import), the snapshot, the tests and --plain. + /// + public required IFilePicker? FilePicker { get; init; } + /// /// Whether the terminal driver's input path can decode a focus report. Not on Windows: the Windows branch of /// NetConsoleDriver is a Console.ReadKey loop with its own reassembly, and an ESC [ I @@ -199,6 +205,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Title = new TerminalTitle(driver), FloatingPanels = null, Attention = new TerminalAttention(driver, TerminalAttention.Detect()), + FilePicker = null, }; /// @@ -229,6 +236,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Title = null, FloatingPanels = null, Attention = null, + FilePicker = null, }; /// diff --git a/src/SharpMUTerm.Tui/Hosting/IFilePicker.cs b/src/SharpMUTerm.Tui/Hosting/IFilePicker.cs new file mode 100644 index 00000000..a3fb7819 --- /dev/null +++ b/src/SharpMUTerm.Tui/Hosting/IFilePicker.cs @@ -0,0 +1,17 @@ +namespace SharpMUTerm.Tui; + +/// +/// A host that can ask the player for a file with the desktop's own picker (the window). The terminal has none — a +/// path is typed after /import there — and neither have the snapshot, the tests and --plain. +/// +internal interface IFilePicker +{ + /// Whether the picker can be shown now (false until the window that owns it exists). Read on the client's thread. + bool Available { get; } + + /// + /// Shows the picker titled ; is told the local path chosen, or null + /// when the player cancelled, from the host's thread (the client marshals). Called on the client's thread. + /// + void Pick(string title, Action picked); +} diff --git a/src/SharpMUTerm.Tui/ImportReview.cs b/src/SharpMUTerm.Tui/ImportReview.cs new file mode 100644 index 00000000..3537394e --- /dev/null +++ b/src/SharpMUTerm.Tui/ImportReview.cs @@ -0,0 +1,108 @@ +using SharpMUTerm.Client.Modals; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// The import review in cells: what can act as the player, what will be added, what was left out and why, the passwords +/// question, and the keys. Drawn from , the model the window's native review draws. The +/// number of lines does not change when the passwords are switched, so the modal sized when it opened still fits. +/// +internal static class ImportReview +{ + /// The width the review asks for. + internal const int PreferredWidth = 84; + + internal static List Render(ImportReviewModel model, int width) + { + ArgumentNullException.ThrowIfNull(model); + width = Math.Max(30, width); + var lines = new List { $"[bold {ScreenPalette.Value}]{Escape(model.Title)}[/]" }; + lines.AddRange(HelpSurface.Wrap(model.Intro, width - 1).Select(Label)); + + if (model.Empty) + { + lines.Add(string.Empty); + lines.Add(Label("There is nothing in it this client can import.")); + } + else + { + lines.Add(string.Empty); + lines.Add(Heading(ImportReviewModel.ActsHeading)); + if (model.ActsAsYou.Count == 0) + { + lines.Add(" " + Label("nothing: no rule in it sends a command")); + } + + foreach (var act in model.ActsAsYou) + { + lines.AddRange(Indented($"[{ScreenPalette.Caution}]•[/] ", act, width, Value)); + } + + lines.Add(string.Empty); + lines.Add(Heading(ImportReviewModel.AddsHeading)); + foreach (var row in model.Adds) + { + lines.AddRange(Indented($"[{ScreenPalette.Accent}]{Escape(row.Kind.PadRight(5))}[/] [bold {ScreenPalette.Value}]{Escape(Clip(row.Name))}[/] ", row.Detail, width, Label)); + } + } + + if (model.LeftOutCount > 0) + { + lines.Add(string.Empty); + lines.Add(Heading($"{ImportReviewModel.LeftOutHeading} ({model.LeftOutCount})")); + foreach (var row in model.LeftOut) + { + lines.AddRange(Indented($"[{ScreenPalette.Muted}]{Escape(row.Kind.PadRight(7))}[/] {Value(Clip(row.Name))} ", "— " + row.Detail, width, Label)); + } + + if (model.MoreLeftOut is { } more) + { + lines.Add(" " + Label(more)); + } + } + + if (model.PasswordLine is { } passwords) + { + lines.Add(string.Empty); + var mark = model.StorePasswords ? $"[{ScreenPalette.Accent}]●[/] " : $"[{ScreenPalette.Label}]○[/] "; + lines.AddRange(Indented(mark, passwords, width, Value, indent: 0)); + } + + lines.Add(string.Empty); + lines.Add(Keys(model.Empty ? "Esc close" : model.Keys)); + return lines; + } + + private static string Clip(string text) => text.Length > 32 ? text[..31] + "…" : text; + + private static string Heading(string text) => $"[bold {ScreenPalette.Accent}]{Escape(text)}[/]"; + + private static string Label(string text) => $"[{ScreenPalette.Label}]{Escape(text)}[/]"; + + private static string Value(string text) => $"[{ScreenPalette.Value}]{Escape(text)}[/]"; + + /// A lead and text wrapped under it, the continuation rows indented past the lead. + private static IEnumerable Indented(string lead, string text, int width, Func style, int indent = 2) + { + var leadWidth = VisibleLength(lead) + indent; + var room = Math.Max(10, width - leadWidth - 1); + var wrapped = HelpSurface.Wrap(text, room).ToList(); + var pad = new string(' ', indent); + for (var i = 0; i < wrapped.Count; i++) + { + yield return i == 0 + ? pad + lead + style(wrapped[i]) + : new string(' ', leadWidth) + style(wrapped[i]); + } + } + + private static string Keys(string keys) => + string.Join(" ", keys.Split(" · ").Select(part => + { + var space = part.IndexOf(' ', StringComparison.Ordinal); + return space < 0 + ? Label(part) + : $"[{ScreenPalette.Accent}]{Escape(part[..space])}[/] {Label(part[(space + 1)..])}"; + })); +} diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs index c3e5ce81..f9ebcfe3 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs @@ -35,6 +35,7 @@ private T Drawing(string surface, string key, T model) : surface == SurfaceCatalog.Welcome ? (_welcomeView.IsOpen ? _welcome?.Model : null) : surface == SurfaceCatalog.Help ? CellHelp?.Model : surface == SurfaceCatalog.Dictionary ? (_helpView.IsOpen && _helpView.Mode == "dictionary" ? _dictionaryOffer : null) + : surface == SurfaceCatalog.Import ? (_helpView.IsOpen && _helpView.Mode == "import" ? _pendingImport?.Model : null) : _drawnModels.TryGetValue((surface, key), out var model) ? model : null; /// A click on a header link, as the header's own handler receives it. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs new file mode 100644 index 00000000..b2ed1831 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs @@ -0,0 +1,338 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Accessibility; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Import; + +namespace SharpMUTerm.Tui; + +/// +/// Import from another client (/import <path>, ⌃P ▸ Import from another client…, the welcome's +/// Import row): MUSHclient, Mudlet and TinTin++ setups read by Core's bounded readers +/// (), planned against the configuration (), and shown as one review +/// () — a cell modal here, a native one in a host that has them. +/// +/// The review is the consent. Nothing is written until ⏎ (or the window's Import), which both end in +/// . Nothing is overwritten: the automation is a new set, an existing world only gains +/// characters it lacks, and a clashing name gets a suffix. Passwords the file held are stored only if the player +/// switches them on in the review, and then through like every password (the OS +/// credential store, else secrets.json). Script code of every kind is listed as left out and never run. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The review waiting for ⏎: the plan, whether its passwords are to be stored, and the model shown. + private (ImportPlan Plan, bool StorePasswords, ImportReviewModel Model)? _pendingImport; + + /// Whether the waiting review was said as lines (--plain), so /import yes may answer it. + private bool _importSaid; + + /// Whether the import review is open, in cells or natively. + internal bool ImportReviewOpen => + (_helpView.IsOpen && _helpView.Mode == "import") || NativeModalOf(SurfaceCatalog.Import) is not null; + + /// The review waiting, for the tests. + internal ImportReviewModel? PendingImport => _pendingImport?.Model; + + /// The native review's session while one is open, for the tests. + internal ImportReviewSession? NativeImportReview => _nativeModal as ImportReviewSession; + + /// + /// /import: with a path, reads it and opens the review; alone, starts an import the way ⌃P does. /import + /// yes, /import no and /import passwords answer a review said as lines, where no modal is drawn. + /// + private void ImportCommand(string argument) + { + var word = argument.Trim(); + if (_importSaid && _pendingImport is not null) + { + switch (word.ToLowerInvariant()) + { + case "yes": + AcceptImport(); + return; + case "no": + _pendingImport = null; + _importSaid = false; + Notice("Import cancelled; nothing was written", MessageSeverity.Info, source: NoticeModel.Sources.Import); + return; + case "passwords": + ToggleImportPasswords(); + return; + } + } + + if (word.Length == 0) + { + StartImport(); + return; + } + + ImportFrom(word); + } + + /// + /// ⌃P ▸ Import and the welcome's row: the desktop's file picker where the host has one, else /import on the + /// command line with a notice saying what path it wants. + /// + internal void StartImport() + { + if (Host.FilePicker is { Available: true } picker) + { + picker.Pick("Import from another client", path => OnUiThread(() => + { + if (path is not null) + { + ImportFrom(path); + } + })); + return; + } + + ActiveBar().SetAndNotify("/import "); + Notice( + $"Type the path to a setup from {ImportFormats.Listed} (a .mcl world, a Mudlet profile folder or save, a TinTin++ script), then Enter", + MessageSeverity.Info, + source: NoticeModel.Sources.Import); + } + + /// Reads and opens its review, or says why it cannot be imported. Writes nothing. + internal void ImportFrom(string path) + { + path = path.Trim().Trim('"', '\''); + if (path.StartsWith('~')) + { + path = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), path[1..].TrimStart('/', '\\')); + } + + var (result, problem) = ClientImport.Read(path); + if (result is null) + { + ImportRefused($"{Snippet(path)} was not imported: {problem}"); + return; + } + + ReviewImport(result); + } + + /// Opens the review for : one model whichever host draws it. Writes nothing. + internal void ReviewImport(ImportResult result) + { + ArgumentNullException.ThrowIfNull(result); + if (ImportReviewOpen) + { + CloseImportReview(); + } + + if (ComposerIsInTheWay("the import review") || (AnyOverlayOpen && Refuse($"close {OpenOverlayName()} first"))) + { + return; + } + + var plan = ImportPlan.For(_config, result); + var model = ImportReviewModel.From(plan); + _pendingImport = (plan, false, model); + _importSaid = false; + + if (!Host.ScreenIsSeen) + { + SayImport(model); + return; + } + + if (NativeModalsHost is { } native) + { + ImportReviewSession? session = null; + session = new ImportReviewSession( + model, + ThemeIsDark(), + () => OnUiThread(AcceptImport), + () => OnUiThread(ToggleImportPasswords), + () => OnUiThread(() => NativeModalClosed(session!))) + { + Theme = _theme.Clone(), + }; + ShowNativeModal(native, session); + return; + } + + _helpView.Open( + "import", + "Import", + width => ImportReview.Render(Drawing(SurfaceCatalog.Import, string.Empty, _pendingImport?.Model ?? model), width), + key => + { + if (key.Key == ConsoleKey.Enter) + { + // Accepted before the overlay closes, so its closing finds nothing waiting to cancel. + if (!(_pendingImport?.Model.Empty ?? true)) + { + AcceptImport(); + } + + return false; + } + + if (key.Key == ConsoleKey.P && key.Modifiers == 0) + { + ToggleImportPasswords(); + } + + return true; + }, + width: ImportReview.PreferredWidth, + closed: () => _pendingImport = null); + } + + /// + /// The consent, from either host: writes the waiting import and saves. Planned again first; if the configuration + /// changed while the review was open (a world added on F5), the review is shown again rather than writing something + /// the player did not see. + /// + internal void AcceptImport() + { + if (_pendingImport is not { } pending) + { + ImportRefused("no import is waiting for an answer"); + return; + } + + _importSaid = false; + var fresh = ImportPlan.For(_config, pending.Plan.Result); + if (!fresh.SameAs(pending.Plan)) + { + ImportRefused("your setup changed while the review was open; nothing was written — check the review again"); + ReviewImport(pending.Plan.Result); + return; + } + + if (pending.Model.Empty) + { + _pendingImport = null; + ImportRefused("there was nothing to import"); + return; + } + + _pendingImport = null; + var applied = fresh.Apply(_config, pending.StorePasswords); + SaveConfiguration(); + + var parts = new List(); + if (applied.Worlds > 0) + { + parts.Add(ImportReviewModel.Count(applied.Worlds, "world")); + } + + if (applied.Characters > 0) + { + parts.Add(ImportReviewModel.Count(applied.Characters, "character")); + } + + if (applied.SetName is { } set) + { + parts.Add($"{ImportReviewModel.Count(applied.Rules, "rule")} in {set}"); + } + + if (applied.PasswordsStored > 0) + { + parts.Add(ImportReviewModel.Count(applied.PasswordsStored, "password") + " stored"); + } + + Notice( + $"Imported {string.Join(", ", parts)} from {pending.Model.Format} · F5 lists worlds, F2 triggers", + MessageSeverity.Info, + source: NoticeModel.Sources.Import); + } + + /// Switches whether the waiting review stores the file's passwords, and redraws it in whichever host shows it. + internal void ToggleImportPasswords() + { + if (_pendingImport is not { } pending || pending.Plan.PasswordCount == 0) + { + return; + } + + var store = !pending.StorePasswords; + var model = ImportReviewModel.From(pending.Plan, store); + _pendingImport = (pending.Plan, store, model); + if (NativeImportReview is { } native) + { + native.Publish(model); + } + else if (_helpView.IsOpen && _helpView.Mode == "import") + { + _helpView.Repaint(); + } + else if (_importSaid) + { + SayImportLine(model.PasswordLine ?? string.Empty); + } + } + + /// Feeds a key to the cell review, as the window's own handler would. + internal void SimulateImportKey(ConsoleKeyInfo key) => _helpView.SimulateKey(key); + + /// What the cell review shows, for a test. + internal IReadOnlyList ImportReviewLines => _helpView.Mode == "import" ? _helpView.Lines : []; + + private void CloseImportReview() + { + if (NativeModalOf(SurfaceCatalog.Import) is { } native) + { + CloseNativeModal(native); + } + + if (_helpView.IsOpen && _helpView.Mode == "import") + { + _helpView.Close(); + } + } + + private void ImportRefused(string reason) => + Notice(reason, MessageSeverity.Warning, source: NoticeModel.Sources.Import); + + /// The review said as lines, for a host with no screen to read, ending in the commands that answer it. + private void SayImport(ImportReviewModel model) + { + _importSaid = true; + SayImportLine(model.Title + ". " + model.Intro); + foreach (var act in model.ActsAsYou) + { + SayImportLine(ImportReviewModel.ActsHeading.ToLowerInvariant() + ": " + act); + } + + foreach (var row in model.Adds) + { + SayImportLine($"adds {row.Kind} {row.Name}: {row.Detail}"); + } + + foreach (var row in model.LeftOut) + { + SayImportLine($"left out {row.Kind} {row.Name}: {row.Detail}"); + } + + if (model.MoreLeftOut is { } more) + { + SayImportLine("left out " + more); + } + + if (model.PasswordLine is { } passwords) + { + SayImportLine(passwords + " Type /import passwords to switch."); + } + + SayImportLine(model.Empty ? "There is nothing in it to import." : "Type /import yes to import it, or /import no."); + } + + private void SayImportLine(string line) + { + if (line.Length == 0) + { + return; + } + + AppendWindowLine(ActiveWindowId(), $"[dim]*** {MarkupText.Escape(line)}[/]"); + Host.Announcer?.Announce(line, AnnouncementKind.Notice); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs index f14e5533..a74f416e 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs @@ -160,6 +160,11 @@ private bool RunWelcomeAction(WelcomeSurface welcome, WelcomeAction action) return false; + case WelcomeAction.Import: + CloseWelcome(); + StartImport(); + return false; + case WelcomeAction.Connect when welcome.Request is { } request: CloseWelcome(); ConnectFromWelcome(request); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index aac90e75..adedb1b0 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1895,6 +1895,14 @@ public string RenderSnapshot(string? view = null) DispatchCommand(SharpMUTerm.Client.Commands.BuiltInCommands.DictionaryCommand); } + // The review of an import from another client, over a MUSHclient world file the demo carries: what can act as + // the player, what it adds, what it leaves out (a script function, a plugin, a time-of-day timer), and the + // password it holds, not stored. + if (string.Equals(view, "import-review", StringComparison.OrdinalIgnoreCase)) + { + ReviewImport(SharpMUTerm.Core.Import.ClientImport.Parse(DemoImport.Mushclient, DemoImport.MushclientName).Result!); + } + // A pane narrower than its game wraps, recorded through the writer the live size report uses: ⌃P suggests // joining the world's wraps; `join-wraps-f5` is F5 recommending it beside the setting. if (string.Equals(view, "join-wraps", StringComparison.OrdinalIgnoreCase) @@ -5164,6 +5172,14 @@ private void OnCommandEntered(InputBar bar, string command) return; } + // `/import ` reads another client's setup and opens its review; nothing is written before ⏎. + if (command.StartsWith("/import", StringComparison.OrdinalIgnoreCase) + && (command.Length == 7 || command[7] == ' ')) + { + ImportCommand(command[7..]); + return; + } + // `/package` opens the Packages screen; `/package install …` reads one for review. if (command.StartsWith("/package", StringComparison.OrdinalIgnoreCase) && (command.Length == 8 || command[8] == ' ')) @@ -5750,7 +5766,7 @@ private string OpenOverlayName() => : _search.IsOpen ? "the search surface" : _prefixPanel.IsOpen ? "the pane keys panel" : _welcomeView.IsOpen ? "the welcome" - : _helpView.IsOpen ? (_helpView.Mode == "dictionary" ? "the dictionary offer" : "help") + : _helpView.IsOpen ? (_helpView.Mode switch { "dictionary" => "the dictionary offer", "import" => "the import review", _ => "help" }) : "what is open"; /// Whether either bar is holding unsent text — what the ✎ tab marker means. @@ -8886,6 +8902,9 @@ private bool RunBuiltInCommand(string id) case "term:welcome": ShowWelcome(); return true; + case SharpMUTerm.Client.Commands.BuiltInCommands.ImportCommand: + StartImport(); + return true; case "term:tour": ToggleKeyTour(); return true; diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 0d3c5a09..ff1eb8bd 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -28,6 +28,6 @@ internal static class SnapshotViews "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", - "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "join-wraps", "join-wraps-f5", + "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "import-review", "join-wraps", "join-wraps-f5", ]; } diff --git a/src/SharpMUTerm.Tui/WelcomeSurface.cs b/src/SharpMUTerm.Tui/WelcomeSurface.cs index accf42b8..a59f6e5b 100644 --- a/src/SharpMUTerm.Tui/WelcomeSurface.cs +++ b/src/SharpMUTerm.Tui/WelcomeSurface.cs @@ -18,6 +18,9 @@ internal enum WelcomeAction /// Close, and open F5. Settings, + + /// Close, and start an import from another client. + Import, } /// What the connect form asks for, read once ⏎ has checked it. @@ -162,7 +165,7 @@ private WelcomeAction MenuKey(ConsoleKeyInfo key) Problem = null; return WelcomeAction.Redraw; case ConsoleKey.DownArrow: - Selected = (WelcomeChoice)Math.Min((int)WelcomeChoice.Settings, (int)Selected + 1); + Selected = (WelcomeChoice)Math.Min((int)WelcomeChoice.Import, (int)Selected + 1); Problem = null; return WelcomeAction.Redraw; case ConsoleKey.LeftArrow: @@ -184,6 +187,8 @@ private WelcomeAction MenuKey(ConsoleKeyInfo key) return WelcomeAction.Redraw; case WelcomeChoice.Browse: return WelcomeAction.Browse; + case WelcomeChoice.Import: + return WelcomeAction.Import; default: return WelcomeAction.Settings; } @@ -432,6 +437,7 @@ public static IReadOnlyList PlainLines(WelcomeLayout layout, string? ind indexProblem is null ? "To browse worlds from the package index, type /package browse" : "Browsing worlds is not available: " + indexProblem, + "To import worlds and automation from MUSHclient, Mudlet or TinTin++, type /import and the path to the file", "Starting layout: " + (layout == WelcomeLayout.Suggested ? "suggested from what the game sends" : layout.ToString()) + ". Type /welcome layout roleplay, combat or suggested to change it.", "Type /welcome to hear this again.", diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs index 9ab00c43..3a612c38 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs @@ -250,4 +250,37 @@ public async Task YInTheNativePromptQuitsAndTabMovesTheChoice() await Assert.That(afterTab).IsEqualTo(QuitChoice.Quit); await Assert.That(exited).IsTrue(); } + + /// + /// The import review in the window: the card shows what can act as the player, the check box stores the file's + /// password through the client, and Import writes the world, character and set — nothing before it. + /// + [Test] + public async Task TheImportReviewWritesNothingUntilImport_AndItsCheckBoxStoresThePassword() + { + var (body, boxShown, worldsBefore, stored, worlds, focused) = await Run(rig => + { + rig.App.RenderSnapshot("import-review"); + DesktopLayerTests.Drain(); + var view = (ImportReviewView)rig.Driver.Modals.Modal!.View; + var before = rig.App.Configuration.Worlds.Count; + var body = view.BodyText.ToArray(); + var focused = view.ImportButton.IsFocused; + view.PasswordsBox.IsChecked = true; + DesktopLayerTests.Drain(); + var stored = rig.App.PendingImport!.StorePasswords; + view.ImportButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); + DesktopLayerTests.Drain(); + var wren = rig.App.Configuration.Worlds.SelectMany(w => w.Characters).Single(c => c.Name == "Wren"); + return (body, view.PasswordsBox.IsVisible, before, stored && wren.Password == "not-a-real-one", rig.App.Configuration.Worlds.Count - before, focused); + }); + + await Assert.That(body).Contains(t => t.StartsWith("WHAT CAN ACT AS YOU", StringComparison.OrdinalIgnoreCase)); + await Assert.That(body).Contains(t => t.Contains("Northwind", StringComparison.Ordinal)); + await Assert.That(boxShown).IsTrue(); + await Assert.That(focused).IsTrue(); + await Assert.That(stored).IsTrue(); + await Assert.That(worlds).IsEqualTo(1); + await Assert.That(worldsBefore).IsGreaterThan(0).Because("the demo has worlds of its own, which the import leaves alone"); + } } diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 5fb69eba..49548e4f 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -258,6 +258,7 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! (SurfaceCatalog.Welcome, "welcome-connect"), (SurfaceCatalog.Help, "help"), (SurfaceCatalog.Dictionary, "dictionary-offer"), + (SurfaceCatalog.Import, "import-review"), }) { using var nativeDriver = new AvaloniaConsoleDriver(140, 36); @@ -713,6 +714,25 @@ await SameModal("dictionary: download", "dictionary-offer", app => app.SimulateHelpKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); probed.Add(SurfaceCatalog.Dictionary); + // The import review: Import writes the same world, character and set as the cells' Enter; with the passwords + // switched on first (the window's check box, the cells' p), the password is stored on the character in both. + await SameModal("import: accept", "import-review", + (app, m) => ((ImportReviewSession)m.Open(SurfaceCatalog.Import)!).Accept(), + app => app.SimulateImportKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); + await SameModal("import: passwords, then accept", "import-review", + (app, m) => + { + var review = (ImportReviewSession)m.Open(SurfaceCatalog.Import)!; + review.TogglePasswords(); + review.Accept(); + }, + app => + { + app.SimulateImportKey(new ConsoleKeyInfo('p', ConsoleKey.P, false, false, false)); + app.SimulateImportKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + probed.Add(SurfaceCatalog.Import); + var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); // The tab overflow chip: an entry chosen from the window's menu and the same digit in the cell list bring the same // hidden tab forward. @@ -962,6 +982,7 @@ private static void HelpKeysTo(SharpMUTermApp app, Func match) WelcomeSession welcome => welcome.Model, HelpSession help => help.Model, DictionaryOfferSession offer => offer.Model, + ImportReviewSession import => import.Model, _ => throw new ArgumentException(session.GetType().Name), }; @@ -983,6 +1004,8 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "layout=" + app.LiveLayoutId, "welcome=" + app.WelcomeIsOpen, "help=" + app.HelpIsOpen + "/" + app.DictionaryOfferOpen, + "import=" + app.ImportReviewOpen + " " + string.Join(",", app.Configuration.TriggerSets.Select(s => s.Name + ":" + s.Triggers.Count)) + + " " + string.Join(",", app.Configuration.Worlds.SelectMany(w => w.Characters).Select(c => c.Name + (c.Password is null ? string.Empty : "*"))), "quick=" + app.LastQuickMacro, "walk=" + app.WalkState, "rail=" + (app.BuildChromeOverlay().Sidebar.Collapsed ? "folded" : "open"), diff --git a/tests/SharpMUTerm.Client.Tests/ImportReviewModelTests.cs b/tests/SharpMUTerm.Client.Tests/ImportReviewModelTests.cs new file mode 100644 index 00000000..36980965 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/ImportReviewModelTests.cs @@ -0,0 +1,96 @@ +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Import; + +namespace SharpMUTerm.Client.Tests; + +/// +/// The import review (): what it says about an import before anything is written, built +/// from the plan both hosts draw. +/// +public class ImportReviewModelTests +{ + private const string World = """ + + + + page %1=away + + f() + + get %1 + + """; + + private static ImportPlan Plan(AppConfiguration? config = null) => + ImportPlan.For(config ?? new AppConfiguration(), MushclientImport.Parse(World, "Northwind.mcl").Result!); + + [Test] + public async Task TheReviewLeadsWithWhatCanActAsThePlayer_AndSaysWhatItAddsAndLeavesOut() + { + var model = ImportReviewModel.From(Plan()); + + await Assert.That(model.Title).IsEqualTo("Import from MUSHclient"); + await Assert.That(model.Intro).Contains("Northwind.mcl"); + await Assert.That(model.Intro).Contains("Nothing is written until you press Enter"); + await Assert.That(model.ActsAsYou.ToArray()).IsEquivalentTo(new[] + { + "1 trigger sends a command when a line matches", + "1 alias turns what you type into other commands", + }); + await Assert.That(model.Adds.Select(r => r.Kind + ":" + r.Name).ToArray()).IsEquivalentTo(new[] { "world:Northwind", "set:Imported from MUSHclient" }); + await Assert.That(model.Adds[0].Detail).IsEqualTo("new world, northwind.example.org:4201, character Wren"); + await Assert.That(model.Adds[1].Detail).IsEqualTo("2 triggers, 1 alias · new set, listed on Wren"); + await Assert.That(model.LeftOutCount).IsEqualTo(1); + await Assert.That(model.LeftOut.Single().Detail).Contains("script"); + } + + [Test] + public async Task PasswordsAreNamedAndNotStoredUntilSwitchedOn() + { + var plan = Plan(); + var off = ImportReviewModel.From(plan); + var on = ImportReviewModel.From(plan, storePasswords: true); + + await Assert.That(off.Passwords).IsEqualTo(1); + await Assert.That(off.StorePasswords).IsFalse(); + await Assert.That(off.PasswordLine).Contains("will not be stored"); + await Assert.That(on.PasswordLine).Contains("will be stored"); + await Assert.That(off.Keys).Contains("p passwords"); + await Assert.That(off).IsNotEqualTo(on); + await Assert.That(ImportReviewModel.From(plan)).IsEqualTo(off).Because("two reviews of one plan are the same review"); + } + + [Test] + public async Task AKnownWorldSaysItOnlyGainsCharacters() + { + var config = new AppConfiguration + { + Worlds = { new WorldDefinition { Name = "Mine", Host = "northwind.example.org", Port = 4201, Characters = { new CharacterDefinition { Name = "Wren" } } } }, + }; + var model = ImportReviewModel.From(Plan(config)); + + await Assert.That(model.Adds[0].Detail).Contains("already configured"); + await Assert.That(model.Adds[0].Detail).Contains("keeps your Wren as is"); + await Assert.That(model.Adds[1].Detail).Contains("listed on no character yet"); + await Assert.That(model.Passwords).IsEqualTo(0).Because("a password is only ever stored for a character the import adds"); + await Assert.That(model.Keys).DoesNotContain("passwords"); + } + + [Test] + public async Task TheSessionPassesGesturesOnUntilItEnds() + { + var accepted = 0; + var toggled = 0; + var closed = 0; + var session = new ImportReviewSession(ImportReviewModel.From(Plan()), true, () => accepted++, () => toggled++, () => closed++); + + session.TogglePasswords(); + session.Accept(); + session.Accept(); + session.TogglePasswords(); + + await Assert.That((accepted, toggled, closed)).IsEqualTo((1, 1, 1)); + await Assert.That(session.Surface).IsEqualTo(Surfaces.SurfaceCatalog.Import); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Import/ClientImportTests.cs b/tests/SharpMUTerm.Core.Tests/Import/ClientImportTests.cs new file mode 100644 index 00000000..876f9af5 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Import/ClientImportTests.cs @@ -0,0 +1,540 @@ +using System.IO.Compression; +using System.Text; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Import; + +namespace SharpMUTerm.Core.Tests.Import; + +/// +/// The readers for other clients' setups (, , +/// ), over fixtures written here. What they map, what they leave out and say so, and the +/// bounds an untrusted file is held to. +/// +public class ClientImportTests +{ + private const string Mushclient = """ + + + + + + page %1=Away, back soon. Costs $5. + say I am %1 + + UpdateGauge("%1") + nod + x + + + get %1 + give %1 to Wren + DoScore() + + + look + say midnight + + + score + say + up + + + north + south + up + + + + + """; + + private static ImportResult Read(string text, string source = "fixture") + { + var (result, problem) = ClientImport.Parse(text, source); + if (result is null) + { + throw new InvalidOperationException(problem); + } + + return result; + } + + private static Trigger Named(ImportResult result, string name) => result.Set.Triggers.Single(t => t.Name == name); + + [Test] + public async Task AMushclientWorldBringsItsWorldAndPlayer_AndHoldsThePasswordApart() + { + var result = Read(Mushclient, "Northwind.mcl"); + + await Assert.That(result.Format).IsEqualTo(ImportFormat.MushClient); + var world = result.Worlds.Single(); + await Assert.That(world.Name).IsEqualTo("Northwind"); + await Assert.That(world.Host).IsEqualTo("northwind.example.org"); + await Assert.That(world.Port).IsEqualTo(4201); + await Assert.That(world.Characters.Single().Name).IsEqualTo("Wren"); + await Assert.That(world.Characters.Single().Password).IsNull().Because("a password is never put on a character by the reader"); + await Assert.That(result.Passwords.Single().Password).IsEqualTo("s3cret"); + await Assert.That(result.Passwords.Single().ToString()).DoesNotContain("s3cret"); + } + + [Test] + public async Task AMushclientWildcardMatchesTheWholeLine_AndItsSendTakesTheCapture() + { + var result = Read(Mushclient); + var page = Named(result, "* pages: *"); + + await Assert.That(page.MatchType).IsEqualTo(TriggerMatchType.Wildcard).Because("starting and ending in * already means anywhere"); + await Assert.That(page.CaseSensitive).IsTrue(); + var match = page.Regex.Match("Ann pages: hello"); + await Assert.That(match.Success).IsTrue(); + await Assert.That(match.Result(page.Actions.SendResponse!)).IsEqualTo("page Ann=Away, back soon. Costs $5."); + await Assert.That(page.Regex.IsMatch("Then Ann pages: hello")).IsTrue().Because("* at the start swallows the lead"); + await Assert.That(Named(result, "* pages: *").Regex.IsMatch("nobody paged")).IsFalse(); + } + + [Test] + public async Task AMushclientPatternWithoutStarsAtBothEndsIsAnchored() + { + var result = Read("""eat"""); + var hungry = result.Set.Triggers.Single(); + + await Assert.That(hungry.MatchType).IsEqualTo(TriggerMatchType.Regex); + await Assert.That(hungry.Regex.IsMatch("You are hungry.")).IsTrue(); + await Assert.That(hungry.Regex.IsMatch("You are hungry. Very.")).IsFalse(); + await Assert.That(hungry.Regex.IsMatch("Then You are hungry.")).IsFalse(); + } + + [Test] + public async Task AMushclientRegexKeepsItsFlags_AndRulesKeepTheirOrder() + { + var result = Read(Mushclient); + var hungry = Named(result, "^You are (\\w+)\\.$"); + + await Assert.That(hungry.Enabled).IsFalse(); + await Assert.That(hungry.CaseSensitive).IsFalse(); + await Assert.That(hungry.StopProcessing).IsFalse(); + await Assert.That(hungry.Regex.Match("you are HUNGRY.").Result(hungry.Actions.SendResponse!)).IsEqualTo("say I am HUNGRY"); + await Assert.That(result.Set.Triggers[0].Name).IsEqualTo(hungry.Name).Because("sequence 100 comes before 200"); + } + + [Test] + public async Task AStarredMushclientPatternIsThisClientsWildcard_AndAnOmitIsAGag() + { + var result = Read(Mushclient); + var arrived = Named(result, "*has arrived*"); + + await Assert.That(arrived.MatchType).IsEqualTo(TriggerMatchType.Wildcard); + await Assert.That(arrived.Actions.Gag).IsTrue(); + await Assert.That(arrived.Actions.SendResponse).IsNull(); + await Assert.That(arrived.Regex.IsMatch("Ann has arrived from the north.")).IsTrue(); + } + + [Test] + public async Task ScriptsAndPluginsAreListedAndNeverImported() + { + var result = Read(Mushclient); + + await Assert.That(result.Set.Triggers.Any(t => t.Name.StartsWith("Your health", StringComparison.Ordinal))).IsFalse(); + await Assert.That(result.Set.Triggers.Any(t => t.Actions.ScriptCallback is not null)).IsFalse(); + await Assert.That(result.Set.Aliases.Any(a => a.Name == "sc")).IsFalse(); + await Assert.That(Named(result, "* says *").Actions.SendResponse).IsEqualTo("nod").Because("the send is kept, the script function is not"); + var reasons = result.Skipped.Select(s => $"{s.Kind}:{s.Name}:{s.Reason}").ToArray(); + await Assert.That(reasons).Contains(r => r.StartsWith("trigger:Your health is *:it sends to a script", StringComparison.Ordinal)); + await Assert.That(reasons).Contains(r => r.StartsWith("part:* says *:its script function OnSay", StringComparison.Ordinal)); + await Assert.That(reasons).Contains(r => r.StartsWith("script:", StringComparison.Ordinal)); + await Assert.That(reasons).Contains(r => r.StartsWith("plugin:health_bar.xml", StringComparison.Ordinal)); + await Assert.That(reasons).Contains(r => r.StartsWith("trigger:[unclosed:its regular expression", StringComparison.Ordinal)); + } + + [Test] + public async Task MushclientAliasesTimersAndKeysMapWhereTheyCan() + { + var result = Read(Mushclient); + var alias = result.Set.Aliases.Single(); + + await Assert.That(alias.Regex.Match("gg sword").Result(alias.Substitution)).IsEqualTo("get sword\ngive sword to Wren"); + var timer = result.Set.Timers.Single(); + await Assert.That(timer.Name).IsEqualTo("idle"); + await Assert.That(timer.IntervalSeconds).IsEqualTo(90); + await Assert.That(timer.OneShot).IsTrue(); + await Assert.That(result.Set.Macros.Select(m => $"{m.Key}={m.Command}").ToArray()) + .IsEquivalentTo(new[] { "Ctrl+F2=score", "Num8=north", "Ctrl+Num2=south" }); + var skipped = result.Skipped.Select(s => s.Name).ToArray(); + await Assert.That(skipped).Contains("midnight"); + await Assert.That(skipped).Contains("F3"); + await Assert.That(skipped).Contains("up").Because("a named macro has no key here, and \"up\" is not the arrow"); + await Assert.That(skipped).Contains("keypad +"); + } + + [Test] + public async Task AFileNamingAnOutsideEntityExpandsNothing() + { + var hostile = """ + + ]> + + """; + var (result, _) = ClientImport.Parse(hostile, "x.mcl"); + + await Assert.That(result?.Worlds.SelectMany(w => new[] { w.Name, w.Host }).Any(t => t.Contains("root:", StringComparison.Ordinal)) ?? false).IsFalse(); + } + + [Test] + public async Task SomethingThatIsNoClientsSetupIsRefusedOutLoud() + { + var (result, problem) = ClientImport.Parse("just some notes\nnothing here", "notes.txt"); + + await Assert.That(result).IsNull(); + await Assert.That(problem).Contains("MUSHclient, Mudlet, TinTin++"); + var (old, oldProblem) = MushclientImport.Parse("\u0001\u0002binary muclient", "old.mcl"); + await Assert.That(old).IsNull(); + await Assert.That(oldProblem).Contains("not XML"); + } + + [Test] + public async Task ACommandTooLongIsLeftOut_NeverCutShort() + { + var text = $"""{new string('a', ImportLimits.MaxText + 1)}"""; + var result = Read(text); + + await Assert.That(result.Set.Aliases).IsEmpty(); + await Assert.That(result.Skipped.Single().Reason).Contains("too long"); + } + + [Test] + public async Task PastTheItemLimitRulesAreCountedNotImported() + { + var rules = string.Concat(Enumerable.Range(0, ImportLimits.MaxItems + 3).Select(i => $"""x""")); + var result = Read($"{rules}"); + + await Assert.That(result.Set.Aliases.Count).IsEqualTo(ImportLimits.MaxItems); + await Assert.That(result.SkippedCount).IsEqualTo(3); + } + + [Test] + public async Task ALargeFileIsRefusedBeforeItIsRead() + { + var path = Path.Combine(Path.GetTempPath(), "sharpmuterm-import-" + Guid.NewGuid().ToString("N") + ".mcl"); + try + { + using (var stream = File.Create(path)) + { + stream.SetLength(ImportLimits.MaxFileBytes + 1); + } + + var (result, problem) = ClientImport.Read(path); + await Assert.That(result).IsNull(); + await Assert.That(problem).Contains("too large"); + } + finally + { + File.Delete(path); + } + } + + // ── Mudlet ───────────────────────────────────────────────────────────────────────────────────── + + private const string Mudlet = """ + + + + + + Off folder + + + + + inside off + + wave + waves to you + 0 + + + + kinds + + bow + bowsGreetingsHi.^(\w+) curtsies$ + 0231 + + + lua only + + + ^(\w+) attacks you$ + 1 + + + both + + smile $1 + smiles + 0 + + + chain + + start + begin + 0 + linkxy0 + + + + kkill rat^k$ + + + ticklook + + + scorescore1677726567108864 + padnorth56536870912 + barex650 + + + + """; + + [Test] + public async Task AMudletPackageMapsItsPatternKinds_OneTriggerPerPattern() + { + var result = Read(Mudlet); + + await Assert.That(result.Format).IsEqualTo(ImportFormat.Mudlet); + await Assert.That(Named(result, "kinds (1)").MatchType).IsEqualTo(TriggerMatchType.Contains); + await Assert.That(Named(result, "kinds (2)").MatchType).IsEqualTo(TriggerMatchType.StartsWith); + var exact = Named(result, "kinds (3)"); + await Assert.That(exact.Regex.IsMatch("Hi.")).IsTrue(); + await Assert.That(exact.Regex.IsMatch("Hi!")).IsFalse(); + await Assert.That(exact.Regex.IsMatch("Hi. there")).IsFalse(); + await Assert.That(Named(result, "kinds (4)").MatchType).IsEqualTo(TriggerMatchType.Regex); + } + + [Test] + public async Task AMudletRuleInADisabledFolderComesInDisabled() + { + var result = Read(Mudlet); + + await Assert.That(Named(result, "inside off").Enabled).IsFalse(); + await Assert.That(Named(result, "kinds (1)").Enabled).IsTrue(); + } + + [Test] + public async Task MudletLuaIsNeverImported_AndACommandBesideItIsKept() + { + var result = Read(Mudlet); + + await Assert.That(result.Set.Triggers.Any(t => t.Name == "lua only")).IsFalse(); + var both = Named(result, "both"); + await Assert.That(both.Regex.Match("Ann smiles").Result(both.Actions.SendResponse!)).IsEqualTo("smile $1").Because("Mudlet sends its command as written"); + var reasons = result.Skipped.Select(s => $"{s.Kind}:{s.Name}:{s.Reason}").ToArray(); + await Assert.That(reasons).Contains(r => r.StartsWith("trigger:lua only:its action is Lua", StringComparison.Ordinal)); + await Assert.That(reasons).Contains(r => r.StartsWith("part:both:its Lua was left out", StringComparison.Ordinal)); + await Assert.That(reasons).Contains(r => r.StartsWith("script:helpers", StringComparison.Ordinal)); + await Assert.That(reasons).Contains(r => r.StartsWith("trigger:chain:it is a chain gating 1 rule", StringComparison.Ordinal)); + await Assert.That(result.Set.Triggers.Any(t => t.Name is "chain" or "link")).IsFalse(); + } + + [Test] + public async Task MudletAliasesTimersAndKeysMap() + { + var result = Read(Mudlet); + + await Assert.That(result.Set.Aliases.Single().Regex.IsMatch("k")).IsTrue(); + await Assert.That(result.Set.Timers.Single().IntervalSeconds).IsEqualTo(60.5); + await Assert.That(result.Set.Macros.Select(m => m.Key).ToArray()).IsEquivalentTo(new[] { "Ctrl+F2", "Num8" }); + await Assert.That(result.Skipped.Select(s => s.Name)).Contains("bare").Because("a bare letter is typing, not a key"); + } + + [Test] + public async Task AMudletProfileFolderBringsItsWorldFromTheFilesBesideTheSaves() + { + var folder = Directory.CreateTempSubdirectory("sharpmuterm-mudlet-"); + try + { + var profile = Directory.CreateDirectory(Path.Combine(folder.FullName, "Achaea")); + File.WriteAllText(Path.Combine(profile.FullName, "url"), "achaea.example.com\n"); + File.WriteAllText(Path.Combine(profile.FullName, "port"), "23"); + File.WriteAllText(Path.Combine(profile.FullName, "login"), "Ixia"); + File.WriteAllText(Path.Combine(profile.FullName, "password"), "pw"); + var current = Directory.CreateDirectory(Path.Combine(profile.FullName, "current")); + File.WriteAllText(Path.Combine(current.FullName, "01-01-2024#10-00-00.xml"), Mudlet); + + var (result, problem) = ClientImport.Read(profile.FullName); + + await Assert.That(problem).IsNull(); + var world = result!.Worlds.Single(); + await Assert.That(world.Name).IsEqualTo("Achaea"); + await Assert.That(world.Host).IsEqualTo("achaea.example.com"); + await Assert.That(world.Port).IsEqualTo(23); + await Assert.That(world.Characters.Single().Name).IsEqualTo("Ixia"); + await Assert.That(result.Passwords.Single().Password).IsEqualTo("pw"); + await Assert.That(result.Set.Triggers).IsNotEmpty(); + + var (fromSave, _) = ClientImport.Read(Path.Combine(current.FullName, "01-01-2024#10-00-00.xml")); + await Assert.That(fromSave!.Worlds.Single().Host).IsEqualTo("achaea.example.com").Because("a save inside current/ finds its profile"); + } + finally + { + folder.Delete(recursive: true); + } + } + + [Test] + public async Task AMudletPackageZipIsReadWithoutExtractingAnything() + { + using var buffer = new MemoryStream(); + using (var zip = new ZipArchive(buffer, ZipArchiveMode.Create, leaveOpen: true)) + { + using (var evil = zip.CreateEntry("../../evil.lua").Open()) + { + evil.Write(Encoding.UTF8.GetBytes("os.exit()")); + } + + using var writer = new StreamWriter(zip.CreateEntry("Pack/Pack.xml").Open()); + writer.Write(Mudlet); + } + + var (result, problem) = MudletImport.ReadZip(buffer.ToArray(), "Pack.mpackage"); + + await Assert.That(problem).IsNull(); + await Assert.That(result!.Set.Aliases.Single().Name).IsEqualTo("k"); + } + + // ── TinTin++ ─────────────────────────────────────────────────────────────────────────────────── + + private const string TinTin = """ + #nop A TinTin++ setup, written for this test. + #session {nw} {northwind.example.org} {4201} + #action {%1 tells you '%2'} {reply %2 to %1;smile} + #act {^You are hungry.$} {eat bread} + #action {%1 bonks you} {#showme ouch} + #alias {k} {kill %1;loot %0} + #alias {gt %1 %2} {give %2 to %1} + #ticker {idle} {look} {120} + #gag {^Ann has arrived} + #highlight {red} {danger} + #var hp 100 + """; + + [Test] + public async Task ATinTinScriptBringsItsSessionActionsAliasesTickersAndGags() + { + var result = Read(TinTin, "setup.tin"); + + await Assert.That(result.Format).IsEqualTo(ImportFormat.TinTin); + var world = result.Worlds.Single(); + await Assert.That((world.Name, world.Host, world.Port)).IsEqualTo(("nw", "northwind.example.org", 4201)); + + var tells = result.Set.Triggers.Single(t => t.Name.StartsWith("%1 tells", StringComparison.Ordinal)); + await Assert.That(tells.Regex.Match("Ann tells you 'hello there'").Result(tells.Actions.SendResponse!)).IsEqualTo("reply hello there to Ann\nsmile"); + + var hungry = result.Set.Triggers.Single(t => t.Name.StartsWith("^You are", StringComparison.Ordinal)); + await Assert.That(hungry.Regex.IsMatch("You are hungry.")).IsTrue(); + await Assert.That(hungry.Regex.IsMatch("Then You are hungry.")).IsFalse(); + await Assert.That(hungry.Regex.IsMatch("You are hungryX")).IsFalse(); + + var gag = result.Set.Triggers.Single(t => t.Actions.Gag); + await Assert.That(gag.Regex.IsMatch("Ann has arrived from the west.")).IsTrue(); + + var k = result.Set.Aliases.Single(a => a.Name == "k"); + await Assert.That(k.Regex.Match("k rat now").Result(k.Substitution)).IsEqualTo("kill rat\nloot rat now"); + var give = result.Set.Aliases.Single(a => a.Name.StartsWith("gt", StringComparison.Ordinal)); + await Assert.That(give.Regex.Match("gt Ann sword").Result(give.Substitution)).IsEqualTo("give sword to Ann"); + + await Assert.That(result.Set.Timers.Single().IntervalSeconds).IsEqualTo(120); + } + + [Test] + public async Task TinTinsOwnStatementsAreLeftOut_AndCounted() + { + var result = Read(TinTin); + + await Assert.That(result.Set.Triggers.Any(t => t.Name.Contains("bonks", StringComparison.Ordinal))).IsFalse(); + await Assert.That(result.Skipped.Select(s => s.Reason)).Contains(r => r.Contains("runs TinTin commands", StringComparison.Ordinal)); + var other = result.Skipped.Single(s => s.Kind == "command"); + await Assert.That(other.Name).IsEqualTo("3 other TinTin commands"); + await Assert.That(other.Reason).Contains("#highlight"); + } + + // ── The plan ─────────────────────────────────────────────────────────────────────────────────── + + private static AppConfiguration Existing() => new() + { + Worlds = + { + new WorldDefinition { Name = "Northwind", Host = "other.example.org", Port = 23 }, + new WorldDefinition + { + Name = "Home", + Host = "NORTHWIND.example.org", + Port = 4201, + Characters = { new CharacterDefinition { Name = "wren", ConnectString = "mine" } }, + }, + }, + TriggerSets = { new TriggerSet { Name = "Imported from MUSHclient" } }, + }; + + [Test] + public async Task APlanOverwritesNothing_ASetNameClashGetsASuffix_AndAKnownEndpointOnlyGainsCharacters() + { + var config = Existing(); + var text = Mushclient.Replace("player=\"Wren\"", "player=\"Wren\"", StringComparison.Ordinal); + var result = Read(text); + result.Worlds[0].Characters.Add(new CharacterDefinition { Name = "Ash" }); + var plan = ImportPlan.For(config, result); + + await Assert.That(plan.SetName).IsEqualTo("Imported from MUSHclient (2)"); + var world = plan.Worlds.Single(); + await Assert.That(world.Existing).IsTrue(); + await Assert.That(world.Name).IsEqualTo("Home"); + await Assert.That(world.NewCharacters.ToArray()).IsEquivalentTo(new[] { "Ash" }); + await Assert.That(world.KeptCharacters.ToArray()).IsEquivalentTo(new[] { "Wren" }); + await Assert.That(plan.PasswordCount).IsEqualTo(0).Because("Wren's password is for a character this import does not add"); + + var applied = plan.Apply(config, storePasswords: true); + + await Assert.That(config.TriggerSets.Count).IsEqualTo(2); + await Assert.That(config.TriggerSets[0].Triggers).IsEmpty().Because("the existing set is untouched"); + var home = config.Worlds.Single(w => w.Name == "Home"); + await Assert.That(home.Characters.Single(c => c.Name == "wren").ConnectString).IsEqualTo("mine"); + await Assert.That(home.Characters.Single(c => c.Name == "Ash").TriggerSets.Single()).IsEqualTo("Imported from MUSHclient (2)"); + await Assert.That(home.Characters.Single(c => c.Name == "wren").TriggerSets).IsEmpty(); + await Assert.That(applied.Worlds).IsEqualTo(0); + await Assert.That(applied.Characters).IsEqualTo(1); + } + + [Test] + public async Task ANewWorldWhoseNameIsTakenGetsASuffix_AndItsPasswordIsStoredOnlyWhenAsked() + { + var config = new AppConfiguration { Worlds = { new WorldDefinition { Name = "Northwind", Host = "x.example", Port = 1 } } }; + var result = Read(Mushclient); + + var plan = ImportPlan.For(config, result); + await Assert.That(plan.Worlds.Single().Name).IsEqualTo("Northwind (2)"); + await Assert.That(plan.PasswordCount).IsEqualTo(1); + plan.Apply(config, storePasswords: false); + await Assert.That(config.Worlds[1].Characters.Single().Password).IsNull(); + + var again = new AppConfiguration(); + ImportPlan.For(again, result).Apply(again, storePasswords: true); + await Assert.That(again.Worlds.Single().Characters.Single().Password).IsEqualTo("s3cret"); + await Assert.That(again.TriggerSets.Single().Triggers.Count).IsEqualTo(result.Set.Triggers.Count); + await Assert.That(ReferenceEquals(again.TriggerSets.Single().Triggers[0], result.Set.Triggers[0])).IsFalse().Because("the configuration gets copies"); + } + + [Test] + public async Task APlanMadeBeforeTheConfigurationChangedRefusesToApply() + { + var config = new AppConfiguration(); + var plan = ImportPlan.For(config, Read(Mushclient)); + config.Worlds.Add(new WorldDefinition { Name = "Northwind", Host = "y.example", Port = 2 }); + + await Assert.That(() => plan.Apply(config, storePasswords: false)).Throws(); + await Assert.That(config.TriggerSets).IsEmpty(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/ImportTests.cs b/tests/SharpMUTerm.Tui.Tests/ImportTests.cs new file mode 100644 index 00000000..3994d811 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/ImportTests.cs @@ -0,0 +1,207 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Import from another client (/import, ⌃P ▸ Import from another client…, the welcome's row): the review opens +/// before anything is written, ⏎ writes, Esc writes nothing, and passwords are stored only when switched on. +/// +[NotInParallel] +public class ImportTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static ConsoleKeyInfo Key(ConsoleKey key, char c = '\0') => new(c, key, false, false, false); + + private static SharpMUTermApp App(AppConfiguration? config = null, IFilePicker? picker = null) + { + Console.SetIn(TextReader.Null); + var host = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 40), null, null, null) with { FilePicker = picker }; + return new SharpMUTermApp(config ?? new AppConfiguration(), host); + } + + private static void TypeCommand(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(Key(ConsoleKey.Enter, '\r')); + } + + private static string Fixture() + { + var path = Path.Combine(Path.GetTempPath(), "sharpmuterm-import-" + Guid.NewGuid().ToString("N") + ".mcl"); + File.WriteAllText(path, DemoImport.Mushclient); + return path; + } + + [Test] + public async Task SlashImportOpensTheReview_AndNothingIsWrittenUntilEnter() + { + var path = Fixture(); + try + { + var app = App(); + TypeCommand(app, "/import " + path); + + await Assert.That(app.ImportReviewOpen).IsTrue(); + await Assert.That(app.Configuration.Worlds).IsEmpty(); + await Assert.That(app.Configuration.TriggerSets).IsEmpty(); + var shown = string.Join("\n", app.ImportReviewLines); + await Assert.That(shown).Contains("WHAT CAN ACT AS YOU"); + await Assert.That(shown).Contains("Northwind"); + await Assert.That(shown).Contains("LEFT OUT"); + + app.SimulateImportKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(app.ImportReviewOpen).IsFalse(); + var world = app.Configuration.Worlds.Single(); + await Assert.That(world.Host).IsEqualTo("northwind.example.org"); + var character = world.Characters.Single(); + await Assert.That(character.Name).IsEqualTo("Wren"); + await Assert.That(character.Password).IsNull().Because("the password was not switched on"); + await Assert.That(character.TriggerSets.Single()).IsEqualTo("Imported from MUSHclient"); + await Assert.That(app.Configuration.TriggerSets.Single().Triggers).IsNotEmpty(); + await Assert.That(app.LastNotice).Contains("Imported"); + } + finally + { + File.Delete(path); + } + } + + [Test] + public async Task PStoresThePasswords_AndEscWritesNothing() + { + var path = Fixture(); + try + { + var app = App(); + app.ImportFrom(path); + app.SimulateImportKey(Key(ConsoleKey.Escape, '\u001b')); + + await Assert.That(app.ImportReviewOpen).IsFalse(); + await Assert.That(app.Configuration.Worlds).IsEmpty(); + await Assert.That(app.PendingImport).IsNull(); + + app.ImportFrom(path); + await Assert.That(app.PendingImport!.StorePasswords).IsFalse(); + app.SimulateImportKey(Key(ConsoleKey.P, 'p')); + await Assert.That(app.PendingImport!.StorePasswords).IsTrue(); + await Assert.That(string.Join("\n", app.ImportReviewLines)).Contains("will be stored"); + app.SimulateImportKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(app.Configuration.Worlds.Single().Characters.Single().Password).IsEqualTo("not-a-real-one"); + } + finally + { + File.Delete(path); + } + } + + [Test] + public async Task ImportingTwiceAddsASecondSet_AndNoSecondWorld() + { + var path = Fixture(); + try + { + var app = App(); + app.ImportFrom(path); + app.SimulateImportKey(Key(ConsoleKey.Enter, '\r')); + app.ImportFrom(path); + + await Assert.That(app.PendingImport!.Adds[0].Detail).Contains("already configured"); + app.SimulateImportKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(app.Configuration.Worlds.Count).IsEqualTo(1); + await Assert.That(app.Configuration.TriggerSets.Select(s => s.Name).ToArray()) + .IsEquivalentTo(new[] { "Imported from MUSHclient", "Imported from MUSHclient (2)" }); + await Assert.That(app.Configuration.Worlds[0].Characters.Single().TriggerSets.Single()).IsEqualTo("Imported from MUSHclient"); + } + finally + { + File.Delete(path); + } + } + + [Test] + public async Task AFileThatIsNoSetupIsRefusedOutLoud() + { + var app = App(); + TypeCommand(app, "/import /nonexistent/nothing-here.mcl"); + + await Assert.That(app.ImportReviewOpen).IsFalse(); + await Assert.That(app.LastNotice).Contains("was not imported"); + } + + [Test] + public async Task ThePaletteEntryAndBareSlashImportAskForAPath_WhereThereIsNoPicker() + { + var app = App(); + await Assert.That(app.DispatchCommand(BuiltInCommands.ImportCommand)).IsTrue(); + await Assert.That(app.PrimaryInputText).IsEqualTo("/import "); + await Assert.That(app.LastNotice).Contains("Type the path"); + + var other = App(); + TypeCommand(other, "/import"); + await Assert.That(other.PrimaryInputText).IsEqualTo("/import "); + } + + [Test] + public async Task AHostWithAPickerOpensTheReviewForThePickedFile() + { + var path = Fixture(); + try + { + var picker = new FakePicker(path); + var app = App(picker: picker); + app.DispatchCommand(BuiltInCommands.ImportCommand); + + await Assert.That(picker.Asked).IsEqualTo(1); + await Assert.That(app.ImportReviewOpen).IsTrue(); + await Assert.That(app.PrimaryInputText).IsEmpty(); + } + finally + { + File.Delete(path); + } + } + + [Test] + public async Task TheWelcomesImportRowStartsAnImport() + { + var app = App(); + app.ShowWelcome(); + await Assert.That(string.Join("\n", app.WelcomeLines)).Contains("Import"); + for (var i = 0; i < 3; i++) + { + app.SimulateWelcomeKey(Key(ConsoleKey.DownArrow)); + } + + await Assert.That(app.Welcome!.Selected).IsEqualTo(WelcomeChoice.Import); + app.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(app.WelcomeIsOpen).IsFalse(); + await Assert.That(app.PrimaryInputText).IsEqualTo("/import "); + } + + private sealed class FakePicker(string path) : IFilePicker + { + public int Asked { get; private set; } + + public bool Available => true; + + public void Pick(string title, Action picked) + { + Asked++; + picked(path); + } + } +} From 8ad3bb389f9238ef5eb259e6095cc46431923421 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 12:57:16 +0000 Subject: [PATCH 048/113] feat(map): name rooms on the terminal map, and edit maps by hand in both hosts The cell map's title is the current room's name, and MapViewModel.Nearby (each exit and the room it leads to) fills a side column beside a wide grid or the rows under a tall one, so both hosts name the same rooms. Map editing, a Mudlet subset: rename, area, lock, weight, add/remove exit (to a room id or the next room walked into), nudge, delete, note and symbol, with undo of the last ten edits. Every edit is a Client MapEdit through ApplyMapEdit -> MapEditing.Apply -> MapRecorder.Edit, on the UI thread under SyncRoot, marked dirty and saved like a recorded room. Cells: Ctrl+P > Edit map, arrow keys and an honest key footer, /map verbs for the edits that need words. Window: a right-click room menu and a native inspector. Declared on the map surface; SurfaceParityTests compares MapDigest after native and cell edits. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 6 + CLAUDE.md | 12 + src/SharpMUTerm.Avalonia/DesktopLayer.cs | 2 +- src/SharpMUTerm.Avalonia/FloatingPanels.cs | 2 +- src/SharpMUTerm.Avalonia/MapCanvas.cs | 142 ++++++- src/SharpMUTerm.Avalonia/MapInspector.cs | 330 +++++++++++++++ .../Commands/BuiltInCommands.cs | 5 + src/SharpMUTerm.Client/Help/SlashCommands.cs | 4 + src/SharpMUTerm.Client/Panels/MapEditing.cs | 394 ++++++++++++++++++ src/SharpMUTerm.Client/Panels/MapViewModel.cs | 131 +++++- .../Surfaces/SurfaceCatalog.cs | 15 +- .../Commands/CommandCatalog.cs | 4 +- src/SharpMUTerm.Core/Mapping/MapModel.cs | 215 ++++++++++ src/SharpMUTerm.Core/Mapping/MapRecorder.cs | 160 +++++++ src/SharpMUTerm.Tui/MapRenderer.cs | 263 +++++++++++- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 13 +- .../Pointer/SharpMUTermApp.Desktop.cs | 5 +- src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs | 371 +++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 66 ++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- .../SurfaceParityTests.cs | 79 ++++ .../MapEditingTests.cs | 126 ++++++ .../Mapping/MapEditTests.cs | 154 +++++++ .../SharpMUTerm.Tui.Tests/MapEditModeTests.cs | 186 +++++++++ tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs | 2 +- 25 files changed, 2645 insertions(+), 44 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/MapInspector.cs create mode 100644 src/SharpMUTerm.Client/Panels/MapEditing.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs create mode 100644 tests/SharpMUTerm.Client.Tests/MapEditingTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Mapping/MapEditTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 7991b70a..109c415a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- The terminal map names the room you are in, and where each of its exits leads when the pane has room. +- Maps can be edited by hand: Ctrl+P ▸ Edit map in the terminal (arrow keys select, Shift+arrows move, r, a, l, w, x, + n, s, Del and u edit), or right-click a room in the desktop window for its menu and inspector. Rename a room, set + its area, lock it, weight it, add or remove an exit (or link one to the next room you walk into), move it, delete it, + or give it a note or a symbol; the last ten edits can be undone. A game that reports rooms over GMCP may overwrite + a room's name, area and exits the next time it describes it. - A world can reconnect by itself after its connection drops (F5 ▸ reconnect). It waits 5, 15, 30, 60 and 60 seconds between tries, counts down on the status row, and stops after five; Alt+R dials at once, and Disconnect or Ctrl+P ▸ Stop reconnecting cancels. Your own Disconnect, quitting, or the game closing right after you typed a diff --git a/CLAUDE.md b/CLAUDE.md index f768d53c..d8a2e736 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -152,6 +152,18 @@ fallbacks) for inline images/maps. read off the UI thread: every such read takes `MapRecorder.SyncRoot`, which the recorder holds while it changes the map and never while it raises `Changed` (a handler can end in the alias engine, which takes the script host's lock). A change a script asks for (`map.walk`, a lock) is posted to the UI thread. + - **The map names rooms, and is edited by hand in both hosts** (`WorldMap.Rename`/`SetArea`/`SetExit`/`Remove`/…, Core; + `MapRecorder.Edit(label, touched, change)`, `LinkNext`, `Undo`; Client `MapEditing`, `MapEdit`; Tui + `SharpMUTermApp.MapEdit.cs`; Avalonia `MapInspector`; the `map-edit` view). The cell title is the current room's name, + and `MapViewModel.Nearby` (each exit and where it leads) fills a side column from 64 cells or the rows under the grid + from 18. Every edit is a `MapEdit` through `ApplyMapEdit` → `MapEditing.Apply` → `MapRecorder.Edit`, on the UI thread + under `SyncRoot`, dirty and saved like a recorded room; undo snapshots the rooms an edit touches (10 deep, areas it + created go too). **Selection is client state per map window and selecting takes the keys** in both hosts (⌃P ▸ Edit + map, a cell click while editing, the canvas's right-click menu or click), so `SurfaceParityTests` compares + `MapDigest()`. Cell keys are `MapEditing.Keys`; the ones that need words put a `/map …` command on the command line + and put back what was being typed once it runs. "Next" on an exit links it to the next room walked into, never its + own. Deleting the room you are in is refused. **On a GMCP world the server's next report of a room overwrites a hand + edit to its name, area, exits and place**; locks, weights, notes and symbols survive. - **Sound** (`Core/Media`: `MediaCommand`, `MediaQueue`, `MediaCache`, `IAudioOutput`). MCMP's `Client.Media.*` is read with TNC.Gmcp's typed records into `MediaCommand`s (`WorldSession.MediaReceived`), and one `MediaQueue` per connection applies the specification's rules — priority halts and refuses lower, diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index be0d0b8d..d7390d06 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -340,7 +340,7 @@ private void SyncPanels(ScreenFrame frame, Size cell) () => new MapCanvas(_view), frame, cell, - (map, panel, plane) => map.Show(panel.Map!, panel.Ink, plane, text, panel.WalkTo)); + (map, panel, plane) => map.Show(panel.Map!, panel.Ink, plane, text, panel.WalkTo, panel.SelectRoom, panel.EditMap)); Place( _whoHere, _pointer.Panels.Where(p => p.PanelId == PanelIds.WhoHere && p.WhoHere is not null), diff --git a/src/SharpMUTerm.Avalonia/FloatingPanels.cs b/src/SharpMUTerm.Avalonia/FloatingPanels.cs index e031c84e..57738f29 100644 --- a/src/SharpMUTerm.Avalonia/FloatingPanels.cs +++ b/src/SharpMUTerm.Avalonia/FloatingPanels.cs @@ -289,7 +289,7 @@ public void Update(FloatingPanel panel, double cellHeight) switch (_content) { case MapCanvas map when content.Map is { } model: - map.Show(model, content.Ink, plane, text, content.WalkTo); + map.Show(model, content.Ink, plane, text, content.WalkTo, content.SelectRoom, content.EditMap); break; case VitalsGauges gauges when content.Vitals is { } vitals: gauges.Show(vitals, content.Ink, plane, text, cellHeight); diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index 26c0e447..61bf78e7 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -3,6 +3,7 @@ using Avalonia.Controls; using Avalonia.Input; using Avalonia.Media; +using SharpMUTerm.Client.Commands; using SharpMUTerm.Client.Panels; using SharpMUTerm.Tui; @@ -19,6 +20,12 @@ namespace SharpMUTerm.Avalonia; /// (), so the pane's menu is the same here as over cells. The view is /// centred on the character and follows them; a pan is an offset from there, and a double-click puts it back. /// +/// +/// Editing. A right click on a room selects it for editing () and opens the +/// client's room menu (); while a room is selected a click selects instead of walking, and the +/// card in the top right corner edits it. Every edit is a handed to the +/// client (), the funnel the cell map's keys end in. +/// /// internal sealed class MapCanvas : Control { @@ -39,6 +46,9 @@ internal sealed class MapCanvas : Control private Color _plane = Colors.Black; private Color _text = Colors.White; private Action? _walkTo; + private Action? _select; + private Action? _edit; + private readonly MapInspector _inspector = new(); private Vector _pan; private Point? _pressAt; private Vector _panAtPress; @@ -51,8 +61,29 @@ public MapCanvas(TerminalView view) ClipToBounds = true; Focusable = false; Cursor = new Cursor(StandardCursorType.Arrow); + VisualChildren.Add(_inspector); + LogicalChildren.Add(_inspector); + } + + protected override Size MeasureOverride(Size availableSize) + { + _inspector.Measure(availableSize); + return default; + } + + protected override Size ArrangeOverride(Size finalSize) + { + // The card arranges itself in the top right corner by its own alignment and margin. + _inspector.Arrange(new Rect(finalSize)); + return finalSize; } + /// The room inspector card. Internal for tests. + internal MapInspector Inspector => _inspector; + + /// The last room menu the canvas opened. Internal for tests. + internal MenuModel? OpenedRoomMenu { get; private set; } + /// The zoom, 1 at pixels between rooms. Internal for tests. internal double Zoom { get; private set; } = 1; @@ -62,9 +93,12 @@ public MapCanvas(TerminalView view) /// What it is showing. Internal for tests. internal MapViewModel Model => _model; - public void Show(MapViewModel model, PanelInk ink, Color plane, Color text, Action? walkTo) + public void Show(MapViewModel model, PanelInk ink, Color plane, Color text, Action? walkTo, Action? select = null, Action? edit = null) { _walkTo = walkTo; + _select = select; + _edit = edit; + _inspector.Show(model, plane, text, edit, select); if (model.Equals(_model) && ink == _ink && plane == _plane && text == _text) { return; @@ -82,12 +116,24 @@ internal Point CentreOf(MapViewRoom room) { var anchor = _model.Current ?? _model.Rooms.FirstOrDefault(); var step = Spacing * Zoom; - var middle = new Point(Bounds.Width / 2, Bounds.Height / 2) + _pan; + var middle = Middle + _pan; return anchor is null ? middle : new Point(middle.X + ((room.X - anchor.X) * step), middle.Y + ((room.Y - anchor.Y) * step)); } + /// The middle of the map's open part: left of the inspector while it is up and the pane is wide enough to spare it. + private Point Middle + { + get + { + var open = _inspector.IsVisible && Bounds.Width > MapInspector.CardWidth * 2 + ? Bounds.Width - MapInspector.CardWidth - 16 + : Bounds.Width; + return new Point(open / 2, Bounds.Height / 2); + } + } + private double RoomSize => Math.Max(5, Spacing * Zoom * 0.56); /// The room under a point, or null. @@ -103,13 +149,27 @@ internal Point CentreOf(MapViewRoom room) // ── Input: the canvas's own, never routed on to the cells (bar the right click) ────────────── + /// Whether a point is on the inspector card, which takes its own input. + private bool OnInspector(Point point) => _inspector.IsVisible && _inspector.Bounds.Contains(point); + protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); var point = e.GetCurrentPoint(this); + if (OnInspector(point.Position)) + { + return; + } + e.Handled = true; if (point.Properties.IsRightButtonPressed) { + if (_select is not null && RoomAt(point.Position) is { } room) + { + OpenRoomMenu(room); + return; + } + if (RightClick is { } own) { own(e.GetPosition(this)); @@ -141,8 +201,13 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) protected override void OnPointerMoved(PointerEventArgs e) { base.OnPointerMoved(e); - e.Handled = true; var position = e.GetPosition(this); + if (_pressAt is null && OnInspector(position)) + { + return; + } + + e.Handled = true; if (_pressAt is { } from) { var moved = position - from; @@ -163,7 +228,9 @@ protected override void OnPointerMoved(PointerEventArgs e) _hovered = room?.Id; Cursor = new Cursor(room is null ? StandardCursorType.Arrow : StandardCursorType.Hand); // The name is drawn on the canvas beside the room; the tip says only what a click does. - ToolTip.SetTip(this, room is null || room.Current ? null : "Click to walk here"); + ToolTip.SetTip(this, room is null ? null + : _model.Editing && _select is not null ? "Click to edit this room" + : room.Current ? "Right-click to edit this room" : "Click to walk here · right-click to edit"); InvalidateVisual(); } } @@ -182,7 +249,17 @@ protected override void OnPointerReleased(PointerReleasedEventArgs e) _dragging = false; e.Pointer.Capture(null); Cursor = new Cursor(StandardCursorType.Arrow); - if (!wasDrag && e.InitialPressMouseButton == MouseButton.Left && RoomAt(e.GetPosition(this)) is { Current: false } room) + if (wasDrag || e.InitialPressMouseButton != MouseButton.Left || RoomAt(e.GetPosition(this)) is not { } room) + { + return; + } + + // While a room is being edited a click picks the room to edit; otherwise it walks, as it always has. + if (_model.Editing && _select is not null) + { + _select(room.Id); + } + else if (!room.Current) { _walkTo?.Invoke(room.Id); } @@ -191,10 +268,46 @@ protected override void OnPointerReleased(PointerReleasedEventArgs e) protected override void OnPointerWheelChanged(PointerWheelEventArgs e) { base.OnPointerWheelChanged(e); + if (OnInspector(e.GetPosition(this))) + { + return; + } + e.Handled = true; ZoomAbout(e.GetPosition(this), e.Delta.Y); } + /// + /// Selects and opens the client's menu for it: walk there, each edit, undo. An edit that needs + /// words opens the inspector at its field; the rest are handed to the client as they are. + /// + internal void OpenRoomMenu(MapViewRoom room) + { + _select?.Invoke(room.Id); + var model = MapEditing.Menu(room, _model.UndoLabel); + OpenedRoomMenu = model; + var menu = NativeMenu.Build(model, verb => RunMenuVerb(room.Id, verb), global::Avalonia.Controls.PlacementMode.Pointer, this); + menu.Open(this); + } + + /// What a room menu entry does. Internal for tests, which choose an entry the way a click on it would. + internal void RunMenuVerb(long room, string verb) + { + if (verb == MapEditing.WalkVerb) + { + _walkTo?.Invoke(room); + } + else if (MapEditing.TextVerbs.Contains(verb)) + { + // The inspector shows the room once the client has published it selected; the field takes the keyboard then. + global::Avalonia.Threading.Dispatcher.UIThread.Post(() => _inspector.FocusField(verb), global::Avalonia.Threading.DispatcherPriority.Background); + } + else if (MapEditing.EditFor(verb, room) is { } edit) + { + _edit?.Invoke(edit); + } + } + /// Zooms by about , keeping what is under it there. internal void ZoomAbout(Point point, double notches) { @@ -205,7 +318,7 @@ internal void ZoomAbout(Point point, double notches) } // The centre is middle + pan; a point at offset d from it moves to d·ratio, so the pan takes up the difference. - var middle = new Point(Bounds.Width / 2, Bounds.Height / 2); + var middle = Middle; var ratio = next / Zoom; var fromCentre = point - (middle + _pan); _pan = point - middle - (fromCentre * ratio); @@ -313,6 +426,23 @@ public override void Render(DrawingContext context) } DrawStairs(context, room, rect, room.Current ? Contrasting(accent) : _text); + if (room.Symbol is { } symbol && !room.Up && !room.Down) + { + var mark = PanelText.Format(symbol, Math.Max(8, size * 0.5), room.Current ? Contrasting(accent) : _text, bold: true, size); + context.DrawText(mark, new Point(c.X - (mark.Width / 2), c.Y - (mark.Height / 2))); + } + + if (room.Noted) + { + context.DrawEllipse(new SolidColorBrush(path), null, rect.TopRight + new Vector(-size * 0.12, size * 0.12), size * 0.1, size * 0.1); + } + + if (room.Selected) + { + // The room being edited: a ring in the draft colour, outside any halo, so it reads on the current room too. + var ring = new Pen(new SolidColorBrush(path), 2, new DashStyle([2, 1.5], 0)); + context.DrawRectangle(null, ring, rect.Inflate(size * 0.42), radius * 2.2, radius * 2.2); + } if ((names || room.Id == _hovered) && room.Id != _hovered) { diff --git a/src/SharpMUTerm.Avalonia/MapInspector.cs b/src/SharpMUTerm.Avalonia/MapInspector.cs new file mode 100644 index 00000000..556737db --- /dev/null +++ b/src/SharpMUTerm.Avalonia/MapInspector.cs @@ -0,0 +1,330 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Automation; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Layout; +using Avalonia.Media; +using SharpMUTerm.Client.Panels; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's inspector for the room being edited (): a small card in the map's top +/// right corner with the room's name, area, note, symbol, weight, lock and exits, each edited in place, and nudge, delete, +/// undo and done buttons. It says what the cell map's side column says, from the same model, and every change it makes is +/// a handed to the client (), which checks it and applies it the way +/// a cell key's edit is applied. It never edits the map itself: the fields show what the client published, and an edit the +/// client refuses is simply put back on the next model. +/// +internal sealed class MapInspector : Border +{ + internal const double CardWidth = 272; + + private readonly TextBlock _title = new() { FontWeight = FontWeight.SemiBold, TextTrimming = TextTrimming.CharacterEllipsis }; + private readonly TextBlock _where = new() { Opacity = 0.75 }; + private readonly TextBlock _pending = new() { TextWrapping = TextWrapping.Wrap, IsVisible = false }; + private readonly StackPanel _exits = new() { Spacing = 2 }; + private readonly Button _undo; + private readonly Button _delete; + private MapViewModel _model = new(null, 0, [], [], null); + private Action? _edit; + private Action? _select; + private Color _ink = Colors.White; + + public MapInspector() + { + HorizontalAlignment = HorizontalAlignment.Right; + VerticalAlignment = VerticalAlignment.Top; + Width = CardWidth; + Margin = new Thickness(0, 30, 8, 8); + Padding = new Thickness(10, 8); + CornerRadius = new CornerRadius(NativeTokens.RadiusM); + BorderThickness = new Thickness(1); + IsVisible = false; + AutomationProperties.SetName(this, "Room inspector"); + + NameBox = Field("Name"); + AreaBox = Field("Area"); + NoteBox = Field("Note"); + SymbolBox = Field("Symbol"); + SymbolBox.MaxLength = 1; + WeightBox = Field("Weight"); + ExitBox = Field("Exit"); + ExitBox.PlaceholderText = "direction or command"; + TargetBox = Field("Leads to"); + TargetBox.PlaceholderText = "room number, or next"; + LockBox = new CheckBox { Content = "Locked: no walk goes through it" }; + LockBox.IsCheckedChanged += (_, _) => + { + if (_model.Selected is { } room && LockBox.IsChecked is { } locked && locked != room.Locked) + { + _edit?.Invoke(MapEdit.Lock(room.Id, locked)); + } + }; + + Commit(NameBox, (room, text) => text != room.Name ? MapEdit.Rename(room.Id, text) : null); + Commit(AreaBox, (room, text) => text != (room.Area ?? string.Empty) ? MapEdit.Area(room.Id, text) : null); + Commit(NoteBox, (room, text) => text != (room.Note ?? string.Empty) ? MapEdit.Note(room.Id, text) : null); + Commit(SymbolBox, (room, text) => text != (room.Symbol ?? string.Empty) ? MapEdit.Symbol(room.Id, text) : null); + Commit(WeightBox, (room, text) => + int.TryParse(text, NumberStyles.None, CultureInfo.InvariantCulture, out var weight) && weight != room.Weight ? MapEdit.Weight(room.Id, weight) : null); + + var add = Small("Add exit", AddExit); + TargetBox.KeyDown += (_, e) => + { + if (e.Key == Key.Enter) + { + e.Handled = true; + AddExit(); + } + }; + + _undo = Small("Undo", () => _edit?.Invoke(MapEdit.Undo)); + _delete = Small("Delete room", () => + { + if (_model.Selected is { } room) + { + _edit?.Invoke(MapEdit.Delete(room.Id)); + } + }); + var done = Small("Done", () => _select?.Invoke(null)); + + var nudge = new WrapPanel(); + foreach (var (label, dx, dy, dz) in new[] { ("West", -1, 0, 0), ("North", 0, -1, 0), ("South", 0, 1, 0), ("East", 1, 0, 0), ("Level up", 0, 0, 1), ("Level down", 0, 0, -1) }) + { + nudge.Children.Add(Small(label, () => + { + if (_model.Selected is { } room) + { + _edit?.Invoke(MapEdit.Move(room.Id, dx, dy, dz)); + } + })); + } + + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), RowSpacing = 4, ColumnSpacing = 8 }; + var row = 0; + void Row(string label, Control field) + { + grid.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); + var text = new TextBlock { Text = label, VerticalAlignment = VerticalAlignment.Center, Opacity = 0.75 }; + Grid.SetRow(text, row); + Grid.SetRow(field, row); + Grid.SetColumn(field, 1); + grid.Children.Add(text); + grid.Children.Add(field); + row++; + } + + Row("Name", NameBox); + Row("Area", AreaBox); + Row("Note", NoteBox); + Row("Symbol", SymbolBox); + Row("Weight", WeightBox); + + var newExit = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,Auto"), ColumnSpacing = 4 }; + Grid.SetColumn(TargetBox, 1); + Grid.SetColumn(add, 2); + newExit.Children.Add(ExitBox); + newExit.Children.Add(TargetBox); + newExit.Children.Add(add); + + var buttons = new WrapPanel(); + buttons.Children.Add(_undo); + buttons.Children.Add(_delete); + buttons.Children.Add(done); + + Child = new StackPanel + { + Spacing = 6, + Children = + { + _title, + _where, + grid, + LockBox, + new TextBlock { Text = "Exits", Opacity = 0.75 }, + _exits, + newExit, + _pending, + new TextBlock { Text = "Move", Opacity = 0.75 }, + nudge, + buttons, + }, + }; + + // Nothing pressed on the card reaches the map under it: a press here is never a pan, a walk or a pane menu. + PointerPressed += (_, e) => e.Handled = true; + PointerReleased += (_, e) => e.Handled = true; + PointerWheelChanged += (_, e) => e.Handled = true; + } + + internal TextBox NameBox { get; } + + internal TextBox AreaBox { get; } + + internal TextBox NoteBox { get; } + + internal TextBox SymbolBox { get; } + + internal TextBox WeightBox { get; } + + internal TextBox ExitBox { get; } + + internal TextBox TargetBox { get; } + + internal CheckBox LockBox { get; } + + /// The room it shows, or null. Internal for tests. + internal MapRoomDetails? Room => _model.Selected; + + /// Shows the room the model says is being edited, or hides when none is. + public void Show(MapViewModel model, Color plane, Color text, Action? edit, Action? select) + { + _edit = edit; + _select = select; + var previous = _model.Selected; + _model = model; + IsVisible = model.Selected is not null; + if (model.Selected is not { } room) + { + return; + } + + if (text != _ink || Background is null) + { + _ink = text; + var tokens = NativeTokens.For(null, (0.299 * plane.R) + (0.587 * plane.G) + (0.114 * plane.B) < 140); + Background = tokens.Brush(tokens.Card); + BorderBrush = tokens.Brush(tokens.Edge); + SetValue(global::Avalonia.Controls.Documents.TextElement.ForegroundProperty, tokens.Brush(tokens.Text)); + tokens.ApplySimple(Resources); + } + + _title.Text = $"#{room.Id.ToString(CultureInfo.InvariantCulture)} {room.Name}"; + _where.Text = $"at {room.X.ToString(CultureInfo.InvariantCulture)}, {room.Y.ToString(CultureInfo.InvariantCulture)} · level {room.Z.ToString(CultureInfo.InvariantCulture)}"; + var other = previous?.Id != room.Id; + Put(NameBox, room.Name, other); + Put(AreaBox, room.Area ?? string.Empty, other); + Put(NoteBox, room.Note ?? string.Empty, other); + Put(SymbolBox, room.Symbol ?? string.Empty, other); + Put(WeightBox, room.Weight.ToString(CultureInfo.InvariantCulture), other); + LockBox.IsChecked = room.Locked; + if (other) + { + ExitBox.Text = string.Empty; + TargetBox.Text = string.Empty; + } + + if (!room.Exits.SequenceEqual(previous?.Exits ?? []) || other) + { + _exits.Children.Clear(); + foreach (var exit in room.Exits) + { + var line = new DockPanel(); + var remove = Small("Remove", () => _edit?.Invoke(MapEdit.RemoveExit(room.Id, exit.Exit))); + ToolTip.SetTip(remove, $"Remove the {exit.Exit} exit"); + DockPanel.SetDock(remove, Dock.Right); + line.Children.Add(remove); + line.Children.Add(new TextBlock + { + Text = $"{exit.Exit} {(exit.To is null ? "not walked" : exit.Name ?? "#" + exit.To.Value.ToString(CultureInfo.InvariantCulture))}", + VerticalAlignment = VerticalAlignment.Center, + TextTrimming = TextTrimming.CharacterEllipsis, + }); + _exits.Children.Add(line); + } + } + + _pending.Text = model.Pending ?? string.Empty; + _pending.IsVisible = model.Pending is not null; + _undo.IsEnabled = model.UndoLabel is not null; + ToolTip.SetTip(_undo, model.UndoLabel is { } undo ? $"Undo {undo}" : "Nothing to undo"); + _delete.IsEnabled = model.Current?.Id != room.Id; + } + + /// Puts the keyboard in the field a menu verb names (). + public void FocusField(string verb) + { + var box = verb switch + { + MapEditing.RenameVerb => NameBox, + MapEditing.AreaVerb => AreaBox, + MapEditing.NoteVerb => NoteBox, + MapEditing.SymbolVerb => SymbolBox, + MapEditing.WeightVerb => WeightBox, + MapEditing.ExitVerb => ExitBox, + _ => null, + }; + if (box is not null) + { + box.Focus(); + box.SelectAll(); + } + } + + private void AddExit() + { + if (_model.Selected is not { } room) + { + return; + } + + var exit = ExitBox.Text?.Trim() ?? string.Empty; + var target = TargetBox.Text?.Trim() ?? string.Empty; + MapEdit? edit = target.Equals("next", StringComparison.OrdinalIgnoreCase) + ? MapEdit.LinkNext(room.Id, exit) + : long.TryParse(target, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out var to) ? MapEdit.AddExit(room.Id, exit, to) : null; + if (edit is not null) + { + _edit?.Invoke(edit); + ExitBox.Text = string.Empty; + TargetBox.Text = string.Empty; + } + } + + /// A field shows the model's value unless the player is typing in it; a room changed always shows its own. + private static void Put(TextBox box, string value, bool force) + { + if (force || !box.IsFocused) + { + box.Text = value; + } + } + + /// Enter, or leaving the field, hands the client the edit the field's text asks for, if it asks for one. + private void Commit(TextBox box, Func make) + { + void Run() + { + if (_model.Selected is { } room && make(room, box.Text?.Trim() ?? string.Empty) is { } edit) + { + _edit?.Invoke(edit); + } + } + + box.KeyDown += (_, e) => + { + if (e.Key == Key.Enter) + { + e.Handled = true; + Run(); + } + }; + box.LostFocus += (_, _) => Run(); + } + + private static TextBox Field(string name) + { + var box = new TextBox { MinHeight = 24, Padding = new Thickness(6, 2), FontSize = NativeTokens.Body, MaxLength = 200 }; + AutomationProperties.SetName(box, name); + return box; + } + + private static Button Small(string label, Action run) + { + var button = new Button { Content = label, Padding = new Thickness(8, 2), Margin = new Thickness(0, 0, 4, 4), FontSize = NativeTokens.Body, Focusable = false }; + button.Click += (_, _) => run(); + return button; + } +} diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 1a539792..2f0d6d9c 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -147,6 +147,11 @@ void Family(string id, string prefix, Func"); + + // Editing the map: the room you are in selected, the map holding the keys (its footer names them). Listed + // unconditionally beside Show map; it refuses out loud where there is no map. + Add("map:edit", CommandGroup.Terminal, "Edit map", detail: "rename, area, lock, weight, exits, notes · /map rename …"); + Add("map:undo", CommandGroup.Terminal, "Undo map edit", detail: "takes back the last change to the map", when: c => c.State.MapUndo is not null); // The panels a layout places, openable one at a time as tabs: each draws the focused character's own data // and says so when there is none yet, so they are listed unconditionally, like the map. Add("panel:who-here", CommandGroup.Terminal, "Show who is here", detail: "players and creatures in the room · click a name to look"); diff --git a/src/SharpMUTerm.Client/Help/SlashCommands.cs b/src/SharpMUTerm.Client/Help/SlashCommands.cs index b0031bad..aaedf28f 100644 --- a/src/SharpMUTerm.Client/Help/SlashCommands.cs +++ b/src/SharpMUTerm.Client/Help/SlashCommands.cs @@ -26,6 +26,10 @@ public static class SlashCommands new("/walk", "/walk ", "Speedwalk to a room on this connection's map, one step at a time", "/walk "), new("/walk", "/walk stop", "Stop walking", "/walk stop"), new("/map", "/map lock|unlock [room]", "Keep walks out of a room, or let them through again", "/map lock "), + new("/map", "/map edit", "Edit the map: select a room and change it with keys (⌃P ▸ Edit map)", "/map edit"), + new("/map", "/map rename|area|note|symbol|weight …", "Change a room on the map, by its number", "/map rename "), + new("/map", "/map exit · unexit ", "Add or remove an exit by hand", "/map exit "), + new("/map", "/map move [dz] · delete · undo", "Move or delete a room, or undo the last edit", "/map undo"), new("/web", "/web ", "Open a page in the built-in web view", "/web "), new("/graphics", "/graphics", "Say how pictures are drawn in this terminal, and why", "/graphics"), new("/triggers", "/triggers", "Say which trigger rules this window's character runs, and why a window did not open", "/triggers"), diff --git a/src/SharpMUTerm.Client/Panels/MapEditing.cs b/src/SharpMUTerm.Client/Panels/MapEditing.cs new file mode 100644 index 00000000..73c0a87a --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/MapEditing.cs @@ -0,0 +1,394 @@ +using System.Globalization; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Core.Mapping; + +namespace SharpMUTerm.Client.Panels; + +/// What a map edit does. +public enum MapEditKind +{ + Rename, + Area, + Lock, + Unlock, + Weight, + + /// An exit pointed at a room the map already has. + AddExit, + + /// An exit that will lead to the next room the character walks into. + LinkNext, + RemoveExit, + Move, + Delete, + Note, + Symbol, + + /// The last edit taken back. + Undo, +} + +/// +/// One edit to a map, as both hosts ask for it: the cell map's keys and /map commands parse into one, and the +/// window's room menu and inspector build one. Every edit goes through , so a native +/// gesture and a cell key that ask for the same thing leave the same map. +/// +/// What it does. +/// The room it acts on (ignored by ). +/// A name, an area, a note, a symbol or an exit's direction or command. +/// A weight. +/// The room an added exit leads to. +/// A move's step east. +/// A move's step south. +/// A move's step up. +public sealed record MapEdit(MapEditKind Kind, long Room, string? Text = null, int Number = 0, long? Target = null, int Dx = 0, int Dy = 0, int Dz = 0) +{ + public static MapEdit Rename(long room, string name) => new(MapEditKind.Rename, room, name); + + public static MapEdit Area(long room, string? area) => new(MapEditKind.Area, room, area); + + public static MapEdit Lock(long room, bool locked) => new(locked ? MapEditKind.Lock : MapEditKind.Unlock, room); + + public static MapEdit Weight(long room, int weight) => new(MapEditKind.Weight, room, Number: weight); + + public static MapEdit AddExit(long room, string exit, long to) => new(MapEditKind.AddExit, room, exit, Target: to); + + public static MapEdit LinkNext(long room, string exit) => new(MapEditKind.LinkNext, room, exit); + + public static MapEdit RemoveExit(long room, string exit) => new(MapEditKind.RemoveExit, room, exit); + + public static MapEdit Move(long room, int dx, int dy, int dz = 0) => new(MapEditKind.Move, room, Dx: dx, Dy: dy, Dz: dz); + + public static MapEdit Delete(long room) => new(MapEditKind.Delete, room); + + public static MapEdit Note(long room, string? note) => new(MapEditKind.Note, room, note); + + public static MapEdit Symbol(long room, string? symbol) => new(MapEditKind.Symbol, room, symbol); + + public static MapEdit Undo { get; } = new(MapEditKind.Undo, 0); +} + +/// What an edit did: whether the map changed, and a sentence for the player either way. +public sealed record MapEditResult(bool Done, string Message); + +/// +/// Map editing, for both hosts: applying an edit to a recorder (the one place an edit meets the map), reading +/// /map commands into edits, the keys the cell map answers in edit mode, and the window's room menu. +/// +public static class MapEditing +{ + /// A room menu entry's verbs (). A verb that needs words opens the inspector at that field. + public const string WalkVerb = "walk", RenameVerb = "rename", AreaVerb = "area", NoteVerb = "note", SymbolVerb = "symbol", + WeightVerb = "weight", ExitVerb = "exit", UnexitVerb = "unexit", LockVerb = "lock", UnlockVerb = "unlock", DeleteVerb = "delete", + UndoVerb = "undo"; + + /// The verbs that need words, which a host asks for in its inspector before an edit is made. + public static IReadOnlyList TextVerbs { get; } = [RenameVerb, AreaVerb, NoteVerb, SymbolVerb, WeightVerb, ExitVerb]; + + /// + /// The keys the cell map answers while it holds the keyboard in edit mode, in the order its footer names them. Every + /// one is answered by the cell map's key handler; a test holds the two to each other. + /// + public static IReadOnlyList<(string Key, string Word)> Keys { get; } = + [ + ("←↑→↓", "select"), + ("⇧←↑→↓", "move"), + ("r", "rename"), + ("a", "area"), + ("l", "lock"), + ("w", "weight"), + ("x", "exit"), + ("-", "remove exit"), + ("n", "note"), + ("s", "symbol"), + ("Del", "delete"), + ("u", "undo"), + ("⏎", "walk"), + ("Esc", "done"), + ]; + + /// + /// Applies to 's map: checked first, then made through + /// (under its lock, marked dirty, + /// kept for undo), or and . Call it on the thread + /// that owns the map — the client's UI thread. + /// + public static MapEditResult Apply(MapRecorder recorder, MapEdit edit) + { + ArgumentNullException.ThrowIfNull(recorder); + ArgumentNullException.ThrowIfNull(edit); + if (edit.Kind == MapEditKind.Undo) + { + return recorder.Undo() is { } undone ? new(true, $"undid: {undone}") : new(false, "nothing to undo"); + } + + var map = recorder.Map; + if (map.Room(edit.Room) is not { } room) + { + return new(false, $"no room {edit.Room.ToString(CultureInfo.InvariantCulture)} on the map"); + } + + var name = Snippet(room.Name.Length > 0 ? room.Name : "#" + room.Id.ToString(CultureInfo.InvariantCulture)); + var id = edit.Room; + var text = edit.Text?.Trim() ?? string.Empty; + var exit = WorldMap.ExitKey(text); + switch (edit.Kind) + { + case MapEditKind.Rename when text.Length == 0: + return new(false, "a room needs a name"); + case MapEditKind.Weight when edit.Number < 1 || edit.Number > WorldMap.MaxWeight: + return new(false, $"a weight is 1 to {WorldMap.MaxWeight.ToString(CultureInfo.InvariantCulture)}"); + case MapEditKind.AddExit or MapEditKind.LinkNext or MapEditKind.RemoveExit when exit.Length == 0: + return new(false, "name the exit: a direction (n, ne, up…) or the command that takes it"); + case MapEditKind.AddExit when edit.Target is not { } to || map.Room(to) is null: + return new(false, $"no room {edit.Target?.ToString(CultureInfo.InvariantCulture) ?? "?"} to lead to"); + case MapEditKind.Symbol when text.Length > 1 || (text.Length == 1 && !WorldMap.IsSymbol(text[0])): + return new(false, "a symbol is one printable character"); + case MapEditKind.Delete when recorder.CurrentRoomId == id: + return new(false, "you are in that room — walk out of it first"); + } + + if (edit.Kind == MapEditKind.LinkNext) + { + return recorder.LinkNext(id, exit) + ? new(true, $"the next room you walk into is {exit} from {name}") + : new(false, "that exit is already waiting"); + } + + var touched = edit.Kind == MapEditKind.Delete + ? map.Rooms.Values.Where(r => r.Id == id || r.AllExits().Any(e => e.To == id)).Select(r => r.Id).ToList() + : [id]; + var (label, done) = edit.Kind switch + { + MapEditKind.Rename => ($"rename {name}", $"renamed {name} to {Snippet(text)}"), + MapEditKind.Area => ($"area of {name}", text.Length == 0 ? $"{name} is in no area" : $"{name} is in {Snippet(text)}"), + MapEditKind.Lock => ($"lock {name}", $"{name} is locked: no walk goes through it"), + MapEditKind.Unlock => ($"unlock {name}", $"{name} is unlocked"), + MapEditKind.Weight => ($"weight of {name}", $"{name} weighs {edit.Number.ToString(CultureInfo.InvariantCulture)}"), + MapEditKind.AddExit => ($"exit {exit} from {name}", $"{exit} from {name} leads to room {edit.Target!.Value.ToString(CultureInfo.InvariantCulture)}"), + MapEditKind.RemoveExit => ($"remove exit {exit}", $"{name} has no {exit} exit now"), + MapEditKind.Move => ($"move {name}", $"moved {name}"), + MapEditKind.Delete => ($"delete {name}", $"deleted {name} — undo brings it back"), + MapEditKind.Note => ($"note on {name}", text.Length == 0 ? $"{name} has no note" : $"noted {name}"), + MapEditKind.Symbol => ($"symbol of {name}", text.Length == 0 ? $"{name} has no symbol" : $"{name} is marked {text}"), + _ => (string.Empty, string.Empty), + }; + + var changed = recorder.Edit(label, touched, m => edit.Kind switch + { + MapEditKind.Rename => m.Rename(id, text), + MapEditKind.Area => m.SetArea(id, text), + MapEditKind.Lock => m.SetLocked(id, true), + MapEditKind.Unlock => m.SetLocked(id, false), + MapEditKind.Weight => m.SetWeight(id, edit.Number), + MapEditKind.AddExit => m.SetExit(id, text, edit.Target!.Value), + MapEditKind.RemoveExit => m.RemoveExit(id, text), + MapEditKind.Move => m.Move(id, edit.Dx, edit.Dy, edit.Dz), + MapEditKind.Delete => m.Remove(id), + MapEditKind.Note => m.SetNote(id, text), + MapEditKind.Symbol => m.SetSymbol(id, text), + _ => false, + }); + return changed ? new(true, done) : new(false, $"nothing to change on {name}"); + } + + /// The /map verbs that edit, which reads. + public static IReadOnlyList CommandVerbs { get; } = + ["rename", "area", "lock", "unlock", "weight", "exit", "unexit", "move", "delete", "note", "symbol", "undo"]; + + /// + /// A /map command's words after /map, as an edit: rename 12 The Hall, area 12 Keep, + /// lock|unlock [room], weight 12 5, exit 12 ne 14 (or next: the room walked into next), + /// unexit 12 ne, move 12 1 0 [0], delete 12, note 12 [text], symbol 12 [c], + /// undo. A room is its number; reads a name for lock and unlock (and gives the + /// current room for none). Null edit with a problem when the words are not one of these. + /// + public static (MapEdit? Edit, string? Problem) Parse(string argument, Func resolve) + { + ArgumentNullException.ThrowIfNull(resolve); + var words = (argument ?? string.Empty).Trim(); + var space = words.IndexOf(' '); + var verb = (space < 0 ? words : words[..space]).ToLowerInvariant(); + var rest = space < 0 ? string.Empty : words[(space + 1)..].Trim(); + if (verb == "undo") + { + return (MapEdit.Undo, null); + } + + if (verb is "lock" or "unlock") + { + return resolve(rest.Length == 0 ? null : rest) is { } locked + ? (MapEdit.Lock(locked, verb == "lock"), null) + : (null, "no such room"); + } + + var usage = verb switch + { + "rename" => "/map rename ", + "area" => "/map area [area]", + "weight" => "/map weight <1-1000>", + "exit" => "/map exit ", + "unexit" => "/map unexit ", + "move" => "/map move [dz]", + "delete" => "/map delete ", + "note" => "/map note [text]", + "symbol" => "/map symbol [character]", + _ => null, + }; + if (usage is null) + { + return (null, "use /map lock|unlock [room], rename, area, weight, exit, unexit, move, delete, note, symbol or undo"); + } + + space = rest.IndexOf(' '); + var first = space < 0 ? rest : rest[..space]; + var tail = space < 0 ? string.Empty : rest[(space + 1)..].Trim(); + if (!long.TryParse(first, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out var room)) + { + return (null, $"use {usage} — a room is its number"); + } + + switch (verb) + { + case "rename": + return tail.Length == 0 ? (null, $"use {usage}") : (MapEdit.Rename(room, tail), null); + case "area": + return (MapEdit.Area(room, tail), null); + case "note": + return (MapEdit.Note(room, tail), null); + case "symbol": + return (MapEdit.Symbol(room, tail), null); + case "delete": + return (MapEdit.Delete(room), null); + case "weight": + return int.TryParse(tail, NumberStyles.None, CultureInfo.InvariantCulture, out var weight) + ? (MapEdit.Weight(room, weight), null) + : (null, $"use {usage}"); + case "unexit": + return tail.Length == 0 ? (null, $"use {usage}") : (MapEdit.RemoveExit(room, tail), null); + case "exit": + { + var last = tail.LastIndexOf(' '); + if (last < 0) + { + return (null, $"use {usage}"); + } + + var exit = tail[..last].Trim(); + var to = tail[(last + 1)..]; + if (to.Equals("next", StringComparison.OrdinalIgnoreCase)) + { + return (MapEdit.LinkNext(room, exit), null); + } + + return long.TryParse(to, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out var target) + ? (MapEdit.AddExit(room, exit, target), null) + : (null, $"use {usage}"); + } + + case "move": + { + var parts = tail.Split(' ', StringSplitOptions.RemoveEmptyEntries); + var steps = new int[3]; + for (var i = 0; i < parts.Length; i++) + { + if (parts.Length is < 2 or > 3 || !int.TryParse(parts[i], NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out steps[i])) + { + return (null, $"use {usage}"); + } + } + + return parts.Length < 2 ? (null, $"use {usage}") : (MapEdit.Move(room, steps[0], steps[1], steps[2]), null); + } + } + + return (null, $"use {usage}"); + } + + /// + /// The /map command a text edit starts from, put on the command line for the player to finish: the room's + /// number and what it holds now, so ⏎ with nothing changed changes nothing. Null for a verb that needs no words. + /// + public static string? CommandFor(string verb, MapRoomDetails room) + { + ArgumentNullException.ThrowIfNull(room); + var id = room.Id.ToString(CultureInfo.InvariantCulture); + return verb switch + { + RenameVerb => $"/map rename {id} {room.Name}", + AreaVerb => $"/map area {id} {room.Area}", + NoteVerb => $"/map note {id} {room.Note}", + SymbolVerb => $"/map symbol {id} {room.Symbol}", + WeightVerb => $"/map weight {id} {room.Weight.ToString(CultureInfo.InvariantCulture)}", + ExitVerb => $"/map exit {id} ", + UnexitVerb => $"/map unexit {id} ", + _ => null, + }; + } + + /// + /// The menu a right click on a room opens in the window: walk there, the edits that need words (each opens the + /// inspector at its field), lock or unlock, delete, and undo when there is something to undo. Each entry carries the + /// cell map's key for the same edit. + /// + public static MenuModel Menu(MapViewRoom room, string? undo) + { + ArgumentNullException.ThrowIfNull(room); + var here = room.Current; + var entries = new List + { + new($"Walk to {Snippet(room.Name)}", "⏎", here ? null : WalkVerb, Enabled: !here), + MenuEntry.Separator, + new("Rename…", "r", RenameVerb), + new("Set area…", "a", AreaVerb), + new("Note…", "n", NoteVerb), + new("Symbol…", "s", SymbolVerb), + new("Weight…", "w", WeightVerb), + new("Add exit…", "x", ExitVerb), + room.Locked ? new("Unlock", "l", UnlockVerb) : new("Lock", "l", LockVerb), + MenuEntry.Separator, + new("Delete room", "Del", here ? null : DeleteVerb, Enabled: !here), + }; + if (undo is not null) + { + entries.Add(new($"Undo {Snippet(undo)}", "u", UndoVerb)); + } + + return new MenuModel(entries); + } + + /// The edit a menu verb that needs no words makes on , or null for one that does. + public static MapEdit? EditFor(string verb, long room) => verb switch + { + LockVerb => MapEdit.Lock(room, true), + UnlockVerb => MapEdit.Lock(room, false), + DeleteVerb => MapEdit.Delete(room), + UndoVerb => MapEdit.Undo, + _ => null, + }; + + /// + /// The room nearest in a direction on the view's grid ( east, + /// south), or null when there is none that way. A room not in the view starts from the anchor. + /// + public static long? Neighbour(MapViewModel view, long from, int dx, int dy) + { + ArgumentNullException.ThrowIfNull(view); + if (view.Rooms.FirstOrDefault(r => r.Id == from) is not { } start) + { + return view.AnchorId; + } + + // Ahead in the direction asked, no further to the side than ahead; nearest first, a step aside costing two forward. + return view.Rooms + .Where(r => r.Id != from) + .Select(r => (Room: r, Ahead: ((r.X - start.X) * dx) + ((r.Y - start.Y) * dy), Side: Math.Abs(((r.X - start.X) * dy) - ((r.Y - start.Y) * dx)))) + .Where(p => p.Ahead > 0 && p.Side <= p.Ahead) + .OrderBy(p => p.Ahead + (2 * p.Side)) + .ThenBy(p => p.Room.Id) + .Select(p => (long?)p.Room.Id) + .FirstOrDefault(); + } + + private static string Snippet(string text) => text.Length <= 40 ? text : text[..39] + "…"; +} diff --git a/src/SharpMUTerm.Client/Panels/MapViewModel.cs b/src/SharpMUTerm.Client/Panels/MapViewModel.cs index e62bccbd..5f6a0e5a 100644 --- a/src/SharpMUTerm.Client/Panels/MapViewModel.cs +++ b/src/SharpMUTerm.Client/Panels/MapViewModel.cs @@ -16,8 +16,33 @@ namespace SharpMUTerm.Client.Panels; /// The name of another area one of its exits leads into (the first by name), or null. Both views mark the way out in /// that area's colour (). /// +/// Whether it is the room being edited (). +/// The one character the player marked it with, or null. +/// Whether the player wrote a note on it. public sealed record MapViewRoom( - long Id, string Name, int X, int Y, bool Current, bool Ahead, bool Locked, bool Up = false, bool Down = false, string? Elsewhere = null); + long Id, string Name, int X, int Y, bool Current, bool Ahead, bool Locked, bool Up = false, bool Down = false, string? Elsewhere = null, + bool Selected = false, string? Symbol = null, bool Noted = false); + +/// An exit as a view names it: the direction or command, and the room it leads to, or none for a stub. +/// A direction's short command (n, up) or a special exit's command. +/// The room it leads to, or null when nobody has walked it. +/// That room's name, bounded, or null. +public sealed record MapViewExitName(string Exit, long? To, string? Name); + +/// +/// The room being edited, as both hosts' inspectors show it: the cell map's side column or footer line, and the window's +/// inspector panel. +/// +public sealed record MapRoomDetails( + long Id, string Name, string? Area, int X, int Y, int Z, int Weight, bool Locked, string? Symbol, string? Note, IReadOnlyList Exits) +{ + /// Value equality over the exits too, which a record's list member does not give. + public bool Equals(MapRoomDetails? other) => + other is not null && Id == other.Id && Name == other.Name && Area == other.Area && (X, Y, Z) == (other.X, other.Y, other.Z) + && Weight == other.Weight && Locked == other.Locked && Symbol == other.Symbol && Note == other.Note && Exits.SequenceEqual(other.Exits); + + public override int GetHashCode() => HashCode.Combine(Id, Name, Area, X, Y, Z, Weight, Exits.Count); +} /// A drawn exit between two rooms of the view, once per pair. public sealed record MapViewExit(long From, long To); @@ -60,6 +85,24 @@ public sealed record MapViewModel(string? Area, int Level, IReadOnlyListThe room the character is in, or null. public MapViewRoom? Current => Rooms.FirstOrDefault(r => r.Current); + /// + /// The current room's exits with the names of the rooms they lead to, directions first in compass order: what the + /// cell map lists beside the grid when it has the width, so a terminal names the rooms around you as the canvas does. + /// + public IReadOnlyList Nearby { get; init; } = []; + + /// The room being edited, or null when the map is not in edit mode. + public MapRoomDetails? Selected { get; init; } + + /// Whether the map is in edit mode: a room is selected. + public bool Editing => Selected is not null; + + /// An exit waiting for the next room walked into, said as a sentence, or null. + public string? Pending { get; init; } + + /// What an undo would take back, or null when nothing would. + public string? UndoLabel { get; init; } + /// The colour of the area the view draws, or null when that area has no name. public string? AreaColour => Areas.FirstOrDefault(a => a.Drawn)?.Colour; @@ -76,15 +119,32 @@ public sealed record MapViewModel(string? Area, int Level, IReadOnlyListThe rooms a walk under way still goes through. /// What the walk says about itself, or null. /// The area colours for the theme in use ( by default). - public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerable ahead, string? walking, MapAreaPalette? palette = null) + /// + /// The room being edited, or null. When it is not on the current room's level and area, the view is drawn around it + /// instead, so the room being edited is always drawn. + /// + /// An exit waiting for the next room walked into (). + /// What an undo would take back (). + public static MapViewModel From( + WorldMap map, long? currentRoomId, IEnumerable ahead, string? walking, MapAreaPalette? palette = null, + long? selected = null, (long From, string Exit)? pending = null, string? undo = null) { ArgumentNullException.ThrowIfNull(map); palette ??= MapAreaPalette.Dark; var anchor = currentRoomId is { } id ? map.Room(id) : null; anchor ??= map.Rooms.Values.LastOrDefault(); + var chosen = selected is { } pick ? map.Room(pick) : null; + if (chosen is not null && (anchor is null || chosen.Z != anchor.Z || chosen.AreaId != anchor.AreaId)) + { + anchor = chosen; + } + + var pendingText = pending is { } link && map.Room(link.From) is { } source + ? $"the next room you walk into is {MapDirections.Command(link.Exit)} from {Bounded(source.Name)}" + : null; if (anchor is null) { - return new MapViewModel(null, 0, [], [], walking); + return new MapViewModel(null, 0, [], [], walking) { Pending = pendingText, UndoLabel = undo }; } var path = ahead.ToHashSet(); @@ -103,7 +163,10 @@ public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerable r.Id).ToHashSet(); var exits = new List(); @@ -140,9 +203,64 @@ public static MapViewModel From(WorldMap map, long? currentRoomId, IEnumerableA room's exits named: directions in compass order, then special exits by command, then stubs. + private static List ExitsOf(WorldMap map, MapRoom room) + { + var named = new List(); + foreach (var direction in MapDirections.All) + { + if (room.Exits.TryGetValue(direction, out var to)) + { + named.Add(new(MapDirections.Command(direction), to, map.Room(to) is { } next ? Bounded(next.Name) : null)); + } + else if (room.Stubs.Contains(direction)) + { + named.Add(new(MapDirections.Command(direction), null, null)); + } + } + + foreach (var (command, to) in room.SpecialExits.OrderBy(e => e.Key, StringComparer.Ordinal)) + { + named.Add(new(Bounded(command), to, map.Room(to) is { } next ? Bounded(next.Name) : null)); + } + + foreach (var stub in room.Stubs.Where(s => !MapDirections.All.Contains(s)).Order(StringComparer.Ordinal)) + { + named.Add(new(Bounded(stub), null, null)); + } + + return named; + } + + private static MapRoomDetails DetailsOf(WorldMap map, MapRoom room) => new( + room.Id, + Bounded(room.Name), + AreaName(map, room.AreaId), + room.X, + room.Y, + room.Z, + room.Weight, + room.Locked, + ValidSymbol(room.Symbol), + room.Note is { } note ? Bounded(note) : null, + ExitsOf(map, room)); + + /// A symbol a view may draw: its first character when that is one a cell can hold, else null. + private static string? ValidSymbol(string? symbol) => + !string.IsNullOrEmpty(symbol) && WorldMap.IsSymbol(symbol[0]) ? symbol[..1] : null; + private static string Bounded(string name) => name.Length <= MaxNameLength ? name : name[..(MaxNameLength - 1)] + "…"; /// An area's name, bounded, or null for none. @@ -190,7 +308,8 @@ private static bool Climbs(WorldMap map, MapRoom room, bool up) /// Value equality over the rooms, exits and areas, which a record's list members do not give. public bool Equals(MapViewModel? other) => other is not null && Area == other.Area && Level == other.Level && Walking == other.Walking && AnchorId == other.AnchorId - && Rooms.SequenceEqual(other.Rooms) && Exits.SequenceEqual(other.Exits) && Areas.SequenceEqual(other.Areas); + && Rooms.SequenceEqual(other.Rooms) && Exits.SequenceEqual(other.Exits) && Areas.SequenceEqual(other.Areas) + && Nearby.SequenceEqual(other.Nearby) && Equals(Selected, other.Selected) && Pending == other.Pending && UndoLabel == other.UndoLabel; public override int GetHashCode() => HashCode.Combine(Area, Level, Walking, Rooms.Count, Exits.Count, Areas.Count); } diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index c3af479b..031adef8 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -41,6 +41,9 @@ public enum SurfaceActionKind /// A room id on the map. Walk, + /// A change to a map (MapEdit), checked and applied by the client. + MapEdit, + /// A change to a declared setting, committed through the client's save funnel. Edit, @@ -288,10 +291,18 @@ public static class SurfaceCatalog new( PanelIds.Map, typeof(MapViewModel), - [new(SurfaceActionKind.Walk, "room", "WalkFromMap"), PopOut], + [ + new(SurfaceActionKind.Walk, "room", "WalkFromMap"), + + // Editing: a room selected (a cell click while editing, the cell arrows; the window's right click or a click + // while editing), and every edit — cell key, /map command, native menu or inspector — through one funnel. + new(SurfaceActionKind.Pick, "select room", "SelectMapRoom"), + new(SurfaceActionKind.MapEdit, "edit", "ApplyMapEdit"), + PopOut, + ], CellsUnderNative, "SharpMUTerm.Tui.MapRenderer.Render", - PanelViews("MapCanvas")), + [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), new( PanelIds.WhoHere, typeof(WhoHereModel), diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index a657cbdc..16ccc83e 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -61,6 +61,7 @@ public sealed record CharacterRef( /// /// Whether the client's own dictionaries folder holds none, so Get a spelling dictionary is offered. /// +/// What the focused character's last map edit was, so Undo map edit is offered only with one. public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -78,7 +79,8 @@ public sealed record CommandContext( int KeyClashes = 0, IReadOnlyList? Floats = null, IReadOnlyList? RaggedWraps = null, - bool NoDictionary = false); + bool NoDictionary = false, + string? MapUndo = null); /// A world whose pane is narrower than its server's wrap column. /// The world's name. diff --git a/src/SharpMUTerm.Core/Mapping/MapModel.cs b/src/SharpMUTerm.Core/Mapping/MapModel.cs index 4e3ee74c..02425174 100644 --- a/src/SharpMUTerm.Core/Mapping/MapModel.cs +++ b/src/SharpMUTerm.Core/Mapping/MapModel.cs @@ -56,9 +56,35 @@ public sealed class MapRoom /// The room's colour as #rrggbb, or null for the default. public string? Color { get; set; } + /// The player's own note on the room, or null: kept with the map, never sent anywhere. + public string? Note { get; set; } + /// Anything a script wants to keep on the room. public Dictionary UserData { get; set; } = new(StringComparer.Ordinal); + /// A deep copy, for an edit's undo. + public MapRoom Clone() => new() + { + Id = Id, + Name = Name, + AreaId = AreaId, + X = X, + Y = Y, + Z = Z, + Environment = Environment, + Exits = new(Exits, StringComparer.Ordinal), + SpecialExits = new(SpecialExits, StringComparer.Ordinal), + Stubs = new(Stubs, StringComparer.Ordinal), + Weight = Weight, + ExitWeights = new(ExitWeights, StringComparer.Ordinal), + LockedExits = new(LockedExits, StringComparer.Ordinal), + Locked = Locked, + Symbol = Symbol, + Color = Color, + Note = Note, + UserData = new(UserData, StringComparer.Ordinal), + }; + /// Every exit, direction and special alike, as the command that takes it and where it leads. public IEnumerable<(string Command, string Key, long To)> AllExits() { @@ -118,6 +144,195 @@ public MapArea AreaNamed(string name) return created; } + // ── Edits by hand: each answers whether it changed anything, and changes nothing it refuses ────────── + + /// The longest room name, area name, note or exit command an edit keeps. + public const int MaxEditLength = 200; + + /// The heaviest weight an edit sets. + public const int MaxWeight = 1000; + + /// Renames a room. A blank name is refused. + public bool Rename(long id, string name) + { + var text = Clean(name); + if (Room(id) is not { } room || text.Length == 0 || room.Name == text) + { + return false; + } + + room.Name = text; + return true; + } + + /// Puts a room in the area called , creating it; blank takes it out of every area. + public bool SetArea(long id, string? area) + { + if (Room(id) is not { } room) + { + return false; + } + + var text = Clean(area); + int? next = text.Length == 0 ? null : AreaNamed(text).Id; + if (room.AreaId == next) + { + return false; + } + + room.AreaId = next; + return true; + } + + /// Locks or unlocks a room for paths. + public bool SetLocked(long id, bool locked) + { + if (Room(id) is not { } room || room.Locked == locked) + { + return false; + } + + room.Locked = locked; + return true; + } + + /// Sets the cost of entering a room, 1 to . + public bool SetWeight(long id, int weight) + { + if (Room(id) is not { } room || weight < 1 || weight > MaxWeight || room.Weight == weight) + { + return false; + } + + room.Weight = weight; + return true; + } + + /// + /// Points an exit of room at room : a direction (any spelling + /// reads) goes in , anything else is the command + /// of a special exit. A stub of the same name is linked. Both rooms must exist. + /// + public bool SetExit(long id, string exit, long to) + { + var key = ExitKey(exit); + if (Room(id) is not { } room || Room(to) is null || key.Length == 0) + { + return false; + } + + var exits = MapDirections.All.Contains(key) ? room.Exits : room.SpecialExits; + var changed = !exits.TryGetValue(key, out var was) || was != to; + exits[key] = to; + changed |= room.Stubs.Remove(key); + return changed; + } + + /// Removes an exit of a room, linked or a stub, by direction or command. + public bool RemoveExit(long id, string exit) + { + var key = ExitKey(exit); + if (Room(id) is not { } room || key.Length == 0) + { + return false; + } + + var removed = room.Exits.Remove(key) | room.SpecialExits.Remove(key) | room.Stubs.Remove(key); + room.ExitWeights.Remove(key); + room.LockedExits.Remove(key); + return removed; + } + + /// Moves a room on the grid by a step; up and down are . + public bool Move(long id, int dx, int dy, int dz) + { + if (Room(id) is not { } room || (dx, dy, dz) == (0, 0, 0)) + { + return false; + } + + (room.X, room.Y, room.Z) = (room.X + dx, room.Y + dy, room.Z + dz); + return true; + } + + /// Removes a room and every exit that led to it (those become stubs again, as before anyone walked them). + public bool Remove(long id) + { + if (!Rooms.Remove(id)) + { + return false; + } + + foreach (var other in Rooms.Values) + { + foreach (var key in other.Exits.Where(e => e.Value == id).Select(e => e.Key).ToList()) + { + other.Exits.Remove(key); + other.Stubs.Add(key); + } + + foreach (var key in other.SpecialExits.Where(e => e.Value == id).Select(e => e.Key).ToList()) + { + other.SpecialExits.Remove(key); + other.Stubs.Add(key); + } + } + + return true; + } + + /// Sets a room's note; blank clears it. + public bool SetNote(long id, string? note) + { + var text = Clean(note); + string? next = text.Length == 0 ? null : text; + if (Room(id) is not { } room || room.Note == next) + { + return false; + } + + room.Note = next; + return true; + } + + /// Sets the one character drawn in a room's cell; blank clears it. Only a printable, single-cell character. + public bool SetSymbol(long id, string? symbol) + { + var text = Clean(symbol); + if (Room(id) is not { } room || text.Length > 1 || (text.Length == 1 && !IsSymbol(text[0]))) + { + return false; + } + + string? next = text.Length == 0 ? null : text; + if (room.Symbol == next) + { + return false; + } + + room.Symbol = next; + return true; + } + + /// Whether a character may be a room's symbol: printable, one cell, not markup's brackets. + public static bool IsSymbol(char c) => + !char.IsControl(c) && !char.IsSurrogate(c) && !char.IsWhiteSpace(c) && c is not ('[' or ']') && c < 0x2E80; + + /// An exit's key: a direction's canonical name, else the command as typed, trimmed and bounded. + public static string ExitKey(string? exit) => MapDirections.Normalise(Clean(exit)) ?? Clean(exit); + + /// Text from a player: control characters out, trimmed, bounded to . + private static string Clean(string? text) + { + if (string.IsNullOrWhiteSpace(text)) + { + return string.Empty; + } + + var kept = new string(text.Where(c => !char.IsControl(c)).ToArray()).Trim(); + return kept.Length <= MaxEditLength ? kept : kept[..MaxEditLength]; + } + /// Whether a room other than already sits at this point of this area. public bool IsOccupied(int? areaId, int x, int y, int z, long except) => Rooms.Values.Any(r => r.Id != except && r.AreaId == areaId && r.X == x && r.Y == y && r.Z == z); diff --git a/src/SharpMUTerm.Core/Mapping/MapRecorder.cs b/src/SharpMUTerm.Core/Mapping/MapRecorder.cs index 7ffcc766..fbdf3352 100644 --- a/src/SharpMUTerm.Core/Mapping/MapRecorder.cs +++ b/src/SharpMUTerm.Core/Mapping/MapRecorder.cs @@ -124,6 +124,158 @@ public void Edit(Action change) Changed?.Invoke(this, EventArgs.Empty); } + /// The most edits can take back. + public const int UndoDepth = 10; + + /// What an undo puts back: the rooms an edit touched as they were (null where it made one), the areas, and the pending link. + private sealed record UndoEntry(string Label, IReadOnlyDictionary Rooms, IReadOnlyDictionary Areas, (long From, string Exit)? Pending); + + private readonly LinkedList _undo = new(); + + /// + /// An exit waiting for the next room the character walks into: From's Exit will lead there. Set by + /// ; read by a view to say so. + /// + public (long From, string Exit)? PendingLink { get; private set; } + + /// What would take back, or null when nothing would. + public string? UndoLabel + { + get + { + lock (SyncRoot) + { + return _undo.First?.Value.Label; + } + } + } + + /// How many edits can take back. + public int UndoCount + { + get + { + lock (SyncRoot) + { + return _undo.Count; + } + } + } + + /// + /// A change made by hand that can be undone: the rooms names are copied first, the + /// change is applied under the lock, and when it answers true it is kept for (the last + /// ), the map is marked dirty and redrawn. When it answers false nothing is kept or raised. + /// + public bool Edit(string label, IEnumerable touched, Func change) + { + ArgumentNullException.ThrowIfNull(change); + bool changed; + lock (SyncRoot) + { + var entry = Snapshot(label, touched); + changed = change(Map); + if (changed) + { + Push(entry); + IsDirty = true; + } + } + + if (changed) + { + Changed?.Invoke(this, EventArgs.Empty); + } + + return changed; + } + + /// + /// Arms of room to lead to the next room the character walks into + /// (Mudlet's "the room I go to next"). Undoable like any edit; a second arming replaces the first. + /// + public bool LinkNext(long from, string exit) + { + var key = WorldMap.ExitKey(exit); + if (key.Length == 0) + { + return false; + } + + lock (SyncRoot) + { + if (Map.Room(from) is null || PendingLink == (from, key)) + { + return false; + } + + Push(Snapshot($"wait to link {key}", [])); + PendingLink = (from, key); + } + + Changed?.Invoke(this, EventArgs.Empty); + return true; + } + + /// Takes back the last edit. Returns what it took back, or null when there was nothing to. + public string? Undo() + { + string label; + lock (SyncRoot) + { + if (_undo.First?.Value is not { } entry) + { + return null; + } + + _undo.RemoveFirst(); + foreach (var (id, room) in entry.Rooms) + { + if (room is null) + { + Map.Rooms.Remove(id); + } + else + { + Map.Rooms[id] = room.Clone(); + } + } + + // Areas the edit made go again unless a room has come to use one since; the ones it had are put back. + foreach (var id in Map.Areas.Keys.Where(id => !entry.Areas.ContainsKey(id) && Map.Rooms.Values.All(r => r.AreaId != id)).ToList()) + { + Map.Areas.Remove(id); + } + + foreach (var (id, area) in entry.Areas) + { + Map.Areas[id] = new MapArea { Id = area.Id, Name = area.Name }; + } + + PendingLink = entry.Pending; + IsDirty = true; + label = entry.Label; + } + + Changed?.Invoke(this, EventArgs.Empty); + return label; + } + + private UndoEntry Snapshot(string label, IEnumerable touched) => new( + label, + touched.Distinct().ToDictionary(id => id, id => Map.Room(id)?.Clone()), + Map.Areas.ToDictionary(a => a.Key, a => new MapArea { Id = a.Value.Id, Name = a.Value.Name }), + PendingLink); + + private void Push(UndoEntry entry) + { + _undo.AddFirst(entry); + while (_undo.Count > UndoDepth) + { + _undo.RemoveLast(); + } + } + /// Applies one observation. Public so a test, or a script, can drive the recorder directly. public void Apply(RoomObservation observation) { @@ -194,6 +346,14 @@ private void ApplyCore(RoomObservation observation) Link(previous, walked, room); } + // An exit the player asked to lead to "the next room I go to": this is it, unless it is the room it leaves. + if (PendingLink is { } pending && pending.From != room.Id && Map.Room(pending.From) is not null) + { + Push(Snapshot($"link {pending.Exit}", [pending.From])); + Map.SetExit(pending.From, pending.Exit, room.Id); + PendingLink = null; + } + CurrentRoomId = room.Id; Touch(); } diff --git a/src/SharpMUTerm.Tui/MapRenderer.cs b/src/SharpMUTerm.Tui/MapRenderer.cs index f3c6c25c..c182fd2f 100644 --- a/src/SharpMUTerm.Tui/MapRenderer.cs +++ b/src/SharpMUTerm.Tui/MapRenderer.cs @@ -47,7 +47,16 @@ internal static class MapRenderer /// The inks a map is drawn in. Hexes, already held to the legibility floor by the caller; /// is the pane plane the area colours are held to, or null to draw them as the view gives them. /// - internal readonly record struct Ink(string Title, string Current, string Path, string Locked, Rgb? Plane = null); + internal readonly record struct Ink(string Title, string Current, string Path, string Locked, Rgb? Plane = null, string? Selected = null); + + /// The narrowest map that lists names beside its grid: the current room's exits, or the room being edited. + internal const int SideFromWidth = 64; + + /// The side column's width in a map wide, or 0 for none. + internal static int SideWidth(int width) => width >= SideFromWidth ? Math.Clamp(width / 3, 22, 36) : 0; + + /// The shortest map that lists names under its grid when it has no side column. + internal const int UnderFromHeight = 18; private enum Kind { @@ -58,6 +67,7 @@ private enum Kind Current, Path, Locked, + Selected, } private readonly record struct Cell(char Glyph, Kind Kind, long? Room, string? Colour = null); @@ -91,7 +101,14 @@ internal static List Render( /// areas or colour them differently. Only the exits' geometry (directions, stubs, ways off the level), which the /// view does not carry, is read from . An empty map says so. /// - internal static List Render(MapViewModel view, WorldMap map, int width, int height, Ink ink) + internal static List Render(MapViewModel view, WorldMap map, int width, int height, Ink ink) => + Render(view, map, width, height, ink, keysHeld: true); + + /// + /// The map as draws it, saying in edit mode whether the + /// map holds the keyboard () or has handed a /map command to the command line. + /// + internal static List Render(MapViewModel view, WorldMap map, int width, int height, Ink ink, bool keysHeld) { width = Math.Max(1, width); height = Math.Max(1, height); @@ -107,7 +124,9 @@ internal static List Render(MapViewModel view, WorldMap map, int width, var current = view.Current?.Id; var ahead = view.Rooms.Where(r => r.Ahead).Select(r => r.Id); - var title = new StringBuilder("Map"); + // The room you are in leads the title: the one name a reader wants from a map at a glance, and the one a grid + // of [ ] cannot say. With no current room the map is a map of somewhere else, and says so. + var title = new StringBuilder(view.Current is { } here ? here.Name : "Map"); if (!string.IsNullOrWhiteSpace(view.Area)) { title.Append(" · ").Append(view.Area); @@ -125,16 +144,28 @@ internal static List Render(MapViewModel view, WorldMap map, int width, return lines; } - var legend = height >= LegendMinHeight; - var rows = height - 1 - (legend ? 1 : 0); - var grid = new Cell[rows, width]; + // Names go beside the grid when the map is wide, else under it: in edit mode the room and the keys that edit it, + // otherwise (in a tall pane) what each exit of your room leads to. Edit mode spends the legend's row on them. + var side = SideWidth(width); + var gridWidth = side > 0 ? width - side - 2 : width; + var legend = !view.Editing && height >= LegendMinHeight; + var under = side > 0 ? [] : UnderLines(view, width, height, ink, keysHeld); + var rows = Math.Max(0, height - 1 - (legend ? 1 : 0) - under.Count); + var grid = new Cell[rows, gridWidth]; var ahead_ = ahead.ToHashSet(); var byId = view.Rooms.ToDictionary(r => r.Id); var roomInk = AreaInk(view.AreaColour, ink); - // Rooms are placed so the centre room's middle cell lands in the middle of the box. - var originCol = width / 2 - 1; + // Rooms are placed so the centre room's middle cell lands in the middle of the box — unless the room being + // edited would then fall outside it, when that room is the centre instead. + var originCol = gridWidth / 2 - 1; var originRow = rows / 2; + if (view.Selected is { } picked && map.Room(picked.Id) is { } chosen + && (Math.Abs(chosen.X - centre.X) * CellWidth > originCol - 1 || Math.Abs(chosen.Y - centre.Y) * CellHeight > originRow)) + { + centre = chosen; + } + (int Col, int Row) At(MapRoom room) => (originCol + (room.X - centre.X) * CellWidth, originRow + (room.Y - centre.Y) * CellHeight); @@ -144,7 +175,7 @@ internal static List Render(MapViewModel view, WorldMap map, int width, void Put(int col, int row, char glyph, Kind kind, long? room = null, string? colour = null) { - if (row < 0 || row >= rows || col < 0 || col >= width) + if (row < 0 || row >= rows || col < 0 || col >= gridWidth) { return; } @@ -188,7 +219,8 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null, string? col foreach (var room in level) { var (col, row) = At(room); - var kind = room.Id == current ? Kind.Current + var kind = room.Id == view.Selected?.Id ? Kind.Selected + : room.Id == current ? Kind.Current : room.Locked ? Kind.Locked : ahead_.Contains(room.Id) ? Kind.Path : Kind.Room; @@ -198,14 +230,17 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null, string? col Put(col + 2, row, ']', kind, room.Id, colour); } + var column = side > 0 ? SideLines(view, side, rows + (legend ? 1 : 0), ink, keysHeld) : []; for (var row = 0; row < rows; row++) { - lines.Add(Row(grid, row, width, ink)); + lines.Add(WithSide(Row(grid, row, gridWidth, ink), column, row, gridWidth)); } + lines.AddRange(under); + if (legend) { - lines.Add(Legend(view, width, ink)); + lines.Add(WithSide(Legend(view, gridWidth, ink), column, rows, gridWidth)); } return lines; @@ -341,9 +376,9 @@ private static char Middle(MapRoom room, MapViewRoom? seen, long? current) return '@'; } - if (!string.IsNullOrEmpty(room.Symbol) && !char.IsControl(room.Symbol[0]) && !char.IsSurrogate(room.Symbol[0])) + if (seen?.Symbol is { Length: > 0 } symbol) { - return room.Symbol[0]; + return symbol[0]; } // The stairs are the view's, so the window's marks and these arrows are one answer. @@ -352,6 +387,205 @@ private static char Middle(MapRoom room, MapViewRoom? seen, long? current) return up && down ? '↕' : up ? '↑' : down ? '↓' : ' '; } + /// A grid row with the side column's line for it, the column starting two cells past the grid. + private static string WithSide(string row, IReadOnlyList column, int index, int gridWidth) + { + if (index >= column.Count || column[index].Length == 0) + { + return row; + } + + var pad = Math.Max(0, gridWidth + 2 - MarkupText.VisibleLength(row)); + return row + new string(' ', pad) + column[index]; + } + + /// + /// The side column, beside a wide grid: the room being edited and the keys that edit it, or else where you are and + /// what each exit leads to. Every line is cut to and there are at most . + /// + private static List SideLines(MapViewModel view, int width, int rows, Ink ink, bool keysHeld) + { + var lines = new List(); + if (view.Selected is { } room) + { + lines.AddRange(DetailLines(view, width, ink)); + foreach (var exit in room.Exits.Take(Math.Max(0, rows - lines.Count - MapEditing.Keys.Count - 1))) + { + lines.Add(ExitLine(exit, width)); + } + + lines.Add(string.Empty); + if (!keysHeld) + { + lines.AddRange(KeysLines(width, ink, keysHeld, 3)); + } + else + { + foreach (var (key, word) in MapEditing.Keys.Take(Math.Max(0, rows - lines.Count))) + { + lines.Add(Fit($"[bold {ink.Current}]{MarkupText.Escape(key.PadRight(6))}[/][dim]{word}[/]", width)); + } + } + } + else if (view.Current is { } here) + { + lines.Add(Fit($"[bold {ink.Current}]@[/] [bold]{MarkupText.Escape(Elide(here.Name, width - 2))}[/]", width)); + foreach (var exit in view.Nearby.Take(Math.Max(0, rows - 1))) + { + lines.Add(ExitLine(exit, width)); + } + } + + return lines.Take(rows).ToList(); + } + + /// + /// What goes under a grid with no side column. In edit mode, the room being edited and the keys — a few lines each + /// in a tall pane, one each in a short one. Otherwise, in a tall pane, what each exit of your room leads to. + /// + private static List UnderLines(MapViewModel view, int width, int height, Ink ink, bool keysHeld) + { + if (view.Editing) + { + return height >= UnderFromHeight + ? [string.Empty, .. DetailLines(view, width, ink), .. KeysLines(width, ink, keysHeld, 5)] + : height >= 4 ? [RoomLine(view, width, ink), .. KeysLines(width, ink, keysHeld, 1)] : []; + } + + if (height < UnderFromHeight || view.Nearby.Count == 0) + { + return []; + } + + return [string.Empty, .. view.Nearby.Take(Math.Max(1, height / 4)).Select(e => ExitLine(e, width))]; + } + + /// The room being edited, a fact a line: its number and name, area, place and weight, then its note and a waiting link. + private static List DetailLines(MapViewModel view, int width, Ink ink) + { + var room = view.Selected!; + string Name(string text, int room) => MarkupText.Escape(Elide(text, room)); + var lines = new List + { + Fit($"[bold {ink.Title}]{Name($"#{room.Id.ToString(CultureInfo.InvariantCulture)} {room.Name}", width)}[/]", width), + Fit($"[dim]area [/]{Name(room.Area ?? "—", width - 6)}", width), + Fit( + $"[dim]at [/]{room.X.ToString(CultureInfo.InvariantCulture)}, {room.Y.ToString(CultureInfo.InvariantCulture)} [dim]level[/] {room.Z.ToString(CultureInfo.InvariantCulture)}", + width), + Fit( + $"[dim]weight[/] {room.Weight.ToString(CultureInfo.InvariantCulture)}" + + (room.Locked ? $" [{ink.Locked}]locked[/]" : string.Empty) + + (room.Symbol is { } symbol ? $" [dim]mark[/] {MarkupText.Escape(symbol)}" : string.Empty), + width), + }; + if (room.Note is { } note) + { + lines.Add(Fit($"[dim]note [/]{Name(note, width - 6)}", width)); + } + + if (view.Pending is { } pending) + { + lines.Add(Fit($"[{ink.Path}]{Name(pending, width)}[/]", width)); + } + + return lines; + } + + private static string ExitLine(MapViewExitName exit, int width) + { + var where = exit.To is null + ? "[dim]not walked[/]" + : MarkupText.Escape(Elide(exit.Name ?? "#" + exit.To.Value.ToString(CultureInfo.InvariantCulture), width - 6)); + return Fit($"[dim]{MarkupText.Escape(Elide(exit.Exit, 5).PadRight(5))}[/] {where}", width); + } + + /// Edit mode's room line, under a short grid with no side column: the room being edited, in a line. + private static string RoomLine(MapViewModel view, int width, Ink ink) + { + var room = view.Selected!; + var parts = new List { $"#{room.Id.ToString(CultureInfo.InvariantCulture)} {room.Name}" }; + if (room.Area is { } area) + { + parts.Add(area); + } + + parts.Add($"{room.X.ToString(CultureInfo.InvariantCulture)},{room.Y.ToString(CultureInfo.InvariantCulture)},{room.Z.ToString(CultureInfo.InvariantCulture)}"); + if (room.Weight != 1) + { + parts.Add("weight " + room.Weight.ToString(CultureInfo.InvariantCulture)); + } + + if (room.Locked) + { + parts.Add("locked"); + } + + if (room.Symbol is { } symbol) + { + parts.Add("mark " + symbol); + } + + if (room.Note is { } note) + { + parts.Add("note: " + note); + } + + if (view.Pending is { } pending) + { + parts.Add(pending); + } + + return $"[bold {ink.Title}]{MarkupText.Escape(Elide(string.Join(" · ", parts), width))}[/]"; + } + + /// + /// Edit mode's keys over at most lines, in ' order, with + /// Esc done always the last; while a /map command waits on the command line, how to finish it instead. + /// + internal static List KeysLines(int width, Ink ink, bool keysHeld, int max) + { + if (!keysHeld) + { + return [Fit("[dim]finish the /map command on the command line · ⏎ applies it · ⌃P ▸ Edit map takes the keys back[/]", width)]; + } + + string Item((string Key, string Word) k) => $"[bold {ink.Current}]{MarkupText.Escape(k.Key)}[/] [dim]{k.Word}[/]"; + static int Cost((string Key, string Word) k) => k.Key.Length + 1 + k.Word.Length; + var last = MapEditing.Keys[^1]; + var lines = new List> { new() }; + var used = 0; + foreach (var key in MapEditing.Keys.Take(MapEditing.Keys.Count - 1)) + { + var cost = (lines[^1].Count == 0 ? 0 : 3) + Cost(key); + var reserve = lines.Count == max ? 3 + Cost(last) : 0; + if (used + cost + reserve > width) + { + if (lines.Count == max) + { + break; + } + + lines.Add(new()); + used = 0; + cost = Cost(key); + } + + lines[^1].Add(key); + used += cost; + } + + if (used + 3 + Cost(last) > width && lines.Count < max) + { + lines.Add(new()); + } + + lines[^1].Add(last); + return lines.Select(l => Fit(string.Join(" [dim]·[/] ", l.Select(Item)), width)).ToList(); + } + + private static string Elide(string text, int width) => + width <= 0 ? string.Empty : text.Length <= width ? text : text[..Math.Max(0, width - 1)] + "…"; + private static string Title(string text, int width, Ink ink) { var plain = text.Length > width ? text[..Math.Max(0, width - 1)] + "…" : text; @@ -396,6 +630,7 @@ private static string Row(Cell[,] grid, int row, int width, Ink ink) Kind.Current => $"[bold {ink.Current}]{escaped}[/]", Kind.Path => $"[{ink.Path}]{escaped}[/]", Kind.Locked => $"[{ink.Locked}]{escaped}[/]", + Kind.Selected => $"[{ink.Selected ?? "bold " + ink.Current}]{escaped}[/]", _ => escaped, }; diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 890121c2..e2a4f237 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -219,6 +219,15 @@ void Notice(NoticeOverlay notice) /// host that can float a panel (); null elsewhere, and for a panel that cannot /// float. Safe to call from any thread; one instance per window. /// +/// +/// For the map, selects a room for editing (SelectMapRoom), or with null ends editing: what a click on a cell room +/// does while the cell map is in edit mode. Safe to call from any thread; one instance per window. +/// +/// +/// For the map, makes one edit (ApplyMapEdit), the funnel the cell map's keys and /map commands end in. The +/// client checks it; the window only builds a from its inspector. Safe to +/// call from any thread; one instance per window. +/// internal sealed record PanelOverlay( string PanelId, string WindowId, @@ -233,7 +242,9 @@ internal sealed record PanelOverlay( Action? Dispatch = null, SharpMUTerm.Client.Composer.ComposerModel? Composer = null, SharpMUTerm.Client.Composer.ComposerSession? ComposerSession = null, - Action? PopOut = null); + Action? PopOut = null, + Action? SelectRoom = null, + Action? EditMap = null); /// A panel's colours as #rrggbb: a bar or fill, the warning, and the empty part of a bar. internal sealed record PanelInk(string Bar, string Low, string Track); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs index f51c7a82..2107f9ba 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -243,7 +243,7 @@ private void PublishPanels() : _mapWalkers[windowId] = room => OnUiThread(() => WalkFromMap(windowId, room)); return new PanelOverlay( PanelIds.Map, windowId, rect, new PanelInk(_ink.Accent, _ink.Draft, _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))), null, view, walker, - PopOut: popOut); + PopOut: popOut, SelectRoom: MapSelectorFor(windowId), EditMap: MapEditorFor(windowId)); } if (!TerminalPanels.TryParseWindowId(windowId, out var panelId, out var key)) @@ -324,8 +324,7 @@ private void PickFromPanel(string windowId, string sessionKey, int index) return cached.Model; } - var walking = map.Walk.IsWalking ? $"walking, {map.Walk.Remaining} to go" : null; - var model = MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking, MapPalette()); + var model = BuildMapView(windowId, map); _mapViews[windowId] = (revision, model); return model; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs new file mode 100644 index 00000000..65409e8d --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs @@ -0,0 +1,371 @@ +using System.Globalization; +using System.Text; +using SharpConsoleUI; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Mapping; + +namespace SharpMUTerm.Tui; + +/// +/// Editing a map, in both hosts, from one model and one funnel. A map is in edit mode while a room of it is +/// selected (, per map window): ⌃P ▸ Edit map selects the room you are in, a +/// click on a cell room selects it while editing, and the window selects a room on a right click (its menu) or a click +/// while editing (its inspector). Every edit — a cell key, a /map command, a native menu entry or inspector field — +/// is a that ends in , which runs on the +/// UI thread: under , marked dirty (so it is saved with the recorded rooms), and kept +/// for undo. +/// +/// The keys are the map's while it holds them (), the way ⌥C puts them on the sidebar: client +/// state the main window's key chain reads first, focus never moving. An edit that needs words puts its /map +/// command on the command line, filled with what the room holds now, and hands the keys over until it is sent; any other +/// key the map does not answer ends editing and goes on to the command line. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The room being edited, by map window. A window in this is in edit mode. + private readonly Dictionary _mapSelection = new(StringComparer.Ordinal); + + /// The map window that holds the keyboard, or null. + private string? _mapKeys; + + /// The overlay callbacks, one instance per window so an overlay compares equal frame to frame. + private readonly Dictionary> _mapSelectors = new(StringComparer.Ordinal); + + private readonly Dictionary> _mapEditors = new(StringComparer.Ordinal); + + /// What the command line held when a map key put a /map command on it, put back once that command runs. + private string? _mapLentDraft; + + /// Whether a map holds the keys. Internal for tests. + internal bool MapKeysActive => _mapKeys is not null; + + /// The room selected on a map window, or null. Internal for tests. + internal long? MapSelection(string windowId) => _mapSelection.TryGetValue(windowId, out var room) ? room : null; + + /// + /// One map window's model: the recorder's map around the current room, the walk, and the edit state. The cell map and + /// the window's native map are both drawn from what this builds. + /// + private MapViewModel BuildMapView(string windowId, SessionMap map) + { + var walking = map.Walk.IsWalking ? $"walking, {map.Walk.Remaining} to go" : null; + long? selected = _mapSelection.TryGetValue(windowId, out var room) && map.Map.Room(room) is not null ? room : null; + return MapViewModel.From( + map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking, MapPalette(), selected, map.Recorder.PendingLink, map.Recorder.UndoLabel); + } + + /// + /// ⌃P ▸ Edit map: the focused character's map goes into edit mode on the room you are in (opening the map if no + /// pane shows it) and takes the keys. Again while editing: takes the keys back if a /map command had them, else + /// ends editing. + /// + private void ToggleMapEdit() + { + var key = SendTarget()?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey; + if (MapOf(key) is not { } map) + { + RefuseCommand("no map here — pick a character first (⌃P ▸ Switch to …)"); + return; + } + + var windowId = MapWindowId(key!); + if (_mapSelection.ContainsKey(windowId)) + { + if (_mapKeys != windowId) + { + _mapKeys = windowId; + RenderMap(windowId); + return; + } + + LeaveMapEdit(windowId); + return; + } + + var start = map.Recorder.CurrentRoomId ?? MapViewModel.From(map.Map, null, [], null).AnchorId; + if (start is null) + { + RefuseCommand("nothing is mapped yet — walk somewhere first"); + return; + } + + if (_workspace.Layout.FindWindow(windowId) is null || IsFloating(windowId)) + { + ShowMap(); + } + + SelectMapRoom(windowId, start); + } + + /// + /// Selects a room on a map window (null ends editing): the one way selection changes, from the cell keys, a cell click + /// while editing and the window's map. Selecting takes the keys. + /// + /// Whose map a map window draws: its recorded owner, else the session key its id names (a map not yet opened). + private string? MapOwner(string windowId) => + _workspace.FindWindow(windowId)?.SessionKey + ?? (windowId.StartsWith(MapWindowPrefix, StringComparison.Ordinal) ? windowId[MapWindowPrefix.Length..] : null); + + internal void SelectMapRoom(string windowId, long? room) + { + if (room is not { } id) + { + LeaveMapEdit(windowId); + return; + } + + if (MapOf(MapOwner(windowId)) is not { } map || map.Map.Room(id) is null) + { + return; + } + + var entering = !_mapSelection.ContainsKey(windowId); + _mapSelection[windowId] = id; + _mapKeys = windowId; + RenderMap(windowId); + if (entering) + { + Notice("map: ←↑→↓ select · r rename · l lock · Del delete · u undo · Esc done", MessageSeverity.Info, "⌃P", source: NoticeModel.Sources.Map); + } + } + + /// Ends editing on a map window: no room selected, and the keys back on the command line. + private void LeaveMapEdit(string windowId) + { + var was = _mapSelection.Remove(windowId); + if (_mapKeys == windowId) + { + _mapKeys = null; + was = true; + } + + if (was) + { + RenderMap(windowId); + } + } + + /// + /// Every map edit ends here, from either host: applied to the window's own character's map on the UI thread + /// (), said in a notice, and redrawn by the recorder's Changed. A selected room an + /// edit took away (a delete, an undo of an added room) moves the selection to the room you are in. Returns what + /// refused it, or null. + /// + internal string? ApplyMapEdit(string windowId, MapEdit edit) + { + if (MapOf(MapOwner(windowId)) is not { } map) + { + Notice("no map here: this window has no connection.", source: NoticeModel.Sources.Map); + return "no map"; + } + + var result = MapEditing.Apply(map.Recorder, edit); + if (_mapSelection.TryGetValue(windowId, out var selected) && map.Map.Room(selected) is null) + { + var next = map.Recorder.CurrentRoomId ?? MapViewModel.From(map.Map, null, [], null).AnchorId; + if (next is { } room) + { + _mapSelection[windowId] = room; + } + else + { + _mapSelection.Remove(windowId); + } + } + + if (_mapSelection.ContainsKey(windowId) && _mapKeys is null) + { + _mapKeys = windowId; // an edit finished from the command line gives the keys back to the map it edits + } + + RenderMap(windowId); + Notice(result.Message + ".", result.Done ? MessageSeverity.Info : MessageSeverity.Warning, source: NoticeModel.Sources.Map); + return result.Done ? null : result.Message; + } + + /// /map with an editing verb: parsed into an edit for the window's own character's map. + private void MapEditCommand(string windowId, SessionMap map, string sessionKey, string argument) + { + var (edit, problem) = MapEditing.Parse(argument, name => (name is null ? map.Recorder.CurrentRoom : map.Find(name))?.Id); + if (edit is null) + { + AppendWindowLine(windowId, $"[dim]*** {MarkupText.Escape(problem ?? "no such edit")}.[/]"); + return; + } + + ApplyMapEdit(MapWindowId(sessionKey), edit); + if (_mapLentDraft is { } draft) + { + _mapLentDraft = null; + ActiveBar().SetAndNotify(draft); // the line being typed when a map key borrowed the command line comes back + } + } + + /// + /// A key while a map holds the keyboard. Returns true for the keys it answers (); any other + /// ends editing and returns false, so the key goes on down the chain to the command line. + /// + private bool TryMapKey(KeyPressedEventArgs e) + { + if (_mapKeys is not { } windowId) + { + return false; + } + + if (!_mapSelection.TryGetValue(windowId, out var room) || MapOf(MapOwner(windowId)) is not { } map) + { + _mapKeys = null; + return false; + } + + var key = e.KeyInfo; + var bare = key.Modifiers == 0; + var shift = key.Modifiers == ConsoleModifiers.Shift; + (int Dx, int Dy)? arrow = key.Key switch + { + ConsoleKey.LeftArrow => (-1, 0), + ConsoleKey.RightArrow => (1, 0), + ConsoleKey.UpArrow => (0, -1), + ConsoleKey.DownArrow => (0, 1), + _ => null, + }; + + if (arrow is { } step && bare) + { + if (MapEditing.Neighbour(BuildMapView(windowId, map), room, step.Dx, step.Dy) is { } next) + { + SelectMapRoom(windowId, next); + } + } + else if (arrow is { } nudge && shift) + { + ApplyMapEdit(windowId, MapEdit.Move(room, nudge.Dx, nudge.Dy)); + } + else if (key.Key == ConsoleKey.Delete && bare) + { + ApplyMapEdit(windowId, MapEdit.Delete(room)); + } + else if (key.Key == ConsoleKey.Escape) + { + LeaveMapEdit(windowId); + } + else if (key.Key == ConsoleKey.Enter && bare) + { + if (map.Recorder.CurrentRoomId != room) + { + WalkFromMap(windowId, room); + } + } + else if (key.Modifiers is (ConsoleModifiers)0 or ConsoleModifiers.Shift && key.KeyChar switch + { + 'l' => Edit(MapEdit.Lock(room, map.Map.Room(room)?.Locked != true)), + 'u' => Edit(MapEdit.Undo), + 'r' => Words(MapEditing.RenameVerb), + 'a' => Words(MapEditing.AreaVerb), + 'w' => Words(MapEditing.WeightVerb), + 'x' => Words(MapEditing.ExitVerb), + '-' => Words(MapEditing.UnexitVerb), + 'n' => Words(MapEditing.NoteVerb), + 's' => Words(MapEditing.SymbolVerb), + _ => false, + }) + { + // answered in the switch + } + else + { + LeaveMapEdit(windowId); + return false; + } + + e.Handled = true; + return true; + + bool Edit(MapEdit edit) + { + ApplyMapEdit(windowId, edit); + return true; + } + + bool Words(string verb) + { + if (BuildMapView(windowId, map).Selected is not { } details || MapEditing.CommandFor(verb, details) is not { } command) + { + return false; + } + + // The command goes on the command line and the keys with it; ⏎ there applies it and gives them back. + _mapKeys = null; + if (ArmedComposer() is not null) + { + ReleaseComposer(); + } + + _mapLentDraft = ActiveBar().Text.Length > 0 ? ActiveBar().Text : null; + PlaceGrab(ActiveBar(), command, MapOwner(windowId)); + RenderMap(windowId); + Notice("finish the /map command on the command line — ⏎ applies it.", MessageSeverity.Info, source: NoticeModel.Sources.Map); + return true; + } + } + + /// Drives a key into the map's key handling as the main window would. Internal for tests. + internal bool SimulateMapKey(ConsoleKeyInfo key) => TryMapKey(new KeyPressedEventArgs(key, false)); + + /// The window's selector callback for a map window: a room selected (null closes the inspector), on the client's thread. + private Action MapSelectorFor(string windowId) => + _mapSelectors.TryGetValue(windowId, out var known) + ? known + : _mapSelectors[windowId] = room => OnUiThread(() => SelectMapRoom(windowId, room)); + + /// The window's edit callback for a map window: every native edit through . + private Action MapEditorFor(string windowId) => + _mapEditors.TryGetValue(windowId, out var known) + ? known + : _mapEditors[windowId] = edit => OnUiThread(() => ApplyMapEdit(windowId, edit)); + + /// + /// Every map this client holds, as text: each room with its name, area, place, weight, lock, symbol, note and exits, + /// the pending link, how many edits can be undone, and what each map window has selected. Two clients that made the + /// same edits read the same. Internal for tests. + /// + internal string MapDigest() + { + var text = new StringBuilder(); + var maps = _recorders.Values.ToList(); + if (_demoMap is not null) + { + maps.Add(_demoMap); + } + + foreach (var map in maps) + { + lock (map.Recorder.SyncRoot) + { + foreach (var room in map.Map.Rooms.Values.OrderBy(r => r.Id)) + { + var area = room.AreaId is { } a && map.Map.Areas.TryGetValue(a, out var named) ? named.Name : "-"; + text.Append(CultureInfo.InvariantCulture, $"{room.Id}:{room.Name}@{area}({room.X},{room.Y},{room.Z})w{room.Weight}") + .Append(room.Locked ? "L" : string.Empty) + .Append(CultureInfo.InvariantCulture, $"[{room.Symbol}|{room.Note}]{{") + .AppendJoin(',', room.AllExits().Select(e => $"{e.Key}>{e.To}").Order(StringComparer.Ordinal)) + .Append('/') + .AppendJoin(',', room.Stubs.Order(StringComparer.Ordinal)) + .Append("} "); + } + } + + text.Append(CultureInfo.InvariantCulture, $"pending={map.Recorder.PendingLink} undo={map.Recorder.UndoCount} "); + } + + foreach (var (window, room) in _mapSelection.OrderBy(p => p.Key, StringComparer.Ordinal)) + { + text.Append(CultureInfo.InvariantCulture, $"selected {window}={room} "); + } + + return text.Append("keys=").Append(_mapKeys).ToString(); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index aac90e75..ac2e8632 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1962,10 +1962,10 @@ public string RenderSnapshot(string? view = null) // The map window, over the demo's recorded streets: opened through the real ⌃P entry; `map-walking` // starts a walk to the docks through the real `/walk`, so the path ahead is marked; `map-split` puts // the map beside the output, the way it is meant to be read. - if (view?.ToLowerInvariant() is "map" or "map-walking" or "map-split") + if (view?.ToLowerInvariant() is "map" or "map-walking" or "map-split" or "map-edit") { LoadDemoMap(); - var split = string.Equals(view, "map-split", StringComparison.OrdinalIgnoreCase); + var split = view.ToLowerInvariant() is "map-split" or "map-edit"; if (split) { // Split first, so the map opens in front in the right-hand pane, then hand the focus back to @@ -1989,6 +1989,16 @@ public string RenderSnapshot(string? view = null) Activate(MainWindowId); RefreshRail(); } + + // `map-edit`: the real ⌃P ▸ Edit map, → to the market through the map's own keys, a note through `/map note`, + // and l to lock it — so the frame shows the room being edited, its inspector and the keys that edit it. + if (string.Equals(view, "map-edit", StringComparison.OrdinalIgnoreCase)) + { + DispatchCommand("map:edit"); + SimulateMapKey(new ConsoleKeyInfo('\0', ConsoleKey.RightArrow, false, false, false)); + MapCommand(MainWindowId, "map", "note 4210 Spice traders gather here at dawn"); + SimulateMapKey(new ConsoleKeyInfo('l', ConsoleKey.L, false, false, false)); + } } // The Packages screen with two installed (one switched off), the review an install opens with, and @@ -8401,6 +8411,7 @@ private CommandContext CommandState() NewlineChord: Host.Keys.Newline.Glyph, ScriptsOn: _scriptsRoot is not null, Walking: SendTarget() is { } walker && _recorders.TryGetValue(walker, out var map) && map.Walk.IsWalking, + MapUndo: MapOf(SendTarget()?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey)?.Recorder.UndoLabel, Reconnecting: _reconnects.Values.Any(r => r.IsActive), Sound: CanPlaySound ? !_muted : null, Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId()), @@ -8846,6 +8857,20 @@ private bool RunBuiltInCommand(string id) return true; case "term:map": ShowMap(); + return true; + case "map:edit": + ToggleMapEdit(); + return true; + case "map:undo": + if ((SendTarget()?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey) is { } undoKey && MapOf(undoKey) is not null) + { + ApplyMapEdit(MapWindowId(undoKey), SharpMUTerm.Client.Panels.MapEdit.Undo); + } + else + { + RefuseCommand("no map here — pick a character first (⌃P ▸ Switch to …)"); + } + return true; case "layout:layouts": ShowLayouts(); @@ -9191,7 +9216,17 @@ private MarkupControl MapControlFor(string windowId) /// private void OnMapLinkClicked(string windowId, string url) { - if (MapRenderer.ParseLink(url) is { } room) + if (MapRenderer.ParseLink(url) is not { } room) + { + return; + } + + // While the map is being edited a click selects the room; otherwise it walks there, as it always has. + if (_mapSelection.ContainsKey(windowId)) + { + SelectMapRoom(windowId, room); + } + else { WalkFromMap(windowId, room); } @@ -9236,11 +9271,10 @@ private void RenderMap(string windowId) // One model per drawing, and the window's native map is handed this same instance (MapViewFor), so the two // cannot disagree about where the character is, which level is shown or whether a walk is under way. - var walking = map.Walk.IsWalking ? $"walking, {map.Walk.Remaining} to go" : null; - var view = Drawing(Core.Layouts.PanelIds.Map, windowId, SharpMUTerm.Client.Panels.MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking, MapPalette())); + var view = Drawing(Core.Layouts.PanelIds.Map, windowId, BuildMapView(windowId, map)); _mapViews[windowId] = (_mapRevisions[windowId], view); - var ink = new MapRenderer.Ink(_ink.Accent, _ink.Accent, _ink.Notice, _ink.Draft, WorkspacePalette.ReadingPlane(_theme)); - var lines = MapRenderer.Render(view, map.Map, width, height, ink); + var ink = new MapRenderer.Ink(_ink.Accent, _ink.Accent, _ink.Notice, _ink.Draft, WorkspacePalette.ReadingPlane(_theme), "bold " + RailCursorBand()); + var lines = MapRenderer.Render(view, map.Map, width, height, ink, keysHeld: _mapKeys == windowId); _mapMarkup[windowId] = lines; control.SetContent(lines.ToList()); NoteFloatingContent(windowId); @@ -9317,6 +9351,17 @@ private void MapCommand(string windowId, string verb, string argument) problem = map.WalkTo(argument); } } + else if ((WindowSession(windowId)?.SessionKey ?? _workspace.FindWindow(windowId)?.SessionKey) is { } owner + && SharpMUTerm.Client.Panels.MapEditing.CommandVerbs.Contains(argument.Split(' ', 2)[0].ToLowerInvariant())) + { + MapEditCommand(windowId, map, owner, argument); + return; + } + else if (argument.Trim().Equals("edit", StringComparison.OrdinalIgnoreCase)) + { + ToggleMapEdit(); + return; + } else { var parts = argument.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); @@ -12059,6 +12104,13 @@ private bool RouteToInput(ConsoleKeyInfo key) return null; } + // ⌃P ▸ Edit map put the keys on a map: its arrows and edit keys come first, and anything else ends editing + // and carries on down this chain (SharpMUTermApp.MapEdit.cs). + if (TryMapKey(e)) + { + return null; + } + // A docked composer holding the keyboard takes the keys an editor takes; see HandleComposerKey. if (ArmedComposer() is { } composer) { diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 0d3c5a09..570775ab 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -25,7 +25,7 @@ internal static class SnapshotViews "search", "search-regex", "search-all", "search-landed", "activity-bar", "mxp-image", "mxp-figure", "input-selection", "selection", "trigger-builder", "prefix", "prefix-panel", "focus", "focus-moved", "tabs", "tabs-many", - "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", + "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "map-edit", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "join-wraps", "join-wraps-f5", diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 5fb69eba..521d586b 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -410,6 +410,48 @@ await Same("map: walk", "layout-combat", await Same("map: pop out", "layout-combat", (app, d) => Panel(d, PanelIds.Map).PopOut!(), (app, d) => app.DispatchCommand(PanelFloatCommands.PopOut(Panel(d, PanelIds.Map).WindowId))); + + // Map editing: a room selected and edited on the canvas, and the same with the cell map's keys. + await Same("map: select", "layout-combat", + (app, d) => Panel(d, PanelIds.Map).SelectRoom!(OtherRoom(Panel(d, PanelIds.Map).Map!)), + (app, d) => CellSelect(app, d)); + await Same("map: rename", "layout-combat", + (app, d) => NativeEdit(d, room => MapEdit.Rename(room, "Spice Yard")), + (app, d) => + { + CellSelect(app, d); + MapKeys(app, MapKey(ConsoleKey.R, 'r')); + while (app.PrimaryInputText.Count(c => c == ' ') > 3 || !app.PrimaryInputText.EndsWith(' ')) + { + MapKeys(app, MapKey(ConsoleKey.Backspace, '\b')); + } + + TypeLine(app, "Spice Yard"); + }); + await Same("map: lock", "layout-combat", + (app, d) => NativeEdit(d, room => MapEdit.Lock(room, true)), + (app, d) => { CellSelect(app, d); MapKeys(app, MapKey(ConsoleKey.L, 'l')); }); + await Same("map: move", "layout-combat", + (app, d) => NativeEdit(d, room => MapEdit.Move(room, 1, 0)), + (app, d) => { CellSelect(app, d); MapKeys(app, new ConsoleKeyInfo('\0', ConsoleKey.RightArrow, true, false, false)); }); + await Same("map: delete", "layout-combat", + (app, d) => NativeEdit(d, MapEdit.Delete), + (app, d) => { CellSelect(app, d); MapKeys(app, MapKey(ConsoleKey.Delete, '\0')); }); + await Same("map: undo", "layout-combat", + (app, d) => + { + NativeEdit(d, room => MapEdit.Lock(room, true)); + Panel(d, PanelIds.Map).EditMap!(MapEdit.Undo); + }, + (app, d) => { CellSelect(app, d); MapKeys(app, MapKey(ConsoleKey.L, 'l'), MapKey(ConsoleKey.U, 'u')); }); + await Same("map: exit to the next room", "layout-combat", + (app, d) => NativeEdit(d, room => MapEdit.LinkNext(room, "climb")), + (app, d) => + { + CellSelect(app, d); + MapKeys(app, MapKey(ConsoleKey.X, 'x')); + TypeLine(app, "climb next"); + }); probed.Add(PanelIds.Map); // Vitals: the pop-out button, and ⌃P's entry for the same window. @@ -985,6 +1027,7 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "help=" + app.HelpIsOpen + "/" + app.DictionaryOfferOpen, "quick=" + app.LastQuickMacro, "walk=" + app.WalkState, + "map=" + app.MapDigest(), "rail=" + (app.BuildChromeOverlay().Sidebar.Collapsed ? "folded" : "open"), "floating=" + string.Join(",", app.FloatingPublished.Select(f => f.Model.WindowId)), "notice=" + app.LastNotice, @@ -1009,6 +1052,42 @@ private static string OtherWindow(SharpMUTermApp app) private static long OtherRoom(MapViewModel map) => map.Rooms.First(r => !r.Current && r.Id != map.AnchorId).Id; + private static ConsoleKeyInfo MapKey(ConsoleKey key, char c) => new(c, key, false, false, false); + + /// The cell way to select a room: Edit map from the palette, then a click on the room's cell link while editing. + private static void CellSelect(SharpMUTermApp app, AvaloniaConsoleDriver driver) + { + var room = OtherRoom(Panel(driver, PanelIds.Map).Map!); + app.DispatchCommand("map:edit"); + app.SimulateMapClick(Panel(driver, PanelIds.Map).WindowId, MapRenderer.LinkPrefix + room); + } + + /// The native way: the room selected on the canvas, then an edit from its menu or inspector. + private static void NativeEdit(AvaloniaConsoleDriver driver, Func edit) + { + var room = OtherRoom(Panel(driver, PanelIds.Map).Map!); + Panel(driver, PanelIds.Map).SelectRoom!(room); + Panel(driver, PanelIds.Map).EditMap!(edit(room)); + } + + private static void MapKeys(SharpMUTermApp app, params ConsoleKeyInfo[] keys) + { + foreach (var key in keys) + { + app.SimulateKey(key); + } + } + + private static void TypeLine(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + } + // ── F4 and the quick bar, per host ────────────────────────────────────────────────────────── /// diff --git a/tests/SharpMUTerm.Client.Tests/MapEditingTests.cs b/tests/SharpMUTerm.Client.Tests/MapEditingTests.cs new file mode 100644 index 00000000..4427e092 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/MapEditingTests.cs @@ -0,0 +1,126 @@ +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Mapping; + +namespace SharpMUTerm.Client.Tests; + +/// The one action model both hosts' map edits go through, and what the map view says about rooms. +public class MapEditingTests +{ + private static MapRecorder Recorded() + { + var recorder = new MapRecorder(new WorldMap()); + recorder.Apply(new RoomObservation(1, "Hall", [new ObservedExit("north", 2), new ObservedExit("east", 3)]) with { Area = "Keep" }); + recorder.NoteCommand("n"); + recorder.Apply(new RoomObservation(2, "Gallery", [new ObservedExit("south", 1)]) with { Area = "Keep" }); + recorder.NoteCommand("s"); + recorder.Apply(new RoomObservation(1, "Hall", [new ObservedExit("north", 2), new ObservedExit("east", 3)]) with { Area = "Keep" }); + return recorder; + } + + private static long? Resolve(MapRecorder recorder, string? name) => + name is null ? recorder.CurrentRoomId : recorder.Map.Rooms.Values.FirstOrDefault(r => r.Name.Equals(name, StringComparison.OrdinalIgnoreCase))?.Id; + + [Test] + public async Task EveryCommandVerbParsesIntoItsEdit() + { + var recorder = Recorded(); + (MapEdit? Edit, string? Problem) Parse(string text) => MapEditing.Parse(text, n => Resolve(recorder, n)); + + await Assert.That(Parse("rename 2 Long Gallery").Edit).IsEqualTo(MapEdit.Rename(2, "Long Gallery")); + await Assert.That(Parse("area 2").Edit).IsEqualTo(MapEdit.Area(2, string.Empty)); + await Assert.That(Parse("weight 2 5").Edit).IsEqualTo(MapEdit.Weight(2, 5)); + await Assert.That(Parse("exit 2 climb rope 1").Edit).IsEqualTo(MapEdit.AddExit(2, "climb rope", 1)); + await Assert.That(Parse("exit 2 down next").Edit).IsEqualTo(MapEdit.LinkNext(2, "down")); + await Assert.That(Parse("unexit 2 south").Edit).IsEqualTo(MapEdit.RemoveExit(2, "south")); + await Assert.That(Parse("move 2 1 -1").Edit).IsEqualTo(MapEdit.Move(2, 1, -1)); + await Assert.That(Parse("delete 2").Edit).IsEqualTo(MapEdit.Delete(2)); + await Assert.That(Parse("note 2 a draught").Edit).IsEqualTo(MapEdit.Note(2, "a draught")); + await Assert.That(Parse("symbol 2 $").Edit).IsEqualTo(MapEdit.Symbol(2, "$")); + await Assert.That(Parse("lock gallery").Edit).IsEqualTo(MapEdit.Lock(2, true)); + await Assert.That(Parse("unlock").Edit).IsEqualTo(MapEdit.Lock(1, false)); + await Assert.That(Parse("undo").Edit).IsEqualTo(MapEdit.Undo); + await Assert.That(Parse("rename hall Foo").Problem!).Contains("a room is its number"); + await Assert.That(Parse("weight 2 heavy").Edit).IsNull(); + await Assert.That(Parse("paint 2").Problem!).StartsWith("use /map"); + } + + [Test] + public async Task ApplyAnswersInASentenceAndRefusesWhatItCannotDo() + { + var recorder = Recorded(); + + await Assert.That(MapEditing.Apply(recorder, MapEdit.Rename(2, "Long Gallery"))).IsEqualTo(new MapEditResult(true, "renamed Gallery to Long Gallery")); + await Assert.That(MapEditing.Apply(recorder, MapEdit.Rename(2, "Long Gallery")).Done).IsFalse(); + await Assert.That(MapEditing.Apply(recorder, MapEdit.Weight(2, 0)).Done).IsFalse(); + await Assert.That(MapEditing.Apply(recorder, MapEdit.AddExit(2, "up", 99)).Done).IsFalse(); + await Assert.That(MapEditing.Apply(recorder, MapEdit.Symbol(2, "ab")).Done).IsFalse(); + await Assert.That(MapEditing.Apply(recorder, MapEdit.Delete(1)).Message).Contains("walk out of it first"); + await Assert.That(MapEditing.Apply(recorder, MapEdit.Delete(42)).Done).IsFalse(); + + await Assert.That(MapEditing.Apply(recorder, MapEdit.Delete(2)).Done).IsTrue(); + await Assert.That(recorder.Map.Room(1)!.Stubs).Contains("north"); + await Assert.That(MapEditing.Apply(recorder, MapEdit.Undo).Message).IsEqualTo("undid: delete Long Gallery"); + await Assert.That(recorder.Map.Room(2)!.Name).IsEqualTo("Long Gallery"); + await Assert.That(MapEditing.Apply(recorder, MapEdit.Undo).Done).IsTrue(); + await Assert.That(recorder.Map.Room(2)!.Name).IsEqualTo("Gallery"); + await Assert.That(MapEditing.Apply(recorder, MapEdit.Undo)).IsEqualTo(new MapEditResult(false, "nothing to undo")); + } + + [Test] + public async Task TheViewNamesTheExitsOfTheRoomYouAreInAndTheRoomBeingEdited() + { + var recorder = Recorded(); + recorder.Map.SetNote(2, "draughty"); + + var plain = MapViewModel.From(recorder.Map, 1, [], null); + await Assert.That(plain.Editing).IsFalse(); + await Assert.That(plain.Nearby).Contains(new MapViewExitName("n", 2, "Gallery")); + await Assert.That(plain.Nearby.Any(e => e.Exit == "e" && e.Name is null)).IsTrue(); + + var editing = MapViewModel.From(recorder.Map, 1, [], null, selected: 2, pending: (2, "down"), undo: "rename"); + await Assert.That(editing.Editing).IsTrue(); + await Assert.That(editing.Selected!.Note).IsEqualTo("draughty"); + await Assert.That(editing.Rooms.Single(r => r.Id == 2).Selected).IsTrue(); + await Assert.That(editing.Rooms.Single(r => r.Id == 2).Noted).IsTrue(); + await Assert.That(editing.Pending).IsNotNull(); + await Assert.That(editing).IsEqualTo(MapViewModel.From(recorder.Map, 1, [], null, selected: 2, pending: (2, "down"), undo: "rename")); + await Assert.That(editing).IsNotEqualTo(MapViewModel.From(recorder.Map, 1, [], null, selected: 1, pending: (2, "down"), undo: "rename")); + } + + [Test] + public async Task AnArrowSelectsTheNearestRoomThatWay() + { + var map = new WorldMap(); + map.Add(new MapRoom { Id = 1, Name = "A", X = 0, Y = 0 }); + map.Add(new MapRoom { Id = 2, Name = "B", X = 2, Y = 0 }); + map.Add(new MapRoom { Id = 3, Name = "C", X = 1, Y = 1 }); + map.Add(new MapRoom { Id = 4, Name = "D", X = 0, Y = -3 }); + var view = MapViewModel.From(map, 1, [], null); + + await Assert.That(MapEditing.Neighbour(view, 1, 1, 0)).IsEqualTo(2L); + await Assert.That(MapEditing.Neighbour(view, 1, 0, 1)).IsEqualTo(3L); + await Assert.That(MapEditing.Neighbour(view, 1, 0, -1)).IsEqualTo(4L); + await Assert.That(MapEditing.Neighbour(view, 1, -1, 0)).IsNull(); + } + + [Test] + public async Task TheRoomMenuOffersOnlyWhatCanBeDoneToThatRoom() + { + var here = new MapViewRoom(1, "Hall", 0, 0, true, false, false); + var there = here with { Id = 2, Current = false, Locked = true }; + + var mine = MapEditing.Menu(here, null).Entries; + await Assert.That(mine.First().Enabled).IsFalse().Because("you cannot walk to the room you are in"); + await Assert.That(mine.Single(e => e.Label == "Delete room").Enabled).IsFalse(); + await Assert.That(mine.Any(e => e.Label.StartsWith("Undo", StringComparison.Ordinal))).IsFalse(); + + var theirs = MapEditing.Menu(there, "rename Hall").Entries; + await Assert.That(theirs.Any(e => e.Label == "Unlock")).IsTrue(); + await Assert.That(theirs.Last().Command).IsEqualTo(MapEditing.UndoVerb); + foreach (var entry in theirs.Where(e => e.Command is not null)) + { + var needsWords = MapEditing.TextVerbs.Contains(entry.Command!) || entry.Command == MapEditing.WalkVerb; + await Assert.That(needsWords || MapEditing.EditFor(entry.Command!, 2) is not null).IsTrue().Because(entry.Label); + } + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Mapping/MapEditTests.cs b/tests/SharpMUTerm.Core.Tests/Mapping/MapEditTests.cs new file mode 100644 index 00000000..9e19bf42 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Mapping/MapEditTests.cs @@ -0,0 +1,154 @@ +using SharpMUTerm.Core.Mapping; + +namespace SharpMUTerm.Core.Tests.Mapping; + +/// Edits by hand: the map's own operations, the recorder's undo, and an exit waiting for the next room. +public class MapEditTests +{ + private static RoomObservation Room(long? id, string name, params (string Key, long? To)[] exits) => + new(id, name, exits.Select(e => new ObservedExit(e.Key, e.To)).ToList()); + + private static MapRecorder Recorded() + { + var recorder = new MapRecorder(new WorldMap()); + recorder.Apply(Room(1, "Hall", ("north", 2)) with { Area = "Keep" }); + recorder.NoteCommand("n"); + recorder.Apply(Room(2, "Gallery", ("south", 1)) with { Area = "Keep" }); + recorder.MarkSaved(); + return recorder; + } + + [Test] + public async Task EachEditChangesOnlyWhatItSaysAndRefusesNonsense() + { + var map = Recorded().Map; + + await Assert.That(map.Rename(1, " Great Hall ")).IsTrue(); + await Assert.That(map.Room(1)!.Name).IsEqualTo("Great Hall"); + await Assert.That(map.Rename(1, " ")).IsFalse(); + await Assert.That(map.SetArea(1, "Tower")).IsTrue(); + await Assert.That(map.Areas[map.Room(1)!.AreaId!.Value].Name).IsEqualTo("Tower"); + await Assert.That(map.SetArea(1, "")).IsTrue(); + await Assert.That(map.Room(1)!.AreaId).IsNull(); + await Assert.That(map.SetWeight(1, 0)).IsFalse(); + await Assert.That(map.SetWeight(1, 7)).IsTrue(); + await Assert.That(map.SetExit(1, "ne", 2)).IsTrue(); + await Assert.That(map.Room(1)!.Exits["northeast"]).IsEqualTo(2L); + await Assert.That(map.SetExit(1, "climb rope", 2)).IsTrue(); + await Assert.That(map.Room(1)!.SpecialExits["climb rope"]).IsEqualTo(2L); + await Assert.That(map.SetExit(1, "e", 99)).IsFalse().Because("no room 99"); + await Assert.That(map.RemoveExit(1, "northeast")).IsTrue(); + await Assert.That(map.Move(1, 1, 0, 1)).IsTrue(); + await Assert.That((map.Room(1)!.X, map.Room(1)!.Z)).IsEqualTo((1, 1)); + await Assert.That(map.SetSymbol(1, "$")).IsTrue(); + await Assert.That(map.SetSymbol(1, "[")).IsFalse().Because("a bracket would be markup"); + await Assert.That(map.SetNote(1, "a note\u0007")).IsTrue(); + await Assert.That(map.Room(1)!.Note).IsEqualTo("a note"); + } + + [Test] + public async Task DeletingARoomTurnsTheExitsThatLedThereBackIntoStubs() + { + var map = Recorded().Map; + + await Assert.That(map.Remove(2)).IsTrue(); + await Assert.That(map.Room(2)).IsNull(); + await Assert.That(map.Room(1)!.Exits.ContainsKey("north")).IsFalse(); + await Assert.That(map.Room(1)!.Stubs).Contains("north"); + } + + [Test] + public async Task AnEditIsKeptForUndoMarksTheMapDirtyAndUndoPutsEveryTouchedRoomBack() + { + var recorder = Recorded(); + var changes = 0; + recorder.Changed += (_, _) => changes++; + + await Assert.That(recorder.Edit("delete Gallery", [2, 1], m => m.Remove(2))).IsTrue(); + await Assert.That(recorder.IsDirty).IsTrue(); + await Assert.That(recorder.UndoLabel).IsEqualTo("delete Gallery"); + + await Assert.That(recorder.Undo()).IsEqualTo("delete Gallery"); + await Assert.That(recorder.Map.Room(2)!.Name).IsEqualTo("Gallery"); + await Assert.That(recorder.Map.Room(1)!.Exits["north"]).IsEqualTo(2L); + await Assert.That(recorder.Map.Room(1)!.Stubs).DoesNotContain("north"); + await Assert.That(recorder.Undo()).IsNull(); + await Assert.That(changes).IsEqualTo(2); + } + + [Test] + public async Task AnEditThatChangesNothingIsNotKept() + { + var recorder = Recorded(); + + await Assert.That(recorder.Edit("rename", [1], m => m.Rename(1, "Hall"))).IsFalse(); + await Assert.That(recorder.UndoCount).IsEqualTo(0); + await Assert.That(recorder.IsDirty).IsFalse(); + } + + [Test] + public async Task UndoKeepsTheLastFewEdits() + { + var recorder = Recorded(); + for (var i = 0; i < MapRecorder.UndoDepth + 5; i++) + { + recorder.Edit($"weight {i}", [1], m => m.SetWeight(1, i + 2)); + } + + await Assert.That(recorder.UndoCount).IsEqualTo(MapRecorder.UndoDepth); + } + + [Test] + public async Task UndoingANewAreaTakesTheAreaAwayToo() + { + var recorder = Recorded(); + var areas = recorder.Map.Areas.Count; + + recorder.Edit("area", [1], m => m.SetArea(1, "Crypt")); + await Assert.That(recorder.Map.Areas.Count).IsEqualTo(areas + 1); + recorder.Undo(); + + await Assert.That(recorder.Map.Areas.Count).IsEqualTo(areas); + await Assert.That(recorder.Map.Areas[recorder.Map.Room(1)!.AreaId!.Value].Name).IsEqualTo("Keep"); + } + + /// Mudlet's "the room I go to next": the exit is linked to the next room walked into, and that is undoable too. + [Test] + public async Task AnExitWaitsForTheNextRoomWalkedInto() + { + var recorder = Recorded(); + + await Assert.That(recorder.LinkNext(1, "climb")).IsTrue(); + await Assert.That(recorder.PendingLink).IsEqualTo((1L, "climb")); + recorder.Apply(Room(2, "Gallery", ("south", 1))); // the next room reported, which is not the one the exit leaves + await Assert.That(recorder.Map.Room(1)!.SpecialExits["climb"]).IsEqualTo(2L); + await Assert.That(recorder.PendingLink).IsNull(); + + recorder.Undo(); + await Assert.That(recorder.Map.Room(1)!.SpecialExits.ContainsKey("climb")).IsFalse(); + await Assert.That(recorder.PendingLink).IsEqualTo((1L, "climb")); + } + + [Test] + public async Task AWaitingExitIsNotLinkedToItsOwnRoom() + { + var recorder = Recorded(); + recorder.LinkNext(2, "down"); + + recorder.Apply(Room(2, "Gallery", ("south", 1))); + + await Assert.That(recorder.PendingLink).IsEqualTo((2L, "down")); + await Assert.That(recorder.Map.Room(2)!.Exits.ContainsKey("down")).IsFalse(); + } + + [Test] + public async Task ANoteIsSavedWithTheMap() + { + var map = Recorded().Map; + map.SetNote(1, "the fountain hides a key"); + + var read = MapStore.Deserialize(MapStore.Serialize(map, "x:1")); + + await Assert.That(read.Room(1)!.Note).IsEqualTo("the fountain hides a key"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs b/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs new file mode 100644 index 00000000..9dd60173 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs @@ -0,0 +1,186 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// The cell map's edit mode: ⌃P ▸ Edit map, the keys it names, and the /map verbs behind the ones that need words. +[NotInParallel] +public class MapEditModeTests +{ + private const string Ann = "Convergence.Ann"; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static string MapId => SharpMUTermApp.MapWindowId(Ann); + + private static async Task<(SharpMUTermApp App, RecordingTelnetSession Wire)> Open() + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + config.Worlds.Add(new WorldDefinition + { + Name = "Convergence", + Host = "convergence.example", + Port = 4201, + Characters = { new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() } }, + }); + var wire = new RecordingTelnetSession(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(160, 32)); + app.TelnetFactory = _ => wire; + app.DispatchCommand(CommandIds.Character(Ann)); + await app.FindSession(Ann)!.ConnectAsync(); + wire.ReceiveGmcp("Room.Info", """{"num":1,"name":"Hall","area":"Keep","exits":{"n":2}}"""); + wire.ReceiveGmcp("Room.Info", """{"num":2,"name":"Gallery","area":"Keep","exits":{"s":1,"e":3}}"""); + wire.ReceiveGmcp("Room.Info", """{"num":3,"name":"Tower","area":"Keep","exits":{"w":2}}"""); + wire.ReceiveGmcp("Room.Info", """{"num":1,"name":"Hall","area":"Keep","exits":{"n":2}}"""); + return (app, wire); + } + + private static ConsoleKeyInfo Key(ConsoleKey key, char c = '\0', bool shift = false) => new(c, key, shift, false, false); + + private static void Type(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(Key(ConsoleKey.Enter, '\r')); + } + + private static Core.Mapping.WorldMap MapOf(SharpMUTermApp app) => app.SessionMapFor(app.FindSession(Ann)!)!.Map; + + [Test] + public async Task EditMapSelectsTheRoomYouAreInAndTakesTheKeys() + { + var (app, _) = await Open(); + await using var _app = app; + + await Assert.That(app.DispatchCommand("map:edit")).IsTrue(); + + await Assert.That(app.MapSelection(MapId)).IsEqualTo(1L); + await Assert.That(app.MapKeysActive).IsTrue(); + var plain = app.MapMarkup(MapId).Select(MarkupText.Plain).ToList(); + await Assert.That(plain.Any(l => l.Contains("#1 Hall"))).IsTrue(); + await Assert.That(plain.Any(l => System.Text.RegularExpressions.Regex.IsMatch(l, @"Esc\s+done"))).IsTrue().Because(string.Join("\n", plain)); + } + + [Test] + public async Task ArrowsSelectShiftArrowsMoveAndLAndUAnswer() + { + var (app, wire) = await Open(); + await using var _app = app; + app.DispatchCommand("map:edit"); + var before = wire.Lines.Count; + + app.SimulateKey(Key(ConsoleKey.UpArrow)); + await Assert.That(app.MapSelection(MapId)).IsEqualTo(2L); + var x = MapOf(app).Room(2)!.X; + app.SimulateKey(Key(ConsoleKey.LeftArrow, shift: true)); + await Assert.That(MapOf(app).Room(2)!.X).IsEqualTo(x - 1); + app.SimulateKey(Key(ConsoleKey.L, 'l')); + await Assert.That(MapOf(app).Room(2)!.Locked).IsTrue(); + app.SimulateKey(Key(ConsoleKey.U, 'u')); + await Assert.That(MapOf(app).Room(2)!.Locked).IsFalse(); + await Assert.That(app.SessionMapFor(app.FindSession(Ann)!)!.Recorder.IsDirty).IsTrue(); + await Assert.That(wire.Lines.Count).IsEqualTo(before).Because("editing sends nothing to the game"); + } + + [Test] + public async Task AKeyThatNeedsWordsPutsTheCommandOnTheCommandLineAndEnterAppliesIt() + { + var (app, _) = await Open(); + await using var _app = app; + app.DispatchCommand("map:edit"); + app.SimulateKey(Key(ConsoleKey.UpArrow)); + + app.SimulateKey(Key(ConsoleKey.R, 'r')); + await Assert.That(app.MapKeysActive).IsFalse(); + await Assert.That(app.ArmedInputText).IsEqualTo("/map rename 2 Gallery"); + foreach (var _ in "Gallery") + { + app.SimulateKey(Key(ConsoleKey.Backspace, '\b')); + } + + Type(app, "Long Gallery"); + + await Assert.That(MapOf(app).Room(2)!.Name).IsEqualTo("Long Gallery"); + await Assert.That(app.MapKeysActive).IsTrue().Because("the edit hands the keys back to the map"); + } + + [Test] + public async Task EveryKeyTheFooterNamesIsAnswered() + { + var (app, _) = await Open(); + await using var _app = app; + var keys = new Dictionary + { + ["←↑→↓"] = [Key(ConsoleKey.UpArrow)], + ["⇧←↑→↓"] = [Key(ConsoleKey.RightArrow, shift: true)], + ["r"] = [Key(ConsoleKey.R, 'r')], ["a"] = [Key(ConsoleKey.A, 'a')], ["l"] = [Key(ConsoleKey.L, 'l')], + ["w"] = [Key(ConsoleKey.W, 'w')], ["x"] = [Key(ConsoleKey.X, 'x')], ["-"] = [Key(ConsoleKey.OemMinus, '-')], + ["n"] = [Key(ConsoleKey.N, 'n')], ["s"] = [Key(ConsoleKey.S, 's')], ["Del"] = [Key(ConsoleKey.Delete)], + ["u"] = [Key(ConsoleKey.U, 'u')], ["⏎"] = [Key(ConsoleKey.Enter, '\r')], ["Esc"] = [Key(ConsoleKey.Escape, '\u001b')], + }; + + foreach (var (key, _) in MapEditing.Keys) + { + await Assert.That(keys.ContainsKey(key)).IsTrue().Because($"the test knows {key}"); + app.DispatchCommand("map:edit"); + if (!app.MapKeysActive) + { + app.DispatchCommand("map:edit"); + } + + app.SimulateKey(Key(ConsoleKey.UpArrow)); // off the room you are in, so Del and ⏎ have something to do + await Assert.That(app.SimulateMapKey(keys[key][0])).IsTrue().Because($"{key} is on the footer"); + while (app.ArmedInputText.Length > 0) + { + app.SimulateKey(Key(ConsoleKey.Backspace, '\b')); + } + + if (app.MapSelection(MapId) is not null) + { + app.SelectMapRoom(MapId, null); + } + } + } + + [Test] + public async Task AClickSelectsInEditModeAndWalksOutsideIt() + { + var (app, wire) = await Open(); + await using var _app = app; + app.DispatchCommand("term:map"); + app.DispatchCommand("map:edit"); + var before = wire.Lines.Count; + + app.SimulateMapClick(MapId, "mux:map:3"); + await Assert.That(app.MapSelection(MapId)).IsEqualTo(3L); + await Assert.That(wire.Lines.Count).IsEqualTo(before); + + app.SimulateKey(Key(ConsoleKey.Escape, '\u001b')); + await Assert.That(app.MapSelection(MapId)).IsNull(); + app.SimulateMapClick(MapId, "mux:map:3"); + await Assert.That(wire.Lines.Skip(before)).IsEquivalentTo(new[] { "n" }); + } + + [Test] + public async Task DeletingTheRoomYouAreInIsRefusedAndAnyOtherIsUndoable() + { + var (app, _) = await Open(); + await using var _app = app; + + Type(app, "/map delete 1"); + await Assert.That(MapOf(app).Room(1)).IsNotNull(); + Type(app, "/map delete 3"); + await Assert.That(MapOf(app).Room(3)).IsNull(); + await Assert.That(app.BuildCatalog().Select(i => i.Id)).Contains("map:undo"); + await Assert.That(app.DispatchCommand("map:undo")).IsTrue(); + await Assert.That(MapOf(app).Room(3)!.Name).IsEqualTo("Tower"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs b/tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs index 925c87b8..62f946c3 100644 --- a/tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/MapWindowTests.cs @@ -58,7 +58,7 @@ public async Task ShowMapOpensTheConnectionsMapInFront() await Assert.That(app.WindowOwnerOf(MapId)).IsEqualTo(Ann); await Assert.That(app.ActiveWindowId()).IsEqualTo(MapId); var plain = app.MapMarkup(MapId).Select(MarkupText.Plain).ToList(); - await Assert.That(plain[0]).IsEqualTo("Map · Keep · z 0"); + await Assert.That(plain[0]).IsEqualTo("Hall · Keep · z 0"); await Assert.That(plain.Any(l => l.Contains("[@]"))).IsTrue(); await Assert.That(app.MapMarkup(MapId).Count(l => l.Contains("[link=mux:map:"))).IsGreaterThan(0); } From aa9883f3ed873a112df1adcb505b1df604400918 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 13:00:30 +0000 Subject: [PATCH 049/113] Script console, GMCP channel windows, highlighted names and scene logs - Ctrl+P > Script console: per character, output and errors with file:line, a time- and instruction-limited Lua prompt run through the host's gate, history, a read-only store viewer with delete, and Reload. One Client model drawn as cells and as a native modal; surface script-console with parity probes. - F5 > channels (off/copy/move): Comm.Channel.Text into a spawn window per channel through SpawnLine; move gags the main-window echo. - F5 > names: whole-word highlighted names with HighlightColours, at ingest. - Ctrl+P > Start/Stop scene log: the focused window's poses (or every line) to an HTML or plain file under the log root with a who-was-present header; refused with no log root. F7 > Scene log holds the format and content. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 10 + CLAUDE.md | 25 ++ src/SharpMUTerm.Avalonia/ModalOverlay.cs | 1 + src/SharpMUTerm.Avalonia/ScriptConsoleView.cs | 299 +++++++++++++ .../Commands/BuiltInCommands.cs | 14 + .../Modals/ScriptConsoleModel.cs | 263 +++++++++++ .../Settings/BuiltInSettings.cs | 32 ++ src/SharpMUTerm.Client/Settings/TextRules.cs | 5 + .../Settings/WorldFieldValues.cs | 16 + .../Surfaces/SurfaceCatalog.cs | 17 +- .../Automation/NameHighlights.cs | 164 +++++++ .../Commands/CommandCatalog.cs | 4 +- .../Configuration/AppConfiguration.cs | 13 + .../Configuration/WorldDefinition.cs | 14 + src/SharpMUTerm.Core/Logging/SceneLog.cs | 219 +++++++++ .../Protocols/ChannelCapture.cs | 186 ++++++++ src/SharpMUTerm.Core/Session/WorldSession.cs | 64 ++- src/SharpMUTerm.Scripting/ScriptHost.cs | 151 ++++++- src/SharpMUTerm.Scripting/SessionScripts.cs | 15 +- .../WorldSessionScriptBridge.cs | 9 +- .../Pointer/SharpMUTermApp.Surfaces.cs | 1 + src/SharpMUTerm.Tui/ScriptConsoleSurface.cs | 262 +++++++++++ .../SharpMUTermApp.NativeModals.cs | 1 + .../SharpMUTermApp.SceneLog.cs | 265 +++++++++++ .../SharpMUTermApp.ScriptConsole.cs | 423 ++++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 45 +- src/SharpMUTerm.Tui/SnapshotViews.cs | 1 + src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 28 +- .../SurfaceParityTests.cs | 27 ++ .../Session/ChannelsAndNamesTests.cs | 156 +++++++ .../ConsoleTests.cs | 85 ++++ .../SharpMUTerm.Tui.Tests/ScreenModelTests.cs | 5 +- .../ScriptingWaveTests.cs | 314 +++++++++++++ 33 files changed, 3119 insertions(+), 15 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/ScriptConsoleView.cs create mode 100644 src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs create mode 100644 src/SharpMUTerm.Core/Automation/NameHighlights.cs create mode 100644 src/SharpMUTerm.Core/Logging/SceneLog.cs create mode 100644 src/SharpMUTerm.Core/Protocols/ChannelCapture.cs create mode 100644 src/SharpMUTerm.Tui/ScriptConsoleSurface.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.SceneLog.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Session/ChannelsAndNamesTests.cs create mode 100644 tests/SharpMUTerm.Scripting.Tests/ConsoleTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/ScriptingWaveTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 7991b70a..261fda36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Ctrl+P ▸ Script console: one per character, it shows what your Lua scripts printed and the errors they raised + (with the file and line), runs a line of Lua as that character (a runaway loop is stopped after half a second), + remembers what you typed, lists the character's `store` keys with Delete, and reloads the scripts. Without a + scripts folder it says what to create. +- F5 ▸ channels puts each GMCP channel (`Comm.Channel.Text`) in a window of its own: `copy` keeps the line in the + main window too, `move` takes it out. Off by default. +- F5 ▸ names highlights the names you list (`Ashlyn, Merrow=red`) in a colour of your choice, as whole words, + wherever they appear. +- Ctrl+P ▸ Start scene log records the window in front to a file of its own under the log folder, HTML or plain text, + poses only or every line (F7 ▸ Scene log), with a header naming who was in the room; Stop scene log closes it. - A world can reconnect by itself after its connection drops (F5 ▸ reconnect). It waits 5, 15, 30, 60 and 60 seconds between tries, counts down on the status row, and stops after five; Alt+R dials at once, and Disconnect or Ctrl+P ▸ Stop reconnecting cancels. Your own Disconnect, quitting, or the game closing right after you typed a diff --git a/CLAUDE.md b/CLAUDE.md index f768d53c..51ec6045 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2993,6 +2993,31 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] so a late offer cannot log in twice. The on-connect commands go after whichever login was sent. The password goes only to `SendGmcpAsync`; `Char.Login.Result` is printed, bounded to one line. Not done: a server that never negotiates GMCP still costs the five seconds, because `TelnetSession` raises nothing on a refusal. +- **The script console is one per character, and a line runs on the UI thread** (`ScriptHost.EvaluateConsole`, + Scripting; `ScriptConsoleModel`/`ScriptConsoleLog`/`ScriptConsoleSession`, Client; `ScriptConsoleSurface`, + `SharpMUTermApp.ScriptConsole.cs`, Tui; `ScriptConsoleView`, Avalonia; ⌃P `world:script-console`; the `script-console` + view). A line is tried as `return ` first, then as a statement, in a coroutine under the host's `_gate` with an + instruction budget (2,000,000) and a time budget (500 ms), so a loop typed there cannot hang the screen; a Lua function + called *inside* a library call cannot be preempted. Files load under their own chunk name, so an error says + `main.lua:(3,…)`. Lines and history are in memory for the run (`SessionScripts.Printed`, `ReportScript`), never saved. + The prompt exists only with a scripts root whose folder exists and a window with a character; otherwise the model's + `Unavailable` says which. Every gesture ends in `RunConsoleLine`/`DeleteStoreKey`/`ReloadConsoleScripts` (surface + `script-console`, parity-probed). The demo scene has its own sandbox (`_demoScripts`), so the snapshot's prompt runs. +- **GMCP channels go to a window per channel through `SpawnLine`** (`ChannelCapture`, Core; + `WorldDefinition.CaptureChannels`, F5 ▸ `channels`: off/copy/move, off by default). `Comm.Channel.Text`'s `channel` + names the window (letters, digits, space, `-`, `_`, 24 at most); its `text` is parsed through `AnsiParser`. `move` + gags the main-window echo by exact text, only when it arrives within 3 s of the GMCP (32 pending at most), so an echo + that arrives *before* the GMCP is not taken out. +- **Highlighted names are an ingest-time restyle** (`NameHighlights`, Core; `WorldDefinition.HighlightNames`, F5 ▸ + `names`, `TextRule.NameHighlights`). `Name=colour` from `HighlightColours`, gold by default, 64 names; one whole-word, + case-insensitive regex with a 50 ms timeout, applied before emoji and links and to captured channel lines. Only the + foreground is set, so the formatter's floor still applies. Like `join wraps`, it changes the next line, never history. +- **A scene log is the focused window's lines into a file of its own** (`SceneLog`/`ScenePoses`, Core; + `SharpMUTermApp.SceneLog.cs`; ⌃P `term:scene-on`/`term:scene-off`; F7 ▸ Scene log: HTML or plain, poses or every line). + Under `/scenes/`, `scene--`, never overwriting, through `HtmlLogSink`/`PlainTextLogSink`. Fed at + `OnLine`/`OnSpawnLine`, the restore log's seam, so chrome is never recorded. A pose is a line that starts with a + present name or has the say-shape; present is the room roster plus the character, named in the header. **No log root, + no scene log**: refused out loud, the `logRoot` gate. - **Lua's `store.*` is one JSON file per character** (`ScriptStore`, Scripting; `script-data/.json` beside `config.json`, `0600`). The `scriptStoreRoot:` constructor parameter is null by default, the `save:`/`logRoot:` family, but the host's store never is: with no folder it is memory-only by construction, the diff --git a/src/SharpMUTerm.Avalonia/ModalOverlay.cs b/src/SharpMUTerm.Avalonia/ModalOverlay.cs index eed0a7f3..a60b524a 100644 --- a/src/SharpMUTerm.Avalonia/ModalOverlay.cs +++ b/src/SharpMUTerm.Avalonia/ModalOverlay.cs @@ -47,6 +47,7 @@ public ModalOverlay(ModalSession session, Action remove, Action new WelcomeView(welcome, Colours, Done), HelpSession help => new HelpView(help, Colours, Done), DictionaryOfferSession offer => new DictionaryOfferView(offer, Colours, Done), + ScriptConsoleSession console => new ScriptConsoleView(console, Colours, Done), _ => throw new ArgumentException($"no native view for {session.GetType().Name}", nameof(session)), }; AutomationProperties.SetName(this, _view.Title); diff --git a/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs b/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs new file mode 100644 index 00000000..7e9c1155 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs @@ -0,0 +1,299 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's script console: whose scripts and how many loaded, what they printed and the errors they raised, a +/// one-line Lua prompt with its history on ↑↓, the character's store.* with Delete, and Reload. Drawn from the +/// client's , the record the cells draw; every gesture goes back through the +/// to the client's own methods, and the client republishes after each. +/// +internal sealed class ScriptConsoleView : DockPanel, IModalView +{ + private readonly ScriptConsoleSession _session; + private readonly NativeTokens _colours; + private readonly Action _done; + private readonly TextBlock _summary; + private readonly TextBox _prompt; + private readonly StackPanel _output; + private readonly ScrollViewer _outputScroller; + private readonly StackPanel _store; + private readonly TextBlock _storeHeading; + private readonly Button _delete; + private readonly List _storeRows = []; + private readonly FontFamily _mono = new($"{CellFonts.BundledFamily}, DejaVu Sans Mono, Consolas, Menlo, monospace"); + private ScriptConsoleModel _model; + private int _selectedKey = -1; + private int _historyAt = -1; + + public ScriptConsoleView(ScriptConsoleSession session, NativeTokens colours, Action done) + { + _session = session; + _colours = colours; + _done = done; + _model = session.Model; + + var heading = ModalParts.Heading("Script console", colours); + SetDock(heading, Dock.Top); + Children.Add(heading); + + _summary = ModalParts.Dim(string.Empty, colours); + SetDock(_summary, Dock.Top); + Children.Add(_summary); + + var footer = ModalParts.Footer(ScriptConsoleModel.Keys, colours); + SetDock(footer, Dock.Bottom); + Children.Add(footer); + + var buttons = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Margin = new Thickness(14, 8, 14, 0), HorizontalAlignment = HorizontalAlignment.Right }; + _delete = ModalParts.Button("Delete key", "Del", colours, DeleteSelected); + buttons.Children.Add(_delete); + buttons.Children.Add(ModalParts.Button("Reload scripts", "Ctrl+L", colours, Reload)); + SetDock(buttons, Dock.Bottom); + Children.Add(buttons); + + _prompt = new TextBox + { + FontFamily = _mono, + FontSize = NativeTokens.Title, + Margin = new Thickness(14, 8, 14, 0), + Padding = new Thickness(10, 6), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), + MaxLength = ScriptConsoleModel.MaxInput, + PlaceholderText = "Lua — try 1 + 1 or print(world.name)", + InnerLeftContent = new TextBlock + { + Text = "lua", + FontFamily = _mono, + Foreground = colours.Brush(colours.Accent), + VerticalAlignment = VerticalAlignment.Center, + Margin = new Thickness(0, 0, 8, 0), + }, + }; + global::Avalonia.Automation.AutomationProperties.SetName(_prompt, "Lua prompt"); + SetDock(_prompt, Dock.Bottom); + Children.Add(_prompt); + + var body = new Grid { ColumnDefinitions = new ColumnDefinitions("*,12,240"), MinHeight = 260, Margin = new Thickness(0, 4, 0, 0) }; + + _output = new StackPanel { Margin = new Thickness(14, 6, 8, 6) }; + _outputScroller = new ScrollViewer + { + Content = _output, + HorizontalScrollBarVisibility = global::Avalonia.Controls.Primitives.ScrollBarVisibility.Disabled, + VerticalScrollBarVisibility = global::Avalonia.Controls.Primitives.ScrollBarVisibility.Auto, + }; + var outputFrame = new Border + { + BorderBrush = colours.Brush(colours.Rule), + BorderThickness = new Thickness(0, 1, 1, 1), + Child = _outputScroller, + }; + Grid.SetColumn(outputFrame, 0); + body.Children.Add(outputFrame); + + var storePanel = new DockPanel(); + _storeHeading = ModalParts.GroupHeader("Store", colours, first: true); + SetDock(_storeHeading, Dock.Top); + storePanel.Children.Add(_storeHeading); + var (storeFrame, store, _) = ModalParts.List(colours); + _store = store; + storePanel.Children.Add(storeFrame); + Grid.SetColumn(storePanel, 2); + body.Children.Add(storePanel); + Children.Add(body); + + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + _session.Changed += OnChanged; + Draw(); + } + + public string Title => "Script console"; + + public double PreferredWidth => 860; + + public bool Centred => false; + + /// The model drawn now, for a test. + public ScriptConsoleModel Model => _model; + + /// The prompt, for a test. + public TextBox Prompt => _prompt; + + /// The store key Delete removes, or null. + public string? SelectedKey => _selectedKey >= 0 && _selectedKey < _model.Store.Count ? _model.Store[_selectedKey].Key : null; + + public void FocusFirst() => _prompt.Focus(); + + public void Detach() => _session.Changed -= OnChanged; + + /// ⏎ at the prompt: hands the line to the client and clears the box. + public void Run() + { + var line = _prompt.Text ?? string.Empty; + if (_session.Run(line)) + { + _prompt.Text = string.Empty; + _historyAt = -1; + } + } + + /// Picks store row . + public void SelectKey(int index) + { + _selectedKey = index; + Highlight(); + } + + /// Delete on the store key picked. + public void DeleteSelected() + { + if (SelectedKey is { } key) + { + _session.Delete(key); + } + } + + /// Reload scripts. + public void Reload() => _session.Reload(); + + private void OnChanged(ScriptConsoleModel model) => Dispatcher.UIThread.Post(() => + { + _model = model; + Draw(); + }); + + private void Draw() + { + _summary.Text = NativeKeys.Words(_model.Summary); + _summary.Foreground = _colours.Brush(_model.CanRun ? _colours.Dim : _colours.Warn); + _prompt.IsEnabled = _model.CanRun; + + _output.Children.Clear(); + if (_model.Lines.Count == 0) + { + _output.Children.Add(Line(_model.CanRun ? ScriptConsoleModel.Empty : _model.Unavailable ?? string.Empty, _colours.Dim, string.Empty)); + } + + foreach (var line in _model.Lines) + { + var colour = line.Kind switch + { + ScriptConsoleKind.Error => _colours.Warn, + ScriptConsoleKind.Result => _colours.Accent, + ScriptConsoleKind.Input or ScriptConsoleKind.Note => _colours.Dim, + _ => _colours.Text, + }; + _output.Children.Add(Line(line.Text, colour, ScriptConsoleModel.Mark(line.Kind))); + } + + _outputScroller.ScrollToEnd(); + + _storeHeading.Text = _model.StoreCount > _model.Store.Count + ? $"STORE · {_model.Store.Count} OF {_model.StoreCount}" + : $"STORE · {_model.StoreCount}"; + _store.Children.Clear(); + _storeRows.Clear(); + if (_model.Store.Count == 0) + { + _store.Children.Add(ModalParts.Dim(_model.CanRun ? "nothing stored" : string.Empty, _colours, new Thickness(12, 8))); + } + + for (var i = 0; i < _model.Store.Count; i++) + { + var entry = _model.Store[i]; + var index = i; + var text = new StackPanel(); + text.Children.Add(new TextBlock { Text = entry.Key, FontWeight = FontWeight.SemiBold, Foreground = _colours.Brush(_colours.Text), TextTrimming = TextTrimming.CharacterEllipsis }); + text.Children.Add(new TextBlock { Text = entry.Value, FontFamily = _mono, FontSize = NativeTokens.Small, Foreground = _colours.Brush(_colours.Dim), TextTrimming = TextTrimming.CharacterEllipsis }); + var row = ModalParts.Row(text, entry.Key, () => SelectKey(index), () => SelectKey(index)); + _storeRows.Add(row); + _store.Children.Add(row); + } + + _selectedKey = _model.Store.Count == 0 ? -1 : Math.Clamp(_selectedKey, -1, _model.Store.Count - 1); + Highlight(); + } + + private Control Line(string text, Color colour, string mark) + { + var row = new DockPanel { Margin = new Thickness(0, 1) }; + var gutter = new TextBlock { Text = mark, Width = 18, FontFamily = _mono, Foreground = _colours.Brush(colour), FontSize = NativeTokens.Body }; + SetDock(gutter, Dock.Left); + row.Children.Add(gutter); + row.Children.Add(new SelectableTextBlock + { + Text = text, + FontFamily = _mono, + FontSize = NativeTokens.Body, + Foreground = _colours.Brush(colour), + TextWrapping = TextWrapping.Wrap, + }); + return row; + } + + private void Highlight() + { + for (var i = 0; i < _storeRows.Count; i++) + { + _storeRows[i].Background = i == _selectedKey ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + } + + _delete.IsEnabled = SelectedKey is not null; + } + + private void OnKey(object? sender, KeyEventArgs e) + { + switch (e.Key) + { + case Key.Escape: + e.Handled = true; + _session.Dismiss(); + _done(); + return; + case Key.L when e.KeyModifiers == KeyModifiers.Control: + e.Handled = true; + Reload(); + return; + case Key.Enter when _prompt.IsFocused: + e.Handled = true; + Run(); + return; + case Key.Up or Key.Down when _prompt.IsFocused && e.KeyModifiers == KeyModifiers.None: + e.Handled = true; + Recall(e.Key == Key.Up ? -1 : 1); + return; + case Key.Delete when !_prompt.IsFocused && SelectedKey is not null: + e.Handled = true; + DeleteSelected(); + return; + case Key.Up or Key.Down when !_prompt.IsFocused && _model.Store.Count > 0: + e.Handled = true; + SelectKey(Math.Clamp((_selectedKey < 0 ? 0 : _selectedKey) + (e.Key == Key.Up ? -1 : 1), 0, _model.Store.Count - 1)); + return; + } + } + + /// ↑↓ at the prompt: walks what was typed, newest first, and back to an empty line. + private void Recall(int delta) + { + var history = _model.History; + if (history.Count == 0) + { + return; + } + + var at = _historyAt < 0 ? history.Count : _historyAt; + at = Math.Clamp(at + delta, 0, history.Count); + _historyAt = at == history.Count ? -1 : at; + _prompt.Text = _historyAt < 0 ? string.Empty : history[_historyAt]; + _prompt.CaretIndex = _prompt.Text.Length; + } +} diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 1a539792..44eae132 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -20,6 +20,15 @@ public static class BuiltInCommands /// Help: keys, slash commands and how-tos (/help). public const string HelpCommand = "term:help"; + /// ⌃P ▸ Script console. + public const string ScriptConsoleCommand = "world:script-console"; + + /// ⌃P ▸ Start scene log. + public const string SceneStartCommand = "term:scene-on"; + + /// ⌃P ▸ Stop scene log. + public const string SceneStopCommand = "term:scene-off"; + /// The spelling dictionary offer. public const string DictionaryCommand = "term:get-dictionary"; @@ -96,6 +105,8 @@ void Family(string id, string prefix, Func c.State.ScriptsOn); + Add(ScriptConsoleCommand, CommandGroup.World, "Script console", + detail: "run Lua as this character, see what scripts print and keep"); // Only where the host has a screen reader to tell: the window's live region, or --plain. Add("a11y:toggle-window", CommandGroup.Terminal, "Read this window aloud", @@ -105,6 +116,9 @@ void Family(string id, string prefix, Func c.State.LoggingOn); Add("term:log-on", CommandGroup.Terminal, "Start logging", when: c => !c.State.LoggingOn); + Add(SceneStopCommand, CommandGroup.Terminal, "Stop scene log", detail: "closes the file", when: c => c.State.SceneLogging); + Add(SceneStartCommand, CommandGroup.Terminal, "Start scene log", + detail: "record this window's poses to a file of their own", when: c => !c.State.SceneLogging); Add("term:unfreeze", CommandGroup.Terminal, "Resume scrollback", when: c => c.State.Frozen); Add("term:freeze", CommandGroup.Terminal, "Freeze pane", when: c => !c.State.Frozen); Add("term:clear", CommandGroup.Terminal, "Clear window"); diff --git a/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs b/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs new file mode 100644 index 00000000..e8e436be --- /dev/null +++ b/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs @@ -0,0 +1,263 @@ +namespace SharpMUTerm.Client.Modals; + +/// What a script console line is. +public enum ScriptConsoleKind +{ + /// A line typed at the prompt. + Input, + + /// The value a typed line returned. + Result, + + /// Something a script printed (print, world.print, log.*). + Output, + + /// A script's error, a load failure or a refused file, with file:line where Lua gave one. + Error, + + /// The console's own remark (scripts reloaded, a key deleted). + Note, +} + +/// One line of a character's script console. +public sealed record ScriptConsoleLine(ScriptConsoleKind Kind, string Text); + +/// One store.* key and its value, as JSON cut to . +public sealed record ScriptStoreEntry(string Key, string Value); + +/// +/// A character's script console (⌃P ▸ Script console): what its scripts printed and the errors they raised, +/// a one-line Lua prompt run in that character's sandbox, the lines typed there, and a read-only view of its +/// store.* with delete. Drawn by the cell surface (ScriptConsoleSurface.Render) and the window's native +/// modal from the same record. +/// +/// Whose scripts these are (the window's character), or empty for none. +/// Why there is no prompt (no scripts folder, no character), or null when there is one. +/// The newest console lines, oldest first, at most . +/// What was typed at the prompt, oldest first, at most . +/// The store's keys and values in the order they were first set, at most . +/// How many keys the store holds in all. +/// The script files the character's trigger sets name. +/// How many of them loaded. +/// The scripts folder, or null in a client that runs none. +public sealed record ScriptConsoleModel( + string Character, + string? Unavailable, + IReadOnlyList Lines, + IReadOnlyList History, + IReadOnlyList Store, + int StoreCount, + IReadOnlyList Files, + int Loaded, + string? Folder) +{ + /// The most console lines kept per character. + public const int MaxLines = 300; + + /// The most prompt lines remembered per character. + public const int MaxHistory = 50; + + /// The most store keys listed. + public const int MaxStoreRows = 200; + + /// The longest store value shown. + public const int MaxValueLength = 120; + + /// The longest line typed at the prompt. + public const int MaxInput = 500; + + /// The keys, in glyphs, as the cells' footer says them (a native view spells them in words). + public const string Keys = "⏎ runs · ↑↓ history · ⇥ store keys · Del deletes a key · ⌃L reloads scripts · Esc closes"; + + /// What the console says when its scripts printed nothing yet. + public const string Empty = "nothing printed yet — try 1 + 1 or print(world.name)"; + + /// Whether a line can be run. + public bool CanRun => Unavailable is null; + + /// The line under the title: whose scripts, how many loaded, how many keys. + public string Summary => + Unavailable is not null + ? Unavailable + : $"{Character} · {LoadedText} · {StoreCount} store key{(StoreCount == 1 ? string.Empty : "s")}"; + + private string LoadedText => (Files.Count, Loaded) switch + { + (0, _) => "no script files", + (var n, var l) when l < n => $"{l} of {n} files loaded", + (1, _) => "1 file loaded", + (var n, _) => $"{n} files loaded", + }; + + /// A console line's mark, the same in both hosts. + public static string Mark(ScriptConsoleKind kind) => kind switch + { + ScriptConsoleKind.Input => "›", + ScriptConsoleKind.Result => "=", + ScriptConsoleKind.Error => "!", + ScriptConsoleKind.Note => "·", + _ => " ", + }; + + public bool Equals(ScriptConsoleModel? other) => + other is not null + && Character == other.Character + && Unavailable == other.Unavailable + && StoreCount == other.StoreCount + && Loaded == other.Loaded + && Folder == other.Folder + && ModelLists.Same(Lines, other.Lines) + && ModelLists.Same(History, other.History) + && ModelLists.Same(Store, other.Store) + && ModelLists.Same(Files, other.Files); + + public override int GetHashCode() => + HashCode.Combine(Character, Unavailable, StoreCount, Loaded, ModelLists.Hash(Lines), ModelLists.Hash(Store)); +} + +/// +/// A character's console lines, kept for the run (never saved) and fed from any thread: a trigger's script prints on +/// the read loop, a timer's on the scheduler. Bounded at . +/// +public sealed class ScriptConsoleLog +{ + private readonly object _gate = new(); + private readonly LinkedList _lines = new(); + private readonly List _history = new(); + + /// Raised after a line is added, on the thread that added it. + public event Action? Changed; + + /// Adds a line, cut to one row of reasonable length per line of text. + public void Add(ScriptConsoleKind kind, string text) + { + lock (_gate) + { + foreach (var part in (text ?? string.Empty).Replace("\r", string.Empty, StringComparison.Ordinal).Split('\n').Take(20)) + { + var clean = new string(part.Select(c => char.IsControl(c) && c != '\t' ? ' ' : c).ToArray()).Replace('\t', ' '); + _lines.AddLast(new ScriptConsoleLine(kind, clean.Length > 400 ? clean[..399] + "…" : clean)); + } + + while (_lines.Count > ScriptConsoleModel.MaxLines) + { + _lines.RemoveFirst(); + } + } + + Changed?.Invoke(); + } + + /// Remembers a line typed at the prompt (a repeat of the last is not added twice). + public void Remember(string input) + { + lock (_gate) + { + if (_history.Count == 0 || _history[^1] != input) + { + _history.Add(input); + } + + if (_history.Count > ScriptConsoleModel.MaxHistory) + { + _history.RemoveAt(0); + } + } + } + + /// The lines, oldest first. + public IReadOnlyList Lines + { + get + { + lock (_gate) + { + return _lines.ToArray(); + } + } + } + + /// What was typed, oldest first. + public IReadOnlyList History + { + get + { + lock (_gate) + { + return _history.ToArray(); + } + } + } +} + +/// +/// One opening of the script console in a host's own controls. Every gesture goes back through it to the client's +/// thread and ends in the method the cell surface's key ends in; the client republishes the model after each. +/// +public sealed class ScriptConsoleSession : ModalSession +{ + private readonly Action _run; + private readonly Action _delete; + private readonly Action _reload; + + /// What the console shows. + /// Whether the client's theme is a dark one. + /// Runs a line at the prompt (RunConsoleLine). + /// Deletes a store key (DeleteStoreKey). + /// Reloads the character's scripts (ReloadConsoleScripts). + /// Told the console closed. + public ScriptConsoleSession( + ScriptConsoleModel model, + bool isDark, + Action run, + Action delete, + Action reload, + Action closed) + : base(model, isDark, closed) + { + ArgumentNullException.ThrowIfNull(run); + ArgumentNullException.ThrowIfNull(delete); + ArgumentNullException.ThrowIfNull(reload); + _run = run; + _delete = delete; + _reload = reload; + } + + public override string Surface => "script-console"; + + /// The host's: ⏎ on a line. Nothing when the console cannot run one, or the line is blank. + public bool Run(string line) + { + if (IsEnded || !Model.CanRun || string.IsNullOrWhiteSpace(line)) + { + return false; + } + + _run(line.Length > ScriptConsoleModel.MaxInput ? line[..ScriptConsoleModel.MaxInput] : line); + return true; + } + + /// The host's: Delete on a store key the model lists. + public bool Delete(string key) + { + if (IsEnded || !Model.Store.Any(e => e.Key == key)) + { + return false; + } + + _delete(key); + return true; + } + + /// The host's: Reload scripts. + public bool Reload() + { + if (IsEnded) + { + return false; + } + + _reload(); + return true; + } +} diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index 0ac15685..2f86e250 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -1,5 +1,7 @@ using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Logging; namespace SharpMUTerm.Client.Settings; @@ -47,6 +49,9 @@ public static partial class BuiltInSettings /// Game sound; drawn only where a host passes the sound settings. public const string SoundGroup = "Sound"; + /// How a scene log is written. + public const string SceneLogGroup = "Scene log"; + /// The id of the meters field, which a host draws as a table rather than one value. public const string MetersField = "meters"; @@ -140,6 +145,23 @@ public static partial class BuiltInSettings Flag("captions", "sound captions", SoundGroup, c => c.Sound.Captions, (c, v) => c.Sound.Captions = v, "print a line of text for each sound", "audio subtitles accessibility"), + + new ChoiceField("scene-format", "scene log format", WorldFieldValues.SceneFormats, "HTML keeps the game's colours") + { + Group = SceneLogGroup, + Keywords = "roleplay rp scene log html plain transcript", + Binding = new SettingBinding( + c => c.SceneLog.Html ? WorldFieldValues.SceneFormats[0] : WorldFieldValues.SceneFormats[1], + (c, v) => c.SceneLog.Html = v != WorldFieldValues.SceneFormats[1]), + }, + new ChoiceField("scene-content", "scene log keeps", WorldFieldValues.SceneContents, "poses start with the name of someone present") + { + Group = SceneLogGroup, + Keywords = "roleplay rp scene log poses", + Binding = new SettingBinding( + c => c.SceneLog.Content == SceneLogContent.Everything ? WorldFieldValues.SceneContents[1] : WorldFieldValues.SceneContents[0], + (c, v) => c.SceneLog.Content = v == WorldFieldValues.SceneContents[1] ? SceneLogContent.Everything : SceneLogContent.Poses), + }, ], }; @@ -267,6 +289,16 @@ public static partial class BuiltInSettings (_, w) => w.AlertOnName ? WorldFieldValues.AlertChoices[1] : WorldFieldValues.AlertChoices[0], (_, w, v) => w.AlertOnName = v == WorldFieldValues.AlertChoices[1], "tell the desktop when a line names your character or pages you", "notify mention page tell"), + WorldChoice("capture-channels", "capture channels", WorldFieldValues.ChannelCaptureChoices, WorldTextGroup, + (_, w) => WorldFieldValues.ChannelCaptureName(w.CaptureChannels), + (_, w, v) => w.CaptureChannels = WorldFieldValues.ChannelCaptureOf(v), + "put each GMCP channel in a window of its own, as a copy or moved out of the main window", + "comm.channel chat ooc gossip spawn window"), + WorldText("highlight-names", "highlight names", TextRule.NameHighlights, WorldTextGroup, + (_, w) => NameHighlights.Format(w.HighlightNames), + (_, w, v) => w.HighlightNames = [.. NameHighlights.Parse(v).Names], + "names drawn in a colour wherever they appear: Ashlyn=gold, Merrow=red", + "friends enemies highlight name colour"), WorldText("edit-grab", "edit grab", TextRule.Optional, WorldTextGroup, (_, w) => w.GrabPrefix, (_, w, v) => w.GrabPrefix = v, "a line starting with this goes on the command line instead of the output", "fugueedit mush edit prefix"), diff --git a/src/SharpMUTerm.Client/Settings/TextRules.cs b/src/SharpMUTerm.Client/Settings/TextRules.cs index 0d042885..84772107 100644 --- a/src/SharpMUTerm.Client/Settings/TextRules.cs +++ b/src/SharpMUTerm.Client/Settings/TextRules.cs @@ -45,6 +45,9 @@ public enum TextRule /// The name of a window: not blank, no control characters; trimmed (a route). Window, + + /// A highlight-names list: Name=colour, …, each colour one of . + NameHighlights, } /// @@ -78,6 +81,8 @@ TextRule.Name when string.IsNullOrWhiteSpace(text) => $"{field.Label} cannot be TextRule.Name or TextRule.Secret or TextRule.Defaulted when text.Any(char.IsControl) => $"{field.Label} cannot contain control characters", TextRule.Pattern when !string.IsNullOrWhiteSpace(text) => PatternError(text), + TextRule.NameHighlights => Core.Automation.NameHighlights.Parse( + text, colour => HighlightColours.Palette.Contains(colour) && colour != HighlightColours.None).Error, _ => null, }; } diff --git a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs index 6547186c..abb39b73 100644 --- a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs +++ b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs @@ -188,4 +188,20 @@ public static void SplitModules(WorldDefinition world, string? value) world.GmcpModules = modules; } + + /// The words for . + public static IReadOnlyList ChannelCaptureChoices { get; } = ["off", "copy", "move"]; + + /// A capture mode as its word. + public static string ChannelCaptureName(SharpMUTerm.Core.Protocols.ChannelCaptureMode mode) => ChannelCaptureChoices[(int)mode]; + + /// A word as a capture mode; anything else is off. + public static SharpMUTerm.Core.Protocols.ChannelCaptureMode ChannelCaptureOf(string? word) => + (SharpMUTerm.Core.Protocols.ChannelCaptureMode)Math.Max(0, ChannelCaptureChoices.ToList().IndexOf(word ?? string.Empty)); + + /// F7's words for a scene log's format. + public static IReadOnlyList SceneFormats { get; } = ["html", "plain text"]; + + /// F7's words for what a scene log keeps. + public static IReadOnlyList SceneContents { get; } = ["poses", "every line"]; } diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index c3af479b..dabe0acc 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -186,6 +186,9 @@ public static class SurfaceCatalog /// The spelling dictionary offer: the consent step before anything is downloaded. public const string Dictionary = "dictionary"; + /// A character's script console: its scripts' output and errors, a Lua prompt, and its store.*. + public const string ScriptConsole = "script-console"; + /// /// The +3 ▾ chip a tab strip carries when its tabs do not fit even at their floors, and the list of the tabs /// past its edges it opens: a cell list in a terminal, a native menu in the window (the chip itself is cells in both). @@ -209,7 +212,7 @@ public static class SurfaceCatalog private static string[] PanelViews(string view) => ["SharpMUTerm.Avalonia." + view, "SharpMUTerm.Avalonia.PopOutButton"]; /// The modals the window draws with its own controls in place of the cell modal (ClientHost.NativeModals). - public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary]; + public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary, ScriptConsole]; /// A cell modal in a terminal; the window's own modal in its place. private static readonly IReadOnlyDictionary NativeModal = new Dictionary @@ -483,6 +486,18 @@ public static class SurfaceCatalog NativeModal, "SharpMUTerm.Tui.DictionaryOffer.Render", ModalViews("DictionaryOfferView")), + new( + ScriptConsole, + typeof(ScriptConsoleModel), + [ + // A line at the prompt runs in the character's sandbox; a store key is deleted; the scripts are reloaded. + new(SurfaceActionKind.Modal, "run", "RunConsoleLine"), + new(SurfaceActionKind.Modal, "delete key", "DeleteStoreKey"), + new(SurfaceActionKind.Modal, "reload", "ReloadConsoleScripts"), + ], + NativeModal, + "SharpMUTerm.Tui.ScriptConsoleSurface.Render", + ModalViews("ScriptConsoleView")), new( TabOverflow, typeof(MenuModel), diff --git a/src/SharpMUTerm.Core/Automation/NameHighlights.cs b/src/SharpMUTerm.Core/Automation/NameHighlights.cs new file mode 100644 index 00000000..4d1b3a27 --- /dev/null +++ b/src/SharpMUTerm.Core/Automation/NameHighlights.cs @@ -0,0 +1,164 @@ +using System.Text; +using System.Text.RegularExpressions; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Automation; + +/// One name a world highlights wherever it appears as a whole word, and the colour it is drawn in. +/// The name, as typed (matched without regard to case). +/// A colour name (gold, red) or #rrggbb. +public sealed record NameHighlight(string Name, string Colour); + +/// +/// A world's highlight-names list (F5 ▸ highlight names): friends, enemies, your own name, each drawn in its colour +/// wherever it appears as a whole word in that world's output. Written as one line, Ashlyn=gold, Merrow=red; a name +/// with no colour is . Applied at ingest, after the triggers (so a rule matches what the server +/// sent) and before emoji and links, so a spawn window and the main window show the same colours. The colour is a +/// foreground only, so the pane's legibility floor still holds it (the formatter measures it against the reading plane). +/// +public static class NameHighlights +{ + /// The colour a name with none is drawn in. + public const string DefaultColour = "gold"; + + /// How many names a list may hold; past it the rest are dropped. + public const int MaxNames = 64; + + /// The longest name. + public const int MaxNameLength = 40; + + /// + /// Reads Name=colour, Name=colour (commas or semicolons between, = or : before a colour). Returns + /// the list, or why the text is not one — a colour that is not a colour, a name too long or holding a control + /// character. A blank text is the empty list. + /// + public static (IReadOnlyList Names, string? Error) Parse(string? text, Func? colourIsAllowed = null) + { + var names = new List(); + if (string.IsNullOrWhiteSpace(text)) + { + return (names, null); + } + + foreach (var raw in text.Split([',', ';'], StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)) + { + var cut = raw.IndexOfAny(['=', ':']); + var name = (cut < 0 ? raw : raw[..cut]).Trim(); + var colour = cut < 0 ? DefaultColour : raw[(cut + 1)..].Trim().ToLowerInvariant(); + if (name.Length == 0) + { + return (names, $"'{raw}' names nobody"); + } + + if (name.Length > MaxNameLength) + { + return (names, $"a name may be at most {MaxNameLength} characters"); + } + + if (name.Any(char.IsControl)) + { + return (names, "a name cannot contain control characters"); + } + + if (colour.Length == 0) + { + colour = DefaultColour; + } + + if (!WebColors.TryParse(colour, out _) || (colourIsAllowed is not null && !colourIsAllowed(colour))) + { + return (names, $"'{colour}' is not one of the highlight colours"); + } + + if (names.Count < MaxNames && !names.Any(n => string.Equals(n.Name, name, StringComparison.OrdinalIgnoreCase))) + { + names.Add(new NameHighlight(name, colour)); + } + } + + return (names, null); + } + + /// The list as the one line reads, or null for none. + public static string? Format(IReadOnlyList? names) => + names is null || names.Count == 0 + ? null + : string.Join(", ", names.Select(n => string.Equals(n.Colour, DefaultColour, StringComparison.OrdinalIgnoreCase) ? n.Name : $"{n.Name}={n.Colour}")); + + /// + /// with every whole-word occurrence of a listed name drawn in its colour. A name is a whole + /// word when no letter, digit or underscore touches either end, so Ann lights Ann's and not + /// Annabel. Returns the line itself when nothing matched. + /// + public static StyledLine Apply(StyledLine line, Matcher? matcher) + { + ArgumentNullException.ThrowIfNull(line); + if (matcher is null || line.IsEmpty) + { + return line; + } + + MatchCollection matches; + try + { + matches = matcher.Pattern.Matches(line.Text); + } + catch (RegexMatchTimeoutException) + { + return line; + } + + foreach (Match match in matches) + { + if (matcher.ColourOf(match.Value) is { } colour) + { + line = StyledText.Restyle(line, match.Index, match.Length, style => style.WithForeground(colour)); + } + } + + return line; + } + + /// The compiled form of a list, built once per list and reused for every line; null for an empty list. + public static Matcher? Compile(IReadOnlyList? names) + { + if (names is null || names.Count == 0) + { + return null; + } + + var colours = new Dictionary(StringComparer.OrdinalIgnoreCase); + var pattern = new StringBuilder(@"(? n.Name.Length > 0).OrderByDescending(n => n.Name.Length)) + { + if (!WebColors.TryParse(name.Colour, out var colour) || !colours.TryAdd(name.Name, colour)) + { + continue; + } + + pattern.Append(first ? string.Empty : "|").Append(Regex.Escape(name.Name)); + first = false; + } + + if (first) + { + return null; + } + + pattern.Append(@")(?![\w])"); + return new Matcher( + new Regex(pattern.ToString(), RegexOptions.IgnoreCase | RegexOptions.CultureInvariant, TimeSpan.FromMilliseconds(50)), + colours); + } + + /// A list compiled to one pattern, with each name's colour. + public sealed class Matcher(Regex pattern, IReadOnlyDictionary colours) + { + public Regex Pattern { get; } = pattern; + + public TerminalColor? ColourOf(string name) => colours.TryGetValue(name, out var colour) ? colour : null; + } +} diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index a657cbdc..249c9c13 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -58,6 +58,7 @@ public sealed record CharacterRef( /// The worlds whose connected pane is narrower than the column their server wraps at, and which do not join wraps — so /// Join server wraps for … is offered (and suggested) only while it would change what the pane shows. /// +/// Whether the focused window is being recorded as a scene, so ⌃P offers to stop it. /// /// Whether the client's own dictionaries folder holds none, so Get a spelling dictionary is offered. /// @@ -78,7 +79,8 @@ public sealed record CommandContext( int KeyClashes = 0, IReadOnlyList? Floats = null, IReadOnlyList? RaggedWraps = null, - bool NoDictionary = false); + bool NoDictionary = false, + bool SceneLogging = false); /// A world whose pane is narrower than its server's wrap column. /// The world's name. diff --git a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs index cf709f96..b3d2b318 100644 --- a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs +++ b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs @@ -89,6 +89,9 @@ public sealed class AppConfiguration /// Game sound: on or off, the player's levels, captions (F7 ▸ SOUND). public SoundSettings Sound { get; set; } = new(); + /// How a scene log (⌃P ▸ Start scene log) is written: HTML or plain text, poses or every line (F7 ▸ Scene log). + public SceneLogSettings SceneLog { get; set; } = new(); + /// How the command line behaves — the F8 "Input & spellcheck" screen's settings. public InputSettings Input { get; set; } = new(); @@ -186,3 +189,13 @@ public IReadOnlyList ResolveTriggerSets(CharacterDefinition characte return resolved; } } + +/// How a scene log is written (). +public sealed class SceneLogSettings +{ + /// HTML (the default, keeping the game's colours) or plain text. + public bool Html { get; set; } = true; + + /// Poses only (the default) or every line the window shows. + public Logging.SceneLogContent Content { get; set; } +} diff --git a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs index 6e4f9417..e443d32a 100644 --- a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs +++ b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs @@ -165,6 +165,18 @@ public sealed class WorldDefinition /// public bool DiscordPresence { get; set; } + /// + /// What GMCP Comm.Channel.Text does (F5 ▸ capture channels): nothing (the default), a copy in a window + /// per channel, or the line moved there and kept out of the main window (). + /// + public Protocols.ChannelCaptureMode CaptureChannels { get; set; } + + /// + /// Names drawn in a colour wherever they appear as whole words in this world's output (F5 ▸ highlight names), + /// in the order they were listed. Empty by default (). + /// + public List HighlightNames { get; set; } = new(); + /// How the mapper recognises a room on a game that sends no room data (see ). public MapSettings Map { get; set; } = new(); @@ -271,6 +283,8 @@ public sealed class WorldDefinition AlertOnName = AlertOnName, GmcpLogin = GmcpLogin, DiscordPresence = DiscordPresence, + CaptureChannels = CaptureChannels, + HighlightNames = HighlightNames.ToList(), Layout = Layout, AcceptedLayoutSuggestion = AcceptedLayoutSuggestion, Characters = Characters.Select(c => c.Clone()).ToList(), diff --git a/src/SharpMUTerm.Core/Logging/SceneLog.cs b/src/SharpMUTerm.Core/Logging/SceneLog.cs new file mode 100644 index 00000000..7c529d35 --- /dev/null +++ b/src/SharpMUTerm.Core/Logging/SceneLog.cs @@ -0,0 +1,219 @@ +using System.Globalization; +using System.Text; +using System.Text.RegularExpressions; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Logging; + +/// Which lines a scene log keeps. +public enum SceneLogContent +{ + /// Poses: lines that start with the name of someone present (). The default. + Poses, + + /// Every line the window shows. + Everything, +} + +/// +/// A roleplay scene being recorded (⌃P ▸ Start scene log): one window's lines from now until it is stopped, +/// written through or to a file of its own, under a header naming +/// the scene, when it started and who was present. It is not the session log, which is per character and kept running; +/// a scene is something a player starts and stops, and keeps. +/// +public sealed class SceneLog : IDisposable +{ + private readonly ILogSink _sink; + private readonly IReadOnlyCollection _names; + private readonly HashSet _seen = new(StringComparer.OrdinalIgnoreCase); + private readonly object _gate = new(); + private bool _closed; + + private SceneLog(ILogSink sink, string path, string windowId, string title, SceneLogContent content, IReadOnlyCollection names, DateTimeOffset started) + { + _sink = sink; + _names = names; + Path = path; + WindowId = windowId; + Title = title; + Content = content; + Started = started; + } + + /// The file being written. + public string Path { get; } + + /// The window whose lines are recorded. + public string WindowId { get; } + + /// The scene's title (the window's, unless one was given). + public string Title { get; } + + public SceneLogContent Content { get; } + + public DateTimeOffset Started { get; } + + /// How many lines have been written. + public int Lines { get; private set; } + + /// The names that started a pose so far, in no order. + public IReadOnlyCollection Posers + { + get + { + lock (_gate) + { + return _seen.ToArray(); + } + } + } + + /// + /// Starts a scene log in : scene-<title>-<yyyyMMdd-HHmmss>.html (or + /// .txt), never overwriting a file that is there. Writes the header at once. Throws an + /// or when the file cannot be made. + /// + /// Who is present: the room's roster and the player's own character. Also the names a pose starts with. + public static SceneLog Start( + string folder, + string windowId, + string title, + bool html, + SceneLogContent content, + IReadOnlyCollection present, + DateTimeOffset now) + { + ArgumentException.ThrowIfNullOrWhiteSpace(folder); + Directory.CreateDirectory(folder); + var stem = $"scene-{FileStem(title)}-{now.ToLocalTime().ToString("yyyyMMdd-HHmmss", CultureInfo.InvariantCulture)}"; + var extension = html ? ".html" : ".txt"; + var path = System.IO.Path.Combine(folder, stem + extension); + for (var n = 2; File.Exists(path); n++) + { + path = System.IO.Path.Combine(folder, $"{stem}-{n}{extension}"); + } + + var heading = $"Scene: {title}"; + ILogSink sink = html ? HtmlLogSink.CreateFile(path, heading) : PlainTextLogSink.CreateFile(path, append: false); + var log = new SceneLog(sink, path, windowId, title, content, present, now); + sink.WriteSystem(heading); + sink.WriteSystem($"Started {now.ToLocalTime().ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture)}"); + sink.WriteSystem(present.Count == 0 ? "Present: nobody the client knows of" : $"Present: {string.Join(", ", present)}"); + sink.WriteSystem(content == SceneLogContent.Poses ? "Poses only" : "Every line"); + sink.Flush(); + return log; + } + + /// Offers a line the window showed; it is written when the scene keeps lines of its kind. Any thread. + public bool Offer(StyledLine line) + { + ArgumentNullException.ThrowIfNull(line); + if (line.IsPrompt || line.Text.Trim().Length == 0) + { + return false; + } + + string? poser = ScenePoses.Poser(line.Text, _names); + if (Content == SceneLogContent.Poses && poser is null) + { + return false; + } + + lock (_gate) + { + if (_closed) + { + return false; + } + + if (poser is not null) + { + _seen.Add(poser); + } + + _sink.WriteLine(line); + _sink.Flush(); + Lines++; + return true; + } + } + + /// Writes the closing lines and closes the file. + public void Stop(DateTimeOffset now) + { + lock (_gate) + { + if (_closed) + { + return; + } + + _closed = true; + _sink.WriteSystem($"Ended {now.ToLocalTime().ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture)} · {Lines} line{(Lines == 1 ? string.Empty : "s")}" + + (_seen.Count == 0 ? string.Empty : $" · posed: {string.Join(", ", _seen.Order(StringComparer.OrdinalIgnoreCase))}")); + _sink.Dispose(); + } + } + + public void Dispose() => Stop(DateTimeOffset.Now); + + /// A title as part of a file name: letters, digits and dashes, at most 40. + internal static string FileStem(string title) + { + var stem = new StringBuilder(); + foreach (var c in title) + { + if (stem.Length >= 40) + { + break; + } + + stem.Append(char.IsAsciiLetterOrDigit(c) ? char.ToLowerInvariant(c) : '-'); + } + + var text = Regex.Replace(stem.ToString(), "-{2,}", "-").Trim('-'); + return text.Length == 0 ? "scene" : text; + } +} + +/// +/// What counts as a pose in a scene log: a line that starts with the name of someone present (Ashlyn smiles., +/// Ashlyn says, "…", Ashlyn's eyes narrow.), or a line in the shape a say takes (Name says, "…"). +/// Room descriptions, channel lines, system messages and the client's own lines start with no name and are left out. +/// +public static class ScenePoses +{ + private static readonly Regex SayShape = new( + @"^([A-Z][\w'-]{1,30})\s+(says|asks|exclaims|whispers|shouts|murmurs|replies)\b.*""", + RegexOptions.CultureInvariant, + TimeSpan.FromMilliseconds(50)); + + /// The name a pose starts with, or null when is not a pose. + public static string? Poser(string text, IReadOnlyCollection names) + { + var line = text.TrimStart(); + if (line.Length == 0 || line.StartsWith("***", StringComparison.Ordinal)) + { + return null; + } + + foreach (var name in names.OrderByDescending(n => n.Length)) + { + if (name.Length > 0 + && line.StartsWith(name, StringComparison.OrdinalIgnoreCase) + && (line.Length == name.Length || !char.IsLetterOrDigit(line[name.Length]))) + { + return name; + } + } + + try + { + return SayShape.Match(line) is { Success: true } say ? say.Groups[1].Value : null; + } + catch (RegexMatchTimeoutException) + { + return null; + } + } +} diff --git a/src/SharpMUTerm.Core/Protocols/ChannelCapture.cs b/src/SharpMUTerm.Core/Protocols/ChannelCapture.cs new file mode 100644 index 00000000..31bcc78c --- /dev/null +++ b/src/SharpMUTerm.Core/Protocols/ChannelCapture.cs @@ -0,0 +1,186 @@ +using System.Text; +using System.Text.Json; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Protocols; + +/// What a world does with GMCP Comm.Channel.Text (F5 ▸ capture channels). +public enum ChannelCaptureMode +{ + /// Nothing: channel text reaches only the main window, as the server prints it. The default. + Off, + + /// Each channel's text is also put in a window of its own; the main window keeps its copy. + Copy, + + /// Each channel's text goes to its window, and the line the server prints for it is kept out of the main window. + Move, +} + +/// +/// GMCP channel capture (IRE's and Aardwolf's Comm.Channel.Text): the message is turned into a line for a spawn +/// window named after its channel, through the same SpawnLine a capture rule raises, so the restore log, ⌃F, the +/// unread badge and the activity bar treat it as any captured line. With the line +/// the server prints for the same message is gagged from the main window by . +/// +/// The gag matches text, not position: the server prints the channel line and sends the GMCP message separately, +/// and neither carries an id. A printed line whose visible text equals a message's within of it +/// is taken as that message's echo and is consumed once. IRE and Aardwolf send the GMCP first; a server that prints first +/// keeps its main-window copy, which is the safe way for this to be wrong. +/// +/// +public sealed class ChannelCapture +{ + /// How long a message waits for its printed echo. + public static readonly TimeSpan EchoWindow = TimeSpan.FromSeconds(3); + + /// The most messages waiting for an echo at once. + public const int MaxPending = 32; + + /// The longest channel name kept for a window title. + public const int MaxChannelLength = 24; + + /// The longest message text read. + public const int MaxTextLength = 4096; + + private readonly object _gate = new(); + private readonly LinkedList<(string Text, DateTimeOffset At)> _pending = new(); + private readonly TimeProvider _clock; + + public ChannelCapture(TimeProvider? clock = null) => _clock = clock ?? TimeProvider.System; + + /// + /// The window a Comm.Channel.Text payload belongs to and the lines it shows there, or null for a payload that + /// is not one (no channel, no text, not an object). The text may carry ANSI colour, which is kept. + /// + public static (string Window, IReadOnlyList Lines)? Read(string json) + { + try + { + using var document = JsonDocument.Parse(json); + var root = document.RootElement; + if (root.ValueKind != JsonValueKind.Object + || Text(root, "channel") is not { } channel + || Text(root, "text") is not { } text) + { + return null; + } + + var window = WindowName(channel); + if (window.Length == 0) + { + return null; + } + + if (text.Length > MaxTextLength) + { + text = text[..MaxTextLength]; + } + + var parser = new AnsiParser(); + var lines = new List(parser.Feed(text.Replace("\r", string.Empty, StringComparison.Ordinal))); + if (parser.Flush() is { } last) + { + lines.Add(last); + } + + while (lines.Count > 0 && lines[^1].Text.Trim().Length == 0) + { + lines.RemoveAt(lines.Count - 1); + } + + return lines.Count == 0 ? null : (window, lines); + } + catch (JsonException) + { + return null; + } + } + + /// + /// A channel name as a window title: letters, digits, spaces, - and _ only, capped, and with no + /// leading or trailing space — it names a window, and is server text. + /// + public static string WindowName(string channel) + { + var name = new StringBuilder(Math.Min(channel.Length, MaxChannelLength)); + foreach (var c in channel) + { + if (name.Length >= MaxChannelLength) + { + break; + } + + if (char.IsLetterOrDigit(c) || c is ' ' or '-' or '_') + { + name.Append(c); + } + } + + return name.ToString().Trim(); + } + + /// Notes a message whose printed echo is to be kept out of the main window. + public void ExpectEcho(IEnumerable lines) + { + var now = _clock.GetUtcNow(); + lock (_gate) + { + foreach (var line in lines) + { + var text = line.Text.Trim(); + if (text.Length > 0) + { + _pending.AddLast((text, now)); + } + } + + while (_pending.Count > MaxPending) + { + _pending.RemoveFirst(); + } + } + } + + /// Whether is the echo of a message still waiting; if so it is consumed. + public bool TakeEcho(string printed) + { + var text = printed.Trim(); + if (text.Length == 0) + { + return false; + } + + var now = _clock.GetUtcNow(); + lock (_gate) + { + while (_pending.First is { } oldest && now - oldest.Value.At > EchoWindow) + { + _pending.RemoveFirst(); + } + + for (var node = _pending.First; node is not null; node = node.Next) + { + if (string.Equals(node.Value.Text, text, StringComparison.Ordinal)) + { + _pending.Remove(node); + return true; + } + } + } + + return false; + } + + /// Forgets every message waiting for an echo (a new connection). + public void Clear() + { + lock (_gate) + { + _pending.Clear(); + } + } + + private static string? Text(JsonElement root, string name) => + root.TryGetProperty(name, out var value) && value.ValueKind == JsonValueKind.String ? value.GetString() : null; +} diff --git a/src/SharpMUTerm.Core/Session/WorldSession.cs b/src/SharpMUTerm.Core/Session/WorldSession.cs index e05b9ef7..7d81a31a 100644 --- a/src/SharpMUTerm.Core/Session/WorldSession.cs +++ b/src/SharpMUTerm.Core/Session/WorldSession.cs @@ -620,6 +620,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) telnet.OutputReceived += OnOutputReceived; GameData.Clear(); Occupants.Clear(); + _channels.Clear(); lock (_metersGate) { _mxpMeters = []; @@ -641,6 +642,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) GamePresenceChanged?.Invoke(this, EventArgs.Empty); } GmcpReceived?.Invoke(this, e); + CaptureChannel(e.Package, e.Json); if (e.Package.StartsWith("Client.Media", StringComparison.Ordinal) && Media.MediaCommand.FromGmcp(e.Package, e.Json) is { } media) { @@ -877,6 +879,54 @@ private bool TryGrab(StyledLine line) return true; } + /// Messages whose printed echo a world that moves channels keeps out of the main window. + private readonly ChannelCapture _channels = new(); + + /// The highlight-names list last compiled, and what it compiled to. + private (List? Source, int Count, NameHighlights.Matcher? Matcher) _nameMatcher; + + /// The world's highlight names, compiled once per list (F5 replaces the list whole, so its identity is the key). + private NameHighlights.Matcher? NameMatcher() + { + var names = World.HighlightNames; + var cached = _nameMatcher; + if (ReferenceEquals(cached.Source, names) && cached.Count == (names?.Count ?? 0)) + { + return cached.Matcher; + } + + var matcher = NameHighlights.Compile(names); + _nameMatcher = (names, names?.Count ?? 0, matcher); + return matcher; + } + + /// + /// GMCP Comm.Channel.Text into a window per channel, when the world captures channels: raised as + /// , the event a capture rule raises, so the restore log, search and the unread badge see a + /// captured line. Runs on the read loop, in arrival order with the output it belongs beside. + /// + internal void CaptureChannel(string package, string json) + { + if (World.CaptureChannels == ChannelCaptureMode.Off + || !string.Equals(package, "Comm.Channel.Text", StringComparison.OrdinalIgnoreCase) + || ChannelCapture.Read(json) is not { } message) + { + return; + } + + if (World.CaptureChannels == ChannelCaptureMode.Move) + { + _channels.ExpectEcho(message.Lines); + } + + foreach (var line in message.Lines) + { + var shown = ApplyLinks(ApplyEmoji(NameHighlights.Apply(line, NameMatcher()))); + Completions.ObserveLine(shown.Text); + SpawnLine?.Invoke(this, new SpawnLineEventArgs(message.Window, shown)); + } + } + private void ProcessOutputLine(StyledLine line, bool isPrompt = false) { // An MSP trigger is the server asking for a sound, and is taken out before anything else sees the @@ -918,8 +968,14 @@ private void ProcessOutputLine(StyledLine line, bool isPrompt = false) // rather than before it, so a link's target is exactly the text under it — a span whose visible // text and destination disagree is the shape of a phishing link, and this client should not be // in the business of manufacturing one. - var shown = ApplyLinks(ApplyEmoji(result.Line)).WithPrompt(isPrompt); - if (result.RouteMain || !result.Suppress || result.SpawnTargets.Count > 0) + var shown = ApplyLinks(ApplyEmoji(NameHighlights.Apply(result.Line, NameMatcher()))).WithPrompt(isPrompt); + + // A channel line whose GMCP copy has already gone to its own window is kept out of this one when the world + // moves channels (F5 ▸ capture channels). It is a gag in every other respect: a destination a rule asked for, + // `main` included, still gets it. + var suppress = result.Suppress + || (!isPrompt && World.CaptureChannels == ChannelCaptureMode.Move && _channels.TakeEcho(line.Text)); + if (result.RouteMain || !suppress || result.SpawnTargets.Count > 0) { Completions.ObserveLine(shown.Text); // only what is shown somewhere: a gagged word was never read } @@ -940,14 +996,14 @@ private void ProcessOutputLine(StyledLine line, bool isPrompt = false) // true of the main window too. So `route: main` plus `gag` keeps the line here and nowhere else, // where before it deleted the line — because `main` was the F2 screen's label for the *absence* // of a route rather than a route. - if (result.RouteMain || !result.Suppress) + if (result.RouteMain || !suppress) { Print(shown); } // Asked for by a rule (shown or not: the rule said so), or by the world for a line that mentions the // character or pages them — only a line someone will see, and never a prompt. - var shownSomewhere = result.RouteMain || !result.Suppress || result.SpawnTargets.Count > 0; + var shownSomewhere = result.RouteMain || !suppress || result.SpawnTargets.Count > 0; var reason = result.Matched.Any(t => t.Actions.Alert) ? AttentionReason.Trigger : World.AlertOnName && shownSomewhere && !isPrompt ? AttentionMatcher.Classify(shown.Text, Character?.Name) : null; diff --git a/src/SharpMUTerm.Scripting/ScriptHost.cs b/src/SharpMUTerm.Scripting/ScriptHost.cs index 503fdb86..5edc69fc 100644 --- a/src/SharpMUTerm.Scripting/ScriptHost.cs +++ b/src/SharpMUTerm.Scripting/ScriptHost.cs @@ -102,6 +102,133 @@ public DynValue Evaluate(string luaSource) } } + /// + /// The script console's one line: evaluated in this host's sandbox, as a Lua REPL does — first as an expression + /// (return …), and as a statement when that does not parse — under the host's lock, and stopped once it has + /// run Lua instructions or of time, so a loop + /// typed at the prompt cannot hang the thread it runs on. Errors are returned, never thrown. + /// + /// + /// The chunk runs as a coroutine with MoonSharp's auto-yield counter set, and is resumed until it ends or a limit + /// passes; an abandoned coroutine is dropped. The limit is checked between Lua instructions, so Lua running inside a + /// callback a library function makes (string.gsub's, table.sort's) cannot be yielded out of: there it + /// runs to its end, which the console says nothing about because nothing can. + /// + public ConsoleResult EvaluateConsole(string line, long instructionLimit = DefaultInstructionLimit, TimeSpan? timeLimit = null) + { + ArgumentNullException.ThrowIfNull(line); + var limit = timeLimit ?? DefaultTimeLimit; + lock (_gate) + { + if (_disposed) + { + return new ConsoleResult(null, "the scripts have been unloaded"); + } + + DynValue chunk; + try + { + chunk = _script.LoadString("return " + line, null, ConsoleChunk); + } + catch (SyntaxErrorException) + { + try + { + chunk = _script.LoadString(line, null, ConsoleChunk); + } + catch (InterpreterException ex) + { + return new ConsoleResult(null, ScriptException.FromInterpreter(ex).Message); + } + } + + const int slice = 1000; + var clock = System.Diagnostics.Stopwatch.StartNew(); + try + { + var coroutine = _script.CreateCoroutine(chunk).Coroutine; + coroutine.AutoYieldCounter = slice; + long ran = 0; + var result = coroutine.Resume(); + while (result.Type == DataType.YieldRequest) + { + ran += slice; + if (ran >= instructionLimit || clock.Elapsed >= limit) + { + return new ConsoleResult(null, ran >= instructionLimit + ? $"stopped after {instructionLimit.ToString("N0", CultureInfo.InvariantCulture)} instructions — a loop that does not end?" + : $"stopped after {limit.TotalMilliseconds.ToString("0", CultureInfo.InvariantCulture)} ms — a loop that does not end?"); + } + + result = coroutine.Resume(); + } + + return new ConsoleResult(Describe(result), null); + } + catch (InterpreterException ex) + { + return new ConsoleResult(null, ScriptException.FromInterpreter(ex).Message); + } + catch (Exception ex) when (ex is not OutOfMemoryException) + { + return new ConsoleResult(null, ex.Message); + } + } + } + + /// How many Lua instructions a console line may run before it is stopped. + public const long DefaultInstructionLimit = 2_000_000; + + /// How long a console line may run before it is stopped. + public static readonly TimeSpan DefaultTimeLimit = TimeSpan.FromMilliseconds(500); + + /// The chunk name a console line's errors carry. + public const string ConsoleChunk = "console"; + + /// A value as the console shows it: nothing for no value, a tuple's values separated by tabs. + private static string? Describe(DynValue value) + { + // A lone nil is what a call like print(...) returns, and showing "= nil" after every print is noise. + if (value.Type is DataType.Void or DataType.Nil || (value.Type == DataType.Tuple && value.Tuple.Length == 0)) + { + return null; + } + + var text = value.Type == DataType.Tuple + ? string.Join('\t', value.Tuple.Select(Show)) + : Show(value); + return text.Length > ConsoleValueLimit ? text[..(ConsoleValueLimit - 1)] + "…" : text; + + static string Show(DynValue v) => v.Type switch + { + DataType.String => "\"" + v.String + "\"", + DataType.Table => ShowTable(v.Table), + _ => v.ToPrintString(), + }; + + static string ShowTable(Table table) + { + var parts = new List(); + foreach (var pair in table.Pairs.Take(20)) + { + var key = pair.Key.Type == DataType.String ? pair.Key.String : "[" + pair.Key.ToPrintString() + "]"; + var val = pair.Value.Type switch + { + DataType.String => "\"" + pair.Value.String + "\"", + DataType.Table => "{…}", + _ => pair.Value.ToPrintString(), + }; + parts.Add(key + " = " + val); + } + + var more = table.Length > 20 || table.Pairs.Skip(20).Any() ? ", …" : string.Empty; + return "{ " + string.Join(", ", parts) + more + " }"; + } + } + + /// The longest value the console shows. + public const int ConsoleValueLimit = 400; + /// Loads and executes a Lua file, tracking it for . public void LoadFile(string path) { @@ -125,7 +252,24 @@ public void LoadFile(string path) } } - Execute(source); + Run(source, Path.GetFileName(full)); + } + + /// Runs a file's source under its name, so its errors say file:line. + private void Run(string source, string chunkName) + { + lock (_gate) + { + ObjectDisposedException.ThrowIf(_disposed, this); + try + { + _script.DoString(source, null, chunkName); + } + catch (InterpreterException ex) + { + throw ScriptException.FromInterpreter(ex); + } + } } /// @@ -154,7 +298,7 @@ public void Reload() throw new ScriptException($"Could not read script file '{file}': {ex.Message}", null, ex); } - Execute(source); + Run(source, Path.GetFileName(file)); } } @@ -674,3 +818,6 @@ public void Dispose() } } } + +/// What a console line came to: the value it returned (null for none), or the error that stopped it. +public sealed record ConsoleResult(string? Value, string? Error); diff --git a/src/SharpMUTerm.Scripting/SessionScripts.cs b/src/SharpMUTerm.Scripting/SessionScripts.cs index 8a9911cf..6ea4c4c8 100644 --- a/src/SharpMUTerm.Scripting/SessionScripts.cs +++ b/src/SharpMUTerm.Scripting/SessionScripts.cs @@ -88,6 +88,19 @@ public SessionScripts( /// The live host, or null before the first . public ScriptHost? Host => _host; + /// + /// Raised for every line a script prints, on the script's thread (the read loop, the UI thread, a timer), after it + /// has reached the session's window. The script console keeps its own copy from here. + /// + public event Action? Printed; + + /// + /// The script console's line, run in this character's sandbox under the host's lock and time-limited + /// (). Before the first there is no host to run it in. + /// + public ConsoleResult Evaluate(string line) => + _host is { } host ? host.EvaluateConsole(line) : new ConsoleResult(null, "the scripts have not been loaded yet"); + /// Whether the loaded scripts define a global function by this (possibly dotted) name. public bool Defines(string name) => _host?.Defines(name) ?? false; @@ -118,7 +131,7 @@ public int Reload() _session.Aliases.ClearRuntime(); _files = _session.ScriptFiles.ToArray(); - _bridge = new WorldSessionScriptBridge(_session, _sendTo); + _bridge = new WorldSessionScriptBridge(_session, _sendTo) { Printed = text => Printed?.Invoke(text) }; _host = new ScriptHost(_bridge, _store); _bridge.Attach(_host); _host.Error += OnScriptError; diff --git a/src/SharpMUTerm.Scripting/WorldSessionScriptBridge.cs b/src/SharpMUTerm.Scripting/WorldSessionScriptBridge.cs index aa4c37e2..ccee40a9 100644 --- a/src/SharpMUTerm.Scripting/WorldSessionScriptBridge.cs +++ b/src/SharpMUTerm.Scripting/WorldSessionScriptBridge.cs @@ -48,7 +48,14 @@ public static ScriptHost CreateHost(WorldSession session) public string? SendTo(string character, string command) => _sendTo is null ? "this client cannot send to another character" : _sendTo(character, command); - public void Print(string text) => _session.PrintSystem(text); + public void Print(string text) + { + _session.PrintSystem(text); + Printed?.Invoke(text); + } + + /// Told each line a script prints, after it reaches the session, on the script's thread (the console's copy). + public Action? Printed { get; init; } public void AddTrigger(string pattern, string callbackId) => _session.Triggers.Add(new Trigger diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs index c3e5ce81..3daa092a 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs @@ -35,6 +35,7 @@ private T Drawing(string surface, string key, T model) : surface == SurfaceCatalog.Welcome ? (_welcomeView.IsOpen ? _welcome?.Model : null) : surface == SurfaceCatalog.Help ? CellHelp?.Model : surface == SurfaceCatalog.Dictionary ? (_helpView.IsOpen && _helpView.Mode == "dictionary" ? _dictionaryOffer : null) + : surface == SurfaceCatalog.ScriptConsole ? CellConsole?.Model : _drawnModels.TryGetValue((surface, key), out var model) ? model : null; /// A click on a header link, as the header's own handler receives it. diff --git a/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs b/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs new file mode 100644 index 00000000..cf755acc --- /dev/null +++ b/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs @@ -0,0 +1,262 @@ +using SharpMUTerm.Client.Modals; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// The script console in cells: the character's console lines bottom-anchored on the left, its store.* keys on +/// the right, and a one-line Lua prompt. The state is the reader's (what is typed, where in the history, which key is +/// picked, which side ⇥ is on); what it shows is the the window's native console draws. +/// Hosted in a , which is sized once, so +/// always draws exactly the rows it is given. +/// +internal sealed class ScriptConsoleSurface +{ + /// The width the console asks for; the overlay narrows it on a small terminal. + internal const int PreferredWidth = 104; + + /// Below this width the store is shown in place of the lines (⇥), not beside them. + internal const int TwoColumns = 70; + + private int _history = -1; + + public ScriptConsoleSurface(ScriptConsoleModel model) => Model = model; + + public ScriptConsoleModel Model { get; set; } + + /// What is typed at the prompt. + public string Input { get; private set; } = string.Empty; + + /// Whether ⇥ has put the keys on the store list. + public bool OnStore { get; private set; } + + /// The store key picked. + public int StoreSelected { get; private set; } + + /// What a key asks the client to do. + internal enum Ask + { + None, + Run, + Delete, + Reload, + } + + /// + /// A key. Returns what the client is to do — run (then call ), delete the + /// picked key, reload — or when the key only moved or typed. + /// + public Ask Key(ConsoleKeyInfo key) + { + var ctrl = (key.Modifiers & ConsoleModifiers.Control) != 0; + if (ctrl && key.Key == ConsoleKey.L) + { + return Ask.Reload; + } + + if (key.Key == ConsoleKey.Tab) + { + OnStore = !OnStore && Model.Store.Count > 0; + return Ask.None; + } + + if (OnStore) + { + switch (key.Key) + { + case ConsoleKey.UpArrow: + StoreSelected = Math.Max(0, StoreSelected - 1); + return Ask.None; + case ConsoleKey.DownArrow: + StoreSelected = Math.Min(Math.Max(0, Model.Store.Count - 1), StoreSelected + 1); + return Ask.None; + case ConsoleKey.Delete or ConsoleKey.Backspace: + return StoreSelected < Model.Store.Count ? Ask.Delete : Ask.None; + } + + return Ask.None; + } + + var history = Model.History; + switch (key.Key) + { + case ConsoleKey.Enter: + return Model.CanRun && Input.Trim().Length > 0 ? Ask.Run : Ask.None; + case ConsoleKey.Backspace: + if (Input.Length > 0) + { + Input = Input[..^1]; + } + + return Ask.None; + case ConsoleKey.UpArrow when history.Count > 0: + _history = _history < 0 ? history.Count - 1 : Math.Max(0, _history - 1); + Input = history[_history]; + return Ask.None; + case ConsoleKey.DownArrow when _history >= 0: + _history++; + Input = _history < history.Count ? history[_history] : string.Empty; + if (_history >= history.Count) + { + _history = -1; + } + + return Ask.None; + } + + if (key.KeyChar >= ' ' && !char.IsControl(key.KeyChar) + && (key.Modifiers & (ConsoleModifiers.Control | ConsoleModifiers.Alt)) == 0 + && Input.Length < ScriptConsoleModel.MaxInput) + { + Input += key.KeyChar; + } + + return Ask.None; + } + + /// The line ran: the prompt empties and the history walk starts again from the newest. + public void Ran() + { + Input = string.Empty; + _history = -1; + } + + /// The picked key, for . + public string? PickedKey => StoreSelected < Model.Store.Count ? Model.Store[StoreSelected].Key : null; + + /// Keeps the pick inside a store that shrank. + public void Clamp() + { + StoreSelected = Math.Clamp(StoreSelected, 0, Math.Max(0, Model.Store.Count - 1)); + if (Model.Store.Count == 0) + { + OnStore = false; + } + } + + /// What the console draws now. + public List Render(int width, int rows) => Render(Model, Input, OnStore, StoreSelected, width, rows); + + /// The console for , with at the prompt, in exactly rows. + internal static List Render(ScriptConsoleModel model, string input, bool onStore, int storeSelected, int width, int rows) + { + width = Math.Max(30, width); + rows = Math.Max(8, rows); + var lines = new List + { + SpreadLR( + $"[{ScreenPalette.Accent}]SCRIPT CONSOLE[/] [{(model.CanRun ? ScreenPalette.Value : ScreenPalette.Caution)}]{Escape(model.Summary)}[/]", + model.Folder is { } folder ? $"[{ScreenPalette.Label}]{Escape(Fit(folder, Math.Max(10, width / 3)))}[/]" : string.Empty, + width), + string.Empty, + }; + + var body = rows - 5; + var two = width >= TwoColumns; + var storeWidth = two ? Math.Clamp(width / 3, 26, 40) : width; + var outWidth = two ? width - storeWidth - 3 : width; + + var output = OutputRows(model, outWidth, body); + var store = StoreRows(model, onStore, storeSelected, storeWidth, body); + for (var i = 0; i < body; i++) + { + if (two) + { + var left = output[i]; + var pad = Math.Max(0, outWidth - VisibleLength(left)); + lines.Add(left + new string(' ', pad) + $" [{ScreenPalette.Rule}]│[/] " + store[i]); + } + else + { + lines.Add(onStore ? store[i] : output[i]); + } + } + + lines.Add(string.Empty); + lines.Add(model.CanRun + ? $"[bold {ScreenPalette.Accent}]lua ›[/] [{ScreenPalette.Value}]{Escape(Tail(input, width - 8))}{(onStore ? string.Empty : "▏")}[/]" + : $"[{ScreenPalette.Label}]lua › no prompt here — {Escape(model.Unavailable ?? string.Empty)}[/]"); + lines.Add($"[{ScreenPalette.Label}]{Escape(Fit(ScriptConsoleModel.Keys, width))}[/]"); + return lines; + } + + private static List OutputRows(ScriptConsoleModel model, int width, int rows) + { + var wrapped = new List(); + foreach (var line in model.Lines) + { + var mark = ScriptConsoleModel.Mark(line.Kind); + var colour = line.Kind switch + { + ScriptConsoleKind.Error => ScreenPalette.Warn, + ScriptConsoleKind.Input => ScreenPalette.Accent, + ScriptConsoleKind.Result => ScreenPalette.Value, + ScriptConsoleKind.Note => ScreenPalette.Label, + _ => ScreenPalette.Muted, + }; + var first = true; + foreach (var part in HelpSurface.Wrap(line.Text, Math.Max(4, width - 2))) + { + wrapped.Add($"[{colour}]{(first ? mark : " ")} {Escape(part)}[/]"); + first = false; + } + } + + if (wrapped.Count == 0) + { + wrapped.Add($"[{ScreenPalette.Label}] {Escape(model.CanRun ? ScriptConsoleModel.Empty : "nothing to show")}[/]"); + } + + // Bottom-anchored: the newest line sits just above the prompt. + var shown = wrapped.Skip(Math.Max(0, wrapped.Count - rows)).ToList(); + while (shown.Count < rows) + { + shown.Insert(0, string.Empty); + } + + return shown; + } + + private static List StoreRows(ScriptConsoleModel model, bool onStore, int selected, int width, int rows) + { + var list = new List + { + $"[{(onStore ? ScreenPalette.Accent : ScreenPalette.Muted)}]STORE[/] [{ScreenPalette.Label}]{model.StoreCount} key{(model.StoreCount == 1 ? string.Empty : "s")} · read only[/]", + }; + + if (model.Store.Count == 0) + { + list.Add($"[{ScreenPalette.Label}] empty — store.set(k, v) keeps one[/]"); + } + + var room = rows - 1 - (model.StoreCount > model.Store.Count ? 1 : 0); + var first = Math.Clamp(selected - (room / 2), 0, Math.Max(0, model.Store.Count - room)); + var keyWidth = Math.Clamp(model.Store.Count == 0 ? 8 : model.Store.Max(e => e.Key.Length), 4, Math.Max(4, width / 2 - 2)); + for (var i = first; i < model.Store.Count && list.Count < rows; i++) + { + var entry = model.Store[i]; + var picked = onStore && i == selected; + var mark = picked ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; + var value = Fit(entry.Value, Math.Max(1, width - keyWidth - 3)); + list.Add($"{mark} [{(picked ? "bold " : string.Empty)}{ScreenPalette.Value}]{Escape(Fit(entry.Key, keyWidth).PadRight(keyWidth))}[/] [{ScreenPalette.Muted}]{Escape(value)}[/]"); + } + + if (model.StoreCount > model.Store.Count && list.Count < rows) + { + list.Add($"[{ScreenPalette.Label}] +{model.StoreCount - model.Store.Count} more[/]"); + } + + while (list.Count < rows) + { + list.Add(string.Empty); + } + + return list; + } + + private static string Fit(string text, int width) => + width <= 0 ? string.Empty : text.Length <= width ? text : width == 1 ? "…" : text[..(width - 1)] + "…"; + + private static string Tail(string text, int width) => + width <= 1 || text.Length <= width ? text : "…" + text[^(width - 1)..]; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs index 9f91b082..54ef9c77 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs @@ -64,6 +64,7 @@ internal sealed partial class SharpMUTermApp SurfaceCatalog.Welcome => "the welcome", SurfaceCatalog.Help => "help", SurfaceCatalog.Dictionary => "the dictionary offer", + SurfaceCatalog.ScriptConsole => "the script console", null => null, _ => "what is open", }; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.SceneLog.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.SceneLog.cs new file mode 100644 index 00000000..e25acf37 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.SceneLog.cs @@ -0,0 +1,265 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Logging; +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Tui; + +/// +/// Scene logs (⌃P ▸ Start scene log / Stop scene log): the focused window's lines from now until it is +/// stopped, written to a file of their own under the log root through the session log's sinks (), +/// with a header naming the scene and who was present — the window's room roster (who-here) and its character. F7 ▸ +/// Scene log says HTML or plain text, and poses or every line. +/// +/// The log root is the gate, as it is for the session log: an app with none (a test, a snapshot) refuses out loud +/// and writes nothing. Lines are fed where the restore log is (, ), so a +/// scene in a channel window records that window, and the client's own chrome rows are never offered. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The scenes being recorded, by window. + private readonly Dictionary _sceneLogs = new(StringComparer.Ordinal); + + /// The scene log recording a window, for the tests. + internal SceneLog? SceneLogOf(string windowId) + { + lock (_sceneLogs) + { + return _sceneLogs.GetValueOrDefault(windowId); + } + } + + /// Starts recording the focused window as a scene, titled after the window. + internal void StartSceneLog() + { + var windowId = ActiveWindowId(); + if (_logRoot is null) + { + RefuseCommand("no scene log — this client owns no log directory"); + return; + } + + if (SceneLogOf(windowId) is not null) + { + RefuseCommand($"{Snippet(WindowTitle(windowId))} is already being recorded"); + return; + } + + var session = WindowSession(windowId); + var key = session?.SessionKey ?? _workspace.FindWindow(windowId)?.SessionKey; + var present = new List(); + if (key is not null && PanelOccupants(key) is { Known: true } roster) + { + present.AddRange(roster.Snapshot.Where(o => o.IsPlayer).Select(o => o.Name)); + } + + var own = session?.Character?.Name ?? (key is not null && IsDemoKey(key) ? "Corvid" : null); + if (own is not null && !present.Contains(own, StringComparer.OrdinalIgnoreCase)) + { + present.Insert(0, own); + } + + var title = WindowTitle(windowId); + SceneLog log; + try + { + log = SceneLog.Start( + Path.Combine(_logRoot, "scenes"), + windowId, + title, + _config.SceneLog.Html, + _config.SceneLog.Content, + present, + _time.GetLocalNow()); + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) + { + RefuseCommand($"the scene log could not be opened: {ex.Message}"); + return; + } + + lock (_sceneLogs) + { + _sceneLogs[windowId] = log; + } + + Notice( + $"Recording {Snippet(title)} as a scene ({(_config.SceneLog.Content == SceneLogContent.Poses ? "poses" : "every line")}) → {log.Path}", + MessageSeverity.Info, + "⌃P"); + } + + /// Stops the focused window's scene log, writing its ending and closing the file. + internal void StopSceneLog() + { + var windowId = ActiveWindowId(); + SceneLog? log; + lock (_sceneLogs) + { + _sceneLogs.Remove(windowId, out log); + } + + if (log is null) + { + RefuseCommand($"{Snippet(WindowTitle(windowId))} is not being recorded"); + return; + } + + log.Stop(_time.GetLocalNow()); + Notice($"Scene saved · {log.Lines} line{(log.Lines == 1 ? string.Empty : "s")} · {log.Path}", MessageSeverity.Info, "⌃P"); + } + + /// A line a window showed: the scene recording that window, if any, decides whether to keep it. + private void RecordForScene(string windowId, StyledLine line) + { + SceneLog? log; + lock (_sceneLogs) + { + if (_sceneLogs.Count == 0 || !_sceneLogs.TryGetValue(windowId, out log)) + { + return; + } + } + + try + { + log.Offer(line); + } + catch (Exception ex) when (ex is IOException or ObjectDisposedException) + { + lock (_sceneLogs) + { + _sceneLogs.Remove(windowId); + } + + RefuseCommand($"the scene log stopped: {ex.Message}"); + } + } + + /// Closes every scene being recorded, on the way out. + private void CloseSceneLogs() + { + SceneLog[] logs; + lock (_sceneLogs) + { + logs = [.. _sceneLogs.Values]; + _sceneLogs.Clear(); + } + + foreach (var log in logs) + { + log.Stop(_time.GetLocalNow()); + } + } + + // ── demo scenes ────────────────────────────────────────────────────────────────────────────────── + + /// + /// The snapshot scenes for channel capture, highlight names and the scene log, over the demo. The demo has no live + /// session, so a channel message goes through and the routing a captured line + /// takes (, ), and a name through + /// : the functions the session runs. Returns a frame for a view drawn here alone, + /// else null to go on drawing the workspace. + /// + private string? RenderScriptingWaveScene(string? view) + { + if (view is null || _config.Worlds.Count == 0) + { + return null; + } + + var world = _config.Worlds[0]; + var names = new List { new("Ashlyn", "gold"), new("Merrow", "red") }; + if (string.Equals(view, "channels-f5", StringComparison.OrdinalIgnoreCase)) + { + world.CaptureChannels = ChannelCaptureMode.Copy; + world.HighlightNames = names; + _settings.OpenForSnapshot(ConsoleKey.F5, WorldsScreen()); + + // Edit the world and ⇥ through its fields to the names row, so the frame shows the two new rows rather + // than "19 more" — the keys a reader presses. + _settings.SimulateKey(Stroke('\r', ConsoleKey.Enter)); + for (var i = 0; i < WorldsScreenRenderer.WorldFieldOrder.ToList().IndexOf("highlight-names"); i++) + { + _settings.SimulateKey(Stroke('\t', ConsoleKey.Tab)); + } + + SyncInputWidth(); + return RenderFrame(); + } + + if (string.Equals(view, "highlight-names", StringComparison.OrdinalIgnoreCase)) + { + world.HighlightNames = names; + var matcher = NameHighlights.Compile(names); + foreach (var text in new[] + { + "Ashlyn sips her tea and glances across the plaza at Merrow.", + "Merrow says, \"Ashlyn's late again.\" Annabel laughs.", + "Brannoc nods to Ashlyn, Merrow and you.", + }) + { + AppendSessionLine(MainWindowId, NameHighlights.Apply(StyledLine.FromText(text, TextStyle.Default), matcher), StampNow()); + } + + SettleScroll(); + return null; + } + + if (string.Equals(view, "channel-capture", StringComparison.OrdinalIgnoreCase)) + { + world.CaptureChannels = ChannelCaptureMode.Copy; + string? oocId = null; + foreach (var json in DemoChannelMessages) + { + if (ChannelCapture.Read(json) is not { } message) + { + continue; + } + + foreach (var line in message.Lines) + { + var window = _workspace.RouteLine(message.Window, DemoScene.ActiveSessionKey); + window.OwnerLabel ??= "Corvid"; + PaneContentFor(window.Id, window.Title); + AppendSessionLine(window.Id, line, StampNow()); + AppendSessionLine(MainWindowId, line, StampNow()); + if (message.Window == "ooc") + { + oocId = window.Id; + } + } + } + + if (oocId is not null) + { + Activate(MainWindowId); + PaneCommands.Apply(_workspace.Layout, PaneCommand.SplitRight); + RebuildPaneArea(); + Activate(oocId); + } + + SettleScroll(); + return null; + } + + if (string.Equals(view, "scene-log", StringComparison.OrdinalIgnoreCase)) + { + OpenMenu("scene"); + } + + return null; + } + + /// Four Comm.Channel.Text payloads as IRE sends them, for the channel-capture scene. + private static readonly string[] DemoChannelMessages = + [ + "{\"channel\":\"ooc\",\"talker\":\"Ashlyn\",\"text\":\"\\u001b[36m(OOC) Ashlyn: anyone up for a scene at the docks?\\u001b[0m\"}", + "{\"channel\":\"ooc\",\"talker\":\"Merrow\",\"text\":\"\\u001b[36m(OOC) Merrow: in ten, grabbing tea\\u001b[0m\"}", + "{\"channel\":\"trade\",\"talker\":\"Brannoc\",\"text\":\"\\u001b[33m[Trade] Brannoc: selling lanterns, 4 silver\\u001b[0m\"}", + "{\"channel\":\"ooc\",\"talker\":\"Ashlyn\",\"text\":\"\\u001b[36m(OOC) Ashlyn: \\u001b[1msee you there\\u001b[0m\"}", + ]; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs new file mode 100644 index 00000000..6043d86b --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs @@ -0,0 +1,423 @@ +using System.Text.Json.Nodes; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Scripting; + +namespace SharpMUTerm.Tui; + +/// +/// The script console (⌃P ▸ Script console): one per character, holding what its scripts printed and the errors +/// they raised (with file:line), a one-line Lua prompt run in that character's own sandbox, what was typed there, +/// and a read-only view of its store.* with delete. One Client model () drawn as a +/// cell here and as a native modal in a host that has them; every gesture ends in +/// , or . +/// +/// A line runs on the UI thread, through the host's lock, and is time-limited (: +/// two million instructions or half a second), so a loop typed at the prompt cannot hang the screen. The prompt exists +/// only where scripts can run — a client with a scripts root, whose folder exists, and a window with a character — +/// and otherwise says which of those is missing. +/// +/// +/// The console's lines are in memory for the run, per character (), fed from +/// and on whichever thread a script ran; nothing is saved. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// Each character's console lines and prompt history, by session key. + private readonly Dictionary _consoleLogs = new(StringComparer.Ordinal); + + /// The cell console while it is open; null otherwise. + private ScriptConsoleSurface? _console; + + /// The character the open console (either host) belongs to. + private string? _consoleKey; + + /// A console repaint is already queued, so a script printing a thousand lines queues one. + private int _consoleRefreshQueued; + + /// The demo's sandbox, so the snapshot's console has a prompt that runs. + private (ScriptHost Host, ScriptStore Store)? _demoScripts; + + /// Whether the script console is open, in cells or natively. + internal bool ScriptConsoleIsOpen => + (_helpView.IsOpen && _helpView.Mode == "script-console") || NativeModalOf(SurfaceCatalog.ScriptConsole) is not null; + + /// The cell console's state, for a test; null while it is shut. + internal ScriptConsoleSurface? CellConsole => _helpView.IsOpen && _helpView.Mode == "script-console" ? _console : null; + + /// The native console's session while one is open, for the tests. + internal ScriptConsoleSession? NativeConsole => _nativeModal as ScriptConsoleSession; + + /// What the cell console shows, for a test. + internal IReadOnlyList ConsoleLines => _helpView.Mode == "script-console" ? _helpView.Lines : []; + + /// Feeds a key to the cell console. + internal void SimulateConsoleKey(ConsoleKeyInfo key) => _helpView.SimulateKey(key); + + /// Types at the cell console's prompt. + internal void SimulateConsoleTyping(string text) + { + foreach (var c in text) + { + SimulateConsoleKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + } + + /// A character's console log, made on first use. + private ScriptConsoleLog ConsoleLog(string key) + { + lock (_consoleLogs) + { + if (!_consoleLogs.TryGetValue(key, out var log)) + { + log = new ScriptConsoleLog(); + log.Changed += () => QueueConsoleRefresh(key); + _consoleLogs[key] = log; + } + + return log; + } + } + + /// What the console acts on: a character's scripts, the demo's sandbox, or why there is nothing. + private sealed record ConsoleTarget( + string Key, + string Title, + Func Evaluate, + ScriptStore Store, + IReadOnlyList Files, + int Loaded, + Func Reload); + + /// The focused window's character's scripts, or why there are none to talk to. + private (ConsoleTarget? Target, string Key, string Title, string? Why) ConsoleTargetNow() + { + var session = SendTarget(); + if (session is null && _workspace.FindWindow(ActiveWindowId())?.SessionKey is { } owner && IsDemoKey(owner)) + { + var (host, store) = _demoScripts ??= NewDemoScripts(); + return (new ConsoleTarget("demo", "Corvid", line => host.EvaluateConsole(line), store, ["corvid.lua"], 1, () => "1 script loaded"), + "demo", "Corvid", null); + } + + if (session is null) + { + return (null, string.Empty, string.Empty, "this window has no character — pick one first (⌃P ▸ Switch to …)"); + } + + var title = SessionTitle(session); + if (_scriptsRoot is null || !_scripts.TryGetValue(session, out var scripts)) + { + return (null, session.SessionKey, title, "this client runs no scripts"); + } + + if (!Directory.Exists(_scriptsRoot)) + { + return (null, session.SessionKey, title, $"there is no scripts folder yet — create {_scriptsRoot} and put .lua files in it"); + } + + return (new ConsoleTarget( + session.SessionKey, + title, + scripts.Evaluate, + scripts.Store, + scripts.Files, + scripts.LoadedCount, + () => + { + scripts.Reload(); + return ScriptsLoaded(scripts); + }), + session.SessionKey, title, null); + } + + /// The console's model for the focused window's character, as it stands now. + internal ScriptConsoleModel ScriptConsoleModelNow() + { + var (target, key, title, why) = ConsoleTargetNow(); + var log = key.Length == 0 ? null : ConsoleLog(key); + var store = new List(); + var count = 0; + if (target is not null) + { + var keys = target.Store.Keys; + count = keys.Count; + foreach (var name in keys.Take(ScriptConsoleModel.MaxStoreRows)) + { + var value = target.Store.Get(name)?.ToJsonString() ?? "null"; + store.Add(new ScriptStoreEntry(name, value.Length > ScriptConsoleModel.MaxValueLength + ? value[..(ScriptConsoleModel.MaxValueLength - 1)] + "…" + : value)); + } + } + + return new ScriptConsoleModel( + title, + why, + log?.Lines ?? [], + log?.History ?? [], + store, + count, + target?.Files ?? [], + target?.Loaded ?? 0, + _scriptsRoot ?? (target is not null ? "scripts/" : null)); + } + + /// ⌃P ▸ Script console: opens the focused window's character's console, or closes it. + private void ShowScriptConsole() + { + if (NativeModalOf(SurfaceCatalog.ScriptConsole) is { } native) + { + CloseNativeModal(native); + return; + } + + if (ScriptConsoleIsOpen) + { + _helpView.Close(); + return; + } + + if (ComposerIsInTheWay("the script console") || (AnyOverlayOpen && Refuse($"close {OpenOverlayName()} first"))) + { + return; + } + + var model = ScriptConsoleModelNow(); + _consoleKey = ConsoleTargetNow().Key; + if (NativeModalsHost is { } host) + { + ScriptConsoleSession? session = null; + session = new ScriptConsoleSession( + model, + ThemeIsDark(), + line => OnUiThread(() => RunConsoleLine(line)), + key => OnUiThread(() => DeleteStoreKey(key)), + () => OnUiThread(ReloadConsoleScripts), + () => OnUiThread(() => + { + NativeModalClosed(session!); + _consoleKey = null; + })) + { + Theme = _theme.Clone(), + }; + ShowNativeModal(host, session); + return; + } + + var console = new ScriptConsoleSurface(model); + _console = console; + var rows = Math.Clamp(_system.DesktopDimensions.Height - 6, 10, 30); + _helpView.Open( + "script-console", + "Script console", + width => + { + Drawing(SurfaceCatalog.ScriptConsole, string.Empty, console.Model); + return console.Render(width, rows); + }, + ConsoleKeyPressed, + width: ScriptConsoleSurface.PreferredWidth, + closed: () => + { + _console = null; + _consoleKey = null; + }); + } + + /// A key in the cell console. + private bool ConsoleKeyPressed(ConsoleKeyInfo key) + { + if (_console is not { } console) + { + return false; + } + + switch (console.Key(key)) + { + case ScriptConsoleSurface.Ask.Run: + var line = console.Input; + console.Ran(); + RunConsoleLine(line); + break; + case ScriptConsoleSurface.Ask.Delete when console.PickedKey is { } picked: + DeleteStoreKey(picked); + break; + case ScriptConsoleSurface.Ask.Reload: + ReloadConsoleScripts(); + break; + } + + return true; + } + + /// + /// The one place a console line is run, from either host: written to the console, evaluated in the character's + /// sandbox under its lock with a limit, and its value or error written after whatever it printed. + /// + internal void RunConsoleLine(string line) + { + if (string.IsNullOrWhiteSpace(line)) + { + return; + } + + var (target, _, _, why) = ConsoleTargetNow(); + if (target is null) + { + RefuseCommand(why ?? "no scripts to run here"); + return; + } + + var log = ConsoleLog(target.Key); + log.Remember(line); + log.Add(ScriptConsoleKind.Input, line); + var result = target.Evaluate(line); + if (result.Error is { } error) + { + log.Add(ScriptConsoleKind.Error, error); + } + else if (result.Value is { } value) + { + log.Add(ScriptConsoleKind.Result, value); + } + + RefreshConsole(); + } + + /// Deletes a store.* key of the focused window's character, from either host. + internal void DeleteStoreKey(string key) + { + var (target, _, _, why) = ConsoleTargetNow(); + if (target is null) + { + RefuseCommand(why ?? "no store here"); + return; + } + + if (target.Store.Set(key, (JsonNode?)null) is { } refusal) + { + RefuseCommand(refusal); + return; + } + + ConsoleLog(target.Key).Add(ScriptConsoleKind.Note, $"deleted store key {key}"); + RefreshConsole(); + } + + /// Reloads the focused window's character's scripts from the console, from either host. + internal void ReloadConsoleScripts() + { + var (target, _, _, why) = ConsoleTargetNow(); + if (target is null) + { + RefuseCommand(why ?? "no scripts to reload"); + return; + } + + var said = target.Reload(); + ConsoleLog(target.Key).Add(ScriptConsoleKind.Note, $"reloaded · {said}"); + RefreshConsole(); + } + + /// A script printed a line or failed: the character's console keeps a copy. Any thread. + private void NoteConsole(WorldSession session, ScriptConsoleKind kind, string text) => + ConsoleLog(session.SessionKey).Add(kind, text); + + private void QueueConsoleRefresh(string key) + { + if (_consoleKey != key || Interlocked.Exchange(ref _consoleRefreshQueued, 1) == 1) + { + return; + } + + OnUiThread(() => + { + Interlocked.Exchange(ref _consoleRefreshQueued, 0); + RefreshConsole(); + }); + } + + /// Redraws whichever console is open from a fresh model. + private void RefreshConsole() + { + if (!ScriptConsoleIsOpen) + { + return; + } + + var model = ScriptConsoleModelNow(); + if (NativeModalOf(SurfaceCatalog.ScriptConsole) is ScriptConsoleSession native) + { + native.Publish(model); + return; + } + + if (_console is { } console) + { + console.Model = model; + console.Clamp(); + _helpView.Repaint(); + } + } + + /// The demo's sandbox: a host over nothing, a store with a few keys, and a few lines already printed. + private (ScriptHost, ScriptStore) NewDemoScripts() + { + var log = ConsoleLog("demo"); + var store = new ScriptStore(null); + var host = new ScriptHost(new DemoScriptWorld(text => log.Add(ScriptConsoleKind.Output, text)), store); + store.Set("kills", JsonValue.Create(42)); + store.Set("friends", new JsonArray("Ashlyn", "Merrow")); + store.Set("last_room", JsonValue.Create("The Grand Plaza")); + log.Add(ScriptConsoleKind.Note, "loaded corvid.lua"); + log.Add(ScriptConsoleKind.Output, "[info] corvid.lua: watching for tells"); + log.Add(ScriptConsoleKind.Error, "corvid.lua:(14,8-12): attempt to index a nil value (field 'vitals')"); + return (host, store); + } + + /// What the demo's scripts act on: nothing but the console. + private sealed class DemoScriptWorld(Action print) : IScriptWorld + { + public string WorldName => "Aetherfall"; + + public void Send(string command) => print($"(demo) would send: {command}"); + + public void Print(string text) => print(text); + + public void AddTrigger(string pattern, string callbackId) + { + } + + public void AddAlias(string pattern, string substitution, string callbackId) + { + } + + public IDisposable ScheduleEvery(TimeSpan interval, Action callback) => new Nothing(); + + public IDisposable ScheduleAfter(TimeSpan delay, Action callback) => new Nothing(); + + public JsonNode? GameData(string path) => null; + + public void SendGmcp(string package, string json) + { + } + + public ScriptRoom? CurrentRoom() => new(1, "The Grand Plaza", "Aetherfall"); + + public IReadOnlyList? PathTo(string target) => null; + + public string? WalkTo(string target) => "the demo keeps no map"; + + private sealed class Nothing : IDisposable + { + public void Dispose() + { + } + } + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index aac90e75..31b8e4cb 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1888,6 +1888,32 @@ public string RenderSnapshot(string? view = null) ShowHelp(topic: "reading"); } + // The script console, through its ⌃P entry, over the demo's own sandbox: a value, a print, a store read and a loop + // the limit stopped, run through the console's one path before it opens. + if (string.Equals(view, "script-console", StringComparison.OrdinalIgnoreCase)) + { + RunConsoleLine("store.get('kills') + 1"); + RunConsoleLine("print('hello from ' .. world.name)"); + RunConsoleLine("map.current().name"); + RunConsoleLine("while true do end"); + DispatchCommand(SharpMUTerm.Client.Commands.BuiltInCommands.ScriptConsoleCommand); + if (CellConsole is { } console) + { + foreach (var c in "store.keys()") + { + console.Key(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + _helpView.Repaint(); + } + } + + // GMCP channel capture, the highlight-names list and a scene log, over the demo (scripting wave). + if (RenderScriptingWaveScene(view) is { } scriptingFrame) + { + return scriptingFrame; + } + // The spelling dictionary offer, through its ⌃P entry. The demo keeps no dictionaries folder, so the offer says // nothing can be saved in this run — the text a live client shows names the folder instead. if (string.Equals(view, "dictionary-offer", StringComparison.OrdinalIgnoreCase)) @@ -5046,6 +5072,7 @@ private void OnLine(WorldSession session, string windowId, StyledLine line) var stamp = StampNow(); AppendSessionLine(windowId, line, stamp); RecordForRestore(session, windowId, WindowTitle(windowId), line, stamp); + RecordForScene(windowId, line); AnnounceLine(windowId, line.Text); NoteUnseenLine(); @@ -5107,6 +5134,7 @@ private void OnSpawnLine(WorldSession session, string target, StyledLine line) var stamp = StampNow(); AppendSessionLine(window.Id, line, stamp); RecordForRestore(session, window.Id, window.Title, line, stamp); + RecordForScene(window.Id, line); AnnounceLine(window.Id, line.Text); NoteUnseenLine(); @@ -5750,7 +5778,7 @@ private string OpenOverlayName() => : _search.IsOpen ? "the search surface" : _prefixPanel.IsOpen ? "the pane keys panel" : _welcomeView.IsOpen ? "the welcome" - : _helpView.IsOpen ? (_helpView.Mode == "dictionary" ? "the dictionary offer" : "help") + : _helpView.IsOpen ? (_helpView.Mode == "dictionary" ? "the dictionary offer" : _helpView.Mode == "script-console" ? "the script console" : "help") : "what is open"; /// Whether either bar is holding unsent text — what the ✎ tab marker means. @@ -8408,7 +8436,8 @@ private CommandContext CommandState() KeyClashes: KeyClashes.Count(Host.Keys, Macros()), Floats: FloatRefs(), RaggedWraps: RaggedWraps(), - NoDictionary: NoOwnDictionary); + NoDictionary: NoOwnDictionary, + SceneLogging: _sceneLogs.ContainsKey(ActiveWindowId())); } /// @@ -8935,6 +8964,15 @@ private bool RunBuiltInCommand(string id) case "world:reload-scripts": ReloadScripts(); break; + case Client.Commands.BuiltInCommands.ScriptConsoleCommand: + ShowScriptConsole(); + break; + case Client.Commands.BuiltInCommands.SceneStartCommand: + StartSceneLog(); + break; + case Client.Commands.BuiltInCommands.SceneStopCommand: + StopSceneLog(); + break; default: // On the status line, never through _active: an unwired command is exactly what you hit // while nothing is connected, and a message that needs a session to be seen cannot @@ -9008,6 +9046,7 @@ private void OnSessionAdded(object? sender, WorldSession session) } var scripts = new SessionScripts(session, _scriptsRoot, text => ReportScript(session, text), _packages.ResolveScript, _scriptStoreRoot, ScriptSendTo); + scripts.Printed += text => NoteConsole(session, Client.Modals.ScriptConsoleKind.Output, text); _scripts[session] = scripts; scripts.Reload(); } @@ -9348,6 +9387,7 @@ private void MapCommand(string windowId, string verb, string argument) private void ReportScript(WorldSession session, string text) { session.PrintSystem($"*** {text}"); + NoteConsole(session, Client.Modals.ScriptConsoleKind.Error, text); OnUi(() => Notice($"{SessionTitle(session)}: {text}")); } @@ -14363,6 +14403,7 @@ public async ValueTask DisposeAsync() } _reconnects.Clear(); + CloseSceneLogs(); // a scene being recorded is closed with its ending written _webImageCts?.Cancel(); _webImageCts?.Dispose(); _inlineImages.Dispose(); diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 0d3c5a09..1857ddca 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -29,5 +29,6 @@ internal static class SnapshotViews "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "join-wraps", "join-wraps-f5", + "script-console", "channel-capture", "highlight-names", "channels-f5", "scene-log", ]; } diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index b3dceab3..b187f2fe 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -113,6 +113,15 @@ internal static class WorldsScreenRenderer /// , as one of . internal const int AlertOnField = 19; + /// , as one of . + internal const int CaptureChannelsField = 20; + + /// : Name=colour, …. + internal const int HighlightNamesField = 21; + + /// F5's words for . + internal static readonly IReadOnlyList ChannelCaptureChoices = WorldFieldValues.ChannelCaptureChoices; + /// F5's words for . internal static readonly IReadOnlyList ReconnectChoices = WorldFieldValues.ReconnectChoices; @@ -771,7 +780,7 @@ .. SecurityFieldOrder.Select(id => ScreenRow.Of(DeclaredFields.Toggle(DeclaredFi [ "name", "host", "port", "encoding", "keepalive", "gmcp-modules", "content", "emoji", "map-room", "map-exits", "walk-fail", "sounds", "edit-grab", "gmcp-login", "discord", "layout", "join-wraps", "reconnect", "stacking", - "alert-on", + "alert-on", "capture-channels", "highlight-names", ]; /// The world's two security checkboxes, drawn in the WORLD block (), by declared id. @@ -1090,6 +1099,23 @@ world.CommandSeparator is { } separator cursor, selectedWorld, AlertOnField)), + WorldField("channels", Field( + world.CaptureChannels switch + { + SharpMUTerm.Core.Protocols.ChannelCaptureMode.Copy => $"[{Value}]{ChannelCaptureChoices[1]} · a window per GMCP channel[/]", + SharpMUTerm.Core.Protocols.ChannelCaptureMode.Move => $"[{Value}]{ChannelCaptureChoices[2]} · out of the main window[/]", + _ => $"[{Label}]{ChannelCaptureChoices[0]} · channels stay in the main window[/]", + }, + cursor, + selectedWorld, + CaptureChannelsField)), + WorldField("names", Field( + SharpMUTerm.Core.Automation.NameHighlights.Format(world.HighlightNames) is { } names + ? $"[{Value}]{Escape(names)}[/]" + : $"[{Label}]none · e.g. Ashlyn=gold, Merrow=red[/]", + cursor, + selectedWorld, + HighlightNamesField)), string.Empty, $"[{accent}]├ CHARACTERS[/] [{Label}]a character is a connection[/]", }); diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 5fb69eba..72a9609e 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -258,6 +258,7 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! (SurfaceCatalog.Welcome, "welcome-connect"), (SurfaceCatalog.Help, "help"), (SurfaceCatalog.Dictionary, "dictionary-offer"), + (SurfaceCatalog.ScriptConsole, "script-console"), }) { using var nativeDriver = new AvaloniaConsoleDriver(140, 36); @@ -713,6 +714,24 @@ await SameModal("dictionary: download", "dictionary-offer", app => app.SimulateHelpKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); probed.Add(SurfaceCatalog.Dictionary); + // The script console: a line run at the prompt, a store key deleted, and the scripts reloaded — each through the + // session in the window and through the cell console's keys, ending in RunConsoleLine, DeleteStoreKey and + // ReloadConsoleScripts. The scene leaves "store.keys()" typed at the cell prompt. + await SameModal("script console: run", "script-console", + (app, m) => ((ScriptConsoleSession)m.Open(SurfaceCatalog.ScriptConsole)!).Run("store.keys()"), + app => app.SimulateConsoleKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); + await SameModal("script console: delete key", "script-console", + (app, m) => ((ScriptConsoleSession)m.Open(SurfaceCatalog.ScriptConsole)!).Delete("kills"), + app => + { + app.SimulateConsoleKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false)); + app.SimulateConsoleKey(new ConsoleKeyInfo('\0', ConsoleKey.Delete, false, false, false)); + }); + await SameModal("script console: reload", "script-console", + (app, m) => ((ScriptConsoleSession)m.Open(SurfaceCatalog.ScriptConsole)!).Reload(), + app => app.SimulateConsoleKey(new ConsoleKeyInfo('\f', ConsoleKey.L, false, false, true))); + probed.Add(SurfaceCatalog.ScriptConsole); + var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); // The tab overflow chip: an entry chosen from the window's menu and the same digit in the cell list bring the same // hidden tab forward. @@ -962,6 +981,7 @@ private static void HelpKeysTo(SharpMUTermApp app, Func match) WelcomeSession welcome => welcome.Model, HelpSession help => help.Model, DictionaryOfferSession offer => offer.Model, + ScriptConsoleSession console => console.Model, _ => throw new ArgumentException(session.GetType().Name), }; @@ -983,6 +1003,7 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "layout=" + app.LiveLayoutId, "welcome=" + app.WelcomeIsOpen, "help=" + app.HelpIsOpen + "/" + app.DictionaryOfferOpen, + "console=" + app.ScriptConsoleIsOpen + " " + ConsoleState(app), "quick=" + app.LastQuickMacro, "walk=" + app.WalkState, "rail=" + (app.BuildChromeOverlay().Sidebar.Collapsed ? "folded" : "open"), @@ -990,6 +1011,12 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "notice=" + app.LastNotice, "recent=" + string.Join(",", app.RecentCommandIds)); + private static string ConsoleState(SharpMUTermApp app) + { + var model = app.ScriptConsoleModelNow(); + return $"[{string.Join(";", model.Lines.Select(l => l.Kind + ":" + l.Text))}] [{string.Join(",", model.Store.Select(e => e.Key))}]"; + } + private static string Layouts(SharpMUTermApp app) { var model = app.LayoutsModelFor(DemoScene.ActiveSessionKey); diff --git a/tests/SharpMUTerm.Core.Tests/Session/ChannelsAndNamesTests.cs b/tests/SharpMUTerm.Core.Tests/Session/ChannelsAndNamesTests.cs new file mode 100644 index 00000000..44a66792 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Session/ChannelsAndNamesTests.cs @@ -0,0 +1,156 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Logging; +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Tests.Session; + +/// GMCP channel capture, the highlight-names list and the scene log. +public class ChannelsAndNamesTests +{ + private static (WorldSession Session, FakeTelnetSession Telnet) Create(WorldDefinition world) + { + var telnet = new FakeTelnetSession(); + return (new WorldSession(world, sessionFactory: _ => telnet), telnet); + } + + private static WorldDefinition World() => new() { Name = "T", Host = "h", Port = 1 }; + + private const string Ooc = """{"channel":"ooc","talker":"Ashlyn","text":"\u001b[36m(OOC) Ashlyn: hello all\u001b[0m"}"""; + + [Test] + public async Task ChannelTextIsNotCapturedUnlessTheWorldSaysSo() + { + var (session, telnet) = Create(World()); + var spawned = new List(); + session.SpawnLine += (_, e) => spawned.Add(e); + await session.ConnectAsync(); + telnet.EmitGmcp("Comm.Channel.Text", Ooc); + await Assert.That(spawned).IsEmpty(); + } + + [Test] + public async Task CopyPutsTheChannelInItsWindowAndKeepsTheMainLine() + { + var world = World(); + world.CaptureChannels = ChannelCaptureMode.Copy; + var (session, telnet) = Create(world); + var spawned = new List(); + var printed = new List(); + session.SpawnLine += (_, e) => spawned.Add(e); + session.LinePrinted += (_, l) => printed.Add(l.Text); + await session.ConnectAsync(); + + telnet.EmitGmcp("Comm.Channel.Text", Ooc); + telnet.EmitLine("(OOC) Ashlyn: hello all"); + + await Assert.That(spawned).HasSingleItem(); + await Assert.That(spawned[0].Target).IsEqualTo("ooc"); + await Assert.That(spawned[0].Line.Text).IsEqualTo("(OOC) Ashlyn: hello all"); + await Assert.That(spawned[0].Line.Spans[0].Style.Foreground == TerminalColor.Default).IsFalse(); + await Assert.That(printed).Contains("(OOC) Ashlyn: hello all"); + } + + [Test] + public async Task MoveKeepsTheEchoOutOfTheMainWindowOnce() + { + var world = World(); + world.CaptureChannels = ChannelCaptureMode.Move; + var (session, telnet) = Create(world); + var printed = new List(); + session.LinePrinted += (_, l) => printed.Add(l.Text); + await session.ConnectAsync(); + + telnet.EmitGmcp("Comm.Channel.Text", Ooc); + telnet.EmitLine("(OOC) Ashlyn: hello all"); + telnet.EmitLine("(OOC) Ashlyn: hello all"); + + await Assert.That(printed.Count(p => p == "(OOC) Ashlyn: hello all")).IsEqualTo(1); + } + + [Test] + public async Task AChannelNameIsMadeSafeForATitle() + { + await Assert.That(ChannelCapture.WindowName("ooc:\u001b[1m/../x")).IsEqualTo("ooc1mx"); + await Assert.That(ChannelCapture.Read("""{"channel":"","text":"x"}""")).IsNull(); + await Assert.That(ChannelCapture.Read("not json")).IsNull(); + await Assert.That(ChannelCapture.Read("""{"channel":"ooc"}""")).IsNull(); + } + + [Test] + public async Task ListedNamesAreHighlightedAsWholeWords() + { + var world = World(); + world.HighlightNames = [new NameHighlight("Ann", "red")]; + var (session, telnet) = Create(world); + StyledLine? printed = null; + session.LinePrinted += (_, l) => printed = l; + await session.ConnectAsync(); + + telnet.EmitLine("Annabel waves to Ann."); + + WebColors.TryParse("red", out var red); + var spans = printed!.Spans; + await Assert.That(spans.Any(s => s.Text == "Ann" && s.Style.Foreground == red)).IsTrue(); + await Assert.That(spans.Any(s => s.Text.Contains("Annabel") && s.Style.Foreground == red)).IsFalse(); + } + + [Test] + public async Task TheListParsesAndFormats() + { + var (names, error) = NameHighlights.Parse("Ashlyn=gold; Merrow : red, Vale"); + await Assert.That(error).IsNull(); + await Assert.That(names.Select(n => n.Name)).IsEquivalentTo(["Ashlyn", "Merrow", "Vale"]); + await Assert.That(names[2].Colour).IsEqualTo(NameHighlights.DefaultColour); + await Assert.That(NameHighlights.Format(names)).IsEqualTo("Ashlyn, Merrow=red, Vale"); + await Assert.That(NameHighlights.Parse("Ann=notacolour").Error).IsNotNull(); + await Assert.That(NameHighlights.Parse("").Names).IsEmpty(); + } + + [Test] + public async Task ASceneLogKeepsPosesAndNamesWhoWasPresent() + { + var folder = Directory.CreateTempSubdirectory("smt-scene-"); + try + { + var log = SceneLog.Start(folder.FullName, "main", "Tea at the Plaza", html: false, SceneLogContent.Poses, ["Ashlyn", "Corvid"], DateTimeOffset.Now); + await Assert.That(log.Offer(StyledLine.FromText("Ashlyn sips her tea.", TextStyle.Default))).IsTrue(); + await Assert.That(log.Offer(StyledLine.FromText("The Grand Plaza", TextStyle.Default))).IsFalse(); + await Assert.That(log.Offer(StyledLine.FromText("Merrow says, \"Hello.\"", TextStyle.Default))).IsTrue(); + log.Stop(DateTimeOffset.Now); + + var text = File.ReadAllText(log.Path); + await Assert.That(Path.GetFileName(log.Path)).StartsWith("scene-tea-at-the-plaza-"); + await Assert.That(text).Contains("Present: Ashlyn, Corvid"); + await Assert.That(text).Contains("Ashlyn sips her tea."); + await Assert.That(text).DoesNotContain("The Grand Plaza"); + await Assert.That(text).Contains("posed: Ashlyn, Merrow"); + } + finally + { + folder.Delete(recursive: true); + } + } + + [Test] + public async Task ASceneLogInHtmlKeepsEveryLineWhenAsked() + { + var folder = Directory.CreateTempSubdirectory("smt-scene-"); + try + { + var log = SceneLog.Start(folder.FullName, "main", "Scene", html: true, SceneLogContent.Everything, [], DateTimeOffset.Now); + log.Offer(StyledLine.FromText("The Grand Plaza", TextStyle.Default)); + log.Stop(DateTimeOffset.Now); + var text = File.ReadAllText(log.Path); + await Assert.That(log.Path).EndsWith(".html"); + await Assert.That(text).Contains("The Grand Plaza"); + await Assert.That(text).Contains("Present: nobody"); + } + finally + { + folder.Delete(recursive: true); + } + } +} diff --git a/tests/SharpMUTerm.Scripting.Tests/ConsoleTests.cs b/tests/SharpMUTerm.Scripting.Tests/ConsoleTests.cs new file mode 100644 index 00000000..34afc8b2 --- /dev/null +++ b/tests/SharpMUTerm.Scripting.Tests/ConsoleTests.cs @@ -0,0 +1,85 @@ +namespace SharpMUTerm.Scripting.Tests; + +public class ConsoleTests +{ + [Test] + public async Task AnExpressionComesBackAsItsValue() + { + using var host = new ScriptHost(new FakeScriptWorld()); + var result = host.EvaluateConsole("1 + 2"); + await Assert.That(result.Error).IsNull(); + await Assert.That(result.Value).IsEqualTo("3"); + } + + [Test] + public async Task AStatementRunsAndReturnsNothing() + { + var world = new FakeScriptWorld(); + using var host = new ScriptHost(world); + var result = host.EvaluateConsole("x = 4; print('x is', x)"); + await Assert.That(result.Error).IsNull(); + await Assert.That(result.Value).IsNull(); + await Assert.That(world.Printed).Contains("x is\t4"); + await Assert.That(host.EvaluateConsole("x * 2").Value).IsEqualTo("8"); + } + + [Test] + public async Task StringsAndTablesAreShownReadably() + { + using var host = new ScriptHost(new FakeScriptWorld()); + await Assert.That(host.EvaluateConsole("'hi'").Value).IsEqualTo("\"hi\""); + await Assert.That(host.EvaluateConsole("{a = 1}").Value).IsEqualTo("{ a = 1 }"); + await Assert.That(host.EvaluateConsole("1, 'two'").Value).IsEqualTo("1\t\"two\""); + } + + [Test] + public async Task AnErrorIsReturnedWithItsLine() + { + using var host = new ScriptHost(new FakeScriptWorld()); + var result = host.EvaluateConsole("error('boom')"); + await Assert.That(result.Value).IsNull(); + await Assert.That(result.Error!).Contains("boom"); + await Assert.That(result.Error!).Contains("console"); + } + + [Test] + public async Task ALoopThatNeverEndsIsStopped() + { + using var host = new ScriptHost(new FakeScriptWorld()); + var clock = System.Diagnostics.Stopwatch.StartNew(); + var result = host.EvaluateConsole("while true do end", instructionLimit: 200_000); + await Assert.That(result.Error!).Contains("stopped after"); + await Assert.That(clock.Elapsed).IsLessThan(TimeSpan.FromSeconds(5)); + + // The host is still usable afterwards. + await Assert.That(host.EvaluateConsole("2 * 21").Value).IsEqualTo("42"); + } + + [Test] + public async Task ALoopIsStoppedByTimeToo() + { + using var host = new ScriptHost(new FakeScriptWorld()); + var result = host.EvaluateConsole( + "local n = 0 while true do n = n + 1 end", instructionLimit: long.MaxValue, timeLimit: TimeSpan.FromMilliseconds(50)); + await Assert.That(result.Error!).Contains("ms"); + } + + [Test] + public async Task AFilesErrorNamesTheFileAndLine() + { + var dir = Directory.CreateTempSubdirectory("smt-console-"); + try + { + var path = Path.Combine(dir.FullName, "broken.lua"); + File.WriteAllText(path, "local a = 1\nlocal b = nil\nreturn b.c\n"); + using var host = new ScriptHost(new FakeScriptWorld()); + var ex = Assert.Throws(() => host.LoadFile(path)); + await Assert.That(ex!.Message).Contains("broken.lua"); + await Assert.That(ex.Line).IsEqualTo(3); + } + finally + { + dir.Delete(recursive: true); + } + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs index 7579773e..dcdeda2b 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenModelTests.cs @@ -374,9 +374,10 @@ public async Task Options_NavigableRowsSkipSectionHeadersAndSpacers() // The THEME group on top adds thirteen rows and three stops: its heading and spacer, a row per built-in // theme, and the preview's caption and seven rows, which are drawn and never a stop. // ALERTS adds three rows and one stop: its heading, its spacer and `alert when away`. - await Assert.That(screen.Rows.Count).IsEqualTo(42); + // SCENE LOG adds four rows and two stops: its heading, its spacer, the format and what is recorded. + await Assert.That(screen.Rows.Count).IsEqualTo(46); await Assert.That(model.PaneCount).IsEqualTo(1); - await Assert.That(model.Sizes[0]).IsEqualTo(18); + await Assert.That(model.Sizes[0]).IsEqualTo(20); } /// diff --git a/tests/SharpMUTerm.Tui.Tests/ScriptingWaveTests.cs b/tests/SharpMUTerm.Tui.Tests/ScriptingWaveTests.cs new file mode 100644 index 00000000..71abfdac --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/ScriptingWaveTests.cs @@ -0,0 +1,314 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Logging; +using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The script console, GMCP channel capture, highlighted names and the scene log, each driven through a connected +/// session the way a player reaches it. +/// +[NotInParallel] +public class ScriptingWaveTests +{ + private const string Ann = "Convergence.Ann"; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static AppConfiguration Config(Action? world = null) + { + var set = new TriggerSet { Name = "Lua", ScriptFiles = { "main.lua" } }; + var config = new AppConfiguration(); + config.TriggerSets.Add(set); + var definition = new WorldDefinition + { + Name = "Convergence", + Host = "convergence.example", + Port = 4201, + Characters = { new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings(), TriggerSets = { "Lua" } } }, + }; + world?.Invoke(definition); + config.Worlds.Add(definition); + return config; + } + + private static async Task<(SharpMUTermApp App, RecordingTelnetSession Wire)> Open( + AppConfiguration config, string? scriptsRoot = null, string? logRoot = null) + { + Console.SetIn(TextReader.Null); + var wire = new RecordingTelnetSession(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32), logRoot: logRoot, scriptsRoot: scriptsRoot); + app.TelnetFactory = _ => wire; + if (!app.DispatchCommand(CommandIds.Character(Ann))) + { + throw new InvalidOperationException("the app would not switch to Ann"); + } + + await app.FindSession(Ann)!.ConnectAsync(); + app.RenderNextFrame(); + return (app, wire); + } + + private static string Root(string lua) + { + var root = Directory.CreateTempSubdirectory("sharpmuterm-console-").FullName; + File.WriteAllText(Path.Combine(root, "main.lua"), lua); + return root; + } + + private static void Enter(SharpMUTermApp app, string line) + { + app.SimulateConsoleTyping(line); + app.SimulateConsoleKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + } + + [Test] + public async Task TheConsoleRunsALineInTheCharactersSandboxAndShowsWhatItPrinted() + { + var root = Root("function greet(n) print('hello ' .. n) end\nstore.set('kills', 3)"); + try + { + var (app, _) = await Open(Config(), scriptsRoot: root); + await using var _app = app; + + await Assert.That(app.DispatchCommand(BuiltInCommands.ScriptConsoleCommand)).IsTrue(); + await Assert.That(app.ScriptConsoleIsOpen).IsTrue(); + await Assert.That(app.CellConsole!.Model.CanRun).IsTrue(); + await Assert.That(app.CellConsole!.Model.Store.Select(e => e.Key)).Contains("kills"); + + Enter(app, "1 + 1"); + Enter(app, "greet('Ann')"); + Enter(app, "error('boom')"); + + var lines = app.CellConsole!.Model.Lines; + await Assert.That(lines).Contains(new ScriptConsoleLine(ScriptConsoleKind.Result, "2")); + await Assert.That(lines).Contains(new ScriptConsoleLine(ScriptConsoleKind.Output, "hello Ann")); + await Assert.That(lines.Any(l => l.Kind == ScriptConsoleKind.Error && l.Text.Contains("boom"))).IsTrue(); + await Assert.That(app.CellConsole!.Model.History).IsEquivalentTo(new[] { "1 + 1", "greet('Ann')", "error('boom')" }); + await Assert.That(string.Join("\n", app.ConsoleLines)).Contains("hello Ann"); + } + finally + { + Directory.Delete(root, recursive: true); + } + } + + [Test] + public async Task ALoopTypedAtThePromptIsStoppedAndTheConsoleStaysUsable() + { + var root = Root("-- nothing"); + try + { + var (app, _) = await Open(Config(), scriptsRoot: root); + await using var _app = app; + app.DispatchCommand(BuiltInCommands.ScriptConsoleCommand); + + Enter(app, "while true do end"); + Enter(app, "40 + 2"); + + var lines = app.CellConsole!.Model.Lines; + await Assert.That(lines.Any(l => l.Kind == ScriptConsoleKind.Error)).IsTrue(); + await Assert.That(lines).Contains(new ScriptConsoleLine(ScriptConsoleKind.Result, "42")); + } + finally + { + Directory.Delete(root, recursive: true); + } + } + + [Test] + public async Task DeletingAStoreKeyAndReloadingGoThroughTheConsole() + { + var root = Root("store.set('a', 1)\nstore.set('b', 2)"); + try + { + var (app, _) = await Open(Config(), scriptsRoot: root); + await using var _app = app; + app.DispatchCommand(BuiltInCommands.ScriptConsoleCommand); + + app.DeleteStoreKey("a"); + await Assert.That(app.CellConsole!.Model.Store.Select(e => e.Key)).IsEquivalentTo(new[] { "b" }); + + File.WriteAllText(Path.Combine(root, "main.lua"), "print('v2 loaded')"); + app.SimulateConsoleKey(new ConsoleKeyInfo('\f', ConsoleKey.L, false, false, true)); + + var lines = app.CellConsole!.Model.Lines; + await Assert.That(lines.Any(l => l.Kind == ScriptConsoleKind.Note && l.Text.StartsWith("reloaded", StringComparison.Ordinal))).IsTrue(); + await Assert.That(lines).Contains(new ScriptConsoleLine(ScriptConsoleKind.Output, "v2 loaded")); + } + finally + { + Directory.Delete(root, recursive: true); + } + } + + [Test] + public async Task AScriptErrorReachesTheConsoleWithItsFileAndLine() + { + var root = Root("local x = 1\n\nnil_call()"); + try + { + var (app, _) = await Open(Config(), scriptsRoot: root); + await using var _app = app; + app.DispatchCommand(BuiltInCommands.ScriptConsoleCommand); + + var errors = app.CellConsole!.Model.Lines.Where(l => l.Kind == ScriptConsoleKind.Error).ToArray(); + await Assert.That(errors.Any(e => e.Text.Contains("main.lua:(3", StringComparison.Ordinal) || e.Text.Contains("main.lua:3", StringComparison.Ordinal))).IsTrue(); + } + finally + { + Directory.Delete(root, recursive: true); + } + } + + /// A client that runs no scripts still opens the console, and it says why there is no prompt. + [Test] + public async Task WithNoScriptsRootTheConsoleSaysWhyAndRunsNothing() + { + var (app, _) = await Open(Config(), scriptsRoot: null); + await using var _app = app; + + await Assert.That(app.DispatchCommand(BuiltInCommands.ScriptConsoleCommand)).IsTrue(); + await Assert.That(app.CellConsole!.Model.CanRun).IsFalse(); + await Assert.That(app.CellConsole!.Model.Unavailable!).Contains("runs no scripts"); + + Enter(app, "1 + 1"); + await Assert.That(app.CellConsole!.Model.Lines).IsEmpty(); + } + + [Test] + public async Task AChannelMessageOpensAWindowForItsChannelAndTheMainCopyStays() + { + var (app, wire) = await Open(Config(w => w.CaptureChannels = ChannelCaptureMode.Copy)); + await using var _app = app; + + wire.ReceiveGmcp("Comm.Channel.Text", """{"channel":"ooc","talker":"Rivane","text":"[OOC] Rivane: anyone around?"}"""); + wire.Receive("[OOC] Rivane: anyone around?\n"); + + var spawn = app.WindowIds().Single(id => id.StartsWith("spawn:", StringComparison.Ordinal)); + await Assert.That(spawn).Contains("ooc"); + await Assert.That(app.PaneLines(spawn).Any(l => l.Contains("anyone around?", StringComparison.Ordinal))).IsTrue(); + await Assert.That(app.PaneLines(app.ActiveWindowId()).Any(l => l.Contains("anyone around?", StringComparison.Ordinal))).IsTrue(); + } + + [Test] + public async Task MoveModeTakesTheEchoOutOfTheMainWindow() + { + var (app, wire) = await Open(Config(w => w.CaptureChannels = ChannelCaptureMode.Move)); + await using var _app = app; + + wire.ReceiveGmcp("Comm.Channel.Text", """{"channel":"ooc","talker":"Rivane","text":"[OOC] Rivane: hello"}"""); + wire.Receive("[OOC] Rivane: hello\n"); + wire.Receive("The fountain splashes.\n"); + + var main = app.PaneLines(app.ActiveWindowId()); + await Assert.That(main.Any(l => l.Contains("Rivane: hello", StringComparison.Ordinal))).IsFalse(); + await Assert.That(main.Any(l => l.Contains("fountain", StringComparison.Ordinal))).IsTrue(); + } + + [Test] + public async Task WithCaptureOffAChannelMessageOpensNoWindow() + { + var (app, wire) = await Open(Config()); + await using var _app = app; + + wire.ReceiveGmcp("Comm.Channel.Text", """{"channel":"ooc","talker":"Rivane","text":"hi"}"""); + + await Assert.That(app.WindowIds().Any(id => id.StartsWith("spawn:", StringComparison.Ordinal))).IsFalse(); + } + + [Test] + public async Task AHighlightedNameIsColouredInTheMainWindowAsAWholeWord() + { + var (app, wire) = await Open(Config(w => w.HighlightNames = [new NameHighlight("Ashlyn", "red")])); + await using var _app = app; + + wire.Receive("Ashlyn waves to Ashlynn.\n"); + + var line = app.PaneLines(app.ActiveWindowId()).Single(l => l.Contains("waves", StringComparison.Ordinal)); + await Assert.That(line).Contains("Ashlyn[/]"); + await Assert.That(line).DoesNotContain("Ashlynn[/]"); + } + + [Test] + public async Task ASceneLogRecordsTheWindowWithAHeaderAndRefusesASecondStart() + { + var logs = Directory.CreateTempSubdirectory("sharpmuterm-scene-").FullName; + try + { + var config = Config(); + config.SceneLog = new SceneLogSettings { Html = false, Content = SceneLogContent.Everything }; + var (app, wire) = await Open(config, logRoot: logs); + await using var _app = app; + + await Assert.That(app.DispatchCommand(BuiltInCommands.SceneStartCommand)).IsTrue(); + var log = app.SceneLogOf(app.ActiveWindowId()); + await Assert.That(log).IsNotNull(); + await Assert.That(app.BuildCatalog().Select(i => i.Id)).Contains(BuiltInCommands.SceneStopCommand); + + wire.Receive("Rivane says, \"Evening.\"\n"); + wire.Receive("The fountain splashes.\n"); + await Assert.That(app.DispatchCommand(BuiltInCommands.SceneStopCommand)).IsTrue(); + await Assert.That(app.SceneLogOf(app.ActiveWindowId())).IsNull(); + + var text = File.ReadAllText(log!.Path); + await Assert.That(text).Contains("Present: Ann"); + await Assert.That(text).Contains("Evening."); + await Assert.That(text).Contains("The fountain splashes."); + await Assert.That(text).Contains("Ended"); + await Assert.That(Path.GetDirectoryName(log.Path)!).IsEqualTo(Path.Combine(logs, "scenes")); + } + finally + { + Directory.Delete(logs, recursive: true); + } + } + + [Test] + public async Task PosesOnlyLeavesOutTheRoomsOwnLines() + { + var logs = Directory.CreateTempSubdirectory("sharpmuterm-scene-").FullName; + try + { + var config = Config(); + config.SceneLog = new SceneLogSettings { Html = true, Content = SceneLogContent.Poses }; + var (app, wire) = await Open(config, logRoot: logs); + await using var _app = app; + + app.DispatchCommand(BuiltInCommands.SceneStartCommand); + var log = app.SceneLogOf(app.ActiveWindowId())!; + wire.Receive("Ann says, \"Evening.\"\n"); + wire.Receive("The fountain splashes.\n"); + app.DispatchCommand(BuiltInCommands.SceneStopCommand); + + var text = File.ReadAllText(log.Path); + await Assert.That(log.Path).EndsWith(".html"); + await Assert.That(text).Contains("Evening."); + await Assert.That(text).DoesNotContain("fountain"); + } + finally + { + Directory.Delete(logs, recursive: true); + } + } + + /// An app with no log root — every test, every snapshot — refuses out loud and writes nothing. + [Test] + public async Task WithNoLogRootTheSceneLogRefuses() + { + var (app, _) = await Open(Config(), logRoot: null); + await using var _app = app; + + app.DispatchCommand(BuiltInCommands.SceneStartCommand); + + await Assert.That(app.SceneLogOf(app.ActiveWindowId())).IsNull(); + await Assert.That(app.StatusMarkup).Contains("no scene log"); + } +} From f3afd4cabc9b05ce8fddf9d08776e69be48d7848 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 13:42:11 +0000 Subject: [PATCH 050/113] Maps: other levels and areas, drag to move, hand edits kept, find room - View another level or area and come back in both hosts (MapLooking, MapViewpoint, LookMap): cell title/legend links, PgUp/PgDn/v/h while editing, canvas buttons and Shift+wheel, Ctrl+P map:level-up/-down/ next-area/here, /map level|view|here. Walking targets the real room. - Drag a room on the native canvas while editing: snapped, one MapEdit.Move per drop. - Hand edits (name, area, exits, position) are recorded per room and skipped by the recorder; Reset to server (inspector, menu, R, /map reset) clears them and re-applies the last report. MapStore format 2 with a migration from 1. - Ctrl+P Find room... and /map find . - Views map-level, map-area, map-find, map-mine; parity probes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 12 +- CLAUDE.md | 23 +- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 2 +- src/SharpMUTerm.Avalonia/FloatingPanels.cs | 2 +- src/SharpMUTerm.Avalonia/MapCanvas.cs | 244 ++++++++++++++++- src/SharpMUTerm.Avalonia/MapInspector.cs | 20 ++ .../Commands/BuiltInCommands.cs | 7 + src/SharpMUTerm.Client/Panels/MapEditing.cs | 32 ++- src/SharpMUTerm.Client/Panels/MapLooking.cs | 259 ++++++++++++++++++ src/SharpMUTerm.Client/Panels/MapViewModel.cs | 74 ++++- .../Surfaces/SurfaceCatalog.cs | 4 + .../Commands/CommandCatalog.cs | 8 +- src/SharpMUTerm.Core/Mapping/MapModel.cs | 41 +++ src/SharpMUTerm.Core/Mapping/MapRecorder.cs | 84 +++++- src/SharpMUTerm.Core/Mapping/MapStore.cs | 26 +- src/SharpMUTerm.Tui/MapRenderer.cs | 87 +++++- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 7 +- .../Pointer/SharpMUTermApp.Desktop.cs | 3 +- src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs | 25 +- src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs | 196 +++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 51 +++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- .../NativeMapViewTests.cs | 159 +++++++++++ .../SurfaceParityTests.cs | 51 ++++ .../Mapping/HandEditTests.cs | 187 +++++++++++++ .../SharpMUTerm.Tui.Tests/MapEditModeTests.cs | 2 + tests/SharpMUTerm.Tui.Tests/MapViewTests.cs | 199 ++++++++++++++ 27 files changed, 1765 insertions(+), 42 deletions(-) create mode 100644 src/SharpMUTerm.Client/Panels/MapLooking.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NativeMapViewTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Mapping/HandEditTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/MapViewTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 9686bbbb..4adf89b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,8 +17,16 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] - Maps can be edited by hand: Ctrl+P ▸ Edit map in the terminal (arrow keys select, Shift+arrows move, r, a, l, w, x, n, s, Del and u edit), or right-click a room in the desktop window for its menu and inspector. Rename a room, set its area, lock it, weight it, add or remove an exit (or link one to the next room you walk into), move it, delete it, - or give it a note or a symbol; the last ten edits can be undone. A game that reports rooms over GMCP may overwrite - a room's name, area and exits the next time it describes it. + or give it a note or a symbol; the last ten edits can be undone. What you changed by hand (a name, an area, exits, + a position) is kept when the game describes the room again; Reset to server (R, or the inspector's button) gives it + back to the game. +- The map can show another level or area and come back: the ▲ ▼ and "here" in the map's title and the area names in + its legend in the terminal, the Up, Down, Areas and "Back to where I am" buttons (or Shift+wheel) in the desktop + window, PgUp/PgDn, v and h while editing, Ctrl+P ▸ Map: level up / level down / next area / back to where I am, and + `/map level up|down`, `/map view ` and `/map here`. Walking still goes from where you are. +- In the desktop window, drag a room while editing the map to move it; it snaps to the grid. +- Ctrl+P ▸ Find room… and `/map find ` list the rooms whose name or area matches, with the `/walk` for each, + and show the first on the map. - Ctrl+P ▸ Script console: one per character, it shows what your Lua scripts printed and the errors they raised (with the file and line), runs a line of Lua as that character (a runaway loop is stopped after half a second), remembers what you typed, lists the character's `store` keys with Delete, and reloads the scripts. Without a diff --git a/CLAUDE.md b/CLAUDE.md index 436460e1..b10bd267 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -154,7 +154,8 @@ fallbacks) for inline images/maps. the script host's lock). A change a script asks for (`map.walk`, a lock) is posted to the UI thread. - **The map names rooms, and is edited by hand in both hosts** (`WorldMap.Rename`/`SetArea`/`SetExit`/`Remove`/…, Core; `MapRecorder.Edit(label, touched, change)`, `LinkNext`, `Undo`; Client `MapEditing`, `MapEdit`; Tui - `SharpMUTermApp.MapEdit.cs`; Avalonia `MapInspector`; the `map-edit` view). The cell title is the current room's name, + `SharpMUTermApp.MapEdit.cs`; Avalonia `MapInspector`; the `map-edit` view; `map-level`, `map-area`, `map-find` and `map-mine` show looking up a level, another area, a find and + a hand-renamed room in edit mode). The cell title is the current room's name, and `MapViewModel.Nearby` (each exit and where it leads) fills a side column from 64 cells or the rows under the grid from 18. Every edit is a `MapEdit` through `ApplyMapEdit` → `MapEditing.Apply` → `MapRecorder.Edit`, on the UI thread under `SyncRoot`, dirty and saved like a recorded room; undo snapshots the rooms an edit touches (10 deep, areas it @@ -162,8 +163,24 @@ fallbacks) for inline images/maps. map, a cell click while editing, the canvas's right-click menu or click), so `SurfaceParityTests` compares `MapDigest()`. Cell keys are `MapEditing.Keys`; the ones that need words put a `/map …` command on the command line and put back what was being typed once it runs. "Next" on an exit links it to the next room walked into, never its - own. Deleting the room you are in is refused. **On a GMCP world the server's next report of a room overwrites a hand - edit to its name, area, exits and place**; locks, weights, notes and symbols survive. + own. Deleting the room you are in is refused. + - **A hand edit is kept from the server** (`MapRoom.HandEdited`, `MapFields`: name, area, exits, position). Each edit + marks the fields it changed; `MapRecorder` skips those fields on every later report (the rest still follow the + server), and keeps each room's last report this run (`_served`). **Reset to server** (`MapEdit.ResetToServer`; + inspector button, menu entry, cell `R`, `/map reset`) clears the marks through `Edit`, so it undoes, and re-applies + that report at once if there is one; otherwise the next report wins. Undo restores the marks with the room. + `MapStore` is format 2 (`handEdited` per room); a version-1 file migrates on read, and unknown field names are dropped. + - **A map window can look at another level or area** (Client `MapLooking`, `MapViewpoint`, `MapLook`; Tui + `SharpMUTermApp.MapView.cs`; `LookMap`, a `PanelOverlay` callback and a surface action). The look is client state per + window (`_mapLooks`), handed to `MapViewModel.From(…, look)`, which anchors on the room there nearest the current + room's x/y and sets `Viewing`, `Levels`, `LevelAbove`/`Below` and `AreaChoices` (64 at most). Looking where you are + clears it. Walking still targets the real room. Ways in: cell title `▲ ▼ ⌂ here` and legend area links + (`MapRenderer.LookPrefix`), edit keys PgUp/PgDn/`v`/`h`, the canvas's Up/Down/Areas/Back buttons and ⇧wheel, + ⌃P `map:level-up`/`-down`/`next-area`/`here`, and `/map level|view|here`. Nearby is hidden while viewing. + - **A room is dragged on the canvas while editing**: snapped to the grid, one `MapEdit.Move` per drop (the cells' + ⇧arrows' edit), ghost outline while held; a drag outside editing still pans. + - **`/map find `** (⌃P ▸ *Find room…* puts it on the command line) lists up to 20 rooms by name, then area, as + chrome lines in the session window with `/walk `, and points the map at the first. - **Sound** (`Core/Media`: `MediaCommand`, `MediaQueue`, `MediaCache`, `IAudioOutput`). MCMP's `Client.Media.*` is read with TNC.Gmcp's typed records into `MediaCommand`s (`WorldSession.MediaReceived`), and one `MediaQueue` per connection applies the specification's rules — priority halts and refuses lower, diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index d7390d06..6b8fbac5 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -340,7 +340,7 @@ private void SyncPanels(ScreenFrame frame, Size cell) () => new MapCanvas(_view), frame, cell, - (map, panel, plane) => map.Show(panel.Map!, panel.Ink, plane, text, panel.WalkTo, panel.SelectRoom, panel.EditMap)); + (map, panel, plane) => map.Show(panel.Map!, panel.Ink, plane, text, panel.WalkTo, panel.SelectRoom, panel.EditMap, panel.LookMap)); Place( _whoHere, _pointer.Panels.Where(p => p.PanelId == PanelIds.WhoHere && p.WhoHere is not null), diff --git a/src/SharpMUTerm.Avalonia/FloatingPanels.cs b/src/SharpMUTerm.Avalonia/FloatingPanels.cs index 57738f29..34253f7c 100644 --- a/src/SharpMUTerm.Avalonia/FloatingPanels.cs +++ b/src/SharpMUTerm.Avalonia/FloatingPanels.cs @@ -289,7 +289,7 @@ public void Update(FloatingPanel panel, double cellHeight) switch (_content) { case MapCanvas map when content.Map is { } model: - map.Show(model, content.Ink, plane, text, content.WalkTo, content.SelectRoom, content.EditMap); + map.Show(model, content.Ink, plane, text, content.WalkTo, content.SelectRoom, content.EditMap, content.LookMap); break; case VitalsGauges gauges when content.Vitals is { } vitals: gauges.Show(vitals, content.Ink, plane, text, cellHeight); diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index 61bf78e7..a90fe942 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -24,7 +24,14 @@ namespace SharpMUTerm.Avalonia; /// Editing. A right click on a room selects it for editing () and opens the /// client's room menu (); while a room is selected a click selects instead of walking, and the /// card in the top right corner edits it. Every edit is a handed to the -/// client (), the funnel the cell map's keys end in. +/// client (), the funnel the cell map's keys end in. While editing, a room dragged to +/// another grid cell is moved there on the drop: one , so one undo, the cell map's ⇧arrows' edit. +/// +/// +/// Other levels and areas. Buttons under the corner label step a level up or down and open the area menu +/// (); ⇧ with the wheel steps levels; a click on another area in the legend shows it; and +/// while the view is elsewhere a button goes back to where the character is. Each is a handed to the +/// client (), which redraws both hosts from the one model. /// /// internal sealed class MapCanvas : Control @@ -48,6 +55,9 @@ internal sealed class MapCanvas : Control private Action? _walkTo; private Action? _select; private Action? _edit; + private Action? _look; + private MapViewRoom? _dragRoom; + private Vector _dragBy; private readonly MapInspector _inspector = new(); private Vector _pan; private Point? _pressAt; @@ -93,17 +103,26 @@ protected override Size ArrangeOverride(Size finalSize) /// What it is showing. Internal for tests. internal MapViewModel Model => _model; - public void Show(MapViewModel model, PanelInk ink, Color plane, Color text, Action? walkTo, Action? select = null, Action? edit = null) + public void Show( + MapViewModel model, PanelInk ink, Color plane, Color text, Action? walkTo, Action? select = null, Action? edit = null, + Action? look = null) { _walkTo = walkTo; _select = select; _edit = edit; + _look = look; _inspector.Show(model, plane, text, edit, select); if (model.Equals(_model) && ink == _ink && plane == _plane && text == _text) { return; } + // Another level or area is another picture: the pan from the old one means nothing on it. + if (model.Level != _model.Level || model.Area != _model.Area || model.Viewing != _model.Viewing) + { + _pan = default; + } + _model = model; _ink = ink; _plane = plane; @@ -185,6 +204,22 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) return; } + if (LookButtonAt(point.Position) is { } button) + { + if (button.Enabled) + { + PressLookButton(button.Id); + } + + return; + } + + if (LegendAreaAt(point.Position) is { } area) + { + _look?.Invoke(MapLook.ToArea(area)); + return; + } + if (e.ClickCount == 2) { _pan = default; @@ -195,6 +230,8 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) _pressAt = point.Position; _panAtPress = _pan; _dragging = false; + _dragBy = default; + _dragRoom = _model.Editing && _edit is not null ? RoomAt(point.Position) : null; e.Pointer.Capture(this); } @@ -214,7 +251,15 @@ protected override void OnPointerMoved(PointerEventArgs e) if (_dragging || Math.Abs(moved.X) + Math.Abs(moved.Y) > DragThreshold) { _dragging = true; - _pan = _panAtPress + moved; + if (_dragRoom is not null) + { + _dragBy = moved; // a room being moved: drawn at the cell it would land in, the map stays put + } + else + { + _pan = _panAtPress + moved; + } + Cursor = new Cursor(StandardCursorType.SizeAll); InvalidateVisual(); } @@ -245,10 +290,21 @@ protected override void OnPointerReleased(PointerReleasedEventArgs e) } var wasDrag = _dragging; + var dragged = _dragRoom; + var by = _dragBy; _pressAt = null; _dragging = false; + _dragRoom = null; + _dragBy = default; e.Pointer.Capture(null); Cursor = new Cursor(StandardCursorType.Arrow); + if (wasDrag && dragged is not null) + { + DropRoom(dragged, by); + InvalidateVisual(); + return; + } + if (wasDrag || e.InitialPressMouseButton != MouseButton.Left || RoomAt(e.GetPosition(this)) is not { } room) { return; @@ -274,9 +330,159 @@ protected override void OnPointerWheelChanged(PointerWheelEventArgs e) } e.Handled = true; + if ((e.KeyModifiers & KeyModifiers.Shift) != 0) + { + // ⇧ with the wheel steps levels; some platforms turn ⇧-wheel into a sideways scroll, so either axis counts. + var notches = e.Delta.Y != 0 ? e.Delta.Y : e.Delta.X; + if (notches > 0 && _model.LevelAbove) + { + _look?.Invoke(MapLook.Up); + } + else if (notches < 0 && _model.LevelBelow) + { + _look?.Invoke(MapLook.Down); + } + + return; + } + ZoomAbout(e.GetPosition(this), e.Delta.Y); } + /// The grid cells a drag of pixels comes to, at the zoom shown. + internal (int Dx, int Dy) SnapOf(Vector moved) + { + var step = Spacing * Zoom; + return ((int)Math.Round(moved.X / step), (int)Math.Round(moved.Y / step)); + } + + /// + /// A room dropped pixels from where it was picked up: selected, and moved to the grid cell it came + /// to as one edit (none when it came back to its own cell, which is a click that selects it). Internal for tests, + /// which drop a room the way a release does. + /// + internal void DropRoom(MapViewRoom room, Vector by) + { + _select?.Invoke(room.Id); + var (dx, dy) = SnapOf(by); + if ((dx, dy) != (0, 0)) + { + _edit?.Invoke(MapEdit.Move(room.Id, dx, dy)); + } + } + + // ── The look buttons: a level up or down, the area menu, and back to where the character is ────────────── + + /// A look button: what it is, where it is drawn, its words, and whether it does anything now. + internal sealed record LookButton(string Id, Rect Rect, string Label, bool Enabled); + + internal const string UpButton = "up", DownButton = "down", AreasButton = "areas", HereButton = "here"; + + /// + /// The look buttons the view offers, left to right under the corner label: ▲ ▼ while the area has more than one level, + /// Areas ▾ while the map has more than one area, and Back to where I am while the view is elsewhere. Internal for tests. + /// + internal IReadOnlyList LookButtons() + { + var buttons = new List(); + if (_look is null || _model.Rooms.Count == 0) + { + return buttons; + } + + var x = 10.0; + var y = _model.Walking is not null || _model.Current is not null ? 46.0 : 28.0; + void Add(string id, string label, bool enabled) + { + var width = PanelText.Measure(label, ButtonSize, bold: false) + 14; + buttons.Add(new LookButton(id, new Rect(x, y, width, 20), label, enabled)); + x += width + 4; + } + + if (_model.Levels.Count > 1) + { + Add(UpButton, "▲ Up", _model.LevelAbove); + Add(DownButton, "▼ Down", _model.LevelBelow); + } + + if (_model.AreaChoices.Count > 1) + { + Add(AreasButton, "Areas ▾", true); + } + + if (_model.Viewing) + { + Add(HereButton, "Back to where I am", true); + } + + return buttons; + } + + private const double ButtonSize = 11; + + private LookButton? LookButtonAt(Point point) => LookButtons().FirstOrDefault(b => b.Rect.Contains(point)); + + /// What a look button does. Internal for tests, which press one the way a click does. + internal void PressLookButton(string id) + { + switch (id) + { + case UpButton: + _look?.Invoke(MapLook.Up); + break; + case DownButton: + _look?.Invoke(MapLook.Down); + break; + case HereButton: + _look?.Invoke(MapLook.Here); + break; + case AreasButton: + OpenAreaMenu(); + break; + } + } + + /// The last area menu the canvas opened. Internal for tests. + internal MenuModel? OpenedAreaMenu { get; private set; } + + /// Opens the client's area menu: each area the map has, and the way back while the view is elsewhere. + internal void OpenAreaMenu() + { + var model = MapLooking.AreaMenu(_model); + OpenedAreaMenu = model; + var view = _model; + var menu = NativeMenu.Build(model, verb => RunAreaVerb(view, verb), global::Avalonia.Controls.PlacementMode.Pointer, this); + menu.Open(this); + } + + /// What an area menu entry does. Internal for tests, which choose an entry the way a click on it would. + internal void RunAreaVerb(MapViewModel view, string verb) + { + if (MapLooking.LookFor(verb, view) is { } look) + { + _look?.Invoke(look); + } + } + + /// The other area whose legend row is under a point, or null: a click there shows that area. + internal string? LegendAreaAt(Point point) + { + if (_look is null || LegendRect(Bounds.Size) is not { } plate || !plate.Contains(point)) + { + return null; + } + + var entries = LegendEntries(); + var row = (int)Math.Floor((point.Y - plate.Y - LegendPad) / LegendRow); + if (row < 0 || row >= entries.Count) + { + return null; + } + + var first = entries.Count - _model.Areas.Count; + return row >= first && !_model.Areas[row - first].Drawn ? _model.Areas[row - first].Name : null; + } + /// /// Selects and opens the client's menu for it: walk there, each edit, undo. An edit that needs /// words opens the inspector at its field; the rest are handed to the client as they are. @@ -457,7 +663,8 @@ public override void Render(DrawingContext context) } // What and where, in the corner: the area and level, and a walk under way. - var label = _model.Area is { Length: > 0 } areaName ? $"{areaName} · level {_model.Level}" : $"level {_model.Level}"; + var label = (_model.Viewing ? "Viewing " : string.Empty) + + (_model.Area is { Length: > 0 } areaName ? $"{areaName} · level {_model.Level}" : $"level {_model.Level}"); DrawText(context, label, new Point(10, 8), 12, _model.AreaColour is { } areaHex ? Parse(areaHex) : Faded(0.75)); if (_model.Walking is { } walking) { @@ -468,9 +675,38 @@ public override void Render(DrawingContext context) DrawText(context, here.Name, new Point(10, 26), 12, accent); } + if (_dragRoom is { } moving && byId.TryGetValue(moving.Id, out var shown)) + { + // Where the room would land: an outline on the grid cell the drag has come to, joined to where it is now. + var (dx, dy) = SnapOf(_dragBy); + var from = CentreOf(shown); + var step = Spacing * Zoom; + var to = new Point(from.X + (dx * step), from.Y + (dy * step)); + var ghost = new Pen(new SolidColorBrush(path), 2, new DashStyle([3, 2], 0)); + context.DrawLine(new Pen(new SolidColorBrush(Faded(0.5)), 1, new DashStyle([2, 2], 0)), from, to); + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x40, path.R, path.G, path.B)), ghost, new Rect(to.X - (size / 2), to.Y - (size / 2), size, size), radius, radius); + } + + DrawLookButtons(context); DrawLegend(context, bounds); } + private void DrawLookButtons(DrawingContext context) + { + foreach (var button in LookButtons()) + { + var alpha = button.Enabled ? 1.0 : 0.4; + context.DrawRectangle( + new SolidColorBrush(Mix(_plane, _text, 0.1)), + new Pen(new SolidColorBrush(Faded(0.35 * alpha)), 1), + button.Rect, + 4, + 4); + var label = PanelText.Format(button.Label, ButtonSize, Faded(0.9 * alpha), bold: false, button.Rect.Width); + context.DrawText(label, new Point(button.Rect.X + 7, button.Rect.Y + ((button.Rect.Height - label.Height) / 2))); + } + } + /// Up and down marks: a small triangle at the top of the room for a way up, at the bottom for a way down. private void DrawStairs(DrawingContext context, MapViewRoom room, Rect rect, Color ink) { diff --git a/src/SharpMUTerm.Avalonia/MapInspector.cs b/src/SharpMUTerm.Avalonia/MapInspector.cs index 556737db..49114a72 100644 --- a/src/SharpMUTerm.Avalonia/MapInspector.cs +++ b/src/SharpMUTerm.Avalonia/MapInspector.cs @@ -25,6 +25,7 @@ internal sealed class MapInspector : Border private readonly TextBlock _where = new() { Opacity = 0.75 }; private readonly TextBlock _pending = new() { TextWrapping = TextWrapping.Wrap, IsVisible = false }; private readonly StackPanel _exits = new() { Spacing = 2 }; + private readonly TextBlock _mine = new() { TextWrapping = TextWrapping.Wrap, Opacity = 0.85, IsVisible = false }; private readonly Button _undo; private readonly Button _delete; private MapViewModel _model = new(null, 0, [], [], null); @@ -89,6 +90,14 @@ public MapInspector() } }); var done = Small("Done", () => _select?.Invoke(null)); + ResetButton = Small("Reset to server", () => + { + if (_model.Selected is { } room) + { + _edit?.Invoke(MapEdit.ResetToServer(room.Id)); + } + }); + ToolTip.SetTip(ResetButton, "Let the server's room reports set the fields you edited by hand again (R on the cell map)"); var nudge = new WrapPanel(); foreach (var (label, dx, dy, dz) in new[] { ("West", -1, 0, 0), ("North", 0, -1, 0), ("South", 0, 1, 0), ("East", 1, 0, 0), ("Level up", 0, 0, 1), ("Level down", 0, 0, -1) }) @@ -132,6 +141,7 @@ void Row(string label, Control field) var buttons = new WrapPanel(); buttons.Children.Add(_undo); buttons.Children.Add(_delete); + buttons.Children.Add(ResetButton); buttons.Children.Add(done); Child = new StackPanel @@ -142,6 +152,7 @@ void Row(string label, Control field) _title, _where, grid, + _mine, LockBox, new TextBlock { Text = "Exits", Opacity = 0.75 }, _exits, @@ -175,6 +186,12 @@ void Row(string label, Control field) internal CheckBox LockBox { get; } + /// Gives the room's hand-edited fields back to the server; enabled only while it has some. + internal Button ResetButton { get; } + + /// What the card says about the fields edited by hand, or empty. Internal for tests. + internal string HandEditedText => _mine.IsVisible ? _mine.Text ?? string.Empty : string.Empty; + /// The room it shows, or null. Internal for tests. internal MapRoomDetails? Room => _model.Selected; @@ -238,6 +255,9 @@ public void Show(MapViewModel model, Color plane, Color text, Action? e _pending.Text = model.Pending ?? string.Empty; _pending.IsVisible = model.Pending is not null; + _mine.Text = room.HandEdited.Count == 0 ? string.Empty : $"Edited by hand, kept from the server: {string.Join(", ", room.HandEdited)}"; + _mine.IsVisible = room.HandEdited.Count > 0; + ResetButton.IsEnabled = room.HandEdited.Count > 0; _undo.IsEnabled = model.UndoLabel is not null; ToolTip.SetTip(_undo, model.UndoLabel is { } undo ? $"Undo {undo}" : "Nothing to undo"); _delete.IsEnabled = model.Current?.Id != room.Id; diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index f3fb8dd8..3bb728d1 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -169,6 +169,13 @@ void Family(string id, string prefix, Func c.State.MapUndo is not null); + + // Looking at another level or area of the map, and back; offered only where the map has one to look at. + Add("map:level-up", CommandGroup.Terminal, "Map: level up", detail: "shows the next level up · /map level up", when: c => c.State.MapLevels > 1); + Add("map:level-down", CommandGroup.Terminal, "Map: level down", detail: "shows the next level down · /map level down", when: c => c.State.MapLevels > 1); + Add("map:next-area", CommandGroup.Terminal, "Map: next area", detail: "shows another area · /map view ", when: c => c.State.MapAreas > 1); + Add("map:here", CommandGroup.Terminal, "Map: back to where I am", detail: "the map follows you again · /map here", when: c => c.State.MapViewing); + Add("map:find", CommandGroup.Terminal, "Find room…", detail: "rooms by name or area · /map find ", when: c => c.State.MapLevels > 0); // The panels a layout places, openable one at a time as tabs: each draws the focused character's own data // and says so when there is none yet, so they are listed unconditionally, like the map. Add("panel:who-here", CommandGroup.Terminal, "Show who is here", detail: "players and creatures in the room · click a name to look"); diff --git a/src/SharpMUTerm.Client/Panels/MapEditing.cs b/src/SharpMUTerm.Client/Panels/MapEditing.cs index 73c0a87a..0b0a7921 100644 --- a/src/SharpMUTerm.Client/Panels/MapEditing.cs +++ b/src/SharpMUTerm.Client/Panels/MapEditing.cs @@ -26,6 +26,9 @@ public enum MapEditKind /// The last edit taken back. Undo, + + /// The room's hand-edited fields given back to the server (). + ResetToServer, } /// @@ -66,6 +69,8 @@ public sealed record MapEdit(MapEditKind Kind, long Room, string? Text = null, i public static MapEdit Symbol(long room, string? symbol) => new(MapEditKind.Symbol, room, symbol); public static MapEdit Undo { get; } = new(MapEditKind.Undo, 0); + + public static MapEdit ResetToServer(long room) => new(MapEditKind.ResetToServer, room); } /// What an edit did: whether the map changed, and a sentence for the player either way. @@ -80,7 +85,7 @@ public static class MapEditing /// A room menu entry's verbs (). A verb that needs words opens the inspector at that field. public const string WalkVerb = "walk", RenameVerb = "rename", AreaVerb = "area", NoteVerb = "note", SymbolVerb = "symbol", WeightVerb = "weight", ExitVerb = "exit", UnexitVerb = "unexit", LockVerb = "lock", UnlockVerb = "unlock", DeleteVerb = "delete", - UndoVerb = "undo"; + UndoVerb = "undo", ResetVerb = "reset"; /// The verbs that need words, which a host asks for in its inspector before an edit is made. public static IReadOnlyList TextVerbs { get; } = [RenameVerb, AreaVerb, NoteVerb, SymbolVerb, WeightVerb, ExitVerb]; @@ -93,6 +98,9 @@ public static class MapEditing [ ("←↑→↓", "select"), ("⇧←↑→↓", "move"), + ("PgUp PgDn", "level"), + ("v", "next area"), + ("h", "here"), ("r", "rename"), ("a", "area"), ("l", "lock"), @@ -102,6 +110,7 @@ public static class MapEditing ("n", "note"), ("s", "symbol"), ("Del", "delete"), + ("R", "reset to server"), ("u", "undo"), ("⏎", "walk"), ("Esc", "done"), @@ -148,6 +157,14 @@ public static MapEditResult Apply(MapRecorder recorder, MapEdit edit) return new(false, "you are in that room — walk out of it first"); } + if (edit.Kind == MapEditKind.ResetToServer) + { + var reported = recorder.HasServerReport(id); + return recorder.ResetToServer(id, $"reset {name} to server") + ? new(true, reported ? $"{name} is as the server last said" : $"{name} takes the server's next report") + : new(false, $"nothing on {name} was edited by hand"); + } + if (edit.Kind == MapEditKind.LinkNext) { return recorder.LinkNext(id, exit) @@ -194,7 +211,7 @@ public static MapEditResult Apply(MapRecorder recorder, MapEdit edit) /// The /map verbs that edit, which reads. public static IReadOnlyList CommandVerbs { get; } = - ["rename", "area", "lock", "unlock", "weight", "exit", "unexit", "move", "delete", "note", "symbol", "undo"]; + ["rename", "area", "lock", "unlock", "weight", "exit", "unexit", "move", "delete", "note", "symbol", "undo", "reset"]; /// /// A /map command's words after /map, as an edit: rename 12 The Hall, area 12 Keep, @@ -233,11 +250,12 @@ public static (MapEdit? Edit, string? Problem) Parse(string argument, Func "/map delete ", "note" => "/map note [text]", "symbol" => "/map symbol [character]", + "reset" => "/map reset ", _ => null, }; if (usage is null) { - return (null, "use /map lock|unlock [room], rename, area, weight, exit, unexit, move, delete, note, symbol or undo"); + return (null, "use /map lock|unlock [room], rename, area, weight, exit, unexit, move, delete, note, symbol, reset or undo"); } space = rest.IndexOf(' '); @@ -260,6 +278,8 @@ public static (MapEdit? Edit, string? Problem) Parse(string argument, Func MapEdit.Lock(room, false), DeleteVerb => MapEdit.Delete(room), UndoVerb => MapEdit.Undo, + ResetVerb => MapEdit.ResetToServer(room), _ => null, }; diff --git a/src/SharpMUTerm.Client/Panels/MapLooking.cs b/src/SharpMUTerm.Client/Panels/MapLooking.cs new file mode 100644 index 00000000..b4df8716 --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/MapLooking.cs @@ -0,0 +1,259 @@ +using System.Globalization; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Core.Mapping; + +namespace SharpMUTerm.Client.Panels; + +/// +/// Where a map view looks when it is not where the character is: one area's one level. Held by the client per map window; +/// null means the view follows the character ( false). +/// +/// The area shown (), or null for rooms in no area. +/// The level shown (z). +public sealed record MapViewpoint(int? AreaId, int Level); + +/// What a request to look elsewhere on the map asks for. +public enum MapLookKind +{ + /// Back to where the character is. + Here, + + /// The next level up in the area shown that has rooms. + Up, + + /// The next level down in the area shown that has rooms. + Down, + + /// An area by name (). + Area, + + /// The next area by name, after the one shown. + NextArea, +} + +/// +/// A request to look at another level or area of a map, as both hosts make it: the cell map's keys, its title and legend +/// links, a /map command, and the window's buttons, wheel and area menu. Every one ends in the client's +/// LookMap, which resolves it with . +/// +public sealed record MapLook(MapLookKind Kind, string? Area = null) +{ + public static MapLook Here { get; } = new(MapLookKind.Here); + + public static MapLook Up { get; } = new(MapLookKind.Up); + + public static MapLook Down { get; } = new(MapLookKind.Down); + + public static MapLook NextArea { get; } = new(MapLookKind.NextArea); + + public static MapLook ToArea(string area) => new(MapLookKind.Area, area); +} + +/// A room a search found: its number, name and area (bounded), and where it is, which a view can be pointed at. +public sealed record MapFoundRoom(long Id, string Name, string? Area, int? AreaId, int Level); + +/// What resolving a did: whether the view moved, where it now looks, and a sentence. +public sealed record MapLookResult(bool Done, MapViewpoint? Next, string Message); + +/// Looking at another level or area of a map: resolving a request, the window's area menu, and reading /map words. +public static class MapLooking +{ + /// The area menu's entry verbs: area:N picks [N]; here goes back. + public const string AreaVerbPrefix = "area:", HereVerb = "here"; + + /// + /// Where takes a view that now looks at (null: where the character is, + /// or with no current room the most recently recorded room). A viewpoint that is where the character is comes back + /// null, so the view follows them again. Nothing is changed by a request that is refused. + /// + public static MapLookResult Resolve(WorldMap map, long? currentRoomId, MapViewpoint? now, MapLook look) + { + ArgumentNullException.ThrowIfNull(map); + ArgumentNullException.ThrowIfNull(look); + var home = (currentRoomId is { } id ? map.Room(id) : null) ?? map.Rooms.Values.LastOrDefault(); + if (home is null) + { + return new(false, now, "nothing is mapped yet"); + } + + var at = now ?? new MapViewpoint(home.AreaId, home.Z); + MapViewpoint next; + switch (look.Kind) + { + case MapLookKind.Here: + return now is null ? new(false, null, "the map already shows where you are") : new(true, null, "the map shows where you are again"); + case MapLookKind.Up or MapLookKind.Down: + { + var up = look.Kind == MapLookKind.Up; + var levels = map.Rooms.Values.Where(r => r.AreaId == at.AreaId).Select(r => r.Z).Distinct().ToList(); + var further = levels.Where(z => up ? z > at.Level : z < at.Level).ToList(); + if (further.Count == 0) + { + return new(false, now, $"no level {(up ? "above" : "below")} {at.Level.ToString(CultureInfo.InvariantCulture)} in {AreaLabel(map, at.AreaId)}"); + } + + next = at with { Level = up ? further.Min() : further.Max() }; + break; + } + + case MapLookKind.Area or MapLookKind.NextArea: + { + var choices = Choices(map); + MapArea? area; + if (look.Kind == MapLookKind.NextArea) + { + if (choices.Count < 2) + { + return new(false, now, "this map has only one area"); + } + + var index = choices.FindIndex(a => a.Id == at.AreaId); + area = choices[(index + 1) % choices.Count]; + } + else + { + var name = (look.Area ?? string.Empty).Trim(); + area = choices.FirstOrDefault(a => string.Equals(MapViewModel.Bound(a.Name), name, StringComparison.Ordinal)) + ?? choices.FirstOrDefault(a => string.Equals(a.Name, name, StringComparison.OrdinalIgnoreCase)) + ?? choices.FirstOrDefault(a => a.Name.StartsWith(name, StringComparison.OrdinalIgnoreCase) && name.Length > 0); + if (area is null) + { + return new(false, now, $"no area called {Snippet(name)} on this map"); + } + + if (area.Id == at.AreaId) + { + return new(false, now, $"the map already shows {Snippet(area.Name)}"); + } + } + + // The level the character is on when the area has rooms there, else the nearest level it has. + var levels = map.Rooms.Values.Where(r => r.AreaId == area.Id).Select(r => r.Z).Distinct().ToList(); + var level = levels.Contains(home.Z) ? home.Z : levels.OrderBy(z => Math.Abs(z - at.Level)).ThenBy(z => z).First(); + next = new MapViewpoint(area.Id, level); + break; + } + + default: + return new(false, now, "nothing to look at"); + } + + if (next.AreaId == home.AreaId && next.Level == home.Z) + { + return new(true, null, "the map shows where you are again"); + } + + return new(true, next, $"the map shows {AreaLabel(map, next.AreaId)}, level {next.Level.ToString(CultureInfo.InvariantCulture)}"); + } + + /// The areas a view can be pointed at: every named area that holds a room, by name. + public static List Choices(WorldMap map) + { + var used = map.Rooms.Values.Select(r => r.AreaId).OfType().ToHashSet(); + return map.Areas.Values + .Where(a => used.Contains(a.Id) && !string.IsNullOrWhiteSpace(a.Name)) + .OrderBy(a => a.Name, StringComparer.Ordinal) + .ThenBy(a => a.Id) + .Take(MapViewModel.MaxAreaChoices) + .ToList(); + } + + /// + /// The window's area menu: each area the map has, the one shown checked off by being disabled, then a way back to + /// where the character is while the view is elsewhere. + /// + public static MenuModel AreaMenu(MapViewModel view) + { + ArgumentNullException.ThrowIfNull(view); + var entries = new List(); + for (var i = 0; i < view.AreaChoices.Count; i++) + { + var area = view.AreaChoices[i]; + entries.Add(new MenuEntry(Snippet(area.Name), area.Drawn ? "shown" : null, area.Drawn ? null : AreaVerbPrefix + i.ToString(CultureInfo.InvariantCulture), Enabled: !area.Drawn)); + } + + if (view.Viewing) + { + entries.Add(MenuEntry.Separator); + entries.Add(new MenuEntry("Back to where I am", "h", HereVerb)); + } + + return new MenuModel(entries); + } + + /// The look an area menu verb asks for, or null for a verb that is not one. + public static MapLook? LookFor(string verb, MapViewModel view) + { + ArgumentNullException.ThrowIfNull(view); + if (verb == HereVerb) + { + return MapLook.Here; + } + + return verb.StartsWith(AreaVerbPrefix, StringComparison.Ordinal) + && int.TryParse(verb.AsSpan(AreaVerbPrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out var index) + && index < view.AreaChoices.Count + ? MapLook.ToArea(view.AreaChoices[index].Name) + : null; + } + + /// The /map verbs that look elsewhere, which reads. + public static IReadOnlyList CommandVerbs { get; } = ["level", "view", "here"]; + + /// + /// /map level up|down, /map view <area> (or next), /map here, as a look. Null with a + /// problem for anything else. + /// + public static (MapLook? Look, string? Problem) Parse(string argument) + { + var words = (argument ?? string.Empty).Trim(); + var space = words.IndexOf(' '); + var verb = (space < 0 ? words : words[..space]).ToLowerInvariant(); + var rest = space < 0 ? string.Empty : words[(space + 1)..].Trim(); + return verb switch + { + "here" => (MapLook.Here, null), + "level" when rest.Equals("up", StringComparison.OrdinalIgnoreCase) || rest == "+" => (MapLook.Up, null), + "level" when rest.Equals("down", StringComparison.OrdinalIgnoreCase) || rest == "-" => (MapLook.Down, null), + "level" => (null, "use /map level up or /map level down"), + "view" when rest.Length == 0 => (null, "use /map view , /map view next or /map here"), + "view" when rest.Equals("next", StringComparison.OrdinalIgnoreCase) => (MapLook.NextArea, null), + "view" => (MapLook.ToArea(rest), null), + _ => (null, "use /map level up|down, /map view or /map here"), + }; + } + + /// The most rooms lists. + public const int MaxFound = 20; + + /// + /// Rooms whose name or area holds , ignoring case: name matches first, then area matches, each + /// by name and then number; at most , with how many matched in all. + /// + public static (IReadOnlyList Rooms, int Total) Find(WorldMap map, string text) + { + ArgumentNullException.ThrowIfNull(map); + var query = (text ?? string.Empty).Trim(); + if (query.Length == 0) + { + return ([], 0); + } + + string? AreaOf(MapRoom r) => r.AreaId is { } a && map.Areas.TryGetValue(a, out var area) && !string.IsNullOrWhiteSpace(area.Name) ? area.Name : null; + var matches = map.Rooms.Values + .Select(r => (Room: r, Area: AreaOf(r), ByName: r.Name.Contains(query, StringComparison.OrdinalIgnoreCase))) + .Where(m => m.ByName || (m.Area?.Contains(query, StringComparison.OrdinalIgnoreCase) ?? false)) + .OrderBy(m => m.ByName ? 0 : 1) + .ThenBy(m => m.Room.Name, StringComparer.OrdinalIgnoreCase) + .ThenBy(m => m.Room.Id) + .ToList(); + return (matches.Take(MaxFound) + .Select(m => new MapFoundRoom(m.Room.Id, MapViewModel.Bound(m.Room.Name), m.Area is null ? null : MapViewModel.Bound(m.Area), m.Room.AreaId, m.Room.Z)) + .ToList(), matches.Count); + } + + private static string AreaLabel(WorldMap map, int? areaId) => + areaId is { } id && map.Areas.TryGetValue(id, out var area) && !string.IsNullOrWhiteSpace(area.Name) ? Snippet(area.Name) : "no area"; + + private static string Snippet(string text) => text.Length <= 40 ? text : text[..39] + "…"; +} diff --git a/src/SharpMUTerm.Client/Panels/MapViewModel.cs b/src/SharpMUTerm.Client/Panels/MapViewModel.cs index 5f6a0e5a..94645457 100644 --- a/src/SharpMUTerm.Client/Panels/MapViewModel.cs +++ b/src/SharpMUTerm.Client/Panels/MapViewModel.cs @@ -19,9 +19,10 @@ namespace SharpMUTerm.Client.Panels; /// Whether it is the room being edited (). /// The one character the player marked it with, or null. /// Whether the player wrote a note on it. +/// Whether a field the server reports was changed by hand (). public sealed record MapViewRoom( long Id, string Name, int X, int Y, bool Current, bool Ahead, bool Locked, bool Up = false, bool Down = false, string? Elsewhere = null, - bool Selected = false, string? Symbol = null, bool Noted = false); + bool Selected = false, string? Symbol = null, bool Noted = false, bool HandEdited = false); /// An exit as a view names it: the direction or command, and the room it leads to, or none for a stub. /// A direction's short command (n, up) or a special exit's command. @@ -36,10 +37,17 @@ public sealed record MapViewExitName(string Exit, long? To, string? Name); public sealed record MapRoomDetails( long Id, string Name, string? Area, int X, int Y, int Z, int Weight, bool Locked, string? Symbol, string? Note, IReadOnlyList Exits) { + /// + /// The fields changed by hand (, in that order), which the server's next report leaves alone + /// until the room is reset to the server. + /// + public IReadOnlyList HandEdited { get; init; } = []; + /// Value equality over the exits too, which a record's list member does not give. public bool Equals(MapRoomDetails? other) => other is not null && Id == other.Id && Name == other.Name && Area == other.Area && (X, Y, Z) == (other.X, other.Y, other.Z) - && Weight == other.Weight && Locked == other.Locked && Symbol == other.Symbol && Note == other.Note && Exits.SequenceEqual(other.Exits); + && Weight == other.Weight && Locked == other.Locked && Symbol == other.Symbol && Note == other.Note && Exits.SequenceEqual(other.Exits) + && HandEdited.SequenceEqual(other.HandEdited); public override int GetHashCode() => HashCode.Combine(Id, Name, Area, X, Y, Z, Weight, Exits.Count); } @@ -69,6 +77,30 @@ public sealed record MapViewModel(string? Area, int Level, IReadOnlyListThe longest room or area name a view is given. public const int MaxNameLength = 80; + /// The most areas lists. + public const int MaxAreaChoices = 64; + + /// + /// Whether the view is somewhere the player asked to look () rather than where the + /// character is: both hosts then offer the way back. + /// + public bool Viewing { get; init; } + + /// The levels the drawn area has rooms on, lowest first: what the level buttons and keys step through. + public IReadOnlyList Levels { get; init; } = []; + + /// Whether the drawn area has a level above the one drawn. + public bool LevelAbove => Levels.Any(z => z > Level); + + /// Whether the drawn area has a level below the one drawn. + public bool LevelBelow => Levels.Any(z => z < Level); + + /// + /// Every named area of the map that holds a room, by name, each in its colour and for + /// the one drawn: what the window's area menu lists and the cell map's area key cycles through. + /// + public IReadOnlyList AreaChoices { get; init; } = []; + /// /// The room the view is drawn around: the character's, or with no current room the most recently recorded one. /// Null when nothing is mapped. The cell map centres on this room too, so the two views never disagree about it. @@ -125,16 +157,30 @@ public sealed record MapViewModel(string? Area, int Level, IReadOnlyList /// An exit waiting for the next room walked into (). /// What an undo would take back (). + /// + /// Another area or level to draw (), or null to draw where the character is. A viewpoint + /// with no rooms is ignored. The view is then drawn around the room of that set nearest the character's place. + /// public static MapViewModel From( WorldMap map, long? currentRoomId, IEnumerable ahead, string? walking, MapAreaPalette? palette = null, - long? selected = null, (long From, string Exit)? pending = null, string? undo = null) + long? selected = null, (long From, string Exit)? pending = null, string? undo = null, MapViewpoint? look = null) { ArgumentNullException.ThrowIfNull(map); palette ??= MapAreaPalette.Dark; var anchor = currentRoomId is { } id ? map.Room(id) : null; anchor ??= map.Rooms.Values.LastOrDefault(); + var home = anchor; + var viewing = false; + if (look is { } v && home is not null && (v.AreaId != home.AreaId || v.Level != home.Z) + && map.Rooms.Values.Where(r => r.Z == v.Level && r.AreaId == v.AreaId) + .OrderBy(r => Math.Abs(r.X - home.X) + Math.Abs(r.Y - home.Y)).ThenBy(r => r.Id).FirstOrDefault() is { } there) + { + anchor = there; + viewing = true; + } + var chosen = selected is { } pick ? map.Room(pick) : null; - if (chosen is not null && (anchor is null || chosen.Z != anchor.Z || chosen.AreaId != anchor.AreaId)) + if (!viewing && chosen is not null && (anchor is null || chosen.Z != anchor.Z || chosen.AreaId != anchor.AreaId)) { anchor = chosen; } @@ -166,7 +212,8 @@ public static MapViewModel From( Elsewhere(map, r), r.Id == chosen?.Id, ValidSymbol(r.Symbol), - r.Note is not null)) + r.Note is not null, + r.HandEdited.Count > 0)) .ToList(); var ids = rooms.Select(r => r.Id).ToHashSet(); var exits = new List(); @@ -204,10 +251,16 @@ public static MapViewModel From( } var here = currentRoomId is { } at ? map.Room(at) : null; + var choices = MapLooking.Choices(map) + .Select(a => new MapViewArea(Bounded(a.Name), palette.Colour(Bounded(a.Name)), Drawn: a.Id == anchor.AreaId)) + .ToList(); return new MapViewModel(area, anchor.Z, rooms, exits, walking) { AnchorId = anchor.Id, Areas = areas, + Viewing = viewing, + Levels = map.Rooms.Values.Where(r => r.AreaId == anchor.AreaId).Select(r => r.Z).Distinct().Order().ToList(), + AreaChoices = choices, Nearby = here is null ? [] : ExitsOf(map, here), Selected = chosen is null ? null : DetailsOf(map, chosen), Pending = pendingText, @@ -255,7 +308,13 @@ private static List ExitsOf(WorldMap map, MapRoom room) room.Locked, ValidSymbol(room.Symbol), room.Note is { } note ? Bounded(note) : null, - ExitsOf(map, room)); + ExitsOf(map, room)) + { + HandEdited = MapFields.All.Where(room.HandEdited.Contains).ToList(), + }; + + /// A name as a view is given it: at most characters. + public static string Bound(string name) => Bounded(name); /// A symbol a view may draw: its first character when that is one a cell can hold, else null. private static string? ValidSymbol(string? symbol) => @@ -309,7 +368,8 @@ private static bool Climbs(WorldMap map, MapRoom room, bool up) public bool Equals(MapViewModel? other) => other is not null && Area == other.Area && Level == other.Level && Walking == other.Walking && AnchorId == other.AnchorId && Rooms.SequenceEqual(other.Rooms) && Exits.SequenceEqual(other.Exits) && Areas.SequenceEqual(other.Areas) - && Nearby.SequenceEqual(other.Nearby) && Equals(Selected, other.Selected) && Pending == other.Pending && UndoLabel == other.UndoLabel; + && Nearby.SequenceEqual(other.Nearby) && Equals(Selected, other.Selected) && Pending == other.Pending && UndoLabel == other.UndoLabel + && Viewing == other.Viewing && Levels.SequenceEqual(other.Levels) && AreaChoices.SequenceEqual(other.AreaChoices); public override int GetHashCode() => HashCode.Combine(Area, Level, Walking, Rooms.Count, Exits.Count, Areas.Count); } diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index a9d5b48d..0629ac20 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -304,6 +304,10 @@ public static class SurfaceCatalog // while editing), and every edit — cell key, /map command, native menu or inspector — through one funnel. new(SurfaceActionKind.Pick, "select room", "SelectMapRoom"), new(SurfaceActionKind.MapEdit, "edit", "ApplyMapEdit"), + + // Another level or area, and back: the cell title's arrows, its legend's areas and the edit keys; the + // window's level buttons, wheel and area menu. + new(SurfaceActionKind.Pick, "look", "LookMap"), PopOut, ], CellsUnderNative, diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index f584673d..19fdb2d7 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -63,6 +63,9 @@ public sealed record CharacterRef( /// Whether the client's own dictionaries folder holds none, so Get a spelling dictionary is offered. /// /// What the focused character's last map edit was, so Undo map edit is offered only with one. +/// How many levels the area the focused character's map shows has (0 with no map). +/// How many named areas that map has. +/// Whether that map shows somewhere other than where the character is. public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -82,7 +85,10 @@ public sealed record CommandContext( IReadOnlyList? RaggedWraps = null, bool NoDictionary = false, string? MapUndo = null, - bool SceneLogging = false); + bool SceneLogging = false, + int MapLevels = 0, + int MapAreas = 0, + bool MapViewing = false); /// A world whose pane is narrower than its server's wrap column. /// The world's name. diff --git a/src/SharpMUTerm.Core/Mapping/MapModel.cs b/src/SharpMUTerm.Core/Mapping/MapModel.cs index 02425174..bf0a69bf 100644 --- a/src/SharpMUTerm.Core/Mapping/MapModel.cs +++ b/src/SharpMUTerm.Core/Mapping/MapModel.cs @@ -62,6 +62,12 @@ public sealed class MapRoom /// Anything a script wants to keep on the room. public Dictionary UserData { get; set; } = new(StringComparer.Ordinal); + /// + /// The fields the player changed by hand (): a room report from the server leaves these alone, + /// so a GMCP world does not undo a rename, an area, an exit or a move on the next visit. Kept with the map. + /// + public HashSet HandEdited { get; set; } = new(StringComparer.Ordinal); + /// A deep copy, for an edit's undo. public MapRoom Clone() => new() { @@ -83,6 +89,7 @@ public sealed class MapRoom Color = Color, Note = Note, UserData = new(UserData, StringComparer.Ordinal), + HandEdited = new(HandEdited, StringComparer.Ordinal), }; /// Every exit, direction and special alike, as the command that takes it and where it leads. @@ -100,6 +107,15 @@ public sealed class MapRoom } } +/// The fields of a room a hand edit protects from the server's next report (). +public static class MapFields +{ + public const string Name = "name", Area = "area", Exits = "exits", Position = "position"; + + /// Every field, in the order a view lists them. + public static IReadOnlyList All { get; } = [Name, Area, Exits, Position]; +} + /// A named area rooms belong to. public sealed class MapArea { @@ -162,6 +178,7 @@ public bool Rename(long id, string name) } room.Name = text; + room.HandEdited.Add(MapFields.Name); return true; } @@ -181,6 +198,7 @@ public bool SetArea(long id, string? area) } room.AreaId = next; + room.HandEdited.Add(MapFields.Area); return true; } @@ -225,6 +243,11 @@ public bool SetExit(long id, string exit, long to) var changed = !exits.TryGetValue(key, out var was) || was != to; exits[key] = to; changed |= room.Stubs.Remove(key); + if (changed) + { + room.HandEdited.Add(MapFields.Exits); + } + return changed; } @@ -240,6 +263,11 @@ public bool RemoveExit(long id, string exit) var removed = room.Exits.Remove(key) | room.SpecialExits.Remove(key) | room.Stubs.Remove(key); room.ExitWeights.Remove(key); room.LockedExits.Remove(key); + if (removed) + { + room.HandEdited.Add(MapFields.Exits); + } + return removed; } @@ -252,6 +280,19 @@ public bool Move(long id, int dx, int dy, int dz) } (room.X, room.Y, room.Z) = (room.X + dx, room.Y + dy, room.Z + dz); + room.HandEdited.Add(MapFields.Position); + return true; + } + + /// Forgets which fields of a room were edited by hand, so the server's reports set them again. + public bool ClearHandEdits(long id) + { + if (Room(id) is not { } room || room.HandEdited.Count == 0) + { + return false; + } + + room.HandEdited.Clear(); return true; } diff --git a/src/SharpMUTerm.Core/Mapping/MapRecorder.cs b/src/SharpMUTerm.Core/Mapping/MapRecorder.cs index fbdf3352..7e12b628 100644 --- a/src/SharpMUTerm.Core/Mapping/MapRecorder.cs +++ b/src/SharpMUTerm.Core/Mapping/MapRecorder.cs @@ -217,6 +217,58 @@ public bool LinkNext(long from, string exit) return true; } + /// The last report of each room, this run: what puts back. + private readonly Dictionary _served = new(); + + /// + /// Gives a room back to the server: forgets which of its fields were edited by hand () + /// and, when the server has reported the room this run, puts back its name, area, exits and place at once; otherwise + /// the next report does. Undoable like any edit. False when nothing was edited by hand. + /// + public bool ResetToServer(long id, string label) => Edit(label, [id], map => + { + if (map.Room(id) is not { } room || room.HandEdited.Count == 0) + { + return false; + } + + var edited = room.HandEdited.ToList(); + room.HandEdited.Clear(); + if (_served.TryGetValue(id, out var seen)) + { + if (edited.Contains(MapFields.Name) && seen.Name.Length > 0) + { + room.Name = seen.Name; + } + + if (edited.Contains(MapFields.Area) && !string.IsNullOrWhiteSpace(seen.Area)) + { + room.AreaId = map.AreaNamed(seen.Area).Id; + } + + if (edited.Contains(MapFields.Exits)) + { + SetExits(room, seen.Exits); + } + + if (edited.Contains(MapFields.Position) && seen.Coordinates is { } at) + { + (room.X, room.Y, room.Z) = at; + } + } + + return true; + }); + + /// Whether the server has reported this room this run, so a reset can put its values back at once. + public bool HasServerReport(long id) + { + lock (SyncRoot) + { + return _served.ContainsKey(id); + } + } + /// Takes back the last edit. Returns what it took back, or null when there was nothing to. public string? Undo() { @@ -299,7 +351,16 @@ private void ApplyCore(RoomObservation observation) { if (Map.Room(observation.Id ?? CurrentRoomId ?? long.MinValue) is { } here) { - SetExits(here, observation.Exits); + if (_served.TryGetValue(here.Id, out var seen)) + { + _served[here.Id] = seen with { Exits = observation.Exits }; + } + + if (!here.HandEdited.Contains(MapFields.Exits)) + { + SetExits(here, observation.Exits); + } + Touch(); } @@ -314,13 +375,20 @@ private void ApplyCore(RoomObservation observation) var room = Map.Room(id); var created = room is null; room ??= Map.Add(new MapRoom { Id = id }); + _served[room.Id] = observation; - if (observation.Name.Length > 0) + // A field the player edited by hand is theirs: the report leaves it alone until "reset to server". + var mine = room.HandEdited; + if (observation.Name.Length > 0 && !mine.Contains(MapFields.Name)) { room.Name = observation.Name; } - if (!string.IsNullOrWhiteSpace(observation.Area)) + if (mine.Contains(MapFields.Area)) + { + // kept as the player set it + } + else if (!string.IsNullOrWhiteSpace(observation.Area)) { room.AreaId = Map.AreaNamed(observation.Area).Id; } @@ -330,11 +398,17 @@ private void ApplyCore(RoomObservation observation) } room.Environment = observation.Environment ?? room.Environment; - SetExits(room, observation.Exits); + if (!mine.Contains(MapFields.Exits)) + { + SetExits(room, observation.Exits); + } if (observation.Coordinates is { } at) { - (room.X, room.Y, room.Z) = at; + if (!mine.Contains(MapFields.Position)) + { + (room.X, room.Y, room.Z) = at; + } } else if (created) { diff --git a/src/SharpMUTerm.Core/Mapping/MapStore.cs b/src/SharpMUTerm.Core/Mapping/MapStore.cs index d539c590..8ee8fb60 100644 --- a/src/SharpMUTerm.Core/Mapping/MapStore.cs +++ b/src/SharpMUTerm.Core/Mapping/MapStore.cs @@ -35,8 +35,11 @@ public sealed class MapStore /// What an unreadable map file is renamed with, so a new one can be written. public const string AsideSuffix = ".unreadable"; - /// This file's schema version. - public const int CurrentVersion = 1; + /// + /// This file's schema version. 2 added each room's handEdited fields (); a + /// version 1 file reads as a map with nothing edited by hand, and is written back as version 2. + /// + public const int CurrentVersion = 2; private static readonly JsonSerializerOptions Json = new() { @@ -158,6 +161,7 @@ public static WorldMap Deserialize(string text) $"this map was written by a newer SharpMUTerm (map version {version}; this one reads {CurrentVersion})"); } + Migrate(document, version); var map = new WorldMap(); foreach (var area in document["areas"]?.Deserialize(Json) ?? []) { @@ -172,6 +176,23 @@ public static WorldMap Deserialize(string text) return map; } + /// + /// Brings an older file's document up to , one revision at a time. 1 → 2: no room was + /// marked as edited by hand, because nothing recorded it — every room starts with an empty handEdited. + /// + private static void Migrate(JsonObject document, int version) + { + if (version < 2 && document["rooms"] is JsonArray rooms) + { + foreach (var room in rooms.OfType()) + { + room["handEdited"] = new JsonArray(); + } + } + + document["version"] = CurrentVersion; + } + /// /// Puts back what a hand-edited file may have lost: the dictionaries' ordinal comparers (the serializer /// builds default ones), a weight of at least 1, and only real directions among the exits. @@ -193,6 +214,7 @@ private static MapRoom Normalised(MapRoom room) room.LockedExits = new HashSet(room.LockedExits ?? [], StringComparer.Ordinal); room.Stubs = new HashSet(room.Stubs ?? [], StringComparer.Ordinal); room.UserData = new Dictionary(room.UserData ?? [], StringComparer.Ordinal); + room.HandEdited = new HashSet((room.HandEdited ?? []).Where(MapFields.All.Contains), StringComparer.Ordinal); room.Name ??= string.Empty; room.Weight = Math.Max(1, room.Weight); return room; diff --git a/src/SharpMUTerm.Tui/MapRenderer.cs b/src/SharpMUTerm.Tui/MapRenderer.cs index c182fd2f..c1397dcc 100644 --- a/src/SharpMUTerm.Tui/MapRenderer.cs +++ b/src/SharpMUTerm.Tui/MapRenderer.cs @@ -72,6 +72,34 @@ private enum Kind private readonly record struct Cell(char Glyph, Kind Kind, long? Room, string? Colour = null); + /// The payload prefix of a look link: the title's level arrows and way back, and the legend's areas. + internal const string LookPrefix = LinkPrefix + "look:"; + + /// + /// The look a map link asks for, or null for anything else: up, down, here, or area:N, the + /// Nth of 's (an index, never a name: an area's name is the + /// game's text). + /// + internal static MapLook? ParseLook(string url, MapViewModel view) + { + if (!url.StartsWith(LookPrefix, StringComparison.Ordinal)) + { + return null; + } + + var what = url[LookPrefix.Length..]; + return what switch + { + "up" => MapLook.Up, + "down" => MapLook.Down, + "here" => MapLook.Here, + _ when what.StartsWith("area:", StringComparison.Ordinal) + && int.TryParse(what.AsSpan(5), NumberStyles.None, CultureInfo.InvariantCulture, out var index) + && index < view.Areas.Count => MapLook.ToArea(view.Areas[index].Name), + _ => null, + }; + } + /// The room number a map link names, or null for anything else. internal static long? ParseLink(string url) => url.StartsWith(LinkPrefix, StringComparison.Ordinal) @@ -126,7 +154,7 @@ internal static List Render(MapViewModel view, WorldMap map, int width, var ahead = view.Rooms.Where(r => r.Ahead).Select(r => r.Id); // The room you are in leads the title: the one name a reader wants from a map at a glance, and the one a grid // of [ ] cannot say. With no current room the map is a map of somewhere else, and says so. - var title = new StringBuilder(view.Current is { } here ? here.Name : "Map"); + var title = new StringBuilder(view.Current is { } here ? here.Name : view.Viewing ? "Viewing" : "Map"); if (!string.IsNullOrWhiteSpace(view.Area)) { title.Append(" · ").Append(view.Area); @@ -138,7 +166,16 @@ internal static List Render(MapViewModel view, WorldMap map, int width, title.Append(" · ").Append(walking); } - lines.Add(Title(title.ToString(), width, ink)); + // The ways to look elsewhere and back, after the title: links the map's own handler answers. + var (controls, controlsWidth) = LookControls(view, ink); + if (controlsWidth > 0 && controlsWidth + 8 <= width) + { + lines.Add(Title(title.ToString(), width - controlsWidth, ink) + controls); + } + else + { + lines.Add(Title(title.ToString(), width, ink)); + } if (height == 1) { return lines; @@ -333,11 +370,13 @@ private static string Legend(MapViewModel view, int width, Ink ink) return marks; } + // Another area's entry is a link: a click shows that area (its index, never its name, is the payload). List<(string Markup, int Length)> Areas(int cap) => view.Areas - .Select(a => + .Select((a, i) => { var name = a.Name.Length <= cap ? a.Name : a.Name[..(cap - 1)] + "…"; - return (Markup: $"[{AreaInk(a.Colour, ink)}]■[/] [dim]{MarkupText.Escape(name)}[/]", Length: 2 + name.Length); + var markup = $"[{AreaInk(a.Colour, ink)}]■[/] [dim]{MarkupText.Escape(name)}[/]"; + return (Markup: a.Drawn ? markup : $"[link={LookPrefix}area:{i.ToString(CultureInfo.InvariantCulture)}]{markup}[/]", Length: 2 + name.Length); }) .ToList(); @@ -365,6 +404,33 @@ private static string Legend(MapViewModel view, int width, Ink ink) return Fit(string.Join(" [dim]·[/] ", Marks(words: false).Select(p => p.Markup)), width); } + /// + /// The title's look links and their width: ▲ ▼ while the drawn area has more than one level (an arrow with no + /// level that way is dim and not a link), and ⌂ here while the view is somewhere the player asked to look. + /// Empty when there is nothing to offer, so a one-level map's title is as it always was. + /// + internal static (string Markup, int Width) LookControls(MapViewModel view, Ink ink) + { + var parts = new List<(string Markup, int Width)>(); + if (view.Levels.Count > 1) + { + parts.Add((Arrow("▲", "up", view.LevelAbove), 1)); + parts.Add((Arrow("▼", "down", view.LevelBelow), 1)); + } + + if (view.Viewing) + { + parts.Add(($"[link={LookPrefix}here][bold {ink.Current}]⌂ here[/][/]", 6)); + } + + return parts.Count == 0 + ? (string.Empty, 0) + : (" " + string.Join(" ", parts.Select(p => p.Markup)), 2 + parts.Sum(p => p.Width) + parts.Count - 1); + + string Arrow(string glyph, string way, bool open) => + open ? $"[link={LookPrefix}{way}][bold {ink.Title}]{glyph}[/][/]" : $"[dim]{glyph}[/]"; + } + /// The lengths an area name is shortened through, longest first, before an area is counted instead. private static readonly int[] LegendNameCaps = [24, 14, 8]; @@ -452,7 +518,7 @@ private static List UnderLines(MapViewModel view, int width, int height, : height >= 4 ? [RoomLine(view, width, ink), .. KeysLines(width, ink, keysHeld, 1)] : []; } - if (height < UnderFromHeight || view.Nearby.Count == 0) + if (height < UnderFromHeight || view.Nearby.Count == 0 || view.Viewing) { return []; } @@ -483,6 +549,12 @@ private static List DetailLines(MapViewModel view, int width, Ink ink) lines.Add(Fit($"[dim]note [/]{Name(note, width - 6)}", width)); } + if (room.HandEdited.Count > 0) + { + // What the server's next report will leave alone, and the key that gives it back. + lines.Add(Fit($"[dim]mine [/]{MarkupText.Escape(string.Join(", ", room.HandEdited))} [dim]· R resets[/]", width)); + } + if (view.Pending is { } pending) { lines.Add(Fit($"[{ink.Path}]{Name(pending, width)}[/]", width)); @@ -530,6 +602,11 @@ private static string RoomLine(MapViewModel view, int width, Ink ink) parts.Add("note: " + note); } + if (room.HandEdited.Count > 0) + { + parts.Add("mine: " + string.Join(", ", room.HandEdited)); + } + if (view.Pending is { } pending) { parts.Add(pending); diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index e2a4f237..6fe97200 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -228,6 +228,10 @@ void Notice(NoticeOverlay notice) /// client checks it; the window only builds a from its inspector. Safe to /// call from any thread; one instance per window. /// +/// +/// For the map, looks at another level or area, or back at the character (LookMap), the funnel the cell map's look +/// keys and links end in. Safe to call from any thread; one instance per window. +/// internal sealed record PanelOverlay( string PanelId, string WindowId, @@ -244,7 +248,8 @@ internal sealed record PanelOverlay( SharpMUTerm.Client.Composer.ComposerSession? ComposerSession = null, Action? PopOut = null, Action? SelectRoom = null, - Action? EditMap = null); + Action? EditMap = null, + Action? LookMap = null); /// A panel's colours as #rrggbb: a bar or fill, the warning, and the empty part of a bar. internal sealed record PanelInk(string Bar, string Low, string Track); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs index 2107f9ba..e9373c16 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -243,7 +243,8 @@ private void PublishPanels() : _mapWalkers[windowId] = room => OnUiThread(() => WalkFromMap(windowId, room)); return new PanelOverlay( PanelIds.Map, windowId, rect, new PanelInk(_ink.Accent, _ink.Draft, _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))), null, view, walker, - PopOut: popOut, SelectRoom: MapSelectorFor(windowId), EditMap: MapEditorFor(windowId)); + PopOut: popOut, SelectRoom: MapSelectorFor(windowId), EditMap: MapEditorFor(windowId), + LookMap: MapLookerFor(windowId)); } if (!TerminalPanels.TryParseWindowId(windowId, out var panelId, out var key)) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs index 65409e8d..2de7e3bd 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs @@ -54,7 +54,8 @@ private MapViewModel BuildMapView(string windowId, SessionMap map) var walking = map.Walk.IsWalking ? $"walking, {map.Walk.Remaining} to go" : null; long? selected = _mapSelection.TryGetValue(windowId, out var room) && map.Map.Room(room) is not null ? room : null; return MapViewModel.From( - map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking, MapPalette(), selected, map.Recorder.PendingLink, map.Recorder.UndoLabel); + map.Map, map.Recorder.CurrentRoomId, map.Walk.RoomsAhead, walking, MapPalette(), selected, map.Recorder.PendingLink, map.Recorder.UndoLabel, + MapLookOf(windowId)); } /// @@ -165,7 +166,7 @@ private void LeaveMapEdit(string windowId) var result = MapEditing.Apply(map.Recorder, edit); if (_mapSelection.TryGetValue(windowId, out var selected) && map.Map.Room(selected) is null) { - var next = map.Recorder.CurrentRoomId ?? MapViewModel.From(map.Map, null, [], null).AnchorId; + var next = MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, [], null, look: MapLookOf(windowId)).AnchorId; if (next is { } room) { _mapSelection[windowId] = room; @@ -248,6 +249,10 @@ private bool TryMapKey(KeyPressedEventArgs e) { ApplyMapEdit(windowId, MapEdit.Delete(room)); } + else if (key.Key is ConsoleKey.PageUp or ConsoleKey.PageDown && bare) + { + LookMap(windowId, key.Key == ConsoleKey.PageUp ? MapLook.Up : MapLook.Down); + } else if (key.Key == ConsoleKey.Escape) { LeaveMapEdit(windowId); @@ -263,6 +268,9 @@ private bool TryMapKey(KeyPressedEventArgs e) { 'l' => Edit(MapEdit.Lock(room, map.Map.Room(room)?.Locked != true)), 'u' => Edit(MapEdit.Undo), + 'R' => Edit(MapEdit.ResetToServer(room)), + 'v' => Look(MapLook.NextArea), + 'h' => Look(MapLook.Here), 'r' => Words(MapEditing.RenameVerb), 'a' => Words(MapEditing.AreaVerb), 'w' => Words(MapEditing.WeightVerb), @@ -290,6 +298,12 @@ bool Edit(MapEdit edit) return true; } + bool Look(MapLook look) + { + LookMap(windowId, look); + return true; + } + bool Words(string verb) { if (BuildMapView(windowId, map).Selected is not { } details || MapEditing.CommandFor(verb, details) is not { } command) @@ -350,7 +364,7 @@ internal string MapDigest() var area = room.AreaId is { } a && map.Map.Areas.TryGetValue(a, out var named) ? named.Name : "-"; text.Append(CultureInfo.InvariantCulture, $"{room.Id}:{room.Name}@{area}({room.X},{room.Y},{room.Z})w{room.Weight}") .Append(room.Locked ? "L" : string.Empty) - .Append(CultureInfo.InvariantCulture, $"[{room.Symbol}|{room.Note}]{{") + .Append(CultureInfo.InvariantCulture, $"[{room.Symbol}|{room.Note}|{string.Join('+', room.HandEdited.Order(StringComparer.Ordinal))}]{{") .AppendJoin(',', room.AllExits().Select(e => $"{e.Key}>{e.To}").Order(StringComparer.Ordinal)) .Append('/') .AppendJoin(',', room.Stubs.Order(StringComparer.Ordinal)) @@ -366,6 +380,11 @@ internal string MapDigest() text.Append(CultureInfo.InvariantCulture, $"selected {window}={room} "); } + foreach (var (window, look) in _mapLooks.OrderBy(p => p.Key, StringComparer.Ordinal)) + { + text.Append(CultureInfo.InvariantCulture, $"look {window}={look.AreaId}/{look.Level} "); + } + return text.Append("keys=").Append(_mapKeys).ToString(); } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs new file mode 100644 index 00000000..f480bdcf --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs @@ -0,0 +1,196 @@ +using System.Globalization; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Mapping; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// +/// Looking at another level or area of a map, in both hosts, from one funnel. A map window draws where its character is +/// until the player asks to look elsewhere; then it holds a (, per map +/// window, for the run) until they ask to come back. Every way of asking — the cell map's edit keys, its title and legend +/// links, a /map command, ⌃P, and the window's level buttons, wheel and area menu — is a that +/// ends in . Walking from a viewed map still walks to the room clicked: the view changes what is +/// drawn, never which room an id names. +/// +internal sealed partial class SharpMUTermApp +{ + /// Where each map window looks, when it is not where its character is. + private readonly Dictionary _mapLooks = new(StringComparer.Ordinal); + + /// The window's look callback, one instance per map window so an overlay compares equal frame to frame. + private readonly Dictionary> _mapLookers = new(StringComparer.Ordinal); + + /// Where a map window looks, or null while it follows its character. Internal for tests. + internal MapViewpoint? MapLookOf(string windowId) => _mapLooks.GetValueOrDefault(windowId); + + /// + /// Points a map window at another level or area, or back at its character: resolved by , + /// said in a notice either way, and redrawn. While the map is being edited the selection moves to the room the view is + /// now drawn around, so the keys edit a room that is on screen. Returns what refused it, or null. + /// + internal string? LookMap(string windowId, MapLook look) + { + if (MapOf(MapOwner(windowId)) is not { } map) + { + Notice("no map here: this window has no connection.", source: NoticeModel.Sources.Map); + return "no map"; + } + + var result = MapLooking.Resolve(map.Map, map.Recorder.CurrentRoomId, MapLookOf(windowId), look); + if (result.Done) + { + SetMapLook(windowId, map, result.Next); + } + + Notice(result.Message + ".", result.Done ? MessageSeverity.Info : MessageSeverity.Warning, source: NoticeModel.Sources.Map); + return result.Done ? null : result.Message; + } + + private void SetMapLook(string windowId, SessionMap map, MapViewpoint? next) + { + if (next is null) + { + _mapLooks.Remove(windowId); + } + else + { + _mapLooks[windowId] = next; + } + + if (_mapSelection.ContainsKey(windowId) + && MapViewModel.From(map.Map, map.Recorder.CurrentRoomId, [], null, look: next).AnchorId is { } anchor) + { + _mapSelection[windowId] = anchor; + } + + RenderMap(windowId); + } + + /// The window's look callback for a map window: every native request through . + private Action MapLookerFor(string windowId) => + _mapLookers.TryGetValue(windowId, out var known) + ? known + : _mapLookers[windowId] = look => OnUiThread(() => LookMap(windowId, look)); + + /// The focused character's map window and map, for ⌃P's entries. + private (string WindowId, SessionMap Map, string Key)? FocusedMap() + { + var key = SendTarget()?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey; + return key is not null && MapOf(key) is { } map ? (MapWindowId(key), map, key) : null; + } + + /// What ⌃P needs to know about the focused character's map: levels in the area shown, named areas, and whether it looks elsewhere. + private (int Levels, int Areas, bool Viewing) MapCommandState() + { + if (FocusedMap() is not { } focused) + { + return (0, 0, false); + } + + var (windowId, map, _) = focused; + var home = map.Recorder.CurrentRoom ?? map.Map.Rooms.Values.LastOrDefault(); + if (home is null) + { + return (0, 0, false); + } + + var look = MapLookOf(windowId); + var areaId = look?.AreaId ?? home.AreaId; + var levels = map.Map.Rooms.Values.Where(r => r.AreaId == areaId).Select(r => r.Z).Distinct().Count(); + return (levels, MapLooking.Choices(map.Map).Count, look is not null); + } + + /// ⌃P's map view entries: level up and down, the next area, back to where you are, and Find room…. + private void RunMapViewCommand(string id) + { + if (FocusedMap() is not { } focused) + { + RefuseCommand("no map here — pick a character first (⌃P ▸ Switch to …)"); + return; + } + + var (windowId, _, key) = focused; + if (id == "map:find") + { + if (ArmedComposer() is not null) + { + ReleaseComposer(); + } + + PlaceGrab(ActiveBar(), "/map find ", key); + Notice("type part of a room's name or area — ⏎ lists the rooms.", MessageSeverity.Info, source: NoticeModel.Sources.Map); + return; + } + + if (_workspace.Layout.FindWindow(windowId) is null && !IsFloating(windowId)) + { + ShowMap(); + } + + LookMap(windowId, id switch + { + "map:level-up" => MapLook.Up, + "map:level-down" => MapLook.Down, + "map:next-area" => MapLook.NextArea, + _ => MapLook.Here, + }); + } + + /// + /// /map level up|down, /map view <area>, /map here and /map find <text>, for the + /// window's own character's map. A search lists the rooms in the window it was typed in and points the map at the first. + /// + private void MapViewCommand(string windowId, SessionMap map, string sessionKey, string argument) + { + var mapWindow = MapWindowId(sessionKey); + var words = argument.Trim(); + + // Typed in the map's own tab, the answer goes to the character's window: a map window draws no lines. + if (IsMapWindow(windowId) && FindSession(sessionKey) is { } owner && _sessionWindows.TryGetValue(owner, out var own)) + { + windowId = own; + } + if (words.StartsWith("find", StringComparison.OrdinalIgnoreCase)) + { + var text = words.Length > 4 ? words[4..].Trim() : string.Empty; + if (text.Length == 0) + { + AppendWindowLine(windowId, "[dim]*** use /map find .[/]"); + return; + } + + var (rooms, total) = MapLooking.Find(map.Map, text); + if (rooms.Count == 0) + { + AppendWindowLine(windowId, $"[dim]*** no room on the map matches {Escape(text)}.[/]"); + return; + } + + var shown = total > rooms.Count ? $"the first {rooms.Count.ToString(CultureInfo.InvariantCulture)} of {total.ToString(CultureInfo.InvariantCulture)}" : total.ToString(CultureInfo.InvariantCulture); + AppendWindowLine(windowId, $"[dim]*** rooms matching {Escape(text)} ({shown}) · /walk goes there:[/]"); + foreach (var room in rooms) + { + var where = (room.Area is { } area ? Escape(area) + " · " : string.Empty) + "level " + room.Level.ToString(CultureInfo.InvariantCulture); + AppendWindowLine(windowId, $"[dim]***[/] [bold]{room.Id.ToString(CultureInfo.InvariantCulture)}[/] {Escape(room.Name)} [dim]{where}[/]"); + } + + // The map shows the first match's area and level, so the room found is on screen. + var first = rooms[0]; + var home = map.Recorder.CurrentRoom ?? map.Map.Rooms.Values.LastOrDefault(); + SetMapLook(mapWindow, map, home is not null && home.AreaId == first.AreaId && home.Z == first.Level ? null : new MapViewpoint(first.AreaId, first.Level)); + return; + } + + var (look, problem) = MapLooking.Parse(words); + if (look is null) + { + AppendWindowLine(windowId, $"[dim]*** {Escape(problem ?? "no such view")}.[/]"); + return; + } + + LookMap(mapWindow, look); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 76a0d642..7e134f31 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1996,10 +1996,10 @@ public string RenderSnapshot(string? view = null) // The map window, over the demo's recorded streets: opened through the real ⌃P entry; `map-walking` // starts a walk to the docks through the real `/walk`, so the path ahead is marked; `map-split` puts // the map beside the output, the way it is meant to be read. - if (view?.ToLowerInvariant() is "map" or "map-walking" or "map-split" or "map-edit") + if (view?.ToLowerInvariant() is "map" or "map-walking" or "map-split" or "map-edit" or "map-level" or "map-area" or "map-find" or "map-mine") { LoadDemoMap(); - var split = view.ToLowerInvariant() is "map-split" or "map-edit"; + var split = view.ToLowerInvariant() is not ("map" or "map-walking"); if (split) { // Split first, so the map opens in front in the right-hand pane, then hand the focus back to @@ -2033,6 +2033,29 @@ public string RenderSnapshot(string? view = null) MapCommand(MainWindowId, "map", "note 4210 Spice traders gather here at dawn"); SimulateMapKey(new ConsoleKeyInfo('l', ConsoleKey.L, false, false, false)); } + + // `map-level`: the real ⌃P ▸ Map: level up, so the frame shows the bell tower's floor with the way back offered. + // `map-area`: the legend's link to the docks clicked, so the frame shows the other area drawn in its colour. + // `map-find`: `/map find temple` typed, listing the rooms and pointing the map at the first. + // `map-mine`: the market renamed by hand, then edited, so the side column says what the server will leave alone. + var mapWindow = MapWindowId(DemoScene.ActiveSessionKey); + switch (view.ToLowerInvariant()) + { + case "map-level": + DispatchCommand("map:level-up"); + break; + case "map-area" when _mapViews.TryGetValue(mapWindow, out var drawn): + OnMapLinkClicked(mapWindow, MapRenderer.LookPrefix + "area:" + drawn.Model.Areas.ToList().FindIndex(a => !a.Drawn)); + break; + case "map-find": + MapCommand(MainWindowId, "map", "find temple"); + break; + case "map-mine": + MapCommand(MainWindowId, "map", "rename 4210 Market Row of Lanterns"); + DispatchCommand("map:edit"); + SimulateMapKey(new ConsoleKeyInfo('\0', ConsoleKey.RightArrow, false, false, false)); + break; + } } // The Packages screen with two installed (one switched off), the review an install opens with, and @@ -8445,6 +8468,7 @@ private void RefreshRail() /// The stateful flags the catalog's labels read, as they stand now. private CommandContext CommandState() { + var mapState = MapCommandState(); return new CommandContext( LoggingOn: _active?.IsLogging == true, Zoomed: _workspace.Layout.ZoomedPaneId is not null, @@ -8456,6 +8480,9 @@ private CommandContext CommandState() ScriptsOn: _scriptsRoot is not null, Walking: SendTarget() is { } walker && _recorders.TryGetValue(walker, out var map) && map.Walk.IsWalking, MapUndo: MapOf(SendTarget()?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey)?.Recorder.UndoLabel, + MapLevels: mapState.Levels, + MapAreas: mapState.Areas, + MapViewing: mapState.Viewing, Reconnecting: _reconnects.Values.Any(r => r.IsActive), Sound: CanPlaySound ? !_muted : null, Announced: Host.Announcer is null ? null : IsAnnounced(ActiveWindowId()), @@ -8906,6 +8933,13 @@ private bool RunBuiltInCommand(string id) case "map:edit": ToggleMapEdit(); return true; + case "map:level-up": + case "map:level-down": + case "map:next-area": + case "map:here": + case "map:find": + RunMapViewCommand(id); + return true; case "map:undo": if ((SendTarget()?.SessionKey ?? _workspace.FindWindow(ActiveWindowId())?.SessionKey) is { } undoKey && MapOf(undoKey) is not null) { @@ -9274,6 +9308,13 @@ private MarkupControl MapControlFor(string windowId) /// private void OnMapLinkClicked(string windowId, string url) { + // The title's level arrows and "here", and the legend's areas: a look, by index into the view last drawn. + if (_mapViews.TryGetValue(windowId, out var drawn) && MapRenderer.ParseLook(url, drawn.Model) is { } look) + { + LookMap(windowId, look); + return; + } + if (MapRenderer.ParseLink(url) is not { } room) { return; @@ -9420,6 +9461,12 @@ private void MapCommand(string windowId, string verb, string argument) ToggleMapEdit(); return; } + else if ((WindowSession(windowId)?.SessionKey ?? _workspace.FindWindow(windowId)?.SessionKey) is { } viewer + && argument.Split(' ', 2)[0].ToLowerInvariant() is "level" or "view" or "here" or "find") + { + MapViewCommand(windowId, map, viewer, argument); + return; + } else { var parts = argument.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index b36f4580..e759351c 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -25,7 +25,7 @@ internal static class SnapshotViews "search", "search-regex", "search-all", "search-landed", "activity-bar", "mxp-image", "mxp-figure", "input-selection", "selection", "trigger-builder", "prefix", "prefix-panel", "focus", "focus-moved", "tabs", "tabs-many", - "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "map-edit", + "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "map-edit", "map-level", "map-area", "map-find", "map-mine", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "import-review", "join-wraps", "join-wraps-f5", diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeMapViewTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeMapViewTests.cs new file mode 100644 index 00000000..797df068 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeMapViewTests.cs @@ -0,0 +1,159 @@ +using Avalonia; +using Avalonia.Headless; +using Avalonia.Input; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The native map's look buttons, ⇧-wheel and legend (another level or area, and back), a room dragged to another grid +/// cell while editing, and the inspector's reset to the server: each handed to the client as the model's own +/// or . +/// +public class NativeMapViewTests +{ + private static MapViewModel Model(bool editing, bool viewing = false) => new( + "Town", + 0, + [ + new MapViewRoom(1, "Plaza", 0, 0, Current: !viewing, Ahead: false, Locked: false, Selected: editing), + new MapViewRoom(2, "North Road", 0, -1, Current: false, Ahead: false, Locked: false, HandEdited: true), + ], + [new MapViewExit(1, 2)], + null) + { + AnchorId = 1, + Viewing = viewing, + Levels = [0, 1], + Areas = [new MapViewArea("Town", "#5fafff", Drawn: true), new MapViewArea("Docks", "#ffaf5f", Drawn: false)], + AreaChoices = [new MapViewArea("Docks", "#ffaf5f", Drawn: false), new MapViewArea("Town", "#5fafff", Drawn: true)], + Selected = editing ? new MapRoomDetails(1, "Plaza", "Town", 0, 0, 0, 1, false, null, null, []) { HandEdited = [Core.Mapping.MapFields.Name] } : null, + }; + + private sealed record Seen(List Looks, List Edits, List Selects); + + private static Seen Publish(AvaloniaConsoleDriver driver, MapViewModel model) + { + var seen = new Seen([], [], []); + ((IPointerPresenter)driver.Pointer).Panels( + [ + new PanelOverlay( + PanelIds.Map, "map:demo", new PaneRect(0, 1, 60, 14), new PanelInk("#33ccff", "#ffaa33", "#555555"), null, model, _ => { }, + SelectRoom: seen.Selects.Add, EditMap: seen.Edits.Add, LookMap: seen.Looks.Add), + ]); + return seen; + } + + [Test] + public async Task TheButtonsTheWheelAndTheLegendLookElsewhereAndTheWayBackIsOffered() + { + var (looks, labels, menu) = await DesktopLayerTests.Run((window, view, layer, driver) => + { + var seen = Publish(driver, Model(editing: false, viewing: true)); + Dispatcher(); + window.UpdateLayout(); + var canvas = layer.Maps.Values.Single(); + var labels = canvas.LookButtons().Select(b => (b.Id, b.Enabled)).ToList(); + Point Centre(MapCanvas.LookButton b) => canvas.TranslatePoint(b.Rect.Center, window)!.Value; + + var up = canvas.LookButtons().Single(b => b.Id == MapCanvas.UpButton); + window.MouseDown(Centre(up), MouseButton.Left); + window.MouseUp(Centre(up), MouseButton.Left); + var here = canvas.LookButtons().Single(b => b.Id == MapCanvas.HereButton); + window.MouseDown(Centre(here), MouseButton.Left); + window.MouseUp(Centre(here), MouseButton.Left); + + var middle = canvas.TranslatePoint(new Point(canvas.Bounds.Width / 2, canvas.Bounds.Height / 2), window)!.Value; + window.MouseWheel(middle, new Vector(0, 1), RawInputModifiers.Shift); + + canvas.OpenAreaMenu(); + canvas.RunAreaVerb(canvas.Model, MapLooking.AreaVerbPrefix + "0"); + return (seen.Looks, labels, canvas.OpenedAreaMenu); + }, columns: 60, rows: 16); + + await Assert.That(labels).IsEquivalentTo(new[] + { + (MapCanvas.UpButton, true), (MapCanvas.DownButton, false), (MapCanvas.AreasButton, true), (MapCanvas.HereButton, true), + }); + await Assert.That(looks).IsEquivalentTo(new[] { MapLook.Up, MapLook.Here, MapLook.Up, MapLook.ToArea("Docks") }); + await Assert.That(menu!.Entries.Select(e => e.Label)).Contains("Back to where I am"); + } + + [Test] + public async Task ARoomDraggedWhileEditingIsMovedByTheGridCellsItCameToInOneEdit() + { + var seen = await DesktopLayerTests.Run((window, view, layer, driver) => + { + var seen = Publish(driver, Model(editing: true)); + Dispatcher(); + window.UpdateLayout(); + var canvas = layer.Maps.Values.Single(); + var room = canvas.Model.Rooms[1]; + var from = canvas.TranslatePoint(canvas.CentreOf(room), window)!.Value; + var step = MapCanvas.Spacing * canvas.Zoom; + + window.MouseDown(from, MouseButton.Left); + window.MouseMove(from + new Vector(step * 0.6, 0)); + window.MouseMove(from + new Vector((step * 2) + 3, step - 4)); + window.MouseUp(from + new Vector((step * 2) + 3, step - 4), MouseButton.Left); + return (seen, canvas.Pan); + }, columns: 60, rows: 16); + + await Assert.That(seen.seen.Edits).IsEquivalentTo(new[] { MapEdit.Move(2, 2, 1) }); + await Assert.That(seen.seen.Selects).Contains(2L); + await Assert.That(seen.Pan).IsEqualTo(default(Vector)).Because("dragging a room moves the room, not the map"); + } + + [Test] + public async Task OutsideEditingADragStillPansAndMovesNothing() + { + var seen = await DesktopLayerTests.Run((window, view, layer, driver) => + { + var seen = Publish(driver, Model(editing: false)); + Dispatcher(); + window.UpdateLayout(); + var canvas = layer.Maps.Values.Single(); + var from = canvas.TranslatePoint(canvas.CentreOf(canvas.Model.Rooms[1]), window)!.Value; + window.MouseDown(from, MouseButton.Left); + window.MouseMove(from + new Vector(80, 0)); + window.MouseUp(from + new Vector(80, 0), MouseButton.Left); + return (seen, canvas.Pan); + }, columns: 60, rows: 16); + + await Assert.That(seen.seen.Edits).IsEmpty(); + await Assert.That(seen.Pan).IsEqualTo(new Vector(80, 0)); + } + + [Test] + public async Task TheInspectorSaysWhatWasEditedByHandAndResetsItToTheServer() + { + var (text, enabled, edits) = await DesktopLayerTests.Run((window, view, layer, driver) => + { + var seen = Publish(driver, Model(editing: true)); + Dispatcher(); + window.UpdateLayout(); + var inspector = layer.Maps.Values.Single().Inspector; + var enabled = inspector.ResetButton.IsEnabled; + inspector.ResetButton.RaiseEvent(new global::Avalonia.Interactivity.RoutedEventArgs(global::Avalonia.Controls.Button.ClickEvent)); + return (inspector.HandEditedText, enabled, seen.Edits); + }, columns: 60, rows: 16); + + await Assert.That(text).Contains("name"); + await Assert.That(enabled).IsTrue(); + await Assert.That(edits).IsEquivalentTo(new[] { MapEdit.ResetToServer(1) }); + } + + [Test] + public async Task TheRoomMenuOffersResetOnlyForARoomEditedByHand() + { + var model = Model(editing: false); + + await Assert.That(MapEditing.Menu(model.Rooms[1], null).Entries.Select(e => e.Command)).Contains(MapEditing.ResetVerb); + await Assert.That(MapEditing.Menu(model.Rooms[0], null).Entries.Select(e => e.Command)).DoesNotContain(MapEditing.ResetVerb); + } + + private static void Dispatcher() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index cf61650f..f94aafe8 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -454,6 +454,57 @@ await Same("map: exit to the next room", "layout-combat", MapKeys(app, MapKey(ConsoleKey.X, 'x')); TypeLine(app, "climb next"); }); + + // Another level or area, and back: the canvas's buttons and menu, and the cell title's and legend's links and keys. + await Same("map: look up a level", "layout-combat", + (app, d) => Panel(d, PanelIds.Map).LookMap!(MapLook.Up), + (app, d) => app.SimulateMapClick(Panel(d, PanelIds.Map).WindowId, MapRenderer.LookPrefix + "up")); + await Same("map: look at another area", "layout-combat", + (app, d) => Panel(d, PanelIds.Map).LookMap!(MapLook.ToArea(Panel(d, PanelIds.Map).Map!.Areas.First(a => !a.Drawn).Name)), + (app, d) => + { + var map = Panel(d, PanelIds.Map).Map!; + var index = map.Areas.ToList().FindIndex(a => !a.Drawn); + app.SimulateMapClick(Panel(d, PanelIds.Map).WindowId, MapRenderer.LookPrefix + "area:" + index); + }); + await Same("map: back to where I am", "layout-combat", + (app, d) => + { + Panel(d, PanelIds.Map).LookMap!(MapLook.Up); + Panel(d, PanelIds.Map).LookMap!(MapLook.Here); + }, + (app, d) => + { + app.SimulateMapClick(Panel(d, PanelIds.Map).WindowId, MapRenderer.LookPrefix + "up"); + app.SimulateMapClick(Panel(d, PanelIds.Map).WindowId, MapRenderer.LookPrefix + "here"); + }); + await Same("map: next area while editing", "layout-combat", + (app, d) => + { + Panel(d, PanelIds.Map).SelectRoom!(OtherRoom(Panel(d, PanelIds.Map).Map!)); + Panel(d, PanelIds.Map).LookMap!(MapLook.NextArea); + }, + (app, d) => { CellSelect(app, d); MapKeys(app, MapKey(ConsoleKey.V, 'v')); }); + + // A hand edit given back to the server: the inspector's Reset button, and R on the cell map. + await Same("map: reset to server", "layout-combat", + (app, d) => + { + NativeEdit(d, room => MapEdit.Rename(room, "Spice Yard")); + Panel(d, PanelIds.Map).EditMap!(MapEdit.ResetToServer(OtherRoom(Panel(d, PanelIds.Map).Map!))); + }, + (app, d) => + { + CellSelect(app, d); + MapKeys(app, MapKey(ConsoleKey.R, 'r')); + while (app.PrimaryInputText.Count(c => c == ' ') > 3 || !app.PrimaryInputText.EndsWith(' ')) + { + MapKeys(app, MapKey(ConsoleKey.Backspace, '\b')); + } + + TypeLine(app, "Spice Yard"); + MapKeys(app, new ConsoleKeyInfo('R', ConsoleKey.R, true, false, false)); + }); probed.Add(PanelIds.Map); // Vitals: the pop-out button, and ⌃P's entry for the same window. diff --git a/tests/SharpMUTerm.Core.Tests/Mapping/HandEditTests.cs b/tests/SharpMUTerm.Core.Tests/Mapping/HandEditTests.cs new file mode 100644 index 00000000..b639b208 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Mapping/HandEditTests.cs @@ -0,0 +1,187 @@ +using SharpMUTerm.Core.Mapping; + +namespace SharpMUTerm.Core.Tests.Mapping; + +/// +/// A hand edit survives the server's next report of the room: the fields a player changed are recorded per room, kept +/// with the map, left alone by the recorder, and given back to the server only on "reset to server". +/// +public class HandEditTests +{ + private static RoomObservation Room(long? id, string name, params (string Key, long? To)[] exits) => + new(id, name, exits.Select(e => new ObservedExit(e.Key, e.To)).ToList()); + + private static RoomObservation Hall => Room(1, "Hall", ("north", 2)) with { Area = "Keep", Coordinates = (0, 0, 0) }; + + private static RoomObservation Gallery => Room(2, "Gallery", ("south", 1)) with { Area = "Keep", Coordinates = (0, -1, 0) }; + + private static MapRecorder Recorded() + { + var recorder = new MapRecorder(new WorldMap()); + recorder.Apply(Hall); + recorder.NoteCommand("n"); + recorder.Apply(Gallery); + return recorder; + } + + /// Back to the hall, as a GMCP game reports it: everything about the room again. + private static void Revisit(MapRecorder recorder) + { + recorder.NoteCommand("s"); + recorder.Apply(Hall); + } + + [Test] + public async Task EachEditMarksTheFieldItChangedAndNothingElse() + { + var map = Recorded().Map; + + await Assert.That(map.Room(1)!.HandEdited).IsEmpty().Because("recording is not editing"); + map.Rename(1, "Great Hall"); + map.SetArea(1, "Tower"); + await Assert.That(map.Room(1)!.HandEdited.Order()).IsEquivalentTo(new[] { MapFields.Area, MapFields.Name }); + map.SetLocked(1, true); + map.SetNote(1, "cold"); + map.SetWeight(1, 4); + await Assert.That(map.Room(1)!.HandEdited.Count).IsEqualTo(2).Because("locks, notes and weights were never the server's"); + map.SetExit(1, "ne", 2); + map.Move(1, 1, 0, 0); + await Assert.That(map.Room(1)!.HandEdited.Order()).IsEquivalentTo(new[] { MapFields.Area, MapFields.Exits, MapFields.Name, MapFields.Position }); + await Assert.That(map.Rename(1, "Great Hall")).IsFalse(); + } + + [Test] + public async Task TheServersNextReportLeavesHandEditedFieldsAlone() + { + var recorder = Recorded(); + var map = recorder.Map; + map.Rename(1, "Great Hall"); + map.SetArea(1, "Tower"); + map.SetExit(1, "climb rope", 2); + map.Move(1, 3, 2, 0); + + Revisit(recorder); + + var hall = map.Room(1)!; + await Assert.That(hall.Name).IsEqualTo("Great Hall"); + await Assert.That(map.Areas[hall.AreaId!.Value].Name).IsEqualTo("Tower"); + await Assert.That(hall.SpecialExits.ContainsKey("climb rope")).IsTrue(); + await Assert.That((hall.X, hall.Y, hall.Z)).IsEqualTo((3, 2, 0)); + await Assert.That(recorder.CurrentRoomId).IsEqualTo(1L).Because("the character still moved"); + } + + [Test] + public async Task AFieldNobodyEditedStillFollowsTheServer() + { + var recorder = Recorded(); + recorder.Map.Rename(1, "Great Hall"); + + recorder.NoteCommand("s"); + recorder.Apply(Room(1, "Hall", ("north", 2), ("east", 3)) with { Area = "Keep", Coordinates = (5, 5, 0) }); + + var hall = recorder.Map.Room(1)!; + await Assert.That(hall.Name).IsEqualTo("Great Hall"); + await Assert.That((hall.X, hall.Y)).IsEqualTo((5, 5)); + await Assert.That(hall.Exits.ContainsKey("east")).IsTrue(); + } + + [Test] + public async Task AnExitsOnlyUpdateLeavesHandEditedExitsAlone() + { + var recorder = Recorded(); + recorder.Map.RemoveExit(2, "south"); + + recorder.Apply(Room(2, string.Empty, ("south", 1), ("west", 9)) with { ExitsOnly = true }); + + await Assert.That(recorder.Map.Room(2)!.Exits).IsEmpty(); + } + + [Test] + public async Task ResetToServerPutsBackWhatTheServerLastSaidAndCanBeUndone() + { + var recorder = Recorded(); + var map = recorder.Map; + recorder.Edit("rename", [1], m => m.Rename(1, "Great Hall")); + recorder.Edit("move", [1], m => m.Move(1, 2, 0, 0)); + + await Assert.That(recorder.ResetToServer(1, "reset Hall")).IsTrue(); + await Assert.That(map.Room(1)!.Name).IsEqualTo("Hall"); + await Assert.That(map.Room(1)!.X).IsEqualTo(0); + await Assert.That(map.Room(1)!.HandEdited).IsEmpty(); + await Assert.That(recorder.ResetToServer(1, "again")).IsFalse().Because("nothing is edited by hand now"); + + await Assert.That(recorder.Undo()).IsEqualTo("reset Hall"); + await Assert.That(map.Room(1)!.Name).IsEqualTo("Great Hall"); + await Assert.That(map.Room(1)!.HandEdited).Contains(MapFields.Name); + } + + [Test] + public async Task ResetWithNoReportThisRunLetsTheNextReportSetTheFields() + { + var recorder = new MapRecorder(MapStore.Deserialize(MapStore.Serialize(Recorded().Map, "x:1"))); + recorder.Map.Rename(1, "Great Hall"); + + await Assert.That(recorder.HasServerReport(1)).IsFalse(); + await Assert.That(recorder.ResetToServer(1, "reset")).IsTrue(); + await Assert.That(recorder.Map.Room(1)!.Name).IsEqualTo("Great Hall").Because("nothing to put back yet"); + + recorder.Apply(Hall); + await Assert.That(recorder.Map.Room(1)!.Name).IsEqualTo("Hall"); + } + + [Test] + public async Task UndoingAnEditTakesItsProtectionWithIt() + { + var recorder = Recorded(); + recorder.Edit("rename", [1], m => m.Rename(1, "Great Hall")); + recorder.Undo(); + + await Assert.That(recorder.Map.Room(1)!.HandEdited).IsEmpty(); + } + + [Test] + public async Task HandEditsAreKeptWithTheMapInVersionTwo() + { + var map = Recorded().Map; + map.Rename(1, "Great Hall"); + map.Move(2, 0, -1, 0); + + var text = MapStore.Serialize(map, "example.org:4000"); + var back = MapStore.Deserialize(text); + + await Assert.That(text).Contains("\"version\": 2"); + await Assert.That(back.Room(1)!.HandEdited).IsEquivalentTo(new[] { MapFields.Name }); + await Assert.That(back.Room(2)!.HandEdited).IsEquivalentTo(new[] { MapFields.Position }); + await Assert.That(back.Room(1)!.HandEdited.Contains("NAME")).IsFalse().Because("the comparer is ordinal again"); + } + + [Test] + public async Task AVersionOneFileReadsWithNothingEditedByHandAndIsWrittenBackAsVersionTwo() + { + const string v1 = """ + {"version":1,"endpoint":"example.org:4000","areas":[{"id":1,"name":"Keep"}], + "rooms":[{"id":1,"name":"Hall","areaId":1,"x":0,"y":0,"z":0,"exits":{"north":2}}, + {"id":2,"name":"Gallery","areaId":1,"x":0,"y":-1,"z":0,"exits":{"south":1}}]} + """; + + var map = MapStore.Deserialize(v1); + + await Assert.That(map.Rooms.Count).IsEqualTo(2); + await Assert.That(map.Rooms.Values.All(r => r.HandEdited.Count == 0)).IsTrue(); + await Assert.That(MapStore.Serialize(map, "example.org:4000")).Contains("\"version\": 2"); + + var recorder = new MapRecorder(map); + recorder.Apply(Room(1, "Hall of Echoes", ("north", 2)) with { Area = "Keep" }); + await Assert.That(map.Room(1)!.Name).IsEqualTo("Hall of Echoes").Because("an old map has no hand edits to protect"); + } + + [Test] + public async Task AFileFromALaterClientWithUnknownFieldsInHandEditedKeepsOnlyTheKnownOnes() + { + const string text = """{"version":2,"rooms":[{"id":1,"name":"Hall","handEdited":["name","colour"]}]}"""; + + var map = MapStore.Deserialize(text); + + await Assert.That(map.Room(1)!.HandEdited).IsEquivalentTo(new[] { MapFields.Name }); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs b/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs index 9dd60173..46ca7ce1 100644 --- a/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs @@ -124,6 +124,8 @@ public async Task EveryKeyTheFooterNamesIsAnswered() ["r"] = [Key(ConsoleKey.R, 'r')], ["a"] = [Key(ConsoleKey.A, 'a')], ["l"] = [Key(ConsoleKey.L, 'l')], ["w"] = [Key(ConsoleKey.W, 'w')], ["x"] = [Key(ConsoleKey.X, 'x')], ["-"] = [Key(ConsoleKey.OemMinus, '-')], ["n"] = [Key(ConsoleKey.N, 'n')], ["s"] = [Key(ConsoleKey.S, 's')], ["Del"] = [Key(ConsoleKey.Delete)], + ["PgUp PgDn"] = [Key(ConsoleKey.PageDown)], ["v"] = [Key(ConsoleKey.V, 'v')], ["h"] = [Key(ConsoleKey.H, 'h')], + ["R"] = [Key(ConsoleKey.R, 'R', shift: true)], ["u"] = [Key(ConsoleKey.U, 'u')], ["⏎"] = [Key(ConsoleKey.Enter, '\r')], ["Esc"] = [Key(ConsoleKey.Escape, '\u001b')], }; diff --git a/tests/SharpMUTerm.Tui.Tests/MapViewTests.cs b/tests/SharpMUTerm.Tui.Tests/MapViewTests.cs new file mode 100644 index 00000000..762c359e --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/MapViewTests.cs @@ -0,0 +1,199 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Mapping; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Looking at another level or area of the map and back, protecting hand edits from the server's next report, and +/// finding a room — through the cell map's keys and links, ⌃P and /map, over a live GMCP session. +/// +[NotInParallel] +public class MapViewTests +{ + private const string Ann = "Convergence.Ann"; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static string MapId => SharpMUTermApp.MapWindowId(Ann); + + private const string Hall = """{"num":1,"name":"Hall","area":"Keep","coords":"0,0,0","exits":{"n":2,"u":4}}"""; + + /// A keep of three rooms on level 0 and a loft on level 1, and a yard next door; Ann stands in the hall. + private static async Task<(SharpMUTermApp App, RecordingTelnetSession Wire)> Open() + { + Console.SetIn(TextReader.Null); + var config = new AppConfiguration(); + config.Worlds.Add(new WorldDefinition + { + Name = "Convergence", + Host = "convergence.example", + Port = 4201, + Characters = { new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() } }, + }); + var wire = new RecordingTelnetSession(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(160, 40)); + app.TelnetFactory = _ => wire; + app.DispatchCommand(CommandIds.Character(Ann)); + await app.FindSession(Ann)!.ConnectAsync(); + wire.ReceiveGmcp("Room.Info", """{"num":5,"name":"Garden","area":"Yard","coords":"2,-1,0","exits":{"w":3}}"""); + wire.ReceiveGmcp("Room.Info", """{"num":4,"name":"Loft","area":"Keep","coords":"0,0,1","exits":{"d":1}}"""); + wire.ReceiveGmcp("Room.Info", """{"num":3,"name":"Tower","area":"Keep","coords":"1,-1,0","exits":{"w":2,"e":5}}"""); + wire.ReceiveGmcp("Room.Info", """{"num":2,"name":"Gallery","area":"Keep","coords":"0,-1,0","exits":{"s":1,"e":3}}"""); + wire.ReceiveGmcp("Room.Info", Hall); + app.DispatchCommand("term:map"); + return (app, wire); + } + + private static ConsoleKeyInfo Key(ConsoleKey key, char c = '\0', bool shift = false) => new(c, key, shift, false, false); + + private static void Type(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(Key(ConsoleKey.Enter, '\r')); + } + + private static WorldMap MapOf(SharpMUTermApp app) => app.SessionMapFor(app.FindSession(Ann)!)!.Map; + + private static string Title(SharpMUTermApp app) => MarkupText.Plain(app.MapMarkup(MapId)[0]); + + [Test] + public async Task PaletteStepsALevelUpAndBackAndTheTitleSaysWhereItIs() + { + var (app, _) = await Open(); + await using var _app = app; + + var ids = app.BuildCatalog().Select(i => i.Id).ToList(); + await Assert.That(ids).Contains("map:level-up"); + await Assert.That(ids).Contains("map:next-area"); + await Assert.That(ids).DoesNotContain("map:here").Because("the map already shows where Ann is"); + await Assert.That(Title(app)).Contains("Hall · Keep · z 0"); + await Assert.That(app.MapMarkup(MapId)[0]).Contains(MapRenderer.LookPrefix + "up"); + + app.DispatchCommand("map:level-up"); + + await Assert.That(app.MapLookOf(MapId)).IsEqualTo(new MapViewpoint(MapOf(app).Room(1)!.AreaId, 1)); + await Assert.That(Title(app)).StartsWith("Viewing · Keep · z 1"); + await Assert.That(Title(app)).Contains("⌂ here"); + await Assert.That(app.BuildCatalog().Select(i => i.Id)).Contains("map:here"); + + app.DispatchCommand("map:here"); + await Assert.That(app.MapLookOf(MapId)).IsNull(); + await Assert.That(Title(app)).StartsWith("Hall · Keep · z 0"); + } + + [Test] + public async Task TheTitlesArrowsAndTheLegendsAreasAreLinksTheMapAnswers() + { + var (app, _) = await Open(); + await using var _app = app; + + app.SimulateMapClick(MapId, MapRenderer.LookPrefix + "up"); + await Assert.That(app.MapLookOf(MapId)!.Level).IsEqualTo(1); + app.SimulateMapClick(MapId, MapRenderer.LookPrefix + "up"); + await Assert.That(app.MapLookOf(MapId)!.Level).IsEqualTo(1).Because("there is no level 2: refused, not moved"); + app.SimulateMapClick(MapId, MapRenderer.LookPrefix + "here"); + await Assert.That(app.MapLookOf(MapId)).IsNull(); + + var legend = app.MapMarkup(MapId)[^1]; + await Assert.That(legend).Contains(MapRenderer.LookPrefix + "area:1").Because("Yard is reached by an exit and is a link"); + app.SimulateMapClick(MapId, MapRenderer.LookPrefix + "area:1"); + var yard = MapOf(app).Areas.Values.Single(a => a.Name == "Yard").Id; + await Assert.That(app.MapLookOf(MapId)).IsEqualTo(new MapViewpoint(yard, 0)); + await Assert.That(Title(app)).StartsWith("Viewing · Yard · z 0"); + } + + [Test] + public async Task AClickOnAViewedLevelStillWalksToTheRealRoom() + { + var (app, wire) = await Open(); + await using var _app = app; + app.DispatchCommand("map:level-up"); + var before = wire.Lines.Count; + + app.SimulateMapClick(MapId, MapRenderer.LinkPrefix + "4"); + + await Assert.That(wire.Lines.Skip(before)).IsEquivalentTo(new[] { "u" }); + } + + [Test] + public async Task MapCommandsLookByLevelAndAreaAndCanFindARoom() + { + var (app, _) = await Open(); + await using var _app = app; + + Type(app, "/map view yard"); + await Assert.That(app.MapLookOf(MapId)!.AreaId).IsEqualTo(MapOf(app).Areas.Values.Single(a => a.Name == "Yard").Id); + Type(app, "/map here"); + await Assert.That(app.MapLookOf(MapId)).IsNull(); + Type(app, "/map level up"); + await Assert.That(app.MapLookOf(MapId)!.Level).IsEqualTo(1); + Type(app, "/map level down"); + await Assert.That(app.MapLookOf(MapId)).IsNull().Because("level 0 of the keep is where Ann is"); + + Type(app, "/map find loft"); + var lines = app.WindowIds().SelectMany(w => app.PaneLines(w)).Select(MarkupText.Plain).ToList(); + await Assert.That(string.Join("\n", lines)).Contains("4 Loft"); + await Assert.That(app.MapLookOf(MapId)!.Level).IsEqualTo(1).Because("the map shows the room found"); + } + + [Test] + public async Task InEditModePageKeysStepLevelsAndTheSelectionComesWith() + { + var (app, _) = await Open(); + await using var _app = app; + app.DispatchCommand("map:edit"); + await Assert.That(app.MapSelection(MapId)).IsEqualTo(1L); + + await Assert.That(app.SimulateMapKey(Key(ConsoleKey.PageUp))).IsTrue(); + await Assert.That(app.MapLookOf(MapId)!.Level).IsEqualTo(1); + await Assert.That(app.MapSelection(MapId)).IsEqualTo(4L).Because("the keys edit a room that is on screen"); + + await Assert.That(app.SimulateMapKey(Key(ConsoleKey.H, 'h'))).IsTrue(); + await Assert.That(app.MapLookOf(MapId)).IsNull(); + await Assert.That(app.MapSelection(MapId)).IsEqualTo(1L); + + await Assert.That(app.SimulateMapKey(Key(ConsoleKey.V, 'v'))).IsTrue(); + await Assert.That(app.MapSelection(MapId)).IsEqualTo(5L).Because("Yard has one room"); + } + + [Test] + public async Task AHandRenameSurvivesTheServersNextReportUntilItIsReset() + { + var (app, wire) = await Open(); + await using var _app = app; + + Type(app, "/map rename 1 Great Hall"); + wire.ReceiveGmcp("Room.Info", Hall); + await Assert.That(MapOf(app).Room(1)!.Name).IsEqualTo("Great Hall"); + await Assert.That(app.MapDigest()).Contains("|name]"); + + app.DispatchCommand("map:edit"); + await Assert.That(string.Join("\n", app.MapMarkup(MapId).Select(MarkupText.Plain))).Contains("mine name"); + await Assert.That(app.SimulateMapKey(Key(ConsoleKey.R, 'R', shift: true))).IsTrue(); + + await Assert.That(MapOf(app).Room(1)!.Name).IsEqualTo("Hall").Because("the server's last report is put back at once"); + await Assert.That(MapOf(app).Room(1)!.HandEdited).IsEmpty(); + app.DispatchCommand("map:undo"); + await Assert.That(MapOf(app).Room(1)!.Name).IsEqualTo("Great Hall"); + } + + [Test] + public async Task FindRoomPutsTheCommandOnTheCommandLine() + { + var (app, _) = await Open(); + await using var _app = app; + + await Assert.That(app.DispatchCommand("map:find")).IsTrue(); + + await Assert.That(app.ArmedInputText).IsEqualTo("/map find "); + } +} From d3e682787b7807cad43424edbf1c6e4aefa087eb Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 13:49:36 +0000 Subject: [PATCH 051/113] Polish wave 14: F5 scroll, Light contrast, [dim] exemption, native keys, dictionary chip, join-wraps note, move hold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - F5 follows the field being edited: ScreenChrome.Window centres on the caret before the cursor band (WorldFieldScrollTests at 120x32 and 80x24; --view settings-edit edits the deepest field). - Light: WorkspacePalette.Recessed uses a shallower 0.90 step on light planes; settings-screen inks are held to 4.5:1 on light planes (ScreenTheme.FloorOn), with a bare [dim] rewritten to a held grey there. Dark and Solarized frames are unchanged. - FrameContrastTests no longer exempts the framework's [dim]. - NativeKeys.Words spells Tab, Shift+Tab, Backspace, Delete, Esc, PgUp/PgDn. - F1: "no dictionary · ⌥W gets one" in cells; the window's chip is a button opening the offer. - Native F5 shows join-wraps' recommendation via SettingsForm.WorldNotes (one string from WorldFieldValues.JoinWrapsAdvice). - Channel capture move: lines no pending GMCP expects are held until the socket read ends (ITelnetSession.ReceiveBatchEnded, at most 250 ms), so an echo just before its GMCP is caught without reordering output. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 10 +++ CLAUDE.md | 46 +++++++--- src/SharpMUTerm.Avalonia/ComposerView.cs | 35 +++++++- src/SharpMUTerm.Avalonia/HelpView.cs | 2 +- src/SharpMUTerm.Avalonia/NativeKeys.cs | 41 +++++++-- src/SharpMUTerm.Avalonia/SettingsWindow.cs | 20 +++++ .../Settings/BuiltInSettings.cs | 2 +- .../Settings/SettingsForm.cs | 23 +++++ .../Settings/WorldFieldValues.cs | 11 +++ .../Protocols/ChannelCapture.cs | 24 +++++ src/SharpMUTerm.Core/Session/WorldSession.cs | 87 ++++++++++++++++++- src/SharpMUTerm.Core/Telnet/ITelnetSession.cs | 12 +++ src/SharpMUTerm.Core/Telnet/TelnetSession.cs | 4 + src/SharpMUTerm.Tui/ComposeOverlay.cs | 5 +- src/SharpMUTerm.Tui/ScreenChrome.cs | 10 ++- src/SharpMUTerm.Tui/ScreenTheme.cs | 29 ++++++- .../SharpMUTermApp.JoinWraps.cs | 2 +- .../SharpMUTermApp.Settings.cs | 22 +++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 12 +++ src/SharpMUTerm.Tui/WorkspacePalette.cs | 12 ++- .../NativeComposerTests.cs | 24 +++++ .../NativeKeySpellingTests.cs | 5 ++ .../SettingsWindowTests.cs | 43 ++++++++- .../ScopedSettingsTests.cs | 30 +++++++ .../Session/ChannelsAndNamesTests.cs | 45 ++++++++++ .../Session/FakeTelnetSession.cs | 20 ++++- .../ComposeSpellingTests.cs | 2 + .../FrameContrastTests.cs | 18 +--- .../RecordingTelnetSession.cs | 7 +- .../SharpMUTerm.Tui.Tests/ScreenThemeTests.cs | 55 ++++++++++++ .../WorldFieldScrollTests.cs | 67 ++++++++++++++ 31 files changed, 676 insertions(+), 49 deletions(-) create mode 100644 tests/SharpMUTerm.Tui.Tests/WorldFieldScrollTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 9686bbbb..ead4bba7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -312,6 +312,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- Light theme: background tabs and one-row panels (vitals, quick bar) sit on a lighter grey, and small text on the + settings screens is darker, so it is as easy to read as body text. +- Desktop window: the composer's "no dictionary" chip is a button that offers to get one; in the terminal F1 names + Alt+W beside it. The world settings show the same "join wraps" recommendation the terminal's F5 does. + - A character is named one way everywhere: the command line's prompt, the window title and tab titles now read `Corvid · Aetherfall` and `Corvid · Chat` instead of `Corvid@Aetherfall` and `Corvid - Chat`. - Messages from packages, the map and sound name where they came from as a label ("Sound: muted.") rather than in the @@ -364,6 +369,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- F5: editing a world field low on the screen (channels, names) now scrolls the field into view instead of leaving + the cursor off screen. +- F5 ▸ channels `move`: a channel message whose echo arrives just before its GMCP in the same read is no longer left + in the main window as well. + - Desktop window: the settings window can be resized again from any edge, and opens at the size you last left it for the rest of the session. Notification cards disappear as soon as it opens rather than showing beside it. - Clicking a tab strip's `+N ▾` no longer also selects (or closes) the tab drawn underneath it. diff --git a/CLAUDE.md b/CLAUDE.md index 436460e1..620239de 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -807,7 +807,9 @@ fallbacks) for inline images/maps. `Func` that is null by default, so a test and a snapshot read none and their header says `no dictionary`. A MOO edit is not checked (its buffer is code as often as prose). `%`-codes, a word before `(`, and any word with a digit or an inner capital are skipped. ⌥W appends to - `dictionaries/user-words.txt`. **A command token is skipped** (one starting `+ @ & /`, up to its first `=`), and so + `dictionaries/user-words.txt`. With no dictionary F1's header reads `no dictionary · ⌥W gets one` (the docked panel + says only `no dictionary`), and the window's chip is a button (`ComposerView.DictionaryChip`) that opens the same + offer through `ComposerSession.GetDictionary`. **A command token is skipped** (one starting `+ @ & /`, up to its first `=`), and so is **every name the client knows** (`SpellChecker.KnowNames`: configured worlds and characters, each session's `CompletionIndex.Names()`), refreshed each time F1 opens and held for the run, never written to disk. - **With no dictionary, ⌥W offers to download one** (`DictionaryDownload`, Core; `DictionaryOfferModel`, Client; @@ -947,14 +949,18 @@ fallbacks) for inline images/maps. - **The audit that found most of this is a test** (`FrameContrastTests`): every emitted SGR pair over 24 views × 3 themes. Reading the source found four of the offenders; the paint found nine. It exempts the powerline wedges and box-drawing rules (fill boundaries and dividers), the solid blocks (a swatch - is a colour sample shown as the *pane* will paint it), and the framework's `[dim]`. **The half blocks + is a colour sample shown as the *pane* will paint it), and nothing else. **The half blocks are not exempt** — `▌` is the trigger left-rule and the focus marker, and one of them was a real defect this caught. - - **One thing is outside the floor's reach and is named rather than hidden.** SharpConsoleUI resolves - `[dim]` to a fixed `#808080` through no option we hold: 4.01:1 on Dark, **2.52:1** on Solarized Dark's - focused pane. Reaching it means giving up `[dim]` across every renderer for an explicit floor-checked - grey — a sweep, for a near miss on one theme. The exemption is a named predicate with the number in - it, so whoever does that sweep can delete it and watch the test pass. + - **The framework's `[dim]` is no longer exempt.** It is faint on the inherited ink, or a fixed `#808080` + with none; it once measured 2.52:1 on Solarized Dark's focused pane. The panes have since deepened, the + status row swaps it (`StatusInk`), and a light settings screen rewrites a bare `[dim]` to a held grey + (`ScreenTheme.Tag`, light planes only, so Dark and Solarized frames are unchanged), so every `[dim]` cell in + every view clears the floor. A new one that does not fails like any other ink. The workspace's own `[dim]`s + (rail, popups) were not swept, because they did not need to be. + - **Small text on a light settings screen is held to 4.5:1** (`ScreenTheme.FloorOn`, `LightTextFloor`); 3:1 + stays the floor on dark planes. Light's L*-mirrored greys left labels at about 3.2:1, which read as disabled. + `ScreenThemeTests.ALightSettingsScreensTextClearsBodyTextContrast` walks the frames. - **The settings screens follow the theme, and the renderers do not know it** (`ScreenTheme`, Tui; defect D6). `ScreenPalette`'s constants are *roles* spelt as the Dark theme's values; renderers keep writing `[{Label}]…` in them, and the views resolve the markup and every control colour through one immutable @@ -1100,8 +1106,10 @@ fallbacks) for inline images/maps. control's own background is what its content inherits, so it cannot be set there). A tab, its `×` and the `│` between tabs stay the framework's, and `PaneDragSurface.IsDragHandle` keeps the run from starting a window drag. There is no row either side of a fixed strip panel; it sits flush, and an *unfocused* strip is - recessed the backdrop's step (`SurfaceToneIn`), so it is never the same plane as an unfocused pane (2.8 L* - on Dark, 3.7 Solarized Dark, 21 Light — the pane-over-backdrop step). Side by side, nothing changed. The + recessed (`SurfaceToneIn`), so it is never the same plane as an unfocused pane. `WorkspacePalette.Recessed` + is the backdrop's step on a dark plane and a shallower 0.90 on a light one (`LightRecessScale`, about L* 87 + under Light's L* 96 panes, twice the light backdrop's step), so Light's background chips and strips are not + the deep grey a dark theme's step gives. Side by side, nothing changed. The freed row went to the panes, which is the point and a NAWS change; `StackedDividerTests` and the `split-stacked` view are the pins. - **The menu is the ⌃P catalog's own entries** (`AddCommands`), so it cannot offer an action the keyboard @@ -1824,7 +1832,10 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] maximum path); `now` reads `SendTarget()`'s game data (never `_active`'s); Delete on a meter row is a hidden trailing Remove button added only while the cursor is on one; the received-data box shows only while the cursor is in the table; path fields offer the received paths with their values as `ChoiceNotes`. - - F7 and F8 are windowed to the screen height (`ScreenChrome.Window`), because F7 is taller than 24 rows. + - F7 and F8 are windowed to the screen height (`ScreenChrome.Window`), because F7 is taller than 24 rows. F5 too: + the window centres on the *caret* (an open edit or a key capture) before the cursor band, because on F5 the band + stays on the WORLDS row while a world field is typed in (`WorldFieldScrollTests`, 120×32 and 80×24; + `--view settings-edit` edits the deepest field). - **F5's world fields and F9's character fields are declared, with scoped bindings** (`BuiltInSettings.World` and `.Character`; `SettingScope`, `SettingTarget`, `SettingBinding.ForWorld`/`ForCharacter`; `WorldFieldValues`, `TextRules`; Tui `DeclaredFields`). A binding reads a `SettingTarget` (the configuration @@ -1916,7 +1927,10 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] thread). A write captures the subject at the moment it is made. `Open the F5 screen ↗` (`OpenScreen`) is the way to the lists, and opens the *cell* screen: `OpenSectionScreen` calls `GoToSetting(…, native: false)`, or the door would reopen this window. With no world there are no fields, only a sentence and the door. A text the rule - refuses is put back with the reason as a tooltip. + refuses is put back with the reason as a tooltip. A field may carry a per-world note the cell row shows + (`SettingsForm.WorldNotes`, by field id then world, built on the client's thread; `Note` shows it only while the + field is at its default): `join wraps` carries `recommended · wraps at 78, pane is 60`, one string from + `WorldFieldValues.JoinWrapsAdvice` for both hosts. - **Search is `SettingsSearch.Find` and nothing else**, so the two surfaces always find the same fields. While searching, the page shows only matched fields, and if the section on show has none it moves to the first that has some. @@ -2098,7 +2112,8 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] move), the tokens' card and edge, and a scrim over the main window (`SettingsPresenter.Scrim`; a press on it closes). Opened from the trigger builder (`SettingsForm.BesideOutput`) it is docked to the main window's right half with no scrim, so the line the rule came from stays in view. Still a separate OS window, not an overlay. -- **Every native surface spells a key in words** (`NativeKeys.Words`, Avalonia: `KeyGlyphs.Words` plus `⏎` → `Enter`): +- **Every native surface spells a key in words** (`NativeKeys.Words`, Avalonia: `KeyGlyphs.Words` plus the named keys + `⏎` Enter, `⇥`/`↹` Tab, `⇤` Shift+Tab, `⌫` Backspace, `⌦` Delete, `⎋` Esc, `⇞`/`⇟` PgUp/PgDn; arrows stay arrows): `Ctrl+P`, `Alt+M`, `Ctrl+B b`, never `⌃P`/`⌥M`/`⏎`. The client writes keys in glyphs because the cells draw them well; whatever it hands a native view — menu keys, a toast's chip and text, palette details and chips, the composer's key row, modal footers and sentences, settings help, tooltips — goes through `Words` on the way to the @@ -3041,8 +3056,11 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] - **GMCP channels go to a window per channel through `SpawnLine`** (`ChannelCapture`, Core; `WorldDefinition.CaptureChannels`, F5 ▸ `channels`: off/copy/move, off by default). `Comm.Channel.Text`'s `channel` names the window (letters, digits, space, `-`, `_`, 24 at most); its `text` is parsed through `AnsiParser`. `move` - gags the main-window echo by exact text, only when it arrives within 3 s of the GMCP (32 pending at most), so an echo - that arrives *before* the GMCP is not taken out. + gags the main-window echo by exact text, only when it arrives within 3 s of the GMCP (32 pending at most). An echo + that arrives *before* its GMCP is caught when both are in one socket read: in `move` a line no pending GMCP expects + is held (`WorldSession.EchoHold`, ≤250 ms, under `_ingestGate`) until the read ends (`ITelnetSession.ReceiveBatchEnded`, + raised after each `InterpretByteArrayAsync`), a channel message, a prompt, a parser swap or a disconnect, then + released in order, so nothing is reordered. A GMCP in a *later* read than its echo still leaves the copy in main. - **Highlighted names are an ingest-time restyle** (`NameHighlights`, Core; `WorldDefinition.HighlightNames`, F5 ▸ `names`, `TextRule.NameHighlights`). `Name=colour` from `HighlightColours`, gold by default, 64 names; one whole-word, case-insensitive regex with a 50 ms timeout, applied before emoji and links and to captured channel lines. Only the diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 9e0f9390..28090456 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -354,7 +354,9 @@ private void Label(ComposerModel model) model.Escaping == ComposeEscaping.Literal ? Accent : _text, ui - 1.5)); if (_fullScreen || model.Armed) { - _chips.Children.Add(Chip(model.Dictionary ?? "no dictionary", model.Dictionary is null ? Dim : _text, ui - 1.5)); + _chips.Children.Add(model.Dictionary is { } dictionary + ? Chip(dictionary, _text, ui - 1.5) + : DictionaryChip(ui - 1.5)); } } @@ -407,6 +409,37 @@ private void Label(ComposerModel model) Child = new TextBlock { Text = words, FontSize = Math.Max(9, size), Foreground = new SolidColorBrush(ink) }, }; + /// What the header's dictionary chip says while no dictionary marks the post. + internal const string NoDictionaryChip = "no dictionary · get one"; + + /// + /// The header's chip while no dictionary marks the post: a button for the offer ⌥W opens + /// (), so the state names its own way out. Where the session cannot offer + /// one (the docked panel, a MOO edit) it is the plain dim chip it always was. Internal for tests. + /// + internal Border DictionaryChip(double size) + { + if (_session is not { CanGetDictionary: true }) + { + return Chip("no dictionary", Dim, size); + } + + var chip = Chip(NoDictionaryChip, Accent, size); + chip.Name = "GetDictionary"; + chip.Cursor = new Cursor(StandardCursorType.Hand); + ToolTip.SetTip(chip, "Get a spelling dictionary (Alt+W)"); + AutomationProperties.SetName(chip, "Get a spelling dictionary"); + chip.PointerPressed += (_, e) => + { + if (e.GetCurrentPoint(chip).Properties.IsLeftButtonPressed) + { + e.Handled = true; + _session?.GetDictionary(); + } + }; + return chip; + } + protected override void OnSizeChanged(SizeChangedEventArgs e) { base.OnSizeChanged(e); diff --git a/src/SharpMUTerm.Avalonia/HelpView.cs b/src/SharpMUTerm.Avalonia/HelpView.cs index 84f39f5d..fc1684b2 100644 --- a/src/SharpMUTerm.Avalonia/HelpView.cs +++ b/src/SharpMUTerm.Avalonia/HelpView.cs @@ -228,7 +228,7 @@ private void ShowList() { _list.Children.Add(new TextBlock { - Text = NativeKeys.Words(HelpModel.NoMatches).Replace("⌫", "Backspace", StringComparison.Ordinal), + Text = NativeKeys.Words(HelpModel.NoMatches), Foreground = _colours.Brush(_colours.Dim), Margin = new Thickness(12, 10), TextWrapping = TextWrapping.Wrap, diff --git a/src/SharpMUTerm.Avalonia/NativeKeys.cs b/src/SharpMUTerm.Avalonia/NativeKeys.cs index e2e8fba6..35572140 100644 --- a/src/SharpMUTerm.Avalonia/NativeKeys.cs +++ b/src/SharpMUTerm.Avalonia/NativeKeys.cs @@ -14,17 +14,46 @@ namespace SharpMUTerm.Avalonia; /// internal static class NativeKeys { - /// The key glyphs the window never shows: the three modifiers and the Enter key. - internal static readonly char[] Glyphs = ['⌃', '⌥', '⇧', '⏎']; + /// + /// The key glyphs the window never shows: the three modifiers, and every named key the client spells with a glyph + /// (Enter, Tab, Backspace, Delete, Escape, Page Up/Down). The arrows stay arrows: a desktop application labels them + /// that way too. + /// + internal static readonly char[] Glyphs = ['⌃', '⌥', '⇧', '⏎', '⇥', '↹', '⇤', '⌫', '⌦', '⎋', '⇞', '⇟']; + + /// Each named key's glyph and its word, applied after the modifiers (so ⇧⇥ reads Shift+Tab). + private static readonly (string Glyph, string Word)[] Named = + [ + ("⏎", "Enter"), + ("⇤", "Shift+Tab"), + ("⇥", "Tab"), + ("↹", "Tab"), + ("⌫", "Backspace"), + ("⌦", "Delete"), + ("⎋", "Esc"), + ("⇞", "PgUp"), + ("⇟", "PgDn"), + ]; /// /// with every key glyph spelt as a word — ⌃⏎ is Ctrl+Enter, as the modal footers /// and the window's own chords (HostChord's words) say it; null is empty. /// - public static string Words(string? text) => - string.IsNullOrEmpty(text) || text.IndexOfAny(Glyphs) < 0 - ? text ?? string.Empty - : KeyGlyphs.Words(text).Replace("⏎", "Enter", StringComparison.Ordinal); + public static string Words(string? text) + { + if (string.IsNullOrEmpty(text) || text.IndexOfAny(Glyphs) < 0) + { + return text ?? string.Empty; + } + + var words = KeyGlyphs.Words(text); + foreach (var (glyph, word) in Named) + { + words = words.Replace(glyph, word, StringComparison.Ordinal); + } + + return words; + } /// Whether still holds a modifier glyph. public static bool HasGlyph(string? text) => text is not null && text.IndexOfAny(Glyphs) >= 0; diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index 26ab7eb1..e8ab8618 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -38,6 +38,7 @@ internal sealed class SettingsWindow : Window private readonly DispatcherTimer _clock; private readonly Dictionary _controls = new(StringComparer.Ordinal); private readonly Dictionary _resets = new(StringComparer.Ordinal); + private readonly Dictionary _notes = new(StringComparer.Ordinal); private readonly Dictionary _badges = new(StringComparer.Ordinal); private readonly List<(StatusMeter Meter, TextBlock Now)> _meterNow = []; private readonly List _themeCards = []; @@ -369,12 +370,16 @@ private void OnQuery() // ── the page ───────────────────────────────────────────────────────────────────────────────── + /// The note line under a field on the page, by field id (shown or not), for tests. + internal TextBlock? NoteFor(string id) => _notes.GetValueOrDefault(id); + private void BuildPage() { _page.Children.Clear(); _refreshers.Clear(); _controls.Clear(); _resets.Clear(); + _notes.Clear(); _meterNow.Clear(); _themeCards.Clear(); SubjectPicker = null; @@ -611,6 +616,21 @@ private Grid FieldRow(SettingsField field) words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap }); } + // The note the cell F5 draws beside the value (join wraps' recommendation), from the same sentence, in the + // cells' caution amber; gone once the field has been changed. + var note = new TextBlock { FontSize = NativeTokens.Body, Foreground = _tokens.Brush(_tokens.Notice), TextWrapping = TextWrapping.Wrap }; + void ShowNote() + { + var text = _form.Note(field); + note.Text = text is null ? null : NativeKeys.Words(Capitalise(text)); + note.IsVisible = text is not null; + } + + ShowNote(); + _refreshers.Add(ShowNote); + _notes[field.Id] = note; + words.Children.Add(note); + grid.Children.Add(words); var control = ControlFor(field); diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index 2f86e250..06e1c619 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -277,7 +277,7 @@ public static partial class BuiltInSettings WorldChoice("emoji", "emoji", WorldFieldValues.EmojiChoices, WorldTextGroup, (_, w) => WorldFieldValues.EmojiName(w.Emoji), (_, w, v) => WorldFieldValues.SetEmoji(w.Emoji, v), "which emoji substitutions run on this world's text", "emoticons shortcodes"), - WorldChoice("join-wraps", "join wraps", WorldFieldValues.JoinWrapChoices, WorldTextGroup, + WorldChoice(WorldFieldValues.JoinWrapsFieldId, "join wraps", WorldFieldValues.JoinWrapChoices, WorldTextGroup, (_, w) => w.JoinWrappedLines ? WorldFieldValues.JoinWrapChoices[1] : WorldFieldValues.JoinWrapChoices[0], (_, w, v) => w.JoinWrappedLines = v == WorldFieldValues.JoinWrapChoices[1], "join lines the server wrapped at its own width", "reflow wrap hard"), diff --git a/src/SharpMUTerm.Client/Settings/SettingsForm.cs b/src/SharpMUTerm.Client/Settings/SettingsForm.cs index f7e16590..eb22ddb9 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsForm.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsForm.cs @@ -225,6 +225,29 @@ public bool IsDefault(SettingsField field) return field.Binding?.IsDefault(Target) ?? true; } + /// + /// Notes the client attaches to a world field for one world — F5's join wraps recommendation while the pane is + /// narrower than the server wraps — keyed by field id, then world name. Captured on the client's thread when the form + /// opens, from the data its cell screen draws the same sentence from, so the window reads nothing live. + /// + public IReadOnlyDictionary> WorldNotes { get; init; } = + new Dictionary>(); + + /// + /// The note beside for the world being edited, or null. A note recommends changing the + /// setting, so it holds only while the field is still at its default — once taken, it has nothing left to say. + /// + public string? Note(SettingsField field) + { + ArgumentNullException.ThrowIfNull(field); + return _world is { } world + && WorldNotes.TryGetValue(field.Id, out var byWorld) + && byWorld.TryGetValue(world.Name, out var note) + && IsDefault(field) + ? note + : null; + } + /// The default of as text, for a reset button's tooltip. public static string DefaultText(SettingsField field) { diff --git a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs index abb39b73..9b900897 100644 --- a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs +++ b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs @@ -83,6 +83,17 @@ public static void SetEmoji(EmojiSettings emoji, string name) /// The words for . public static IReadOnlyList JoinWrapChoices { get; } = ["off", "join"]; + /// The id of the declared join wraps field, which a note is attached to. + public const string JoinWrapsFieldId = "join-wraps"; + + /// + /// What F5 says beside join wraps while a world's pane is narrower than its server wraps — one sentence for the + /// cell screen and the window's settings alike. + /// + public static string JoinWrapsAdvice(int column, int paneWidth) => + $"recommended · wraps at {column.ToString(System.Globalization.CultureInfo.InvariantCulture)}, " + + $"pane is {paneWidth.ToString(System.Globalization.CultureInfo.InvariantCulture)}"; + /// The words for . public static IReadOnlyList ReconnectChoices { get; } = ["off", "after a drop"]; diff --git a/src/SharpMUTerm.Core/Protocols/ChannelCapture.cs b/src/SharpMUTerm.Core/Protocols/ChannelCapture.cs index 31bcc78c..02ee1967 100644 --- a/src/SharpMUTerm.Core/Protocols/ChannelCapture.cs +++ b/src/SharpMUTerm.Core/Protocols/ChannelCapture.cs @@ -172,6 +172,30 @@ public bool TakeEcho(string printed) return false; } + /// Whether is the echo of a message still waiting, without consuming it. + public bool Expects(string printed) + { + var text = printed.Trim(); + if (text.Length == 0) + { + return false; + } + + var now = _clock.GetUtcNow(); + lock (_gate) + { + foreach (var (pending, at) in _pending) + { + if (now - at <= EchoWindow && string.Equals(pending, text, StringComparison.Ordinal)) + { + return true; + } + } + } + + return false; + } + /// Forgets every message waiting for an echo (a new connection). public void Clear() { diff --git a/src/SharpMUTerm.Core/Session/WorldSession.cs b/src/SharpMUTerm.Core/Session/WorldSession.cs index 7d81a31a..228f51e5 100644 --- a/src/SharpMUTerm.Core/Session/WorldSession.cs +++ b/src/SharpMUTerm.Core/Session/WorldSession.cs @@ -340,6 +340,8 @@ private void UpgradeParser(ContentFormat format) { ProcessOutputLine(tail); } + + ReleaseEchoHeld(); } _parser = NewParser(format); @@ -607,6 +609,9 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) _reflowRelease?.Dispose(); _wrapJoiner = new ServerWrapJoiner(); _serverWrapColumn = 0; + _echoRelease?.Dispose(); + _echoRelease = null; + _echoHeld.Clear(); // Re-read with the parser, so an F5 change to the world's emoji switches reaches the next connection. _emoji = NewEmoji(World.Emoji); @@ -661,6 +666,13 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) telnet.MxpEnabled += OnMxpEnabled; _mspActive = false; telnet.MspChanged += (_, active) => _mspActive = active; + telnet.ReceiveBatchEnded += (_, _) => + { + lock (_ingestGate) + { + ReleaseEchoHeld(); + } + }; telnet.PuebloEnabled += OnPuebloEnabled; McpStatus = null; GamePresence = null; @@ -916,7 +928,13 @@ internal void CaptureChannel(string package, string json) if (World.CaptureChannels == ChannelCaptureMode.Move) { - _channels.ExpectEcho(message.Lines); + // Lines held since the read began may be this message's echo, printed just before it: they are let go + // now, against the message, in the order they arrived. + lock (_ingestGate) + { + _channels.ExpectEcho(message.Lines); + ReleaseEchoHeld(); + } } foreach (var line in message.Lines) @@ -927,7 +945,73 @@ internal void CaptureChannel(string package, string json) } } + /// + /// Lines waiting, under , for the rest of the read they arrived in: a server + /// that prints a channel line before the GMCP message for it, in the same write, still has its echo kept out of the + /// main window. Released in order at the end of the read (), when a + /// channel message arrives, before a prompt or any other line not held, on a parser swap and on a disconnect, and + /// after at the latest. Touched only under . + /// + private readonly List _echoHeld = []; + + /// The pending release of , or null when nothing is held. + private IDisposable? _echoRelease; + + /// + /// The longest a line waits for its read's GMCP under move when the session says nothing of where a read + /// ends: the cap, not the usual wait, since a real connection lets the lines go as soon as the read is done. + /// + public TimeSpan EchoHold { get; set; } = TimeSpan.FromMilliseconds(250); + + /// + /// A completed line on its way to the engines and the windows. Under move an ordinary line that is not + /// already a waiting message's echo is held to the end of its read (); anything else lets + /// whatever is held go first, so nothing is ever shown out of order. Call under . + /// private void ProcessOutputLine(StyledLine line, bool isPrompt = false) + { + if (isPrompt || World.CaptureChannels != ChannelCaptureMode.Move) + { + ReleaseEchoHeld(); + ProcessOutputLineNow(line, isPrompt); + return; + } + + if (_echoHeld.Count == 0 && _channels.Expects(line.Text)) + { + ProcessOutputLineNow(line); + return; + } + + _echoHeld.Add(line); + _echoRelease ??= Scheduler.After(EchoHold, () => + { + lock (_ingestGate) + { + ReleaseEchoHeld(); + } + }, "echo-hold"); + } + + /// Lets every held line go, in order. Call under . + private void ReleaseEchoHeld() + { + _echoRelease?.Dispose(); + _echoRelease = null; + if (_echoHeld.Count == 0) + { + return; + } + + var held = _echoHeld.ToArray(); + _echoHeld.Clear(); + foreach (var line in held) + { + ProcessOutputLineNow(line); + } + } + + private void ProcessOutputLineNow(StyledLine line, bool isPrompt = false) { // An MSP trigger is the server asking for a sound, and is taken out before anything else sees the // line — but only on a connection that agreed MSP. Anywhere else it is text a player can type. @@ -1458,6 +1542,7 @@ private void OnDisconnected(object? sender, SessionDisconnectedEventArgs e) lock (_ingestGate) { ReleaseHeldLine(); + ReleaseEchoHeld(); } CancelGmcpLogin(); diff --git a/src/SharpMUTerm.Core/Telnet/ITelnetSession.cs b/src/SharpMUTerm.Core/Telnet/ITelnetSession.cs index 5f0c4f46..7a55186f 100644 --- a/src/SharpMUTerm.Core/Telnet/ITelnetSession.cs +++ b/src/SharpMUTerm.Core/Telnet/ITelnetSession.cs @@ -50,6 +50,18 @@ event EventHandler? MspChanged remove { } } + /// + /// Raised after every event one read from the socket produced has been raised: the lines, prompts and GMCP of a + /// single receive are one batch. Channel capture's move holds lines to the end of the batch, so an echo the + /// server printed just before its GMCP in the same write still finds it. A session that does not say leaves those + /// lines to a short timer, which is what the default does. + /// + event EventHandler? ReceiveBatchEnded + { + add { } + remove { } + } + /// /// Raised once the server has switched this connection to Pueblo (its start sequence, after our /// PUEBLOCLIENT). The of Pueblo. diff --git a/src/SharpMUTerm.Core/Telnet/TelnetSession.cs b/src/SharpMUTerm.Core/Telnet/TelnetSession.cs index ac95a254..7275f539 100644 --- a/src/SharpMUTerm.Core/Telnet/TelnetSession.cs +++ b/src/SharpMUTerm.Core/Telnet/TelnetSession.cs @@ -413,6 +413,9 @@ private Encoding? Negotiated public event EventHandler? PuebloEnabled; public event EventHandler? MspChanged; + /// + public event EventHandler? ReceiveBatchEnded; + public async Task ConnectAsync(CancellationToken cancellationToken = default) { if (_interpreter is not null) @@ -920,6 +923,7 @@ private async Task ReadLoopAsync(CancellationToken cancellationToken) } await _interpreter!.InterpretByteArrayAsync(buffer.AsMemory(0, read)).ConfigureAwait(false); + ReceiveBatchEnded?.Invoke(this, EventArgs.Empty); // The second arm of charset observation: the direction whose callback the library // does not raise (see WireCharsetCallback). Cheap — a reference comparison — and diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 7d23e11a..b38006a2 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -581,7 +581,10 @@ internal static (string Header, string Footer) Render(ComposerModel model, int w var spelling = model.Dictionary is { } name ? $"[{ScreenPalette.Value}]{Escape(name)}[/]" - : $"[{ScreenPalette.Muted}]no dictionary[/]"; + : model.Place == ComposerPlace.FullScreen + // The state names its way out: ⌥W here is the offer to get one (the key row says so too). + ? $"[{ScreenPalette.Muted}]no dictionary[/][{ScreenPalette.Label}] · [/][{ScreenPalette.Accent}]⌥W[/][{ScreenPalette.Label}] gets one[/]" + : $"[{ScreenPalette.Muted}]no dictionary[/]"; header = $"[{ScreenPalette.Accent}]COMPOSE[/][{ScreenPalette.Label}] to [/]{target}" + $"[{ScreenPalette.Label}] · text [/]{mode}" diff --git a/src/SharpMUTerm.Tui/ScreenChrome.cs b/src/SharpMUTerm.Tui/ScreenChrome.cs index 526b6aa2..4b6e0d28 100644 --- a/src/SharpMUTerm.Tui/ScreenChrome.cs +++ b/src/SharpMUTerm.Tui/ScreenChrome.cs @@ -279,7 +279,15 @@ internal static List Window(List block, int height) return block; } - var focused = block.FindIndex(l => l.Contains(CursorMark, StringComparison.Ordinal)); + // An open edit is where the keyboard is, so its caret wins over a cursor band: on F5 the band + // stays on the WORLDS row while a world field is typed in the column beside it, and windowing + // that column by the band alone left a field below the fold being edited where nobody could see. + var focused = block.FindIndex(l => l.Contains(CaretMark, StringComparison.Ordinal)); + if (focused < 0) + { + focused = block.FindIndex(l => l.Contains(CursorMark, StringComparison.Ordinal)); + } + var start = focused < 0 ? 0 : Math.Clamp(focused - (height / 2), 0, block.Count - height); diff --git a/src/SharpMUTerm.Tui/ScreenTheme.cs b/src/SharpMUTerm.Tui/ScreenTheme.cs index f59b3200..d2994382 100644 --- a/src/SharpMUTerm.Tui/ScreenTheme.cs +++ b/src/SharpMUTerm.Tui/ScreenTheme.cs @@ -136,7 +136,7 @@ internal static ScreenTheme For(Theme theme) // Text printed on the accent: near-black on a bright accent, the panel's own tone on a dark one. var accent = roles[ScreenPalette.Accent]; var ink0 = Contrast.RelativeLuminance(accent) < LightPlaneLuminance ? roles[ScreenPalette.PanelBg] : Parse(ScreenPalette.Ink); - roles[ScreenPalette.Ink] = Contrast.Legible(ink0, accent); + roles[ScreenPalette.Ink] = Contrast.Legible(ink0, accent, FloorOn(accent)); return new ScreenTheme(roles.ToDictionary(r => r.Key, r => r.Value.ToHex(), StringComparer.OrdinalIgnoreCase)); } @@ -268,6 +268,15 @@ private string Tag(string tag, Stack planes, bool sample) } var plane = background ?? planes.Peek(); + + // The framework draws [dim] as faint text in the inherited ink (or a fixed #808080 with none), which nothing + // holds to a floor. On a light screen plane it becomes a grey held to body text's 4.5:1 there; a dark plane keeps + // the framework's faint, so Dark and Solarized Dark frames do not move. + if (foreground < 0 && !IsIdentity && FloorOn(Parse(plane)) > Contrast.Floor && Array.IndexOf(words, "dim") is >= 0 and var dim) + { + words[dim] = Contrast.Legible(FrameworkDim, Parse(plane), FloorOn(Parse(plane))).ToHex(); + } + if (foreground >= 0) { var given = words[foreground]; @@ -287,7 +296,7 @@ private string Tag(string tag, Stack planes, bool sample) else if (!IsIdentity) { // Not a role: a colour the screen was handed. Hold it to the floor where it lands. - words[foreground] = Contrast.Legible(Parse(given), Parse(plane)).ToHex(); + words[foreground] = Contrast.Legible(Parse(given), Parse(plane), FloorOn(Parse(plane))).ToHex(); } } @@ -349,7 +358,7 @@ private static Rgb Legible(Rgb ink, IReadOnlyDictionary roles, IRea { foreach (var plane in planes ?? TextPlanes) { - ink = Contrast.Legible(ink, roles[plane]); + ink = Contrast.Legible(ink, roles[plane], FloorOn(roles[plane])); } } @@ -361,6 +370,20 @@ private static Rgb Legible(Rgb ink, IReadOnlyDictionary roles, IRea private const double LightPlaneLuminance = 0.18; + /// + /// The floor an ink is held to on : WCAG AA's 4.5:1 for body text on a light plane, where a + /// settings screen's labels and help are small text in a terminal font and 3:1 read as faint; the client's 3:1 on a + /// dark one, where it was chosen (and where Dark's constants, byte for byte, are the identity this must not move). + /// + internal static double FloorOn(Rgb plane) => + Contrast.RelativeLuminance(plane) >= LightPlaneLuminance ? LightTextFloor : Contrast.Floor; + + /// The grey SharpConsoleUI resolves the [dim] tag to, through no option this client holds. + internal static readonly Rgb FrameworkDim = new(0x80, 0x80, 0x80); + + /// The floor small text is held to on a light settings screen. + internal const double LightTextFloor = 4.5; + /// /// A dark role on a light theme: the same colour at the mirrored lightness (100 − L*), keeping the /// tint it carried (its distance from the grey of its own luminance). diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs index ccd5d75a..efd9c3cd 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.JoinWraps.cs @@ -38,7 +38,7 @@ internal sealed partial class SharpMUTermApp /// What F5 says beside join wraps for : a recommendation while it is ragged. internal string? JoinWrapsAdvice(WorldDefinition world) => !world.JoinWrappedLines && _raggedWraps.TryGetValue(world.Name, out var ragged) - ? $"recommended · wraps at {ragged.Column}, pane is {ragged.PaneWidth}" + ? Client.Settings.WorldFieldValues.JoinWrapsAdvice(ragged.Column, ragged.PaneWidth) : null; /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs index 101dd054..f0db1c10 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Settings.cs @@ -194,10 +194,32 @@ internal SettingsForm NativeSettingsForm(string initial, object? item = null) Selections = _listSelections, Theme = () => _theme.Clone(), BesideOutput = item is not null, + WorldNotes = WorldNotesNow(), }; return form; } + /// + /// The notes the cell F5 draws beside a world's fields, for every world, read now on the client's thread: today the + /// join wraps recommendation (), the one sentence both surfaces say. + /// + private Dictionary> WorldNotesNow() + { + var joinWraps = new Dictionary(StringComparer.Ordinal); + foreach (var world in _config.Worlds) + { + if (JoinWrapsAdvice(world) is { } advice) + { + joinWraps[world.Name] = advice; + } + } + + return new Dictionary>(StringComparer.Ordinal) + { + [Client.Settings.WorldFieldValues.JoinWrapsFieldId] = joinWraps, + }; + } + /// /// The world and character the focused window belongs to — what F5 and F9 open on — or nulls, and the form takes the /// first. Resolved here, on the client's thread, because the focus is not safe to read from the window's. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 76a0d642..8ee28d08 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -8012,6 +8012,18 @@ private static IEnumerable EditSnapshotKeys(string view) yield break; } + if (string.Equals(view, "settings", StringComparison.OrdinalIgnoreCase)) + { + // F5 under its second name: the world's last field, far below the fold on an ordinary terminal, + // so the frame shows the detail column windowed to the field being typed in. + for (var i = 0; i < WorldsScreenRenderer.HighlightNamesField; i++) + { + yield return Stroke('\t', ConsoleKey.Tab); + } + + yield break; + } + if (string.Equals(view, "logging", StringComparison.OrdinalIgnoreCase)) { // name → password → connect → on connect → log: the character row's fields, in order. The diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index 7d4a2a13..f766d89c 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -283,8 +283,18 @@ internal static Rgb Backdrop(Theme theme) /// tabs. A chip states one fact relative to its own strip: the selected tab is painted the plane its /// page is painted on, its siblings are recessed from it. Pane focus is not a term, because it is /// already in the plane. + /// + /// A light plane takes a shallower step (), for the backdrop's reason: the dark + /// themes' step off a near-white pane landed unselected chips and resting strip panels on a mid-grey (L* 75) that + /// read as disabled. Twice the light backdrop's step (about 9 L*), so a recessed chip or strip is still a step below + /// the pane and a step apart from the backdrop beside it. + /// /// - internal static Rgb Recessed(Rgb plane) => Scale(plane, BackdropScale); + internal static Rgb Recessed(Rgb plane) => + Scale(plane, Contrast.RelativeLuminance(plane) < LightPlaneLuminance ? BackdropScale : LightRecessScale); + + /// The recess as a fraction of a light plane: about L* 87 under Light's L* 96 panes. + private const double LightRecessScale = 0.90; /// The one-cell hairline a split draws between two panes, and beside the rail. internal static Rgb Rule(Theme theme) => Mix(Surface(theme), theme.Border, RuleLift); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs index be38b3b6..82e57292 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs @@ -131,6 +131,30 @@ public async Task F1OpensTheNativeEditorFocusedOverTheCellsAndNotTheCellModal() await Assert.That(margin).IsTrue().Because("over the cells, clear of the native header and sidebar"); } + /// + /// With no dictionary, the header's chip is the way to one: a click opens the offer ⌥W opens, and fetches nothing. + /// + [Test] + public async Task TheNoDictionaryChipOpensTheOffer() + { + var (text, tip, offered) = await Run(rig => + { + var overlay = OpenF1(rig); + var chip = overlay.Composer.DictionaryChip(12); + var label = ((TextBlock)chip.Child!).Text; + var tooltip = ToolTip.GetTip(chip) as string; + var pointer = new Pointer(0, PointerType.Mouse, true); + var point = new PointerPointProperties(RawInputModifiers.LeftMouseButton, PointerUpdateKind.LeftButtonPressed); + chip.RaiseEvent(new PointerPressedEventArgs(chip, pointer, chip, default, 0, point, KeyModifiers.None)); + Drain(); + return (label, tooltip, rig.App.DictionaryOfferOpen); + }); + + await Assert.That(text).IsEqualTo(ComposerView.NoDictionaryChip); + await Assert.That(tip).Contains("Alt+W"); + await Assert.That(offered).IsTrue(); + } + [Test] [Arguments("+pose waves\nand sits", false)] [Arguments("+bbpost 1=Title\n\nFirst, 50% [done].\n", true)] diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeKeySpellingTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeKeySpellingTests.cs index 2c506e76..085f818f 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeKeySpellingTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeKeySpellingTests.cs @@ -259,6 +259,11 @@ public async Task WordsSpellsEveryModifierAndLeavesTheRestAlone() await Assert.That(NativeKeys.Words("F4 edits keys")).IsEqualTo("F4 edits keys"); await Assert.That(NativeKeys.Words("⌃⏎ newline · ⏎ goes")).IsEqualTo("Ctrl+Enter newline · Enter goes"); await Assert.That(NativeKeys.Words(null)).IsEqualTo(string.Empty); + await Assert.That(NativeKeys.Words("⇥ next field · ⇧⇥ back · ↹ · ⇤")).IsEqualTo("Tab next field · Shift+Tab back · Tab · Shift+Tab"); + await Assert.That(NativeKeys.Words("⌫ widens · ⌦ removes · ⎋ · ⇞/⇟ pages")).IsEqualTo("Backspace widens · Delete removes · Esc · PgUp/PgDn pages"); + await Assert.That(NativeKeys.Words("↑↓ move · ← →")).IsEqualTo("↑↓ move · ← →").Because("a desktop application labels the arrows as arrows"); + await Assert.That(NativeKeys.HasGlyph("⌫ widens the query")).IsTrue(); + await Assert.That(NativeKeys.HasGlyph("⇥")).IsTrue(); } private static string RepositoryRoot() diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs index 4b7de06f..49ac7f1a 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -27,6 +27,10 @@ private sealed class Harness /// The sections the form lists; every built-in one is declared now, so a test adds one that is not. public IReadOnlyList Sections { get; init; } = BuiltInSettings.All; + /// The notes the client captured for the world fields (F5's join wraps recommendation). + public IReadOnlyDictionary> Notes { get; init; } = + new Dictionary>(); + public SettingsForm Form(string initial = "text") { SettingsForm? form = null; @@ -45,7 +49,10 @@ public SettingsForm Form(string initial = "text") () => [new ReceivedValue("Char.Vitals.hp", "412"), new ReceivedValue("Char.Vitals.maxhp", "500")], meter => meter.Value == "Char.Vitals.hp" ? "412/500" : null, () => ThemePreviews.Cards(Config), - () => ThemePreviews.IsDark(ThemeChoices.Resolve(Config))); + () => ThemePreviews.IsDark(ThemeChoices.Resolve(Config))) + { + WorldNotes = Notes, + }; return form; } } @@ -222,6 +229,40 @@ public async Task AWorldSectionPicksItsWorldAndEditsIt() await Assert.That(harness.Commits).IsEqualTo(1); } + /// + /// The cell F5's join wraps recommendation is drawn under the field natively, from the same sentence, and goes + /// when the field is changed. + /// + [Test] + public async Task JoinWrapsCarriesTheCellScreensRecommendation() + { + var advice = WorldFieldValues.JoinWrapsAdvice(78, 60); + var harness = new Harness + { + Notes = new Dictionary> + { + [WorldFieldValues.JoinWrapsFieldId] = new Dictionary { ["Aetherfall"] = advice }, + }, + }; + harness.Config.Worlds.Clear(); + harness.Config.Worlds.Add(new WorldDefinition { Name = "Aetherfall", Host = "aether.example" }); + var (before, shownBefore, after) = await Run(harness, "worlds", window => + { + var note = window.NoteFor(WorldFieldValues.JoinWrapsFieldId)!; + var text = note.Text; + var shown = note.IsVisible; + var combo = (ComboBox)window.FieldControls[WorldFieldValues.JoinWrapsFieldId]; + combo.SelectedItem = WorldFieldValues.JoinWrapChoices[1]; + Dispatcher.UIThread.RunJobs(); + return (text, shown, window.NoteFor(WorldFieldValues.JoinWrapsFieldId)!.IsVisible); + }); + + await Assert.That(before).IsEqualTo("Recommended · wraps at 78, pane is 60"); + await Assert.That(shownBefore).IsTrue(); + await Assert.That(harness.Config.Worlds[0].JoinWrappedLines).IsTrue(); + await Assert.That(after).IsFalse(); + } + /// A text the cell screen would refuse is refused here too, and the box shows the value kept. [Test] public async Task ARefusedTextIsPutBack() diff --git a/tests/SharpMUTerm.Client.Tests/ScopedSettingsTests.cs b/tests/SharpMUTerm.Client.Tests/ScopedSettingsTests.cs index 5ecab3cb..89c6ab24 100644 --- a/tests/SharpMUTerm.Client.Tests/ScopedSettingsTests.cs +++ b/tests/SharpMUTerm.Client.Tests/ScopedSettingsTests.cs @@ -25,6 +25,36 @@ private static AppConfiguration TwoWorlds() private static SettingsField Character(string id) => BuiltInSettings.Character.Fields.Single(f => f.Id == id); + /// + /// The note F5 draws beside join wraps reaches the window through the form, for the world being edited only, in + /// the cells' own sentence, and goes once the setting is taken. + /// + [Test] + public async Task AWorldNoteIsShownForItsWorldUntilTheFieldIsChanged() + { + var config = TwoWorlds(); + var advice = WorldFieldValues.JoinWrapsAdvice(78, 60); + var form = new SettingsForm(BuiltInSettings.All, config, change => change(), _ => { }, "worlds", isDark: true) + { + WorldNotes = new Dictionary> + { + [WorldFieldValues.JoinWrapsFieldId] = new Dictionary { ["Aetherfall"] = advice }, + }, + }; + var join = World(WorldFieldValues.JoinWrapsFieldId); + + await Assert.That(advice).IsEqualTo("recommended · wraps at 78, pane is 60"); + await Assert.That(form.Note(join)).IsEqualTo(advice); + await Assert.That(form.Note(World("emoji"))).IsNull(); + + form.Choose(form.Subjects(SettingScope.World)[1]); + await Assert.That(form.Note(join)).IsNull().Because("Brightwater's pane is not ragged"); + + form.Choose(form.Subjects(SettingScope.World)[0]); + config.Worlds[0].JoinWrappedLines = true; + await Assert.That(form.Note(join)).IsNull().Because("a recommendation that has been taken has nothing left to say"); + } + [Test] public async Task TheWorldAndCharacterSectionsAreScoped() { diff --git a/tests/SharpMUTerm.Core.Tests/Session/ChannelsAndNamesTests.cs b/tests/SharpMUTerm.Core.Tests/Session/ChannelsAndNamesTests.cs index 44a66792..3d6a8cd9 100644 --- a/tests/SharpMUTerm.Core.Tests/Session/ChannelsAndNamesTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Session/ChannelsAndNamesTests.cs @@ -70,6 +70,51 @@ public async Task MoveKeepsTheEchoOutOfTheMainWindowOnce() await Assert.That(printed.Count(p => p == "(OOC) Ashlyn: hello all")).IsEqualTo(1); } + /// + /// A server that prints the channel line before its GMCP message, in the same read: the line waits for the rest of + /// the read, so the echo is still kept out, and the lines around it keep their order. + /// + [Test] + public async Task MoveCatchesAnEchoPrintedBeforeItsMessageInTheSameRead() + { + var world = World(); + world.CaptureChannels = ChannelCaptureMode.Move; + var (session, telnet) = Create(world); + var printed = new List(); + session.LinePrinted += (_, l) => printed.Add(l.Text); + await session.ConnectAsync(); + printed.Clear(); + + telnet.EmitLine("The fountain splashes.", endRead: false); + telnet.EmitLine("(OOC) Ashlyn: hello all", endRead: false); + await Assert.That(printed).IsEmpty().Because("held until the read is done"); + + telnet.EmitGmcp("Comm.Channel.Text", Ooc); + telnet.EmitLine("A pigeon lands.", endRead: false); + telnet.EndRead(); + + await Assert.That(string.Join(" | ", printed)).IsEqualTo("The fountain splashes. | A pigeon lands."); + } + + /// The hold is a read long: a line whose read ended with no message is shown, in order, at once. + [Test] + public async Task MoveShowsAnUnmatchedLineWhenItsReadEnds() + { + var world = World(); + world.CaptureChannels = ChannelCaptureMode.Move; + var (session, telnet) = Create(world); + var printed = new List(); + session.LinePrinted += (_, l) => printed.Add(l.Text); + await session.ConnectAsync(); + printed.Clear(); + + telnet.EmitLine("(OOC) Ashlyn: hello all", endRead: false); + telnet.EmitPrompt("> "); + telnet.EmitGmcp("Comm.Channel.Text", Ooc); + + await Assert.That(printed.First()).IsEqualTo("(OOC) Ashlyn: hello all").Because("a prompt lets the held line go first, and a message after its read is too late"); + } + [Test] public async Task AChannelNameIsMadeSafeForATitle() { diff --git a/tests/SharpMUTerm.Core.Tests/Session/FakeTelnetSession.cs b/tests/SharpMUTerm.Core.Tests/Session/FakeTelnetSession.cs index 4d129be0..913c5db2 100644 --- a/tests/SharpMUTerm.Core.Tests/Session/FakeTelnetSession.cs +++ b/tests/SharpMUTerm.Core.Tests/Session/FakeTelnetSession.cs @@ -26,6 +26,7 @@ internal sealed class FakeTelnetSession : ITelnetSession public event EventHandler? PuebloEnabled; public event EventHandler? MsdpEnabled; public event EventHandler? MspChanged; + public event EventHandler? ReceiveBatchEnded; public List<(string Variable, string Value)> SentMsdp { get; } = new(); @@ -90,9 +91,24 @@ public Task DisconnectAsync() // ---- test drivers ---- - public void EmitLine(string text) => OutputReceived?.Invoke(this, new TelnetOutputEventArgs(text, isPrompt: false)); + /// A line, as one read of its own unless is false (more of the same read follows). + public void EmitLine(string text, bool endRead = true) + { + OutputReceived?.Invoke(this, new TelnetOutputEventArgs(text, isPrompt: false)); + if (endRead) + { + EndRead(); + } + } + + public void EmitPrompt(string text) + { + OutputReceived?.Invoke(this, new TelnetOutputEventArgs(text, isPrompt: true)); + EndRead(); + } - public void EmitPrompt(string text) => OutputReceived?.Invoke(this, new TelnetOutputEventArgs(text, isPrompt: true)); + /// The end of one read from the socket: everything it carried has been raised. + public void EndRead() => ReceiveBatchEnded?.Invoke(this, EventArgs.Empty); public void EmitGmcp(string package, string json) => GmcpReceived?.Invoke(this, new GmcpMessageEventArgs(package, json)); diff --git a/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs b/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs index 6a172109..1329d004 100644 --- a/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs @@ -93,6 +93,8 @@ public async Task WithNoDictionaryTheHeaderSaysSoAndAltWOffersToGetOne() await Assert.That(app.Composer.HeaderMarkup).Contains("no dictionary"); var rows = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); await Assert.That(rows.Any(r => r.Contains("⌥W", StringComparison.Ordinal) && r.Contains("get a dictionary", StringComparison.Ordinal))).IsTrue(); + await Assert.That(rows.Any(r => r.Contains("no dictionary · ⌥W gets one", StringComparison.Ordinal))) + .IsTrue().Because("the header names the key beside the state it gets you out of"); await Assert.That(app.Composer.SimulateKey(Key(ConsoleKey.W, ConsoleModifiers.Alt))).IsTrue(); await Assert.That(app.DictionaryOfferOpen).IsTrue().Because("⌥W with no dictionary offers one, and fetches nothing"); } diff --git a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs index be64c780..2636b4f1 100644 --- a/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FrameContrastTests.cs @@ -177,7 +177,6 @@ await Assert.That(painted).IsGreaterThanOrEqualTo(100) var failures = pairs .Select(pair => (pair.Key.Fg, pair.Key.Bg, pair.Value, Ratio: Contrast.Ratio(pair.Key.Fg, pair.Key.Bg))) .Where(t => t.Ratio < Contrast.Floor) - .Where(t => !IsFrameworkDim(t.Fg)) .OrderBy(t => t.Ratio) .Select(t => $"{t.Ratio:0.00} {t.Fg.ToHex()} on {t.Bg.ToHex()} ({t.Value} cells)") .ToList(); @@ -186,19 +185,10 @@ await Assert.That(failures).IsEmpty() .Because($"--theme \"{test.Theme}\" --view {(test.View.Length == 0 ? "(default)" : test.View)}"); } - /// - /// The one exemption, and it is the framework's rather than ours. SharpConsoleUI resolves the - /// [dim] markup tag to a fixed #808080 of its own — it is an internal local function in - /// the markup renderer, reachable through no option we hold — so a dim rule measures 4.01:1 on the - /// default dark theme and 2.52:1 on Solarized Dark's focused pane. - /// - /// It is exempted rather than papered over. Reaching it means giving up [dim] everywhere in - /// favour of an explicit floor-checked grey, which is a sweep across every renderer in the app for a - /// near miss on one theme; the honest state is a named exemption and a number, so that anybody who - /// does that sweep can delete this and watch the test still pass. - /// - /// - private static bool IsFrameworkDim(Rgb fg) => fg == new Rgb(0x80, 0x80, 0x80); + // There is no exemption for the framework's [dim] any more. It resolves to a fixed #808080 nothing can retheme, and + // was exempted while it measured 2.52:1 on Solarized Dark's focused pane; the panes have since been deepened, the + // settings screens repaint it off Dark (ScreenTheme), and the status row swaps it (StatusInk), so every [dim] cell + // in every view here clears the floor on all three themes, and a new one that does not fails like any other ink. /// /// A glyph that is a fill rather than text, and to which a text floor therefore does not diff --git a/tests/SharpMUTerm.Tui.Tests/RecordingTelnetSession.cs b/tests/SharpMUTerm.Tui.Tests/RecordingTelnetSession.cs index 88beceae..ec2bf9ff 100644 --- a/tests/SharpMUTerm.Tui.Tests/RecordingTelnetSession.cs +++ b/tests/SharpMUTerm.Tui.Tests/RecordingTelnetSession.cs @@ -70,6 +70,8 @@ public IReadOnlyList Lines public event EventHandler? MsdpEnabled; + public event EventHandler? ReceiveBatchEnded; + public void ReceiveGmcp(string package, string json) => GmcpReceived?.Invoke(this, new GmcpMessageEventArgs(package, json)); @@ -128,8 +130,11 @@ public void RaiseEncodingChanged() => /// lines. It is the only way to assert on what a server's markup does to this client, as /// opposed to what a hand-built StyledLine does. /// - public void Receive(string text) => + public void Receive(string text) + { OutputReceived?.Invoke(this, new TelnetOutputEventArgs(text, isPrompt: false)); + ReceiveBatchEnded?.Invoke(this, EventArgs.Empty); // one call, one read + } public Task ConnectAsync(CancellationToken cancellationToken = default) { diff --git a/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs b/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs index 710a788b..d2349cad 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScreenThemeTests.cs @@ -171,6 +171,61 @@ await Assert.That(scheme.Paint($"[{ScreenPalette.Ink} on {ScreenPalette.Accent}] [Arguments("worlds")] public async Task NoLightSettingsFramePaintsADarkPlaneAt80Columns(string view) => await AssertNoDarkPlane(view, 80, 24); + /// + /// On a light theme a settings screen's text is body text: every ink, the framework's [dim] included, clears + /// WCAG AA's 4.5:1 on the screen plane it is painted on. Labels and help were held to the client's 3:1 and read as + /// faint in a terminal font; Dark keeps its constants (and its 3:1), byte for byte. + /// + [Test] + [Arguments("triggers")] + [Arguments("worlds")] + [Arguments("textansi")] + [Arguments("aliases")] + [Arguments("timers")] + [Arguments("keypad")] + public async Task ALightSettingsScreensTextClearsBodyTextContrast(string view) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = "Light"; + config.Theme = ThemeLibrary.Get("Light"); + var scheme = ScreenTheme.For(config.Theme); + var caps = new TerminalCapabilities(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + var app = new SharpMUTermApp(config, caps, new HeadlessConsoleDriver(120, 32)); + var frame = app.RenderSnapshot(view); + + var planes = TextPlanes.Select(p => Rgb(scheme.Role(p))).ToHashSet(); + var failures = FrameGrid.Cells(frame, 120, 32).Values + .Where(c => c.Background is { } bg && planes.Contains(bg) && c.Foreground is { }) + .Where(c => c.Glyph is not (' ' or '▌' or '▐') && !(c.Glyph is >= '─' and <= '▟') && c.Glyph is not ('\ue0b0' or '\ue0b2')) + .Select(c => (Fg: c.Foreground!.Value, Bg: c.Background!.Value)) + .Distinct() + .Where(p => Contrast.Ratio(p.Fg, p.Bg) < ScreenTheme.LightTextFloor) + .Select(p => $"{Contrast.Ratio(p.Fg, p.Bg):0.00} {p.Fg.ToHex()} on {p.Bg.ToHex()}") + .ToList(); + + await Assert.That(failures).IsEmpty().Because($"--theme Light --view {view}"); + } + + [Test] + public async Task OnALightThemeEveryInkClearsBodyTextContrast() + { + var scheme = ScreenTheme.For(ThemeLibrary.Get("Light")); + string[] inks = [ScreenPalette.Label, ScreenPalette.Muted, ScreenPalette.Value, ScreenPalette.PanelFg, ScreenPalette.Warn]; + foreach (var ink in inks) + { + foreach (var plane in ScreenTheme.PlanesUnder(ink)) + { + await Assert.That(Contrast.Ratio(Rgb(scheme.Role(ink)), Rgb(scheme.Role(plane)))) + .IsGreaterThanOrEqualTo(ScreenTheme.LightTextFloor).Because($"{ink} on {plane}"); + } + } + + await Assert.That(Contrast.Ratio(Rgb(scheme.Ink), Rgb(scheme.Accent))).IsGreaterThanOrEqualTo(ScreenTheme.LightTextFloor); + await Assert.That(scheme.Paint("[dim]x[/]")).DoesNotContain("dim").Because("the framework's fixed grey is rethemed off Dark"); + await Assert.That(ScreenTheme.For(ThemeLibrary.Get("Dark")).Paint("[dim]x[/]")).IsEqualTo("[dim]x[/]"); + } + private static async Task AssertNoDarkPlane(string view, int width, int height) { Console.SetIn(TextReader.Null); diff --git a/tests/SharpMUTerm.Tui.Tests/WorldFieldScrollTests.cs b/tests/SharpMUTerm.Tui.Tests/WorldFieldScrollTests.cs new file mode 100644 index 00000000..65a4c3b0 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/WorldFieldScrollTests.cs @@ -0,0 +1,67 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// F5's world fields run past the fold on an ordinary terminal, and the field being typed in has to be +/// on screen. The cursor band stays on the WORLDS row while ⇥ walks the fields in the column beside it, +/// so the column is windowed by the open edit's caret, not by the band (). +/// Read off the painted frame, because the defect was a field edited where nobody could see it. +/// +[NotInParallel] +public class WorldFieldScrollTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + /// Fields whose row is labelled shorter than the field's own name. + private static readonly Dictionary RowLabels = new() + { + ["gmcp modules"] = "gmcp", + ["command stacking"] = "stacking", + ["capture channels"] = "channels", + ["highlight names"] = "names", + }; + + private static ConsoleKeyInfo Key(ConsoleKey key) => new('\0', key, false, false, false); + + [Test] + [Arguments(120, 32)] + [Arguments(80, 24)] + public async Task EveryWorldFieldIsOnScreenWhileItIsBeingEdited(int width, int height) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); + app.RenderSnapshot("worlds"); + + // ⏎ on the world's row opens its first field; ⇥ walks the rest. + app.SimulateSettingsKey(Key(ConsoleKey.Enter)); + var seen = new HashSet(); + var offScreen = new List(); + for (var step = 0; step < 60; step++) + { + var focus = app.Settings.Focus; + if (focus?.Edit is not { } edit || !seen.Add(edit.Field)) + { + break; + } + + var model = WorldsScreenRenderer.Model(config.Worlds, config.TriggerSets, focus.Value.Index, 0); + var label = model.FieldAt(focus.Value.Pane, focus.Value.Index, edit.Field)?.Label; + label = label is not null && RowLabels.TryGetValue(label, out var shown) ? shown : label; + var frame = FrameGrid.Decode(app.RenderWholeFrame(), width, height); + if (label is not null && !frame.Any(row => row.Contains(label + " ", StringComparison.Ordinal))) + { + offScreen.Add(label); + } + + app.SimulateSettingsKey(Key(ConsoleKey.Tab)); + } + + await Assert.That(seen.Count).IsGreaterThan(10); + await Assert.That(offScreen).IsEmpty(); + } +} From 196fa9e4b716aa9b66545a4ed3696f292de5de47 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 14:29:16 +0000 Subject: [PATCH 052/113] Alerts reach the desktop on X11 and Windows; page alerts on for new worlds - X11: an alert sets the window's urgency hint (WM_HINTS UrgencyHint and _NET_WM_STATE_DEMANDS_ATTENTION), taken back when the window is activated. - Windows: the window adopts the AppUserModelID SharpMUTerm.Window; the installer gives the shortcuts that id and registers it, and an installed copy shows a WinRT toast (via Windows PowerShell, text base64-encoded in a fixed script) beside the taskbar flash. - WorldDefinition.AlertOnPage, on for a new world; a saved world lacking it reads false, so existing worlds keep their alerts. F5's alert on row is off / pages / name & pages. - DesktopAlert decides through an IDesktopNative seam, tested with a fake. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 6 + CLAUDE.md | 15 +- docs/PACKAGING.md | 14 + packaging/windows/sharpmuterm.iss | 12 +- src/SharpMUTerm.Avalonia/DesktopAlert.cs | 441 ++++++++++++++++++ src/SharpMUTerm.Avalonia/MainWindow.cs | 11 +- src/SharpMUTerm.Avalonia/Program.cs | 2 + src/SharpMUTerm.Avalonia/WindowAttention.cs | 94 ---- .../Settings/BuiltInSettings.cs | 6 +- .../Settings/WorldFieldValues.cs | 18 +- .../Configuration/ConfigurationMigrator.cs | 23 + .../Configuration/WorldDefinition.cs | 26 +- src/SharpMUTerm.Core/Session/WorldSession.cs | 7 +- src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 6 +- .../DesktopAlertTests.cs | 143 ++++++ .../AlertChoiceTests.cs | 42 ++ .../Automation/AttentionTests.cs | 59 ++- 17 files changed, 808 insertions(+), 117 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/DesktopAlert.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/DesktopAlertTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/AlertChoiceTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index a56b3d8f..19a1c010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Alerts reach more of the desktop. On Linux (X11, and XWayland) the window is marked as wanting attention, so the + taskbar or window list highlights it until you come back. On Windows, an installed copy shows a toast as well as + flashing the taskbar, and the window groups with its Start menu shortcut. +- A new world alerts you when you are paged, told or whispered to while you are in another window (F5 ▸ alert on ▸ + pages). Alerts for your character's name stay off until you choose "name & pages", since a name comes up in every + scene. Worlds you already have keep the setting they had. - Import worlds, characters, triggers, aliases, timers and keys from MUSHclient (.mcl), Mudlet (a profile folder, an XML package or a .mpackage) and TinTin++ with `/import `, Ctrl+P ▸ Import from another client… or the welcome screen. A review shows what can act as you, what will be added and what was left out (scripts are never imported or diff --git a/CLAUDE.md b/CLAUDE.md index 6be78060..71d7ce83 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2985,8 +2985,19 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] with F5 ▸ `alert on` a line naming the character (whole word, not the line's first) or paging/telling/whispering them (`WorldSession.AttentionRequested`, raised after the line is shown, never for a prompt or a gagged line). The client asks only with F7 ▸ `alert when away` on, the host not in front, and one per 10 s. The window - (`WindowAttention`, `DesktopAlert`) knows its focus: Windows flashes the taskbar, macOS `osascript`, Linux - `notify-send`, all argv, errors swallowed. A terminal cannot tell focus-out, so `TerminalAttention.Focused` is null: + (`WindowAttention`, `DesktopAlert`, which decides through an `IDesktopNative` seam tests fake) knows its focus. + Windows: `FlashWindowEx`, plus a toast only where the installer registered the AUMID `SharpMUTerm.Window` + (`HKA\Software\Classes\AppUserModelId\…`; the shortcuts carry it too; the process adopts it in `Program`), + shown by `powershell.exe -EncodedCommand` reaching WinRT (`net10.0` has no WinRT), the text base64 inside a fixed + script; built, never run on Windows. macOS: `/usr/bin/osascript`, argv; never run. Linux: `notify-send`, and on an + `XID` handle the urgency hint (`X11Urgency`: `WM_HINTS` UrgencyHint and `_NET_WM_STATE_DEMANDS_ATTENTION` via a + root client message, own Xlib connection, 64-bit only), taken back on `Activated`. Seen under Xvfb + openbox (a + page from a fake server sets both, activation clears both); Avalonia has no Wayland back end, so Wayland is + XWayland's mapping of the hint, untried. **Page alerts are on for a new world, name alerts off** + (`WorldDefinition.AlertOnPage = true`, `AlertOnName` false and still covering pages; F5 ▸ `alert on`: off / pages / + name & pages): a page is addressed to the player, a name comes up in every scene. A saved world lacking the field + gets `false` at load (`ConfigurationMigrator.AdoptPageAlerts`, every load, no schema step), so nobody's existing + world changes. A terminal cannot tell focus-out, so `TerminalAttention.Focused` is null: kitty gets OSC 99 with `o=unfocused` (kitty filters), WezTerm/Ghostty/foot OSC 777, anything else BEL, and those last two only after 30 s with no input (`AwayAfter`). Text is stripped of control characters and base64'd for OSC 99. While a host that knows its focus is behind, the title leads with the count of lines that arrived (`(3) …`, diff --git a/docs/PACKAGING.md b/docs/PACKAGING.md index 6c0c77b5..c4e55c55 100644 --- a/docs/PACKAGING.md +++ b/docs/PACKAGING.md @@ -75,6 +75,20 @@ arguments of its own. The link itself is read as server text (`TelnetLink`): hos name or password, no path, no command. A running client is handed the link over a socket in `$XDG_RUNTIME_DIR/sharpmuterm/` (or beside `config.json`), and the new launch exits. +### Alerts and the AppUserModelID + +The window takes the AppUserModelID `SharpMUTerm.Window` at start (`SetCurrentProcessExplicitAppUserModelID`), and +the installer gives its Start menu and desktop shortcuts the same id and writes +`Software\Classes\AppUserModelId\SharpMUTerm.Window` (`DisplayName`, and `IconUri` pointing at the installed +`sharpmuterm.png`) under `HKA`, removed on uninstall. That key is what Windows needs before it shows a toast under the +id, and its presence is how the window knows it may: an alert then shows a toast (through Windows PowerShell 5.1's +WinRT `ToastNotificationManager`, the text base64-encoded inside the script) as well as flashing the taskbar. A copy +run from the `.zip` has no key and only flashes. The program never writes the key itself. **Built, never run on +Windows**: neither the toast nor the shortcut's id has been seen on a desktop. + +Linux needs nothing from the package: `notify-send` and, on X11, the window's urgency hint. macOS uses +`/usr/bin/osascript`, which files the notification under Script Editor and asks once whether to allow it. + ### Passwords Character passwords go to the system's credential store when there is one that answers: Windows Credential Manager diff --git a/packaging/windows/sharpmuterm.iss b/packaging/windows/sharpmuterm.iss index a97a52c3..82aabf82 100644 --- a/packaging/windows/sharpmuterm.iss +++ b/packaging/windows/sharpmuterm.iss @@ -51,10 +51,13 @@ Name: "telnetlinks"; Description: "Open telnet:// and telnets:// links in SharpM Source: "{#PublishDir}\sharpmuterm-window.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{#PublishDir}\sharpmuterm.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\LICENSE"; DestDir: "{app}"; DestName: "LICENSE.txt"; Flags: ignoreversion +Source: "..\icons\sharpmuterm.png"; DestDir: "{app}"; Flags: ignoreversion +; AppUserModelID: the window takes the same id at start (WindowsAppId in src/SharpMUTerm.Avalonia/DesktopAlert.cs), so +; the taskbar groups it with this shortcut and an alert's toast is shown under it. [Icons] -Name: "{autoprograms}\SharpMUTerm"; Filename: "{app}\sharpmuterm-window.exe" -Name: "{autodesktop}\SharpMUTerm"; Filename: "{app}\sharpmuterm-window.exe"; Tasks: desktopicon +Name: "{autoprograms}\SharpMUTerm"; Filename: "{app}\sharpmuterm-window.exe"; AppUserModelID: "SharpMUTerm.Window" +Name: "{autodesktop}\SharpMUTerm"; Filename: "{app}\sharpmuterm-window.exe"; AppUserModelID: "SharpMUTerm.Window"; Tasks: desktopicon ; telnet:// and telnets:// links, for this user (HKA is HKCU in the default per-user install). Only with the task above; ; the program never registers itself. --open-link makes the client read the link and nothing else, so a link holding a @@ -69,6 +72,11 @@ Root: HKA; Subkey: "Software\Classes\telnets"; ValueType: string; ValueName: "UR Root: HKA; Subkey: "Software\Classes\telnets\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: """{app}\sharpmuterm-window.exe"",0"; Tasks: telnetlinks Root: HKA; Subkey: "Software\Classes\telnets\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\sharpmuterm-window.exe"" --open-link ""%1"""; Tasks: telnetlinks +; The AppUserModelID's name and icon for toasts. Always written: its presence is what tells the window a toast can be +; shown (a portable copy has none and only flashes the taskbar). +Root: HKA; Subkey: "Software\Classes\AppUserModelId\SharpMUTerm.Window"; ValueType: string; ValueName: "DisplayName"; ValueData: "SharpMUTerm"; Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\AppUserModelId\SharpMUTerm.Window"; ValueType: string; ValueName: "IconUri"; ValueData: "{app}\sharpmuterm.png" + [Run] Filename: "{app}\sharpmuterm-window.exe"; Description: "{cm:LaunchProgram,SharpMUTerm}"; Flags: nowait postinstall skipifsilent diff --git a/src/SharpMUTerm.Avalonia/DesktopAlert.cs b/src/SharpMUTerm.Avalonia/DesktopAlert.cs new file mode 100644 index 00000000..c6e0a384 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/DesktopAlert.cs @@ -0,0 +1,441 @@ +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Text; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// Which desktop the window is on, as far as an alert cares. +internal enum DesktopPlatform +{ + Windows, + MacOS, + Linux, +} + +/// A fixed program and its arguments, each passed as one argv entry, never a shell string. +internal sealed record AlertLaunch(string Program, IReadOnlyList Arguments); + +/// +/// Everything an alert does to the machine, behind one seam so the decisions in are tested +/// with a fake ( is the real one). +/// +internal interface IDesktopNative +{ + /// Starts and does not wait for it. + void Launch(AlertLaunch launch); + + /// Flashes the taskbar button of until it is brought forward (Windows). + void Flash(IntPtr hwnd); + + /// Sets or clears the X11 urgency hint of the window ; false when it could not. + bool SetUrgency(IntPtr xid, bool urgent); + + /// + /// Whether the installer registered (Windows), which is what lets a toast be + /// shown under it. A portable copy has none and gets the flash alone. + /// + bool ToastRegistered { get; } +} + +/// +/// What the desktop does with an alert, per platform. Every way out of the process is a fixed program with the text as +/// separate arguments, and every failure is a quiet no-op: an alert is a courtesy, never an error. +/// +/// Windows: FlashWindowEx until the window is brought forward, and a toast through +/// ToastNotificationManager under the AppUserModelID the installer registered (). The +/// toast is shown by Windows PowerShell 5.1, which can reach WinRT from a script; the text travels base64-encoded inside +/// -EncodedCommand, so nothing a server sends can become script. +/// macOS: /usr/bin/osascript with a fixed display notification script and the title and body +/// as argv. macOS files it under Script Editor and asks the player once whether to allow it. +/// Linux: notify-send, and on X11 the window's urgency hint (WM_HINTS UrgencyHint and +/// _NET_WM_STATE_DEMANDS_ATTENTION, ), cleared when the window is activated. Avalonia +/// has no Wayland back end, so under Wayland the window is an XWayland client and the hint goes through XWayland. +/// +/// +internal sealed class DesktopAlert(DesktopPlatform platform, IDesktopNative native) +{ + /// How much of a line goes into a notification; a toast or a bubble shows two or three lines at most. + internal const int MaxBody = 400; + + private IntPtr _urgentWindow; + + /// The alert for the machine this runs on. + public static DesktopAlert ForThisMachine() => new( + OperatingSystem.IsWindows() ? DesktopPlatform.Windows + : OperatingSystem.IsMacOS() ? DesktopPlatform.MacOS + : DesktopPlatform.Linux, + new DesktopNative()); + + /// + /// Shows for the window behind , whose kind is + /// (Avalonia's HWND, XID or NSWindow), both null where there is none. + /// + public void Show(AttentionRequest request, IntPtr? handle, string? descriptor) + { + try + { + if (platform == DesktopPlatform.Windows && IsWindow(handle, descriptor, "HWND") is { } hwnd) + { + native.Flash(hwnd); + } + + if (platform == DesktopPlatform.Linux && IsWindow(handle, descriptor, "XID") is { } xid && native.SetUrgency(xid, true)) + { + _urgentWindow = xid; + } + + foreach (var launch in Launches(platform, request, platform == DesktopPlatform.Windows && native.ToastRegistered)) + { + native.Launch(launch); + } + } + catch (Exception ex) when (ex is Win32Exception or InvalidOperationException or PlatformNotSupportedException + or DllNotFoundException or EntryPointNotFoundException) + { + // No notifier on this machine: the title bar's count still says it. + } + } + + /// The window was brought forward: takes back an urgency hint this set. The flash stops by itself. + public void Clear() + { + if (_urgentWindow == IntPtr.Zero) + { + return; + } + + var xid = _urgentWindow; + _urgentWindow = IntPtr.Zero; + try + { + native.SetUrgency(xid, false); + } + catch (Exception ex) when (ex is DllNotFoundException or EntryPointNotFoundException) + { + // Nothing was set. + } + } + + /// Whether an urgency hint this set is still up (tests). + internal bool Urgent => _urgentWindow != IntPtr.Zero; + + /// The programs an alert starts on . + internal static IReadOnlyList Launches(DesktopPlatform platform, AttentionRequest request, bool toastRegistered) + { + var title = Bound(request.Title, 120); + var body = Bound(request.Body, MaxBody); + return platform switch + { + DesktopPlatform.Windows => toastRegistered ? [WindowsToast.Launch(WindowsAppId.Value, title, body)] : [], + DesktopPlatform.MacOS => + [ + new AlertLaunch("/usr/bin/osascript", + ["-e", "on run argv", "-e", "display notification (item 2 of argv) with title (item 1 of argv)", "-e", "end run", + title, body]), + ], + _ => [new AlertLaunch("notify-send", ["--app-name=SharpMUTerm", "--", title, body])], + }; + } + + private static IntPtr? IsWindow(IntPtr? handle, string? descriptor, string kind) => + handle is { } value && value != IntPtr.Zero && string.Equals(descriptor, kind, StringComparison.Ordinal) ? value : null; + + /// Control characters out (a notification is one or two lines), and at most characters. + internal static string Bound(string text, int max) + { + var clean = new StringBuilder(Math.Min(text.Length, max)); + foreach (var c in text) + { + if (clean.Length >= max) + { + break; + } + + clean.Append(char.IsControl(c) ? ' ' : c); + } + + if (clean.Length > 0 && char.IsHighSurrogate(clean[^1])) + { + clean.Length--; + } + + return clean.ToString(); + } +} + +/// +/// The AppUserModelID the window runs under on Windows. The process takes it at start +/// (SetCurrentProcessExplicitAppUserModelID), the installer's Start-menu shortcut carries it, and the installer +/// registers it under Software\Classes\AppUserModelId with a display name and an icon, which is what Windows needs +/// before a toast is shown under it. The program never registers it itself (the telnet-link rule). +/// +internal static class WindowsAppId +{ + /// The id. The installer (packaging/windows/sharpmuterm.iss) spells it too. + public const string Value = "SharpMUTerm.Window"; + + /// Takes for this process, so the taskbar groups the window with its shortcut. Windows only. + public static void Adopt() + { + if (!OperatingSystem.IsWindows()) + { + return; + } + + try + { + _ = SetCurrentProcessExplicitAppUserModelID(Value); + } + catch (Exception ex) when (ex is DllNotFoundException or EntryPointNotFoundException) + { + // Older than Windows 7: nothing to group by. + } + } + + [DllImport("shell32.dll", CharSet = CharSet.Unicode)] + private static extern int SetCurrentProcessExplicitAppUserModelID(string appId); +} + +/// +/// A Windows toast through WinRT's ToastNotificationManager, shown by Windows PowerShell 5.1 because .NET on the +/// plain net10.0 target reaches no WinRT itself (that needs a -windows TFM, which the Linux build and the +/// shared assemblies cannot take). The script is fixed; the title, body and id are base64 inside it, decoded by the +/// script and added as text nodes, so neither PowerShell nor the toast's XML ever parses server text. +/// +internal static class WindowsToast +{ + /// The powershell.exe launch that shows one toast. + public static AlertLaunch Launch(string appId, string title, string body) => + new("powershell.exe", + ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-WindowStyle", "Hidden", + "-EncodedCommand", Convert.ToBase64String(Encoding.Unicode.GetBytes(Script(appId, title, body)))]); + + /// The script encodes. + internal static string Script(string appId, string title, string body) => + string.Join('\n', + "$ErrorActionPreference = 'Stop'", + "[void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]", + "[void][Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]", + "function D($s) { [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($s)) }", + "$x = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02)", + "$n = $x.GetElementsByTagName('text')", + $"[void]$n.Item(0).AppendChild($x.CreateTextNode((D '{Base64(title)}')))", + $"[void]$n.Item(1).AppendChild($x.CreateTextNode((D '{Base64(body)}')))", + $"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier((D '{Base64(appId)}')).Show([Windows.UI.Notifications.ToastNotification]::new($x))"); + + private static string Base64(string text) => Convert.ToBase64String(Encoding.UTF8.GetBytes(text)); +} + +/// The real . +internal sealed class DesktopNative : IDesktopNative +{ + private bool? _toastRegistered; + + public bool ToastRegistered => _toastRegistered ??= ReadToastRegistered(); + + public void Launch(AlertLaunch launch) + { + var start = new ProcessStartInfo(launch.Program) + { + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = true, + }; + foreach (var argument in launch.Arguments) + { + start.ArgumentList.Add(argument); + } + + using var process = Process.Start(start); + } + + public void Flash(IntPtr hwnd) + { + if (OperatingSystem.IsWindows()) + { + WindowsFlash.Flash(hwnd); + } + } + + public bool SetUrgency(IntPtr xid, bool urgent) => + OperatingSystem.IsLinux() || OperatingSystem.IsFreeBSD() ? X11Urgency.Set(xid, urgent) : false; + + private static bool ReadToastRegistered() + { + if (!OperatingSystem.IsWindows()) + { + return false; + } + + try + { + const string key = @"Software\Classes\AppUserModelId\" + WindowsAppId.Value; + using var user = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(key); + using var machine = user is null ? Microsoft.Win32.Registry.LocalMachine.OpenSubKey(key) : null; + return user is not null || machine is not null; + } + catch (Exception ex) when (ex is System.Security.SecurityException or UnauthorizedAccessException or IOException) + { + return false; + } + } +} + +/// FlashWindowEx. +internal static class WindowsFlash +{ + public static void Flash(IntPtr hwnd) + { + var info = new FlashInfo + { + Size = (uint)Marshal.SizeOf(), + Window = hwnd, + Flags = FlashAll | FlashUntilForeground, + Count = 0, + Timeout = 0, + }; + FlashWindowEx(ref info); + } + + private const uint FlashAll = 3; + private const uint FlashUntilForeground = 12; + + [StructLayout(LayoutKind.Sequential)] + private struct FlashInfo + { + public uint Size; + public IntPtr Window; + public uint Flags; + public uint Count; + public uint Timeout; + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool FlashWindowEx(ref FlashInfo info); +} + +/// +/// The X11 urgency hint, set the two ways window managers read it: the ICCCM WM_HINTS UrgencyHint flag (which +/// the window manager may clear on focus) and the EWMH _NET_WM_STATE_DEMANDS_ATTENTION state, asked of the root +/// window with a client message as EWMH requires. Each call opens its own display connection (window ids are +/// server-wide, so Avalonia's own connection is not needed) and closes it after a flush. 64-bit only, which is every +/// platform the window ships for; anywhere else it says it did nothing. +/// +internal static class X11Urgency +{ + private const long UrgencyHint = 1L << 8; + private const long SubstructureNotifyMask = 1L << 19; + private const long SubstructureRedirectMask = 1L << 20; + private const int ClientMessage = 33; + private const long StateRemove = 0; + private const long StateAdd = 1; + private const long SourceApplication = 1; + + public static bool Set(IntPtr window, bool urgent) + { + if (!Environment.Is64BitProcess || window == IntPtr.Zero) + { + return false; + } + + var display = XOpenDisplay(IntPtr.Zero); + if (display == IntPtr.Zero) + { + return false; + } + + try + { + var hints = XGetWMHints(display, window); + var owned = hints == IntPtr.Zero; + if (owned) + { + hints = XAllocWMHints(); + } + + if (hints != IntPtr.Zero) + { + var flags = Marshal.ReadInt64(hints); + Marshal.WriteInt64(hints, urgent ? flags | UrgencyHint : flags & ~UrgencyHint); + XSetWMHints(display, window, hints); + XFree(hints); + } + + var message = new ClientMessageEvent + { + Type = ClientMessage, + SendEvent = 1, + Display = display, + Window = window, + MessageType = XInternAtom(display, "_NET_WM_STATE", false), + Format = 32, + Data0 = (IntPtr)(urgent ? StateAdd : StateRemove), + Data1 = XInternAtom(display, "_NET_WM_STATE_DEMANDS_ATTENTION", false), + Data2 = IntPtr.Zero, + Data3 = (IntPtr)SourceApplication, + }; + XSendEvent(display, XDefaultRootWindow(display), false, + (IntPtr)(SubstructureNotifyMask | SubstructureRedirectMask), ref message); + XFlush(display); + return true; + } + finally + { + XCloseDisplay(display); + } + } + + /// XClientMessageEvent, padded to the size of the XEvent union (24 longs) that XSendEvent reads. + [StructLayout(LayoutKind.Explicit, Size = 192)] + private struct ClientMessageEvent + { + [FieldOffset(0)] public int Type; + [FieldOffset(8)] public IntPtr Serial; + [FieldOffset(16)] public int SendEvent; + [FieldOffset(24)] public IntPtr Display; + [FieldOffset(32)] public IntPtr Window; + [FieldOffset(40)] public IntPtr MessageType; + [FieldOffset(48)] public int Format; + [FieldOffset(56)] public IntPtr Data0; + [FieldOffset(64)] public IntPtr Data1; + [FieldOffset(72)] public IntPtr Data2; + [FieldOffset(80)] public IntPtr Data3; + [FieldOffset(88)] public IntPtr Data4; + } + + private const string LibX11 = "libX11.so.6"; + + [DllImport(LibX11)] + private static extern IntPtr XOpenDisplay(IntPtr name); + + [DllImport(LibX11)] + private static extern int XCloseDisplay(IntPtr display); + + [DllImport(LibX11)] + private static extern IntPtr XDefaultRootWindow(IntPtr display); + + [DllImport(LibX11, CharSet = CharSet.Ansi, BestFitMapping = false)] + private static extern IntPtr XInternAtom(IntPtr display, string name, [MarshalAs(UnmanagedType.Bool)] bool onlyIfExists); + + [DllImport(LibX11)] + private static extern IntPtr XGetWMHints(IntPtr display, IntPtr window); + + [DllImport(LibX11)] + private static extern IntPtr XAllocWMHints(); + + [DllImport(LibX11)] + private static extern int XSetWMHints(IntPtr display, IntPtr window, IntPtr hints); + + [DllImport(LibX11)] + private static extern int XFree(IntPtr data); + + [DllImport(LibX11)] + private static extern int XSendEvent(IntPtr display, IntPtr window, [MarshalAs(UnmanagedType.Bool)] bool propagate, IntPtr mask, ref ClientMessageEvent message); + + [DllImport(LibX11)] + private static extern int XFlush(IntPtr display); +} diff --git a/src/SharpMUTerm.Avalonia/MainWindow.cs b/src/SharpMUTerm.Avalonia/MainWindow.cs index d3200500..5b194a6e 100644 --- a/src/SharpMUTerm.Avalonia/MainWindow.cs +++ b/src/SharpMUTerm.Avalonia/MainWindow.cs @@ -45,13 +45,20 @@ public MainWindow(WindowOptions options, IClassicDesktopStyleApplicationLifetime _driver.TitleBar.Changed += title => Dispatcher.UIThread.Post(() => Title = title); // Whether the window is in front decides whether an alert is shown at all, and the title's unread count. - Activated += (_, _) => _driver.Attention.SetFocused(true); + // Activation also takes back an X11 urgency hint the alert set (DesktopAlert). + var alert = DesktopAlert.ForThisMachine(); + Activated += (_, _) => + { + _driver.Attention.SetFocused(true); + alert.Clear(); + }; Deactivated += (_, _) => _driver.Attention.SetFocused(false); _driver.Attention.Requested += request => Dispatcher.UIThread.Post(() => { if (!IsActive) { - DesktopAlert.Show(request, TryGetPlatformHandle()?.Handle); + var handle = TryGetPlatformHandle(); + alert.Show(request, handle?.Handle, handle?.HandleDescriptor); } }); _driver.Settings.Owner = this; diff --git a/src/SharpMUTerm.Avalonia/Program.cs b/src/SharpMUTerm.Avalonia/Program.cs index 057231a3..e5be0f5a 100644 --- a/src/SharpMUTerm.Avalonia/Program.cs +++ b/src/SharpMUTerm.Avalonia/Program.cs @@ -35,6 +35,8 @@ private static int Main(string[] args) return 0; } + // The taskbar groups the window under the id its installed shortcut carries, and a toast is shown under it. + WindowsAppId.Adopt(); App.Options = options; return BuildAvaloniaApp().StartWithClassicDesktopLifetime(options.ClientArgs); } diff --git a/src/SharpMUTerm.Avalonia/WindowAttention.cs b/src/SharpMUTerm.Avalonia/WindowAttention.cs index b8c12a24..ae401d13 100644 --- a/src/SharpMUTerm.Avalonia/WindowAttention.cs +++ b/src/SharpMUTerm.Avalonia/WindowAttention.cs @@ -1,6 +1,3 @@ -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.InteropServices; using SharpMUTerm.Tui; namespace SharpMUTerm.Avalonia; @@ -42,94 +39,3 @@ public void SetFocused(bool focused) } } -/// -/// What the desktop does with an alert: a notification, and on Windows the taskbar button's flash. Every way out of -/// the process is a fixed program with the text as separate arguments (), -/// never a shell string, and a missing program is a quiet no-op: an alert is a courtesy, never an error. -/// -/// Linux: notify-send (libnotify, on every desktop that runs a notification daemon). macOS: osascript, -/// the title and body passed as argv to a fixed script. Windows: FlashWindowEx until the window is -/// brought forward — a toast needs an installed AppUserModelID this client does not register. Avalonia has no -/// urgency API of its own, so an X11 window manager's urgency hint is not set. -/// -/// -internal static class DesktopAlert -{ - /// Shows for the window behind (null where there is none). - public static void Show(AttentionRequest request, IntPtr? handle) - { - try - { - if (OperatingSystem.IsWindows()) - { - if (handle is { } hwnd && hwnd != IntPtr.Zero) - { - Flash(hwnd); - } - - return; - } - - if (OperatingSystem.IsMacOS()) - { - Run("osascript", - ["-e", "on run argv", "-e", "display notification (item 2 of argv) with title (item 1 of argv)", "-e", "end run", - request.Title, request.Body]); - return; - } - - Run("notify-send", ["--app-name=SharpMUTerm", "--", request.Title, request.Body]); - } - catch (Exception ex) when (ex is Win32Exception or InvalidOperationException or PlatformNotSupportedException) - { - // No notifier on this machine: the title bar's count still says it. - } - } - - private static void Run(string program, IReadOnlyList arguments) - { - var start = new ProcessStartInfo(program) - { - UseShellExecute = false, - RedirectStandardOutput = true, - RedirectStandardError = true, - CreateNoWindow = true, - }; - foreach (var argument in arguments) - { - start.ArgumentList.Add(argument); - } - - using var process = Process.Start(start); - } - - private static void Flash(IntPtr hwnd) - { - var info = new FlashInfo - { - Size = (uint)Marshal.SizeOf(), - Window = hwnd, - Flags = FlashAll | FlashUntilForeground, - Count = 0, - Timeout = 0, - }; - FlashWindowEx(ref info); - } - - private const uint FlashAll = 3; - private const uint FlashUntilForeground = 12; - - [StructLayout(LayoutKind.Sequential)] - private struct FlashInfo - { - public uint Size; - public IntPtr Window; - public uint Flags; - public uint Count; - public uint Timeout; - } - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool FlashWindowEx(ref FlashInfo info); -} diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index 06e1c619..6d773b2d 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -286,9 +286,9 @@ public static partial class BuiltInSettings (_, w, v) => w.CommandSeparator = WorldFieldValues.SeparatorOf(v), "split a typed line on this, and #3 cmd repeats one; off for a MUSH", "separator semicolon repeat speedwalk"), WorldChoice("alert-on", "alert on", WorldFieldValues.AlertChoices, WorldTextGroup, - (_, w) => w.AlertOnName ? WorldFieldValues.AlertChoices[1] : WorldFieldValues.AlertChoices[0], - (_, w, v) => w.AlertOnName = v == WorldFieldValues.AlertChoices[1], - "tell the desktop when a line names your character or pages you", "notify mention page tell"), + (_, w) => WorldFieldValues.AlertName(w), + (_, w, v) => WorldFieldValues.SetAlert(w, v), + "tell the desktop when you are paged, or your character is named too", "notify mention page tell"), WorldChoice("capture-channels", "capture channels", WorldFieldValues.ChannelCaptureChoices, WorldTextGroup, (_, w) => WorldFieldValues.ChannelCaptureName(w.CaptureChannels), (_, w, v) => w.CaptureChannels = WorldFieldValues.ChannelCaptureOf(v), diff --git a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs index 9b900897..2997abd6 100644 --- a/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs +++ b/src/SharpMUTerm.Client/Settings/WorldFieldValues.cs @@ -97,8 +97,22 @@ public static string JoinWrapsAdvice(int column, int paneWidth) => /// The words for . public static IReadOnlyList ReconnectChoices { get; } = ["off", "after a drop"]; - /// The words for . - public static IReadOnlyList AlertChoices { get; } = ["off", "name & pages"]; + /// + /// The words for and together: + /// nothing, pages only (a new world's default), or the character's name as well. + /// + public static IReadOnlyList AlertChoices { get; } = ["off", "pages", "name & pages"]; + + /// The alert on row's word for . + public static string AlertName(WorldDefinition world) => + world.AlertOnName ? AlertChoices[2] : world.AlertOnPage ? AlertChoices[1] : AlertChoices[0]; + + /// Sets both alert fields from one of . + public static void SetAlert(WorldDefinition world, string choice) + { + world.AlertOnName = choice == AlertChoices[2]; + world.AlertOnPage = choice == AlertChoices[1] || choice == AlertChoices[2]; + } /// /// The words for : off, or the separator itself. A closed list, so a diff --git a/src/SharpMUTerm.Core/Configuration/ConfigurationMigrator.cs b/src/SharpMUTerm.Core/Configuration/ConfigurationMigrator.cs index 10da3ecc..0f29dc4c 100644 --- a/src/SharpMUTerm.Core/Configuration/ConfigurationMigrator.cs +++ b/src/SharpMUTerm.Core/Configuration/ConfigurationMigrator.cs @@ -38,9 +38,32 @@ public static void Migrate(JsonObject root) MigrateV4ToV5(root); } + AdoptPageAlerts(root); root["version"] = AppConfiguration.CurrentVersion; } + /// + /// A world saved before existed keeps the alerts it had: the field is + /// written as false where it is missing, so only a world made from now on gets page alerts by default. Not a + /// schema step: it runs on every load and changes nothing in a file that has the field, because it adds a field + /// with the meaning the file already had rather than moving one. + /// + private static void AdoptPageAlerts(JsonObject root) + { + if (root["worlds"] is not JsonArray worlds) + { + return; + } + + foreach (var world in worlds.OfType()) + { + if (!world.ContainsKey("alertOnPage")) + { + world["alertOnPage"] = false; + } + } + } + /// /// v4's spawn window ids named only their target (spawn:Public), so a workspace held one /// capture pane per target however many characters were capturing into it. v5 puts the owning diff --git a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs index e443d32a..376cd601 100644 --- a/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs +++ b/src/SharpMUTerm.Core/Configuration/WorldDefinition.cs @@ -221,12 +221,31 @@ public sealed class WorldDefinition public string? CommandSeparator { get; set; } /// - /// Whether a line naming this world's character, or a page or a tell, asks for attention while the player is in - /// another window (F5 ▸ alert on; ). Off by default. A trigger can - /// ask for the same with its own alert flag on any world. + /// Whether a line naming this world's character asks for attention while the player is in another window, and a + /// page, tell or whisper with it (F5 ▸ alert on ▸ name & pages; + /// ). Off by default: a name is said in every scene the character is in, + /// so a name alert is noisy and the player opts in. A trigger can ask for attention with its own alert flag + /// on any world. /// public bool AlertOnName { get; set; } + /// + /// Whether a page, tell or whisper to the character asks for attention while the player is in another window + /// (F5 ▸ alert on ▸ pages). On for a world made now, off for one saved before the field existed: + /// a page is addressed to the player and rare, so it is the alert worth having unasked, but a world the player + /// already set up is not changed under them — writes false into a saved + /// world that lacks the field, with no schema step. covers pages as well, as it always did. + /// + public bool AlertOnPage { get; set; } = true; + + /// Whether may ask for attention on this world (a trigger's flag always may). + public bool Alerts(Automation.AttentionReason reason) => reason switch + { + Automation.AttentionReason.Name => AlertOnName, + Automation.AttentionReason.Page => AlertOnPage || AlertOnName, + _ => true, + }; + /// /// The world's accent colour, used to keep its windows traceable to their owner once they /// scatter across panes. Default resolves to a theme-derived accent. @@ -281,6 +300,7 @@ public sealed class WorldDefinition AutoReconnect = AutoReconnect, CommandSeparator = CommandSeparator, AlertOnName = AlertOnName, + AlertOnPage = AlertOnPage, GmcpLogin = GmcpLogin, DiscordPresence = DiscordPresence, CaptureChannels = CaptureChannels, diff --git a/src/SharpMUTerm.Core/Session/WorldSession.cs b/src/SharpMUTerm.Core/Session/WorldSession.cs index 228f51e5..26e58e3e 100644 --- a/src/SharpMUTerm.Core/Session/WorldSession.cs +++ b/src/SharpMUTerm.Core/Session/WorldSession.cs @@ -1088,9 +1088,12 @@ private void ProcessOutputLineNow(StyledLine line, bool isPrompt = false) // Asked for by a rule (shown or not: the rule said so), or by the world for a line that mentions the // character or pages them — only a line someone will see, and never a prompt. var shownSomewhere = result.RouteMain || !suppress || result.SpawnTargets.Count > 0; - var reason = result.Matched.Any(t => t.Actions.Alert) + AttentionReason? reason = result.Matched.Any(t => t.Actions.Alert) ? AttentionReason.Trigger - : World.AlertOnName && shownSomewhere && !isPrompt ? AttentionMatcher.Classify(shown.Text, Character?.Name) : null; + : (World.AlertOnName || World.AlertOnPage) && shownSomewhere && !isPrompt + && AttentionMatcher.Classify(shown.Text, Character?.Name) is { } matched && World.Alerts(matched) + ? matched + : null; if (reason is { } why) { AttentionRequested?.Invoke(this, new AttentionEventArgs(why, shown.Text)); diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index b187f2fe..0ddc4108 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -110,7 +110,7 @@ internal static class WorldsScreenRenderer /// , as one of . internal const int StackingField = 18; - /// , as one of . + /// and , as one of . internal const int AlertOnField = 19; /// , as one of . @@ -1093,8 +1093,8 @@ world.CommandSeparator is { } separator selectedWorld, StackingField)), WorldField("alert on", Field( - world.AlertOnName - ? $"[{Value}]{AlertChoices[1]}[/]" + world.AlertOnName || world.AlertOnPage + ? $"[{Value}]{WorldFieldValues.AlertName(world)}[/]" : $"[{Label}]{AlertChoices[0]} · alert triggers only[/]", cursor, selectedWorld, diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopAlertTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopAlertTests.cs new file mode 100644 index 00000000..045d83a1 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopAlertTests.cs @@ -0,0 +1,143 @@ +using System.Text; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// What an alert does on each desktop, read through a fake of everything that reaches the machine: which program +/// starts with which arguments, when the taskbar flashes, and when the X11 urgency hint goes up and comes down. The +/// real notifiers, the toast and the hint are not exercised here (see CLAUDE.md for what has been seen on a desktop). +/// +public class DesktopAlertTests +{ + private static readonly AttentionRequest Page = new("Corvid@Aetherfall", "Rivane pages: are you there?"); + + private sealed class FakeNative : IDesktopNative + { + public List Launched { get; } = []; + + public List Flashed { get; } = []; + + public List<(IntPtr Window, bool Urgent)> Urgency { get; } = []; + + public bool ToastRegistered { get; set; } + + public bool UrgencyWorks { get; set; } = true; + + public void Launch(AlertLaunch launch) => Launched.Add(launch); + + public void Flash(IntPtr hwnd) => Flashed.Add(hwnd); + + public bool SetUrgency(IntPtr xid, bool urgent) + { + Urgency.Add((xid, urgent)); + return UrgencyWorks; + } + } + + [Test] + public async Task OnX11TheWindowIsMarkedUrgentAndActivationTakesItBack() + { + var native = new FakeNative(); + var alert = new DesktopAlert(DesktopPlatform.Linux, native); + + alert.Show(Page, 0x2a00007, "XID"); + + await Assert.That(native.Urgency).IsEquivalentTo([((IntPtr)0x2a00007, true)]); + await Assert.That(alert.Urgent).IsTrue(); + await Assert.That(native.Launched.Single().Program).IsEqualTo("notify-send"); + await Assert.That(native.Launched.Single().Arguments) + .IsEquivalentTo(["--app-name=SharpMUTerm", "--", Page.Title, Page.Body]); + + alert.Clear(); + alert.Clear(); + await Assert.That(native.Urgency).IsEquivalentTo([((IntPtr)0x2a00007, true), ((IntPtr)0x2a00007, false)]); + await Assert.That(alert.Urgent).IsFalse(); + await Assert.That(native.Flashed).IsEmpty(); + } + + [Test] + public async Task AWindowThatIsNotAnX11WindowGetsNoHintAndNothingIsTakenBack() + { + var native = new FakeNative(); + var alert = new DesktopAlert(DesktopPlatform.Linux, native); + + alert.Show(Page, 0x10, "Wayland"); + alert.Show(Page, null, null); + alert.Clear(); + + await Assert.That(native.Urgency).IsEmpty(); + await Assert.That(native.Launched.Count).IsEqualTo(2); + } + + [Test] + public async Task AHintThatCouldNotBeSetIsNotTakenBack() + { + var native = new FakeNative { UrgencyWorks = false }; + var alert = new DesktopAlert(DesktopPlatform.Linux, native); + + alert.Show(Page, 0x2a00007, "XID"); + alert.Clear(); + + await Assert.That(native.Urgency.Count).IsEqualTo(1); + } + + [Test] + public async Task OnWindowsTheTaskbarFlashesAndAToastGoesOnlyWhereTheInstallerRegisteredTheId() + { + var portable = new FakeNative(); + new DesktopAlert(DesktopPlatform.Windows, portable).Show(Page, 0x1234, "HWND"); + await Assert.That(portable.Flashed).IsEquivalentTo([(IntPtr)0x1234]); + await Assert.That(portable.Launched).IsEmpty(); + + var installed = new FakeNative { ToastRegistered = true }; + new DesktopAlert(DesktopPlatform.Windows, installed).Show(Page, 0x1234, "HWND"); + await Assert.That(installed.Flashed.Count).IsEqualTo(1); + var toast = installed.Launched.Single(); + await Assert.That(toast.Program).IsEqualTo("powershell.exe"); + await Assert.That(toast.Arguments.Take(toast.Arguments.Count - 1)) + .IsEquivalentTo(["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-WindowStyle", "Hidden", "-EncodedCommand"]); + await Assert.That(installed.Urgency).IsEmpty(); + } + + [Test] + public async Task TheToastScriptCarriesTheTextOnlyAsBase64() + { + const string hostile = "'; Remove-Item C:\\ -Recurse; '&\"$(whoami)\""; + var launch = WindowsToast.Launch(WindowsAppId.Value, "Corvid", hostile); + var script = Encoding.Unicode.GetString(Convert.FromBase64String(launch.Arguments[^1])); + + await Assert.That(script).IsEqualTo(WindowsToast.Script(WindowsAppId.Value, "Corvid", hostile)); + await Assert.That(script).DoesNotContain("Remove-Item"); + await Assert.That(script).DoesNotContain("whoami"); + await Assert.That(script).Contains(Convert.ToBase64String(Encoding.UTF8.GetBytes(hostile))); + await Assert.That(script).Contains(Convert.ToBase64String(Encoding.UTF8.GetBytes("SharpMUTerm.Window"))); + await Assert.That(script).Contains("CreateToastNotifier"); + await Assert.That(script).Contains("CreateTextNode"); + } + + [Test] + public async Task OnMacOSTheTextIsArgvToAFixedScript() + { + var native = new FakeNative(); + new DesktopAlert(DesktopPlatform.MacOS, native).Show(Page, 0x55, "NSWindow"); + + var launch = native.Launched.Single(); + await Assert.That(launch.Program).IsEqualTo("/usr/bin/osascript"); + await Assert.That(launch.Arguments[^2]).IsEqualTo(Page.Title); + await Assert.That(launch.Arguments[^1]).IsEqualTo(Page.Body); + await Assert.That(native.Flashed).IsEmpty(); + await Assert.That(native.Urgency).IsEmpty(); + } + + [Test] + public async Task TheTextIsOneLineAndBounded() + { + var request = new AttentionRequest("A\u001b]0;x\u0007", new string('z', 1000) + "\nmore"); + var launch = DesktopAlert.Launches(DesktopPlatform.Linux, request, toastRegistered: false).Single(); + + await Assert.That(launch.Arguments[^2]).IsEqualTo("A ]0;x "); + await Assert.That(launch.Arguments[^1].Length).IsEqualTo(DesktopAlert.MaxBody); + await Assert.That(DesktopAlert.Bound("ab\U0001F600", 3)).IsEqualTo("ab"); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/AlertChoiceTests.cs b/tests/SharpMUTerm.Client.Tests/AlertChoiceTests.cs new file mode 100644 index 00000000..9751a964 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/AlertChoiceTests.cs @@ -0,0 +1,42 @@ +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Tests; + +/// F5's alert on row: one choice over the page and name fields, and a new world reads pages. +public class AlertChoiceTests +{ + [Test] + public async Task ANewWorldReadsPages() + { + await Assert.That(WorldFieldValues.AlertName(new WorldDefinition())).IsEqualTo("pages"); + } + + [Test] + [Arguments("off", false, false)] + [Arguments("pages", true, false)] + [Arguments("name & pages", true, true)] + public async Task EachChoiceSetsBothFieldsAndReadsBack(string choice, bool page, bool name) + { + var world = new WorldDefinition { AlertOnName = !name, AlertOnPage = !page }; + + WorldFieldValues.SetAlert(world, choice); + + await Assert.That(world.AlertOnPage).IsEqualTo(page); + await Assert.That(world.AlertOnName).IsEqualTo(name); + await Assert.That(WorldFieldValues.AlertName(world)).IsEqualTo(choice); + } + + [Test] + public async Task TheDeclaredFieldResetsToPages() + { + var config = new AppConfiguration(); + var world = new WorldDefinition { Name = "W", Host = "h", Port = 1, AlertOnPage = false }; + config.Worlds.Add(world); + var field = BuiltInSettings.World.Fields.Single(f => f.Id == "alert-on"); + + await Assert.That(WorldFieldValues.AlertName(world)).IsEqualTo("off"); + ((SettingBinding)field.Binding!).Reset(new SettingTarget(config, world)); + await Assert.That(WorldFieldValues.AlertName(world)).IsEqualTo("pages"); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Automation/AttentionTests.cs b/tests/SharpMUTerm.Core.Tests/Automation/AttentionTests.cs index a91b3f03..efabd547 100644 --- a/tests/SharpMUTerm.Core.Tests/Automation/AttentionTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Automation/AttentionTests.cs @@ -43,10 +43,11 @@ public async Task TheThrottleLetsOneAlertThroughPerInterval() await Assert.That(throttle.TryTake()).IsTrue(); } - private static async Task<(FakeTelnetSession Telnet, List Raised)> Open(bool alertOnName, Trigger? trigger = null) + private static async Task<(FakeTelnetSession Telnet, List Raised)> Open( + bool alertOnName, Trigger? trigger = null, bool alertOnPage = false) { var telnet = new FakeTelnetSession(); - var world = new WorldDefinition { Name = "Aetherfall", Host = "h", Port = 1, AlertOnName = alertOnName }; + var world = new WorldDefinition { Name = "Aetherfall", Host = "h", Port = 1, AlertOnName = alertOnName, AlertOnPage = alertOnPage }; var set = new TriggerSet { Name = "s" }; if (trigger is not null) { @@ -85,12 +86,62 @@ public async Task AWorldThatDoesNotOptInIsToldOnlyOfAnAlertTrigger() await Assert.That(raised.Select(e => e.Reason)).IsEquivalentTo([AttentionReason.Trigger]); } + [Test] + public async Task AWorldWithPageAlertsIsToldOfAPageAndNotOfAMention() + { + var (telnet, raised) = await Open(alertOnName: false, alertOnPage: true); + + telnet.EmitLine("Rivane nods to Corvid."); + telnet.EmitLine("Rivane tells you 'hi'"); + + await Assert.That(raised.Select(e => e.Reason)).IsEquivalentTo([AttentionReason.Page]); + } + + [Test] + public async Task ANewWorldAlertsOnPagesAndNotOnTheName() + { + var world = new WorldDefinition(); + + await Assert.That(world.AlertOnPage).IsTrue(); + await Assert.That(world.AlertOnName).IsFalse(); + await Assert.That(world.Alerts(AttentionReason.Page)).IsTrue(); + await Assert.That(world.Alerts(AttentionReason.Name)).IsFalse(); + await Assert.That(world.Alerts(AttentionReason.Trigger)).IsTrue(); + + // The name rule covers pages, as it did before pages had a field of their own. + world.AlertOnPage = false; + world.AlertOnName = true; + await Assert.That(world.Alerts(AttentionReason.Page)).IsTrue(); + } + + [Test] + public async Task AWorldSavedBeforePageAlertsKeepsWhatItHad() + { + const string json = """ + { "version": 5, "worlds": [ + { "name": "Old", "host": "h", "port": 1 }, + { "name": "Named", "host": "h", "port": 2, "alertOnName": true }, + { "name": "New", "host": "h", "port": 3, "alertOnPage": true } ] } + """; + + var config = ConfigurationStore.Deserialize(json); + + await Assert.That(config.Worlds.Select(w => w.AlertOnPage)).IsEquivalentTo([false, false, true]); + await Assert.That(config.Worlds[1].Alerts(AttentionReason.Page)).IsTrue(); + + // A world made now and saved comes back with page alerts on. + var saved = new AppConfiguration(); + saved.Worlds.Add(new WorldDefinition { Name = "Fresh", Host = "h", Port = 4 }); + var reloaded = ConfigurationStore.Deserialize(ConfigurationStore.Serialize(saved)); + await Assert.That(reloaded.Worlds[0].AlertOnPage).IsTrue(); + } + [Test] public async Task TheAlertFlagIsCopiedWithTheRule() { var trigger = new Trigger { Name = "t", Pattern = "x", Actions = { Alert = true } }; await Assert.That(trigger.Clone().Actions.Alert).IsTrue(); - await Assert.That(new WorldDefinition { AutoReconnect = true, CommandSeparator = ";", AlertOnName = true }.Clone() is - { AutoReconnect: true, CommandSeparator: ";", AlertOnName: true }).IsTrue(); + await Assert.That(new WorldDefinition { AutoReconnect = true, CommandSeparator = ";", AlertOnName = true, AlertOnPage = false }.Clone() is + { AutoReconnect: true, CommandSeparator: ";", AlertOnName: true, AlertOnPage: false }).IsTrue(); } } From cbec8a4d06b10c6662e392fab9313ede332a5ccf Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 14:39:04 +0000 Subject: [PATCH 053/113] Fit wave 16: pinned import keys, laddered key rows, named map rooms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ListOverlay can pin footer rows outside a scrolling body; the import review keeps its passwords question and Enter/Esc on screen at 80x24 and scrolls the rest (arrows, PgUp/PgDn, Home/End). - KeyLadder fits a cell key row to one line (full labels, parentheticals cut, short labels, then lowest-priority keys dropped; the way out never). Used by F1, the script console, the map's edit row, the import review and F10's header. F1's header no longer repeats ⌥W. - Script console: the store says "⇥ to pick" / "Del deletes" instead of "read only"; Del is named only on the store list. - Map edit keys are one laddered row under the map ("PgUp PgDnlevel" gone); ? opens /help ▸ Maps, which lists every key; ⌃P ▸ Edit map says so. - The cell map names rooms on the grid when the level fits (or on grids >= 100 wide); the exits list is always under the grid. - FooterFitTests renders every cell modal/footer view at 80x24 and fails unless its key row's first and last hints share one painted row. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 13 +- CLAUDE.md | 16 ++ .../Commands/BuiltInCommands.cs | 2 +- src/SharpMUTerm.Client/Help/HelpTopics.cs | 25 +++ src/SharpMUTerm.Client/Panels/MapEditing.cs | 1 + src/SharpMUTerm.Tui/ComposeOverlay.cs | 33 ++- src/SharpMUTerm.Tui/ImportReview.cs | 34 ++- src/SharpMUTerm.Tui/KeyLadder.cs | 121 ++++++++++ src/SharpMUTerm.Tui/ListOverlay.cs | 99 ++++++++- src/SharpMUTerm.Tui/MapRenderer.cs | 210 +++++++++++------- src/SharpMUTerm.Tui/PackageScreen.cs | 13 +- src/SharpMUTerm.Tui/ScriptConsoleSurface.cs | 31 ++- src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs | 4 +- src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs | 9 + .../ComposeSpellingTests.cs | 5 +- tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs | 108 +++++++++ .../SharpMUTerm.Tui.Tests/MapEditModeTests.cs | 2 +- 17 files changed, 617 insertions(+), 109 deletions(-) create mode 100644 src/SharpMUTerm.Tui/KeyLadder.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index a56b3d8f..b9731ee9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -320,9 +320,15 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- At 80 columns the terminal's key rows fit on one line: the F1 composer, the script console, the map's edit keys, + the import review and F10 shorten their words and then leave out the least-used keys, never the one that closes. + The map's edit keys are now one row under the map instead of a block beside it; `?` lists them all (also under + `/help` ▸ Maps). +- The terminal map writes room names beside the rooms when the pane is wide enough, and always lists where your + room's exits lead in the same place, under the map. - Light theme: background tabs and one-row panels (vitals, quick bar) sit on a lighter grey, and small text on the settings screens is darker, so it is as easy to read as body text. -- Desktop window: the composer's "no dictionary" chip is a button that offers to get one; in the terminal F1 names +- Desktop window: the composer's "no dictionary" chip is a button that offers to get one; in the terminal F1's key row names Alt+W beside it. The world settings show the same "join wraps" recommendation the terminal's F5 does. - A character is named one way everywhere: the command line's prompt, the window title and tab titles now read @@ -377,6 +383,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- The import review at 80×24 no longer scrolls its Enter and Esc keys and the passwords question out of sight: they + stay at the bottom while the rest scrolls (arrow keys, PgUp/PgDn, Home/End). +- The script console's store no longer says "read only" while Del deletes a key; the console names Del only on the + store list, where it works. +- The map's edit keys at 160 columns no longer read "PgUp PgDnlevel". - F5: editing a world field low on the screen (channels, names) now scrolls the field into view instead of leaving the cursor off screen. - F5 ▸ channels `move`: a channel message whose echo arrives just before its GMCP in the same read is no longer left diff --git a/CLAUDE.md b/CLAUDE.md index 6be78060..8cdb08f6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -130,6 +130,12 @@ fallbacks) for inline images/maps. `CommandSent` carries player commands only — never the login line or on-connect commands. - Maps are written on disconnect, session removal and exit, not per room (`IsDirty`). MXP room tags wait for `` (Phase 5a). + - **The cell map names rooms on the grid when the level fits** (`MapRenderer.Labelling`): the column step becomes + name + 6 (`[ ] name──[ ]`), the longest name up to 16 at which the whole level fits, the block centred rather than the + room; else 8 on a grid ≥100 wide; else the plain `[ ]` grid (every test map is narrower than `LabelFromWidth`). The + exits list is always under the grid, above the legend; the side column is edit mode's inspector only. Edit mode's + keys are one laddered row at the foot (`KeysLine`, `KeyDrop`); `?` (in `MapEditing.Keys`) opens `/help` ▸ Maps + (`HelpTopics.MapTopic`), which lists every key. - **The map window is a window, not a pane control** (`map:`, `WindowKind.Auxiliary`, owned by the session; `MapRenderer`, Tui). It is drawn from the recorder on `Changed` and whenever its pane's box changes (`SyncMapSizes` on `PostBufferPaint`), never fed from a line buffer, so its control lives in @@ -232,6 +238,10 @@ fallbacks) for inline images/maps. `MarkupControl.MeasureDOM` at the modal's inner width), not as its line count: F10's header wraps at 80 columns, and counting lines made the modal a row short, so it scrolled its close key out of sight at 80×24. F10 always emits its two confirm rows (blank when idle), so the modal sized once at open still fits a confirmation. + - **A consent screen's keys are pinned, not scrolled** (`ListOverlay.Open(footer:, scrollKeys:)`): the body goes in a + `ScrollablePanelControl` and the footer rows are a sticky-bottom control, so a body taller than 80×24 scrolls under + them (↑↓ PgUp PgDn Home End, answered before the caller's key handler). The import review uses it (`ImportReview.Footer`: + passwords question + keys); `Lines` is body then footer. - **The index** (`PackageIndex`; ⌃P ▸ *Browse packages*, `b` on F10) is `{"packages":[…]}`, each entry a manifest plus an https `url` and a `sha256`, at `AppConfiguration.PackageIndexUrl`. **It is fetched only when the player opens it, never at start.** An entry that breaks a rule is dropped and counted, not @@ -630,6 +640,12 @@ fallbacks) for inline images/maps. reflection). The editor scrolls to keep the caret on a row the viewport does not have yet and never scrolls back when the viewport grows, so a newline in a one-row bar drew the new row and a blank. The three-row floor had hidden it; `NewlineKeyTests` caught it. +- **A cell key row never wraps; it ladders** (`KeyLadder`, `LadderKey`, Tui). Rungs: full labels, parentheticals cut, + `Short` labels, then keys dropped lowest `Drop` first (reading order is not drop order); `LadderKey.Keep` (the way + out, the accept) is never dropped. F1 (`ComposeOverlay.FooterKeys`; the header no longer repeats the `⌥W` chip), the + script console (per state: Del is named only on the store list), the map's edit row, the import review and F10's + header use it. `FooterFitTests` renders every cell modal/footer view at 80×24 and fails unless its first and last + hints share one painted row — add a view there when it gains a key row. - **The status row names the keys of the mode you are in** (`ModeHints`/`StatusMode`, Client; `SharpMUTermApp.ModeHints.cs`). Composer armed > search bar in the focused window > frozen > split > scrolled back; while one holds, its hints replace `FocusHints` (`End returns · ⌥F freezes`, `⌥F thaws`, `⌥G next hit · ⌃F searches diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 3bb728d1..a7036c3e 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -167,7 +167,7 @@ void Family(string id, string prefix, Func c.State.MapUndo is not null); // Looking at another level or area of the map, and back; offered only where the map has one to look at. diff --git a/src/SharpMUTerm.Client/Help/HelpTopics.cs b/src/SharpMUTerm.Client/Help/HelpTopics.cs index 9a3549be..359830f1 100644 --- a/src/SharpMUTerm.Client/Help/HelpTopics.cs +++ b/src/SharpMUTerm.Client/Help/HelpTopics.cs @@ -1,4 +1,5 @@ using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Panels; namespace SharpMUTerm.Client.Help; @@ -92,5 +93,29 @@ public static IReadOnlyList For(string newline) => "F4 puts your own commands on keys and says which keys this terminal cannot deliver.", "Every key below is also an entry on ⌃P.", ]), + new(MapTopic, "Maps", "walk from the map, find a room, edit rooms", [ + "The map draws the area you are in around you, rooms named where the pane is wide enough. Click a", + "room to walk there; ⌃P ▸ Find room… looks rooms up by name or area. Exits and where they lead", + "are listed under the grid.", + "", + "⌃P ▸ Edit map gives the terminal's map the keys (the window has an inspector beside the map).", + "Its footer names the keys it has room for; these are all of them:", + .. MapKeyRows(), + "", + "/map rename, /map note and the rest do the same from the command line.", + ]), ]; + + /// The help page that lists every map-edit key, which the map's ? opens. + public const string MapTopic = "map"; + + /// , three to a row. + private static IEnumerable MapKeyRows() + { + var keys = MapEditing.Keys; + for (var i = 0; i < keys.Count; i += 3) + { + yield return " " + string.Concat(keys.Skip(i).Take(3).Select(k => (k.Key.PadRight(10) + k.Word).PadRight(26))).TrimEnd(); + } + } } diff --git a/src/SharpMUTerm.Client/Panels/MapEditing.cs b/src/SharpMUTerm.Client/Panels/MapEditing.cs index 0b0a7921..92beedba 100644 --- a/src/SharpMUTerm.Client/Panels/MapEditing.cs +++ b/src/SharpMUTerm.Client/Panels/MapEditing.cs @@ -113,6 +113,7 @@ public static class MapEditing ("R", "reset to server"), ("u", "undo"), ("⏎", "walk"), + ("?", "all keys"), ("Esc", "done"), ]; diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index b38006a2..959dd2f8 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -55,6 +55,7 @@ internal sealed class ComposeOverlay private SpellChecker? _spelling; private bool _spellingOpened; private MarkupControl? _headerBand; + private MarkupControl? _footerBand; private MarkupControl? _previewBand; /// The window system the composer opens in. @@ -293,7 +294,9 @@ private void RefreshBands() } var model = Model; - _headerBand?.SetContent(new List { _scheme.Paint(Render(model, Width).Header, ScreenPalette.HeaderBg) }); + var (header, footer) = Render(model, Width); + _headerBand?.SetContent(new List { _scheme.Paint(header, ScreenPalette.HeaderBg) }); + _footerBand?.SetContent(new List { _scheme.Paint(footer, ScreenPalette.FooterBg) }); _previewBand?.SetContent(_scheme.Lines(PreviewLines(model, Width), ScreenPalette.FooterBg)); } @@ -544,7 +547,8 @@ internal static IReadOnlyList WrapExact(string text, int width) private MarkupControl FooterBand() { - var band = ScreenChrome.Band(Render(Model).Footer, ScreenPalette.FooterBg, _scheme); + var band = ScreenChrome.Band(Render(Model, Width).Footer, ScreenPalette.FooterBg, _scheme); + _footerBand = band; band.StickyPosition = StickyPosition.Bottom; return band; } @@ -567,6 +571,7 @@ internal static (string Header, string Footer) Render(ComposerModel model, int w ? $"[{ScreenPalette.Warn}]no connection[/]" : $"[{ScreenPalette.Value}]{Escape(model.Target)}[/]"; + var footerKeys = KeyLadder.Choose(FooterKeys(model), width); string header; if (model.Edit is { } edit) { @@ -579,12 +584,11 @@ internal static (string Header, string Footer) Render(ComposerModel model, int w ? $"[{ScreenPalette.Accent}]literal[/]" : $"[{ScreenPalette.Value}]as typed[/]"; + // The key row names ⌥W (get a dictionary) and gives it up only after ⌥P and ⌥L, so the header does not name it + // again: a second chip for one key cost the header its room at 80 columns, where it was cut to "⌥W…". var spelling = model.Dictionary is { } name ? $"[{ScreenPalette.Value}]{Escape(name)}[/]" - : model.Place == ComposerPlace.FullScreen - // The state names its way out: ⌥W here is the offer to get one (the key row says so too). - ? $"[{ScreenPalette.Muted}]no dictionary[/][{ScreenPalette.Label}] · [/][{ScreenPalette.Accent}]⌥W[/][{ScreenPalette.Label}] gets one[/]" - : $"[{ScreenPalette.Muted}]no dictionary[/]"; + : $"[{ScreenPalette.Muted}]no dictionary[/]"; header = $"[{ScreenPalette.Accent}]COMPOSE[/][{ScreenPalette.Label}] to [/]{target}" + $"[{ScreenPalette.Label}] · text [/]{mode}" @@ -596,10 +600,24 @@ internal static (string Header, string Footer) Render(ComposerModel model, int w var footer = string.Join( $"[{ScreenPalette.Label}] · [/]", - model.Keys.Select(k => $"[{ScreenPalette.Accent}]{Escape(k.Key)}[/][{ScreenPalette.Label}] {Escape(k.Label)}[/]")); + footerKeys.Select(k => $"[{ScreenPalette.Accent}]{Escape(k.Key)}[/][{ScreenPalette.Label}] {Escape(k.Label)}[/]")); return (header, footer); } + /// + /// The key row as a ladder: parentheticals go first (close (keeps the draft)), then ⌥P, ⌥L and ⌥W in that order. + /// ⌃S and Esc are never given up — they are how a post leaves this screen. + /// + internal static IReadOnlyList FooterKeys(ComposerModel model) => + model.Keys.Select(k => new LadderKey(k.Key, k.Label, k.Short, k.Key switch + { + "⌥P" => 1, + "⌥L" => 2, + "⌥W" => 3, + "F1" => 4, + _ => LadderKey.Keep, + })).ToList(); + /// /// Sizes the editor to the window: every row the terminal has, less the two chrome bands. /// @@ -645,6 +663,7 @@ private void Reset() _editor = null; _edit = null; _headerBand = null; + _footerBand = null; _previewBand = null; } } diff --git a/src/SharpMUTerm.Tui/ImportReview.cs b/src/SharpMUTerm.Tui/ImportReview.cs index 3537394e..dae255d6 100644 --- a/src/SharpMUTerm.Tui/ImportReview.cs +++ b/src/SharpMUTerm.Tui/ImportReview.cs @@ -62,15 +62,34 @@ internal static List Render(ImportReviewModel model, int width) } } + return lines; + } + + /// + /// The rows pinned under the review, outside its scroll: the passwords question and the keys that answer the review. + /// Pinned because this is a consent screen — at 80×24 the body is taller than the screen, and a footer that scrolled + /// with it showed no way to accept or decline. A rule row first, so the pinned rows read as the review's foot. + /// + internal static List Footer(ImportReviewModel model, int width) + { + ArgumentNullException.ThrowIfNull(model); + width = Math.Max(30, width); + var lines = new List { $"[{ScreenPalette.Rule}]{new string('─', width - 1)}[/]" }; if (model.PasswordLine is { } passwords) { - lines.Add(string.Empty); var mark = model.StorePasswords ? $"[{ScreenPalette.Accent}]●[/] " : $"[{ScreenPalette.Label}]○[/] "; lines.AddRange(Indented(mark, passwords, width, Value, indent: 0)); } - lines.Add(string.Empty); - lines.Add(Keys(model.Empty ? "Esc close" : model.Keys)); + var keys = (model.Empty ? "Esc close" : model.Keys).Split(" · ").Select(part => + { + var space = part.IndexOf(' ', StringComparison.Ordinal); + return space < 0 ? new LadderKey(part, string.Empty) : new LadderKey(part[..space], part[(space + 1)..]); + }).ToList(); + + // The body scrolls under these rows, and the overlay answers the scroll keys before the review does. + keys.Insert(Math.Max(0, keys.Count - 1), new LadderKey("↑↓", "scroll", Drop: 1)); + lines.Add(KeyLadder.Fit(keys, width - 1, k => $"[{ScreenPalette.Accent}]{Escape(k)}[/]", Label, " ")); return lines; } @@ -96,13 +115,4 @@ private static IEnumerable Indented(string lead, string text, int width, : new string(' ', leadWidth) + style(wrapped[i]); } } - - private static string Keys(string keys) => - string.Join(" ", keys.Split(" · ").Select(part => - { - var space = part.IndexOf(' ', StringComparison.Ordinal); - return space < 0 - ? Label(part) - : $"[{ScreenPalette.Accent}]{Escape(part[..space])}[/] {Label(part[(space + 1)..])}"; - })); } diff --git a/src/SharpMUTerm.Tui/KeyLadder.cs b/src/SharpMUTerm.Tui/KeyLadder.cs new file mode 100644 index 00000000..00ab3f5b --- /dev/null +++ b/src/SharpMUTerm.Tui/KeyLadder.cs @@ -0,0 +1,121 @@ +namespace SharpMUTerm.Tui; + +/// +/// One key a footer names: the key, what it does, a shorter way to say it, and when it is given up. +/// +/// The key in glyphs (⌃S, Esc). +/// What it does, in full. +/// A shorter label for a narrow row, or null to use with any parenthetical cut. +/// +/// When this key leaves a row that cannot hold every key: lowest first. is never dropped — the key +/// that closes the surface, and the one that accepts it. +/// +internal readonly record struct LadderKey(string Key, string Label, string? Short = null, int Drop = LadderKey.Keep) +{ + /// A key a row never gives up. + public const int Keep = int.MaxValue; + + /// The label at a rung: 0 full, 1 any parenthetical cut, 2 the short label. + internal string LabelAt(int rung) => rung switch + { + 0 => Label, + 1 => KeyLadder.CutParenthetical(Label), + _ => Short ?? KeyLadder.CutParenthetical(Label), + }; +} + +/// +/// A footer's key row fitted to one row, never wrapped (the D1 lesson, and the reason a modal's way out cannot be +/// scrolled off it). Rungs, in order: every key in full; parentheticals cut (close (keeps the draft) becomes +/// close); short labels; then keys given up lowest first, in reading order otherwise +/// — the /FocusHints rule that reading order and drop order are separate. A key marked +/// is never dropped; if even those do not fit, the row is cut at the edge. +/// +internal static class KeyLadder +{ + /// The cells between two keys: · . + internal const int Gap = 3; + + /// + /// The row for in at most cells (0: no limit, every key in full). + /// and style the two halves of a key; is + /// the markup between keys (three visible cells). , when given, is appended once anything was + /// dropped — the key that lists the rest. + /// + internal static string Fit( + IReadOnlyList keys, + int width, + Func key, + Func label, + string separator, + LadderKey? more = null) => + Join(Choose(keys, width, more), key, label, separator); + + /// The keys and labels draws, for a caller that styles them itself or a test. + internal static IReadOnlyList<(string Key, string Label)> Choose(IReadOnlyList keys, int width, LadderKey? more = null) + { + ArgumentNullException.ThrowIfNull(keys); + if (width <= 0) + { + return keys.Select(k => (k.Key, k.Label)).ToList(); + } + + for (var rung = 0; rung <= 2; rung++) + { + var all = keys.Select(k => (k.Key, k.LabelAt(rung))).ToList(); + if (Length(all) <= width) + { + return all; + } + } + + // Give keys up, lowest Drop first; ties go from the end of the row, so the row keeps its first words longest. + var order = keys + .Select((k, i) => (k, i)) + .Where(p => p.k.Drop != LadderKey.Keep) + .OrderBy(p => p.k.Drop) + .ThenByDescending(p => p.i) + .Select(p => p.i) + .ToList(); + var dropped = new HashSet(); + foreach (var index in order) + { + dropped.Add(index); + var kept = keys.Where((_, i) => !dropped.Contains(i)).Select(k => (k.Key, k.LabelAt(2))).ToList(); + if (more is { } extra) + { + kept.Add((extra.Key, extra.LabelAt(2))); + } + + if (Length(kept) <= width) + { + return kept; + } + } + + var last = keys.Where((_, i) => !dropped.Contains(i)).Select(k => (k.Key, k.LabelAt(2))).ToList(); + if (more is { } tail) + { + last.Add((tail.Key, tail.LabelAt(2))); + } + + return last; + } + + /// The visible cells a row of takes. + internal static int Length(IReadOnlyList<(string Key, string Label)> keys) => + keys.Count == 0 ? 0 : keys.Sum(k => k.Key.Length + (k.Label.Length == 0 ? 0 : (k.Key.Length == 0 ? 0 : 1) + k.Label.Length)) + (Gap * (keys.Count - 1)); + + /// with a trailing (…) removed: close (keeps the draft) → close. + internal static string CutParenthetical(string text) + { + var open = text.IndexOf(" (", StringComparison.Ordinal); + return open > 0 && text.EndsWith(')') ? text[..open] : text; + } + + private static string Join(IReadOnlyList<(string Key, string Label)> keys, Func key, Func label, string separator) => + string.Join(separator, keys.Select(k => + k.Key.Length == 0 ? label(k.Label) + : k.Label.Length == 0 ? key(k.Key) + : key(k.Key) + label(" " + k.Label))); +} diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index 2f30858e..4285ee3f 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -17,7 +17,11 @@ internal sealed class ListOverlay private Window? _window; private MarkupControl? _content; + private MarkupControl? _footerControl; + private ScrollablePanelControl? _body; private Func>? _render; + private Func>? _footer; + private bool _scrollKeys; private Func? _key; private Func? _escape; private Action? _closed; @@ -39,7 +43,14 @@ public ListOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) public string? Mode { get; private set; } /// What the surface shows now, for a test to read. - internal IReadOnlyList Lines => _render?.Invoke(Width()) ?? []; + internal IReadOnlyList Lines => + _render is null ? [] : [.. _render(Width()), .. _footer?.Invoke(Width()) ?? []]; + + /// The pinned footer's lines alone (empty for a surface with none), for a test. + internal IReadOnlyList FooterLines => _footer?.Invoke(Width()) ?? []; + + /// The body's scroll offset in rows (0 for a surface with no pinned footer), for a test. + internal int BodyScroll => _body?.VerticalScrollOffset ?? 0; /// /// Opens a surface. draws it at a width; answers a key @@ -51,6 +62,12 @@ public ListOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) /// typed, a delete awaiting its answer) and stays open; with none, or false, Esc closes. /// /// Told once when this surface closes, however it does (not when a later one replaces it). + /// + /// Rows pinned to the modal's bottom edge, outside the scrolling body: a consent screen's keys and the question that + /// goes with them. A body taller than the screen scrolls under them, so the way to accept or decline is never + /// scrolled away (the import review at 80×24 lost both). Each row is one line, never wrapped: fit it to the width. + /// + /// Whether ↑↓ PgUp PgDn Home End scroll the body before the key handler sees them. public void Open( string mode, string title, @@ -58,7 +75,9 @@ public void Open( Func key, int? width = null, Func? escape = null, - Action? closed = null) + Action? closed = null, + Func>? footer = null, + bool scrollKeys = false) { if (_window is not null) { @@ -69,12 +88,36 @@ public void Open( _key = key; _escape = escape; _closed = closed; + _footer = footer; + _scrollKeys = scrollKeys && footer is not null; var desktop = _system.DesktopDimensions; var widest = Math.Clamp(desktop.Width - 8, 44, 110); var outer = width is { } asked ? Math.Clamp(asked + 4, 24, widest) : widest; var lines = render(outer - 4); - var height = Math.Clamp(Rows(lines, outer - 3) + 2, 8, Math.Max(8, desktop.Height - 2)); + var footerLines = footer?.Invoke(outer - 4) ?? []; + var height = Math.Clamp(Rows(lines, outer - 3) + footerLines.Count + 2, 8, Math.Max(8, desktop.Height - 2)); _content = new MarkupControl(_scheme.Lines(lines, ScreenPalette.MenuBg)); + IWindowControl body = _content; + if (footer is not null) + { + _content.HorizontalAlignment = HorizontalAlignment.Stretch; + _body = new ScrollablePanelControl + { + HorizontalAlignment = HorizontalAlignment.Stretch, + VerticalAlignment = VerticalAlignment.Fill, + VerticalScrollMode = ScrollMode.Scroll, + HorizontalScrollMode = ScrollMode.None, + ShowScrollbar = true, + AutoScroll = false, + }; + _body.AddControl(_content); + body = _body; + _footerControl = new MarkupControl(_scheme.Lines(footerLines, ScreenPalette.MenuBg)) + { + HorizontalAlignment = HorizontalAlignment.Stretch, + StickyPosition = StickyPosition.Bottom, + }; + } // Centered() after WithSize(), for CommandPalette's reason. Window? built = null; @@ -87,7 +130,7 @@ public void Open( .Resizable(false) .WithSize(outer, height) .Centered() - .AddControl(_content) + .AddControl(body) .OnClosed((_, _) => { // A window closed because the next surface replaced it must not clear the next one's state. @@ -101,6 +144,10 @@ public void Open( .Build(); _window = built; _scheme.Frame(_window); + if (_footerControl is not null) + { + _window.AddControl(_footerControl); + } _window.PreviewKeyPressed += OnKey; _system.AddWindow(_window); @@ -132,6 +179,11 @@ public void Repaint() if (_render is not null && _content is not null) { _content.SetContent(_scheme.Lines(_render(Width()), ScreenPalette.MenuBg)); + if (_footer is not null) + { + _footerControl?.SetContent(_scheme.Lines(_footer(Width()), ScreenPalette.MenuBg)); + } + _window?.Invalidate(redrawAll: true); } } @@ -170,6 +222,25 @@ private void OnKey(object? sender, KeyPressedEventArgs e) return; } + if (_scrollKeys && _body is { } body && e.KeyInfo.Modifiers == 0 && ScrollBy(body, e.KeyInfo.Key) is { } rows) + { + if (rows == int.MinValue) + { + body.ScrollToTop(); + } + else if (rows == int.MaxValue) + { + body.ScrollToBottom(); + } + else + { + body.ScrollVerticalBy(rows); + } + + _window.Invalidate(redrawAll: true); + return; + } + if (e.KeyInfo.Key == ConsoleKey.Escape || !_key(e.KeyInfo)) { if (_window == window) @@ -183,10 +254,30 @@ private void OnKey(object? sender, KeyPressedEventArgs e) Repaint(); } + /// The rows a scroll key moves the body: a line, a page less one, or either end (, ). + private static int? ScrollBy(ScrollablePanelControl body, ConsoleKey key) + { + var page = Math.Max(1, body.ActualHeight - 1); + return key switch + { + ConsoleKey.UpArrow => -1, + ConsoleKey.DownArrow => 1, + ConsoleKey.PageUp => -page, + ConsoleKey.PageDown => page, + ConsoleKey.Home => int.MinValue, + ConsoleKey.End => int.MaxValue, + _ => null, + }; + } + private void Reset() { _window = null; _content = null; + _footerControl = null; + _body = null; + _footer = null; + _scrollKeys = false; _render = null; _key = null; _escape = null; diff --git a/src/SharpMUTerm.Tui/MapRenderer.cs b/src/SharpMUTerm.Tui/MapRenderer.cs index c1397dcc..fa9d7459 100644 --- a/src/SharpMUTerm.Tui/MapRenderer.cs +++ b/src/SharpMUTerm.Tui/MapRenderer.cs @@ -63,6 +63,7 @@ private enum Kind Blank, Line, Stub, + Label, Room, Current, Path, @@ -181,13 +182,15 @@ internal static List Render(MapViewModel view, WorldMap map, int width, return lines; } - // Names go beside the grid when the map is wide, else under it: in edit mode the room and the keys that edit it, - // otherwise (in a tall pane) what each exit of your room leads to. Edit mode spends the legend's row on them. - var side = SideWidth(width); + // In edit mode the room being edited goes beside the grid when the map is wide, else under it, and the keys that + // edit it are one laddered row at the foot (edit mode spends the legend's row on them). Otherwise what each exit + // of your room leads to is always under the grid, above the legend — one place, whatever the pane's shape. + var side = view.Editing ? SideWidth(width) : 0; var gridWidth = side > 0 ? width - side - 2 : width; var legend = !view.Editing && height >= LegendMinHeight; var under = side > 0 ? [] : UnderLines(view, width, height, ink, keysHeld); - var rows = Math.Max(0, height - 1 - (legend ? 1 : 0) - under.Count); + var footer = side > 0 && height >= 4 ? KeysLine(width, ink, keysHeld) : null; + var rows = Math.Max(0, height - 1 - (legend ? 1 : 0) - under.Count - (footer is null ? 0 : 1)); var grid = new Cell[rows, gridWidth]; var ahead_ = ahead.ToHashSet(); var byId = view.Rooms.ToDictionary(r => r.Id); @@ -197,18 +200,21 @@ internal static List Render(MapViewModel view, WorldMap map, int width, // edited would then fall outside it, when that room is the centre instead. var originCol = gridWidth / 2 - 1; var originRow = rows / 2; + var level = map.Rooms.Values + .Where(r => r.Z == centre.Z && r.AreaId == centre.AreaId) + .ToList(); + var (label, cellWidth, labelledOrigin) = Labelling(level, centre, gridWidth, originCol); + originCol = labelledOrigin; if (view.Selected is { } picked && map.Room(picked.Id) is { } chosen - && (Math.Abs(chosen.X - centre.X) * CellWidth > originCol - 1 || Math.Abs(chosen.Y - centre.Y) * CellHeight > originRow)) + && (originCol + ((chosen.X - centre.X) * cellWidth) is var pickedCol && (pickedCol < 1 || pickedCol + 3 > gridWidth) + || Math.Abs(chosen.Y - centre.Y) * CellHeight > originRow)) { centre = chosen; + originCol = gridWidth / 2 - 1; } (int Col, int Row) At(MapRoom room) => - (originCol + (room.X - centre.X) * CellWidth, originRow + (room.Y - centre.Y) * CellHeight); - - var level = map.Rooms.Values - .Where(r => r.Z == centre.Z && r.AreaId == centre.AreaId) - .ToList(); + (originCol + (room.X - centre.X) * cellWidth, originRow + (room.Y - centre.Y) * CellHeight); void Put(int col, int row, char glyph, Kind kind, long? room = null, string? colour = null) { @@ -234,6 +240,7 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null, string? col foreach (var room in level) { var (col, row) = At(room); + var named = label > 0 ? Math.Min(NameOf(room).Length, label) : 0; foreach (var (_, key, to) in room.AllExits()) { // A way into another area is drawn in that area's colour, which is the view's. @@ -241,14 +248,14 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null, string? col && map.Areas.TryGetValue(areaId, out var area) ? AreaInk(view.ColourOf(area.Name), ink) : null; - Connect(col, row, key, Kind.Line, into); + Connect(col, row, key, Kind.Line, into, named); } foreach (var stub in room.Stubs) { if (MapDirections.Normalise(stub) is { } direction) { - Connect(col, row, direction, Kind.Stub, null); + Connect(col, row, direction, Kind.Stub, null, named); } } } @@ -267,13 +274,34 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null, string? col Put(col + 2, row, ']', kind, room.Id, colour); } - var column = side > 0 ? SideLines(view, side, rows + (legend ? 1 : 0), ink, keysHeld) : []; + if (label > 0) + { + // The name after the room, one cell clear of it and elided to the room the grid leaves; a link to the room, + // like the room itself. The room you are in is named in its own ink. + foreach (var room in level) + { + var (col, row) = At(room); + var name = NameOf(room); + name = name.Length <= label ? name : name[..(label - 1)].TrimEnd() + "…"; + var labelColour = room.Id == current ? ink.Current : null; + for (var i = 0; i < name.Length; i++) + { + Put(col + 4 + i, row, name[i], Kind.Label, room.Id, labelColour); + } + } + } + + var column = side > 0 ? SideLines(view, side, rows, ink) : []; for (var row = 0; row < rows; row++) { lines.Add(WithSide(Row(grid, row, gridWidth, ink), column, row, gridWidth)); } lines.AddRange(under); + if (footer is not null) + { + lines.Add(footer); + } if (legend) { @@ -282,12 +310,27 @@ void Put(int col, int row, char glyph, Kind kind, long? room = null, string? col return lines; - void Connect(int col, int row, string direction, Kind kind, string? colour) + // A room's name as the grid draws it: the view's, else the map's, else its number. + string NameOf(MapRoom room) => + byId.GetValueOrDefault(room.Id)?.Name is { Length: > 0 } seen ? seen + : room.Name.Length > 0 ? room.Name + : "#" + room.Id.ToString(CultureInfo.InvariantCulture); + + void Connect(int col, int row, string direction, Kind kind, string? colour, int named = 0) { switch (direction) { case "east": - Put(col + 3, row, '─', kind, colour: colour); + // With names on the grid the way east starts one cell past the name and runs to the next room. + for (var c = named > 0 ? col + 5 + named : col + 3; c <= col + cellWidth - 1; c++) + { + Put(c, row, '─', kind, colour: colour); + if (label == 0) + { + break; + } + } + break; case "west": Put(col - 1, row, '─', kind, colour: colour); @@ -314,6 +357,41 @@ void Connect(int col, int row, string direction, Kind kind, string? colour) } } + /// The narrowest grid that names its rooms. + internal const int LabelFromWidth = 48; + + /// The longest and shortest room name drawn on the grid. + internal const int LabelMax = 16, LabelMin = 6; + + /// + /// How long a room's name on the grid may be, the grid's column step ([ ] name──, so a step is the name plus + /// six), and the column the centre room is drawn at. The longest name (up to ) at which the + /// whole level fits the grid, which is then centred as a block rather than on the centre room, so the names have + /// the width there is; failing that, on a grid of 100 columns or more, eight, centred on the room as before (rooms + /// past the edge are cut, as they always were); otherwise none, and the step is the plain . + /// + internal static (int Label, int CellWidth, int OriginCol) Labelling(IReadOnlyList level, MapRoom centre, int gridWidth, int originCol) + { + if (gridWidth < LabelFromWidth || level.Count == 0) + { + return (0, CellWidth, originCol); + } + + var west = Math.Max(0, centre.X - level.Min(r => r.X)); + var east = Math.Max(0, level.Max(r => r.X) - centre.X); + for (var label = LabelMax; label >= LabelMin; label--) + { + var step = label + 6; + var span = ((west + east) * step) + 4 + label; + if (span <= gridWidth) + { + return (label, step, ((gridWidth - span) / 2) + (west * step)); + } + } + + return gridWidth >= 100 ? (8, 14, originCol) : (0, CellWidth, originCol); + } + /// /// An area colour from the view, held to the floor on the pane. The palette clears it on every built-in theme, /// so this returns the view's hex unchanged there; a custom theme may move it. @@ -469,34 +547,13 @@ private static string WithSide(string row, IReadOnlyList column, int ind /// The side column, beside a wide grid: the room being edited and the keys that edit it, or else where you are and /// what each exit leads to. Every line is cut to and there are at most . /// - private static List SideLines(MapViewModel view, int width, int rows, Ink ink, bool keysHeld) + private static List SideLines(MapViewModel view, int width, int rows, Ink ink) { var lines = new List(); if (view.Selected is { } room) { lines.AddRange(DetailLines(view, width, ink)); - foreach (var exit in room.Exits.Take(Math.Max(0, rows - lines.Count - MapEditing.Keys.Count - 1))) - { - lines.Add(ExitLine(exit, width)); - } - - lines.Add(string.Empty); - if (!keysHeld) - { - lines.AddRange(KeysLines(width, ink, keysHeld, 3)); - } - else - { - foreach (var (key, word) in MapEditing.Keys.Take(Math.Max(0, rows - lines.Count))) - { - lines.Add(Fit($"[bold {ink.Current}]{MarkupText.Escape(key.PadRight(6))}[/][dim]{word}[/]", width)); - } - } - } - else if (view.Current is { } here) - { - lines.Add(Fit($"[bold {ink.Current}]@[/] [bold]{MarkupText.Escape(Elide(here.Name, width - 2))}[/]", width)); - foreach (var exit in view.Nearby.Take(Math.Max(0, rows - 1))) + foreach (var exit in room.Exits.Take(Math.Max(0, rows - lines.Count))) { lines.Add(ExitLine(exit, width)); } @@ -514,8 +571,8 @@ private static List UnderLines(MapViewModel view, int width, int height, if (view.Editing) { return height >= UnderFromHeight - ? [string.Empty, .. DetailLines(view, width, ink), .. KeysLines(width, ink, keysHeld, 5)] - : height >= 4 ? [RoomLine(view, width, ink), .. KeysLines(width, ink, keysHeld, 1)] : []; + ? [string.Empty, .. DetailLines(view, width, ink), KeysLine(width, ink, keysHeld)] + : height >= 4 ? [RoomLine(view, width, ink), KeysLine(width, ink, keysHeld)] : []; } if (height < UnderFromHeight || view.Nearby.Count == 0 || view.Viewing) @@ -616,50 +673,50 @@ private static string RoomLine(MapViewModel view, int width, Ink ink) } /// - /// Edit mode's keys over at most lines, in ' order, with - /// Esc done always the last; while a /map command waits on the command line, how to finish it instead. + /// Edit mode's keys as one row (): in ' order, the least used given + /// up first (), ? all keys and Esc done never — ? opens the help page that + /// lists every one. One row and not a block: at 80×24 the block took half the pane and still cut keys. While a + /// /map command waits on the command line, how to finish it instead. /// - internal static List KeysLines(int width, Ink ink, bool keysHeld, int max) + internal static string KeysLine(int width, Ink ink, bool keysHeld) { if (!keysHeld) { - return [Fit("[dim]finish the /map command on the command line · ⏎ applies it · ⌃P ▸ Edit map takes the keys back[/]", width)]; + return Fit("[dim]finish the /map command on the command line · ⏎ applies it · ⌃P ▸ Edit map takes the keys back[/]", width); } - string Item((string Key, string Word) k) => $"[bold {ink.Current}]{MarkupText.Escape(k.Key)}[/] [dim]{k.Word}[/]"; - static int Cost((string Key, string Word) k) => k.Key.Length + 1 + k.Word.Length; - var last = MapEditing.Keys[^1]; - var lines = new List> { new() }; - var used = 0; - foreach (var key in MapEditing.Keys.Take(MapEditing.Keys.Count - 1)) - { - var cost = (lines[^1].Count == 0 ? 0 : 3) + Cost(key); - var reserve = lines.Count == max ? 3 + Cost(last) : 0; - if (used + cost + reserve > width) - { - if (lines.Count == max) - { - break; - } - - lines.Add(new()); - used = 0; - cost = Cost(key); - } - - lines[^1].Add(key); - used += cost; - } - - if (used + 3 + Cost(last) > width && lines.Count < max) - { - lines.Add(new()); - } - - lines[^1].Add(last); - return lines.Select(l => Fit(string.Join(" [dim]·[/] ", l.Select(Item)), width)).ToList(); + var keys = MapEditing.Keys.Select(k => new LadderKey(k.Key, k.Word, Drop: KeyDrop(k.Key))).ToList(); + return KeyLadder.Fit( + keys, + width, + k => $"[bold {ink.Current}]{MarkupText.Escape(k)}[/]", + w => $"[dim]{MarkupText.Escape(w)}[/]", + " [dim]·[/] "); } + /// Which edit key a short footer gives up first: lowest first; the ones a newcomer reaches for last. + internal static int KeyDrop(string key) => key switch + { + "?" or "Esc" => LadderKey.Keep, + "←↑→↓" => 17, + "⏎" => 16, + "r" => 15, + "u" => 14, + "⇧←↑→↓" => 13, + "Del" => 12, + "x" => 11, + "n" => 10, + "l" => 9, + "PgUp PgDn" => 8, + "v" => 7, + "h" => 6, + "a" => 5, + "w" => 4, + "-" => 3, + "s" => 2, + _ => 1, + }; + private static string Elide(string text, int width) => width <= 0 ? string.Empty : text.Length <= width ? text : text[..Math.Max(0, width - 1)] + "…"; @@ -704,6 +761,7 @@ private static string Row(Cell[,] grid, int row, int width, Ink ink) Kind.Blank => escaped, Kind.Line or Kind.Room => cell.Colour is { } colour ? $"[{colour}]{escaped}[/]" : escaped, Kind.Stub => $"[dim]{escaped}[/]", + Kind.Label => cell.Colour is { } named ? $"[{named}]{escaped}[/]" : escaped, Kind.Current => $"[bold {ink.Current}]{escaped}[/]", Kind.Path => $"[{ink.Path}]{escaped}[/]", Kind.Locked => $"[{ink.Locked}]{escaped}[/]", diff --git a/src/SharpMUTerm.Tui/PackageScreen.cs b/src/SharpMUTerm.Tui/PackageScreen.cs index ce6ee8b8..c3f9b293 100644 --- a/src/SharpMUTerm.Tui/PackageScreen.cs +++ b/src/SharpMUTerm.Tui/PackageScreen.cs @@ -79,10 +79,19 @@ internal static List List( int width, List? drawn = null) { - var keys = string.Join(" · ", declaration.Actions.Select(a => $"{a.Key} {a.Label}")); + // One row, never wrapped: a ladder after the count (↑↓ goes first, then the copy and browse keys). + var count = $"{Count(packages.Count)} installed · "; + var ladder = new List { new("↑↓", "select", Drop: 1) }; + ladder.AddRange(declaration.Actions.Select(a => new LadderKey( + a.Key, + a.Label, + a.Label.Contains(' ', StringComparison.Ordinal) ? a.Label[..a.Label.IndexOf(' ', StringComparison.Ordinal)] : null, + a.Key switch { "c" => 2, "b" => 3, _ => LadderKey.Keep }))); + ladder.Add(new("Esc", "close")); + var keys = KeyLadder.Fit(ladder, Math.Max(20, width - count.Length - 1), Escape, Escape, " · "); var lines = new List { - $"[{ScreenPalette.Label}]{Count(packages.Count)} installed · ↑↓ select · {Escape(keys)} · Esc close[/]", + $"[{ScreenPalette.Label}]{count}{keys}[/]", string.Empty, }; diff --git a/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs b/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs index cf755acc..56c0e30a 100644 --- a/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs +++ b/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs @@ -176,10 +176,37 @@ internal static List Render(ScriptConsoleModel model, string input, bool lines.Add(model.CanRun ? $"[bold {ScreenPalette.Accent}]lua ›[/] [{ScreenPalette.Value}]{Escape(Tail(input, width - 8))}{(onStore ? string.Empty : "▏")}[/]" : $"[{ScreenPalette.Label}]lua › no prompt here — {Escape(model.Unavailable ?? string.Empty)}[/]"); - lines.Add($"[{ScreenPalette.Label}]{Escape(Fit(ScriptConsoleModel.Keys, width))}[/]"); + lines.Add(KeyLadder.Fit( + FooterKeys(onStore), + width, + k => $"[{ScreenPalette.Accent}]{Escape(k)}[/]", + l => $"[{ScreenPalette.Label}]{Escape(l)}[/]", + $"[{ScreenPalette.Label}] · [/]")); return lines; } + /// + /// The key row for where the keys are: at the prompt, or on the store list (where ↑↓ pick and Del deletes). A ladder, + /// so Esc is never the word cut off at 80 columns; ⌃L goes first, then ⇥, history and ⏎. + /// + internal static IReadOnlyList FooterKeys(bool onStore) => onStore + ? + [ + new("↑↓", "pick a key", "pick", Drop: 2), + new("Del", "deletes it", "deletes"), + new("⇥", "back to the prompt", "prompt", Drop: 3), + new("⌃L", "reloads scripts", "reload", Drop: 1), + new("Esc", "closes"), + ] + : + [ + new("⏎", "runs", Drop: 4), + new("↑↓", "history", Drop: 2), + new("⇥", "store keys", "store", Drop: 3), + new("⌃L", "reloads scripts", "reload", Drop: 1), + new("Esc", "closes"), + ]; + private static List OutputRows(ScriptConsoleModel model, int width, int rows) { var wrapped = new List(); @@ -221,7 +248,7 @@ private static List StoreRows(ScriptConsoleModel model, bool onStore, in { var list = new List { - $"[{(onStore ? ScreenPalette.Accent : ScreenPalette.Muted)}]STORE[/] [{ScreenPalette.Label}]{model.StoreCount} key{(model.StoreCount == 1 ? string.Empty : "s")} · read only[/]", + $"[{(onStore ? ScreenPalette.Accent : ScreenPalette.Muted)}]STORE[/] [{ScreenPalette.Label}]{model.StoreCount} key{(model.StoreCount == 1 ? string.Empty : "s")}{(model.Store.Count == 0 ? string.Empty : onStore ? " · Del deletes" : " · ⇥ to pick")}[/]", }; if (model.Store.Count == 0) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs index b2ed1831..ea5f0b9f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Import.cs @@ -182,7 +182,9 @@ internal void ReviewImport(ImportResult result) return true; }, width: ImportReview.PreferredWidth, - closed: () => _pendingImport = null); + closed: () => _pendingImport = null, + footer: width => ImportReview.Footer(_pendingImport?.Model ?? model, width), + scrollKeys: true); } /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs index 2de7e3bd..79b3b495 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs @@ -2,6 +2,7 @@ using System.Text; using SharpConsoleUI; using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Help; using SharpMUTerm.Client.Panels; using SharpMUTerm.Core.Diagnostics; using SharpMUTerm.Core.Mapping; @@ -278,6 +279,7 @@ private bool TryMapKey(KeyPressedEventArgs e) '-' => Words(MapEditing.UnexitVerb), 'n' => Words(MapEditing.NoteVerb), 's' => Words(MapEditing.SymbolVerb), + '?' => AllKeys(), _ => false, }) { @@ -298,6 +300,13 @@ bool Edit(MapEdit edit) return true; } + bool AllKeys() + { + // The footer names the keys it has room for; the help page names every one. The map keeps the keys. + ShowHelp(topic: HelpTopics.MapTopic); + return true; + } + bool Look(MapLook look) { LookMap(windowId, look); diff --git a/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs b/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs index 1329d004..b5d2c6e4 100644 --- a/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ComposeSpellingTests.cs @@ -93,8 +93,9 @@ public async Task WithNoDictionaryTheHeaderSaysSoAndAltWOffersToGetOne() await Assert.That(app.Composer.HeaderMarkup).Contains("no dictionary"); var rows = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); await Assert.That(rows.Any(r => r.Contains("⌥W", StringComparison.Ordinal) && r.Contains("get a dictionary", StringComparison.Ordinal))).IsTrue(); - await Assert.That(rows.Any(r => r.Contains("no dictionary · ⌥W gets one", StringComparison.Ordinal))) - .IsTrue().Because("the header names the key beside the state it gets you out of"); + await Assert.That(rows.Count(r => r.Contains("⌥W", StringComparison.Ordinal))).IsEqualTo(1) + .Because("the key row names ⌥W, so the header does not name it a second time and is not cut for it"); + await Assert.That(app.Composer.HeaderMarkup).DoesNotContain("⌥W"); await Assert.That(app.Composer.SimulateKey(Key(ConsoleKey.W, ConsoleModifiers.Alt))).IsTrue(); await Assert.That(app.DictionaryOfferOpen).IsTrue().Because("⌥W with no dictionary offers one, and fetches nothing"); } diff --git a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs new file mode 100644 index 00000000..b63d5331 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs @@ -0,0 +1,108 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Every cell modal and footer fits 80×24: each view below is rendered at the default terminal size and its key +/// row is read off the painted frame. A row's first and last hints must both be on screen and on one row — a +/// footer that wrapped puts its last hint (almost always the way out) on the row under it, and a footer that scrolled +/// with its body is not on screen at all. Both happened: the import review at 80×24 scrolled its Enter/Esc away, and +/// F1's footer wrapped "(keeps the draft)" onto a second row. Read off the frame, never the renderer: the renderers +/// were internally consistent both times. +/// +[NotInParallel] +public class FooterFitTests +{ + private const int Width = 80; + + private const int Height = 24; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + /// + /// A view and the hints that must share one painted row: the row's first key and its last (its way out, or the + /// key that accepts). Add a view here when it gains a key row. + /// + internal static readonly (string View, string[] OneRow)[] Footers = + [ + ("import-review", ["⏎ import", "↑↓ scroll", "Esc cancel"]), + ("compose", ["⌃S send", "⌥W", "Esc close"]), + ("compose-literal", ["⌃S send", "Esc close"]), + ("moo-edit", ["⌃S save", "Esc close"]), + ("script-console", ["⏎ runs", "Esc closes"]), + ("map-edit", ["←↑→↓ select", "? all keys", "Esc done"]), + ("help", ["type to search", "Esc closes"]), + ("help-topic", ["↑↓ PgUp PgDn scroll", "Esc back to the list"]), + ("dictionary-offer", ["⏎ download", "Esc not now"]), + ("quit", ["⏎ stay", "Esc stays"]), + ("search", ["↑↓ pick", "⌃F closes"]), + ("history-search", ["type to filter", "⌃R closes"]), + ("layouts", ["↑↓ pick", "[⏎] Apply"]), + ("welcome", ["↑↓ pick", "Esc closes"]), + ("welcome-connect", ["↑↓ field", "Esc back"]), + ("packages", ["installed", "Space", "Esc close"]), + ("package-review", ["⏎ install", "Esc cancel"]), + ("package-browse", ["↑↓ select", "Esc close"]), + ("messages", ["+/- level", "Esc close"]), + ("prefix-panel", ["Esc cancels", "any other key disarms"]), + ("settings", ["[Esc] Close", "[⏎] Edit"]), + ("triggers", ["[Esc] Close", "[⏎] Edit"]), + ("keypad", ["[Esc] Close", "[⏎] Edit"]), + ("trigger-builder", ["[Esc] Revert", "[⏎] Commit"]), + ]; + + public static IEnumerable> Cases() => + Footers.Select(f => (Func<(string, string)>)(() => (f.View, string.Join(" | ", f.OneRow)))); + + [Test] + [MethodDataSource(nameof(Cases))] + public async Task TheKeyRowIsOnScreenAndOnOneRowAt80x24(string view, string hints) + { + var rows = FrameGrid.Decode(Render(view), Width, Height); + var wanted = hints.Split(" | "); + var row = rows.FirstOrDefault(r => wanted.All(h => r.Contains(h, StringComparison.Ordinal))); + await Assert.That(row).IsNotNull() + .Because($"{view} at 80×24 must show '{string.Join("', '", wanted)}' on one row:\n{string.Join('\n', rows)}"); + } + + [Test] + public async Task EveryViewInTheListIsOneTheSnapshotKnows() + { + foreach (var (view, _) in Footers) + { + await Assert.That(SnapshotViews.All.Contains(view)).IsTrue().Because(view); + } + } + + [Test] + public async Task TheImportReviewScrollsItsBodyUnderAPinnedFooter() + { + var app = App(); + var first = FrameGrid.Decode(app.RenderSnapshot("import-review"), Width, Height); + await Assert.That(first.Any(r => r.Contains("LEFT OUT", StringComparison.Ordinal) && !r.Contains("password", StringComparison.Ordinal))).IsTrue(); + + app.SimulateImportKey(new ConsoleKeyInfo('\0', ConsoleKey.End, false, false, false)); + var scrolled = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); + await Assert.That(scrolled.Any(r => r.Contains("Your health is", StringComparison.Ordinal))).IsTrue() + .Because("End scrolls the body to the last of what was left out:\n" + string.Join('\n', scrolled)); + await Assert.That(scrolled.Any(r => r.Contains("⏎ import", StringComparison.Ordinal) && r.Contains("Esc cancel", StringComparison.Ordinal))).IsTrue() + .Because("the keys stay where they were"); + await Assert.That(scrolled.Any(r => r.Contains("password", StringComparison.Ordinal))).IsTrue() + .Because("and so does the passwords question"); + await Assert.That(app.ImportReviewLines.Count).IsGreaterThan(0).Because("the review is still open: End scrolled, it did not answer"); + } + + private static SharpMUTermApp App() + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = "Dark"; + config.Theme = ThemeLibrary.Get("Dark"); + return new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height)); + } + + private static string Render(string view) => App().RenderSnapshot(view); +} diff --git a/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs b/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs index 46ca7ce1..02e9b556 100644 --- a/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/MapEditModeTests.cs @@ -126,7 +126,7 @@ public async Task EveryKeyTheFooterNamesIsAnswered() ["n"] = [Key(ConsoleKey.N, 'n')], ["s"] = [Key(ConsoleKey.S, 's')], ["Del"] = [Key(ConsoleKey.Delete)], ["PgUp PgDn"] = [Key(ConsoleKey.PageDown)], ["v"] = [Key(ConsoleKey.V, 'v')], ["h"] = [Key(ConsoleKey.H, 'h')], ["R"] = [Key(ConsoleKey.R, 'R', shift: true)], - ["u"] = [Key(ConsoleKey.U, 'u')], ["⏎"] = [Key(ConsoleKey.Enter, '\r')], ["Esc"] = [Key(ConsoleKey.Escape, '\u001b')], + ["u"] = [Key(ConsoleKey.U, 'u')], ["⏎"] = [Key(ConsoleKey.Enter, '\r')], ["?"] = [Key(ConsoleKey.Oem2, '?', shift: true)], ["Esc"] = [Key(ConsoleKey.Escape, '\u001b')], }; foreach (var (key, _) in MapEditing.Keys) From 0d05be55a08f2dabda5bc65c33c4ac8d8a7d6967 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 14:44:20 +0000 Subject: [PATCH 054/113] =?UTF-8?q?UX=20wave=2016:=20grouped=20F5=20world?= =?UTF-8?q?=20page,=20=E2=8C=83P=20groups,=20scene=20mark,=20client=20rows?= =?UTF-8?q?,=20map=20find=20picker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - F5's world column is drawn in the declaration's order under group headings with the declared labels, in both hosts; ⇥ order and ordinals follow it. - ⌃P's OUTPUT group is split into Writing, Map, Panels and Help & setup; a new configuration is suggested Help, Welcome and Import. - A recording scene shows ● REC on the status row and the window header; the saved notice offers Open (ClientHost.OpenFile, log files under the log root only) and Copy path, as a second toast action (NoticeModel.Second). - Map edits that worked are not toasted; errors still are. - /map find lists its rooms as ⌃P "Walk to …" entries (a client-owned list, never links in a pane); reconnect messages are client rows, not session lines. - Connection-failure notices offer Show messages, not a bare ⌃P chip; no "Graphics …" on the first-run status row; "1 character" pluralised. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 14 ++ CLAUDE.md | 22 +- src/SharpMUTerm.Avalonia/NativeChrome.cs | 3 +- src/SharpMUTerm.Avalonia/NoticeToasts.cs | 45 +++- src/SharpMUTerm.Avalonia/WindowHost.cs | 1 + src/SharpMUTerm.Client/Chrome/HeaderModel.cs | 6 + src/SharpMUTerm.Client/Chrome/NoticeModel.cs | 9 + .../Commands/BuiltInCommands.cs | 104 ++++++--- .../Palette/CommandPaletteModel.cs | 21 +- .../Settings/BuiltInSettings.cs | 32 +-- .../Commands/CommandCatalog.cs | 15 +- src/SharpMUTerm.Core/Commands/CommandItem.cs | 18 +- src/SharpMUTerm.Tui/ClientRowRenderer.cs | 21 ++ src/SharpMUTerm.Tui/ExternalBrowser.cs | 41 ++++ src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 10 + src/SharpMUTerm.Tui/Hosting/PlainHost.cs | 1 + .../Pointer/SharpMUTermApp.Notices.cs | 7 +- src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs | 8 +- src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs | 81 ++++++- .../SharpMUTermApp.Reconnect.cs | 45 +++- .../SharpMUTermApp.SceneLog.cs | 127 ++++++++++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 76 ++++++- src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 215 ++++++++++-------- .../HostParityTests.cs | 4 +- .../NoticeToastTests.cs | 28 +++ .../CommandPaletteModelTests.cs | 4 +- .../PaletteGroupsTests.cs | 95 ++++++++ .../AlertsAndReconnectTests.cs | 18 ++ .../CommandSurfaceRendererTests.cs | 2 +- .../DeclaredWorldSettingsTests.cs | 25 ++ tests/SharpMUTerm.Tui.Tests/MapViewTests.cs | 31 ++- .../ScriptingWaveTests.cs | 76 ++++++- .../WorldFieldScrollTests.cs | 10 +- .../WorldsScreenRendererTests.cs | 4 +- 34 files changed, 1012 insertions(+), 207 deletions(-) create mode 100644 src/SharpMUTerm.Tui/ClientRowRenderer.cs create mode 100644 tests/SharpMUTerm.Client.Tests/PaletteGroupsTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index a56b3d8f..3e4be66c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- While a scene log records, the status row shows `● REC` and the desktop window's header says so. The "scene saved" + notice offers Open (the scene file in your viewer; only files the client saved under its own log folder) and Copy + path. +- `/map find` lists the rooms it found in Ctrl+P as "Walk to …" entries; Enter walks there. + - Import worlds, characters, triggers, aliases, timers and keys from MUSHclient (.mcl), Mudlet (a profile folder, an XML package or a .mpackage) and TinTin++ with `/import `, Ctrl+P ▸ Import from another client… or the welcome screen. A review shows what can act as you, what will be added and what was left out (scripts are never imported or @@ -320,6 +325,15 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- F5's world page lists its fields under headings (Connection, Login & protocols, Text & input, Alerts & channels, + Map, Sound & layout) with their full names, in the same order in the terminal and in the desktop window. +- Ctrl+P's OUTPUT group is split into WRITING, MAP, PANELS and HELP & SETUP. A new configuration's palette suggests + Help, Welcome and Import first. +- Reconnect messages are written as a client row in the window, not as session lines, so they no longer reach + transcripts, the restore log, scene logs or Ctrl+F. +- The desktop window no longer shows a toast for each map edit; failed edits still do. A connection failure's notice + offers Show messages instead of a bare Ctrl+P. +- The first-run status row no longer says which graphics protocol is in use, and F5 says "1 character", not "1 chars". - Light theme: background tabs and one-row panels (vitals, quick bar) sit on a lighter grey, and small text on the settings screens is darker, so it is as easy to read as body text. - Desktop window: the composer's "no dictionary" chip is a button that offers to get one; in the terminal F1 names diff --git a/CLAUDE.md b/CLAUDE.md index 6be78060..704e5abb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1408,11 +1408,31 @@ fallbacks) for inline images/maps. always-on-top choice; the composer does not float; positions on a mixed-DPI desktop are assumed to be in the main window's scaling. +- **Wave 16 groups** (F5 headings, ⌃P groups, scene mark, client rows, map find). Decisions not to relitigate: + - **F5's world column is drawn in the declaration's order under its `Group` headings** (`WorldsScreenRenderer.DetailColumn` + walks `BuiltInSettings.World.Fields`), so the cell screen and the window group alike; `WorldFieldOrder` (⇥ order and the + ordinals tests navigate by) follows it, security checkboxes excepted. Labels are the declared ones, not shortenings. + - **⌃P's groups are `CommandGroup`'s nine** (Go to, Connection, Output, Writing, Map, Panels, Windows & panes, Help & setup, + Settings); `PaletteGroupsTests` keeps OUTPUT at 16 or fewer. `CommandContext.NewConfiguration` (no worlds, or a tour + owed) puts Help, Welcome and Import first in SUGGESTED. + - **`/map find` is a ⌃P family, not links in a pane** (`map:walk-to:`, `CommandContext.MapFound`; the palette opens on + `walk to `). A link in a pane is answered by the panes' handler, which is scheme-tagged server text; a palette entry is + the client's own list, in both hosts, with no new trust path. `--plain` gets client rows instead. + - **What the client says in a session window is a client row** (`ClientRowRenderer`, `AppendClientRow`: a bar function + and no `Plain`), never a `***` session line: reconnect countdowns and stops reach no transcript, restore, scene log or ⌃F. + Core's own `*** Connecting/Connection lost` lines are still session lines. + - **A scene recording is marked** (`● REC` status cell, `HeaderModel.Recording`), and the saved notice carries two actions + (`NoticeModel.Second`): `scene:open:N` and `scene:copy:N`, by index into this run's saved scenes, never a path. Open goes + through `ClientHost.OpenFile` (required; null headless), which takes only an existing absolute `.html/.htm/.txt/.log` + (`ExternalBrowser.TryParseOpenableFile`), and only under the log root. + - **`Notice(..., toast: false)`** draws the status row without a toast: map edits that worked and map hints use it. + - The parity harness's window host has `FloatingPanels = null`, like the terminal, or ⌃P's catalog differs by the pop-out entries. + ## One client, several hosts — and how they are kept the same The terminal (`sharpmuterm`), the desktop window (`sharpmuterm-window`) and the headless snapshot all run the one `SharpMUTermApp`; a host is only the place it runs. What differs between hosts is a **`ClientHost`** -(`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, focus reporting, keys +(`src/SharpMUTerm.Tui/Hosting/`): driver, capabilities, clipboard, URL opener, file opener, focus reporting, keys (`HostKeys`: the newline chord, and the chords the host keeps for itself), whether there is a main loop, the Sixel cell size, and what it does with the pointer (`IPointerPresenter`, null for none), whether it draws the declared settings natively (`INativeSettings`, null for the cell screens), and whether it draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draws the composer with its own editor (`INativeComposer`, null for cells), whether it draws the quit prompt, ⌃F, ⌃R, ⌥M, the welcome, help and the dictionary offer itself (`INativeModals`, null for cells), where the title for what is in front goes (`IWindowTitle`: the window's title bar, the terminal's OSC 2, null headless), whether it can pop a panel out into a window of its own (`IFloatingPanels`, null for none), whether it has a native file picker (`IFilePicker`, null for none), how it asks for attention while the player is elsewhere (`IAttention`, null headless), and which chrome it draws itself beside the cells (`HostChrome`: the header and the rail, which the client then leaves out of the grid). Built by `ClientHost.Terminal`, `ClientHost.Headless`/`Snapshot` and diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 147f4f8b..fa4f990c 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -459,7 +459,8 @@ private void LayoutPrefix(HeaderPrefix prefix, double start, double right, doubl } private static string CountsText(HeaderModel model) => - model.HasWorlds ? $"{model.ConnectedText} · {model.LogText}" : model.LogText; + (model.Recording ? $"{HeaderModel.RecordingText} · " : string.Empty) + + (model.HasWorlds ? $"{model.ConnectedText} · {model.LogText}" : model.LogText); protected override void PressedEmpty(PointerPressedEventArgs e) => View.WindowGestureFromChrome(e); diff --git a/src/SharpMUTerm.Avalonia/NoticeToasts.cs b/src/SharpMUTerm.Avalonia/NoticeToasts.cs index f83f45b8..db55155b 100644 --- a/src/SharpMUTerm.Avalonia/NoticeToasts.cs +++ b/src/SharpMUTerm.Avalonia/NoticeToasts.cs @@ -113,7 +113,7 @@ public void Show(NoticeOverlay overlay) /// Runs or dismisses the toast showing notice , as a left click on it does. Internal for /// tests; a real click comes through . /// - internal void Click(long sequence) + internal void Click(long sequence, bool second = false) { var toast = _toasts.FirstOrDefault(t => t.Overlay.Notice.Sequence == sequence); if (toast is null) @@ -122,7 +122,7 @@ internal void Click(long sequence) } _toasts.Remove(toast); - if (toast.Overlay.Notice.Action is { } action) + if ((second ? toast.Overlay.Notice.Second : toast.Overlay.Notice.Action) is { } action) { toast.Overlay.Run(action.Command); } @@ -144,7 +144,7 @@ internal void Advance(TimeSpan by) /// The words each toast draws — its key chip, its text and its action — oldest first. Internal for tests. internal IReadOnlyList DrawnText() => - Layout().SelectMany(l => new[] { SourceText(l.Toast), ChipText(l.Toast), BodyText(l.Toast), ActionText(l.Toast) }).OfType().ToList(); + Layout().SelectMany(l => new[] { SourceText(l.Toast), ChipText(l.Toast), BodyText(l.Toast), ActionText(l.Toast), SecondText(l.Toast) }).OfType().ToList(); /// Whether each toast's label is a key chip (true) or a source caption (false), oldest first; null for none. Internal for tests. internal IReadOnlyList LabelIsChip() => @@ -161,6 +161,29 @@ internal IReadOnlyList DrawnText() => private static string? ActionText(Toast toast) => toast.Overlay.Notice.Action is { } a ? $"{NativeKeys.Words(a.Label)} ›" : null; + // A second action (a saved scene's Copy path beside Open) sits on the same line, after the first, as its own click. + private static string? SecondText(Toast toast) => + toast.Overlay.Notice.Action is not null && toast.Overlay.Notice.Second is { } a ? $"{NativeKeys.Words(a.Label)} ›" : null; + + /// Where a toast's second action is drawn, or an empty rect when it has none. + private static Rect SecondArea(Placed placed) + { + if (placed.Action is not { } action || placed.Second is not { } second) + { + return default; + } + + var y = placed.Rect.Y + Padding + (placed.Source is null ? 0 : placed.Source.Height + 2) + placed.Text.Height + 6; + var x = placed.Rect.X + EdgeWidth + Padding + action.Width + SecondGap; + return new Rect(x - (SecondGap / 2), y - 3, second.Width + SecondGap, second.Height + 6); + } + + /// The gap between a toast's two actions, in pixels. + private const double SecondGap = 20; + + /// Where each toast's second action is, oldest first (empty for none). Internal for tests. + internal IReadOnlyList SecondAreas() => Layout().Select(SecondArea).ToList(); + /// Where each toast is drawn, oldest first, in this control's coordinates. Internal for tests. internal IReadOnlyList Rects() => Layout().Select(l => l.Rect).ToList(); @@ -228,7 +251,7 @@ private void SyncFreeze() // ── Layout ─────────────────────────────────────────────────────────────────────────────── - private readonly record struct Placed(Toast Toast, Rect Rect, FormattedText Text, FormattedText? Chip, FormattedText? Action, FormattedText? Source = null); + private readonly record struct Placed(Toast Toast, Rect Rect, FormattedText Text, FormattedText? Chip, FormattedText? Action, FormattedText? Source = null, FormattedText? Second = null); private List Layout() { @@ -308,10 +331,13 @@ private List FrozenLayout(Dictionary frozen) var textWidth = inner - (chip is null ? 0 : chip.Width + 8); var text = Format(BodyText(toast), TextSize, ink, bold: false, Math.Max(40, textWidth), lines: 3); var action = ActionText(toast) is { } a ? Format(a, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var second = action is not null && SecondText(toast) is { } b + ? Format(b, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, Math.Max(1, inner - action.Width - SecondGap)) + : null; var source = SourceText(toast) is { } said ? Format(said.ToUpperInvariant(), ChipSize - 1, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; var height = (2 * Padding) + text.Height + (action is null ? 0 : action.Height + 6) + (source is null ? 0 : source.Height + 2); var top = bottom - height; - return top < Inset ? null : new Placed(toast, new Rect(x, top, width, height), text, chip, action, source); + return top < Inset ? null : new Placed(toast, new Rect(x, top, width, height), text, chip, action, source, second); } private static FormattedText Format(string text, double size, Color colour, bool bold, double maxWidth, int lines = 1) => @@ -368,7 +394,7 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) if (point.Properties.IsLeftButtonPressed) { - Click(hit.Toast.Overlay.Notice.Sequence); + Click(hit.Toast.Overlay.Notice.Sequence, SecondArea(hit).Contains(at)); } } @@ -390,8 +416,9 @@ public override void Render(DrawingContext context) { var now = _clock.Elapsed; var hovered = HoveredToast(); - foreach (var (toast, rect, text, chip, action, source) in Layout()) + foreach (var placed in Layout()) { + var (toast, rect, text, chip, action, source, second) = placed; var palette = toast.Overlay.Palette; var plane = PanelText.Parse(palette.Plane); var edge = PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)); @@ -432,6 +459,10 @@ public override void Render(DrawingContext context) if (action is not null) { context.DrawText(action, new Point(rect.X + EdgeWidth + Padding, y + text.Height + 6)); + if (second is not null) + { + context.DrawText(second, new Point(rect.X + EdgeWidth + Padding + action.Width + SecondGap, y + text.Height + 6)); + } } } } diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index c3599d79..91ea1452 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -50,6 +50,7 @@ internal static class WindowHost Capabilities = WindowOptions.Capabilities, Clipboard = clipboard, OpenUrl = ExternalBrowser.Open, + OpenFile = ExternalBrowser.OpenFile, // Focus reporting is a terminal escape, and its focus-in arrives disguised as a Tab: in a window it // would only ever turn a real Tab after a pause into a "you were away" bar. diff --git a/src/SharpMUTerm.Client/Chrome/HeaderModel.cs b/src/SharpMUTerm.Client/Chrome/HeaderModel.cs index ebee1f4a..207f4cdc 100644 --- a/src/SharpMUTerm.Client/Chrome/HeaderModel.cs +++ b/src/SharpMUTerm.Client/Chrome/HeaderModel.cs @@ -51,6 +51,12 @@ public sealed record HeaderModel( /// panel lists in full; null otherwise. A host drawing its own header shows this in place of the search box. /// public HeaderPrefix? Prefix { get; init; } + + /// Whether a scene log is recording (⌃P ▸ Start scene log), in any window. + public bool Recording { get; init; } + + /// The recording mark as every surface words it. + public const string RecordingText = "● REC"; } /// The ⌃B keymap as the header shows it while the prefix is armed. diff --git a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs index 1504b520..04902e93 100644 --- a/src/SharpMUTerm.Client/Chrome/NoticeModel.cs +++ b/src/SharpMUTerm.Client/Chrome/NoticeModel.cs @@ -54,8 +54,17 @@ public static class Sources /// Imports from another client. public const string Import = "Import"; + + /// Scene logs: recording, saved. + public const string Scene = "Scene log"; } + /// + /// A second command the notice offers, after (a saved scene's Copy path beside + /// Open); null for none, and always null without a first. Only the window offers it, as its own click. + /// + public NoticeAction? Second { get; init; } + /// How long a notice holds the status row, and how long a toast stays before it fades. public static readonly TimeSpan Duration = TimeSpan.FromSeconds(6); } diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 3bb728d1..0132bfc7 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -20,6 +20,9 @@ public static class BuiltInCommands /// Help: keys, slash commands and how-tos (/help). public const string HelpCommand = "term:help"; + /// The first-run welcome: connect to a world, browse worlds, pick a layout. + public const string WelcomeCommand = "term:welcome"; + /// Import from another client: a file picker in a host that has one, else /import on the command line. public const string ImportCommand = "term:import"; @@ -32,9 +35,30 @@ public static class BuiltInCommands /// ⌃P ▸ Stop scene log. public const string SceneStopCommand = "term:scene-off"; + /// + /// The prefix of a saved scene's notice actions, which ⌃P lists nothing under: scene:open:N and + /// scene:copy:N, where N indexes the scenes saved this run (the client's own list, never a path). + /// + public const string ScenePrefix = "scene:"; + + /// Opens saved scene N in the desktop's viewer for it. + public const string SceneOpenPrefix = "scene:open:"; + + /// Copies saved scene N's path. + public const string SceneCopyPrefix = "scene:copy:"; + /// The spelling dictionary offer. public const string DictionaryCommand = "term:get-dictionary"; + /// The prefix of the Walk to … entries the last /map find listed: map:walk-to:<room id>. + public const string MapWalkPrefix = "map:walk-to:"; + + /// What the palette opens with typed in after a /map find, so it lists the rooms found and nothing else. + public const string MapWalkQuery = "walk to "; + + /// The ⌃P id that walks to room , one the last /map find listed. + public static string MapWalk(long room) => MapWalkPrefix + room.ToString(System.Globalization.CultureInfo.InvariantCulture); + /// The ⌃P id that joins 's server wraps. public static string JoinWraps(string world) => JoinWrapsPrefix + world; @@ -119,6 +143,7 @@ void Family(string id, string prefix, Func c.State.LoggingOn); Add("term:log-on", CommandGroup.Terminal, "Start logging", when: c => !c.State.LoggingOn); + Family("term:scene-saved", ScenePrefix, _ => []); Add(SceneStopCommand, CommandGroup.Terminal, "Stop scene log", detail: "closes the file", when: c => c.State.SceneLogging); Add(SceneStartCommand, CommandGroup.Terminal, "Start scene log", detail: "record this window's poses to a file of their own", when: c => !c.State.SceneLogging); @@ -163,32 +188,36 @@ void Family(string id, string prefix, Func"); + Add("term:map", CommandGroup.Map, "Show map", detail: "this connection's map · click a room, or /walk "); // Editing the map: the room you are in selected, the map holding the keys (its footer names them). Listed // unconditionally beside Show map; it refuses out loud where there is no map. - Add("map:edit", CommandGroup.Terminal, "Edit map", detail: "rename, area, lock, weight, exits, notes · /map rename …"); - Add("map:undo", CommandGroup.Terminal, "Undo map edit", detail: "takes back the last change to the map", when: c => c.State.MapUndo is not null); + Add("map:edit", CommandGroup.Map, "Edit map", detail: "rename, area, lock, weight, exits, notes · /map rename …"); + Add("map:undo", CommandGroup.Map, "Undo map edit", detail: "takes back the last change to the map", when: c => c.State.MapUndo is not null); // Looking at another level or area of the map, and back; offered only where the map has one to look at. - Add("map:level-up", CommandGroup.Terminal, "Map: level up", detail: "shows the next level up · /map level up", when: c => c.State.MapLevels > 1); - Add("map:level-down", CommandGroup.Terminal, "Map: level down", detail: "shows the next level down · /map level down", when: c => c.State.MapLevels > 1); - Add("map:next-area", CommandGroup.Terminal, "Map: next area", detail: "shows another area · /map view ", when: c => c.State.MapAreas > 1); - Add("map:here", CommandGroup.Terminal, "Map: back to where I am", detail: "the map follows you again · /map here", when: c => c.State.MapViewing); - Add("map:find", CommandGroup.Terminal, "Find room…", detail: "rooms by name or area · /map find ", when: c => c.State.MapLevels > 0); + Add("map:level-up", CommandGroup.Map, "Map: level up", detail: "shows the next level up · /map level up", when: c => c.State.MapLevels > 1); + Add("map:level-down", CommandGroup.Map, "Map: level down", detail: "shows the next level down · /map level down", when: c => c.State.MapLevels > 1); + Add("map:next-area", CommandGroup.Map, "Map: next area", detail: "shows another area · /map view ", when: c => c.State.MapAreas > 1); + Add("map:here", CommandGroup.Map, "Map: back to where I am", detail: "the map follows you again · /map here", when: c => c.State.MapViewing); + Add("map:find", CommandGroup.Map, "Find room…", detail: "rooms by name or area · /map find ", when: c => c.State.MapLevels > 0); + + // The rooms the last /map find listed: one Walk to entry each, which the find opens the palette on. A picker of the + // client's own, never a link in a pane: the panes' link handler is server text's, and this is the client's action. + Family("map:walk-to", MapWalkPrefix, MapFoundEntries); // The panels a layout places, openable one at a time as tabs: each draws the focused character's own data // and says so when there is none yet, so they are listed unconditionally, like the map. - Add("panel:who-here", CommandGroup.Terminal, "Show who is here", detail: "players and creatures in the room · click a name to look"); - Add("panel:vitals", CommandGroup.Terminal, "Show vitals", detail: "the F7 meters as bars, and your target"); - Add("panel:quick-bar", CommandGroup.Terminal, "Show quick bar", detail: "this character's function-key macros · click one to run it"); - Add("panel:composer", CommandGroup.Terminal, "Dock the composer", detail: "a pane to write posts in · ⌃S sends"); + Add("panel:who-here", CommandGroup.Panels, "Show who is here", detail: "players and creatures in the room · click a name to look"); + Add("panel:vitals", CommandGroup.Panels, "Show vitals", detail: "the F7 meters as bars, and your target"); + Add("panel:quick-bar", CommandGroup.Panels, "Show quick bar", detail: "this character's function-key macros · click one to run it"); + Add("panel:composer", CommandGroup.Panels, "Dock the composer", detail: "a pane to write posts in · ⌃S sends"); // A panel in a window of its own, for a second monitor — only where the host can draw one (the desktop window; // Floats is null in a terminal, which keeps every panel in its region). One entry per panel window, by id, so the // action runs on that panel's own character whichever window is focused. Family("panel:popout", Client.Panels.PanelFloatCommands.PopOutPrefix, PopOuts); Family("panel:dock", Client.Panels.PanelFloatCommands.DockPrefix, Docks); - Add("term:walk-stop", CommandGroup.Terminal, "Stop walking", detail: "ends the speedwalk", when: c => c.State.Walking); + Add("term:walk-stop", CommandGroup.Map, "Stop walking", detail: "ends the speedwalk", when: c => c.State.Walking); // Game sound, for this run. The levels and the off switch are F7's; this is the quick one. Add("term:mute", CommandGroup.Terminal, "Mute sound", detail: "until unmuted or restarted", @@ -199,7 +228,7 @@ void Family(string id, string prefix, Func c.State.NoDictionary); Add("term:timestamps-off", CommandGroup.Terminal, "Hide timestamps", when: c => c.State.TimestampsOn); Add("term:timestamps-on", CommandGroup.Terminal, "Show timestamps", when: c => !c.State.TimestampsOn); - Add("term:input2-off", CommandGroup.Terminal, "Hide second input", "⌃B i", "this window", + Add("term:input2-off", CommandGroup.Compose, "Hide second input", "⌃B i", "this window", when: c => c.State.SecondInputOn, detailFirst: true); - Add("term:input2-on", CommandGroup.Terminal, "Show second input", "⌃B i", "this window", + Add("term:input2-on", CommandGroup.Compose, "Show second input", "⌃B i", "this window", when: c => !c.State.SecondInputOn, detailFirst: true); // The newline chord. Here for the same reason the scrollback keys are: a chord that works and is // named nowhere is a chord nobody finds, which is precisely how this one was reported as missing. // The host says which chord it is: a terminal reports Shift+⏎ and Ctrl+⏎ as a bare ⏎, so there it is // Alt+⏎, and a window keeps Alt+⏎ for itself, so there it is Ctrl+⏎. - Add("term:newline", CommandGroup.Terminal, "Insert a newline in the command line", KeyHint.ForHost(HostKey.Newline)); + Add("term:newline", CommandGroup.Compose, "Insert a newline in the command line", KeyHint.ForHost(HostKey.Newline)); // LAYOUT — every entry carries the chord that runs it, because this surface is where the client // is discovered from and the ⌃B keymap is otherwise visible only while the prefix is armed. @@ -430,6 +461,15 @@ private static IEnumerable JoinWrapsEntries(ICommandContext context Detail = $"it wraps at {r.Column}, the pane is {r.PaneWidth} wide · F5 ▸ join wraps", }); + private static IEnumerable MapFoundEntries(ICommandContext context) => + (context.State.MapFound ?? []).Select(r => + { + var detail = (r.Area is { } area ? area + " · " : string.Empty) + + "level " + r.Level.ToString(System.Globalization.CultureInfo.InvariantCulture) + + " · #" + r.Id.ToString(System.Globalization.CultureInfo.InvariantCulture); + return new CommandItem(CommandGroup.Map, $"Walk to {r.Name}", MapWalk(r.Id), detail) { Detail = detail }; + }); + private static IEnumerable SendGroup(ICommandContext context) { var characters = context.Characters; @@ -496,7 +536,7 @@ private static IEnumerable Panes(ICommandContext context) private static IEnumerable PopOuts(ICommandContext context) => (context.State.Floats ?? []).Where(f => !f.Floating).Select(f => new CommandItem( - CommandGroup.Layout, + CommandGroup.Panels, $"Pop out {f.Title}", Client.Panels.PanelFloatCommands.PopOut(f.WindowId), $"{f.Character} · in a window of its own") @@ -507,7 +547,7 @@ private static IEnumerable PopOuts(ICommandContext context) => private static IEnumerable Docks(ICommandContext context) => (context.State.Floats ?? []).Where(f => f.Floating).Select(f => new CommandItem( - CommandGroup.Layout, + CommandGroup.Panels, $"Dock {f.Title} back", Client.Panels.PanelFloatCommands.Dock(f.WindowId), $"{f.Character} · into its place in the layout") diff --git a/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs b/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs index 740d054e..c82c44c2 100644 --- a/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs +++ b/src/SharpMUTerm.Client/Palette/CommandPaletteModel.cs @@ -84,7 +84,11 @@ public static class CommandPaletteModel CommandGroup.GoTo, CommandGroup.World, CommandGroup.Terminal, + CommandGroup.Compose, + CommandGroup.Map, + CommandGroup.Panels, CommandGroup.Layout, + CommandGroup.Help, CommandGroup.Settings, }; @@ -92,9 +96,13 @@ public static class CommandPaletteModel public static string GroupLabel(CommandGroup group) => group switch { CommandGroup.GoTo => "GO TO", - CommandGroup.World => "WORLD", + CommandGroup.World => "CONNECTION", CommandGroup.Terminal => "OUTPUT", - CommandGroup.Layout => "LAYOUT", + CommandGroup.Compose => "WRITING", + CommandGroup.Map => "MAP", + CommandGroup.Panels => "PANELS", + CommandGroup.Layout => "WINDOWS & PANES", + CommandGroup.Help => "HELP & SETUP", CommandGroup.Settings => "SETTINGS", _ => group.ToString().ToUpperInvariant(), }; @@ -108,6 +116,15 @@ public static IReadOnlyList Suggested(CommandContext state) { ArgumentNullException.ThrowIfNull(state); var ids = new List(); + + // A configuration that is new (no world yet, or the key tour still owed): where to start, before anything else. + if (state.NewConfiguration) + { + ids.Add(BuiltInCommands.HelpCommand); + ids.Add(BuiltInCommands.WelcomeCommand); + ids.Add(BuiltInCommands.ImportCommand); + } + if (state.OutputSelected) { ids.Add("term:copy"); diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index 06e1c619..2cc66651 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -205,11 +205,14 @@ public static partial class BuiltInSettings /// F5's world groups. public const string ConnectionGroup = "Connection"; - /// What the world speaks and how it logs in. - public const string ProtocolGroup = "Protocols & login"; + /// How the world logs in and what it speaks. + public const string ProtocolGroup = "Login & protocols"; - /// How the world's text is taken in. - public const string WorldTextGroup = "Text"; + /// How the world's text is taken in, and what a typed line becomes. + public const string WorldTextGroup = "Text & input"; + + /// What the world's text tells the player about: alerts, channels, names. + public const string WorldAlertsGroup = "Alerts & channels"; /// What the mapper reads. public const string MapGroup = "Map"; @@ -254,6 +257,10 @@ public static partial class BuiltInSettings Keywords = "idle timeout ping", Binding = SettingBinding.ForWorld((_, w) => w.KeepaliveSeconds, (_, w, v) => w.KeepaliveSeconds = v), }, + WorldChoice("reconnect", "reconnect", WorldFieldValues.ReconnectChoices, ConnectionGroup, + (_, w) => w.AutoReconnect ? WorldFieldValues.ReconnectChoices[1] : WorldFieldValues.ReconnectChoices[0], + (_, w, v) => w.AutoReconnect = v == WorldFieldValues.ReconnectChoices[1], + "dial again after a dropped connection, 5 s to 60 s apart, five tries", "auto reconnect drop retry"), WorldChoice("content", "content", WorldFieldValues.ContentChoices, ProtocolGroup, (_, w) => WorldFieldValues.ContentName(w.ContentFormat), (_, w, v) => w.ContentFormat = WorldFieldValues.ContentOf(v), @@ -265,10 +272,6 @@ public static partial class BuiltInSettings (_, w) => w.GmcpLogin ? WorldFieldValues.LoginChoices[1] : WorldFieldValues.LoginChoices[0], (_, w, v) => w.GmcpLogin = v == WorldFieldValues.LoginChoices[1], "log in over GMCP when the server offers it", "char.login password credentials"), - WorldChoice("reconnect", "reconnect", WorldFieldValues.ReconnectChoices, ConnectionGroup, - (_, w) => w.AutoReconnect ? WorldFieldValues.ReconnectChoices[1] : WorldFieldValues.ReconnectChoices[0], - (_, w, v) => w.AutoReconnect = v == WorldFieldValues.ReconnectChoices[1], - "dial again after a dropped connection, 5 s to 60 s apart, five tries", "auto reconnect drop retry"), WorldChoice("discord", "discord", WorldFieldValues.DiscordChoices, ProtocolGroup, (_, w) => w.DiscordPresence ? WorldFieldValues.DiscordChoices[1] : WorldFieldValues.DiscordChoices[0], (_, w, v) => w.DiscordPresence = v == WorldFieldValues.DiscordChoices[1], @@ -285,23 +288,24 @@ public static partial class BuiltInSettings (_, w) => WorldFieldValues.SeparatorName(w.CommandSeparator), (_, w, v) => w.CommandSeparator = WorldFieldValues.SeparatorOf(v), "split a typed line on this, and #3 cmd repeats one; off for a MUSH", "separator semicolon repeat speedwalk"), - WorldChoice("alert-on", "alert on", WorldFieldValues.AlertChoices, WorldTextGroup, + WorldText("edit-grab", "edit grab", TextRule.Optional, WorldTextGroup, + (_, w) => w.GrabPrefix, (_, w, v) => w.GrabPrefix = v, + "a line starting with this goes on the command line instead of the output", "fugueedit mush edit prefix"), + + WorldChoice("alert-on", "alert on", WorldFieldValues.AlertChoices, WorldAlertsGroup, (_, w) => w.AlertOnName ? WorldFieldValues.AlertChoices[1] : WorldFieldValues.AlertChoices[0], (_, w, v) => w.AlertOnName = v == WorldFieldValues.AlertChoices[1], "tell the desktop when a line names your character or pages you", "notify mention page tell"), - WorldChoice("capture-channels", "capture channels", WorldFieldValues.ChannelCaptureChoices, WorldTextGroup, + WorldChoice("capture-channels", "capture channels", WorldFieldValues.ChannelCaptureChoices, WorldAlertsGroup, (_, w) => WorldFieldValues.ChannelCaptureName(w.CaptureChannels), (_, w, v) => w.CaptureChannels = WorldFieldValues.ChannelCaptureOf(v), "put each GMCP channel in a window of its own, as a copy or moved out of the main window", "comm.channel chat ooc gossip spawn window"), - WorldText("highlight-names", "highlight names", TextRule.NameHighlights, WorldTextGroup, + WorldText("highlight-names", "highlight names", TextRule.NameHighlights, WorldAlertsGroup, (_, w) => NameHighlights.Format(w.HighlightNames), (_, w, v) => w.HighlightNames = [.. NameHighlights.Parse(v).Names], "names drawn in a colour wherever they appear: Ashlyn=gold, Merrow=red", "friends enemies highlight name colour"), - WorldText("edit-grab", "edit grab", TextRule.Optional, WorldTextGroup, - (_, w) => w.GrabPrefix, (_, w, v) => w.GrabPrefix = v, - "a line starting with this goes on the command line instead of the output", "fugueedit mush edit prefix"), WorldText("map-room", "map room", TextRule.Pattern, MapGroup, (_, w) => w.Map.RoomNamePattern, (_, w, v) => w.Map.RoomNamePattern = v, diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index 19fdb2d7..f5657ed6 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -66,6 +66,10 @@ public sealed record CharacterRef( /// How many levels the area the focused character's map shows has (0 with no map). /// How many named areas that map has. /// Whether that map shows somewhere other than where the character is. +/// +/// Whether the configuration is new — no world yet, or the key tour still owed — so Help, Welcome and Import are suggested. +/// +/// The rooms the last /map find listed, newest search only, so ⌃P offers to walk to each. public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -88,7 +92,16 @@ public sealed record CommandContext( bool SceneLogging = false, int MapLevels = 0, int MapAreas = 0, - bool MapViewing = false); + bool MapViewing = false, + bool NewConfiguration = false, + IReadOnlyList? MapFound = null); + +/// A room the last /map find listed, for the command surface's Walk to … entries. +/// The room's id on the map. +/// Its name. +/// Its area's name, or null. +/// Its level (z). +public sealed record FoundRoom(long Id, string Name, string? Area, int Level); /// A world whose pane is narrower than its server's wrap column. /// The world's name. diff --git a/src/SharpMUTerm.Core/Commands/CommandItem.cs b/src/SharpMUTerm.Core/Commands/CommandItem.cs index 3dac440c..cca4d7bf 100644 --- a/src/SharpMUTerm.Core/Commands/CommandItem.cs +++ b/src/SharpMUTerm.Core/Commands/CommandItem.cs @@ -6,17 +6,29 @@ public enum CommandGroup /// Navigation: switch character, jump to a window. GoTo, - /// World/connection actions: connect, disconnect, reconnect. + /// Connection actions: reconnect, disconnect, the send group, scripts. World, - /// Terminal/session actions: logging, freeze/scrollback, clear. + /// Output actions: logging and scene logs, freeze/scrollback, clear, copy, timestamps, sound. Terminal, - /// Layout actions: split, zoom, close pane, move. + /// Windows and panes: split, zoom, close pane, focus, tabs, the rail, layouts, resize. Layout, /// The configuration screens — one entry per screen the host offers, F-key and all. Settings, + + /// The map: show it, edit it, look at another level or area, find a room, stop a walk. + Map, + + /// The panels a layout places (who is here, vitals, quick bar, the docked composer), and popping them out. + Panels, + + /// Writing: the composer, command history, the second command line, the newline, the dictionary. + Compose, + + /// Help and setting up: help, the welcome, the key tour, import, packages. + Help, } /// diff --git a/src/SharpMUTerm.Tui/ClientRowRenderer.cs b/src/SharpMUTerm.Tui/ClientRowRenderer.cs new file mode 100644 index 00000000..80aa0118 --- /dev/null +++ b/src/SharpMUTerm.Tui/ClientRowRenderer.cs @@ -0,0 +1,21 @@ +namespace SharpMUTerm.Tui; + +/// +/// One row the client itself writes into a window — a reconnect counting down, a room a search found where no screen is +/// read — drawn the way the boundary bars are (): a label in the accent, the words muted, +/// a rule to the pane's edge. Not a session line: it goes into the pane buffer as chrome (AppendClientRow), so it +/// reaches no transcript, restore log, scene log, trigger or ⌃F search, and a theme change recolours it with the bars. +/// Replaces the *** lines these used to print, which read as the game's own text and were logged as it. +/// Pure, so the markup is unit-testable without a terminal. +/// +internal static class ClientRowRenderer +{ + /// The row for and , on an already-resolved #rrggbb accent. + public static string Bar(string label, string text, string accentHex, int width = 0) + { + ArgumentException.ThrowIfNullOrEmpty(label); + ArgumentException.ThrowIfNullOrEmpty(accentHex); + var (words, rule) = BarRule.Fit(label.Length + 4, text, width); + return $"[{accentHex}]› {MarkupText.Escape(label)}[/] [dim]{MarkupText.Escape(words)} {BarRule.Rule(rule)}[/]"; + } +} diff --git a/src/SharpMUTerm.Tui/ExternalBrowser.cs b/src/SharpMUTerm.Tui/ExternalBrowser.cs index 6bd7686e..9051c8a0 100644 --- a/src/SharpMUTerm.Tui/ExternalBrowser.cs +++ b/src/SharpMUTerm.Tui/ExternalBrowser.cs @@ -72,4 +72,45 @@ internal static void Open(string url) Process.Start(new ProcessStartInfo(target) { UseShellExecute = true })?.Dispose(); } + + /// The kinds of file hands to the desktop: what a transcript or scene log is written as. + internal static readonly IReadOnlyList OpenableFileExtensions = [".html", ".htm", ".txt", ".log"]; + + /// + /// Whether is a file this client will hand to the desktop, and its full form if so: an + /// absolute path to an existing regular file whose extension is one a log is written as. Never a script, a + /// .desktop entry or an executable, whatever asks — the desktop's handler for those would run them. + /// + internal static bool TryParseOpenableFile(string? path, out string full) + { + full = string.Empty; + if (string.IsNullOrWhiteSpace(path) || !Path.IsPathFullyQualified(path) || path.Contains('\0')) + { + return false; + } + + var resolved = Path.GetFullPath(path); + if (!OpenableFileExtensions.Contains(Path.GetExtension(resolved).ToLowerInvariant()) || !File.Exists(resolved)) + { + return false; + } + + full = resolved; + return true; + } + + /// + /// Opens a log file the client wrote in the desktop's viewer for its kind (a browser for HTML, an editor for text), + /// with the same shell-execute and the same gate-in-the-launcher rule as . + /// + /// The path is not an existing log file (). + internal static void OpenFile(string path) + { + if (!TryParseOpenableFile(path, out var target)) + { + throw new ArgumentException($"not a log file this client opens: {path}", nameof(path)); + } + + Process.Start(new ProcessStartInfo(target) { UseShellExecute = true })?.Dispose(); + } } diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 35b28501..59099085 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -42,6 +42,13 @@ internal sealed record ClientHost /// Opens an http(s) link in the desktop's browser, or null for a client that refuses and says so. public required Action? OpenUrl { get; init; } + /// + /// Opens a file the client wrote (a saved scene log) in the desktop's viewer for it, or null for a client that refuses + /// and says so. The client checks the file is its own (under the log root); the opener refuses anything but a log's + /// own kinds of file (). + /// + public required Action? OpenFile { get; init; } + /// Whether to ask for terminal focus reports (). public required bool FocusReporting { get; init; } @@ -188,6 +195,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) // Win32), so a copy lands whether the client is local or on the far end of an ssh session. Clipboard = SharpConsoleUI.Helpers.ClipboardHelper.SetText, OpenUrl = ExternalBrowser.Open, + OpenFile = ExternalBrowser.OpenFile, FocusReporting = PlatformDecodesFocusReports, Keys = HostKeys.Terminal, Pointer = TerminalPointer.Create(driver), @@ -219,6 +227,7 @@ public static ClientHost Terminal(TerminalCapabilities capabilities) Capabilities = capabilities, Clipboard = null, OpenUrl = null, + OpenFile = null, FocusReporting = false, Keys = HostKeys.Terminal, Pointer = null, @@ -282,6 +291,7 @@ internal static ClientHost HarnessTerminal( { Clipboard = clipboard, OpenUrl = openUrl, + OpenFile = null, // a test never opens a viewer FocusReporting = focusReporting ?? PlatformDecodesFocusReports, Audio = null, // a test never makes a noise Presence = null, // nor talks to Discord diff --git a/src/SharpMUTerm.Tui/Hosting/PlainHost.cs b/src/SharpMUTerm.Tui/Hosting/PlainHost.cs index 1917ce7d..92855c1e 100644 --- a/src/SharpMUTerm.Tui/Hosting/PlainHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/PlainHost.cs @@ -25,6 +25,7 @@ public static ClientHost Create(TerminalCapabilities capabilities, TextWriter ou { Name = "plain", OpenUrl = ExternalBrowser.Open, + OpenFile = ExternalBrowser.OpenFile, RunsInline = false, Audio = () => DesktopAudio.TryCreate(), Presence = () => new DiscordIpc(), diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs index 56b30bf7..d79d7bcc 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs @@ -71,8 +71,13 @@ private void PublishNotice(NoticeModel notice) return; } - if (notice.Action is { } action) + foreach (var action in new[] { notice.Action, notice.Second }) { + if (action is null) + { + continue; + } + _noticeActionsOffered.Add(action.Command); if (_noticeActionsOffered.Count > NoticeActionsKept) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs index 2de7e3bd..1f231270 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs @@ -129,7 +129,8 @@ internal void SelectMapRoom(string windowId, long? room) RenderMap(windowId); if (entering) { - Notice("map: ←↑→↓ select · r rename · l lock · Del delete · u undo · Esc done", MessageSeverity.Info, "⌃P", source: NoticeModel.Sources.Map); + // Not toasted: the window's map inspector shows these as buttons; the status row says them for the cells. + Notice("map: ←↑→↓ select · r rename · l lock · Del delete · u undo · Esc done", MessageSeverity.Info, source: NoticeModel.Sources.Map, toast: false); } } @@ -183,7 +184,10 @@ private void LeaveMapEdit(string windowId) } RenderMap(windowId); - Notice(result.Message + ".", result.Done ? MessageSeverity.Info : MessageSeverity.Warning, source: NoticeModel.Sources.Map); + + // A done edit is said on the status row and not toasted: the map shows it, and so does the window's inspector, so a + // toast per edit only stacked over the map. A refusal is still toasted — nothing else says it. + Notice(result.Message + ".", result.Done ? MessageSeverity.Info : MessageSeverity.Warning, source: NoticeModel.Sources.Map, toast: !result.Done); return result.Done ? null : result.Message; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs index f480bdcf..9a9eff30 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MapView.cs @@ -20,6 +20,70 @@ internal sealed partial class SharpMUTermApp /// Where each map window looks, when it is not where its character is. private readonly Dictionary _mapLooks = new(StringComparer.Ordinal); + /// + /// The rooms the last /map find listed, and whose map they are on: ⌃P's Walk to … entries + /// (), for the run. Replaced by the next search. + /// + private (string SessionKey, IReadOnlyList Rooms)? _mapFound; + + /// The rooms ⌃P offers to walk to, for the catalog. + private IReadOnlyList? MapFoundRooms() => _mapFound?.Rooms; + + /// + /// A search's answer: a picker, not lines in the output. The rooms become ⌃P entries (Walk to …, the client's own + /// commands, run by the registry) and the palette opens listing them, so ⏎ walks — in the cells and in the window's + /// native palette alike, from the one model. Nothing is a link in a pane: the panes' link handler takes server text, + /// and a client action reached through it would be a new trust path. Where no screen is seen (--plain) a + /// modal would take the reader's typing, so the rooms are said as client rows instead (never session lines: they + /// reach no transcript, restore log, trigger or search). + /// + private void ShowFoundRooms(string windowId, string sessionKey, string text, IReadOnlyList rooms, int total) + { + _mapFound = (sessionKey, [.. rooms.Select(r => new Core.Commands.FoundRoom(r.Id, r.Name, r.Area, r.Level))]); + var shown = total > rooms.Count + ? $"the first {rooms.Count.ToString(CultureInfo.InvariantCulture)} of {total.ToString(CultureInfo.InvariantCulture)}" + : total.ToString(CultureInfo.InvariantCulture); + if (!Host.ScreenIsSeen) + { + AppendClientRow(windowId, "FIND", $"rooms matching {text} ({shown}) · /walk goes there"); + foreach (var room in rooms) + { + var where = (room.Area is { } area ? area + " · " : string.Empty) + "level " + room.Level.ToString(CultureInfo.InvariantCulture); + AppendClientRow(windowId, room.Id.ToString(CultureInfo.InvariantCulture), $"{room.Name} · {where}"); + } + + return; + } + + Notice($"{shown} room{(total == 1 ? string.Empty : "s")} match {text} — ⏎ walks to one", MessageSeverity.Info, source: NoticeModel.Sources.Map, toast: false); + OpenMenu(Client.Commands.BuiltInCommands.MapWalkQuery); + } + + /// ⌃P ▸ Walk to …: walks the found room's own character there, whichever window is focused. + private bool WalkToFoundRoom(string id) + { + if (_mapFound is not { } found + || !long.TryParse(id, NumberStyles.Integer, CultureInfo.InvariantCulture, out var room) + || !found.Rooms.Any(r => r.Id == room)) + { + RefuseCommand("that room is not in the last /map find"); + return true; + } + + if (MapOf(found.SessionKey) is not { } map) + { + RefuseCommand("no map here: that character has no connection"); + return true; + } + + if (map.WalkTo(room) is { } problem) + { + Notice($"cannot walk there: {problem}.", source: NoticeModel.Sources.Map); + } + + return true; + } + /// The window's look callback, one instance per map window so an overlay compares equal frame to frame. private readonly Dictionary> _mapLookers = new(StringComparer.Ordinal); @@ -45,7 +109,8 @@ internal sealed partial class SharpMUTermApp SetMapLook(windowId, map, result.Next); } - Notice(result.Message + ".", result.Done ? MessageSeverity.Info : MessageSeverity.Warning, source: NoticeModel.Sources.Map); + // The map itself shows a level or area it moved to; only a refusal is toasted (ApplyMapEdit's rule). + Notice(result.Message + ".", result.Done ? MessageSeverity.Info : MessageSeverity.Warning, source: NoticeModel.Sources.Map, toast: !result.Done); return result.Done ? null : result.Message; } @@ -158,25 +223,19 @@ private void MapViewCommand(string windowId, SessionMap map, string sessionKey, var text = words.Length > 4 ? words[4..].Trim() : string.Empty; if (text.Length == 0) { - AppendWindowLine(windowId, "[dim]*** use /map find .[/]"); + Notice("use /map find .", source: NoticeModel.Sources.Map); return; } var (rooms, total) = MapLooking.Find(map.Map, text); if (rooms.Count == 0) { - AppendWindowLine(windowId, $"[dim]*** no room on the map matches {Escape(text)}.[/]"); + _mapFound = null; + Notice($"no room on the map matches {text}.", source: NoticeModel.Sources.Map); return; } - var shown = total > rooms.Count ? $"the first {rooms.Count.ToString(CultureInfo.InvariantCulture)} of {total.ToString(CultureInfo.InvariantCulture)}" : total.ToString(CultureInfo.InvariantCulture); - AppendWindowLine(windowId, $"[dim]*** rooms matching {Escape(text)} ({shown}) · /walk goes there:[/]"); - foreach (var room in rooms) - { - var where = (room.Area is { } area ? Escape(area) + " · " : string.Empty) + "level " + room.Level.ToString(CultureInfo.InvariantCulture); - AppendWindowLine(windowId, $"[dim]***[/] [bold]{room.Id.ToString(CultureInfo.InvariantCulture)}[/] {Escape(room.Name)} [dim]{where}[/]"); - } - + ShowFoundRooms(windowId, sessionKey, text, rooms, total); // The map shows the first match's area and level, so the room found is on screen. var first = rooms[0]; var home = map.Recorder.CurrentRoom ?? map.Map.Rooms.Values.LastOrDefault(); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs index cf6b037d..a3279f44 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs @@ -61,7 +61,7 @@ private void OnReconnectStep(WorldSession session, AutoReconnect auto, Reconnect switch (step) { case ReconnectStep.Scheduled when auto.SecondsLeft is { } seconds: - session.PrintSystem(ReconnectLine(seconds, auto.Try)); + SayInSessionWindow(session, ReconnectLabel, ReconnectLine(seconds, auto.Try)); Notice( $"{title} dropped — reconnecting in {seconds} s · ⌥R now", MessageSeverity.Info, @@ -70,7 +70,7 @@ private void OnReconnectStep(WorldSession session, AutoReconnect auto, Reconnect break; case ReconnectStep.GaveUp: - session.PrintSystem($"*** Stopped reconnecting after {AutoReconnect.Delays.Count} tries — ⌥R dials again."); + SayInSessionWindow(session, ReconnectLabel, $"stopped after {AutoReconnect.Delays.Count} tries · ⌥R dials again"); Notice($"{title} did not come back after {AutoReconnect.Delays.Count} tries — ⌥R dials again", MessageSeverity.Error, "⌥R"); break; } @@ -120,7 +120,40 @@ private void OnReconnectTick() /// The line a session's window gets when a try is scheduled; one writer for the live session and the demo's. internal static string ReconnectLine(int seconds, int attempt) => - $"*** Reconnecting in {seconds} s (try {attempt} of {AutoReconnect.Delays.Count}) — ⌥R dials now, ⌃P ▸ Stop reconnecting."; + $"in {seconds} s · try {attempt} of {AutoReconnect.Delays.Count} · ⌥R dials now · ⌃P ▸ Stop reconnecting"; + + /// The label of every row a reconnect writes into its session's window. + internal const string ReconnectLabel = "RECONNECT"; + + /// + /// Writes a client row into 's own window (): chrome, not a + /// session line, so the client's own bookkeeping never lands in the character's transcript or restore log. + /// + private void SayInSessionWindow(WorldSession session, string label, string text) + { + if (_sessionWindows.TryGetValue(session, out var windowId)) + { + AppendClientRow(windowId, label, text); + } + } + + /// + /// Appends one client row () to a window: drawn as the bars are, held as chrome (a bar + /// function and no plain text), with no stamp, because it did not arrive. Fed to nothing a session line is fed to. + /// + private void AppendClientRow(string windowId, string label, string text) + { + if (BarWidth(windowId) <= 0) + { + // Not arranged yet: drawn at the fallback width, so the next frame must redraw it at the pane's. + _chromeBarWidths.Remove(windowId); + } + + AppendWindowLine( + windowId, + ClientRowRenderer.Bar(label, text, FrozenAccentHex(), BarWidth(windowId)), + bar: accent => ClientRowRenderer.Bar(label, text, accent, BarWidth(windowId))); + } /// The demo scene's waiting reconnect, in seconds: the `reconnect` view's, which has no live session to drop. private int? _demoReconnect; @@ -135,7 +168,7 @@ private void ShowDemoReconnect() AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connection lost: Connection reset by peer", WorldSession.SystemLineStyle), StampNow()); AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connecting to aetherfall.mux:4201...", WorldSession.SystemLineStyle), StampNow()); AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connection failed: Connection refused", WorldSession.SystemLineStyle), StampNow()); - AppendWindowLine(MainWindowId, StyledLine.FromText(ReconnectLine(12, 2), WorldSession.SystemLineStyle), StampNow()); + AppendClientRow(MainWindowId, ReconnectLabel, ReconnectLine(12, 2)); _statusIdentity = ("Corvid", "aetherfall.mux", 4201, "faulted"); RefreshStatusBar(); SettleScroll(); @@ -158,7 +191,7 @@ private void StopReconnectCommandRun() { if (SendTarget() is { } session && CancelReconnect(session)) { - session.PrintSystem("*** Stopped reconnecting."); + SayInSessionWindow(session, ReconnectLabel, "stopped · ⌥R dials again"); Notice($"stopped reconnecting {SessionTitle(session)} — ⌥R dials it", MessageSeverity.Info, "⌥R"); return; } @@ -166,7 +199,7 @@ private void StopReconnectCommandRun() // The notice's action can arrive after focus moved: any one waiting is the one the notice was about. if (_reconnects.FirstOrDefault(r => r.Value.IsActive) is { Key: { } other } && CancelReconnect(other)) { - other.PrintSystem("*** Stopped reconnecting."); + SayInSessionWindow(other, ReconnectLabel, "stopped · ⌥R dials again"); Notice($"stopped reconnecting {SessionTitle(other)}", MessageSeverity.Info); return; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.SceneLog.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.SceneLog.cs index e25acf37..00dbb044 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.SceneLog.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.SceneLog.cs @@ -20,6 +20,33 @@ namespace SharpMUTerm.Tui; /// internal sealed partial class SharpMUTermApp { + /// The status row's mark while a scene records (). + internal const string RecordingCell = SharpMUTerm.Client.Chrome.HeaderModel.RecordingText; + + /// A saved scene's notice action: open it. + internal const string SceneOpenPrefix = SharpMUTerm.Client.Commands.BuiltInCommands.SceneOpenPrefix; + + /// A saved scene's notice action: copy its path. + internal const string SceneCopyPrefix = SharpMUTerm.Client.Commands.BuiltInCommands.SceneCopyPrefix; + + /// + /// The files this run's scene logs were saved to, in order: what a saved notice's scene:open:N and + /// scene:copy:N name by index, so no path ever travels in a command id. + /// + private readonly List _savedScenes = []; + + /// Whether any window is being recorded as a scene: the status row's and the header's mark. + internal bool SceneRecording + { + get + { + lock (_sceneLogs) + { + return _sceneLogs.Count > 0; + } + } + } + /// The scenes being recorded, by window. private readonly Dictionary _sceneLogs = new(StringComparer.Ordinal); @@ -86,10 +113,11 @@ internal void StartSceneLog() _sceneLogs[windowId] = log; } + SceneMarkChanged(); Notice( $"Recording {Snippet(title)} as a scene ({(_config.SceneLog.Content == SceneLogContent.Poses ? "poses" : "every line")}) → {log.Path}", MessageSeverity.Info, - "⌃P"); + source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Scene); } /// Stops the focused window's scene log, writing its ending and closing the file. @@ -109,7 +137,101 @@ internal void StopSceneLog() } log.Stop(_time.GetLocalNow()); - Notice($"Scene saved · {log.Lines} line{(log.Lines == 1 ? string.Empty : "s")} · {log.Path}", MessageSeverity.Info, "⌃P"); + SceneMarkChanged(); + _savedScenes.Add(log.Path); + var index = (_savedScenes.Count - 1).ToString(System.Globalization.CultureInfo.InvariantCulture); + Notice( + $"Scene saved · {log.Lines} line{(log.Lines == 1 ? string.Empty : "s")} · {log.Path}", + MessageSeverity.Info, + source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Scene, + action: new SharpMUTerm.Client.Chrome.NoticeAction(SceneOpenPrefix + index, "Open"), + second: new SharpMUTerm.Client.Chrome.NoticeAction(SceneCopyPrefix + index, "Copy path")); + } + + /// Redraws the two places the recording mark is shown, after a scene starts or stops. + private void SceneMarkChanged() + { + RefreshHeader(); + RefreshStatusBar(); + } + + /// The saved scene a notice action names by index, or null when the index names none this run saved. + private string? SavedScene(string index) => + int.TryParse(index, System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, out var at) + && at >= 0 && at < _savedScenes.Count ? _savedScenes[at] : null; + + /// + /// A saved scene's Open: handed to the desktop's viewer through the host's file opener, and only a file under + /// this client's own log root — the scene folder is the only place a scene is written, and an index the client + /// assigned is the only way to name one, so nothing a server sent can choose what is opened. + /// + private bool OpenSavedScene(string index) + { + if (SavedScene(index) is not { } path) + { + RefuseCommand("no such saved scene"); + return true; + } + + if (_openFile is null) + { + RefuseCommand($"this client opens no files — the scene is at {path}"); + return true; + } + + if (!IsUnderLogRoot(path) || !File.Exists(path)) + { + RefuseCommand($"the scene is no longer at {path}"); + return true; + } + + try + { + _openFile(path); + } + catch (Exception ex) when (ex is ArgumentException or InvalidOperationException or System.ComponentModel.Win32Exception or IOException) + { + RefuseCommand($"could not open {path}: {ex.Message}"); + } + + return true; + } + + /// A saved scene's Copy path, through the client's clipboard; refused out loud where there is none. + private bool CopySavedScenePath(string index) + { + if (SavedScene(index) is not { } path) + { + RefuseCommand("no such saved scene"); + return true; + } + + if (_clipboard is null) + { + RefuseCommand($"this client has no clipboard — the scene is at {path}"); + return true; + } + + _clipboard(path); + Notice($"copied {path}", MessageSeverity.Info); + return true; + } + + /// Whether is inside this client's log root, after resolving it (no .. escapes). + private bool IsUnderLogRoot(string path) + { + if (_logRoot is null) + { + return false; + } + + var root = Path.GetFullPath(_logRoot); + if (!root.EndsWith(Path.DirectorySeparatorChar)) + { + root += Path.DirectorySeparatorChar; + } + + return Path.GetFullPath(path).StartsWith(root, StringComparison.Ordinal); } /// A line a window showed: the scene recording that window, if any, decides whether to keep it. @@ -135,6 +257,7 @@ private void RecordForScene(string windowId, StyledLine line) _sceneLogs.Remove(windowId); } + SceneMarkChanged(); RefuseCommand($"the scene log stopped: {ex.Message}"); } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 7220e616..295f88df 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -513,6 +513,9 @@ private sealed class SizeReport /// private readonly Action? _openUrl; + /// The host's file opener for a saved scene (), or null. + private readonly Action? _openFile; + /// /// Where a copied selection goes, or null when this app may not reach a clipboard at all. /// @@ -741,6 +744,7 @@ public SharpMUTermApp( _startedEmpty = config.Worlds.Count == 0; _save = save; _openUrl = host.OpenUrl; + _openFile = host.OpenFile; _clipboard = host.Clipboard; _pointer = host.Pointer; _logRoot = string.IsNullOrWhiteSpace(logRoot) ? null : logRoot; @@ -1990,7 +1994,7 @@ public string RenderSnapshot(string? view = null) new NoticeAction(Client.Commands.LayoutCommands.Manage, "Change layout")); RefusePrefix(PrefixPanel.NoSplitRefusal); Notice("muted.", MessageSeverity.Info, source: SharpMUTerm.Client.Chrome.NoticeModel.Sources.Sound); - Notice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error, "⌃P"); + Notice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error, action: ShowMessagesAction); } // The map window, over the demo's recorded streets: opened through the real ⌃P entry; `map-walking` @@ -2993,7 +2997,7 @@ private async Task DialAtStartupAsync(WorldSession session) OnUi(() => Notice( $"could not connect {SessionTitle(session)} — {Snippet(ex.Message)}", MessageSeverity.Error, - "⌃P")); + action: ShowMessagesAction)); } } @@ -3585,7 +3589,8 @@ private void AppendWindowLine( // every line of every window (see PaneLine.Plain). A world's line is read from its spans, not from the // markup: the markup carries the client's own decoration (a highlight's `▌ ` left rule), and a search or a // trigger's live test that saw it would miss `^[public]` on the very line that rule highlighted. - buffer.Add(new PaneLine(markup, stamp, source?.Text ?? MarkupText.Plain(markup), imageAnchor, pictures, source, bar)); + // A chrome row (one drawn by a bar function) carries no plain text, so ⌃F never finds the client's own rows. + buffer.Add(new PaneLine(markup, stamp, bar is not null ? string.Empty : source?.Text ?? MarkupText.Plain(markup), imageAnchor, pictures, source, bar)); // Cap what the pane holds, and trim its control with it. The control re-parses every line it @@ -8503,7 +8508,9 @@ private CommandContext CommandState() Floats: FloatRefs(), RaggedWraps: RaggedWraps(), NoDictionary: NoOwnDictionary, - SceneLogging: _sceneLogs.ContainsKey(ActiveWindowId())); + SceneLogging: _sceneLogs.ContainsKey(ActiveWindowId()), + NewConfiguration: _config.Worlds.Count == 0 || _config.KeyTourPending, + MapFound: MapFoundRooms()); } /// @@ -8774,6 +8781,21 @@ private bool RunBuiltInCommand(string id) return true; } + if (id.StartsWith(SharpMUTerm.Client.Commands.BuiltInCommands.MapWalkPrefix, StringComparison.Ordinal)) + { + return WalkToFoundRoom(id[SharpMUTerm.Client.Commands.BuiltInCommands.MapWalkPrefix.Length..]); + } + + if (id.StartsWith(SceneOpenPrefix, StringComparison.Ordinal)) + { + return OpenSavedScene(id[SceneOpenPrefix.Length..]); + } + + if (id.StartsWith(SceneCopyPrefix, StringComparison.Ordinal)) + { + return CopySavedScenePath(id[SceneCopyPrefix.Length..]); + } + if (id.StartsWith(SharpMUTerm.Client.Commands.BuiltInCommands.JoinWrapsPrefix, StringComparison.Ordinal)) { return JoinWrapsFor(id[SharpMUTerm.Client.Commands.BuiltInCommands.JoinWrapsPrefix.Length..]); @@ -9093,6 +9115,12 @@ private bool RunBuiltInCommand(string id) /// private void RefuseCommand(string reason) => Notice(reason, MessageSeverity.Warning, "⌃P"); + /// + /// A failure's action: the message log, where the whole story is. In place of a bare ⌃P chip, which named a key + /// and not what it would do. + /// + private static readonly NoticeAction ShowMessagesAction = new("term:messages", "Show messages"); + /// /// The task the last dispatched command started, or a completed one when it ran synchronously. /// Internal so a headless test can await a connect it dispatched rather than poll for it; the app @@ -9692,7 +9720,7 @@ private async Task ReconnectAsync(WorldSession session) { if (session.State is ConnectionState.Connected or ConnectionState.Connecting) { - session.PrintSystem("*** Reconnecting..."); + SayInSessionWindow(session, ReconnectLabel, "dialling again"); await session.DisconnectAsync().ConfigureAwait(false); } @@ -9720,7 +9748,7 @@ private async Task ReconnectAsync(WorldSession session) OnUi(() => Notice( $"could not connect to {session.World.Host}:{session.World.Port} — {ex.Message}", MessageSeverity.Error, - "⌃P")); + action: ShowMessagesAction)); } } @@ -9741,7 +9769,7 @@ private void Disconnect() // Not connected but waiting to dial again: Disconnect means "stay disconnected". if (CancelReconnect(session)) { - session.PrintSystem("*** Stopped reconnecting."); + SayInSessionWindow(session, ReconnectLabel, "stopped · ⌥R dials again"); Notice($"stopped reconnecting {SessionTitle(session)} — ⌥R dials it", MessageSeverity.Info, "⌥R"); return; } @@ -13856,12 +13884,17 @@ private void SetStatus(string markup, bool displace = false) /// A command the notice offers. The status row never draws it (a terminal cell is not a button, and the text /// already names the key); a host that draws notices natively offers it as a click (). /// - private void Notice(string text, MessageSeverity severity = MessageSeverity.Warning, string? key = null, NoticeAction? action = null, string? source = null) + /// + /// False keeps the notice off a host's toast stack: the status row still says it and the message log keeps it. For a + /// notice the surface it answers already shows (a map edit, under the window's map inspector). + /// + /// A second command the notice offers, after . + private void Notice(string text, MessageSeverity severity = MessageSeverity.Warning, string? key = null, NoticeAction? action = null, string? source = null, bool toast = true, NoticeAction? second = null) { // The same notice raised again while it is still up is one notice: it keeps the row for another few seconds and // is not said, toasted or announced a second time. Two identical toasts stacked in the window were the report. if (_notice is not null && _noticeShown is { } shown && shown.Text == text && shown.Key == key && shown.Source == source - && shown.Severity == NoticeSeverityOf(severity) && shown.Action == action) + && shown.Severity == NoticeSeverityOf(severity) && shown.Action == action && shown.Second == second) { _noticeTimer?.Change(NoticeDuration, Timeout.InfiniteTimeSpan); return; @@ -13884,13 +13917,19 @@ private void Notice(string text, MessageSeverity severity = MessageSeverity.Warn var model = Drawing( SurfaceCatalog.Notice, string.Empty, - new NoticeModel(text, NoticeSeverityOf(severity), source is null ? key : null, action, _time.GetUtcNow(), ++_noticeSequence, source)); + new NoticeModel(text, NoticeSeverityOf(severity), source is null ? key : null, action, _time.GetUtcNow(), ++_noticeSequence, source) + { + Second = action is null ? null : second, + }); var markup = NoticeMarkup(model); _notice = markup; _noticeShown = model; PaintStatus(markup); - PublishNotice(model); + if (toast) + { + PublishNotice(model); + } _noticeTimer ??= _time.CreateTimer( _ => OnUiThread(ClearNotice), null, Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); _noticeTimer.Change(NoticeDuration, Timeout.InfiniteTimeSpan); @@ -13902,6 +13941,9 @@ private void Notice(string text, MessageSeverity severity = MessageSeverity.Warn /// internal ClientMessageLog Messages => _messages; + /// Lifts the notice off the row now, as its timer would; for a test reading the resting row under it. + internal void ClearNoticeForTest() => ClearNotice(); + /// Lifts the notice off the row, putting the resting line back under it. private void ClearNotice() { @@ -13926,7 +13968,9 @@ private string NotConnectedMarkup() { var scrollback = ScrollbackStatus(); var suffix = scrollback.Length == 0 ? string.Empty : $" {scrollback}"; - var row = $"[dim]not connected · Graphics {Escape(_capabilities.Protocol.ToString())} · ⌃P palette · ⌃Q quit[/]{suffix}"; + // No graphics readout: which protocol the probe chose is a startup fact (--help and the session's first line say it), and on a + // first run it was the one technical word on the screen. + var row = $"[dim]not connected · ⌃P palette · ⌃Q quit[/]{suffix}"; // A client with nothing connected is still read back through, frozen and searched: the mode's keys go on // the end where they fit, the longest that does. @@ -14028,6 +14072,7 @@ internal HeaderModel BuildHeaderModel() _prefixArmed) { Prefix = _prefixArmed ? PrefixPanel.Model(PrefixFactsNow()) : null, + Recording = SceneRecording, }; } @@ -14337,6 +14382,13 @@ private string StatusBarMarkup(string character, string state) right.Add(scrollback); } + // While a scene is being recorded (⌃P ▸ Start scene log), in any window: a three-hour scene is easy to forget. + // Only by a keystroke, like the mute cell below, so it needs no reserved width; and never given up for room. + if (SceneRecording) + { + right.Add($"[{HeldOn(ScreenPalette.Warn, WorkspacePalette.Backdrop(_theme))}]{RecordingCell}[/]"); + } + // Only while muted, and only by a keystroke: nothing from the wire can make this cell appear. if (_muted) { diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index b187f2fe..fbe5a622 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -20,7 +20,7 @@ namespace SharpMUTerm.Tui; internal static class WorldsScreenRenderer { private const int LeftColumnWidth = 28; - private const int WorldLabelWidth = 9; + private const int WorldLabelWidth = 16; private const int CharLabelWidth = 10; private const int CharDetailColumnWidth = 40; @@ -69,55 +69,55 @@ internal static class WorldsScreenRenderer /// : the GMCP modules asked for beyond the client's own, as a /// comma-separated list of Name Version. /// - internal const int GmcpModulesField = 5; + internal const int GmcpModulesField = 7; /// , as . internal const int ContentField = 6; /// 's three switches, as one of . - internal const int EmojiField = 7; + internal const int EmojiField = 10; /// : the line naming a room, for a game that sends no GMCP room. - internal const int MapRoomField = 8; + internal const int MapRoomField = 17; /// : the line listing a room's exits. - internal const int MapExitsField = 9; + internal const int MapExitsField = 18; /// : a line that stops a speedwalk. - internal const int WalkFailField = 10; + internal const int WalkFailField = 19; /// , as one of . - internal const int SoundsField = 11; + internal const int SoundsField = 20; /// : the line prefix a MUSH hands text back to edit with. - internal const int GrabField = 12; + internal const int GrabField = 13; /// , as one of . - internal const int GmcpLoginField = 13; + internal const int GmcpLoginField = 8; /// , as one of . - internal const int DiscordField = 14; + internal const int DiscordField = 9; /// : the layout this world's characters use, or the suggestion. - internal const int WorldLayoutField = 15; + internal const int WorldLayoutField = 21; /// , as one of . - internal const int JoinWrapsField = 16; + internal const int JoinWrapsField = 11; /// , as one of . - internal const int ReconnectField = 17; + internal const int ReconnectField = 5; /// , as one of . - internal const int StackingField = 18; + internal const int StackingField = 12; /// , as one of . - internal const int AlertOnField = 19; + internal const int AlertOnField = 14; /// , as one of . - internal const int CaptureChannelsField = 20; + internal const int CaptureChannelsField = 15; /// : Name=colour, …. - internal const int HighlightNamesField = 21; + internal const int HighlightNamesField = 16; /// F5's words for . internal static readonly IReadOnlyList ChannelCaptureChoices = WorldFieldValues.ChannelCaptureChoices; @@ -778,9 +778,12 @@ .. SecurityFieldOrder.Select(id => ScreenRow.Of(DeclaredFields.Toggle(DeclaredFi /// internal static readonly IReadOnlyList WorldFieldOrder = [ - "name", "host", "port", "encoding", "keepalive", "gmcp-modules", "content", "emoji", "map-room", "map-exits", - "walk-fail", "sounds", "edit-grab", "gmcp-login", "discord", "layout", "join-wraps", "reconnect", "stacking", + "name", "host", "port", "encoding", "keepalive", "reconnect", + "content", "gmcp-modules", "gmcp-login", "discord", + "emoji", "join-wraps", "stacking", "edit-grab", "alert-on", "capture-channels", "highlight-names", + "map-room", "map-exits", "walk-fail", + "sounds", "layout", ]; /// The world's two security checkboxes, drawn in the WORLD block (), by declared id. @@ -930,7 +933,7 @@ internal static List WorldsColumn( left.Add(ScreenChrome.Cursor( $"{marker} [{accentHex}]▚[/] {name}", cursor.IsOn(WorldsPane, i), LeftColumnWidth)); left.Add($" [{Label}]{Escape(world.Host)}:{world.Port.ToString(CultureInfo.InvariantCulture)}[/]"); - left.Add($" [{Label}]{world.Characters.Count.ToString(CultureInfo.InvariantCulture)} chars[/]"); + left.Add($" [{Label}]{world.Characters.Count.ToString(CultureInfo.InvariantCulture)} character{Plural(world.Characters.Count)}[/]"); } if (worlds.Count == 0) @@ -987,89 +990,68 @@ internal static List DetailColumn( // where they are displayed, so it is where an open edit draws its caret. No title strip above // them: every token of one would be repeated in the rows underneath and in the WORLDS list beside // it, and the rows it cost are rows the CHARACTERS list needs at 100x24. - var right = new List + // Each world field's cell, by declared id. They are drawn in the declaration's order under its group headings + // (BuiltInSettings.World), with the declared labels, so this column and the desktop's settings window read the + // same; WorldFieldOrder is that order too, so ⇥ walks down the column rather than jumping about it. + var cells = new Dictionary(StringComparer.Ordinal) { - $"[{accent}]├ WORLD[/]", - WorldField("name", Field( - $"[{Value}]{Escape(world.Name)}[/]", cursor, selectedWorld, WorldNameField)), - WorldField("host", Field( - $"[{Value}]{Escape(world.Host)}[/]", cursor, selectedWorld, HostField)), - WorldField("port", Field( + ["name"] = Field( + $"[{Value}]{Escape(world.Name)}[/]", cursor, selectedWorld, WorldNameField), + ["host"] = Field( + $"[{Value}]{Escape(world.Host)}[/]", cursor, selectedWorld, HostField), + ["port"] = Field( $"[{Value}]{world.Port.ToString(CultureInfo.InvariantCulture)}[/]", cursor, selectedWorld, - PortField)), - }; - - right.AddRange(SecurityColumn(world, cursor)); - right.AddRange(new[] - { - WorldField("encoding", Field( - EncodingDetail(world.Encoding), cursor, selectedWorld, EncodingField)), - WorldField("keepalive", Field( + PortField), + ["encoding"] = Field( + EncodingDetail(world.Encoding), cursor, selectedWorld, EncodingField), + ["keepalive"] = Field( world.KeepaliveSeconds > 0 ? $"[{Value}]{world.KeepaliveSeconds.ToString(CultureInfo.InvariantCulture)}s[/]" : $"[{Label}]off[/]", cursor, selectedWorld, - KeepaliveField)), - WorldField("gmcp", Field( - JoinModules(world) is { } modules - ? $"[{Value}]{Escape(modules)}[/]" - : $"[{Label}]defaults[/]", + KeepaliveField), + ["reconnect"] = Field( + world.AutoReconnect + ? $"[{Value}]{ReconnectChoices[1]} · 5 s to 60 s, five tries[/]" + : $"[{Label}]{ReconnectChoices[0]} · ⌥R dials again[/]", cursor, selectedWorld, - GmcpModulesField)), - WorldField("content", Field( + ReconnectField), + ["content"] = Field( world.ContentFormat == ContentFormat.Ansi ? $"[{Label}]{ContentName(world.ContentFormat)}[/]" : $"[{Value}]{ContentName(world.ContentFormat)}[/]", cursor, selectedWorld, - ContentField)), - WorldField("emoji", Field( - world.Emoji.Enabled - ? $"[{Value}]{EmojiName(world.Emoji)}[/]" - : $"[{Label}]{EmojiOff}[/]", - cursor, - selectedWorld, - EmojiField)), - WorldField("map room", Field( - PatternDetail(world.Map.RoomNamePattern, "from GMCP"), cursor, selectedWorld, MapRoomField)), - WorldField("map exits", Field( - PatternDetail(world.Map.ExitsPattern, "from GMCP"), cursor, selectedWorld, MapExitsField)), - WorldField("walk fail", Field( - PatternDetail(world.Map.WalkFailurePattern, "timeout only"), cursor, selectedWorld, WalkFailField)), - WorldField("sounds", Field( - world.DownloadMedia ? $"[{Label}]{SoundChoices[0]}[/]" : $"[{Value}]{SoundChoices[1]}[/]", - cursor, - selectedWorld, - SoundsField)), - WorldField("edit grab", Field( - world.GrabPrefix is { } grab - ? $"[{Value}]{Escape(grab)}[/]" - : $"[{Label}]off · e.g. {Escape(SuggestedGrabPrefix)}[/]", + ContentField), + ["gmcp-modules"] = Field( + JoinModules(world) is { } modules + ? $"[{Value}]{Escape(modules)}[/]" + : $"[{Label}]defaults[/]", cursor, selectedWorld, - GrabField)), - WorldField("gmcp login", Field( + GmcpModulesField), + ["gmcp-login"] = Field( world.GmcpLogin ? $"[{Value}]{LoginChoices[1]}[/]" : $"[{Label}]{LoginChoices[0]} · connect line[/]", cursor, selectedWorld, - GmcpLoginField)), - WorldField("discord", Field( + GmcpLoginField), + ["discord"] = Field( world.DiscordPresence ? $"[{Value}]{DiscordChoices[1]}[/]" : $"[{Label}]{DiscordChoices[0]}[/]", cursor, selectedWorld, - DiscordField)), - WorldField("layout", Field( - LayoutName(all, world.Layout) is { } worldLayout - ? $"[{Value}]{Escape(worldLayout)}[/]" - : $"[{Label}]{WorldLayoutDefault} · {Escape(LayoutName(all, world.AcceptedLayoutSuggestion) ?? BuiltInLayouts.Roleplay.Name)}[/]", + DiscordField), + ["emoji"] = Field( + world.Emoji.Enabled + ? $"[{Value}]{EmojiName(world.Emoji)}[/]" + : $"[{Label}]{EmojiOff}[/]", cursor, selectedWorld, - WorldLayoutField)), - WorldField("join wraps", Field( + EmojiField), + ["join-wraps"] = Field( world.JoinWrappedLines ? $"[{Value}]{JoinWrapChoices[1]} lines the server wrapped[/]" : joinWrapsAdvice?.Invoke(world) is { } advice @@ -1077,29 +1059,29 @@ world.GrabPrefix is { } grab : $"[{Label}]{JoinWrapChoices[0]} · rows as the server sent them[/]", cursor, selectedWorld, - JoinWrapsField)), - WorldField("reconnect", Field( - world.AutoReconnect - ? $"[{Value}]{ReconnectChoices[1]} · 5 s to 60 s, five tries[/]" - : $"[{Label}]{ReconnectChoices[0]} · ⌥R dials again[/]", - cursor, - selectedWorld, - ReconnectField)), - WorldField("stacking", Field( + JoinWrapsField), + ["stacking"] = Field( world.CommandSeparator is { } separator ? $"[{Value}]{Escape(separator)} splits · #3 repeats[/]" : $"[{Label}]{SeparatorChoices[0]} · lines go as typed[/]", cursor, selectedWorld, - StackingField)), - WorldField("alert on", Field( + StackingField), + ["edit-grab"] = Field( + world.GrabPrefix is { } grab + ? $"[{Value}]{Escape(grab)}[/]" + : $"[{Label}]off · e.g. {Escape(SuggestedGrabPrefix)}[/]", + cursor, + selectedWorld, + GrabField), + ["alert-on"] = Field( world.AlertOnName ? $"[{Value}]{AlertChoices[1]}[/]" : $"[{Label}]{AlertChoices[0]} · alert triggers only[/]", cursor, selectedWorld, - AlertOnField)), - WorldField("channels", Field( + AlertOnField), + ["capture-channels"] = Field( world.CaptureChannels switch { SharpMUTerm.Core.Protocols.ChannelCaptureMode.Copy => $"[{Value}]{ChannelCaptureChoices[1]} · a window per GMCP channel[/]", @@ -1108,14 +1090,56 @@ world.CommandSeparator is { } separator }, cursor, selectedWorld, - CaptureChannelsField)), - WorldField("names", Field( + CaptureChannelsField), + ["highlight-names"] = Field( SharpMUTerm.Core.Automation.NameHighlights.Format(world.HighlightNames) is { } names ? $"[{Value}]{Escape(names)}[/]" : $"[{Label}]none · e.g. Ashlyn=gold, Merrow=red[/]", cursor, selectedWorld, - HighlightNamesField)), + HighlightNamesField), + ["map-room"] = Field( + PatternDetail(world.Map.RoomNamePattern, "from GMCP"), cursor, selectedWorld, MapRoomField), + ["map-exits"] = Field( + PatternDetail(world.Map.ExitsPattern, "from GMCP"), cursor, selectedWorld, MapExitsField), + ["walk-fail"] = Field( + PatternDetail(world.Map.WalkFailurePattern, "timeout only"), cursor, selectedWorld, WalkFailField), + ["sounds"] = Field( + world.DownloadMedia ? $"[{Label}]{SoundChoices[0]}[/]" : $"[{Value}]{SoundChoices[1]}[/]", + cursor, + selectedWorld, + SoundsField), + ["layout"] = Field( + LayoutName(all, world.Layout) is { } worldLayout + ? $"[{Value}]{Escape(worldLayout)}[/]" + : $"[{Label}]{WorldLayoutDefault} · {Escape(LayoutName(all, world.AcceptedLayoutSuggestion) ?? BuiltInLayouts.Roleplay.Name)}[/]", + cursor, + selectedWorld, + WorldLayoutField), + }; + + var right = new List { $"[{accent}]├ WORLD[/]" }; + string? group = null; + foreach (var field in BuiltInSettings.World.Fields) + { + if (field.Group is { } heading && !string.Equals(heading, group, StringComparison.Ordinal)) + { + group = heading; + right.Add(GroupHeading(heading)); + } + + if (string.Equals(field.Id, SecurityFieldOrder[0], StringComparison.Ordinal)) + { + right.AddRange(SecurityColumn(world, cursor)); + } + else if (cells.TryGetValue(field.Id, out var cell)) + { + right.Add(WorldField(field.Label, cell)); + } + } + + right.AddRange(new[] + { string.Empty, $"[{accent}]├ CHARACTERS[/] [{Label}]a character is a connection[/]", }); @@ -1536,7 +1560,10 @@ private static string CharacterRow(CharacterDefinition character, bool selected) } private static string WorldField(string label, string value) => - $" [{Label}]{label.PadLeft(WorldLabelWidth)}[/] {value}"; + $" [{Label}]{Escape(label).PadLeft(WorldLabelWidth)}[/] {value}"; + + /// A heading over one of the world's declared groups (CONNECTION, MAP), in the label column. + private static string GroupHeading(string group) => $" [bold {Label}]{Escape(group.ToUpperInvariant())}[/]"; /// /// The encoding cell: auto reads as the unremarkable default it is (dimmed, like keepalive's diff --git a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs index c402d8a7..d8f629b2 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs @@ -62,7 +62,7 @@ public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string na using var driver = new AvaloniaConsoleDriver(Width, Height); await using (var window = new SharpMUTermApp( DemoScene.Build(), - WindowHost.Create(driver, clipboard: null, chrome) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, NativePalette = null, RunsInline = true })) + WindowHost.Create(driver, clipboard: null, chrome) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, NativePalette = null, FloatingPanels = null, RunsInline = true })) { window.RenderSnapshot(view); } @@ -101,7 +101,7 @@ public async Task EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning(string n using var driver = new AvaloniaConsoleDriver(Width, Height); await using var window = new SharpMUTermApp( DemoScene.Build(), - WindowHost.Create(driver, clipboard: null, chrome) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, NativePalette = null }); + WindowHost.Create(driver, clipboard: null, chrome) with { Capabilities = Caps, Keys = HostKeys.Terminal, Audio = null, Presence = null, Announcer = null, NativeSettings = null, NativePalette = null, FloatingPanels = null }); window.OnUiThread(() => _ = window.RenderSnapshot(view)); var loop = new Thread(() => window.Run([])) { IsBackground = true }; loop.Start(); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs index c1ccea22..9754aebc 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs @@ -87,6 +87,34 @@ public async Task AToastStacksAboveTheCommandLineAndAClickRunsItsActionWithoutTa await Assert.That(passedThrough).IsTrue().Because("only a toast is hit; the rest of the layer is the cells'"); } + /// A notice with two actions (a saved scene: Open and Copy path) draws both, and a click on the second runs it. + [Test] + public async Task AToastsSecondActionIsDrawnAndAClickOnItRunsIt() + { + var (words, ran) = await Run((window, view, layer, driver) => + { + var ran = new List(); + var model = new NoticeModel("scene saved", NoticeSeverity.Info, null, new NoticeAction("scene:open:0", "Open"), DateTimeOffset.UnixEpoch, 1, NoticeModel.Sources.Scene) + { + Second = new NoticeAction("scene:copy:0", "Copy path"), + }; + ((IPointerPresenter)driver.Pointer).Notice(new NoticeOverlay(model, 8, Palette, ran.Add)); + Drain(); + window.UpdateLayout(); + + var toasts = layer.Toasts; + var words = toasts.DrawnText(); + var on = toasts.TranslatePoint(toasts.SecondAreas()[0].Center, window)!.Value; + window.MouseDown(on, MouseButton.Left); + window.MouseUp(on, MouseButton.Left); + return (words, ran); + }, columns: 80, rows: 12); + + await Assert.That(words.Any(w => w.Contains("Open", StringComparison.Ordinal))).IsTrue(); + await Assert.That(words.Any(w => w.Contains("Copy path", StringComparison.Ordinal))).IsTrue(); + await Assert.That(ran).IsEquivalentTo(new[] { "scene:copy:0" }); + } + [Test] public async Task AToastFadesAfterItsTimeButStaysWhileHovered() { diff --git a/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs b/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs index 7f53fadb..f4ee92ea 100644 --- a/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs @@ -98,7 +98,7 @@ public class CommandPaletteModelTests public async Task AnEmptyQueryListsEveryGroupInItsFixedOrder() { var view = CommandPaletteModel.Build("", Items); - await Assert.That(Headers(view)).IsEquivalentTo(new[] { "GO TO", "OUTPUT", "LAYOUT" }, CollectionOrdering.Matching); + await Assert.That(Headers(view)).IsEquivalentTo(new[] { "GO TO", "OUTPUT", "WINDOWS & PANES" }, CollectionOrdering.Matching); await Assert.That(view.Entries.Count).IsEqualTo(Items.Length); await Assert.That(view.Total).IsEqualTo(Items.Length); } @@ -108,7 +108,7 @@ public async Task LayFindsLayoutsFirst() { var view = CommandPaletteModel.Build("lay", Items); await Assert.That(view.Entries[0].Item.Id).IsEqualTo("layout:layouts"); - await Assert.That(view.Rows[0]).IsEqualTo(new PaletteHeader("LAYOUT")); + await Assert.That(view.Rows[0]).IsEqualTo(new PaletteHeader("WINDOWS & PANES")); } [Test] diff --git a/tests/SharpMUTerm.Client.Tests/PaletteGroupsTests.cs b/tests/SharpMUTerm.Client.Tests/PaletteGroupsTests.cs new file mode 100644 index 00000000..40c9aa2b --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/PaletteGroupsTests.cs @@ -0,0 +1,95 @@ +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Tests; + +/// +/// ⌃P's groups: OUTPUT used to hold forty-odd entries (help, packages, every map and panel command, the composer); the +/// catalog is now grouped by what an entry is about, and a new configuration is pointed at where to start. +/// +public class PaletteGroupsTests +{ + private static IReadOnlyList Catalog(CommandContext? state = null) + { + var registry = new ContributionRegistry(); + BuiltInCommands.Register(registry, _ => true); + return registry.Commands.Catalog(new CommandEnvironment( + state ?? new CommandContext(), + new Workspace(), + Array.Empty(), + null, + Array.Empty(), + HostKeyGlyphs.Terminal)); + } + + private static CommandGroup GroupOf(IReadOnlyList catalog, string id) => catalog.Single(i => i.Id == id).Group; + + [Test] + public async Task EachEntryIsListedUnderWhatItIsAbout() + { + var catalog = Catalog(); + await Assert.That(GroupOf(catalog, BuiltInCommands.HelpCommand)).IsEqualTo(CommandGroup.Help); + await Assert.That(GroupOf(catalog, BuiltInCommands.ImportCommand)).IsEqualTo(CommandGroup.Help); + await Assert.That(GroupOf(catalog, "term:packages")).IsEqualTo(CommandGroup.Help); + await Assert.That(GroupOf(catalog, "term:map")).IsEqualTo(CommandGroup.Map); + await Assert.That(GroupOf(catalog, "map:edit")).IsEqualTo(CommandGroup.Map); + await Assert.That(GroupOf(catalog, "panel:vitals")).IsEqualTo(CommandGroup.Panels); + await Assert.That(GroupOf(catalog, "term:compose")).IsEqualTo(CommandGroup.Compose); + await Assert.That(GroupOf(catalog, "term:history")).IsEqualTo(CommandGroup.Compose); + await Assert.That(GroupOf(catalog, BuiltInCommands.SceneStartCommand)).IsEqualTo(CommandGroup.Terminal); + + // OUTPUT is about output now: a group a reader can scan. + await Assert.That(catalog.Count(i => i.Group == CommandGroup.Terminal)).IsLessThanOrEqualTo(16); + } + + [Test] + public async Task TheGroupsAreListedInTheirFixedOrderWithHelpFirstInItsOwn() + { + var view = CommandPaletteModel.Build(string.Empty, Catalog()); + var headers = view.Rows.OfType().Select(h => h.Label).ToList(); + await Assert.That(headers).IsEquivalentTo( + new[] { "CONNECTION", "OUTPUT", "WRITING", "MAP", "PANELS", "WINDOWS & PANES", "HELP & SETUP" }, + TUnit.Assertions.Enums.CollectionOrdering.Matching); + + var help = view.Entries.First(e => e.Item.Group == CommandGroup.Help); + await Assert.That(help.Item.Id).IsEqualTo(BuiltInCommands.HelpCommand); + } + + [Test] + public async Task ANewConfigurationIsSuggestedHelpWelcomeAndImport() + { + var suggested = CommandPaletteModel.Suggested(new CommandContext(NewConfiguration: true)); + await Assert.That(suggested.Take(3)).IsEquivalentTo( + new[] { BuiltInCommands.HelpCommand, BuiltInCommands.WelcomeCommand, BuiltInCommands.ImportCommand }, + TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(CommandPaletteModel.Suggested(new CommandContext())).DoesNotContain(BuiltInCommands.HelpCommand); + + var view = CommandPaletteModel.Build(string.Empty, Catalog(), suggested: suggested); + await Assert.That(view.Rows[0]).IsEqualTo(new PaletteHeader(CommandPaletteModel.SuggestedLabel)); + await Assert.That(view.Entries[0].Item.Id).IsEqualTo(BuiltInCommands.HelpCommand); + } + + [Test] + public async Task TheRoomsAMapFindListedAreWalkToEntriesThatItsQueryAloneLists() + { + var found = new[] { new FoundRoom(12, "The Grand Plaza", "Aetherfall", 0), new FoundRoom(40, "Plaza Steps", null, 1) }; + var catalog = Catalog(new CommandContext(MapFound: found)); + var walks = catalog.Where(i => i.Id.StartsWith(BuiltInCommands.MapWalkPrefix, StringComparison.Ordinal)).ToList(); + await Assert.That(walks.Select(w => w.Id)).IsEquivalentTo( + new[] { BuiltInCommands.MapWalk(12), BuiltInCommands.MapWalk(40) }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(walks[0].Title).IsEqualTo("Walk to The Grand Plaza"); + await Assert.That(walks[0].Detail).IsEqualTo("Aetherfall · level 0 · #12"); + await Assert.That(walks.All(w => w.Group == CommandGroup.Map)).IsTrue(); + + // The palette opens with the find's query typed in, and lists the rooms and nothing else. + var view = CommandPaletteModel.Build(BuiltInCommands.MapWalkQuery, catalog); + await Assert.That(view.Entries.Select(e => e.Item.Id)).IsEquivalentTo( + walks.Select(w => w.Id), TUnit.Assertions.Enums.CollectionOrdering.Matching); + + // Nothing found, nothing offered. + await Assert.That(Catalog().Any(i => i.Id.StartsWith(BuiltInCommands.MapWalkPrefix, StringComparison.Ordinal))).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs b/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs index 24cfb4f2..b680f862 100644 --- a/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs @@ -133,6 +133,24 @@ public async Task ADropCountsDownOnTheStatusRowAndDialsAgain() await Assert.That(rig.App.BuildCatalog().Select(i => i.Title)).DoesNotContain("Stop reconnecting"); } + /// + /// What a reconnect says in the session's window is a client row drawn like the bars, not a *** session line: + /// it is never in the session's scrollback (so never in a transcript, restore or scene log) and ⌃F does not find it. + /// + [Test] + public async Task AReconnectSaysSoInAClientRowAndNotInTheSessionsLines() + { + var rig = await Open(); + await using var _ = rig.App; + rig.Wire.Drop(new IOException("Connection reset by peer")); + + var window = rig.App.ActiveWindowId(); + var row = rig.App.PaneLines(window).Last(l => MarkupText.Plain(l).Contains(SharpMUTermApp.ReconnectLabel, StringComparison.Ordinal)); + await Assert.That(MarkupText.Plain(row)).Contains("in 5 s · try 1 of"); + await Assert.That(rig.Session.Scrollback.Snapshot().Any(l => l.Text.Contains("econnect", StringComparison.Ordinal))).IsFalse(); + await Assert.That(rig.App.SearchModelFor("try 1 of", regex: false, all: true).Rows).IsEmpty(); + } + [Test] public async Task StopReconnectingCancelsTheWait() { diff --git a/tests/SharpMUTerm.Tui.Tests/CommandSurfaceRendererTests.cs b/tests/SharpMUTerm.Tui.Tests/CommandSurfaceRendererTests.cs index 54d5f375..c7fbd6ec 100644 --- a/tests/SharpMUTerm.Tui.Tests/CommandSurfaceRendererTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/CommandSurfaceRendererTests.cs @@ -32,7 +32,7 @@ public async Task Render_EmitsGroupHeadersAndHighlightsSelected() await Assert.That(lines[0]).Contains("acting on Corvid"); await Assert.That(lines.Any(l => l.Contains("├ GO TO"))).IsTrue(); - await Assert.That(lines.Any(l => l.Contains("├ LAYOUT"))).IsTrue(); + await Assert.That(lines.Any(l => l.Contains("├ WINDOWS & PANES"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("on #00f5b7") && l.Contains("Switch to Rookery"))).IsTrue(); } diff --git a/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs b/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs index 273922d5..67498cfe 100644 --- a/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/DeclaredWorldSettingsTests.cs @@ -56,6 +56,31 @@ public async Task TheCellScreenAndTheWindowListTheSameWorldFields() } } + /// + /// F5's world column is drawn in the declaration's order under its group headings, with the declared labels, and ⇥ + /// walks it in that order: the thirty-field scroll with shortened labels ("names", "channels") was the report. + /// + [Test] + public async Task TheCellWorldColumnIsGroupedAndLabelledAsDeclared() + { + var declared = BuiltInSettings.World.Fields.Select(f => f.Id) + .Where(id => !WorldsScreenRenderer.SecurityFieldOrder.Contains(id)).ToList(); + await Assert.That(WorldsScreenRenderer.WorldFieldOrder).IsEquivalentTo(declared, TUnit.Assertions.Enums.CollectionOrdering.Matching); + + var worlds = DemoScene.Build().Worlds; + var column = WorldsScreenRenderer.DetailColumn(worlds, [], 0, 0, "#00f5b7").Select(MarkupText.Plain).ToList(); + var groups = BuiltInSettings.World.Fields.Select(f => f.Group!).Distinct().ToList(); + await Assert.That(groups.Count).IsGreaterThanOrEqualTo(5); + var at = groups.Select(g => column.FindIndex(l => l.Trim() == g.ToUpperInvariant())).ToList(); + await Assert.That(at.All(i => i >= 0)).IsTrue(); + await Assert.That(at).IsEquivalentTo(at.Order().ToList(), TUnit.Assertions.Enums.CollectionOrdering.Matching); + + foreach (var label in new[] { "highlight names", "capture channels", "command stacking", "gmcp modules" }) + { + await Assert.That(column.Any(l => l.TrimStart().StartsWith(label + " ", StringComparison.Ordinal))).IsTrue().Because(label); + } + } + [Test] public async Task TheCellScreenAndTheWindowListTheSameCharacterFields() { diff --git a/tests/SharpMUTerm.Tui.Tests/MapViewTests.cs b/tests/SharpMUTerm.Tui.Tests/MapViewTests.cs index 762c359e..f2816b2d 100644 --- a/tests/SharpMUTerm.Tui.Tests/MapViewTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/MapViewTests.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Commands; using SharpConsoleUI.Drivers; using SharpMUTerm.Client.Panels; using SharpMUTerm.Core.Commands; @@ -140,11 +141,37 @@ public async Task MapCommandsLookByLevelAndAreaAndCanFindARoom() await Assert.That(app.MapLookOf(MapId)).IsNull().Because("level 0 of the keep is where Ann is"); Type(app, "/map find loft"); - var lines = app.WindowIds().SelectMany(w => app.PaneLines(w)).Select(MarkupText.Plain).ToList(); - await Assert.That(string.Join("\n", lines)).Contains("4 Loft"); await Assert.That(app.MapLookOf(MapId)!.Level).IsEqualTo(1).Because("the map shows the room found"); } + /// + /// A find is a picker, not lines in the output: ⌃P opens listing a Walk to … entry per room found, the client's + /// own commands, and ⏎ on one walks there. Nothing lands in a pane, where a link would be the server text handler's. + /// + [Test] + public async Task AFindOpensThePaletteOnTheRoomsFoundAndAnEntryWalksThere() + { + var (app, wire) = await Open(); + await using var _app = app; + var before = app.WindowIds().Sum(w => app.PaneLines(w).Count); + + Type(app, "/map find loft"); + + await Assert.That(app.MenuIsOpen).IsTrue(); + var listed = app.Palette.View.Entries.Select(e => e.Item.Id).ToList(); + await Assert.That(listed).IsEquivalentTo(new[] { BuiltInCommands.MapWalk(4) }); + await Assert.That(app.Palette.View.Entries[0].Item.Title).IsEqualTo("Walk to Loft"); + await Assert.That(app.WindowIds().Sum(w => app.PaneLines(w).Count)).IsEqualTo(before).Because("no *** lines in the output"); + + var sent = wire.Lines.Count; + await Assert.That(app.DispatchCommand(BuiltInCommands.MapWalk(4))).IsTrue(); + await Assert.That(wire.Lines.Skip(sent)).IsEquivalentTo(new[] { "u" }).Because("the walk's first step went out"); + + // An id the last find did not list is refused, not walked. + await Assert.That(app.DispatchCommand(BuiltInCommands.MapWalk(1))).IsTrue(); + await Assert.That(app.StatusMarkup).Contains("not in the last /map find"); + } + [Test] public async Task InEditModePageKeysStepLevelsAndTheSelectionComesWith() { diff --git a/tests/SharpMUTerm.Tui.Tests/ScriptingWaveTests.cs b/tests/SharpMUTerm.Tui.Tests/ScriptingWaveTests.cs index 71abfdac..9607998f 100644 --- a/tests/SharpMUTerm.Tui.Tests/ScriptingWaveTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/ScriptingWaveTests.cs @@ -40,11 +40,11 @@ private static AppConfiguration Config(Action? world = null) } private static async Task<(SharpMUTermApp App, RecordingTelnetSession Wire)> Open( - AppConfiguration config, string? scriptsRoot = null, string? logRoot = null) + AppConfiguration config, string? scriptsRoot = null, string? logRoot = null, Action? clipboard = null) { Console.SetIn(TextReader.Null); var wire = new RecordingTelnetSession(); - var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32), logRoot: logRoot, scriptsRoot: scriptsRoot); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32), logRoot: logRoot, scriptsRoot: scriptsRoot, clipboard: clipboard); app.TelnetFactory = _ => wire; if (!app.DispatchCommand(CommandIds.Character(Ann))) { @@ -299,6 +299,78 @@ public async Task PosesOnlyLeavesOutTheRoomsOwnLines() } } + /// + /// While a scene records, the status row and the header model say so; the saved notice offers Open and Copy path, + /// both client commands naming the scene by index, and Open refuses out loud in a host that opens no files. + /// + [Test] + public async Task ARecordingSceneIsMarkedAndItsSavedNoticeOffersOpenAndCopyPath() + { + var logs = Directory.CreateTempSubdirectory("sharpmuterm-scene-").FullName; + try + { + var copied = new List(); + var (app, wire) = await Open(Config(), logRoot: logs, clipboard: copied.Add); + await using var _app = app; + await Assert.That(MarkupText.Plain(app.StatusMarkup)).DoesNotContain(SharpMUTermApp.RecordingCell); + + app.DispatchCommand(BuiltInCommands.SceneStartCommand); + var log = app.SceneLogOf(app.ActiveWindowId())!; + await Assert.That(app.BuildHeaderModel().Recording).IsTrue(); + await Assert.That(app.LastNoticeModel!.Source).IsEqualTo(SharpMUTerm.Client.Chrome.NoticeModel.Sources.Scene); + await Assert.That(app.LastNoticeModel!.Key).IsNull().Because("no bare chip"); + + // The notice covers the row for a while; once it goes, the resting row carries the mark. + app.ClearNoticeForTest(); + await Assert.That(MarkupText.Plain(app.StatusMarkup)).Contains(SharpMUTermApp.RecordingCell); + + wire.Receive("Ann says, \"Evening.\"\n"); + app.DispatchCommand(BuiltInCommands.SceneStopCommand); + await Assert.That(app.BuildHeaderModel().Recording).IsFalse(); + var saved = app.LastNoticeModel!; + await Assert.That(saved.Action!.Label).IsEqualTo("Open"); + await Assert.That(saved.Second!.Label).IsEqualTo("Copy path"); + await Assert.That(saved.Action.Command).DoesNotContain(logs).Because("a command id names a scene by index, never by path"); + + await Assert.That(app.DispatchCommand(saved.Second.Command)).IsTrue(); + await Assert.That(copied).IsEquivalentTo(new[] { log.Path }); + + await Assert.That(app.DispatchCommand(saved.Action.Command)).IsTrue(); + await Assert.That(app.StatusMarkup).Contains("opens no files"); + + await Assert.That(app.DispatchCommand(BuiltInCommands.SceneOpenPrefix + "7")).IsTrue(); + await Assert.That(app.StatusMarkup).Contains("no such saved scene"); + } + finally + { + Directory.Delete(logs, recursive: true); + } + } + + /// The file opener's own gate: only an existing log file, never a script or a relative path. + [Test] + public async Task TheFileOpenerTakesOnlyALogFile() + { + var dir = Directory.CreateTempSubdirectory("sharpmuterm-open-").FullName; + try + { + var html = Path.Combine(dir, "scene.html"); + var script = Path.Combine(dir, "launch.desktop"); + File.WriteAllText(html, "

    x

    "); + File.WriteAllText(script, "[Desktop Entry]"); + + await Assert.That(ExternalBrowser.TryParseOpenableFile(html, out var full)).IsTrue(); + await Assert.That(full).IsEqualTo(html); + await Assert.That(ExternalBrowser.TryParseOpenableFile(script, out _)).IsFalse(); + await Assert.That(ExternalBrowser.TryParseOpenableFile("scene.html", out _)).IsFalse(); + await Assert.That(ExternalBrowser.TryParseOpenableFile(Path.Combine(dir, "gone.txt"), out _)).IsFalse(); + } + finally + { + Directory.Delete(dir, recursive: true); + } + } + /// An app with no log root — every test, every snapshot — refuses out loud and writes nothing. [Test] public async Task WithNoLogRootTheSceneLogRefuses() diff --git a/tests/SharpMUTerm.Tui.Tests/WorldFieldScrollTests.cs b/tests/SharpMUTerm.Tui.Tests/WorldFieldScrollTests.cs index 65a4c3b0..95e32d4e 100644 --- a/tests/SharpMUTerm.Tui.Tests/WorldFieldScrollTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WorldFieldScrollTests.cs @@ -17,13 +17,9 @@ public class WorldFieldScrollTests new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); /// Fields whose row is labelled shorter than the field's own name. - private static readonly Dictionary RowLabels = new() - { - ["gmcp modules"] = "gmcp", - ["command stacking"] = "stacking", - ["capture channels"] = "channels", - ["highlight names"] = "names", - }; + // The cell column draws every world field under its declared label (no shortened row labels), so the label the + // model reports is the label to look for. + private static readonly Dictionary RowLabels = new(); private static ConsoleKeyInfo Key(ConsoleKey key) => new('\0', key, false, false, false); diff --git a/tests/SharpMUTerm.Tui.Tests/WorldsScreenRendererTests.cs b/tests/SharpMUTerm.Tui.Tests/WorldsScreenRendererTests.cs index cd691c5a..dc2a1724 100644 --- a/tests/SharpMUTerm.Tui.Tests/WorldsScreenRendererTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WorldsScreenRendererTests.cs @@ -76,9 +76,9 @@ public async Task Render_WorldsListedWithCounts() var lines = WorldsScreenRenderer.Render(Worlds(), TriggerSets(), selectedWorld: 0, selectedCharacter: 0); await Assert.That(lines.Any(l => l.Contains("Aetherfall"))).IsTrue(); - await Assert.That(lines.Any(l => l.Contains("2 chars"))).IsTrue(); + await Assert.That(lines.Any(l => l.Contains("2 characters"))).IsTrue(); await Assert.That(lines.Any(l => l.Contains("Voidmoor"))).IsTrue(); - await Assert.That(lines.Any(l => l.Contains("0 chars"))).IsTrue(); + await Assert.That(lines.Any(l => l.Contains("0 characters"))).IsTrue(); } [Test] From f771b943e59897934063267f1a6c4a96b77d103f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 15:27:51 +0000 Subject: [PATCH 055/113] polish(wave17): settings headers ladder, help blocks, connection rows, F5 at 80x24, notice hints - Settings screen headers go through KeyLadder (ScreenChrome.Hints room): whole keys, the way out always kept; FooterFitTests covers every settings header at 80x24. - Help topics are blocks (HelpPage, Client): headings and key spans, drawn bold/accent in cells and as headings and key chips in the window; the cell topic header is one row. - Native modal scrim (NativeTokens.Scrim, shared with the palette and settings) strengthened and pinned. - Highlight-names syntax and colours explained where edited: under the F5 well and in the window's field help (HighlightColours.NamesHelp). - Core's connection lines become WorldSession.ConnectionNoted, drawn as client rows: no transcript, restore log, scene log, triggers or Ctrl+F. - F5's world column at 80x24 drops group headings when short and names the top group; character/trigger bands capped while a world field is focused. Tab order unchanged. - The status row names a notice's action (key, or Ctrl+P title, or the shorter label) when it fits, never cut. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 12 ++ CLAUDE.md | 19 ++- src/SharpMUTerm.Avalonia/HelpView.cs | 56 +++++++- src/SharpMUTerm.Avalonia/NativeTokens.cs | 4 +- src/SharpMUTerm.Client/Help/HelpPage.cs | 125 ++++++++++++++++++ .../Settings/BuiltInSettings.cs | 2 +- src/SharpMUTerm.Client/Settings/ItemValues.cs | 13 ++ .../Session/ConnectionNote.cs | 25 ++++ src/SharpMUTerm.Core/Session/WorldSession.cs | 25 +++- src/SharpMUTerm.Tui/AliasesScreenRenderer.cs | 3 +- src/SharpMUTerm.Tui/HelpSurface.cs | 50 ++++++- src/SharpMUTerm.Tui/KeypadScreenRenderer.cs | 3 +- src/SharpMUTerm.Tui/OptionsScreenRenderer.cs | 3 +- .../Pointer/SharpMUTermApp.Notices.cs | 40 +++++- src/SharpMUTerm.Tui/ScreenChrome.cs | 108 ++++++++++++--- .../SharpMUTermApp.Reconnect.cs | 6 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 8 ++ src/SharpMUTerm.Tui/TimersScreenRenderer.cs | 3 +- src/SharpMUTerm.Tui/TriggersScreenRenderer.cs | 3 +- src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 77 ++++++++++- src/SharpMUTerm.Tui/WorldsScreenView.cs | 21 ++- .../NativeModalTests.cs | 28 ++++ .../SharpMUTerm.Client.Tests/HelpPageTests.cs | 72 ++++++++++ .../Session/WorldSessionLoggingTests.cs | 26 ++++ .../Session/WorldSessionReflowTests.cs | 6 +- .../AlertsAndReconnectTests.cs | 22 +++ tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs | 31 ++++- .../NoticeAndMapSurfaceTests.cs | 3 +- .../PolishWave17Tests.cs | 85 ++++++++++++ 29 files changed, 817 insertions(+), 62 deletions(-) create mode 100644 src/SharpMUTerm.Client/Help/HelpPage.cs create mode 100644 src/SharpMUTerm.Core/Session/ConnectionNote.cs create mode 100644 tests/SharpMUTerm.Client.Tests/HelpPageTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/PolishWave17Tests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index e728b2e6..118446f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -331,6 +331,18 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The settings screens' key hints no longer lose words from the middle at 80 columns: the least-used keys are left + out and the way to close is always there. +- Help topics have headings and show their keys as keys, in the terminal and the window, and a topic's title fits + on one row at 80 columns. +- The window's dialogs (quit, search, history, layouts, welcome) dim the window behind them more clearly. +- Editing F5 ▸ highlight names shows the `Name=colour` syntax and the colours you can use, in both the terminal + and the window. +- "Connecting", "connection lost" and "connection failed" are now client rows in the window, like the reconnect + countdown: they no longer go into transcripts, the restore log, scene logs, triggers or Ctrl+F. +- At 80×24, F5's world column shows a page of fields instead of one, naming the group at the top. +- When a notice has an action, the terminal's status row names it (`· ⌃P ▸ Show messages`, or the action's key) + if there is room. - At 80 columns the terminal's key rows fit on one line: the F1 composer, the script console, the map's edit keys, the import review and F10 shorten their words and then leave out the least-used keys, never the one that closes. The map's edit keys are now one row under the map instead of a block beside it; `?` lists them all (also under diff --git a/CLAUDE.md b/CLAUDE.md index cd5c8502..1416f4a1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -645,7 +645,9 @@ fallbacks) for inline images/maps. out, the accept) is never dropped. F1 (`ComposeOverlay.FooterKeys`; the header no longer repeats the `⌥W` chip), the script console (per state: Del is named only on the store list), the map's edit row, the import review and F10's header use it. `FooterFitTests` renders every cell modal/footer view at 80×24 and fails unless its first and last - hints share one painted row — add a view there when it gains a key row. + hints share one painted row — add a view there when it gains a key row. Settings screen headers go through it too + (`ScreenChrome.Hints(…, room)`, `HeaderRoom`): `{F}/Esc close` and an edit's ⏎/Esc are `Keep`, the pane and select + keys go first; `FooterFitTests.SettingsHeaders` fails on a `…` in any F2–F10 header at 80×24. - **The status row names the keys of the mode you are in** (`ModeHints`/`StatusMode`, Client; `SharpMUTermApp.ModeHints.cs`). Composer armed > search bar in the focused window > frozen > split > scrolled back; while one holds, its hints replace `FocusHints` (`End returns · ⌥F freezes`, `⌥F thaws`, `⌥G next hit · ⌃F searches @@ -1436,7 +1438,20 @@ fallbacks) for inline images/maps. the client's own list, in both hosts, with no new trust path. `--plain` gets client rows instead. - **What the client says in a session window is a client row** (`ClientRowRenderer`, `AppendClientRow`: a bar function and no `Plain`), never a `***` session line: reconnect countdowns and stops reach no transcript, restore, scene log or ⌃F. - Core's own `*** Connecting/Connection lost` lines are still session lines. + Core's own connection notes are too: `WorldSession.ConnectionNoted` (`ConnectionNote`: CONNECT/FAILED/LOST/CLOSED) + replaces the `*** Connecting/Connection lost/failed` lines, `BindSession` draws them as client rows and announces them. + - **The status row names a notice's action** (`NoticeActionHints`): `⌥R Reconnect` when the command has a key, else + `⌃P ▸ `, else the action's shorter label; added whole after ` · ` only if the row still fits, never cut. + - **Help topics are blocks** (`HelpPage`, Client): a paragraph or line opening `Label: ` is a heading, keys are spans + (glyph runs, F-keys, Esc, PgUp…), two-space-indented lines stay rows. The cells draw bold headings and accent keys; + the window draws headings and key chips (`NativeKeys.Words`). The cell topic header is one elided row. + - **F5's world column at 80×24 drops its group headings** when the fields do not fit, naming the top row's group on the + column's first row (`├ WORLD · CONNECTION`, `⌃ 12 more · MAP`); while a world field is focused the character form and + trigger sets are capped to a third of the height. ⇥ order is unchanged. An open `highlight names` edit draws the + syntax and colours under its well (`NamesHelpRows`; `ScreenChrome.Window(…, keepBelow)` keeps them on screen); the + window's field help is `HighlightColours.NamesHelp`, the same words. + - **The native modal scrim is `NativeTokens.Scrim`, shared with ⌃P and settings**, raised to 0x73 dark / 0x4d light; + `NativeModalTests.EveryModalIsVeiledByTheOneScrimOverTheWholeWindow` pins it. - **A scene recording is marked** (`● REC` status cell, `HeaderModel.Recording`), and the saved notice carries two actions (`NoticeModel.Second`): `scene:open:N` and `scene:copy:N`, by index into this run's saved scenes, never a path. Open goes through `ClientHost.OpenFile` (required; null headless), which takes only an existing absolute `.html/.htm/.txt/.log` diff --git a/src/SharpMUTerm.Avalonia/HelpView.cs b/src/SharpMUTerm.Avalonia/HelpView.cs index fc1684b2..39b610bf 100644 --- a/src/SharpMUTerm.Avalonia/HelpView.cs +++ b/src/SharpMUTerm.Avalonia/HelpView.cs @@ -4,6 +4,8 @@ using Avalonia.Interactivity; using Avalonia.Layout; using Avalonia.Media; +using Avalonia.Controls.Documents; +using SharpMUTerm.Client.Help; using SharpMUTerm.Client.Modals; namespace SharpMUTerm.Avalonia; @@ -168,6 +170,9 @@ private int IndexOf(HelpEntry entry) return -1; } + /// The face a help page's table rows (the map's keys) are set in, so their columns line up. + private static FontFamily TableFace { get; } = new($"{CellFonts.BundledFamily}, DejaVu Sans Mono, Consolas, Menlo, monospace"); + private void ShowPage(HelpTopic topic) { Page = topic.Id; @@ -191,16 +196,53 @@ private void ShowPage(HelpTopic topic) Foreground = _colours.Brush(_colours.Dim), TextWrapping = TextWrapping.Wrap, }); - foreach (var line in topic.Paragraphs) + // The cells' blocks (HelpPage): a heading over each paragraph, keys as key caps, the map's table rows in the + // cell face. No blank paragraphs: the stack's spacing and a heading's top margin are the gaps, so the page has no + // tall empty bands. + HelpBlock? previous = null; + foreach (var block in HelpPage.Blocks(topic)) { - _pageText.Children.Add(new TextBlock + if (block.Heading is { } heading) { - Text = NativeKeys.Words(line), - FontSize = NativeTokens.Title, + _pageText.Children.Add(new TextBlock + { + Text = NativeKeys.Words(heading), + FontSize = NativeTokens.Title, + FontWeight = FontWeight.SemiBold, + Foreground = _colours.Brush(_colours.Header), + Margin = new Thickness(0, previous is null ? 4 : 8, 0, -4), + }); + } + + var text = new TextBlock + { + FontSize = NativeTokens.Body + 1, Foreground = _colours.Brush(_colours.Text), - TextWrapping = TextWrapping.Wrap, - MinHeight = line.Length == 0 ? 4 : 0, - }); + TextWrapping = block.Preformatted ? TextWrapping.NoWrap : TextWrapping.Wrap, + LineHeight = (NativeTokens.Body + 1) * 1.45, + Margin = block.Preformatted && previous is { Preformatted: true } ? new Thickness(12, -6, 0, 0) + : block.Preformatted ? new Thickness(12, 0, 0, 0) : default, + }; + if (block.Preformatted) + { + text.FontFamily = TableFace; + } + + foreach (var span in block.Spans) + { + text.Inlines!.Add(span.IsKey + ? new Run(" " + NativeKeys.Words(span.Text) + " ") + { + Background = _colours.Brush(_colours.KeyFill), + Foreground = _colours.Brush(_colours.KeyInk), + FontWeight = FontWeight.SemiBold, + FontSize = NativeTokens.Body, + } + : new Run(NativeKeys.Words(span.Text))); + } + + _pageText.Children.Add(text); + previous = block; } var back = ModalParts.Button("Back to help", "Esc", _colours, Back); diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.cs b/src/SharpMUTerm.Avalonia/NativeTokens.cs index d2e7dd81..8c8bb89f 100644 --- a/src/SharpMUTerm.Avalonia/NativeTokens.cs +++ b/src/SharpMUTerm.Avalonia/NativeTokens.cs @@ -255,7 +255,7 @@ private sealed record Canon( /// The palette's dark card, as it was drawn before there were tokens. private static readonly Canon DarkCanon = new( - Color.FromArgb(0x59, 0, 0, 0), + Color.FromArgb(0x73, 0, 0, 0), new Rgb(0x1e, 0x1e, 0x25), new Rgb(0x3a, 0x3a, 0x46), new Rgb(0x2c, 0x2c, 0x36), @@ -270,7 +270,7 @@ private sealed record Canon( /// The palette's light card. private static readonly Canon LightCanon = new( - Color.FromArgb(0x33, 0, 0, 0), + Color.FromArgb(0x4d, 0, 0, 0), new Rgb(0xff, 0xff, 0xff), new Rgb(0xd4, 0xd4, 0xdd), new Rgb(0xe6, 0xe6, 0xec), diff --git a/src/SharpMUTerm.Client/Help/HelpPage.cs b/src/SharpMUTerm.Client/Help/HelpPage.cs new file mode 100644 index 00000000..33e48056 --- /dev/null +++ b/src/SharpMUTerm.Client/Help/HelpPage.cs @@ -0,0 +1,125 @@ +using System.Text.RegularExpressions; +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Client.Help; + +/// A run of a help page's text: words, or a key the cells draw as a chip and the window as a key cap. +/// The text, keys in glyphs (⌃F). +/// Whether it is a key. +public readonly record struct HelpSpan(string Text, bool IsKey); + +/// +/// One block of a help page: an optional heading (the Search: a paragraph opens with), its words as spans, and +/// whether it is a table row laid out in source (the map's key list) rather than a paragraph to wrap. +/// +public sealed record HelpBlock(string? Heading, IReadOnlyList Spans, bool Preformatted) +{ + public bool Equals(HelpBlock? other) => + other is not null && Heading == other.Heading && Preformatted == other.Preformatted && Spans.SequenceEqual(other.Spans); + + public override int GetHashCode() => HashCode.Combine(Heading, Preformatted, Spans.Count); + + /// The block's words as plain text. + public string Text => string.Concat(Spans.Select(s => s.Text)); +} + +/// +/// A as both hosts draw it: blocks with headings and key spans, so a page reads like the rest of +/// the client — a heading over each paragraph, keys drawn as keys — rather than as a wall of sentences. The topics stay +/// plain sentences in source; this reads their shape: a paragraph (or a line inside one) that opens with a short +/// capitalised label and a colon starts a block headed by it, a line indented two spaces is a table row kept as written, +/// and the keys are found by their glyphs. +/// +public static class HelpPage +{ + /// The longest label read as a heading (Everything else, Ragged lines). + public const int MaxHeading = 22; + + private static readonly Regex HeadingPattern = new( + $@"^(?[A-Z][A-Za-z' ]{{0,{MaxHeading - 1}}}): (?.+)$", RegexOptions.CultureInvariant); + + /// + /// A key as the topics write one: a modifier run and what it modifies (⌃F, ⌥⇧, ⌃←→↑↓, + /// ⇧↑), a bare key glyph (⏎, ⇥, an arrow), or a named key (F5, Esc, PgUp). + /// + private static readonly Regex KeyPattern = new( + @"[⌃⌥⇧]+(?:F\d{1,2}|PgUp|PgDn|Home|End|Esc|[←→↑↓]+|[^\s,;.:)/])?|[⏎⇥]|[←→↑↓]+|\b(?:F\d{1,2}|Esc|PgUp|PgDn|End)\b", + RegexOptions.CultureInvariant); + + /// The blocks of , in order. + public static IReadOnlyList Blocks(HelpTopic topic) + { + ArgumentNullException.ThrowIfNull(topic); + var blocks = new List(); + string? heading = null; + var words = new List(); + + void Close() + { + if (words.Count > 0 || heading is not null) + { + blocks.Add(new HelpBlock(heading, Spans(string.Join(' ', words)), false)); + } + + heading = null; + words.Clear(); + } + + foreach (var line in topic.Lines) + { + if (line.Length == 0) + { + Close(); + continue; + } + + if (line.StartsWith(" ", StringComparison.Ordinal)) + { + Close(); + blocks.Add(new HelpBlock(null, Spans(line.TrimStart()), true)); + continue; + } + + if (HeadingPattern.Match(line) is { Success: true } match) + { + Close(); + heading = match.Groups["h"].Value; + + // The sentence now starts the block: "Copy / Drag across output", not "drag across output". + var rest = match.Groups["rest"].Value; + words.Add(char.IsLower(rest[0]) ? char.ToUpperInvariant(rest[0]) + rest[1..] : rest); + continue; + } + + words.Add(line); + } + + Close(); + return blocks; + } + + /// split into words and keys. + public static IReadOnlyList Spans(string text) + { + ArgumentNullException.ThrowIfNull(text); + var spans = new List(); + var at = 0; + foreach (Match key in KeyPattern.Matches(text)) + { + if (key.Index > at) + { + spans.Add(new HelpSpan(text[at..key.Index], false)); + } + + spans.Add(new HelpSpan(key.Value, true)); + at = key.Index + key.Length; + } + + if (at < text.Length) + { + spans.Add(new HelpSpan(text[at..], false)); + } + + return spans; + } +} diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index af1dbdf0..4bcf44c8 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -304,7 +304,7 @@ public static partial class BuiltInSettings WorldText("highlight-names", "highlight names", TextRule.NameHighlights, WorldAlertsGroup, (_, w) => NameHighlights.Format(w.HighlightNames), (_, w, v) => w.HighlightNames = [.. NameHighlights.Parse(v).Names], - "names drawn in a colour wherever they appear: Ashlyn=gold, Merrow=red", + HighlightColours.NamesHelp, "friends enemies highlight name colour"), WorldText("map-room", "map room", TextRule.Pattern, MapGroup, diff --git a/src/SharpMUTerm.Client/Settings/ItemValues.cs b/src/SharpMUTerm.Client/Settings/ItemValues.cs index 31ce5e9c..23d2a9f4 100644 --- a/src/SharpMUTerm.Client/Settings/ItemValues.cs +++ b/src/SharpMUTerm.Client/Settings/ItemValues.cs @@ -23,6 +23,19 @@ public static class HighlightColours "blue", "magenta", "purple", "pink", "white", "silver", "grey", "black", ]; + /// + /// How a highlight-names list is written (F5 ▸ highlight names), said where it is edited in both hosts: the cell + /// field draws it under the open edit, the window as the field's help. + /// + public const string NameSyntax = "Name=colour, comma between; a name alone is " + Core.Automation.NameHighlights.DefaultColour; + + /// The colours a highlight-names list may name: the palette without . + public static IReadOnlyList NameColours { get; } = [.. Palette.Where(n => n != None)]; + + /// The highlight-names field's help: what it does, how to write it, and every colour it takes. + public static string NamesHelp { get; } = + $"names drawn in a colour wherever they appear, e.g. Ashlyn=gold, Merrow=red. {NameSyntax}. Colours: {string.Join(", ", NameColours)}"; + /// A colour as text: a palette name where one matches, else #rrggbb or idx:N. public static string Format(TerminalColor? colour) { diff --git a/src/SharpMUTerm.Core/Session/ConnectionNote.cs b/src/SharpMUTerm.Core/Session/ConnectionNote.cs new file mode 100644 index 00000000..00c8279f --- /dev/null +++ b/src/SharpMUTerm.Core/Session/ConnectionNote.cs @@ -0,0 +1,25 @@ +namespace SharpMUTerm.Core.Session; + +/// +/// One thing a session says about its own connection (): a short label in +/// capitals and the words. The client draws it as a row of its own, not as a line of the game's output. +/// +/// What happened: , , or . +/// The words: the host, and the reason when there is one. +public sealed record ConnectionNote(string Label, string Text) +{ + /// Dialling, and connected. + public const string Connect = "CONNECT"; + + /// A dial that did not open. + public const string Failed = "FAILED"; + + /// An open connection that dropped. + public const string Lost = "LOST"; + + /// An open connection closed cleanly, by either end. + public const string Closed = "CLOSED"; + + /// The note as one plain line, for a reader with no rows (a screen reader, --plain, a test). + public override string ToString() => $"{Label}: {Text}"; +} diff --git a/src/SharpMUTerm.Core/Session/WorldSession.cs b/src/SharpMUTerm.Core/Session/WorldSession.cs index 26e58e3e..cdb6cb8d 100644 --- a/src/SharpMUTerm.Core/Session/WorldSession.cs +++ b/src/SharpMUTerm.Core/Session/WorldSession.cs @@ -399,6 +399,21 @@ public ILogger Logger public event EventHandler? LinePrinted; + /// + /// What the session says about its own connection — dialling, connected, could not connect, lost, closed. Not a + /// line: the client draws it as one of its own rows in the session's window, so it reaches no transcript, restore + /// log, scene log, trigger or search (it used to be a *** line printed into all of them as if the game had + /// said it). Raised on whichever thread the change happened on; also written to the diagnostics at debug level (the app already reports a failure as a notice, which the message log keeps). + /// + public event EventHandler? ConnectionNoted; + + /// Says about the connection () and keeps it in the diagnostics. + private void NoteConnection(string label, string text) + { + Logger.LogDebug("{World}: {Label} {Text}", World.Name, label, text); + ConnectionNoted?.Invoke(this, new ConnectionNote(label, text)); + } + public event EventHandler? PromptChanged; public event EventHandler? StateChanged; @@ -618,7 +633,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) _closingByPlayer = false; SetState(ConnectionState.Connecting, null); - PrintSystem($"*** Connecting to {World.Host}:{World.Port}..."); + NoteConnection(ConnectionNote.Connect, $"dialling {World.Host}:{World.Port}…"); var telnet = _sessionFactory(World.ToConnectionOptions()); _telnet = telnet; @@ -688,14 +703,14 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) { await telnet.ConnectAsync(cancellationToken).ConfigureAwait(false); SetState(ConnectionState.Connected, null); - PrintSystem("*** Connected."); + NoteConnection(ConnectionNote.Connect, $"connected to {World.Host}:{World.Port}"); await SendLoginAsync(cancellationToken).ConfigureAwait(false); StartTimers(); } catch (Exception ex) { SetState(ConnectionState.Faulted, ex); - PrintSystem($"*** Connection failed: {ex.Message}"); + NoteConnection(ConnectionNote.Failed, $"could not connect to {World.Host}:{World.Port} · {ex.Message}"); Logger.LogWarning(ex, "Connect to {Host}:{Port} failed", World.Host, World.Port); throw; } @@ -1554,7 +1569,9 @@ private void OnDisconnected(object? sender, SessionDisconnectedEventArgs e) LastClose = _closingByPlayer ? SessionClose.Player : e.IsClean ? SessionClose.Server : SessionClose.Failed; _closingByPlayer = false; SetState(e.IsClean ? ConnectionState.Disconnected : ConnectionState.Faulted, e.Error); - PrintSystem(e.IsClean ? "*** Disconnected." : $"*** Connection lost: {e.Error?.Message}"); + NoteConnection( + e.IsClean ? ConnectionNote.Closed : ConnectionNote.Lost, + e.IsClean ? "disconnected" : $"connection lost · {e.Error?.Message}"); } /// diff --git a/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs b/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs index 01ade1fa..56b31fdd 100644 --- a/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/AliasesScreenRenderer.cs @@ -114,7 +114,8 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo { var title = $"[bold {Value}] Aliases[/]"; var hints = ScreenChrome.Hints( - ScreenChrome.ListHints, "F3", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false); + ScreenChrome.ListHints, "F3", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false, + room: ScreenChrome.HeaderRoom(" " + title, width)); return SpreadTitle(" " + title, hints, width); } diff --git a/src/SharpMUTerm.Tui/HelpSurface.cs b/src/SharpMUTerm.Tui/HelpSurface.cs index e232bc3e..230d6929 100644 --- a/src/SharpMUTerm.Tui/HelpSurface.cs +++ b/src/SharpMUTerm.Tui/HelpSurface.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Help; using SharpMUTerm.Client.Modals; using static SharpMUTerm.Tui.MarkupText; @@ -145,14 +146,17 @@ internal static List Render(HelpModel model, string query, int selected, var body = rows - 3; if (model.Topic(topic) is { } page) { - lines.Add($"[{ScreenPalette.Accent}]HELP ▸[/] [bold {ScreenPalette.Value}]{Escape(page.Title)}[/]" - + $"[{ScreenPalette.Label}] · {Escape(page.Summary)}[/]"); + // One row, never wrapped: the summary gives way to the title (it wrapped at 80 columns). + lines.Add(ElideVisible( + $"[{ScreenPalette.Accent}]HELP ▸[/] [bold {ScreenPalette.Value}]{Escape(page.Title)}[/]" + + $"[{ScreenPalette.Label}] · {Escape(page.Summary)}[/]", + width - 1)); lines.Add(string.Empty); - var text = page.Paragraphs.SelectMany(l => Wrap(l, width - 3)).ToList(); + var text = PageRows(page, width - 3); var top = Math.Clamp(scroll, 0, Math.Max(0, text.Count - body)); foreach (var line in text.Skip(top).Take(body)) { - lines.Add($" [{ScreenPalette.Value}]{Escape(line)}[/]"); + lines.Add(line); } Pad(lines, rows - 1); @@ -206,6 +210,44 @@ internal static List Render(HelpModel model, string query, int selected, return lines; } + /// + /// A page as rows of markup (): each block's heading on a row of its own in bold, its + /// words wrapped to under it, keys in the accent as every footer draws them, a blank row + /// between blocks, and table rows (the map's keys) kept as written. The window draws the same blocks. + /// + internal static List PageRows(HelpTopic page, int width) + { + var rows = new List(); + var blocks = HelpPage.Blocks(page); + for (var i = 0; i < blocks.Count; i++) + { + var block = blocks[i]; + if (i > 0 && !(block.Preformatted && blocks[i - 1].Preformatted)) + { + rows.Add(string.Empty); + } + + if (block.Heading is { } heading) + { + rows.Add($" [bold {ScreenPalette.Value}]{Escape(heading)}[/]"); + } + + var indent = block.Preformatted ? " " : " "; + foreach (var line in Wrap(block.Text, Math.Max(10, width - (indent.Length - 1)))) + { + rows.Add(indent + Styled(line)); + } + } + + return rows; + } + + /// A row of a help page as markup: words in the value ink, keys bold in the accent. + private static string Styled(string line) => + string.Concat(HelpPage.Spans(line).Select(s => s.IsKey + ? $"[bold {ScreenPalette.Accent}]{Escape(s.Text)}[/]" + : $"[{ScreenPalette.Value}]{Escape(s.Text)}[/]")); + private static string Row(HelpEntry entry, bool selected, int width, int titleWidth) { var mark = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; diff --git a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs index e4a4e22f..9e4ac9ef 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs @@ -204,7 +204,8 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo { var title = $"[bold {Value}] Keypad & hotkeys[/]"; var hints = ScreenChrome.Hints( - ScreenChrome.SingleListHints, "F4", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false); + ScreenChrome.SingleListHints, "F4", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false, + room: ScreenChrome.HeaderRoom(" " + title, width)); return SpreadTitle(" " + title, hints, width); } diff --git a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs index 98eaa81c..8558a02b 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs @@ -139,7 +139,8 @@ internal static string HeaderLine( model?.HasEditableRow ?? false, focus, removable: model?.HasRemovableRow ?? false, - resettable: resettable); + resettable: resettable, + room: ScreenChrome.HeaderRoom(" " + heading, width)); return SpreadTitle(" " + heading, hints, width); } diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs index d79d7bcc..7f06e925 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs @@ -55,8 +55,46 @@ internal string NoticeMarkup(NoticeModel notice) var body = $"[{ink}]{Escape(notice.Text)}[/]"; var label = HeldOn(_ink.Notice, plane); // A source is a label (Sound:), a key a chord chip (⌃P): two shapes, so a word is never read as a key to press. - return notice.Source is { } source ? $"[{label}]{Escape(source)}:[/] {body}" + var row = notice.Source is { } source ? $"[{label}]{Escape(source)}:[/] {body}" : notice.Key is null ? body : $"[{label}]{Escape(notice.Key)}[/] {body}"; + + // The toast offers the action as a button; the row names the way to it, where it fits whole — never by cutting + // the notice's own words, and never wrapping the row (FitStatusRow). + if (NoticeActionHints(notice.Action).FirstOrDefault(h => MarkupWidth(row) + 3 + h.Length <= HeaderWidth()) is { } hint) + { + row += $"[{label}] · {Escape(hint)}[/]"; + } + + return row; + } + + /// + /// The ways the status row may say a notice's action, longest first: its key and the action's name + /// (⌥R Reconnect) when the command has a key on this host, else the ⌃P entry it is by title + /// (⌃P ▸ Show client messages) and then by the action's shorter label, which ⌃P still finds (it matches word by + /// word). None for a command ⌃P does not list (a saved scene's Open): that is the toast's alone, and the row will not + /// name a way that is not there. Never a bare ⌃P: a chip with no verb says nothing. + /// + internal IReadOnlyList NoticeActionHints(NoticeAction? action) + { + if (action is null) + { + return []; + } + + if (CommandKey(action.Command) is { } key) + { + return [$"{key} {action.Label}"]; + } + + if (BuildCatalog().FirstOrDefault(c => c.Id == action.Command) is not { } entry) + { + return []; + } + + return string.Equals(entry.Title, action.Label, StringComparison.OrdinalIgnoreCase) + ? [$"⌃P ▸ {entry.Title}"] + : [$"⌃P ▸ {entry.Title}", $"⌃P ▸ {action.Label}"]; } /// A colour held to on : notice text is small text. diff --git a/src/SharpMUTerm.Tui/ScreenChrome.cs b/src/SharpMUTerm.Tui/ScreenChrome.cs index 4b6e0d28..c2170ecf 100644 --- a/src/SharpMUTerm.Tui/ScreenChrome.cs +++ b/src/SharpMUTerm.Tui/ScreenChrome.cs @@ -31,7 +31,8 @@ internal static string Hints( ScreenFocus? focus = null, bool removable = false, bool detailed = false, - bool resettable = false) + bool resettable = false, + int room = 0) { if (focus?.Edit is { } edit) { @@ -44,25 +45,91 @@ internal static string Hints( return $"[{ScreenPalette.Label}]{CaptureHints}[/]"; } - var editing = EditingHints - + (edit.VisibleChoices.Count > 0 ? ChoiceHint : string.Empty) - + (edit.RowFields > 1 ? NextFieldHint : string.Empty); - return $"[{ScreenPalette.Label}]{editing} · [/][{ScreenPalette.Accent}]{fkey}[/]" - + $"[{ScreenPalette.Label}] close [/]"; + var editing = new List + { + new("⏎", "commit"), + new("Esc", "revert"), + }; + if (edit.VisibleChoices.Count > 0) + { + editing.Add(new LadderKey("↑↓", "pick from list", "pick", Drop: 2)); + } + + if (edit.RowFields > 1) + { + editing.Add(new LadderKey("⇥", "next field", "next", Drop: 1)); + } + + editing.Add(new LadderKey(fkey, "close", Drop: 3)); + return HintMarkup(KeyLadder.Choose(editing, room), fkey, closesWithEsc: false); + } + + // Fitted by KeyLadder, never cut mid-word: a header narrower than its hints gives up whole keys, lowest Drop + // first, and keeps the way out. Del outlasts everything but the close, because Delete is the destructive key and + // this line is the only place it is named; `i info` and `/ search` go early, because the INFO row is drawn on + // the screen either way and search is the overlay's, not the screen's. + var keys = new List(VerbKeys(verbs)); + if (editable) + { + keys.Add(new LadderKey("⏎", "edit", Drop: 6)); + } + + if (resettable) + { + keys.Add(new LadderKey("r", "reset", Drop: 5)); + } + + if (removable) + { + keys.Add(new LadderKey("Del", "remove", Drop: 8)); + } + + if (detailed) + { + keys.Add(new LadderKey("i", "info", Drop: 4)); } - // Order is a budget, not taste: a header narrower than its hints loses the *tail* of this string - // (see the 80-column frames), so whatever is appended last is what a narrow terminal does not - // get. `i info` goes after `Del remove` because Delete is the destructive key and must be the - // one that survives — and because the INFO key's drawn row (`i info on Aetherfall`) is on the - // screen either way, while a key that removes a world has only this line and its own row. - var all = (editable ? verbs + EditHint : verbs) - + (resettable ? ResetHint : string.Empty) - + (removable ? DeleteHint : string.Empty) - + (detailed ? DetailHint : string.Empty) - + SearchHint; - return $"[{ScreenPalette.Label}]{all} · [/][{ScreenPalette.Accent}]{fkey}[/][{ScreenPalette.Label}]/[/]" - + $"[{ScreenPalette.Accent}]Esc[/][{ScreenPalette.Label}] close [/]"; + keys.Add(new LadderKey("/", "search", Drop: 1)); + keys.Add(new LadderKey($"{fkey}/Esc", "close")); + return HintMarkup(KeyLadder.Choose(keys, room), fkey, closesWithEsc: true); + } + + /// + /// The cells a header has for its hints once is drawn in : what + /// is fitted to (0 when the caller has no width). One cell for the gap, one for the trailing pad. + /// + internal static int HeaderRoom(string title, int width) => + width <= 0 ? 0 : Math.Max(1, width - MarkupText.VisibleLength(title) - 2); + + /// A verbs string (, ) as ladder keys, each with its drop rank. + private static IEnumerable VerbKeys(string verbs) + { + foreach (var part in verbs.Split(" · ", StringSplitOptions.RemoveEmptyEntries)) + { + var cut = part.LastIndexOf(' '); + var key = cut > 0 ? part[..cut] : part; + var label = cut > 0 ? part[(cut + 1)..] : string.Empty; + yield return new LadderKey(key, label, Drop: label switch + { + "pane" => 2, + "select" => 3, + _ => 7, + }); + } + } + + /// + /// A header's hints as markup: the keys in the label ink, then the close — its keys in the accent, as every screen + /// has drawn them. The close is always the last key kept (it is never dropped). + /// + private static string HintMarkup(IReadOnlyList<(string Key, string Label)> keys, string fkey, bool closesWithEsc) + { + var verbs = string.Join(" · ", keys.Take(keys.Count - 1).Select(k => k.Label.Length == 0 ? k.Key : $"{k.Key} {k.Label}")); + var lead = verbs.Length == 0 ? string.Empty : $"[{ScreenPalette.Label}]{verbs} · [/]"; + var close = closesWithEsc + ? $"[{ScreenPalette.Accent}]{fkey}[/][{ScreenPalette.Label}]/[/][{ScreenPalette.Accent}]Esc[/]" + : $"[{ScreenPalette.Accent}]{fkey}[/]"; + return lead + close + $"[{ScreenPalette.Label}] close [/]"; } /// @@ -270,7 +337,7 @@ internal static List Compact(List block, int height) /// with no cursor in it shows its top, where its heading is, and the edges say what they are hiding. /// /// - internal static List Window(List block, int height) + internal static List Window(List block, int height, int keepBelow = 0) { ArgumentNullException.ThrowIfNull(block); @@ -288,9 +355,10 @@ internal static List Window(List block, int height) focused = block.FindIndex(l => l.Contains(CursorMark, StringComparison.Ordinal)); } + // keepBelow: rows under the focused one that belong to it (an open field's explanation), kept on screen too. var start = focused < 0 ? 0 - : Math.Clamp(focused - (height / 2), 0, block.Count - height); + : Math.Clamp(Math.Max(focused - (height / 2), focused + keepBelow + 2 - height), 0, block.Count - height); var window = block.GetRange(start, height); if (start > 0) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs index a3279f44..2f2efbce 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Reconnect.cs @@ -165,9 +165,9 @@ private void AppendClientRow(string windowId, string label, string text) private void ShowDemoReconnect() { _demoReconnect = 12; - AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connection lost: Connection reset by peer", WorldSession.SystemLineStyle), StampNow()); - AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connecting to aetherfall.mux:4201...", WorldSession.SystemLineStyle), StampNow()); - AppendWindowLine(MainWindowId, StyledLine.FromText("*** Connection failed: Connection refused", WorldSession.SystemLineStyle), StampNow()); + AppendClientRow(MainWindowId, ConnectionNote.Lost, "connection lost · Connection reset by peer"); + AppendClientRow(MainWindowId, ConnectionNote.Connect, "dialling aetherfall.mux:4201…"); + AppendClientRow(MainWindowId, ConnectionNote.Failed, "could not connect to aetherfall.mux:4201 · Connection refused"); AppendClientRow(MainWindowId, ReconnectLabel, ReconnectLine(12, 2)); _statusIdentity = ("Corvid", "aetherfall.mux", 4201, "faulted"); RefreshStatusBar(); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 295f88df..b7abef7d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -3250,6 +3250,14 @@ private void BindSession(WorldSession session, string? windowId = null) } session.LinePrinted += (_, line) => OnUi(() => OnLine(session, windowId, line)); + + // What the session says about its connection is the client's row in this window, never a line of the session: + // no transcript, restore log, scene log, trigger or ⌃F sees it (ClientRowRenderer). A reader with no rows hears it. + session.ConnectionNoted += (_, note) => OnUi(() => + { + AppendClientRow(windowId, note.Label, note.Text); + AnnounceLine(windowId, note.ToString()); + }); session.PromptChanged += (_, _) => OnUi(() => { UpdateStatus(); diff --git a/src/SharpMUTerm.Tui/TimersScreenRenderer.cs b/src/SharpMUTerm.Tui/TimersScreenRenderer.cs index b5ea5e9d..e084ed0a 100644 --- a/src/SharpMUTerm.Tui/TimersScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/TimersScreenRenderer.cs @@ -114,7 +114,8 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo { var title = $"[bold {Value}] Timers[/]"; var hints = ScreenChrome.Hints( - ScreenChrome.ListHints, "F6", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false); + ScreenChrome.ListHints, "F6", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false, + room: ScreenChrome.HeaderRoom(" " + title, width)); return SpreadTitle(" " + title, hints, width); } diff --git a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs index e9d98577..8d120289 100644 --- a/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/TriggersScreenRenderer.cs @@ -294,7 +294,8 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo { var title = $"[bold {Value}] Triggers & spawn routing[/]"; var hints = ScreenChrome.Hints( - ScreenChrome.ListHints, "F2", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false); + ScreenChrome.ListHints, "F2", model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false, + room: ScreenChrome.HeaderRoom(" " + title, width)); return SpreadTitle(" " + title, hints, width); } diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index b28c4445..dd1b7917 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -355,7 +355,8 @@ internal static string HeaderLine( model?.HasEditableRow ?? false, focus, model?.HasRemovableRow ?? false, - model?.HasDetailRow ?? false); + model?.HasDetailRow ?? false, + room: ScreenChrome.HeaderRoom(" " + title, width)); return SpreadTitle(" " + title, hints, width); } @@ -1119,15 +1120,23 @@ world.GrabPrefix is { } grab }; var right = new List { $"[{accent}]├ WORLD[/]" }; + + // Which group each world row is under, and which rows are the headings: a short column gives the headings up + // and names the group of its first drawn row on its top row instead (see the end of this method). + var groupOf = new Dictionary(); + var namesHelp = 0; + var headings = new HashSet(); string? group = null; foreach (var field in BuiltInSettings.World.Fields) { if (field.Group is { } heading && !string.Equals(heading, group, StringComparison.Ordinal)) { group = heading; + headings.Add(right.Count); right.Add(GroupHeading(heading)); } + var first = right.Count; if (string.Equals(field.Id, SecurityFieldOrder[0], StringComparison.Ordinal)) { right.AddRange(SecurityColumn(world, cursor)); @@ -1135,6 +1144,18 @@ world.GrabPrefix is { } grab else if (cells.TryGetValue(field.Id, out var cell)) { right.Add(WorldField(field.Label, cell)); + if (string.Equals(field.Id, "highlight-names", StringComparison.Ordinal) + && cursor.EditOn(WorldsPane, selectedWorld, HighlightNamesField) is not null) + { + var help = NamesHelpRows().ToList(); + namesHelp = help.Count; + right.AddRange(help); + } + } + + for (var i = first; i < right.Count && group is not null; i++) + { + groupOf[i] = group; } } @@ -1169,8 +1190,58 @@ world.GrabPrefix is { } grab // Compacted, then windowed, then overlaid: the dropdown replaces rows by index, so anything that // moves a row has to happen before it is drawn or the list slides off the field it belongs to. - return ScreenChrome.Choices( - ScreenChrome.Window(ScreenChrome.Compact(right, height), height), cursor.Edit, DetailRowWidth); + if (height <= 0 || ScreenChrome.Compact(new List(right), height).Count <= height) + { + return ScreenChrome.Choices( + ScreenChrome.Window(ScreenChrome.Compact(right, height), height, namesHelp), cursor.Edit, DetailRowWidth); + } + + // Too short for every row: the group headings go first after the blanks (each costs a row and names no field), + // and the group of the first field drawn is named on the column's top row — `├ WORLD · CONNECTION`, or + // `⌃ 12 more · MAP` once it scrolls. ⇥ order is the fields' and is untouched. + var rows = new List<(string Line, string? Group)>(); + for (var i = 0; i < right.Count; i++) + { + if (!headings.Contains(i)) + { + rows.Add((right[i], groupOf.TryGetValue(i, out var g) ? g : null)); + } + } + + var window = ScreenChrome.Window(ScreenChrome.Compact(rows.ConvertAll(r => r.Line), height), height, namesHelp); + if (window.Count > 1 && rows.FirstOrDefault(r => string.Equals(r.Line, window[1], StringComparison.Ordinal)).Group is { } top) + { + window[0] += $"[{Label}] · {Escape(top.ToUpperInvariant())}[/]"; + } + + return ScreenChrome.Choices(window, cursor.Edit, DetailRowWidth); + } + + /// + /// What an open highlight-names edit draws under its well (, then the colours + /// it takes, a few to a row): the syntax is not on screen anywhere else. The window says the same as the field's help. + /// + internal static IEnumerable NamesHelpRows() + { + const int room = 28; + yield return WorldField(string.Empty, $"[{Label}]{Escape(HighlightColours.NameSyntax.Split(';')[0])}[/]"); + yield return WorldField(string.Empty, $"[{Label}]{Escape(HighlightColours.NameSyntax.Split(';')[1].Trim())}[/]"); + var line = "colours:"; + foreach (var colour in HighlightColours.NameColours) + { + if (line.Length > 0 && line.Length + 1 + colour.Length > room) + { + yield return WorldField(string.Empty, $"[{Label}]{line}[/]"); + line = string.Empty; + } + + line = line.Length == 0 ? colour : line + " " + colour; + } + + if (line.Length > 0) + { + yield return WorldField(string.Empty, $"[{Label}]{line}[/]"); + } } /// diff --git a/src/SharpMUTerm.Tui/WorldsScreenView.cs b/src/SharpMUTerm.Tui/WorldsScreenView.cs index fb573b2a..73a9894b 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenView.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenView.cs @@ -51,17 +51,24 @@ public static IWindowControl Build( // How many rows the WORLDS/detail body has once the header, the character band, the gap under // it and the action bar have taken theirs. The detail column is built against that number, so a // pane taller than its slot compacts and then scrolls rather than losing its tail silently. + // While the keyboard is in the world's own rows (the WORLDS list, a world field, its security boxes) the character + // band below gives up rows to them: it is drawn to a third of the screen and says what it holds back, so a short + // terminal shows a page of world fields rather than one field and "⌄ 33 more". On a character it is whole again. + var capBand = height > 0 && focus is { Pane: WorldsScreenRenderer.WorldsPane or WorldsScreenRenderer.SecurityPane }; + var bandCap = capBand ? Math.Max(5, (height - 3) / 3) : 0; + List Capped(List rows) => capBand ? ScreenChrome.Window(rows, bandCap) : rows; + var band = WorldsScreenRenderer.HasCharacter(worlds, selectedWorld, selectedCharacter) ? Math.Max( - WorldsScreenRenderer.FormColumn( - worlds[selectedWorld].Characters[selectedCharacter], accent, focus, selectedCharacter, layouts).Count, - WorldsScreenRenderer.TriggersColumn( + Capped(WorldsScreenRenderer.FormColumn( + worlds[selectedWorld].Characters[selectedCharacter], accent, focus, selectedCharacter, layouts).ToList()).Count, + Capped(WorldsScreenRenderer.TriggersColumn( worlds[selectedWorld].Characters[selectedCharacter], triggerSets, accent, focus, selectedSet, - worlds).Count) + 2 + worlds).ToList()).Count) + 2 : 1; var rows = height <= 0 ? 0 : Math.Max(1, height - 1 - band); @@ -88,10 +95,10 @@ public static IWindowControl Build( if (WorldsScreenRenderer.HasCharacter(worlds, selectedWorld, selectedCharacter)) { var character = worlds[selectedWorld].Characters[selectedCharacter]; - var form = WorldsScreenRenderer.FormColumn(character, accent, focus, selectedCharacter, layouts).ToList(); - var triggers = WorldsScreenRenderer + var form = Capped(WorldsScreenRenderer.FormColumn(character, accent, focus, selectedCharacter, layouts).ToList()); + var triggers = Capped(WorldsScreenRenderer .TriggersColumn(character, triggerSets, accent, focus, selectedSet, worlds) - .ToList(); + .ToList()); var editHeight = Math.Max(form.Count, triggers.Count); // Form panel on the left; the trigger checklist pushed to the right by a flex spacer so its diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs index 3a612c38..ea9a0158 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeModalTests.cs @@ -3,6 +3,7 @@ using Avalonia.Headless; using Avalonia.Input; using Avalonia.Interactivity; +using Avalonia.Media; using SharpMUTerm.Client.Modals; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Theming; @@ -183,6 +184,33 @@ public async Task EscClosesAndGivesTheKeyboardBack() await Assert.That(focused).IsTrue(); } + /// + /// Every native modal lies under one veil, the palette's and the settings window's (): + /// the whole window is dimmed, so the cells behind do not look live. Two stacked modals are two veils, the quit + /// prompt's in front. + /// + [Test] + public async Task EveryModalIsVeiledByTheOneScrimOverTheWholeWindow() + { + var (searchVeil, quitVeil, spans, inFront) = await Run(rig => + { + Key(rig, CtrlF); + var search = rig.Driver.Modals.Modal!; + Key(rig, CtrlQ); + var quit = rig.Driver.Modals.Quit!; + return ((search.Background as SolidColorBrush)?.Color, (quit.Background as SolidColorBrush)?.Color, + search.Bounds.Width >= rig.Root.Bounds.Width - 1 && search.Bounds.Height >= rig.Root.Bounds.Height - 1, + ReferenceEquals(rig.Root.Children[^1], quit)); + }); + + await Assert.That(searchVeil).IsEqualTo(NativeTokens.Dark.Scrim); + await Assert.That(quitVeil).IsEqualTo(NativeTokens.Dark.Scrim); + await Assert.That(spans).IsTrue().Because("the veil covers the header, the sidebar and the cells"); + await Assert.That(inFront).IsTrue(); + await Assert.That(NativeTokens.Dark.Scrim.A).IsGreaterThanOrEqualTo((byte)0x70).Because("faint enough to read through, dark enough to read as a veil"); + await Assert.That(NativeTokens.Light.Scrim.A).IsGreaterThanOrEqualTo((byte)0x48); + } + [Test] public async Task TheQuitPromptStaysInFrontOfAnythingAddedAfterIt() { diff --git a/tests/SharpMUTerm.Client.Tests/HelpPageTests.cs b/tests/SharpMUTerm.Client.Tests/HelpPageTests.cs new file mode 100644 index 00000000..954ef5b8 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/HelpPageTests.cs @@ -0,0 +1,72 @@ +using SharpMUTerm.Client.Help; +using SharpMUTerm.Client.Settings; + +namespace SharpMUTerm.Client.Tests; + +/// +/// A help page as both hosts draw it (): headings read off a paragraph's opening label, keys found +/// by their glyphs, the map's key table kept as rows. And the highlight-names explanation both hosts show where the field +/// is edited. +/// +public class HelpPageTests +{ + private static HelpTopicLookup Topics => new(HelpTopics.For("⌥⏎")); + + private sealed record HelpTopicLookup(IReadOnlyList All) + { + public Modals.HelpTopic this[string id] => All.Single(t => t.Id == id); + } + + [Test] + public async Task AParagraphOpeningWithALabelIsABlockHeadedByIt() + { + var blocks = HelpPage.Blocks(Topics["reading"]); + + await Assert.That(blocks.Select(b => b.Heading ?? string.Empty)).IsEquivalentTo(new[] { "Scroll", "Search", "Freeze", "Ragged lines", "Copy" }); + await Assert.That(blocks[^1].Text).StartsWith("Drag across output").Because("the sentence starts the block, so it is capitalised"); + await Assert.That(blocks[0].Text).Contains("the live tail below").Because("a paragraph's source lines are joined"); + } + + [Test] + public async Task LinesInsideOneParagraphThatOpenWithALabelAreBlocksOfTheirOwn() + { + var headings = HelpPage.Blocks(Topics["keys"]).Select(b => b.Heading).Where(h => h is not null).ToList(); + + await Assert.That(headings).Contains("Windows"); + await Assert.That(headings).Contains("Characters"); + await Assert.That(headings).Contains("Connection"); + } + + [Test] + public async Task KeysAreSpansOfTheirOwn() + { + var keys = HelpPage.Spans("⌃Z/⌃Y undo, ⌥⇧ and an arrow, ⇧↑/⇧↓ a line, PgUp/PgDn, ⏎ goes, F5 ▸ join, Esc closes, ⌃B | splits") + .Where(s => s.IsKey).Select(s => s.Text).ToList(); + + await Assert.That(keys).IsEquivalentTo(new[] { "⌃Z", "⌃Y", "⌥⇧", "⇧↑", "⇧↓", "PgUp", "PgDn", "⏎", "F5", "Esc", "⌃B" }); + await Assert.That(string.Concat(HelpPage.Spans("a ⌃F b").Select(s => s.Text))).IsEqualTo("a ⌃F b").Because("nothing is lost"); + } + + [Test] + public async Task TheMapsKeyTableStaysAsRows() + { + var rows = HelpPage.Blocks(Topics[HelpTopics.MapTopic]).Where(b => b.Preformatted).ToList(); + + await Assert.That(rows.Count).IsGreaterThan(1).Because("each row of the table is a row, not one joined paragraph"); + await Assert.That(rows.All(r => r.Heading is null)).IsTrue(); + } + + [Test] + public async Task TheHighlightNamesHelpSaysTheSyntaxAndEveryColour() + { + var help = BuiltInSettings.World.Fields.Single(f => f.Id == "highlight-names").Help!; + + await Assert.That(help).Contains(HighlightColours.NameSyntax); + foreach (var colour in HighlightColours.NameColours) + { + await Assert.That(help).Contains(colour); + } + + await Assert.That(HighlightColours.NameColours).DoesNotContain(HighlightColours.None); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Session/WorldSessionLoggingTests.cs b/tests/SharpMUTerm.Core.Tests/Session/WorldSessionLoggingTests.cs index 28892b03..d05d57f8 100644 --- a/tests/SharpMUTerm.Core.Tests/Session/WorldSessionLoggingTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Session/WorldSessionLoggingTests.cs @@ -32,6 +32,32 @@ private sealed class RecordingSink : ILogSink private static WorldSession Session() => new(new WorldDefinition { Name = "T", Host = "h", Port = 1 }); + /// + /// Dialling, connecting and losing the connection are said as , never as + /// lines: nothing reaches the transcript, the scrollback or . + /// + [Test] + public async Task TheConnectionsOwnNotesReachNoTranscriptAndNoScrollback() + { + var telnet = new FakeTelnetSession(); + var session = new WorldSession(new WorldDefinition { Name = "T", Host = "h", Port = 1 }, sessionFactory: _ => telnet); + var sink = new RecordingSink(); + session.AttachLog(sink); + var notes = new List(); + var lines = new List(); + session.ConnectionNoted += (_, n) => notes.Add(n); + session.LinePrinted += (_, l) => lines.Add(l); + + await session.ConnectAsync(); + await telnet.DisconnectAsync(); + + await Assert.That(notes.Select(n => n.Label)).IsEquivalentTo(new[] { ConnectionNote.Connect, ConnectionNote.Connect, ConnectionNote.Closed }); + await Assert.That(notes[0].Text).IsEqualTo("dialling h:1…"); + await Assert.That(sink.Lines).IsEmpty(); + await Assert.That(lines).IsEmpty(); + await Assert.That(session.Scrollback.Snapshot()).IsEmpty(); + } + [Test] public async Task AttachedMidSession_TheLogTakesSubsequentLines() { diff --git a/tests/SharpMUTerm.Core.Tests/Session/WorldSessionReflowTests.cs b/tests/SharpMUTerm.Core.Tests/Session/WorldSessionReflowTests.cs index d00a1777..07b7008d 100644 --- a/tests/SharpMUTerm.Core.Tests/Session/WorldSessionReflowTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Session/WorldSessionReflowTests.cs @@ -31,6 +31,10 @@ private static (WorldSession Session, FakeTelnetSession Telnet, List }; var printed = new List(); session.LinePrinted += (_, l) => printed.Add(l); + + // The connection's own notes are not lines any more (ConnectionNoted); recorded in order with the lines, as + // "*** CLOSED: …", so a test can still say a note came after a line. + session.ConnectionNoted += (_, n) => printed.Add(StyledLine.FromText("*** " + n, TextStyle.Default)); return (session, telnet, printed); } @@ -142,6 +146,6 @@ public async Task ADisconnectReleasesAHeldLineBeforeItsOwnMessage() var texts = printed.Select(l => l.Text).ToList(); var held = texts.IndexOf(Paragraph[0]); await Assert.That(held).IsGreaterThanOrEqualTo(0); - await Assert.That(texts.FindIndex(t => t.StartsWith("*** Disconnected", StringComparison.Ordinal))).IsGreaterThan(held); + await Assert.That(texts.FindIndex(t => t.StartsWith("*** " + ConnectionNote.Closed, StringComparison.Ordinal))).IsGreaterThan(held); } } diff --git a/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs b/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs index b680f862..3963a73a 100644 --- a/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/AlertsAndReconnectTests.cs @@ -151,6 +151,28 @@ public async Task AReconnectSaysSoInAClientRowAndNotInTheSessionsLines() await Assert.That(rig.App.SearchModelFor("try 1 of", regex: false, all: true).Rows).IsEmpty(); } + /// + /// The session's own connection lines (dialling, connected, lost) are client rows too, not *** session lines: + /// the window still says them, and no scrollback (so no transcript, restore or scene log), trigger or ⌃F sees them. + /// + [Test] + public async Task ConnectingAndLosingTheConnectionAreClientRowsNotSessionLines() + { + var rig = await Open(autoReconnect: false); + await using var _ = rig.App; + rig.Wire.Drop(new IOException("Connection reset by peer")); + + var window = rig.App.ActiveWindowId(); + var rows = rig.App.PaneLines(window).Select(MarkupText.Plain).ToList(); + await Assert.That(rows.Any(r => r.Contains(ConnectionNote.Connect + " dialling aetherfall.example:4201", StringComparison.Ordinal))).IsTrue() + .Because(string.Join('\n', rows)); + await Assert.That(rows.Any(r => r.Contains(ConnectionNote.Connect + " connected to aetherfall.example:4201", StringComparison.Ordinal))).IsTrue(); + await Assert.That(rows.Any(r => r.Contains(ConnectionNote.Lost + " connection lost · Connection reset by peer", StringComparison.Ordinal))).IsTrue(); + await Assert.That(rows.Any(r => r.StartsWith("***", StringComparison.Ordinal))).IsFalse(); + await Assert.That(rig.Session.Scrollback.Snapshot().Any(l => l.Text.Contains("onnect", StringComparison.Ordinal))).IsFalse(); + await Assert.That(rig.App.SearchModelFor("dialling", regex: false, all: true).Rows).IsEmpty(); + } + [Test] public async Task StopReconnectingCancelsTheWait() { diff --git a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs index b63d5331..8fc7fa39 100644 --- a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs @@ -71,12 +71,41 @@ await Assert.That(row).IsNotNull() [Test] public async Task EveryViewInTheListIsOneTheSnapshotKnows() { - foreach (var (view, _) in Footers) + foreach (var (view, _) in Footers.Concat(SettingsHeaders.Select(v => (v, Array.Empty())))) { await Assert.That(SnapshotViews.All.Contains(view)).IsTrue().Because(view); } } + /// + /// Every settings screen, navigating and mid-edit. Their header's keys are fitted by + /// (ScreenChrome.Hints): at 80 columns they used to be cut from the middle (⏎ …, Del remo…). + /// + internal static readonly string[] SettingsHeaders = + [ + "settings", "worlds", "triggers", "route", "highlight", "set", "aliases", "timers", "keypad", "textansi", "input", + "logging", "password", "startup", "settings-search", "settings-meters", "settings-changed", + "settings-themes", "triggers-edit", "logging-edit", "keypad-edit", "password-edit", "startup-edit", "channels-f5", + "join-wraps-f5", + ]; + + public static IEnumerable> SettingsCases() => SettingsHeaders.Select(v => (Func)(() => v)); + + [Test] + [MethodDataSource(nameof(SettingsCases))] + public async Task ASettingsHeaderKeepsWholeKeysAndItsWayOutAt80x24(string view) + { + var rows = FrameGrid.Decode(Render(view), Width, Height); + var header = rows[0]; + await Assert.That(header.Contains('…')).IsFalse() + .Because($"{view}: a key is given up whole, never cut: '{header}'"); + await Assert.That(header.Contains("close", StringComparison.Ordinal) || header.Contains("cancels", StringComparison.Ordinal) + || header.Contains("Esc back", StringComparison.Ordinal)) + .IsTrue().Because($"{view}: the way out stays: '{header}'"); + var footer = rows.LastOrDefault(r => r.Contains("[Esc]", StringComparison.Ordinal)); + await Assert.That(footer).IsNotNull().Because($"{view}: its action bar is on screen:\n{string.Join('\n', rows)}"); + } + [Test] public async Task TheImportReviewScrollsItsBodyUnderAPinnedFooter() { diff --git a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs index 92d6d839..9a016160 100644 --- a/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NoticeAndMapSurfaceTests.cs @@ -44,8 +44,9 @@ public async Task TheStatusRowDrawsANoticeAsItAlwaysHas() var chip = plain[..plain.IndexOf("⌃B", StringComparison.Ordinal)]; var muted = plain[(plain.IndexOf("⌃B[/] ", StringComparison.Ordinal) + "⌃B[/] ".Length)..plain.IndexOf("nothing", StringComparison.Ordinal)]; + // A cell is not a button, so the row names the way to the action instead — after the words, unchanged. app.SimulateNotice("nothing to split", MessageSeverity.Warning, "⌃B", new NoticeAction("layout:layouts", "Change layout")); - await Assert.That(app.LastNotice).IsEqualTo(plain).Because("the action is the window's to offer; the row is unchanged"); + await Assert.That(app.LastNotice).StartsWith(plain).And.EndsWith(" · ⌥M Change layout[/]"); app.SimulateNotice("no route to host", MessageSeverity.Error, null, null); await Assert.That(app.LastNotice).IsEqualTo($"[{ScreenPalette.Warn}]no route to host[/]"); diff --git a/tests/SharpMUTerm.Tui.Tests/PolishWave17Tests.cs b/tests/SharpMUTerm.Tui.Tests/PolishWave17Tests.cs new file mode 100644 index 00000000..d0242ff0 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/PolishWave17Tests.cs @@ -0,0 +1,85 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Help; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The wave-17 polish read off frames: a notice's action named on the status row where it fits, F5's world column at +/// 80×24 showing a page of fields rather than one, and a help page's header on one row with its keys drawn as keys. +/// +[NotInParallel] +public class PolishWave17Tests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(int width, int height) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = "Dark"; + config.Theme = ThemeLibrary.Get("Dark"); + return new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); + } + + [Test] + public async Task TheStatusRowNamesANoticesActionWhereItFits() + { + await using var wide = App(120, 32); + wide.SimulateNotice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error, null, + new NoticeAction("term:messages", "Show messages")); + await Assert.That(MarkupText.Plain(wide.StatusMarkup)).EndsWith("· ⌃P ▸ Show client messages"); + + // At 80 the palette's title does not fit beside the words; the action's own, shorter label does. + await using var narrow = App(80, 24); + narrow.SimulateNotice("could not connect to aetherfall.mux:4201 — no route to host", MessageSeverity.Error, null, + new NoticeAction("term:messages", "Show messages")); + var row = MarkupText.Plain(narrow.StatusMarkup); + await Assert.That(row).EndsWith("· ⌃P ▸ Show messages"); + await Assert.That(row.Length).IsLessThanOrEqualTo(80); + await Assert.That(row).DoesNotContain("…").Because("the hint is added whole or not at all; the words are never cut for it"); + } + + [Test] + public async Task AnActionWithAKeyIsNamedByItsKey_AndOneThePaletteDoesNotListIsNotNamed() + { + await using var app = App(120, 32); + await Assert.That(app.NoticeActionHints(new NoticeAction("world:reconnect", "Reconnect"))).IsEquivalentTo(new[] { "⌥R Reconnect" }); + await Assert.That(app.NoticeActionHints(new NoticeAction("scene:open:0", "Open"))).IsEmpty(); + + app.SimulateNotice("a notice too long to leave room for anything beside it at all, said at length, on and on and on and on", + MessageSeverity.Error, null, new NoticeAction("term:messages", "Show messages")); + await Assert.That(MarkupText.Plain(app.StatusMarkup)).DoesNotContain("⌃P ▸"); + } + + [Test] + public async Task F5At80x24ShowsAPageOfWorldFieldsUnderAnInlineGroupLabel() + { + await using var app = App(80, 24); + var rows = FrameGrid.Decode(app.RenderSnapshot("settings"), 80, 24); + string[] labels = ["name", "host", "port", "security", "encoding", "keepalive", "reconnect", "content", "gmcp modules"]; + var shown = labels.Count(l => rows.Any(r => r.Contains($" {l} ", StringComparison.Ordinal))); + + await Assert.That(shown).IsGreaterThanOrEqualTo(8).Because(string.Join('\n', rows)); + await Assert.That(rows.Any(r => r.Contains("├ WORLD · CONNECTION", StringComparison.Ordinal))).IsTrue() + .Because("the heading the short column gave up is named on its top row"); + await Assert.That(rows.Any(r => r.Contains("more", StringComparison.Ordinal) && r.Contains('⌄'))).IsTrue() + .Because("the character form held back says what it holds back"); + } + + [Test] + public async Task AHelpPagesHeaderIsOneRowAndItsKeysAreDrawnAsKeys() + { + var model = HelpModel.Build([], "⌥⏎", []); + var lines = HelpSurface.Render(model, string.Empty, 0, "reading", 0, 70, 20); + + await Assert.That(MarkupText.VisibleLength(lines[0])).IsLessThanOrEqualTo(69); + await Assert.That(lines.Any(l => l.Contains($"[bold {ScreenPalette.Value}]Search[/]", StringComparison.Ordinal))).IsTrue(); + await Assert.That(lines.Any(l => l.Contains($"[bold {ScreenPalette.Accent}]⌃F[/]", StringComparison.Ordinal))).IsTrue(); + } +} From 91fa7ad74af6dbed2b7132b46af808b239150327 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 15:34:31 +0000 Subject: [PATCH 056/113] =?UTF-8?q?feat:=20script=20editing=20loop=20and?= =?UTF-8?q?=20deeper=20history=20search=20(=E2=8C=83F=20=E2=8C=A5H)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Scripts: ⌃P ▸ Edit script… / New script…, the console's ⌃E and /script edit|new list and open the character's script files in the composer's script mode (verbatim lines, no escaping or spelling, monospace). ⌃S writes atomically under the scripts folder only (ScriptFiles), reloads that character's scripts and shows the first error (file:line) in the header and the console. Package scripts open read only. Both hosts. Search: ⌥H searches the session's whole scrollback, ring and spill, in ranged reads off the UI thread with cancellation and the match timeout (ScrollbackSearch), streaming older hits after the pane's. ⏎ on one goes to the pane if it still holds the line, else opens a read-only history view (cell ScrollbackViewSurface, native ScrollbackView). Captures say they keep no older history. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 + CLAUDE.md | 17 + src/SharpMUTerm.Avalonia/ComposerView.cs | 44 +- src/SharpMUTerm.Avalonia/ModalOverlay.cs | 1 + src/SharpMUTerm.Avalonia/ScriptConsoleView.cs | 19 + src/SharpMUTerm.Avalonia/ScrollbackView.cs | 146 ++++++ src/SharpMUTerm.Avalonia/SearchView.cs | 63 ++- .../Commands/BuiltInCommands.cs | 33 ++ .../Composer/ComposerModel.cs | 31 +- src/SharpMUTerm.Client/Help/SlashCommands.cs | 2 + .../Modals/ScriptConsoleModel.cs | 26 +- .../Modals/ScrollbackViewModel.cs | 126 +++++ src/SharpMUTerm.Client/Modals/SearchModel.cs | 52 +- .../Surfaces/SurfaceCatalog.cs | 24 +- .../Commands/CommandCatalog.cs | 10 +- src/SharpMUTerm.Core/Text/ScrollbackSearch.cs | 137 +++++ src/SharpMUTerm.Scripting/ScriptFiles.cs | 264 ++++++++++ src/SharpMUTerm.Tui/ComposeOverlay.cs | 86 ++- src/SharpMUTerm.Tui/ScriptConsoleSurface.cs | 9 +- src/SharpMUTerm.Tui/ScrollbackViewSurface.cs | 61 +++ src/SharpMUTerm.Tui/SearchPrompt.cs | 40 +- src/SharpMUTerm.Tui/SearchSurface.cs | 33 +- .../SharpMUTermApp.DeepSearch.cs | 489 ++++++++++++++++++ .../SharpMUTermApp.NativeComposer.cs | 27 +- .../SharpMUTermApp.NativeModals.cs | 17 +- .../SharpMUTermApp.ScriptConsole.cs | 6 +- .../SharpMUTermApp.ScriptEdit.cs | 448 ++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 98 +++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- .../SurfaceParityTests.cs | 33 +- .../Text/ScrollbackSearchTests.cs | 119 +++++ .../ScriptFilesTests.cs | 138 +++++ .../SharpMUTerm.Tui.Tests/DeepSearchTests.cs | 137 +++++ .../ScriptEditLoopTests.cs | 196 +++++++ 34 files changed, 2842 insertions(+), 99 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/ScrollbackView.cs create mode 100644 src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs create mode 100644 src/SharpMUTerm.Core/Text/ScrollbackSearch.cs create mode 100644 src/SharpMUTerm.Scripting/ScriptFiles.cs create mode 100644 src/SharpMUTerm.Tui/ScrollbackViewSurface.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Text/ScrollbackSearchTests.cs create mode 100644 tests/SharpMUTerm.Scripting.Tests/ScriptFilesTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/ScriptEditLoopTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index e728b2e6..7b802522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Scripts can be edited without leaving the client. ⌃P ▸ Edit script… (or ⌃E in the script console, or `/script edit`) + lists your character's script files; one opens in the composer with line numbers, exactly as written. ⌃S saves it, + reloads that character's scripts and shows the first error with its file and line. ⌃P ▸ New script… (or + `/script new `) starts one. Scripts from a package open read only. +- ⌃F can search older history. Press ⌥H to search the whole of a character's scrollback, including what has been + moved to disk, as well as what the pane still shows. Results stream in below the pane's own, marked "older"; ⏎ on + one opens a read-only page of history around it. Capture windows keep no older history, and the search says so. - Alerts reach more of the desktop. On Linux (X11, and XWayland) the window is marked as wanting attention, so the taskbar or window list highlights it until you come back. On Windows, an installed copy shows a toast as well as flashing the taskbar, and the window groups with its Start menu shortcut. diff --git a/CLAUDE.md b/CLAUDE.md index cd5c8502..aab4cf8f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -106,6 +106,14 @@ fallbacks) for inline images/maps. - **A rebuild clears the engines' runtime rules first** (`ClearRuntime`), or a reload doubles every `trigger.add`. `SaveConfiguration` rebuilds only when a session's file list changed (`SyncFiles`), since a rebuild restarts script timers; ⌃P ▸ *Reload scripts* always rebuilds and re-reads. + - **Scripts are edited in the composer's script mode** (`ScriptFiles`, Scripting; `SharpMUTermApp.ScriptEdit.cs`; + `ComposerEdit.Script`; ⌃P ▸ *Edit script…* / *New script…*, the console's ⌃E, `/script edit|new`; the `script-list` + and `script-edit` views). The files are ⌃P entries (`script:open:`, a family listed only once asked for, map + find's rule). Names go through `ScriptFiles.Check` and then `SessionScripts.Resolve`; a save is a temp file in the same + folder and a rename, refused through a link and outside the root. Lines verbatim (no `%r`, no escaping, no spelling, + line numbers, monospace). ⌃S saves, reloads that character's scripts and says the first error (`file:line`) in the + header and the console; the editor stays open. Esc keeps unsaved text per file for the run. `package:` scripts open + read only. The demo saves nothing. - **GMCP and MSDP data is held per session in `GameDataStore`, and three things read it**: the status row's meters (`StatusMeter`, F7 ▸ `meters`), ⌃P ▸ *Show game data* (`GameDataOverlay`) and Lua (`gmcp.get`, `msdp.get`). GMCP packages are stored by name with objects merged key by key, because IRE and Aardwolf send @@ -398,6 +406,15 @@ fallbacks) for inline images/maps. viewport width) when drawn, the label elides before the rule shrinks, and `SyncChromeBarWidths` (on `PostBufferPaint`) redraws a window's bars in place when its width moves. Width 0 (not arranged) draws 48 cells. ⌃F's footer is a drop ladder (`SearchPrompt.HintLadder`), so the surface fits from 44 columns. + - **⌥H searches older history too** (`ScrollbackSearch`, Core; `SharpMUTermApp.DeepSearch.cs`; `ScrollbackViewModel`, + Client; `ScrollbackViewSurface`, Tui; `ScrollbackView`, Avalonia; the `search-older` and `search-history` views). Only + a session window has any: its session's `ScrollbackBuffer`, ring and spill, walked newest first in ranged reads of + `MaxRangeLines` off the UI thread (inline headless, so frames are deterministic), cancelled by the next query or by + closing, `OutputSearch.Match`'s timeout per line, at most 500 hits. Lines the pane still holds are skipped by + reference (a session window's `PaneLine.Source` is the ring's instance). Older rows list after the pane's, tagged + `older`; the note on the count row says the bound and the progress, and that captures keep no older history. ⏎ on + one goes to the pane if it holds the line, else opens the **history view**: a modal page of 20 lines, every move a + ranged read, never inserted into a pane buffer. ⌥G stays pane-only. - **The demo scene loads with `_watching` off.** It pours a spawn window's whole history in before the first frame, and every line would otherwise count as missed — so any frame that later made such a window visible carried an activity bar reporting the client's own setup as news. diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 28090456..78c831b9 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -218,7 +218,7 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col try { _editor.Text = model.Body; - _editor.CaretIndex = model.Body.Length; + _editor.CaretIndex = model.Edit is { Line: > 0 } at ? LineStart(model.Body, at.Line) : model.Body.Length; _editor.ClearSelection(); } finally @@ -233,6 +233,9 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col _editor.Marks = session.Marks(_editor.Text ?? string.Empty); } + // A package's script is only read: the editor shows it and keeps every edit out. + _editor.IsReadOnly = model.Edit?.ReadOnly == true; + if (coloursChanged || previous is null) { Paint(); @@ -329,11 +332,37 @@ private void ApplyFont() } } + /// Where line (from 1) of starts; the end when it has fewer. + internal static int LineStart(string text, int line) + { + var at = 0; + for (var i = 1; i < line; i++) + { + var next = text.IndexOf('\n', at); + if (next < 0) + { + return text.Length; + } + + at = next + 1; + } + + return at; + } + /// The header and the key row, from the model. private void Label(ComposerModel model) { var ui = _title.FontSize; - if (model.Edit is { } edit) + if (model.Edit is { Script: true } script) + { + // A script: its name, that a save reloads the character's scripts, and what the last save did. + _title.Text = script.ReadOnly ? "READ ONLY" : "SCRIPT"; + var whose = model.Target.Length == 0 ? "no connection" : model.Target; + _target.Text = $"{script.Name} lua · {(script.ReadOnly ? "a package's script" : $"reloads {whose}")}" + + (script.Status is { } status ? $" · {status.TrimStart('!', ' ')}" : string.Empty); + } + else if (model.Edit is { } edit) { _title.Text = "EDIT"; _target.Text = $"{edit.Name} {edit.Type} · from {(model.Target.Length == 0 ? "no connection" : model.Target)}"; @@ -345,7 +374,8 @@ private void Label(ComposerModel model) _target.Text = model.Target.Length == 0 ? $"{verb}no connection" : $"{verb}to {model.Target}"; } - _target.Foreground = new SolidColorBrush(model.Target.Length == 0 ? Warn : _text); + _target.Foreground = new SolidColorBrush( + model.Target.Length == 0 || model.Edit?.Status?.StartsWith('!') == true ? Warn : _text); _chips.Children.Clear(); if (model.Edit is null) @@ -686,8 +716,12 @@ internal ContextMenu OpenMenu(int offset) items.Add(Item("Copy", _editor.Copy, enabled: _editor.CanCopy)); items.Add(Item("Paste", _editor.Paste, enabled: _editor.CanPaste)); items.Add(Item("Select all", _editor.SelectAll)); - items.Add(new Separator()); - items.Add(Item(Proportional ? "Monospace font" : "Proportional font", () => ChooseFace(!Proportional))); + if (_model?.Edit is not { Script: true }) + { + // A script is code, and stays monospace. + items.Add(new Separator()); + items.Add(Item(Proportional ? "Monospace font" : "Proportional font", () => ChooseFace(!Proportional))); + } var menu = new ContextMenu { ItemsSource = items }; menu.Closed += (_, _) => _editor.Focus(); diff --git a/src/SharpMUTerm.Avalonia/ModalOverlay.cs b/src/SharpMUTerm.Avalonia/ModalOverlay.cs index ab095c65..d00eb612 100644 --- a/src/SharpMUTerm.Avalonia/ModalOverlay.cs +++ b/src/SharpMUTerm.Avalonia/ModalOverlay.cs @@ -49,6 +49,7 @@ public ModalOverlay(ModalSession session, Action remove, Action new DictionaryOfferView(offer, Colours, Done), ImportReviewSession import => new ImportReviewView(import, Colours, Done), ScriptConsoleSession console => new ScriptConsoleView(console, Colours, Done), + ScrollbackViewSession history => new ScrollbackView(history, Colours, Done), _ => throw new ArgumentException($"no native view for {session.GetType().Name}", nameof(session)), }; AutomationProperties.SetName(this, _view.Title); diff --git a/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs b/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs index 7e9c1155..dd4d97fe 100644 --- a/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs +++ b/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs @@ -55,6 +55,11 @@ public ScriptConsoleView(ScriptConsoleSession session, NativeTokens colours, Act var buttons = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Margin = new Thickness(14, 8, 14, 0), HorizontalAlignment = HorizontalAlignment.Right }; _delete = ModalParts.Button("Delete key", "Del", colours, DeleteSelected); buttons.Children.Add(_delete); + if (_session.CanEdit) + { + buttons.Children.Add(ModalParts.Button("Edit a script…", "Ctrl+E", colours, EditScript)); + } + buttons.Children.Add(ModalParts.Button("Reload scripts", "Ctrl+L", colours, Reload)); SetDock(buttons, Dock.Bottom); Children.Add(buttons); @@ -164,6 +169,16 @@ public void DeleteSelected() /// Reload scripts. public void Reload() => _session.Reload(); + /// Edit a script: the console closes and the client lists the character's scripts (⌃P), the cells' ⌃E. + public void EditScript() + { + if (_session.CanEdit) + { + _session.EditScript(); + _done(); + } + } + private void OnChanged(ScriptConsoleModel model) => Dispatcher.UIThread.Post(() => { _model = model; @@ -262,6 +277,10 @@ private void OnKey(object? sender, KeyEventArgs e) e.Handled = true; Reload(); return; + case Key.E when e.KeyModifiers == KeyModifiers.Control && _session.CanEdit: + e.Handled = true; + EditScript(); + return; case Key.Enter when _prompt.IsFocused: e.Handled = true; Run(); diff --git a/src/SharpMUTerm.Avalonia/ScrollbackView.cs b/src/SharpMUTerm.Avalonia/ScrollbackView.cs new file mode 100644 index 00000000..9a16d6bf --- /dev/null +++ b/src/SharpMUTerm.Avalonia/ScrollbackView.cs @@ -0,0 +1,146 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's read-only history view (⏎ on an older-history hit in ⌃F): the page of a session's scrollback the client +/// read, the found line on the selection plane, the query marked in every line. The page is the client's +/// , the record the cells draw; a key or the wheel asks the client for another page +/// (), so the two hosts always show the same lines. +/// +internal sealed class ScrollbackView : DockPanel, IModalView +{ + private readonly ScrollbackViewSession _session; + private readonly NativeTokens _colours; + private readonly Action _done; + private readonly TextBlock _title; + private readonly TextBlock _position; + private readonly StackPanel _list; + private ScrollbackViewModel _model; + + public ScrollbackView(ScrollbackViewSession session, NativeTokens colours, Action done) + { + _session = session; + _colours = colours; + _done = done; + _model = session.Model; + Focusable = true; + + var header = new DockPanel { Margin = new Thickness(20, 14, 20, 8) }; + _title = ModalParts.Heading(string.Empty, colours); + _position = new TextBlock + { + FontSize = NativeTokens.Body, + Foreground = colours.Brush(colours.Dim), + HorizontalAlignment = HorizontalAlignment.Right, + VerticalAlignment = VerticalAlignment.Center, + }; + SetDock(_title, Dock.Left); + header.Children.Add(_title); + header.Children.Add(_position); + SetDock(header, Dock.Top); + Children.Add(header); + + var footer = ModalParts.Footer(NativeKeys.Words(ScrollbackViewModel.Keys), colours); + SetDock(footer, Dock.Bottom); + Children.Add(footer); + + _list = new StackPanel { Margin = new Thickness(8, 4, 8, 4) }; + var frame = new Border + { + BorderBrush = colours.Brush(colours.Rule), + BorderThickness = new Thickness(0, 1, 0, 1), + Child = _list, + }; + Children.Add(frame); + + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + PointerWheelChanged += (_, e) => + { + e.Handled = true; + _session.Key(e.Delta.Y > 0 ? ConsoleKey.UpArrow : ConsoleKey.DownArrow); + }; + _session.Changed += OnChanged; + _model = session.Model; // a page published while the view was being built + Draw(); + } + + public string Title => "Older history"; + + public double PreferredWidth => 900; + + public bool Centred => false; + + /// The page drawn now, for a test. + public ScrollbackViewModel Model => _model; + + public void FocusFirst() => Focus(); + + public void Detach() => _session.Changed -= OnChanged; + + private void OnChanged(ScrollbackViewModel model) => Dispatcher.UIThread.Post(() => + { + _model = model; + Draw(); + }); + + private void Draw() + { + _title.Text = _model.Title; + _position.Text = _model.Position; + _list.Children.Clear(); + var mono = new FontFamily($"{CellFonts.BundledFamily}, DejaVu Sans Mono, Consolas, Menlo, monospace"); + foreach (var line in _model.Lines) + { + var marked = line.Index == _model.Marked; + var text = new TextBlock + { + FontFamily = mono, + FontSize = NativeTokens.Body, + Foreground = _colours.Brush(_colours.Text), + TextTrimming = TextTrimming.CharacterEllipsis, + }; + text.Inlines = ModalParts.Marked(line.Text, line.MatchStart, line.MatchLength, _colours); + _list.Children.Add(new Border + { + CornerRadius = new CornerRadius(NativeTokens.RadiusM), + Padding = new Thickness(12, 2), + Background = marked ? _colours.Brush(_colours.Selected) : Brushes.Transparent, + Child = text, + }); + } + + for (var i = _model.Lines.Count; i < ScrollbackViewModel.PageRows; i++) + { + _list.Children.Add(new TextBlock { Text = " ", FontFamily = mono, FontSize = NativeTokens.Body, Margin = new Thickness(12, 2) }); + } + } + + private void OnKey(object? sender, KeyEventArgs e) + { + if (ModalParts.Console(e) is not { } key) + { + return; + } + + if (key.Key == ConsoleKey.Escape) + { + e.Handled = true; + _session.Dismiss(); + _done(); + return; + } + + if (key.Modifiers == 0 && _session.Key(key.Key)) + { + e.Handled = true; + } + } +} diff --git a/src/SharpMUTerm.Avalonia/SearchView.cs b/src/SharpMUTerm.Avalonia/SearchView.cs index 8bf90e32..f70d393a 100644 --- a/src/SharpMUTerm.Avalonia/SearchView.cs +++ b/src/SharpMUTerm.Avalonia/SearchView.cs @@ -12,8 +12,8 @@ namespace SharpMUTerm.Avalonia; /// -/// The window's ⌃F: a search box, the two toggles as switches (⌥E regex, ⌥A every window), the count with its bound, -/// and the hits with the match marked. The client searches () and publishes the +/// The window's ⌃F: a search box, the three toggles as switches (⌥E regex, ⌥A every window, ⌥H older history), the +/// count with its bound and older history's progress, and the hits with the match marked (an older hit tagged so). The client searches () and publishes the /// hits; ⏎ on a row goes through the client's one path to a hit. The keys that are not typing mean what they mean in /// cells, because they are read by the same rules (). /// @@ -25,7 +25,9 @@ internal sealed class SearchView : DockPanel, IModalView private readonly TextBox _box; private readonly ToggleButton _regex; private readonly ToggleButton _all; + private readonly ToggleButton _older; private readonly TextBlock _state; + private readonly TextBlock _note; private readonly TextBlock _count; private readonly StackPanel _list; private readonly ScrollViewer _scroller; @@ -49,9 +51,11 @@ public SearchView(SearchSession session, NativeTokens colours, Action done) var toggles = new DockPanel { Margin = new Thickness(16, 0, 16, 6) }; _regex = Toggle("Regex", "Alt+E", _model.Regex); _all = Toggle("All windows", "Alt+A", _model.AllWindows); + _older = Toggle("Older history", "Alt+H", _model.Older); var switches = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8 }; switches.Children.Add(_regex); switches.Children.Add(_all); + switches.Children.Add(_older); SetDock(switches, Dock.Left); toggles.Children.Add(switches); _count = new TextBlock @@ -69,7 +73,11 @@ public SearchView(SearchSession session, NativeTokens colours, Action done) SetDock(_state, Dock.Top); Children.Add(_state); - var footer = ModalParts.Footer("↑↓ pick · Enter go · Alt+E regex · Alt+A all windows · Esc cancel", colours); + _note = ModalParts.Dim(string.Empty, colours, new Thickness(20, 0, 20, 6)); + SetDock(_note, Dock.Top); + Children.Add(_note); + + var footer = ModalParts.Footer("↑↓ pick · Enter go · Alt+E regex · Alt+A all windows · Alt+H older history · Esc cancel", colours); SetDock(footer, Dock.Bottom); Children.Add(footer); @@ -89,11 +97,29 @@ public SearchView(SearchSession session, NativeTokens colours, Action done) }; _regex.IsCheckedChanged += (_, _) => Toggled(); _all.IsCheckedChanged += (_, _) => Toggled(); + _older.IsCheckedChanged += (_, _) => Toggled(); AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); _session.Changed += OnChanged; + + // A model published while this view was being built (an older-history search that finished first) is read again + // now that it listens, or the view would sit on the empty one it started from. + _model = session.Model; + SyncQuery(); Draw(); } + /// Puts the model's query in an empty box: the client's own search (a snapshot, a reopening) typed it. + private void SyncQuery() + { + if (string.IsNullOrEmpty(_box.Text) && _model.Query.Length > 0) + { + _syncing = true; + _box.Text = _model.Query; + _box.CaretIndex = _model.Query.Length; + _syncing = false; + } + } + public string Title => "Search the output"; public double PreferredWidth => 760; @@ -114,6 +140,12 @@ public SearchView(SearchSession session, NativeTokens colours, Action done) public ToggleButton AllWindowsToggle => _all; + /// The ⌥H switch, for a test. + public ToggleButton OlderToggle => _older; + + /// What older history says (its bound, or how far its search has got), for a test. + public string Note => _note.Text ?? string.Empty; + public void FocusFirst() { _box.Focus(); @@ -156,11 +188,13 @@ private void Toggled() } } - private void Search() => _session.Search(_box.Text ?? string.Empty, _regex.IsChecked == true, _all.IsChecked == true); + private void Search() => + _session.Search(_box.Text ?? string.Empty, _regex.IsChecked == true, _all.IsChecked == true, _older.IsChecked == true); private void OnChanged(SearchModel model) => Dispatcher.UIThread.Post(() => { _model = model; + SyncQuery(); Draw(); }); @@ -178,6 +212,11 @@ private void Draw() { _all.IsChecked = _model.AllWindows; } + + if (_older.IsChecked != _model.Older) + { + _older.IsChecked = _model.Older; + } } finally { @@ -186,6 +225,9 @@ private void Draw() _state.Text = NativeKeys.Words(_model.StateText); _count.Text = _model.CountText; + _note.Text = NativeKeys.Words(_model.HistoryNote ?? string.Empty); + _note.IsVisible = _model.HistoryNote is not null; + _note.Foreground = _colours.Brush(_model.HistoryRunning ? _colours.Accent : _colours.Dim); _list.Children.Clear(); _rows.Clear(); _selected = _model.Rows.Count == 0 ? 0 : Math.Clamp(_selected, 0, _model.Rows.Count - 1); @@ -201,16 +243,19 @@ private void Draw() return; } + var labelled = _model.AllWindows || _model.Rows.Any(r => r.IsOlder); for (var i = 0; i < _model.Rows.Count; i++) { var row = _model.Rows[i]; var index = i; var line = new DockPanel(); - if (_model.AllWindows) + if (labelled) { + // The cells' window column: the window in ⌥A scope, and "older" on a row ⏎ opens in the history view. + var label = row.IsOlder ? (_model.AllWindows ? $"{row.WindowLabel} · older" : "older") : _model.AllWindows ? row.WindowLabel : string.Empty; var window = new TextBlock { - Text = row.WindowLabel, + Text = label, Width = 130, TextTrimming = TextTrimming.CharacterEllipsis, Foreground = _colours.Brush(_colours.Header), @@ -277,7 +322,7 @@ private void OnKey(object? sender, KeyEventArgs e) } var decision = SearchPrompt.Interpret( - key, _box.Text ?? string.Empty, _selected, _model.Rows.Count, _regex.IsChecked == true, _all.IsChecked == true); + key, _box.Text ?? string.Empty, _selected, _model.Rows.Count, _regex.IsChecked == true, _all.IsChecked == true, _older.IsChecked == true); if (!bare && key.Modifiers.HasFlag(ConsoleModifiers.Control) && decision.Action == SearchAction.None) { // ⌃A, ⌃C, ⌃V and the rest stay the box's. @@ -294,10 +339,12 @@ private void OnKey(object? sender, KeyEventArgs e) _session.Dismiss(); _done(); break; - case SearchAction.Redraw when decision.Regex != (_regex.IsChecked == true) || decision.AllWindows != (_all.IsChecked == true): + case SearchAction.Redraw when decision.Regex != (_regex.IsChecked == true) || decision.AllWindows != (_all.IsChecked == true) + || decision.Older != (_older.IsChecked == true): _syncing = true; _regex.IsChecked = decision.Regex; _all.IsChecked = decision.AllWindows; + _older.IsChecked = decision.Older; _syncing = false; _selected = 0; Search(); diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index d4f560c3..b4e67bdf 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -29,6 +29,21 @@ public static class BuiltInCommands /// ⌃P ▸ Script console. public const string ScriptConsoleCommand = "world:script-console"; + /// ⌃P ▸ Edit script…: opens the palette on the character's script files. + public const string ScriptEditCommand = "world:script-edit"; + + /// ⌃P ▸ New script…: puts /script new on the command line for the name. + public const string ScriptNewCommand = "world:script-new"; + + /// The prefix of the Edit script … entries: script:open:<name>, one per script file. + public const string ScriptOpenPrefix = "script:open:"; + + /// What the palette opens with typed in for Edit script…, so it lists the script files and New script…. + public const string ScriptEditQuery = "script "; + + /// The ⌃P id that opens script in the editor. + public static string ScriptOpen(string name) => ScriptOpenPrefix + name; + /// ⌃P ▸ Start scene log. public const string SceneStartCommand = "term:scene-on"; @@ -135,6 +150,14 @@ void Family(string id, string prefix, Func c.State.ScriptsOn); + Add(ScriptNewCommand, CommandGroup.World, "New script…", + detail: "/script new · starts from a template", when: c => c.State.ScriptsOn); + Family("world:script-open", ScriptOpenPrefix, ScriptFileEntries); + // Only where the host has a screen reader to tell: the window's live region, or --plain. Add("a11y:toggle-window", CommandGroup.Terminal, "Read this window aloud", when: c => c.State.Announced is not null, @@ -461,6 +484,16 @@ private static IEnumerable JoinWrapsEntries(ICommandContext context Detail = $"it wraps at {r.Column}, the pane is {r.PaneWidth} wide · F5 ▸ join wraps", }); + private static IEnumerable ScriptFileEntries(ICommandContext context) => + (context.State.ScriptFiles ?? []).Select(f => new CommandItem( + CommandGroup.World, + f.ReadOnly ? $"Script {f.Name} (read only)" : $"Script {f.Name}", + ScriptOpen(f.Name), + f.Detail) + { + Detail = f.Detail, + }); + private static IEnumerable MapFoundEntries(ICommandContext context) => (context.State.MapFound ?? []).Select(r => { diff --git a/src/SharpMUTerm.Client/Composer/ComposerModel.cs b/src/SharpMUTerm.Client/Composer/ComposerModel.cs index ed55800e..6f413b22 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerModel.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerModel.cs @@ -27,8 +27,17 @@ public enum ComposerPlace /// A shorter label for a narrow pane; null when is already short. public sealed record ComposerKey(string Key, string Label, string? Short = null); -/// A MOO buffer being edited (MCP simpleedit): what it is called and its type. -public sealed record ComposerEdit(string Name, string Type); +/// +/// A buffer being edited rather than a post: a MOO's (MCP simpleedit) or a script file's. Saved as its lines — no +/// %r join, no escaping, no spelling. +/// +/// What it is called: the MOO's name for it, or the script's name under the scripts folder. +/// The MOO's type (moo-code), or lua for a script. +/// Whether this is a script file (⌃S saves it to disk and reloads the character's scripts). +/// Whether it can only be read: a package's script. +/// What the last save said (saved · 2 files loaded, or the first load error), or null. +/// The line the caret opens on, from 1; 0 for the end. +public sealed record ComposerEdit(string Name, string Type, bool Script = false, bool ReadOnly = false, string? Status = null, int Line = 0); /// /// A composer, as both hosts draw it. The terminal draws F1 and the docked panel in cells; the window draws them @@ -135,7 +144,7 @@ public static ComposerModel Create( armed, revision, ComposerMarks.For(body, checker), - KeysFor(place, edit is not null, checker is not null, canSend, armed, preview)) + KeysFor(place, edit is not null, checker is not null, canSend, armed, preview, edit)) { Preview = preview && place == ComposerPlace.FullScreen && edit is null, }; @@ -151,12 +160,16 @@ public static ComposerModel Create( /// The docked key row's keyless hint while the editor does not hold the keyboard. public const string ClickHint = "click here to write"; + /// The key row's keyless hint over a package's script, which can be read and never saved. + public const string ReadOnlyHint = "read only — a package's script"; + /// What F1's key row calls ⌥W while no dictionary marks the post. public const string GetDictionary = "get a dictionary"; /// The key row for a composer in this state. /// Whether F1's as-sent preview is showing, which names what ⌥P does next. - public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, bool dictionary, bool canSend, bool armed, bool preview = false) + /// The edit it is, when : a script saves to disk, a package's script only reads. + public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, bool dictionary, bool canSend, bool armed, bool preview = false, ComposerEdit? editing = null) { if (place == ComposerPlace.Docked) { @@ -176,6 +189,16 @@ public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, return docked; } + if (editing is { Script: true, ReadOnly: true }) + { + return [new(string.Empty, ReadOnlyHint, "read only"), new("Esc", "close")]; + } + + if (editing is { Script: true }) + { + return [new("⌃S", "save and reload", "save"), new("Esc", "close (keeps unsaved text)", "close")]; + } + if (edit) { return diff --git a/src/SharpMUTerm.Client/Help/SlashCommands.cs b/src/SharpMUTerm.Client/Help/SlashCommands.cs index 4b291561..1dafb0d1 100644 --- a/src/SharpMUTerm.Client/Help/SlashCommands.cs +++ b/src/SharpMUTerm.Client/Help/SlashCommands.cs @@ -31,6 +31,8 @@ public static class SlashCommands new("/map", "/map rename|area|note|symbol|weight …", "Change a room on the map, by its number", "/map rename "), new("/map", "/map exit · unexit ", "Add or remove an exit by hand", "/map exit "), new("/map", "/map move [dz] · delete · undo", "Move or delete a room, or undo the last edit", "/map undo"), + new("/script", "/script edit [name]", "Open a script from the scripts folder in the editor; ⌃S saves and reloads (no name lists them)", "/script edit "), + new("/script", "/script new ", "Start a new script in the scripts folder from a template", "/script new "), new("/web", "/web ", "Open a page in the built-in web view", "/web "), new("/graphics", "/graphics", "Say how pictures are drawn in this terminal, and why", "/graphics"), new("/triggers", "/triggers", "Say which trigger rules this window's character runs, and why a window did not open", "/triggers"), diff --git a/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs b/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs index e8e436be..2d4fceb1 100644 --- a/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs +++ b/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs @@ -67,7 +67,7 @@ public sealed record ScriptConsoleModel( public const int MaxInput = 500; /// The keys, in glyphs, as the cells' footer says them (a native view spells them in words). - public const string Keys = "⏎ runs · ↑↓ history · ⇥ store keys · Del deletes a key · ⌃L reloads scripts · Esc closes"; + public const string Keys = "⏎ runs · ↑↓ history · ⇥ store keys · Del deletes a key · ⌃E edits a script · ⌃L reloads scripts · Esc closes"; /// What the console says when its scripts printed nothing yet. public const string Empty = "nothing printed yet — try 1 + 1 or print(world.name)"; @@ -165,6 +165,18 @@ public void Remember(string input) } } + /// How many lines are held now. + public int Count + { + get + { + lock (_gate) + { + return _lines.Count; + } + } + } + /// The lines, oldest first. public IReadOnlyList Lines { @@ -199,6 +211,7 @@ public sealed class ScriptConsoleSession : ModalSession private readonly Action _run; private readonly Action _delete; private readonly Action _reload; + private readonly Action? _edit; /// What the console shows. /// Whether the client's theme is a dark one. @@ -206,13 +219,15 @@ public sealed class ScriptConsoleSession : ModalSession /// Deletes a store key (DeleteStoreKey). /// Reloads the character's scripts (ReloadConsoleScripts). /// Told the console closed. + /// Opens the list of the character's script files to edit (EditScriptFromConsole); null for none. public ScriptConsoleSession( ScriptConsoleModel model, bool isDark, Action run, Action delete, Action reload, - Action closed) + Action closed, + Action? edit = null) : base(model, isDark, closed) { ArgumentNullException.ThrowIfNull(run); @@ -221,8 +236,15 @@ public ScriptConsoleSession( _run = run; _delete = delete; _reload = reload; + _edit = edit; } + /// Whether the console can open a script to edit. + public bool CanEdit => _edit is not null && Model.CanRun; + + /// The host's: Edit a script (⌃E). Closes the console first; the client lists the files. + public bool EditScript() => CanEdit && !IsEnded && CloseThen(_edit!); + public override string Surface => "script-console"; /// The host's: ⏎ on a line. Nothing when the console cannot run one, or the line is blank. diff --git a/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs b/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs new file mode 100644 index 00000000..2abbcf96 --- /dev/null +++ b/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs @@ -0,0 +1,126 @@ +using System.Globalization; + +namespace SharpMUTerm.Client.Modals; + +/// One line of the history view: its absolute index in the session's scrollback, its text, and where the query matched. +public readonly record struct ScrollbackViewLine(long Index, string Text, int MatchStart, int MatchLength); + +/// +/// The read-only history view (⏎ on an older-history hit in ⌃F): lines of a session's scrollback +/// — the ring or the file-backed spill — around the line the search found, the found line marked and the query's run in +/// each line marked. Drawn by the cell surface (ScrollbackViewSurface.Render) and the window's native modal from +/// the same record; every move is a ranged read the client makes (ScrollHistoryView), so the two show the same page. +/// +/// A view, not a pane. It never puts old lines back into a pane buffer: a pane holds the newest +/// PaneLines and its indices are what every bar and boundary counts by, so a page of the past inserted there would +/// move all of them. It is a modal over the workspace, and Esc puts the reader back where they were. +/// +/// +/// What the window is called (the session's own window). +/// The search it came from, marked in each line. +/// The absolute index of the first line shown. +/// The oldest line the scrollback still holds. +/// One past the newest line. +/// The line the search found. +/// The page, oldest first, at most . +public sealed record ScrollbackViewModel( + string Window, + string Query, + long Top, + long Oldest, + long End, + long Marked, + IReadOnlyList Lines) +{ + /// The lines a page holds, the same in both hosts. + public const int PageRows = 20; + + /// The keys, in glyphs (a native view spells them in words). + public const string Keys = "↑↓ a line · PgUp PgDn a page · Home End the ends · Esc closes"; + + /// Where the page sits: lines 12,301–12,320 of 40,000 · 27,680 lines before the newest. + public string Position + { + get + { + if (Lines.Count == 0) + { + return "nothing held here any more"; + } + + var first = Lines[0].Index - Oldest + 1; + var last = Lines[^1].Index - Oldest + 1; + var held = End - Oldest; + var back = End - 1 - Lines[^1].Index; + return $"lines {N(first)}–{N(last)} of {N(held)}" + (back > 0 ? $" · {N(back)} line{(back == 1 ? string.Empty : "s")} before the newest" : " · the newest"); + } + } + + /// The title row: whose history, and that it is only read. + public string Title => $"OLDER HISTORY · {Window} · read only"; + + /// The top that shows a third of the way down a page, clamped to what is held. + public static long TopFor(long marked, long oldest, long end) => Clamp(marked - PageRows / 3, oldest, end); + + /// kept to a page that starts at or after the oldest line and ends at or before the newest. + public static long Clamp(long top, long oldest, long end) => Math.Max(oldest, Math.Min(top, Math.Max(oldest, end - PageRows))); + + /// The top a key moves to: ↑↓ a line, PgUp PgDn a page, Home End the ends; null for a key that does not move. + public long? Move(ConsoleKey key) => key switch + { + ConsoleKey.UpArrow => Clamp(Top - 1, Oldest, End), + ConsoleKey.DownArrow => Clamp(Top + 1, Oldest, End), + ConsoleKey.PageUp => Clamp(Top - (PageRows - 1), Oldest, End), + ConsoleKey.PageDown => Clamp(Top + (PageRows - 1), Oldest, End), + ConsoleKey.Home => Oldest, + ConsoleKey.End => Clamp(End, Oldest, End), + _ => null, + }; + + private static string N(long value) => value.ToString("N0", CultureInfo.InvariantCulture); + + public bool Equals(ScrollbackViewModel? other) => + other is not null + && Window == other.Window && Query == other.Query && Top == other.Top && Oldest == other.Oldest + && End == other.End && Marked == other.Marked && ModelLists.Same(Lines, other.Lines); + + public override int GetHashCode() => HashCode.Combine(Window, Query, Top, Oldest, End, Marked, ModelLists.Hash(Lines)); +} + +/// +/// One opening of the history view in a host's own controls. A move goes back to the client, which reads the page and +/// republishes; Esc closes. +/// +public sealed class ScrollbackViewSession : ModalSession +{ + private readonly Action _scroll; + + /// The page it opens on. + /// Whether the client's theme is a dark one. + /// Reads the page starting at a line (ScrollHistoryView); called from any thread. + /// Told the view closed. + public ScrollbackViewSession(ScrollbackViewModel model, bool isDark, Action scroll, Action closed) + : base(model, isDark, closed) + { + ArgumentNullException.ThrowIfNull(scroll); + _scroll = scroll; + } + + public override string Surface => "history-view"; + + /// The host's: a key that moves the page. False for a key that does not. + public bool Key(ConsoleKey key) + { + if (IsEnded || Model.Move(key) is not { } top) + { + return false; + } + + if (top != Model.Top) + { + _scroll(top); + } + + return true; + } +} diff --git a/src/SharpMUTerm.Client/Modals/SearchModel.cs b/src/SharpMUTerm.Client/Modals/SearchModel.cs index 0f9bb28c..3c96c168 100644 --- a/src/SharpMUTerm.Client/Modals/SearchModel.cs +++ b/src/SharpMUTerm.Client/Modals/SearchModel.cs @@ -4,8 +4,17 @@ namespace SharpMUTerm.Client.Modals; /// One row of ⌃F's results: which window the line is in, where it sits in that window's buffer, and where the query /// landed inside it. /// +/// +/// A row from older history (⌥H) has at the line's absolute index in its session's scrollback and +/// −1: it is not in the pane buffer, so ⏎ opens it in the read-only history view (or scrolls the +/// pane to it when the pane still holds it). +/// public readonly record struct SearchRow( - string WindowId, string WindowLabel, int LineIndex, string Text, int MatchStart, int MatchLength); + string WindowId, string WindowLabel, int LineIndex, string Text, int MatchStart, int MatchLength, long History = -1, string? SessionKey = null) +{ + /// Whether this row came from older history rather than the pane buffer. + public bool IsOlder => History >= 0; +} /// /// ⌃F's results for one query — the search surface's model, drawn by the cell surface (SearchPrompt.Render) @@ -18,7 +27,13 @@ public readonly record struct SearchRow( /// What the focused window is called, for the one-window case. /// How many lines were searched: the bound, stated rather than implied. /// Why the query could not be used (an unparseable pattern), or null. -/// The matches, in buffer order. +/// The matches, in buffer order; then, with , older history's, newest first. +/// Whether older history is searched too (⌥H): the session's scrollback and its spill. +/// +/// What older history holds or how far its search has got (⌥H searches older history · 38,000 lines in Corvid, +/// older history · 7 found in 38,000 lines), or why there is none (a capture window has no spill); null for nothing to say. +/// +/// Whether the older-history search is still reading. public sealed record SearchModel( string Query, bool Regex, @@ -26,10 +41,16 @@ public sealed record SearchModel( string Scope, int Held, string? Error, - IReadOnlyList Rows) + IReadOnlyList Rows, + bool Older = false, + string? HistoryNote = null, + bool HistoryRunning = false) { - /// The two toggles and what they mean now, in words: text · Corvid, regex · every window. - public string StateText => $"{(Regex ? "regex" : "text")} · {(AllWindows ? "every window" : Scope)}"; + /// The toggles and what they mean now, in words: text · Corvid, regex · every window · older history. + public string StateText => $"{(Regex ? "regex" : "text")} · {(AllWindows ? "every window" : Scope)}{(Older ? " · older history" : string.Empty)}"; + + /// How many rows are the pane buffer's (the rest are older history's, listed after them). + public int HeldRows => Rows.Count(r => !r.IsOlder); /// /// How many lines matched out of how many were looked at — 12 found · 4,812 lines held — so a reader who @@ -40,7 +61,7 @@ public string CountText get { var searched = $"{Held:n0} line{(Held == 1 ? string.Empty : "s")} held"; - return Error is not null ? searched : $"{Rows.Count} found · {searched}"; + return Error is not null ? searched : $"{HeldRows} found · {searched}"; } } @@ -48,13 +69,15 @@ public string CountText public string? EmptyText => Error is not null ? Error : Query.Length == 0 ? $"type to search {(AllWindows ? "every window" : Scope)}" - : Rows.Count == 0 ? "no matches — ⌫ widens the query" + : Rows.Count == 0 && HistoryRunning ? "nothing in the lines held — searching older history…" + : Rows.Count == 0 ? (Older ? "no matches here or in older history — ⌫ widens the query" : "no matches — ⌫ widens the query") : null; public bool Equals(SearchModel? other) => other is not null && Query == other.Query && Regex == other.Regex && AllWindows == other.AllWindows && Scope == other.Scope && Held == other.Held && Error == other.Error + && Older == other.Older && HistoryNote == other.HistoryNote && HistoryRunning == other.HistoryRunning && ModelLists.Same(Rows, other.Rows); public override int GetHashCode() => HashCode.Combine(Query, Regex, AllWindows, Scope, Held, Error, ModelLists.Hash(Rows)); @@ -67,15 +90,15 @@ other is not null /// public sealed class SearchSession : ModalSession { - private readonly Action _search; + private readonly Action _search; private readonly Action _go; /// The empty search it opens on. /// Whether the client's theme is a dark one. - /// Re-runs the search for a query and the two toggles; called from any thread. + /// Re-runs the search for a query and the three toggles (regex, every window, older history); called from any thread. /// Goes to row N of the model handed with it, after the surface has closed. /// Told the surface closed. - public SearchSession(SearchModel model, bool isDark, Action search, Action go, Action closed) + public SearchSession(SearchModel model, bool isDark, Action search, Action go, Action closed) : base(model, isDark, closed) { ArgumentNullException.ThrowIfNull(search); @@ -86,12 +109,15 @@ public SearchSession(SearchModel model, bool isDark, Action public override string Surface => "search"; - /// The host's: the query or a toggle changed. - public void Search(string query, bool regex, bool allWindows) + /// The host's: the query or a toggle changed. Older history stays as the model has it. + public void Search(string query, bool regex, bool allWindows) => Search(query, regex, allWindows, Model.Older); + + /// The host's: the query or a toggle changed, older history (⌥H) included. + public void Search(string query, bool regex, bool allWindows, bool older) { if (!IsEnded) { - _search(query ?? string.Empty, regex, allWindows); + _search(query ?? string.Empty, regex, allWindows, older); } } diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 0629ac20..e176ea8d 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -195,6 +195,12 @@ public static class SurfaceCatalog /// A character's script console: its scripts' output and errors, a Lua prompt, and its store.*. public const string ScriptConsole = "script-console"; + /// + /// The read-only history view: a page of a session's scrollback (its ring or its spill) around a line ⌃F's older-history + /// search found, opened by ⏎ on that hit. + /// + public const string HistoryView = "history-view"; + /// /// The +3 ▾ chip a tab strip carries when its tabs do not fit even at their floors, and the list of the tabs /// past its edges it opens: a cell list in a terminal, a native menu in the window (the chip itself is cells in both). @@ -218,7 +224,7 @@ public static class SurfaceCatalog private static string[] PanelViews(string view) => ["SharpMUTerm.Avalonia." + view, "SharpMUTerm.Avalonia.PopOutButton"]; /// The modals the window draws with its own controls in place of the cell modal (ClientHost.NativeModals). - public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary, Import, ScriptConsole]; + public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary, Import, ScriptConsole, HistoryView]; /// A cell modal in a terminal; the window's own modal in its place. private static readonly IReadOnlyDictionary NativeModal = new Dictionary @@ -442,7 +448,8 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), Search, typeof(SearchModel), [ - // Typing, ⌥E and ⌥A re-run the search over the pane buffers; ⏎ goes to the row through the one path to a hit. + // Typing, ⌥E, ⌥A and ⌥H re-run the search over the pane buffers (and, with ⌥H, the sessions' scrollback off + // the UI thread); ⏎ goes to the row through the one path to a hit, or opens an older one in the history view. new(SurfaceActionKind.Modal, "query", "SearchModelFor"), new(SurfaceActionKind.Modal, "go", "GoToSearchHit"), ], @@ -523,10 +530,23 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), new(SurfaceActionKind.Modal, "run", "RunConsoleLine"), new(SurfaceActionKind.Modal, "delete key", "DeleteStoreKey"), new(SurfaceActionKind.Modal, "reload", "ReloadConsoleScripts"), + + // ⌃E (the window's Edit a script… button): the console closes and the palette lists the script files. + new(SurfaceActionKind.Modal, "edit a script", "EditScriptFromConsole"), ], NativeModal, "SharpMUTerm.Tui.ScriptConsoleSurface.Render", ModalViews("ScriptConsoleView")), + new( + HistoryView, + typeof(ScrollbackViewModel), + [ + // ↑↓ PgUp PgDn Home End read another page of the scrollback, through the client's one ranged read. + new(SurfaceActionKind.Modal, "scroll", "ScrollHistoryView"), + ], + NativeModal, + "SharpMUTerm.Tui.ScrollbackViewSurface.Render", + ModalViews("ScrollbackView")), new( TabOverflow, typeof(MenuModel), diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index f5657ed6..f7682da9 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -70,6 +70,7 @@ public sealed record CharacterRef( /// Whether the configuration is new — no world yet, or the key tour still owed — so Help, Welcome and Import are suggested. /// /// The rooms the last /map find listed, newest search only, so ⌃P offers to walk to each. +/// The focused character's script files, so ⌃P offers to open each in the editor. public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -94,7 +95,14 @@ public sealed record CommandContext( int MapAreas = 0, bool MapViewing = false, bool NewConfiguration = false, - IReadOnlyList? MapFound = null); + IReadOnlyList? MapFound = null, + IReadOnlyList? ScriptFiles = null); + +/// A script file ⌃P offers to open in the editor. +/// Its name under the scripts folder (combat.lua), or package:<id>/<file>. +/// What the entry says about it: where it is, whether it loaded, its last error's line. +/// Whether it can only be read (a package's script). +public sealed record ScriptFileRef(string Name, string Detail, bool ReadOnly); /// A room the last /map find listed, for the command surface's Walk to … entries. /// The room's id on the map. diff --git a/src/SharpMUTerm.Core/Text/ScrollbackSearch.cs b/src/SharpMUTerm.Core/Text/ScrollbackSearch.cs new file mode 100644 index 00000000..2c599bac --- /dev/null +++ b/src/SharpMUTerm.Core/Text/ScrollbackSearch.cs @@ -0,0 +1,137 @@ +namespace SharpMUTerm.Core.Text; + +/// One line of a session's scrollback the deep search found: its absolute index, the line, and where it matched. +/// The line's absolute index in the (stable while it is held). +/// The line itself — the ring's own instance while it is in memory, a decoded copy from the spill. +/// Where the query matched in . +/// How long the matched run is. +public readonly record struct ScrollbackMatch(long Index, StyledLine Line, int MatchStart, int MatchLength); + +/// Where a deep search has got to: what it found so far, how far it has read, and whether it has finished. +/// Every match so far, newest first. +/// How many lines have been read. +/// How many lines there were to read when it started. +/// Whether the walk has ended (finished, capped, failed — not cancelled). +/// Whether it stopped at . +/// Why the query could not be used, or null. +public sealed record ScrollbackSearchProgress( + IReadOnlyList Found, long Searched, long Total, bool Done, bool Capped, string? Error); + +/// +/// ⌃F's "search older history" step (⌥H): the session's whole — the in-memory ring and +/// the file-backed spill behind it — walked from the newest line back to the oldest in ranged reads of at most +/// , each matched by (so case, regex mode, +/// the query bound and the per-line match timeout are ⌃F's exactly). +/// +/// It runs off the UI thread: a spill read is disk I/O, and tens of thousands of lines are more than one keystroke +/// can afford. The caller hands a token and gets after every chunk, so results stream into the +/// surface as they are found; a cancelled walk reports nothing further. +/// +/// +/// Lines the pane still holds are skipped (): the ordinary ⌃F rows already list them, and a +/// session window's pane shares the ring's instances, so the caller can say which by reference. +/// +/// +public static class ScrollbackSearch +{ + /// The most hits one deep search keeps; past it the walk stops and says so. + public const int MaxHits = 500; + + /// + /// Walks from its newest line back to its oldest for . + /// + /// The session's scrollback. + /// What to look for; empty finds nothing. + /// Whether it is a pattern. + /// Lines not to list (the pane still holds them); null skips none. + /// Told after every chunk, on the walking thread. + /// Ends the walk between chunks. + /// Lines per ranged read; at most . + /// The last progress reported, or null when cancelled. + public static ScrollbackSearchProgress? Run( + ScrollbackBuffer buffer, + string query, + bool regex, + Func? skip, + Action? progress, + CancellationToken cancel, + int chunk = ScrollbackBuffer.MaxRangeLines) + { + ArgumentNullException.ThrowIfNull(buffer); + ArgumentNullException.ThrowIfNull(query); + chunk = Math.Clamp(chunk, 1, ScrollbackBuffer.MaxRangeLines); + + var end = buffer.TotalLines; + var oldest = buffer.OldestIndex; + var total = Math.Max(0, end - oldest); + var found = new List(); + long searched = 0; + + if (query.Length == 0) + { + return Report(new ScrollbackSearchProgress([], 0, total, true, false, null)); + } + + var cursor = end; + while (cursor > oldest) + { + if (cancel.IsCancellationRequested) + { + return null; + } + + // The oldest line may move up while this walks (the spill trims its front); a range that starts below it + // comes back short from the front, so each line's index is counted back from the end of the range. + var start = Math.Max(oldest, cursor - chunk); + var count = (int)(cursor - start); + var lines = buffer.GetRange(start, count); + var first = cursor - lines.Count; + var texts = new string[lines.Count]; + for (var i = 0; i < lines.Count; i++) + { + texts[i] = skip?.Invoke(lines[i]) == true ? string.Empty : lines[i].Text; + } + + var result = OutputSearch.Match(texts, query, regex); + if (result.Error is { } error) + { + return Report(new ScrollbackSearchProgress([], searched, total, true, false, error)); + } + + var capped = false; + for (var m = result.Matches.Count - 1; m >= 0; m--) + { + var match = result.Matches[m]; + found.Add(new ScrollbackMatch(first + match.LineIndex, lines[match.LineIndex], match.MatchStart, match.MatchLength)); + if (found.Count >= MaxHits) + { + capped = true; + break; + } + } + + searched += count; + cursor = start; + if (capped) + { + return Report(new ScrollbackSearchProgress(found.ToArray(), searched, total, true, true, null)); + } + + if (cancel.IsCancellationRequested) + { + return null; + } + + progress?.Invoke(new ScrollbackSearchProgress(found.ToArray(), searched, total, cursor <= oldest, false, null)); + } + + var last = new ScrollbackSearchProgress(found.ToArray(), searched, total, true, false, null); + return searched == 0 ? Report(last) : last; + + ScrollbackSearchProgress Report(ScrollbackSearchProgress done) + { + progress?.Invoke(done); + return done; + } + } +} diff --git a/src/SharpMUTerm.Scripting/ScriptFiles.cs b/src/SharpMUTerm.Scripting/ScriptFiles.cs new file mode 100644 index 00000000..20a542e4 --- /dev/null +++ b/src/SharpMUTerm.Scripting/ScriptFiles.cs @@ -0,0 +1,264 @@ +using System.Text; + +namespace SharpMUTerm.Scripting; + +/// +/// The script files a player can open, create and save from inside the client (⌃P ▸ Edit script…, the script +/// console's ⌃E, /script new|edit). Every path goes through , the rule the +/// loader already applies, so the editor can reach exactly the files the loader can read and nothing else. +/// +/// +/// +/// A name, never a path. What a player types is a relative name with / between folders. It is refused +/// when it is absolute, holds .. or a backslash, is not .lua, or resolves outside the root. Where an +/// existing file or folder on the way is a link, the save is refused too: a link inside the root that points out of it +/// would otherwise turn a save into a write anywhere. +/// +/// +/// A save is atomic: the text is written to a temporary file beside the target and renamed over it, so a crash +/// or a full disk leaves the old file whole rather than half a script the next reload would run. +/// +/// +public static class ScriptFiles +{ + /// The extension every script has. + public const string Extension = ".lua"; + + /// The most files listed. + public const int MaxListed = 200; + + /// The longest name accepted. + public const int MaxNameLength = 120; + + /// The largest file the editor opens or saves. + public const int MaxBytes = 512 * 1024; + + /// The prefix a package's script carries in a trigger set. + public const string PackagePrefix = "package:"; + + /// What a new script starts as. + public const string Template = + "-- A script for this character. Saved under the scripts folder; ⌃S saves and reloads.\n" + + "-- Name it in a trigger set's scripts (F5) to load it, and call its functions from a rule's script field.\n" + + "\n" + + "function greet(line)\n" + + " print('saw: ' .. line)\n" + + "end\n"; + + /// + /// The .lua files under , as names relative to it with / between folders, sorted, + /// at most . A missing or unreadable root lists nothing. + /// + public static IReadOnlyList List(string root) + { + ArgumentException.ThrowIfNullOrWhiteSpace(root); + var full = Path.TrimEndingDirectorySeparator(Path.GetFullPath(root)); + if (!Directory.Exists(full)) + { + return []; + } + + try + { + var options = new EnumerationOptions { RecurseSubdirectories = true, IgnoreInaccessible = true, AttributesToSkip = FileAttributes.ReparsePoint, MaxRecursionDepth = 6 }; + return Directory.EnumerateFiles(full, "*" + Extension, options) + .Select(path => Path.GetRelativePath(full, path).Replace(Path.DirectorySeparatorChar, '/')) + .Where(name => Check(name) is null) + .OrderBy(name => name, StringComparer.Ordinal) + .Take(MaxListed) + .ToArray(); + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) + { + return []; + } + } + + /// + /// What is wrong with as a script's name, or null when it is one: relative, / + /// between folders, no .., no backslash or control character, ending in .lua. + /// + public static string? Check(string? name) + { + if (string.IsNullOrWhiteSpace(name)) + { + return "give the script a name, such as combat.lua"; + } + + if (name.Length > MaxNameLength) + { + return $"a script's name is at most {MaxNameLength} characters"; + } + + if (name.Any(char.IsControl) || name.Contains('\\', StringComparison.Ordinal) || name.Contains(':', StringComparison.Ordinal)) + { + return "a script's name has no backslash, colon or control character — use / between folders"; + } + + if (name.StartsWith('/') || Path.IsPathRooted(name)) + { + return "a script's name is relative to the scripts folder, not a path from the root of the disk"; + } + + var parts = name.Split('/'); + if (parts.Any(p => p.Length == 0 || p == "." || p == "..")) + { + return "a script's name cannot leave the scripts folder (no .. and no empty folder names)"; + } + + if (!name.EndsWith(Extension, StringComparison.Ordinal) || name.Length == Extension.Length) + { + return "a script's name ends in .lua"; + } + + return null; + } + + /// + /// A typed name made into a script's: .lua added when it has no extension, surrounding space trimmed. Still + /// to be ed. + /// + public static string Normalise(string? typed) + { + var name = (typed ?? string.Empty).Trim(); + return name.Length > 0 && !Path.HasExtension(name) ? name + Extension : name; + } + + /// + /// The full path of script under , or why it has none: a name that + /// fails , or one that resolves outside the root. + /// + public static (string? Path, string? Error) PathOf(string root, string name) + { + ArgumentException.ThrowIfNullOrWhiteSpace(root); + if (Check(name) is { } why) + { + return (null, why); + } + + return SessionScripts.Resolve(root, name) is { } path + ? (path, null) + : (null, "that name is outside the scripts folder"); + } + + /// The text of script , or why it cannot be read. + public static (string? Text, string? Error) Read(string root, string name) + { + var (path, error) = PathOf(root, name); + if (path is null) + { + return (null, error); + } + + try + { + var info = new FileInfo(path); + if (!info.Exists) + { + return (null, $"{name} does not exist yet"); + } + + if (info.Length > MaxBytes) + { + return (null, $"{name} is larger than {MaxBytes / 1024} KB — edit it outside the client"); + } + + return (File.ReadAllText(path, Encoding.UTF8).Replace("\r\n", "\n", StringComparison.Ordinal), null); + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) + { + return (null, $"{name} could not be read: {ex.Message}"); + } + } + + /// + /// Writes to script under , line for line as + /// typed (line breaks as \n, one at the end): to a temporary file beside it, then renamed over it. Creates the + /// script's folders inside the root. Returns null when it was written, otherwise why not; nothing is changed on a + /// refusal. + /// + /// True for a new script: refused when the file already exists. + public static string? Save(string root, string name, string text, bool mustBeNew = false) + { + ArgumentNullException.ThrowIfNull(text); + var (path, error) = PathOf(root, name); + if (path is null) + { + return error; + } + + var body = text.Replace("\r\n", "\n", StringComparison.Ordinal).Replace('\r', '\n'); + if (body.Length > 0 && !body.EndsWith('\n')) + { + body += "\n"; + } + + var bytes = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false).GetBytes(body); + if (bytes.Length > MaxBytes) + { + return $"a script is at most {MaxBytes / 1024} KB"; + } + + var fullRoot = Path.TrimEndingDirectorySeparator(Path.GetFullPath(root)); + if (!Directory.Exists(fullRoot)) + { + return $"there is no scripts folder — create {fullRoot} first"; + } + + if (LinkOnTheWay(fullRoot, path) is { } link) + { + return $"{link} is a link, and a save never follows one out of the scripts folder"; + } + + if (mustBeNew && File.Exists(path)) + { + return $"{name} already exists — open it with Edit script"; + } + + var folder = Path.GetDirectoryName(path)!; + var temp = Path.Combine(folder, $".{Path.GetFileName(path)}.{Guid.NewGuid():N}.tmp"); + try + { + Directory.CreateDirectory(folder); + if (LinkOnTheWay(fullRoot, path) is { } created) + { + return $"{created} is a link, and a save never follows one out of the scripts folder"; + } + + File.WriteAllBytes(temp, bytes); + File.Move(temp, path, overwrite: true); + return null; + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) + { + try + { + File.Delete(temp); + } + catch (Exception cleanup) when (cleanup is IOException or UnauthorizedAccessException) + { + // Nothing more to do: the target was never touched. + } + + return $"{name} was not saved: {ex.Message}"; + } + } + + /// The first file or folder from the root down to that exists and is a link, by its name relative to the root. + private static string? LinkOnTheWay(string fullRoot, string path) + { + var relative = Path.GetRelativePath(fullRoot, path); + var current = fullRoot; + foreach (var part in relative.Split(Path.DirectorySeparatorChar)) + { + current = Path.Combine(current, part); + FileSystemInfo info = Directory.Exists(current) ? new DirectoryInfo(current) : new FileInfo(current); + if (info.Exists && info.LinkTarget is not null) + { + return Path.GetRelativePath(fullRoot, current).Replace(Path.DirectorySeparatorChar, '/'); + } + } + + return null; + } +} diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 959dd2f8..3773e81a 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -14,7 +14,23 @@ namespace SharpMUTerm.Tui; /// The editor's buffer, exactly as typed. /// The window's escaping mode when it happened. /// The MOO buffer this is an edit of, or null for a post. -internal readonly record struct ComposeResult(string Body, ComposeEscaping Escaping, MooEdit? Edit = null); +/// The script file this is an edit of, or null. +internal readonly record struct ComposeResult(string Body, ComposeEscaping Escaping, MooEdit? Edit = null, ScriptEdit? Script = null); + +/// +/// A script file open in the composer: its name under the scripts folder (or package:<id>/<file>), whose +/// scripts a save reloads, whether it can only be read, what the last save said and the line the caret opens on. +/// +/// The script's name. +/// The session key of the character whose scripts a save reloads; null for none. +/// A package's script: shown, never saved. +/// What the last save said, or null. +/// The line the caret opens on, from 1; 0 for the top. +internal sealed record ScriptEdit(string Name, string? Owner, bool ReadOnly, string? Status = null, int Line = 0) +{ + /// What the editor says this is: the MOO edit's shape, read by both hosts. + internal ComposerEdit Describe() => new(Name, "lua", Script: true, ReadOnly, Status, Line); +} /// /// The composer: a full-screen editor for writing a post before sending it, over the workspace. @@ -51,6 +67,7 @@ internal sealed class ComposeOverlay private string _target = string.Empty; private bool _canSend; private MooEdit? _edit; + private ScriptEdit? _script; private readonly Func? _openSpelling; private SpellChecker? _spelling; private bool _spellingOpened; @@ -80,7 +97,7 @@ internal ComposeOverlay(ConsoleWindowSystem system, Func? spellin /// The dictionary marking this post, or null: none was found, or this is a MOO edit, whose buffer is as often /// code as prose. /// - internal SpellChecker? Spelling => _edit is null ? _spelling : null; + internal SpellChecker? Spelling => _edit is null && _script is null ? _spelling : null; /// ⌥W in a post with no dictionary: the host offers to download one. internal event EventHandler? DictionaryWanted; @@ -120,6 +137,21 @@ internal void ForgetSpelling() /// internal MooEdit? Edit => _edit; + /// The script file being edited, or null. Saved as its lines, like a MOO edit. + internal ScriptEdit? Script => _script; + + /// Says what the last save of the open script did, in the header, without touching the editor. + internal void SetScriptStatus(string status) + { + if (_script is null) + { + return; + } + + _script = _script with { Status = status }; + RefreshBands(); + } + /// The header row's markup, so a test can read who the window says it will send to. internal string HeaderMarkup => Render(Model).Header; @@ -127,7 +159,7 @@ internal void ForgetSpelling() /// What the window draws, as the shared model a native composer draws: the target, the buffer as it stands, the /// mode, the edit, the dictionary and its marks, and the key row. /// - internal ComposerModel Model => ModelFor(_target, Body, _escaping, _edit, Spelling, _canSend, Preview); + internal ComposerModel Model => ModelFor(_target, Body, _escaping, _edit, Spelling, _canSend, Preview, _script); /// /// Whether F1 shows the post as it will be sent (⌥P), under the editor. One fact for the run in both hosts — the @@ -143,13 +175,13 @@ internal void ForgetSpelling() /// it, so the two say the same thing for the same draft. Revision 1: F1 opens on a draft and nothing replaces it /// while it is open. /// - internal static ComposerModel ModelFor(string target, string body, ComposeEscaping escaping, MooEdit? edit, SpellChecker? spelling, bool canSend, bool preview = false) => + internal static ComposerModel ModelFor(string target, string body, ComposeEscaping escaping, MooEdit? edit, SpellChecker? spelling, bool canSend, bool preview = false, ScriptEdit? script = null) => ComposerModel.Create( ComposerPlace.FullScreen, target, body, escaping, - edit is null ? null : new ComposerEdit(edit.Name, edit.Type), + script is not null ? script.Describe() : edit is null ? null : new ComposerEdit(edit.Name, edit.Type), spelling, canSend, armed: true, @@ -169,7 +201,8 @@ internal static ComposerModel ModelFor(string target, string body, ComposeEscapi /// which is the same rule ⏎ follows on the command line. /// /// The MOO buffer this opens on, or null for a post. - internal void Toggle(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null) + /// The script file this opens on, or null. + internal void Toggle(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null, ScriptEdit? script = null) { if (_window is not null) { @@ -180,12 +213,17 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool _target = target; _escaping = escaping; _canSend = canSend; - _edit = edit; + _edit = script is null ? edit : null; + _script = script; _editor = new MultilineEditControl { WrapMode = WrapMode.WrapWords, - ShowLineNumbers = false, + + // A script is code: its lines are numbered, so a load error's file:line can be found, and a package's script is + // shown read-only. + ShowLineNumbers = script is not null, + ReadOnly = script?.ReadOnly == true, IsEditing = true, // Fill, so the editor is the window rather than the control's ten-row default sitting in the @@ -200,7 +238,9 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool // into browse mode — which would make the key mean two different things depending on a // state the writer has no reason to be tracking. EscapeExitsEditMode = false, - PlaceholderText = edit is null + PlaceholderText = script is not null + ? "An empty script. ⌃S saves it and reloads this character's scripts." + : edit is null ? "Write your post. ⏎ starts a new line; the game gets one command with %r breaks." : "Empty. ⌃S saves it empty.", @@ -229,6 +269,11 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool } _editor.SetContent(draft); + if (script is { Line: > 0 } at) + { + _editor.GoToLine(at.Line); + } + _editor.ContentChanged += (_, _) => RefreshBands(); FitEditor(); @@ -327,7 +372,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) // ⌥L flips the escaping. Alt rather than Ctrl by this codebase's rule — ESC + a printable byte // arrives intact, while half the Ctrl alphabet collapses onto bytes a terminal already spends. - if (alt && key.Key == ConsoleKey.L && _edit is null) + if (alt && key.Key == ConsoleKey.L && _edit is null && _script is null) { e.Handled = true; _escaping = _escaping == ComposeEscaping.Literal ? ComposeEscaping.AsTyped : ComposeEscaping.Literal; @@ -345,7 +390,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) } // ⌥W with no dictionary is the way to one: the host closes this window (keeping the draft) and asks first. - if (alt && key.Key == ConsoleKey.W && _edit is null) + if (alt && key.Key == ConsoleKey.W && _edit is null && _script is null) { e.Handled = true; DictionaryWanted?.Invoke(this, EventArgs.Empty); @@ -355,7 +400,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) // ⌥P shows the post as it will be sent, and hides it again. Alt by the same rule; P for preview, and nothing in // MacroKeys.AppShortcuts, the bar's table or a host's reserved chords takes it. A MOO edit is sent as its lines, // which the editor already shows, so it has no preview. - if (alt && key.Key == ConsoleKey.P && _edit is null) + if (alt && key.Key == ConsoleKey.P && _edit is null && _script is null) { e.Handled = true; Preview = !Preview; @@ -407,7 +452,7 @@ private void SendNow() // the close so the handler sees the buffer rather than an empty window — and Closed still // follows, so a send the host refuses (no connection) keeps the post rather than dropping it on // the floor. - Send?.Invoke(this, new ComposeResult(_editor.GetContent(), _escaping, _edit)); + Send?.Invoke(this, new ComposeResult(Body, _escaping, _edit, _script)); } /// Shuts the window, handing the buffer back for the host to keep. @@ -418,7 +463,7 @@ internal void Close() return; } - var result = new ComposeResult(Body, _escaping, _edit); + var result = new ComposeResult(Body, _escaping, _edit, _script); _system.CloseModalWindow(window); Closed?.Invoke(this, result); } @@ -573,7 +618,17 @@ internal static (string Header, string Footer) Render(ComposerModel model, int w var footerKeys = KeyLadder.Choose(FooterKeys(model), width); string header; - if (model.Edit is { } edit) + if (model.Edit is { Script: true } script) + { + var status = script.Status is { } said + ? $"[{ScreenPalette.Label}] · [/][{(said.StartsWith('!') ? ScreenPalette.Warn : ScreenPalette.Value)}]{Escape(said)}[/]" + : string.Empty; + header = $"[{ScreenPalette.Accent}]{(script.ReadOnly ? "READ ONLY" : "SCRIPT")}[/] [{ScreenPalette.Value}]{Escape(script.Name)}[/]" + + $"[{ScreenPalette.Label}] lua · {(model.Target.Length == 0 ? "reloads nobody" : "reloads ")}[/]" + + (model.Target.Length == 0 ? string.Empty : $"[{ScreenPalette.Value}]{Escape(model.Target)}[/]") + + status; + } + else if (model.Edit is { } edit) { header = $"[{ScreenPalette.Accent}]EDIT[/] [{ScreenPalette.Value}]{Escape(edit.Name)}[/]" + $"[{ScreenPalette.Label}] {Escape(edit.Type)} · from [/]{target}"; @@ -662,6 +717,7 @@ private void Reset() _window = null; _editor = null; _edit = null; + _script = null; _headerBand = null; _footerBand = null; _previewBand = null; diff --git a/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs b/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs index 56c0e30a..7bacd41a 100644 --- a/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs +++ b/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs @@ -40,6 +40,7 @@ internal enum Ask Run, Delete, Reload, + Edit, } /// @@ -54,6 +55,11 @@ public Ask Key(ConsoleKeyInfo key) return Ask.Reload; } + if (ctrl && key.Key == ConsoleKey.E) + { + return Model.CanRun ? Ask.Edit : Ask.None; + } + if (key.Key == ConsoleKey.Tab) { OnStore = !OnStore && Model.Store.Count > 0; @@ -200,9 +206,10 @@ internal static IReadOnlyList FooterKeys(bool onStore) => onStore ] : [ - new("⏎", "runs", Drop: 4), + new("⏎", "runs", Drop: 5), new("↑↓", "history", Drop: 2), new("⇥", "store keys", "store", Drop: 3), + new("⌃E", "edits a script", "edit", Drop: 4), new("⌃L", "reloads scripts", "reload", Drop: 1), new("Esc", "closes"), ]; diff --git a/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs b/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs new file mode 100644 index 00000000..fc75cf72 --- /dev/null +++ b/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs @@ -0,0 +1,61 @@ +using SharpMUTerm.Client.Modals; +using static SharpMUTerm.Tui.MarkupText; +using static SharpMUTerm.Tui.ScreenPalette; + +namespace SharpMUTerm.Tui; + +/// +/// The read-only history view in cells: a page of a session's scrollback (ring or spill) around the line ⌃F's older-history +/// search found, that line on the accent band and the query's run in every line in bold accent. Pure: the page is the +/// the window's native view draws too, and every move is the client's ranged read. +/// Always rows of page, so the overlay sized once at open keeps fitting. +/// +internal static class ScrollbackViewSurface +{ + /// The width the view asks for; the overlay narrows it on a small terminal. + internal const int PreferredWidth = 110; + + /// The view's lines at : title, position, a blank, the page, a blank, the keys. + internal static List Render(ScrollbackViewModel model, int width) + { + width = Math.Max(20, width); + var lines = new List + { + SpreadLR($"[{Label}]{Escape(model.Title)}[/]", $"[{Muted}]{Escape(model.Position)}[/]", width), + string.Empty, + }; + + for (var i = 0; i < ScrollbackViewModel.PageRows; i++) + { + lines.Add(i < model.Lines.Count ? Row(model.Lines[i], model.Lines[i].Index == model.Marked, width) : string.Empty); + } + + lines.Add(string.Empty); + lines.Add($"[{Label}]{Escape(ElidePlain(ScrollbackViewModel.Keys, width))}[/]"); + return lines; + } + + private static string Row(ScrollbackViewLine line, bool marked, int width) + { + var text = ElidePlain(line.Text.Replace('\t', ' '), width - 2); + if (marked) + { + var pad = new string(' ', Math.Max(0, width - 2 - text.Length)); + return $"[{Ink} on {Accent}]▸ {Escape(text)}{pad}[/]"; + } + + if (line.MatchStart < 0 || line.MatchStart >= text.Length || line.MatchLength <= 0) + { + return $" [{Value}]{Escape(text)}[/]"; + } + + var length = Math.Min(line.MatchLength, text.Length - line.MatchStart); + var before = text[..line.MatchStart]; + var hit = text.Substring(line.MatchStart, length); + var after = text[(line.MatchStart + length)..]; + return $" [{Value}]{Escape(before)}[/][bold {Accent}]{Escape(hit)}[/][{Value}]{Escape(after)}[/]"; + } + + private static string ElidePlain(string text, int width) => + width <= 0 ? string.Empty : text.Length <= width ? text : text[..Math.Max(0, width - 1)] + "…"; +} diff --git a/src/SharpMUTerm.Tui/SearchPrompt.cs b/src/SharpMUTerm.Tui/SearchPrompt.cs index bcf5097f..c93e2b2b 100644 --- a/src/SharpMUTerm.Tui/SearchPrompt.cs +++ b/src/SharpMUTerm.Tui/SearchPrompt.cs @@ -22,7 +22,7 @@ internal enum SearchAction /// The answer to one keystroke: what to do, and the state it leaves behind. internal readonly record struct SearchDecision( - SearchAction Action, string Query, int Selected, bool Regex, bool AllWindows); + SearchAction Action, string Query, int Selected, bool Regex, bool AllWindows, bool Older = false); /// /// The search surface (⌃F), minus the window: what a keystroke means to it, and what it says. Pure, for @@ -55,7 +55,7 @@ internal static class SearchPrompt /// be widened. /// internal const string Hints = - "type to search · ↑↓ pick · ⏎ go · ⌥E regex · ⌥A all windows · Esc cancel · ⌃F closes"; + "type to search · ↑↓ pick · ⏎ go · ⌥E regex · ⌥A all windows · ⌥H older history · Esc cancel · ⌃F closes"; /// /// The footer's drop-order ladder, longest first: the status row's rule (FocusHints). @@ -66,9 +66,9 @@ internal static class SearchPrompt internal static readonly string[] HintLadder = [ Hints, - "↑↓ pick · ⏎ go · ⌥E regex · ⌥A all windows · Esc cancel · ⌃F closes", - "↑↓ pick · ⏎ go · ⌥E regex · ⌥A all · Esc cancel · ⌃F closes", - "↑↓ · ⏎ go · ⌥E regex · ⌥A all · Esc · ⌃F", + "↑↓ pick · ⏎ go · ⌥E regex · ⌥A all windows · ⌥H older history · Esc cancel · ⌃F closes", + "↑↓ pick · ⏎ go · ⌥E regex · ⌥A all · ⌥H older · Esc cancel · ⌃F closes", + "↑↓ · ⏎ go · ⌥E regex · ⌥A all · ⌥H older · Esc · ⌃F", ]; /// The longest rung of that fits (all of it when unknown). @@ -96,9 +96,9 @@ internal static string HintsFor(int width) => /// /// internal static SearchDecision Interpret( - ConsoleKeyInfo key, string query, int selected, int count, bool regex, bool all) + ConsoleKeyInfo key, string query, int selected, int count, bool regex, bool all, bool older = false) { - var state = new SearchDecision(SearchAction.None, query, selected, regex, all); + var state = new SearchDecision(SearchAction.None, query, selected, regex, all, older); if (key.Modifiers.HasFlag(ConsoleModifiers.Control)) { @@ -118,6 +118,10 @@ internal static SearchDecision Interpret( { ConsoleKey.E => state with { Action = SearchAction.Redraw, Regex = !regex, Selected = 0 }, ConsoleKey.A => state with { Action = SearchAction.Redraw, AllWindows = !all, Selected = 0 }, + + // ⌥H: older history too — the sessions' scrollback and its spill, searched off the UI thread and listed + // after the pane's rows as they are found. H for history; nothing in the app's shortcuts takes it. + ConsoleKey.H => state with { Action = SearchAction.Redraw, Older = !older }, _ => state, }; } @@ -212,15 +216,18 @@ internal static List Render(SearchModel model, int selected, int width = var query = model.Query; var all = model.AllWindows; - var labelWidth = all - ? Math.Min(MaxLabelWidth, rows.Select(r => r.WindowLabel.Length).DefaultIfEmpty(0).Max()) + var labelWidth = all || rows.Any(r => r.IsOlder) + ? Math.Min(MaxLabelWidth, rows.Select(r => RowLabel(r, all).Length).DefaultIfEmpty(0).Max()) : 0; var entryWidth = (width > 0 ? width : DefaultEntryWidth) - 4 - (labelWidth > 0 ? labelWidth + 2 : 0); var lines = new List { SpreadLR($"[{Label}]search[/] {QueryMarkup(query)}", $"[{Label}]{Escape(model.StateText)}[/]", width), - SpreadLR(string.Empty, $"[{Label}]{Escape(model.CountText)}[/]", width), + SpreadLR( + model.HistoryNote is { } note ? $"[{(model.HistoryRunning ? Accent : Muted)}]{Escape(note)}[/]" : string.Empty, + $"[{Label}]{Escape(model.CountText)}[/]", + width), }; var body = new List(); @@ -233,7 +240,7 @@ internal static List Render(SearchModel model, int selected, int width = var last = listRows > 0 ? Math.Min(rows.Count, top + listRows - body.Count) : rows.Count; for (var i = top; i < last; i++) { - body.Add(Row(rows[i], i == selected, entryWidth, labelWidth, width)); + body.Add(Row(rows[i], i == selected, entryWidth, labelWidth, width, all)); } while (body.Count < listRows) @@ -271,10 +278,17 @@ private static string QueryMarkup(string query) => ? $"[{Ink} on {Accent}] [/]" : $"[{Value}]{Escape(query)}[/][{Ink} on {Accent}] [/]"; - private static string Row(SearchRow row, bool selected, int entryWidth, int labelWidth, int width) + /// + /// What a row's window column says: the window's name in ⌥A scope, and older on a row from older history — the + /// only place a reader can tell a line the pane holds from one ⏎ will open in the history view. + /// + private static string RowLabel(SearchRow row, bool all) => + row.IsOlder ? (all ? $"{row.WindowLabel} · older" : "older") : all ? row.WindowLabel : string.Empty; + + private static string Row(SearchRow row, bool selected, int entryWidth, int labelWidth, int width, bool all) { var (text, matchStart, matchLength) = Elide(row, entryWidth); - var label = labelWidth > 0 ? LabelCell(row.WindowLabel, labelWidth) : string.Empty; + var label = labelWidth > 0 ? LabelCell(RowLabel(row, all), labelWidth) : string.Empty; if (selected) { diff --git a/src/SharpMUTerm.Tui/SearchSurface.cs b/src/SharpMUTerm.Tui/SearchSurface.cs index 87a3c785..82f9a448 100644 --- a/src/SharpMUTerm.Tui/SearchSurface.cs +++ b/src/SharpMUTerm.Tui/SearchSurface.cs @@ -44,7 +44,7 @@ internal sealed class SearchSurface private const int ChromeRows = 4; private readonly ConsoleWindowSystem _system; - private readonly Func _search; + private readonly Func _search; private readonly Action _go; private readonly Action? _closed; @@ -73,7 +73,7 @@ internal sealed class SearchSurface /// public SearchSurface( ConsoleWindowSystem system, - Func search, + Func search, Action go, Action? closed = null) { @@ -135,6 +135,25 @@ internal static SearchModel Compute(IReadOnlyList windows, string /// Whether every window is being searched rather than the focused one. internal bool AllWindows => _model.AllWindows; + /// Whether older history is being searched too (⌥H). + internal bool Older => _model.Older; + + /// + /// Re-reads the model for the query and toggles as they stand and redraws, keeping the pointer: the older-history + /// search calls it as its results stream in. + /// + internal void Refresh() + { + if (_window is null) + { + return; + } + + Refilter(_model.Query, _model.Regex, _model.AllWindows, _model.Older, _selected); + Paint(); + _window.Invalidate(redrawAll: true); + } + /// Opens the surface, or closes it when ⌃F arrives a second time. public void Toggle() { @@ -171,7 +190,7 @@ private void Open() _model = Empty; _selected = -1; _first = 0; - Refilter(string.Empty, false, false, -1); + Refilter(string.Empty, false, false, false, -1); var desktop = _system.DesktopDimensions; @@ -217,7 +236,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) return; } - var decision = SearchPrompt.Interpret(e.KeyInfo, _model.Query, _selected, _model.Rows.Count, _model.Regex, _model.AllWindows); + var decision = SearchPrompt.Interpret(e.KeyInfo, _model.Query, _selected, _model.Rows.Count, _model.Regex, _model.AllWindows, _model.Older); e.Handled = true; switch (decision.Action) @@ -236,7 +255,7 @@ private void OnKey(object? sender, KeyPressedEventArgs e) break; case SearchAction.Redraw: - Refilter(decision.Query, decision.Regex, decision.AllWindows, decision.Selected); + Refilter(decision.Query, decision.Regex, decision.AllWindows, decision.Older, decision.Selected); Paint(); _window.Invalidate(redrawAll: true); break; @@ -251,9 +270,9 @@ private void OnKey(object? sender, KeyPressedEventArgs e) /// Re-reads the corpus and re-runs the search. The pointer is clamped to what the query actually /// matched: a narrowing must not leave ⏎ aimed past the end of the list. /// - private void Refilter(string query, bool regex, bool all, int selected) + private void Refilter(string query, bool regex, bool all, bool older, int selected) { - _model = _search(query, regex, all); + _model = _search(query, regex, all, older); _selected = _model.Rows.Count == 0 ? -1 : Math.Clamp(selected, 0, _model.Rows.Count - 1); _first = SearchPrompt.Scroll(_first, _selected, _model.Rows.Count, _listRows); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs new file mode 100644 index 00000000..8636d63e --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs @@ -0,0 +1,489 @@ +using System.Globalization; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Tui; + +/// +/// ⌃F's older history (⌥H) and the read-only history view an older hit opens. +/// +/// What is searched. ⌃F searches the pane buffers and states that bound (N lines held). ⌥H adds the +/// session's own for each session window in scope — the in-memory ring and the +/// file-backed spill behind it, which is what holds a long evening — through : newest to +/// oldest, ranged reads of at most , on a worker thread with a cancellation +/// token, every line under 's match timeout. Lines the pane still holds are skipped (a session +/// window's pane shares the ring's instances), so an older row is never a second copy of a row above it. A capture +/// window has no scrollback and no spill — its lines exist only in its pane — and the note says so rather than implying a +/// deeper search that is not there. +/// +/// +/// Results stream. Each chunk's hits are posted to the UI thread and the open surface (cells or native) is +/// redrawn from , older rows after the pane's, newest first, at most +/// . Typing or a toggle cancels the walk and starts the next one after a short +/// pause; closing ⌃F cancels it. +/// +/// +/// ⏎ on an older hit goes to the pane when the pane still holds that line (by reference), through the one path to a +/// hit; otherwise it opens the history view: a modal page of the scrollback around the line, read a page at a +/// time (), never inserted into a pane buffer — a pane's indices are what every bar and +/// boundary counts by, and a page of the past put there would move all of them. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The older-history search running or last finished, or null. + private DeepSearch? _deep; + + /// Whether the older-history search runs inline (headless, and every snapshot), so a frame is deterministic. + private bool _deepInline; + + /// The demo's scrollback, so the snapshot has older history to search with no session. + private ScrollbackBuffer? _demoHistory; + + /// The open history view's state, in either host; null while it is shut. + private HistoryViewState? _historyView; + + /// How long typing pauses before an older-history search starts. + private static readonly TimeSpan DeepSearchPause = TimeSpan.FromMilliseconds(150); + + /// One source of older history: a session window and its session's scrollback. + private sealed record HistorySource(string WindowId, string Label, string SessionKey, ScrollbackBuffer Buffer); + + /// The state of one older-history search, written on the UI thread only. + private sealed class DeepSearch(string key, IReadOnlyList sources, long total) + { + public string Key { get; } = key; + + public IReadOnlyList Sources { get; } = sources; + + public CancellationTokenSource Cancel { get; } = new(); + + public ScrollbackSearchProgress?[] Progress { get; } = new ScrollbackSearchProgress?[sources.Count]; + + public long Total { get; } = total; + + public bool Running { get; set; } = true; + } + + /// The history view: whose scrollback, the search it came from, the line it found, and where the page starts. + private sealed class HistoryViewState(HistorySource source, string query, bool regex, long marked) + { + public HistorySource Source { get; } = source; + + public string Query { get; } = query; + + public bool Regex { get; } = regex; + + public long Marked { get; } = marked; + + public long Top { get; set; } + + public ScrollbackViewModel? Model { get; set; } + + public ScrollbackViewSession? Native { get; set; } + } + + /// Whether the history view is open, in cells or natively. + internal bool HistoryViewIsOpen => _historyView is not null; + + /// The history view's model as it stands, for the tests; null while it is shut. + internal ScrollbackViewModel? HistoryViewModel => _historyView?.Model; + + /// The native history view's session while one is open, for the tests. + internal ScrollbackViewSession? NativeHistoryView => _nativeModal as ScrollbackViewSession; + + /// + /// The search for over the windows ⌃F looks in now — the one function both the cell surface + /// and the native one ask, so the two list the same rows — with older history's rows after them when + /// (⌥H), as far as its search has got. + /// + internal SearchModel SearchModelFor(string query, bool regex, bool all, bool older = false) + { + var held = SearchSurface.Compute(SearchableWindows(all), query, regex, all); + var sources = HistorySources(all, out var captures); + EnsureDeepSearch(query, regex, all, older && held.Error is null, sources); + + var total = sources.Sum(s => s.Buffer.AvailableLines); + var who = sources.Count == 1 ? sources[0].Label : $"{sources.Count} windows"; + var spill = captures switch + { + 0 => string.Empty, + _ when sources.Count == 0 && !all => "this window is a capture: it keeps no older history — every line it holds is searched", + _ => " · captures keep no older history", + }; + + if (!older || held.Error is not null || _deep is not { } deep) + { + var note = sources.Count == 0 + ? (spill.Length > 0 ? spill.TrimStart(' ', '·') : null) + : $"⌥H searches older history · {N(total)} lines in {who}{spill}"; + return held with { Older = older, HistoryNote = note }; + } + + var rows = new List(held.Rows); + long searched = 0; + var found = 0; + var capped = false; + string? error = null; + for (var i = 0; i < deep.Sources.Count; i++) + { + if (deep.Progress[i] is not { } progress) + { + continue; + } + + searched += progress.Searched; + capped |= progress.Capped; + error ??= progress.Error; + var source = deep.Sources[i]; + foreach (var match in progress.Found) + { + if (rows.Count - held.Rows.Count >= ScrollbackSearch.MaxHits) + { + capped = true; + break; + } + + rows.Add(new SearchRow(source.WindowId, source.Label, -1, match.Line.Text, match.MatchStart, match.MatchLength, match.Index, source.SessionKey)); + found++; + } + } + + var said = error is not null + ? $"older history: {error}" + : deep.Running + ? $"searching older history · {N(searched)} of {N(deep.Total)} lines…" + : $"older history · {found} found in {N(deep.Total)} lines{(capped ? $" · the first {ScrollbackSearch.MaxHits}" : string.Empty)}"; + return held with { Rows = rows, Older = true, HistoryNote = said + spill, HistoryRunning = deep.Running && error is null }; + } + + /// + /// The session windows in ⌃F's scope whose sessions keep a scrollback, and how many capture windows in it keep none. + /// The demo's main window has a scrollback of its own, so the snapshot has older history to show. + /// + private IReadOnlyList HistorySources(bool all, out int captures) + { + captures = 0; + var sources = new List(); + foreach (var window in SearchableWindows(all)) + { + var session = _sessionWindows.FirstOrDefault(p => string.Equals(p.Value, window.WindowId, StringComparison.Ordinal)).Key; + if (session is not null) + { + sources.Add(new HistorySource(window.WindowId, window.Label, session.SessionKey, session.Scrollback)); + } + else if (string.Equals(window.WindowId, MainWindowId, StringComparison.Ordinal) + && _workspace.FindWindow(MainWindowId)?.SessionKey is { } owner && IsDemoKey(owner)) + { + sources.Add(new HistorySource(window.WindowId, window.Label, owner, _demoHistory ??= DemoHistory())); + } + else if (_workspace.FindWindow(window.WindowId)?.Kind == Core.Workspaces.WindowKind.Spawn) + { + captures++; + } + } + + return sources; + } + + /// + /// Starts the older-history search for this query and scope unless the one running is already it; cancels it when + /// ⌥H is off or the query is empty. + /// + private void EnsureDeepSearch(string query, bool regex, bool all, bool older, IReadOnlyList sources) + { + if (!older || query.Length == 0 || sources.Count == 0) + { + CancelDeepSearch(); + return; + } + + var key = string.Join('\u0001', query, regex, all, ActiveWindowId(), string.Join(',', sources.Select(s => s.WindowId))); + if (_deep is { } running && running.Key == key) + { + return; + } + + CancelDeepSearch(); + + // Which lines each pane still holds, by reference, taken here on the UI thread: the worker never touches a pane. + var held = sources.Select(s => _lines.TryGetValue(s.WindowId, out var buffer) + ? buffer.Select(l => l.Source).OfType().ToHashSet(ReferenceEqualityComparer.Instance) + : new HashSet(ReferenceEqualityComparer.Instance)).ToArray(); + var deep = new DeepSearch(key, sources, sources.Sum(s => s.Buffer.AvailableLines)); + _deep = deep; + var token = deep.Cancel.Token; + + void Walk() + { + for (var i = 0; i < sources.Count && !token.IsCancellationRequested; i++) + { + var index = i; + var last = ScrollbackSearch.Run( + sources[i].Buffer, + query, + regex, + line => held[index].Contains(line), + progress => Post(() => deep.Progress[index] = progress), + token); + if (last?.Error is not null) + { + break; + } + } + + Post(() => deep.Running = false); + } + + void Post(Action change) + { + if (token.IsCancellationRequested) + { + return; + } + + if (deep.Running && _deepInline) + { + change(); + return; + } + + OnUiThread(() => + { + if (!ReferenceEquals(_deep, deep) || token.IsCancellationRequested) + { + return; + } + + change(); + RefreshSearchSurfaces(); + }); + } + + if (_deepInline || _headless) + { + _deepInline = true; + Walk(); + return; + } + + _ = Task.Run( + async () => + { + try + { + await Task.Delay(DeepSearchPause, token).ConfigureAwait(false); + Walk(); + } + catch (OperationCanceledException) + { + // A newer query, or ⌃F closed. + } + }, + token); + } + + /// Stops the older-history search, if one is running; its rows go with it. + private void CancelDeepSearch() + { + if (_deep is { } deep) + { + deep.Cancel.Cancel(); + deep.Cancel.Dispose(); + _deep = null; + } + } + + /// Redraws whichever ⌃F is open from a fresh model, as older history's results stream in. + private void RefreshSearchSurfaces() + { + if (_search.IsOpen) + { + _search.Refresh(); + } + else if (NativeSearch is { } native) + { + var model = native.Model; + native.Publish(SearchModelFor(model.Query, model.Regex, model.AllWindows, model.Older)); + } + } + + /// + /// ⏎ on an older hit: to the pane when it still holds that line, through the one path to a hit; otherwise the history + /// view, opened on a page around it. + /// + private void GoToOlderHit(SearchModel model, SearchRow row) + { + CancelDeepSearch(); + var source = HistorySources(model.AllWindows, out _).FirstOrDefault(s => s.WindowId == row.WindowId && s.SessionKey == row.SessionKey); + if (source is null) + { + RefuseCommand("that window's history is gone"); + return; + } + + var line = source.Buffer.GetRange(row.History, 1); + if (line.Count == 0) + { + RefuseCommand("that line is no longer held — the scrollback has moved past it"); + return; + } + + if (_lines.TryGetValue(row.WindowId, out var buffer)) + { + var at = buffer.FindIndex(l => ReferenceEquals(l.Source, line[0])); + if (at >= 0) + { + GoToSearchHit(row with { LineIndex = at, History = -1 }, model.Query, model.Regex, model.AllWindows, 1, 1); + return; + } + } + + OpenHistoryView(source, model.Query, model.Regex, row.History); + } + + /// Opens the read-only history view on 's scrollback around line . + private void OpenHistoryView(HistorySource source, string query, bool regex, long marked) + { + if (AnyOverlayOpen || ComposerOpen) + { + RefuseCommand($"close {(ComposerOpen ? "the composer" : OpenOverlayName())} first"); + return; + } + + var view = new HistoryViewState(source, query, regex, marked); + _historyView = view; + view.Top = ScrollbackViewModel.TopFor(marked, source.Buffer.OldestIndex, source.Buffer.TotalLines); + view.Model = HistoryPage(view); + if (NativeModalsHost is { } host) + { + ScrollbackViewSession? session = null; + session = new ScrollbackViewSession( + view.Model, + ThemeIsDark(), + top => OnUiThread(() => ScrollHistoryView(top)), + () => OnUiThread(() => + { + NativeModalClosed(session!); + if (ReferenceEquals(_historyView, view)) + { + _historyView = null; + } + })) + { + Theme = _theme.Clone(), + }; + view.Native = session; + ShowNativeModal(host, session); + return; + } + + _helpView.Open( + "history-view", + "Older history", + width => + { + var model = view.Model!; + Drawing(SurfaceCatalog.HistoryView, string.Empty, model); + return ScrollbackViewSurface.Render(model, width); + }, + key => + { + if (key.Modifiers == 0 && view.Model!.Move(key.Key) is { } top) + { + ScrollHistoryView(top); + } + + return true; + }, + width: ScrollbackViewSurface.PreferredWidth, + closed: () => + { + if (ReferenceEquals(_historyView, view)) + { + _historyView = null; + } + }); + } + + /// + /// The history view's one move, from either host: the page starting at , read from the + /// scrollback in one ranged read and drawn. + /// + internal void ScrollHistoryView(long top) + { + if (_historyView is not { } view) + { + return; + } + + view.Top = ScrollbackViewModel.Clamp(top, view.Source.Buffer.OldestIndex, view.Source.Buffer.TotalLines); + view.Model = HistoryPage(view); + if (view.Native is { } native) + { + native.Publish(view.Model); + return; + } + + _helpView.Repaint(); + } + + /// A page of the view's scrollback from its top: one ranged read, each line's match marked. + private static ScrollbackViewModel HistoryPage(HistoryViewState view) + { + var buffer = view.Source.Buffer; + var oldest = buffer.OldestIndex; + var end = buffer.TotalLines; + var top = ScrollbackViewModel.Clamp(view.Top, oldest, end); + var lines = buffer.GetRange(top, ScrollbackViewModel.PageRows); + var first = Math.Max(top, oldest); + var texts = lines.Select(l => l.Text).ToArray(); + var matches = OutputSearch.Match(texts, view.Query, view.Regex).Matches.ToDictionary(m => m.LineIndex); + var page = new List(lines.Count); + for (var i = 0; i < lines.Count; i++) + { + var hit = matches.TryGetValue(i, out var m) ? m : default; + page.Add(new ScrollbackViewLine(first + i, texts[i], matches.ContainsKey(i) ? hit.MatchStart : -1, matches.ContainsKey(i) ? hit.MatchLength : 0)); + } + + return new ScrollbackViewModel(view.Source.Label, view.Query, top, oldest, end, view.Marked, page); + } + + /// + /// The demo's older history: an evening of the same streets, a few thousand lines older than anything the pane holds, + /// with a goblin fight in it to find. + /// + private static ScrollbackBuffer DemoHistory() + { + var buffer = new ScrollbackBuffer(10_000); + string[] streets = + [ + "You walk along the Spice Road. Lanterns sway over the stalls.", + "Ashlyn says, \"Have you seen the new market charter?\"", + "A town crier calls the hour from the steps of the guildhall.", + "Merrow pages: meet at the Grand Plaza after the bell.", + "The smell of roasting chestnuts drifts from a cart nearby.", + ]; + for (var i = 0; i < 6_000; i++) + { + var text = i switch + { + 1_200 => "A goblin leaps from behind a barrel and snarls!", + 1_203 => "You hit the goblin for 9 damage.", + 1_207 => "The goblin flees north, clutching a stolen purse.", + 4_410 => "Ashlyn says, \"That goblin came back — it is in the sewers now.\"", + _ => $"[{18 + i / 1_000:00}:{i * 7 % 60:00}] {streets[i % streets.Length]}", + }; + buffer.Append(StyledLine.FromText(text, TextStyle.Default)); + } + + return buffer; + } + + /// ⏎ on row of , for the tests. + internal void GoToSearchHitForTest(SearchModel model, int index) => GoToSearchHit(model, index); + + private static string N(long value) => value.ToString("N0", CultureInfo.InvariantCulture); +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs index 9419542d..631698ba 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs @@ -96,7 +96,7 @@ private IEnumerable SpellingNames() /// Opens F1 on a draft: in the host's editor when it has one, else the cell window. Both are given the same draft /// and say the same thing about it (). /// - private void OpenComposer(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null) + private void OpenComposer(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null, ScriptEdit? script = null) { // The names a game reports change between openings; the dictionary learns them each time F1 opens. if (_composerSpellingOpened) @@ -106,11 +106,16 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, if (NativeComposerHost is not { } native) { - _composer.Toggle(target, draft, escaping, canSend, edit); + _composer.Toggle(target, draft, escaping, canSend, edit, script); return; } - var open = new NativeCompose(target, canSend, edit) { Body = draft.Replace("\r\n", "\n", StringComparison.Ordinal), Escaping = escaping }; + var open = new NativeCompose(target, canSend, script is null ? edit : null) + { + Body = draft.Replace("\r\n", "\n", StringComparison.Ordinal), + Escaping = escaping, + Script = script, + }; open.Session = new ComposerSession( NativeComposeModel(open), () => _composerSpelling, @@ -130,12 +135,12 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, if (ReferenceEquals(_nativeCompose, open)) { open.Body = body; - SendComposed(new ComposeResult(body, open.Escaping, open.Edit)); + SendComposed(new ComposeResult(body, open.Escaping, open.Edit, open.Script)); } }), ToggleEscaping = () => OnUiThread(() => { - if (ReferenceEquals(_nativeCompose, open) && open.Edit is null) + if (ReferenceEquals(_nativeCompose, open) && open.Edit is null && open.Script is null) { open.Escaping = open.Escaping == ComposeEscaping.Literal ? ComposeEscaping.AsTyped : ComposeEscaping.Literal; open.Session.Publish(NativeComposeModel(open)); @@ -143,7 +148,7 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, }), TogglePreview = () => OnUiThread(() => { - if (ReferenceEquals(_nativeCompose, open) && open.Edit is null) + if (ReferenceEquals(_nativeCompose, open) && open.Edit is null && open.Script is null) { // The cell window's fact, so F1 opens the same way in either host for the rest of the run. _composer.Preview = !_composer.Preview; @@ -152,7 +157,8 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, }), AddWord = word => OnUiThread(() => AddComposerWord(word)), GetDictionary = () => OnUiThread(OfferDictionary), - Proportional = ComposerFaceOf(ComposeDraftKey(ActiveWindowId())), + // A script is code, and code is read in monospace whatever face the character writes posts in. + Proportional = script is null ? ComposerFaceOf(ComposeDraftKey(ActiveWindowId())) : () => false, ChooseFace = ChooseComposerFace(ComposeDraftKey(ActiveWindowId())), Closed = body => OnUiThread(() => { @@ -202,7 +208,7 @@ private Action ChooseComposerFace(string? sessionKey) => proportional => O /// The native F1's model for what it holds now; the cell window's for the same draft. private ComposerModel NativeComposeModel(NativeCompose open) => - ComposeOverlay.ModelFor(open.Target, open.Body, open.Escaping, open.Edit, open.Edit is null ? ComposerSpelling() : null, open.CanSend, _composer.Preview); + ComposeOverlay.ModelFor(open.Target, open.Body, open.Escaping, open.Edit, open.Edit is null && open.Script is null ? ComposerSpelling() : null, open.CanSend, _composer.Preview, open.Script); /// /// Closes F1, in whichever host it is open, keeping its buffer as the character's draft (or MOO edit) exactly as the @@ -219,7 +225,7 @@ private void CloseComposer() _nativeCompose = null; open.Session.End(); Host.NativeComposer?.Close(); - KeepComposeDraft(new ComposeResult(open.Body, open.Escaping, open.Edit)); + KeepComposeDraft(new ComposeResult(open.Body, open.Escaping, open.Edit, open.Script)); PublishPanels(); PublishHostChrome(); } @@ -376,6 +382,9 @@ private sealed class NativeCompose(string target, bool canSend, MooEdit? edit) internal ComposeEscaping Escaping { get; set; } + /// The script file this is an edit of, or null; its status moves with each save. + internal ScriptEdit? Script { get; set; } + internal ComposerSession Session { get; set; } = null!; } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs index 54ef9c77..776b8675 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs @@ -121,13 +121,6 @@ private void ToggleQuit() // ── ⌃F, ⌃R, ⌥M and the welcome ────────────────────────────────────────────────────────────── - /// - /// The search for over the windows ⌃F looks in now — the one function both the cell - /// surface and the native one ask, so the two list the same rows. - /// - internal SearchModel SearchModelFor(string query, bool regex, bool all) => - SearchSurface.Compute(SearchableWindows(all), query, regex, all); - /// Opens ⌃F in the host's controls; false when the host has none. private bool TryOpenNativeSearch() { @@ -140,15 +133,19 @@ private bool TryOpenNativeSearch() session = new SearchSession( SearchModelFor(string.Empty, false, false), ThemeIsDark(), - (query, regex, all) => OnUiThread(() => + (query, regex, all, older) => OnUiThread(() => { if (ReferenceEquals(_nativeModal, session)) { - session!.Publish(SearchModelFor(query, regex, all)); + session!.Publish(SearchModelFor(query, regex, all, older)); } }), (model, index) => OnUiThread(() => GoToSearchHit(model, index)), - () => OnUiThread(() => NativeModalClosed(session!))) + () => OnUiThread(() => + { + CancelDeepSearch(); + NativeModalClosed(session!); + })) { Theme = _theme.Clone(), }; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs index 6043d86b..4e8d9804 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs @@ -201,7 +201,8 @@ private void ShowScriptConsole() { NativeModalClosed(session!); _consoleKey = null; - })) + }), + () => OnUiThread(() => ListScriptsToEdit(fromConsole: true))) { Theme = _theme.Clone(), }; @@ -250,6 +251,9 @@ private bool ConsoleKeyPressed(ConsoleKeyInfo key) case ScriptConsoleSurface.Ask.Reload: ReloadConsoleScripts(); break; + case ScriptConsoleSurface.Ask.Edit: + EditScriptFromConsole(); + return true; } return true; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs new file mode 100644 index 00000000..d5730ebd --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs @@ -0,0 +1,448 @@ +using System.Globalization; +using System.Text.RegularExpressions; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Session; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Scripting; + +namespace SharpMUTerm.Tui; + +/// +/// Editing script files inside the client: a loop of list, open, save and reload that never leaves it. +/// +/// The list is ⌃P's (Script <name> entries, ), opened by ⌃P ▸ +/// Edit script…, the script console's ⌃E and /script edit: every .lua under the scripts folder, +/// the names the character's trigger sets give that do not exist yet, and the package scripts those sets name (read +/// only). A new one is /script new <name> (⌃P ▸ New script… puts it on the command line). +/// +/// +/// The editor is the composer's, in a script mode — the MOO edit's shape: no %r join, no escaping, no +/// spelling, lines saved as typed, lines numbered in cells, monospace in the window. ⌃S saves through +/// (the scripts folder only, temporary file and rename), reloads the character's scripts +/// and says in the editor's header and the console what the reload did, load errors with their file:line. The +/// editor stays open, so the next fix is one keystroke away; Esc closes it, keeping unsaved text for that file for the +/// run, and goes back to the console when that is where it was opened from. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// Unsaved text of each script, by name, for the run: Esc keeps it, a save lets it go. + private readonly Dictionary _scriptBuffers = new(StringComparer.Ordinal); + + /// Whether the script editor was reached from the console, so closing it goes back there. + private bool _scriptReturnToConsole; + + /// + /// Whether ⌃P lists the script files (Script …): from the first time they are asked for (Edit script…, the + /// console's ⌃E, a bare /script edit) for the run, as map find's rooms are — not in every empty palette. + /// + private bool _scriptsListed; + + /// The demo's own script, so the snapshot's editor has something to show without a scripts folder. + internal const string DemoScriptText = + "-- corvid.lua: Corvid's helpers\n" + + "\n" + + "function on_tell(line, who)\n" + + " store.set('last_tell', who)\n" + + " print('[info] tell from ' .. who)\n" + + "end\n" + + "\n" + + "function vitals_low()\n" + + " local hp = gmcp.get('Char.Vitals.hp')\n" + + " return hp ~= nil and hp < 100\n" + + "end\n" + + "\n" + + "function on_room()\n" + + " local room = map.current()\n" + + " if room then store.set('last_room', room.name) end\n" + + "end\n" + + "\n" + + "trigger.add('^(\\\\w+) tells you', 'on_tell')\n"; + + private static readonly Regex ErrorAt = new(@"(?[A-Za-z0-9_.\-]+\.lua):\(?(?\d+)", RegexOptions.CultureInvariant, TimeSpan.FromMilliseconds(50)); + + /// Whether the focused window is the demo's, in a client with no scripts folder — the snapshot's scripts. + private bool DemoScriptsShown => + _scriptsRoot is null && _workspace.FindWindow(ActiveWindowId())?.SessionKey is { } owner && IsDemoKey(owner); + + /// The script open in the editor (either host), or null. + internal ScriptEdit? OpenScriptEdit => _nativeCompose is { } open ? open.Script : _composer.IsOpen ? _composer.Script : null; + + /// Whose scripts the focused window's: its session's key, or its recorded owner's. + private string? ScriptOwner() => ComposeDraftKey(ActiveWindowId()); + + /// + /// The focused character's script files, as ⌃P lists them: the folder's .lua files, the names its trigger sets + /// give that are not there yet, and the package scripts those sets name. Each says whether this character loads it and + /// the line of its newest error in the console. + /// + internal IReadOnlyList ScriptFileRefs() + { + var owner = ScriptOwner(); + if (DemoScriptsShown) + { + return + [ + new("corvid.lua", "loaded by Corvid · ! line 14 in the console", false), + new("package:aetherfall-pack/combat.lua", "from the aetherfall-pack package · read only", true), + ]; + } + + if (_scriptsRoot is not { } root) + { + return []; + } + + var named = (owner is null ? null : FindSession(owner))?.ScriptFiles ?? []; + var errors = owner is null ? [] : ConsoleLog(owner).Lines.Where(l => l.Kind == ScriptConsoleKind.Error).Select(l => l.Text).ToArray(); + var refs = new List(); + var seen = new HashSet(StringComparer.Ordinal); + foreach (var name in ScriptFiles.List(root)) + { + seen.Add(name); + refs.Add(new ScriptFileRef(name, Describe(name, exists: true), false)); + } + + foreach (var name in named) + { + if (seen.Contains(name)) + { + continue; + } + + if (name.StartsWith(ScriptFiles.PackagePrefix, StringComparison.Ordinal)) + { + refs.Add(new ScriptFileRef(name, "from a package · read only", true)); + } + else if (ScriptFiles.Check(name) is null) + { + refs.Add(new ScriptFileRef(name, "named by a trigger set · not written yet — opening starts it", false)); + } + } + + return refs; + + string Describe(string name, bool exists) + { + var parts = new List { named.Contains(name, StringComparer.Ordinal) ? "loaded by this character" : "in the scripts folder" }; + if (LastErrorLine(errors, name) is { } line) + { + parts.Add($"! line {line.ToString(CultureInfo.InvariantCulture)} in the console"); + } + + return string.Join(" · ", parts); + } + } + + /// The line of the newest console error naming 's file, or null. + private static int? LastErrorLine(IReadOnlyList errors, string name) + { + var file = name[(name.LastIndexOf('/') + 1)..]; + for (var i = errors.Count - 1; i >= 0; i--) + { + foreach (Match match in ErrorAt.Matches(errors[i])) + { + if (string.Equals(match.Groups["file"].Value, file, StringComparison.Ordinal) + && int.TryParse(match.Groups["line"].Value, NumberStyles.None, CultureInfo.InvariantCulture, out var line)) + { + return line; + } + } + } + + return null; + } + + /// + /// ⌃P ▸ Edit script…, the console's ⌃E and a bare /script edit: the palette, opened on the script files. From + /// the console, closing the editor goes back to it. + /// + private void ListScriptsToEdit(bool fromConsole) + { + if (_scriptsRoot is null && !DemoScriptsShown) + { + RefuseCommand("this client runs no scripts — start it with a scripts folder to edit them"); + return; + } + + _scriptReturnToConsole = fromConsole; + _scriptsListed = true; + OpenMenu(Client.Commands.BuiltInCommands.ScriptEditQuery); + } + + /// The script console's ⌃E (the window's Edit a script… button): the console closes and the palette lists the files. + internal void EditScriptFromConsole() + { + if (ScriptConsoleIsOpen) + { + if (NativeModalOf(Client.Surfaces.SurfaceCatalog.ScriptConsole) is { } native) + { + CloseNativeModal(native); + } + else + { + _helpView.Close(); + } + } + + ListScriptsToEdit(fromConsole: true); + } + + /// ⌃P ▸ Script <name>: opens that file, at its newest error's line when the console has one. + private bool OpenScriptFromPalette(string name) + { + var refs = ScriptFileRefs(); + if (!refs.Any(r => r.Name == name)) + { + RefuseCommand($"{Snippet(name)} is not one of this character's scripts"); + return true; + } + + var owner = ScriptOwner(); + var errors = owner is null ? [] : ConsoleLog(owner).Lines.Where(l => l.Kind == ScriptConsoleKind.Error).Select(l => l.Text).ToArray(); + OpenScript(name, LastErrorLine(errors, name) ?? 0); + return true; + } + + /// /script, /script edit [name], /script new <name>. + private void ScriptCommand(string args) + { + var space = args.IndexOf(' '); + var verb = (space < 0 ? args : args[..space]).ToLowerInvariant(); + var rest = space < 0 ? string.Empty : args[(space + 1)..].Trim(); + switch (verb) + { + case "" or "edit" when rest.Length == 0: + ListScriptsToEdit(fromConsole: false); + return; + case "edit": + _scriptReturnToConsole = false; + OpenScript(ScriptFiles.Normalise(rest)); + return; + case "new": + _scriptReturnToConsole = false; + NewScript(rest); + return; + default: + RefuseCommand("/script edit [name] opens a script; /script new starts one"); + return; + } + } + + /// + /// /script new <name>: the name checked by the loader's own rule, then the editor on the template. Nothing is + /// written until ⌃S. A name that already exists opens that file instead, and says so. + /// + internal void NewScript(string typed) + { + if (_scriptsRoot is not { } root) + { + RefuseCommand("this client runs no scripts — start it with a scripts folder to write them"); + return; + } + + var name = ScriptFiles.Normalise(typed); + var (path, error) = ScriptFiles.PathOf(root, name); + if (path is null) + { + RefuseCommand(error ?? "that is not a script's name"); + return; + } + + if (File.Exists(path)) + { + Notice($"{Snippet(name)} already exists — opened it", MessageSeverity.Info); + } + + OpenScript(name); + } + + /// + /// Opens script in the composer's script mode: a package's read-only, anything else from the + /// scripts folder (the template when it does not exist yet), or the unsaved text Esc kept for it. + /// + internal void OpenScript(string name, int line = 0) + { + if (ComposerOpen || AnyOverlayOpen) + { + RefuseCommand($"close {(ComposerOpen ? "the composer" : OpenOverlayName())} first — the script editor cannot open over it"); + return; + } + + var package = name.StartsWith(ScriptFiles.PackagePrefix, StringComparison.Ordinal); + string text; + if (DemoScriptsShown) + { + text = package ? "-- combat.lua, from the aetherfall-pack package\nfunction on_hit(line) print('hit!') end\n" : DemoScriptText; + } + else if (package) + { + if (_packages.ResolveScript(name) is not { } path || !File.Exists(path) || new FileInfo(path).Length > ScriptFiles.MaxBytes) + { + RefuseCommand($"{Snippet(name)} is not in an installed package"); + return; + } + + text = File.ReadAllText(path).Replace("\r\n", "\n", StringComparison.Ordinal); + } + else if (_scriptsRoot is not { } root) + { + RefuseCommand("this client runs no scripts — start it with a scripts folder to edit them"); + return; + } + else + { + var (path, error) = ScriptFiles.PathOf(root, name); + if (path is null) + { + RefuseCommand(error ?? "that is not a script's name"); + return; + } + + if (File.Exists(path)) + { + var (read, problem) = ScriptFiles.Read(root, name); + if (read is null) + { + RefuseCommand(problem ?? $"{Snippet(name)} could not be read"); + return; + } + + text = read; + } + else + { + text = ScriptFiles.Template; + } + } + + string? status = null; + if (!package && _scriptBuffers.TryGetValue(name, out var kept)) + { + text = kept; + status = "unsaved text kept from earlier · ⌃S saves it"; + } + + var owner = ScriptOwner(); + var session = owner is null ? null : FindSession(owner); + var target = session is not null + ? SessionTitle(session) + : owner is not null ? FindCharacter(owner)?.Character.Name ?? string.Empty : string.Empty; + OpenComposer(target, text, ComposeEscaping.AsTyped, canSend: true, edit: null, script: new ScriptEdit(name, owner, package, status, line)); + } + + /// + /// ⌃S on a script: written atomically under the scripts folder only, then the character's scripts reloaded, and what + /// that did said in the editor's header and the console. The editor stays open. + /// + private void SaveScriptEdit(ScriptEdit script, string body) + { + if (script.ReadOnly) + { + RefuseCommand($"{Snippet(script.Name)} is a package's script and is only read — copy what you need into a script of your own"); + return; + } + + if (DemoScriptsShown) + { + SetScriptStatus("! the demo saves nothing"); + RefuseCommand("the demo saves nothing — run the client with a scripts folder"); + return; + } + + if (_scriptsRoot is not { } root) + { + RefuseCommand("this client runs no scripts"); + return; + } + + if (ScriptFiles.Save(root, script.Name, body) is { } refusal) + { + SetScriptStatus("! not saved: " + refusal); + RefuseCommand(refusal); + return; + } + + _scriptBuffers.Remove(script.Name); + var status = $"saved {DateTime.Now:HH:mm:ss}"; + var session = script.Owner is null ? null : FindSession(script.Owner); + if (session is null || !_scripts.TryGetValue(session, out var scripts)) + { + status += " · not reloaded — no connection"; + } + else if (!scripts.Files.Contains(script.Name, StringComparer.Ordinal) && !session.ScriptFiles.Contains(script.Name, StringComparer.Ordinal)) + { + status += " · not loaded — name it in a trigger set's scripts (F5)"; + } + else + { + var log = ConsoleLog(session.SessionKey); + var before = log.Count; + scripts.Reload(); + var errors = log.Lines.Skip(before).Where(l => l.Kind == ScriptConsoleKind.Error).Select(l => l.Text).ToList(); + log.Add(ScriptConsoleKind.Note, $"saved {script.Name} · reloaded · {ScriptsLoaded(scripts)}"); + status = errors.Count == 0 + ? $"{status} · reloaded · {ScriptsLoaded(scripts)}" + : $"! {errors[0]}{(errors.Count > 1 ? $" (+{errors.Count - 1} more in the console)" : string.Empty)}"; + RefreshConsole(); + } + + SetScriptStatus(status); + Notice($"{Snippet(script.Name)}: {status.TrimStart('!', ' ')}", status.StartsWith('!') ? MessageSeverity.Warning : MessageSeverity.Info, toast: false); + } + + /// Says what the last save did in the open script editor's header, in either host. + private void SetScriptStatus(string status) + { + if (_nativeCompose is { Script: { } script } open) + { + open.Script = script with { Status = status }; + open.Session.Publish(NativeComposeModel(open)); + return; + } + + _composer.SetScriptStatus(status); + } + + /// + /// The script editor closed: unsaved text is kept for that file for the run (nothing is kept when it matches the + /// file), and an editor opened from the console goes back to it. + /// + private void KeepScriptBuffer(ScriptEdit script, string body) + { + if (!script.ReadOnly && !DemoScriptsShown && _scriptsRoot is { } root) + { + var (onDisk, _) = ScriptFiles.Read(root, script.Name); + var normalised = body.Replace("\r\n", "\n", StringComparison.Ordinal); + if (string.Equals(normalised.TrimEnd('\n'), (onDisk ?? ScriptFiles.Template).TrimEnd('\n'), StringComparison.Ordinal)) + { + _scriptBuffers.Remove(script.Name); + } + else + { + _scriptBuffers[script.Name] = normalised; + } + } + + if (_scriptReturnToConsole) + { + _scriptReturnToConsole = false; + OnUiThread(() => + { + if (!ScriptConsoleIsOpen && !AnyOverlayOpen && !ComposerOpen) + { + ShowScriptConsole(); + } + }); + } + } + + /// The unsaved text kept for a script, for the tests. + internal string? KeptScriptText(string name) => _scriptBuffers.GetValueOrDefault(name); + + /// A character's console lines of a kind, for the tests. + internal IReadOnlyList ConsoleTexts(string key, ScriptConsoleKind kind) => + [.. ConsoleLog(key).Lines.Where(l => l.Kind == kind).Select(l => l.Text)]; +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 295f88df..fe0a63ea 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -962,7 +962,7 @@ public SharpMUTermApp( HistoryBarLabel, InsertHistoryEntry); - _search = new SearchSurface(_system, SearchModelFor, GoToSearchHit); + _search = new SearchSurface(_system, SearchModelFor, GoToSearchHit, CancelDeepSearch); SchemePopups(); _window.OnResize += (_, _) => @@ -1654,6 +1654,13 @@ public string RenderSnapshot(string? view = null) // what the real filter produced rather than an impression of it. if (view is not null && view.StartsWith("search", StringComparison.OrdinalIgnoreCase)) { + // `search-older` is ⌥H over the demo's own older history (an evening of the same streets, thousands of lines + // past the pane's), and `search-history` is ⏎ on its first older hit: the read-only history view. + var olderView = string.Equals(view, "search-older", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "search-history", StringComparison.OrdinalIgnoreCase); + var historyView = string.Equals(view, "search-history", StringComparison.OrdinalIgnoreCase); + _deepInline = true; + // A split first, so the pane is narrower than the terminal. That is the geometry that catches // a landing scrolled to the wrong row — a buffer index is not a viewport row, and in a narrow // pane almost every line wraps. @@ -1692,7 +1699,14 @@ public string RenderSnapshot(string? view = null) { var all = string.Equals(view, "search-all", StringComparison.OrdinalIgnoreCase); var regex = string.Equals(view, "search-regex", StringComparison.OrdinalIgnoreCase); - NativeSearch!.Search(regex ? @"gobl\w+ (corpse|for)" : "goblin", regex, all); + NativeSearch!.Search(regex ? @"gobl\w+ (corpse|for)" : "goblin", regex, all, olderView); + if (historyView && NativeSearch is { } older && older.Model.HeldRows < older.Model.Rows.Count) + { + var hits = older.Model; + CloseNativeModal(older); + GoToSearchHit(hits, hits.HeldRows); + } + if (string.Equals(view, "search-landed", StringComparison.OrdinalIgnoreCase) && NativeSearch is { } landing && landing.Model.Rows.Count > 0) { var hits = landing.Model; @@ -1719,6 +1733,21 @@ public string RenderSnapshot(string? view = null) SimulateSearchTyping("goblin"); } + if (olderView) + { + SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.H, false, true, false)); + } + + if (historyView) + { + for (var i = 0; i < (_search.Model?.HeldRows ?? 0); i++) + { + SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + } + + SimulateSearchKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + } + if (string.Equals(view, "search-landed", StringComparison.OrdinalIgnoreCase)) { SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); @@ -1912,6 +1941,20 @@ public string RenderSnapshot(string? view = null) } } + // The script editing loop over the demo's scripts: ⌃P's list of them (`script-list`), and the demo's corvid.lua + // open in the composer's script mode with the caret on the line a reload's error named (`script-edit`). The demo + // saves nothing, so the header's error is the one a live save of this file would put there. + if (string.Equals(view, "script-list", StringComparison.OrdinalIgnoreCase)) + { + DispatchCommand(SharpMUTerm.Client.Commands.BuiltInCommands.ScriptEditCommand); + } + + if (string.Equals(view, "script-edit", StringComparison.OrdinalIgnoreCase)) + { + OpenScript("corvid.lua", 14); + SetScriptStatus("! corvid.lua:(14,22-30): attempt to index a nil value (local 'room')"); + } + // GMCP channel capture, the highlight-names list and a scene log, over the demo (scripting wave). if (RenderScriptingWaveScene(view) is { } scriptingFrame) { @@ -4947,8 +4990,17 @@ private bool RemoveAwayBar(string windowId) /// a search bar was on screen, which is a defect nobody would connect to search. /// /// - private void GoToSearchHit(SearchModel model, int index) => - GoToSearchHit(model.Rows[index], model.Query, model.Regex, model.AllWindows, index + 1, model.Rows.Count); + private void GoToSearchHit(SearchModel model, int index) + { + if (model.Rows[index].IsOlder) + { + // A hit in older history: the pane if it still holds the line, else the read-only history view. + GoToOlderHit(model, model.Rows[index]); + return; + } + + GoToSearchHit(model.Rows[index], model.Query, model.Regex, model.AllWindows, index + 1, model.HeldRows); + } /// Goes to , the th of hits for a search. private void GoToSearchHit(SearchRow row, string query, bool regex, bool all, int ordinal, int total) @@ -5246,6 +5298,14 @@ private void OnCommandEntered(InputBar bar, string command) return; } + // `/script edit|new ` opens a script file from the scripts folder in the editor. + if (command.StartsWith("/script", StringComparison.OrdinalIgnoreCase) + && (command.Length == 7 || command[7] == ' ')) + { + ScriptCommand(command[7..].Trim()); + return; + } + // `/package` opens the Packages screen; `/package install …` reads one for review. if (command.StartsWith("/package", StringComparison.OrdinalIgnoreCase) && (command.Length == 8 || command[8] == ' ')) @@ -5430,6 +5490,13 @@ session is not null /// private void SendComposed(ComposeResult result) { + // A script is saved to disk, not sent: it needs no connection, only the scripts folder. + if (result.Script is { } script) + { + SaveScriptEdit(script, result.Body); + return; + } + var windowId = ActiveWindowId(); if (WindowSession(windowId) is not { } session) { @@ -5468,6 +5535,13 @@ private void SendComposed(ComposeResult result) /// private void KeepComposeDraft(ComposeResult result) { + // A script's unsaved text is kept by file, apart from the post drafts and the MOO edits. + if (result.Script is { } script) + { + KeepScriptBuffer(script, result.Body); + return; + } + if (ComposeDraftKey(ActiveWindowId()) is not { } key) { return; @@ -5832,7 +5906,7 @@ private string OpenOverlayName() => : _search.IsOpen ? "the search surface" : _prefixPanel.IsOpen ? "the pane keys panel" : _welcomeView.IsOpen ? "the welcome" - : _helpView.IsOpen ? (_helpView.Mode switch { "dictionary" => "the dictionary offer", "import" => "the import review", "script-console" => "the script console", _ => "help" }) + : _helpView.IsOpen ? (_helpView.Mode switch { "dictionary" => "the dictionary offer", "import" => "the import review", "script-console" => "the script console", "history-view" => "the history view", _ => "help" }) : "what is open"; /// Whether either bar is holding unsent text — what the ✎ tab marker means. @@ -8510,7 +8584,8 @@ private CommandContext CommandState() NoDictionary: NoOwnDictionary, SceneLogging: _sceneLogs.ContainsKey(ActiveWindowId()), NewConfiguration: _config.Worlds.Count == 0 || _config.KeyTourPending, - MapFound: MapFoundRooms()); + MapFound: MapFoundRooms(), + ScriptFiles: !_scriptsListed || (_scriptsRoot is null && !DemoScriptsShown) ? null : ScriptFileRefs()); } /// @@ -8781,6 +8856,11 @@ private bool RunBuiltInCommand(string id) return true; } + if (id.StartsWith(SharpMUTerm.Client.Commands.BuiltInCommands.ScriptOpenPrefix, StringComparison.Ordinal)) + { + return OpenScriptFromPalette(id[SharpMUTerm.Client.Commands.BuiltInCommands.ScriptOpenPrefix.Length..]); + } + if (id.StartsWith(SharpMUTerm.Client.Commands.BuiltInCommands.MapWalkPrefix, StringComparison.Ordinal)) { return WalkToFoundRoom(id[SharpMUTerm.Client.Commands.BuiltInCommands.MapWalkPrefix.Length..]); @@ -9079,6 +9159,12 @@ private bool RunBuiltInCommand(string id) case Client.Commands.BuiltInCommands.ScriptConsoleCommand: ShowScriptConsole(); break; + case Client.Commands.BuiltInCommands.ScriptEditCommand: + ListScriptsToEdit(fromConsole: false); + break; + case Client.Commands.BuiltInCommands.ScriptNewCommand: + PlaceGrab(ActiveBar(), "/script new "); + break; case Client.Commands.BuiltInCommands.SceneStartCommand: StartSceneLog(); break; diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index e759351c..b643b93e 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -29,6 +29,6 @@ internal static class SnapshotViews "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "import-review", "join-wraps", "join-wraps-f5", - "script-console", "channel-capture", "highlight-names", "channels-f5", "scene-log", + "script-console", "script-list", "script-edit", "search-older", "search-history", "channel-capture", "highlight-names", "channels-f5", "scene-log", ]; } diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index f94aafe8..73846b6f 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -206,7 +206,7 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! // F1: the window's editor is handed the model the cell window draws for the same draft, in each mode and for a // MOO edit. Two clients, one with the window's editor and one without, opened on the same scene. - foreach (var view in new[] { "compose", "compose-literal", "compose-preview", "moo-edit" }) + foreach (var view in new[] { "compose", "compose-literal", "compose-preview", "moo-edit", "script-edit" }) { using var nativeDriver = new AvaloniaConsoleDriver(140, 36); var composer = new FakeComposer(); @@ -260,6 +260,8 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! (SurfaceCatalog.Dictionary, "dictionary-offer"), (SurfaceCatalog.Import, "import-review"), (SurfaceCatalog.ScriptConsole, "script-console"), + (SurfaceCatalog.Search, "search-older"), + (SurfaceCatalog.HistoryView, "search-history"), }) { using var nativeDriver = new AvaloniaConsoleDriver(140, 36); @@ -842,8 +844,35 @@ await SameModal("script console: delete key", "script-console", await SameModal("script console: reload", "script-console", (app, m) => ((ScriptConsoleSession)m.Open(SurfaceCatalog.ScriptConsole)!).Reload(), app => app.SimulateConsoleKey(new ConsoleKeyInfo('\f', ConsoleKey.L, false, false, true))); + await SameModal("script console: edit a script", "script-console", + (app, m) => ((ScriptConsoleSession)m.Open(SurfaceCatalog.ScriptConsole)!).EditScript(), + app => app.SimulateConsoleKey(new ConsoleKeyInfo('\u0005', ConsoleKey.E, false, false, true))); probed.Add(SurfaceCatalog.ScriptConsole); + // ⌃F's older history: ⌥H then ⏎ on the first older hit opens the history view on the same page in both; and the + // history view's one move, a page down, reads the same page in both. + await SameModal("search: older history", "search", + (app, m) => + { + var search = (SearchSession)m.Open(SurfaceCatalog.Search)!; + search.Search(search.Model.Query, false, false, true); + search.Go(search.Model.HeldRows); + }, + app => + { + app.SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.H, false, true, false)); + for (var i = 0; i < app.SearchModelFor("goblin", false, false, true).HeldRows; i++) + { + app.SimulateSearchKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + } + + app.SimulateSearchKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + await SameModal("history view: scroll", "search-history", + (app, m) => ((ScrollbackViewSession)m.Open(SurfaceCatalog.HistoryView)!).Key(ConsoleKey.PageDown), + app => app.SimulateHelpKey(new ConsoleKeyInfo('\0', ConsoleKey.PageDown, false, false, false))); + probed.Add(SurfaceCatalog.HistoryView); + var acting = SurfaceCatalog.All.Where(s => s.HasNative && s.Actions.Count > 0).Select(s => s.Id); // The tab overflow chip: an entry chosen from the window's menu and the same digit in the cell list bring the same // hidden tab forward. @@ -1095,6 +1124,7 @@ private static void HelpKeysTo(SharpMUTermApp app, Func match) DictionaryOfferSession offer => offer.Model, ImportReviewSession import => import.Model, ScriptConsoleSession console => console.Model, + ScrollbackViewSession history => history.Model, _ => throw new ArgumentException(session.GetType().Name), }; @@ -1119,6 +1149,7 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "import=" + app.ImportReviewOpen + " " + string.Join(",", app.Configuration.TriggerSets.Select(s => s.Name + ":" + s.Triggers.Count)) + " " + string.Join(",", app.Configuration.Worlds.SelectMany(w => w.Characters).Select(c => c.Name + (c.Password is null ? string.Empty : "*"))), "console=" + app.ScriptConsoleIsOpen + " " + ConsoleState(app), + "older=" + (app.HistoryViewModel is { } page ? $"{page.Window}:{page.Top}:{page.Marked}" : "shut"), "quick=" + app.LastQuickMacro, "walk=" + app.WalkState, "map=" + app.MapDigest(), diff --git a/tests/SharpMUTerm.Core.Tests/Text/ScrollbackSearchTests.cs b/tests/SharpMUTerm.Core.Tests/Text/ScrollbackSearchTests.cs new file mode 100644 index 00000000..8eeb63b8 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Text/ScrollbackSearchTests.cs @@ -0,0 +1,119 @@ +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Core.Tests.Text; + +/// +/// ⌃F's older-history walk (⌥H): newest first, across the ring and the file-backed spill, in ranged reads, skipping what +/// the pane holds, stopping at the cap, on cancellation and on a pattern that does not parse. +/// +public class ScrollbackSearchTests +{ + private static ScrollbackBuffer Buffer(int lines, int capacity = 10_000, IScrollbackSpill? spill = null, Func? text = null) + { + var buffer = new ScrollbackBuffer(capacity, spill); + for (var i = 0; i < lines; i++) + { + buffer.Append(StyledLine.FromText(text?.Invoke(i) ?? $"line {i}", TextStyle.Default)); + } + + return buffer; + } + + [Test] + public async Task HitsAreListedNewestFirstWithTheirAbsoluteIndex() + { + var buffer = Buffer(100, text: i => i % 30 == 0 ? $"goblin {i}" : $"street {i}"); + + var result = ScrollbackSearch.Run(buffer, "GOBLIN", false, null, null, CancellationToken.None, chunk: 7); + + await Assert.That(result!.Done).IsTrue(); + await Assert.That(result.Found.Select(m => m.Index).ToArray()).IsEquivalentTo(new long[] { 90, 60, 30, 0 }); + await Assert.That(result.Found[0].Line.Text).IsEqualTo("goblin 90"); + await Assert.That(result.Found[0].MatchStart).IsEqualTo(0); + await Assert.That(result.Found[0].MatchLength).IsEqualTo(6); + await Assert.That(result.Searched).IsEqualTo(100); + } + + [Test] + public async Task LinesThePaneHoldsAreSkipped() + { + var buffer = Buffer(10, text: i => $"goblin {i}"); + var held = buffer.GetRange(5, 5).ToHashSet(ReferenceEqualityComparer.Instance); + + var result = ScrollbackSearch.Run(buffer, "goblin", false, line => held.Contains(line), null, CancellationToken.None); + + await Assert.That(result!.Found.Select(m => m.Index).ToArray()).IsEquivalentTo(new long[] { 4, 3, 2, 1, 0 }); + } + + [Test] + public async Task ProgressIsReportedAfterEveryChunk() + { + var buffer = Buffer(25, text: i => $"goblin {i}"); + var reports = new List(); + + ScrollbackSearch.Run(buffer, "goblin", false, null, reports.Add, CancellationToken.None, chunk: 10); + + await Assert.That(reports.Count).IsEqualTo(3); + await Assert.That(reports[0].Found.Count).IsEqualTo(10); + await Assert.That(reports[0].Done).IsFalse(); + await Assert.That(reports[^1].Done).IsTrue(); + } + + [Test] + public async Task ACancelledWalkReportsNothingFurther() + { + var buffer = Buffer(50, text: i => $"goblin {i}"); + using var cancel = new CancellationTokenSource(); + var reports = 0; + + var result = ScrollbackSearch.Run(buffer, "goblin", false, null, _ => { reports++; cancel.Cancel(); }, cancel.Token, chunk: 10); + + await Assert.That(result).IsNull(); + await Assert.That(reports).IsEqualTo(1); + } + + [Test] + public async Task TheWalkStopsAtTheCapAndSaysSo() + { + var buffer = Buffer(ScrollbackSearch.MaxHits + 200, text: i => $"goblin {i}"); + + var result = ScrollbackSearch.Run(buffer, "goblin", false, null, null, CancellationToken.None, chunk: 64); + + await Assert.That(result!.Capped).IsTrue(); + await Assert.That(result.Found.Count).IsEqualTo(ScrollbackSearch.MaxHits); + } + + [Test] + public async Task APatternThatDoesNotParseIsAnErrorNotAThrow() + { + var buffer = Buffer(10); + + var result = ScrollbackSearch.Run(buffer, "gob(lin", true, null, null, CancellationToken.None); + + await Assert.That(result!.Error).IsNotNull(); + await Assert.That(result.Found.Count).IsEqualTo(0); + } + + [Test] + public async Task TheSpillBehindTheRingIsSearchedToo() + { + var root = Path.Combine(Path.GetTempPath(), $"smuterm-deep-{Guid.NewGuid():N}"); + Directory.CreateDirectory(root); + try + { + using var spill = new FileScrollbackSpill(new ScrollbackSpillOptions { Directory = root }); + var buffer = Buffer(3_000, capacity: 200, spill: spill, text: i => i == 17 ? "the old goblin" : $"street {i}"); + + var result = ScrollbackSearch.Run(buffer, "goblin", false, null, null, CancellationToken.None, chunk: 500); + + // Line 17 left the 200-line ring long ago: only the spill holds it. + await Assert.That(buffer.OldestIndex).IsLessThanOrEqualTo(17); + await Assert.That(result!.Found.Select(m => m.Index).ToArray()).IsEquivalentTo(new long[] { 17 }); + await Assert.That(result.Searched).IsEqualTo(buffer.AvailableLines); + } + finally + { + Directory.Delete(root, recursive: true); + } + } +} diff --git a/tests/SharpMUTerm.Scripting.Tests/ScriptFilesTests.cs b/tests/SharpMUTerm.Scripting.Tests/ScriptFilesTests.cs new file mode 100644 index 00000000..8625ea3b --- /dev/null +++ b/tests/SharpMUTerm.Scripting.Tests/ScriptFilesTests.cs @@ -0,0 +1,138 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Session; + +namespace SharpMUTerm.Scripting.Tests; + +/// +/// The script editing loop's file half: names are held to the scripts folder (the same rule a trigger set's file is), a +/// save is atomic and lands only under the root, and a reload after a save reports the error with its file and line. +/// +public class ScriptFilesTests +{ + private sealed class Root : IDisposable + { + public Root() => Path = Directory.CreateTempSubdirectory("sharpmuterm-scriptfiles-").FullName; + + public string Path { get; } + + public void Dispose() => Directory.Delete(Path, recursive: true); + } + + [Test] + [Arguments("../escape.lua")] + [Arguments("a/../../escape.lua")] + [Arguments("/etc/passwd.lua")] + [Arguments("C:/x.lua")] + [Arguments("a\\b.lua")] + [Arguments("./a.lua")] + [Arguments("a//b.lua")] + [Arguments("notes.txt")] + [Arguments("")] + [Arguments("bell\u0007.lua")] + public async Task ANameThatCouldLeaveTheFolderIsRefused(string name) + { + using var root = new Root(); + + await Assert.That(ScriptFiles.Check(name)).IsNotNull(); + await Assert.That(ScriptFiles.PathOf(root.Path, name).Path).IsNull(); + await Assert.That(ScriptFiles.Save(root.Path, name, "x = 1")).IsNotNull(); + await Assert.That(Directory.EnumerateFileSystemEntries(root.Path).Any()).IsFalse(); + } + + [Test] + public async Task ANameIsGivenItsExtension() + { + await Assert.That(ScriptFiles.Normalise(" combat ")).IsEqualTo("combat.lua"); + await Assert.That(ScriptFiles.Normalise("lib/util.lua")).IsEqualTo("lib/util.lua"); + await Assert.That(ScriptFiles.Check("lib/util.lua")).IsNull(); + } + + [Test] + public async Task ASaveWritesTheFileUnderTheRootAndLeavesNoTemporaryFile() + { + using var root = new Root(); + + var error = ScriptFiles.Save(root.Path, "lib/util.lua", "x = 1\r\ny = 2"); + + await Assert.That(error).IsNull(); + await Assert.That(File.ReadAllText(Path.Combine(root.Path, "lib", "util.lua"))).IsEqualTo("x = 1\ny = 2\n"); + await Assert.That(Directory.EnumerateFiles(root.Path, "*", SearchOption.AllDirectories).Count()).IsEqualTo(1); + await Assert.That(ScriptFiles.List(root.Path).ToArray()).IsEquivalentTo(new[] { "lib/util.lua" }); + await Assert.That(ScriptFiles.Read(root.Path, "lib/util.lua").Text).IsEqualTo("x = 1\ny = 2\n"); + } + + [Test] + public async Task ASaveReplacesTheWholeFile() + { + using var root = new Root(); + ScriptFiles.Save(root.Path, "a.lua", new string('-', 4_000)); + + ScriptFiles.Save(root.Path, "a.lua", "short = true"); + + await Assert.That(File.ReadAllText(Path.Combine(root.Path, "a.lua"))).IsEqualTo("short = true\n"); + } + + [Test] + public async Task ANewScriptDoesNotOverwriteOne() + { + using var root = new Root(); + ScriptFiles.Save(root.Path, "a.lua", "kept = true"); + + var error = ScriptFiles.Save(root.Path, "a.lua", "lost = true", mustBeNew: true); + + await Assert.That(error).IsNotNull(); + await Assert.That(File.ReadAllText(Path.Combine(root.Path, "a.lua"))).IsEqualTo("kept = true\n"); + } + + [Test] + public async Task ASaveThroughALinkOutOfTheFolderIsRefused() + { + if (OperatingSystem.IsWindows()) + { + return; + } + + using var root = new Root(); + using var outside = new Root(); + Directory.CreateSymbolicLink(Path.Combine(root.Path, "away"), outside.Path); + + var error = ScriptFiles.Save(root.Path, "away/x.lua", "x = 1"); + + await Assert.That(error).IsNotNull(); + await Assert.That(Directory.EnumerateFiles(outside.Path).Any()).IsFalse(); + } + + [Test] + public async Task ASaveIntoAFolderThatIsNotThereIsRefused() + { + var missing = Path.Combine(Path.GetTempPath(), $"sharpmuterm-none-{Guid.NewGuid():N}"); + + await Assert.That(ScriptFiles.Save(missing, "a.lua", "x = 1")).IsNotNull(); + await Assert.That(Directory.Exists(missing)).IsFalse(); + } + + [Test] + public async Task AReloadAfterASaveReportsTheErrorWithItsFileAndLine() + { + using var root = new Root(); + ScriptFiles.Save(root.Path, "main.lua", "function ok() return 1 end"); + var set = new TriggerSet { Name = "s", ScriptFiles = { "main.lua" } }; + var session = new WorldSession( + new WorldDefinition { Name = "T", Host = "h", Port = 1 }, + triggerSets: new[] { set }, + sessionFactory: _ => new FakeTelnetSession()); + var reports = new List(); + using var scripts = new SessionScripts(session, root.Path, reports.Add); + scripts.Reload(); + await Assert.That(reports.Count).IsEqualTo(0); + await Assert.That(scripts.Defines("ok")).IsTrue(); + + ScriptFiles.Save(root.Path, "main.lua", "function ok() return 1 end\n\nfunction broken(\n"); + scripts.Reload(); + + await Assert.That(reports.Count).IsGreaterThan(0); + await Assert.That(reports[0]).Contains("main.lua"); + await Assert.That(System.Text.RegularExpressions.Regex.IsMatch(reports[0], @"main\.lua:\(?\d+")).IsTrue(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs b/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs new file mode 100644 index 00000000..4726a9c4 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs @@ -0,0 +1,137 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// ⌃F's older-history step (⌥H): the session's scrollback behind the pane is searched, its hits listed after the pane's +/// as "older", ⏎ on one opens the read-only history view on a page around it (or goes to the pane while it still holds +/// the line), and a capture window, which keeps no older history, says so. +/// +[NotInParallel] +public class DeepSearchTests +{ + private const string Ann = "Convergence.Ann"; + + private static readonly ConsoleKeyInfo AltH = new('\0', ConsoleKey.H, false, true, false); + private static readonly ConsoleKeyInfo Enter = new('\r', ConsoleKey.Enter, false, false, false); + private static readonly ConsoleKeyInfo Down = new('\0', ConsoleKey.DownArrow, false, false, false); + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + /// A connected Ann whose pane holds the newest 40 lines of 400, with goblins at lines 10 and 395. + private static async Task Live() + { + var config = new AppConfiguration { PaneLines = 40 }; + config.Worlds.Add(new WorldDefinition + { + Name = "Convergence", + Host = "convergence.example", + Port = 4201, + Characters = { new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings() } }, + }); + Console.SetIn(TextReader.Null); + var wire = new RecordingTelnetSession(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32)); + app.TelnetFactory = _ => wire; + app.DispatchCommand(CommandIds.Character(Ann)); + await app.FindSession(Ann)!.ConnectAsync(); + for (var i = 0; i < 400; i++) + { + wire.Receive(i is 10 or 395 ? $"a goblin, line {i}" : $"street {i}"); + } + + app.RenderNextFrame(); + return app; + } + + [Test] + public async Task WithoutAltHTheBoundSaysOlderHistoryCanBeSearched() + { + await using var app = await Live(); + + var model = app.SearchModelFor("goblin", false, false); + + await Assert.That(model.Rows.Count).IsEqualTo(1); + await Assert.That(model.Rows[0].IsOlder).IsFalse(); + await Assert.That(model.HistoryNote).Contains("⌥H searches older history"); + } + + [Test] + public async Task AltHListsTheScrollbacksHitsAfterThePanesAndNeverTwice() + { + await using var app = await Live(); + + var model = app.SearchModelFor("goblin", false, false, older: true); + + // The pane's own hit (line 395) once, then line 10 from the scrollback behind it. + await Assert.That(model.Rows.Count).IsEqualTo(2); + await Assert.That(model.Rows[0].IsOlder).IsFalse(); + await Assert.That(model.Rows[1].IsOlder).IsTrue(); + await Assert.That(model.Rows[1].Text).IsEqualTo("a goblin, line 10"); + await Assert.That(model.HeldRows).IsEqualTo(1); + await Assert.That(model.HistoryRunning).IsFalse(); + await Assert.That(model.HistoryNote).Contains("1 found"); + await Assert.That(model.StateText).Contains("older history"); + } + + [Test] + public async Task EnterOnAnOlderHitOpensTheHistoryViewAroundIt() + { + await using var app = await Live(); + app.OpenSearchForSnapshot(); + app.SimulateSearchTyping("goblin"); + app.SimulateSearchKey(AltH); + await Assert.That(app.SearchRows.Count).IsEqualTo(2); + + app.SimulateSearchKey(Down); + app.SimulateSearchKey(Enter); + + await Assert.That(app.SearchIsOpen).IsFalse(); + await Assert.That(app.HistoryViewIsOpen).IsTrue(); + var page = app.HistoryViewModel!; + await Assert.That(page.Lines.Count).IsEqualTo(ScrollbackViewModel.PageRows); + await Assert.That(page.Lines.Any(l => l.Index == page.Marked && l.Text == "a goblin, line 10")).IsTrue(); + await Assert.That(page.Title).Contains("read only"); + + // A move is a ranged read from the scrollback, never the pane. + app.ScrollHistoryView(page.Top + 5); + await Assert.That(app.HistoryViewModel!.Top).IsEqualTo(page.Top + 5); + await Assert.That(app.HistoryViewModel!.Lines[0].Text).IsEqualTo(app.FindSession(Ann)!.Scrollback.GetRange(page.Top + 5, 1)[0].Text); + } + + [Test] + public async Task AnOlderHitThePaneStillHoldsGoesToThePane() + { + await using var app = await Live(); + var model = app.SearchModelFor("goblin", false, false, older: true); + var held = model.Rows[0]; + + // The same line, as if it had been found in the scrollback: ⏎ goes to the pane, not the history view. + var session = app.FindSession(Ann)!; + var index = session.Scrollback.TotalLines - 5; + var asOlder = held with { LineIndex = -1, History = index, SessionKey = Ann }; + var rows = new List(model.Rows) { asOlder }; + app.GoToSearchHitForTest(model with { Rows = rows }, rows.Count - 1); + + await Assert.That(app.HistoryViewIsOpen).IsFalse(); + } + + [Test] + public async Task TheDemosCaptureWindowSaysItKeepsNoOlderHistory() + { + Console.SetIn(TextReader.Null); + await using var app = new SharpMUTermApp(DemoScene.Build(), Headless, new HeadlessConsoleDriver(120, 32)); + app.RenderSnapshot(); + app.SimulateWindowChange(DemoScene.ChatWindowId); + + var model = app.SearchModelFor("goblin", false, false, older: true); + + await Assert.That(model.HistoryNote).Contains("keeps no older history"); + await Assert.That(model.Rows.Any(r => r.IsOlder)).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/ScriptEditLoopTests.cs b/tests/SharpMUTerm.Tui.Tests/ScriptEditLoopTests.cs new file mode 100644 index 00000000..f9d0a952 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/ScriptEditLoopTests.cs @@ -0,0 +1,196 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// The script editing loop from the client's side: ⌃P lists the character's scripts, one opens in the composer's script +/// mode (lines verbatim, no escaping, no spelling), ⌃S writes it under the scripts folder and reloads that character's +/// scripts, and a reload's error is said in the editor's header with its file and line and kept in the console. A +/// package's script is only read. +/// +[NotInParallel] +public class ScriptEditLoopTests +{ + private const string Ann = "Convergence.Ann"; + + private static readonly ConsoleKeyInfo CtrlS = new('\u0013', ConsoleKey.S, false, false, true); + private static readonly ConsoleKeyInfo Esc = new('\u001b', ConsoleKey.Escape, false, false, false); + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class World : IAsyncDisposable + { + private World(string root, SharpMUTermApp app, RecordingTelnetSession wire) + { + Root = root; + App = app; + Wire = wire; + } + + public string Root { get; } + + public SharpMUTermApp App { get; } + + public RecordingTelnetSession Wire { get; } + + public static async Task Open(string lua) + { + var root = Directory.CreateTempSubdirectory("sharpmuterm-scriptedit-").FullName; + File.WriteAllText(Path.Combine(root, "main.lua"), lua); + var set = new TriggerSet { Name = "Lua", ScriptFiles = { "main.lua" } }; + set.Triggers.Add(new Trigger { Name = "ping", Pattern = "^ping$", Actions = new TriggerActions { ScriptCallback = "on_ping" } }); + var config = new AppConfiguration(); + config.TriggerSets.Add(set); + config.Worlds.Add(new WorldDefinition + { + Name = "Convergence", + Host = "convergence.example", + Port = 4201, + Characters = { new CharacterDefinition { Name = "Ann", Logging = new LoggingSettings(), TriggerSets = { "Lua" } } }, + }); + + Console.SetIn(TextReader.Null); + var wire = new RecordingTelnetSession(); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(120, 32), scriptsRoot: root); + app.TelnetFactory = _ => wire; + app.DispatchCommand(CommandIds.Character(Ann)); + await app.FindSession(Ann)!.ConnectAsync(); + app.RenderNextFrame(); + return new World(root, app, wire); + } + + public async ValueTask DisposeAsync() + { + await App.DisposeAsync(); + Directory.Delete(Root, recursive: true); + } + } + + [Test] + public async Task EditScriptListsTheCharactersScriptsOnThePalette() + { + await using var world = await World.Open("function on_ping() world.send('v1') end"); + File.WriteAllText(Path.Combine(world.Root, "extra.lua"), "-- not loaded"); + + await Assert.That(world.App.DispatchCommand(BuiltInCommands.ScriptEditCommand)).IsTrue(); + + var ids = world.App.BuildCatalog().Select(i => i.Id).ToList(); + await Assert.That(ids).Contains(BuiltInCommands.ScriptOpen("main.lua")); + await Assert.That(ids).Contains(BuiltInCommands.ScriptOpen("extra.lua")); + var main = world.App.BuildCatalog().Single(i => i.Id == BuiltInCommands.ScriptOpen("main.lua")); + await Assert.That(main.Detail).Contains("loaded by this character"); + } + + [Test] + public async Task AScriptOpensVerbatimWithNoEscapingOrSpelling() + { + await using var world = await World.Open("x = '%r [y]'\n"); + + await Assert.That(world.App.DispatchCommand(BuiltInCommands.ScriptOpen("main.lua"))).IsTrue(); + + await Assert.That(world.App.Composer.IsOpen).IsTrue(); + await Assert.That(world.App.Composer.Script!.Name).IsEqualTo("main.lua"); + await Assert.That(world.App.Composer.Body).StartsWith("x = '%r [y]'"); + await Assert.That(world.App.Composer.Spelling).IsNull(); + await Assert.That(world.App.Composer.Model.Edit!.Script).IsTrue(); + await Assert.That(world.App.Composer.Model.Keys.Select(k => k.Key)).Contains("⌃S"); + await Assert.That(world.App.Composer.Model.Keys.Select(k => k.Key)).DoesNotContain("⌥L"); + } + + [Test] + public async Task CtrlSSavesTheFileAndReloadsTheCharactersScripts() + { + await using var world = await World.Open("function on_ping() world.send('v1') end"); + world.App.DispatchCommand(BuiltInCommands.ScriptOpen("main.lua")); + world.App.Composer.SimulateTyping("\nfunction on_ping() world.send('v2') end\n"); + + await Assert.That(world.App.Composer.SimulateKey(CtrlS)).IsTrue(); + + // Saved verbatim, nothing sent to the game, the editor still open on the file, and the new function live. + await Assert.That(File.ReadAllText(Path.Combine(world.Root, "main.lua"))).Contains("world.send('v2')"); + await Assert.That(world.Wire.Lines.Any(l => l.Contains("on_ping", StringComparison.Ordinal))).IsFalse(); + await Assert.That(world.App.Composer.IsOpen).IsTrue(); + await Assert.That(world.App.Composer.Script!.Status).Contains("reloaded"); + world.Wire.Receive("ping"); + await Assert.That(world.Wire.Lines).Contains("v2"); + await Assert.That(world.App.ConsoleTexts(Ann, ScriptConsoleKind.Note).Any(t => t.Contains("saved main.lua", StringComparison.Ordinal))).IsTrue(); + } + + [Test] + public async Task AReloadErrorIsSaidWithItsFileAndLineAndKeptInTheConsole() + { + await using var world = await World.Open("function on_ping() world.send('v1') end"); + world.App.DispatchCommand(BuiltInCommands.ScriptOpen("main.lua")); + world.App.Composer.SimulateTyping("\n\nfunction broken(\n"); + + world.App.Composer.SimulateKey(CtrlS); + + var status = world.App.Composer.Script!.Status!; + await Assert.That(status).StartsWith("!"); + await Assert.That(status).Contains("main.lua"); + await Assert.That(world.App.Composer.HeaderMarkup).Contains("main.lua:"); + await Assert.That(world.App.ConsoleTexts(Ann, ScriptConsoleKind.Error).Any(t => t.Contains("main.lua", StringComparison.Ordinal))).IsTrue(); + + // Opened again from ⌃P, the editor lands on the line the error named. + world.App.Composer.SimulateKey(Esc); + world.App.DispatchCommand(BuiltInCommands.ScriptOpen("main.lua")); + await Assert.That(world.App.Composer.Script!.Line).IsGreaterThan(0); + } + + [Test] + public async Task EscKeepsUnsavedTextForTheFileUntilItIsSaved() + { + await using var world = await World.Open("x = 1\n"); + world.App.DispatchCommand(BuiltInCommands.ScriptOpen("main.lua")); + world.App.Composer.SimulateTyping("y = 2\n"); + + world.App.Composer.SimulateKey(Esc); + + await Assert.That(world.App.Composer.IsOpen).IsFalse(); + await Assert.That(world.App.KeptScriptText("main.lua")).Contains("y = 2"); + await Assert.That(File.ReadAllText(Path.Combine(world.Root, "main.lua"))).IsEqualTo("x = 1\n"); + world.App.DispatchCommand(BuiltInCommands.ScriptOpen("main.lua")); + await Assert.That(world.App.Composer.Body).Contains("y = 2"); + } + + [Test] + public async Task ANewScriptIsCreatedByNameAndARefusedNameWritesNothing() + { + await using var world = await World.Open("x = 1\n"); + + world.App.NewScript("../outside"); + await Assert.That(world.App.Composer.IsOpen).IsFalse(); + await Assert.That(File.Exists(Path.Combine(Path.GetDirectoryName(world.Root)!, "outside.lua"))).IsFalse(); + + world.App.NewScript("lib/helpers"); + await Assert.That(world.App.Composer.IsOpen).IsTrue(); + await Assert.That(world.App.Composer.Script!.Name).IsEqualTo("lib/helpers.lua"); + world.App.Composer.SimulateKey(CtrlS); + await Assert.That(File.Exists(Path.Combine(world.Root, "lib", "helpers.lua"))).IsTrue(); + await Assert.That(world.App.Composer.Script!.Status).Contains("not loaded"); + } + + [Test] + public async Task APackagesScriptIsOnlyRead() + { + Console.SetIn(TextReader.Null); + await using var demo = new SharpMUTermApp(DemoScene.Build(), Headless, new HeadlessConsoleDriver(120, 32)); + demo.RenderSnapshot(); + + demo.OpenScript("package:aetherfall-pack/combat.lua"); + + await Assert.That(demo.Composer.IsOpen).IsTrue(); + await Assert.That(demo.Composer.Script!.ReadOnly).IsTrue(); + await Assert.That(demo.Composer.Model.Keys.Select(k => k.Key)).DoesNotContain("⌃S"); + await Assert.That(demo.Composer.HeaderMarkup).Contains("READ ONLY"); + await Assert.That(demo.Composer.SimulateKey(CtrlS)).IsTrue(); + await Assert.That(demo.Composer.IsOpen).IsTrue(); + } +} From a7e8fa76bd3f94fe072566a4aa07d98830809a66 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 15:41:15 +0000 Subject: [PATCH 057/113] fix: nullability of the deep search's held-line sets Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs index 8636d63e..6bb11475 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs @@ -210,7 +210,7 @@ private void EnsureDeepSearch(string query, bool regex, bool all, bool older, IR // Which lines each pane still holds, by reference, taken here on the UI thread: the worker never touches a pane. var held = sources.Select(s => _lines.TryGetValue(s.WindowId, out var buffer) - ? buffer.Select(l => l.Source).OfType().ToHashSet(ReferenceEqualityComparer.Instance) + ? new HashSet(buffer.Select(l => l.Source).OfType(), ReferenceEqualityComparer.Instance) : new HashSet(ReferenceEqualityComparer.Instance)).ToArray(); var deep = new DeepSearch(key, sources, sources.Sum(s => s.Buffer.AvailableLines)); _deep = deep; From 37535bd6ced0a4c37c4ab4e57c8999c3560aea3c Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 16:02:19 +0000 Subject: [PATCH 058/113] =?UTF-8?q?feat(wave18a):=20script=20error=20line,?= =?UTF-8?q?=20centred=20history=20view,=20=E2=8C=A5H=20offer=20on=20?= =?UTF-8?q?=E2=8C=83F's=20status=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Script editor: ComposerEdit.ErrorLine (Client ScriptErrors.LineIn, the one reader of file.lua:(N,…)) set by ScriptEdit.Said from a save's status. Cells mark the line on a warning band (SetLineHighlight); the window numbers lines in a gutter beside its editor (ComposerView.LineGutter, from the TextBox layout) and flags the line there and behind it. - History view opens centred on the hit (ScrollbackViewModel.TopFor), Role() marks the three lines either side as context: body ink in both hosts, the rest muted. - ⌃F offers ⌥H on its status line while the pane cap trimmed what it searched (SearchModel.OlderLines/OffersOlder/OlderHintLadder), laddered beside the count; the window's hint is clickable. Nothing trimmed, nothing said. - F5 at 80x24: the top row's group label re-reads the first shown field each scroll step; verified correct and pinned by a walking test. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 + CLAUDE.md | 19 ++- src/SharpMUTerm.Avalonia/ComposerEditor.cs | 82 ++++++++++++ src/SharpMUTerm.Avalonia/ComposerView.cs | 113 +++++++++++++++- src/SharpMUTerm.Avalonia/ScrollbackView.cs | 9 +- src/SharpMUTerm.Avalonia/SearchView.cs | 13 +- .../Composer/ComposerModel.cs | 7 +- .../Composer/ScriptErrors.cs | 65 +++++++++ .../Modals/ScrollbackViewModel.cs | 33 ++++- src/SharpMUTerm.Client/Modals/SearchModel.cs | 67 ++++++++++ .../Surfaces/SurfaceCatalog.cs | 1 + src/SharpMUTerm.Tui/ComposeOverlay.cs | 48 ++++++- src/SharpMUTerm.Tui/ScrollbackViewSurface.cs | 15 ++- src/SharpMUTerm.Tui/SearchPrompt.cs | 25 +++- .../SharpMUTermApp.DeepSearch.cs | 19 ++- .../SharpMUTermApp.ScriptEdit.cs | 32 ++--- .../NativeScriptEditorTests.cs | 72 ++++++++++ .../SurfaceParityTests.cs | 15 +++ .../SearchAndScriptModelTests.cs | 85 ++++++++++++ .../SharpMUTerm.Tui.Tests/DeepSearchTests.cs | 18 ++- tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs | 1 + .../SearchAndScriptWaveTests.cs | 123 ++++++++++++++++++ 22 files changed, 812 insertions(+), 57 deletions(-) create mode 100644 src/SharpMUTerm.Client/Composer/ScriptErrors.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/NativeScriptEditorTests.cs create mode 100644 tests/SharpMUTerm.Client.Tests/SearchAndScriptModelTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/SearchAndScriptWaveTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index d854af60..f43a0489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- The script editor numbers its lines in the desktop window too, and after a save whose reload fails, the line the + error names is marked in both the terminal and the window. +- When Ctrl+F finds fewer matches than it might because the pane no longer holds older lines, its status line offers + Alt+H to search older history, saying how many more lines there are (in the window, clicking the hint does it). +- The read-only history page an older match opens is centred on the match, with the three lines either side drawn as + its context and the rest of the page quieter. + - Scripts can be edited without leaving the client. ⌃P ▸ Edit script… (or ⌃E in the script console, or `/script edit`) lists your character's script files; one opens in the composer with line numbers, exactly as written. ⌃S saves it, reloads that character's scripts and shows the first error with its file and line. ⌃P ▸ New script… (or diff --git a/CLAUDE.md b/CLAUDE.md index fe8c717e..3b42af3f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -114,6 +114,13 @@ fallbacks) for inline images/maps. line numbers, monospace). ⌃S saves, reloads that character's scripts and says the first error (`file:line`) in the header and the console; the editor stays open. Esc keeps unsaved text per file for the run. `package:` scripts open read only. The demo saves nothing. + - **The error's line is one model field, `ComposerEdit.ErrorLine`** (Client `ScriptErrors.LineIn`, the one reader of + `file.lua:(N,…)`, also behind ⌃P's `! line N`; `ScriptEdit.Said(status)` sets it from a `! …` status naming this file + and clears it on anything else). The cell editor puts that line on a band (`MultilineEditControl.SetLineHighlight`, + `ComposeOverlay.ErrorBand`: warn 28% over the well — a syntax token carries a foreground only); the window numbers + lines in a gutter (`ComposerView.LineGutter`, read off the `TextBox`'s own layout via `ComposerEditor.LineSpans`) and + flags the line there and with a band over the text (`DrawMarks`). The gutter re-measures only when its digits or face + change: the editor's layout raises `MarksMoved`, and measuring on each was an infinite layout loop. - **GMCP and MSDP data is held per session in `GameDataStore`, and three things read it**: the status row's meters (`StatusMeter`, F7 ▸ `meters`), ⌃P ▸ *Show game data* (`GameDataOverlay`) and Lua (`gmcp.get`, `msdp.get`). GMCP packages are stored by name with objects merged key by key, because IRE and Aardwolf send @@ -414,7 +421,14 @@ fallbacks) for inline images/maps. reference (a session window's `PaneLine.Source` is the ring's instance). Older rows list after the pane's, tagged `older`; the note on the count row says the bound and the progress, and that captures keep no older history. ⏎ on one goes to the pane if it holds the line, else opens the **history view**: a modal page of 20 lines, every move a - ranged read, never inserted into a pane buffer. ⌥G stays pane-only. + ranged read, never inserted into a pane buffer. ⌥G stays pane-only. It opens **centred on the hit** + (`ScrollbackViewModel.TopFor`, clamped at the ends), and `Role(line)` makes the `ContextRows` (3) either side context: + body ink behind a `│` in cells, a rule in the window; the rest of the page muted/dim. + - **⌥H is offered on the status line, not in a modal, only while the pane cap trimmed what ⌃F searched** + (`SearchModel.OlderLines`/`OlderSource`/`OffersOlder`: a query, ⌥H off, and the session scrollback holding lines the pane + does not). `OlderHintLadder` is four rungs, all starting `⌥H`; the cells take the longest that fits beside the count + (`NoteFor(room)`, chord in bold accent), the window shows the first in words, accent, and a click on it is ⌥H. Nothing + trimmed, nothing said. `FooterFitTests` pins the offer and the count on one row at 80×24. - **The demo scene loads with `_watching` off.** It pours a spawn window's whole history in before the first frame, and every line would otherwise count as missed — so any frame that later made such a window visible carried an activity bar reporting the client's own setup as news. @@ -1463,7 +1477,8 @@ fallbacks) for inline images/maps. (glyph runs, F-keys, Esc, PgUp…), two-space-indented lines stay rows. The cells draw bold headings and accent keys; the window draws headings and key chips (`NativeKeys.Words`). The cell topic header is one elided row. - **F5's world column at 80×24 drops its group headings** when the fields do not fit, naming the top row's group on the - column's first row (`├ WORLD · CONNECTION`, `⌃ 12 more · MAP`); while a world field is focused the character form and + column's first row (`├ WORLD · CONNECTION`, `⌃ 12 more · MAP`) — re-read at every scroll step from the first field + shown, which `SearchAndScriptWaveTests` walks with ⇥ (checked in wave 18: it was already right); while a world field is focused the character form and trigger sets are capped to a third of the height. ⇥ order is unchanged. An open `highlight names` edit draws the syntax and colours under its well (`NamesHelpRows`; `ScreenChrome.Window(…, keepBelow)` keeps them on screen); the window's field help is `HighlightColours.NamesHelp`, the same words. diff --git a/src/SharpMUTerm.Avalonia/ComposerEditor.cs b/src/SharpMUTerm.Avalonia/ComposerEditor.cs index 840110b6..ba56a895 100644 --- a/src/SharpMUTerm.Avalonia/ComposerEditor.cs +++ b/src/SharpMUTerm.Avalonia/ComposerEditor.cs @@ -133,6 +133,76 @@ public IReadOnlyList MarkRects() return rects; } + /// + /// The line a script's last load error named, from 1, or 0: , the field the cell + /// editor marks too. Drawn as a band over the line by and in the gutter. + /// + public int ErrorLine + { + get => _errorLine; + set + { + if (_errorLine != value) + { + _errorLine = value; + MarksMoved?.Invoke(); + } + } + } + + private int _errorLine; + + /// The band's colour (the warning ink, mostly transparent so the text under it reads). + public Color ErrorColour { get; set; } = Color.FromRgb(0xff, 0x6b, 0x6b); + + /// + /// Each source line (from 1) in view, with the top and bottom of all the rows it wraps onto, in this control's + /// coordinates: what the gutter numbers and the error band covers. Read off the box's own layout, so it follows + /// wrapping, scrolling and the face. Empty before the template is applied. + /// + public IReadOnlyList<(int Line, double Top, double Bottom)> LineSpans() + { + if (_presenter is not { TextLayout: { } layout } presenter) + { + return []; + } + + var text = Text ?? string.Empty; + var spans = new List<(int, double, double)>(); + var start = 0; + var line = 1; + var height = Bounds.Height; + while (start <= text.Length) + { + var end = text.IndexOf('\n', start); + var stop = end < 0 ? text.Length : end; + var first = layout.HitTestTextPosition(start); + var last = layout.HitTestTextPosition(stop); + if (presenter.TranslatePoint(first.TopLeft, this) is { } top && presenter.TranslatePoint(last.BottomLeft, this) is { } bottom) + { + if (top.Y > height) + { + break; + } + + if (bottom.Y >= 0) + { + spans.Add((line, top.Y, Math.Max(bottom.Y, top.Y + first.Height))); + } + } + + if (end < 0) + { + break; + } + + start = end + 1; + line++; + } + + return spans; + } + /// /// Draws the wavy lines onto . A paints its text and its own /// background in children of its template, which are drawn after anything the box itself draws, so the lines are @@ -140,6 +210,18 @@ public IReadOnlyList MarkRects() /// public void DrawMarks(DrawingContext context, Visual surface) { + if (_errorLine > 0) + { + foreach (var (line, top, bottom) in LineSpans()) + { + if (line == _errorLine && this.TranslatePoint(new Point(0, top), surface) is { } at) + { + var band = Color.FromArgb(0x3a, ErrorColour.R, ErrorColour.G, ErrorColour.B); + context.FillRectangle(new SolidColorBrush(band), new Rect(at.X, at.Y, Bounds.Width, bottom - top)); + } + } + } + var rects = MarkRects(); if (rects.Count == 0) { diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 78c831b9..a2df2fe4 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -37,6 +37,7 @@ internal sealed class ComposerView : Border private readonly bool _fullScreen; private readonly ComposerEditor _editor; private readonly MarkLayer _marks; + private readonly LineGutter _gutter; private readonly Border _header; private readonly TextBlock _title; private readonly TextBlock _target; @@ -78,6 +79,7 @@ public ComposerView(TerminalView view, bool fullScreen) _editor.GotFocus += (_, _) => AskToArm(); _editor.ContextRequested += OnContextRequested; _marks = new MarkLayer(_editor); + _gutter = new LineGutter(_editor) { IsVisible = false }; _title = new TextBlock { FontWeight = FontWeight.Bold, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 10, 0) }; _target = new TextBlock { VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; @@ -110,10 +112,17 @@ public ComposerView(TerminalView view, bool fullScreen) // The armed rule down the docked editor's left edge: the cell composer's ▌ marker, in the accent. _rule = new Border { Width = 3, HorizontalAlignment = HorizontalAlignment.Left }; - var body = new Panel(); - body.Children.Add(_editor); - body.Children.Add(_marks); - body.Children.Add(_rule); + var text = new Panel(); + text.Children.Add(_editor); + text.Children.Add(_marks); + text.Children.Add(_rule); + + // A script's lines are numbered in a gutter beside the editor, the cells' line numbers; the error line is marked there. + var body = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") }; + Grid.SetColumn(_gutter, 0); + Grid.SetColumn(text, 1); + body.Children.Add(_gutter); + body.Children.Add(text); var grid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto,Auto") }; Grid.SetRow(_header, 0); @@ -236,6 +245,11 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col // A package's script is only read: the editor shows it and keeps every edit out. _editor.IsReadOnly = model.Edit?.ReadOnly == true; + // A script: its lines numbered, and the line the last load error named marked in the gutter and behind the text, + // from the model's one field the cell editor marks too. + _gutter.IsVisible = model.Edit is { Script: true }; + _editor.ErrorLine = model.Edit is { Script: true, ErrorLine: > 0 } failed ? failed.ErrorLine : 0; + if (coloursChanged || previous is null) { Paint(); @@ -265,6 +279,9 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col } } + /// The gutter of line numbers, shown for a script. Internal for tests. + internal LineGutter Gutter => _gutter; + /// The header's length cell as drawn. Internal for tests. internal string CountText => _count.Text ?? string.Empty; @@ -301,6 +318,11 @@ private void Paint() _editor.SelectionBrush = new SolidColorBrush(Color.FromArgb(0x70, Accent.R, Accent.G, Accent.B)); _editor.SelectionForegroundBrush = new SolidColorBrush(_text); _editor.MarkColour = Warn; + _editor.ErrorColour = Warn; + _gutter.Ink = Dim; + _gutter.Warn = Warn; + _gutter.Background = new SolidColorBrush(Band); + _gutter.InvalidateVisual(); _title.Foreground = new SolidColorBrush(Accent); _target.Foreground = new SolidColorBrush(_text); _count.Foreground = new SolidColorBrush(Dim); @@ -787,4 +809,87 @@ public MarkLayer(ComposerEditor editor) public override void Render(DrawingContext context) => _editor.DrawMarks(context, this); } + + /// + /// A script's line numbers, beside the editor and level with each source line's first row (read off the editor's own + /// layout, so a wrapped line is numbered once and scrolling moves the numbers): the window's form of the cell editor's + /// numbered gutter. The line names is drawn in the warning ink with a bar at the + /// edge. It takes no input. + /// + internal sealed class LineGutter : Control + { + private readonly ComposerEditor _editor; + + public LineGutter(ComposerEditor editor) + { + _editor = editor; + IsHitTestVisible = false; + Focusable = false; + ClipToBounds = true; + // Repainted whenever the text moves (the editor's layout, a scroll); re-measured only when the width it needs + // changed — a digit more, another face or size — because the editor's own layout pass raises MarksMoved, and a + // gutter that re-measured on every one would never let layout settle. + editor.MarksMoved += () => + { + if (_measured != (Digits, _editor.FontSize, _editor.FontFamily)) + { + InvalidateMeasure(); + } + + InvalidateVisual(); + }; + } + + private (int Digits, double Size, FontFamily Face) _measured; + + /// The numbers' ink. + public Color Ink { get; set; } = Colors.Gray; + + /// The error line's ink. + public Color Warn { get; set; } = Colors.IndianRed; + + /// The gutter's plane. + public IBrush? Background { get; set; } + + /// The numbers drawn now, by line, for a test: the lines in view with the error line's flagged. + public IReadOnlyList<(int Line, bool Error)> Numbers => + [.. _editor.LineSpans().Select(s => (s.Line, s.Line == _editor.ErrorLine))]; + + private int Digits => Math.Max(2, (_editor.Text ?? string.Empty).Count(c => c == '\n') + 1).ToString(System.Globalization.CultureInfo.InvariantCulture).Length; + + protected override Size MeasureOverride(Size availableSize) + { + _measured = (Digits, _editor.FontSize, _editor.FontFamily); + var sample = Text(new string('8', Digits), Ink, FontWeight.Normal); + return new Size(Math.Ceiling(sample.Width) + 22, 0); + } + + public override void Render(DrawingContext context) + { + if (Background is { } plane) + { + context.FillRectangle(plane, new Rect(Bounds.Size)); + } + + foreach (var (line, top, bottom) in _editor.LineSpans()) + { + if (_editor.TranslatePoint(new Point(0, top), this) is not { } at) + { + continue; + } + + var error = line == _editor.ErrorLine; + var number = Text(line.ToString(System.Globalization.CultureInfo.InvariantCulture), error ? Warn : Ink, error ? FontWeight.Bold : FontWeight.Normal); + context.DrawText(number, new Point(Bounds.Width - 10 - number.Width, at.Y)); + if (error) + { + context.FillRectangle(new SolidColorBrush(Warn), new Rect(Bounds.Width - 4, at.Y, 3, bottom - top)); + } + } + } + + private FormattedText Text(string text, Color ink, FontWeight weight) => + new(text, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, + new Typeface(_editor.FontFamily, FontStyle.Normal, weight), _editor.FontSize, new SolidColorBrush(ink)); + } } diff --git a/src/SharpMUTerm.Avalonia/ScrollbackView.cs b/src/SharpMUTerm.Avalonia/ScrollbackView.cs index 9a16d6bf..075dce08 100644 --- a/src/SharpMUTerm.Avalonia/ScrollbackView.cs +++ b/src/SharpMUTerm.Avalonia/ScrollbackView.cs @@ -99,12 +99,15 @@ private void Draw() var mono = new FontFamily($"{CellFonts.BundledFamily}, DejaVu Sans Mono, Consolas, Menlo, monospace"); foreach (var line in _model.Lines) { - var marked = line.Index == _model.Marked; + // The hit on the selection plane, its context in the body ink behind a rule, the rest of the page in the dim ink: + // the model's roles, which the cells draw too. + var role = _model.Role(line); + var marked = role == ScrollbackLineRole.Hit; var text = new TextBlock { FontFamily = mono, FontSize = NativeTokens.Body, - Foreground = _colours.Brush(_colours.Text), + Foreground = _colours.Brush(role == ScrollbackLineRole.Page ? _colours.Dim : _colours.Text), TextTrimming = TextTrimming.CharacterEllipsis, }; text.Inlines = ModalParts.Marked(line.Text, line.MatchStart, line.MatchLength, _colours); @@ -113,6 +116,8 @@ private void Draw() CornerRadius = new CornerRadius(NativeTokens.RadiusM), Padding = new Thickness(12, 2), Background = marked ? _colours.Brush(_colours.Selected) : Brushes.Transparent, + BorderBrush = role == ScrollbackLineRole.Context ? _colours.Brush(_colours.Rule) : null, + BorderThickness = new Thickness(role == ScrollbackLineRole.Context ? 2 : 0, 0, 0, 0), Child = text, }); } diff --git a/src/SharpMUTerm.Avalonia/SearchView.cs b/src/SharpMUTerm.Avalonia/SearchView.cs index f70d393a..8f04abbf 100644 --- a/src/SharpMUTerm.Avalonia/SearchView.cs +++ b/src/SharpMUTerm.Avalonia/SearchView.cs @@ -74,6 +74,16 @@ public SearchView(SearchSession session, NativeTokens colours, Action done) Children.Add(_state); _note = ModalParts.Dim(string.Empty, colours, new Thickness(20, 0, 20, 6)); + + // While the pane cap trimmed what was searched, the note is the ⌥H offer, and a click on it is ⌥H. + _note.PointerPressed += (_, e) => + { + if (_model.OffersOlder) + { + e.Handled = true; + _older.IsChecked = true; + } + }; SetDock(_note, Dock.Top); Children.Add(_note); @@ -227,7 +237,8 @@ private void Draw() _count.Text = _model.CountText; _note.Text = NativeKeys.Words(_model.HistoryNote ?? string.Empty); _note.IsVisible = _model.HistoryNote is not null; - _note.Foreground = _colours.Brush(_model.HistoryRunning ? _colours.Accent : _colours.Dim); + _note.Foreground = _colours.Brush(_model.HistoryRunning || _model.OffersOlder ? _colours.Accent : _colours.Dim); + _note.Cursor = _model.OffersOlder ? new Cursor(StandardCursorType.Hand) : null; _list.Children.Clear(); _rows.Clear(); _selected = _model.Rows.Count == 0 ? 0 : Math.Clamp(_selected, 0, _model.Rows.Count - 1); diff --git a/src/SharpMUTerm.Client/Composer/ComposerModel.cs b/src/SharpMUTerm.Client/Composer/ComposerModel.cs index 6f413b22..a37d2ec4 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerModel.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerModel.cs @@ -37,7 +37,12 @@ public sealed record ComposerKey(string Key, string Label, string? Short = null) /// Whether it can only be read: a package's script. /// What the last save said (saved · 2 files loaded, or the first load error), or null. /// The line the caret opens on, from 1; 0 for the end. -public sealed record ComposerEdit(string Name, string Type, bool Script = false, bool ReadOnly = false, string? Status = null, int Line = 0); +/// +/// The line of this script the last load error named (corvid.lua:(14,…)), from 1; 0 for none. Both hosts mark it +/// from this one field — the cells on a warning band behind the line, the window in its gutter and behind the line +/// (). +/// +public sealed record ComposerEdit(string Name, string Type, bool Script = false, bool ReadOnly = false, string? Status = null, int Line = 0, int ErrorLine = 0); /// /// A composer, as both hosts draw it. The terminal draws F1 and the docked panel in cells; the window draws them diff --git a/src/SharpMUTerm.Client/Composer/ScriptErrors.cs b/src/SharpMUTerm.Client/Composer/ScriptErrors.cs new file mode 100644 index 00000000..1058137e --- /dev/null +++ b/src/SharpMUTerm.Client/Composer/ScriptErrors.cs @@ -0,0 +1,65 @@ +using System.Globalization; +using System.Text.RegularExpressions; + +namespace SharpMUTerm.Client.Composer; + +/// +/// Reads the line a Lua load or run error names in a script file: MoonSharp says corvid.lua:(14,22-30): … (a chunk is +/// loaded under its file's name), and a plain corvid.lua:14: is read too. One reader, so ⌃P's list of scripts, the +/// line an opened script lands on and the line the editor marks () are the same number. +/// +public static class ScriptErrors +{ + private static readonly Regex ErrorAt = new( + @"(?[A-Za-z0-9_.\-]+\.lua):\(?(?\d+)", + RegexOptions.CultureInvariant, + TimeSpan.FromMilliseconds(50)); + + /// + /// The line of script (folders and a package: prefix allowed; its file name is what is + /// matched) that names, or null. + /// + public static int? LineIn(string? text, string name) + { + ArgumentNullException.ThrowIfNull(name); + if (string.IsNullOrEmpty(text)) + { + return null; + } + + var file = name[(name.LastIndexOf('/') + 1)..]; + try + { + foreach (Match match in ErrorAt.Matches(text)) + { + if (string.Equals(match.Groups["file"].Value, file, StringComparison.Ordinal) + && int.TryParse(match.Groups["line"].Value, NumberStyles.None, CultureInfo.InvariantCulture, out var line) + && line > 0) + { + return line; + } + } + } + catch (RegexMatchTimeoutException) + { + return null; + } + + return null; + } + + /// The line the newest of (oldest first) names in , or null. + public static int? LineIn(IReadOnlyList errors, string name) + { + ArgumentNullException.ThrowIfNull(errors); + for (var i = errors.Count - 1; i >= 0; i--) + { + if (LineIn(errors[i], name) is { } line) + { + return line; + } + } + + return null; + } +} diff --git a/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs b/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs index 2abbcf96..8c28560b 100644 --- a/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs +++ b/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs @@ -5,10 +5,25 @@ namespace SharpMUTerm.Client.Modals; /// One line of the history view: its absolute index in the session's scrollback, its text, and where the query matched. public readonly record struct ScrollbackViewLine(long Index, string Text, int MatchStart, int MatchLength); +/// What a line of the history view is to the line the search found. +public enum ScrollbackLineRole +{ + /// A line of the page, away from the hit: drawn quieter. + Page, + + /// One of the lines either side of the hit: the body ink. + Context, + + /// The line the search found: marked. + Hit, +} + /// /// The read-only history view (⏎ on an older-history hit in ⌃F): lines of a session's scrollback /// — the ring or the file-backed spill — around the line the search found, the found line marked and the query's run in -/// each line marked. Drawn by the cell surface (ScrollbackViewSurface.Render) and the window's native modal from +/// each line marked. It opens centred on the found line (), and the lines +/// either side of it are its context (): drawn in the body ink, the rest of the page quieter, so the hit +/// reads with what was said around it. Drawn by the cell surface (ScrollbackViewSurface.Render) and the window's native modal from /// the same record; every move is a ranged read the client makes (ScrollHistoryView), so the two show the same page. /// /// A view, not a pane. It never puts old lines back into a pane buffer: a pane holds the newest @@ -35,6 +50,9 @@ public sealed record ScrollbackViewModel( /// The lines a page holds, the same in both hosts. public const int PageRows = 20; + /// How many lines either side of the found line are its context. + public const int ContextRows = 3; + /// The keys, in glyphs (a native view spells them in words). public const string Keys = "↑↓ a line · PgUp PgDn a page · Home End the ends · Esc closes"; @@ -59,8 +77,17 @@ public string Position /// The title row: whose history, and that it is only read. public string Title => $"OLDER HISTORY · {Window} · read only"; - /// The top that shows a third of the way down a page, clamped to what is held. - public static long TopFor(long marked, long oldest, long end) => Clamp(marked - PageRows / 3, oldest, end); + /// + /// The top that shows in the middle of a page — / 2 lines above it, the + /// rest below — clamped to what is held, so a hit near either end sits as near the middle as the history allows. + /// + public static long TopFor(long marked, long oldest, long end) => Clamp(marked - PageRows / 2, oldest, end); + + /// What a line of the page is to the hit: the hit itself, its context ( either side), or the rest. + public ScrollbackLineRole Role(ScrollbackViewLine line) => + line.Index == Marked ? ScrollbackLineRole.Hit + : Math.Abs(line.Index - Marked) <= ContextRows ? ScrollbackLineRole.Context + : ScrollbackLineRole.Page; /// kept to a page that starts at or after the oldest line and ends at or before the newest. public static long Clamp(long top, long oldest, long end) => Math.Max(oldest, Math.Min(top, Math.Max(oldest, end - PageRows))); diff --git a/src/SharpMUTerm.Client/Modals/SearchModel.cs b/src/SharpMUTerm.Client/Modals/SearchModel.cs index 3c96c168..80a12843 100644 --- a/src/SharpMUTerm.Client/Modals/SearchModel.cs +++ b/src/SharpMUTerm.Client/Modals/SearchModel.cs @@ -1,3 +1,5 @@ +using System.Globalization; + namespace SharpMUTerm.Client.Modals; /// @@ -49,6 +51,70 @@ public sealed record SearchModel( /// The toggles and what they mean now, in words: text · Corvid, regex · every window · older history. public string StateText => $"{(Regex ? "regex" : "text")} · {(AllWindows ? "every window" : Scope)}{(Older ? " · older history" : string.Empty)}"; + /// + /// How many lines the scrollback behind the searched windows holds that their panes no longer do — what the pane cap + /// trimmed, and so what this search could not see. Set only while ⌥H is off; 0 when the panes hold everything. + /// + public long OlderLines { get; init; } + + /// Whose older history counts: the window's name, or 3 windows. + public string OlderSource { get; init; } = string.Empty; + + /// + /// Whether the status line offers ⌥H: a query was searched, ⌥H is off, and the pane cap trimmed lines the scrollback + /// still holds, so this search found fewer hits than it might. A hint on the line under the query, never a modal. + /// + public bool OffersOlder => !Older && Error is null && Query.Length > 0 && OlderLines > 0; + + /// The offer's chord, which a host draws as a key. + public const string OlderKey = "⌥H"; + + /// + /// The offer, longest first, for a status line too narrow for all of it: whose history and how much, then how much, + /// then the offer alone, then the chord and two words. Every rung starts with . Empty when + /// nothing is offered. + /// + public IReadOnlyList OlderHintLadder + { + get + { + if (!OffersOlder) + { + return []; + } + + var lines = OlderLines.ToString("N0", CultureInfo.InvariantCulture); + var more = $"{lines} more line{(OlderLines == 1 ? string.Empty : "s")}"; + return + [ + OlderSource.Length > 0 ? $"{OlderKey} searches older history · {more} in {OlderSource}" : $"{OlderKey} searches older history · {more}", + $"{OlderKey} searches older history · {more}", + $"{OlderKey} searches older history", + $"{OlderKey} older history", + ]; + } + } + + /// + /// The status line's note in cells (0 for no limit): the longest rung of + /// that fits while ⌥H is offered (its last rung if none does), else . + /// + public string? NoteFor(int room) + { + var ladder = OlderHintLadder; + if (ladder.Count == 0) + { + return HistoryNote; + } + + if (room <= 0) + { + return HistoryNote ?? ladder[0]; + } + + return ladder.FirstOrDefault(r => r.Length <= room) ?? ladder[^1]; + } + /// How many rows are the pane buffer's (the rest are older history's, listed after them). public int HeldRows => Rows.Count(r => !r.IsOlder); @@ -78,6 +144,7 @@ other is not null && Query == other.Query && Regex == other.Regex && AllWindows == other.AllWindows && Scope == other.Scope && Held == other.Held && Error == other.Error && Older == other.Older && HistoryNote == other.HistoryNote && HistoryRunning == other.HistoryRunning + && OlderLines == other.OlderLines && OlderSource == other.OlderSource && ModelLists.Same(Rows, other.Rows); public override int GetHashCode() => HashCode.Combine(Query, Regex, AllWindows, Scope, Held, Error, ModelLists.Hash(Rows)); diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index e176ea8d..791387a4 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -450,6 +450,7 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), [ // Typing, ⌥E, ⌥A and ⌥H re-run the search over the pane buffers (and, with ⌥H, the sessions' scrollback off // the UI thread); ⏎ goes to the row through the one path to a hit, or opens an older one in the history view. + // The status line's ⌥H offer (SearchModel.OlderHintLadder) is the same query: a click on it in the window is ⌥H. new(SurfaceActionKind.Modal, "query", "SearchModelFor"), new(SurfaceActionKind.Modal, "go", "GoToSearchHit"), ], diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 3773e81a..09c974ae 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -26,10 +26,21 @@ namespace SharpMUTerm.Tui; /// A package's script: shown, never saved. /// What the last save said, or null. /// The line the caret opens on, from 1; 0 for the top. -internal sealed record ScriptEdit(string Name, string? Owner, bool ReadOnly, string? Status = null, int Line = 0) +/// The line the last load error named in this file, from 1; 0 for none. +internal sealed record ScriptEdit(string Name, string? Owner, bool ReadOnly, string? Status = null, int Line = 0, int ErrorLine = 0) { /// What the editor says this is: the MOO edit's shape, read by both hosts. - internal ComposerEdit Describe() => new(Name, "lua", Script: true, ReadOnly, Status, Line); + internal ComposerEdit Describe() => new(Name, "lua", Script: true, ReadOnly, Status, Line, ErrorLine); + + /// + /// This edit after a save said : an error (! …) naming a line of this file marks that + /// line; anything else clears the mark. + /// + internal ScriptEdit Said(string status) => this with + { + Status = status, + ErrorLine = status.StartsWith('!') ? ScriptErrors.LineIn(status, Name) ?? 0 : 0, + }; } /// @@ -148,7 +159,8 @@ internal void SetScriptStatus(string status) return; } - _script = _script with { Status = status }; + _script = _script.Said(status); + MarkErrorLine(); RefreshBands(); } @@ -274,6 +286,8 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool _editor.GoToLine(at.Line); } + MarkErrorLine(); + _editor.ContentChanged += (_, _) => RefreshBands(); FitEditor(); @@ -303,6 +317,34 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool _window.FocusManager.SetFocus(_editor, FocusReason.Programmatic); } + /// + /// The line the last load error named (, the field the window's editor marks too) + /// on a band behind it in the warning ink, the rest cleared. A background, because the editor's syntax tokens carry a + /// foreground only. + /// + private void MarkErrorLine() + { + if (_editor is null) + { + return; + } + + _editor.ClearLineHighlights(); + if (_script is { ErrorLine: > 0 } script) + { + _editor.SetLineHighlight(script.ErrorLine - 1, ErrorBand(_scheme)); + } + } + + /// The error line's band: the warning ink part of the way over the editor's well, so the text on it stays legible. + internal static Color ErrorBand(ScreenTheme scheme) + { + var well = scheme.Colour(ScreenPalette.EditBg); + var warn = scheme.Colour(ScreenPalette.Warn); + static byte Mix(byte a, byte b) => (byte)Math.Round(a + ((b - a) * 0.28)); + return new Color(Mix(well.R, warn.R), Mix(well.G, warn.G), Mix(well.B, warn.B)); + } + /// /// Feeds one key through the very handler PreviewKeyPressed raises, so a headless test and a /// snapshot can drive this window. The framework only pumps input inside Run(), which neither diff --git a/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs b/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs index fc75cf72..770d0260 100644 --- a/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs +++ b/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs @@ -6,7 +6,8 @@ namespace SharpMUTerm.Tui; /// /// The read-only history view in cells: a page of a session's scrollback (ring or spill) around the line ⌃F's older-history -/// search found, that line on the accent band and the query's run in every line in bold accent. Pure: the page is the +/// search found, centred: that line on the accent band, its context ( either side) +/// in the body ink behind a │, the rest of the page muted, and the query's run in every line in bold accent. Pure: the page is the /// the window's native view draws too, and every move is the client's ranged read. /// Always rows of page, so the overlay sized once at open keeps fitting. /// @@ -27,7 +28,7 @@ internal static List Render(ScrollbackViewModel model, int width) for (var i = 0; i < ScrollbackViewModel.PageRows; i++) { - lines.Add(i < model.Lines.Count ? Row(model.Lines[i], model.Lines[i].Index == model.Marked, width) : string.Empty); + lines.Add(i < model.Lines.Count ? Row(model.Lines[i], model.Role(model.Lines[i]), width) : string.Empty); } lines.Add(string.Empty); @@ -35,10 +36,10 @@ internal static List Render(ScrollbackViewModel model, int width) return lines; } - private static string Row(ScrollbackViewLine line, bool marked, int width) + private static string Row(ScrollbackViewLine line, ScrollbackLineRole role, int width) { var text = ElidePlain(line.Text.Replace('\t', ' '), width - 2); - if (marked) + if (role == ScrollbackLineRole.Hit) { var pad = new string(' ', Math.Max(0, width - 2 - text.Length)); return $"[{Ink} on {Accent}]▸ {Escape(text)}{pad}[/]"; @@ -46,14 +47,16 @@ private static string Row(ScrollbackViewLine line, bool marked, int width) if (line.MatchStart < 0 || line.MatchStart >= text.Length || line.MatchLength <= 0) { - return $" [{Value}]{Escape(text)}[/]"; + return role == ScrollbackLineRole.Context ? $"[{Muted}]│[/] [{Value}]{Escape(text)}[/]" : $" [{Muted}]{Escape(text)}[/]"; } var length = Math.Min(line.MatchLength, text.Length - line.MatchStart); var before = text[..line.MatchStart]; var hit = text.Substring(line.MatchStart, length); var after = text[(line.MatchStart + length)..]; - return $" [{Value}]{Escape(before)}[/][bold {Accent}]{Escape(hit)}[/][{Value}]{Escape(after)}[/]"; + var ink = role == ScrollbackLineRole.Context ? Value : Muted; + var lead = role == ScrollbackLineRole.Context ? $"[{Muted}]│[/] " : " "; + return $"{lead}[{ink}]{Escape(before)}[/][bold {Accent}]{Escape(hit)}[/][{ink}]{Escape(after)}[/]"; } private static string ElidePlain(string text, int width) => diff --git a/src/SharpMUTerm.Tui/SearchPrompt.cs b/src/SharpMUTerm.Tui/SearchPrompt.cs index c93e2b2b..de4fe733 100644 --- a/src/SharpMUTerm.Tui/SearchPrompt.cs +++ b/src/SharpMUTerm.Tui/SearchPrompt.cs @@ -224,10 +224,7 @@ internal static List Render(SearchModel model, int selected, int width = var lines = new List { SpreadLR($"[{Label}]search[/] {QueryMarkup(query)}", $"[{Label}]{Escape(model.StateText)}[/]", width), - SpreadLR( - model.HistoryNote is { } note ? $"[{(model.HistoryRunning ? Accent : Muted)}]{Escape(note)}[/]" : string.Empty, - $"[{Label}]{Escape(model.CountText)}[/]", - width), + SpreadLR(NoteMarkup(model, width), $"[{Label}]{Escape(model.CountText)}[/]", width), }; var body = new List(); @@ -254,6 +251,26 @@ internal static List Render(SearchModel model, int selected, int width = return lines; } + /// + /// The status line's left half: older history's note, or — while the pane cap trimmed what this search could see — the + /// ⌥H offer, laddered to the room the count leaves (), its chord in the accent. + /// + private static string NoteMarkup(SearchModel model, int width) + { + var room = width > 0 ? width - VisibleLength(model.CountText) - 2 : 0; + if (model.NoteFor(room) is not { } note) + { + return string.Empty; + } + + if (model.OffersOlder && note.StartsWith(SearchModel.OlderKey, StringComparison.Ordinal)) + { + return $"[bold {Accent}]{SearchModel.OlderKey}[/][{Muted}]{Escape(note[SearchModel.OlderKey.Length..])}[/]"; + } + + return $"[{(model.HistoryRunning ? Accent : Muted)}]{Escape(note)}[/]"; + } + /// /// Where the list area's top must sit for to be inside it, moving as /// little as possible from . diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs index 6bb11475..b06da0c4 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs @@ -105,7 +105,6 @@ internal SearchModel SearchModelFor(string query, bool regex, bool all, bool old var sources = HistorySources(all, out var captures); EnsureDeepSearch(query, regex, all, older && held.Error is null, sources); - var total = sources.Sum(s => s.Buffer.AvailableLines); var who = sources.Count == 1 ? sources[0].Label : $"{sources.Count} windows"; var spill = captures switch { @@ -116,10 +115,20 @@ internal SearchModel SearchModelFor(string query, bool regex, bool all, bool old if (!older || held.Error is not null || _deep is not { } deep) { - var note = sources.Count == 0 - ? (spill.Length > 0 ? spill.TrimStart(' ', '·') : null) - : $"⌥H searches older history · {N(total)} lines in {who}{spill}"; - return held with { Older = older, HistoryNote = note }; + // What the pane cap trimmed: the scrollback's lines the panes no longer hold. While there are some, the status + // line offers ⌥H (SearchModel.OlderHintLadder); while there are none, older history has nothing more to find. + long trimmed = 0; + foreach (var source in sources) + { + var inPane = _lines.TryGetValue(source.WindowId, out var buffer) ? buffer.Count(l => l.Source is StyledLine) : 0; + trimmed += Math.Max(0, source.Buffer.AvailableLines - inPane); + } + + var model = held with { Older = older, OlderLines = older ? 0 : trimmed, OlderSource = sources.Count == 0 ? string.Empty : who }; + var note = model.OffersOlder + ? model.OlderHintLadder[0] + spill + : spill.Length > 0 ? spill.TrimStart(' ', '·') : null; + return model with { HistoryNote = note }; } var rows = new List(held.Rows); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs index d5730ebd..fdede98d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs @@ -1,5 +1,5 @@ using System.Globalization; -using System.Text.RegularExpressions; +using SharpMUTerm.Client.Composer; using SharpMUTerm.Client.Modals; using SharpMUTerm.Core.Commands; using SharpMUTerm.Core.Diagnostics; @@ -61,8 +61,6 @@ internal sealed partial class SharpMUTermApp "\n" + "trigger.add('^(\\\\w+) tells you', 'on_tell')\n"; - private static readonly Regex ErrorAt = new(@"(?[A-Za-z0-9_.\-]+\.lua):\(?(?\d+)", RegexOptions.CultureInvariant, TimeSpan.FromMilliseconds(50)); - /// Whether the focused window is the demo's, in a client with no scripts folder — the snapshot's scripts. private bool DemoScriptsShown => _scriptsRoot is null && _workspace.FindWindow(ActiveWindowId())?.SessionKey is { } owner && IsDemoKey(owner); @@ -137,23 +135,7 @@ string Describe(string name, bool exists) } /// The line of the newest console error naming 's file, or null. - private static int? LastErrorLine(IReadOnlyList errors, string name) - { - var file = name[(name.LastIndexOf('/') + 1)..]; - for (var i = errors.Count - 1; i >= 0; i--) - { - foreach (Match match in ErrorAt.Matches(errors[i])) - { - if (string.Equals(match.Groups["file"].Value, file, StringComparison.Ordinal) - && int.TryParse(match.Groups["line"].Value, NumberStyles.None, CultureInfo.InvariantCulture, out var line)) - { - return line; - } - } - } - - return null; - } + private static int? LastErrorLine(IReadOnlyList errors, string name) => ScriptErrors.LineIn(errors, name); /// /// ⌃P ▸ Edit script…, the console's ⌃E and a bare /script edit: the palette, opened on the script files. From @@ -202,7 +184,8 @@ private bool OpenScriptFromPalette(string name) var owner = ScriptOwner(); var errors = owner is null ? [] : ConsoleLog(owner).Lines.Where(l => l.Kind == ScriptConsoleKind.Error).Select(l => l.Text).ToArray(); - OpenScript(name, LastErrorLine(errors, name) ?? 0); + var line = LastErrorLine(errors, name) ?? 0; + OpenScript(name, line, errorLine: line); return true; } @@ -263,7 +246,8 @@ internal void NewScript(string typed) /// Opens script in the composer's script mode: a package's read-only, anything else from the /// scripts folder (the template when it does not exist yet), or the unsaved text Esc kept for it. /// - internal void OpenScript(string name, int line = 0) + /// The line the console's newest error names in it, marked in the editor; 0 for none. + internal void OpenScript(string name, int line = 0, int errorLine = 0) { if (ComposerOpen || AnyOverlayOpen) { @@ -330,7 +314,7 @@ internal void OpenScript(string name, int line = 0) var target = session is not null ? SessionTitle(session) : owner is not null ? FindCharacter(owner)?.Character.Name ?? string.Empty : string.Empty; - OpenComposer(target, text, ComposeEscaping.AsTyped, canSend: true, edit: null, script: new ScriptEdit(name, owner, package, status, line)); + OpenComposer(target, text, ComposeEscaping.AsTyped, canSend: true, edit: null, script: new ScriptEdit(name, owner, package, status, line, errorLine)); } /// @@ -398,7 +382,7 @@ private void SetScriptStatus(string status) { if (_nativeCompose is { Script: { } script } open) { - open.Script = script with { Status = status }; + open.Script = script.Said(status); open.Session.Publish(NativeComposeModel(open)); return; } diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeScriptEditorTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeScriptEditorTests.cs new file mode 100644 index 00000000..48d11ab4 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeScriptEditorTests.cs @@ -0,0 +1,72 @@ +using Avalonia.Controls; +using Avalonia.Media; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window's script editor: a script's lines are numbered in a gutter beside the native editor, level with the text, +/// and the line the reload's error named (, the field the cell editor marks) is the one +/// the gutter flags. A post has no gutter. +/// +[NotInParallel] +public class NativeScriptEditorTests +{ + private static ComposerModel Script(int errorLine) => + ComposerModel.Create( + ComposerPlace.FullScreen, + "Corvid", + SharpMUTermApp.DemoScriptText, + ComposeEscaping.AsTyped, + new ComposerEdit("corvid.lua", "lua", Script: true, Status: errorLine > 0 ? "! corvid.lua:(14,22-30): nil" : null, ErrorLine: errorLine), + null, + canSend: true, + armed: true, + revision: 1); + + private static Task Shown(ComposerModel model, Func read) => + DesktopLayerTests.Run((window, view, layer, driver) => + { + var composer = new ComposerView(view, fullScreen: true); + var host = new Window { Content = composer, Width = 900, Height = 700 }; + host.Show(); + composer.Show(model, new ComposerSession(model, null, new ComposerCallbacks()), new PanelInk("#5fafff", "#ff5f5f", "#3a3a40"), Colors.Black, Colors.White); + DesktopLayerTests.Drain(); + host.UpdateLayout(); + DesktopLayerTests.Drain(); + try + { + return read(composer); + } + finally + { + host.Close(); + } + }); + + [Test] + public async Task AScriptsLinesAreNumberedAndTheErrorLineIsFlagged() + { + var (visible, width, numbers, editorLine) = await Shown(Script(14), c => + (c.Gutter.IsVisible, c.Gutter.Bounds.Width, c.Gutter.Numbers, c.Editor.ErrorLine)); + + await Assert.That(visible).IsTrue(); + await Assert.That(width).IsGreaterThan(0); + await Assert.That(numbers.Select(n => n.Line).Take(3)).IsEquivalentTo([1, 2, 3], TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That(numbers.Where(n => n.Error).Select(n => n.Line)).IsEquivalentTo([14]); + await Assert.That(editorLine).IsEqualTo(14).Because("the band behind the text is drawn from the same field"); + } + + [Test] + public async Task ACleanScriptFlagsNothingAndAPostHasNoGutter() + { + var clean = await Shown(Script(0), c => c.Gutter.Numbers.Count(n => n.Error)); + await Assert.That(clean).IsEqualTo(0); + + var post = ComposerModel.Create(ComposerPlace.FullScreen, "Corvid", "hello", ComposeEscaping.AsTyped, null, null, true, true, 1); + var gutter = await Shown(post, c => c.Gutter.IsVisible); + await Assert.That(gutter).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 73846b6f..5265ddf7 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -220,6 +220,10 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! await Assert.That(composer.Session).IsNotNull().Because($"{view}: F1 opened in the window's editor"); await Assert.That(native.Composer.IsOpen).IsFalse().Because($"{view}: and not in cells under it"); await Assert.That(cells.DrawnModel(SurfaceCatalog.Compose)).IsEqualTo((object)composer.Session!.Model).Because(view); + if (view == "script-edit") + { + await Assert.That(composer.Session.Model.Edit!.ErrorLine).IsEqualTo(14).Because("both hosts mark the line the error named"); + } } covered.Add(SurfaceCatalog.Compose); @@ -281,6 +285,17 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! covered.Add(surface); } + // ⌃F's ⌥H offer: the model both hosts draw offers older history while the pane cap trimmed what was searched. + { + using var nativeDriver = new AvaloniaConsoleDriver(140, 36); + var modals = new FakeModals(); + await using var native = App(nativeDriver, DemoScene.Build(), modals: modals); + native.RenderSnapshot("search"); + var offered = ((SearchSession)modals.Open(SurfaceCatalog.Search)!).Model; + await Assert.That(offered.OffersOlder).IsTrue(); + await Assert.That(offered.HistoryNote).StartsWith(SearchModel.OlderKey); + } + // ⌃R filtered: the view hands its query to the native box, and the native list's rows for it are the cell list's. { using var nativeDriver = new AvaloniaConsoleDriver(140, 36); diff --git a/tests/SharpMUTerm.Client.Tests/SearchAndScriptModelTests.cs b/tests/SharpMUTerm.Client.Tests/SearchAndScriptModelTests.cs new file mode 100644 index 00000000..fbee2b2b --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/SearchAndScriptModelTests.cs @@ -0,0 +1,85 @@ +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Client.Modals; + +namespace SharpMUTerm.Client.Tests; + +/// +/// Wave 18's model facts, each one field both hosts read: the line a Lua error names (), the +/// history view centred on its hit with context either side, and ⌃F's ⌥H offer laddered to the status line's room. +/// +public class SearchAndScriptModelTests +{ + [Test] + [Arguments("corvid.lua:(14,22-30): attempt to index a nil value", "corvid.lua", 14)] + [Arguments("! corvid.lua:(14,22-30): attempt to index a nil value (+1 more in the console)", "corvid.lua", 14)] + [Arguments("main.lua:3: unexpected symbol", "main.lua", 3)] + [Arguments("other.lua:(9,1): oops", "corvid.lua", 0)] + [Arguments("package:pack/combat.lua names combat.lua:(2,4)", "package:pack/combat.lua", 2)] + [Arguments("saved 12:00:00 · reloaded · 2 files loaded", "corvid.lua", 0)] + public async Task TheLineAnErrorNamesIsReadForItsOwnFileOnly(string text, string name, int line) + { + await Assert.That(ScriptErrors.LineIn(text, name) ?? 0).IsEqualTo(line); + } + + [Test] + public async Task TheNewestErrorNamingTheFileWins() + { + string[] errors = ["corvid.lua:(3,1): old", "main.lua:(8,1): elsewhere", "corvid.lua:(11,2): newer"]; + + await Assert.That(ScriptErrors.LineIn(errors, "corvid.lua")).IsEqualTo(11); + await Assert.That(ScriptErrors.LineIn(errors, "nothing.lua")).IsNull(); + } + + [Test] + public async Task TheHistoryViewOpensCentredOnItsHit() + { + var top = ScrollbackViewModel.TopFor(1_000, 0, 5_000); + + await Assert.That(1_000 - top).IsEqualTo(ScrollbackViewModel.PageRows / 2).Because("as many lines above the hit as the page allows"); + await Assert.That(ScrollbackViewModel.TopFor(3, 0, 5_000)).IsEqualTo(0).Because("near the oldest line the page starts at it"); + await Assert.That(ScrollbackViewModel.TopFor(4_998, 0, 5_000)).IsEqualTo(5_000 - ScrollbackViewModel.PageRows); + } + + [Test] + public async Task TheLinesEitherSideOfTheHitAreItsContext() + { + var lines = Enumerable.Range(90, ScrollbackViewModel.PageRows).Select(i => new ScrollbackViewLine(i, $"line {i}", -1, 0)).ToArray(); + var model = new ScrollbackViewModel("Corvid", "goblin", 90, 0, 500, 100, lines); + + await Assert.That(model.Role(lines[10])).IsEqualTo(ScrollbackLineRole.Hit); + await Assert.That(model.Role(lines[10 - ScrollbackViewModel.ContextRows])).IsEqualTo(ScrollbackLineRole.Context); + await Assert.That(model.Role(lines[10 + ScrollbackViewModel.ContextRows])).IsEqualTo(ScrollbackLineRole.Context); + await Assert.That(model.Role(lines[10 + ScrollbackViewModel.ContextRows + 1])).IsEqualTo(ScrollbackLineRole.Page); + await Assert.That(model.Role(lines[0])).IsEqualTo(ScrollbackLineRole.Page); + } + + private static SearchModel Found(string query = "goblin", long older = 5_930, bool on = false) => + new(query, false, false, "Corvid", 70, null, [], Older: on) { OlderLines = older, OlderSource = "Corvid" }; + + [Test] + public async Task OlderHistoryIsOfferedOnlyWhileThePaneCapTrimmedWhatWasSearched() + { + await Assert.That(Found().OffersOlder).IsTrue(); + await Assert.That(Found(older: 0).OffersOlder).IsFalse().Because("the panes hold everything: ⌥H has nothing more to find"); + await Assert.That(Found(query: string.Empty).OffersOlder).IsFalse().Because("nothing has been searched yet"); + await Assert.That(Found(on: true).OffersOlder).IsFalse().Because("⌥H is already on"); + } + + [Test] + public async Task TheOfferIsLadderedToTheRoomAndAlwaysNamesTheChord() + { + var model = Found(); + var ladder = model.OlderHintLadder; + + await Assert.That(ladder[0]).IsEqualTo("⌥H searches older history · 5,930 more lines in Corvid"); + await Assert.That(ladder.All(r => r.StartsWith(SearchModel.OlderKey, StringComparison.Ordinal))).IsTrue(); + for (var i = 1; i < ladder.Count; i++) + { + await Assert.That(ladder[i].Length).IsLessThan(ladder[i - 1].Length); + } + + await Assert.That(model.NoteFor(200)).IsEqualTo(ladder[0]); + await Assert.That(model.NoteFor(40)).IsEqualTo("⌥H searches older history"); + await Assert.That(model.NoteFor(5)).IsEqualTo(ladder[^1]).Because("the shortest rung, never nothing"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs b/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs index 4726a9c4..5bdb261d 100644 --- a/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs @@ -24,9 +24,9 @@ public class DeepSearchTests new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); /// A connected Ann whose pane holds the newest 40 lines of 400, with goblins at lines 10 and 395. - private static async Task Live() + private static async Task Live(int paneLines = 40) { - var config = new AppConfiguration { PaneLines = 40 }; + var config = new AppConfiguration { PaneLines = paneLines }; config.Worlds.Add(new WorldDefinition { Name = "Convergence", @@ -59,6 +59,20 @@ public async Task WithoutAltHTheBoundSaysOlderHistoryCanBeSearched() await Assert.That(model.Rows.Count).IsEqualTo(1); await Assert.That(model.Rows[0].IsOlder).IsFalse(); await Assert.That(model.HistoryNote).Contains("⌥H searches older history"); + await Assert.That(model.OffersOlder).IsTrue(); + await Assert.That(model.OlderLines).IsGreaterThan(300).Because("400 lines arrived and the pane keeps about 40"); + } + + [Test] + public async Task NothingIsOfferedWhileThePaneHoldsEveryLine() + { + await using var app = await Live(paneLines: 2_000); + + var model = app.SearchModelFor("goblin", false, false); + + await Assert.That(model.Rows.Count).IsEqualTo(2).Because("both goblins are in the pane"); + await Assert.That(model.OffersOlder).IsFalse(); + await Assert.That(model.HistoryNote).IsNull(); } [Test] diff --git a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs index 8fc7fa39..f17d48e5 100644 --- a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs @@ -39,6 +39,7 @@ internal static readonly (string View, string[] OneRow)[] Footers = ("dictionary-offer", ["⏎ download", "Esc not now"]), ("quit", ["⏎ stay", "Esc stays"]), ("search", ["↑↓ pick", "⌃F closes"]), + ("search", ["⌥H searches older history", "lines held"]), ("history-search", ["type to filter", "⌃R closes"]), ("layouts", ["↑↓ pick", "[⏎] Apply"]), ("welcome", ["↑↓ pick", "Esc closes"]), diff --git a/tests/SharpMUTerm.Tui.Tests/SearchAndScriptWaveTests.cs b/tests/SharpMUTerm.Tui.Tests/SearchAndScriptWaveTests.cs new file mode 100644 index 00000000..34bc24ef --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/SearchAndScriptWaveTests.cs @@ -0,0 +1,123 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Wave 18, read off painted frames: the cell script editor marks the line the reload's error named (the model's +/// ErrorLine, which the window marks too); the history view opens centred on its hit with its context drawn apart; +/// ⌃F offers ⌥H on its status line while the pane cap trimmed what it searched; and F5's short column names the group of +/// the first field it shows after every scroll step. +/// +[NotInParallel] +public class SearchAndScriptWaveTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(int width, int height) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = "Dark"; + config.Theme = ThemeLibrary.Get("Dark"); + return new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); + } + + [Test] + public async Task TheCellEditorMarksTheLineTheReloadsErrorNamed() + { + await using var app = App(120, 32); + var frame = app.RenderSnapshot("script-edit"); + + await Assert.That(app.Composer.Model.Edit!.ErrorLine).IsEqualTo(14); + + var rows = FrameGrid.Decode(frame, 120, 32); + var row = rows.ToList().FindIndex(r => r.Contains("local room = map.current()", StringComparison.Ordinal)); + await Assert.That(row).IsGreaterThan(0).Because(string.Join('\n', rows)); + var column = rows[row].IndexOf("local room", StringComparison.Ordinal); + var backgrounds = FrameGrid.Backgrounds(frame); + var band = FrameGrid.Sgr(ComposeOverlay.ErrorBand(ScreenTheme.Dark)); + await Assert.That(backgrounds[(row, column)]).IsEqualTo(band).Because("line 14 is on the error band"); + + var other = rows.ToList().FindIndex(r => r.Contains("function on_room()", StringComparison.Ordinal)); + await Assert.That(backgrounds[(other, rows[other].IndexOf("function", StringComparison.Ordinal))]).IsNotEqualTo(band) + .Because("and only line 14"); + } + + [Test] + public async Task ASaveThatLoadsCleanlyClearsTheMarkAndAnErrorElsewhereDoesNotSetIt() + { + var edit = new ScriptEdit("corvid.lua", null, false, ErrorLine: 14); + + await Assert.That(edit.Said("saved 12:00:00 · reloaded · 2 files loaded").ErrorLine).IsEqualTo(0); + await Assert.That(edit.Said("! main.lua:(3,1): unexpected symbol").ErrorLine).IsEqualTo(0); + await Assert.That(edit.Said("! corvid.lua:(6,2): unexpected symbol").ErrorLine).IsEqualTo(6); + await Assert.That(edit.Said("! corvid.lua:(6,2): x").Describe().ErrorLine).IsEqualTo(6).Because("both hosts read Describe"); + } + + [Test] + public async Task TheHistoryViewOpensCentredOnItsHitWithItsContextDrawnApart() + { + await using var app = App(120, 32); + var frame = app.RenderSnapshot("search-history"); + var page = app.HistoryViewModel!; + + await Assert.That(page.Marked - page.Top).IsEqualTo(ScrollbackViewModel.PageRows / 2); + var rows = FrameGrid.Decode(frame, 120, 32); + var context = rows.Count(r => r.Contains("│ ", StringComparison.Ordinal) && r.Contains("] ", StringComparison.Ordinal)); + await Assert.That(context).IsGreaterThanOrEqualTo(2 * ScrollbackViewModel.ContextRows).Because(string.Join('\n', rows)); + await Assert.That(rows.Any(r => r.Contains("▸ ", StringComparison.Ordinal) && r.Contains("goblin", StringComparison.Ordinal))).IsTrue(); + } + + [Test] + [Arguments(80, 24)] + [Arguments(120, 32)] + public async Task CtrlFOffersOlderHistoryOnItsStatusLineWhileThePaneCapTrimmedIt(int width, int height) + { + await using var app = App(width, height); + var rows = FrameGrid.Decode(app.RenderSnapshot("search"), width, height); + + var status = rows.FirstOrDefault(r => r.Contains("lines held", StringComparison.Ordinal)); + await Assert.That(status).IsNotNull().Because(string.Join('\n', rows)); + await Assert.That(status!).Contains("⌥H").And.Contains("older history"); + await Assert.That(status!.Contains('…')).IsFalse().Because("a rung is chosen whole, never cut"); + } + + [Test] + public async Task F5sShortColumnNamesTheFirstShownFieldsGroupAfterEveryScrollStep() + { + await using var app = App(80, 24); + app.RenderSnapshot("worlds"); + app.SimulateSettingsKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + var groups = BuiltInSettings.World.Fields.Where(f => f.Group is not null) + .ToDictionary(f => f.Label, f => f.Group!.ToUpperInvariant(), StringComparer.Ordinal); + var steps = 0; + var scrolled = 0; + for (var step = 0; step < 22; step++) + { + var rows = FrameGrid.Decode(app.RenderWholeFrame(), 80, 24); + var top = rows.ToList().FindIndex(r => r.Contains("├ WORLD", StringComparison.Ordinal) || r.Contains("⌃ ", StringComparison.Ordinal)); + if (top >= 0 && top + 1 < rows.Count) + { + var right = rows[top + 1][32..]; + var label = right.Trim().Split(" ")[0]; + var group = label is "security" || right.TrimStart().StartsWith('[') ? "CONNECTION" : groups.GetValueOrDefault(label); + if (group is not null && !rows[top].Contains("▾", StringComparison.Ordinal)) + { + steps++; + scrolled += rows[top].Contains("⌃ ", StringComparison.Ordinal) ? 1 : 0; + await Assert.That(rows[top]).Contains($"· {group}").Because($"step {step}: first shown '{label}'\n{string.Join('\n', rows)}"); + } + } + + app.SimulateSettingsKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false)); + } + + await Assert.That(steps).IsGreaterThan(15); + await Assert.That(scrolled).IsGreaterThan(10).Because("the walk scrolled the column"); + } +} From 38b0f9f7375bde49f1f70e91d96dfed196ea46ab Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 16:20:47 +0000 Subject: [PATCH 059/113] feat(welcome): Browse worlds lists mu*index; a pick fills in the connect form The welcome's Browse row, Ctrl+P > Browse worlds... and /browse [words] open a list of worlds from the mu*index directory (WorldDirectory, Core: https only, size-capped while streaming, 15 s, 200 rows, server text bounded and stripped). One Client model (WorldBrowseModel) is drawn as a cell overlay and as a native modal. A pick asks the directory for the world's address and opens the welcome's connect form filled in; nothing is saved or dialled until its Enter, which goes through ConnectFromWelcome/ConnectCommand. The fetch is caller-supplied and null by default; the demo answers from memory. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 25 +- src/SharpMUTerm.Avalonia/ModalOverlay.cs | 1 + src/SharpMUTerm.Avalonia/WelcomeView.cs | 2 +- src/SharpMUTerm.Avalonia/WorldBrowseView.cs | 320 +++++++++++++ .../Commands/BuiltInCommands.cs | 4 + src/SharpMUTerm.Client/Help/SlashCommands.cs | 2 + src/SharpMUTerm.Client/Modals/WelcomeModel.cs | 18 +- .../Modals/WorldBrowseModel.cs | 213 +++++++++ .../Surfaces/SurfaceCatalog.cs | 17 +- .../Configuration/AppConfiguration.cs | 9 + .../WorldIndex/WorldDirectory.cs | 363 ++++++++++++++ src/SharpMUTerm.Tui/DemoWorldDirectory.cs | 58 +++ .../Pointer/SharpMUTermApp.Surfaces.cs | 1 + src/SharpMUTerm.Tui/Program.cs | 3 +- .../SharpMUTermApp.NativeModals.cs | 1 + src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs | 23 +- .../SharpMUTermApp.WorldBrowse.cs | 447 ++++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 38 +- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/WelcomeSurface.cs | 42 +- src/SharpMUTerm.Tui/WorldBrowseSurface.cs | 209 ++++++++ .../SurfaceParityTests.cs | 24 + .../WorldBrowseModelTests.cs | 104 ++++ .../WorldIndex/WorldDirectoryTests.cs | 155 ++++++ tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs | 3 + tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs | 6 +- .../SharpMUTerm.Tui.Tests/WorldBrowseTests.cs | 250 ++++++++++ 28 files changed, 2312 insertions(+), 33 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/WorldBrowseView.cs create mode 100644 src/SharpMUTerm.Client/Modals/WorldBrowseModel.cs create mode 100644 src/SharpMUTerm.Core/WorldIndex/WorldDirectory.cs create mode 100644 src/SharpMUTerm.Tui/DemoWorldDirectory.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs create mode 100644 src/SharpMUTerm.Tui/WorldBrowseSurface.cs create mode 100644 tests/SharpMUTerm.Client.Tests/WorldBrowseModelTests.cs create mode 100644 tests/SharpMUTerm.Core.Tests/WorldIndex/WorldDirectoryTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/WorldBrowseTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index d854af60..90d41b14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Browse worlds: the welcome's Browse row, ⌃P ▸ Browse worlds… and `/browse [words]` list worlds from the mu*index + directory, most played first, searchable and sortable by name. Picking one fills in the connect form with its host, + port and TLS; nothing is saved or dialled until you press ⏎ there. The directory is asked only when you open the list. + With `--plain`, `/browse` reads the list out and `/browse 3` tells you the `/connect` line for world 3. + - Scripts can be edited without leaving the client. ⌃P ▸ Edit script… (or ⌃E in the script console, or `/script edit`) lists your character's script files; one opens in the composer with line numbers, exactly as written. ⌃S saves it, reloads that character's scripts and shows the first error with its file and line. ⌃P ▸ New script… (or diff --git a/CLAUDE.md b/CLAUDE.md index fe8c717e..63d1ee54 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -742,8 +742,8 @@ fallbacks) for inline images/maps. - **A client with no worlds opens on a welcome, and the first connect of a new configuration leaves a key tour** (`WelcomeSurface`, `SharpMUTermApp.Welcome.cs`; `/welcome`, ⌃P ▸ *Welcome* / *Key tour*). The welcome is a `ListOverlay` over a pure model (the `QuitPrompt` split): *Connect to a host* (a form: host, port 4000, TLS, an - optional character, a password reminder), *Browse games* (`BrowsePackages`, so the index is still fetched only - when asked; with no https `PackageIndexUrl` it says so on the row instead), *Open settings* (F5), the + optional character, a password reminder), *Browse worlds* (mu*index, below; with no https + `WorldDirectoryUrl` it says so on the row instead), *Open settings* (F5), the `/connect` example, and a starting layout. Decisions not to relitigate: - **Its words live on `WelcomeModel`** (headings, intro, field labels, key rows), so both hosts say the same thing; the client calls a game a *world* on every surface of it. @@ -765,6 +765,24 @@ fallbacks) for inline images/maps. run. The row is chrome (`AppendWindowLine`), found again by its markup, and hidden or shown by ⌃P ▸ *Key tour* — not by a link, because the panes' link handler is scheme-tagged server text and a client action there would be a new trust path. +- **Browse worlds lists mu*index, and a pick only fills in the welcome's connect form** (`WorldDirectory`, Core + `WorldIndex/`; `WorldBrowseModel`/`WorldBrowseSession`, Client; `WorldBrowseSurface`, `SharpMUTermApp.WorldBrowse.cs`, + `DemoWorldDirectory`, Tui; `WorldBrowseView`, Avalonia; the welcome's Browse row, ⌃P ▸ *Browse worlds…*, `/browse + [words]`, `/browse N`; surface `browse-worlds`; the `browse-worlds`, `-failed` and `-picked` views). Decisions: + - **Asked only when opened**, through `worldFetch:` (the `save:` family: null in tests and snapshots, which say they asked + nothing; `Program` passes `WorldDirectory.DownloadAsync`; the demo answers from `DemoWorldDirectory`, made-up worlds on + `.example` hosts). https only (`AppConfiguration.WorldDirectoryUrl`, default `https://mu-index.com/api`), 2 MiB capped + while streaming, 15 s, 200 rows; an answer from a stale request (newer question, or closed) is dropped by generation. + - **The answer is server text**: names, taglines and codebases are bounded and stripped of control, format (bidi), + private-use and unassigned characters (`WorldDirectory.Clean`); a row with no id or name, archived, or repeated is + dropped and counted; a player count is shown only when the directory says `measured`, or `declared` marked `~`. + - **A pick asks `GET /games/{id}` for the address**: `telnet` or `tls`, `active` before `stale`, never `gone`, newest + `lastSeenAt`, and only what `ConnectEndpoint.Parse` takes. Then Browse closes and the welcome's form opens prefilled + (`WelcomeSurface.Prefill`, `WelcomeModel.WorldName`); nothing is saved or dialled until its ⏎, which goes through + `ConnectFromWelcome` → `ConnectCommand` and names the world as listed (dropped if the host is edited). + - ⏎ on a search none of the held rows match asks the directory (`AsksDirectory`). Every listing shows the CC BY 4.0 + credit (`AttributionLine`). `--plain` says the rows as numbered lines and `/browse N` says the `/connect` line. + - *Browse packages* is unchanged; the welcome no longer leads there. The live API has not been exercised from here. - **The URLs a world prints as plain text are marked up by this client, because the terminal's own detection cannot survive a pane** (`UrlDetector`, Core; F7 ▸ `detect links in output`, default on). Kitty, WezTerm and Ghostty all find URLs in the cells they paint — across the terminal **row**. A pane @@ -1764,7 +1782,8 @@ python3 tools/ansi_frame_to_image.py frame.ansi frame.html # or .svg its connect form filled in by real keys), `tour` (the key tour row at the end of the demo's main window), `reconnect` (Corvid dropped, the second try counting down on the status row), `help`/`help-topic` (in-app help's list, and its *Reading output* page), `dictionary-offer` (the spelling dictionary - offer, in a run that keeps no folder) and `join-wraps`/`join-wraps-f5` (a ragged world suggested on ⌃P, and + offer, in a run that keeps no folder), `browse-worlds`/`browse-worlds-failed`/`browse-worlds-picked` (Browse worlds over + the demo's directory, one whose directory does not answer, and the connect form a pick leaves) and `join-wraps`/`join-wraps-f5` (a ragged world suggested on ⌃P, and recommended on F5 — the row is under `14 more` below about 50 rows), plus the default workspace (no `--view`). Any settings screen also takes a `-edit` suffix, which opens it and drives real diff --git a/src/SharpMUTerm.Avalonia/ModalOverlay.cs b/src/SharpMUTerm.Avalonia/ModalOverlay.cs index d00eb612..7bbbd0fa 100644 --- a/src/SharpMUTerm.Avalonia/ModalOverlay.cs +++ b/src/SharpMUTerm.Avalonia/ModalOverlay.cs @@ -47,6 +47,7 @@ public ModalOverlay(ModalSession session, Action remove, Action new WelcomeView(welcome, Colours, Done), HelpSession help => new HelpView(help, Colours, Done), DictionaryOfferSession offer => new DictionaryOfferView(offer, Colours, Done), + WorldBrowseSession browse => new WorldBrowseView(browse, Colours, Done), ImportReviewSession import => new ImportReviewView(import, Colours, Done), ScriptConsoleSession console => new ScriptConsoleView(console, Colours, Done), ScrollbackViewSession history => new ScrollbackView(history, Colours, Done), diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index ca321d6b..b67398ab 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -207,7 +207,7 @@ private void DrawMenu() private void DrawForm() { _heading.Text = WelcomeModel.FormHeading; - _body.Children.Add(ModalParts.Dim(WelcomeModel.FormIntro, _colours, new Thickness(22, 0, 22, 10))); + _body.Children.Add(ModalParts.Dim(NativeKeys.Words(_model.FormIntroLine), _colours, new Thickness(22, 0, 22, 10))); var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), diff --git a/src/SharpMUTerm.Avalonia/WorldBrowseView.cs b/src/SharpMUTerm.Avalonia/WorldBrowseView.cs new file mode 100644 index 00000000..a36fe40f --- /dev/null +++ b/src/SharpMUTerm.Avalonia/WorldBrowseView.cs @@ -0,0 +1,320 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Threading; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.WorldIndex; + +namespace SharpMUTerm.Avalonia; + +/// +/// The window's Browse worlds: a search box, mu*index's rows for what is typed in the order chosen, the credit the +/// directory's licence asks for, and the keys. The rows are , the function the cell +/// surface lists, so both hosts list the same rows. Enter on a row hands the pick to the client, which asks where the +/// world is and opens the connect form in this modal's place; Enter on a search the rows cannot answer asks the +/// directory. Every word is the window's (). +/// +internal sealed class WorldBrowseView : DockPanel, IModalView +{ + private readonly WorldBrowseSession _session; + private readonly NativeTokens _colours; + private readonly Action _done; + private readonly TextBox _box; + private readonly TextBlock _count; + private readonly Button _sort; + private readonly TextBlock _note; + private readonly StackPanel _list; + private readonly List _rows = []; + private WorldBrowseModel _model; + private IReadOnlyList _view = []; + private WorldDirectorySort _order = WorldDirectorySort.Players; + private int _selected; + private string _query; + + public WorldBrowseView(WorldBrowseSession session, NativeTokens colours, Action done) + { + _session = session; + _colours = colours; + _done = done; + _model = session.Model; + + var heading = ModalParts.Heading(WorldBrowseModel.Heading, colours); + SetDock(heading, Dock.Top); + Children.Add(heading); + + var credit = ModalParts.Dim(WorldBrowseModel.AttributionLine, colours); + SetDock(credit, Dock.Top); + Children.Add(credit); + + _box = ModalParts.SearchBox(WorldBrowseModel.SearchPlaceholder, "Search worlds"); + SetDock(_box, Dock.Top); + Children.Add(_box); + + var bar = new DockPanel { Margin = new Thickness(20, 0, 14, 4) }; + _sort = ModalParts.Button(SortLabel(), "Tab", colours, ToggleSort); + SetDock(_sort, Dock.Right); + bar.Children.Add(_sort); + _count = ModalParts.Dim(string.Empty, colours, new Thickness(0)); + _count.VerticalAlignment = VerticalAlignment.Center; + bar.Children.Add(_count); + SetDock(bar, Dock.Top); + Children.Add(bar); + + var footer = ModalParts.Footer(string.Join(" · ", WorldBrowseModel.Keys.Select(k => $"{k.Key} {k.Label}")), colours); + SetDock(footer, Dock.Bottom); + Children.Add(footer); + + _note = ModalParts.Dim(string.Empty, colours, new Thickness(20, 6, 20, 0)); + SetDock(_note, Dock.Bottom); + Children.Add(_note); + + var (frame, list, _) = ModalParts.List(colours); + _list = list; + frame.MinHeight = 220; + Children.Add(frame); + + _box.Text = session.InitialQuery; + _box.CaretIndex = session.InitialQuery.Length; + _query = session.InitialQuery; + _box.TextChanged += (_, _) => + { + var query = _box.Text ?? string.Empty; + if (query == _query) + { + return; + } + + _query = query; + _selected = 0; + ShowList(); + }; + AddHandler(KeyDownEvent, OnKey, RoutingStrategies.Tunnel); + _session.Changed += OnChanged; + ShowList(); + } + + public string Title => WorldBrowseModel.Heading; + + public double PreferredWidth => 820; + + public bool Centred => false; + + /// The rows listed now, for a test. + public IReadOnlyList Rows => _view; + + /// The row Enter acts on. + public int Selected => _selected; + + /// The order the rows are in, for a test. + public WorldDirectorySort Order => _order; + + /// The search box, for a test. + public TextBox Box => _box; + + /// What the list says under it now, for a test. + public string Note => _note.Text ?? string.Empty; + + public void FocusFirst() => _box.Focus(); + + public void Detach() => _session.Changed -= OnChanged; + + /// Enter on listed row , or on a search the rows cannot answer. + public void Choose(int row) + { + if (_model.AsksDirectory(_query)) + { + _session.Ask(_query); + return; + } + + if (row < 0 || row >= _view.Count || _model.Opening is not null) + { + return; + } + + for (var i = 0; i < _model.Rows.Count; i++) + { + if (ReferenceEquals(_model.Rows[i], _view[row])) + { + _session.Pick(i); + return; + } + } + } + + /// Tab, and the order button: by players or by name. + public void ToggleSort() + { + _order = WorldBrowseModel.Next(_order); + _sort.Content = SortLabel(); + _selected = 0; + ShowList(); + } + + private string SortLabel() + { + var name = WorldBrowseModel.SortName(_order); + return char.ToUpperInvariant(name[0]) + name[1..]; + } + + private void OnChanged(WorldBrowseModel model) => Dispatcher.UIThread.Post(() => + { + var rowsChanged = !ReferenceEquals(model.Rows, _model.Rows); + _model = model; + if (rowsChanged) + { + _selected = 0; + } + + ShowList(); + }); + + private void ShowList() + { + _view = _model.View(_query, _order); + _count.Text = _model.CountLine(_query); + _note.Text = NativeKeys.Words( + _model.Opening is not null ? _model.OpeningLine + : _model.State == WorldBrowseState.Ready && _model.Problem is { } problem ? problem + : _model.State == WorldBrowseState.Ready && _view.Count > 0 + ? (_model.AnyDeclared ? WorldBrowseModel.DeclaredNote + " · " : string.Empty) + WorldBrowseModel.PickNote + : string.Empty); + _note.Foreground = _colours.Brush(_model.State == WorldBrowseState.Ready && _model.Problem is not null && _model.Opening is null + ? _colours.Warn + : _colours.Dim); + _list.Children.Clear(); + _rows.Clear(); + _selected = _view.Count == 0 ? 0 : Math.Clamp(_selected, 0, _view.Count - 1); + if (_model.Empty(_query) is { } empty) + { + _list.Children.Add(new TextBlock + { + Text = NativeKeys.Words(empty), + Foreground = _colours.Brush(_model.State is WorldBrowseState.Failed or WorldBrowseState.Unavailable ? _colours.Warn : _colours.Dim), + FontSize = NativeTokens.Body, + Margin = new Thickness(12, 10), + TextWrapping = TextWrapping.Wrap, + }); + return; + } + + for (var i = 0; i < _view.Count; i++) + { + var world = _view[i]; + var index = i; + var line = new DockPanel(); + var players = new TextBlock + { + Text = WorldBrowseModel.Players(world), + Foreground = _colours.Brush(_colours.Accent), + FontSize = NativeTokens.Title, + FontWeight = FontWeight.SemiBold, + Width = 48, + TextAlignment = TextAlignment.Right, + Margin = new Thickness(0, 0, 14, 0), + VerticalAlignment = VerticalAlignment.Center, + }; + SetDock(players, Dock.Left); + line.Children.Add(players); + + var title = new TextBlock + { + Text = world.Name, + Foreground = _colours.Brush(_colours.Text), + FontSize = NativeTokens.Title, + Width = 220, + Margin = new Thickness(0, 0, 12, 0), + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }; + SetDock(title, Dock.Left); + line.Children.Add(title); + + var codebase = new TextBlock + { + Text = world.Codebase, + Foreground = _colours.Brush(_colours.Dim), + FontSize = NativeTokens.Small, + Width = 96, + Margin = new Thickness(0, 0, 12, 0), + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }; + SetDock(codebase, Dock.Left); + line.Children.Add(codebase); + + line.Children.Add(new TextBlock + { + Text = world.Tagline, + Foreground = _colours.Brush(_colours.Dim), + FontSize = NativeTokens.Body, + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }); + var row = ModalParts.Row(line, world.Name, () => Select(index), () => Choose(index)); + ToolTip.SetTip(row, world.Tagline.Length == 0 ? world.Name : $"{world.Name} — {world.Tagline}"); + _rows.Add(row); + _list.Children.Add(row); + } + + Highlight(); + } + + private void Select(int index) + { + if (index != _selected) + { + _selected = index; + Highlight(); + } + } + + private void Highlight() + { + for (var i = 0; i < _rows.Count; i++) + { + _rows[i].Background = i == _selected ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + } + + if (_selected < _rows.Count) + { + _rows[_selected].BringIntoView(); + } + } + + private void OnKey(object? sender, KeyEventArgs e) + { + if (e.KeyModifiers != KeyModifiers.None) + { + return; + } + + switch (e.Key) + { + case Key.Escape: + e.Handled = true; + _session.Dismiss(); + _done(); + return; + case Key.Up: + e.Handled = true; + Select(ModalParts.Step(_selected, -1, _view.Count)); + return; + case Key.Down: + e.Handled = true; + Select(ModalParts.Step(_selected, 1, _view.Count)); + return; + case Key.Tab: + e.Handled = true; + ToggleSort(); + return; + case Key.Enter: + e.Handled = true; + Choose(_selected); + return; + } + } +} diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index b4e67bdf..5c4aa3fa 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -23,6 +23,9 @@ public static class BuiltInCommands /// The first-run welcome: connect to a world, browse worlds, pick a layout. public const string WelcomeCommand = "term:welcome"; + /// Browse worlds: mu*index's listing, a pick filling in the connect form (/browse). + public const string BrowseWorldsCommand = "term:browse-worlds"; + /// Import from another client: a file picker in a host that has one, else /import on the command line. public const string ImportCommand = "term:import"; @@ -270,6 +273,7 @@ void Family(string id, string prefix, Func [port] [tls]", "Add a world for a host and connect to it (port 4000 by default)", "/connect "), new("/welcome", "/welcome", "Show the first-run welcome again", "/welcome"), new("/welcome", "/welcome layout roleplay|combat|suggested", "Choose the starting layout the welcome offers", "/welcome layout "), + new("/browse", "/browse [words]", "Browse worlds listed on mu*index, searched for the words; a pick fills in the connect form", "/browse "), + new("/browse", "/browse ", "Where world n of the list /browse said is (with no screen to read, the /connect line to type)", "/browse "), new("/import", "/import ", "Import worlds, characters and automation from MUSHclient, Mudlet or TinTin++; nothing is written before Enter", "/import "), new("/package", "/package", "Open the Packages screen (F10)", "/package"), new("/package", "/package browse", "Browse the package index, this game's packages first", "/package browse"), diff --git a/src/SharpMUTerm.Client/Modals/WelcomeModel.cs b/src/SharpMUTerm.Client/Modals/WelcomeModel.cs index 5b2a1003..52c53bb8 100644 --- a/src/SharpMUTerm.Client/Modals/WelcomeModel.cs +++ b/src/SharpMUTerm.Client/Modals/WelcomeModel.cs @@ -6,7 +6,7 @@ public enum WelcomeChoice /// The small form: host, port, TLS, a character name. Connect, - /// The package index browser, fetched only now. + /// The world directory (mu*index), fetched only now. Browse, /// F5, to add a world by hand. @@ -40,7 +40,8 @@ public enum WelcomeField /// /// The first-run welcome's model: the menu or the connect form, with everything either says. Drawn by the cell -/// surface (WelcomeSurface.Render) and by the window's native one. +/// surface (WelcomeSurface.Render) and by the window's native one. IndexProblem is why Browse worlds cannot +/// ask the world directory (null when it can); WorldName is the world Browse worlds filled the form in for. /// public sealed record WelcomeModel( bool InForm, @@ -53,7 +54,8 @@ public sealed record WelcomeModel( string Character, bool PasswordLater, string? Problem, - string? IndexProblem) + string? IndexProblem, + string? WorldName = null) { /// The example the surface names, a host nobody owns (RFC 2606). public const string ExampleCommand = "/connect mud.example.org 4201 tls"; @@ -85,6 +87,14 @@ public sealed record WelcomeModel( /// The line under the form's heading. public const string FormIntro = "Saved as a world, so you can come back to it."; + /// + /// The line under the form's heading: , or, when Browse worlds filled the form in, which world + /// it is and that the address came from the directory. + /// + public string FormIntroLine => WorldName is null + ? FormIntro + : $"{WorldName}, as listed on mu*index. Check it and press ⏎ to save and connect."; + /// The TLS row's words when on; the window's check box carries these words. public const string TlsOn = "On, encrypted"; @@ -123,7 +133,7 @@ public sealed record WelcomeModel( public (string Title, string Detail) Describe(WelcomeChoice choice) => choice switch { WelcomeChoice.Connect => ("Connect to a world", "Type a host and port"), - WelcomeChoice.Browse => ("Browse worlds", IndexProblem is null ? "From the package index" : "No package index set"), + WelcomeChoice.Browse => ("Browse worlds", IndexProblem is null ? "From the mu*index directory" : "No world directory set"), WelcomeChoice.Import => ("Import", "From MUSHclient, Mudlet or TinTin++"), _ => ("Open settings", "F5, add a world by hand"), }; diff --git a/src/SharpMUTerm.Client/Modals/WorldBrowseModel.cs b/src/SharpMUTerm.Client/Modals/WorldBrowseModel.cs new file mode 100644 index 00000000..a99b96dd --- /dev/null +++ b/src/SharpMUTerm.Client/Modals/WorldBrowseModel.cs @@ -0,0 +1,213 @@ +using System.Globalization; +using SharpMUTerm.Core.WorldIndex; + +namespace SharpMUTerm.Client.Modals; + +/// Where Browse worlds is: asking the directory, listing what it said, failed, or not able to ask at all. +public enum WorldBrowseState +{ + /// The list is being fetched. + Loading, + + /// The rows are in. + Ready, + + /// The directory did not answer, or answered with something the client cannot read. + Failed, + + /// This run asks nothing (no fetch, or no https directory set), and says why. + Unavailable, +} + +/// +/// Browse worlds: the rows mu*index listed (), and what the surface says about them. Drawn by +/// the cell surface (WorldBrowseSurface.Render) and by the window's native one; both list for +/// what the player typed and the order chosen, so a query lists the same rows in both. What is typed, the order and the +/// row selected are each host's own; the model is what the client knows. +/// +/// Where the list is. +/// Every row the directory sent, in its order (most played first). +/// How many worlds the directory holds for the question asked. +/// The words the directory was last asked to search for, or empty for its most played. +/// Why the list failed or cannot be asked, or why the last pick did not open; null when nothing. +/// The world whose address is being asked for after a pick, or null. +public sealed record WorldBrowseModel( + WorldBrowseState State, + IReadOnlyList Rows, + int Total, + string AskedFor, + string? Problem, + string? Opening) +{ + // The surface's words, said once here so both hosts say them alike. + + /// The surface's title. + public const string Heading = "Browse worlds"; + + /// The credit the directory's licence asks for, on every listing. + public static string AttributionLine => + $"Listing from {WorldDirectory.Name} · data {WorldDirectory.Licence}, {WorldDirectory.Attribution}"; + + /// What the list says while it is fetched. + public const string LoadingLine = "Asking mu*index for worlds…"; + + /// What the list says when a pick is waiting on its address. + public string OpeningLine => $"Asking mu*index where {Opening} is…"; + + /// The search box's placeholder. + public const string SearchPlaceholder = "Type to narrow by name, codebase or tagline"; + + /// What a pick leads to, said under the list. + public const string PickNote = "⏎ fills in the connect form; nothing is saved or dialled until you press ⏎ there."; + + /// What a count the game reports about itself is marked with. + public const string DeclaredMark = "~"; + + /// What the mark means, said only while a row carries it. + public const string DeclaredNote = "~ a count the game reports about itself"; + + /// The keys that act, in glyphs: the cells ladder them, the window spells them in words. + public static IReadOnlyList<(string Key, string Label)> Keys { get; } = + [ + ("↑↓", "pick"), + ("⇥", "sort"), + ("⏎", "connect form"), + ("Esc", "closes"), + ]; + + /// A sort's name as both hosts say it. + public static string SortName(WorldDirectorySort sort) => sort == WorldDirectorySort.Name ? "by name" : "by players"; + + /// The other sort: what ⇥ and the window's toggle switch to. + public static WorldDirectorySort Next(WorldDirectorySort sort) => + sort == WorldDirectorySort.Players ? WorldDirectorySort.Name : WorldDirectorySort.Players; + + /// A row's player count as both hosts write it: 12, ~12 for a declared one, – for none. + public static string Players(WorldListing row) + { + ArgumentNullException.ThrowIfNull(row); + return row.Players is not { } count ? "–" + : (row.Count == WorldPlayerCount.Declared ? DeclaredMark : string.Empty) + count.ToString(CultureInfo.InvariantCulture); + } + + /// + /// The rows for in 's order: each word of the query somewhere in a + /// row's name, codebase or tagline. By players keeps the directory's order (its uncounted worlds follow as it put + /// them); by name is alphabetical. + /// + public IReadOnlyList View(string? query, WorldDirectorySort sort) + { + var words = (query ?? string.Empty).Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + IEnumerable rows = Rows; + if (words.Length > 0) + { + rows = rows.Where(r => words.All(w => + r.Name.Contains(w, StringComparison.OrdinalIgnoreCase) + || r.Codebase.Contains(w, StringComparison.OrdinalIgnoreCase) + || r.Tagline.Contains(w, StringComparison.OrdinalIgnoreCase))); + } + + if (sort == WorldDirectorySort.Name) + { + rows = rows.OrderBy(r => r.Name, StringComparer.OrdinalIgnoreCase); + } + + return rows.ToArray(); + } + + /// + /// Whether ⏎ on asks the directory itself: nothing among the rows held matches, and the + /// directory holds more than it sent, or was last asked something else. + /// + public bool AsksDirectory(string? query) + { + var words = (query ?? string.Empty).Trim(); + return State == WorldBrowseState.Ready && words.Length > 0 && View(words, WorldDirectorySort.Players).Count == 0 + && (Total > Rows.Count || !string.Equals(words, AskedFor, StringComparison.OrdinalIgnoreCase)); + } + + /// What the list says in place of rows, or null when it has rows to show for . + public string? Empty(string? query) => State switch + { + WorldBrowseState.Loading => LoadingLine, + WorldBrowseState.Failed => $"mu*index did not answer: {Problem}", + WorldBrowseState.Unavailable => Problem, + _ when Rows.Count == 0 => AskedFor.Length > 0 ? $"mu*index lists no world for “{AskedFor}”" : "mu*index lists no worlds right now", + _ when View(query, WorldDirectorySort.Players).Count == 0 => AsksDirectory(query) + ? $"none of the {Rows.Count} listed match — ⏎ asks mu*index for “{query!.Trim()}”" + : "nothing listed matches — ⌫ widens the search", + _ => null, + }; + + /// The count line: how many rows are listed, of how many the directory holds. + public string CountLine(string? query) + { + if (State != WorldBrowseState.Ready) + { + return string.Empty; + } + + var shown = View(query, WorldDirectorySort.Players).Count; + var of = Total > Rows.Count ? $"{Rows.Count} of {Total}" : Rows.Count.ToString(CultureInfo.InvariantCulture); + return shown == Rows.Count ? $"{of} worlds" : $"{shown} of {of}"; + } + + /// Whether any row carries a count the game reports about itself, so is said. + public bool AnyDeclared => Rows.Any(r => r.Count == WorldPlayerCount.Declared); + + public bool Equals(WorldBrowseModel? other) => + other is not null && State == other.State && Total == other.Total && AskedFor == other.AskedFor + && Problem == other.Problem && Opening == other.Opening && ModelLists.Same(Rows, other.Rows); + + public override int GetHashCode() => HashCode.Combine(State, Total, AskedFor, Problem, Opening, ModelLists.Hash(Rows)); +} + +/// +/// One opening of Browse worlds in a host's own controls. The host filters and sorts the model's rows itself +/// (); a pick and a search the rows held cannot answer come back through here to the +/// methods the cell surface's ⏎ ends in. A pick does not close the surface: the client asks where the world is, and +/// closes it once the connect form opens in its place. +/// +public sealed class WorldBrowseSession : ModalSession +{ + private readonly Action _pick; + private readonly Action _ask; + + /// What the surface lists now. + /// Whether the client's theme is a dark one. + /// Picks row N of . + /// Asks the directory to search for the words. + /// Told the surface closed. + public WorldBrowseSession(WorldBrowseModel model, bool isDark, Action pick, Action ask, Action closed) + : base(model, isDark, closed) + { + ArgumentNullException.ThrowIfNull(pick); + ArgumentNullException.ThrowIfNull(ask); + _pick = pick; + _ask = ask; + } + + public override string Surface => "browse-worlds"; + + /// What the search box opens with typed in (/browse words). + public string InitialQuery { get; init; } = string.Empty; + + /// The host's: ⏎ on row of . + public void Pick(int index) + { + if (!IsEnded && index >= 0 && index < Model.Rows.Count) + { + _pick(index); + } + } + + /// The host's: ⏎ on a query the rows held do not answer (). + public void Ask(string query) + { + ArgumentNullException.ThrowIfNull(query); + if (!IsEnded && Model.AsksDirectory(query)) + { + _ask(query.Trim()); + } + } +} diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index e176ea8d..befdef82 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -189,6 +189,9 @@ public static class SurfaceCatalog /// The spelling dictionary offer: the consent step before anything is downloaded. public const string Dictionary = "dictionary"; + /// Browse worlds: mu*index's listing, a pick filling in the welcome's connect form. + public const string BrowseWorlds = "browse-worlds"; + /// The review of an import from another client: the consent step before anything is written. public const string Import = "import"; @@ -224,7 +227,7 @@ public static class SurfaceCatalog private static string[] PanelViews(string view) => ["SharpMUTerm.Avalonia." + view, "SharpMUTerm.Avalonia.PopOutButton"]; /// The modals the window draws with its own controls in place of the cell modal (ClientHost.NativeModals). - public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary, Import, ScriptConsole, HistoryView]; + public static IReadOnlyList Modals { get; } = [Quit, Search, History, Layouts, Welcome, Help, Dictionary, BrowseWorlds, Import, ScriptConsole, HistoryView]; /// A cell modal in a terminal; the window's own modal in its place. private static readonly IReadOnlyDictionary NativeModal = new Dictionary @@ -511,6 +514,18 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), NativeModal, "SharpMUTerm.Tui.DictionaryOffer.Render", ModalViews("DictionaryOfferView")), + new( + BrowseWorlds, + typeof(WorldBrowseModel), + [ + // A pick asks the directory where the world is, then opens the welcome's connect form filled in: nothing is + // saved or dialled before the player's own Enter there. A query the rows held cannot answer is asked of it. + new(SurfaceActionKind.Modal, "pick", "PickWorld"), + new(SurfaceActionKind.Modal, "ask", "AskWorldDirectory"), + ], + NativeModal, + "SharpMUTerm.Tui.WorldBrowseSurface.Render", + ModalViews("WorldBrowseView")), new( Import, typeof(ImportReviewModel), diff --git a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs index b3d2b318..f9896771 100644 --- a/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs +++ b/src/SharpMUTerm.Core/Configuration/AppConfiguration.cs @@ -139,6 +139,15 @@ public sealed class AppConfiguration /// The project's own index, until a player names another. public const string DefaultPackageIndexUrl = "https://raw.githubusercontent.com/SharpMUSH/sharpmuterm-packages/main/index.json"; + /// + /// The world directory Browse worlds reads: the https base of a mu*index API (/games and /games/{id} + /// under it). Asked only when the player opens Browse, never at start. + /// + public string WorldDirectoryUrl { get; set; } = DefaultWorldDirectoryUrl; + + /// mu*index, the maintainer's own MU* directory. + public const string DefaultWorldDirectoryUrl = "https://mu-index.com/api"; + /// /// The last workspace layout (panes, windows, focus) so the app can resume where it left off. /// Null on a fresh config; the shell rebuilds a live workspace from it at startup via diff --git a/src/SharpMUTerm.Core/WorldIndex/WorldDirectory.cs b/src/SharpMUTerm.Core/WorldIndex/WorldDirectory.cs new file mode 100644 index 00000000..37d1ccda --- /dev/null +++ b/src/SharpMUTerm.Core/WorldIndex/WorldDirectory.cs @@ -0,0 +1,363 @@ +using System.Globalization; +using System.Text; +using System.Text.Json; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Core.WorldIndex; + +/// How Browse worlds orders the directory's rows. +public enum WorldDirectorySort +{ + /// Most players counted now first, the directory's own default; games it could not count follow. + Players, + + /// Alphabetical: the one order that ranks nobody. + Name, +} + +/// How a row's player count was obtained, as the directory labels it. +public enum WorldPlayerCount +{ + /// No count, or none the directory could say it measured. + Unknown, + + /// Counted by the directory's own probe (a WHO, a connect screen). + Measured, + + /// A number the game reports about itself (MSSP PLAYERS). + Declared, +} + +/// One world as the directory lists it, every text already bounded and stripped of control characters. +/// The directory's durable key, for asking where the world is. +/// Its name. +/// Its one-line description, or empty. +/// The server software family (PennMUSH), or empty when unknown. +/// Players counted now, or null. +/// How was obtained. +public sealed record WorldListing(Guid Id, string Name, string Tagline, string Codebase, int? Players, WorldPlayerCount Count); + +/// A page of the directory: the rows read, how many the directory holds for the question, and how many rows it sent that were not read. +public sealed record WorldListPage(IReadOnlyList Rows, int Total, int Dropped) +{ + public bool Equals(WorldListPage? other) => + other is not null && Total == other.Total && Dropped == other.Dropped && Rows.SequenceEqual(other.Rows); + + public override int GetHashCode() => HashCode.Combine(Total, Dropped, Rows.Count); +} + +/// Where a world is: one telnet address the directory has seen it answer at, checked as /connect checks one. +public sealed record WorldAddress(string Name, string Host, int Port, bool Tls); + +/// +/// The client side of mu*index (https://mu-index.com), the MU* directory Browse worlds lists: what to ask, how much of +/// an answer to read, and how to read it. Everything that comes back is server text: a name or a tagline is +/// bounded and stripped of control characters before anything draws it, an address is read by +/// (the reader /connect uses) or not at all, and a row that breaks a rule is +/// dropped and counted rather than failing the list. The listing carries no address, so it is asked for one game at a +/// time, when the player picks it (). +/// +public static class WorldDirectory +{ + /// Rows asked for in one listing: the directory's most played, then the player types to narrow them. + public const int MaxRows = 200; + + /// The most bytes one answer may be, counted while it streams. + public const int MaxResponseBytes = 2 * 1024 * 1024; + + /// How long one request may take. + public static readonly TimeSpan Timeout = TimeSpan.FromSeconds(15); + + /// The longest a world's name is kept. + public const int MaxName = 64; + + /// The longest a tagline is kept. + public const int MaxTagline = 160; + + /// The longest a codebase is kept. + public const int MaxCodebase = 32; + + /// The longest query sent. + public const int MaxQuery = 64; + + /// What the dataset's licence asks every listing to say (CC BY 4.0). + public const string Attribution = "MUIndex (https://github.com/SharpMUSH/MUIndex)"; + + /// The licence the directory publishes its data under. + public const string Licence = "CC BY 4.0"; + + /// The directory's name as the client says it. + public const string Name = "mu*index"; + + /// The address of the listing for , or null when the base is not an https link. + public static Uri? ListUri(string? baseUrl, string? query = null) + { + if (Base(baseUrl) is not { } root) + { + return null; + } + + var text = new StringBuilder(root).Append("/games?limit=").Append(MaxRows).Append("&sort=players"); + var q = Clean(query, MaxQuery); + if (q.Length > 0) + { + text.Append("&q=").Append(Uri.EscapeDataString(q)); + } + + return new Uri(text.ToString()); + } + + /// The address of one game's page, which names its addresses; null when the base is not an https link. + public static Uri? GameUri(string? baseUrl, Guid id) => + Base(baseUrl) is { } root ? new Uri($"{root}/games/{id:D}") : null; + + /// Why cannot be asked, or null when it can. + public static string? Problem(string? baseUrl) => + Base(baseUrl) is not null ? null + : string.IsNullOrWhiteSpace(baseUrl) ? "no world directory is set (worldDirectoryUrl in config.json)" + : "the world directory is not an https link (worldDirectoryUrl in config.json)"; + + private static string? Base(string? baseUrl) => + Uri.TryCreate(baseUrl?.Trim(), UriKind.Absolute, out var uri) && uri.Scheme == Uri.UriSchemeHttps + && string.IsNullOrEmpty(uri.Query) && string.IsNullOrEmpty(uri.Fragment) && string.IsNullOrEmpty(uri.UserInfo) + ? uri.GetLeftPart(UriPartial.Path).TrimEnd('/') + : null; + + private static readonly JsonDocumentOptions Options = new() { MaxDepth = 32, AllowTrailingCommas = false }; + + /// Reads a GET /games answer (GameListView). + public static (WorldListPage? Page, string? Problem) ParseList(ReadOnlySpan json) + { + if (json.Length > MaxResponseBytes) + { + return (null, "the answer was too large"); + } + + try + { + using var document = JsonDocument.Parse(json.ToArray(), Options); + var root = document.RootElement; + if (root.ValueKind != JsonValueKind.Object + || !root.TryGetProperty("games", out var games) || games.ValueKind != JsonValueKind.Array) + { + return (null, "the answer is not a list of worlds"); + } + + var rows = new List(); + var seen = new HashSet(); + var dropped = 0; + foreach (var game in games.EnumerateArray()) + { + if (rows.Count >= MaxRows || ReadListing(game) is not { } row || !seen.Add(row.Id)) + { + dropped++; + continue; + } + + rows.Add(row); + } + + var total = root.TryGetProperty("total", out var t) && t.ValueKind == JsonValueKind.Number && t.TryGetInt32(out var n) && n >= 0 + ? Math.Max(n, rows.Count) + : rows.Count; + return (new WorldListPage(rows, total, dropped), null); + } + catch (JsonException) + { + return (null, "the answer is not JSON the client can read"); + } + } + + private static WorldListing? ReadListing(JsonElement game) + { + if (game.ValueKind != JsonValueKind.Object + || Text(game, "id") is not { } idText || !Guid.TryParse(idText, out var id) || id == Guid.Empty) + { + return null; + } + + var name = Clean(Text(game, "name"), MaxName); + if (name.Length == 0 || (game.TryGetProperty("archived", out var archived) && archived.ValueKind == JsonValueKind.True)) + { + return null; + } + + int? players = game.TryGetProperty("playersNow", out var p) && p.ValueKind == JsonValueKind.Number + && p.TryGetInt32(out var count) && count is >= 0 and < 1_000_000 + ? count + : null; + var how = players is null ? WorldPlayerCount.Unknown : Text(game, "playersNowState") switch + { + "measured" => WorldPlayerCount.Measured, + "declared" => WorldPlayerCount.Declared, + _ => WorldPlayerCount.Unknown, + }; + + // A number the directory will not say it measured is not shown as one. + if (how == WorldPlayerCount.Unknown) + { + players = null; + } + + return new WorldListing(id, name, Clean(Text(game, "tagline"), MaxTagline), Clean(Text(game, "codebase"), MaxCodebase), players, how); + } + + /// + /// Reads a GET /games/{id} answer (GameView) down to the one address to offer: a telnet or + /// tls endpoint, never one the directory calls gone; active before stale, then the one + /// seen most recently. An address refuses is skipped. + /// + public static (WorldAddress? Address, string? Problem) ParseGame(ReadOnlySpan json) + { + if (json.Length > MaxResponseBytes) + { + return (null, "the answer was too large"); + } + + try + { + using var document = JsonDocument.Parse(json.ToArray(), Options); + var root = document.RootElement; + if (root.ValueKind != JsonValueKind.Object) + { + return (null, "the answer is not a world"); + } + + var name = Clean(Text(root, "name"), MaxName); + if (!root.TryGetProperty("endpoints", out var endpoints) || endpoints.ValueKind != JsonValueKind.Array) + { + return (null, "the directory lists no address for it"); + } + + var candidates = new List<(WorldAddress Address, int Rank, DateTimeOffset Seen)>(); + foreach (var endpoint in endpoints.EnumerateArray().Take(64)) + { + if (endpoint.ValueKind != JsonValueKind.Object) + { + continue; + } + + var kind = Text(endpoint, "kind"); + var rank = Text(endpoint, "state") switch + { + "active" => 0, + "stale" => 1, + _ => -1, + }; + if (kind is not ("telnet" or "tls") || rank < 0 + || Text(endpoint, "host") is not { Length: > 0 and <= 253 } host + || host.Any(c => char.IsWhiteSpace(c) || char.IsControl(c)) + || !endpoint.TryGetProperty("port", out var portValue) || portValue.ValueKind != JsonValueKind.Number + || !portValue.TryGetInt32(out var port) + || ConnectEndpoint.Parse([host, port.ToString(CultureInfo.InvariantCulture)]) is not { } parsed) + { + continue; + } + + var tls = kind == "tls" || (endpoint.TryGetProperty("tlsMeasured", out var measured) && measured.ValueKind == JsonValueKind.True); + var seen = Text(endpoint, "lastSeenAt") is { } at + && DateTimeOffset.TryParse(at, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out var when) + ? when + : DateTimeOffset.MinValue; + candidates.Add((new WorldAddress(name.Length == 0 ? parsed.Host : name, parsed.Host, parsed.Port, tls), rank, seen)); + } + + if (candidates.Count == 0) + { + return (null, "the directory lists no telnet address for it that answers"); + } + + var best = candidates.OrderBy(c => c.Rank).ThenByDescending(c => c.Seen).First(); + return (best.Address, null); + } + catch (JsonException) + { + return (null, "the answer is not JSON the client can read"); + } + } + + /// + /// Server text made safe to draw: control, format (bidirectional overrides included), private-use and astral characters and line breaks + /// become spaces, runs of space collapse, and what is left is cut to with an ellipsis. + /// + public static string Clean(string? text, int max) + { + if (string.IsNullOrEmpty(text) || max <= 0) + { + return string.Empty; + } + + var built = new StringBuilder(Math.Min(text.Length, max + 1)); + var space = false; + foreach (var c in text) + { + if (built.Length > max * 2) + { + break; + } + + var category = char.GetUnicodeCategory(c); + var blank = char.IsWhiteSpace(c) || char.IsControl(c) + || category is UnicodeCategory.Format or UnicodeCategory.LineSeparator or UnicodeCategory.ParagraphSeparator + or UnicodeCategory.PrivateUse or UnicodeCategory.Surrogate or UnicodeCategory.OtherNotAssigned; + if (blank) + { + space = built.Length > 0; + continue; + } + + if (space) + { + built.Append(' '); + space = false; + } + + built.Append(c); + } + + var cleaned = built.ToString(); + return cleaned.Length <= max ? cleaned : cleaned[..(max - 1)].TrimEnd() + "…"; + } + + private static string? Text(JsonElement element, string name) => + element.TryGetProperty(name, out var value) && value.ValueKind == JsonValueKind.String ? value.GetString() : null; + + private static readonly HttpClient Client = new() { Timeout = Timeout }; + + /// + /// Downloads : https only, JSON asked for, the size counted while it streams. Null when it + /// is not https, did not succeed, or was larger than . + /// + public static async Task DownloadAsync(Uri uri, CancellationToken token) + { + ArgumentNullException.ThrowIfNull(uri); + if (uri.Scheme != Uri.UriSchemeHttps) + { + return null; + } + + using var request = new HttpRequestMessage(HttpMethod.Get, uri); + request.Headers.Accept.ParseAdd("application/json"); + using var response = await Client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, token).ConfigureAwait(false); + if (!response.IsSuccessStatusCode || response.Content.Headers.ContentLength > MaxResponseBytes) + { + return null; + } + + await using var stream = await response.Content.ReadAsStreamAsync(token).ConfigureAwait(false); + using var buffer = new MemoryStream(); + var chunk = new byte[16384]; + int read; + while ((read = await stream.ReadAsync(chunk, token).ConfigureAwait(false)) > 0) + { + if (buffer.Length + read > MaxResponseBytes) + { + return null; + } + + buffer.Write(chunk, 0, read); + } + + return buffer.ToArray(); + } +} diff --git a/src/SharpMUTerm.Tui/DemoWorldDirectory.cs b/src/SharpMUTerm.Tui/DemoWorldDirectory.cs new file mode 100644 index 00000000..acb7818a --- /dev/null +++ b/src/SharpMUTerm.Tui/DemoWorldDirectory.cs @@ -0,0 +1,58 @@ +namespace SharpMUTerm.Tui; + +/// +/// The demo scene's world directory: a mu*index listing and the pages it names, in mu*index's own JSON shapes +/// (GameListView, GameView, camelCase), answered from memory. Every world here is made up and every host is +/// under .example (RFC 2606), so a demo that picks one and presses ⏎ dials nothing real. +/// +internal static class DemoWorldDirectory +{ + private sealed record Game(string Id, string Name, string Tagline, string? Codebase, int? Players, string Count, string Host, int Port, bool Tls); + + private static readonly Game[] Games = + [ + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e01", "Aetherfall", "Sky-islands roleplay under a shattered moon", "PennMUSH", 64, "measured", "aetherfall.example", 4201, true), + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e02", "Lanternport", "A harbour city of guilds, smugglers and tide-bells", "TinyMUX", 41, "measured", "lanternport.example", 2860, false), + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e03", "The Hollow Crown", "Courtly intrigue in a kingdom with an empty throne", "RhostMUSH", 33, "declared", "hollowcrown.example", 4000, false), + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e04", "Ironvale", "Hack-and-slash with a hundred-zone map and remorts", "CircleMUD", 28, "measured", "ironvale.example", 4000, false), + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e05", "Starfall Station", "Science-fiction roleplay aboard a failing waystation", "Evennia", 19, "measured", "starfall.example", 4000, true), + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e06", "Mossgrove", "A slow, kind game about tending a forest village", "LambdaMOO", 12, "measured", "mossgrove.example", 7777, false), + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e07", "Duskwatch", "Gothic horror; consent-based, plot-driven", "PennMUSH", 9, "declared", "duskwatch.example", 4201, false), + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e08", "Copperline", "Steam, rails and frontier towns", "TinyMUX", null, "unknown", "copperline.example", 2000, false), + new("6f1c2a52-8d2e-4a52-9b8e-0c6a1f3d2e09", "Glass Archipelago", "Islands, sails and a sea that remembers", null, null, "unknown", "glassarch.example", 4444, false), + ]; + + /// The answer to : one game's page, or the listing (narrowed by its q). + public static string Answer(Uri uri) + { + ArgumentNullException.ThrowIfNull(uri); + var path = uri.AbsolutePath.TrimEnd('/'); + var slash = path.LastIndexOf('/'); + if (slash >= 0 && Guid.TryParse(path[(slash + 1)..], out var id) + && Games.FirstOrDefault(g => Guid.Parse(g.Id) == id) is { } game) + { + return Page(game); + } + + var q = System.Web.HttpUtility.ParseQueryString(uri.Query)["q"] ?? string.Empty; + var listed = Games.Where(g => q.Length == 0 + || g.Name.Contains(q, StringComparison.OrdinalIgnoreCase) + || g.Tagline.Contains(q, StringComparison.OrdinalIgnoreCase) + || (g.Codebase ?? string.Empty).Contains(q, StringComparison.OrdinalIgnoreCase)).ToArray(); + var rows = string.Join(",", listed.Select(Summary)); + return $$"""{"apiVersion":"1","generatedAt":"2026-11-04T12:00:00+00:00","filter":{"q":{{Json(q.Length == 0 ? null : q)}}},"facets":[],"total":{{listed.Length}},"limit":200,"offset":0,"count":{{listed.Length}},"games":[{{rows}}]}"""; + } + + private static string Summary(Game g) => + $$"""{"id":"{{g.Id}}","slug":"{{g.Name.ToLowerInvariant().Replace(' ', '-')}}","name":{{Json(g.Name)}},"tagline":{{Json(g.Tagline)}},"state":"active","archived":false,"claimed":false,"playersNow":{{(g.Players is { } p ? p.ToString(System.Globalization.CultureInfo.InvariantCulture) : "null")}},"playersNowState":"{{g.Count}}","playersNowProvenance":null,"codebase":{{Json(g.Codebase)}},"codebaseProvenance":null,"measuredProtocols":["gmcp","mssp"],"lastReachableAt":"2026-11-04T11:40:00+00:00","url":"/g/{{g.Id}}","apiUrl":"/api/games/{{g.Id}}"}"""; + + private static string Page(Game g) + { + var endpoints = g.Tls + ? $$"""[{"host":"{{g.Host}}","port":{{g.Port + 1}},"kind":"tls","tlsMeasured":true,"firstSeenAt":"2025-02-01T00:00:00+00:00","lastSeenAt":"2026-11-04T11:40:00+00:00","state":"active"},{"host":"{{g.Host}}","port":{{g.Port}},"kind":"telnet","tlsMeasured":false,"firstSeenAt":"2024-01-01T00:00:00+00:00","lastSeenAt":"2026-11-04T11:00:00+00:00","state":"active"}]""" + : $$"""[{"host":"old.{{g.Host}}","port":{{g.Port}},"kind":"telnet","tlsMeasured":false,"firstSeenAt":"2019-01-01T00:00:00+00:00","lastSeenAt":"2021-06-01T00:00:00+00:00","state":"gone"},{"host":"{{g.Host}}","port":{{g.Port}},"kind":"telnet","tlsMeasured":false,"firstSeenAt":"2021-06-01T00:00:00+00:00","lastSeenAt":"2026-11-04T11:40:00+00:00","state":"active"}]"""; + return $$"""{"id":"{{g.Id}}","slug":"x","name":{{Json(g.Name)}},"tagline":{{Json(g.Tagline)}},"description":null,"state":"active","archived":false,"claimed":false,"playersNow":null,"playersNowState":"unknown","codebase":{{Json(g.Codebase)}},"measuredProtocols":[],"endpoints":{{endpoints}},"url":"/g/x","apiUrl":"/api/games/{{g.Id}}"}"""; + } + + private static string Json(string? text) => text is null ? "null" : System.Text.Json.JsonSerializer.Serialize(text); +} diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs index 8dce471e..1c7fbad0 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Surfaces.cs @@ -35,6 +35,7 @@ private T Drawing(string surface, string key, T model) : surface == SurfaceCatalog.Welcome ? (_welcomeView.IsOpen ? _welcome?.Model : null) : surface == SurfaceCatalog.Help ? CellHelp?.Model : surface == SurfaceCatalog.Dictionary ? (_helpView.IsOpen && _helpView.Mode == "dictionary" ? _dictionaryOffer : null) + : surface == SurfaceCatalog.BrowseWorlds ? (_helpView.IsOpen && _helpView.Mode == WorldBrowseMode ? _worldModel : null) : surface == SurfaceCatalog.Import ? (_helpView.IsOpen && _helpView.Mode == "import" ? _pendingImport?.Model : null) : surface == SurfaceCatalog.ScriptConsole ? CellConsole?.Model : _drawnModels.TryGetValue((surface, key), out var model) ? model : null; diff --git a/src/SharpMUTerm.Tui/Program.cs b/src/SharpMUTerm.Tui/Program.cs index dfdc21ef..d93d18bb 100644 --- a/src/SharpMUTerm.Tui/Program.cs +++ b/src/SharpMUTerm.Tui/Program.cs @@ -227,7 +227,8 @@ internal static int RunLive( scriptStoreRoot: Path.Combine(Path.GetDirectoryName(ConfigurationStore.DefaultPath)!, "script-data"), spelling: () => OpenDictionary(loadLogger), autoLayout: true, - dictionaries: DictionariesFolder); + dictionaries: DictionariesFolder, + worldFetch: SharpMUTerm.Core.WorldIndex.WorldDirectory.DownloadAsync); ready?.Invoke(liveApp); // A telnet:// link on the command line is followed once the loop runs, the way /connect host port would be; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs index 776b8675..c53fdaa1 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeModals.cs @@ -64,6 +64,7 @@ internal sealed partial class SharpMUTermApp SurfaceCatalog.Welcome => "the welcome", SurfaceCatalog.Help => "help", SurfaceCatalog.Dictionary => "the dictionary offer", + SurfaceCatalog.BrowseWorlds => "Browse worlds", SurfaceCatalog.ScriptConsole => "the script console", null => null, _ => "what is open", diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs index a74f416e..b2b19b32 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs @@ -71,13 +71,8 @@ internal void SimulateWelcomeKey(ConsoleKeyInfo key) _welcomeView.SimulateKey(key); } - /// Why the package index cannot be browsed, or null when it can be asked for. - private string? PackageIndexProblem() => - Uri.TryCreate(_config.PackageIndexUrl, UriKind.Absolute, out var uri) && uri.Scheme == Uri.UriSchemeHttps - ? null - : string.IsNullOrWhiteSpace(_config.PackageIndexUrl) - ? "no package index is set (packageIndexUrl in config.json)" - : "the package index is not an https link (packageIndexUrl in config.json)"; + /// Why the world directory cannot be browsed, or null when it can be asked for. + private string? WorldDirectoryProblem() => Core.WorldIndex.WorldDirectory.Problem(_config.WorldDirectoryUrl); /// /// Shows the welcome: the surface where the screen is seen, the lines where it is not. Opened at start on @@ -85,7 +80,7 @@ internal void SimulateWelcomeKey(ConsoleKeyInfo key) /// internal void ShowWelcome() { - var problem = PackageIndexProblem(); + var problem = WorldDirectoryProblem(); if (Host.Announcer is { } announcer) { foreach (var line in WelcomeSurface.PlainLines(_welcomeLayout, problem)) @@ -138,7 +133,7 @@ private bool WelcomeKey(WelcomeSurface welcome, ConsoleKeyInfo key) => /// /// What the welcome asked for, from either host: the cell surface's key and the native welcome's click both end - /// here. Browse and Open settings close it and open what they name; Connect closes it and dials the form through + /// here. Browse (Browse worlds) and Open settings close it and open what they name; Connect closes it and dials the form through /// /connect's path. Anything else keeps it open, which is the return value. /// private bool RunWelcomeAction(WelcomeSurface welcome, WelcomeAction action) @@ -148,7 +143,7 @@ private bool RunWelcomeAction(WelcomeSurface welcome, WelcomeAction action) { case WelcomeAction.Browse: CloseWelcome(); - BrowsePackages(); + ShowWorldBrowse(); return false; case WelcomeAction.Settings: @@ -201,6 +196,13 @@ private void ConnectFromWelcome(WelcomeConnect request) ConnectCommand(ActiveWindowId(), arguments, world => { ApplyWelcomeLayout(world); + + // Browse worlds named it: the directory's name for it, made unique, in place of the host. + if (request.WorldName is { Length: > 0 } listed) + { + world.Name = UniqueWorldName(listed); + } + if (request.Character is { } name) { world.Characters.Add(new CharacterDefinition { Name = name }); @@ -370,6 +372,7 @@ private string RenderWelcomeSnapshot(string view) RefreshHeader(); RefreshRail(); UpdateStatus(); + WorldFetch ??= DemoWorldFetch; LastCommand = StartAsync([]); if (string.Equals(view, WelcomeView + "-connect", StringComparison.OrdinalIgnoreCase)) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs new file mode 100644 index 00000000..e540b100 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs @@ -0,0 +1,447 @@ +using System.Globalization; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Accessibility; +using SharpMUTerm.Core.WorldIndex; + +namespace SharpMUTerm.Tui; + +/// +/// Browse worlds (the welcome's Browse row, ⌃P ▸ Browse worlds…, /browse [words]): mu*index's listing, +/// one Client model () drawn as a cell here and as a native modal +/// in a host that has them. Every gesture in either ends in one method: and +/// . +/// +/// Asked only when the player opens it, never at start, through a fetch the caller supplies (worldFetch:, +/// the save:/logRoot: family): null in a test and a snapshot, which then say they asked nothing. The demo +/// scene answers from memory. A pick saves nothing and dials nothing: it asks the directory where the world is and +/// opens the welcome's connect form filled in, so the player's own ⏎ there — through /connect's path — is what +/// adds the world. +/// +/// +internal sealed partial class SharpMUTermApp +{ + /// The cell overlay's mode while Browse worlds is in it. + internal const string WorldBrowseMode = "browse-worlds"; + + /// The fetch the live entry point supplies; null in a run that may ask nothing. + private readonly Func>? _worldFetch; + + /// The cell surface's state while it is open. + private WorldBrowseSurface? _worldBrowse; + + /// What Browse worlds lists now, in either host. + private WorldBrowseModel _worldModel = new(WorldBrowseState.Loading, [], 0, string.Empty, null, null); + + /// Bumped by every request, so an answer that arrives after a newer question (or a close) is dropped. + private int _worldGeneration; + + /// The rows /browse last said as lines, so /browse 3 names one of them. + private IReadOnlyList _saidWorlds = []; + + /// + /// How the directory is asked: the caller's fetch, or one a test or the demo scene sets. Null asks nothing. + /// + internal Func>? WorldFetch { get; set; } + + /// Whether Browse worlds is open, in cells or natively. + internal bool WorldBrowseOpen => + (_helpView.IsOpen && _helpView.Mode == WorldBrowseMode) || NativeModalOf(SurfaceCatalog.BrowseWorlds) is not null; + + /// What Browse worlds lists now, for the tests. + internal WorldBrowseModel WorldBrowseModelNow => _worldModel; + + /// The cell surface's state, for the tests; null while it is shut. + internal WorldBrowseSurface? CellWorldBrowse => _helpView.IsOpen && _helpView.Mode == WorldBrowseMode ? _worldBrowse : null; + + /// The native session while one is open, for the tests. + internal WorldBrowseSession? NativeWorldBrowse => _nativeModal as WorldBrowseSession; + + /// Feeds a key to the cell surface. + internal void SimulateWorldBrowseKey(ConsoleKeyInfo key) => _helpView.SimulateKey(key); + + /// + /// Opens Browse worlds with typed into its search — the welcome's Browse row, ⌃P and + /// /browse — or closes it when it is open (⌃P's entry is a toggle). With no screen to read, the rows are said + /// as lines instead. + /// + internal void ShowWorldBrowse(string query = "") + { + if (NativeModalOf(SurfaceCatalog.BrowseWorlds) is { } native) + { + CloseNativeModal(native); + return; + } + + if (_helpView.IsOpen && _helpView.Mode == WorldBrowseMode) + { + _helpView.Close(); + return; + } + + query = WorldDirectory.Clean(query, WorldDirectory.MaxQuery); + if (!Host.ScreenIsSeen) + { + SayWorlds(query); + return; + } + + if (ComposerIsInTheWay("Browse worlds") || (AnyOverlayOpen && Refuse($"close {OpenOverlayName()} first"))) + { + return; + } + + // The list is the directory's most played; what is typed narrows it as the player types. Opened on a query + // (/browse words), the directory itself is asked, since its most played may hold none of them. + StartWorldList(query); + if (NativeModalsHost is { } host) + { + WorldBrowseSession? session = null; + session = new WorldBrowseSession( + _worldModel, + ThemeIsDark(), + index => OnUiThread(() => PickWorld(session!.Model, index)), + words => OnUiThread(() => AskWorldDirectory(words)), + () => OnUiThread(() => + { + NativeModalClosed(session!); + _worldGeneration++; + })) + { + Theme = _theme.Clone(), + InitialQuery = query, + }; + ShowNativeModal(host, session); + return; + } + + var browse = new WorldBrowseSurface(query); + _worldBrowse = browse; + var rows = Math.Clamp(_system.DesktopDimensions.Height - 6, 10, 30); + _helpView.Open( + WorldBrowseMode, + WorldBrowseModel.Heading, + width => browse.Render(Drawing(SurfaceCatalog.BrowseWorlds, string.Empty, _worldModel), width, rows), + key => + { + switch (browse.Key(_worldModel, key)) + { + case WorldBrowseAction.Pick: + PickWorld(_worldModel, browse.SelectedRow(_worldModel)); + break; + case WorldBrowseAction.Ask: + AskWorldDirectory(browse.Query); + break; + } + + return WorldBrowseOpen; + }, + width: WorldBrowseSurface.PreferredWidth, + closed: () => + { + _worldBrowse = null; + _worldGeneration++; + }); + } + + /// + /// Asks for the listing — the directory's most played, or its search for — and publishes + /// the model it leaves: loading now, then the rows or why there are none. Nothing is asked with no https directory + /// or no fetch, and the model says which. + /// + /// Told the model once the list is in, failed or could not be asked. + private void StartWorldList(string query, Action? settled = null) + { + var generation = ++_worldGeneration; + void Settle(WorldBrowseModel model) + { + PublishWorldModel(model); + settled?.Invoke(model); + } + + if (WorldDirectoryProblem() is { } problem) + { + Settle(new WorldBrowseModel(WorldBrowseState.Unavailable, [], 0, query, problem, null)); + return; + } + + if ((WorldFetch ?? _worldFetch) is null) + { + Settle(new WorldBrowseModel( + WorldBrowseState.Unavailable, [], 0, query, "this run asks no world directory, so nothing was fetched", null)); + return; + } + + PublishWorldModel(new WorldBrowseModel(WorldBrowseState.Loading, [], 0, query, null, null)); + FetchWorlds(WorldDirectory.ListUri(_config.WorldDirectoryUrl, query)!, generation, (bytes, failure) => + { + if (bytes is null) + { + Settle(new WorldBrowseModel(WorldBrowseState.Failed, [], 0, query, failure, null)); + return; + } + + var (page, unread) = WorldDirectory.ParseList(bytes); + Settle(page is null + ? new WorldBrowseModel(WorldBrowseState.Failed, [], 0, query, unread, null) + : new WorldBrowseModel(WorldBrowseState.Ready, page.Rows, page.Total, query, null, null)); + }); + } + + /// + /// The pick, from either host: row of . Asks the directory where that + /// world is; once it answers with an address /connect would take, Browse worlds closes and the welcome's connect + /// form opens filled in. Nothing is saved or dialled here. A refusal is said in place and the list stays. + /// + internal void PickWorld(WorldBrowseModel model, int index) + { + if (index < 0 || index >= model.Rows.Count || _worldModel.Opening is not null) + { + return; + } + + var row = model.Rows[index]; + if (WorldDirectory.GameUri(_config.WorldDirectoryUrl, row.Id) is not { } uri || (WorldFetch ?? _worldFetch) is null) + { + PublishWorldModel(_worldModel with { Problem = $"{row.Name} not opened: {WorldDirectoryProblem() ?? "this run asks no world directory"}" }); + return; + } + + var generation = ++_worldGeneration; + PublishWorldModel(_worldModel with { Opening = row.Name, Problem = null }); + FetchWorlds(uri, generation, (bytes, failure) => + { + var (address, unread) = bytes is null ? (null, failure) : WorldDirectory.ParseGame(bytes); + if (address is null) + { + PublishWorldModel(_worldModel with { Opening = null, Problem = $"{row.Name} not opened: {unread}" }); + return; + } + + // The listing's name, which the player chose by; the page's own is the same world. + OpenWorldForm(address with { Name = row.Name }); + }); + } + + /// + /// ⏎ on a query none of the rows held match, from either host: asks the directory itself to search for it, and lists + /// what it says in place of its most played. + /// + internal void AskWorldDirectory(string query) + { + if (!_worldModel.AsksDirectory(query)) + { + return; + } + + StartWorldList(WorldDirectory.Clean(query, WorldDirectory.MaxQuery)); + } + + /// Closes Browse worlds and opens the welcome's connect form filled in with . + private void OpenWorldForm(WorldAddress address) + { + CloseWorldBrowse(); + var welcome = new WelcomeSurface(WorldDirectoryProblem()) { Layout = _welcomeLayout }; + welcome.Prefill(address.Name, address.Host, address.Port, address.Tls); + if (WelcomeIsOpen) + { + CloseWelcome(); + } + + _welcome = welcome; + if (!TryOpenNativeWelcome(welcome)) + { + OpenWelcomeView(); + } + } + + /// Closes Browse worlds in whichever host it is open. + private void CloseWorldBrowse() + { + if (NativeModalOf(SurfaceCatalog.BrowseWorlds) is { } native) + { + CloseNativeModal(native); + } + + if (_helpView.IsOpen && _helpView.Mode == WorldBrowseMode) + { + _helpView.Close(); + } + } + + /// A new model: the native session is told, the cell surface repainted. + private void PublishWorldModel(WorldBrowseModel model) + { + _worldModel = model; + if (NativeWorldBrowse is { } session) + { + session.Publish(model); + } + + if (_helpView.IsOpen && _helpView.Mode == WorldBrowseMode) + { + _helpView.Repaint(); + } + } + + /// + /// Asks through the fetch and hands back the bytes, or why there are none, on the UI thread — + /// unless a newer request (or a close) has bumped since, when the answer is dropped. An + /// answer already in hand (the demo's, a test's) is handled at once. + /// + private void FetchWorlds(Uri uri, int generation, Action then) + { + var fetch = WorldFetch ?? _worldFetch; + if (fetch is null) + { + return; + } + + void Deliver(byte[]? bytes, string? problem) + { + if (generation == _worldGeneration) + { + then(bytes, bytes is null ? problem ?? "it did not answer, or the answer was too large" : null); + } + } + + Task task; + try + { + task = fetch(uri, CancellationToken.None); + } + catch (Exception ex) when (ex is HttpRequestException or IOException or InvalidOperationException) + { + Deliver(null, ex.Message); + return; + } + + if (task.IsCompleted) + { + Deliver(task.IsCompletedSuccessfully ? task.Result : null, task.Exception?.InnerException?.Message); + return; + } + + _ = Task.Run(async () => + { + byte[]? bytes = null; + string? problem = null; + try + { + bytes = await task.WaitAsync(WorldDirectory.Timeout).ConfigureAwait(false); + } + catch (TimeoutException) + { + problem = "it took too long to answer"; + } + catch (Exception ex) when (ex is HttpRequestException or IOException or TaskCanceledException or InvalidOperationException) + { + problem = ex.Message; + } + + OnUiThread(() => Deliver(bytes, problem)); + }); + } + + // ── /browse, and the lines a host with no screen hears ──────────────────────────────────────── + + /// + /// /browse [words] opens Browse worlds (asking the directory for the words); /browse N picks row N of the + /// list /browse last said as lines. + /// + private void BrowseCommand(string arguments) + { + var words = arguments.Trim(); + if (int.TryParse(words, NumberStyles.None, CultureInfo.InvariantCulture, out var n) && _saidWorlds.Count > 0) + { + if (n < 1 || n > _saidWorlds.Count) + { + RefuseCommand($"/browse lists {_saidWorlds.Count} worlds; say a number from 1 to {_saidWorlds.Count}"); + return; + } + + SayWorldAddress(_saidWorlds[n - 1]); + return; + } + + if (WorldBrowseOpen) + { + CloseWorldBrowse(); + } + + ShowWorldBrowse(words); + } + + /// The listing said as numbered lines, for a host nobody reads the screen of; /browse N picks one. + private void SayWorlds(string query) => StartWorldList(query, model => + { + var lines = new List { WorldBrowseModel.AttributionLine }; + if (model.Empty(string.Empty) is { } empty) + { + lines.Add(empty); + _saidWorlds = []; + } + else + { + _saidWorlds = model.Rows.Take(20).ToArray(); + lines.Add($"{model.CountLine(string.Empty)}; the first {_saidWorlds.Count}, most played first:"); + lines.AddRange(_saidWorlds.Select((r, i) => string.Join( + " — ", + new[] { $"{i + 1}. {r.Name}", $"{WorldBrowseModel.Players(r)} players", r.Codebase, r.Tagline }.Where(p => p.Length > 0)))); + lines.Add("Type /browse and a number to see where that world is, or /browse and words to search."); + } + + SayLines(lines); + }); + + /// Where a world /browse N named is, said as the /connect line to type; nothing is saved or dialled. + private void SayWorldAddress(WorldListing row) + { + if (WorldDirectory.GameUri(_config.WorldDirectoryUrl, row.Id) is not { } uri || (WorldFetch ?? _worldFetch) is null) + { + RefuseCommand($"{row.Name} not looked up: {WorldDirectoryProblem() ?? "this run asks no world directory"}"); + return; + } + + var generation = ++_worldGeneration; + FetchWorlds(uri, generation, (bytes, failure) => + { + var (address, unread) = bytes is null ? (null, failure) : WorldDirectory.ParseGame(bytes); + if (address is null) + { + RefuseCommand($"{row.Name} not looked up: {unread}"); + return; + } + + var host = address.Host.Contains(':') ? $"[{address.Host}]" : address.Host; + var command = $"/connect {host} {address.Port}" + (address.Tls ? " tls" : string.Empty); + if (Host.ScreenIsSeen) + { + OpenWorldForm(address with { Name = row.Name }); + return; + } + + SayLines( + [ + $"{row.Name} is at {address.Host} port {address.Port}{(address.Tls ? ", encrypted" : string.Empty)}, as listed on mu*index.", + $"To add it and connect, type: {command}", + ]); + }); + } + + /// Lines into the focused window and the announcer, as help says its rows. + private void SayLines(IEnumerable lines) + { + foreach (var line in lines) + { + AppendWindowLine(ActiveWindowId(), $"[dim]*** {MarkupText.Escape(line)}[/]"); + Host.Announcer?.Announce(line, AnnouncementKind.Notice); + } + } + + // ── the demo ────────────────────────────────────────────────────────────────────────────────── + + /// The demo's directory, answered from memory, so a window demo can browse and pick without a byte leaving. + private static Task DemoWorldFetch(Uri uri, CancellationToken token) => + Task.FromResult(System.Text.Encoding.UTF8.GetBytes(DemoWorldDirectory.Answer(uri))); +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 0befbe2b..741be210 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -733,9 +733,11 @@ public SharpMUTermApp( string? scriptStoreRoot = null, Func? spelling = null, bool autoLayout = false, - string? dictionaries = null) + string? dictionaries = null, + Func>? worldFetch = null) { _spelling = spelling; + _worldFetch = worldFetch; _dictionariesRoot = string.IsNullOrWhiteSpace(dictionaries) ? null : dictionaries; _autoLayout = autoLayout; var capabilities = host.Capabilities; @@ -1961,6 +1963,24 @@ public string RenderSnapshot(string? view = null) return scriptingFrame; } + // Browse worlds over the demo's directory (answered from memory): the list through its ⌃P entry; `-failed` with a + // directory that does not answer; `-picked` after a pick, so the frame is the welcome's connect form filled in. + if (string.Equals(view, "browse-worlds", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "browse-worlds-failed", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "browse-worlds-picked", StringComparison.OrdinalIgnoreCase)) + { + if (string.Equals(view, "browse-worlds-failed", StringComparison.OrdinalIgnoreCase)) + { + WorldFetch = static (_, _) => Task.FromResult(null); + } + + DispatchCommand(SharpMUTerm.Client.Commands.BuiltInCommands.BrowseWorldsCommand); + if (string.Equals(view, "browse-worlds-picked", StringComparison.OrdinalIgnoreCase)) + { + PickWorld(_worldModel, 0); + } + } + // The spelling dictionary offer, through its ⌃P entry. The demo keeps no dictionaries folder, so the offer says // nothing can be saved in this run — the text a live client shows names the folder instead. if (string.Equals(view, "dictionary-offer", StringComparison.OrdinalIgnoreCase)) @@ -2898,6 +2918,9 @@ private bool RestoreLogWanted(string? sessionKey) => /// private void InitDemoRuntimeState() { + // The demo's world directory answers from memory, so Browse worlds lists and picks without a byte leaving. + WorldFetch ??= DemoWorldFetch; + foreach (var (world, character) in StartupConnections.Resolve(_config)) { var key = $"{world.Name}.{character?.Name ?? world.Name}"; @@ -5290,6 +5313,14 @@ private void OnCommandEntered(InputBar bar, string command) return; } + // `/browse [words]` opens Browse worlds (mu*index); `/browse N` picks a row it said as lines. + if (command.StartsWith("/browse", StringComparison.OrdinalIgnoreCase) + && (command.Length == 7 || command[7] == ' ')) + { + BrowseCommand(command[7..]); + return; + } + // `/welcome` shows the first-run welcome again; `/welcome layout …` picks its starting layout. if (command.StartsWith("/welcome", StringComparison.OrdinalIgnoreCase) && (command.Length == 8 || command[8] == ' ')) @@ -5914,7 +5945,7 @@ private string OpenOverlayName() => : _search.IsOpen ? "the search surface" : _prefixPanel.IsOpen ? "the pane keys panel" : _welcomeView.IsOpen ? "the welcome" - : _helpView.IsOpen ? (_helpView.Mode switch { "dictionary" => "the dictionary offer", "import" => "the import review", "script-console" => "the script console", "history-view" => "the history view", _ => "help" }) + : _helpView.IsOpen ? (_helpView.Mode switch { "dictionary" => "the dictionary offer", "import" => "the import review", "script-console" => "the script console", "history-view" => "the history view", "browse-worlds" => "Browse worlds", _ => "help" }) : "what is open"; /// Whether either bar is holding unsent text — what the ✎ tab marker means. @@ -9112,6 +9143,9 @@ private bool RunBuiltInCommand(string id) case "term:welcome": ShowWelcome(); return true; + case SharpMUTerm.Client.Commands.BuiltInCommands.BrowseWorldsCommand: + ShowWorldBrowse(); + return true; case SharpMUTerm.Client.Commands.BuiltInCommands.ImportCommand: StartImport(); return true; diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index b643b93e..999d6ac5 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -28,7 +28,7 @@ internal static class SnapshotViews "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "map-edit", "map-level", "map-area", "map-find", "map-mine", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", - "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "import-review", "join-wraps", "join-wraps-f5", + "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "browse-worlds", "browse-worlds-failed", "browse-worlds-picked", "import-review", "join-wraps", "join-wraps-f5", "script-console", "script-list", "script-edit", "search-older", "search-history", "channel-capture", "highlight-names", "channels-f5", "scene-log", ]; } diff --git a/src/SharpMUTerm.Tui/WelcomeSurface.cs b/src/SharpMUTerm.Tui/WelcomeSurface.cs index a59f6e5b..d0370c06 100644 --- a/src/SharpMUTerm.Tui/WelcomeSurface.cs +++ b/src/SharpMUTerm.Tui/WelcomeSurface.cs @@ -13,7 +13,7 @@ internal enum WelcomeAction /// Dial . Connect, - /// Close, and open the package index. + /// Close, and open Browse worlds. Browse, /// Close, and open F5. @@ -24,7 +24,7 @@ internal enum WelcomeAction } /// What the connect form asks for, read once ⏎ has checked it. -internal sealed record WelcomeConnect(string Host, int Port, bool Tls, string? Character, bool PasswordLater); +internal sealed record WelcomeConnect(string Host, int Port, bool Tls, string? Character, bool PasswordLater, string? WorldName = null); /// /// The first-run welcome: what it says and what a key on it means, with no window in it — the @@ -51,7 +51,7 @@ internal sealed class WelcomeSurface private readonly string? _indexProblem; - /// Why the package index cannot be browsed, or null when it can be asked for. + /// Why the world directory cannot be browsed, or null when it can be asked for. public WelcomeSurface(string? indexProblem) => _indexProblem = indexProblem; public WelcomeChoice Selected { get; private set; } = WelcomeChoice.Connect; @@ -79,9 +79,32 @@ internal sealed class WelcomeSurface /// The checked form, once ⏎ has accepted it. public WelcomeConnect? Request { get; private set; } + /// The world Browse worlds filled the form in for, or null; dropped once the host is changed. + public string? WorldName { get; private set; } + + /// The host Browse worlds filled in, so a changed host drops the name that went with it. + private string? _prefilledHost; + /// Everything the surface says now: what the cells draw and the window's native welcome draws. public WelcomeModel Model => - new(InForm, Selected, Layout, Field, Host, Port, Tls, Character, PasswordLater, Problem, _indexProblem); + new(InForm, Selected, Layout, Field, Host, Port, Tls, Character, PasswordLater, Problem, _indexProblem, WorldName); + + /// + /// The form, filled in from a world Browse worlds picked: its host, port and TLS, and its name for the world it will + /// be saved as. Only fills it in — the player's own ⏎ there is what saves and dials, through /connect's path. + /// + public void Prefill(string worldName, string host, int port, bool tls) + { + InForm = true; + Field = WelcomeField.Character; + Host = new string(host.Where(c => !char.IsWhiteSpace(c) && !char.IsControl(c)).Take(MaxHost).ToArray()); + Port = port.ToString(System.Globalization.CultureInfo.InvariantCulture); + Tls = tls; + WorldName = worldName; + _prefilledHost = Host; + Problem = null; + Request = null; + } /// /// A menu choice made outright — the native welcome's click, or ⏎ on the cell menu once the pointer is on it. The @@ -292,7 +315,12 @@ private WelcomeAction Submit(Func, (string Host, int Port) } var character = Character.Trim(); - Request = new WelcomeConnect(endpoint.Host, endpoint.Port, Tls, character.Length == 0 ? null : character, PasswordLater); + if (WorldName is not null && !string.Equals(Host, _prefilledHost, StringComparison.OrdinalIgnoreCase)) + { + WorldName = null; + } + + Request = new WelcomeConnect(endpoint.Host, endpoint.Port, Tls, character.Length == 0 ? null : character, PasswordLater, WorldName); return WelcomeAction.Connect; } @@ -378,7 +406,7 @@ private static List RenderForm(WelcomeModel model, int width) var lines = new List { Accent(WelcomeModel.FormHeading), - Label(WelcomeModel.FormIntro), + Label(model.FormIntroLine), string.Empty, }; @@ -435,7 +463,7 @@ public static IReadOnlyList PlainLines(WelcomeLayout layout, string? ind "Welcome to SharpMUTerm. No worlds yet.", "To connect, type /connect, a host and a port, and tls for an encrypted connection: " + ExampleCommand, indexProblem is null - ? "To browse worlds from the package index, type /package browse" + ? "To browse worlds listed on mu*index, type /browse, or /browse and words to search for" : "Browsing worlds is not available: " + indexProblem, "To import worlds and automation from MUSHclient, Mudlet or TinTin++, type /import and the path to the file", "Starting layout: " + (layout == WelcomeLayout.Suggested ? "suggested from what the game sends" : layout.ToString()) diff --git a/src/SharpMUTerm.Tui/WorldBrowseSurface.cs b/src/SharpMUTerm.Tui/WorldBrowseSurface.cs new file mode 100644 index 00000000..4fc865a2 --- /dev/null +++ b/src/SharpMUTerm.Tui/WorldBrowseSurface.cs @@ -0,0 +1,209 @@ +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.WorldIndex; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui; + +/// What a key on Browse worlds asks the app to do. +internal enum WorldBrowseAction +{ + /// Nothing beyond a repaint. + Redraw, + + /// Ask where the selected row is (), then open the connect form. + Pick, + + /// Ask the directory itself for what is typed: nothing among the rows held matches it. + Ask, +} + +/// +/// Browse worlds in cells: a search line, mu*index's rows for what is typed, the credit its licence asks for, and the +/// keys. The state is the reader's (what is typed, the order, which row); what it lists is the model's +/// , so the window's native list shows the same rows for the same query. Hosted in a +/// , which is sized once when it opens, so +/// always draws exactly the rows it is given — loading, failed or listed. +/// +internal sealed class WorldBrowseSurface +{ + /// The width the surface asks for; the overlay narrows it on a small terminal. + internal const int PreferredWidth = 100; + + public WorldBrowseSurface(string query = "") => Query = query.Length > WorldDirectory.MaxQuery ? query[..WorldDirectory.MaxQuery] : query; + + public string Query { get; private set; } + + public WorldDirectorySort Sort { get; private set; } = WorldDirectorySort.Players; + + /// The row selected in the listed rows. + public int Selected { get; private set; } + + /// The index in 's rows of the row selected, or -1. + public int SelectedRow(WorldBrowseModel model) + { + ArgumentNullException.ThrowIfNull(model); + var view = model.View(Query, Sort); + if (Selected < 0 || Selected >= view.Count) + { + return -1; + } + + for (var i = 0; i < model.Rows.Count; i++) + { + if (ReferenceEquals(model.Rows[i], view[Selected])) + { + return i; + } + } + + return -1; + } + + /// A key, read against what the surface lists now. + public WorldBrowseAction Key(WorldBrowseModel model, ConsoleKeyInfo key) + { + ArgumentNullException.ThrowIfNull(model); + var count = model.View(Query, Sort).Count; + switch (key.Key) + { + case ConsoleKey.UpArrow: + Selected = count == 0 ? 0 : (Selected - 1 + count) % count; + return WorldBrowseAction.Redraw; + case ConsoleKey.DownArrow: + Selected = count == 0 ? 0 : (Selected + 1) % count; + return WorldBrowseAction.Redraw; + case ConsoleKey.PageUp: + Selected = Math.Max(0, Selected - 10); + return WorldBrowseAction.Redraw; + case ConsoleKey.PageDown: + Selected = Math.Min(Math.Max(0, count - 1), Selected + 10); + return WorldBrowseAction.Redraw; + case ConsoleKey.Tab: + Sort = WorldBrowseModel.Next(Sort); + Selected = 0; + return WorldBrowseAction.Redraw; + case ConsoleKey.Backspace: + if (Query.Length > 0) + { + Query = Query[..^1]; + Selected = 0; + } + + return WorldBrowseAction.Redraw; + case ConsoleKey.Enter: + if (model.Opening is not null) + { + return WorldBrowseAction.Redraw; + } + + return model.AsksDirectory(Query) ? WorldBrowseAction.Ask + : SelectedRow(model) >= 0 ? WorldBrowseAction.Pick + : WorldBrowseAction.Redraw; + } + + if (key.KeyChar >= ' ' && !char.IsControl(key.KeyChar) + && (key.Modifiers & (ConsoleModifiers.Control | ConsoleModifiers.Alt)) == 0 + && Query.Length < WorldDirectory.MaxQuery) + { + Query += key.KeyChar; + Selected = 0; + } + + return WorldBrowseAction.Redraw; + } + + /// What the surface draws now, in rows of . + public List Render(WorldBrowseModel model, int width, int rows) => Render(model, Query, Sort, Selected, width, rows); + + /// + /// Browse worlds for in 's order, row marked, + /// in exactly rows: the search line, the credit, the list (or what stands for it), a note and + /// the keys. + /// + internal static List Render(WorldBrowseModel model, string query, WorldDirectorySort sort, int selected, int width, int rows) + { + ArgumentNullException.ThrowIfNull(model); + width = Math.Max(30, width); + rows = Math.Max(9, rows); + var lines = new List + { + SpreadLR( + $"[{ScreenPalette.Accent}]WORLDS[/] [{ScreenPalette.Label}]search[/] [{ScreenPalette.Value}]{Escape(query)}▏[/]", + $"[{ScreenPalette.Label}]{Escape(Join(model.CountLine(query), WorldBrowseModel.SortName(sort)))}[/]", + width), + ElideVisible($"[{ScreenPalette.Muted}]{Escape(WorldBrowseModel.AttributionLine)}[/]", width), + string.Empty, + }; + + var body = rows - lines.Count - 2; + var view = model.View(query, sort); + if (model.Empty(query) is { } empty) + { + var tone = model.State is WorldBrowseState.Failed or WorldBrowseState.Unavailable ? ScreenPalette.Caution : ScreenPalette.Label; + lines.Add($" [{tone}]{Escape(Elide(empty, width - 2))}[/]"); + } + else + { + var nameWidth = Math.Clamp(view.Max(r => r.Name.Length) + 1, 12, Math.Max(12, width * 30 / 100)); + var codebaseWidth = Math.Clamp(view.Max(r => r.Codebase.Length) + 1, 8, 14); + var first = Math.Clamp(selected - (body / 2), 0, Math.Max(0, view.Count - body)); + for (var i = first; i < view.Count && i < first + body; i++) + { + lines.Add(Row(view[i], i == selected, width, nameWidth, codebaseWidth)); + } + } + + Pad(lines, rows - 2); + var note = model.Opening is not null ? model.OpeningLine + : model.State == WorldBrowseState.Ready && model.Problem is { } problem ? problem + : model.State == WorldBrowseState.Ready && view.Count > 0 ? (model.AnyDeclared ? WorldBrowseModel.DeclaredNote + " · " : string.Empty) + WorldBrowseModel.PickNote + : string.Empty; + var noteTone = model.State == WorldBrowseState.Ready && model.Problem is not null && model.Opening is null ? ScreenPalette.Caution : ScreenPalette.Label; + lines.Add(note.Length == 0 ? string.Empty : $"[{noteTone}]{Escape(Elide(note, width - 1))}[/]"); + lines.Add(Footer(width)); + return lines; + } + + /// The key row, laddered to one row: the way out and the pick are never given up. + internal static string Footer(int width) + { + var keys = WorldBrowseModel.Keys.Select(k => k.Key switch + { + "⏎" or "Esc" => new LadderKey(k.Key, k.Label), + "⇥" => new LadderKey(k.Key, k.Label, Drop: 1), + _ => new LadderKey(k.Key, k.Label, Drop: 2), + }).ToList(); + keys.Insert(0, new LadderKey("type", "to search", Drop: 0)); + return KeyLadder.Fit(keys, width - 1, k => $"[{ScreenPalette.Accent}]{Escape(k)}[/]", l => $"[{ScreenPalette.Label}]{Escape(l)}[/]", $"[{ScreenPalette.Label}] · [/]"); + } + + private static string Row(WorldListing row, bool selected, int width, int nameWidth, int codebaseWidth) + { + var mark = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; + var weight = selected ? "bold " : string.Empty; + var players = WorldBrowseModel.Players(row).PadLeft(5); + var tagline = Elide(row.Tagline, Math.Max(0, width - 2 - nameWidth - 6 - codebaseWidth - 1)); + return $"{mark} [{weight}{ScreenPalette.Value}]{Escape(Elide(row.Name, nameWidth - 1).PadRight(nameWidth))}[/]" + + $"[{ScreenPalette.Accent}]{Escape(players)}[/] " + + $"[{ScreenPalette.Label}]{Escape(Elide(row.Codebase, codebaseWidth - 1).PadRight(codebaseWidth))}[/]" + + $"[{ScreenPalette.Value}]{Escape(tagline)}[/]"; + } + + private static string Join(string a, string b) => a.Length == 0 ? b : $"{a} · {b}"; + + private static string Elide(string text, int width) => + width <= 0 ? string.Empty : text.Length <= width ? text : width == 1 ? "…" : text[..(width - 1)] + "…"; + + private static void Pad(List lines, int count) + { + while (lines.Count < count) + { + lines.Add(string.Empty); + } + + if (lines.Count > count) + { + lines.RemoveRange(count, lines.Count - count); + } + } +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 73846b6f..99a5a38b 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -258,6 +258,8 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! (SurfaceCatalog.Welcome, "welcome-connect"), (SurfaceCatalog.Help, "help"), (SurfaceCatalog.Dictionary, "dictionary-offer"), + (SurfaceCatalog.BrowseWorlds, "browse-worlds"), + (SurfaceCatalog.BrowseWorlds, "browse-worlds-failed"), (SurfaceCatalog.Import, "import-review"), (SurfaceCatalog.ScriptConsole, "script-console"), (SurfaceCatalog.Search, "search-older"), @@ -810,6 +812,25 @@ await SameModal("dictionary: download", "dictionary-offer", app => app.SimulateHelpKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); probed.Add(SurfaceCatalog.Dictionary); + // Browse worlds: a pick asks the demo's directory where the world is and opens the welcome's connect form filled + // in, saving nothing; a search none of the rows match asks the directory itself — the same in both hosts. + await SameModal("browse worlds: pick", "browse-worlds", + (app, m) => ((WorldBrowseSession)m.Open(SurfaceCatalog.BrowseWorlds)!).Pick(0), + app => app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false))); + await SameModal("browse worlds: ask the directory", "browse-worlds", + (app, m) => ((WorldBrowseSession)m.Open(SurfaceCatalog.BrowseWorlds)!).Ask("zork"), + app => + { + foreach (var c in "zork") + { + app.SimulateWorldBrowseKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + // None of the demo's most played hold the word, so the cells' Enter asks the directory rather than picking. + app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + probed.Add(SurfaceCatalog.BrowseWorlds); + // The import review: Import writes the same world, character and set as the cells' Enter; with the passwords // switched on first (the window's check box, the cells' p), the password is stored on the character in both. await SameModal("import: accept", "import-review", @@ -1122,6 +1143,7 @@ private static void HelpKeysTo(SharpMUTermApp app, Func match) WelcomeSession welcome => welcome.Model, HelpSession help => help.Model, DictionaryOfferSession offer => offer.Model, + WorldBrowseSession browse => browse.Model, ImportReviewSession import => import.Model, ScriptConsoleSession console => console.Model, ScrollbackViewSession history => history.Model, @@ -1146,6 +1168,8 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "layout=" + app.LiveLayoutId, "welcome=" + app.WelcomeIsOpen, "help=" + app.HelpIsOpen + "/" + app.DictionaryOfferOpen, + "browse=" + app.WorldBrowseOpen + " " + app.WorldBrowseModelNow.State + ":" + app.WorldBrowseModelNow.AskedFor + ":" + app.WorldBrowseModelNow.Rows.Count + + " " + (app.Welcome is { } w ? $"{w.InForm}:{w.Host}:{w.Port}:{w.Tls}:{w.WorldName}" : "none"), "import=" + app.ImportReviewOpen + " " + string.Join(",", app.Configuration.TriggerSets.Select(s => s.Name + ":" + s.Triggers.Count)) + " " + string.Join(",", app.Configuration.Worlds.SelectMany(w => w.Characters).Select(c => c.Name + (c.Password is null ? string.Empty : "*"))), "console=" + app.ScriptConsoleIsOpen + " " + ConsoleState(app), diff --git a/tests/SharpMUTerm.Client.Tests/WorldBrowseModelTests.cs b/tests/SharpMUTerm.Client.Tests/WorldBrowseModelTests.cs new file mode 100644 index 00000000..c91c2d96 --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/WorldBrowseModelTests.cs @@ -0,0 +1,104 @@ +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.WorldIndex; + +namespace SharpMUTerm.Client.Tests; + +/// Browse worlds' one model: what both hosts list for a query and an order, and what they say in place of rows. +public class WorldBrowseModelTests +{ + private static WorldListing Row(int n, string name, string codebase, int? players, WorldPlayerCount count = WorldPlayerCount.Measured, string tagline = "") => + new(new Guid(n, 0, 0, new byte[8]), name, tagline, codebase, players, players is null ? WorldPlayerCount.Unknown : count); + + private static readonly WorldListing[] Rows = + [ + Row(1, "Aetherfall", "PennMUSH", 64, tagline: "Sky islands"), + Row(2, "Hollow Crown", "TinyMUX", 33, WorldPlayerCount.Declared), + Row(3, "copperline", "Evennia", null), + ]; + + private static WorldBrowseModel Ready(int total = 3, string asked = "") => new(WorldBrowseState.Ready, Rows, total, asked, null, null); + + [Test] + public async Task ByPlayersKeepsTheDirectorysOrderAndByNameIsAlphabetical() + { + await Assert.That(string.Join("|", Ready().View("", WorldDirectorySort.Players).Select(r => r.Name))) + .IsEqualTo("Aetherfall|Hollow Crown|copperline"); + await Assert.That(string.Join("|", Ready().View(null, WorldDirectorySort.Name).Select(r => r.Name))) + .IsEqualTo("Aetherfall|copperline|Hollow Crown"); + } + + [Test] + public async Task EveryWordMustMatchANameCodebaseOrTagline() + { + await Assert.That(Ready().View("sky penn", WorldDirectorySort.Players).Single().Name).IsEqualTo("Aetherfall"); + await Assert.That(Ready().View("tinymux", WorldDirectorySort.Players).Single().Name).IsEqualTo("Hollow Crown"); + await Assert.That(Ready().View("sky mux", WorldDirectorySort.Players).Count).IsEqualTo(0); + } + + [Test] + public async Task PlayersMarkADeclaredCountAndDashAnUnknownOne() + { + await Assert.That(WorldBrowseModel.Players(Rows[0])).IsEqualTo("64"); + await Assert.That(WorldBrowseModel.Players(Rows[1])).IsEqualTo("~33"); + await Assert.That(WorldBrowseModel.Players(Rows[2])).IsEqualTo("–"); + await Assert.That(Ready().AnyDeclared).IsTrue(); + } + + [Test] + public async Task EnterAsksTheDirectoryOnlyWhenTheRowsHeldCannotAnswer() + { + await Assert.That(Ready().AsksDirectory("aether")).IsFalse().Because("a row matches; ⏎ picks it"); + await Assert.That(Ready().AsksDirectory("zork")).IsTrue(); + await Assert.That(Ready(asked: "zork").AsksDirectory("zork")).IsFalse().Because("the directory was asked that already and sent all it holds"); + await Assert.That(Ready(total: 400, asked: "zork").AsksDirectory("zork")).IsTrue(); + await Assert.That(Ready().AsksDirectory(" ")).IsFalse(); + await Assert.That((Ready() with { State = WorldBrowseState.Loading }).AsksDirectory("zork")).IsFalse(); + } + + [Test] + public async Task EachStateSaysWhatIsTrue() + { + var empty = new WorldBrowseModel(WorldBrowseState.Ready, [], 0, string.Empty, null, null); + await Assert.That(new WorldBrowseModel(WorldBrowseState.Loading, [], 0, "", null, null).Empty("")).IsEqualTo(WorldBrowseModel.LoadingLine); + await Assert.That(new WorldBrowseModel(WorldBrowseState.Failed, [], 0, "", "it timed out", null).Empty("")).IsEqualTo("mu*index did not answer: it timed out"); + await Assert.That(new WorldBrowseModel(WorldBrowseState.Unavailable, [], 0, "", "nothing was fetched", null).Empty("")).IsEqualTo("nothing was fetched"); + await Assert.That(empty.Empty("")).IsEqualTo("mu*index lists no worlds right now"); + await Assert.That((empty with { AskedFor = "zork" }).Empty("zork")).IsEqualTo("mu*index lists no world for “zork”"); + await Assert.That(Ready().Empty("zork")).Contains("⏎ asks mu*index for “zork”"); + await Assert.That(Ready(asked: "zork").Empty("zork")).IsEqualTo("nothing listed matches — ⌫ widens the search"); + await Assert.That(Ready().Empty("aether")).IsNull(); + } + + [Test] + public async Task TheCountSaysHowManyOfHowMany() + { + await Assert.That(Ready().CountLine("")).IsEqualTo("3 worlds"); + await Assert.That(Ready(total: 412).CountLine("")).IsEqualTo("3 of 412 worlds"); + await Assert.That(Ready().CountLine("aether")).IsEqualTo("1 of 3"); + } + + [Test] + public async Task TwoModelsOverEqualRowsAreEqual() + { + var copy = new WorldBrowseModel(WorldBrowseState.Ready, Rows.ToList(), 3, "", null, null); + await Assert.That(copy).IsEqualTo(Ready()); + await Assert.That(copy.GetHashCode()).IsEqualTo(Ready().GetHashCode()); + await Assert.That(copy with { Opening = "Aetherfall" }).IsNotEqualTo(Ready()); + } + + [Test] + public async Task ASessionPicksARowInRangeAndAsksOnlyWhatTheRowsCannotAnswer() + { + var picked = new List(); + var asked = new List(); + var session = new WorldBrowseSession(Ready(), true, picked.Add, asked.Add, () => { }); + + session.Pick(1); + session.Pick(9); + session.Ask("aether"); + session.Ask(" zork "); + + await Assert.That(string.Join(",", picked)).IsEqualTo("1"); + await Assert.That(string.Join(",", asked)).IsEqualTo("zork"); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/WorldIndex/WorldDirectoryTests.cs b/tests/SharpMUTerm.Core.Tests/WorldIndex/WorldDirectoryTests.cs new file mode 100644 index 00000000..4e13bea2 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/WorldIndex/WorldDirectoryTests.cs @@ -0,0 +1,155 @@ +using System.Text; +using SharpMUTerm.Core.WorldIndex; + +namespace SharpMUTerm.Core.Tests.WorldIndex; + +/// +/// mu*index's answers read as untrusted server text: rows bounded and cleaned, a bad row dropped and counted, an address +/// only what /connect would take. The fixtures are shaped from MUIndex's GameListView/GameView +/// (camelCase, enums as camelCase strings); the live service was not reachable when they were written. +/// +public class WorldDirectoryTests +{ + private const string Listing = """ + { + "games": [ + { "id": "6f1c2a52-0000-4000-8000-0c6a1f3d2e01", "name": "Aetherfall", "tagline": "Sky islands", + "state": "active", "archived": false, "playersNow": 64, "playersNowState": "measured", + "codebase": "PennMUSH", "measuredProtocols": ["gmcp", "mssp"], + "provenance": { "name": "crawler" }, "facets": { "genre": ["fantasy"] } }, + { "id": "6f1c2a52-0000-4000-8000-0c6a1f3d2e02", "name": "Hollow Crown", "tagline": "Courts", + "playersNow": 33, "playersNowState": "declared", "codebase": "TinyMUX" }, + { "id": "6f1c2a52-0000-4000-8000-0c6a1f3d2e03", "name": "Copperline", "playersNow": 12, "playersNowState": "unknown" }, + { "id": "6f1c2a52-0000-4000-8000-0c6a1f3d2e04", "name": "Gone Away", "archived": true }, + { "id": "", "name": "No id" }, + { "id": "6f1c2a52-0000-4000-8000-0c6a1f3d2e05", "name": " " }, + { "id": "6f1c2a52-0000-4000-8000-0c6a1f3d2e01", "name": "Aetherfall again" } + ], + "total": 412 + } + """; + + private static byte[] Bytes(string json) => Encoding.UTF8.GetBytes(json); + + [Test] + public async Task AListingIsReadAndItsBadRowsAreDroppedAndCounted() + { + var (page, problem) = WorldDirectory.ParseList(Bytes(Listing)); + + await Assert.That(problem).IsNull(); + await Assert.That(string.Join("|", page!.Rows.Select(r => r.Name))).IsEqualTo("Aetherfall|Hollow Crown|Copperline"); + await Assert.That(page.Dropped).IsEqualTo(4); + await Assert.That(page.Total).IsEqualTo(412); + await Assert.That(page.Rows[0].Players).IsEqualTo(64); + await Assert.That(page.Rows[0].Count).IsEqualTo(WorldPlayerCount.Measured); + await Assert.That(page.Rows[1].Count).IsEqualTo(WorldPlayerCount.Declared); + await Assert.That(page.Rows[2].Players).IsNull().Because("a number the directory does not say it measured is not shown"); + } + + [Test] + public async Task NamesAndTaglinesAreStrippedOfControlAndBidiCharactersAndBounded() + { + var json = "{\"games\":[{\"id\":\"6f1c2a52-0000-4000-8000-0c6a1f3d2e01\",\"name\":\"Evil\\u001b[31m\\u202eName\\n\",\"tagline\":\"" + + new string('x', 500) + "\"}]}"; + + var row = WorldDirectory.ParseList(Bytes(json)).Page!.Rows.Single(); + + await Assert.That(row.Name).IsEqualTo("Evil [31m Name"); + await Assert.That(row.Tagline.Length).IsEqualTo(WorldDirectory.MaxTagline); + await Assert.That(row.Tagline).EndsWith("…"); + } + + [Test] + public async Task NoMoreThanMaxRowsAreKept() + { + var rows = string.Join(',', Enumerable.Range(1, WorldDirectory.MaxRows + 5) + .Select(i => $"{{\"id\":\"{new Guid(i, 0, 0, new byte[8])}\",\"name\":\"W{i}\"}}")); + + var page = WorldDirectory.ParseList(Bytes("{\"games\":[" + rows + "]}")).Page!; + + await Assert.That(page.Rows.Count).IsEqualTo(WorldDirectory.MaxRows); + await Assert.That(page.Dropped).IsEqualTo(5); + } + + [Test] + public async Task AnAnswerThatIsNotAListSaysSo() + { + await Assert.That(WorldDirectory.ParseList(Bytes("not json")).Problem).IsEqualTo("the answer is not JSON the client can read"); + await Assert.That(WorldDirectory.ParseList(Bytes("[]")).Problem).IsEqualTo("the answer is not a list of worlds"); + } + + [Test] + public async Task TheAddressIsAnActiveTelnetOrTlsEndpointSeenMostRecently() + { + const string game = """ + { "id": "6f1c2a52-0000-4000-8000-0c6a1f3d2e01", "name": "Aetherfall", + "endpoints": [ + { "host": "old.example", "port": 4000, "kind": "telnet", "state": "gone", "lastSeenAt": "2026-10-30T00:00:00Z" }, + { "host": "ws.example", "port": 443, "kind": "websocket", "state": "active" }, + { "host": "stale.example", "port": 4000, "kind": "telnet", "state": "stale", "lastSeenAt": "2026-11-01T00:00:00Z" }, + { "host": "a.example", "port": 4201, "kind": "telnet", "state": "active", "lastSeenAt": "2026-10-01T00:00:00Z" }, + { "host": "b.example", "port": 4202, "kind": "tls", "state": "active", "lastSeenAt": "2026-11-02T00:00:00Z" } + ] } + """; + + var (address, problem) = WorldDirectory.ParseGame(Bytes(game)); + + await Assert.That(problem).IsNull(); + await Assert.That(address).IsEqualTo(new WorldAddress("Aetherfall", "b.example", 4202, true)); + } + + [Test] + public async Task AStaleEndpointIsOfferedWhenNoneIsActiveAndTlsMeasuredCounts() + { + const string game = """ + { "name": "Copperline", "endpoints": [ + { "host": "c.example", "port": 23, "kind": "telnet", "state": "stale", "tlsMeasured": true } ] } + """; + + await Assert.That(WorldDirectory.ParseGame(Bytes(game)).Address).IsEqualTo(new WorldAddress("Copperline", "c.example", 23, true)); + } + + [Test] + public async Task AHostOrPortConnectWouldRefuseIsNeverOffered() + { + const string game = """ + { "name": "Bad", "endpoints": [ + { "host": "evil host", "port": 4000, "kind": "telnet", "state": "active" }, + { "host": "ok.example", "port": 0, "kind": "telnet", "state": "active" }, + { "host": "ok.example", "port": 70000, "kind": "telnet", "state": "active" }, + { "host": "x.example", "port": 4000, "kind": "telnet", "state": "gone" } ] } + """; + + var (address, problem) = WorldDirectory.ParseGame(Bytes(game)); + + await Assert.That(address).IsNull(); + await Assert.That(problem).IsEqualTo("the directory lists no telnet address for it that answers"); + await Assert.That(WorldDirectory.ParseGame(Bytes("{\"name\":\"N\"}")).Problem).IsEqualTo("the directory lists no address for it"); + } + + [Test] + public async Task TheListIsAskedOverHttpsOnlyWithTheQueryEscaped() + { + var list = WorldDirectory.ListUri("https://mu-index.com/api/", "red & blue")!.AbsoluteUri; + await Assert.That(list).StartsWith("https://mu-index.com/api/games?limit=200&sort=players&q=red"); + await Assert.That(list).Contains("%26"); + await Assert.That(WorldDirectory.ListUri("http://mu-index.com/api")).IsNull(); + await Assert.That(WorldDirectory.ListUri("https://user@mu-index.com/api")).IsNull(); + await Assert.That(WorldDirectory.GameUri("https://mu-index.com/api", Guid.Parse("6f1c2a52-0000-4000-8000-0c6a1f3d2e01"))!.AbsoluteUri) + .IsEqualTo("https://mu-index.com/api/games/6f1c2a52-0000-4000-8000-0c6a1f3d2e01"); + } + + [Test] + public async Task ProblemNamesTheSettingWhenThereIsNoUsableDirectory() + { + await Assert.That(WorldDirectory.Problem(SharpMUTerm.Core.Configuration.AppConfiguration.DefaultWorldDirectoryUrl)).IsNull(); + await Assert.That(WorldDirectory.Problem("")).Contains("no world directory is set"); + await Assert.That(WorldDirectory.Problem("http://mu-index.com/api")).Contains("not an https link"); + } + + [Test] + public async Task ADownloadOfAPlainHttpLinkFetchesNothing() + { + await Assert.That(await WorldDirectory.DownloadAsync(new Uri("http://mu-index.com/api/games"), CancellationToken.None)).IsNull(); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs index 8fc7fa39..bc96d410 100644 --- a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs @@ -37,6 +37,9 @@ internal static readonly (string View, string[] OneRow)[] Footers = ("help", ["type to search", "Esc closes"]), ("help-topic", ["↑↓ PgUp PgDn scroll", "Esc back to the list"]), ("dictionary-offer", ["⏎ download", "Esc not now"]), + ("browse-worlds", ["↑↓ pick", "Esc closes"]), + ("browse-worlds-failed", ["↑↓ pick", "Esc closes"]), + ("browse-worlds-picked", ["↑↓ field", "Esc back"]), ("quit", ["⏎ stay", "Esc stays"]), ("search", ["↑↓ pick", "⌃F closes"]), ("history-search", ["type to filter", "⌃R closes"]), diff --git a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs index 03ea255c..d6f49f12 100644 --- a/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WelcomeTests.cs @@ -238,17 +238,17 @@ public async Task EscOnTheFormGoesBackToTheMenu() await Assert.That(run.App.Welcome!.InForm).IsFalse(); } - /// With no index to read, Browse says so where the player is looking and fetches nothing. + /// With no world directory to read, Browse says so where the player is looking and fetches nothing. [Test] public async Task BrowseWithNoIndexSaysSoInPlace() { - await using var run = await Start(new AppConfiguration { PackageIndexUrl = string.Empty }); + await using var run = await Start(new AppConfiguration { WorldDirectoryUrl = string.Empty }); run.App.SimulateWelcomeKey(Key(ConsoleKey.DownArrow)); run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); await Assert.That(run.App.WelcomeIsOpen).IsTrue(); - await Assert.That(string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain))).Contains("no package index is set"); + await Assert.That(string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain))).Contains("no world directory is set"); } [Test] diff --git a/tests/SharpMUTerm.Tui.Tests/WorldBrowseTests.cs b/tests/SharpMUTerm.Tui.Tests/WorldBrowseTests.cs new file mode 100644 index 00000000..0e3d691d --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/WorldBrowseTests.cs @@ -0,0 +1,250 @@ +using System.Text; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Accessibility; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Browse worlds: mu*index asked only when the player opens it, a pick that fills in the welcome's connect form and +/// saves nothing, and the player's own ⏎ there — through /connect's path — that adds the world. Answered from the +/// demo's recorded directory; nothing here reaches the network. +/// +[NotInParallel] +public class WorldBrowseTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class Recorder : IAnnouncer + { + public List Heard { get; } = []; + + public void Announce(string text, AnnouncementKind kind) => Heard.Add(text); + } + + private sealed record Run(SharpMUTermApp App, AppConfiguration Config, List Asked, List Saved) : IAsyncDisposable + { + public ValueTask DisposeAsync() => App.DisposeAsync(); + } + + private static async Task Start( + bool fetch = true, + Func? host = null, + Func? answer = null, + AppConfiguration? config = null) + { + Console.SetIn(TextReader.Null); + config ??= new AppConfiguration(); + var asked = new List(); + var saved = new List(); + var baseHost = ClientHost.ForHarness(Headless, new HeadlessConsoleDriver(120, 32), null, null, null); + Func>? worldFetch = fetch + ? (uri, _) => + { + asked.Add(uri); + return Task.FromResult(answer is null ? Encoding.UTF8.GetBytes(DemoWorldDirectory.Answer(uri)) : answer(uri)); + } + : null; + var app = new SharpMUTermApp(config, host?.Invoke(baseHost) ?? baseHost, save: _ => saved.Add(true), worldFetch: worldFetch); + app.TelnetFactory = _ => new RecordingTelnetSession(); + await app.StartAsync([]); + return new Run(app, config, asked, saved); + } + + private static ConsoleKeyInfo Key(ConsoleKey key, char c = '\0') => new(c, key, false, false, false); + + private static void TypeCommand(SharpMUTermApp app, string text) + { + foreach (var c in text) + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(Key(ConsoleKey.Enter, '\r')); + } + + private static void OpenFromTheWelcome(SharpMUTermApp app) + { + app.SimulateWelcomeKey(Key(ConsoleKey.DownArrow)); + app.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + } + + [Test] + public async Task NothingIsAskedAtStart() + { + await using var run = await Start(); + + await Assert.That(run.Asked.Count).IsEqualTo(0); + await Assert.That(run.App.WorldBrowseOpen).IsFalse(); + } + + [Test] + public async Task TheWelcomesBrowseRowOpensTheListFromTheDirectory() + { + await using var run = await Start(); + + OpenFromTheWelcome(run.App); + + await Assert.That(run.App.WorldBrowseOpen).IsTrue(); + await Assert.That(run.App.WelcomeIsOpen).IsFalse(); + await Assert.That(run.Asked.Single().AbsoluteUri).IsEqualTo("https://mu-index.com/api/games?limit=200&sort=players"); + var model = run.App.WorldBrowseModelNow; + await Assert.That(model.State).IsEqualTo(WorldBrowseState.Ready); + await Assert.That(model.Rows[0].Name).IsEqualTo("Aetherfall"); + } + + [Test] + public async Task ARunWithNoFetchSaysSoAndAsksNothing() + { + await using var run = await Start(fetch: false); + + OpenFromTheWelcome(run.App); + + await Assert.That(run.App.WorldBrowseOpen).IsTrue(); + await Assert.That(run.App.WorldBrowseModelNow.State).IsEqualTo(WorldBrowseState.Unavailable); + await Assert.That(run.App.WorldBrowseModelNow.Empty("")).Contains("nothing was fetched"); + } + + [Test] + public async Task ADirectoryThatDoesNotAnswerIsSaidHonestly() + { + await using var run = await Start(answer: _ => null); + + OpenFromTheWelcome(run.App); + + await Assert.That(run.App.WorldBrowseModelNow.State).IsEqualTo(WorldBrowseState.Failed); + await Assert.That(run.App.WorldBrowseModelNow.Empty("")).StartsWith("mu*index did not answer:"); + } + + /// A pick fills the welcome's form in and saves nothing; the player's ⏎ there adds the world, named as listed. + [Test] + public async Task APickFillsInTheConnectFormAndOnlyItsEnterAddsTheWorld() + { + await using var run = await Start(); + OpenFromTheWelcome(run.App); + + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.WorldBrowseOpen).IsFalse(); + var form = run.App.Welcome!; + await Assert.That(form.InForm).IsTrue(); + await Assert.That(form.Host).IsEqualTo("aetherfall.example"); + await Assert.That(form.Tls).IsTrue(); + await Assert.That(form.WorldName).IsEqualTo("Aetherfall"); + await Assert.That(run.Config.Worlds.Count).IsEqualTo(0).Because("nothing is saved before the form's ⏎"); + await Assert.That(run.Saved.Count).IsEqualTo(0); + await Assert.That(string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain))).Contains("as listed on mu*index"); + + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + await run.App.LastCommand; + + var world = run.Config.Worlds.Single(); + await Assert.That(world.Name).IsEqualTo("Aetherfall"); + await Assert.That(world.Host).IsEqualTo("aetherfall.example"); + await Assert.That(world.UseTls).IsTrue(); + } + + [Test] + public async Task ChangingTheHostDropsTheListedName() + { + await using var run = await Start(); + OpenFromTheWelcome(run.App); + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.DownArrow)); + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + await Assert.That(run.App.Welcome!.Host).IsEqualTo("lanternport.example"); + + // Back to the host field and a different host typed over the end of it. + run.App.SimulateWelcomeKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, true, false, false)); + run.App.SimulateWelcomeKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, true, false, false)); + run.App.SimulateWelcomeKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, true, false, false)); + run.App.SimulateWelcomeKey(new ConsoleKeyInfo('x', ConsoleKey.NoName, false, false, false)); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + await run.App.LastCommand; + + var world = run.Config.Worlds.Single(); + await Assert.That(world.Host).IsNotEqualTo("lanternport.example"); + await Assert.That(world.Name).IsNotEqualTo("Lanternport"); + } + + [Test] + public async Task APickTheDirectoryCannotPlaceStaysOnTheListAndSaysWhy() + { + await using var run = await Start(answer: uri => uri.AbsolutePath.EndsWith("/games", StringComparison.Ordinal) + ? Encoding.UTF8.GetBytes(DemoWorldDirectory.Answer(uri)) + : Encoding.UTF8.GetBytes("{\"name\":\"x\",\"endpoints\":[]}")); + OpenFromTheWelcome(run.App); + + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.WorldBrowseOpen).IsTrue(); + await Assert.That(run.App.WorldBrowseModelNow.Problem).IsEqualTo("Aetherfall not opened: the directory lists no telnet address for it that answers"); + await Assert.That(run.App.WorldBrowseModelNow.Opening).IsNull(); + } + + [Test] + public async Task EnterOnASearchTheRowsCannotAnswerAsksTheDirectory() + { + await using var run = await Start(); + OpenFromTheWelcome(run.App); + + foreach (var c in "zork") + { + run.App.SimulateWorldBrowseKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.Asked.Count).IsEqualTo(2); + await Assert.That(run.Asked[1].Query).Contains("q=zork"); + await Assert.That(run.App.WorldBrowseModelNow.AskedFor).IsEqualTo("zork"); + await Assert.That(run.App.WelcomeIsOpen).IsFalse().Because("no world was picked"); + } + + [Test] + public async Task TheCommandPaletteEntryOpensItAndAPackageBrowseIsUntouched() + { + await using var run = await Start(); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Escape, '\x1b')); + + await Assert.That(run.App.DispatchCommand(BuiltInCommands.BrowseWorldsCommand)).IsTrue(); + + await Assert.That(run.App.WorldBrowseOpen).IsTrue(); + await Assert.That(run.Asked.Count).IsEqualTo(1); + } + + [Test] + public async Task SlashBrowseWithWordsAsksTheDirectoryForThem() + { + await using var run = await Start(); + run.App.SimulateWelcomeKey(Key(ConsoleKey.Escape, '\x1b')); + + TypeCommand(run.App, "/browse harbour"); + + await Assert.That(run.App.WorldBrowseOpen).IsTrue(); + await Assert.That(run.Asked.Single().Query).Contains("q=harbour"); + await Assert.That(run.App.WorldBrowseModelNow.Rows.Single().Name).IsEqualTo("Lanternport"); + } + + /// --plain: the rows are said as numbered lines, and /browse 2 says the /connect line to type. + [Test] + public async Task WhereTheScreenIsNotSeenTheListIsLinesAndANumberSaysTheConnectLine() + { + var heard = new Recorder(); + await using var run = await Start(host: h => h with { Announcer = heard, ScreenIsSeen = false }); + + TypeCommand(run.App, "/browse"); + + await Assert.That(run.App.WorldBrowseOpen).IsFalse(); + await Assert.That(heard.Heard).Contains(WorldBrowseModel.AttributionLine); + await Assert.That(heard.Heard).Contains(line => line.StartsWith("2. Lanternport", StringComparison.Ordinal)); + + TypeCommand(run.App, "/browse 2"); + + await Assert.That(heard.Heard).Contains("To add it and connect, type: /connect lanternport.example 2860"); + await Assert.That(run.Config.Worlds.Count).IsEqualTo(0); + } +} From af87acb21b67dd16a1f67db6746b54b416ecd2d1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 16:27:04 +0000 Subject: [PATCH 060/113] feat(wave18b): history view fits 80x24, one count row in Ctrl+F, console errors link to their line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ScrollbackViewModel carries its page size (PageRowsFor the screen, 13 at 80x24), title and position on two rows below 100 columns, keys pinned with ListOverlay.Open(footer:). - Ctrl+F with Alt+H: one count row (this window 3 of 39 · older 4 of 6,000); older rows say how far back (1.6k lines ago), pane rows "here" (SearchModel.LabelFor, both hosts). - Script console error rows naming file.lua:(N,…) are client links (mux:script-error:N on the console's own handler; native rows via ScriptConsoleSession.OpenError) ending in OpenConsoleError, which opens the script at line N with ErrorLine set. Surface action declared and parity-probed. One demo error constant (DemoScriptError). - Cell console sized to what it holds at open, so no blank rows above the log. - Demo history stamped monotonically; FooterFitTests gains the four new views. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 + CLAUDE.md | 26 +++- src/SharpMUTerm.Avalonia/ScriptConsoleView.cs | 49 +++++- src/SharpMUTerm.Avalonia/ScrollbackView.cs | 2 +- src/SharpMUTerm.Avalonia/SearchView.cs | 7 +- .../Composer/ScriptErrors.cs | 29 ++++ .../Modals/ScriptConsoleModel.cs | 35 ++++- .../Modals/ScrollbackViewModel.cs | 62 ++++++-- src/SharpMUTerm.Client/Modals/SearchModel.cs | 83 +++++++++- .../Surfaces/SurfaceCatalog.cs | 4 + src/SharpMUTerm.Tui/ListOverlay.cs | 20 ++- src/SharpMUTerm.Tui/ScriptConsoleSurface.cs | 31 +++- src/SharpMUTerm.Tui/ScrollbackViewSurface.cs | 35 +++-- src/SharpMUTerm.Tui/SearchPrompt.cs | 20 +-- .../SharpMUTermApp.DeepSearch.cs | 70 ++++++--- .../SharpMUTermApp.ScriptConsole.cs | 80 +++++++++- .../SharpMUTermApp.ScriptEdit.cs | 15 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 2 +- .../SurfaceParityTests.cs | 15 ++ .../SearchAndScriptModelTests.cs | 72 ++++++++- .../SharpMUTerm.Tui.Tests/DeepSearchTests.cs | 5 +- tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs | 6 + .../SearchAndScriptWaveTests.cs | 2 +- .../SearchScriptsFitTests.cs | 142 ++++++++++++++++++ 24 files changed, 727 insertions(+), 92 deletions(-) create mode 100644 tests/SharpMUTerm.Tui.Tests/SearchScriptsFitTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index f43a0489..7f4006f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- A script error in the script console that names a file and line is now a link: click it to open that script with the + caret on the line and the line marked. Closing the editor goes back to the console. - The script editor numbers its lines in the desktop window too, and after a save whose reload fails, the line the error names is marked in both the terminal and the window. - When Ctrl+F finds fewer matches than it might because the pane no longer holds older lines, its status line offers @@ -345,6 +347,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The older-history page fits an 80×24 terminal: it sizes its page to the screen, keeps its keys on screen and no longer + covers the command line. +- Ctrl+F with older history says both counts on one line (`this window 3 of 39 · older 4 of 6,000`). Older matches say + how far back they are (`1.6k lines ago`) and the pane's own say `here`. +- The script console opens at the size of what it holds, so its log no longer starts under blank rows. - The settings screens' key hints no longer lose words from the middle at 80 columns: the least-used keys are left out and the way to close is always there. - Help topics have headings and show their keys as keys, in the terminal and the window, and a topic's title fits diff --git a/CLAUDE.md b/CLAUDE.md index 3b42af3f..4130b0ab 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -418,12 +418,18 @@ fallbacks) for inline images/maps. a session window has any: its session's `ScrollbackBuffer`, ring and spill, walked newest first in ranged reads of `MaxRangeLines` off the UI thread (inline headless, so frames are deterministic), cancelled by the next query or by closing, `OutputSearch.Match`'s timeout per line, at most 500 hits. Lines the pane still holds are skipped by - reference (a session window's `PaneLine.Source` is the ring's instance). Older rows list after the pane's, tagged - `older`; the note on the count row says the bound and the progress, and that captures keep no older history. ⏎ on - one goes to the pane if it holds the line, else opens the **history view**: a modal page of 20 lines, every move a - ranged read, never inserted into a pane buffer. ⌥G stays pane-only. It opens **centred on the hit** - (`ScrollbackViewModel.TopFor`, clamped at the ends), and `Role(line)` makes the `ContextRows` (3) either side context: - body ink behind a `│` in cells, a rule in the window; the rest of the page muted/dim. + reference (a session window's `PaneLine.Source` is the ring's instance). Older rows list after the pane's, their + window column saying how far back (`SearchModel.AgeLabel`: `1.6k lines ago` — the scrollback keeps no clock) and the + pane's rows `here` (`SearchModel.LabelFor`, both hosts). **Both counts are one row** (`CountText`: `this window 3 of 39 · + older 4 of 6,000`, `older 2… 1,200 of 6,000 read` while it reads; `OlderFound`/`OlderSearched`/`OlderTotal`); the note + says only what is not a count (an error, captures keep no older history). ⏎ on one goes to the pane if it holds the + line, else opens the **history view**: a modal page, every move a ranged read, never inserted into a pane buffer. ⌥G + stays pane-only. **The page size is the model's** (`ScrollbackViewModel.PageRows`, from `PageRowsFor(rows, columns)` at + open: the modal ends above the command line, 13 at 80×24, at most 20), title and position on two rows below 100 columns + (`TwoTitleRows`), keys pinned with `ListOverlay.Open(footer:)` (`KeysLadder`); the window reads the same page. It opens + **centred on the hit** (`TopFor(…, page)`, clamped at the ends), and `Role(line)` makes the `ContextRows` (3) either side + context: body ink behind a `│` in cells, a rule in the window; the rest of the page muted/dim. The demo's history is + stamped 18:00–22:59 and only moves forward (`DemoHistoryStamp`). - **⌥H is offered on the status line, not in a modal, only while the pane cap trimmed what ⌃F searched** (`SearchModel.OlderLines`/`OlderSource`/`OffersOlder`: a query, ⌥H off, and the session scrollback holding lines the pane does not). `OlderHintLadder` is four rungs, all starting `⌥H`; the cells take the longest that fits beside the count @@ -3164,6 +3170,14 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] The prompt exists only with a scripts root whose folder exists and a window with a character; otherwise the model's `Unavailable` says which. Every gesture ends in `RunConsoleLine`/`DeleteStoreKey`/`ReloadConsoleScripts` (surface `script-console`, parity-probed). The demo scene has its own sandbox (`_demoScripts`), so the snapshot's prompt runs. + - **An error row naming `file.lua:(N,…)` is a link to that line** (`ScriptConsoleModel.ErrorAt`, `ScriptErrors.At`): in + cells `[link=mux:script-error:N]`, N an index into the lines drawn, answered by the console's own `ListOverlay` link + handler (`Open(link:)`), never the panes'; in the window an underlined row (`ScriptConsoleSession.OpenError`). Both end + in `OpenConsoleError`: the file is matched against `ScriptFileRefs()`, the console closes, and `OpenScriptAt` (⌃P's + `Script …` path) opens it with the caret and `ErrorLine` on N; Esc returns to the console. The demo's error is one + constant, `DemoScriptError`, in the console and the `script-edit` header. + - **The cell console is sized to what it holds when it opens** (`ScriptConsoleSurface.RowsFor`, at least `MinBodyRows` + of log), so its log is not drawn under blank padding; then the size is fixed and the log scrolls, newest above the prompt. - **GMCP channels go to a window per channel through `SpawnLine`** (`ChannelCapture`, Core; `WorldDefinition.CaptureChannels`, F5 ▸ `channels`: off/copy/move, off by default). `Comm.Channel.Text`'s `channel` names the window (letters, digits, space, `-`, `_`, 24 at most); its `text` is parsed through `AnsiParser`. `move` diff --git a/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs b/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs index dd4d97fe..bdcb410d 100644 --- a/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs +++ b/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs @@ -197,8 +197,9 @@ private void Draw() _output.Children.Add(Line(_model.CanRun ? ScriptConsoleModel.Empty : _model.Unavailable ?? string.Empty, _colours.Dim, string.Empty)); } - foreach (var line in _model.Lines) + for (var i = 0; i < _model.Lines.Count; i++) { + var line = _model.Lines[i]; var colour = line.Kind switch { ScriptConsoleKind.Error => _colours.Warn, @@ -206,7 +207,10 @@ private void Draw() ScriptConsoleKind.Input or ScriptConsoleKind.Note => _colours.Dim, _ => _colours.Text, }; - _output.Children.Add(Line(line.Text, colour, ScriptConsoleModel.Mark(line.Kind))); + var index = i; + _output.Children.Add(_model.ErrorAt(i) is { } at + ? ErrorLink(line.Text, colour, at, () => OpenError(index)) + : Line(line.Text, colour, ScriptConsoleModel.Mark(line.Kind))); } _outputScroller.ScrollToEnd(); @@ -237,6 +241,47 @@ private void Draw() Highlight(); } + /// + /// A click on error row : the console closes and the client opens the script it names on its + /// line (), the cells' link. + /// + public void OpenError(int index) + { + if (_session.OpenError(index)) + { + _done(); + } + } + + /// An error row naming a script line: underlined, a hand under the pointer, and a click opens that line. + private Control ErrorLink(string text, Color colour, (string File, int Line) at, Action open) + { + var row = new DockPanel { Margin = new Thickness(0, 1), Background = Brushes.Transparent, Cursor = new Cursor(StandardCursorType.Hand) }; + var gutter = new TextBlock { Text = ScriptConsoleModel.Mark(ScriptConsoleKind.Error), Width = 18, FontFamily = _mono, Foreground = _colours.Brush(colour), FontSize = NativeTokens.Body }; + SetDock(gutter, Dock.Left); + row.Children.Add(gutter); + row.Children.Add(new TextBlock + { + Text = text, + FontFamily = _mono, + FontSize = NativeTokens.Body, + Foreground = _colours.Brush(colour), + TextWrapping = TextWrapping.Wrap, + TextDecorations = TextDecorations.Underline, + }); + ToolTip.SetTip(row, $"Open {at.File} at line {at.Line.ToString(System.Globalization.CultureInfo.InvariantCulture)}"); + global::Avalonia.Automation.AutomationProperties.SetName(row, text); + row.PointerPressed += (_, e) => + { + if (e.GetCurrentPoint(row).Properties.IsLeftButtonPressed) + { + e.Handled = true; + open(); + } + }; + return row; + } + private Control Line(string text, Color colour, string mark) { var row = new DockPanel { Margin = new Thickness(0, 1) }; diff --git a/src/SharpMUTerm.Avalonia/ScrollbackView.cs b/src/SharpMUTerm.Avalonia/ScrollbackView.cs index 075dce08..1aa248ce 100644 --- a/src/SharpMUTerm.Avalonia/ScrollbackView.cs +++ b/src/SharpMUTerm.Avalonia/ScrollbackView.cs @@ -122,7 +122,7 @@ private void Draw() }); } - for (var i = _model.Lines.Count; i < ScrollbackViewModel.PageRows; i++) + for (var i = _model.Lines.Count; i < _model.PageRows; i++) { _list.Children.Add(new TextBlock { Text = " ", FontFamily = mono, FontSize = NativeTokens.Body, Margin = new Thickness(12, 2) }); } diff --git a/src/SharpMUTerm.Avalonia/SearchView.cs b/src/SharpMUTerm.Avalonia/SearchView.cs index 8f04abbf..8cacff78 100644 --- a/src/SharpMUTerm.Avalonia/SearchView.cs +++ b/src/SharpMUTerm.Avalonia/SearchView.cs @@ -254,7 +254,7 @@ private void Draw() return; } - var labelled = _model.AllWindows || _model.Rows.Any(r => r.IsOlder); + var labelled = _model.Labelled; for (var i = 0; i < _model.Rows.Count; i++) { var row = _model.Rows[i]; @@ -262,8 +262,9 @@ private void Draw() var line = new DockPanel(); if (labelled) { - // The cells' window column: the window in ⌥A scope, and "older" on a row ⏎ opens in the history view. - var label = row.IsOlder ? (_model.AllWindows ? $"{row.WindowLabel} · older" : "older") : _model.AllWindows ? row.WindowLabel : string.Empty; + // The cells' window column (SearchModel.LabelFor): the window in ⌥A scope, how far back an older row is + // (⏎ opens it in the history view), and "here" on a row the pane holds. + var label = _model.LabelFor(row); var window = new TextBlock { Text = label, diff --git a/src/SharpMUTerm.Client/Composer/ScriptErrors.cs b/src/SharpMUTerm.Client/Composer/ScriptErrors.cs index 1058137e..766fc803 100644 --- a/src/SharpMUTerm.Client/Composer/ScriptErrors.cs +++ b/src/SharpMUTerm.Client/Composer/ScriptErrors.cs @@ -48,6 +48,35 @@ public static class ScriptErrors return null; } + /// + /// The first script file and line names (corvid.lua:(14,…) → corvid.lua, 14), or + /// null when it names none — what makes a console error row a link to its line. + /// + public static (string File, int Line)? At(string? text) + { + if (string.IsNullOrEmpty(text)) + { + return null; + } + + try + { + foreach (Match match in ErrorAt.Matches(text)) + { + if (int.TryParse(match.Groups["line"].Value, NumberStyles.None, CultureInfo.InvariantCulture, out var line) && line > 0) + { + return (match.Groups["file"].Value, line); + } + } + } + catch (RegexMatchTimeoutException) + { + return null; + } + + return null; + } + /// The line the newest of (oldest first) names in , or null. public static int? LineIn(IReadOnlyList errors, string name) { diff --git a/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs b/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs index 2d4fceb1..2db6c3c2 100644 --- a/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs +++ b/src/SharpMUTerm.Client/Modals/ScriptConsoleModel.cs @@ -89,6 +89,21 @@ Unavailable is not null (var n, _) => $"{n} files loaded", }; + /// + /// The scheme of a cell console error row's link: mux:script-error:N, N an index into . Answered by + /// the console's own control (never the output panes' handler), and only for a row this model says names a line. + /// + public const string ErrorLinkPrefix = "mux:script-error:"; + + /// + /// The script file and line console line names, when it is an error that names one + /// () — such a row is a link that opens that script on that line — else null. + /// + public (string File, int Line)? ErrorAt(int index) => + index >= 0 && index < Lines.Count && Lines[index].Kind == ScriptConsoleKind.Error + ? Composer.ScriptErrors.At(Lines[index].Text) + : null; + /// A console line's mark, the same in both hosts. public static string Mark(ScriptConsoleKind kind) => kind switch { @@ -212,6 +227,7 @@ public sealed class ScriptConsoleSession : ModalSession private readonly Action _delete; private readonly Action _reload; private readonly Action? _edit; + private readonly Action? _openError; /// What the console shows. /// Whether the client's theme is a dark one. @@ -220,6 +236,10 @@ public sealed class ScriptConsoleSession : ModalSession /// Reloads the character's scripts (ReloadConsoleScripts). /// Told the console closed. /// Opens the list of the character's script files to edit (EditScriptFromConsole); null for none. + /// + /// Opens the script an error row names on its line (OpenConsoleError), handed the model the row was drawn from + /// and its index; null for none. + /// public ScriptConsoleSession( ScriptConsoleModel model, bool isDark, @@ -227,7 +247,8 @@ public ScriptConsoleSession( Action delete, Action reload, Action closed, - Action? edit = null) + Action? edit = null, + Action? openError = null) : base(model, isDark, closed) { ArgumentNullException.ThrowIfNull(run); @@ -237,6 +258,18 @@ public ScriptConsoleSession( _delete = delete; _reload = reload; _edit = edit; + _openError = openError; + } + + /// + /// The host's: a click on console line , an error naming file.lua:(N,…). Closes the + /// console first; the client opens that script with the caret on line N and the line marked. False for a line that + /// names none. + /// + public bool OpenError(int index) + { + var model = Model; + return _openError is not null && !IsEnded && model.ErrorAt(index) is not null && CloseThen(() => _openError(model, index)); } /// Whether the console can open a script to edit. diff --git a/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs b/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs index 8c28560b..41e7865f 100644 --- a/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs +++ b/src/SharpMUTerm.Client/Modals/ScrollbackViewModel.cs @@ -38,6 +38,10 @@ public enum ScrollbackLineRole /// One past the newest line. /// The line the search found. /// The page, oldest first, at most . +/// +/// The lines a page holds: the screen the client draws on, so the cell view fits an 80×24 +/// terminal with its keys on screen. The window's view reads the same number, so both hosts show the same page. +/// public sealed record ScrollbackViewModel( string Window, string Query, @@ -45,10 +49,38 @@ public sealed record ScrollbackViewModel( long Oldest, long End, long Marked, - IReadOnlyList Lines) + IReadOnlyList Lines, + int PageRows = ScrollbackViewModel.MaxPageRows) { - /// The lines a page holds, the same in both hosts. - public const int PageRows = 20; + /// The most lines a page holds, on a screen with room for more. + public const int MaxPageRows = 20; + + /// The fewest lines a page holds, however small the screen. + public const int MinPageRows = 5; + + /// Below this many columns the title and the position take a row each (). + public const int WideColumns = 100; + + /// + /// The page a screen of × cells has room for: the view is a modal + /// centred on the screen that must end above the command line and the status row, so it is at most rows − 4 + /// tall; less its frame (2), its title (one row, two below ), the blank under it, the blank + /// above the keys and the keys (3). Between and ; 13 at 80×24. + /// + public static int PageRowsFor(int rows, int columns) => + Math.Clamp(rows - 4 - 2 - (TwoTitleRows(columns) ? 2 : 1) - 3, MinPageRows, MaxPageRows); + + /// Whether a screen wide puts the title and the position on a row each. + public static bool TwoTitleRows(int columns) => columns < WideColumns; + + /// The keys as a ladder, longest first, for a key row too narrow for all of them; every rung keeps Esc. + public static IReadOnlyList KeysLadder { get; } = + [ + Keys, + "↑↓ line · PgUp PgDn page · Home End ends · Esc closes", + "↑↓ PgUp PgDn Home End · Esc closes", + "↑↓ · Esc closes", + ]; /// How many lines either side of the found line are its context. public const int ContextRows = 3; @@ -78,10 +110,10 @@ public string Position public string Title => $"OLDER HISTORY · {Window} · read only"; /// - /// The top that shows in the middle of a page — / 2 lines above it, the - /// rest below — clamped to what is held, so a hit near either end sits as near the middle as the history allows. + /// The top that shows in the middle of a page of lines — half of them + /// above it, the rest below — clamped to what is held, so a hit near either end sits as near the middle as the history allows. /// - public static long TopFor(long marked, long oldest, long end) => Clamp(marked - PageRows / 2, oldest, end); + public static long TopFor(long marked, long oldest, long end, int page = MaxPageRows) => Clamp(marked - page / 2, oldest, end, page); /// What a line of the page is to the hit: the hit itself, its context ( either side), or the rest. public ScrollbackLineRole Role(ScrollbackViewLine line) => @@ -89,18 +121,18 @@ public ScrollbackLineRole Role(ScrollbackViewLine line) => : Math.Abs(line.Index - Marked) <= ContextRows ? ScrollbackLineRole.Context : ScrollbackLineRole.Page; - /// kept to a page that starts at or after the oldest line and ends at or before the newest. - public static long Clamp(long top, long oldest, long end) => Math.Max(oldest, Math.Min(top, Math.Max(oldest, end - PageRows))); + /// kept to a page of lines that starts at or after the oldest line and ends at or before the newest. + public static long Clamp(long top, long oldest, long end, int page = MaxPageRows) => Math.Max(oldest, Math.Min(top, Math.Max(oldest, end - page))); /// The top a key moves to: ↑↓ a line, PgUp PgDn a page, Home End the ends; null for a key that does not move. public long? Move(ConsoleKey key) => key switch { - ConsoleKey.UpArrow => Clamp(Top - 1, Oldest, End), - ConsoleKey.DownArrow => Clamp(Top + 1, Oldest, End), - ConsoleKey.PageUp => Clamp(Top - (PageRows - 1), Oldest, End), - ConsoleKey.PageDown => Clamp(Top + (PageRows - 1), Oldest, End), + ConsoleKey.UpArrow => Clamp(Top - 1, Oldest, End, PageRows), + ConsoleKey.DownArrow => Clamp(Top + 1, Oldest, End, PageRows), + ConsoleKey.PageUp => Clamp(Top - (PageRows - 1), Oldest, End, PageRows), + ConsoleKey.PageDown => Clamp(Top + (PageRows - 1), Oldest, End, PageRows), ConsoleKey.Home => Oldest, - ConsoleKey.End => Clamp(End, Oldest, End), + ConsoleKey.End => Clamp(End, Oldest, End, PageRows), _ => null, }; @@ -109,9 +141,9 @@ public ScrollbackLineRole Role(ScrollbackViewLine line) => public bool Equals(ScrollbackViewModel? other) => other is not null && Window == other.Window && Query == other.Query && Top == other.Top && Oldest == other.Oldest - && End == other.End && Marked == other.Marked && ModelLists.Same(Lines, other.Lines); + && End == other.End && Marked == other.Marked && PageRows == other.PageRows && ModelLists.Same(Lines, other.Lines); - public override int GetHashCode() => HashCode.Combine(Window, Query, Top, Oldest, End, Marked, ModelLists.Hash(Lines)); + public override int GetHashCode() => HashCode.Combine(Window, Query, Top, Oldest, End, Marked, PageRows, ModelLists.Hash(Lines)); } /// diff --git a/src/SharpMUTerm.Client/Modals/SearchModel.cs b/src/SharpMUTerm.Client/Modals/SearchModel.cs index 80a12843..4745e675 100644 --- a/src/SharpMUTerm.Client/Modals/SearchModel.cs +++ b/src/SharpMUTerm.Client/Modals/SearchModel.cs @@ -9,10 +9,18 @@ namespace SharpMUTerm.Client.Modals; /// /// A row from older history (⌥H) has at the line's absolute index in its session's scrollback and /// −1: it is not in the pane buffer, so ⏎ opens it in the read-only history view (or scrolls the -/// pane to it when the pane still holds it). +/// pane to it when the pane still holds it). Its says how far back it is (). /// public readonly record struct SearchRow( - string WindowId, string WindowLabel, int LineIndex, string Text, int MatchStart, int MatchLength, long History = -1, string? SessionKey = null) + string WindowId, + string WindowLabel, + int LineIndex, + string Text, + int MatchStart, + int MatchLength, + long History = -1, + string? SessionKey = null, + string? Age = null) { /// Whether this row came from older history rather than the pane buffer. public bool IsOlder => History >= 0; @@ -118,19 +126,83 @@ public IReadOnlyList OlderHintLadder /// How many rows are the pane buffer's (the rest are older history's, listed after them). public int HeldRows => Rows.Count(r => !r.IsOlder); + /// How many older-history lines matched so far (⌥H): set by the client as the search streams in. + public int OlderFound { get; init; } + + /// How many older-history lines have been read so far. + public long OlderSearched { get; init; } + + /// How many lines the older-history search covers in all. + public long OlderTotal { get; init; } + + /// Whether older history found more than the rows it lists. + public bool OlderCapped { get; init; } + /// - /// How many lines matched out of how many were looked at — 12 found · 4,812 lines held — so a reader who - /// cannot find an old line sees the bound rather than concluding the search is broken. + /// How many lines matched out of how many were looked at, on one row — 12 found · 4,812 lines held, and with + /// older history (⌥H) both bounds side by side: this window 3 of 39 · older 4 of 6,000 (while it reads, + /// older 2… 1,200 of 6,000 read) — so a reader who cannot find an old line sees the bound rather than concluding + /// the search is broken, and never two counts competing for the same row. /// public string CountText { get { var searched = $"{Held:n0} line{(Held == 1 ? string.Empty : "s")} held"; - return Error is not null ? searched : $"{HeldRows} found · {searched}"; + if (Error is not null) + { + return searched; + } + + if (!Older || OlderTotal <= 0) + { + return $"{HeldRows} found · {searched}"; + } + + var here = $"{(AllWindows ? "these windows" : "this window")} {HeldRows} of {Held:n0}"; + var older = HistoryRunning + ? $"older {OlderFound}… {OlderSearched:n0} of {OlderTotal:n0} read" + : $"older {OlderFound}{(OlderCapped ? "+" : string.Empty)} of {OlderTotal:n0}"; + return $"{here} · {older}"; } } + /// + /// What a row's window column says, in both hosts: the window's name in ⌥A scope; on an older-history row how far back + /// it is (); and here on a row the pane holds once older rows are listed beside it. + /// + public string LabelFor(SearchRow row) + { + if (row.IsOlder) + { + var age = row.Age ?? "older"; + return AllWindows ? $"{row.WindowLabel} · {age}" : age; + } + + var olderListed = Rows.Any(r => r.IsOlder); + return AllWindows ? (olderListed ? $"{row.WindowLabel} · here" : row.WindowLabel) : olderListed ? "here" : string.Empty; + } + + /// Whether the rows carry a window column at all: in ⌥A scope, or once older history lists a row. + public bool Labelled => AllWindows || Rows.Any(r => r.IsOlder); + + /// + /// How far back an older-history line is, from how many lines arrived after it: 40 lines ago, 1.6k lines ago. + /// The scrollback keeps no clock, so the age is in lines — the unit the history view's position says too. + /// + public static string AgeLabel(long linesAfter) + { + linesAfter = Math.Max(0, linesAfter); + return linesAfter switch + { + 0 => "the newest", + 1 => "1 line ago", + < 1_000 => $"{linesAfter} lines ago", + < 100_000 => (linesAfter / 1000.0).ToString("0.#", CultureInfo.InvariantCulture) + "k lines ago", + _ => (linesAfter / 1000).ToString(CultureInfo.InvariantCulture) + "k lines ago", + }; + } + /// What the list says when it lists nothing, or null when it lists something. public string? EmptyText => Error is not null ? Error @@ -145,6 +217,7 @@ other is not null && Scope == other.Scope && Held == other.Held && Error == other.Error && Older == other.Older && HistoryNote == other.HistoryNote && HistoryRunning == other.HistoryRunning && OlderLines == other.OlderLines && OlderSource == other.OlderSource + && OlderFound == other.OlderFound && OlderSearched == other.OlderSearched && OlderTotal == other.OlderTotal && OlderCapped == other.OlderCapped && ModelLists.Same(Rows, other.Rows); public override int GetHashCode() => HashCode.Combine(Query, Regex, AllWindows, Scope, Held, Error, ModelLists.Hash(Rows)); diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 791387a4..fe927eeb 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -534,6 +534,10 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), // ⌃E (the window's Edit a script… button): the console closes and the palette lists the script files. new(SurfaceActionKind.Modal, "edit a script", "EditScriptFromConsole"), + + // A click on an error row naming file.lua:(N,…) (the cells' mux:script-error:N link, the console's own): the + // console closes and that script opens in the editor with the caret on line N and the line marked. + new(SurfaceActionKind.Modal, "open an error's line", "OpenConsoleError"), ], NativeModal, "SharpMUTerm.Tui.ScriptConsoleSurface.Render", diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index 4285ee3f..d6e3d960 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -25,6 +25,7 @@ internal sealed class ListOverlay private Func? _key; private Func? _escape; private Action? _closed; + private Action? _link; private ScreenTheme _scheme; @@ -68,6 +69,10 @@ public ListOverlay(ConsoleWindowSystem system, ScreenTheme? scheme = null) /// scrolled away (the import review at 80×24 lost both). Each row is one line, never wrapped: fit it to the width. /// /// Whether ↑↓ PgUp PgDn Home End scroll the body before the key handler sees them. + /// + /// Told the target of a [link=…] clicked in the body: this surface's own handler, never the output panes' + /// (whose links are scheme-tagged server text). With none, a link in the body does nothing. + /// public void Open( string mode, string title, @@ -77,13 +82,15 @@ public void Open( Func? escape = null, Action? closed = null, Func>? footer = null, - bool scrollKeys = false) + bool scrollKeys = false, + Action? link = null) { if (_window is not null) { Close(); } + _link = link; _render = render; _key = key; _escape = escape; @@ -97,6 +104,7 @@ public void Open( var footerLines = footer?.Invoke(outer - 4) ?? []; var height = Math.Clamp(Rows(lines, outer - 3) + footerLines.Count + 2, 8, Math.Max(8, desktop.Height - 2)); _content = new MarkupControl(_scheme.Lines(lines, ScreenPalette.MenuBg)); + _content.LinkClicked += (_, e) => _link?.Invoke(e.Url); IWindowControl body = _content; if (footer is not null) { @@ -190,6 +198,15 @@ public void Repaint() internal void SimulateKey(ConsoleKeyInfo key) => OnKey(this, new KeyPressedEventArgs(key, false)); + /// A click on a body link with target , for a test (the surface's own handler, as a click). + internal void SimulateLink(string url) + { + if (_window is not null) + { + _link?.Invoke(url); + } + } + public void Close() { if (_window is { } window) @@ -278,6 +295,7 @@ private void Reset() _body = null; _footer = null; _scrollKeys = false; + _link = null; _render = null; _key = null; _escape = null; diff --git a/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs b/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs index 7bacd41a..fd7195ad 100644 --- a/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs +++ b/src/SharpMUTerm.Tui/ScriptConsoleSurface.cs @@ -140,6 +140,25 @@ public void Clamp() } } + /// The fewest log rows the console opens with, so a short log still leaves room for the next few lines. + internal const int MinBodyRows = 6; + + /// + /// The rows the console asks for at : what its log and store hold when it opens (at least + /// of body), up to . Sized to what it holds, so the log is not drawn + /// under rows of blank padding; once open the overlay keeps its size and the log scrolls, newest above the prompt. + /// + internal static int RowsFor(ScriptConsoleModel model, int width, int maxRows) + { + width = Math.Max(30, width); + var two = width >= TwoColumns; + var storeWidth = two ? Math.Clamp(width / 3, 26, 40) : width; + var outWidth = two ? width - storeWidth - 3 : width; + var log = model.Lines.Sum(l => HelpSurface.Wrap(l.Text, Math.Max(4, outWidth - 2)).Count()); + var store = two ? 1 + Math.Max(1, model.Store.Count) + (model.StoreCount > model.Store.Count ? 1 : 0) : 0; + return Math.Clamp(5 + Math.Max(Math.Max(log, store), MinBodyRows), 8, Math.Max(8, maxRows)); + } + /// What the console draws now. public List Render(int width, int rows) => Render(Model, Input, OnStore, StoreSelected, width, rows); @@ -217,9 +236,16 @@ internal static IReadOnlyList FooterKeys(bool onStore) => onStore private static List OutputRows(ScriptConsoleModel model, int width, int rows) { var wrapped = new List(); - foreach (var line in model.Lines) + for (var index = 0; index < model.Lines.Count; index++) { + var line = model.Lines[index]; var mark = ScriptConsoleModel.Mark(line.Kind); + + // An error naming file.lua:(N,…) is a link to that line: the console's own link, an index into these lines, + // answered by the console control and never by the output panes' handler. + var link = model.ErrorAt(index) is not null + ? ScriptConsoleModel.ErrorLinkPrefix + index.ToString(System.Globalization.CultureInfo.InvariantCulture) + : null; var colour = line.Kind switch { ScriptConsoleKind.Error => ScreenPalette.Warn, @@ -231,7 +257,8 @@ private static List OutputRows(ScriptConsoleModel model, int width, int var first = true; foreach (var part in HelpSurface.Wrap(line.Text, Math.Max(4, width - 2))) { - wrapped.Add($"[{colour}]{(first ? mark : " ")} {Escape(part)}[/]"); + var row = $"[{colour}]{(first ? mark : " ")} {Escape(part)}[/]"; + wrapped.Add(link is null ? row : $"[link={link}]{row}[/]"); first = false; } } diff --git a/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs b/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs index 770d0260..2ee1a9f7 100644 --- a/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs +++ b/src/SharpMUTerm.Tui/ScrollbackViewSurface.cs @@ -9,33 +9,48 @@ namespace SharpMUTerm.Tui; /// search found, centred: that line on the accent band, its context ( either side) /// in the body ink behind a │, the rest of the page muted, and the query's run in every line in bold accent. Pure: the page is the /// the window's native view draws too, and every move is the client's ranged read. -/// Always rows of page, so the overlay sized once at open keeps fitting. +/// Always the model's rows of page — sized from the screen, so the overlay sized +/// once at open keeps fitting, at 80×24 too — and the keys are pinned under the body (), never scrolled. /// internal static class ScrollbackViewSurface { /// The width the view asks for; the overlay narrows it on a small terminal. internal const int PreferredWidth = 110; - /// The view's lines at : title, position, a blank, the page, a blank, the keys. - internal static List Render(ScrollbackViewModel model, int width) + /// + /// The view's body at : the title and the position (one row, or a row each with + /// , below ), a blank, and the page. + /// + internal static List Render(ScrollbackViewModel model, int width, bool twoTitleRows = false) { width = Math.Max(20, width); - var lines = new List + var lines = new List(); + if (twoTitleRows) { - SpreadLR($"[{Label}]{Escape(model.Title)}[/]", $"[{Muted}]{Escape(model.Position)}[/]", width), - string.Empty, - }; + lines.Add($"[{Label}]{Escape(ElidePlain(model.Title, width))}[/]"); + lines.Add($"[{Muted}]{Escape(ElidePlain(model.Position, width))}[/]"); + } + else + { + lines.Add(SpreadLR($"[{Label}]{Escape(model.Title)}[/]", $"[{Muted}]{Escape(model.Position)}[/]", width)); + } - for (var i = 0; i < ScrollbackViewModel.PageRows; i++) + lines.Add(string.Empty); + for (var i = 0; i < model.PageRows; i++) { lines.Add(i < model.Lines.Count ? Row(model.Lines[i], model.Role(model.Lines[i]), width) : string.Empty); } - lines.Add(string.Empty); - lines.Add($"[{Label}]{Escape(ElidePlain(ScrollbackViewModel.Keys, width))}[/]"); return lines; } + /// The pinned key row at : a blank, then the longest rung of the keys that fits. + internal static List Footer(int width) + { + var keys = ScrollbackViewModel.KeysLadder.FirstOrDefault(k => k.Length <= width) ?? ScrollbackViewModel.KeysLadder[^1]; + return [string.Empty, $"[{Label}]{Escape(keys)}[/]"]; + } + private static string Row(ScrollbackViewLine line, ScrollbackLineRole role, int width) { var text = ElidePlain(line.Text.Replace('\t', ' '), width - 2); diff --git a/src/SharpMUTerm.Tui/SearchPrompt.cs b/src/SharpMUTerm.Tui/SearchPrompt.cs index de4fe733..071fa3d9 100644 --- a/src/SharpMUTerm.Tui/SearchPrompt.cs +++ b/src/SharpMUTerm.Tui/SearchPrompt.cs @@ -214,10 +214,8 @@ internal static List Render(SearchModel model, int selected, int width = ArgumentNullException.ThrowIfNull(model); var rows = model.Rows; var query = model.Query; - var all = model.AllWindows; - - var labelWidth = all || rows.Any(r => r.IsOlder) - ? Math.Min(MaxLabelWidth, rows.Select(r => RowLabel(r, all).Length).DefaultIfEmpty(0).Max()) + var labelWidth = model.Labelled + ? Math.Min(MaxLabelWidth, rows.Select(r => model.LabelFor(r).Length).DefaultIfEmpty(0).Max()) : 0; var entryWidth = (width > 0 ? width : DefaultEntryWidth) - 4 - (labelWidth > 0 ? labelWidth + 2 : 0); @@ -237,7 +235,7 @@ internal static List Render(SearchModel model, int selected, int width = var last = listRows > 0 ? Math.Min(rows.Count, top + listRows - body.Count) : rows.Count; for (var i = top; i < last; i++) { - body.Add(Row(rows[i], i == selected, entryWidth, labelWidth, width, all)); + body.Add(Row(rows[i], model.LabelFor(rows[i]), i == selected, entryWidth, labelWidth, width)); } while (body.Count < listRows) @@ -296,16 +294,14 @@ private static string QueryMarkup(string query) => : $"[{Value}]{Escape(query)}[/][{Ink} on {Accent}] [/]"; /// - /// What a row's window column says: the window's name in ⌥A scope, and older on a row from older history — the - /// only place a reader can tell a line the pane holds from one ⏎ will open in the history view. + /// One row. is the window column (): the window's name in + /// ⌥A scope, how far back an older-history row is and here beside it — the only place a reader can tell a line the + /// pane holds from one ⏎ will open in the history view. /// - private static string RowLabel(SearchRow row, bool all) => - row.IsOlder ? (all ? $"{row.WindowLabel} · older" : "older") : all ? row.WindowLabel : string.Empty; - - private static string Row(SearchRow row, bool selected, int entryWidth, int labelWidth, int width, bool all) + private static string Row(SearchRow row, string rowLabel, bool selected, int entryWidth, int labelWidth, int width) { var (text, matchStart, matchLength) = Elide(row, entryWidth); - var label = labelWidth > 0 ? LabelCell(RowLabel(row, all), labelWidth) : string.Empty; + var label = labelWidth > 0 ? LabelCell(rowLabel, labelWidth) : string.Empty; if (selected) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs index b06da0c4..838e6de7 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.DeepSearch.cs @@ -68,10 +68,13 @@ private sealed class DeepSearch(string key, IReadOnlyList sources } /// The history view: whose scrollback, the search it came from, the line it found, and where the page starts. - private sealed class HistoryViewState(HistorySource source, string query, bool regex, long marked) + private sealed class HistoryViewState(HistorySource source, string query, bool regex, long marked, int pageRows) { public HistorySource Source { get; } = source; + /// The lines a page holds, from the screen when the view opened (). + public int PageRows { get; } = pageRows; + public string Query { get; } = query; public bool Regex { get; } = regex; @@ -155,17 +158,26 @@ internal SearchModel SearchModelFor(string query, bool regex, bool all, bool old break; } - rows.Add(new SearchRow(source.WindowId, source.Label, -1, match.Line.Text, match.MatchStart, match.MatchLength, match.Index, source.SessionKey)); + var age = SearchModel.AgeLabel(source.Buffer.TotalLines - 1 - match.Index); + rows.Add(new SearchRow(source.WindowId, source.Label, -1, match.Line.Text, match.MatchStart, match.MatchLength, match.Index, source.SessionKey, age)); found++; } } - var said = error is not null - ? $"older history: {error}" - : deep.Running - ? $"searching older history · {N(searched)} of {N(deep.Total)} lines…" - : $"older history · {found} found in {N(deep.Total)} lines{(capped ? $" · the first {ScrollbackSearch.MaxHits}" : string.Empty)}"; - return held with { Rows = rows, Older = true, HistoryNote = said + spill, HistoryRunning = deep.Running && error is null }; + // The counts are one row (SearchModel.CountText: "this window 3 of 39 · older 4 of 6,000"); the note says only what + // is not a count — an error, or that a capture keeps no older history. + var said = error is not null ? $"older history: {error}{spill}" : spill.Length > 0 ? spill.TrimStart(' ', '·') : null; + return held with + { + Rows = rows, + Older = true, + HistoryNote = said, + HistoryRunning = deep.Running && error is null, + OlderFound = found, + OlderSearched = searched, + OlderTotal = deep.Total, + OlderCapped = capped, + }; } /// @@ -362,9 +374,13 @@ private void OpenHistoryView(HistorySource source, string query, bool regex, lon return; } - var view = new HistoryViewState(source, query, regex, marked); + // The page is sized from the screen, so the cell view (a modal centred on it) ends above the command line with its + // keys on screen at 80×24; the window's view reads the same model and so shows the same page. + var screen = _system.DesktopDimensions; + var twoTitleRows = ScrollbackViewModel.TwoTitleRows(screen.Width); + var view = new HistoryViewState(source, query, regex, marked, ScrollbackViewModel.PageRowsFor(screen.Height, screen.Width)); _historyView = view; - view.Top = ScrollbackViewModel.TopFor(marked, source.Buffer.OldestIndex, source.Buffer.TotalLines); + view.Top = ScrollbackViewModel.TopFor(marked, source.Buffer.OldestIndex, source.Buffer.TotalLines, view.PageRows); view.Model = HistoryPage(view); if (NativeModalsHost is { } host) { @@ -396,7 +412,7 @@ private void OpenHistoryView(HistorySource source, string query, bool regex, lon { var model = view.Model!; Drawing(SurfaceCatalog.HistoryView, string.Empty, model); - return ScrollbackViewSurface.Render(model, width); + return ScrollbackViewSurface.Render(model, width, twoTitleRows); }, key => { @@ -414,7 +430,8 @@ private void OpenHistoryView(HistorySource source, string query, bool regex, lon { _historyView = null; } - }); + }, + footer: ScrollbackViewSurface.Footer); } /// @@ -428,7 +445,7 @@ internal void ScrollHistoryView(long top) return; } - view.Top = ScrollbackViewModel.Clamp(top, view.Source.Buffer.OldestIndex, view.Source.Buffer.TotalLines); + view.Top = ScrollbackViewModel.Clamp(top, view.Source.Buffer.OldestIndex, view.Source.Buffer.TotalLines, view.PageRows); view.Model = HistoryPage(view); if (view.Native is { } native) { @@ -445,8 +462,8 @@ private static ScrollbackViewModel HistoryPage(HistoryViewState view) var buffer = view.Source.Buffer; var oldest = buffer.OldestIndex; var end = buffer.TotalLines; - var top = ScrollbackViewModel.Clamp(view.Top, oldest, end); - var lines = buffer.GetRange(top, ScrollbackViewModel.PageRows); + var top = ScrollbackViewModel.Clamp(view.Top, oldest, end, view.PageRows); + var lines = buffer.GetRange(top, view.PageRows); var first = Math.Max(top, oldest); var texts = lines.Select(l => l.Text).ToArray(); var matches = OutputSearch.Match(texts, view.Query, view.Regex).Matches.ToDictionary(m => m.LineIndex); @@ -457,14 +474,27 @@ private static ScrollbackViewModel HistoryPage(HistoryViewState view) page.Add(new ScrollbackViewLine(first + i, texts[i], matches.ContainsKey(i) ? hit.MatchStart : -1, matches.ContainsKey(i) ? hit.MatchLength : 0)); } - return new ScrollbackViewModel(view.Source.Label, view.Query, top, oldest, end, view.Marked, page); + return new ScrollbackViewModel(view.Source.Label, view.Query, top, oldest, end, view.Marked, page, view.PageRows); + } + + /// How many lines the demo's older history holds. + private const int DemoHistoryLines = 6_000; + + /// + /// The clock stamp of the demo's history line : 18:00 to 22:59 over the evening, never going + /// back, so every line — the goblin's included — reads like its neighbours. + /// + internal static string DemoHistoryStamp(int index) + { + var minutes = 18 * 60 + (index * 300 / DemoHistoryLines); + return $"{minutes / 60:00}:{minutes % 60:00}"; } /// /// The demo's older history: an evening of the same streets, a few thousand lines older than anything the pane holds, /// with a goblin fight in it to find. /// - private static ScrollbackBuffer DemoHistory() + internal static ScrollbackBuffer DemoHistory() { var buffer = new ScrollbackBuffer(10_000); string[] streets = @@ -475,7 +505,7 @@ private static ScrollbackBuffer DemoHistory() "Merrow pages: meet at the Grand Plaza after the bell.", "The smell of roasting chestnuts drifts from a cart nearby.", ]; - for (var i = 0; i < 6_000; i++) + for (var i = 0; i < DemoHistoryLines; i++) { var text = i switch { @@ -483,9 +513,9 @@ private static ScrollbackBuffer DemoHistory() 1_203 => "You hit the goblin for 9 damage.", 1_207 => "The goblin flees north, clutching a stolen purse.", 4_410 => "Ashlyn says, \"That goblin came back — it is in the sewers now.\"", - _ => $"[{18 + i / 1_000:00}:{i * 7 % 60:00}] {streets[i % streets.Length]}", + _ => streets[i % streets.Length], }; - buffer.Append(StyledLine.FromText(text, TextStyle.Default)); + buffer.Append(StyledLine.FromText($"[{DemoHistoryStamp(i)}] {text}", TextStyle.Default)); } return buffer; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs index 4e8d9804..ee2afdad 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptConsole.cs @@ -1,3 +1,4 @@ +using System.Globalization; using System.Text.Json.Nodes; using SharpMUTerm.Client.Modals; using SharpMUTerm.Client.Surfaces; @@ -57,6 +58,15 @@ internal sealed partial class SharpMUTermApp /// Feeds a key to the cell console. internal void SimulateConsoleKey(ConsoleKeyInfo key) => _helpView.SimulateKey(key); + /// A click on a link in the cell console's body, for the tests: the console control's own handler. + internal void SimulateConsoleLink(string url) + { + if (CellConsole is not null) + { + _helpView.SimulateLink(url); + } + } + /// Types at the cell console's prompt. internal void SimulateConsoleTyping(string text) { @@ -202,7 +212,8 @@ private void ShowScriptConsole() NativeModalClosed(session!); _consoleKey = null; }), - () => OnUiThread(() => ListScriptsToEdit(fromConsole: true))) + () => OnUiThread(() => ListScriptsToEdit(fromConsole: true)), + (drawn, index) => OnUiThread(() => OpenConsoleError(drawn, index))) { Theme = _theme.Clone(), }; @@ -212,14 +223,19 @@ private void ShowScriptConsole() var console = new ScriptConsoleSurface(model); _console = console; - var rows = Math.Clamp(_system.DesktopDimensions.Height - 6, 10, 30); + + // Sized on the first draw (the overlay measures at its width before it is built) to what the console holds, so the + // log is not drawn under rows of blank padding; after that the size is fixed and the log scrolls. + var maxRows = Math.Clamp(_system.DesktopDimensions.Height - 6, 10, 30); + int? rows = null; _helpView.Open( "script-console", "Script console", width => { Drawing(SurfaceCatalog.ScriptConsole, string.Empty, console.Model); - return console.Render(width, rows); + rows ??= ScriptConsoleSurface.RowsFor(console.Model, width, maxRows); + return console.Render(width, rows.Value); }, ConsoleKeyPressed, width: ScriptConsoleSurface.PreferredWidth, @@ -227,7 +243,61 @@ private void ShowScriptConsole() { _console = null; _consoleKey = null; - }); + }, + link: url => OpenConsoleErrorLink(console, url)); + } + + /// + /// A click on a link in the cell console: only and an index into the + /// lines the console last drew, so nothing a script printed can name another action. + /// + private void OpenConsoleErrorLink(ScriptConsoleSurface console, string url) + { + if (!url.StartsWith(ScriptConsoleModel.ErrorLinkPrefix, StringComparison.Ordinal) + || !int.TryParse(url.AsSpan(ScriptConsoleModel.ErrorLinkPrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out var index)) + { + return; + } + + OpenConsoleError(console.Model, index); + } + + /// + /// A console error row clicked, from either host: the script it names (file.lua:(N,…), matched against this + /// character's scripts the way ⌃P lists them) opens in the editor with the caret on line N and that line marked — the + /// path ⌃P's Script … entries take — and closing the editor comes back to the console. A row that names no line + /// of a script of this character's is refused out loud. + /// + internal void OpenConsoleError(ScriptConsoleModel model, int index) + { + if (model.ErrorAt(index) is not { } at) + { + RefuseCommand("that console line names no script line"); + return; + } + + var text = model.Lines[index].Text; + var name = ScriptFileRefs().FirstOrDefault(r => SharpMUTerm.Client.Composer.ScriptErrors.LineIn(text, r.Name) is not null)?.Name; + if (name is null) + { + RefuseCommand($"{Snippet(at.File)} is not one of this character's scripts"); + return; + } + + if (ScriptConsoleIsOpen) + { + if (NativeModalOf(SurfaceCatalog.ScriptConsole) is { } native) + { + CloseNativeModal(native); + } + else + { + _helpView.Close(); + } + } + + _scriptReturnToConsole = true; + OpenScriptAt(name, at.Line); } /// A key in the cell console. @@ -380,7 +450,7 @@ private void RefreshConsole() store.Set("last_room", JsonValue.Create("The Grand Plaza")); log.Add(ScriptConsoleKind.Note, "loaded corvid.lua"); log.Add(ScriptConsoleKind.Output, "[info] corvid.lua: watching for tells"); - log.Add(ScriptConsoleKind.Error, "corvid.lua:(14,8-12): attempt to index a nil value (field 'vitals')"); + log.Add(ScriptConsoleKind.Error, DemoScriptError); return (host, store); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs index fdede98d..5ae36ed9 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScriptEdit.cs @@ -61,6 +61,12 @@ internal sealed partial class SharpMUTermApp "\n" + "trigger.add('^(\\\\w+) tells you', 'on_tell')\n"; + /// + /// The demo's one script error: what its console shows and what the editor's header says over corvid.lua line 14 + /// (map.current is columns 16–26 there), so the two never disagree. + /// + internal const string DemoScriptError = "corvid.lua:(14,16-26): attempt to call a nil value (field 'current')"; + /// Whether the focused window is the demo's, in a client with no scripts folder — the snapshot's scripts. private bool DemoScriptsShown => _scriptsRoot is null && _workspace.FindWindow(ActiveWindowId())?.SessionKey is { } owner && IsDemoKey(owner); @@ -184,11 +190,16 @@ private bool OpenScriptFromPalette(string name) var owner = ScriptOwner(); var errors = owner is null ? [] : ConsoleLog(owner).Lines.Where(l => l.Kind == ScriptConsoleKind.Error).Select(l => l.Text).ToArray(); - var line = LastErrorLine(errors, name) ?? 0; - OpenScript(name, line, errorLine: line); + OpenScriptAt(name, LastErrorLine(errors, name) ?? 0); return true; } + /// + /// Opens script with the caret on and that line marked as the error's + /// (0 for neither): the one way in for ⌃P's Script … entries and a console error row's link. + /// + private void OpenScriptAt(string name, int line) => OpenScript(name, line, errorLine: line); + /// /script, /script edit [name], /script new <name>. private void ScriptCommand(string args) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 0befbe2b..5d20fc2f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1952,7 +1952,7 @@ public string RenderSnapshot(string? view = null) if (string.Equals(view, "script-edit", StringComparison.OrdinalIgnoreCase)) { OpenScript("corvid.lua", 14); - SetScriptStatus("! corvid.lua:(14,22-30): attempt to index a nil value (local 'room')"); + SetScriptStatus("! " + DemoScriptError); } // GMCP channel capture, the highlight-names list and a scene log, over the demo (scripting wave). diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 5265ddf7..83b1654d 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -862,6 +862,16 @@ await SameModal("script console: reload", "script-console", await SameModal("script console: edit a script", "script-console", (app, m) => ((ScriptConsoleSession)m.Open(SurfaceCatalog.ScriptConsole)!).EditScript(), app => app.SimulateConsoleKey(new ConsoleKeyInfo('\u0005', ConsoleKey.E, false, false, true))); + + // A click on the demo's error row (corvid.lua:(14,…)): the native row through the session, the cells' row through its + // own mux:script-error:N link — both end in OpenConsoleError, the script open on line 14 with the line marked. + await SameModal("script console: open an error's line", "script-console", + (app, m) => + { + var console = (ScriptConsoleSession)m.Open(SurfaceCatalog.ScriptConsole)!; + console.OpenError(ErrorRow(console.Model)); + }, + app => app.SimulateConsoleLink(ScriptConsoleModel.ErrorLinkPrefix + ErrorRow(app.ScriptConsoleModelNow()))); probed.Add(SurfaceCatalog.ScriptConsole); // ⌃F's older history: ⌥H then ⏎ on the first older hit opens the history view on the same page in both; and the @@ -1164,6 +1174,7 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "import=" + app.ImportReviewOpen + " " + string.Join(",", app.Configuration.TriggerSets.Select(s => s.Name + ":" + s.Triggers.Count)) + " " + string.Join(",", app.Configuration.Worlds.SelectMany(w => w.Characters).Select(c => c.Name + (c.Password is null ? string.Empty : "*"))), "console=" + app.ScriptConsoleIsOpen + " " + ConsoleState(app), + "script=" + (app.OpenScriptEdit is { } script ? $"{script.Name}:{script.Line}:{script.ErrorLine}" : "shut"), "older=" + (app.HistoryViewModel is { } page ? $"{page.Window}:{page.Top}:{page.Marked}" : "shut"), "quick=" + app.LastQuickMacro, "walk=" + app.WalkState, @@ -1173,6 +1184,10 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "notice=" + app.LastNotice, "recent=" + string.Join(",", app.RecentCommandIds)); + /// The index of the first console line that names a script line (the demo's corvid.lua error). + private static int ErrorRow(ScriptConsoleModel model) => + Enumerable.Range(0, model.Lines.Count).First(i => model.ErrorAt(i) is not null); + private static string ConsoleState(SharpMUTermApp app) { var model = app.ScriptConsoleModelNow(); diff --git a/tests/SharpMUTerm.Client.Tests/SearchAndScriptModelTests.cs b/tests/SharpMUTerm.Client.Tests/SearchAndScriptModelTests.cs index fbee2b2b..7a7c5a34 100644 --- a/tests/SharpMUTerm.Client.Tests/SearchAndScriptModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SearchAndScriptModelTests.cs @@ -35,15 +35,15 @@ public async Task TheHistoryViewOpensCentredOnItsHit() { var top = ScrollbackViewModel.TopFor(1_000, 0, 5_000); - await Assert.That(1_000 - top).IsEqualTo(ScrollbackViewModel.PageRows / 2).Because("as many lines above the hit as the page allows"); + await Assert.That(1_000 - top).IsEqualTo(ScrollbackViewModel.MaxPageRows / 2).Because("as many lines above the hit as the page allows"); await Assert.That(ScrollbackViewModel.TopFor(3, 0, 5_000)).IsEqualTo(0).Because("near the oldest line the page starts at it"); - await Assert.That(ScrollbackViewModel.TopFor(4_998, 0, 5_000)).IsEqualTo(5_000 - ScrollbackViewModel.PageRows); + await Assert.That(ScrollbackViewModel.TopFor(4_998, 0, 5_000)).IsEqualTo(5_000 - ScrollbackViewModel.MaxPageRows); } [Test] public async Task TheLinesEitherSideOfTheHitAreItsContext() { - var lines = Enumerable.Range(90, ScrollbackViewModel.PageRows).Select(i => new ScrollbackViewLine(i, $"line {i}", -1, 0)).ToArray(); + var lines = Enumerable.Range(90, ScrollbackViewModel.MaxPageRows).Select(i => new ScrollbackViewLine(i, $"line {i}", -1, 0)).ToArray(); var model = new ScrollbackViewModel("Corvid", "goblin", 90, 0, 500, 100, lines); await Assert.That(model.Role(lines[10])).IsEqualTo(ScrollbackLineRole.Hit); @@ -53,6 +53,72 @@ public async Task TheLinesEitherSideOfTheHitAreItsContext() await Assert.That(model.Role(lines[0])).IsEqualTo(ScrollbackLineRole.Page); } + [Test] + [Arguments(24, 80, 13)] + [Arguments(32, 120, 20)] + [Arguments(40, 160, 20)] + [Arguments(12, 40, ScrollbackViewModel.MinPageRows)] + public async Task TheHistoryPageIsSizedFromTheScreen(int rows, int columns, int page) + { + await Assert.That(ScrollbackViewModel.PageRowsFor(rows, columns)).IsEqualTo(page); + await Assert.That(ScrollbackViewModel.TwoTitleRows(columns)).IsEqualTo(columns < ScrollbackViewModel.WideColumns); + } + + [Test] + public async Task APageMovesByTheRowsTheModelCarries() + { + var lines = Enumerable.Range(90, 13).Select(i => new ScrollbackViewLine(i, $"line {i}", -1, 0)).ToArray(); + var model = new ScrollbackViewModel("Corvid", "goblin", 90, 0, 500, 96, lines, 13); + + await Assert.That(model.Move(ConsoleKey.PageDown)).IsEqualTo(90 + 12); + await Assert.That(model.Move(ConsoleKey.End)).IsEqualTo(500 - 13); + await Assert.That(ScrollbackViewModel.TopFor(96, 0, 500, 13)).IsEqualTo(96 - 6); + await Assert.That(model).IsNotEqualTo(model with { PageRows = 20 }).Because("the page size is part of what both hosts draw"); + await Assert.That(ScrollbackViewModel.KeysLadder.All(k => k.EndsWith("Esc closes", StringComparison.Ordinal))).IsTrue(); + } + + [Test] + public async Task OlderHistoryCountsShareOneRowAndOlderRowsSayHowFarBack() + { + SearchRow[] rows = + [ + new("main", "Corvid", 3, "The goblin snarls.", 4, 6), + new("main", "Corvid", -1, "A goblin leaps.", 2, 6, 1_200, "demo", SearchModel.AgeLabel(4_799)), + ]; + var model = new SearchModel("goblin", false, false, "Corvid", 39, null, rows, Older: true) + { + OlderFound = 4, OlderSearched = 6_000, OlderTotal = 6_000, + }; + + await Assert.That(model.CountText).IsEqualTo("this window 1 of 39 · older 4 of 6,000"); + await Assert.That((model with { HistoryRunning = true, OlderSearched = 1_200 }).CountText).IsEqualTo("this window 1 of 39 · older 4… 1,200 of 6,000 read"); + await Assert.That(model.LabelFor(rows[0])).IsEqualTo("here"); + await Assert.That(model.LabelFor(rows[1])).IsEqualTo("4.8k lines ago"); + await Assert.That((model with { AllWindows = true }).LabelFor(rows[0])).IsEqualTo("Corvid · here"); + await Assert.That(new SearchModel("goblin", false, false, "Corvid", 39, null, [rows[0]]).CountText).IsEqualTo("1 found · 39 lines held") + .Because("without ⌥H the count is the one it always was"); + await Assert.That(SearchModel.AgeLabel(40)).IsEqualTo("40 lines ago"); + await Assert.That(SearchModel.AgeLabel(1)).IsEqualTo("1 line ago"); + } + + [Test] + public async Task AConsoleErrorNamingAScriptLineIsALinkAndNothingElseIs() + { + ScriptConsoleLine[] lines = + [ + new(ScriptConsoleKind.Error, "corvid.lua:(14,16-26): attempt to call a nil value"), + new(ScriptConsoleKind.Error, "stopped after 2,000,000 instructions"), + new(ScriptConsoleKind.Output, "corvid.lua:(3,1) printed by a script"), + ]; + var model = new ScriptConsoleModel("Corvid", null, lines, [], [], 0, ["corvid.lua"], 1, "scripts/"); + + await Assert.That(model.ErrorAt(0)).IsEqualTo(("corvid.lua", 14)); + await Assert.That(model.ErrorAt(1)).IsNull().Because("an error that names no line"); + await Assert.That(model.ErrorAt(2)).IsNull().Because("only an error row: what a script printed is not a link"); + await Assert.That(model.ErrorAt(9)).IsNull(); + await Assert.That(ScriptErrors.At("! main.lua:3: unexpected symbol")).IsEqualTo(("main.lua", 3)); + } + private static SearchModel Found(string query = "goblin", long older = 5_930, bool on = false) => new(query, false, false, "Corvid", 70, null, [], Older: on) { OlderLines = older, OlderSource = "Corvid" }; diff --git a/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs b/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs index 5bdb261d..4ef7f82d 100644 --- a/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/DeepSearchTests.cs @@ -89,7 +89,8 @@ public async Task AltHListsTheScrollbacksHitsAfterThePanesAndNeverTwice() await Assert.That(model.Rows[1].Text).IsEqualTo("a goblin, line 10"); await Assert.That(model.HeldRows).IsEqualTo(1); await Assert.That(model.HistoryRunning).IsFalse(); - await Assert.That(model.HistoryNote).Contains("1 found"); + await Assert.That(model.CountText).StartsWith("this window 1 of ").And.Contains(" · older 1 of "); + await Assert.That(model.HistoryNote).IsNull().Because("the counts are one row; the note says only what is not a count"); await Assert.That(model.StateText).Contains("older history"); } @@ -108,7 +109,7 @@ public async Task EnterOnAnOlderHitOpensTheHistoryViewAroundIt() await Assert.That(app.SearchIsOpen).IsFalse(); await Assert.That(app.HistoryViewIsOpen).IsTrue(); var page = app.HistoryViewModel!; - await Assert.That(page.Lines.Count).IsEqualTo(ScrollbackViewModel.PageRows); + await Assert.That(page.Lines.Count).IsEqualTo(page.PageRows); await Assert.That(page.Lines.Any(l => l.Index == page.Marked && l.Text == "a goblin, line 10")).IsTrue(); await Assert.That(page.Title).Contains("read only"); diff --git a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs index f17d48e5..35b6efa8 100644 --- a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs @@ -53,6 +53,12 @@ internal static readonly (string View, string[] OneRow)[] Footers = ("triggers", ["[Esc] Close", "[⏎] Edit"]), ("keypad", ["[Esc] Close", "[⏎] Edit"]), ("trigger-builder", ["[Esc] Revert", "[⏎] Commit"]), + ("search-older", ["↑↓ pick", "⌃F closes"]), + ("search-older", ["this window 3 of 39", "older 4 of 6,000"]), + ("search-history", ["↑↓ a line", "Esc closes"]), + ("search-history", ["OLDER HISTORY · Corvid · read only"]), + ("script-edit", ["⌃S save and reload", "Esc close"]), + ("script-list", ["Script corvid.lua", "line 14 in the console"]), ]; public static IEnumerable> Cases() => diff --git a/tests/SharpMUTerm.Tui.Tests/SearchAndScriptWaveTests.cs b/tests/SharpMUTerm.Tui.Tests/SearchAndScriptWaveTests.cs index 34bc24ef..1d345bdd 100644 --- a/tests/SharpMUTerm.Tui.Tests/SearchAndScriptWaveTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SearchAndScriptWaveTests.cs @@ -66,7 +66,7 @@ public async Task TheHistoryViewOpensCentredOnItsHitWithItsContextDrawnApart() var frame = app.RenderSnapshot("search-history"); var page = app.HistoryViewModel!; - await Assert.That(page.Marked - page.Top).IsEqualTo(ScrollbackViewModel.PageRows / 2); + await Assert.That(page.Marked - page.Top).IsEqualTo(page.PageRows / 2); var rows = FrameGrid.Decode(frame, 120, 32); var context = rows.Count(r => r.Contains("│ ", StringComparison.Ordinal) && r.Contains("] ", StringComparison.Ordinal)); await Assert.That(context).IsGreaterThanOrEqualTo(2 * ScrollbackViewModel.ContextRows).Because(string.Join('\n', rows)); diff --git a/tests/SharpMUTerm.Tui.Tests/SearchScriptsFitTests.cs b/tests/SharpMUTerm.Tui.Tests/SearchScriptsFitTests.cs new file mode 100644 index 00000000..d240cc99 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/SearchScriptsFitTests.cs @@ -0,0 +1,142 @@ +using System.Globalization; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Wave 18B, read off painted frames: the older-history view fits 80×24 above the command line with its keys pinned; ⌃F +/// says both bounds on one row; a console error row is a link that opens its line in the editor; the console's log is +/// not drawn under blank padding; and the demo's history and script error agree with themselves. +/// +[NotInParallel] +public class SearchScriptsFitTests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(int width, int height) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = "Dark"; + config.Theme = ThemeLibrary.Get("Dark"); + return new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); + } + + [Test] + public async Task TheOlderHistoryViewEndsAboveTheCommandLineAt80x24() + { + await using var app = App(80, 24); + var rows = FrameGrid.Decode(app.RenderSnapshot("search-history"), 80, 24); + var page = app.HistoryViewModel!; + + await Assert.That(page.PageRows).IsEqualTo(ScrollbackViewModel.PageRowsFor(24, 80)); + await Assert.That(page.Lines.Count).IsEqualTo(page.PageRows); + var prompt = rows.ToList().FindIndex(r => r.Contains("Corvid · Aetherfall ›", StringComparison.Ordinal)); + await Assert.That(prompt).IsGreaterThan(0).Because("the command line is not under the view's border:\n" + string.Join('\n', rows)); + var bottom = rows.ToList().FindLastIndex(r => r.Contains('└')); + await Assert.That(bottom).IsLessThan(prompt); + await Assert.That(rows.Any(r => r.Contains(page.Position, StringComparison.Ordinal))).IsTrue() + .Because("the position has a row of its own below 100 columns"); + } + + [Test] + public async Task CtrlFsOlderCountsAreOneRowAndItsRowsSayWhereTheyAre() + { + await using var app = App(80, 24); + var rows = FrameGrid.Decode(app.RenderSnapshot("search-older"), 80, 24); + + await Assert.That(rows.Count(r => r.Contains(" of ", StringComparison.Ordinal) && r.Contains("older", StringComparison.Ordinal) && r.Contains("this window", StringComparison.Ordinal))) + .IsEqualTo(1).Because(string.Join('\n', rows)); + await Assert.That(rows.Any(r => r.Contains("found in", StringComparison.Ordinal))).IsFalse().Because("the second count is gone"); + await Assert.That(rows.Count(r => r.Contains(" here ", StringComparison.Ordinal))).IsEqualTo(3); + await Assert.That(rows.Count(r => r.Contains("lines ago", StringComparison.Ordinal))).IsEqualTo(4); + } + + [Test] + public async Task TheDemosHistoryOnlyMovesForwardAndEveryLineIsStamped() + { + var buffer = SharpMUTermApp.DemoHistory(); + var lines = new List(); + for (var at = buffer.OldestIndex; at < buffer.TotalLines; at += 2_000) + { + lines.AddRange(buffer.GetRange(at, (int)Math.Min(2_000, buffer.TotalLines - at))); + } + + await Assert.That(lines.Count).IsEqualTo((int)buffer.AvailableLines); + var previous = string.Empty; + foreach (var line in lines) + { + await Assert.That(line.Text.Length > 8 && line.Text[0] == '[' && line.Text[6] == ']').IsTrue().Because(line.Text); + var stamp = line.Text[1..6]; + await Assert.That(string.CompareOrdinal(stamp, previous)).IsGreaterThanOrEqualTo(0).Because($"{previous} then {stamp}"); + previous = stamp; + } + + await Assert.That(lines.Any(l => l.Text.Contains("goblin came back", StringComparison.Ordinal))).IsTrue(); + } + + [Test] + public async Task TheDemoConsoleAndTheEditorShowTheOneError() + { + await using var console = App(120, 32); + console.RenderSnapshot("script-console"); + await Assert.That(console.ConsoleTexts("demo", ScriptConsoleKind.Error)).Contains(SharpMUTermApp.DemoScriptError); + + await using var editor = App(120, 32); + editor.RenderSnapshot("script-edit"); + await Assert.That(editor.Composer.Model.Edit!.Status).IsEqualTo("! " + SharpMUTermApp.DemoScriptError); + await Assert.That(editor.Composer.Model.Edit!.ErrorLine).IsEqualTo(SharpMUTerm.Client.Composer.ScriptErrors.At(SharpMUTermApp.DemoScriptError)!.Value.Line); + } + + [Test] + public async Task AConsoleErrorRowIsALinkThatOpensItsLineInTheEditor() + { + await using var app = App(120, 32); + app.RenderSnapshot("script-console"); + var model = app.CellConsole!.Model; + var index = model.Lines.ToList().FindIndex(l => l.Text == SharpMUTermApp.DemoScriptError); + var link = ScriptConsoleModel.ErrorLinkPrefix + index.ToString(CultureInfo.InvariantCulture); + + await Assert.That(app.ConsoleLines.Any(l => l.Contains($"[link={link}]", StringComparison.Ordinal))).IsTrue() + .Because("the error row carries the console's own link"); + await Assert.That(app.ConsoleLines.Where(l => l.Contains("[link=", StringComparison.Ordinal)).All(l => l.Contains($"[link={link}]", StringComparison.Ordinal))) + .IsTrue().Because("only the error naming a line is a link — not the limit's error, not what a script printed"); + + app.SimulateConsoleLink(link); + + await Assert.That(app.ScriptConsoleIsOpen).IsFalse(); + await Assert.That(app.OpenScriptEdit?.Name).IsEqualTo("corvid.lua"); + await Assert.That(app.Composer.Model.Edit!.Line).IsEqualTo(14); + await Assert.That(app.Composer.Model.Edit!.ErrorLine).IsEqualTo(14); + } + + [Test] + public async Task ALinkNotNamingAnErrorRowOpensNothing() + { + await using var app = App(120, 32); + app.RenderSnapshot("script-console"); + + app.SimulateConsoleLink(ScriptConsoleModel.ErrorLinkPrefix + "0"); + app.SimulateConsoleLink("mux:send:@shutdown"); + + await Assert.That(app.ScriptConsoleIsOpen).IsTrue(); + await Assert.That(app.OpenScriptEdit).IsNull(); + } + + [Test] + [Arguments(80, 24)] + [Arguments(120, 32)] + public async Task TheConsolesLogIsNotDrawnUnderBlankPadding(int width, int height) + { + await using var app = App(width, height); + app.RenderSnapshot("script-console"); + var lines = app.ConsoleLines; + + // Title, the blank under it, then the log: its first line is the oldest console line. + await Assert.That(lines[2]).Contains("loaded corvid.lua").Because(string.Join('\n', lines)); + } +} From 805233312f008d52280eeec478e98e62af4fe58f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 16:45:07 +0000 Subject: [PATCH 061/113] Wave 18: map fit, pop-out hover, palette tidy-up, F5 at 80 columns, group routes, tab floor - Native map opens fitted to the rooms near the character, names drawn whenever a step has room (NamesFromStep 40 px); stays put once the player zooms or pans; double-click refits. - Pop-out buttons show on hover only; a one-row strip reserves its right end for the button. - Script entries move to HELP & SETUP and are gated together (ScriptsEditable); FuzzyMatch.StrictLength 4 -> 5 so "scene" no longer scatters. - Cell palette stops above the command line (KeepClearBelow); F5 columns elide with an ellipsis (MarkupText.FitVisible); highlight-names help inks each colour. - Send group: Alt+S / "Send to group" (key hint), `g` on a rail row under Alt+C toggles membership; Ctrl+P > Recent alerts (in memory, 20, newest first) going to the character's window; menu-alerts view. - Overflowed tabs floor at 3 letters + ellipsis (MinimumName 4); an edge tab that would be cut shorter is counted under the chip. - Suppress GHSA-v76p-62qx-wwq2 (ImageSharp TIFF fax decoder, unreachable): build is warning-free. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 18 +++ CLAUDE.md | 34 +++-- Directory.Packages.props | 2 + src/SharpMUTerm.Avalonia/DesktopLayer.cs | 104 +++++++++++++-- src/SharpMUTerm.Avalonia/FloatingPanels.cs | 44 +++++- src/SharpMUTerm.Avalonia/MapCanvas.cs | 106 +++++++++++++-- .../Commands/BuiltInCommands.cs | 79 ++++++++--- src/SharpMUTerm.Client/Palette/FuzzyMatch.cs | 2 +- .../Commands/CommandCatalog.cs | 17 ++- src/SharpMUTerm.Core/Commands/CommandItem.cs | 4 +- src/SharpMUTerm.Core/Session/SendGroup.cs | 2 +- src/SharpMUTerm.Tui/CommandPalette.cs | 21 ++- src/SharpMUTerm.Tui/MacroKeys.cs | 3 + src/SharpMUTerm.Tui/MarkupText.cs | 18 ++- .../SharpMUTermApp.Attention.cs | 1 + .../SharpMUTermApp.RailKeys.cs | 29 +++- .../SharpMUTermApp.RecentAlerts.cs | 85 ++++++++++++ .../SharpMUTermApp.SendGroup.cs | 2 +- .../SharpMUTermApp.TabOverflow.cs | 27 +++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 56 +++++++- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/TabStripFit.cs | 11 +- src/SharpMUTerm.Tui/WorldsScreenRenderer.cs | 13 +- src/SharpMUTerm.Tui/WorldsScreenView.cs | 10 +- .../DesktopLayerTests.cs | 2 +- .../Wave18WindowTests.cs | 107 +++++++++++++++ .../CommandPaletteModelTests.cs | 27 +++- tests/SharpMUTerm.Tui.Tests/SendGroupTests.cs | 46 ++++++- .../SharpMUTerm.Tui.Tests/TabOverflowTests.cs | 5 +- .../Wave18PaletteAndScreenTests.cs | 125 ++++++++++++++++++ 30 files changed, 918 insertions(+), 84 deletions(-) create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.RecentAlerts.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/Wave18WindowTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/Wave18PaletteAndScreenTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index c52877e3..057cacdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] - A script error in the script console that names a file and line is now a link: click it to open that script with the caret on the line and the line marked. Closing the editor goes back to the console. +- ⌃P ▸ Recent alerts lists the pages and alerts every character has had this run, newest first, with how long ago; + choosing one goes to that character's window. +- ⌥S sends the command line to the send group (⌃P ▸ Send to group), and `g` on a sidebar row while ⌥C holds the keys + adds that character to the group or takes them out. + - The script editor numbers its lines in the desktop window too, and after a save whose reload fails, the line the error names is marked in both the terminal and the window. - When Ctrl+F finds fewer matches than it might because the pane no longer holds older lines, its status line offers @@ -356,6 +361,15 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] - Ctrl+F with older history says both counts on one line (`this window 3 of 39 · older 4 of 6,000`). Older matches say how far back they are (`1.6k lines ago`) and the pane's own say `here`. - The script console opens at the size of what it holds, so its log no longer starts under blank rows. +- In the desktop window the map opens sized to the rooms around you, with their names, and stays where you put it + once you zoom or pan (a double-click fits it again). +- The pop-out button on a docked panel shows only while the pointer is over that panel, and never covers the text of a + one-row strip. +- The command palette's script entries are under Help & setup, and a five-letter search such as "scene" no longer + matches letters scattered across unrelated entries. +- F5 at 80 columns shortens long values with "…" instead of cutting them off, and the highlight-names help shows each + colour in that colour. + - The settings screens' key hints no longer lose words from the middle at 80 columns: the least-used keys are left out and the way to close is always there. - Help topics have headings and show their keys as keys, in the terminal and the window, and a topic's title fits @@ -440,6 +454,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- The command palette no longer covers the command line on an 80×24 terminal. +- A tab squeezed by a crowded strip keeps at least three letters of its name. +- The build no longer warns about an ImageSharp advisory in a decoder SharpMUTerm never uses. + - The import review at 80×24 no longer scrolls its Enter and Esc keys and the passwords question out of sight: they stay at the bottom while the rest scrolls (arrow keys, PgUp/PgDn, Home/End). - The script console's store no longer says "read only" while Del deletes a key; the console names Del only on the diff --git a/CLAUDE.md b/CLAUDE.md index 7bfaa89e..fe6c9950 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -164,8 +164,11 @@ fallbacks) for inline images/maps. colour through `Contrast.Legible`. `Areas` lists the drawn area first, then areas reached by an exit. A room carries `Up`/`Down` (an up/down exit or stub, or an exit to a room on another level) and `Elsewhere` (the other area an exit leads to). The cells draw a one-line legend on the last row from 6 rows up — words go - first, then names shorten, then areas are counted (`+2`); it never wraps. The window adds names from zoom - 1.6, the hovered name on a plate, stairs triangles, a halo on the current room and a legend plate. + first, then names shorten, then areas are counted (`+2`); it never wraps. The window opens fitted (`MapCanvas.Fit`: the + rooms within 6 steps of the character's, up to zoom 2.4) and refits on a new model until the player zooms or pans + (`Fitted`; a double-click or another level or area fits again); it names rooms whenever a step is 40 px or more + (`NamesFromStep`), the current room always, plus the hovered name on a plate, stairs triangles, a halo on the + current room and a legend plate. - **A speedwalk sends one step and waits for the map to say it arrived** (`Speedwalk`); it goes through `SendCommandAsync`, so the recorder sees the step. It stops off the path, on the world's `WalkFailurePattern`, after `StepTimeout` with no room, and on disconnect. @@ -309,9 +312,9 @@ fallbacks) for inline images/maps. - **Matching is subsequence, word by word, in order**, scored per character: +1 matched, +8 at a word start, +6 straight after the previous match, +4 on the first character, −1 per skipped character (−4 at most per gap), +20 when the title starts with the whole query. Each word is aligned by dynamic programming, - falling back to the earliest-ending alignment. **A query word of `FuzzyMatch.StrictLength` (4) letters or + falling back to the earliest-ending alignment. **A query word of `FuzzyMatch.StrictLength` (5) letters or fewer must start at a word start and continue in runs or at word starts** (`layo` no longer finds "Clear - window, say you"); a longer word may match as any subsequence. A title match always + window, say you"; `scene` no longer finds Import or Packages); a longer word may match as any subsequence. A title match always lists above a match on the detail, the key or the group's name; ties keep catalog order. Groups keep their headers but are ordered by their best entry, so the best match is the first row. - **An empty query lists RECENT, then SUGGESTED, then the groups**, each entry once. SUGGESTED is read off @@ -1481,6 +1484,15 @@ fallbacks) for inline images/maps. always-on-top choice; the composer does not float; positions on a mixed-DPI desktop are assumed to be in the main window's scaling. +- **Wave 18 tidy-up.** The script entries (reload, console, edit, new, the files) are under HELP & SETUP; Edit and New + and the file entries are offered together, only while scripts are on or the files are listed (`ScriptsEditable`). The + cell ⌃P stops above the command line (`CommandPalette.KeepClearBelow` = `InputBandRows`), so at 80×24 its border is a row + above the prompt. F5's columns are fitted with `MarkupText.FitVisible` (elided with `…`, trailing blanks cut silently), + and `highlight names`' help inks each colour in itself, held to the floor. An overflowed tab keeps 3 letters and `…` + (`TabStripFit.MinimumName` 4); the tab the chip would leave shorter than that (`ChipReserve`) is counted under the chip. + In the window a pop-out button shows only while the pointer is over its panel (`DesktopLayer.SyncPopOutHover`), and a + one-row strip gives the button its right end (`ReservesPopOut`: the native control is narrowed, the corner painted the + pane's plane), so the button never sits on a strip's text. - **Wave 16 groups** (F5 headings, ⌃P groups, scene mark, client rows, map find). Decisions not to relitigate: - **F5's world column is drawn in the declaration's order under its `Group` headings** (`WorldsScreenRenderer.DetailColumn` walks `BuiltInSettings.World.Fields`), so the cell screen and the window group alike; `WorldFieldOrder` (⇥ order and the @@ -1878,8 +1890,8 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] **StbImageSharp reads no WebP**, and the bump silently turned every WebP picture (all of SharpMUSH's) back into its label. `ImageDecoder` is the one decode path for panes and the web view: the framework first, then ImageSharp 3.1 configured with the **WebP module only and metadata skipped**. That narrowing - is what keeps the 3.1.12 advisories (TIFF codecs, ICC/EXIF) unreachable and is why they are - `NuGetAuditSuppress`ed by id; 4.x fixes them but will not build without a Six Labors license key. + is what keeps the 3.1.12 advisories (TIFF codecs including the fax tile decoder, ICC/EXIF) unreachable + and is why they are `NuGetAuditSuppress`ed by id (`Directory.Packages.props`; a new one is NU1903 until listed); 4.x fixes them but will not build without a Six Labors license key. - **Controls default to `HorizontalAlignment.Left`, which self-sizes to content** instead of filling the slot. This is the single biggest cause of "why doesn't this fill the width?" Use `.WithAlignment(HorizontalAlignment.Stretch)`. A `.Flex(n)` column only fills if the grid is @@ -3165,8 +3177,14 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] each member's `SendUserInputAsync`, so aliases and echo apply per character, once each. A disconnected member gets nothing and is named in the notice. A closed session leaves the group. `world.sendTo(name, cmd)` resolves through `SendGroup.Find`: an exact `World.Character` key, else a unique character name. It refuses an - ambiguous or disconnected name and sends raw, like `world.send`. Not done: no ⌃P chord, and no rail gesture - to toggle membership. + ambiguous or disconnected name and sends raw, like `world.send`. ⌃P ▸ *Send to group* is ⌥S (`BuiltInCommands.SendGroupKey`, + in `MacroKeys.AppShortcuts`); `g` on a row while ⌥C holds the sidebar toggles that row's character and keeps the keys + there (`ToggleGroupAtRailCursor`). +- **⌃P ▸ *Recent alerts* lists every character's pages and alerts this run** (`SharpMUTermApp.RecentAlerts.cs`; kept from + `AttentionRequested` whether or not the host was asked, 20, newest first, in memory, never saved). The entry opens the + palette on `alert ` (`AlertQuery`), the only time the `alert:go:` family lists anything (`CommandContext.Alerts`), and + an entry goes through `CommandIds.Character`, the id a ⌃P *Switch to …* runs. An id no longer kept refuses. The + `menu-alerts` view. - **NEW-ENVIRON is answered as MNES** (`TelnetSessionOptions.MnesIdentity`; the library's `NewEnvironProtocol`). The variables are `CLIENT_NAME`, `CLIENT_VERSION`, `TERMINAL_TYPE` and `MTTS`, read from the same TTYPE list, so the two channels cannot disagree (`MTTS 2845`, which now includes MNES 512). It answers a server's `DO` and diff --git a/Directory.Packages.props b/Directory.Packages.props index b1c8bec7..aaef7849 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -88,6 +88,8 @@ + + diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index 6b8fbac5..074542b7 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -367,10 +367,75 @@ private void SyncPanels(ScreenFrame frame, Size cell) SyncPopOuts(frame, cell); } + /// Whether a panel is a one-row strip that keeps a corner for its pop-out button rather than sitting under it. + internal static bool ReservesPopOut(PanelOverlay panel) => panel.PopOut is not null && panel.Rect.Height == 1; + + /// The pixels a one-row strip leaves at its right end for the button. + private static double PopOutReserve(Size cell) => PopOutSize(cell) + 6; + + private static double PopOutSize(Size cell) => Math.Clamp(cell.Height - 2, 12, 18); + + /// Where the pointer last was over the window, in this layer's coordinates; null once it left. + private Point? _pointerAt; + + /// + /// Shows each pop-out button while the pointer is over its panel and hides it otherwise (D3: an always-on button lay + /// over the panel's own text). A one-row strip's reserved corner stays, as the pane's plane, with the icon on hover. + /// + private void SyncPopOutHover() + { + foreach (var button in _popOuts.Values) + { + var over = _pointerAt is { } at && button.PanelBounds.Contains(at); + button.Hovering = over; + button.IsVisible = over || button.Reserved; + } + } + + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnAttachedToVisualTree(e); + if (TopLevel.GetTopLevel(this) is { } top) + { + top.AddHandler(PointerMovedEvent, OnWindowPointerMoved, global::Avalonia.Interactivity.RoutingStrategies.Tunnel, handledEventsToo: true); + top.PointerExited += OnWindowPointerExited; + } + } + + protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) + { + if (TopLevel.GetTopLevel(this) is { } top) + { + top.RemoveHandler(PointerMovedEvent, OnWindowPointerMoved); + top.PointerExited -= OnWindowPointerExited; + } + + base.OnDetachedFromVisualTree(e); + } + + private void OnWindowPointerMoved(object? sender, PointerEventArgs e) + { + _pointerAt = e.GetPosition(this); + SyncPopOutHover(); + } + + private void OnWindowPointerExited(object? sender, PointerEventArgs e) + { + _pointerAt = null; + SyncPopOutHover(); + } + + /// Moves the pointer for a test, as the window's own pointer movement would. + internal void SimulatePointer(Point? at) + { + _pointerAt = at; + SyncPopOutHover(); + } + /// /// A pop-out button in the top right corner of every docked panel the client says can float, above the panel's - /// own view and below the toasts. A panel that cannot float (or a host that cannot) publishes no callback, and - /// gets no button. + /// own view and below the toasts, shown while the pointer is over the panel. A panel that cannot float (or a host + /// that cannot) publishes no callback, and gets no button. /// private void SyncPopOuts(ScreenFrame frame, Size cell) { @@ -391,14 +456,35 @@ private void SyncPopOuts(ScreenFrame frame, Size cell) Children.Insert(Math.Max(0, Children.IndexOf(_toasts)), button); } - var size = Math.Clamp(cell.Height - 2, 12, 18); + var size = PopOutSize(cell); var rect = panel.Rect; - button.Width = size; - button.Height = size; - SetLeft(button, origin.X + ((rect.X + rect.Width) * cell.Width) - size - 3); - SetTop(button, origin.Y + (rect.Y * cell.Height) + 2); + var right = origin.X + ((rect.X + rect.Width) * cell.Width); + button.PanelBounds = new Rect(origin.X + (rect.X * cell.Width), origin.Y + (rect.Y * cell.Height), rect.Width * cell.Width, rect.Height * cell.Height); + button.Reserved = ReservesPopOut(panel); + if (button.Reserved) + { + // The strip's reserved end: the whole row's height, on the pane's own plane. + var reserve = PopOutReserve(cell); + button.Width = reserve; + button.Height = rect.Height * cell.Height; + SetLeft(button, right - reserve); + SetTop(button, origin.Y + (rect.Y * cell.Height)); + var inside = rect.X >= 0 && rect.Y >= 0 && rect.X < frame.Width && rect.Y < frame.Height; + button.Plane = Colour(inside ? _view.Renderer.Background(frame[rect.X + rect.Width - 1, rect.Y]) : _view.Renderer.DefaultBackground); + } + else + { + button.Width = size; + button.Height = size; + SetLeft(button, right - size - 3); + SetTop(button, origin.Y + (rect.Y * cell.Height) + 2); + button.Plane = null; + } + button.Show(panel, Colour(_view.Renderer.DefaultForeground)); } + + SyncPopOutHover(); } /// @@ -436,7 +522,9 @@ private void Place( var origin = CellOrigin; SetLeft(control, origin.X + (rect.X * cell.Width)); SetTop(control, origin.Y + (rect.Y * cell.Height)); - control.Width = rect.Width * cell.Width; + // A one-row strip that can pop out leaves its right end to the button (ReservesPopOut), so the button never + // lies over its text (`88 / 100`, `F4 edits keys`); the button paints the pane's plane over the cells there. + control.Width = Math.Max(0, (rect.Width * cell.Width) - (ReservesPopOut(panel) ? PopOutReserve(cell) : 0)); control.Height = rect.Height * cell.Height; // The pane's own plane, read off the frame, so the native view sits on whatever the pane wears — its diff --git a/src/SharpMUTerm.Avalonia/FloatingPanels.cs b/src/SharpMUTerm.Avalonia/FloatingPanels.cs index 34253f7c..df1a5f5c 100644 --- a/src/SharpMUTerm.Avalonia/FloatingPanels.cs +++ b/src/SharpMUTerm.Avalonia/FloatingPanels.cs @@ -489,6 +489,31 @@ public PopOutButton() /// The panel it pops out, as the client last published it. public PanelOverlay? Panel { get; private set; } + /// The panel's rectangle in the layer, which the pointer must be over for the button to show. + internal Rect PanelBounds { get; set; } + + /// Whether the button holds a one-row strip's reserved end, which stays (as ) when the icon goes. + internal bool Reserved { get; set; } + + /// The pane's plane, painted under a reserved button so the cells under the strip's end do not show; else null. + internal Color? Plane { get; set; } + + /// Whether the pointer is over the panel, which is when the icon is drawn. + internal bool Hovering + { + get => _hovering; + set + { + if (_hovering != value) + { + _hovering = value; + InvalidateVisual(); + } + } + } + + private bool _hovering; + public Color Ink { get; set; } = Colors.White; /// Shows the button for , in . @@ -546,7 +571,24 @@ protected override void OnPointerWheelChanged(PointerWheelEventArgs e) public override void Render(DrawingContext context) { - var bounds = new Rect(Bounds.Size); + var whole = new Rect(Bounds.Size); + if (Plane is { } under) + { + context.FillRectangle(new SolidColorBrush(under), whole); + } + + if (!Hovering && !IsPointerOver && !_pressed) + { + return; + } + + // A reserved strip end draws the icon as a square at its right, vertically centred. + var square = Math.Min(whole.Width, Math.Min(whole.Height, 18)); + var bounds = Reserved + ? new Rect(whole.Width - square - 3, Math.Round((whole.Height - square) / 2), square, square) + : whole; + using var _ = context.PushTransform(Matrix.CreateTranslation(bounds.X, bounds.Y)); + bounds = new Rect(bounds.Size); var plate = (byte)(_pressed ? 0x60 : IsPointerOver ? 0x40 : 0x18); context.DrawRectangle(new SolidColorBrush(Color.FromArgb(plate, Ink.R, Ink.G, Ink.B)), null, bounds, 3, 3); diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index a90fe942..54ecb467 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -41,6 +41,12 @@ internal sealed class MapCanvas : Control private const double MinZoom = 0.35, MaxZoom = 3, DragThreshold = 4; + /// The most the fit zooms in: past it a small area's rooms are boxes the size of buttons. + internal const double FitMaxZoom = 2.4; + + /// How many grid steps from the character's room the fit takes in; a larger area is fitted around them. + internal const int FitRadius = 6; + private readonly TerminalView _view; /// @@ -60,6 +66,14 @@ internal sealed class MapCanvas : Control private Vector _dragBy; private readonly MapInspector _inspector = new(); private Vector _pan; + + /// + /// The offset and zoom that fit the area to the canvas, recomputed whenever the picture or the canvas changes until the + /// player zooms or pans (); a double-click or another level or area fits it again. + /// + private Vector _fit; + private bool _moved; + private (MapViewModel Model, Size Size, bool Inspector)? _fitFor; private Point? _pressAt; private Vector _panAtPress; private bool _dragging; @@ -95,7 +109,21 @@ protected override Size ArrangeOverride(Size finalSize) internal MenuModel? OpenedRoomMenu { get; private set; } /// The zoom, 1 at pixels between rooms. Internal for tests. - internal double Zoom { get; private set; } = 1; + internal double Zoom + { + get + { + Fit(); + return _zoom; + } + + private set => _zoom = value; + } + + private double _zoom = 1; + + /// Whether the view is the fit (true) or where the player zoomed or panned it to. Internal for tests. + internal bool Fitted => !_moved; /// The pan from the character's room, in pixels. Internal for tests. internal Vector Pan => _pan; @@ -117,10 +145,11 @@ public void Show( return; } - // Another level or area is another picture: the pan from the old one means nothing on it. + // Another level or area is another picture: the pan from the old one means nothing on it, and it is fitted afresh. if (model.Level != _model.Level || model.Area != _model.Area || model.Viewing != _model.Viewing) { _pan = default; + _moved = false; } _model = model; @@ -135,7 +164,7 @@ internal Point CentreOf(MapViewRoom room) { var anchor = _model.Current ?? _model.Rooms.FirstOrDefault(); var step = Spacing * Zoom; - var middle = Middle + _pan; + var middle = Middle + _fit + _pan; return anchor is null ? middle : new Point(middle.X + ((room.X - anchor.X) * step), middle.Y + ((room.Y - anchor.Y) * step)); @@ -155,6 +184,54 @@ private Point Middle private double RoomSize => Math.Max(5, Spacing * Zoom * 0.56); + /// + /// Fits the area to the canvas: the rooms within steps of the character's, centred in the open + /// part below the corner label, at the largest zoom up to that holds them with a room's width + /// to spare. Only until the player zooms or pans; then the view is theirs. + /// + private void Fit() + { + if (_moved) + { + return; + } + + var key = (_model, Bounds.Size, _inspector.IsVisible); + if (_fitFor is { } was && ReferenceEquals(was.Model, key._model) && was.Size == key.Size && was.Inspector == key.IsVisible) + { + return; + } + + _fitFor = (key._model, key.Size, key.IsVisible); + var anchor = _model.Current ?? _model.Rooms.FirstOrDefault(); + if (anchor is null || Bounds.Width <= 0 || Bounds.Height <= 0) + { + _zoom = 1; + _fit = default; + return; + } + + var near = _model.Rooms.Where(r => Math.Abs(r.X - anchor.X) <= FitRadius && Math.Abs(r.Y - anchor.Y) <= FitRadius).ToList(); + var minX = near.Min(r => r.X - anchor.X); + var maxX = near.Max(r => r.X - anchor.X); + var minY = near.Min(r => r.Y - anchor.Y); + var maxY = near.Max(r => r.Y - anchor.Y); + var open = Middle.X * 2; + const double top = 44; // the corner label and the walk or room line under it + var across = Math.Max(1, open - 24) / ((maxX - minX + 1.6) * Spacing); + var down = Math.Max(1, Bounds.Height - top - 16) / ((maxY - minY + 1.6) * Spacing); + _zoom = Math.Clamp(Math.Min(across, down), MinZoom, FitMaxZoom); + var step = Spacing * _zoom; + _fit = new Vector(-(minX + maxX) / 2.0 * step, (top / 2) - ((minY + maxY) / 2.0 * step)); + } + + /// The player took the view: the fit stops following, and stays where it was. + private void TakeView() + { + Fit(); + _moved = true; + } + /// The room under a point, or null. internal MapViewRoom? RoomAt(Point point) { @@ -222,7 +299,10 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) if (e.ClickCount == 2) { + // Re-centre: the fit again, as when the map opened. _pan = default; + _moved = false; + _fitFor = null; InvalidateVisual(); return; } @@ -257,6 +337,7 @@ protected override void OnPointerMoved(PointerEventArgs e) } else { + TakeView(); _pan = _panAtPress + moved; } @@ -517,6 +598,7 @@ internal void RunMenuVerb(long room, string verb) /// Zooms by about , keeping what is under it there. internal void ZoomAbout(Point point, double notches) { + TakeView(); var next = Math.Clamp(Zoom * Math.Pow(1.18, notches), MinZoom, MaxZoom); if (Math.Abs(next - Zoom) < 1e-9) { @@ -526,16 +608,22 @@ internal void ZoomAbout(Point point, double notches) // The centre is middle + pan; a point at offset d from it moves to d·ratio, so the pan takes up the difference. var middle = Middle; var ratio = next / Zoom; - var fromCentre = point - (middle + _pan); - _pan = point - middle - (fromCentre * ratio); + var fromCentre = point - (middle + _fit + _pan); + _pan = point - middle - _fit - (fromCentre * ratio); Zoom = next; InvalidateVisual(); } // ── Drawing ─────────────────────────────────────────────────────────────────────────────── - /// The zoom from which every room's name is written under it, not only the hovered one's. - internal const double NamesFromZoom = 1.6; + /// + /// The pixels between room centres from which every room's name is written under it: wherever a few letters fit + /// between two rooms. Below it only the character's own room is named (and the hovered one, on a plate). + /// + internal const double NamesFromStep = 40; + + /// Whether every room is named at the zoom shown. Internal for tests. + internal bool NamesShown => Spacing * Zoom >= NamesFromStep; /// /// The colour a room is drawn in: its area's, as the view gives it (), or the @@ -593,7 +681,7 @@ public override void Render(DrawingContext context) var accent = Parse(_ink.Bar); var path = Parse(_ink.Low); var radius = size * 0.22; - var names = Zoom >= NamesFromZoom; + var names = NamesShown; foreach (var room in _model.Rooms) { var c = CentreOf(room); @@ -650,7 +738,7 @@ public override void Render(DrawingContext context) context.DrawRectangle(null, ring, rect.Inflate(size * 0.42), radius * 2.2, radius * 2.2); } - if ((names || room.Id == _hovered) && room.Id != _hovered) + if ((names || room.Current) && room.Id != _hovered) { DrawName(context, room.Name, c, size, plate: false); } diff --git a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs index 5c4aa3fa..6eefd48c 100644 --- a/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs +++ b/src/SharpMUTerm.Client/Commands/BuiltInCommands.cs @@ -29,6 +29,21 @@ public static class BuiltInCommands /// Import from another client: a file picker in a host that has one, else /import on the command line. public const string ImportCommand = "term:import"; + /// The chord that sends the command line to the send group (). + public const string SendGroupKey = "⌥S"; + + /// ⌃P ▸ Recent alerts: opens the palette on this run's pages and alerts, every character's. + public const string RecentAlertsCommand = "world:recent-alerts"; + + /// The prefix of the alert entries: alert:go:<id>, one per kept alert. + public const string AlertPrefix = "alert:go:"; + + /// What the palette opens with typed in for Recent alerts, so it lists the alerts. + public const string AlertQuery = "alert "; + + /// The ⌃P id that goes to alert 's character. + public static string Alert(int id) => AlertPrefix + id.ToString(System.Globalization.CultureInfo.InvariantCulture); + /// ⌃P ▸ Script console. public const string ScriptConsoleCommand = "world:script-console"; @@ -147,19 +162,14 @@ void Family(string id, string prefix, Func c.State.Reconnecting); Family("world:send-group", CommandIds.GroupPrefix, SendGroup); - Family("world:join-wraps", JoinWrapsPrefix, JoinWrapsEntries); - Add("world:reload-scripts", CommandGroup.World, "Reload scripts", - detail: "re-reads this character's Lua files", when: c => c.State.ScriptsOn); - Add(ScriptConsoleCommand, CommandGroup.World, "Script console", - detail: "run Lua as this character, see what scripts print and keep"); - // Editing the script files under the scripts folder, in the composer's editor: the list (one entry per file, which - // Edit script… opens the palette on) and a new one by name. Only where the client runs scripts. - Add(ScriptEditCommand, CommandGroup.World, "Edit script…", - detail: "open a .lua file from the scripts folder · ⌃S saves and reloads", when: c => c.State.ScriptsOn); - Add(ScriptNewCommand, CommandGroup.World, "New script…", - detail: "/script new · starts from a template", when: c => c.State.ScriptsOn); - Family("world:script-open", ScriptOpenPrefix, ScriptFileEntries); + // The pages and alerts of this run, every character's (in memory, never saved): the entry opens the palette on + // them, one per alert, newest first, and choosing one goes to that character's window. + Add(RecentAlertsCommand, CommandGroup.World, "Recent alerts", + titleFor: c => $"Recent alerts ({c.State.RecentAlerts})", + detail: "pages and alerts this run, every character's", when: c => c.State.RecentAlerts > 0); + Family("world:alerts", AlertPrefix, AlertEntries); + Family("world:join-wraps", JoinWrapsPrefix, JoinWrapsEntries); // Only where the host has a screen reader to tell: the window's live region, or --plain. Add("a11y:toggle-window", CommandGroup.Terminal, "Read this window aloud", @@ -284,6 +294,20 @@ void Family(string id, string prefix, Func c.State.ScriptsOn); + Add(ScriptConsoleCommand, CommandGroup.Help, "Script console", + detail: "run Lua as this character, see what scripts print and keep"); + Add(ScriptEditCommand, CommandGroup.Help, "Edit script…", + detail: "open a .lua file from the scripts folder · ⌃S saves and reloads", when: ScriptsEditable); + Add(ScriptNewCommand, CommandGroup.Help, "New script…", + detail: "/script new · starts from a template", when: ScriptsEditable); + Family("world:script-open", ScriptOpenPrefix, ScriptFileEntries); + // A spelling dictionary, downloaded only when asked — the offer says what, from where and where to, first. Add(DictionaryCommand, CommandGroup.Compose, "Get a spelling dictionary…", detail: "English, for the composer · asks first", @@ -488,9 +512,16 @@ private static IEnumerable JoinWrapsEntries(ICommandContext context Detail = $"it wraps at {r.Column}, the pane is {r.PaneWidth} wide · F5 ▸ join wraps", }); + /// + /// Whether ⌃P offers the script files, Edit script… and New script…: the client runs scripts, or it is showing a + /// list of files to edit (the snapshot's demo scripts). One predicate for all three, so they come and go together. + /// + private static bool ScriptsEditable(ICommandContext context) => + context.State.ScriptsOn || context.State.ScriptFiles is not null; + private static IEnumerable ScriptFileEntries(ICommandContext context) => - (context.State.ScriptFiles ?? []).Select(f => new CommandItem( - CommandGroup.World, + !ScriptsEditable(context) ? [] : (context.State.ScriptFiles ?? []).Select(f => new CommandItem( + CommandGroup.Help, f.ReadOnly ? $"Script {f.Name} (read only)" : $"Script {f.Name}", ScriptOpen(f.Name), f.Detail) @@ -498,6 +529,13 @@ private static IEnumerable ScriptFileEntries(ICommandContext contex Detail = f.Detail, }); + private static IEnumerable AlertEntries(ICommandContext context) => + (context.State.Alerts ?? []).Select(a => + { + var detail = $"{a.Why} · {a.Age}"; + return new CommandItem(CommandGroup.World, $"Alert · {a.Who}: {a.Text}", Alert(a.Id), detail) { Detail = detail }; + }); + private static IEnumerable MapFoundEntries(ICommandContext context) => (context.State.MapFound ?? []).Select(r => { @@ -530,11 +568,14 @@ private static IEnumerable SendGroup(ICommandContext context) var members = characters.Count(c => c.InGroup); if (members > 0) { - yield return new CommandItem( - CommandGroup.World, - "Send the command line to the group", - CommandIds.GroupSend, - members == 1 ? "1 character" : $"{members} characters"); + // ⌥S, the group's own chord (MacroKeys), named here because this is where it is learnt; the rail's `g` while ⌥C + // holds the keys is the other half, putting characters in. + var who = members == 1 ? "the command line, to 1 character" : $"the command line, to {members} characters"; + yield return new CommandItem(CommandGroup.World, "Send to group", CommandIds.GroupSend, $"{SendGroupKey} · {who}") + { + Key = SendGroupKey, + Detail = who, + }; yield return new CommandItem(CommandGroup.World, "Clear the send group", CommandIds.GroupClear); } } diff --git a/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs b/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs index 87eb004c..aec630e8 100644 --- a/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs +++ b/src/SharpMUTerm.Client/Palette/FuzzyMatch.cs @@ -56,7 +56,7 @@ public static class FuzzyMatch public const int WholePrefix = 20; /// A query word this long or shorter matches only at word starts and runs (see the class remarks). - public const int StrictLength = 4; + public const int StrictLength = 5; /// /// Matches against , or returns null when it is not a diff --git a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs index f7682da9..42ca6c31 100644 --- a/src/SharpMUTerm.Core/Commands/CommandCatalog.cs +++ b/src/SharpMUTerm.Core/Commands/CommandCatalog.cs @@ -71,6 +71,11 @@ public sealed record CharacterRef( /// /// The rooms the last /map find listed, newest search only, so ⌃P offers to walk to each. /// The focused character's script files, so ⌃P offers to open each in the editor. +/// How many pages and alerts this run has kept, across every character, so ⌃P offers Recent alerts. +/// +/// Those alerts, newest first, once Recent alerts has opened the palette on them (null before), so each is an entry +/// that goes to its character's window without crowding every other ⌃P. +/// public sealed record CommandContext( bool LoggingOn = false, bool Zoomed = false, @@ -96,7 +101,17 @@ public sealed record CommandContext( bool MapViewing = false, bool NewConfiguration = false, IReadOnlyList? MapFound = null, - IReadOnlyList? ScriptFiles = null); + IReadOnlyList? ScriptFiles = null, + int RecentAlerts = 0, + IReadOnlyList? Alerts = null); + +/// A page or alert the client kept this run, for ⌃P's Recent alerts entries. +/// Its number this run, which the entry's id carries. +/// The character it was for, as every surface names one (Corvid · Aetherfall). +/// What it was: page, mentioned you or alert. +/// The line, bounded. +/// How long ago, in words (just now, 4 min ago). +public sealed record AlertRef(int Id, string Who, string Why, string Text, string Age); /// A script file ⌃P offers to open in the editor. /// Its name under the scripts folder (combat.lua), or package:<id>/<file>. diff --git a/src/SharpMUTerm.Core/Commands/CommandItem.cs b/src/SharpMUTerm.Core/Commands/CommandItem.cs index cca4d7bf..d2310782 100644 --- a/src/SharpMUTerm.Core/Commands/CommandItem.cs +++ b/src/SharpMUTerm.Core/Commands/CommandItem.cs @@ -6,7 +6,7 @@ public enum CommandGroup /// Navigation: switch character, jump to a window. GoTo, - /// Connection actions: reconnect, disconnect, the send group, scripts. + /// Connection actions: reconnect, disconnect, the send group, recent alerts. World, /// Output actions: logging and scene logs, freeze/scrollback, clear, copy, timestamps, sound. @@ -27,7 +27,7 @@ public enum CommandGroup /// Writing: the composer, command history, the second command line, the newline, the dictionary. Compose, - /// Help and setting up: help, the welcome, the key tour, import, packages. + /// Help and setting up: help, the welcome, the key tour, import, packages, scripts. Help, } diff --git a/src/SharpMUTerm.Core/Session/SendGroup.cs b/src/SharpMUTerm.Core/Session/SendGroup.cs index e0cf1834..05de44b8 100644 --- a/src/SharpMUTerm.Core/Session/SendGroup.cs +++ b/src/SharpMUTerm.Core/Session/SendGroup.cs @@ -1,7 +1,7 @@ namespace SharpMUTerm.Core.Session; /// -/// The characters one line can be sent to at once (⌃P ▸ Send the command line to the group), and how a +/// The characters one line can be sent to at once (⌃P ▸ Send to group), and how a /// script names another character (world.sendTo). What BeipMU calls puppets: a MUSH player's alts, moved /// together. /// diff --git a/src/SharpMUTerm.Tui/CommandPalette.cs b/src/SharpMUTerm.Tui/CommandPalette.cs index 1bb1478e..8991c88a 100644 --- a/src/SharpMUTerm.Tui/CommandPalette.cs +++ b/src/SharpMUTerm.Tui/CommandPalette.cs @@ -90,6 +90,12 @@ public void Toggle() } } + /// + /// How many rows at the desktop's foot the palette must leave uncovered — the command line and the status row — or + /// null for none. Asked each time it opens, since the command line grows. + /// + public Func? KeepClearBelow { get; init; } + private void Open() { _selected = 0; @@ -115,7 +121,11 @@ private void Open() // narrower desktop elides titles and details, never keys (CommandSurfaceRenderer). var initial = Build(string.Empty); var desktop = _system.DesktopDimensions; - var height = Math.Clamp(initial.Rows.Count + 1 + 3, 6, Math.Max(6, desktop.Height - 2)); + // The rows the command line and the status row take at the desktop's foot stay clear (KeepClearBelow), so the + // line being typed is never under the palette's bottom border; the palette centres in what is above them. + var clear = Math.Clamp(KeepClearBelow?.Invoke() ?? 0, 0, Math.Max(0, desktop.Height - 8)); + var above = desktop.Height - clear; + var height = Math.Clamp(initial.Rows.Count + 1 + 3, 6, Math.Max(6, clear > 0 ? above - 1 : desktop.Height - 2)); _contentWidth = Math.Clamp( Math.Max(CommandSurfaceRenderer.NaturalWidth(initial), HeaderWidth(initial)) + 1, 32, @@ -129,15 +139,18 @@ private void Open() // Centered() *after* WithSize(): it reads the bounds set so far and falls back to 80x25, so // centring first placed the surface as if it were that size — which only became visible once // the catalog grew tall enough for the misplacement to push its bottom border off-screen. - _window = new WindowBuilder(_system) + var builder = new WindowBuilder(_system) .WithTitle(Title) .AsModal() .WithBorderStyle(BorderStyle.Single) .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) - .WithSize(width, height) - .Centered() + .WithSize(width, height); + builder = clear > 0 + ? builder.AtPosition(Math.Max(0, (desktop.Width - width) / 2), Math.Max(1, (above - height) / 2)) + : builder.Centered(); + _window = builder .AddControl(_search) .AddControl(_results) .OnClosed((_, _) => Reset()) diff --git a/src/SharpMUTerm.Tui/MacroKeys.cs b/src/SharpMUTerm.Tui/MacroKeys.cs index d6aef8b0..8a999723 100644 --- a/src/SharpMUTerm.Tui/MacroKeys.cs +++ b/src/SharpMUTerm.Tui/MacroKeys.cs @@ -183,6 +183,9 @@ private static AppShortcut[] BuildAppShortcuts() // are read off. new(ConsoleModifiers.Alt, ConsoleKey.J, "goes to the next character"), new(ConsoleModifiers.Alt, ConsoleKey.K, "goes to the previous character"), + // The send group's line (⌃P ▸ Send to group). ⌥S is `ESC s`, one Alt chord like the rest; nothing here, in the + // framework or in the window's HostKeys.Reserved takes it. S for send; ⌃S is the composer's own send. + new(ConsoleModifiers.Alt, ConsoleKey.S, "sends the command line to the send group"), // F1 is the composer and not a settings screen, which is why it sits ahead of the F2–F9 block // rather than in it: those keys all open the same overlay from one table, and this one opens a // different surface. It is claimed here for the same reason they are — F4 reads this list to say diff --git a/src/SharpMUTerm.Tui/MarkupText.cs b/src/SharpMUTerm.Tui/MarkupText.cs index 603a39c6..546ff9a5 100644 --- a/src/SharpMUTerm.Tui/MarkupText.cs +++ b/src/SharpMUTerm.Tui/MarkupText.cs @@ -123,14 +123,26 @@ internal static string SpreadTitle(string title, string hints, int width) /// Cuts a markup string to visible cells, ending in … when anything /// was cut. Tags are kept, including those after the cut, so every span that opened still closes. /// - internal static string ElideVisible(string markup, int width) + internal static string ElideVisible(string markup, int width) => ElideVisible(markup, width, mark: true); + + /// + /// A row of a column cells wide: unchanged when it fits; cut without a mark when only its + /// trailing blanks (a cursor band's padding) are past the edge; else elided with … — never clipped mid-word + /// by the control, which says nothing about what was lost. Zero or less means the width is not known. + /// + internal static string FitVisible(string markup, int width) => + width <= 0 || VisibleLength(markup) <= width + ? markup + : ElideVisible(markup, width, mark: Plain(markup).TrimEnd().Length > width); + + private static string ElideVisible(string markup, int width, bool mark) { if (VisibleLength(markup) <= width) { return markup; } - var budget = Math.Max(0, width - 1); + var budget = Math.Max(0, mark ? width - 1 : width); var result = new System.Text.StringBuilder(markup.Length); var shown = 0; var cut = false; @@ -145,7 +157,7 @@ void Visible(string text) else if (!cut) { cut = true; - if (width > 0) + if (mark && width > 0) { result.Append('…'); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs index 03b4619e..e13a50d6 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Attention.cs @@ -78,6 +78,7 @@ private void NoteUnseenLine() private void OnAttentionRequested(WorldSession session, AttentionEventArgs e) { + KeepAlert(session.SessionKey, e.Reason, e.Text); if (!_config.Text.AlertWhenAway || Host.Attention is not { } host) { return; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs index 9cec4dc2..816ee254 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.RailKeys.cs @@ -70,7 +70,7 @@ private void ToggleRailKeys() RefreshRail(); SyncComposerBands(); // the command line goes idle: ⏎ goes to a row now, not to the game UpdateInputChrome(); // and its prompt with it, which is painted to match the band - Notice("sidebar: ↑↓ walk · ⏎ goes · Esc returns", MessageSeverity.Info, "⌥C"); + Notice("sidebar: ↑↓ walk · ⏎ goes · g send group · Esc returns", MessageSeverity.Info, "⌥C"); } /// Hands the keys back to the command line. Does nothing when the sidebar does not hold them. @@ -117,6 +117,9 @@ private bool TryRailKey(KeyPressedEventArgs e) case ConsoleKey.Escape: LeaveRailKeys(); break; + case ConsoleKey.G when bare: + ToggleGroupAtRailCursor(); + break; case ConsoleKey.Enter when bare: var row = BuildSidebar().NavigableRows().FirstOrDefault(r => SidebarModel.KeyOf(r) == _railCursor); LeaveRailKeys(); @@ -135,6 +138,30 @@ private bool TryRailKey(KeyPressedEventArgs e) return true; } + /// + /// g on a sidebar row: the row's character joins or leaves the send group (⌃P's Add … to the send group, + /// through the same id), and the keys stay in the sidebar so the next row can be added. A window row stands for its + /// owner; a row with no character refuses. + /// + private void ToggleGroupAtRailCursor() + { + var row = BuildSidebar().NavigableRows().FirstOrDefault(r => SidebarModel.KeyOf(r) == _railCursor); + var key = row?.Target switch + { + { } t when t.StartsWith(CommandIds.CharacterPrefix, StringComparison.Ordinal) => t[CommandIds.CharacterPrefix.Length..], + { } t when t.StartsWith(CommandIds.WindowPrefix, StringComparison.Ordinal) => + _workspace.FindWindow(t[CommandIds.WindowPrefix.Length..])?.SessionKey, + _ => null, + }; + if (key is null) + { + RefuseCommand("that row is no character — g adds a character to the send group"); + return; + } + + DispatchGroupCommand(CommandIds.GroupToggle(key)); + } + /// Moves the cursor by rows, clamped; the extremes of int go to the ends. private void MoveRailCursor(int step) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.RecentAlerts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.RecentAlerts.cs new file mode 100644 index 00000000..5c7b0234 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.RecentAlerts.cs @@ -0,0 +1,85 @@ +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Core.Session; + +namespace SharpMUTerm.Tui; + +/// +/// ⌃P ▸ Recent alerts: the pages and alerts this run has seen, every character's, newest first. Kept from +/// whether or not the desktop was asked (the player may have been looking +/// at another character's pane), in memory for the run and never saved. The entry opens the palette on them +/// (), one entry each, and choosing one goes to that character's +/// window through the same id a ⌃P Switch to … runs. +/// +internal sealed partial class SharpMUTermApp +{ + /// How many alerts are kept; the oldest goes first. + internal const int RecentAlertCap = 20; + + private readonly List _recentAlerts = []; + private int _nextAlertId = 1; + private bool _alertsListed; + + private sealed record KeptAlert(int Id, string SessionKey, AttentionReason Reason, string Text, DateTimeOffset At); + + /// The alerts kept, newest first, as ⌃P lists them; for the tests. + internal IReadOnlyList RecentAlerts => AlertRefs(); + + private void KeepAlert(string sessionKey, AttentionReason reason, string line, TimeSpan ago = default) + { + var text = line.ReplaceLineEndings(" ").Trim(); + _recentAlerts.Insert(0, new KeptAlert(_nextAlertId++, sessionKey, reason, text.Length <= 80 ? text : text[..79] + "…", _time.GetUtcNow() - ago)); + if (_recentAlerts.Count > RecentAlertCap) + { + _recentAlerts.RemoveAt(_recentAlerts.Count - 1); + } + } + + private IReadOnlyList AlertRefs() + { + var now = _time.GetUtcNow(); + return _recentAlerts.Select(a => new AlertRef(a.Id, DisplayName(a.SessionKey), a.Reason switch + { + AttentionReason.Page => "page", + AttentionReason.Name => "mentioned you", + _ => "alert", + }, a.Text, Age(now - a.At))).ToList(); + } + + private static string Age(TimeSpan ago) => ago.TotalSeconds < 60 + ? "just now" + : ago.TotalMinutes < 60 + ? $"{(int)ago.TotalMinutes} min ago" + : $"{(int)ago.TotalHours} h ago"; + + /// ⌃P ▸ Recent alerts: the palette, opened on the alerts. + private void ShowRecentAlerts() + { + if (_recentAlerts.Count == 0) + { + RefuseCommand("no pages or alerts yet this run"); + return; + } + + OpenMenu(Client.Commands.BuiltInCommands.AlertQuery); + } + + /// An alert entry: goes to its character's window. False when the alert is no longer kept. + private bool GoToAlert(string id) + { + var alert = int.TryParse(id, System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, out var n) + ? _recentAlerts.FirstOrDefault(a => a.Id == n) + : null; + if (alert is null) + { + RefuseCommand("that alert is no longer kept"); + return false; + } + + return DispatchCommand(CommandIds.Character(alert.SessionKey)); + } + + /// Keeps an alert as the session's event would, for a test or the demo scene. + internal void SimulateAlert(string sessionKey, AttentionReason reason, string text, TimeSpan ago = default) => + KeepAlert(sessionKey, reason, text, ago); +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs index 205f0eda..cb5b01ce 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.SendGroup.cs @@ -6,7 +6,7 @@ namespace SharpMUTerm.Tui; /// /// The send group: characters picked on ⌃P, marked ◆ on the rail, and sent one line together by -/// ⌃P ▸ Send the command line to the group. Lua reaches the same sessions by name through +/// ⌃P ▸ Send to group. Lua reaches the same sessions by name through /// world.sendTo. /// internal sealed partial class SharpMUTermApp diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs index 15234794..2e14daf7 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.TabOverflow.cs @@ -31,6 +31,9 @@ internal sealed partial class SharpMUTermApp /// The commands the last overflow list offered, so a choice can be checked against them. private MenuModel? _tabOverflowOffered; + /// The cells at a strip's right edge a chip takes, for deciding which clipped tab it covers: a space and +9 ▾. + private const int ChipReserve = 5; + /// The chip for a list: +3 ▾. internal static string TabOverflowChip(MenuModel menu) => $"+{menu.Entries.Count} ▾"; @@ -189,16 +192,34 @@ private void PaintTabOverflowChips(SharpConsoleUI.Layout.CharacterBuffer buffer) /// private List? HiddenTabs(TabControl tabs, int width) { - var seen = new HashSet(); + // Cells per tab along the whole strip, and left of where a chip would sit. A tab the framework clipped at the + // right edge to a letter or two (`R`) names nothing, and the chip is painted over it anyway: it counts as hidden + // unless the part left of the chip holds its pad and TabStripFit's floor (three letters and an ellipsis). + var total = new Dictionary(); + var shown = new Dictionary(); for (var x = 0; x < width; x++) { if (FrameworkHitTests.TabAt(tabs, x) is var index and >= 0) { - seen.Add(index); + total[index] = total.GetValueOrDefault(index) + 1; + if (x < width - ChipReserve) + { + shown[index] = shown.GetValueOrDefault(index) + 1; + } } } - if (seen.Count == 0 || seen.Count >= tabs.TabCount) + if (total.Count == 0) + { + return null; + } + + // Only the tab reaching the strip's last cell can have been clipped. + var edge = FrameworkHitTests.TabAt(tabs, width - 1); + var seen = total.Keys + .Where(i => i != edge || shown.GetValueOrDefault(i) >= Math.Min(total[i], 1 + TabStripFit.MinimumName)) + .ToHashSet(); + if (seen.Count >= tabs.TabCount) { return null; } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 7726e240..3959d4cc 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -935,7 +935,10 @@ public SharpMUTermApp( () => _active is { } acting ? DisplayName(acting.SessionKey) : null, id => DispatchCommand(id), _recentCommands, - () => CommandPaletteModel.Suggested(CommandState())); + () => CommandPaletteModel.Suggested(CommandState())) + { + KeepClearBelow = InputBandRows, + }; _messageLog = new MessageLogOverlay(_system, _diagnostics); _gameData = new GameDataOverlay(_system, _time); _screens = ScreenTheme.For(_theme); @@ -1912,6 +1915,19 @@ public string RenderSnapshot(string? view = null) OpenMenu(); } + // ⌃P ▸ Recent alerts over three kept pages and alerts, two characters', oldest first in time: the entry itself runs, + // so the palette opens on them the way it does live, each with its character and how long ago. + if (string.Equals(view, "menu-alerts", StringComparison.OrdinalIgnoreCase)) + { + SimulateAlert("Aetherfall.Rookery", SharpMUTerm.Core.Automation.AttentionReason.Page, + "Merrow pages: are you coming to the crypt?", TimeSpan.FromMinutes(14)); + SimulateAlert("Grapevine.Thistle", SharpMUTerm.Core.Automation.AttentionReason.Name, + "Ashlyn says, \"Thistle, the herbs came in.\"", TimeSpan.FromMinutes(3)); + SimulateAlert(DemoScene.ActiveSessionKey, SharpMUTerm.Core.Automation.AttentionReason.Page, + "Rivane pages: meet at the north gate"); + DispatchCommand(SharpMUTerm.Client.Commands.BuiltInCommands.RecentAlertsCommand); + } + // Help, opened by the ⌃P entry itself: the list, and a how-to page (the one that names join wraps). if (string.Equals(view, "help", StringComparison.OrdinalIgnoreCase)) { @@ -6121,6 +6137,22 @@ private void SyncInputHeights(bool secondShown) /// count is arithmetic on the text rather than a reading of the last frame: the veto has to be right /// on the first frame too, and nothing has been arranged yet when the window is built. /// + /// + /// The rows from the top of the input band (the prompt row, then the command lines) to the desktop's foot, as last + /// arranged — what a popup must leave uncovered so the line being typed stays in view. Zero before anything is + /// arranged. + /// + private int InputBandRows() + { + var tops = new[] { (IWindowControl)_promptRow, _input, _second } + .Where(c => c.Visible) + .Select(c => BoundsOf(c)) + .Where(b => b is { Height: > 0 }) + .Select(b => b!.Value.Y - _system.DesktopUpperLeft.Y) + .ToList(); + return tops.Count == 0 ? 0 : Math.Max(0, _system.DesktopDimensions.Height - tops.Min()); + } + private int ChromeRows() => // No row for a header the host draws: it is not in the cells, so the bars may have the row it would take. (_header.Visible ? InputLayout.WrappedRows(MarkupWidth(_header.Text), HeaderWidth()) : 0) @@ -7423,6 +7455,12 @@ private void RegisterFocusReportTab() return () => { CycleCharacter(-1); return true; }; } + // ⌥S sends the command line to the send group, as ⌃P ▸ Send to group does. + if (claim.Key == ConsoleKey.S) + { + return () => { SendToGroup(); return true; }; + } + // ⌥G walks to the next hit of the last search, so a reader following a name down a transcript // presses one key rather than reopening the surface for each. There is no backward chord — // see MacroKeys, where the measurement that rules ⌥⇧G out is recorded. @@ -8624,6 +8662,8 @@ private CommandContext CommandState() SceneLogging: _sceneLogs.ContainsKey(ActiveWindowId()), NewConfiguration: _config.Worlds.Count == 0 || _config.KeyTourPending, MapFound: MapFoundRooms(), + RecentAlerts: _recentAlerts.Count, + Alerts: _alertsListed ? AlertRefs() : null, ScriptFiles: !_scriptsListed || (_scriptsRoot is null && !DemoScriptsShown) ? null : ScriptFileRefs()); } @@ -8900,6 +8940,11 @@ private bool RunBuiltInCommand(string id) return OpenScriptFromPalette(id[SharpMUTerm.Client.Commands.BuiltInCommands.ScriptOpenPrefix.Length..]); } + if (id.StartsWith(SharpMUTerm.Client.Commands.BuiltInCommands.AlertPrefix, StringComparison.Ordinal)) + { + return GoToAlert(id[SharpMUTerm.Client.Commands.BuiltInCommands.AlertPrefix.Length..]); + } + if (id.StartsWith(SharpMUTerm.Client.Commands.BuiltInCommands.MapWalkPrefix, StringComparison.Ordinal)) { return WalkToFoundRoom(id[SharpMUTerm.Client.Commands.BuiltInCommands.MapWalkPrefix.Length..]); @@ -9201,6 +9246,9 @@ private bool RunBuiltInCommand(string id) case Client.Commands.BuiltInCommands.ScriptConsoleCommand: ShowScriptConsole(); break; + case Client.Commands.BuiltInCommands.RecentAlertsCommand: + ShowRecentAlerts(); + break; case Client.Commands.BuiltInCommands.ScriptEditCommand: ListScriptsToEdit(fromConsole: false); break; @@ -10062,6 +10110,12 @@ private void ToggleMenu() return; } + // The alert entries are listed only in the palette Recent alerts opened, so they never crowd any other. + if (!_palette.IsOpen) + { + _alertsListed = _openingQuery == Client.Commands.BuiltInCommands.AlertQuery; + } + // A host that draws ⌃P itself gets it, unless the cell popup is already up (then this closes that). if (_palette.IsOpen || !TryOpenNativePalette()) { diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 999d6ac5..3f2ebfb9 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -18,7 +18,7 @@ internal static class SnapshotViews "triggers-edit", "logging-edit", "keypad-edit", "password-edit", "startup-edit", "freeze", "freeze-scrollback", "spawn", "split", "split-stacked", "move", "drag", "history", "history-search", "history-search-filter", "draft", "draft2", - "menu", "menu-split", "menu-fuzzy", "menu-recent", "messages", "notices", "quit", "connections", "characters", + "menu", "menu-split", "menu-fuzzy", "menu-recent", "menu-alerts", "messages", "notices", "quit", "connections", "characters", "tint", "tint-input", "tint-input-moved", "tint-tabs", "compose", "compose-literal", "compose-preview", "moo-edit", "mssp", "mssp-none", "mssp-never", "web", "rail-long", "scrollback", "scrollback-up", "scrollback-split", "reflow", "links", "away", "away-scrollback", diff --git a/src/SharpMUTerm.Tui/TabStripFit.cs b/src/SharpMUTerm.Tui/TabStripFit.cs index aa0c1cd6..c1c38aa8 100644 --- a/src/SharpMUTerm.Tui/TabStripFit.cs +++ b/src/SharpMUTerm.Tui/TabStripFit.cs @@ -61,12 +61,13 @@ namespace SharpMUTerm.Tui; internal static class TabStripFit { /// - /// The fewest cells of name a background tab is cut to. Below three a name is an initial and an - /// ellipsis, which identifies nothing; at three there is still a syllable to recognise. It is a floor - /// rather than a guarantee — a strip narrower than its tabs at the floor is one the framework will - /// clip, and this cannot prevent that, only postpone it. + /// The fewest cells of name a background tab is cut to: three letters and the ellipsis. Below that a + /// name is an initial or two (Pu…), which identifies nothing; three letters are a syllable to + /// recognise. It is a floor rather than a guarantee — a strip narrower than its tabs at the floor is + /// one the framework will clip, and a tab it clips below the floor is counted into the overflow chip + /// (+N ▾) rather than left showing a letter. /// - internal const int MinimumName = 3; + internal const int MinimumName = 4; /// /// The fewest for the tab the pane is showing. Higher than on purpose: it diff --git a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs index dd1b7917..f66dce91 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenRenderer.cs @@ -1226,21 +1226,30 @@ internal static IEnumerable NamesHelpRows() const int room = 28; yield return WorldField(string.Empty, $"[{Label}]{Escape(HighlightColours.NameSyntax.Split(';')[0])}[/]"); yield return WorldField(string.Empty, $"[{Label}]{Escape(HighlightColours.NameSyntax.Split(';')[1].Trim())}[/]"); + // Each colour's name is drawn in that colour, held to the floor on the column's plane (black and grey lift on a + // dark screen), so the list is its own sample; the light screens re-hold it on theirs (ScreenTheme.Paint). + var plane = RgbJsonConverter.Parse(PanelBg); var line = "colours:"; + var markup = $"[{Label}]colours:[/]"; foreach (var colour in HighlightColours.NameColours) { if (line.Length > 0 && line.Length + 1 + colour.Length > room) { - yield return WorldField(string.Empty, $"[{Label}]{line}[/]"); + yield return WorldField(string.Empty, markup); line = string.Empty; + markup = string.Empty; } + var ink = HighlightColours.TryParse(colour, out var parsed) && HighlightColours.Hex(parsed) is { } hex + ? Contrast.Legible(RgbJsonConverter.Parse(hex), plane).ToHex() + : Label; + markup += (line.Length == 0 ? string.Empty : " ") + $"[{ink}]{Escape(colour)}[/]"; line = line.Length == 0 ? colour : line + " " + colour; } if (line.Length > 0) { - yield return WorldField(string.Empty, $"[{Label}]{line}[/]"); + yield return WorldField(string.Empty, markup); } } diff --git a/src/SharpMUTerm.Tui/WorldsScreenView.cs b/src/SharpMUTerm.Tui/WorldsScreenView.cs index 73a9894b..fe37430b 100644 --- a/src/SharpMUTerm.Tui/WorldsScreenView.cs +++ b/src/SharpMUTerm.Tui/WorldsScreenView.cs @@ -75,9 +75,12 @@ public static IWindowControl Build( // Body: WORLDS list │ detail, as two real columns. var worldsCol = ScreenChrome.Stretch(ScreenChrome.Panel( WorldsScreenRenderer.WorldsColumn(worlds, selectedWorld, focus, rows, info), scheme)); + // The detail column is what is left of the width after the WORLDS column, its rule and the spacer (32 cells); a + // value too long for it (`[x] TLS — encrypt this conne`) is elided to it rather than clipped by the control. var detailCol = ScreenChrome.Stretch(ScreenChrome.Panel( WorldsScreenRenderer - .DetailColumn(worlds, triggerSets, selectedWorld, selectedCharacter, accent, focus, rows, layouts, joinWrapsAdvice), + .DetailColumn(worlds, triggerSets, selectedWorld, selectedCharacter, accent, focus, rows, layouts, joinWrapsAdvice) + .ConvertAll(line => MarkupText.FitVisible(line, width - 32)), scheme)); var body = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) @@ -107,7 +110,10 @@ public static IWindowControl Build( // gives the full-width elevated band behind both. var formPanel = ScreenChrome.Panel(ScreenChrome.Indent(form), scheme, ScreenPalette.EditBg); formPanel.HorizontalAlignment = HorizontalAlignment.Left; - var trigPanel = ScreenChrome.Panel(triggers, scheme, ScreenPalette.EditBg); + // The checklist hugs its rows beside the 48-cell form and a 2-cell margin; on a narrow screen its notes + // (`channel + page routing`) are elided to what is left. + var trigPanel = ScreenChrome.Panel( + triggers.ConvertAll(line => MarkupText.FitVisible(line, width - 50)), scheme, ScreenPalette.EditBg); trigPanel.HorizontalAlignment = HorizontalAlignment.Left; var edit = Controls.HorizontalGrid() .WithAlignment(HorizontalAlignment.Stretch) diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs index cd4387ab..d7ca6ed0 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -304,7 +304,7 @@ [new MapViewExit(1, 2)], }); await Assert.That(walked).IsEquivalentTo(new long[] { 2 }); - await Assert.That(pan).IsEqualTo(new Vector(30, 12)); + await Assert.That(new Vector(Math.Round(pan.X, 6), Math.Round(pan.Y, 6))).IsEqualTo(new Vector(30, 12)); await Assert.That(zoom).IsGreaterThan(1.0); await Assert.That(clientSaw.Count).IsEqualTo(2).Because("only the right click is handed on, pressed and released"); await Assert.That(clientSaw[0]).Contains(MouseFlags.Button3Pressed); diff --git a/tests/SharpMUTerm.Avalonia.Tests/Wave18WindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/Wave18WindowTests.cs new file mode 100644 index 00000000..b0332695 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/Wave18WindowTests.cs @@ -0,0 +1,107 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Input; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// Wave 18's window fixes: the native map opens fitted to the rooms around the character with their names on, and stays +/// where the player puts it; a pop-out button shows only while the pointer is over its panel, and a one-row strip keeps +/// its right end for it rather than drawing text under it. +/// +public class Wave18WindowTests +{ + private static readonly VitalsModel Vitals = new( + [new VitalsMeter("hp", "412", "500", true, 412 / 500.0, false)], + null); + + private static MapViewModel Street() => new( + "Town", + 0, + [ + new MapViewRoom(1, "Plaza", 0, 0, Current: true, Ahead: false, Locked: false), + new MapViewRoom(2, "North Road", 0, -1, Current: false, Ahead: false, Locked: false), + new MapViewRoom(3, "East Gate", 1, 0, Current: false, Ahead: false, Locked: false), + ], + [new MapViewExit(1, 2), new MapViewExit(1, 3)], + null) + { + AnchorId = 1, + }; + + [Test] + public async Task TheMapOpensFittedToItsRoomsWithTheirNamesAndKeepsAViewThePlayerTook() + { + var (fitted, zoom, names, afterWheel, movedZoom, refitted) = await DesktopLayerTests.Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Panels( + [new PanelOverlay(PanelIds.Map, "map:demo", new PaneRect(0, 0, 60, 16), new PanelInk("#33ccff", "#ffaa33", "#555555"), null, Street(), _ => { })]); + DesktopLayerTests.Drain(); + window.UpdateLayout(); + var canvas = layer.Maps.Values.Single(); + var fitted = canvas.Fitted; + var zoom = canvas.Zoom; + var names = canvas.NamesShown; + + var middle = canvas.TranslatePoint(new Point(canvas.Bounds.Width / 2, canvas.Bounds.Height / 2), window)!.Value; + window.MouseWheel(middle, new Vector(0, -1)); + var afterWheel = canvas.Fitted; + var movedZoom = canvas.Zoom; + + window.MouseDown(middle, MouseButton.Left); + window.MouseUp(middle, MouseButton.Left); + window.MouseDown(middle, MouseButton.Left); + window.MouseUp(middle, MouseButton.Left); + return (fitted, zoom, names, afterWheel, movedZoom, canvas.Fitted); + }, columns: 60, rows: 16); + + await Assert.That(fitted).IsTrue(); + await Assert.That(zoom).IsGreaterThan(1.0).Because("three rooms in a 60-column pane are drawn larger than the old fixed scale"); + await Assert.That(names).IsTrue().Because("the names are drawn whenever a room step has room for them"); + await Assert.That(afterWheel).IsFalse().Because("a zoom is the player taking the view"); + await Assert.That(movedZoom).IsLessThan(zoom); + await Assert.That(refitted).IsTrue().Because("a double-click re-centres and fits again"); + } + + [Test] + public async Task APopOutButtonShowsOnlyUnderThePointerAndAStripKeepsItsCorner() + { + var result = await DesktopLayerTests.Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Panels( + [ + new PanelOverlay(PanelIds.Vitals, "panel:vitals:strip", new PaneRect(0, 0, 40, 1), new PanelInk("#3ccf6a", "#ff5555", "#333338"), Vitals, PopOut: () => { }), + new PanelOverlay(PanelIds.Vitals, "panel:vitals:pane", new PaneRect(0, 2, 40, 6), new PanelInk("#3ccf6a", "#ff5555", "#333338"), Vitals, PopOut: () => { }), + ]); + DesktopLayerTests.Drain(); + window.UpdateLayout(); + var strip = layer.PopOuts["panel:vitals:strip"]; + var pane = layer.PopOuts["panel:vitals:pane"]; + layer.SimulatePointer(null); + var awayStrip = (strip.IsVisible, strip.Hovering); + var awayPane = pane.IsVisible; + + var cell = view.SizeFor(1, 1); + layer.SimulatePointer(new Point(5 * cell.Width, 4 * cell.Height)); + var overPane = (pane.IsVisible, pane.Hovering, strip.Hovering); + + var gauges = layer.Gauges["panel:vitals:strip"]; + var stripRight = Canvas.GetLeft(gauges) + gauges.Width; + return (awayStrip, awayPane, overPane, stripRight, Canvas.GetLeft(strip), strip.Height, cell.Height); + }, columns: 40, rows: 10); + + await Assert.That(result.awayPane).IsFalse().Because("away from the panel the button does not cover its text"); + await Assert.That(result.awayStrip.Item1).IsTrue().Because("a strip's reserved corner stays, as its own plane"); + await Assert.That(result.awayStrip.Item2).IsFalse(); + await Assert.That(result.overPane.Item1).IsTrue(); + await Assert.That(result.overPane.Item2).IsTrue(); + await Assert.That(result.overPane.Item3).IsFalse(); + await Assert.That(result.stripRight).IsLessThanOrEqualTo(result.Item5).Because("the strip's own view ends before the button's corner"); + await Assert.That(result.Item6).IsEqualTo(result.Item7); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs b/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs index f4ee92ea..7d9cea99 100644 --- a/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/CommandPaletteModelTests.cs @@ -49,20 +49,37 @@ public async Task WordsAreMatchedInOrder_EachAfterTheLast() [Test] public async Task AWholePrefixBeatsAScatteredMatch() { - var prefix = FuzzyMatch.Match("layou", "Layouts")!; - var scattered = FuzzyMatch.Match("layou", "Clear window, say you")!; + // Six letters may scatter; the whole prefix still wins. (Five no longer may: see the next test.) + var prefix = FuzzyMatch.Match("layout", "Layouts")!; + var scattered = FuzzyMatch.Match("layout", "Clear window, say you two")!; await Assert.That(prefix.Score).IsGreaterThan(scattered.Score); // And a short query cannot scatter at all. await Assert.That(FuzzyMatch.Match("lay", "Clear window, say")).IsNull(); + await Assert.That(FuzzyMatch.Match("layou", "Clear window, say you")).IsNull(); + } + + /// + /// Five letters are short too: scene listed Import, Packages and the panel entries (an s, c, e, n, e spread over + /// their titles and details), wave 18's D7. It finds what starts or runs with it, and acronym-like word starts. + /// + [Test] + public async Task AFiveLetterWordMatchesOnlyAtWordStartsAndRuns() + { + await Assert.That(FuzzyMatch.Match("scene", "Start scene log")).IsNotNull(); + await Assert.That(FuzzyMatch.Match("scene", "Stop scene log")).IsNotNull(); + await Assert.That(FuzzyMatch.Match("scene", "Show client messages")).IsNull(); + await Assert.That(FuzzyMatch.Match("scene", "Import from another client…")).IsNull(); + await Assert.That(FuzzyMatch.Match("scene", "installed packages, on/off, remove")).IsNull(); + await Assert.That(FuzzyMatch.Match("scene", "players and creatures in the room · click a name to look")).IsNull(); } [Test] public async Task WordStartsBeatTheMiddleOfAWord() { - // f…p at two word starts, against an f and a p buried in words. - var starts = FuzzyMatch.Match("frzpn", "Freeze pane")!; - var buried = FuzzyMatch.Match("frzpn", "Fur-zip ink")!; + // f…p at two word starts, against an f and a p buried in words (six letters, so it may scatter at all). + var starts = FuzzyMatch.Match("frzpan", "Freeze pane")!; + var buried = FuzzyMatch.Match("frzpan", "Fairs, zapped, ran")!; await Assert.That(starts.Score).IsGreaterThan(buried.Score); } diff --git a/tests/SharpMUTerm.Tui.Tests/SendGroupTests.cs b/tests/SharpMUTerm.Tui.Tests/SendGroupTests.cs index 5ed0e1d7..e22b197d 100644 --- a/tests/SharpMUTerm.Tui.Tests/SendGroupTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/SendGroupTests.cs @@ -60,12 +60,12 @@ public async Task TheGroupIsOfferedOnceTwoCharactersAreOpenAndEachMemberIsMarked var titles = app.BuildCatalog().Select(i => i.Title).ToArray(); await Assert.That(titles).Contains("Add Ann to the send group"); - await Assert.That(titles).DoesNotContain("Send the command line to the group"); + await Assert.That(titles).DoesNotContain("Send to group"); app.DispatchCommand(CommandIds.GroupToggle("Mush.Ann")); titles = app.BuildCatalog().Select(i => i.Title).ToArray(); await Assert.That(titles).Contains("Remove Ann from the send group"); - await Assert.That(titles).Contains("Send the command line to the group"); + await Assert.That(titles).Contains("Send to group"); var rail = app.RailLines.Select(MarkupText.Plain).ToArray(); await Assert.That(rail.Single(l => l.Contains("Ann"))).Contains("◆"); @@ -96,4 +96,46 @@ public async Task ALineGoesOnceToEachConnectedMemberAndNotToTheOthers() await Assert.That(app.ArmedInputText).IsEqualTo(string.Empty); await Assert.That(app.Messages.Entries[^1].Text).Contains("not to Cy"); } + + /// ⌥C, then g on a row: that character joins the group, and the keys stay in the sidebar for the next. + [Test] + public async Task GOnASidebarRowTogglesThatCharacterInTheGroup() + { + var (app, _) = await Open("Ann", "Bob"); + await using var _app = app; + + app.SimulateKey(new ConsoleKeyInfo('c', ConsoleKey.C, false, true, false)); + await Assert.That(app.RailKeysActive).IsTrue(); + app.SimulateRailKey(new ConsoleKeyInfo('g', ConsoleKey.G, false, false, false)); + + await Assert.That(app.SendGroupKeys.Count).IsEqualTo(1); + await Assert.That(app.RailKeysActive).IsTrue().Because("g keeps the keys in the sidebar"); + + app.SimulateRailKey(new ConsoleKeyInfo('g', ConsoleKey.G, false, false, false)); + await Assert.That(app.SendGroupKeys.Count).IsEqualTo(0).Because("a second g takes the character out again"); + } + + /// ⌥S sends the command line to the group, as ⌃P ▸ Send to group does, and the entry names the chord. + [Test] + public async Task AltSSendsTheCommandLineToTheGroup() + { + var (app, wires) = await Open("Ann", "Bob"); + await using var _app = app; + app.DispatchCommand(CommandIds.GroupToggle("Mush.Ann")); + app.DispatchCommand(CommandIds.GroupToggle("Mush.Bob")); + + var entry = app.BuildCatalog().Single(i => i.Id == CommandIds.GroupSend); + await Assert.That(entry.Key).IsEqualTo("⌥S"); + + foreach (var c in "wave") + { + app.SimulateKey(new ConsoleKeyInfo(c, ConsoleKey.NoName, false, false, false)); + } + + app.SimulateKey(new ConsoleKeyInfo('s', ConsoleKey.S, false, true, false)); + await Task.Delay(50); + + await Assert.That(wires["Ann"].Lines).IsEquivalentTo(new[] { "wave" }); + await Assert.That(wires["Bob"].Lines).IsEquivalentTo(new[] { "wave" }); + } } diff --git a/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs b/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs index df5ba4fc..62b00367 100644 --- a/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/TabOverflowTests.cs @@ -104,9 +104,8 @@ public async Task AClickOnTheChipDoesNotAlsoSelectTheTabUnderIt() var click = new List { MouseFlags.Button1Released, MouseFlags.Button1Clicked }; var at = new System.Drawing.Point(chip.X + 1, chip.Y); - await Assert.That(app.AChipClickReachesTheTabUnderIt(paneId, filtered: false)).IsTrue() - .Because("unfiltered, the framework's own click on the chip's cells lands on the tab drawn under it — the defect"); - + // Since the tab floor (wave 18) a tab left with fewer than four cells beside the chip is counted under it, so in + // this fixture the chip sits on the strip's fill; the filter is still what keeps a press from reaching the strip. await Assert.That(app.TakesTabOverflowPress(press, at)).IsTrue(); await Assert.That(app.TakesTabOverflowPress(click, at)).IsTrue(); await Assert.That(press.Concat(click).Any(f => f.ToString().StartsWith("Button1", StringComparison.Ordinal))).IsFalse() diff --git a/tests/SharpMUTerm.Tui.Tests/Wave18PaletteAndScreenTests.cs b/tests/SharpMUTerm.Tui.Tests/Wave18PaletteAndScreenTests.cs new file mode 100644 index 00000000..b7ccbcbb --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/Wave18PaletteAndScreenTests.cs @@ -0,0 +1,125 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Core.Automation; +using SharpMUTerm.Core.Commands; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Wave 18's ⌃P, F5 and tab-strip fixes, read off real frames: the script entries' group, the five-letter match, +/// Recent alerts, the palette leaving the command line in view at 80×24, F5 eliding at 80 columns and the tab floor. +/// +[NotInParallel] +public class Wave18PaletteAndScreenTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp Demo(int width = 120, int height = 32) + { + Console.SetIn(TextReader.Null); + return new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(new HeadlessConsoleDriver(width, height), Caps)); + } + + [Test] + public async Task TheScriptEntriesAreUnderHelpAndSetupNotConnection() + { + await using var app = Demo(); + app.RenderSnapshot("script-list"); + var catalog = app.BuildCatalog(); + + var console = catalog.Single(i => i.Id == BuiltInCommands.ScriptConsoleCommand); + await Assert.That(console.Group).IsEqualTo(CommandGroup.Help); + var files = catalog.Where(i => i.Id.StartsWith(BuiltInCommands.ScriptOpenPrefix, StringComparison.Ordinal)).ToList(); + await Assert.That(files.Count).IsGreaterThan(0); + await Assert.That(files.All(f => f.Group == CommandGroup.Help)).IsTrue(); + + // Listed together or not at all (D7c): the files are listed here, so New script… is too. + await Assert.That(catalog.Select(i => i.Id)).Contains(BuiltInCommands.ScriptNewCommand); + await Assert.That(catalog.Select(i => i.Id)).Contains(BuiltInCommands.ScriptEditCommand); + } + + [Test] + public async Task SceneListsOnlyTheSceneEntries() + { + await using var app = Demo(); + app.RenderSnapshot(null); + var view = CommandPaletteModel.Build("scene", app.BuildCatalog()); + + await Assert.That(view.Entries.Count).IsGreaterThan(0); + await Assert.That(view.Entries.All(e => e.Item.Title.Contains("scene", StringComparison.OrdinalIgnoreCase) + || (e.Item.Detail ?? e.Item.Subtitle ?? string.Empty).Contains("scene", StringComparison.OrdinalIgnoreCase))).IsTrue() + .Because(string.Join(", ", view.Entries.Select(e => e.Item.Title))); + } + + [Test] + public async Task RecentAlertsListsEveryCharactersAlertsAndGoesToTheirWindow() + { + await using var app = Demo(); + var frame = string.Join("\n", FrameGrid.Decode(app.RenderSnapshot("menu-alerts"), 120, 32)); + + await Assert.That(app.RecentAlerts.Count).IsEqualTo(3); + await Assert.That(app.RecentAlerts[0].Text).Contains("north gate").Because("newest first"); + await Assert.That(frame).Contains("Alert · Corvid · Aetherfall: Rivane pages"); + await Assert.That(frame).Contains("Alert · Thistle · Grapevine"); + await Assert.That(frame).Contains("14 min ago"); + + var corvid = app.RecentAlerts[0]; + await Assert.That(app.DispatchCommand(BuiltInCommands.Alert(corvid.Id))).IsTrue(); + await Assert.That(app.DispatchCommand(BuiltInCommands.Alert(9999))).IsFalse().Because("an alert no longer kept refuses"); + } + + [Test] + public async Task TheAlertEntriesAreListedOnlyInThePaletteRecentAlertsOpened() + { + await using var app = Demo(); + app.RenderSnapshot(null); + await Assert.That(app.BuildCatalog().Any(i => i.Id == BuiltInCommands.RecentAlertsCommand)).IsFalse().Because("none kept yet"); + + app.SimulateAlert(DemoScene.ActiveSessionKey, AttentionReason.Page, "Rivane pages: hello"); + var catalog = app.BuildCatalog(); + await Assert.That(catalog.Single(i => i.Id == BuiltInCommands.RecentAlertsCommand).Title).IsEqualTo("Recent alerts (1)"); + await Assert.That(catalog.Any(i => i.Id.StartsWith(BuiltInCommands.AlertPrefix, StringComparison.Ordinal))).IsFalse() + .Because("a plain ⌃P is not crowded with them"); + } + + [Test] + public async Task ThePaletteLeavesTheCommandLineInViewAt80By24() + { + await using var app = Demo(80, 24); + var rows = FrameGrid.Decode(app.RenderSnapshot("menu"), 80, 24); + + await Assert.That(rows[22]).StartsWith("Corvid · Aetherfall ›").Because(rows[22]); + await Assert.That(rows.Take(22).Any(r => r.Contains('└'))).IsTrue().Because("the palette's bottom border is above it"); + } + + [Test] + public async Task F5ElidesItsValuesAt80Columns() + { + await using var app = Demo(80, 24); + var rows = FrameGrid.Decode(app.RenderSnapshot("worlds"), 80, 24); + + await Assert.That(rows.Any(r => r.TrimEnd().EndsWith("encrypt this conn…", StringComparison.Ordinal))).IsTrue() + .Because(string.Join("\n", rows)); + await Assert.That(rows.Any(r => r.Contains("channel + page …", StringComparison.Ordinal))).IsTrue(); + } + + [Test] + public async Task NoOverflowedTabIsCutBelowThreeLetters() + { + await using var app = Demo(80, 24); + var rows = FrameGrid.Decode(app.RenderSnapshot("tabs-many"), 80, 24); + var strip = rows.First(r => r.Contains('▾')); + + foreach (System.Text.RegularExpressions.Match cut in System.Text.RegularExpressions.Regex.Matches(strip, @"(\S+)…")) + { + await Assert.That(cut.Groups[1].Value.Length).IsGreaterThanOrEqualTo(3).Because(strip); + } + + // Nothing left of a clipped tab beside the chip: the cell before " +N ▾" is the strip's own fill or a tab's end. + var chip = strip.IndexOf(" +", StringComparison.Ordinal); + await Assert.That(strip[..chip].TrimEnd()).DoesNotEndWith(" R"); + } +} From cd3f115c6136cb26f032e5b38209eb80379eafda Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 17:09:09 +0000 Subject: [PATCH 062/113] Browse worlds: choose among a world's addresses; carry its charset; ask unnamed=!yes A pick whose game lists more than one telnet/TLS address (not gone) opens an address choice in the same surface, both hosts: host:port, TLS or plain, active/stale, not connectable where /connect would refuse it. The first connectable one is selected; Esc goes back to the list. The chosen address fills the connect form, TLS included, and mu*index's per-game CHARSET sets the world's encoding when it is a non-UTF-8 charset F5 offers. WorldDirectory now shows the directory's data as it states it (rows, order, counts and labels, addresses in order) and keeps only safety: https, size, time and row caps, text cleaning, ConnectEndpoint.Parse before the form. Every list asks unnamed=!yes. --plain gains /browse N M. New browse-worlds-endpoints view. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 32 ++- src/SharpMUTerm.Avalonia/WorldBrowseView.cs | 133 ++++++++++- src/SharpMUTerm.Client/Help/SlashCommands.cs | 3 +- src/SharpMUTerm.Client/Modals/WelcomeModel.cs | 10 +- .../Modals/WorldBrowseModel.cs | 110 ++++++++- .../Surfaces/SurfaceCatalog.cs | 4 + .../WorldIndex/WorldDirectory.cs | 217 +++++++++++++----- src/SharpMUTerm.Tui/DemoWorldDirectory.cs | 29 ++- src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs | 6 + .../SharpMUTermApp.WorldBrowse.cs | 173 ++++++++++++-- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 12 +- src/SharpMUTerm.Tui/SnapshotViews.cs | 2 +- src/SharpMUTerm.Tui/WelcomeSurface.cs | 16 +- src/SharpMUTerm.Tui/WorldBrowseSurface.cs | 108 ++++++++- .../SurfaceParityTests.cs | 17 +- .../WorldBrowseModelTests.cs | 47 +++- .../WorldIndex/WorldDirectoryTests.cs | 86 +++++-- tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs | 1 + .../SharpMUTerm.Tui.Tests/WorldBrowseTests.cs | 125 +++++++++- 20 files changed, 977 insertions(+), 159 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c52877e3..aeb802fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- Browse worlds: a world listed at several addresses (TLS and plain, another port, an old one) now lets you choose + which before the connect form opens; the form takes that address's TLS setting, and the world is saved with the + game's character set when mu*index names one other than UTF-8. `/browse N M` says address M in `--plain`. +- Browse worlds shows mu*index's list as mu*index gives it — every row, in its order, with its player counts and their + labels — and asks it to leave out games listed only by an address. - A script error in the script console that names a file and line is now a link: click it to open that script with the caret on the line and the line marked. Closing the editor goes back to the console. - The script editor numbers its lines in the desktop window too, and after a save whose reload fails, the line the diff --git a/CLAUDE.md b/CLAUDE.md index 7bfaa89e..6a851c4a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -788,20 +788,32 @@ fallbacks) for inline images/maps. - **Browse worlds lists mu*index, and a pick only fills in the welcome's connect form** (`WorldDirectory`, Core `WorldIndex/`; `WorldBrowseModel`/`WorldBrowseSession`, Client; `WorldBrowseSurface`, `SharpMUTermApp.WorldBrowse.cs`, `DemoWorldDirectory`, Tui; `WorldBrowseView`, Avalonia; the welcome's Browse row, ⌃P ▸ *Browse worlds…*, `/browse - [words]`, `/browse N`; surface `browse-worlds`; the `browse-worlds`, `-failed` and `-picked` views). Decisions: + [words]`, `/browse N`, `/browse N M`; surface `browse-worlds`; the `browse-worlds`, `-failed`, `-picked` and `-endpoints` + views). Decisions: - **Asked only when opened**, through `worldFetch:` (the `save:` family: null in tests and snapshots, which say they asked nothing; `Program` passes `WorldDirectory.DownloadAsync`; the demo answers from `DemoWorldDirectory`, made-up worlds on `.example` hosts). https only (`AppConfiguration.WorldDirectoryUrl`, default `https://mu-index.com/api`), 2 MiB capped - while streaming, 15 s, 200 rows; an answer from a stale request (newer question, or closed) is dropped by generation. - - **The answer is server text**: names, taglines and codebases are bounded and stripped of control, format (bidi), - private-use and unassigned characters (`WorldDirectory.Clean`); a row with no id or name, archived, or repeated is - dropped and counted; a player count is shown only when the directory says `measured`, or `declared` marked `~`. - - **A pick asks `GET /games/{id}` for the address**: `telnet` or `tls`, `active` before `stale`, never `gone`, newest - `lastSeenAt`, and only what `ConnectEndpoint.Parse` takes. Then Browse closes and the welcome's form opens prefilled - (`WelcomeSurface.Prefill`, `WelcomeModel.WorldName`); nothing is saved or dialled until its ⏎, which goes through - `ConnectFromWelcome` → `ConnectCommand` and names the world as listed (dropped if the host is edited). + while streaming, 15 s, 200 rows, 8 addresses a game; an answer from a stale request (newer question, or closed) is + dropped by generation. Every list asks `unnamed=!yes` (MUIndex's facet that leaves out games listed only by host:port). + - **The directory is the authority on its own data; the client does not second-guess it.** Rows are shown in its order, + archived, repeated, unnamed or id-less included (an id-less pick says so), with its player count and its label (`~` + declared, `?` unlabelled); addresses in its order, leaving out only `gone` and kinds this client cannot dial (websocket, + http). What stays is safety: the caps above, and every text is server text, bounded and stripped of control, format + (bidi), private-use and unassigned characters (`WorldDirectory.Clean`). + - **A pick asks `GET /games/{id}`.** One address goes straight to the form; several are a choice in the same surface + (`WorldBrowseModel.Choosing`, a `WorldGame`): `host:port`, TLS or plain, active or stale, the first connectable one + selected; Esc goes back to the list (`LeaveWorldChoice`), ⏎ is `ChooseWorldEndpoint`. An address `ConnectEndpoint.Parse` + refuses is listed `not connectable` and refused out loud, never put in the form. Then Browse closes and the welcome's + form opens prefilled (`WelcomeSurface.Prefill`: host, port, TLS, `WorldName`, `Encoding`); nothing is saved or dialled + until its ⏎, which goes through `ConnectFromWelcome` → `ConnectCommand` and names the world as listed (name and encoding + dropped if the host is edited). + - **Charset is the game's, not an address's.** mu*index's `GameView` has no per-endpoint charset; the only one is + `fields.CHARSET` (the precedence winner of a game field: handshake-measured or MSSP-declared, with `source`/`measured` + beside it). The choice says it once, for the whole game. A world is saved with an encoding only when that names a charset + F5 offers that is not UTF-8 or ASCII (`WorldDirectory.EncodingFor`: ISO-8859-1, CP1252, CP437); otherwise `auto`. - ⏎ on a search none of the held rows match asks the directory (`AsksDirectory`). Every listing shows the CC BY 4.0 - credit (`AttributionLine`). `--plain` says the rows as numbered lines and `/browse N` says the `/connect` line. + credit (`AttributionLine`). `--plain` says the rows as numbered lines; `/browse N` says the `/connect` line, or the + addresses numbered when there are several, and `/browse N M` says address M's. - *Browse packages* is unchanged; the welcome no longer leads there. The live API has not been exercised from here. - **The URLs a world prints as plain text are marked up by this client, because the terminal's own detection cannot survive a pane** (`UrlDetector`, Core; F7 ▸ `detect links in output`, default on). diff --git a/src/SharpMUTerm.Avalonia/WorldBrowseView.cs b/src/SharpMUTerm.Avalonia/WorldBrowseView.cs index a36fe40f..555c21c4 100644 --- a/src/SharpMUTerm.Avalonia/WorldBrowseView.cs +++ b/src/SharpMUTerm.Avalonia/WorldBrowseView.cs @@ -15,7 +15,8 @@ namespace SharpMUTerm.Avalonia; /// directory's licence asks for, and the keys. The rows are , the function the cell /// surface lists, so both hosts list the same rows. Enter on a row hands the pick to the client, which asks where the /// world is and opens the connect form in this modal's place; Enter on a search the rows cannot answer asks the -/// directory. Every word is the window's (). +/// directory. A world that answers at several addresses lists them in the same card (): +/// Enter hands the chosen one to the client, Esc goes back to the list. Every word is the window's (). /// internal sealed class WorldBrowseView : DockPanel, IModalView { @@ -26,6 +27,8 @@ internal sealed class WorldBrowseView : DockPanel, IModalView private readonly TextBlock _count; private readonly Button _sort; private readonly TextBlock _note; + private readonly TextBlock _footer; + private readonly DockPanel _bar; private readonly StackPanel _list; private readonly List _rows = []; private WorldBrowseModel _model; @@ -53,7 +56,7 @@ public WorldBrowseView(WorldBrowseSession session, NativeTokens colours, Action SetDock(_box, Dock.Top); Children.Add(_box); - var bar = new DockPanel { Margin = new Thickness(20, 0, 14, 4) }; + var bar = _bar = new DockPanel { Margin = new Thickness(20, 0, 14, 4) }; _sort = ModalParts.Button(SortLabel(), "Tab", colours, ToggleSort); SetDock(_sort, Dock.Right); bar.Children.Add(_sort); @@ -63,7 +66,7 @@ public WorldBrowseView(WorldBrowseSession session, NativeTokens colours, Action SetDock(bar, Dock.Top); Children.Add(bar); - var footer = ModalParts.Footer(string.Join(" · ", WorldBrowseModel.Keys.Select(k => $"{k.Key} {k.Label}")), colours); + var footer = _footer = ModalParts.Footer(KeysText(WorldBrowseModel.Keys), colours); SetDock(footer, Dock.Bottom); Children.Add(footer); @@ -111,6 +114,9 @@ public WorldBrowseView(WorldBrowseSession session, NativeTokens colours, Action /// The order the rows are in, for a test. public WorldDirectorySort Order => _order; + /// Whether a picked world's addresses are listed in place of the worlds, for a test. + public bool ChoosingAddress => _model.Choosing is not null; + /// The search box, for a test. public TextBox Box => _box; @@ -121,9 +127,15 @@ public WorldBrowseView(WorldBrowseSession session, NativeTokens colours, Action public void Detach() => _session.Changed -= OnChanged; - /// Enter on listed row , or on a search the rows cannot answer. + /// Enter on listed row , or on a search the rows cannot answer — or, while a world's addresses are listed, on address . public void Choose(int row) { + if (_model.Choosing is not null) + { + _session.Choose(row); + return; + } + if (_model.AsksDirectory(_query)) { _session.Ask(_query); @@ -162,25 +174,116 @@ private string SortLabel() private void OnChanged(WorldBrowseModel model) => Dispatcher.UIThread.Post(() => { - var rowsChanged = !ReferenceEquals(model.Rows, _model.Rows); + var rowsChanged = !ReferenceEquals(model.Rows, _model.Rows) || !ReferenceEquals(model.Choosing, _model.Choosing); + var leftChoice = _model.Choosing is not null && model.Choosing is null; _model = model; if (rowsChanged) { - _selected = 0; + _selected = Math.Max(0, model.Choosing?.FirstConnectable ?? 0); } ShowList(); + if (leftChoice) + { + _box.Focus(); + } }); + private static string KeysText(IReadOnlyList<(string Key, string Label)> keys) => + string.Join(" · ", keys.Select(k => $"{k.Key} {k.Label}")); + + /// A picked world's addresses, one row each: host:port, TLS or plain, and its state. + private void ShowChoice(WorldGame game) + { + _box.IsVisible = false; + _bar.IsVisible = false; + _footer.Text = NativeKeys.Words(KeysText(WorldBrowseModel.ChoiceKeys)); + _note.Text = NativeKeys.Words(_model.Problem ?? WorldBrowseModel.ChoiceNote); + _note.Foreground = _colours.Brush(_model.Problem is null ? _colours.Dim : _colours.Warn); + _list.Children.Clear(); + _rows.Clear(); + _list.Children.Add(new TextBlock + { + Text = _model.ChoiceLine, + Foreground = _colours.Brush(_colours.Text), + FontSize = NativeTokens.Title, + FontWeight = FontWeight.SemiBold, + Margin = new Thickness(12, 8, 12, 2), + TextWrapping = TextWrapping.Wrap, + }); + _list.Children.Add(new TextBlock + { + Text = _model.CharsetLine, + Foreground = _colours.Brush(_colours.Dim), + FontSize = NativeTokens.Body, + Margin = new Thickness(12, 0, 12, 8), + TextWrapping = TextWrapping.Wrap, + }); + _selected = Math.Clamp(_selected, 0, game.Endpoints.Count - 1); + for (var i = 0; i < game.Endpoints.Count; i++) + { + var endpoint = game.Endpoints[i]; + var (address, security, state) = WorldBrowseModel.Endpoint(endpoint); + var index = i; + var line = new DockPanel(); + var host = new TextBlock + { + Text = address, + Foreground = _colours.Brush(_colours.Text), + FontSize = NativeTokens.Title, + Width = 300, + Margin = new Thickness(0, 0, 12, 0), + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }; + SetDock(host, Dock.Left); + line.Children.Add(host); + var kind = new TextBlock + { + Text = security, + Foreground = _colours.Brush(endpoint.Tls ? _colours.Accent : _colours.Dim), + FontSize = NativeTokens.Body, + FontWeight = endpoint.Tls ? FontWeight.SemiBold : FontWeight.Normal, + Width = 64, + VerticalAlignment = VerticalAlignment.Center, + }; + SetDock(kind, Dock.Left); + line.Children.Add(kind); + line.Children.Add(new TextBlock + { + Text = state, + Foreground = _colours.Brush(endpoint.Stale || !endpoint.Connectable ? _colours.Warn : _colours.Dim), + FontSize = NativeTokens.Body, + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }); + var row = ModalParts.Row(line, address, () => Select(index), () => Choose(index)); + ToolTip.SetTip(row, WorldBrowseModel.EndpointText(endpoint)); + _rows.Add(row); + _list.Children.Add(row); + } + + Highlight(); + } + private void ShowList() { + if (_model.Choosing is { } game) + { + ShowChoice(game); + return; + } + + _box.IsVisible = true; + _bar.IsVisible = true; + _footer.Text = NativeKeys.Words(KeysText(WorldBrowseModel.Keys)); _view = _model.View(_query, _order); _count.Text = _model.CountLine(_query); _note.Text = NativeKeys.Words( _model.Opening is not null ? _model.OpeningLine : _model.State == WorldBrowseState.Ready && _model.Problem is { } problem ? problem : _model.State == WorldBrowseState.Ready && _view.Count > 0 - ? (_model.AnyDeclared ? WorldBrowseModel.DeclaredNote + " · " : string.Empty) + WorldBrowseModel.PickNote + ? _model.MarksNote + WorldBrowseModel.PickNote : string.Empty); _note.Foreground = _colours.Brush(_model.State == WorldBrowseState.Ready && _model.Problem is not null && _model.Opening is null ? _colours.Warn @@ -296,20 +399,30 @@ private void OnKey(object? sender, KeyEventArgs e) { case Key.Escape: e.Handled = true; + if (_model.Choosing is not null) + { + _session.Back(); + return; + } + _session.Dismiss(); _done(); return; case Key.Up: e.Handled = true; - Select(ModalParts.Step(_selected, -1, _view.Count)); + Select(ModalParts.Step(_selected, -1, _rows.Count)); return; case Key.Down: e.Handled = true; - Select(ModalParts.Step(_selected, 1, _view.Count)); + Select(ModalParts.Step(_selected, 1, _rows.Count)); return; case Key.Tab: e.Handled = true; - ToggleSort(); + if (_model.Choosing is null) + { + ToggleSort(); + } + return; case Key.Enter: e.Handled = true; diff --git a/src/SharpMUTerm.Client/Help/SlashCommands.cs b/src/SharpMUTerm.Client/Help/SlashCommands.cs index 68c3bd87..8df5baa6 100644 --- a/src/SharpMUTerm.Client/Help/SlashCommands.cs +++ b/src/SharpMUTerm.Client/Help/SlashCommands.cs @@ -21,7 +21,8 @@ public static class SlashCommands new("/welcome", "/welcome", "Show the first-run welcome again", "/welcome"), new("/welcome", "/welcome layout roleplay|combat|suggested", "Choose the starting layout the welcome offers", "/welcome layout "), new("/browse", "/browse [words]", "Browse worlds listed on mu*index, searched for the words; a pick fills in the connect form", "/browse "), - new("/browse", "/browse ", "Where world n of the list /browse said is (with no screen to read, the /connect line to type)", "/browse "), + new("/browse", "/browse ", "Where world n of the list /browse said is (with no screen to read, the /connect line to type, or its addresses numbered when it has several)", "/browse "), + new("/browse", "/browse ", "Address m of world n, when it answers at several (TLS, plain, another port): its /connect line", "/browse "), new("/import", "/import ", "Import worlds, characters and automation from MUSHclient, Mudlet or TinTin++; nothing is written before Enter", "/import "), new("/package", "/package", "Open the Packages screen (F10)", "/package"), new("/package", "/package browse", "Browse the package index, this game's packages first", "/package browse"), diff --git a/src/SharpMUTerm.Client/Modals/WelcomeModel.cs b/src/SharpMUTerm.Client/Modals/WelcomeModel.cs index 52c53bb8..676faa94 100644 --- a/src/SharpMUTerm.Client/Modals/WelcomeModel.cs +++ b/src/SharpMUTerm.Client/Modals/WelcomeModel.cs @@ -41,7 +41,8 @@ public enum WelcomeField /// /// The first-run welcome's model: the menu or the connect form, with everything either says. Drawn by the cell /// surface (WelcomeSurface.Render) and by the window's native one. IndexProblem is why Browse worlds cannot -/// ask the world directory (null when it can); WorldName is the world Browse worlds filled the form in for. +/// ask the world directory (null when it can); WorldName is the world Browse worlds filled the form in for, and +/// Encoding the encoding the world will be saved with because mu*index named a non-UTF-8 charset for it (null: auto). /// public sealed record WelcomeModel( bool InForm, @@ -55,7 +56,8 @@ public sealed record WelcomeModel( bool PasswordLater, string? Problem, string? IndexProblem, - string? WorldName = null) + string? WorldName = null, + string? Encoding = null) { /// The example the surface names, a host nobody owns (RFC 2606). public const string ExampleCommand = "/connect mud.example.org 4201 tls"; @@ -93,7 +95,9 @@ public sealed record WelcomeModel( /// public string FormIntroLine => WorldName is null ? FormIntro - : $"{WorldName}, as listed on mu*index. Check it and press ⏎ to save and connect."; + : Encoding is { } encoding + ? $"{WorldName}, as listed on mu*index, saved with encoding {encoding}. Check it and press ⏎ to save and connect." + : $"{WorldName}, as listed on mu*index. Check it and press ⏎ to save and connect."; /// The TLS row's words when on; the window's check box carries these words. public const string TlsOn = "On, encrypted"; diff --git a/src/SharpMUTerm.Client/Modals/WorldBrowseModel.cs b/src/SharpMUTerm.Client/Modals/WorldBrowseModel.cs index a99b96dd..3caa812a 100644 --- a/src/SharpMUTerm.Client/Modals/WorldBrowseModel.cs +++ b/src/SharpMUTerm.Client/Modals/WorldBrowseModel.cs @@ -31,13 +31,18 @@ public enum WorldBrowseState /// The words the directory was last asked to search for, or empty for its most played. /// Why the list failed or cannot be asked, or why the last pick did not open; null when nothing. /// The world whose address is being asked for after a pick, or null. +/// +/// A picked world that answers at more than one usable address, while the player chooses one; null otherwise. A world +/// with one address goes straight to the connect form and is never chosen here. +/// public sealed record WorldBrowseModel( WorldBrowseState State, IReadOnlyList Rows, int Total, string AskedFor, string? Problem, - string? Opening) + string? Opening, + WorldGame? Choosing = null) { // The surface's words, said once here so both hosts say them alike. @@ -66,6 +71,12 @@ public sealed record WorldBrowseModel( /// What the mark means, said only while a row carries it. public const string DeclaredNote = "~ a count the game reports about itself"; + /// What a count the directory does not label measured or declared is marked with. + public const string UnlabelledMark = "?"; + + /// What that mark means, said only while a row carries it. + public const string UnlabelledNote = "? a count mu*index does not label"; + /// The keys that act, in glyphs: the cells ladder them, the window spells them in words. public static IReadOnlyList<(string Key, string Label)> Keys { get; } = [ @@ -75,6 +86,46 @@ public sealed record WorldBrowseModel( ("Esc", "closes"), ]; + /// The keys while an address is being chosen. + public static IReadOnlyList<(string Key, string Label)> ChoiceKeys { get; } = + [ + ("↑↓", "pick"), + ("⏎", "connect form"), + ("Esc", "back"), + ]; + + /// What the address choice says under its rows. + public const string ChoiceNote = "⏎ fills in the connect form with this address; nothing is saved or dialled until you press ⏎ there."; + + /// The address choice's first line: whose addresses, and how many. + public string ChoiceLine => Choosing is { } game + ? $"{game.Name} answers at {game.Endpoints.Count} addresses — choose one" + : string.Empty; + + /// + /// What the address choice says about text encoding: the charset mu*index names for the whole game (it names none + /// per address), and whether the form will set the world's encoding from it. + /// + public string CharsetLine => Choosing is not { } game ? string.Empty + : game.Charset is not { } charset ? "mu*index names no charset for it; the world's encoding stays auto" + : game.Encoding is { } encoding ? $"charset {charset} for the whole game (not per address) · the form sets encoding {encoding}" + : $"charset {charset} for the whole game (not per address) · the world's encoding stays auto"; + + /// An address's columns as both hosts write them: host:port, TLS or plain, and its state. + public static (string Address, string Security, string State) Endpoint(WorldEndpoint endpoint) + { + ArgumentNullException.ThrowIfNull(endpoint); + var state = endpoint.Stale ? "stale · not reached lately" : "active"; + return (endpoint.Address, endpoint.Tls ? "TLS" : "plain", endpoint.Connectable ? state : $"{state} · not connectable"); + } + + /// An address as one line (--plain, a tooltip). + public static string EndpointText(WorldEndpoint endpoint) + { + var (address, security, state) = Endpoint(endpoint); + return $"{address} — {security} — {state}"; + } + /// A sort's name as both hosts say it. public static string SortName(WorldDirectorySort sort) => sort == WorldDirectorySort.Name ? "by name" : "by players"; @@ -82,12 +133,16 @@ public sealed record WorldBrowseModel( public static WorldDirectorySort Next(WorldDirectorySort sort) => sort == WorldDirectorySort.Players ? WorldDirectorySort.Name : WorldDirectorySort.Players; - /// A row's player count as both hosts write it: 12, ~12 for a declared one, – for none. + /// + /// A row's player count as both hosts write it, with the directory's label: 12 measured, ~12 declared, + /// ?12 unlabelled, – for none. + /// public static string Players(WorldListing row) { ArgumentNullException.ThrowIfNull(row); return row.Players is not { } count ? "–" - : (row.Count == WorldPlayerCount.Declared ? DeclaredMark : string.Empty) + count.ToString(CultureInfo.InvariantCulture); + : (row.Count switch { WorldPlayerCount.Declared => DeclaredMark, WorldPlayerCount.Unknown => UnlabelledMark, _ => string.Empty }) + + count.ToString(CultureInfo.InvariantCulture); } /// @@ -153,38 +208,57 @@ public string CountLine(string? query) } /// Whether any row carries a count the game reports about itself, so is said. - public bool AnyDeclared => Rows.Any(r => r.Count == WorldPlayerCount.Declared); + public bool AnyDeclared => Rows.Any(r => r.Players is not null && r.Count == WorldPlayerCount.Declared); + + /// Whether any row carries a count the directory does not label, so is said. + public bool AnyUnlabelled => Rows.Any(r => r.Players is not null && r.Count == WorldPlayerCount.Unknown); + + /// What the marks on the counts listed mean, joined, followed by " · "; empty when no row is marked. + public string MarksNote => + string.Concat( + AnyDeclared ? DeclaredNote + " · " : string.Empty, + AnyUnlabelled ? UnlabelledNote + " · " : string.Empty); public bool Equals(WorldBrowseModel? other) => other is not null && State == other.State && Total == other.Total && AskedFor == other.AskedFor - && Problem == other.Problem && Opening == other.Opening && ModelLists.Same(Rows, other.Rows); + && Problem == other.Problem && Opening == other.Opening && Equals(Choosing, other.Choosing) && ModelLists.Same(Rows, other.Rows); - public override int GetHashCode() => HashCode.Combine(State, Total, AskedFor, Problem, Opening, ModelLists.Hash(Rows)); + public override int GetHashCode() => HashCode.Combine(State, Total, AskedFor, Problem, Opening, Choosing, ModelLists.Hash(Rows)); } /// /// One opening of Browse worlds in a host's own controls. The host filters and sorts the model's rows itself /// (); a pick and a search the rows held cannot answer come back through here to the /// methods the cell surface's ⏎ ends in. A pick does not close the surface: the client asks where the world is, and -/// closes it once the connect form opens in its place. +/// closes it once the connect form opens in its place — or, when the world answers at several addresses, publishes them +/// () for or . /// public sealed class WorldBrowseSession : ModalSession { private readonly Action _pick; private readonly Action _ask; + private readonly Action _choose; + private readonly Action _back; /// What the surface lists now. /// Whether the client's theme is a dark one. /// Picks row N of . /// Asks the directory to search for the words. + /// Chooses address N of . + /// Leaves the address choice for the list. /// Told the surface closed. - public WorldBrowseSession(WorldBrowseModel model, bool isDark, Action pick, Action ask, Action closed) + public WorldBrowseSession( + WorldBrowseModel model, bool isDark, Action pick, Action ask, Action choose, Action back, Action closed) : base(model, isDark, closed) { ArgumentNullException.ThrowIfNull(pick); ArgumentNullException.ThrowIfNull(ask); + ArgumentNullException.ThrowIfNull(choose); + ArgumentNullException.ThrowIfNull(back); _pick = pick; _ask = ask; + _choose = choose; + _back = back; } public override string Surface => "browse-worlds"; @@ -195,7 +269,7 @@ public WorldBrowseSession(WorldBrowseModel model, bool isDark, Action pick, /// The host's: ⏎ on row of . public void Pick(int index) { - if (!IsEnded && index >= 0 && index < Model.Rows.Count) + if (!IsEnded && Model.Choosing is null && index >= 0 && index < Model.Rows.Count) { _pick(index); } @@ -210,4 +284,22 @@ public void Ask(string query) _ask(query.Trim()); } } + + /// The host's: ⏎ on address of . + public void Choose(int index) + { + if (!IsEnded && Model.Choosing is { } game && index >= 0 && index < game.Endpoints.Count && game.Endpoints[index].Connectable) + { + _choose(index); + } + } + + /// The host's: Esc while an address is being chosen, back to the list. + public void Back() + { + if (!IsEnded && Model.Choosing is not null) + { + _back(); + } + } } diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 49c2c84d..ab372e3a 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -523,6 +523,10 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), // saved or dialled before the player's own Enter there. A query the rows held cannot answer is asked of it. new(SurfaceActionKind.Modal, "pick", "PickWorld"), new(SurfaceActionKind.Modal, "ask", "AskWorldDirectory"), + + // A world that answers at several addresses is chosen from first (TLS active first); Esc goes back. + new(SurfaceActionKind.Modal, "choose", "ChooseWorldEndpoint"), + new(SurfaceActionKind.Modal, "back", "LeaveWorldChoice"), ], NativeModal, "SharpMUTerm.Tui.WorldBrowseSurface.Render", diff --git a/src/SharpMUTerm.Core/WorldIndex/WorldDirectory.cs b/src/SharpMUTerm.Core/WorldIndex/WorldDirectory.cs index 37d1ccda..a1cbd562 100644 --- a/src/SharpMUTerm.Core/WorldIndex/WorldDirectory.cs +++ b/src/SharpMUTerm.Core/WorldIndex/WorldDirectory.cs @@ -29,15 +29,18 @@ public enum WorldPlayerCount } /// One world as the directory lists it, every text already bounded and stripped of control characters. -/// The directory's durable key, for asking where the world is. +/// The directory's durable key, for asking where the world is; when the row gave none it could read. /// Its name. /// Its one-line description, or empty. /// The server software family (PennMUSH), or empty when unknown. -/// Players counted now, or null. -/// How was obtained. +/// Players now, as the directory says, or null. +/// How was obtained, as the directory labels it. public sealed record WorldListing(Guid Id, string Name, string Tagline, string Codebase, int? Players, WorldPlayerCount Count); -/// A page of the directory: the rows read, how many the directory holds for the question, and how many rows it sent that were not read. +/// +/// A page of the directory: the rows read, in the directory's order, how many it holds for the question, and how many rows +/// it sent that were not read — past , or not a JSON object. +/// public sealed record WorldListPage(IReadOnlyList Rows, int Total, int Dropped) { public bool Equals(WorldListPage? other) => @@ -47,15 +50,83 @@ public bool Equals(WorldListPage? other) => } /// Where a world is: one telnet address the directory has seen it answer at, checked as /connect checks one. -public sealed record WorldAddress(string Name, string Host, int Port, bool Tls); +/// The world's name. +/// The host. +/// The port. +/// Whether the address is a TLS one. +/// +/// The encoding a world added from here is set to (one of F5's names), or null to leave it auto: set only when the +/// directory names a charset that is not UTF-8 and not ASCII (). +/// +public sealed record WorldAddress(string Name, string Host, int Port, bool Tls, string? Encoding = null); + +/// +/// One address a game answers at, as the directory lists it: a telnet or tls endpoint it does not call gone. +/// +/// The host: as read it, or the directory's text, cleaned and bounded, when it could not. +/// The port, or 0 when the directory gave none. +/// Whether it is a TLS address (the directory's tls kind, or TLS it measured there). +/// Whether the directory calls it stale: listed, not reached lately. +/// +/// Whether — the reader /connect uses — takes it. One it refuses is still listed, +/// marked not connectable, and is never put in the connect form. +/// +public sealed record WorldEndpoint(string Host, int Port, bool Tls, bool Stale, bool Connectable = true) +{ + /// host:port, an IPv6 host in brackets. + public string Address => $"{(Host.Contains(':') ? $"[{Host}]" : Host)}:{Port.ToString(CultureInfo.InvariantCulture)}"; +} + +/// +/// A game's page read down to what a connect needs: its telnet and TLS addresses in the order the directory lists them, +/// and the charset it names for the whole game, if any. +/// +/// The game's name. +/// At least one address, at most , in the directory's order. +/// The game's charset as the directory names it (bounded, cleaned), or null when it names none. +public sealed record WorldGame(string Name, IReadOnlyList Endpoints, string? Charset) +{ + /// The first address that can be dialled — the default — or -1 when none can. + public int FirstConnectable + { + get + { + for (var i = 0; i < Endpoints.Count; i++) + { + if (Endpoints[i].Connectable) + { + return i; + } + } + + return -1; + } + } + + /// The encoding a world added from this game is set to, or null to leave it auto. + public string? Encoding => WorldDirectory.EncodingFor(Charset); + + /// Endpoint as the address the connect form is filled in with. + public WorldAddress Address(int index) + { + var endpoint = Endpoints[index]; + return new WorldAddress(Name, endpoint.Host, endpoint.Port, endpoint.Tls, Encoding); + } + + public bool Equals(WorldGame? other) => + other is not null && Name == other.Name && Charset == other.Charset && Endpoints.SequenceEqual(other.Endpoints); + + public override int GetHashCode() => HashCode.Combine(Name, Charset, Endpoints.Count); +} /// /// The client side of mu*index (https://mu-index.com), the MU* directory Browse worlds lists: what to ask, how much of /// an answer to read, and how to read it. Everything that comes back is server text: a name or a tagline is -/// bounded and stripped of control characters before anything draws it, an address is read by -/// (the reader /connect uses) or not at all, and a row that breaks a rule is -/// dropped and counted rather than failing the list. The listing carries no address, so it is asked for one game at a -/// time, when the player picks it (). +/// bounded and stripped of control characters before anything draws it, and an address goes into the connect form only +/// if (the reader /connect uses) takes it. Otherwise what the directory says +/// is shown as it says it — its rows, their order, its counts and their labels, its addresses in its order — because the +/// directory is the authority on its own data; the client caps how much it reads and asks for nothing at start. The +/// listing carries no address, so it is asked for one game at a time, when the player picks it (). /// public static class WorldDirectory { @@ -77,6 +148,15 @@ public static class WorldDirectory /// The longest a codebase is kept. public const int MaxCodebase = 32; + /// The longest host shown for an address the client could not read as one. + public const int MaxHostShown = 64; + + /// The longest charset name kept. + public const int MaxCharset = 32; + + /// The most addresses one game offers. + public const int MaxEndpoints = 8; + /// The longest query sent. public const int MaxQuery = 64; @@ -97,7 +177,8 @@ public static class WorldDirectory return null; } - var text = new StringBuilder(root).Append("/games?limit=").Append(MaxRows).Append("&sort=players"); + // unnamed=!yes: the directory leaves out games it lists only by host:port (MUIndex's `unnamed` facet). + var text = new StringBuilder(root).Append("/games?limit=").Append(MaxRows).Append("&sort=players&unnamed=!yes"); var q = Clean(query, MaxQuery); if (q.Length > 0) { @@ -144,17 +225,16 @@ public static (WorldListPage? Page, string? Problem) ParseList(ReadOnlySpan(); - var seen = new HashSet(); var dropped = 0; foreach (var game in games.EnumerateArray()) { - if (rows.Count >= MaxRows || ReadListing(game) is not { } row || !seen.Add(row.Id)) + if (rows.Count >= MaxRows || game.ValueKind != JsonValueKind.Object) { dropped++; continue; } - rows.Add(row); + rows.Add(ReadListing(game)); } var total = root.TryGetProperty("total", out var t) && t.ValueKind == JsonValueKind.Number && t.TryGetInt32(out var n) && n >= 0 @@ -168,46 +248,32 @@ public static (WorldListPage? Page, string? Problem) ParseList(ReadOnlySpan= 0 and < 1_000_000 ? count : null; - var how = players is null ? WorldPlayerCount.Unknown : Text(game, "playersNowState") switch + var how = Text(game, "playersNowState") switch { "measured" => WorldPlayerCount.Measured, "declared" => WorldPlayerCount.Declared, _ => WorldPlayerCount.Unknown, }; - // A number the directory will not say it measured is not shown as one. - if (how == WorldPlayerCount.Unknown) - { - players = null; - } - - return new WorldListing(id, name, Clean(Text(game, "tagline"), MaxTagline), Clean(Text(game, "codebase"), MaxCodebase), players, how); + return new WorldListing( + id, Clean(Text(game, "name"), MaxName), Clean(Text(game, "tagline"), MaxTagline), Clean(Text(game, "codebase"), MaxCodebase), players, how); } /// - /// Reads a GET /games/{id} answer (GameView) down to the one address to offer: a telnet or - /// tls endpoint, never one the directory calls gone; active before stale, then the one - /// seen most recently. An address refuses is skipped. + /// Reads a GET /games/{id} answer (GameView) down to its addresses, in the order the directory lists + /// them: telnet and tls endpoints (a websocket or http one is not a telnet address) that it does not call + /// gone, at most . An address refuses is listed and + /// marked not connectable. The charset is the game's fields.CHARSET value — the directory's one charset field, + /// which names no address. /// - public static (WorldAddress? Address, string? Problem) ParseGame(ReadOnlySpan json) + public static (WorldGame? Game, string? Problem) ParseGame(ReadOnlySpan json) { if (json.Length > MaxResponseBytes) { @@ -229,46 +295,39 @@ public static (WorldAddress? Address, string? Problem) ParseGame(ReadOnlySpan(); + var listed = new List(); foreach (var endpoint in endpoints.EnumerateArray().Take(64)) { - if (endpoint.ValueKind != JsonValueKind.Object) + if (listed.Count >= MaxEndpoints) { - continue; + break; } var kind = Text(endpoint, "kind"); - var rank = Text(endpoint, "state") switch - { - "active" => 0, - "stale" => 1, - _ => -1, - }; - if (kind is not ("telnet" or "tls") || rank < 0 - || Text(endpoint, "host") is not { Length: > 0 and <= 253 } host - || host.Any(c => char.IsWhiteSpace(c) || char.IsControl(c)) - || !endpoint.TryGetProperty("port", out var portValue) || portValue.ValueKind != JsonValueKind.Number - || !portValue.TryGetInt32(out var port) - || ConnectEndpoint.Parse([host, port.ToString(CultureInfo.InvariantCulture)]) is not { } parsed) + var state = Text(endpoint, "state"); + if (endpoint.ValueKind != JsonValueKind.Object || kind is not ("telnet" or "tls") || state == "gone") { continue; } + var host = Text(endpoint, "host") ?? string.Empty; + var port = endpoint.TryGetProperty("port", out var portValue) && portValue.ValueKind == JsonValueKind.Number + && portValue.TryGetInt32(out var number) ? number : 0; var tls = kind == "tls" || (endpoint.TryGetProperty("tlsMeasured", out var measured) && measured.ValueKind == JsonValueKind.True); - var seen = Text(endpoint, "lastSeenAt") is { } at - && DateTimeOffset.TryParse(at, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out var when) - ? when - : DateTimeOffset.MinValue; - candidates.Add((new WorldAddress(name.Length == 0 ? parsed.Host : name, parsed.Host, parsed.Port, tls), rank, seen)); + var parsed = host.Length is > 0 and <= 253 && !host.Any(c => char.IsWhiteSpace(c) || char.IsControl(c)) && port is > 0 and <= 65535 + ? ConnectEndpoint.Parse([host, port.ToString(CultureInfo.InvariantCulture)]) + : null; + listed.Add(parsed is { } ok + ? new WorldEndpoint(ok.Host, ok.Port, tls, state == "stale") + : new WorldEndpoint(Clean(host, MaxHostShown), Math.Clamp(port, 0, 65535), tls, state == "stale", Connectable: false)); } - if (candidates.Count == 0) + if (listed.Count == 0) { - return (null, "the directory lists no telnet address for it that answers"); + return (null, "the directory lists no telnet address for it"); } - var best = candidates.OrderBy(c => c.Rank).ThenByDescending(c => c.Seen).First(); - return (best.Address, null); + return (new WorldGame(name.Length == 0 ? listed[0].Host : name, listed, Charset(root)), null); } catch (JsonException) { @@ -276,6 +335,40 @@ public static (WorldAddress? Address, string? Problem) ParseGame(ReadOnlySpanThe game's fields.CHARSET value, cleaned and bounded; null when there is none. + private static string? Charset(JsonElement root) + { + if (!root.TryGetProperty("fields", out var fields) || fields.ValueKind != JsonValueKind.Object + || !fields.TryGetProperty("CHARSET", out var field) || field.ValueKind != JsonValueKind.Object) + { + return null; + } + + var value = Clean(Text(field, "value"), MaxCharset); + return value.Length > 0 ? value : null; + } + + /// + /// The F5 encoding a world is set to for a directory's , or null to leave it auto: + /// UTF-8, ASCII (which UTF-8 reads) and any name the client does not offer stay auto, so CHARSET still decides. + /// + public static string? EncodingFor(string? charset) + { + if (string.IsNullOrWhiteSpace(charset)) + { + return null; + } + + var key = new string(charset.Where(char.IsAsciiLetterOrDigit).ToArray()).ToUpperInvariant(); + return key switch + { + "ISO88591" or "LATIN1" or "ISOLATIN1" or "L1" or "ISOIR100" or "CP819" or "IBM819" => "ISO-8859-1", + "CP1252" or "WINDOWS1252" => "CP1252", + "CP437" or "IBM437" or "437" => "CP437", + _ => null, + }; + } + /// /// Server text made safe to draw: control, format (bidirectional overrides included), private-use and astral characters and line breaks /// become spaces, runs of space collapse, and what is left is cut to with an ellipsis. diff --git a/src/SharpMUTerm.Tui/DemoWorldDirectory.cs b/src/SharpMUTerm.Tui/DemoWorldDirectory.cs index acb7818a..fab87144 100644 --- a/src/SharpMUTerm.Tui/DemoWorldDirectory.cs +++ b/src/SharpMUTerm.Tui/DemoWorldDirectory.cs @@ -3,7 +3,9 @@ namespace SharpMUTerm.Tui; /// /// The demo scene's world directory: a mu*index listing and the pages it names, in mu*index's own JSON shapes /// (GameListView, GameView, camelCase), answered from memory. Every world here is made up and every host is -/// under .example (RFC 2606), so a demo that picks one and presses ⏎ dials nothing real. +/// under .example (RFC 2606), so a demo that picks one and presses ⏎ dials nothing real. Aetherfall answers at three +/// addresses (TLS, plain, and a stale old port) and names a charset, so a pick of it shows the address choice; every other +/// world has one usable address and goes straight to the connect form. /// internal static class DemoWorldDirectory { @@ -46,12 +48,29 @@ public static string Answer(Uri uri) private static string Summary(Game g) => $$"""{"id":"{{g.Id}}","slug":"{{g.Name.ToLowerInvariant().Replace(' ', '-')}}","name":{{Json(g.Name)}},"tagline":{{Json(g.Tagline)}},"state":"active","archived":false,"claimed":false,"playersNow":{{(g.Players is { } p ? p.ToString(System.Globalization.CultureInfo.InvariantCulture) : "null")}},"playersNowState":"{{g.Count}}","playersNowProvenance":null,"codebase":{{Json(g.Codebase)}},"codebaseProvenance":null,"measuredProtocols":["gmcp","mssp"],"lastReachableAt":"2026-11-04T11:40:00+00:00","url":"/g/{{g.Id}}","apiUrl":"/api/games/{{g.Id}}"}"""; + private const string Seen = "\"firstSeenAt\":\"2024-01-01T00:00:00+00:00\",\"lastSeenAt\":\"2026-11-04T11:40:00+00:00\""; + + private static string Endpoint(string host, int port, string kind, string state, string seen = Seen) => + $$"""{"host":"{{host}}","port":{{port}},"kind":"{{kind}}","tlsMeasured":{{(kind == "tls" ? "true" : "false")}},{{seen}},"state":"{{state}}"}"""; + private static string Page(Game g) { - var endpoints = g.Tls - ? $$"""[{"host":"{{g.Host}}","port":{{g.Port + 1}},"kind":"tls","tlsMeasured":true,"firstSeenAt":"2025-02-01T00:00:00+00:00","lastSeenAt":"2026-11-04T11:40:00+00:00","state":"active"},{"host":"{{g.Host}}","port":{{g.Port}},"kind":"telnet","tlsMeasured":false,"firstSeenAt":"2024-01-01T00:00:00+00:00","lastSeenAt":"2026-11-04T11:00:00+00:00","state":"active"}]""" - : $$"""[{"host":"old.{{g.Host}}","port":{{g.Port}},"kind":"telnet","tlsMeasured":false,"firstSeenAt":"2019-01-01T00:00:00+00:00","lastSeenAt":"2021-06-01T00:00:00+00:00","state":"gone"},{"host":"{{g.Host}}","port":{{g.Port}},"kind":"telnet","tlsMeasured":false,"firstSeenAt":"2021-06-01T00:00:00+00:00","lastSeenAt":"2026-11-04T11:40:00+00:00","state":"active"}]"""; - return $$"""{"id":"{{g.Id}}","slug":"x","name":{{Json(g.Name)}},"tagline":{{Json(g.Tagline)}},"description":null,"state":"active","archived":false,"claimed":false,"playersNow":null,"playersNowState":"unknown","codebase":{{Json(g.Codebase)}},"measuredProtocols":[],"endpoints":{{endpoints}},"url":"/g/x","apiUrl":"/api/games/{{g.Id}}"}"""; + // Aetherfall, listed TLS first as the directory might: TLS and plain both active, an old port the directory has not reached lately, a gone one and a + // websocket (neither offered), and a charset — the address choice. Everything else: one usable address. + var endpoints = g.Name == "Aetherfall" + ? string.Join(",", + Endpoint(g.Host, g.Port + 1, "tls", "active"), + Endpoint(g.Host, g.Port, "telnet", "active"), + Endpoint(g.Host, 4000, "telnet", "stale", "\"firstSeenAt\":\"2019-01-01T00:00:00+00:00\",\"lastSeenAt\":\"2026-08-12T00:00:00+00:00\""), + Endpoint("old." + g.Host, g.Port, "telnet", "gone"), + Endpoint(g.Host, 4280, "websocket", "active")) + : g.Tls + ? Endpoint(g.Host, g.Port + 1, "tls", "active") + : string.Join(",", Endpoint("old." + g.Host, g.Port, "telnet", "gone"), Endpoint(g.Host, g.Port, "telnet", "active")); + var fields = g.Name == "Aetherfall" + ? """{"CHARSET":{"value":"ISO-8859-1","source":"handshake","measured":true,"lastConfirmedAt":"2026-11-04T11:40:00+00:00","ageSeconds":1200,"age":"20 minutes","stale":false}}""" + : "{}"; + return $$"""{"id":"{{g.Id}}","slug":"x","name":{{Json(g.Name)}},"tagline":{{Json(g.Tagline)}},"description":null,"state":"active","archived":false,"claimed":false,"playersNow":null,"playersNowState":"unknown","codebase":{{Json(g.Codebase)}},"measuredProtocols":[],"endpoints":[{{endpoints}}],"fields":{{fields}},"url":"/g/x","apiUrl":"/api/games/{{g.Id}}"}"""; } private static string Json(string? text) => text is null ? "null" : System.Text.Json.JsonSerializer.Serialize(text); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs index b2b19b32..6d5c5f50 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs @@ -203,6 +203,12 @@ private void ConnectFromWelcome(WelcomeConnect request) world.Name = UniqueWorldName(listed); } + // mu*index named a charset that is not UTF-8 for it: the world starts on that encoding, still F5's to change. + if (request.Encoding is { Length: > 0 } encoding) + { + world.Encoding = encoding; + } + if (request.Character is { } name) { world.Characters.Add(new CharacterDefinition { Name = name }); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs index e540b100..97314d7f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs @@ -9,8 +9,8 @@ namespace SharpMUTerm.Tui; /// /// Browse worlds (the welcome's Browse row, ⌃P ▸ Browse worlds…, /browse [words]): mu*index's listing, /// one Client model () drawn as a cell here and as a native modal -/// in a host that has them. Every gesture in either ends in one method: and -/// . +/// in a host that has them. Every gesture in either ends in one method: , +/// , and . /// /// Asked only when the player opens it, never at start, through a fetch the caller supplies (worldFetch:, /// the save:/logRoot: family): null in a test and a snapshot, which then say they asked nothing. The demo @@ -102,6 +102,8 @@ internal void ShowWorldBrowse(string query = "") ThemeIsDark(), index => OnUiThread(() => PickWorld(session!.Model, index)), words => OnUiThread(() => AskWorldDirectory(words)), + endpoint => OnUiThread(() => ChooseWorldEndpoint(session!.Model, endpoint)), + () => OnUiThread(LeaveWorldChoice), () => OnUiThread(() => { NativeModalClosed(session!); @@ -132,11 +134,25 @@ internal void ShowWorldBrowse(string query = "") case WorldBrowseAction.Ask: AskWorldDirectory(browse.Query); break; + case WorldBrowseAction.Choose: + ChooseWorldEndpoint(_worldModel, browse.Endpoint); + break; } return WorldBrowseOpen; }, width: WorldBrowseSurface.PreferredWidth, + escape: () => + { + // Esc on the address choice goes back to the list; on the list it closes. + if (_worldModel.Choosing is null) + { + return false; + } + + LeaveWorldChoice(); + return true; + }, closed: () => { _worldBrowse = null; @@ -190,17 +206,25 @@ void Settle(WorldBrowseModel model) /// /// The pick, from either host: row of . Asks the directory where that - /// world is; once it answers with an address /connect would take, Browse worlds closes and the welcome's connect - /// form opens filled in. Nothing is saved or dialled here. A refusal is said in place and the list stays. + /// world is; once it answers with one address /connect would take, Browse worlds closes and the welcome's connect + /// form opens filled in. With several (TLS and plain, another port, a stale one), they are published as a choice + /// () and opens the form. Nothing is saved or + /// dialled here. A refusal is said in place and the list stays. /// internal void PickWorld(WorldBrowseModel model, int index) { - if (index < 0 || index >= model.Rows.Count || _worldModel.Opening is not null) + if (index < 0 || index >= model.Rows.Count || _worldModel.Opening is not null || _worldModel.Choosing is not null) { return; } var row = model.Rows[index]; + if (row.Id == Guid.Empty) + { + PublishWorldModel(_worldModel with { Problem = $"{row.Name} not opened: mu*index gave no id to ask for it by" }); + return; + } + if (WorldDirectory.GameUri(_config.WorldDirectoryUrl, row.Id) is not { } uri || (WorldFetch ?? _worldFetch) is null) { PublishWorldModel(_worldModel with { Problem = $"{row.Name} not opened: {WorldDirectoryProblem() ?? "this run asks no world directory"}" }); @@ -211,18 +235,65 @@ internal void PickWorld(WorldBrowseModel model, int index) PublishWorldModel(_worldModel with { Opening = row.Name, Problem = null }); FetchWorlds(uri, generation, (bytes, failure) => { - var (address, unread) = bytes is null ? (null, failure) : WorldDirectory.ParseGame(bytes); - if (address is null) + var (game, unread) = bytes is null ? (null, failure) : WorldDirectory.ParseGame(bytes); + if (game is null) { PublishWorldModel(_worldModel with { Opening = null, Problem = $"{row.Name} not opened: {unread}" }); return; } // The listing's name, which the player chose by; the page's own is the same world. - OpenWorldForm(address with { Name = row.Name }); + game = game with { Name = row.Name }; + if (game.Endpoints.Count == 1) + { + if (!game.Endpoints[0].Connectable) + { + PublishWorldModel(_worldModel with { Opening = null, Problem = NotConnectable(game, 0) }); + return; + } + + OpenWorldForm(game.Address(0)); + return; + } + + PublishWorldModel(_worldModel with { Opening = null, Choosing = game }); }); } + /// + /// The address chosen, from either host: endpoint of 's choice. Browse + /// worlds closes and the connect form opens filled in with it — host, port, TLS, and the encoding when mu*index names a + /// charset that is not UTF-8. Nothing is saved or dialled. + /// + internal void ChooseWorldEndpoint(WorldBrowseModel model, int index) + { + if (model.Choosing is not { } game || _worldModel.Choosing is null || index < 0 || index >= game.Endpoints.Count) + { + return; + } + + if (!game.Endpoints[index].Connectable) + { + PublishWorldModel(_worldModel with { Problem = NotConnectable(game, index) }); + return; + } + + OpenWorldForm(game.Address(index)); + } + + /// Why address of does not go into the connect form. + private static string NotConnectable(WorldGame game, int index) => + $"{game.Name} not opened: mu*index lists it at {game.Endpoints[index].Address}, which /connect cannot dial"; + + /// Esc on the address choice, from either host: back to the list, as it was. + internal void LeaveWorldChoice() + { + if (_worldModel.Choosing is not null) + { + PublishWorldModel(_worldModel with { Choosing = null, Problem = null }); + } + } + /// /// ⏎ on a query none of the rows held match, from either host: asks the directory itself to search for it, and lists /// what it says in place of its most played. @@ -242,7 +313,7 @@ private void OpenWorldForm(WorldAddress address) { CloseWorldBrowse(); var welcome = new WelcomeSurface(WorldDirectoryProblem()) { Layout = _welcomeLayout }; - welcome.Prefill(address.Name, address.Host, address.Port, address.Tls); + welcome.Prefill(address.Name, address.Host, address.Port, address.Tls, address.Encoding); if (WelcomeIsOpen) { CloseWelcome(); @@ -347,12 +418,14 @@ void Deliver(byte[]? bytes, string? problem) /// /// /browse [words] opens Browse worlds (asking the directory for the words); /browse N picks row N of the - /// list /browse last said as lines. + /// list /browse last said as lines, and /browse N M address M of the ones it said for that world. /// private void BrowseCommand(string arguments) { var words = arguments.Trim(); - if (int.TryParse(words, NumberStyles.None, CultureInfo.InvariantCulture, out var n) && _saidWorlds.Count > 0) + var parts = words.Split(' ', StringSplitOptions.RemoveEmptyEntries); + if (parts.Length is 1 or 2 && _saidWorlds.Count > 0 + && int.TryParse(parts[0], NumberStyles.None, CultureInfo.InvariantCulture, out var n)) { if (n < 1 || n > _saidWorlds.Count) { @@ -360,7 +433,19 @@ private void BrowseCommand(string arguments) return; } - SayWorldAddress(_saidWorlds[n - 1]); + int? endpoint = null; + if (parts.Length == 2) + { + if (!int.TryParse(parts[1], NumberStyles.None, CultureInfo.InvariantCulture, out var m) || m < 1 || m > WorldDirectory.MaxEndpoints) + { + RefuseCommand($"/browse {n} and the number of one of its addresses, from 1"); + return; + } + + endpoint = m - 1; + } + + SayWorldAddress(_saidWorlds[n - 1], n, endpoint); return; } @@ -388,15 +473,24 @@ private void SayWorlds(string query) => StartWorldList(query, model => lines.AddRange(_saidWorlds.Select((r, i) => string.Join( " — ", new[] { $"{i + 1}. {r.Name}", $"{WorldBrowseModel.Players(r)} players", r.Codebase, r.Tagline }.Where(p => p.Length > 0)))); - lines.Add("Type /browse and a number to see where that world is, or /browse and words to search."); + lines.Add("Type /browse and a number to hear where that world is (/browse 1 2 for its second address), or /browse and words to search."); } SayLines(lines); }); - /// Where a world /browse N named is, said as the /connect line to type; nothing is saved or dialled. - private void SayWorldAddress(WorldListing row) + /// + /// Where a world /browse N named is, said as the /connect line to type; when it answers at several + /// addresses and none was named, they are said as numbered lines for /browse N M. Nothing is saved or dialled. + /// + private void SayWorldAddress(WorldListing row, int number, int? endpoint) { + if (row.Id == Guid.Empty) + { + RefuseCommand($"{row.Name} not looked up: mu*index gave no id to ask for it by"); + return; + } + if (WorldDirectory.GameUri(_config.WorldDirectoryUrl, row.Id) is not { } uri || (WorldFetch ?? _worldFetch) is null) { RefuseCommand($"{row.Name} not looked up: {WorldDirectoryProblem() ?? "this run asks no world directory"}"); @@ -406,26 +500,63 @@ private void SayWorldAddress(WorldListing row) var generation = ++_worldGeneration; FetchWorlds(uri, generation, (bytes, failure) => { - var (address, unread) = bytes is null ? (null, failure) : WorldDirectory.ParseGame(bytes); - if (address is null) + var (game, unread) = bytes is null ? (null, failure) : WorldDirectory.ParseGame(bytes); + if (game is null) { RefuseCommand($"{row.Name} not looked up: {unread}"); return; } + game = game with { Name = row.Name }; + if (endpoint is { } chosen && chosen >= game.Endpoints.Count) + { + RefuseCommand($"{row.Name} has {game.Endpoints.Count} addresses; say /browse {number} and a number from 1 to {game.Endpoints.Count}"); + return; + } + + if (endpoint is null && game.Endpoints.Count > 1 && !Host.ScreenIsSeen) + { + var model = new WorldBrowseModel(WorldBrowseState.Ready, [], 0, string.Empty, null, null, game); + var lines = new List + { + $"{model.ChoiceLine}:", + game.Charset is { } charset + ? $"mu*index names its charset {charset}, for the whole game rather than per address." + : "mu*index names no charset for it.", + }; + lines.AddRange(game.Endpoints.Select((e, i) => $"{i + 1}. {WorldBrowseModel.EndpointText(e)}")); + lines.Add($"Type /browse {number} and an address number (/browse {number} 1 is the first) to hear its /connect line."); + SayLines(lines); + return; + } + + var index = endpoint ?? game.FirstConnectable; + if (index < 0 || !game.Endpoints[index].Connectable) + { + RefuseCommand(NotConnectable(game, Math.Max(0, index))); + return; + } + + var address = game.Address(index); var host = address.Host.Contains(':') ? $"[{address.Host}]" : address.Host; var command = $"/connect {host} {address.Port}" + (address.Tls ? " tls" : string.Empty); if (Host.ScreenIsSeen) { - OpenWorldForm(address with { Name = row.Name }); + OpenWorldForm(address); return; } - SayLines( - [ + var said = new List + { $"{row.Name} is at {address.Host} port {address.Port}{(address.Tls ? ", encrypted" : string.Empty)}, as listed on mu*index.", $"To add it and connect, type: {command}", - ]); + }; + if (address.Encoding is { } encoding) + { + said.Add($"mu*index names its charset {game.Charset}: set the world's encoding to {encoding} on F5 (/connect leaves it auto)."); + } + + SayLines(said); }); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 7726e240..0e1572ba 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1964,10 +1964,13 @@ public string RenderSnapshot(string? view = null) } // Browse worlds over the demo's directory (answered from memory): the list through its ⌃P entry; `-failed` with a - // directory that does not answer; `-picked` after a pick, so the frame is the welcome's connect form filled in. + // directory that does not answer; `-picked` after a pick of a world with one address (Lanternport), so the frame is + // the welcome's connect form filled in; `-endpoints` after a pick of Aetherfall, which answers at three addresses + // and names a charset, so the frame is the address choice. if (string.Equals(view, "browse-worlds", StringComparison.OrdinalIgnoreCase) || string.Equals(view, "browse-worlds-failed", StringComparison.OrdinalIgnoreCase) - || string.Equals(view, "browse-worlds-picked", StringComparison.OrdinalIgnoreCase)) + || string.Equals(view, "browse-worlds-picked", StringComparison.OrdinalIgnoreCase) + || string.Equals(view, "browse-worlds-endpoints", StringComparison.OrdinalIgnoreCase)) { if (string.Equals(view, "browse-worlds-failed", StringComparison.OrdinalIgnoreCase)) { @@ -1976,6 +1979,11 @@ public string RenderSnapshot(string? view = null) DispatchCommand(SharpMUTerm.Client.Commands.BuiltInCommands.BrowseWorldsCommand); if (string.Equals(view, "browse-worlds-picked", StringComparison.OrdinalIgnoreCase)) + { + PickWorld(_worldModel, 1); + } + + if (string.Equals(view, "browse-worlds-endpoints", StringComparison.OrdinalIgnoreCase)) { PickWorld(_worldModel, 0); } diff --git a/src/SharpMUTerm.Tui/SnapshotViews.cs b/src/SharpMUTerm.Tui/SnapshotViews.cs index 999d6ac5..1930e7a3 100644 --- a/src/SharpMUTerm.Tui/SnapshotViews.cs +++ b/src/SharpMUTerm.Tui/SnapshotViews.cs @@ -28,7 +28,7 @@ internal static class SnapshotViews "collapsed", "timestamps", "timestamps-toggled", "theme-switched", "rail-keys", "prompt", "meters", "gamedata", "map", "map-walking", "map-split", "map-edit", "map-level", "map-area", "map-find", "map-mine", "packages", "package-review", "package-browse", "send-menu", "layouts", "layout-combat", "layout-roleplay", "panel-who", "panel-vitals", "panel-quickbar", "panel-composer", - "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "browse-worlds", "browse-worlds-failed", "browse-worlds-picked", "import-review", "join-wraps", "join-wraps-f5", + "welcome", "welcome-connect", "tour", "reconnect", "help", "help-topic", "dictionary-offer", "browse-worlds", "browse-worlds-failed", "browse-worlds-picked", "browse-worlds-endpoints", "import-review", "join-wraps", "join-wraps-f5", "script-console", "script-list", "script-edit", "search-older", "search-history", "channel-capture", "highlight-names", "channels-f5", "scene-log", ]; } diff --git a/src/SharpMUTerm.Tui/WelcomeSurface.cs b/src/SharpMUTerm.Tui/WelcomeSurface.cs index d0370c06..6330934b 100644 --- a/src/SharpMUTerm.Tui/WelcomeSurface.cs +++ b/src/SharpMUTerm.Tui/WelcomeSurface.cs @@ -24,7 +24,7 @@ internal enum WelcomeAction } /// What the connect form asks for, read once ⏎ has checked it. -internal sealed record WelcomeConnect(string Host, int Port, bool Tls, string? Character, bool PasswordLater, string? WorldName = null); +internal sealed record WelcomeConnect(string Host, int Port, bool Tls, string? Character, bool PasswordLater, string? WorldName = null, string? Encoding = null); /// /// The first-run welcome: what it says and what a key on it means, with no window in it — the @@ -82,18 +82,24 @@ internal sealed class WelcomeSurface /// The world Browse worlds filled the form in for, or null; dropped once the host is changed. public string? WorldName { get; private set; } + /// + /// The encoding the world will be saved with, from the charset mu*index names for the world Browse worlds picked + /// (null: auto); dropped with once the host is changed. + /// + public string? Encoding { get; private set; } + /// The host Browse worlds filled in, so a changed host drops the name that went with it. private string? _prefilledHost; /// Everything the surface says now: what the cells draw and the window's native welcome draws. public WelcomeModel Model => - new(InForm, Selected, Layout, Field, Host, Port, Tls, Character, PasswordLater, Problem, _indexProblem, WorldName); + new(InForm, Selected, Layout, Field, Host, Port, Tls, Character, PasswordLater, Problem, _indexProblem, WorldName, Encoding); /// /// The form, filled in from a world Browse worlds picked: its host, port and TLS, and its name for the world it will /// be saved as. Only fills it in — the player's own ⏎ there is what saves and dials, through /connect's path. /// - public void Prefill(string worldName, string host, int port, bool tls) + public void Prefill(string worldName, string host, int port, bool tls, string? encoding = null) { InForm = true; Field = WelcomeField.Character; @@ -101,6 +107,7 @@ public void Prefill(string worldName, string host, int port, bool tls) Port = port.ToString(System.Globalization.CultureInfo.InvariantCulture); Tls = tls; WorldName = worldName; + Encoding = encoding; _prefilledHost = Host; Problem = null; Request = null; @@ -318,9 +325,10 @@ private WelcomeAction Submit(Func, (string Host, int Port) if (WorldName is not null && !string.Equals(Host, _prefilledHost, StringComparison.OrdinalIgnoreCase)) { WorldName = null; + Encoding = null; } - Request = new WelcomeConnect(endpoint.Host, endpoint.Port, Tls, character.Length == 0 ? null : character, PasswordLater, WorldName); + Request = new WelcomeConnect(endpoint.Host, endpoint.Port, Tls, character.Length == 0 ? null : character, PasswordLater, WorldName, Encoding); return WelcomeAction.Connect; } diff --git a/src/SharpMUTerm.Tui/WorldBrowseSurface.cs b/src/SharpMUTerm.Tui/WorldBrowseSurface.cs index 4fc865a2..55d4d48f 100644 --- a/src/SharpMUTerm.Tui/WorldBrowseSurface.cs +++ b/src/SharpMUTerm.Tui/WorldBrowseSurface.cs @@ -15,6 +15,9 @@ internal enum WorldBrowseAction /// Ask the directory itself for what is typed: nothing among the rows held matches it. Ask, + + /// Open the connect form with the address chosen () of the world being chosen for. + Choose, } /// @@ -38,6 +41,22 @@ internal sealed class WorldBrowseSurface /// The row selected in the listed rows. public int Selected { get; private set; } + /// The address selected while a picked world's addresses are being chosen from (0 is the default, TLS first). + public int Endpoint => _choiceFor is null ? 0 : _endpoint; + + private int _endpoint; + private WorldGame? _choiceFor; + + /// Starts the address choice at its first row whenever a different world's addresses are shown. + private void Follow(WorldBrowseModel model) + { + if (!ReferenceEquals(model.Choosing, _choiceFor)) + { + _choiceFor = model.Choosing; + _endpoint = Math.Max(0, model.Choosing?.FirstConnectable ?? 0); + } + } + /// The index in 's rows of the row selected, or -1. public int SelectedRow(WorldBrowseModel model) { @@ -63,6 +82,25 @@ public int SelectedRow(WorldBrowseModel model) public WorldBrowseAction Key(WorldBrowseModel model, ConsoleKeyInfo key) { ArgumentNullException.ThrowIfNull(model); + Follow(model); + if (model.Choosing is { } game) + { + var addresses = game.Endpoints.Count; + switch (key.Key) + { + case ConsoleKey.UpArrow: + _endpoint = (_endpoint - 1 + addresses) % addresses; + break; + case ConsoleKey.DownArrow: + _endpoint = (_endpoint + 1) % addresses; + break; + case ConsoleKey.Enter: + return WorldBrowseAction.Choose; + } + + return WorldBrowseAction.Redraw; + } + var count = model.View(Query, Sort).Count; switch (key.Key) { @@ -113,18 +151,28 @@ public WorldBrowseAction Key(WorldBrowseModel model, ConsoleKeyInfo key) } /// What the surface draws now, in rows of . - public List Render(WorldBrowseModel model, int width, int rows) => Render(model, Query, Sort, Selected, width, rows); + public List Render(WorldBrowseModel model, int width, int rows) + { + ArgumentNullException.ThrowIfNull(model); + Follow(model); + return Render(model, Query, Sort, Selected, width, rows, Endpoint); + } /// /// Browse worlds for in 's order, row marked, /// in exactly rows: the search line, the credit, the list (or what stands for it), a note and /// the keys. /// - internal static List Render(WorldBrowseModel model, string query, WorldDirectorySort sort, int selected, int width, int rows) + internal static List Render(WorldBrowseModel model, string query, WorldDirectorySort sort, int selected, int width, int rows, int endpoint = 0) { ArgumentNullException.ThrowIfNull(model); width = Math.Max(30, width); rows = Math.Max(9, rows); + if (model.Choosing is not null) + { + return RenderChoice(model, endpoint, width, rows); + } + var lines = new List { SpreadLR( @@ -156,7 +204,7 @@ internal static List Render(WorldBrowseModel model, string query, WorldD Pad(lines, rows - 2); var note = model.Opening is not null ? model.OpeningLine : model.State == WorldBrowseState.Ready && model.Problem is { } problem ? problem - : model.State == WorldBrowseState.Ready && view.Count > 0 ? (model.AnyDeclared ? WorldBrowseModel.DeclaredNote + " · " : string.Empty) + WorldBrowseModel.PickNote + : model.State == WorldBrowseState.Ready && view.Count > 0 ? model.MarksNote + WorldBrowseModel.PickNote : string.Empty; var noteTone = model.State == WorldBrowseState.Ready && model.Problem is not null && model.Opening is null ? ScreenPalette.Caution : ScreenPalette.Label; lines.Add(note.Length == 0 ? string.Empty : $"[{noteTone}]{Escape(Elide(note, width - 1))}[/]"); @@ -164,6 +212,60 @@ internal static List Render(WorldBrowseModel model, string query, WorldD return lines; } + /// + /// A picked world's addresses, row marked, in exactly rows: whose + /// they are, what mu*index says of its charset, one row per address (host:port, TLS or plain, its state), a note + /// and the keys. + /// + private static List RenderChoice(WorldBrowseModel model, int endpoint, int width, int rows) + { + var game = model.Choosing!; + var lines = new List + { + ElideVisible($"[{ScreenPalette.Accent}]ADDRESSES[/] [{ScreenPalette.Value}]{Escape(model.ChoiceLine)}[/]", width), + ElideVisible($"[{ScreenPalette.Muted}]{Escape(WorldBrowseModel.AttributionLine)}[/]", width), + string.Empty, + }; + + // The charset sentence on one row where it fits, else broken at its " · " so the encoding is never elided away. + var charset = model.CharsetLine; + var pieces = charset.Length <= width - 3 ? [charset] : charset.Split(" · ", 2); + lines.AddRange(pieces.Select(piece => $" [{ScreenPalette.Label}]{Escape(Elide(piece, width - 3))}[/]")); + lines.Add(string.Empty); + + var columns = game.Endpoints.Select(WorldBrowseModel.Endpoint).ToArray(); + var addressWidth = Math.Clamp(columns.Max(c => c.Address.Length) + 2, 12, Math.Max(12, width / 2)); + for (var i = 0; i < columns.Length && lines.Count < rows - 2; i++) + { + var (address, security, state) = columns[i]; + var chosen = i == endpoint; + var mark = chosen ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; + var weight = chosen ? "bold " : string.Empty; + var stateTone = game.Endpoints[i].Stale || !game.Endpoints[i].Connectable ? ScreenPalette.Caution : ScreenPalette.Label; + var stateText = Elide(state, Math.Max(0, width - 4 - addressWidth - 7)); + lines.Add($"{mark} [{weight}{ScreenPalette.Value}]{Escape(Elide(address, addressWidth - 1).PadRight(addressWidth))}[/]" + + $"[{(game.Endpoints[i].Tls ? ScreenPalette.Accent : ScreenPalette.Label)}]{Escape(security.PadRight(7))}[/]" + + $"[{stateTone}]{Escape(stateText)}[/]"); + } + + Pad(lines, rows - 2); + var note = model.Problem ?? WorldBrowseModel.ChoiceNote; + lines.Add($"[{(model.Problem is null ? ScreenPalette.Label : ScreenPalette.Caution)}]{Escape(Elide(note, width - 1))}[/]"); + lines.Add(ChoiceFooter(width)); + return lines; + } + + /// The address choice's key row, laddered to one row: the choice and the way back are never given up. + internal static string ChoiceFooter(int width) + { + var keys = WorldBrowseModel.ChoiceKeys.Select(k => k.Key switch + { + "⏎" or "Esc" => new LadderKey(k.Key, k.Label), + _ => new LadderKey(k.Key, k.Label, Drop: 1), + }).ToList(); + return KeyLadder.Fit(keys, width - 1, k => $"[{ScreenPalette.Accent}]{Escape(k)}[/]", l => $"[{ScreenPalette.Label}]{Escape(l)}[/]", $"[{ScreenPalette.Label}] · [/]"); + } + /// The key row, laddered to one row: the way out and the pick are never given up. internal static string Footer(int width) { diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 23cbdcac..0aa66dac 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -264,6 +264,7 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! (SurfaceCatalog.Dictionary, "dictionary-offer"), (SurfaceCatalog.BrowseWorlds, "browse-worlds"), (SurfaceCatalog.BrowseWorlds, "browse-worlds-failed"), + (SurfaceCatalog.BrowseWorlds, "browse-worlds-endpoints"), (SurfaceCatalog.Import, "import-review"), (SurfaceCatalog.ScriptConsole, "script-console"), (SurfaceCatalog.Search, "search-older"), @@ -844,6 +845,19 @@ await SameModal("browse worlds: ask the directory", "browse-worlds", // None of the demo's most played hold the word, so the cells' Enter asks the directory rather than picking. app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); }); + + // A world that answers at several addresses (the demo's Aetherfall): choosing the second (plain) fills in the form + // with it and the charset's encoding, and Esc goes back to the list — the same in both hosts. + await SameModal("browse worlds: choose an address", "browse-worlds-endpoints", + (app, m) => ((WorldBrowseSession)m.Open(SurfaceCatalog.BrowseWorlds)!).Choose(1), + app => + { + app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + await SameModal("browse worlds: back from the addresses", "browse-worlds-endpoints", + (app, m) => ((WorldBrowseSession)m.Open(SurfaceCatalog.BrowseWorlds)!).Back(), + app => app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\x1b', ConsoleKey.Escape, false, false, false))); probed.Add(SurfaceCatalog.BrowseWorlds); // The import review: Import writes the same world, character and set as the cells' Enter; with the passwords @@ -1194,7 +1208,8 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "welcome=" + app.WelcomeIsOpen, "help=" + app.HelpIsOpen + "/" + app.DictionaryOfferOpen, "browse=" + app.WorldBrowseOpen + " " + app.WorldBrowseModelNow.State + ":" + app.WorldBrowseModelNow.AskedFor + ":" + app.WorldBrowseModelNow.Rows.Count - + " " + (app.Welcome is { } w ? $"{w.InForm}:{w.Host}:{w.Port}:{w.Tls}:{w.WorldName}" : "none"), + + ":" + (app.WorldBrowseModelNow.Choosing?.Endpoints.Count ?? 0) + + " " + (app.Welcome is { } w ? $"{w.InForm}:{w.Host}:{w.Port}:{w.Tls}:{w.WorldName}:{w.Encoding}" : "none"), "import=" + app.ImportReviewOpen + " " + string.Join(",", app.Configuration.TriggerSets.Select(s => s.Name + ":" + s.Triggers.Count)) + " " + string.Join(",", app.Configuration.Worlds.SelectMany(w => w.Characters).Select(c => c.Name + (c.Password is null ? string.Empty : "*"))), "console=" + app.ScriptConsoleIsOpen + " " + ConsoleState(app), diff --git a/tests/SharpMUTerm.Client.Tests/WorldBrowseModelTests.cs b/tests/SharpMUTerm.Client.Tests/WorldBrowseModelTests.cs index c91c2d96..debbe4c9 100644 --- a/tests/SharpMUTerm.Client.Tests/WorldBrowseModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/WorldBrowseModelTests.cs @@ -91,7 +91,7 @@ public async Task ASessionPicksARowInRangeAndAsksOnlyWhatTheRowsCannotAnswer() { var picked = new List(); var asked = new List(); - var session = new WorldBrowseSession(Ready(), true, picked.Add, asked.Add, () => { }); + var session = new WorldBrowseSession(Ready(), true, picked.Add, asked.Add, _ => { }, () => { }, () => { }); session.Pick(1); session.Pick(9); @@ -101,4 +101,49 @@ public async Task ASessionPicksARowInRangeAndAsksOnlyWhatTheRowsCannotAnswer() await Assert.That(string.Join(",", picked)).IsEqualTo("1"); await Assert.That(string.Join(",", asked)).IsEqualTo("zork"); } + + private static WorldGame Game(string? charset) => new( + "Aetherfall", + [new("a.example", 4202, true, false), new("a.example", 4201, false, false), new("a.example", 4000, false, true)], + charset); + + [Test] + public async Task TheAddressChoiceSaysEachAddressItsSecurityItsStateAndTheGamesCharset() + { + var model = Ready() with { Choosing = Game("ISO-8859-1") }; + + await Assert.That(model.ChoiceLine).IsEqualTo("Aetherfall answers at 3 addresses — choose one"); + await Assert.That(model.CharsetLine).IsEqualTo("charset ISO-8859-1 for the whole game (not per address) · the form sets encoding ISO-8859-1"); + await Assert.That((Ready() with { Choosing = Game("UTF-8") }).CharsetLine).EndsWith("the world's encoding stays auto"); + await Assert.That((Ready() with { Choosing = Game(null) }).CharsetLine).IsEqualTo("mu*index names no charset for it; the world's encoding stays auto"); + await Assert.That(WorldBrowseModel.Endpoint(model.Choosing!.Endpoints[0])).IsEqualTo(("a.example:4202", "TLS", "active")); + await Assert.That(WorldBrowseModel.Endpoint(model.Choosing.Endpoints[2])).IsEqualTo(("a.example:4000", "plain", "stale · not reached lately")); + await Assert.That(WorldBrowseModel.Endpoint(new WorldEndpoint("2001:db8::1", 23, false, false)).Address).IsEqualTo("[2001:db8::1]:23"); + await Assert.That(WorldBrowseModel.Endpoint(new WorldEndpoint("bad host", 4000, false, false, Connectable: false)).State).IsEqualTo("active · not connectable"); + await Assert.That(model).IsEqualTo(Ready() with { Choosing = Game("ISO-8859-1") }); + await Assert.That(model).IsNotEqualTo(Ready()); + } + + [Test] + public async Task ASessionChoosesAnAddressOnlyWhileOneIsBeingChosenAndPicksNoRowMeanwhile() + { + var picked = new List(); + var chosen = new List(); + var backs = 0; + var session = new WorldBrowseSession(Ready(), true, picked.Add, _ => { }, chosen.Add, () => backs++, () => { }); + + session.Choose(0); + session.Back(); + session.Publish(Ready() with { Choosing = Game(null) }); + session.Pick(1); + session.Choose(2); + session.Choose(3); + session.Publish(Ready() with { Choosing = new WorldGame("W", [new("bad host", 4000, false, false, Connectable: false), new("w.example", 23, false, false)], null) }); + session.Choose(0); + session.Back(); + + await Assert.That(picked.Count).IsEqualTo(0); + await Assert.That(string.Join(",", chosen)).IsEqualTo("2"); + await Assert.That(backs).IsEqualTo(1); + } } diff --git a/tests/SharpMUTerm.Core.Tests/WorldIndex/WorldDirectoryTests.cs b/tests/SharpMUTerm.Core.Tests/WorldIndex/WorldDirectoryTests.cs index 4e13bea2..75fe75cb 100644 --- a/tests/SharpMUTerm.Core.Tests/WorldIndex/WorldDirectoryTests.cs +++ b/tests/SharpMUTerm.Core.Tests/WorldIndex/WorldDirectoryTests.cs @@ -4,8 +4,9 @@ namespace SharpMUTerm.Core.Tests.WorldIndex; /// -/// mu*index's answers read as untrusted server text: rows bounded and cleaned, a bad row dropped and counted, an address -/// only what /connect would take. The fixtures are shaped from MUIndex's GameListView/GameView +/// mu*index's answers read as untrusted server text and otherwise as the directory states them: rows kept in its order +/// with its counts and labels, text bounded and cleaned, sizes capped, and an address put in the connect form only when +/// /connect would take it. The fixtures are shaped from MUIndex's GameListView/GameView /// (camelCase, enums as camelCase strings); the live service was not reachable when they were written. /// public class WorldDirectoryTests @@ -32,18 +33,22 @@ public class WorldDirectoryTests private static byte[] Bytes(string json) => Encoding.UTF8.GetBytes(json); [Test] - public async Task AListingIsReadAndItsBadRowsAreDroppedAndCounted() + public async Task AListingIsReadAsTheDirectoryStatesItEveryRowInItsOrder() { var (page, problem) = WorldDirectory.ParseList(Bytes(Listing)); await Assert.That(problem).IsNull(); - await Assert.That(string.Join("|", page!.Rows.Select(r => r.Name))).IsEqualTo("Aetherfall|Hollow Crown|Copperline"); - await Assert.That(page.Dropped).IsEqualTo(4); + await Assert.That(string.Join("|", page!.Rows.Select(r => r.Name))) + .IsEqualTo("Aetherfall|Hollow Crown|Copperline|Gone Away|No id||Aetherfall again") + .Because("the client drops no archived, repeated, unnamed or id-less row: the directory decides what it lists"); + await Assert.That(page.Dropped).IsEqualTo(0); await Assert.That(page.Total).IsEqualTo(412); await Assert.That(page.Rows[0].Players).IsEqualTo(64); await Assert.That(page.Rows[0].Count).IsEqualTo(WorldPlayerCount.Measured); await Assert.That(page.Rows[1].Count).IsEqualTo(WorldPlayerCount.Declared); - await Assert.That(page.Rows[2].Players).IsNull().Because("a number the directory does not say it measured is not shown"); + await Assert.That(page.Rows[2].Players).IsEqualTo(12).Because("a count is shown with the directory's own label"); + await Assert.That(page.Rows[2].Count).IsEqualTo(WorldPlayerCount.Unknown); + await Assert.That(page.Rows[4].Id).IsEqualTo(Guid.Empty); } [Test] @@ -68,7 +73,7 @@ public async Task NoMoreThanMaxRowsAreKept() var page = WorldDirectory.ParseList(Bytes("{\"games\":[" + rows + "]}")).Page!; await Assert.That(page.Rows.Count).IsEqualTo(WorldDirectory.MaxRows); - await Assert.That(page.Dropped).IsEqualTo(5); + await Assert.That(page.Dropped).IsEqualTo(5).Because("the row cap is the one thing that leaves rows unread"); } [Test] @@ -79,7 +84,7 @@ public async Task AnAnswerThatIsNotAListSaysSo() } [Test] - public async Task TheAddressIsAnActiveTelnetOrTlsEndpointSeenMostRecently() + public async Task AddressesAreListedInTheDirectorysOrderLeavingOutOnlyGoneAndUndialableKinds() { const string game = """ { "id": "6f1c2a52-0000-4000-8000-0c6a1f3d2e01", "name": "Aetherfall", @@ -88,14 +93,52 @@ public async Task TheAddressIsAnActiveTelnetOrTlsEndpointSeenMostRecently() { "host": "ws.example", "port": 443, "kind": "websocket", "state": "active" }, { "host": "stale.example", "port": 4000, "kind": "telnet", "state": "stale", "lastSeenAt": "2026-11-01T00:00:00Z" }, { "host": "a.example", "port": 4201, "kind": "telnet", "state": "active", "lastSeenAt": "2026-10-01T00:00:00Z" }, - { "host": "b.example", "port": 4202, "kind": "tls", "state": "active", "lastSeenAt": "2026-11-02T00:00:00Z" } + { "host": "b.example", "port": 4202, "kind": "tls", "state": "active", "lastSeenAt": "2026-11-02T00:00:00Z" }, + { "host": "a.example", "port": 4201, "kind": "telnet", "state": "active" } ] } """; - var (address, problem) = WorldDirectory.ParseGame(Bytes(game)); + var (parsed, problem) = WorldDirectory.ParseGame(Bytes(game)); await Assert.That(problem).IsNull(); - await Assert.That(address).IsEqualTo(new WorldAddress("Aetherfall", "b.example", 4202, true)); + await Assert.That(string.Join(",", parsed!.Endpoints.Select(e => $"{e.Address}:{(e.Tls ? "tls" : "plain")}:{(e.Stale ? "stale" : "active")}"))) + .IsEqualTo("stale.example:4000:plain:stale,a.example:4201:plain:active,b.example:4202:tls:active,a.example:4201:plain:active") + .Because("the client neither re-ranks nor de-duplicates what the directory lists"); + await Assert.That(parsed.FirstConnectable).IsEqualTo(0); + await Assert.That(parsed.Address(2)).IsEqualTo(new WorldAddress("Aetherfall", "b.example", 4202, true)); + await Assert.That(parsed.Charset).IsNull(); + } + + [Test] + public async Task NoMoreThanMaxEndpointsAreOffered() + { + var endpoints = string.Join(',', Enumerable.Range(1, 20).Select(i => $"{{\"host\":\"h{i}.example\",\"port\":{i},\"kind\":\"telnet\",\"state\":\"active\"}}")); + + var parsed = WorldDirectory.ParseGame(Bytes("{\"name\":\"W\",\"endpoints\":[" + endpoints + "]}")).Game!; + + await Assert.That(parsed.Endpoints.Count).IsEqualTo(WorldDirectory.MaxEndpoints); + await Assert.That(parsed.Endpoints[0].Host).IsEqualTo("h1.example"); + } + + [Test] + public async Task TheGamesCharsetIsReadFromItsFieldsAndANonUtf8OneSetsTheEncoding() + { + static WorldGame Game(string charset) => WorldDirectory.ParseGame(Bytes( + "{\"name\":\"W\",\"endpoints\":[{\"host\":\"w.example\",\"port\":4000,\"kind\":\"telnet\",\"state\":\"active\"}]," + + "\"fields\":{\"CHARSET\":{\"value\":" + charset + ",\"source\":\"handshake\",\"measured\":true}}}")).Game!; + + await Assert.That(Game("\"ISO-8859-1\"").Charset).IsEqualTo("ISO-8859-1"); + await Assert.That(Game("\"ISO-8859-1\"").Address(0).Encoding).IsEqualTo("ISO-8859-1"); + await Assert.That(Game("\"latin1\"").Encoding).IsEqualTo("ISO-8859-1"); + await Assert.That(Game("\"windows-1252\"").Encoding).IsEqualTo("CP1252"); + await Assert.That(Game("\"UTF-8\"").Charset).IsEqualTo("UTF-8"); + await Assert.That(Game("\"UTF-8\"").Encoding).IsNull().Because("UTF-8 leaves the world's encoding auto"); + await Assert.That(Game("\"US-ASCII\"").Encoding).IsNull().Because("UTF-8 reads ASCII"); + await Assert.That(Game("\"KOI8-R\"").Encoding).IsNull().Because("a charset F5 does not offer is not guessed at"); + await Assert.That(Game("\"\\u001b[31mevil\\u202echarset\"").Charset).IsEqualTo("[31mevil charset").Because("control and bidi characters are stripped"); + await Assert.That(Game("\"\\u001b[31mevil\\u202echarset\"").Encoding).IsNull(); + await Assert.That(Game("\"" + new string('a', 200) + "\"").Charset!.Length).IsEqualTo(WorldDirectory.MaxCharset).Because("a charset name is bounded"); + await Assert.That(Game("12").Charset).IsNull(); } [Test] @@ -106,11 +149,13 @@ public async Task AStaleEndpointIsOfferedWhenNoneIsActiveAndTlsMeasuredCounts() { "host": "c.example", "port": 23, "kind": "telnet", "state": "stale", "tlsMeasured": true } ] } """; - await Assert.That(WorldDirectory.ParseGame(Bytes(game)).Address).IsEqualTo(new WorldAddress("Copperline", "c.example", 23, true)); + var parsed = WorldDirectory.ParseGame(Bytes(game)).Game!; + await Assert.That(parsed.Endpoints.Count).IsEqualTo(1); + await Assert.That(parsed.Address(0)).IsEqualTo(new WorldAddress("Copperline", "c.example", 23, true)); } [Test] - public async Task AHostOrPortConnectWouldRefuseIsNeverOffered() + public async Task AnAddressConnectWouldRefuseIsListedAsNotConnectableAndNeverFillsTheForm() { const string game = """ { "name": "Bad", "endpoints": [ @@ -120,10 +165,14 @@ public async Task AHostOrPortConnectWouldRefuseIsNeverOffered() { "host": "x.example", "port": 4000, "kind": "telnet", "state": "gone" } ] } """; - var (address, problem) = WorldDirectory.ParseGame(Bytes(game)); + var (parsed, problem) = WorldDirectory.ParseGame(Bytes(game)); - await Assert.That(address).IsNull(); - await Assert.That(problem).IsEqualTo("the directory lists no telnet address for it that answers"); + await Assert.That(problem).IsNull(); + await Assert.That(parsed!.Endpoints.Count).IsEqualTo(3).Because("the gone one is left out, the three it cannot dial are listed"); + await Assert.That(parsed.Endpoints.All(e => !e.Connectable)).IsTrue(); + await Assert.That(parsed.FirstConnectable).IsEqualTo(-1); + await Assert.That(parsed.Endpoints[0].Host).IsEqualTo("evil host"); + await Assert.That(WorldDirectory.ParseGame(Bytes("{\"name\":\"N\",\"endpoints\":[]}")).Problem).IsEqualTo("the directory lists no telnet address for it"); await Assert.That(WorldDirectory.ParseGame(Bytes("{\"name\":\"N\"}")).Problem).IsEqualTo("the directory lists no address for it"); } @@ -131,7 +180,10 @@ public async Task AHostOrPortConnectWouldRefuseIsNeverOffered() public async Task TheListIsAskedOverHttpsOnlyWithTheQueryEscaped() { var list = WorldDirectory.ListUri("https://mu-index.com/api/", "red & blue")!.AbsoluteUri; - await Assert.That(list).StartsWith("https://mu-index.com/api/games?limit=200&sort=players&q=red"); + await Assert.That(list).StartsWith("https://mu-index.com/api/games?limit=200&sort=players&unnamed=!yes&q=red"); + await Assert.That(WorldDirectory.ListUri("https://mu-index.com/api")!.AbsoluteUri) + .IsEqualTo("https://mu-index.com/api/games?limit=200&sort=players&unnamed=!yes") + .Because("every list asks the directory to leave out games listed only by host:port"); await Assert.That(list).Contains("%26"); await Assert.That(WorldDirectory.ListUri("http://mu-index.com/api")).IsNull(); await Assert.That(WorldDirectory.ListUri("https://user@mu-index.com/api")).IsNull(); diff --git a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs index e3a0ac73..697408f9 100644 --- a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs @@ -40,6 +40,7 @@ internal static readonly (string View, string[] OneRow)[] Footers = ("browse-worlds", ["↑↓ pick", "Esc closes"]), ("browse-worlds-failed", ["↑↓ pick", "Esc closes"]), ("browse-worlds-picked", ["↑↓ field", "Esc back"]), + ("browse-worlds-endpoints", ["↑↓ pick", "Esc back"]), ("quit", ["⏎ stay", "Esc stays"]), ("search", ["↑↓ pick", "⌃F closes"]), ("search", ["⌥H searches older history", "lines held"]), diff --git a/tests/SharpMUTerm.Tui.Tests/WorldBrowseTests.cs b/tests/SharpMUTerm.Tui.Tests/WorldBrowseTests.cs index 0e3d691d..33d83210 100644 --- a/tests/SharpMUTerm.Tui.Tests/WorldBrowseTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WorldBrowseTests.cs @@ -91,7 +91,7 @@ public async Task TheWelcomesBrowseRowOpensTheListFromTheDirectory() await Assert.That(run.App.WorldBrowseOpen).IsTrue(); await Assert.That(run.App.WelcomeIsOpen).IsFalse(); - await Assert.That(run.Asked.Single().AbsoluteUri).IsEqualTo("https://mu-index.com/api/games?limit=200&sort=players"); + await Assert.That(run.Asked.Single().AbsoluteUri).IsEqualTo("https://mu-index.com/api/games?limit=200&sort=players&unnamed=!yes"); var model = run.App.WorldBrowseModelNow; await Assert.That(model.State).IsEqualTo(WorldBrowseState.Ready); await Assert.That(model.Rows[0].Name).IsEqualTo("Aetherfall"); @@ -120,21 +120,24 @@ public async Task ADirectoryThatDoesNotAnswerIsSaidHonestly() await Assert.That(run.App.WorldBrowseModelNow.Empty("")).StartsWith("mu*index did not answer:"); } - /// A pick fills the welcome's form in and saves nothing; the player's ⏎ there adds the world, named as listed. + /// A pick of a world with one address fills the welcome's form in and saves nothing; the form's ⏎ adds it. [Test] - public async Task APickFillsInTheConnectFormAndOnlyItsEnterAddsTheWorld() + public async Task APickWithOneAddressFillsInTheConnectFormAndOnlyItsEnterAddsTheWorld() { await using var run = await Start(); OpenFromTheWelcome(run.App); + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.DownArrow)); run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); await Assert.That(run.App.WorldBrowseOpen).IsFalse(); var form = run.App.Welcome!; await Assert.That(form.InForm).IsTrue(); - await Assert.That(form.Host).IsEqualTo("aetherfall.example"); - await Assert.That(form.Tls).IsTrue(); - await Assert.That(form.WorldName).IsEqualTo("Aetherfall"); + await Assert.That(form.Host).IsEqualTo("lanternport.example"); + await Assert.That(form.Port).IsEqualTo("2860"); + await Assert.That(form.Tls).IsFalse(); + await Assert.That(form.WorldName).IsEqualTo("Lanternport"); + await Assert.That(form.Encoding).IsNull(); await Assert.That(run.Config.Worlds.Count).IsEqualTo(0).Because("nothing is saved before the form's ⏎"); await Assert.That(run.Saved.Count).IsEqualTo(0); await Assert.That(string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain))).Contains("as listed on mu*index"); @@ -142,10 +145,72 @@ public async Task APickFillsInTheConnectFormAndOnlyItsEnterAddsTheWorld() run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); await run.App.LastCommand; + var world = run.Config.Worlds.Single(); + await Assert.That(world.Name).IsEqualTo("Lanternport"); + await Assert.That(world.Host).IsEqualTo("lanternport.example"); + await Assert.That(world.Encoding).IsEqualTo("auto"); + } + + /// + /// A world with several addresses is chosen from first — TLS active, then plain active, then stale — and the address + /// chosen fills in the form with its TLS, and the encoding mu*index's non-UTF-8 charset names; still nothing is saved + /// before the form's ⏎. + /// + [Test] + public async Task APickWithSeveralAddressesIsChosenFromAndTheChoiceFillsInTheFormWithItsEncoding() + { + await using var run = await Start(); + OpenFromTheWelcome(run.App); + + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.WorldBrowseOpen).IsTrue(); + var game = run.App.WorldBrowseModelNow.Choosing!; + await Assert.That(string.Join(",", game.Endpoints.Select(WorldBrowseModel.EndpointText))) + .IsEqualTo("aetherfall.example:4202 — TLS — active,aetherfall.example:4201 — plain — active,aetherfall.example:4000 — plain — stale · not reached lately"); + await Assert.That(game.Charset).IsEqualTo("ISO-8859-1"); + var drawn = string.Join('\n', run.App.CellWorldBrowse!.Render(run.App.WorldBrowseModelNow, 96, 20).Select(MarkupText.Plain)); + await Assert.That(drawn).Contains("Aetherfall answers at 3 addresses").And.Contains("▸ aetherfall.example:4202").And.Contains("charset ISO-8859-1"); + + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.DownArrow)); + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.WorldBrowseOpen).IsFalse(); + var form = run.App.Welcome!; + await Assert.That(form.Host).IsEqualTo("aetherfall.example"); + await Assert.That(form.Port).IsEqualTo("4201"); + await Assert.That(form.Tls).IsFalse(); + await Assert.That(form.Encoding).IsEqualTo("ISO-8859-1"); + await Assert.That(run.Config.Worlds.Count).IsEqualTo(0); + await Assert.That(string.Join('\n', run.App.WelcomeLines.Select(MarkupText.Plain))).Contains("encoding ISO-8859-1"); + + run.App.SimulateWelcomeKey(Key(ConsoleKey.Enter, '\r')); + await run.App.LastCommand; + var world = run.Config.Worlds.Single(); await Assert.That(world.Name).IsEqualTo("Aetherfall"); - await Assert.That(world.Host).IsEqualTo("aetherfall.example"); - await Assert.That(world.UseTls).IsTrue(); + await Assert.That(world.Port).IsEqualTo(4201); + await Assert.That(world.UseTls).IsFalse(); + await Assert.That(world.Encoding).IsEqualTo("ISO-8859-1"); + } + + [Test] + public async Task TheDefaultAddressIsTheFirstListedAndEscGoesBackToTheList() + { + await using var run = await Start(); + OpenFromTheWelcome(run.App); + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Escape, '\x1b')); + + await Assert.That(run.App.WorldBrowseOpen).IsTrue().Because("Esc on the address choice goes back, not out"); + await Assert.That(run.App.WorldBrowseModelNow.Choosing).IsNull(); + + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.Welcome!.Port).IsEqualTo("4202"); + await Assert.That(run.App.Welcome!.Tls).IsTrue(); } [Test] @@ -181,10 +246,25 @@ public async Task APickTheDirectoryCannotPlaceStaysOnTheListAndSaysWhy() run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); await Assert.That(run.App.WorldBrowseOpen).IsTrue(); - await Assert.That(run.App.WorldBrowseModelNow.Problem).IsEqualTo("Aetherfall not opened: the directory lists no telnet address for it that answers"); + await Assert.That(run.App.WorldBrowseModelNow.Problem).IsEqualTo("Aetherfall not opened: the directory lists no telnet address for it"); await Assert.That(run.App.WorldBrowseModelNow.Opening).IsNull(); } + [Test] + public async Task AnAddressConnectCannotDialIsSaidAndNeverFillsTheForm() + { + await using var run = await Start(answer: uri => uri.AbsolutePath.EndsWith("/games", StringComparison.Ordinal) + ? Encoding.UTF8.GetBytes(DemoWorldDirectory.Answer(uri)) + : Encoding.UTF8.GetBytes("{\"name\":\"x\",\"endpoints\":[{\"host\":\"bad host\",\"port\":4000,\"kind\":\"telnet\",\"state\":\"active\"}]}")); + OpenFromTheWelcome(run.App); + + run.App.SimulateWorldBrowseKey(Key(ConsoleKey.Enter, '\r')); + + await Assert.That(run.App.WorldBrowseOpen).IsTrue(); + await Assert.That(run.App.WelcomeIsOpen).IsFalse(); + await Assert.That(run.App.WorldBrowseModelNow.Problem).IsEqualTo("Aetherfall not opened: mu*index lists it at bad host:4000, which /connect cannot dial"); + } + [Test] public async Task EnterOnASearchTheRowsCannotAnswerAsksTheDirectory() { @@ -247,4 +327,31 @@ public async Task WhereTheScreenIsNotSeenTheListIsLinesAndANumberSaysTheConnectL await Assert.That(heard.Heard).Contains("To add it and connect, type: /connect lanternport.example 2860"); await Assert.That(run.Config.Worlds.Count).IsEqualTo(0); } + + /// --plain: a world with several addresses has them said as numbered lines, and /browse 1 2 says the second's line. + [Test] + public async Task WhereTheScreenIsNotSeenSeveralAddressesAreNumberedAndASecondNumberSaysOne() + { + var heard = new Recorder(); + await using var run = await Start(host: h => h with { Announcer = heard, ScreenIsSeen = false }); + TypeCommand(run.App, "/browse"); + + TypeCommand(run.App, "/browse 1"); + + await Assert.That(heard.Heard).Contains("Aetherfall answers at 3 addresses — choose one:"); + await Assert.That(heard.Heard).Contains("1. aetherfall.example:4202 — TLS — active"); + await Assert.That(heard.Heard).Contains("3. aetherfall.example:4000 — plain — stale · not reached lately"); + await Assert.That(heard.Heard).Contains("mu*index names its charset ISO-8859-1, for the whole game rather than per address."); + + TypeCommand(run.App, "/browse 1 1"); + await Assert.That(heard.Heard).Contains("To add it and connect, type: /connect aetherfall.example 4202 tls"); + + TypeCommand(run.App, "/browse 1 2"); + await Assert.That(heard.Heard).Contains("To add it and connect, type: /connect aetherfall.example 4201"); + await Assert.That(heard.Heard).Contains(line => line.Contains("set the world's encoding to ISO-8859-1", StringComparison.Ordinal)); + + TypeCommand(run.App, "/browse 1 7"); + await Assert.That(run.App.LastNotice).Contains("Aetherfall has 3 addresses"); + await Assert.That(run.Config.Worlds.Count).IsEqualTo(0); + } } From 788e18de524628da2e47545347d42122ae42802b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 17:20:35 +0000 Subject: [PATCH 063/113] Give the package link test ten seconds under a loaded test host It waited two seconds for the review to open and failed once in a parallel run; alone it passes in milliseconds. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs b/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs index 175ac4c6..b93dc74d 100644 --- a/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs @@ -134,7 +134,7 @@ public async Task ALinkIsFetchedThenReviewed() rig.App.PackageFetch = (uri, _) => { asked = uri; return Task.FromResult(Archive()); }; Type(rig.App, "/package install https://packages.example/basics.zip"); - for (var i = 0; i < 200 && !rig.App.PackageView.IsOpen; i++) + for (var i = 0; i < 1000 && !rig.App.PackageView.IsOpen; i++) { await Task.Delay(10); } From 26ca3c9a8599c59aa805a9e4067eb5996a665b27 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 17:22:54 +0000 Subject: [PATCH 064/113] Window: panel headings, docked composer footer, page welcome MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every docked native panel draws a heading from its model (PanelHeading, Client): Compose for Corvid, Here The Grand Plaza · 6, Vitals GMCP Char.Vitals, Map Aetherfall · level 0. Who-here marks active, idle and NPC with a dot and right-aligned state and ends in its footnote; a tall vitals pane is a card with the target under a rule; the quick bar's buttons carry their key and end in "+ Bind a key" (F4). The docked composer gets an escaping chip, a paragraph/word summary, and Preview (F1 with the as-sent band, PreviewDocked) and Send buttons. The window's welcome is one page: a Find a world card that lists mu*index only on Show worlds (WelcomeSession.FindWorlds, the browse list's pick on Add), Connect directly with its /connect line, and two starting-layout cards. New surface actions are probed in SurfaceParityTests. Terminal frames are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 8 + CLAUDE.md | 8 + src/SharpMUTerm.Avalonia/ComposerView.cs | 207 ++++- src/SharpMUTerm.Avalonia/MapCanvas.cs | 25 +- src/SharpMUTerm.Avalonia/NativeTokens.cs | 3 + src/SharpMUTerm.Avalonia/PanelText.cs | 45 ++ src/SharpMUTerm.Avalonia/QuickBarButtons.cs | 64 +- src/SharpMUTerm.Avalonia/VitalsGauges.cs | 81 +- src/SharpMUTerm.Avalonia/WelcomeView.cs | 722 +++++++++++++----- src/SharpMUTerm.Avalonia/WhoHereList.cs | 90 +-- .../Composer/ComposerModel.cs | 32 + src/SharpMUTerm.Client/Modals/WelcomeModel.cs | 103 +++ src/SharpMUTerm.Client/Panels/PanelHeading.cs | 57 ++ .../Panels/QuickBarModel.cs | 6 + src/SharpMUTerm.Client/Panels/VitalsModel.cs | 45 +- src/SharpMUTerm.Client/Panels/WhoHereModel.cs | 13 + .../Surfaces/SurfaceCatalog.cs | 8 + .../SharpMUTermApp.NativeComposer.cs | 26 + .../SharpMUTermApp.NativeModals.cs | 14 +- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 13 +- src/SharpMUTerm.Tui/SharpMUTermApp.Welcome.cs | 5 + .../SharpMUTermApp.WorldBrowse.cs | 83 +- .../NativeComposerTests.cs | 2 +- .../SurfaceParityTests.cs | 49 ++ .../PanelHeadingTests.cs | 56 ++ 25 files changed, 1411 insertions(+), 354 deletions(-) create mode 100644 src/SharpMUTerm.Client/Panels/PanelHeading.cs create mode 100644 tests/SharpMUTerm.Client.Tests/PanelHeadingTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index c52877e3..53474907 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- In the desktop window, every docked panel has a heading saying what it shows (Compose for Corvid, Here The Grand + Plaza · 6, Vitals GMCP Char.Vitals, Map Aetherfall · level 0). Who is here marks each person active, idle or NPC; a + tall vitals pane draws a card with the target under a rule; the quick bar's buttons show their key and end in a + "+ Bind a key" button that opens F4. +- The docked composer in the window has its escaping on a chip you can click, a paragraph and word count, and Preview + and Send buttons; Preview opens the full-screen composer with the as-sent band. +- The window's welcome is one page: find a world from mu*index and add it, connect directly (with the `/connect` line + it stands for), and pick a starting layout from two cards. Nothing is fetched until you ask for the list. - A script error in the script console that names a file and line is now a link: click it to open that script with the caret on the line and the line marked. Closing the editor goes back to the console. - The script editor numbers its lines in the desktop window too, and after a save whose reload fails, the line the diff --git a/CLAUDE.md b/CLAUDE.md index 7bfaa89e..e50f4f54 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1481,6 +1481,14 @@ fallbacks) for inline images/maps. always-on-top choice; the composer does not float; positions on a mixed-DPI desktop are assumed to be in the main window's scaling. +- **Wave 19 panels and welcome (window only; the cells are unchanged).** Each docked native panel draws a heading from + its model (`PanelHeading.For`, Client; `PanelText.Heading`); `VitalsModel.Source` names where the meters came from + (`SourceOf`, set in `ReadVitals`), a mixture names nothing. The docked composer's footer (summary, Preview, Send) ends + in `ComposerSession`: Preview is `PreviewDocked` → F1 with `_composer.Preview` on (surface action `preview`). The quick + bar and the vitals row leave 22–30 px at the right for the pop-out button. The native welcome is a page + (`WelcomeView`): its Find card attaches a `WorldBrowseSession` to the welcome (`WelcomeSession.FindWorlds` → + `FindWorldsInWelcome`, actions `find`/`add`), fetched only on Show worlds, forgotten when the welcome closes; Add is the + browse pick, which reopens the welcome with the form filled. - **Wave 16 groups** (F5 headings, ⌃P groups, scene mark, client rows, map find). Decisions not to relitigate: - **F5's world column is drawn in the declaration's order under its `Group` headings** (`WorldsScreenRenderer.DetailColumn` walks `BuiltInSettings.World.Fields`), so the cell screen and the window group alike; `WorldFieldOrder` (⇥ order and the diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index a2df2fe4..f54348a2 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -49,6 +49,12 @@ internal sealed class ComposerView : Border private readonly Border _footer; private readonly WrapPanel _keys; private readonly Border _rule; + + // The docked panel's own parts: the editor's framed well, and the footer's summary, Preview and Send. + private readonly Border? _well; + private readonly TextBlock _summary = new() { VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; + private readonly Border _previewButton; + private readonly Border _sendButton; private ComposerSession? _session; private ComposerModel? _model; private long _applied = -1; @@ -70,7 +76,7 @@ public ComposerView(TerminalView view, bool fullScreen) _editor = new ComposerEditor { Background = Brushes.Transparent, - Padding = fullScreen ? new Thickness(22, 14) : new Thickness(12, 6), + Padding = fullScreen ? new Thickness(22, 14) : new Thickness(10, 8), }; AutomationProperties.SetName(_editor, fullScreen ? "Compose a post" : "Docked composer"); _editor.TextChanged += (_, _) => OnTextChanged(); @@ -81,7 +87,7 @@ public ComposerView(TerminalView view, bool fullScreen) _marks = new MarkLayer(_editor); _gutter = new LineGutter(_editor) { IsVisible = false }; - _title = new TextBlock { FontWeight = FontWeight.Bold, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 10, 0) }; + _title = new TextBlock { FontWeight = fullScreen ? FontWeight.Bold : FontWeight.SemiBold, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, fullScreen ? 10 : 8, 0) }; _target = new TextBlock { VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; _chips = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, VerticalAlignment = VerticalAlignment.Center }; _count = new TextBlock { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(10, 0, 0, 0) }; @@ -93,10 +99,29 @@ public ComposerView(TerminalView view, bool fullScreen) headerRow.Children.Add(_count); headerRow.Children.Add(_chips); headerRow.Children.Add(_target); - _header = new Border { Child = headerRow, Padding = fullScreen ? new Thickness(22, 10) : new Thickness(12, 3, 8, 3) }; + // The docked panel's heading is every panel's (PanelText.Heading): 16 px in, a rule under it, the pop-out button + // clear at the right. + _header = new Border { Child = headerRow, Padding = fullScreen ? new Thickness(22, 10) : new Thickness(PanelText.Pad, 10, 30, 10) }; _keys = new WrapPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center }; - _footer = new Border { Child = _keys, Padding = fullScreen ? new Thickness(22, 8) : new Thickness(12, 2, 8, 3) }; + + // The docked footer: how long the post is, then Preview (F1 with its as-sent band) and Send, each the session's. + _previewButton = ActionButton("Preview", "The post as it will be sent, in F1", () => _session?.TogglePreview()); + _previewButton.Name = "Preview"; + _sendButton = ActionButton("Send Ctrl+S", "Send the post (Ctrl+S)", () => _session?.Send(_editor.Text ?? string.Empty)); + _sendButton.Name = "Send"; + var dockedFooter = new DockPanel { LastChildFill = true }; + DockPanel.SetDock(_sendButton, Dock.Right); + DockPanel.SetDock(_previewButton, Dock.Right); + _previewButton.Margin = new Thickness(8, 0, 8, 0); + dockedFooter.Children.Add(_sendButton); + dockedFooter.Children.Add(_previewButton); + dockedFooter.Children.Add(_summary); + _footer = new Border + { + Child = fullScreen ? _keys : dockedFooter, + Padding = fullScreen ? new Thickness(22, 8) : new Thickness(PanelText.Pad, 10, PanelText.Pad, 12), + }; // F1's as-sent preview (⌥P): the one command ⌃S sends, in the editor's face, under the editor. _previewHeading = new TextBlock { Text = "AS SENT", FontWeight = FontWeight.Bold, Margin = new Thickness(0, 0, 0, 4) }; @@ -119,10 +144,25 @@ public ComposerView(TerminalView view, bool fullScreen) // A script's lines are numbered in a gutter beside the editor, the cells' line numbers; the error line is marked there. var body = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") }; + Control page = text; + if (!fullScreen) + { + // Docked, the editor is a framed well inside the panel, as the mockup's Text field is. + _well = new Border + { + Child = text, + Margin = new Thickness(PanelText.Pad, 12, PanelText.Pad, 0), + CornerRadius = new CornerRadius(NativeTokens.RadiusS + 2), + BorderThickness = new Thickness(1), + ClipToBounds = true, + }; + page = _well; + } + Grid.SetColumn(_gutter, 0); - Grid.SetColumn(text, 1); + Grid.SetColumn(page, 1); body.Children.Add(_gutter); - body.Children.Add(text); + body.Children.Add(page); var grid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto,Auto") }; Grid.SetRow(_header, 0); @@ -165,8 +205,10 @@ public ComposerView(TerminalView view, bool fullScreen) .Concat(_chips.Children.OfType().Select(b => (b.Child as TextBlock)?.Text)).Where(t => !string.IsNullOrEmpty(t))); /// The key row's words, joined, for a test. - internal string FooterText => string.Join(" · ", _keys.Children.OfType() - .Select(p => string.Join(" ", p.Children.OfType().Select(Words).Where(t => t.Length > 0)))); + internal string FooterText => !_fullScreen + ? string.Join(" · ", new[] { _summary.Text, Words(_previewButton.Child!), Words(_sendButton.Child!) }.Where(t => !string.IsNullOrEmpty(t))) + : string.Join(" · ", _keys.Children.OfType() + .Select(p => string.Join(" ", p.Children.OfType().Select(Words).Where(t => t.Length > 0)))); /// The menu the editor last opened. Internal for tests. internal ContextMenu? OpenedMenu { get; private set; } @@ -303,15 +345,29 @@ private static bool SameChrome(ComposerModel a, ComposerModel b) => /// The bands' plane: the pane's, one step toward the text, so the editor reads as the page between them. private Color Band => Mix(_plane, _text, _fullScreen ? 0.06 : 0.045); + /// The docked editor's well: a step deeper than the panel on a dark plane, lighter on a light one. + private Color Well => Luma(_plane) < 0.5 ? Mix(_plane, Colors.Black, 0.25) : Mix(_plane, Colors.White, 0.7); + + private static double Luma(Color c) => ((0.2126 * c.R) + (0.7152 * c.G) + (0.0722 * c.B)) / 255; + private void Paint() { Background = new SolidColorBrush(_plane); - _header.Background = new SolidColorBrush(Band); - _footer.Background = new SolidColorBrush(Band); - _header.BorderBrush = new SolidColorBrush(Mix(_plane, _text, 0.12)); + _header.Background = new SolidColorBrush(_fullScreen ? Band : _plane); + _footer.Background = new SolidColorBrush(_fullScreen ? Band : _plane); + _header.BorderBrush = new SolidColorBrush(_fullScreen ? Mix(_plane, _text, 0.12) : PanelText.Rule(_text, _plane)); _header.BorderThickness = new Thickness(0, 0, 0, 1); _footer.BorderBrush = _header.BorderBrush; - _footer.BorderThickness = new Thickness(0, 1, 0, 0); + _footer.BorderThickness = _fullScreen ? new Thickness(0, 1, 0, 0) : default; + if (_well is not null) + { + _well.Background = new SolidColorBrush(Well); + _well.BorderBrush = new SolidColorBrush(Mix(_plane, _text, 0.2)); + } + + _summary.Foreground = new SolidColorBrush(Dim); + PaintButton(_previewButton, accent: false); + PaintButton(_sendButton, accent: true); _rule.Background = new SolidColorBrush(Accent); _editor.Foreground = new SolidColorBrush(_text); _editor.CaretBrush = new SolidColorBrush(Accent); @@ -323,8 +379,8 @@ private void Paint() _gutter.Warn = Warn; _gutter.Background = new SolidColorBrush(Band); _gutter.InvalidateVisual(); - _title.Foreground = new SolidColorBrush(Accent); - _target.Foreground = new SolidColorBrush(_text); + _title.Foreground = new SolidColorBrush(_fullScreen ? Accent : _text); + _target.Foreground = new SolidColorBrush(_fullScreen ? _text : Dim); _count.Foreground = new SolidColorBrush(Dim); _preview.Background = new SolidColorBrush(Band); _preview.BorderBrush = _header.BorderBrush; @@ -338,9 +394,17 @@ private void ApplyFont() { var cell = _view.CellExtent.Height > 0 ? _view.CellExtent.Height : 17; var ui = Math.Clamp(cell * 0.72, 11, 15); - _title.FontSize = ui; - _target.FontSize = ui; + _title.FontSize = _fullScreen ? ui : PanelText.Size; + _target.FontSize = _fullScreen ? ui : PanelText.Size; _count.FontSize = ui - 1; + _summary.FontSize = PanelText.Size - 1; + foreach (var button in new[] { _previewButton, _sendButton }) + { + if (button.Child is TextBlock words) + { + words.FontSize = PanelText.Size - 1; + } + } _previewHeading.FontSize = ui - 1.5; _previewText.FontSize = Math.Clamp(cell * 0.72, 11, 16); _previewText.FontFamily = new FontFamily($"{_view.Renderer.Fonts.FamilyName}, {CellFonts.BundledFamily}, DejaVu Sans Mono, Liberation Mono, Consolas, Menlo, monospace"); @@ -389,18 +453,49 @@ private void Label(ComposerModel model) _title.Text = "EDIT"; _target.Text = $"{edit.Name} {edit.Type} · from {(model.Target.Length == 0 ? "no connection" : model.Target)}"; } + else if (!_fullScreen) + { + // The panel heading: Compose for Corvid. + var heading = SharpMUTerm.Client.Panels.PanelHeading.For(model); + _title.Text = heading.Title; + _target.Text = heading.Context ?? string.Empty; + } else { _title.Text = "COMPOSE"; - var verb = !_fullScreen && model.Verb.Length > 0 ? $"{model.Verb} " : string.Empty; - _target.Text = model.Target.Length == 0 ? $"{verb}no connection" : $"{verb}to {model.Target}"; + _target.Text = model.Target.Length == 0 ? "no connection" : $"to {model.Target}"; } _target.Foreground = new SolidColorBrush( - model.Target.Length == 0 || model.Edit?.Status?.StartsWith('!') == true ? Warn : _text); + model.Target.Length == 0 || model.Edit?.Status?.StartsWith('!') == true ? Warn : _fullScreen ? _text : Dim); _chips.Children.Clear(); - if (model.Edit is null) + if (model.Edit is null && !_fullScreen) + { + // The escaping, as a chip that switches it (⌥L): Literal or As typed. + var literal = model.Escaping == ComposeEscaping.Literal; + var escaping = Chip(literal ? "Literal" : "As typed", literal ? Accent : Dim, ui - 1.5); + escaping.Name = "Escaping"; + escaping.Cursor = new Cursor(StandardCursorType.Hand); + ToolTip.SetTip(escaping, literal ? "Sent as typed, % [ ] escaped (Alt+L switches)" : "Sent exactly as typed (Alt+L switches)"); + escaping.PointerPressed += (_, e) => + { + if (e.GetCurrentPoint(escaping).Properties.IsLeftButtonPressed) + { + e.Handled = true; + _session?.ToggleEscaping(); + } + }; + _chips.Children.Add(escaping); + if (model.Armed && model.Dictionary is { } named) + { + _chips.Children.Add(Chip(named, Dim, ui - 1.5)); + } + + _count.IsVisible = false; + _sendButton.Opacity = model.CanSend ? 1 : 0.55; + } + else if (model.Edit is null) { _chips.Children.Add(Chip(model.Escaping == ComposeEscaping.Literal ? "literal" : "as typed", model.Escaping == ComposeEscaping.Literal ? Accent : _text, ui - 1.5)); @@ -416,7 +511,15 @@ private void Label(ComposerModel model) SyncLength(); _keys.Children.Clear(); - var narrow = !_fullScreen && Bounds.Width is > 0 and < 560; + if (!_fullScreen) + { + // A docked composer too short for its footer keeps the editor and drops the footer. + _footer.IsVisible = Bounds.Height is 0 or >= 96; + _editor.PlaceholderText = !model.Armed ? ComposerModel.ClickToWrite : null; + _editor.PlaceholderForeground = new SolidColorBrush(Dim); + return; + } + // The idle editor's placeholder says "Click to write a post"; the row's keyless hint saying it again was the // panel saying one thing twice. var placeholder = !model.Armed && !_fullScreen; @@ -436,7 +539,7 @@ private void Label(ComposerModel model) item.Children.Add(new TextBlock { - Text = NativeKeys.Words(narrow && key.Short is { } brief ? brief : key.Label), + Text = NativeKeys.Words(key.Label), FontSize = ui - 1, Foreground = new SolidColorBrush(Dim), VerticalAlignment = VerticalAlignment.Center, @@ -516,6 +619,14 @@ private void SyncLength() var text = _editor.Text ?? string.Empty; _count.Text = ComposerModel.CharactersLabel(ComposerModel.SentLength(text, model.Escaping, model.Edit is not null)); + if (!_fullScreen) + { + // 2 paragraphs · 31 words · 240 chars; before anything is written, the keys that move in and out of it. + var summary = ComposerModel.Summary(text); + _summary.Text = summary.Length > 0 + ? $"{summary} · {_count.Text}" + : NativeKeys.Words(model.Armed ? "Esc command line · F1 full screen" : "F1 full screen"); + } if (_preview.IsVisible) { var command = ComposeMessage.Build(text.Replace("\r\n", "\n", StringComparison.Ordinal), model.Escaping); @@ -783,6 +894,58 @@ private void Replace(SpellRange mark, string replacement) // ── colours ────────────────────────────────────────────────────────────────────────────── + /// A footer button drawn as a plate, as the panels' are: a click runs . + private static Border ActionButton(string words, string tip, Action click) + { + var button = new Border + { + Child = new TextBlock { Text = words, VerticalAlignment = VerticalAlignment.Center }, + Padding = new Thickness(10, 5), + CornerRadius = new CornerRadius(NativeTokens.RadiusS + 2), + BorderThickness = new Thickness(1), + Cursor = new Cursor(StandardCursorType.Hand), + VerticalAlignment = VerticalAlignment.Center, + }; + ToolTip.SetTip(button, tip); + AutomationProperties.SetName(button, words); + button.PointerPressed += (_, e) => + { + if (e.GetCurrentPoint(button).Properties.IsLeftButtonPressed) + { + e.Handled = true; + click(); + } + }; + return button; + } + + private void PaintButton(Border button, bool accent) + { + button.Background = new SolidColorBrush(accent ? Accent : Mix(_plane, _text, 0.07)); + button.BorderBrush = new SolidColorBrush(accent ? Accent : Mix(_plane, _text, 0.18)); + if (button.Child is TextBlock words) + { + words.Foreground = new SolidColorBrush(accent ? (Luma(Accent) > 0.5 ? Mix(Accent, Colors.Black, 0.85) : Colors.White) : _text); + words.FontWeight = accent ? FontWeight.SemiBold : FontWeight.Normal; + } + } + + /// Presses the docked footer's Preview or Send button, as a click on it does. Internal for tests. + internal void PressFooter(string name) + { + if (name == "Send") + { + _session?.Send(_editor.Text ?? string.Empty); + } + else + { + _session?.TogglePreview(); + } + } + + /// The docked footer's summary as drawn. Internal for tests. + internal string SummaryText => _summary.Text ?? string.Empty; + internal static Color Mix(Color a, Color b, double t) => Color.FromRgb( (byte)Math.Round(a.R + ((b.R - a.R) * t)), (byte)Math.Round(a.G + ((b.G - a.G) * t)), diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index a90fe942..05586083 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -390,8 +390,9 @@ internal IReadOnlyList LookButtons() return buttons; } - var x = 10.0; - var y = _model.Walking is not null || _model.Current is not null ? 46.0 : 28.0; + var x = PanelText.Pad; + var heading = PanelText.HeadingHeight(CellHeight); + var y = _model.Walking is not null || _model.Current is not null ? heading + 26 : heading + 8; void Add(string id, string label, bool enabled) { var width = PanelText.Measure(label, ButtonSize, bold: false) + 14; @@ -420,6 +421,9 @@ void Add(string id, string label, bool enabled) private const double ButtonSize = 11; + /// The cell height the panel sits on, which sizes its heading as every panel's. + private double CellHeight => _view.CellExtent.Height > 0 ? _view.CellExtent.Height : 17; + private LookButton? LookButtonAt(Point point) => LookButtons().FirstOrDefault(b => b.Rect.Contains(point)); /// What a look button does. Internal for tests, which press one the way a click does. @@ -662,17 +666,22 @@ public override void Render(DrawingContext context) DrawName(context, hovered.Current ? $"{hovered.Name} — you are here" : hovered.Name, CentreOf(hovered), size, plate: true); } - // What and where, in the corner: the area and level, and a walk under way. - var label = (_model.Viewing ? "Viewing " : string.Empty) - + (_model.Area is { Length: > 0 } areaName ? $"{areaName} · level {_model.Level}" : $"level {_model.Level}"); - DrawText(context, label, new Point(10, 8), 12, _model.AreaColour is { } areaHex ? Parse(areaHex) : Faded(0.75)); + // What and where: the panel heading (Map, the area and level) with the area's colour as a mark before its name's + // line, then the room the character is in, or a walk under way, under it. + var heading = PanelText.Heading(context, PanelHeading.For(_model), bounds.Width, CellHeight, _plane, _text, right: 20); + if (_model.AreaColour is { } areaHex) + { + context.DrawRectangle(new SolidColorBrush(Parse(areaHex)), null, new Rect(PanelText.Pad - 9, (heading / 2) - 5, 3, 10), 1.5, 1.5); + } + + var under = heading + 6; if (_model.Walking is { } walking) { - DrawText(context, walking, new Point(10, 26), 12, path); + DrawText(context, walking, new Point(PanelText.Pad, under), 12, path); } else if (_model.Current is { } here) { - DrawText(context, here.Name, new Point(10, 26), 12, accent); + DrawText(context, here.Name, new Point(PanelText.Pad, under), 12, accent); } if (_dragRoom is { } moving && byId.TryGetValue(moving.Id, out var shown)) diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.cs b/src/SharpMUTerm.Avalonia/NativeTokens.cs index 8c8bb89f..363bea89 100644 --- a/src/SharpMUTerm.Avalonia/NativeTokens.cs +++ b/src/SharpMUTerm.Avalonia/NativeTokens.cs @@ -56,6 +56,9 @@ internal sealed record NativeTokens( /// The type ramp: a surface's or a page's heading. public const double Heading = 18; + /// The type ramp: a whole page's title, of which there is one (the first-run welcome). + public const double Display = 26; + /// /// Not on the ramp: the theme cards' miniature of the cells (F7), which is a picture of a terminal at a quarter of /// its size rather than text to read. diff --git a/src/SharpMUTerm.Avalonia/PanelText.cs b/src/SharpMUTerm.Avalonia/PanelText.cs index 47b9e705..5d4dc396 100644 --- a/src/SharpMUTerm.Avalonia/PanelText.cs +++ b/src/SharpMUTerm.Avalonia/PanelText.cs @@ -58,4 +58,49 @@ public static double Draw(DrawingContext context, string text, double x, double /// A #rrggbb from the client, or grey when it is not one. public static Color Parse(string hex) => Color.TryParse(hex, out var colour) ? colour : Colors.Gray; + + // ── The panel heading: one row every docked panel draws over its content ──────────────────────────────────── + + /// The panels' side padding, and the heading's. + public const double Pad = 16; + + /// The panels' text size: the window's body size, one step up, which is what the mockups' side column reads at. + public const double Size = NativeTokens.Body + 1; + + /// How tall the heading is, its rule included, for the cell height the panel sits on: 42 px at a 20 px cell. + public static double HeadingHeight(double cellHeight) => Math.Clamp(cellHeight * 2.1, 32, 44); + + /// The secondary ink: mixed toward , opaque so it can be floor-checked. + public static Color Dim(Color text, Color plane) => Mix(text, plane, 0.38); + + /// The heading's rule, and every rule in a panel: a step from the plane toward the text. + public static Color Rule(Color text, Color plane) => Mix(plane, text, 0.14); + + /// Mixes toward by (0 is a, 1 is b), opaque. + public static Color Mix(Color a, Color b, double amount) => Color.FromRgb( + (byte)Math.Round(a.R + ((b.R - a.R) * amount)), + (byte)Math.Round(a.G + ((b.G - a.G) * amount)), + (byte)Math.Round(a.B + ((b.B - a.B) * amount))); + + /// + /// Draws a panel heading across the top of — the title semibold, the context dim beside it, + /// a rule under both — and returns the height it took (). is the + /// room kept clear at the right edge (a chip, the pop-out button). + /// + public static double Heading(DrawingContext context, SharpMUTerm.Client.Panels.PanelHeading heading, double width, double cellHeight, Color plane, Color text, double right = 0) + { + var height = HeadingHeight(cellHeight); + context.FillRectangle(new SolidColorBrush(plane), new Rect(0, 0, width, height)); + var middle = (height - 1) / 2; + var limit = width - Pad - right; + var x = Pad; + x += Draw(context, heading.Title, x, middle, Size, text, true, limit - x) + 8; + if (heading.Context is { Length: > 0 } words) + { + Draw(context, words, x, middle, Size, Dim(text, plane), false, limit - x); + } + + context.FillRectangle(new SolidColorBrush(Rule(text, plane)), new Rect(0, height - 1, width, 1)); + return height; + } } diff --git a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs index 45b1db80..72793cc3 100644 --- a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs +++ b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs @@ -43,7 +43,10 @@ internal enum SlotKind /// The widest a binding's name is drawn before it is trimmed. internal const double MaxTitleWidth = 150; - private const double Gap = 6, PadX = 8; + private const double Gap = 8, PadX = 12; + + /// The pane's top-right corner, where the pop-out button sits: the bar ends short of it. + private const double EndRoom = 22; private readonly TerminalView _view; @@ -117,7 +120,10 @@ public void Show(QuickBarModel model, PanelInk ink, Color plane, Color text, dou InvalidateVisual(); } - private double FontSize => Math.Clamp(_cellHeight * 0.62, 9, 13); + private double FontSize => Math.Min(PanelText.Size, Math.Max(9, _cellHeight * 0.66)); + + /// The key chip's size: a step under the label, as a caption. + private double KeySize => Math.Max(8, FontSize - 2); private static string Trim(QuickBarItem item) => item.Title; @@ -125,12 +131,12 @@ private double ItemWidth(QuickBarItem item) { var size = FontSize; var title = Math.Min(MaxTitleWidth, PanelText.Measure(Trim(item), size, false)); - return PadX + PanelText.Measure(NativeKeys.Words(item.Key), size, true) + 5 + title + PadX; + return PadX + PanelText.Measure(NativeKeys.Words(item.Key), KeySize, false) + 7 + title + PadX; } private double MoreWidth(int hidden) => PadX + PanelText.Measure($"+{hidden.ToString(CultureInfo.InvariantCulture)}", FontSize, true) + PadX; - private double EditWidth => PanelText.Measure(QuickBarModel.EditHint, FontSize, false) + (PadX * 2); + private double EditWidth => PanelText.Measure(QuickBarModel.BindLabel, FontSize, false) + (PadX * 2); /// /// The cells' rule, in pixels: the link first, then as many bindings as fit in order, with +N for the @@ -157,7 +163,7 @@ private void Layout(Size size) var widths = items.Select(ItemWidth).ToList(); foreach (var withEdit in new[] { true, false }) { - var room = size.Width - (Gap * 2) - (withEdit ? EditWidth + Gap : 0); + var room = size.Width - EndRoom - (Gap * 2) - (withEdit ? EditWidth + Gap : 0); for (var take = items.Count; take >= 0 && room >= 0; take--) { var hidden = items.Count - take; @@ -182,7 +188,7 @@ private void Layout(Size size) if (withEdit) { - _slots.Add(new Slot(SlotKind.Edit, -1, new Rect(size.Width - Gap - EditWidth, top, EditWidth, height))); + _slots.Add(new Slot(SlotKind.Edit, -1, new Rect(size.Width - EndRoom - Gap - EditWidth, top, EditWidth, height))); } return; @@ -346,49 +352,43 @@ public override void Render(DrawingContext context) { case SlotKind.Item: { + // The key as a caption, then the binding's name: a button per binding, as the mockups draw the bar. var item = _model.Items[slot.Index]; - Plate(context, rect, hot, down); - var keyInk = item.Fires ? accent : dim; + Plate(context, rect, hot, down, dashed: false); + var keyInk = item.Fires ? dim : PanelText.Mix(dim, _plane, 0.35); var titleInk = item.Fires ? _text : dim; var x = rect.Left + PadX; - x += PanelText.Draw(context, NativeKeys.Words(item.Key), x, middle, size, keyInk, true, rect.Width) + 5; + x += PanelText.Draw(context, NativeKeys.Words(item.Key), x, middle, KeySize, keyInk, false, rect.Width) + 7; PanelText.Draw(context, Trim(item), x, middle, size, titleInk, false, rect.Right - PadX - x + 0.5); break; } case SlotKind.More: - Plate(context, rect, hot, down); + Plate(context, rect, hot, down, dashed: false); PanelText.Draw(context, $"+{slot.Index.ToString(CultureInfo.InvariantCulture)}", rect.Left + PadX, middle, size, _text, true, rect.Width); break; case SlotKind.Edit: - { - // A link, not a button: the accent key, the words in the dim ink, underlined under the pointer. - var x = rect.Left + PadX; - var keyWidth = PanelText.Draw(context, QuickBarModel.EditKey, x, middle, size, accent, true, rect.Width); - var rest = QuickBarModel.EditHint[QuickBarModel.EditKey.Length..]; - var restWidth = PanelText.Draw(context, rest, x + keyWidth, middle, size, hot ? _text : dim, false, rect.Right - x - keyWidth); - if (hot) - { - var y = Math.Round(middle + (size * 0.62)) + 0.5; - context.DrawLine(new Pen(new SolidColorBrush(PanelText.Alpha(_text, 0xC0)), 1), new Point(x, y), new Point(x + keyWidth + restWidth, y)); - } - + // F4's door as a button with a dashed edge: an empty slot to put a binding in. + Plate(context, rect, hot, down, dashed: true); + PanelText.Draw(context, QuickBarModel.BindLabel, rect.Left + PadX, middle, size, hot ? _text : dim, false, rect.Width - (PadX * 2) + 1); break; - } } } } - /// A button's plate: the text colour at a low alpha, stronger under the pointer and while pressed. - private void Plate(DrawingContext context, Rect rect, bool hot, bool down) + /// + /// A button's plate: a step off the plane with a rule-coloured edge, stronger under the pointer and while pressed; the + /// bind button's edge is dashed and its plate empty until the pointer is on it. + /// + private void Plate(DrawingContext context, Rect rect, bool hot, bool down, bool dashed) { - var alpha = (byte)(down ? 0x48 : hot ? 0x30 : 0x18); - context.DrawRectangle( - new SolidColorBrush(PanelText.Alpha(_text, alpha)), - new Pen(new SolidColorBrush(PanelText.Alpha(_text, 0x26)), 1), - rect.Deflate(0.5), - 4, - 4); + var fill = dashed && !hot && !down ? _plane : PanelText.Mix(_plane, _text, down ? 0.2 : hot ? 0.13 : 0.07); + var edge = new Pen( + new SolidColorBrush(PanelText.Mix(_plane, _text, dashed ? 0.3 : 0.18)), + 1, + dashed ? new DashStyle([4, 3], 0) : null); + var radius = Math.Min(NativeTokens.RadiusM, rect.Height / 2); + context.DrawRectangle(new SolidColorBrush(fill), edge, rect.Deflate(0.5), radius, radius); } } diff --git a/src/SharpMUTerm.Avalonia/VitalsGauges.cs b/src/SharpMUTerm.Avalonia/VitalsGauges.cs index 5563ec14..2489dce5 100644 --- a/src/SharpMUTerm.Avalonia/VitalsGauges.cs +++ b/src/SharpMUTerm.Avalonia/VitalsGauges.cs @@ -59,15 +59,32 @@ public void Show(VitalsModel model, PanelInk ink, Color plane, Color text, doubl InvalidateVisual(); } - /// Height one stacked block takes: a line of text and a bar under it. - private static double BlockHeight(double cellHeight) => Math.Max(30, cellHeight * 2.1); + /// The meter's label line in a stacked block: the name and the numbers over the bar. + private static double LabelHeight(double cellHeight) => Math.Max(14, cellHeight * 0.85); + + /// A stacked meter's bar: ten pixels on an ordinary cell, as the mockups draw it. + private static double BarHeight(double cellHeight) => cellHeight >= 15 ? 10 : 8; + + /// Height one stacked block takes: a line of text, the bar under it, and the gap to the next. + private static double BlockHeight(double cellHeight) => LabelHeight(cellHeight) + 4 + BarHeight(cellHeight) + 10; + + /// The height every stacked block takes, the target's rule included. + private double BlocksHeight(VitalsModel model) => + (model.Meters.Count * BlockHeight(_cellHeight)) + (model.Target is null ? 0 : BlockHeight(_cellHeight) + 8); private bool StackedFor(double height, VitalsModel model) { var blocks = model.Meters.Count + (model.Target is null ? 0 : 1); - return blocks > 0 && height >= (blocks * BlockHeight(_cellHeight)) + 8; + return blocks > 0 && height >= BlocksHeight(model) + 12; } + /// Whether a stacked pane also has room for the panel heading over the blocks. + private bool HeadedFor(double height, VitalsModel model) => + height >= PanelText.HeadingHeight(_cellHeight) + 12 + BlocksHeight(model) + 4; + + /// Whether the heading is drawn now. Internal for tests. + internal bool Headed => Stacked && HeadedFor(Bounds.Height > 0 ? Bounds.Height : Height, _model); + public override void Render(DrawingContext context) { var bounds = new Rect(Bounds.Size); @@ -90,31 +107,46 @@ public override void Render(DrawingContext context) } } + /// + /// The side column's card: the heading (Vitals and where the numbers come from) when there is room for it, then a + /// block per meter — the name and the numbers over a ten-pixel rounded bar, a low meter's words and bar in the + /// warning ink with · low — and the target under a rule, on a thinner bar. + /// private void RenderStacked(DrawingContext context, Rect bounds) { var block = BlockHeight(_cellHeight); - var size = Math.Clamp(_cellHeight * 0.68, 10, 15); - var barHeight = Math.Clamp(_cellHeight * 0.45, 6, 10); - var inner = bounds.Deflate(new Thickness(12, 8)); + var label = LabelHeight(_cellHeight); + var barHeight = BarHeight(_cellHeight); + var size = Math.Min(PanelText.Size - 1, Math.Max(10, _cellHeight * 0.68)); + var top = HeadedFor(bounds.Height, _model) + ? PanelText.Heading(context, PanelHeading.For(_model), bounds.Width, _cellHeight, _plane, _text, right: 20) + 12 + : 8; + var inner = new Rect(PanelText.Pad, top, Math.Max(1, bounds.Width - (PanelText.Pad * 2)), Math.Max(1, bounds.Height - top)); + var dim = PanelText.Dim(_text, _plane); + var warn = Parse(_ink.Low); var y = inner.Top; foreach (var meter in _model.Meters) { var low = meter.Low; + var middle = y + (label / 2); var title = low ? $"{meter.Title} · low" : meter.Title; - DrawText(context, title, new Point(inner.Left, y), size, low ? Parse(_ink.Low) : Dim(), bold: low, alignRight: false, inner.Width); - DrawText(context, Numbers(meter), new Point(inner.Right, y), size, _text, bold: true, alignRight: true, inner.Width); - var bar = new Rect(inner.Left, y + (size * 1.45), inner.Width, barHeight); - DrawBar(context, bar, meter.HasMax ? meter.Share ?? 0 : 1, low); + PanelText.Draw(context, title, inner.Left, middle, size, low ? warn : _text, low, inner.Width * 0.6); + PanelText.Draw(context, Numbers(meter), inner.Right, middle, size, low ? warn : _text, false, inner.Width * 0.4, alignRight: true); + DrawBar(context, new Rect(inner.Left, y + label + 4, inner.Width, barHeight), meter.HasMax ? meter.Share ?? 0 : 1, low); y += block; } if (_model.Target is { } target) { - DrawText(context, $"Target · {target.Name}", new Point(inner.Left, y), size, Dim(), bold: false, alignRight: false, inner.Width * 0.75); + context.FillRectangle(new SolidColorBrush(PanelText.Rule(_text, _plane)), new Rect(inner.Left, y - 4, inner.Width, 1)); + y += 4; + var middle = y + (label / 2); + var leadWidth = 6 + PanelText.Draw(context, "Target", inner.Left, middle, size, dim, false, inner.Width * 0.3); + PanelText.Draw(context, target.Name, inner.Left + leadWidth, middle, size, target.Low ? warn : _text, false, (inner.Width * 0.75) - leadWidth); if (target.Share is { } share) { - DrawText(context, Percent(share), new Point(inner.Right, y), size, _text, bold: true, alignRight: true, inner.Width); - DrawBar(context, new Rect(inner.Left, y + (size * 1.45), inner.Width, barHeight), share, target.Low); + PanelText.Draw(context, Percent(share), inner.Right, middle, size, _text, false, inner.Width * 0.25, alignRight: true); + DrawBar(context, new Rect(inner.Left, y + label + 4, inner.Width, Math.Max(4, barHeight - 4)), share, target.Low); } } } @@ -126,7 +158,7 @@ private void RenderRow(DrawingContext context, Rect bounds) { var size = Math.Clamp(_cellHeight * 0.62, 9, 14); var barHeight = Math.Clamp(bounds.Height * 0.32, 4, 9); - var inner = bounds.Deflate(new Thickness(10, 0)); + var inner = bounds.Deflate(new Thickness(10, 0, 30, 0)); var gap = 18.0; var shares = _model.Meters.Count + (_model.Target is null ? 0 : 1.4); var unit = (inner.Width - (gap * Math.Max(0, Math.Ceiling(shares) - 1))) / shares; @@ -214,23 +246,13 @@ private static FormattedText Format(string text, double size, Color colour, bool private void DrawBar(DrawingContext context, Rect track, double share, bool low) { + // Flat fills on a track one step off the plane, rounded to the bar's height: the mockups' gauge. var radius = track.Height / 2; - context.DrawRectangle(new SolidColorBrush(Parse(_ink.Track)), null, track, radius, radius); + context.DrawRectangle(new SolidColorBrush(PanelText.Mix(_plane, _text, 0.12)), null, track, radius, radius); var fill = new Rect(track.X, track.Y, track.Width * Math.Clamp(share, 0, 1), track.Height); if (fill.Width > 0.5) { - var colour = Parse(low ? _ink.Low : _ink.Bar); - var brush = new LinearGradientBrush - { - StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative), - EndPoint = new RelativePoint(0, 1, RelativeUnit.Relative), - GradientStops = - { - new GradientStop(Lighten(colour, 0.18), 0), - new GradientStop(colour, 1), - }, - }; - context.DrawRectangle(brush, null, fill, radius, radius); + context.DrawRectangle(new SolidColorBrush(Parse(low ? _ink.Low : _ink.Bar)), null, fill, radius, radius); } _drawn.Add((track, fill, low)); @@ -254,9 +276,4 @@ private static string Percent(double share) => private Color Dim() => Color.FromArgb(0xB0, _text.R, _text.G, _text.B); private static Color Parse(string hex) => Color.TryParse(hex, out var colour) ? colour : Colors.Gray; - - private static Color Lighten(Color colour, double amount) => Color.FromRgb( - (byte)(colour.R + ((255 - colour.R) * amount)), - (byte)(colour.G + ((255 - colour.G) * amount)), - (byte)(colour.B + ((255 - colour.B) * amount))); } diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index b67398ab..8365700f 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -1,42 +1,54 @@ +using System.Globalization; using Avalonia; using Avalonia.Controls; +using Avalonia.Controls.Documents; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Layout; using Avalonia.Media; using Avalonia.Threading; +using Avalonia.VisualTree; using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.WorldIndex; namespace SharpMUTerm.Avalonia; /// -/// The window's first-run welcome: the menu (connect to a host, browse games, open settings, the /connect -/// example and the starting layout) and the connect form (host, port, TLS, a character, a password reminder). A choice, -/// a layout and the filled form go back through the session; the client checks the form through /connect's own -/// path, so a refusal comes back as the model's problem and the form stays up. ↑↓ and ⏎ work the menu, ←→ the -/// layout; on the form ⇥ moves, ⏎ connects and Esc goes back to the menu. +/// The window's first-run welcome as one page: a heading, then two cards side by side — Find a world (a search box +/// and mu*index's rows, asked only when the player opens the list, each with an Add that does what a pick in Browse worlds +/// does: fills in the connect form) and Connect directly (host, port, character, TLS, Connect, and the +/// /connect line it is the same as) — then the starting layout as two cards. Everything it says is +/// 's and 's; every button ends in the session: a choice and a +/// layout in RunWelcomeAction/SetWelcomeLayout, the form in ConnectFromWelcome (through +/// /connect's own path, so a refusal comes back as the model's problem and the page stays up), the list in +/// FindWorldsInWelcome and a row's Add in PickWorld. ⏎ in the form connects, ⏎ in the search asks, Esc +/// closes. The cells keep their menu (WelcomeSurface): a page this wide does not fit a terminal. /// internal sealed class WelcomeView : DockPanel, IModalView { - private static readonly WelcomeChoice[] Choices = [WelcomeChoice.Connect, WelcomeChoice.Browse, WelcomeChoice.Settings, WelcomeChoice.Import]; - private static readonly WelcomeLayout[] Layouts = [WelcomeLayout.Suggested, WelcomeLayout.Roleplay, WelcomeLayout.Combat]; + /// The most rows the find card shows at once; the rest scroll. + private const int ShownRows = 3; private readonly WelcomeSession _session; private readonly NativeTokens _colours; private readonly Action _done; - private readonly StackPanel _body = new(); - private readonly TextBlock _footer; - private readonly TextBlock _heading; - private readonly List _choiceRows = []; - private readonly List internal bool CellsHoldHeader { get; set; } = true; + /// + /// Whether this view draws the command line's field around the bars' rows (): the + /// grid is then shorter, and a frame carrying a band + /// () draws its rows that much lower inside a padded, rounded field. + /// + internal bool DrawsInputField { get; set; } + + /// The plane the field's strip is painted on: the backdrop the status row and the sidebar sit on. + internal SKColor? FooterPlane { get; set; } + + /// The vertical pixels the field takes beside the rows it frames: none unless the view draws it. + private double FieldReserve => DrawsInputField ? NativeLayout.FieldReserve : 0; + + /// The top of screen row in logical units: rows of a band sit lower by the field's top padding. + internal double RowTop(int row) + { + var top = row * CellSize.Height; + return DrawsInputField && _driver.Frame.Band is { } band && row >= band.Top ? top + NativeLayout.FieldTop : top; + } + /// /// Raised on the window's thread after a new frame is taken for painting, and when the cell size or the view's /// size changes: when anything placed over cells may need to move. @@ -128,10 +150,10 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba /// The grid a window of holds, in whole cells. public (int Columns, int Rows) GridFor(Size size) => - (Math.Max(20, (int)(size.Width / CellSize.Width)), Math.Max(8, (int)(size.Height / CellSize.Height))); + (Math.Max(20, (int)(size.Width / CellSize.Width)), Math.Max(8, (int)((size.Height - FieldReserve) / CellSize.Height))); /// The window size that holds a grid of × . - public Size SizeFor(int columns, int rows) => new(columns * CellSize.Width, rows * CellSize.Height); + public Size SizeFor(int columns, int rows) => new(columns * CellSize.Width, (rows * CellSize.Height) + FieldReserve); protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) { @@ -156,7 +178,14 @@ protected override void OnSizeChanged(SizeChangedEventArgs e) public override void Render(DrawingContext context) { - context.Custom(new FrameDraw(new Rect(Bounds.Size), _driver.Frame, _driver.Pictures, _renderer, _scale)); + var frame = _driver.Frame; + var band = DrawsInputField ? frame.Band : null; + context.Custom(new FrameDraw(new Rect(Bounds.Size), frame, _driver.Pictures, _renderer, _scale, band, FooterPlane ?? Darker(_renderer.DefaultBackground))); + if (band is not null) + { + DrawFieldText(context, frame, band); + } + DrawHover(context); DrawScrollbars(context); } @@ -174,7 +203,7 @@ private void DrawHover(DrawingContext context) var cell = CellSize; var area = _target.Area; - var rect = new Rect(area.X * cell.Width, area.Y * cell.Height, area.Width * cell.Width, area.Height * cell.Height); + var rect = new Rect(area.X * cell.Width, RowTop(area.Y), area.Width * cell.Width, area.Height * cell.Height); context.DrawRectangle(Brush(_renderer.DefaultForeground, 0x24), null, rect.Inflate(new Thickness(1, 0)), 2, 2); } @@ -184,7 +213,7 @@ private void Rescale(double scale) // with them. A change of display scale is rare enough that one set of leaked fonts is the cheaper fix. _scale = scale; _renderer = new CellRenderer( - new CellFonts((float)(_fontPoints * scale), _family), + new CellFonts((float)(_fontPoints * scale), _family, _lineHeight), _renderer.DefaultForeground, _renderer.DefaultBackground); Repainted?.Invoke(); @@ -710,6 +739,14 @@ private System.Drawing.Point Cell(Point position) var frame = _driver.Frame; var x = Math.Clamp((int)(position.X / size.Width), 0, Math.Max(0, frame.Width - 1)); var y = Math.Clamp((int)(position.Y / size.Height), 0, Math.Max(0, frame.Height - 1)); + + // Below the panes, the field: its padding is the band's first and last rows, and its rows sit lower. + if (DrawsInputField && frame.Band is { } band && position.Y >= band.Top * size.Height) + { + var inside = (position.Y - (band.Top * size.Height) - NativeLayout.FieldTop) / size.Height; + y = Math.Clamp(band.Top + (int)Math.Floor(inside), band.Top, Math.Min(frame.Height, band.Top + band.Rows) - 1); + } + return new System.Drawing.Point(x, y); } @@ -719,7 +756,7 @@ private static PointerModifiers Modifiers(KeyModifiers keys) => | ((keys & KeyModifiers.Control) != 0 ? PointerModifiers.Ctrl : 0); /// One frame, drawn straight onto the compositor's Skia canvas. - private sealed class FrameDraw(Rect bounds, ScreenFrame frame, PictureStore pictures, CellRenderer renderer, double scale) + private sealed class FrameDraw(Rect bounds, ScreenFrame frame, PictureStore pictures, CellRenderer renderer, double scale, InputBand? band, SKColor plane) : ICustomDrawOperation { public Rect Bounds { get; } = bounds; @@ -727,7 +764,9 @@ private sealed class FrameDraw(Rect bounds, ScreenFrame frame, PictureStore pict public bool HitTest(Point p) => Bounds.Contains(p); public bool Equals(ICustomDrawOperation? other) => - other is FrameDraw draw && ReferenceEquals(draw.Frame, Frame) && draw.Bounds == Bounds; + other is FrameDraw draw && ReferenceEquals(draw.Frame, Frame) && draw.Bounds == Bounds && draw.Plane == Plane; + + private SKColor Plane => plane; private ScreenFrame Frame => frame; @@ -743,12 +782,159 @@ public void Render(ImmediateDrawingContext context) canvas.Save(); canvas.ClipRect(new SKRect(0, 0, (float)Bounds.Width, (float)Bounds.Height)); canvas.Scale((float)(1 / scale)); + if (band is null) + { + renderer.Render(canvas, frame, pictures); + } + else + { + RenderWithField(canvas, band); + } + + canvas.Restore(); + } + + /// + /// The panes as they are, then the field: the strip across the bottom on the backdrop, the rounded field in the + /// bars' own band colour (read off the cells, so armed, idle and a character's tint are the cells' own), the + /// bars' rows drawn inside it lower by its top padding, and a one-pixel edge. Device pixels throughout. + /// + private void RenderWithField(SKCanvas canvas, InputBand band) + { + var ch = renderer.Fonts.CellHeight; + var cw = renderer.Fonts.CellWidth; + var s = (float)scale; + var width = (float)(Bounds.Width * scale); + var height = (float)(Bounds.Height * scale); + var top = band.Top * ch; + + canvas.Save(); + canvas.ClipRect(new SKRect(0, 0, width, top)); renderer.Render(canvas, frame, pictures); canvas.Restore(); + + var field = FieldRect(band, cw, ch, frame.Width, s); + var fill = renderer.Background(frame[Math.Min(frame.Width - 1, band.Pad), band.Top].Background); + using var paint = new SKPaint { IsAntialias = true }; + paint.Color = plane; + canvas.DrawRect(0, top, width, height - top, paint); + paint.Color = Mix(plane, renderer.DefaultForeground, 0.10f); + canvas.DrawRect(0, top, width, Math.Max(1, s), paint); + + var radius = (float)(NativeTokens.RadiusM * scale); + var rounded = new SKRoundRect(field, radius); + paint.Color = fill; + canvas.DrawRoundRect(rounded, paint); + + canvas.Save(); + canvas.ClipRoundRect(rounded, SKClipOperation.Intersect, true); + canvas.Translate(0, (float)(NativeLayout.FieldTop * scale)); + + // The bars' rows only, and not the client's right padding, whose colour is the margin's rather than the band's. + canvas.ClipRect(new SKRect(0, top, (frame.Width - band.Pad) * cw, (band.Top + band.Rows) * ch)); + renderer.Render(canvas, frame, pictures); + canvas.Restore(); + + paint.Style = SKPaintStyle.Stroke; + paint.StrokeWidth = Math.Max(1, s); + paint.Color = Mix(fill, renderer.DefaultForeground, 0.22f); + var edge = rounded; + edge.Deflate(paint.StrokeWidth / 2, paint.StrokeWidth / 2); + canvas.DrawRoundRect(edge, paint); } public void Dispose() { } } + + /// + /// The field's rectangle in device pixels: inset from the grid's edges so the client's band-coloured padding columns + /// are its inner padding, from the strip's top padding to below the last row. + /// + internal static SKRect FieldRect(InputBand band, int cw, int ch, int columns, float scale) + { + var inset = Math.Max(4 * scale, (band.Pad * cw) - (float)(NativeLayout.FieldInsetX * scale)); + var top = (band.Top * ch) + (float)(NativeLayout.FieldOuter * scale); + var bottom = ((band.Top + band.Rows) * ch) + (float)((NativeLayout.FieldTop + NativeLayout.FieldInner) * scale); + return new SKRect(inset, top, (columns * cw) - inset, bottom); + } + + /// + /// The prompt in the UI face, semibold, over the prompt's own cells; and the newline hint at the right of the first + /// row while the cells under it are blank — it stands down the moment the typed text reaches it. + /// + private void DrawFieldText(DrawingContext context, ScreenFrame frame, InputBand band) + { + var cell = CellSize; + foreach (var prompt in band.Prompts) + { + var text = prompt.Text.TrimEnd(); + if (text.Length == 0 || prompt.Row < 0 || prompt.Row >= frame.Height || band.Pad >= frame.Width) + { + continue; + } + + var first = frame[band.Pad, prompt.Row]; + var ink = Ink(frame, band.Pad, prompt.Row, text.Length); + var plate = new Rect(band.Pad * cell.Width, RowTop(prompt.Row), Math.Min(text.Length, frame.Width - band.Pad) * cell.Width, cell.Height); + context.FillRectangle(Brush(_renderer.Background(first.Background)), plate); + var formatted = new FormattedText( + text, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, + new Typeface(NativeTokens.UiFont, FontStyle.Normal, FontWeight.SemiBold), NativeTokens.Input, Brush(ink)) + { + MaxTextWidth = plate.Width + (2 * cell.Width), + MaxLineCount = 1, + Trimming = TextTrimming.CharacterEllipsis, + }; + // Against the text, not the field's edge: the UI face is narrower than the cells it covers, and a prompt + // that kept to the left would leave a gap between itself and the line being typed. + var left = Math.Max(plate.X, plate.Right - formatted.Width); + context.DrawText(formatted, new Point(Math.Round(left), plate.Y + ((cell.Height - formatted.Height) / 2))); + } + + if (band.Hint.Length == 0 || band.Top >= frame.Height) + { + return; + } + + var hint = new FormattedText( + NativeKeys.Words(band.Hint), System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, + new Typeface(NativeTokens.UiFont), NativeTokens.Small, Brush(SKColors.White)); + var right = (frame.Width - band.Pad) * cell.Width; + var from = Math.Max(0, (int)Math.Floor((right - hint.Width) / cell.Width) - 2); + var promptEnd = band.Pad + (band.Prompts.FirstOrDefault(p => p.Row == band.Top)?.Text.Length ?? 0); + if (from <= promptEnd || frame.Caret is { Visible: true } caret && caret.Y == band.Top && caret.X >= from) + { + return; + } + + for (var x = from; x < frame.Width - band.Pad; x++) + { + if (frame[x, band.Top].Rune.Value != ' ') + { + return; + } + } + + var bandColour = _renderer.Background(frame[band.Pad, band.Top].Background); + hint.SetForegroundBrush(Brush(Mix(bandColour, _renderer.DefaultForeground, 0.6f))); + context.DrawText(hint, new Point(right - hint.Width, RowTop(band.Top) + ((cell.Height - hint.Height) / 2))); + } + + /// The ink of the first non-blank cell of a run, the run's own colour. + private SKColor Ink(ScreenFrame frame, int x, int y, int length) + { + for (var i = x; i < Math.Min(frame.Width, x + length); i++) + { + if (frame[i, y].Rune.Value != ' ') + { + return _renderer.Foreground(frame[i, y].Foreground); + } + } + + return _renderer.DefaultForeground; + } + + private static SKColor Darker(SKColor colour) => Mix(colour, SKColors.Black, 0.25f); } diff --git a/src/SharpMUTerm.Avalonia/ThemeCardView.cs b/src/SharpMUTerm.Avalonia/ThemeCardView.cs index b8dc3162..029844c6 100644 --- a/src/SharpMUTerm.Avalonia/ThemeCardView.cs +++ b/src/SharpMUTerm.Avalonia/ThemeCardView.cs @@ -72,7 +72,7 @@ public void SetInUse(bool inUse, NativeTokens tokens) _frame.BorderBrush = tokens.Brush(inUse ? tokens.Accent : tokens.Edge); } - private static readonly FontFamily Mono = FontFamily.Parse("monospace"); + private static readonly FontFamily Mono = NativeTokens.MonoFont; private static IBrush Brush(Rgb colour) => new SolidColorBrush(Color.FromRgb(colour.R, colour.G, colour.B)); diff --git a/src/SharpMUTerm.Avalonia/VitalsGauges.cs b/src/SharpMUTerm.Avalonia/VitalsGauges.cs index 5563ec14..5a3db83e 100644 --- a/src/SharpMUTerm.Avalonia/VitalsGauges.cs +++ b/src/SharpMUTerm.Avalonia/VitalsGauges.cs @@ -197,7 +197,7 @@ private static FormattedText Format(string text, double size, Color colour, bool text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, - new Typeface(FontFamily.Default, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), + new Typeface(NativeTokens.UiFont, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), size, new SolidColorBrush(colour)) { diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index b67398ab..b372faec 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -182,7 +182,7 @@ private void DrawMenu() example.Inlines.Add(new global::Avalonia.Controls.Documents.Run(WelcomeModel.ExampleCommand) { Foreground = _colours.Brush(_colours.Accent), - FontFamily = new FontFamily("JetBrains Mono, DejaVu Sans Mono, Consolas, Menlo, monospace"), + FontFamily = NativeTokens.MonoFont, }); _body.Children.Add(example); diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 91ea1452..592fb601 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -75,7 +75,7 @@ internal static class WindowHost // The header band and the connections sidebar are the window's own controls, beside the cell grid rather // than over it (MainWindow, DesktopLayer): the client draws neither. - Chrome = chrome ?? HostChrome.HeaderAndRail, + Chrome = chrome ?? HostChrome.Desktop, // ⌃P is a native palette over the window, listing the same rows as the cell one. NativePalette = driver.Palette, diff --git a/src/SharpMUTerm.Avalonia/WindowOptions.cs b/src/SharpMUTerm.Avalonia/WindowOptions.cs index 857321a5..9612a789 100644 --- a/src/SharpMUTerm.Avalonia/WindowOptions.cs +++ b/src/SharpMUTerm.Avalonia/WindowOptions.cs @@ -24,13 +24,25 @@ internal sealed record WindowOptions( int Columns, int Rows, bool TitleBar = false, - bool CellChrome = false) + bool CellChrome = false, + float LineHeight = WindowOptions.DefaultLineHeight) { + /// + /// The cell text size when --font-size names none: 10 pt, the 13 px game text of the window's mockups. + /// + public const float DefaultPoints = 10f; + + /// + /// The row height, as a multiple of the face's own height, when --line-height names none: JetBrains Mono at + /// 13 px is 18 px tall, and the mockups set it on 20 px rows. + /// + public const float DefaultLineHeight = 1.12f; + /// /// Which chrome the window draws natively: the header and the sidebar, unless --cell-chrome asked for the /// terminal's cells or this is --render-png, which draws cells and nothing native. /// - public HostChrome Chrome => CellChrome || RenderPng is not null ? HostChrome.None : HostChrome.HeaderAndRail; + public HostChrome Chrome => CellChrome || RenderPng is not null ? HostChrome.None : HostChrome.Desktop; /// /// What the client is told about this "terminal": Kitty graphics and truecolour. Both are true by @@ -43,7 +55,8 @@ public static WindowOptions Parse(string[] args) { var rest = new List(); string? font = null, view = null, theme = null, png = null; - var points = 14f; + var points = DefaultPoints; + var lineHeight = DefaultLineHeight; var demo = false; var titleBar = false; var cellChrome = false; @@ -60,6 +73,13 @@ public static WindowOptions Parse(string[] args) points = Math.Clamp(p, 6, 48); } + break; + case "--line-height": + if (float.TryParse(Next(), NumberStyles.Float, CultureInfo.InvariantCulture, out var l)) + { + lineHeight = Math.Clamp(l, 1f, 2f); + } + break; case "--demo-config": demo = true; break; case "--title-bar": titleBar = true; break; @@ -79,7 +99,7 @@ public static WindowOptions Parse(string[] args) } } - return new WindowOptions([.. rest], font, points, demo, view, theme, png, columns, rows, titleBar, cellChrome); + return new WindowOptions([.. rest], font, points, demo, view, theme, png, columns, rows, titleBar, cellChrome, lineHeight); } /// Applies --theme, the way the snapshot does: name and inline theme both. @@ -124,8 +144,9 @@ public static string Usage [ ("Window:", [ - new("--font ", "Monospace font (default: the first installed Nerd Font, then Cascadia, Consolas…)."), - new("--font-size ", "Font size (default 14)."), + new("--font ", "An installed monospace font (default: the bundled JetBrains Mono)."), + new("--font-size ", "Font size (default 10)."), + new("--line-height ", "Row height as a multiple of the font's (1 to 2; default 1.12)."), new("--size ", "The window's first size in cells, and the grid for --render-png (default 120x36)."), new("--title-bar", "Keep the system title bar. Without it, drag the blank part of the header", "to move the window, double-click it to maximise, and drag an edge to resize."), diff --git a/src/SharpMUTerm.Avalonia/WindowPointer.cs b/src/SharpMUTerm.Avalonia/WindowPointer.cs index 4a3e1b33..cb605ef9 100644 --- a/src/SharpMUTerm.Avalonia/WindowPointer.cs +++ b/src/SharpMUTerm.Avalonia/WindowPointer.cs @@ -119,6 +119,29 @@ void IPointerPresenter.Chrome(ChromeOverlay chrome) /// Raised on the client's thread with each notice the client says. public event Action? NoticeSaid; + private StatusOverlay? _status; + private InputBand? _band; + + /// The status row as the client last described it, or null before it has (). + public StatusOverlay? Status => Volatile.Read(ref _status); + + /// + /// Where the command line's rows are, as of the client's last word (): read by the + /// driver when it flushes a frame, so each frame carries the band it was painted with. + /// + public InputBand? Band => Volatile.Read(ref _band); + + /// Raised on the client's thread when changes. + public event Action? StatusChanged; + + void IPointerPresenter.Status(StatusOverlay status) + { + Volatile.Write(ref _status, status); + StatusChanged?.Invoke(); + } + + void IPointerPresenter.InputBand(InputBand? band) => Volatile.Write(ref _band, band); + void IPointerPresenter.Notice(NoticeOverlay notice) { var next = Notices.Append(notice).TakeLast(NoticesKept).ToList(); diff --git a/src/SharpMUTerm.Client/Chrome/StatusModel.cs b/src/SharpMUTerm.Client/Chrome/StatusModel.cs new file mode 100644 index 00000000..2a1f523c --- /dev/null +++ b/src/SharpMUTerm.Client/Chrome/StatusModel.cs @@ -0,0 +1,164 @@ +namespace SharpMUTerm.Client.Chrome; + +/// One run of the status row: text in one ink and weight, and what a click on it does (null for nothing). +/// The run's visible text, keys in the cells' glyphs (a native host spells them in words). +/// Its colour, #rrggbb, already held to the floor on the row's plane. +/// Whether the cells draw it bold. +/// +/// What a click hands back: a target the client put here itself (the palette, a notice's action), never a command a +/// host spelt. Null for text a click does nothing on. +/// +public sealed record StatusRun(string Text, string Ink, bool Bold, string? Target = null); + +/// +/// The status row as data: what SharpMUTermApp.PaintStatus writes into the cells — the connection, the mode's +/// keys, meters, reconnect, ● REC, ♪ muted, the scrollback segment, or a notice laid over them — split +/// into the cluster read from the left and the one read from the right. The terminal draws the row in cells; the window +/// (HostChrome.Status) leaves no cell for it and draws this as its footer, so the two cannot say different things. +/// +/// The runs from the left edge. +/// The runs that end at the right edge. +/// The row's plane, #rrggbb. +public sealed record StatusModel(IReadOnlyList Left, IReadOnlyList Right, string Plane) +{ + /// A status row with nothing on it. + public static StatusModel Empty { get; } = new([], [], "#000000"); + + /// Every target a click on this row may hand back. + public IEnumerable Targets() => + Left.Concat(Right).Select(r => r.Target).OfType().Distinct(StringComparer.Ordinal); + + /// The row as plain text, the two clusters joined by a gap: what a test or a screen reader reads. + public string Text => + string.Concat(Left.Select(r => r.Text)).TrimEnd() + + (Right.Count > 0 ? " " + string.Concat(Right.Select(r => r.Text)).Trim() : string.Empty); + + /// + public bool Equals(StatusModel? other) => + other is not null && Plane == other.Plane && Left.SequenceEqual(other.Left) && Right.SequenceEqual(other.Right); + + /// + public override int GetHashCode() => HashCode.Combine(Plane, Left.Count, Right.Count); + + /// + /// Splits one row of runs into its two clusters at the widest run of spaces — the padding the row's renderer puts + /// between what it reads from the left and what it right-aligns — when that gap is at least three wide; otherwise + /// the whole row reads from the left. Runs are split at the gap and the gap itself is dropped. + /// + public static StatusModel From(IReadOnlyList runs, string plane) + { + ArgumentNullException.ThrowIfNull(runs); + var text = string.Concat(runs.Select(r => r.Text)); + var (gapAt, gapLength) = (-1, 0); + for (var i = 0; i < text.Length;) + { + if (text[i] != ' ') + { + i++; + continue; + } + + var start = i; + while (i < text.Length && text[i] == ' ') + { + i++; + } + + // Only a gap with text on both sides divides the row; trailing padding is not a right cluster. + if (i < text.Length && start > 0 && i - start >= 3 && i - start > gapLength) + { + (gapAt, gapLength) = (start, i - start); + } + } + + if (gapAt < 0) + { + return new StatusModel(Trim(Slice(runs, 0, text.Length)), [], plane); + } + + return new StatusModel(Trim(Slice(runs, 0, gapAt)), Trim(Slice(runs, gapAt + gapLength, text.Length)), plane); + } + + private static List Slice(IReadOnlyList runs, int from, int to) + { + var result = new List(); + var at = 0; + foreach (var run in runs) + { + var (start, end) = (Math.Max(from, at), Math.Min(to, at + run.Text.Length)); + if (end > start) + { + result.Add(run with { Text = run.Text[(start - at)..(end - at)] }); + } + + at += run.Text.Length; + } + + return result; + } + + private static List Trim(List runs) + { + while (runs.Count > 0 && string.IsNullOrWhiteSpace(runs[0].Text)) + { + runs.RemoveAt(0); + } + + while (runs.Count > 0 && string.IsNullOrWhiteSpace(runs[^1].Text)) + { + runs.RemoveAt(runs.Count - 1); + } + + if (runs.Count > 0) + { + runs[0] = runs[0] with { Text = runs[0].Text.TrimStart() }; + runs[^1] = runs[^1] with { Text = runs[^1].Text.TrimEnd() }; + } + + return runs; + } + + /// + /// The runs with set on the characters of the last occurrence of , + /// splitting runs at its edges; unchanged when the text is not there. How the client marks a hint or a notice's + /// action as clickable after drawing it. + /// + public static IReadOnlyList Mark(IReadOnlyList runs, string text, string target) + { + ArgumentNullException.ThrowIfNull(runs); + var whole = string.Concat(runs.Select(r => r.Text)); + var at = string.IsNullOrEmpty(text) ? -1 : whole.LastIndexOf(text, StringComparison.Ordinal); + if (at < 0) + { + return runs; + } + + var end = at + text.Length; + var result = new List(); + var pos = 0; + foreach (var run in runs) + { + var (rs, re) = (pos, pos + run.Text.Length); + pos = re; + if (re <= at || rs >= end) + { + result.Add(run); + continue; + } + + var (a, b) = (Math.Max(rs, at), Math.Min(re, end)); + if (a > rs) + { + result.Add(run with { Text = run.Text[..(a - rs)] }); + } + + result.Add(run with { Text = run.Text[(a - rs)..(b - rs)], Target = target }); + if (re > b) + { + result.Add(run with { Text = run.Text[(b - rs)..] }); + } + } + + return result; + } +} diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 49c2c84d..854a6266 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -165,6 +165,12 @@ public static class SurfaceCatalog /// A notice: the status row's message in cells, and in the window a toast over them as well. public const string Notice = "notice"; + /// + /// The status row: the last row of cells in a terminal; in the window (HostChrome.Status) a native footer + /// under the cells and the sidebar, which then leave the row out. + /// + public const string Status = "status"; + /// F1, the full-screen composer: a cell modal in a terminal, the window's native editor in its place. public const string Compose = "compose"; @@ -398,6 +404,18 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), CellsUnderNative, "SharpMUTerm.Tui.SharpMUTermApp.NoticeMarkup", ["SharpMUTerm.Avalonia.NoticeToasts"]), + new( + Status, + typeof(StatusModel), + [ + // The palette hint opens ⌃P, the header search box's path; a showing notice's action runs as the toast's + // click does. In cells the row is not a button: ⌃P itself, and the notice's command on ⌃P. + new(SurfaceActionKind.Target, HeaderModel.PaletteTarget, "ToggleMenu", CellsVia: Header), + new(SurfaceActionKind.Target, "notice action", "RunNoticeAction", CellsVia: "term:messages"), + ], + NativeChrome, + "SharpMUTerm.Tui.SharpMUTermApp.StatusRowMarkup", + ["SharpMUTerm.Avalonia.NativeFooter"]), new( Compose, typeof(ComposerModel), diff --git a/src/SharpMUTerm.Tui/ClientUsage.cs b/src/SharpMUTerm.Tui/ClientUsage.cs index 17d14365..aab33e91 100644 --- a/src/SharpMUTerm.Tui/ClientUsage.cs +++ b/src/SharpMUTerm.Tui/ClientUsage.cs @@ -51,7 +51,7 @@ public static string[] NarrowToLink(string[] args) /// The options that take a value, so their value is never mistaken for the host. public static IReadOnlySet TakingValues { get; } = new HashSet(StringComparer.Ordinal) { - "--name", "--size", "--view", "--out", "--theme", "--transparency", "--font", "--font-size", "--render-png", OpenLink, + "--name", "--size", "--view", "--out", "--theme", "--transparency", "--font", "--font-size", "--line-height", "--render-png", OpenLink, }; /// The arguments that are not an option or an option's value: the host, then the port. diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 59099085..3756030f 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -309,7 +309,17 @@ internal static ClientHost HarnessTerminal( /// /// The host draws the header band (the client's first row). /// The host draws the connection rail (the client's left column, with its divider and spacer). -internal sealed record HostChrome(bool Header, bool Rail) +/// +/// The host draws the status row (the client's last row) from , +/// published through . +/// +/// +/// The host draws the command line's field around the cell editor: the client keeps the editor, its keys and its band +/// colours, pads it ( band-coloured columns either side) and says where its rows are +/// each frame (), so the host can draw the field's frame and padding in its own +/// units around those rows. No keystroke path changes. +/// +internal sealed record HostChrome(bool Header, bool Rail, bool Status = false, bool Input = false) { /// The client draws all of its chrome in cells: the terminal, the snapshot, the tests. public static HostChrome None { get; } = new(false, false); @@ -317,6 +327,9 @@ internal sealed record HostChrome(bool Header, bool Rail) /// The host draws the header and the rail natively: the desktop window. public static HostChrome HeaderAndRail { get; } = new(true, true); + /// The host draws the header, the rail, the status footer and the command line's field: the desktop window. + public static HostChrome Desktop { get; } = new(true, true, true, true); + /// Whether the host draws anything at all. - public bool Any => Header || Rail; + public bool Any => Header || Rail || Status || Input; } diff --git a/src/SharpMUTerm.Tui/InputBarControl.cs b/src/SharpMUTerm.Tui/InputBarControl.cs index febf1f8d..f72838bc 100644 --- a/src/SharpMUTerm.Tui/InputBarControl.cs +++ b/src/SharpMUTerm.Tui/InputBarControl.cs @@ -313,7 +313,29 @@ internal int Rows() => InputLayout.Height(WrappedRowCount(FieldWidth(ActualWidth > 0 ? ActualWidth : Width ?? 80)), MinRows, MaxRows); /// - public override int? ContentWidth => MarkupParser.StripLength(Prompt) + 10 + Margin.Left + Margin.Right; + public override int? ContentWidth => PromptWidth + 10 + Margin.Left + Margin.Right; + + /// + /// Band-coloured columns before the prompt on every row ( when the host draws + /// the field, else none). Part of the gutter, so every row indents past it as it does past the prompt. + /// + internal int LeadingPad + { + get => _leadingPad; + set + { + if (_leadingPad != value) + { + _leadingPad = Math.Max(0, value); + Invalidate(Invalidation.Relayout); + } + } + } + + private int _leadingPad; + + /// The gutter: the leading pad and the prompt. + private int PromptWidth => _leadingPad + MarkupParser.StripLength(Prompt); /// ⇥ is ours whenever there is another bar to hand it to; otherwise it stays traversal. public new bool WantsTabKey => HasSibling(); @@ -548,7 +570,7 @@ private bool Send() /// How many columns of text fit on one row: the field, less the prompt it indents past. private int FieldWidth(int width) => - Math.Max(1, width - Margin.Left - Margin.Right - MarkupParser.StripLength(Prompt)); + Math.Max(1, width - Margin.Left - Margin.Right - PromptWidth); /// /// The rows the text takes at : the editor's own wrapped rows, plus one @@ -604,11 +626,11 @@ public override LayoutSize MeasureDOM(LayoutConstraints constraints) // Past the last column means the end of a full row; the row under it is the one Rows() added. // A bar past its cap shows the editor's scrollbar, which takes the field's last column. var field = FieldWidth(ActualWidth > 0 ? ActualWidth : Width ?? 80); - var right = Margin.Left + MarkupParser.StripLength(Prompt) + field + var right = Margin.Left + PromptWidth + field - (WrappedRowCount(field) > ViewportHeight ? 1 : 0); if (caret.X >= right && caret.Y + 1 - Margin.Top < ViewportHeight) { - return new Point(Margin.Left + MarkupParser.StripLength(Prompt), caret.Y + 1); + return new Point(Margin.Left + PromptWidth, caret.Y + 1); } return caret.X >= right ? caret with { X = right - 1 } : caret; @@ -674,7 +696,7 @@ private sealed class PromptGutter(InputBarControl bar) : IGutterRenderer // The prompt's width is re-read on every measure, so there is nothing for this to announce. public event EventHandler? Invalidated { add { } remove { } } - public int GetWidth(int totalLineCount) => MarkupParser.StripLength(Markup); + public int GetWidth(int totalLineCount) => bar._leadingPad + MarkupParser.StripLength(Markup); public void Render(in GutterRenderContext context, int width) { @@ -687,9 +709,10 @@ public void Render(in GutterRenderContext context, int width) if (context.SourceLineIndex == 0 && context.IsFirstWrappedSegment) { + var pad = Math.Min(bar._leadingPad, width); context.Buffer.WriteCellsClipped( - context.X, context.Y, MarkupParser.Parse(Markup, ink, band), - new LayoutRect(context.X, context.Y, width, 1)); + context.X + pad, context.Y, MarkupParser.Parse(Markup, ink, band), + new LayoutRect(context.X + pad, context.Y, width - pad, 1)); } } } diff --git a/src/SharpMUTerm.Tui/InputLayout.cs b/src/SharpMUTerm.Tui/InputLayout.cs index 9ca717ea..5305580c 100644 --- a/src/SharpMUTerm.Tui/InputLayout.cs +++ b/src/SharpMUTerm.Tui/InputLayout.cs @@ -28,6 +28,12 @@ internal readonly record struct InputRow(int Start, int Length) /// internal static class InputLayout { + /// + /// The band-coloured columns a command line leaves at each end of its rows when the host draws its field + /// (): the field's inner padding, inside the frame the host draws. + /// + internal const int HostFieldPad = 3; + /// /// Breaks into the rows it occupies at columns. /// Newlines break hard; everything else wraps at the last space that fits, or mid-word when a word diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 6fe97200..11b4959e 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -176,6 +176,23 @@ void Chrome(ChromeOverlay chrome) void Notice(NoticeOverlay notice) { } + + /// + /// The status row, as data, whenever what it says changes — only to a host that draws it + /// (), which the client leaves no cell for. A host that draws none ignores this. + /// + void Status(StatusOverlay status) + { + } + + /// + /// Where the command line's rows are, or null when there is no field to draw (another of the client's windows is in + /// front) — only to a host that draws the field (). Said on the client's thread while + /// the main window paints, before the frame it describes is flushed, so a host may keep it with that frame. + /// + void InputBand(InputBand? band) + { + } } /// diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs new file mode 100644 index 00000000..6be600e8 --- /dev/null +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs @@ -0,0 +1,236 @@ +using SharpConsoleUI; +using SharpConsoleUI.Parsing; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Palette; +using SharpMUTerm.Client.Surfaces; + +namespace SharpMUTerm.Tui; + +/// +/// The status row and the command line's field, for a host that draws them itself (, +/// ; the window). +/// +/// The status row is the markup writes, parsed by the framework's own parser into runs +/// () — so the footer says exactly what the cells would, notices, mode keys, meters, reconnect, +/// ● REC, ♪ muted and the scrollback segment included — and the row's cell is left out of the grid. A click +/// hands back a target the client put on a run: a notice's action (to , the toast's path) +/// or the palette hint (to the palette, the header search box's path). Anything else is refused. +/// +/// +/// The command line stays the cell editor. Every key, the history, completion, selection and paste go where +/// they always went; the client only pads the bar with band-coloured columns () +/// and says, with every frame, which rows the bars are on (). The host draws the field around +/// those rows — its frame, its padding, the prompt in its UI face and the newline hint over blank cells — in its own +/// units. The band colour is read off the cells, so armed, idle and the character's tint read exactly as they do there. +/// +/// +internal sealed partial class SharpMUTermApp +{ + private StatusOverlay? _statusOverlay; + private Action? _statusActivate; + private InputBand? _inputBand; + private bool _inputBandSaid; + + /// Tells a host that draws the status row what it says, when that changed. + private void PublishStatus() + { + if (_pointer is null || !Host.Chrome.Status || _window is null) + { + return; + } + + var overlay = BuildStatusOverlay(); + if (overlay == _statusOverlay) + { + return; + } + + _statusOverlay = overlay; + Drawing(SurfaceCatalog.Status, string.Empty, overlay.Model); + _pointer.Status(overlay); + } + + /// The status row as the host is to draw it. Internal for tests. + internal StatusOverlay BuildStatusOverlay() + { + _statusActivate ??= target => OnUiThread(() => ActivateStatusTarget(target)); + return new StatusOverlay(BuildStatusModel(), MainWindowInFront(), _statusActivate); + } + + /// + /// The row's markup as runs: the framework's parse of exactly what the cells are given, one run per change of ink + /// or weight, split into the left and right clusters, with the palette hint and a showing notice's action marked + /// clickable. + /// + internal StatusModel BuildStatusModel() + { + var plane = WorkspacePalette.Backdrop(_theme); + var fg = ToColor(_theme.StatusForeground); + var bg = ToColor(plane); + var runs = new List(); + var text = new System.Text.StringBuilder(); + (string Ink, bool Bold)? style = null; + foreach (var cell in MarkupParser.Parse(_statusBar.Text, fg, bg)) + { + if (cell.IsWideContinuation) + { + continue; + } + + var next = (ColourHex(cell.Foreground), cell.Decorations.HasFlag(TextDecoration.Bold)); + if (style is { } current && current != next) + { + runs.Add(new StatusRun(text.ToString(), current.Ink, current.Bold)); + text.Clear(); + } + + style = next; + text.Append(cell.Character.ToString()); + } + + if (style is { } last && text.Length > 0) + { + runs.Add(new StatusRun(text.ToString(), last.Ink, last.Bold)); + } + + IReadOnlyList marked = runs; + if (_noticeShown?.Action is { } action && _notice is not null) + { + foreach (var hint in NoticeActionHints(action)) + { + marked = StatusModel.Mark(marked, hint, action.Command); + } + } + + marked = StatusModel.Mark(marked, PaletteHintText, HeaderModel.PaletteTarget); + return StatusModel.From(marked, Hex(plane)); + } + + /// + /// The model as cell markup: each run in its ink, bold where it was, the clusters a gap apart. The row the cells + /// paint is the markup this model was parsed from; this is the way back, and StatusFooterTests holds the two + /// to the same visible text. + /// + internal static string StatusRowMarkup(StatusModel model) + { + static string Run(StatusRun run) => + $"[{(run.Bold ? "bold " : string.Empty)}{run.Ink}]{MarkupText.Escape(run.Text)}[/]"; + + var left = string.Concat(model.Left.Select(Run)); + return model.Right.Count == 0 ? left : left + " " + string.Concat(model.Right.Select(Run)); + } + + /// The status row's way to the palette, as the row writes it. + private static string PaletteHintText => $"{KeyGlyphs.Normalize("⌃P")} palette"; + + /// + /// A click on the host's status footer, by the target the client put on a run. Internal so a test can drive it the + /// way the host does; returns whether the target was offered and was acted on. + /// + internal bool ActivateStatusTarget(string target) + { + var offered = _statusOverlay ?? BuildStatusOverlay(); + if (!offered.Model.Targets().Contains(target, StringComparer.Ordinal)) + { + RefuseCommand($"the status row never offered {Snippet(target)}"); + return false; + } + + if (!MainWindowInFront()) + { + return false; + } + + if (target == HeaderModel.PaletteTarget) + { + if (!_palette.IsOpen && !NativePaletteIsOpen) + { + OpenMenu(); + } + + return true; + } + + return RunNoticeAction(target); + } + + /// What the host was last told about the status row. Internal for tests. + internal StatusOverlay? StatusOverlayPublished => _statusOverlay; + + /// + /// Tells a host that draws the command line's field which rows the bars are on, or that there is no field to draw + /// (another of the client's windows is in front: its cells, not the bars, are at the bottom of the screen). Called + /// on every paint of the main window, before the frame is flushed, so the host reads it with the frame it belongs to. + /// + private void PublishInputBand() + { + if (_pointer is null || !Host.Chrome.Input || _window is null) + { + return; + } + + var band = InputBandNow(); + if (_inputBandSaid && band == _inputBand) + { + return; + } + + (_inputBand, _inputBandSaid) = (band, true); + _pointer.InputBand(band); + } + + /// Where the bars are now, or null with no field to draw. Internal for tests. + internal InputBand? InputBandNow() + { + if (!Host.Chrome.Input || !MainWindowInFront() || AnyOverlayOpen || _input.ActualHeight <= 0) + { + return null; + } + + var rows = _input.ActualHeight + (_second.Visible ? _second.ActualHeight : 0); + var top = _system.ConsoleDriver.ScreenSize.Height - rows - (_statusBar.Visible ? Math.Max(0, _statusBar.ActualHeight) : 0); + if (top <= 0) + { + return null; + } + + var prompts = new List { new(top, MarkupParser.Remove(_input.Prompt)) }; + if (_second.Visible) + { + prompts.Add(new InputPrompt(top + _input.ActualHeight, MarkupParser.Remove(_second.Prompt))); + } + + return new InputBand(top, rows, InputLayout.HostFieldPad, prompts, $"⏎ sends · {KeyGlyphs.Normalize(Host.Keys.Newline.Glyph)} new line"); + } + + private static string ColourHex(Color colour) => $"#{colour.R:x2}{colour.G:x2}{colour.B:x2}"; +} + +/// The status row, for a host that draws it (). +/// What the row says. +/// Whether the main window is in front; while a modal is, the footer takes no click. +/// Acts on a run's target; safe from any thread, and the same instance for the life of the app. +internal sealed record StatusOverlay(StatusModel Model, bool Interactive, Action Activate); + +/// A command line's prompt, by the screen row its first line is on, as plain text. +internal sealed record InputPrompt(int Row, string Text); + +/// +/// The command line's rows, for a host that draws its field (): the field's frame and +/// padding go around rows to + , the full width. +/// +/// The first screen row of the first bar. +/// How many rows the bars take between them. +/// The band-coloured columns the client leaves at each end of a bar row, for the field's inner padding. +/// Each bar's prompt, drawn in the bar's first cells after . +/// The newline hint, in the cells' glyphs, for the host to draw where the first row is blank. +internal sealed record InputBand(int Top, int Rows, int Pad, IReadOnlyList Prompts, string Hint) +{ + /// + public bool Equals(InputBand? other) => + other is not null && Top == other.Top && Rows == other.Rows && Pad == other.Pad && Hint == other.Hint + && Prompts.SequenceEqual(other.Prompts); + + /// + public override int GetHashCode() => HashCode.Combine(Top, Rows, Pad, Hint); +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 7726e240..b01d8a6d 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -878,6 +878,10 @@ public SharpMUTermApp( _statusBar = Controls.Markup("[dim]not connected[/]").StickyBottom().Build(); + // A host that draws the status row itself (the window's footer) gets no cell for it: a hidden sticky band takes + // no row, and ChromeRows counts none, so the bars and the panes have the row. + _statusBar.Visible = !host.Chrome.Status; + // Sticky-bottom, added ahead of the bars so it sits above them, and hidden until a prompt // arrives: most sessions never see one, and a permanently blank row would cost every pane a // row for nothing. @@ -1031,6 +1035,8 @@ public SharpMUTermApp( PublishPanels(); PublishFloating(); PublishChrome(); + PublishInputBand(); + PublishStatus(); SyncMapSizes(); SyncPanelSizes(); SyncScrollSplitBars(); @@ -1040,7 +1046,11 @@ public SharpMUTermApp( // A modal that covers the main window entirely leaves it unpainted, so no PostBufferPaint says the native // panels are now under it; the modal stack changing says it instead. - _system.ModalStateService.StateChanged += (_, _) => PublishPanels(); + _system.ModalStateService.StateChanged += (_, _) => + { + PublishPanels(); + PublishInputBand(); + }; if (_sixel is not null) { // Another window over this one rewrites the cells a picture sits on, and the frame that puts @@ -1050,8 +1060,8 @@ public SharpMUTermApp( } // The native chrome stands down while another window is in front, and that window repaints, not this one. - _window.Activated += (_, _) => PublishChrome(); - _window.Deactivated += (_, _) => PublishChrome(); + _window.Activated += (_, _) => { PublishChrome(); PublishInputBand(); PublishStatus(); }; + _window.Deactivated += (_, _) => { PublishChrome(); PublishInputBand(); PublishStatus(); }; // Pane drag-and-drop listens at the driver, not at a control: SharpConsoleUI delivers mouse // frames to the control that was pressed (it captures on Button1Pressed), so a control-level @@ -5972,6 +5982,14 @@ private void SetUpBar(InputBarControl bar, InputBar kind) // and the first chrome refresh. PaintInputBands(PaneTint.None); bar.HasSibling = () => _second.Visible; + + // A host that draws the field (the window) gets band-coloured padding inside it at both ends of every row: the + // gutter's leading columns on the left, a margin the editor does not wrap into on the right. + if (Host.Chrome.Input) + { + bar.LeadingPad = InputLayout.HostFieldPad; + bar.Margin = new Margin(0, 0, InputLayout.HostFieldPad, 0); + } bar.Complete = CompleteWord; bar.Entered += text => OnCommandEntered(kind, text); bar.Changed += text => OnInputChanged(kind, text); @@ -6124,7 +6142,7 @@ private void SyncInputHeights(bool secondShown) private int ChromeRows() => // No row for a header the host draws: it is not in the cells, so the bars may have the row it would take. (_header.Visible ? InputLayout.WrappedRows(MarkupWidth(_header.Text), HeaderWidth()) : 0) - + InputLayout.WrappedRows(MarkupWidth(_statusBar.Text), HeaderWidth()) + + (_statusBar.Visible ? InputLayout.WrappedRows(MarkupWidth(_statusBar.Text), HeaderWidth()) : 0) // One, not WrappedRows: the prompt row is elided to a single row by construction, precisely so // that a long prompt cannot take a second row off the panes. See PromptRowRenderer. + (_promptRow.Visible ? 1 : 0); @@ -13910,6 +13928,7 @@ private void PaintStatus(string markup) { _statusBar.SetContent(new List { StatusInk(FitStatusRow(markup, HeaderWidth())) }); SyncInputHeights(_second.Visible); + PublishStatus(); // a host's footer has no cell to repaint, so a change may paint no frame (RefreshHeader's reason) } /// diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs index cd4387ab..3b05e66e 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -52,7 +52,7 @@ public async Task TheClientPublishesTheVitalsPaneWithTheModelItsCellStripIsDrawn public async Task PublishingPanelsMovesNoPaneRectangle() { using var headless = new HeadlessConsoleDriver(140, 36); - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.HeaderAndRail }); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.Desktop }); terminal.RenderSnapshot("layout-combat"); using var driver = new AvaloniaConsoleDriver(140, 36); diff --git a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs index d8f629b2..ab72b449 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs @@ -27,17 +27,23 @@ public partial class HostParityTests public static IEnumerable Views() => SnapshotViews.All.Select(v => v ?? "(default)"); /// - /// Every view under both chrome arrangements: the client's chrome in cells (the terminal's, and the window's with - /// --cell-chrome), and the header and rail drawn by the host (the window as a person runs it). Both hosts - /// are told the same arrangement each time, so the comparison is still of drivers and nothing else, over every - /// cell either one draws. + /// Every view under each chrome arrangement: the client's chrome in cells (the terminal's, and the window's with + /// --cell-chrome), the header and rail drawn by the host, and the window as a person runs it — header, rail, + /// status footer and the command line's field drawn by the host (). Both hosts are + /// told the same arrangement each time, so the comparison is still of drivers and nothing else, over every cell + /// either one draws. /// - public static IEnumerable<(string View, bool HostChrome)> ViewsUnderBothChromes() => + public static IEnumerable<(string View, string HostChrome)> ViewsUnderBothChromes() => from view in Views() - from native in new[] { false, true } - select (view, native); + from chrome in new[] { "none", "header-rail", "desktop" } + select (view, chrome); - private static HostChrome ChromeFor(bool native) => native ? HostChrome.HeaderAndRail : HostChrome.None; + private static HostChrome ChromeFor(string chrome) => chrome switch + { + "header-rail" => HostChrome.HeaderAndRail, + "desktop" => HostChrome.Desktop, + _ => HostChrome.None, + }; /// /// A view drawn in the window is the view drawn in the terminal, cell for cell. What this catches is the @@ -46,7 +52,7 @@ from view in Views() /// [Test] [MethodDataSource(nameof(ViewsUnderBothChromes))] - public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string name, bool hostChrome) + public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string name, string hostChrome) { var view = name == "(default)" ? null : name; var chrome = ChromeFor(hostChrome); @@ -83,7 +89,7 @@ public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string na [MethodDataSource(nameof(Views))] public async Task EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning(string name) { - var chrome = HostChrome.HeaderAndRail; + var chrome = HostChrome.Desktop; var view = name == "(default)" ? null : name; if (view is "timestamps" or "timestamps-toggled") { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs index 62104f46..46d4a9ce 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs @@ -377,7 +377,7 @@ public async Task APressOnEmptyHeaderSpaceMovesTheWindowAndNeverReachesTheClient public async Task TheLiveClientDrawsNoChromeCellAndLaysThePanesOutAsATerminalToldTheSame(string view) { using var headless = new HeadlessConsoleDriver(120, 32); - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.HeaderAndRail }); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.Desktop }); terminal.RenderSnapshot(view); using var driver = new AvaloniaConsoleDriver(120, 32); @@ -394,7 +394,7 @@ public async Task TheLiveClientDrawsNoChromeCellAndLaysThePanesOutAsATerminalTol var chrome = driver.Pointer.Chrome; await Assert.That(chrome).IsNotNull(); - await Assert.That(chrome!.Drawn).IsEqualTo(HostChrome.HeaderAndRail); + await Assert.That(chrome!.Drawn).IsEqualTo(HostChrome.Desktop); await Assert.That(chrome.Sidebar).IsEqualTo(window.BuildSidebar()); await Assert.That(window.LaidOutRows.Header).IsEqualTo(0); await Assert.That(Enumerable.Range(0, 32).Any(y => driver.Frame.RowText(y).Contains("muterm", StringComparison.Ordinal))).IsFalse() diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs new file mode 100644 index 00000000..6b6dc600 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs @@ -0,0 +1,129 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Input; +using Avalonia.Media; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Tui; +using SkiaSharp; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The window as a person runs it (): the bundled faces resolve, the status footer draws +/// what the client said and hands back only the targets the client put on it, and the field frames the bars' rows. +/// +public class NativeFooterTests +{ + private const int Columns = 100; + private const int Rows = 24; + private static readonly SKColor Back = new(0x1e, 0x1e, 0x25); + + [Test] + public async Task TheBundledFacesResolveByNameOnEveryPlatform() + { + var (loaded, ui, mono, plain) = await Session.Dispatch(() => + { + var manager = FontManager.Current; + manager.TryGetGlyphTypeface(new Typeface(NativeTokens.UiFont), out var uiFace); + manager.TryGetGlyphTypeface(new Typeface(NativeTokens.MonoFont), out var monoFace); + manager.TryGetGlyphTypeface(new Typeface("Inter"), out var plainFace); + return (new BundledFonts().Loaded, uiFace?.FamilyName, monoFace?.FamilyName, plainFace?.FamilyName); + }, CancellationToken.None); + + await Assert.That(loaded).IsEqualTo(8); + await Assert.That(ui).IsEqualTo("Inter"); + await Assert.That(mono).IsEqualTo("JetBrains Mono"); + await Assert.That(plain).IsEqualTo("Inter").Because("a view naming Inter gets the bundle, not an installed face"); + } + + [Test] + public async Task TheFooterDrawsWhatTheClientSaidAndHandsBackOnlyItsTargets() + { + var activated = new List(); + var model = StatusModel.From( + StatusModel.Mark([new("Corvid · connected", "#cccccc", false), new(" ", "#cccccc", false), new("⌃P palette", "#cccccc", false)], "⌃P palette", HeaderModel.PaletteTarget), + "#101014"); + + var (visible, top, height, hits, text, clicked) = await Run((window, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Status(new StatusOverlay(model, true, activated.Add)); + Drain(); + window.CaptureRenderedFrame()?.Dispose(); + var footer = layer.Footer; + var bounds = new Rect(footer.TranslatePoint(default, window)!.Value, footer.Bounds.Size); + var hit = footer.Hits.Single(); + var centre = footer.TranslatePoint(hit.Area.Center, window)!.Value; + window.MouseMove(centre); + window.MouseDown(centre, MouseButton.Left); + window.MouseUp(centre, MouseButton.Left); + Drain(); + footer.Click("term:quit"); + return (footer.IsVisible, bounds.Bottom, bounds.Height, footer.Hits.Select(h => h.Target).ToList(), footer.Text, activated.ToList()); + }); + + await Assert.That(visible).IsTrue(); + await Assert.That(height).IsEqualTo(NativeLayout.StatusHeight); + await Assert.That(top).IsGreaterThan(0); + await Assert.That(hits).IsEquivalentTo(new[] { HeaderModel.PaletteTarget }); + await Assert.That(text).Contains("Ctrl+P palette").Because("keys in words"); + + // The click hands back the palette; a target the client never offered still goes to the client, which refuses it. + await Assert.That(clicked.First()).IsEqualTo(HeaderModel.PaletteTarget); + } + + [Test] + public async Task TheFieldIsInsetFromTheGridAndFramesTheBarsRows() + { + var band = new InputBand(20, 2, InputLayout.HostFieldPad, [new InputPrompt(20, "Corvid ›")], "⏎ sends"); + var rect = TerminalView.FieldRect(band, 10, 20, 80, 1f); + + await Assert.That((double)rect.Left).IsEqualTo((3 * 10) - NativeLayout.FieldInsetX); + await Assert.That((double)rect.Right).IsEqualTo(800 - ((3 * 10) - NativeLayout.FieldInsetX)); + await Assert.That((double)rect.Top).IsEqualTo((20 * 20) + NativeLayout.FieldOuter); + await Assert.That((double)rect.Bottom).IsEqualTo((22 * 20) + NativeLayout.FieldTop + NativeLayout.FieldInner); + + // The grid gives up exactly the field's padding: the rows it frames are still whole cells. + var sizes = await Session.Dispatch(() => + { + using var driver = new AvaloniaConsoleDriver(Columns, Rows); + var view = new TerminalView(driver, SKColors.White, Back, 16, null) { DrawsInputField = true }; + var plain = new TerminalView(driver, SKColors.White, Back, 16, null); + return (view.SizeFor(Columns, Rows).Height, plain.SizeFor(Columns, Rows).Height); + }, CancellationToken.None); + await Assert.That(sizes.Item1 - sizes.Item2).IsEqualTo(NativeLayout.FieldReserve); + } + + private static void Drain() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); + + private static Task Run(Func body) => + Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(Columns, Rows); + var view = new TerminalView(driver, SKColors.White, Back, 16, null); + var layer = new DesktopLayer(view, HostChrome.Desktop); + var root = new Panel(); + root.Children.Add(view); + root.Children.Add(layer); + var window = new Window { Content = root, WindowDecorations = WindowDecorations.BorderOnly }; + var cells = view.SizeFor(Columns, Rows); + window.Width = cells.Width + NativeLayout.SidebarWidth + NativeLayout.SidebarGutter; + window.Height = cells.Height + NativeLayout.HeaderHeight + NativeLayout.StatusHeight; + window.Show(); + view.Focus(); + driver.Flush(); + Drain(); + try + { + return body(window, layer, driver); + } + finally + { + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + private static HeadlessUnitTestSession Session => TerminalViewTests.Session; +} diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs index 0751fcf8..80ee27ad 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs @@ -95,7 +95,7 @@ public async Task NativeListsMoveNoPaneRectangle() foreach (var view in new[] { "layout-roleplay", "layout-combat" }) { using var headless = new HeadlessConsoleDriver(140, 36); - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.HeaderAndRail }); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.Desktop }); terminal.RenderSnapshot(view); using var driver = new AvaloniaConsoleDriver(140, 36); diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 23cbdcac..848ee52f 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -202,6 +202,14 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! await Assert.That(app.NoticeMarkup(said[^1].Notice)).IsEqualTo(app.LastNotice); await Assert.That(said[0].Notice.Action).IsNotNull().Because("the first offers its action"); covered.Add(SurfaceCatalog.Notice); + + // The footer: what the window was last told is the row the cells' renderer was handed in the same frame, and + // it carries the notice's action as a run a click hands back. + var status = driver.Pointer.Status; + await Assert.That(status).IsNotNull(); + await Assert.That((object)status!.Model).IsEqualTo(app.DrawnModel(SurfaceCatalog.Status)).Because("status"); + await Assert.That((object)status.Model).IsEqualTo(app.BuildStatusModel()).Because("status: now"); + covered.Add(SurfaceCatalog.Status); } // F1: the window's editor is handed the model the cell window draws for the same draft, in each mode and for a @@ -621,6 +629,30 @@ await Same("notice: action", "layout-combat", }); probed.Add(SurfaceCatalog.Notice); + // Status footer: the palette hint opens ⌃P as ⌃P does; a notice's action on the footer runs its command as the + // ⌃P entry does. + await Same("status: palette", "layout-combat", + (app, d) => app.ActivateStatusTarget(HeaderModel.PaletteTarget), + (app, _) => app.SimulateHeaderLink(HeaderModel.PaletteTarget)); + await Same("status: notice action", "layout-combat", + (app, d) => + { + app.SimulateNotice("a set is missing", SharpMUTerm.Core.Diagnostics.MessageSeverity.Warning, "⌃P", openF5); + app.RenderNextFrame(); + if (!d.Pointer.Status!.Model.Targets().Contains(openF5.Command)) + { + throw new InvalidOperationException("the footer did not offer the notice's action"); + } + + app.ActivateStatusTarget(openF5.Command); + }, + (app, _) => + { + app.SimulateNotice("a set is missing", SharpMUTerm.Core.Diagnostics.MessageSeverity.Warning, "⌃P", openF5); + app.DispatchCommand(openF5.Command); + }); + probed.Add(SurfaceCatalog.Status); + // F1: ⌃S in the window's editor and ⌃S in the cell window send the same command for the same draft — as typed and // literal, one line and several paragraphs. Esc keeps the draft, and its mode, in both. foreach (var (draft, literal) in new[] diff --git a/tests/SharpMUTerm.Avalonia.Tests/TerminalViewTests.cs b/tests/SharpMUTerm.Avalonia.Tests/TerminalViewTests.cs index 67a5ec90..02494c17 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/TerminalViewTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/TerminalViewTests.cs @@ -321,7 +321,7 @@ public sealed class TestApp : Application public override void Initialize() => Styles.Add(new SimpleTheme()); public static AppBuilder BuildAvaloniaApp() => - AppBuilder.Configure() + BundledFonts.Use(AppBuilder.Configure() .UseSkia() - .UseHeadless(new AvaloniaHeadlessPlatformOptions { UseHeadlessDrawing = false }); + .UseHeadless(new AvaloniaHeadlessPlatformOptions { UseHeadlessDrawing = false })); } diff --git a/tests/SharpMUTerm.Client.Tests/StatusModelTests.cs b/tests/SharpMUTerm.Client.Tests/StatusModelTests.cs new file mode 100644 index 00000000..4495fffd --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/StatusModelTests.cs @@ -0,0 +1,51 @@ +using SharpMUTerm.Client.Chrome; + +namespace SharpMUTerm.Client.Tests; + +/// The status row as data: two clusters split at the renderer's padding, and runs a click can hand back. +public class StatusModelTests +{ + private const string Ink = "#cccccc"; + + [Test] + public async Task TheRowSplitsAtItsWidestGapAndDropsTheGap() + { + var model = StatusModel.From( + [new("Corvid · connected ⌥F freezes", Ink, false), new(" ", Ink, false), new("UTF-8 · ⌃P palette ", Ink, true)], + "#101010"); + + await Assert.That(model.Left.Select(r => r.Text)).IsEquivalentTo(new[] { "Corvid · connected ⌥F freezes" }); + await Assert.That(model.Right.Select(r => r.Text)).IsEquivalentTo(new[] { "UTF-8 · ⌃P palette" }); + await Assert.That(model.Right.Single().Bold).IsTrue(); + await Assert.That(model.Text).IsEqualTo("Corvid · connected ⌥F freezes UTF-8 · ⌃P palette"); + } + + [Test] + public async Task ARowWithNoWideGapReadsFromTheLeft() + { + var model = StatusModel.From([new(" a notice, said once ", Ink, false)], "#000000"); + await Assert.That(model.Right).IsEmpty(); + await Assert.That(model.Text).IsEqualTo("a notice, said once"); + } + + [Test] + public async Task MarkSetsTheTargetOnTheLastOccurrenceAndSplitsRuns() + { + var runs = StatusModel.Mark([new("⌥R Reconnect · ⌥R Reconnect", Ink, false)], "⌥R Reconnect", "world:reconnect"); + + await Assert.That(runs.Select(r => r.Text)).IsEquivalentTo(new[] { "⌥R Reconnect · ", "⌥R Reconnect" }); + await Assert.That(runs[1].Target).IsEqualTo("world:reconnect"); + await Assert.That(StatusModel.From(runs, "#000000").Targets()).IsEquivalentTo(new[] { "world:reconnect" }); + + var unchanged = StatusModel.Mark(runs, "not there", "x"); + await Assert.That(unchanged).IsSameReferenceAs(runs); + } + + [Test] + public async Task TwoRowsThatSayTheSameAreEqual() + { + StatusModel Make() => StatusModel.From([new("left", Ink, false), new(" right", Ink, false)], "#000000"); + await Assert.That(Make()).IsEqualTo(Make()); + await Assert.That(Make()).IsNotEqualTo(StatusModel.Empty); + } +} diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs index 0f1e4f44..3efa56a7 100644 --- a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -73,7 +73,7 @@ public async Task PanelSurfacesAreKnownPanels() var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose - or SurfaceCatalog.FloatingPanel or SurfaceCatalog.TabOverflow) + or SurfaceCatalog.FloatingPanel or SurfaceCatalog.TabOverflow or SurfaceCatalog.Status) && !SurfaceCatalog.Modals.Contains(s.Id)); foreach (var surface in panels) { diff --git a/tests/SharpMUTerm.Tui.Tests/StatusFooterTests.cs b/tests/SharpMUTerm.Tui.Tests/StatusFooterTests.cs new file mode 100644 index 00000000..b90acf05 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/StatusFooterTests.cs @@ -0,0 +1,128 @@ +using System.Drawing; +using SharpConsoleUI.Drivers; +using SharpConsoleUI.Parsing; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A host that draws the status row () gets no cell for it and is told what the row +/// would have said; a host that draws the command line's field () is told which rows the +/// bars are on, and the bars stay the cell editor. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class StatusFooterTests +{ + private const int Width = 120; + private const int Height = 32; + + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class FooterPresenter : IPointerPresenter + { + public List Statuses { get; } = []; + + public List Bands { get; } = []; + + public void Hover(PointerTarget target) + { + } + + public void ShowMenu(Point cell, IReadOnlyList items) + { + } + + public bool DrawsMenus => true; + + public void Scrollbars(IReadOnlyList bars) + { + } + + public void Status(StatusOverlay status) => Statuses.Add(status); + + public void InputBand(InputBand? band) => Bands.Add(band); + } + + private static SharpMUTermApp App(HostChrome chrome, out string frame, IPointerPresenter? pointer = null, string? view = null) + { + Console.SetIn(TextReader.Null); + var host = ClientHost.Headless(new HeadlessConsoleDriver(Width, Height), Caps) with { Chrome = chrome, Pointer = pointer }; + var app = new SharpMUTermApp(DemoScene.Build(), host); + frame = app.RenderSnapshot(view); + app.RenderNextFrame(); + return app; + } + + private static string Squash(string text) => string.Join(' ', text.Split(' ', StringSplitOptions.RemoveEmptyEntries)); + + [Test] + public async Task AHostThatDrawsTheStatusRowGetsNoStatusRowAndIsToldWhatItSays() + { + await using var cells = App(HostChrome.None, out var cellFrame); + var presenter = new FooterPresenter(); + await using var native = App(HostChrome.None with { Status = true }, out _, presenter); + + await Assert.That(cells.LaidOutRows.Status).IsEqualTo(1); + await Assert.That(native.LaidOutRows.Status).IsEqualTo(0); + await Assert.That(native.LaidOutRows.Workspace).IsEqualTo(cells.LaidOutRows.Workspace + 1); + + // What the footer was told is what the terminal's last row says. + await Assert.That(presenter.Statuses).IsNotEmpty(); + var said = presenter.Statuses[^1].Model; + var lastRow = FrameGrid.Decode(cellFrame, Width, Height)[^1]; + await Assert.That(Squash(said.Text)).IsEqualTo(Squash(lastRow)); + await Assert.That(said.Targets()).Contains(HeaderModel.PaletteTarget); + + // The cell renderer's markup of the model reads the same. + var back = MarkupParser.Remove(SharpMUTermApp.StatusRowMarkup(said)); + await Assert.That(Squash(back)).IsEqualTo(Squash(lastRow)); + } + + [Test] + public async Task AStatusClickRunsOnlyWhatTheRowOffered() + { + await using (var refused = App(HostChrome.None with { Status = true }, out _, new FooterPresenter())) + { + await Assert.That(refused.ActivateStatusTarget("term:quit")).IsFalse(); + await Assert.That(refused.MenuIsOpen).IsFalse(); + } + + await using var app = App(HostChrome.None with { Status = true }, out _, new FooterPresenter()); + await Assert.That(app.ActivateStatusTarget(HeaderModel.PaletteTarget)).IsTrue(); + await Assert.That(app.MenuIsOpen).IsTrue(); + } + + [Test] + public async Task AHostThatDrawsTheFieldIsToldTheBarsRowsAndThePanesDoNotMove() + { + await using var cells = App(HostChrome.None, out _); + var presenter = new FooterPresenter(); + await using var native = App(HostChrome.None with { Input = true }, out _, presenter); + + // The field is the host's pixels: no pane rectangle, so nothing said over NAWS, moves for it. + await Assert.That(native.PaneOutputRects()).IsEquivalentTo(cells.PaneOutputRects()); + await Assert.That(native.LaidOutRows).IsEqualTo(cells.LaidOutRows); + + var band = native.InputBandNow(); + await Assert.That(band).IsNotNull(); + await Assert.That(band!.Pad).IsEqualTo(InputLayout.HostFieldPad); + await Assert.That(band.Top + band.Rows).IsEqualTo(Height - native.LaidOutRows.Status); + await Assert.That(band.Prompts.Single().Text).Contains("›"); + await Assert.That(band.Hint).Contains("new line"); + await Assert.That(presenter.Bands.OfType()).IsNotEmpty(); + + // A host that does not draw the field is told nothing. + await Assert.That(cells.InputBandNow()).IsNull(); + } + + [Test] + public async Task UnderAModalTheFieldIsNotDrawn() + { + await using var app = App(HostChrome.None with { Input = true }, out _, new FooterPresenter(), "menu"); + await Assert.That(app.InputBandNow()).IsNull(); + } +} From c02bd746bff1c554ae34fa3bbbcee2b0f40d12b6 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 17:33:13 +0000 Subject: [PATCH 066/113] feat(window): native tab strips and scrolled-back band per pane The window draws each pane's tab strip natively (HostChrome.Tabs; HostChrome.Native is the window's default) over the strip's own cell row, which the client paints blank, so the layout, the pane rectangles and NAWS stay the terminal's. One TabStripModel per strip titles the cells and is published through IPointerPresenter.PaneChrome; the scroll split's band is a ScrollBandModel drawn natively with a Jump to latest button. Every gesture ends in the cell gesture's method (ActivateStripTab, CloseStripTab, OpenTabMenu, OpenTabOverflow, ReturnToLiveTail) and is refused unless offered. New surfaces tab-strip and scroll-band with parity probes; HostParityTests gains the native arrangement. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 37 +- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 71 +++ src/SharpMUTerm.Avalonia/PaneChromeViews.cs | 543 ++++++++++++++++++ src/SharpMUTerm.Avalonia/WindowHost.cs | 4 +- src/SharpMUTerm.Avalonia/WindowOptions.cs | 2 +- src/SharpMUTerm.Avalonia/WindowPointer.cs | 14 + .../Chrome/TabStripModel.cs | 91 +++ .../Surfaces/SurfaceCatalog.cs | 36 ++ src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 14 +- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 9 + .../Pointer/SharpMUTermApp.PaneChrome.cs | 368 ++++++++++++ .../Pointer/SharpMUTermApp.Pointer.cs | 40 +- src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs | 12 +- .../SharpMUTermApp.ScrollSplit.cs | 21 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 135 +++-- src/SharpMUTerm.Tui/TabTitles.cs | 54 +- .../HostParityTests.cs | 25 +- .../NativeChromeTests.cs | 4 +- .../SurfaceParityTests.cs | 43 ++ .../SurfaceCatalogTests.cs | 2 +- .../NativeTabStripTests.cs | 159 +++++ 22 files changed, 1590 insertions(+), 99 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/PaneChromeViews.cs create mode 100644 src/SharpMUTerm.Client/Chrome/TabStripModel.cs create mode 100644 src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.PaneChrome.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index c52877e3..d0b31b05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- In the desktop window each pane's tabs are drawn as native tabs: the tab in front is a card joined to its pane, + unread counts are in the accent, a tab's close appears when you point at it, a right click shows the tab's menu, + and tabs that do not fit are behind a `+N` button. The terminal is unchanged. +- In the desktop window a pane split by scrolling back shows a native band — "Scrolled back N rows · New lines keep + arriving below" — with a Jump to latest button that does what End does. - A script error in the script console that names a file and line is now a link: click it to open that script with the caret on the line and the line marked. Closing the editor goes back to the console. - The script editor numbers its lines in the desktop window too, and after a save whose reload fails, the line the diff --git a/CLAUDE.md b/CLAUDE.md index 7bfaa89e..0c5ae11c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1285,9 +1285,9 @@ fallbacks) for inline images/maps. is the row projection. The header's presence dot reads `ConnectedCharacters()`, the same answer as the rail's dot and the fraction. While ⌃B is armed `HeaderModel.Prefix` carries `PrefixPanel.Entries` (key, title, why it is blocked) and the exit, so the native header shows the keymap where the cell header shows its strip. - - **`ClientHost.Chrome` (`HostChrome(Header, Rail)`, required) says which chrome the host draws, and the client + - **`ClientHost.Chrome` (`HostChrome(Header, Rail, Tabs)`, required) says which chrome the host draws, and the client leaves no cell for it.** `HostChrome.None` for the terminal, the snapshot, `--plain` and the tests; - `HeaderAndRail` for the window (`WindowHost.Create`, from `WindowOptions.Chrome`; `--cell-chrome` and + `Native` (header, rail and tab strips) for the window (`WindowHost.Create`, from `WindowOptions.Chrome`; `--cell-chrome` and `--render-png` say None). It is a flag per part, not a size: the space is the host's own business (42 px, 232 px, `NativeLayout`), and the client is only told the part is not its to draw. With `Header` the header control is `Visible = false` — a hidden sticky band takes no row — and `ChromeRows()` counts no header row, so the @@ -1328,8 +1328,8 @@ fallbacks) for inline images/maps. header space calls `TerminalView.WindowGestureFromChrome`: edge band resizes, the rest moves the window, double-click maximises. The header leaves the header buttons' slots clear; with a native header the buttons sit in it, 30 px, right-aligned. - - **Parity is cells against cells under the same `HostChrome`.** `HostParityTests` draws every view twice inline — - both hosts told `None`, and both told `HeaderAndRail` — and the looping pass with `HeaderAndRail`, comparing every + - **Parity is cells against cells under the same `HostChrome`.** `HostParityTests` draws every view three times inline — + both hosts told `None`, `HeaderAndRail`, then `Native` (tabs too) — and the looping pass with `Native`, comparing every cell. Telling both hosts the same arrangement keeps the comparison a comparison of drivers (the guarantee it exists for), and covering both arrangements means the layout a person actually runs in the window is held to the terminal's cell for cell, rather than compared below an offset or skipped. What the native header and @@ -1355,6 +1355,31 @@ fallbacks) for inline images/maps. - **Not done**: no animation when the sidebar folds; the command line keeps its armed band while the sidebar holds the keys; the terminal has no row menu (no pointer menus there), its entries are ⌃P's. +- **The window draws each pane's tab strip and the scrolled-back band natively, over rows the cells keep** + (`HostChrome.Tabs`, `HostChrome.Native` = all three, the window's default; Client `TabStripModel`/`TabChipModel`, + `ScrollBandModel`; Tui `Pointer/SharpMUTermApp.PaneChrome.cs`, `PaneChromeOverlay`; Avalonia `PaneChromeViews.cs`: + `NativeTabStrip`, `ScrollBandView`; surfaces `tab-strip` (`NativeChrome`) and `scroll-band` (`CellsUnderNative`)). + Decisions not to relitigate: + - **Unlike the header and rail, the strip keeps its cell row.** One cell grid cannot be inset per pane, so the + layout, `PaneOutputRects` and NAWS stay the terminal's exactly; the client paints the strip row blank in the + pane's recessed plane after the frame (`BlankNativeTabStrips`, `PostBufferPaint`) and the native strip lies on it. + The strip is one cell row tall (~25 px), not the mockup's 38. The band needs no blanking: its cells stay under it. + - **One model per strip, and the cells title from it**: `BuildPaneTabs`/`RetitlePane` build `StripModelFor` through + `Drawing(TabStrip, paneId, …)` and `TabTitles.Strip` writes the titles; the band is recorded in + `RefreshScrollSplitBar`. Published through `IPointerPresenter.PaneChrome` (default member) on `PostBufferPaint` + and modal changes, only on change, never while a modal or the native F1 covers the panes. Bands go to every host + with a presenter; strips only where `Tabs`. + - **Every gesture ends in the cell one's method, and is refused unless offered**: a tab → `ActivateStripTab` (what + `OnTabChanged` runs), its × → `CloseStripTab` (what the cell × runs; only where `Closable`), a right click → + `OpenTabMenu` (`AddTabMenu`, the cell tab's menu), `+N ▾` → `OpenTabOverflow` with the recorded `MenuModel`, the + band's button → `ReturnToLiveTail` (End's and ⌃End's path). + - **Presses**: the views hit only their tabs and buttons (`ICustomHitTest`); a press on the strip's empty run goes to + the cells, where the strip row is the stacked divider (`HeaderFill` returns the whole row under `Tabs`) and + `TakesNativeStripPress` strikes the button flags after the client's own handlers, so the framework never selects + or closes a tab under the native one. `PaneTargetAt` says Nothing on a strip row. + - **Not done**: no dragging a native tab to another pane (the cell drag handle is under it, unreachable); no hover + plate on the empty run. + - **Layouts are realised as panes, one per panel that has data** (`Core/Layouts`: `LayoutFold` → `LayoutRealiser` → `WorkspaceLayout.ReplaceTree`, `LayoutCapture` for the way back; Tui `SharpMUTermApp.Layouts.cs`, `TerminalPanels.cs`; ⌥M / ⌃P ▸ *Layouts*; F5 `layout` rows; the `layouts`, `layout-combat` and `layout-roleplay` views). The layout's @@ -1537,8 +1562,8 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw `ClientHost`. Don't use `WarningsAsErrors` for it: that ignores the folder's `severity = none`. - **Every snapshot view is drawn through both drivers and compared cell for cell**, glyph and background (`HostParityTests.EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal`, Avalonia suite), with the same - capabilities, keys and `HostChrome` — once with the chrome in cells and once with the header and rail drawn by - the host, as the window runs — so a difference can only be the driver. The list is `SnapshotViews.All`, and + capabilities, keys and `HostChrome` — with the chrome in cells, with the header and rail drawn by the host, and with + the tab strips drawn by it too, as the window runs — so a difference can only be the driver. The list is `SnapshotViews.All`, and `EveryViewTheSnapshotKnowsIsInTheParityList` reads `RenderSnapshot`'s source and fails when it learns a view the list does not name. The harness drag goes through `IMouseInjector` so `drag` draws in both. A second pass (`EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning`) draws each view with the window's loop diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index 6b8fbac5..96481dc8 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -49,6 +49,9 @@ internal sealed class DesktopLayer : Canvas private readonly Dictionary _quickBars = new(StringComparer.Ordinal); private readonly Dictionary _composers = new(StringComparer.Ordinal); private readonly NoticeToasts _toasts; + private readonly Dictionary _strips = new(StringComparer.Ordinal); + private readonly Dictionary _bands = new(StringComparer.Ordinal); + private (SharpMUTerm.Core.Theming.Theme Theme, NativeTokens Tokens)? _paneTokens; private int _noticeAboveRow; /// The cells. @@ -66,6 +69,7 @@ public DesktopLayer(TerminalView view, HostChrome chrome) _pointer.ActionsChanged += () => Dispatcher.UIThread.Post(Sync); _pointer.PanelsChanged += () => Dispatcher.UIThread.Post(Sync); _pointer.ChromeChanged += () => Dispatcher.UIThread.Post(Sync); + _pointer.PaneChromeChanged += () => Dispatcher.UIThread.Post(Sync); // The chrome first, so every panel and button is drawn over it. _header = new NativeHeader(view) { IsVisible = false }; @@ -168,9 +172,76 @@ internal void Sync() SyncChrome(); SyncButtons(frame, cell); SyncPanels(frame, cell); + SyncPaneChrome(cell); SyncToasts(frame, cell); } + /// The native tab strips by pane id. Internal for tests. + internal IReadOnlyDictionary Strips => _strips; + + /// The native scrolled-back bands by window id. Internal for tests. + internal IReadOnlyDictionary Bands => _bands; + + /// + /// Each pane's tab strip over the row the client left blank for it, and each scrolled-back band over its row: placed + /// from the cells, so a strip is exactly its pane's width and one row deep, and never over another cell. + /// + private void SyncPaneChrome(Size cell) + { + var said = _pointer.PaneChrome; + var strips = said?.Strips ?? []; + var bands = said?.Bands ?? []; + NativeTokens tokens = NativeTokens.Dark; + if (said is not null) + { + if (_paneTokens is not { } cached || !ReferenceEquals(cached.Theme, said.Theme)) + { + _paneTokens = (said.Theme, NativeTokens.For(said.Theme)); + } + + tokens = _paneTokens.Value.Tokens; + } + + var origin = CellOrigin; + Sync(_strips, strips.Select(s => (s.Model.PaneId, s.Row)), () => new NativeTabStrip(), origin, cell); + foreach (var strip in strips) + { + _strips[strip.Model.PaneId].Show(strip, tokens, said!.Interactive); + } + + Sync(_bands, bands.Select(b => (b.Model.WindowId, b.Row)), () => new ScrollBandView(), origin, cell); + foreach (var band in bands) + { + _bands[band.Model.WindowId].Show(band, tokens, said!.Interactive); + } + } + + private void Sync(Dictionary controls, IEnumerable<(string Key, PaneRect Row)> wanted, Func create, Point origin, Size cell) + where T : Control + { + var rows = wanted.ToList(); + foreach (var stale in controls.Keys.Where(k => rows.All(r => r.Key != k)).ToList()) + { + Children.Remove(controls[stale]); + controls.Remove(stale); + } + + foreach (var (key, row) in rows) + { + if (!controls.TryGetValue(key, out var control)) + { + control = create(); + controls[key] = control; + Children.Insert(0, control); + } + + SetLeft(control, origin.X + (row.X * cell.Width)); + SetTop(control, origin.Y + (row.Y * cell.Height)); + control.Width = row.Width * cell.Width; + control.Height = row.Height * cell.Height; + } + } + /// The toasts over the cell area, their stack sitting on the row the client said the pane area ends at. private void SyncToasts(ScreenFrame frame, Size cell) { diff --git a/src/SharpMUTerm.Avalonia/PaneChromeViews.cs b/src/SharpMUTerm.Avalonia/PaneChromeViews.cs new file mode 100644 index 00000000..7aef7add --- /dev/null +++ b/src/SharpMUTerm.Avalonia/PaneChromeViews.cs @@ -0,0 +1,543 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; +using Avalonia.Rendering; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// A pane's tab strip, drawn by the window over the strip's row, which the client paints blank where the window draws +/// the strips (). The model is the one the cells' titles are written from +/// (): the selected tab is a card joined to the pane, on the pane's own plane (its character's +/// tint and focus lift come with it), the others plain text in the quiet ink — an idle tab of another character's on its +/// own plane, as in the cells — an unread count in the accent, a close on hover where the tab offers one, and +/// +N ▾ where the cells' list of hidden tabs would open. +/// +/// Input. Only the tabs and the +N ▾ button are hit (): a press on the strip's +/// empty run goes on to the cells, where the client reads it as the divider or a window drag, exactly as the empty run +/// of a cell strip is read. Every gesture is handed back as a pane and window id, never a command; it takes no focus. +/// +/// +internal sealed class NativeTabStrip : Control, ICustomHitTest +{ + private readonly List<(Rect Area, Rect? Close, TabChipModel Tab, Color Plane)> _tabs = []; + + private readonly List _names = []; + + private string[] _labels = []; + + /// The narrowest a name is cut to while sharing room; the tab in front keeps more (the cells' floors). + private const double NameFloor = 36, SelectedNameFloor = 72, NameCap = 220; + private Rect? _overflow; + private string? _hoverTab; + private bool _hoverClose; + private bool _hoverOverflow; + private (string? Tab, bool Close, bool Overflow) _pressed; + + public NativeTabStrip() + { + Focusable = false; + ClipToBounds = true; + } + + /// What the client last said about this strip. Internal for tests. + internal TabStripOverlay? Overlay { get; private set; } + + private NativeTokens Tokens { get; set; } = NativeTokens.Dark; + + private bool Interactive { get; set; } = true; + + /// Each tab's area, as last laid out. Internal for tests. + internal IReadOnlyList<(Rect Area, Rect? Close, TabChipModel Tab, Color Plane)> Tabs => _tabs; + + /// The +N ▾ button's area, or null when every tab fits. Internal for tests. + internal Rect? OverflowArea => _overflow; + + /// The type size for the strip's depth: one cell row, which is the window's cell height. + private double Size => (double.IsNaN(Height) ? Bounds.Height : Height) switch + { + >= 24 => NativeTokens.Title, + >= 18 => NativeTokens.Body, + _ => NativeTokens.Small, + }; + + /// Takes the client's strip and the window's tokens, lays the tabs out and redraws. + public void Show(TabStripOverlay overlay, NativeTokens tokens, bool interactive) + { + Overlay = overlay; + Tokens = tokens; + Interactive = interactive; + Lay(); + InvalidateVisual(); + } + + protected override void OnSizeChanged(SizeChangedEventArgs e) + { + base.OnSizeChanged(e); + Lay(); + } + + private static Color Parse(string? hex, Color fallback) => hex is not null && Color.TryParse(hex, out var c) ? c : fallback; + + private static Rgb Rgb(Color c) => new(c.R, c.G, c.B); + + private static Color Colour(Rgb c) => Color.FromRgb(c.R, c.G, c.B); + + /// An ink held to the window's text floor on the plane it is drawn on. + internal static Color Held(Color ink, Color plane) => Colour(Contrast.Legible(Rgb(ink), Rgb(plane), NativeTokens.TextFloor)); + + private void Lay() + { + _tabs.Clear(); + _names.Clear(); + _overflow = null; + if (Overlay is not { } overlay) + { + return; + } + + var width = double.IsNaN(Width) ? Bounds.Width : Width; + var height = double.IsNaN(Height) ? Bounds.Height : Height; + var strip = Parse(overlay.StripPlane, Tokens.Card); + var plane = Parse(overlay.Plane, Tokens.Card); + var right = width - 6; + if (overlay.Overflow is { Entries.Count: > 0 } menu) + { + var label = $"+{menu.Entries.Count} ▾"; + var w = PanelText.Measure(label, Size, bold: true) + 16; + _overflow = new Rect(Math.Max(0, width - w - 6), 3, w, Math.Max(4, height - 6)); + right = _overflow.Value.X - 6; + } + + var x = 8.0; + var top = Math.Min(4, Math.Max(1, height / 6)); + var names = Fit(overlay.Model.Tabs, right - x); + for (var i = 0; i < overlay.Model.Tabs.Count; i++) + { + var tab = overlay.Model.Tabs[i]; + var name = names[i]; + var extra = Extra(tab); + var close = tab.Closable ? 16 : 0; + var w = 14 + name + extra + close + 14; + var area = new Rect(x, top, w, Math.Max(4, height - top)); + var chip = overlay.Chips.Count > i && overlay.Chips[i] is { } hex ? Parse(hex, strip) : strip; + Rect? closeArea = tab.Closable ? new Rect(area.Right - 14 - close, top + ((area.Height - 16) / 2), 16, 16) : null; + _tabs.Add((area, closeArea, tab, tab.Selected ? plane : chip)); + _names.Add(name); + x += w + 2; + if (x > right) + { + break; + } + } + } + + private double Extra(TabChipModel tab) => + (tab.Unread > 0 ? PanelText.Measure(" " + UnreadBadge.Format(tab.Unread), Size, true) : 0) + + (Marks(tab).Length > 0 ? PanelText.Measure(Marks(tab), Size, false) : 0); + + /// + /// Each name's width so the tabs fit , the way the cells' strip shares its row + /// (TabStripFit): a cap is lowered until the row fits and every longer name is cut to it, so short names stay + /// whole; the tab in front keeps a floor of its own. Past the floors the row clips, as the cells' does. + /// + private double[] Fit(IReadOnlyList tabs, double room) + { + var fixedCost = tabs.Sum(t => 28 + Extra(t) + (t.Closable ? 16 : 0) + 2); + double Measure(string label, TabChipModel t) => Math.Min(NameCap, PanelText.Measure(label, Size, t.Selected)); + + // The owner prefix goes first, and for the whole strip, as in the cells: the chip and the other character's + // mark still say whose a tab is. + _labels = tabs.Select(t => t.Name).ToArray(); + if (fixedCost + tabs.Sum(t => Measure(t.Name, t)) > room) + { + _labels = tabs.Select(t => t.Title).ToArray(); + } + + var full = tabs.Select((t, i) => Measure(_labels[i], t)).ToArray(); + double Width(double cap) => full.Select((w, i) => Math.Min(w, Math.Max(cap, tabs[i].Selected ? Math.Min(w, SelectedNameFloor) : 0))).Sum(); + if (fixedCost + full.Sum() <= room || full.Length == 0) + { + return full; + } + + var cap = full.Max(); + while (cap > NameFloor && fixedCost + Width(cap) > room) + { + cap -= 2; + } + + return full.Select((w, i) => Math.Min(w, Math.Max(cap, tabs[i].Selected ? Math.Min(w, SelectedNameFloor) : 0))).ToArray(); + } + + /// The quiet marks after a name: the draft pen and the other character's sign, as the cells write them. + private static string Marks(TabChipModel tab) => (tab.Draft ? " ✎" : string.Empty) + (tab.Foreign ? " ⌁" : string.Empty); + + public bool HitTest(Point point) => + Interactive && (_tabs.Any(t => t.Area.Contains(point)) || _overflow?.Contains(point) == true); + + protected override void OnPointerMoved(PointerEventArgs e) + { + base.OnPointerMoved(e); + var p = e.GetPosition(this); + var hit = _tabs.FirstOrDefault(t => t.Area.Contains(p)); + var tab = hit.Tab?.WindowId; + var close = hit.Close?.Contains(p) == true; + var overflow = _overflow?.Contains(p) == true; + if (tab != _hoverTab || close != _hoverClose || overflow != _hoverOverflow) + { + _hoverTab = tab; + _hoverClose = close; + _hoverOverflow = overflow; + Cursor = tab is not null || overflow ? new Cursor(StandardCursorType.Hand) : Cursor.Default; + ToolTip.SetTip(this, hit.Tab is { } t ? Tip(t, close) : overflow ? $"{Overlay?.Overflow?.Entries.Count} more tabs" : null); + InvalidateVisual(); + } + } + + private static string Tip(TabChipModel tab, bool close) => + NativeKeys.Words(close + ? "Close this tab (Ctrl+W)" + : tab.Name + (tab.Unread > 0 ? $"\n{UnreadBadge.Format(tab.Unread)} new" : string.Empty) + + (tab.Draft ? "\nan unsent line on its command line" : string.Empty)); + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + _hoverTab = null; + _hoverClose = false; + _hoverOverflow = false; + InvalidateVisual(); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + e.Handled = true; + var p = e.GetPosition(this); + var hit = _tabs.FirstOrDefault(t => t.Area.Contains(p)); + if (e.GetCurrentPoint(this).Properties.IsRightButtonPressed) + { + // The menu takes the pointer, so the release would never arrive: a right press is the whole click. + if (Overlay is { } overlay && hit.Tab is { } tab) + { + overlay.Menu(overlay.Model.PaneId, tab.WindowId); + } + + return; + } + + _pressed = (hit.Tab?.WindowId, hit.Close?.Contains(p) == true, _overflow?.Contains(p) == true); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + var pressed = _pressed; + _pressed = default; + if (e.InitialPressMouseButton != MouseButton.Left || Overlay is not { } overlay) + { + return; + } + + var p = e.GetPosition(this); + var hit = _tabs.FirstOrDefault(t => t.Area.Contains(p)); + if (pressed.Overflow && _overflow?.Contains(p) == true) + { + overlay.OpenOverflow(overlay.Model.PaneId); + } + else if (pressed.Tab is { } id && hit.Tab?.WindowId == id) + { + if (pressed.Close && hit.Close?.Contains(p) == true) + { + overlay.Close(overlay.Model.PaneId, id); + } + else + { + overlay.Activate(overlay.Model.PaneId, id); + } + } + } + + /// Clicks a tab as a left press and release on it would. Internal for tests. + internal void PerformClick(string windowId, bool close = false) + { + if (Overlay is { } overlay) + { + if (close) + { + overlay.Close(overlay.Model.PaneId, windowId); + } + else + { + overlay.Activate(overlay.Model.PaneId, windowId); + } + } + } + + public override void Render(DrawingContext context) + { + if (Overlay is not { } overlay) + { + return; + } + + var bounds = new Rect(Bounds.Size); + var strip = Parse(overlay.StripPlane, Tokens.Card); + context.FillRectangle(new SolidColorBrush(strip), bounds); + var rule = new Pen(new SolidColorBrush(Tokens.Rule), 1); + var bottom = Math.Floor(bounds.Height) - 0.5; + context.DrawLine(rule, new Point(0, bottom), new Point(bounds.Width, bottom)); + + var size = Size; + var middle = (bounds.Height / 2) + 1; + var index = -1; + foreach (var (area, close, tab, plane) in _tabs) + { + index++; + var hovered = tab.WindowId == _hoverTab; + if (tab.Selected) + { + // A card joined to the pane: rounded at the top, ruled on three sides, open at the bottom onto the pane. + var r = Math.Min(NativeTokens.RadiusM, area.Height / 2); + var card = CardGeometry(area, r, bounds.Height); + context.DrawGeometry(new SolidColorBrush(plane), null, card); + context.DrawGeometry(null, new Pen(new SolidColorBrush(Tokens.Rule), 1), CardOutline(area, r, bounds.Height)); + + // The focused pane's front tab carries the focus cue: an accent bar along its top, between the corners. + if (overlay.Model.Focused) + { + context.DrawRectangle(new SolidColorBrush(Tokens.Accent), null, new Rect(area.X + r, area.Y, Math.Max(0, area.Width - (2 * r)), 2), 1, 1); + } + } + else + { + if (plane != strip) + { + context.DrawRectangle(new SolidColorBrush(plane), null, area.Deflate(new Thickness(0, 1, 0, 3)), NativeTokens.RadiusS, NativeTokens.RadiusS); + } + + if (hovered && Interactive) + { + context.DrawRectangle(new SolidColorBrush(PanelText.Alpha(Tokens.Text, 0x14)), null, area.Deflate(new Thickness(0, 1, 0, 3)), NativeTokens.RadiusS, NativeTokens.RadiusS); + } + } + + var ink = Held(tab.Selected ? Tokens.Text : Tokens.Dim, plane); + var x = area.X + 14; + var limit = area.Right - 14 - (close is null ? 0 : 16) - x; + var drawn = PanelText.Draw(context, _labels.Length > index ? _labels[index] : tab.Name, x, middle, size, ink, tab.Selected, Math.Min(_names.Count > index ? _names[index] : NameCap, limit)); + x += drawn; + if (tab.Unread > 0) + { + x += PanelText.Draw(context, " " + UnreadBadge.Format(tab.Unread), x, middle, size, Held(Tokens.Accent, plane), true, area.Right - x); + } + + if (Marks(tab) is { Length: > 0 } marks) + { + PanelText.Draw(context, marks, x, middle, size, Held(Tokens.Dim, plane), false, area.Right - x); + } + + if (close is { } c && hovered && Interactive) + { + var shade = _hoverClose && hovered ? 0x30 : 0; + if (shade > 0) + { + context.DrawRectangle(new SolidColorBrush(PanelText.Alpha(Tokens.Text, (byte)shade)), null, c, NativeTokens.RadiusS, NativeTokens.RadiusS); + } + + var pen = new Pen(new SolidColorBrush(PanelText.Alpha(ink, 0xe0)), 1.25); + var m = c.Center; + context.DrawLine(pen, new Point(m.X - 3.5, m.Y - 3.5), new Point(m.X + 3.5, m.Y + 3.5)); + context.DrawLine(pen, new Point(m.X + 3.5, m.Y - 3.5), new Point(m.X - 3.5, m.Y + 3.5)); + } + } + + if (_overflow is { } o && overlay.Overflow is { } menu) + { + var fill = _hoverOverflow ? Tokens.Selected : Tokens.Raised; + context.DrawRectangle(new SolidColorBrush(fill), new Pen(new SolidColorBrush(Tokens.Edge), 1), o, NativeTokens.RadiusS, NativeTokens.RadiusS); + PanelText.Draw(context, $"+{menu.Entries.Count} ▾", o.X + 8, o.Center.Y, size, Held(Tokens.Accent, fill), true, o.Width - 10); + } + + if (!Interactive) + { + context.FillRectangle(new SolidColorBrush(PanelText.Alpha(strip, 0x70)), bounds); + } + } + + /// The selected tab's fill: rounded top corners, square bottom running down over the strip's rule. + private static Geometry CardGeometry(Rect area, double r, double height) + { + var g = new StreamGeometry(); + using var c = g.Open(); + var bottom = height; + c.BeginFigure(new Point(area.X, bottom), true); + c.LineTo(new Point(area.X, area.Y + r)); + c.ArcTo(new Point(area.X + r, area.Y), new Size(r, r), 0, false, SweepDirection.Clockwise); + c.LineTo(new Point(area.Right - r, area.Y)); + c.ArcTo(new Point(area.Right, area.Y + r), new Size(r, r), 0, false, SweepDirection.Clockwise); + c.LineTo(new Point(area.Right, bottom)); + c.EndFigure(true); + return g; + } + + /// The selected tab's edge: three sides, none along the bottom, which is where it joins its pane. + private static Geometry CardOutline(Rect area, double r, double height) + { + var g = new StreamGeometry(); + using var c = g.Open(); + var left = area.X + 0.5; + var right = area.Right - 0.5; + var top = area.Y + 0.5; + c.BeginFigure(new Point(left, height), false); + c.LineTo(new Point(left, top + r)); + c.ArcTo(new Point(left + r, top), new Size(r, r), 0, false, SweepDirection.Clockwise); + c.LineTo(new Point(right - r, top)); + c.ArcTo(new Point(right, top + r), new Size(r, r), 0, false, SweepDirection.Clockwise); + c.LineTo(new Point(right, height)); + c.EndFigure(false); + return g; + } +} + +/// +/// The band across a pane split by scrolling back, drawn by the window over the band's row (its cells stay drawn under +/// it): how far back the history is, that new lines keep arriving below, and a Jump to latest button that ends +/// where End does (, the model the cells' rule is drawn from). Only the button is hit; the +/// rest of the band passes the pointer on to the cells. It takes no focus. +/// +internal sealed class ScrollBandView : Control, ICustomHitTest +{ + private Rect _button; + private bool _hover; + private bool _pressed; + + public ScrollBandView() + { + Focusable = false; + ClipToBounds = true; + } + + /// What the client last said about this band. Internal for tests. + internal ScrollBandOverlay? Overlay { get; private set; } + + private NativeTokens Tokens { get; set; } = NativeTokens.Dark; + + private bool Interactive { get; set; } = true; + + /// The button's area, as last laid out. Internal for tests. + internal Rect Button => _button; + + private double Size => (double.IsNaN(Height) ? Bounds.Height : Height) >= 20 ? NativeTokens.Body : NativeTokens.Small; + + private string ButtonText => $"{ScrollBandModel.Action} {NativeKeys.Words(ScrollBandModel.ReturnKey)}"; + + /// Takes the client's band and the window's tokens and redraws. + public void Show(ScrollBandOverlay band, NativeTokens tokens, bool interactive) + { + Overlay = band; + Tokens = tokens; + Interactive = interactive; + Lay(); + InvalidateVisual(); + } + + protected override void OnSizeChanged(SizeChangedEventArgs e) + { + base.OnSizeChanged(e); + Lay(); + } + + private void Lay() + { + var width = double.IsNaN(Width) ? Bounds.Width : Width; + var height = double.IsNaN(Height) ? Bounds.Height : Height; + var w = PanelText.Measure(ButtonText, Size, bold: true) + 20; + var h = Math.Max(4, Math.Min(height - 4, 24)); + _button = new Rect(Math.Max(0, width - w - 12), (height - h) / 2, w, h); + } + + public bool HitTest(Point point) => Interactive && _button.Contains(point); + + protected override void OnPointerEntered(PointerEventArgs e) + { + base.OnPointerEntered(e); + _hover = true; + Cursor = new Cursor(StandardCursorType.Hand); + ToolTip.SetTip(this, "Back to the live output (End, Ctrl+End)"); + InvalidateVisual(); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + _hover = false; + InvalidateVisual(); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + e.Handled = true; + _pressed = e.GetCurrentPoint(this).Properties.IsLeftButtonPressed; + InvalidateVisual(); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + var click = _pressed && e.InitialPressMouseButton == MouseButton.Left && _button.Contains(e.GetPosition(this)); + _pressed = false; + InvalidateVisual(); + if (click) + { + PerformClick(); + } + } + + /// Clicks the button as a left press and release would. Internal for tests. + internal void PerformClick() + { + if (Overlay is { } band) + { + band.Jump(band.Model.WindowId); + } + } + + public override void Render(DrawingContext context) + { + if (Overlay is not { } band) + { + return; + } + + var bounds = new Rect(Bounds.Size); + var plane = Tokens.Raised; + context.FillRectangle(new SolidColorBrush(plane), bounds); + var rule = new Pen(new SolidColorBrush(Tokens.Rule), 1); + context.DrawLine(rule, new Point(0, 0.5), new Point(bounds.Width, 0.5)); + context.DrawLine(rule, new Point(0, Math.Floor(bounds.Height) - 0.5), new Point(bounds.Width, Math.Floor(bounds.Height) - 0.5)); + + var size = Size; + var middle = bounds.Height / 2; + var x = 12.0; + var room = _button.X - 12; + x += PanelText.Draw(context, band.Model.Lead(band.Count), x, middle, size, NativeTabStrip.Held(Tokens.Text, plane), true, room - x); + if (room - x > 40) + { + PanelText.Draw(context, ScrollBandModel.Detail, x + 12, middle, size, NativeTabStrip.Held(Tokens.Dim, plane), false, room - x - 12); + } + + var fill = Tokens.Accent; + var shade = _hover && Interactive ? 0xe8 : 0xff; + context.DrawRectangle(new SolidColorBrush(Color.FromArgb((byte)shade, fill.R, fill.G, fill.B)), null, _button, NativeTokens.RadiusS + 2, NativeTokens.RadiusS + 2); + PanelText.Draw(context, ButtonText, _button.X + 10, _button.Center.Y, size, Tokens.AccentInk, true, _button.Width - 12); + } +} diff --git a/src/SharpMUTerm.Avalonia/WindowHost.cs b/src/SharpMUTerm.Avalonia/WindowHost.cs index 91ea1452..4d9a5054 100644 --- a/src/SharpMUTerm.Avalonia/WindowHost.cs +++ b/src/SharpMUTerm.Avalonia/WindowHost.cs @@ -40,7 +40,7 @@ internal static class WindowHost /// The window's driver. /// Where a copy goes. /// - /// Which chrome the window draws natively. The header and the rail by default, which is the window a person runs; + /// Which chrome the window draws natively. The header, the rail and the tab strips by default (), which is the window a person runs; /// for --render-png and --cell-chrome, where the cells carry it all. /// public static ClientHost Create(AvaloniaConsoleDriver driver, Action? clipboard, HostChrome? chrome = null) => new() @@ -75,7 +75,7 @@ internal static class WindowHost // The header band and the connections sidebar are the window's own controls, beside the cell grid rather // than over it (MainWindow, DesktopLayer): the client draws neither. - Chrome = chrome ?? HostChrome.HeaderAndRail, + Chrome = chrome ?? HostChrome.Native, // ⌃P is a native palette over the window, listing the same rows as the cell one. NativePalette = driver.Palette, diff --git a/src/SharpMUTerm.Avalonia/WindowOptions.cs b/src/SharpMUTerm.Avalonia/WindowOptions.cs index 857321a5..8b9025f3 100644 --- a/src/SharpMUTerm.Avalonia/WindowOptions.cs +++ b/src/SharpMUTerm.Avalonia/WindowOptions.cs @@ -30,7 +30,7 @@ internal sealed record WindowOptions( /// Which chrome the window draws natively: the header and the sidebar, unless --cell-chrome asked for the /// terminal's cells or this is --render-png, which draws cells and nothing native. /// - public HostChrome Chrome => CellChrome || RenderPng is not null ? HostChrome.None : HostChrome.HeaderAndRail; + public HostChrome Chrome => CellChrome || RenderPng is not null ? HostChrome.None : HostChrome.Native; /// /// What the client is told about this "terminal": Kitty graphics and truecolour. Both are true by diff --git a/src/SharpMUTerm.Avalonia/WindowPointer.cs b/src/SharpMUTerm.Avalonia/WindowPointer.cs index 4a3e1b33..e19a6a16 100644 --- a/src/SharpMUTerm.Avalonia/WindowPointer.cs +++ b/src/SharpMUTerm.Avalonia/WindowPointer.cs @@ -108,6 +108,20 @@ void IPointerPresenter.Chrome(ChromeOverlay chrome) ChromeChanged?.Invoke(); } + private PaneChromeOverlay? _paneChrome; + + /// The panes' tab strips and scrolled-back bands as the client last described them, or null before it has. + public PaneChromeOverlay? PaneChrome => Volatile.Read(ref _paneChrome); + + /// Raised on the client's thread when changes. + public event Action? PaneChromeChanged; + + void IPointerPresenter.PaneChrome(PaneChromeOverlay chrome) + { + Volatile.Write(ref _paneChrome, chrome); + PaneChromeChanged?.Invoke(); + } + private IReadOnlyList _notices = []; /// The notices the client has said, newest last, the most recent . diff --git a/src/SharpMUTerm.Client/Chrome/TabStripModel.cs b/src/SharpMUTerm.Client/Chrome/TabStripModel.cs new file mode 100644 index 00000000..79ad5ede --- /dev/null +++ b/src/SharpMUTerm.Client/Chrome/TabStripModel.cs @@ -0,0 +1,91 @@ +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Chrome; + +/// +/// One tab of a pane's strip, as data: what the cell strip writes into the tab's title (TabTitles) and what the +/// window's native strip draws, so the two say the same thing about the same window. +/// +/// The window the tab brings forward. +/// The window's name as the strip spells it: the owner ahead of a capture's title (Corvid · Chat). +/// The window's own title, without the owner — what an elided cell tab falls back to. +/// Whether it is the strip's front tab. +/// Lines that arrived while it was not caught up; zero for none. +/// Whether its command line holds an unsent line. +/// Whether it belongs to a character other than the focused one (the cells' ⌁). +/// Whether it offers a close (the cells' ×): the front tab, never the main window. +/// The session key of the character it belongs to, or null for a window nobody owns. +public sealed record TabChipModel( + string WindowId, + string Name, + string Title, + bool Selected, + int Unread, + bool Draft, + bool Foreign, + bool Closable, + string? Owner) +{ + /// The command a click on the tab is the same as: the ⌃P "Go to …" entry for its window. + public string Target => Core.Commands.CommandIds.Window(WindowId); + + /// The tab for , as the strip of a pane whose focused character is . + public static TabChipModel From(WorkspaceWindow window, string? focusedCharacterKey, bool selected, bool closable) + { + ArgumentNullException.ThrowIfNull(window); + var name = window.Kind != WindowKind.Main ? CharacterNames.Window(window.OwnerLabel, window.Title) : window.Title; + var foreign = focusedCharacterKey is not null + && window.SessionKey is not null + && !string.Equals(window.SessionKey, focusedCharacterKey, StringComparison.Ordinal); + return new TabChipModel( + window.Id, name, window.Title, selected, Math.Max(0, window.Unread), window.HasUnsentInput, foreign, closable, window.SessionKey); + } +} + +/// +/// A pane's tab strip, as data (SurfaceCatalog.TabStrip): the tabs in strip order and whether the pane holds the +/// keyboard. The cells write each tab's title from it; the window draws it natively over the strip's row, which the +/// client leaves blank when the host says it draws the strips (HostChrome.Tabs). Value equality, lists included, +/// so an unchanged strip is not published again. +/// +public sealed record TabStripModel(string PaneId, bool Focused, IReadOnlyList Tabs) +{ + /// The tab a click on names, or null when the strip does not hold it. + public TabChipModel? Find(string windowId) => Tabs.FirstOrDefault(t => string.Equals(t.WindowId, windowId, StringComparison.Ordinal)); + + public bool Equals(TabStripModel? other) => + other is not null + && string.Equals(PaneId, other.PaneId, StringComparison.Ordinal) + && Focused == other.Focused + && Tabs.SequenceEqual(other.Tabs); + + public override int GetHashCode() => HashCode.Combine(PaneId, Focused, Tabs.Count); +} + +/// +/// The band across a pane split by scrolling back (SurfaceCatalog.ScrollBand): how far back the history above it +/// is, in display rows, and the way back to the live tail. The cells draw it as a rule +/// (ScrollSplitBarRenderer); the window draws it natively over that row, its button ending where End does. +/// +/// The split window. +/// Display rows below the history viewport: the status row's figure. +public sealed record ScrollBandModel(string WindowId, int RowsBack) +{ + /// The command the band's button is the same as: ⌃P ▸ Back to live output. + public const string LiveCommand = "term:scroll-live"; + + /// The key that returns, named on the button. + public const string ReturnKey = "End"; + + /// The key that freezes the split instead. + public const string FreezeKey = "⌥F"; + + /// The native band's lead: Scrolled back 120 rows, the count capped as the cells cap it. + public string Lead(string count) => $"Scrolled back {count} rows"; + + /// What the native band says beside its lead. + public const string Detail = "New lines keep arriving below"; + + /// The native button's words, before its key. + public const string Action = "Jump to latest"; +} diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 49c2c84d..c0aee430 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -210,6 +210,18 @@ public static class SurfaceCatalog /// public const string TabOverflow = "tab-overflow"; + /// + /// A pane's tab strip: the framework's strip of cells in a terminal, written from the model; in the window + /// (HostChrome.Tabs) a native strip over the strip's row, which the client then paints blank. + /// + public const string TabStrip = "tab-strip"; + + /// + /// The band across a pane split by scrolling back: a rule of cells in a terminal; in the window a native band over + /// that row as well, whose button ends where End does. + /// + public const string ScrollBand = "scroll-band"; + /// /// A panel popped out into a window of its own (the desktop window only; a terminal keeps every panel in its /// region). The frame around the panel's own native view: its title, whose it is, and the way back. @@ -578,6 +590,30 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), CellsUnderNative, "SharpMUTerm.Tui.SharpMUTermApp.TabOverflowLines", ["SharpMUTerm.Avalonia.NativeMenu"]), + new( + TabStrip, + typeof(TabStripModel), + [ + // A tab click brings its window forward and focuses its pane; the × closes the front tab; a right click + // opens the tab's menu; +N ▾ opens the overflow list. Each is the method the cell strip's click ends in. + new(SurfaceActionKind.Pick, "tab", "ActivateStripTab"), + new(SurfaceActionKind.Pick, "close", "CloseStripTab"), + new(SurfaceActionKind.Pick, "tab menu", "OpenTabMenu"), + new(SurfaceActionKind.Target, "overflow", "OpenTabOverflow"), + ], + NativeChrome, + "SharpMUTerm.Tui.TabTitles.Strip", + ["SharpMUTerm.Avalonia.NativeTabStrip"]), + new( + ScrollBand, + typeof(ScrollBandModel), + [ + // Jump to latest: End's method. The cells' band is a rule, not a button: End, ⌃End or the ⌃P entry. + new(SurfaceActionKind.Target, "jump to latest", "ReturnToLiveTail", CellsVia: ScrollBandModel.LiveCommand), + ], + CellsUnderNative, + "SharpMUTerm.Tui.ScrollSplitBarRenderer.Bar", + ["SharpMUTerm.Avalonia.ScrollBandView"]), new( FloatingPanel, typeof(FloatingPanelModel), diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 59099085..6d4f6ae4 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -309,14 +309,22 @@ internal static ClientHost HarnessTerminal( /// /// The host draws the header band (the client's first row). /// The host draws the connection rail (the client's left column, with its divider and spacer). -internal sealed record HostChrome(bool Header, bool Rail) +/// +/// The host draws each pane's tab strip. A strip's row cannot be taken out of one pane of a uniform cell grid, so this +/// one part keeps its row: the client paints it blank and publishes the strip as data (TabStripModel), and the +/// host draws over exactly that row. The pane rectangles, and so NAWS, are the terminal's. +/// +internal sealed record HostChrome(bool Header, bool Rail, bool Tabs = false) { /// The client draws all of its chrome in cells: the terminal, the snapshot, the tests. public static HostChrome None { get; } = new(false, false); - /// The host draws the header and the rail natively: the desktop window. + /// The host draws the header and the rail natively. public static HostChrome HeaderAndRail { get; } = new(true, true); + /// The host draws the header, the rail and every pane's tab strip natively: the desktop window as it runs. + public static HostChrome Native { get; } = new(true, true, true); + /// Whether the host draws anything at all. - public bool Any => Header || Rail; + public bool Any => Header || Rail || Tabs; } diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 6fe97200..31f94d3f 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -160,6 +160,15 @@ void Chrome(ChromeOverlay chrome) { } + /// + /// The panes' tab strips (when the host draws them, ) and the bands of panes split by + /// scrolling back, as data, whenever one moves or what it says changes. A host that draws neither ignores this (the + /// default). + /// + void PaneChrome(PaneChromeOverlay chrome) + { + } + /// /// How many columns a terminal the size of the host's whole window would have: its cells plus the chrome it draws /// beside them, in cells. Null when the cells are the whole window (the terminal, and the default). The client's diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.PaneChrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.PaneChrome.cs new file mode 100644 index 00000000..8878a73a --- /dev/null +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.PaneChrome.cs @@ -0,0 +1,368 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Commands; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Tui; + +/// +/// The panes' own chrome as data, for a host that draws it natively over the cells: each pane's tab strip (only where +/// the host says it draws them, ) and the band of each pane split by scrolling back. +/// +/// A strip keeps its row. The header and the rail are taken out of the grid, but a pane's strip is one row of +/// one pane, and a uniform cell grid cannot be inset per pane. So the client lays the panes out exactly as in a +/// terminal — the pane rectangles, and therefore NAWS, are the terminal's — paints each strip's row blank after the +/// frame (, the way the header dividers and the overflow chip are painted), and the +/// host draws its strip over exactly that row. A press the host lets through reaches only the client's own pointer +/// path (the divider, a window drag), never the framework's strip, whose labels are under the blank cells +/// (). +/// +/// +/// Every gesture ends in the cell click's method: a tab in (the cell strip's +/// TabChanged), its close in (the ×), a right click in +/// (the cell tab's menu), +N ▾ in , and the band's +/// button in (End). Each is refused unless the overlay last published offered it. +/// +/// +internal sealed partial class SharpMUTermApp +{ + private PaneChromeOverlay? _paneChrome; + + private Action? _stripActivate; + private Action? _stripClose; + private Action? _stripMenu; + private Action? _stripOverflow; + private Action? _bandJump; + + /// The strip rows the host draws over, in desktop cells, as the last frame painted them; read on the input thread. + private volatile PaneRect[] _nativeStripRows = []; + + /// What the host was last told about the panes' strips and bands. Internal for tests. + internal PaneChromeOverlay? PaneChromePublished => _paneChrome; + + /// + /// Tells the host about the strips and bands on screen, when any changed. Rides the frame, after every strip has been + /// re-titled and every band re-counted, and the modal stack, for ' reason. + /// + private void PublishPaneChrome() + { + if (_pointer is null || _window is null) + { + return; + } + + var overlay = BuildPaneChrome(); + if (overlay.Equals(_paneChrome)) + { + return; + } + + _paneChrome = overlay; + _pointer.PaneChrome(overlay); + } + + /// The strips and bands as they stand. Internal for tests. + internal PaneChromeOverlay BuildPaneChrome() + { + _stripActivate ??= (pane, window) => OnUiThread(() => ActivateOfferedStripTab(pane, window)); + _stripClose ??= (pane, window) => OnUiThread(() => CloseOfferedStripTab(pane, window)); + _stripMenu ??= (pane, window) => OnUiThread(() => OpenTabMenu(pane, window)); + _stripOverflow ??= pane => OnUiThread(() => OpenOfferedTabOverflow(pane)); + _bandJump ??= window => OnUiThread(() => ReturnFromOfferedBand(window)); + + // A modal over the main window is drawn in cells over the panes; a native strip would sit on top of it. + var covered = _system.ModalStateService.HasModals || _nativeCompose is not null; + var strips = new List(); + var bands = new List(); + if (!covered) + { + foreach (var (paneId, tabs, _) in RealisedPanes()) + { + if (Host.Chrome.Tabs && tabs.ShowTabHeader && BoundsOf(tabs) is { Width: > 0 } box + && DrawnModel(SurfaceCatalog.TabStrip, paneId) is TabStripModel model) + { + var surface = PaneSurfaceTone(paneId); + var chips = model.Tabs + .Select(t => t.Selected || _workspace.FindWindow(t.WindowId) is not { } w ? null : ChipFor(paneId, w).Plane) + .ToList(); + strips.Add(new TabStripOverlay( + new PaneRect(box.X, box.Y, box.Width, Math.Max(1, tabs.TabHeaderHeight)), + model, + surface.ToHex(), + WorkspacePalette.Recessed(surface).ToHex(), + chips, + _tabOverflow.TryGetValue(paneId, out var overflow) ? overflow.Menu : null, + _stripActivate, + _stripClose, + _stripMenu, + _stripOverflow)); + } + + if (_workspace.Layout.FindPane(paneId)?.ActiveTab is { } windowId && _scrollSplits.ContainsKey(windowId) + && _scrollSplitBars.TryGetValue(windowId, out var bar) && BoundsOf(bar) is { Width: > 0 } row + && DrawnModel(SurfaceCatalog.ScrollBand, windowId) is ScrollBandModel band) + { + bands.Add(new ScrollBandOverlay( + new PaneRect(row.X, row.Y, row.Width, 1), band, ScrollSplitBarRenderer.Count(band.RowsBack), _bandJump)); + } + } + } + + _nativeStripRows = [.. strips.Select(s => s.Row)]; + return new PaneChromeOverlay(strips, bands, _theme, MainWindowInFront()); + } + + /// + /// Paints the row of every strip the host draws blank, after the frame, in the strip's own recessed plane: the + /// framework's labels, separators and × go, the row stays, and the host's strip lies over it. Only where the + /// host draws the strips. + /// + private void BlankNativeTabStrips(SharpConsoleUI.Layout.CharacterBuffer buffer) + { + if (!Host.Chrome.Tabs) + { + return; + } + + var top = _window.Top + _system.DesktopUpperLeft.Y; + foreach (var (paneId, tabs, _) in RealisedPanes()) + { + if (!tabs.ShowTabHeader || BoundsOf(tabs) is not { Width: > 0 } strip) + { + continue; + } + + var plane = ToColor(WorkspacePalette.Recessed(PaneSurfaceTone(paneId))); + for (var y = strip.Y; y < strip.Y + Math.Max(1, tabs.TabHeaderHeight); y++) + { + var by = y - top; + for (var x = strip.X; x < strip.X + strip.Width; x++) + { + var bx = x - _window.Left; + if (bx >= 0 && by >= 0 && bx < buffer.Width && by < buffer.Height) + { + buffer.SetCell(bx, by, new SharpConsoleUI.Layout.Cell(' ', plane, plane)); + } + } + } + } + } + + /// + /// Strikes the button flags of a frame on a strip row the host draws over, leaving the framework a movement. Called + /// after this client's own handlers have read the frame whole. Internal for tests. + /// + internal bool TakesNativeStripPress(List flags, System.Drawing.Point point) + { + var rows = _nativeStripRows; + if (rows.Length == 0 || !rows.Any(r => Contains(r, point))) + { + return false; + } + + var removed = flags.RemoveAll(f => f is MouseFlags.Button1Pressed or MouseFlags.Button1Released + or MouseFlags.Button1Clicked or MouseFlags.Button1DoubleClicked or MouseFlags.Button1TripleClicked + or MouseFlags.Button1Dragged); + if (removed > 0 && flags.Count == 0) + { + flags.Add(MouseFlags.ReportMousePosition); + } + + return removed > 0; + } + + /// + /// A tab clicked, in either host: its pane takes the focus and its window comes forward, through the one activation + /// path. The cell strip's TabChanged ends here too. + /// + internal void ActivateStripTab(string paneId, string windowId) + { + _workspace.Layout.Focus(paneId); + Activate(windowId); + } + + /// A tab's close, in either host: the cell × and the native one. + internal void CloseStripTab(string windowId) => CloseWindow(windowId); + + /// + /// A right click on a tab: the tab comes forward and the host shows the tab's menu (), the + /// menu a right click on a cell tab shows. Internal for tests; returns whether a menu was shown. + /// + internal bool OpenTabMenu(string paneId, string windowId) + { + if (_pointer is null || !Offered(paneId, windowId, out var strip) || !MainWindowInFront()) + { + return false; + } + + var items = new List(); + AddTabMenu(items, windowId); + var tidy = Tidy(items); + if (tidy.Count == 0) + { + return false; + } + + _pointer.ShowMenu(new System.Drawing.Point(strip!.Row.X, strip.Row.Y), tidy); + return true; + } + + /// A native tab click, checked against what the strip offered. Internal for tests. + internal bool ActivateOfferedStripTab(string paneId, string windowId) + { + if (!Offered(paneId, windowId, out _)) + { + RefuseCommand($"the tab strip never offered {Snippet(windowId)}"); + return false; + } + + if (!MainWindowInFront()) + { + return false; + } + + ActivateStripTab(paneId, windowId); + return true; + } + + /// A native tab's close, checked: only a tab the strip offered a close on. Internal for tests. + internal bool CloseOfferedStripTab(string paneId, string windowId) + { + if (!Offered(paneId, windowId, out var strip) || strip!.Model.Find(windowId) is not { Closable: true }) + { + RefuseCommand($"the tab strip never offered to close {Snippet(windowId)}"); + return false; + } + + if (!MainWindowInFront()) + { + return false; + } + + CloseStripTab(windowId); + return true; + } + + /// A native +N ▾: the overflow list the cells recorded for that strip. Internal for tests. + internal bool OpenOfferedTabOverflow(string paneId) + { + var offered = _paneChrome?.Strips.FirstOrDefault(s => s.Model.PaneId == paneId); + if (offered?.Overflow is null) + { + RefuseCommand($"the tab strip never offered a list for {Snippet(paneId)}"); + return false; + } + + return MainWindowInFront() && OpenTabOverflow(paneId, new System.Drawing.Point(offered.Row.X + offered.Row.Width - 1, offered.Row.Y)); + } + + /// A native band's Jump to latest, checked against the bands last published. Internal for tests. + internal bool ReturnFromOfferedBand(string windowId) + { + if (_paneChrome?.Bands.Any(b => b.Model.WindowId == windowId) != true) + { + RefuseCommand($"no band offered to return {Snippet(windowId)}"); + return false; + } + + return MainWindowInFront() && ReturnToLiveTail(windowId); + } + + /// + /// The first column of a pane's strip, relative to the pane, at which the framework's own hit test finds the tab + /// showing , or -1. Internal for tests: where a cell click on that tab lands. + /// + internal int CellTabColumn(string paneId, string windowId) + { + SharpConsoleUI.Controls.TabControl? tabs; + lock (_paneTabsLock) + { + if (!_paneTabs.TryGetValue(paneId, out tabs)) + { + return -1; + } + } + + var index = _workspace.Layout.FindPane(paneId)?.Tabs.ToList().IndexOf(windowId) ?? -1; + var width = BoundsOf(tabs)?.Width ?? 0; + for (var x = 0; index >= 0 && x < width; x++) + { + if (FrameworkHitTests.TabAt(tabs, x) == index) + { + return x + 1; + } + } + + return -1; + } + + private bool Offered(string paneId, string windowId, out TabStripOverlay? strip) + { + strip = (_paneChrome ?? BuildPaneChrome()).Strips.FirstOrDefault(s => s.Model.PaneId == paneId); + return strip?.Model.Find(windowId) is not null; + } +} + +/// +/// The panes' own chrome, for a host that draws it natively over the cells: the tab strips (only where +/// ) and the scrolled-back bands. +/// +/// One per pane that shows a strip, in pane order. +/// One per pane whose front window is split by scrolling back. +/// The client's theme, from which the host derives its inks. +/// Whether the main window is in front; under a modal the chrome takes no click. +internal sealed record PaneChromeOverlay( + IReadOnlyList Strips, + IReadOnlyList Bands, + Theme Theme, + bool Interactive) +{ + public bool Equals(PaneChromeOverlay? other) => + other is not null && Strips.SequenceEqual(other.Strips) && Bands.SequenceEqual(other.Bands) + && ReferenceEquals(Theme, other.Theme) && Interactive == other.Interactive; + + public override int GetHashCode() => HashCode.Combine(Strips.Count, Bands.Count, Interactive); +} + +/// +/// One pane's tab strip, for a host that draws it over the strip's row. +/// +/// The strip's row, in desktop cells; the client paints it blank. +/// The strip as the cells wrote it. +/// The pane's own plane (its character's tint, the focus lift): the selected tab is drawn on it. +/// The strip's plane, one step recessed from the pane's: what the cells' idle chips wear. +/// Per tab, an unselected tab's own plane when it belongs to another character; else null. +/// The tabs the strip cannot show (), or null when all fit. +/// Brings a tab forward by pane and window id; any thread. +/// Closes a tab the strip offered a close on, by pane and window id; any thread. +/// Opens a tab's menu, by pane and window id; any thread. +/// Opens the overflow list, by pane id; any thread. +internal sealed record TabStripOverlay( + PaneRect Row, + TabStripModel Model, + string Plane, + string StripPlane, + IReadOnlyList Chips, + MenuModel? Overflow, + Action Activate, + Action Close, + Action Menu, + Action OpenOverflow) +{ + public bool Equals(TabStripOverlay? other) => + other is not null && Row == other.Row && Model.Equals(other.Model) && Plane == other.Plane + && StripPlane == other.StripPlane && Chips.SequenceEqual(other.Chips) && Equals(Overflow, other.Overflow) + && ReferenceEquals(Activate, other.Activate); + + public override int GetHashCode() => HashCode.Combine(Row, Model, Plane); +} + +/// A pane's scrolled-back band, for a host that draws it over the band's row. +/// The band's row, in desktop cells; its cells stay drawn under the host's band. +/// The band as the cells drew it. +/// The count as the cells show it, capped. +/// Takes the window back to its live tail, by window id; any thread. +internal sealed record ScrollBandOverlay(PaneRect Row, ScrollBandModel Model, string Count, Action Jump); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index e3bc86c8..0e725c29 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -118,6 +118,13 @@ private void RegisterHeaderDivider(SplitNode split, int index) return null; } + // A host that draws the strips takes the presses on its tabs; what reaches the cells is the strip's empty run, + // wherever the host's tabs end, so the whole blank row is the handle. + if (Host.Chrome.Tabs) + { + return new PaneRect(rect.X, rect.Y, rect.Width, 1); + } + var from = rect.Width; while (from > 0 && FrameworkHitTests.TabAt(tabs, from - 1) < 0) { @@ -420,6 +427,13 @@ private PointerTarget PaneTargetAt(string paneId, TabControl tabs, PaneRect rect { if (point.Y < rect.Y + tabs.TabHeaderHeight) { + // Where the host draws the strips, the framework's labels under them are blank cells: a press on the row + // that reaches the cells is past the host's last tab, nothing the framework's hit test should answer. + if (Host.Chrome.Tabs) + { + return PointerTarget.Nothing; + } + var index = FrameworkHitTests.TabAt(tabs, point.X - rect.X); var pages = tabs.TabPages; if (index < 0 || index >= pages.Count || pages[index].Tag is not string tabWindow) @@ -573,15 +587,7 @@ internal IReadOnlyList PointerMenu(System.Drawing.Point point) break; case PointerKind.Tab: - var tabWindow = target.Key.Split(':', 3)[2]; - Activate(tabWindow); - if (tabWindow != MainWindowId) - { - items.Add(new PointerMenuItem("Close tab", "⌃W", () => OnUiThread(() => CloseWindow(tabWindow)))); - } - - AddCommands(items, "layout:next-tab", null, "layout:split-right", "layout:split-down", "layout:zoom", "layout:unzoom", "layout:close"); - AddPopOut(items); + AddTabMenu(items, target.Key.Split(':', 3)[2]); break; case PointerKind.Link: @@ -621,6 +627,22 @@ internal IReadOnlyList PointerMenu(System.Drawing.Point point) return Tidy(items); } + /// + /// A tab's menu: the tab is brought forward, so every entry acts on it, then Close and the pane's own commands. One + /// list for a right click on a cell tab and on the window's native tab (). + /// + private void AddTabMenu(List items, string tabWindow) + { + Activate(tabWindow); + if (tabWindow != MainWindowId) + { + items.Add(new PointerMenuItem("Close tab", "⌃W", () => OnUiThread(() => CloseWindow(tabWindow)))); + } + + AddCommands(items, "layout:next-tab", null, "layout:split-right", "layout:split-down", "layout:zoom", "layout:unzoom", "layout:close"); + AddPopOut(items); + } + /// The window and payload of a link target, read back out of its key. private static (string WindowId, string Url, LinkPayload Payload)? LinkOf(PointerTarget target) { diff --git a/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs b/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs index 7f8c4e89..f76a0912 100644 --- a/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs +++ b/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs @@ -13,11 +13,21 @@ internal static class ScrollSplitBarRenderer /// (), so the label does not move as output arrives; the hints are dropped, last /// first, when the pane is too narrow for them, and the rule takes whatever is left. /// + public static string Bar(SharpMUTerm.Client.Chrome.ScrollBandModel band, int width, string accentHex) + { + ArgumentNullException.ThrowIfNull(band); + return Bar(band.RowsBack, width, accentHex); + } + + /// The count a band shows for : capped, as the status row caps it. + public static string Count(int rowsBack) => UnreadBadge.Format(Math.Max(1, rowsBack)); + + /// The bar for a count, as draws it. public static string Bar(int rowsBack, int width, string accentHex) { ArgumentException.ThrowIfNullOrEmpty(accentHex); - var count = UnreadBadge.Format(Math.Max(1, rowsBack)).PadLeft(UnreadBadge.FieldWidth); + var count = Count(rowsBack).PadLeft(UnreadBadge.FieldWidth); var label = $"{Glyphs.Scrollback} scrolled back {count} rows"; string[] hints = ["End returns", "⌥F freezes"]; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs index 9063a7ef..9d6432f1 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs @@ -1,4 +1,6 @@ using SharpConsoleUI; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Surfaces; using SharpConsoleUI.Controls; using SharpConsoleUI.Layout; using SharpConsoleUI.Builders; @@ -217,7 +219,8 @@ private bool RefreshScrollSplitBar(string windowId) var bar = ScrollSplitBarFor(windowId); var width = panel.ViewportWidth > 0 ? panel.ViewportWidth : 80; var below = panel.TotalContentHeight - panel.ViewportHeight - panel.VerticalScrollOffset; - var markup = ScrollSplitBarRenderer.Bar(below, width, _ink.Notice); + var band = Drawing(SurfaceCatalog.ScrollBand, windowId, new ScrollBandModel(windowId, below)); + var markup = ScrollSplitBarRenderer.Bar(band, width, _ink.Notice); if (!string.Equals(_scrollSplitBarText.GetValueOrDefault(windowId), markup, StringComparison.Ordinal)) { _scrollSplitBarText[windowId] = markup; @@ -267,6 +270,22 @@ private bool TryEndReturnsFromSplit(KeyPressedEventArgs e) } e.Handled = true; + ReturnToLiveTail(windowId); + return true; + } + + /// + /// Takes a split window back to its live tail: End's work, and what the window's native band's Jump to latest + /// ends in (). Internal so a test can drive it as the window does; returns + /// whether the window was split and is now following its tail. + /// + internal bool ReturnToLiveTail(string windowId) + { + if (!_scrollSplits.ContainsKey(windowId) || _paneScrolls.GetValueOrDefault(windowId) is not { } panel) + { + return false; + } + BackToLive(panel); SyncScrollbackState(); return true; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 7726e240..5e1b69bf 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1026,6 +1026,7 @@ public SharpMUTermApp( SyncTransparentColours(); PaintHeaderDividers(buffer); PaintTabOverflow(buffer); + BlankNativeTabStrips(buffer); DrawSixelOverlay(buffer); PublishScrollbars(); PublishPanels(); @@ -1036,11 +1037,16 @@ public SharpMUTermApp( SyncScrollSplitBars(); SyncChromeBarWidths(); SyncStatusMode(); + PublishPaneChrome(); }; // A modal that covers the main window entirely leaves it unpainted, so no PostBufferPaint says the native // panels are now under it; the modal stack changing says it instead. - _system.ModalStateService.StateChanged += (_, _) => PublishPanels(); + _system.ModalStateService.StateChanged += (_, _) => + { + PublishPanels(); + PublishPaneChrome(); + }; if (_sixel is not null) { // Another window over this one rewrites the cells a picture sits on, and the frame that puts @@ -10233,11 +10239,13 @@ private static string Snippet(string text) => /// private void OnTabChanged(string paneId, TabPage? newTab) { - _workspace.Layout.Focus(paneId); if (newTab?.Tag is string id) { - Activate(id); + ActivateStripTab(paneId, id); + return; } + + _workspace.Layout.Focus(paneId); } /// @@ -11531,21 +11539,16 @@ private IWindowControl BuildPaneTabs(PaneNode pane) { var builder = Controls.TabControl(); var ids = new List(); - var focused = IsFocusedPane(pane.Id); - foreach (var windowId in pane.Tabs) - { - if (_workspace.FindWindow(windowId) is not { } window) - { - continue; - } - // ▌ is the focus half of the signal and bold is the selection half; both read on a monochrome - // terminal, where a luminance step does not. - var selected = string.Equals(pane.ActiveTab, windowId, StringComparison.Ordinal); - builder.AddTab( - TabTitles.For( - window, ActiveCharacterKey(), focused && selected, selected, _ink, ChipFor(pane.Id, window)), - BuildTabContent(pane, windowId, window)); + // ▌ is the focus half of the signal and bold is the selection half; both read on a monochrome + // terminal, where a luminance step does not. The titles are the strip's model drawn as cells, the model the + // window's native strip draws (SurfaceCatalog.TabStrip). + var strip = Drawing(SurfaceCatalog.TabStrip, pane.Id, StripModelFor(pane.Id, pane.Tabs, pane.ActiveTab, ActiveCharacterKey())); + var titles = TabTitles.Strip(strip, _ink, ChipOf(pane.Id)); + for (var i = 0; i < strip.Tabs.Count; i++) + { + var windowId = strip.Tabs[i].WindowId; + builder.AddTab(titles[i], BuildTabContent(pane, windowId, _workspace.FindWindow(windowId)!)); ids.Add(windowId); } @@ -12877,6 +12880,20 @@ private void OnDriverMouseEvent(object sender, List flags, System.Dr // thread; the copy is because the driver may reuse its list. var frame = flags.ToList(); OnUiThread(() => OnPointerFrame(frame, point)); + try + { + RouteDriverMouseEvent(flags, point); + } + finally + { + // A strip row the host draws over: the press is the client's own (the divider, a window drag), never the + // framework's, whose labels under it are blank cells. Struck last, so the tracker above saw the frame whole. + TakesNativeStripPress(flags, point); + } + } + + private void RouteDriverMouseEvent(List flags, System.Drawing.Point point) + { // A press on a tab strip's +N ▾ chip opens its list and nothing else: the framework, which reads this same list // after us, is left a pointer movement rather than a click on the tab under the chip. @@ -13269,7 +13286,7 @@ private void OnTabCloseRequested(TabPage tab) { if (tab.Tag is string windowId) { - OnUiThread(() => CloseWindow(windowId)); + OnUiThread(() => CloseStripTab(windowId)); } } @@ -13575,59 +13592,81 @@ private void RetitlePane(string paneId, TabControl tabs, string? focusedCharacte { var activeTab = _workspace.Layout.FindPane(paneId)?.ActiveTab; var pages = tabs.TabPages; - var costs = new List(pages.Count); - var windows = new WorkspaceWindow?[pages.Count]; - var full = new string?[pages.Count]; + // The × follows the active tab, so keep it in step with every title refresh — and it has to be settled before + // the strip is costed, because it is one of the cells being counted. + var ids = new List(pages.Count); for (var i = 0; i < pages.Count; i++) { - var page = pages[i]; - var id = page.Tag as string; - var window = id is not null ? _workspace.FindWindow(id) : null; - var selected = id is not null && string.Equals(activeTab, id, StringComparison.Ordinal); - - // The × follows the active tab, so keep it in step with every title refresh — and it has to - // be settled before the strip is costed, because it is one of the cells being counted. - if (id is not null && window is not null) + if (pages[i].Tag is string id && _workspace.FindWindow(id) is not null) { - page.IsClosable = CanCloseTab(id, activeTab); + pages[i].IsClosable = CanCloseTab(id, activeTab); + ids.Add(id); } + } + var strip = Drawing(SurfaceCatalog.TabStrip, paneId, StripModelFor(paneId, ids, activeTab, focusedCharacter)); + var chipOf = ChipOf(paneId); + var full = TabTitles.Strip(strip, _ink, chipOf); + var costs = new List(pages.Count); + var tabAt = new int[pages.Count]; + var next = 0; + for (var i = 0; i < pages.Count; i++) + { + var page = pages[i]; var frame = 2 + (page.IsClosable ? 1 : 0) + (i < pages.Count - 1 ? 1 : 0); - if (window is null) + var selected = page.Tag is string pageId && string.Equals(activeTab, pageId, StringComparison.Ordinal); + if (next >= strip.Tabs.Count || !string.Equals(page.Tag as string, strip.Tabs[next].WindowId, StringComparison.Ordinal)) { + tabAt[i] = -1; costs.Add(new TabCost(0, 0, MarkupText.VisibleLength(page.Title) + frame, selected)); continue; } - var title = TabTitles.For( - window, focusedCharacter, IsFocusedPane(paneId) && selected, selected, _ink, - ChipFor(paneId, window)); - var name = TabTitles.Name(window).Length; - - windows[i] = window; - full[i] = title; - costs.Add(new TabCost( - name, window.Title.Length, MarkupText.VisibleLength(title) - name + frame, selected)); + var tab = strip.Tabs[next]; + tabAt[i] = next; + var name = tab.Name.Length; + costs.Add(new TabCost(name, tab.Title.Length, MarkupText.VisibleLength(full[next]) - name + frame, selected)); + next++; } var budgets = TabStripFit.Budgets(costs, _stripWidths.GetValueOrDefault(paneId)); for (var i = 0; i < pages.Count; i++) { - if (windows[i] is not { } window) + if (tabAt[i] is var t and >= 0) { - continue; + var tab = strip.Tabs[t]; + pages[i].Title = budgets[i] >= costs[i].NameLength + ? full[t] + : TabTitles.For(tab, strip.Focused && tab.Selected, _ink, chipOf(tab), budgets[i]); } + } + } - var selected = costs[i].Selected; - pages[i].Title = budgets[i] >= costs[i].NameLength - ? full[i]! - : TabTitles.For( - window, focusedCharacter, IsFocusedPane(paneId) && selected, selected, _ink, - ChipFor(paneId, window), budgets[i]); + /// + /// A pane's tab strip as data (): one tab per window in + /// that still exists, in strip order. What the cells write into the tab titles and what a host that draws the strips + /// () is handed are this one model. + /// + private TabStripModel StripModelFor(string paneId, IEnumerable windowIds, string? activeTab, string? focusedCharacter) + { + var tabs = new List(); + foreach (var id in windowIds) + { + if (_workspace.FindWindow(id) is { } window) + { + var selected = string.Equals(activeTab, id, StringComparison.Ordinal); + tabs.Add(TabChipModel.From(window, focusedCharacter, selected, CanCloseTab(id, activeTab))); + } } + + return new TabStripModel(paneId, IsFocusedPane(paneId), tabs); } + /// The plane each unselected tab of a pane is drawn on (), by its model. + private Func ChipOf(string paneId) => + tab => _workspace.FindWindow(tab.WindowId) is { } window ? ChipFor(paneId, window) : null; + /// /// Re-measures each strip against the pane it was just arranged into, and re-titles the ones that /// moved. It rides PostBufferPaint beside and for that diff --git a/src/SharpMUTerm.Tui/TabTitles.cs b/src/SharpMUTerm.Tui/TabTitles.cs index fa6de88f..54b9ca56 100644 --- a/src/SharpMUTerm.Tui/TabTitles.cs +++ b/src/SharpMUTerm.Tui/TabTitles.cs @@ -1,3 +1,4 @@ +using SharpMUTerm.Client.Chrome; using SharpMUTerm.Core.Workspaces; namespace SharpMUTerm.Tui; @@ -60,27 +61,50 @@ public static string For( int nameBudget = 0) { ArgumentNullException.ThrowIfNull(window); + return For(TabChipModel.From(window, focusedCharacterKey, selected, closable: false), focusedPane, ink, chip, nameBudget); + } + + /// + /// Every title of a strip, drawn from its model (): the cells' renderer of the tab-strip + /// surface, whose model the window's native strip draws. gives an unselected tab its own + /// plane; , when given, is each name's budget (). + /// + public static List Strip( + TabStripModel strip, ChromeInk? ink, Func chipFor, IReadOnlyList? budgets = null) + { + ArgumentNullException.ThrowIfNull(strip); + ArgumentNullException.ThrowIfNull(chipFor); + var titles = new List(strip.Tabs.Count); + for (var i = 0; i < strip.Tabs.Count; i++) + { + var tab = strip.Tabs[i]; + titles.Add(For(tab, strip.Focused && tab.Selected, ink, chipFor(tab), budgets is null ? 0 : budgets[i])); + } + + return titles; + } + + /// One tab's title from its model; 's work. + public static string For(TabChipModel tab, bool focusedPane, ChromeInk? ink, TabChip? chip, int nameBudget = 0) + { + ArgumentNullException.ThrowIfNull(tab); - var name = MarkupText.Escape(Elide(window, nameBudget)); + var name = MarkupText.Escape(Elide(tab, nameBudget)); // Capped through the sidebar's own formatter, so the two surfaces reading one number cannot print // different answers and a count from the wire cannot push a narrow strip's later tabs off the end. - var unread = window.Unread > 0 ? $" ({UnreadBadge.Format(window.Unread)})" : string.Empty; - var pen = window.HasUnsentInput ? $" {Glyphs.Draft}" : string.Empty; + var unread = tab.Unread > 0 ? $" ({UnreadBadge.Format(tab.Unread)})" : string.Empty; + var pen = tab.Draft ? $" {Glyphs.Draft}" : string.Empty; // ⌁ marks a window owned by a character other than the focused one. - var cross = focusedCharacterKey is not null - && window.SessionKey is not null - && !string.Equals(window.SessionKey, focusedCharacterKey, StringComparison.Ordinal) - ? " ⌁" - : string.Empty; + var cross = tab.Foreign ? " ⌁" : string.Empty; var focus = focusedPane ? Glyphs.FocusedPane + " " : string.Empty; // Tint and weight cover the name and count only: the ▌ ahead and the ✎ / ⌁ behind are other // facts. One tag rather than two nested, because a selected tab can also be unread. var named = name + unread; - var style = (selected, window.Unread > 0) switch + var style = (tab.Selected, tab.Unread > 0) switch { (true, true) => $"bold {UnreadBadge.TintFor(ink)}", (true, false) => "bold", @@ -91,7 +115,7 @@ public static string For( // The chip is the tab's own plane, which only an unselected tab carries — the selected one is // painted by the strip, in the plane its page is on. Foreground first so an unread tab keeps its // accent: the plane says whose window this is, the accent says it has something new. - if (chip is { } tile && !selected) + if (chip is { } tile && !tab.Selected) { style = $"{style ?? tile.Ink} on {tile.Plane}"; } @@ -126,16 +150,16 @@ public static string Name(WorkspaceWindow window) /// the chip behind the tab already says whose window this is, and cutting from the front would spend /// the surviving cells on Corvid… — the half that every other tab in the strip repeats. /// - private static string Elide(WorkspaceWindow window, int budget) + private static string Elide(TabChipModel tab, int budget) { - var name = Name(window); + var name = tab.Name; if (budget <= 0 || name.Length <= budget) { return name; } - return window.Title.Length <= budget - ? window.Title - : window.Title[..Math.Max(1, budget - 1)] + "…"; + return tab.Title.Length <= budget + ? tab.Title + : tab.Title[..Math.Max(1, budget - 1)] + "…"; } } diff --git a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs index d8f629b2..7c7d8f68 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/HostParityTests.cs @@ -27,17 +27,22 @@ public partial class HostParityTests public static IEnumerable Views() => SnapshotViews.All.Select(v => v ?? "(default)"); /// - /// Every view under both chrome arrangements: the client's chrome in cells (the terminal's, and the window's with - /// --cell-chrome), and the header and rail drawn by the host (the window as a person runs it). Both hosts - /// are told the same arrangement each time, so the comparison is still of drivers and nothing else, over every - /// cell either one draws. + /// Every view under each chrome arrangement: the client's chrome in cells (the terminal's, and the window's with + /// --cell-chrome), the header and rail drawn by the host, and those with every pane's tab strip drawn by the + /// host too (the window as a person runs it, whose strip rows the client paints blank). Both hosts are told the same + /// arrangement each time, so the comparison is still of drivers and nothing else, over every cell either one draws. /// - public static IEnumerable<(string View, bool HostChrome)> ViewsUnderBothChromes() => + public static IEnumerable<(string View, string HostChrome)> ViewsUnderBothChromes() => from view in Views() - from native in new[] { false, true } - select (view, native); + from chrome in new[] { "cells", "header-and-rail", "native" } + select (view, chrome); - private static HostChrome ChromeFor(bool native) => native ? HostChrome.HeaderAndRail : HostChrome.None; + private static HostChrome ChromeFor(string chrome) => chrome switch + { + "native" => HostChrome.Native, + "header-and-rail" => HostChrome.HeaderAndRail, + _ => HostChrome.None, + }; /// /// A view drawn in the window is the view drawn in the terminal, cell for cell. What this catches is the @@ -46,7 +51,7 @@ from view in Views() /// [Test] [MethodDataSource(nameof(ViewsUnderBothChromes))] - public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string name, bool hostChrome) + public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string name, string hostChrome) { var view = name == "(default)" ? null : name; var chrome = ChromeFor(hostChrome); @@ -83,7 +88,7 @@ public async Task EveryViewDrawsTheSameCellsInTheWindowAsInTheTerminal(string na [MethodDataSource(nameof(Views))] public async Task EveryViewDrawsTheSameCellsWhenTheWindowsLoopIsRunning(string name) { - var chrome = HostChrome.HeaderAndRail; + var chrome = HostChrome.Native; var view = name == "(default)" ? null : name; if (view is "timestamps" or "timestamps-toggled") { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs index 62104f46..492b511d 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs @@ -377,7 +377,7 @@ public async Task APressOnEmptyHeaderSpaceMovesTheWindowAndNeverReachesTheClient public async Task TheLiveClientDrawsNoChromeCellAndLaysThePanesOutAsATerminalToldTheSame(string view) { using var headless = new HeadlessConsoleDriver(120, 32); - await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.HeaderAndRail }); + await using var terminal = new SharpMUTermApp(DemoScene.Build(), ClientHost.Headless(headless, WindowOptions.Capabilities) with { Chrome = HostChrome.Native }); terminal.RenderSnapshot(view); using var driver = new AvaloniaConsoleDriver(120, 32); @@ -394,7 +394,7 @@ public async Task TheLiveClientDrawsNoChromeCellAndLaysThePanesOutAsATerminalTol var chrome = driver.Pointer.Chrome; await Assert.That(chrome).IsNotNull(); - await Assert.That(chrome!.Drawn).IsEqualTo(HostChrome.HeaderAndRail); + await Assert.That(chrome!.Drawn).IsEqualTo(HostChrome.Native); await Assert.That(chrome.Sidebar).IsEqualTo(window.BuildSidebar()); await Assert.That(window.LaidOutRows.Header).IsEqualTo(0); await Assert.That(Enumerable.Range(0, 32).Any(y => driver.Frame.RowText(y).Contains("muterm", StringComparison.Ordinal))).IsFalse() diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 23cbdcac..82559c3e 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -343,6 +343,27 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! covered.Add(SurfaceCatalog.TabOverflow); } + // The panes' tab strips and the scrolled-back band: each is handed the model the cells were titled or drawn from. + foreach (var view in new[] { "tabs", "scrollback-split" }) + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot(view); + var panes = driver.Pointer.PaneChrome; + await Assert.That(panes).IsNotNull().Because($"{view}: the pane chrome was published"); + foreach (var strip in panes!.Strips) + { + await Assert.That(app.DrawnModel(SurfaceCatalog.TabStrip, strip.Model.PaneId)).IsEqualTo((object)strip.Model).Because($"{view}: tab-strip {strip.Model.PaneId}"); + covered.Add(SurfaceCatalog.TabStrip); + } + + foreach (var band in panes.Bands) + { + await Assert.That(app.DrawnModel(SurfaceCatalog.ScrollBand, band.Model.WindowId)).IsEqualTo((object)band.Model).Because($"{view}: scroll-band"); + covered.Add(SurfaceCatalog.ScrollBand); + } + } + var drawnNatively = SurfaceCatalog.All.Where(s => s.On(SurfaceHosts.Window).HasFlag(SurfaceDrawing.Native)).Select(s => s.Id); await Assert.That(covered).IsEquivalentTo(drawnNatively).Because("every surface the window draws natively has its model compared here"); } @@ -945,6 +966,27 @@ await SameModal("history view: scroll", "search-history", probed.Add(SurfaceCatalog.TabOverflow); + // A tab: the native click and the cell click on the same tab bring the same window forward in the same pane. + await Same("tab-strip: tab", "tabs", + (app, _) => + { + var strip = app.PaneChromePublished!.Strips.First(s => !s.Model.Focused && s.Model.Tabs.Count > 1); + app.ActivateOfferedStripTab(strip.Model.PaneId, strip.Model.Tabs.First(t => !t.Selected).WindowId); + }, + (app, _) => + { + var strip = app.BuildPaneChrome().Strips.First(s => !s.Model.Focused && s.Model.Tabs.Count > 1); + var window = strip.Model.Tabs.First(t => !t.Selected).WindowId; + app.SimulateTabStripClick(strip.Model.PaneId, app.CellTabColumn(strip.Model.PaneId, window), 0); + }); + probed.Add(SurfaceCatalog.TabStrip); + + // The band's Jump to latest ends where End does: the split closes and the pane follows its live tail again. + await Same("scroll-band: jump to latest", "scrollback-split", + (app, _) => app.ReturnFromOfferedBand(app.PaneChromePublished!.Bands.Single().Model.WindowId), + (app, _) => app.DispatchCommand(ScrollBandModel.LiveCommand)); + probed.Add(SurfaceCatalog.ScrollBand); + await Assert.That(probed).IsEquivalentTo(acting).Because("every native surface with actions has a probe here"); } @@ -1205,6 +1247,7 @@ private static string Outcome(SharpMUTermApp app) => string.Join( "map=" + app.MapDigest(), "rail=" + (app.BuildChromeOverlay().Sidebar.Collapsed ? "folded" : "open"), "floating=" + string.Join(",", app.FloatingPublished.Select(f => f.Model.WindowId)), + "split=" + string.Join(",", app.PaneWindows().Values.Where(app.IsScrollSplit)), "notice=" + app.LastNotice, "recent=" + string.Join(",", app.RecentCommandIds)); diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs index 0f1e4f44..74f11121 100644 --- a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -73,7 +73,7 @@ public async Task PanelSurfacesAreKnownPanels() var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose - or SurfaceCatalog.FloatingPanel or SurfaceCatalog.TabOverflow) + or SurfaceCatalog.FloatingPanel or SurfaceCatalog.TabOverflow or SurfaceCatalog.TabStrip or SurfaceCatalog.ScrollBand) && !SurfaceCatalog.Modals.Contains(s.Id)); foreach (var surface in panels) { diff --git a/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs new file mode 100644 index 00000000..98030196 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs @@ -0,0 +1,159 @@ +using System.Drawing; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A host that draws the panes' tab strips () is handed each strip as the model the cells' +/// titles are written from, the client paints each strip's row blank under it, and nothing moves: the pane rectangles, +/// and so what every world is told over NAWS, are the terminal's. Every gesture on a native strip, and on the native +/// scrolled-back band, ends in the method the cell gesture ends in, and only if the client offered it. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class NativeTabStripTests +{ + private const int Width = 120; + private const int Height = 32; + + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private sealed class PanePresenter : IPointerPresenter + { + public List Published { get; } = []; + + public List> Menus { get; } = []; + + public void Hover(PointerTarget target) + { + } + + public void ShowMenu(Point cell, IReadOnlyList items) => Menus.Add(items); + + public bool DrawsMenus => true; + + public void Scrollbars(IReadOnlyList bars) + { + } + + public void PaneChrome(PaneChromeOverlay chrome) => Published.Add(chrome); + } + + private static SharpMUTermApp App(HostChrome chrome, out string frame, string? view, IPointerPresenter? pointer = null) + { + Console.SetIn(TextReader.Null); + var host = ClientHost.Headless(new HeadlessConsoleDriver(Width, Height), Caps) with { Chrome = chrome, Pointer = pointer }; + var app = new SharpMUTermApp(DemoScene.Build(), host); + frame = app.RenderSnapshot(view); + app.RenderNextFrame(); + return app; + } + + [Test] + public async Task TheStripRowStaysAndNothingMoves() + { + await using var cells = App(HostChrome.HeaderAndRail, out _, "split"); + await using var native = App(HostChrome.Native, out _, "split"); + + await Assert.That(native.PaneOutputRects()).IsEquivalentTo(cells.PaneOutputRects()); + } + + [Test] + public async Task EachStripRowIsBlankWhereTheHostDrawsItAndTheModelIsWhatTheCellsWrote() + { + var pointer = new PanePresenter(); + await using var cellApp = App(HostChrome.HeaderAndRail, out var cellFrame, "tabs"); + await using var app = App(HostChrome.Native, out var frame, "tabs", pointer); + + var chrome = pointer.Published.Last(); + await Assert.That(chrome.Strips.Count).IsGreaterThanOrEqualTo(2).Because("one strip per pane of the split"); + var rows = FrameGrid.Decode(frame, Width, Height); + var cellRows = FrameGrid.Decode(cellFrame, Width, Height); + foreach (var strip in chrome.Strips) + { + await Assert.That((object)strip.Model).IsEqualTo(app.DrawnModel(SurfaceCatalog.TabStrip, strip.Model.PaneId)); + var row = rows[strip.Row.Y].Substring(strip.Row.X, strip.Row.Width); + await Assert.That(row.Trim()).IsEmpty().Because($"the strip of {strip.Model.PaneId} is the host's to draw"); + var first = strip.Model.Tabs[0].Name; + await Assert.That(cellRows[strip.Row.Y]).Contains(first[..Math.Min(4, first.Length)]).Because("the terminal still writes it"); + } + + await Assert.That(chrome.Strips.Count(s => s.Model.Focused)).IsEqualTo(1); + } + + [Test] + public async Task AHostThatDrawsNoStripsIsHandedNone() + { + var pointer = new PanePresenter(); + await using var app = App(HostChrome.HeaderAndRail, out _, "tabs", pointer); + await Assert.That(pointer.Published.Last().Strips).IsEmpty(); + } + + [Test] + public async Task ANativeTabClickBringsTheWindowForwardAndARefusedOneDoesNothing() + { + var pointer = new PanePresenter(); + await using var app = App(HostChrome.Native, out _, "tabs", pointer); + var strip = pointer.Published.Last().Strips.First(s => s.Model.Tabs.Count > 1 && !s.Model.Focused); + var other = strip.Model.Tabs.First(t => !t.Selected); + + await Assert.That(app.ActivateOfferedStripTab(strip.Model.PaneId, "no-such-window")).IsFalse(); + await Assert.That(app.ActivateOfferedStripTab(strip.Model.PaneId, other.WindowId)).IsTrue(); + await Assert.That(app.ActiveWindowId()).IsEqualTo(other.WindowId); + } + + [Test] + public async Task OnlyAClosableTabIsClosedAndARightClickShowsTheTabsMenu() + { + var pointer = new PanePresenter(); + await using var app = App(HostChrome.Native, out _, "tabs", pointer); + var strip = pointer.Published.Last().Strips.First(s => s.Model.Focused); + var main = strip.Model.Tabs.First(t => !t.Closable); + + await Assert.That(app.CloseOfferedStripTab(strip.Model.PaneId, main.WindowId)).IsFalse().Because("the main window has no close"); + await Assert.That(app.OpenTabMenu(strip.Model.PaneId, main.WindowId)).IsTrue(); + await Assert.That(pointer.Menus.Last().Any(i => i.Label == "Split right" || i.Label.StartsWith("Split", StringComparison.Ordinal))).IsTrue(); + } + + [Test] + public async Task APressOnAStripRowNeverReachesTheFrameworkThere() + { + var pointer = new PanePresenter(); + await using var app = App(HostChrome.Native, out _, "tabs", pointer); + var row = pointer.Published.Last().Strips[0].Row; + var frame = new List { MouseFlags.Button1Pressed }; + await Assert.That(app.TakesNativeStripPress(frame, new Point(row.X + 1, row.Y))).IsTrue(); + await Assert.That(frame).IsEquivalentTo(new[] { MouseFlags.ReportMousePosition }); + + var below = new List { MouseFlags.Button1Pressed }; + await Assert.That(app.TakesNativeStripPress(below, new Point(row.X + 1, row.Y + 2))).IsFalse(); + } + + [Test] + public async Task TheBandIsPublishedAndItsButtonEndsWhereEndDoes() + { + var pointer = new PanePresenter(); + await using var app = App(HostChrome.Native, out _, "scrollback-split", pointer); + var band = pointer.Published.Last().Bands.Single(); + await Assert.That((object)band.Model).IsEqualTo(app.DrawnModel(SurfaceCatalog.ScrollBand, band.Model.WindowId)); + await Assert.That(band.Model.RowsBack).IsGreaterThan(0); + await Assert.That(app.IsScrollSplit(band.Model.WindowId)).IsTrue(); + + await Assert.That(app.ReturnFromOfferedBand("no-such-window")).IsFalse(); + await Assert.That(app.ReturnFromOfferedBand(band.Model.WindowId)).IsTrue(); + await Assert.That(app.IsScrollSplit(band.Model.WindowId)).IsFalse(); + } + + [Test] + public async Task TheBandIsHandedToAHostThatDrawsNoStripsToo() + { + var pointer = new PanePresenter(); + await using var app = App(HostChrome.None, out _, "scrollback-split", pointer); + await Assert.That(pointer.Published.Last().Bands).Count().IsEqualTo(1); + await Assert.That(pointer.Published.Last().Strips).IsEmpty(); + } +} From a2308d7b07fa40f22155e8b83107adb69e7221f4 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 17:39:23 +0000 Subject: [PATCH 067/113] Wave 19 slice E: the window's floating surfaces in the mockup's language NativeTokens' Dark canon is the mockup's palette (card #171b24, raised #1d2333, a Well #10131a for inputs, Edge #2c3447, Focus #3a4f73, selected #1f3a3a, ink #d7deec/#9aa4b8, #0f1620 on the accent); Light and Solarized derive as before and every ink is still held to 4.5:1, the well included. ModalParts gains a sunk search box with a magnifier, mono key caps, an accent bar on the selected row and a footer band; the palette, search, history, help, layouts and script console use them. Toasts are rounded on a soft shadow with an inset severity bar; menus take the palette's row height, mono dim keys, and no white popup corners. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 3 + CLAUDE.md | 11 +- src/SharpMUTerm.Avalonia/HelpView.cs | 4 +- src/SharpMUTerm.Avalonia/HistoryView.cs | 4 +- src/SharpMUTerm.Avalonia/LayoutsView.cs | 2 +- src/SharpMUTerm.Avalonia/ModalParts.cs | 110 +++++++++++++++--- src/SharpMUTerm.Avalonia/NativeMenu.cs | 41 ++++++- src/SharpMUTerm.Avalonia/NativeTokens.cs | 69 +++++++---- src/SharpMUTerm.Avalonia/NoticeToasts.cs | 30 ++--- src/SharpMUTerm.Avalonia/PaletteOverlay.cs | 53 +++++---- src/SharpMUTerm.Avalonia/ScriptConsoleView.cs | 2 +- src/SharpMUTerm.Avalonia/SearchView.cs | 4 +- .../NativeTokenTests.cs | 6 +- 13 files changed, 251 insertions(+), 88 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 057cacdb..c6b1b947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -356,6 +356,9 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- In the desktop window, ⌃P, the quit prompt, search, history, layouts, help, the script console, toasts and the + right-click menu now match the window's new look: blue-grey cards, search boxes sunk into the page with a magnifier, + keys drawn as small key caps, an accent bar on the selected row, and a footer band naming the keys. - The older-history page fits an 80×24 terminal: it sizes its page to the screen, keeps its keys on screen and no longer covers the command line. - Ctrl+F with older history says both counts on one line (`this window 3 of 39 · older 4 of 6,000`). Older matches say diff --git a/CLAUDE.md b/CLAUDE.md index fe6c9950..857aea99 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2237,7 +2237,7 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] - **The window has one design language: `NativeTokens`** (Avalonia). Planes (card, raised, selected, scrim), edge and rule, inks (text, dim, header, accent, warn, notice, accent and key inks), radii `RadiusS/M/L` 4/8/12 and the type ramp `Small/Body/Title/Heading` 11/12/14/18 (`Miniature` 9 only for a theme card's preview). Derived - from the client's `Theme` the `ScreenTheme` way: a canonical Dark (`#1e1e25` card) and Light (white) set, the + from the client's `Theme` the `ScreenTheme` way: a canonical Dark (the mockup's: `#171b24` card) and Light (white) set, the theme background's hue shift added, every ink held to `TextFloor` 4.5:1 on each plane it is drawn on; the accent is the client's teal, never Fluent's blue. `Apply` sets the Fluent keys on a scope and `ApplySimple` the Simple theme's (menus). The settings window, list editor, package page, theme cards, menus, palette and @@ -2245,6 +2245,15 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] `SettingsForm.Theme`). `NativeTokenTests.NoViewWritesALiteralFontSizeOrColour` fails on a literal `FontSize =` number or `Color.Parse("#` anywhere in the window's assembly outside `NativeTokens.cs`; widen its allow-list only with a reason. A quiet line is the `Dim` ink, never an opacity (an opacity is not floor-checked). + - **The floating surfaces are the mockup's cards** (wave 19, `ux-mockups/Main.dc.html`). Dark's canon is the mockup's + palette: card `#171b24`, raised `#1d2333`, `Well` `#10131a` (the ground an input sits in), `Edge` `#2c3447`, `Focus` + `#3a4f73`, selected `#1f3a3a`, ink `#d7deec`/`#9aa4b8`, `#0f1620` on the accent. Every ⌃P and modal search box is sunk + (`ModalParts.Sunk`: the well, a rule turning to `Focus`, a magnifier); a key is a cap in the cells' mono + (`ModalParts.Chip`, `NativeTokens.KeyFace`); a selected row is the selected plane plus a `MarkWidth` accent bar on its + left (`ModalParts.Mark`); a modal's key line is a band on the card's foot in the well (`ModalParts.Footer`). Toasts are + rounded on `ShadowSmall` with the severity as an inset bar, still on the client's `NoticePalette` plane; menus take + the palette's row height, keys in the mono and the dim ink, and the popup's own window shows the card's plane in the + rounded corners where it cannot be transparent. - **The settings window is the palette's modal**: undecorated with its own title bar (title, ✕, Esc, drag to move), the tokens' card and edge, and a scrim over the main window (`SettingsPresenter.Scrim`; a press on it closes). Opened from the trigger builder (`SettingsForm.BesideOutput`) it is docked to the main window's right diff --git a/src/SharpMUTerm.Avalonia/HelpView.cs b/src/SharpMUTerm.Avalonia/HelpView.cs index 39b610bf..d1289d79 100644 --- a/src/SharpMUTerm.Avalonia/HelpView.cs +++ b/src/SharpMUTerm.Avalonia/HelpView.cs @@ -39,7 +39,7 @@ public HelpView(HelpSession session, NativeTokens colours, Action done) _colours = colours; _done = done; - _box = ModalParts.SearchBox("Search help: keys, slash commands, how-tos…", "Search help"); + _box = ModalParts.SearchBox("Search help: keys, slash commands, how-tos…", "Search help", colours); SetDock(_box, Dock.Top); Children.Add(_box); @@ -339,7 +339,7 @@ private void Highlight() { for (var i = 0; i < _rows.Count; i++) { - _rows[i].Background = i == _selected ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + ModalParts.Mark(_rows[i], i == _selected, _colours); } if (_selected < _rows.Count) diff --git a/src/SharpMUTerm.Avalonia/HistoryView.cs b/src/SharpMUTerm.Avalonia/HistoryView.cs index eb8e2ba7..107df297 100644 --- a/src/SharpMUTerm.Avalonia/HistoryView.cs +++ b/src/SharpMUTerm.Avalonia/HistoryView.cs @@ -34,7 +34,7 @@ public HistoryView(HistorySession session, NativeTokens colours, Action done) _done = done; var model = session.Model; - _box = ModalParts.SearchBox("Filter the history…", "Filter the history"); + _box = ModalParts.SearchBox("Filter the history…", "Filter the history", colours); SetDock(_box, Dock.Top); Children.Add(_box); @@ -152,7 +152,7 @@ private void Highlight() { for (var i = 0; i < _rows.Count; i++) { - _rows[i].Background = i == _selected ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + ModalParts.Mark(_rows[i], i == _selected, _colours); } if (_selected < _rows.Count) diff --git a/src/SharpMUTerm.Avalonia/LayoutsView.cs b/src/SharpMUTerm.Avalonia/LayoutsView.cs index ffa400cd..0eeebdb7 100644 --- a/src/SharpMUTerm.Avalonia/LayoutsView.cs +++ b/src/SharpMUTerm.Avalonia/LayoutsView.cs @@ -308,7 +308,7 @@ private void Highlight() for (var i = 0; i < _rows.Count; i++) { var mine = _rowIndex[i] == _selected; - _rows[i].Background = mine ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + ModalParts.Mark(_rows[i], mine, _colours); if (mine) { _rows[i].BringIntoView(); diff --git a/src/SharpMUTerm.Avalonia/ModalParts.cs b/src/SharpMUTerm.Avalonia/ModalParts.cs index b523c738..5adeb142 100644 --- a/src/SharpMUTerm.Avalonia/ModalParts.cs +++ b/src/SharpMUTerm.Avalonia/ModalParts.cs @@ -17,7 +17,7 @@ internal static class ModalParts FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold, Foreground = colours.Brush(colours.Text), - Margin = new Thickness(20, 16, 20, 4), + Margin = new Thickness(20, 18, 20, 4), TextWrapping = TextWrapping.Wrap, }; @@ -31,14 +31,20 @@ internal static class ModalParts TextWrapping = TextWrapping.Wrap, }; - /// The keys the modal answers, right-aligned under it, in the window's words. + /// + /// The keys the modal answers, in the window's words, on a band along the card's foot — the mockup's footer: the + /// ground the card's inputs sit in, ruled off above, the keys right-aligned on it. + /// public static TextBlock Footer(string text, NativeTokens colours) => new() { Text = NativeKeys.Words(text), FontSize = NativeTokens.Small, Foreground = colours.Brush(colours.Dim), - Margin = new Thickness(20, 8, 20, 12), - HorizontalAlignment = HorizontalAlignment.Right, + Background = colours.Brush(colours.Well), + Padding = new Thickness(20, 9, 20, 10), + Margin = new Thickness(0, 10, 0, 0), + HorizontalAlignment = HorizontalAlignment.Stretch, + TextAlignment = TextAlignment.Right, TextWrapping = TextWrapping.Wrap, }; @@ -53,21 +59,67 @@ internal static class ModalParts Margin = new Thickness(12, first ? 8 : 14, 12, 4), }; - /// A search box, the palette's. - public static TextBox SearchBox(string placeholder, string name) + /// + /// A search box, the palette's: the mockup's header search — sunk into the ground the page sits on, a rule for its + /// edge that turns to the focused edge while it has the keyboard, a magnifier before the text. + /// + public static TextBox SearchBox(string placeholder, string name, NativeTokens? colours = null) { var box = new TextBox { PlaceholderText = placeholder, FontSize = NativeTokens.Title, - Margin = new Thickness(14, 14, 14, 6), - Padding = new Thickness(12, 8), + Margin = new Thickness(14, 14, 14, 8), + Padding = new Thickness(8, 9, 12, 9), CornerRadius = new CornerRadius(NativeTokens.RadiusM), }; + if (colours is not null) + { + Sunk(box, colours); + } + global::Avalonia.Automation.AutomationProperties.SetName(box, name); return box; } + /// + /// Sinks into the ground (), its edge a rule that becomes + /// while it has the keyboard, with a magnifier before the text when + /// . + /// + public static void Sunk(TextBox box, NativeTokens colours, bool magnifier = true) + { + var well = colours.Brush(colours.Well); + foreach (var key in new[] { "TextControlBackground", "TextControlBackgroundPointerOver", "TextControlBackgroundFocused" }) + { + box.Resources[key] = well; + } + + box.Resources["TextControlBorderBrush"] = colours.Brush(colours.Edge); + box.Resources["TextControlBorderBrushPointerOver"] = colours.Brush(colours.Focus); + box.Resources["TextControlBorderBrushFocused"] = colours.Brush(colours.Focus); + box.Resources["TextControlBorderThemeThicknessFocused"] = new Thickness(1); + if (magnifier) + { + box.InnerLeftContent = Magnifier(colours); + } + } + + /// The magnifier the mockup draws in its search box, in the quiet ink. + public static Control Magnifier(NativeTokens colours) => new global::Avalonia.Controls.Shapes.Path + { + Data = Geometry.Parse("M 6.5 1 A 5.5 5.5 0 1 1 6.5 12 A 5.5 5.5 0 1 1 6.5 1 Z M 10.5 10.5 L 14 14"), + Stroke = colours.Brush(colours.Dim), + StrokeThickness = 1.6, + StrokeLineCap = PenLineCap.Round, + Width = 15, + Height = 15, + Stretch = Stretch.None, + Margin = new Thickness(12, 0, 2, 0), + VerticalAlignment = VerticalAlignment.Center, + IsHitTestVisible = false, + }; + /// A list of rows that scrolls, ruled above and below. public static (Border Frame, StackPanel List, ScrollViewer Scroller) List(NativeTokens colours) { @@ -93,8 +145,10 @@ public static Border Row(Control content, string name, Action select, Action cho var row = new Border { CornerRadius = new CornerRadius(NativeTokens.RadiusM), - Padding = new Thickness(12, 6), + Padding = new Thickness(12 - NativeTokens.MarkWidth, 7, 12, 7), Background = Brushes.Transparent, + BorderBrush = Brushes.Transparent, + BorderThickness = new Thickness(NativeTokens.MarkWidth, 0, 0, 0), Child = content, Cursor = new Cursor(StandardCursorType.Hand), }; @@ -140,18 +194,44 @@ public static InlineCollection Marked(string text, int start, int length, Native } /// A key chip, as the palette draws a key. - public static Border Key(string key, NativeTokens colours) => new() + public static Border Key(string key, NativeTokens colours) => Chip(NativeKeys.Words(key), colours, new Thickness(6, 0, 0, 0)); + + /// + /// One key cap: the raised plane, a rule for its edge, the key in the cells' mono at the small size — the mockup's + /// Alt+1 given a cap. Every native list (⌃P, help, the modals) draws a key with this. + /// + public static Border Chip(string words, NativeTokens colours, Thickness margin = default) => new() { Background = colours.Brush(colours.KeyFill), BorderBrush = colours.Brush(colours.Edge), BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(NativeTokens.RadiusS), - Padding = new Thickness(6, 0), - Margin = new Thickness(6, 0, 0, 0), + Padding = new Thickness(6, 1, 6, 2), + Margin = margin, + MinWidth = 22, VerticalAlignment = VerticalAlignment.Center, - Child = new TextBlock { Text = NativeKeys.Words(key), FontSize = NativeTokens.Small, Foreground = colours.Brush(colours.KeyInk) }, + Child = new TextBlock + { + Text = words, + FontFamily = NativeTokens.KeyFace, + FontSize = NativeTokens.Small, + Foreground = colours.Brush(colours.KeyInk), + HorizontalAlignment = HorizontalAlignment.Center, + }, }; + /// + /// Paints selected or not: the selected row's plane, and the accent bar down its left edge + /// that the mockup's selected navigation wears — so the selection reads at a glance on every theme, not only by a + /// step in luminance. + /// + public static void Mark(Border row, bool selected, NativeTokens colours) + { + row.Background = selected ? colours.Brush(colours.Selected) : Brushes.Transparent; + row.BorderBrush = selected ? colours.Brush(colours.Accent) : Brushes.Transparent; + row.BorderThickness = new Thickness(NativeTokens.MarkWidth, 0, 0, 0); + } + /// A button whose label is followed by the key that presses it. public static Button Button(string label, string? key, NativeTokens colours, Action click, bool accent = false) { @@ -172,8 +252,10 @@ public static Button Button(string label, string? key, NativeTokens colours, Act var button = new Button { Content = content, - Padding = new Thickness(14, 6), + Padding = new Thickness(14, 7), + MinHeight = 32, CornerRadius = new CornerRadius(NativeTokens.RadiusM), + FontWeight = accent ? FontWeight.SemiBold : FontWeight.Normal, }; if (accent) { diff --git a/src/SharpMUTerm.Avalonia/NativeMenu.cs b/src/SharpMUTerm.Avalonia/NativeMenu.cs index b85cfafc..8b4be696 100644 --- a/src/SharpMUTerm.Avalonia/NativeMenu.cs +++ b/src/SharpMUTerm.Avalonia/NativeMenu.cs @@ -51,20 +51,41 @@ private static ContextMenu Build( BorderBrush = tokens.Brush(tokens.Edge), BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(NativeTokens.RadiusM), - Padding = new Thickness(4), + Padding = new Thickness(6), FontSize = NativeTokens.Body, }; tokens.ApplySimple(menu.Resources); + + // The highlighted entry is the palette's selected row, a plane; Simple outlines it in its accent too, which on a + // menu reads as a second, louder selection. + menu.Resources["ThemeAccentBrush"] = tokens.Brush(tokens.Selected); + + // The popup's own window shows in the menu's rounded corners: clear where the platform composites it, else the + // card's own plane, so a corner is never the popup's default white. + menu.Opened += (_, _) => + { + if (TopLevel.GetTopLevel(menu) is { } root and not Window) + { + root.TransparencyLevelHint = [WindowTransparencyLevel.Transparent]; + root.Background = root.ActualTransparencyLevel == WindowTransparencyLevel.Transparent ? null : tokens.Brush(tokens.Card); + } + }; Grid.SetIsSharedSizeScope(menu, true); foreach (var item in items) { if (item is not { } entry) { - menu.Items.Add(new Separator()); + menu.Items.Add(new Separator { Background = tokens.Brush(tokens.Rule), Margin = new Thickness(8, 4) }); continue; } - var menuItem = new MenuItem { Header = Header(entry.Label, entry.Hint), IsEnabled = entry.Enabled }; + // The palette's row: the same height and inset, so a menu and ⌃P read as one list. + var menuItem = new MenuItem + { + Header = Header(entry.Label, entry.Hint, tokens), + IsEnabled = entry.Enabled, + MinHeight = 30, + }; if (entry.Checked) { menuItem.ToggleType = MenuItemToggleType.CheckBox; @@ -80,7 +101,7 @@ private static ContextMenu Build( } /// An entry's label with its key after it, the keys lined up in a column of their own, both in the window's words. - private static Control Header(string label, string? hint) + private static Control Header(string label, string? hint, NativeTokens tokens) { var grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto) { SharedSizeGroup = "label" }); @@ -88,7 +109,17 @@ private static Control Header(string label, string? hint) grid.Children.Add(new TextBlock { Text = NativeKeys.Words(label), VerticalAlignment = VerticalAlignment.Center }); if (hint is { } key) { - var text = new TextBlock { Text = NativeKeys.Words(key), Opacity = 0.7, Margin = new Thickness(28, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; + // The key in the quiet ink and the keys' face, as the mockup's rail spells Alt+1 — an ink held to the floor, + // never an opacity. + var text = new TextBlock + { + Text = NativeKeys.Words(key), + FontFamily = NativeTokens.KeyFace, + FontSize = NativeTokens.Small, + Foreground = tokens.Brush(tokens.Dim), + Margin = new Thickness(32, 0, 0, 0), + VerticalAlignment = VerticalAlignment.Center, + }; Grid.SetColumn(text, 1); grid.Children.Add(text); } diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.cs b/src/SharpMUTerm.Avalonia/NativeTokens.cs index 8c8bb89f..820b1d18 100644 --- a/src/SharpMUTerm.Avalonia/NativeTokens.cs +++ b/src/SharpMUTerm.Avalonia/NativeTokens.cs @@ -40,7 +40,9 @@ internal sealed record NativeTokens( Color KeyFill, Color KeyInk, Color Warn, - Color Notice) + Color Notice, + Color Well, + Color Focus) { // ── the scales ────────────────────────────────────────────────────────────────────────────── @@ -74,14 +76,28 @@ internal sealed record NativeTokens( /// The floor every ink is held to on every plane it is drawn on: WCAG AA for body text. public const double TextFloor = 4.5; - /// The shadow a surface casts on what it floats over. + /// The shadow a surface casts on what it floats over: the palette, a modal. public static BoxShadows Shadow { get; } = new(new BoxShadow { - OffsetY = 16, - Blur = 40, - Color = Color.FromArgb(0x66, 0, 0, 0), + OffsetY = 18, + Blur = 48, + Color = Color.FromArgb(0x80, 0, 0, 0), }); + /// The smaller shadow a toast or a menu casts: it floats, but over the page rather than over a scrim. + public static BoxShadows ShadowSmall { get; } = new(new BoxShadow + { + OffsetY = 6, + Blur = 18, + Color = Color.FromArgb(0x59, 0, 0, 0), + }); + + /// The thickness of the accent bar a selected row and a toast's severity wear on their left. + public const double MarkWidth = 3; + + /// The face keys are spelt in on a chip, as the mockup's rail spells Alt+1: the cells' bundled mono. + public static FontFamily KeyFace { get; } = new($"{CellFonts.BundledFamily}, DejaVu Sans Mono, Consolas, Menlo, monospace"); + /// The raised plane an input, a key cap or a hovered row sits on. public Color Raised => KeyFill; @@ -113,7 +129,8 @@ public static NativeTokens For(Theme theme) var rule = Shift(canon.Rule, shift); var selected = Shift(canon.Selected, shift); var keyFill = Shift(canon.KeyFill, shift); - Rgb[] planes = [card, selected, keyFill]; + var well = Shift(canon.Well, shift); + Rgb[] planes = [card, selected, keyFill, well]; var accent = Held(ChromeInk.BaseAccent, planes); var accentInk = Contrast.Legible( @@ -134,7 +151,9 @@ public static NativeTokens For(Theme theme) Colour(keyFill), Colour(Held(canon.KeyInk, [keyFill])), Colour(Held(canon.Warn, planes)), - Colour(Held(ChromeInk.BaseNotice, planes))); + Colour(Held(ChromeInk.BaseNotice, planes)), + Colour(well), + Colour(Shift(canon.Focus, shift))); } /// A brush of . @@ -251,22 +270,28 @@ public void ApplySimple(IResourceDictionary resources) /// One side of mid-grey's set, before a theme is laid onto it. private sealed record Canon( Color Scrim, Rgb Card, Rgb Edge, Rgb Rule, Rgb Text, Rgb Dim, Rgb Header, Rgb Selected, Rgb AccentInk, Rgb KeyFill, - Rgb KeyInk, Rgb Warn); + Rgb KeyInk, Rgb Warn, Rgb Well, Rgb Focus); - /// The palette's dark card, as it was drawn before there were tokens. + /// + /// The dark set: the mockup's (ux-mockups/Main.dc.html) — panels #171b24, raised #1d2333, the + /// ground an input sits in #10131a, rules #2c3447 and a focused edge #3a4f73, ink #d7deec + /// over #9aa4b8, the selected row's #1f3a3a, and #0f1620 on the accent. + /// private static readonly Canon DarkCanon = new( Color.FromArgb(0x73, 0, 0, 0), - new Rgb(0x1e, 0x1e, 0x25), - new Rgb(0x3a, 0x3a, 0x46), - new Rgb(0x2c, 0x2c, 0x36), - new Rgb(0xec, 0xec, 0xf1), - new Rgb(0x9a, 0x9a, 0xab), - new Rgb(0x80, 0x80, 0x8f), - new Rgb(0x22, 0x40, 0x3a), - new Rgb(0x06, 0x23, 0x1b), - new Rgb(0x2a, 0x2a, 0x34), - new Rgb(0xcf, 0xcf, 0xdb), - new Rgb(0xff, 0xb4, 0x54)); + new Rgb(0x17, 0x1b, 0x24), + new Rgb(0x2c, 0x34, 0x47), + new Rgb(0x26, 0x2d, 0x3d), + new Rgb(0xd7, 0xde, 0xec), + new Rgb(0x9a, 0xa4, 0xb8), + new Rgb(0x8f, 0x99, 0xad), + new Rgb(0x1f, 0x3a, 0x3a), + new Rgb(0x0f, 0x16, 0x20), + new Rgb(0x1d, 0x23, 0x33), + new Rgb(0xc8, 0xd0, 0xe0), + new Rgb(0xff, 0xb4, 0x54), + new Rgb(0x10, 0x13, 0x1a), + new Rgb(0x3a, 0x4f, 0x73)); /// The palette's light card. private static readonly Canon LightCanon = new( @@ -281,7 +306,9 @@ private sealed record Canon( new Rgb(0xff, 0xff, 0xff), new Rgb(0xf1, 0xf1, 0xf5), new Rgb(0x40, 0x40, 0x4c), - new Rgb(0xa3, 0x4a, 0x00)); + new Rgb(0xa3, 0x4a, 0x00), + new Rgb(0xf6, 0xf7, 0xfa), + new Rgb(0xa9, 0xb3, 0xc6)); /// An ink moved, if it must be, until it clears on every plane given. private static Rgb Held(Rgb ink, IReadOnlyList planes) diff --git a/src/SharpMUTerm.Avalonia/NoticeToasts.cs b/src/SharpMUTerm.Avalonia/NoticeToasts.cs index db55155b..f08b1981 100644 --- a/src/SharpMUTerm.Avalonia/NoticeToasts.cs +++ b/src/SharpMUTerm.Avalonia/NoticeToasts.cs @@ -39,7 +39,9 @@ internal sealed class NoticeToasts : Control /// How long a toast stays after the pointer leaves it. internal static readonly TimeSpan HoverGrace = TimeSpan.FromSeconds(2); - private const double Inset = 12, Gap = 8, Padding = 10, EdgeWidth = 4, CardWidth = 380, TextSize = 13, ChipSize = 11; + // The severity is a bar inset from the card's left edge (the mockup's pill mark, as a highlighted line wears it), so the + // text starts past the bar and its margin: EdgeWidth is that whole lead, BarInset where the bar starts. + private const double Inset = 12, Gap = 8, Padding = 12, EdgeWidth = 10, BarInset = 7, CardWidth = 380, TextSize = 13, ChipSize = 11; private readonly List _toasts = []; private readonly Stopwatch _clock = Stopwatch.StartNew(); @@ -424,19 +426,19 @@ public override void Render(DrawingContext context) var edge = PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)); using var _ = context.PushOpacity(FadeOf(toast, now)); - // A soft shadow, the card, and the severity edge down its left side. - context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x50, 0, 0, 0)), null, rect.Translate(new Vector(0, 2)).Inflate(1), 7, 7); + // The card on a soft shadow (NativeTokens' small one: it floats over the page, not over a scrim), a rule for + // its edge, and the severity as a rounded bar down its left side. var lift = toast == hovered ? 0.08 : 0; + var card = new RoundedRect(rect, NativeTokens.RadiusM); context.DrawRectangle( - new SolidColorBrush(Mix(plane, PanelText.Parse(palette.Text), lift)), - new Pen(new SolidColorBrush(Color.FromArgb(0x60, edge.R, edge.G, edge.B)), 1), - rect, - 6, - 6); - using (context.PushClip(new RoundedRect(rect, 6))) - { - context.FillRectangle(new SolidColorBrush(edge), new Rect(rect.X, rect.Y, EdgeWidth, rect.Height)); - } + new SolidColorBrush(Mix(plane, PanelText.Parse(palette.Text), lift + 0.03)), + new Pen(new SolidColorBrush(Mix(plane, PanelText.Parse(palette.Text), 0.16)), 1), + card, + NativeTokens.ShadowSmall); + context.DrawRectangle( + new SolidColorBrush(edge), + null, + new RoundedRect(new Rect(rect.X + BarInset, rect.Y + 9, NativeTokens.MarkWidth, Math.Max(4, rect.Height - 18)), NativeTokens.MarkWidth / 2)); var x = rect.X + EdgeWidth + Padding; var y = rect.Y + Padding; @@ -449,8 +451,8 @@ public override void Render(DrawingContext context) if (chip is not null) { - var chipRect = new Rect(x - 3, y + 1, chip.Width + 6, chip.Height); - context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x30, edge.R, edge.G, edge.B)), null, chipRect, 3, 3); + var chipRect = new Rect(x - 4, y, chip.Width + 8, chip.Height + 2); + context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x30, edge.R, edge.G, edge.B)), null, chipRect, NativeTokens.RadiusS, NativeTokens.RadiusS); context.DrawText(chip, new Point(x, y + 1)); x += chip.Width + 8; } diff --git a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs index 4b039bb0..b0c16394 100644 --- a/src/SharpMUTerm.Avalonia/PaletteOverlay.cs +++ b/src/SharpMUTerm.Avalonia/PaletteOverlay.cs @@ -70,10 +70,11 @@ public PaletteOverlay(PaletteSession session, Action remove) { PlaceholderText = Placeholder, FontSize = NativeTokens.Title, - Margin = new Thickness(14, 14, 14, 6), - Padding = new Thickness(12, 9), + Margin = new Thickness(14, 14, 14, 8), + Padding = new Thickness(8, 10, 12, 10), CornerRadius = new CornerRadius(NativeTokens.RadiusM), }; + ModalParts.Sunk(_search, _colours); AutomationProperties.SetName(_search, "Command palette"); _search.TextChanged += (_, _) => Refresh(resetSelection: true); DockPanel.SetDock(_search, Dock.Top); @@ -82,17 +83,30 @@ public PaletteOverlay(PaletteSession session, Action remove) { FontSize = NativeTokens.Body, Foreground = new SolidColorBrush(_colours.Dim), - Margin = new Thickness(20, 0, 20, 6), + Margin = new Thickness(22, 0, 22, 8), }; DockPanel.SetDock(_status, Dock.Top); - var footer = new TextBlock + // The keys as caps on the card's foot band, the mockup's footer. + var keys = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, HorizontalAlignment = HorizontalAlignment.Right }; + foreach (var (cap, does) in new[] { ("↑↓", "move"), ("Enter", "run"), ("Esc", "close") }) { - Text = "↑↓ move Enter run Esc close", - FontSize = NativeTokens.Small, - Foreground = new SolidColorBrush(_colours.Dim), - Margin = new Thickness(20, 6, 20, 10), - HorizontalAlignment = HorizontalAlignment.Right, + keys.Children.Add(ModalParts.Chip(cap, _colours)); + keys.Children.Add(new TextBlock + { + Text = does, + FontSize = NativeTokens.Small, + Foreground = new SolidColorBrush(_colours.Dim), + Margin = new Thickness(0, 0, 8, 0), + VerticalAlignment = VerticalAlignment.Center, + }); + } + + var footer = new Border + { + Background = new SolidColorBrush(_colours.Well), + Padding = new Thickness(20, 8, 12, 8), + Child = keys, }; DockPanel.SetDock(footer, Dock.Bottom); @@ -110,7 +124,7 @@ public PaletteOverlay(PaletteSession session, Action remove) dock.Children.Add(footer); dock.Children.Add(new Border { - BorderBrush = new SolidColorBrush(_colours.Rule), + BorderBrush = new SolidColorBrush(_colours.Edge), BorderThickness = new Thickness(0, 1, 0, 1), Child = _scroller, }); @@ -314,16 +328,7 @@ private Border EntryRow(PaletteEntry entry, string? key, int index) var chips = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 4, Margin = new Thickness(16, 0, 0, 0) }; foreach (var part in key.Split(' ', StringSplitOptions.RemoveEmptyEntries)) { - chips.Children.Add(new Border - { - Background = new SolidColorBrush(_colours.KeyFill), - BorderBrush = new SolidColorBrush(_colours.Edge), - BorderThickness = new Thickness(1), - CornerRadius = new CornerRadius(NativeTokens.RadiusS), - Padding = new Thickness(7, 1), - VerticalAlignment = VerticalAlignment.Center, - Child = new TextBlock { Text = part, FontSize = NativeTokens.Body, Foreground = new SolidColorBrush(_colours.KeyInk) }, - }); + chips.Children.Add(ModalParts.Chip(part, _colours)); } Grid.SetColumn(chips, 1); @@ -333,8 +338,10 @@ private Border EntryRow(PaletteEntry entry, string? key, int index) var row = new Border { CornerRadius = new CornerRadius(NativeTokens.RadiusM), - Padding = new Thickness(12, 7), + Padding = new Thickness(12 - NativeTokens.MarkWidth, 7, 12, 7), Background = Brushes.Transparent, + BorderBrush = Brushes.Transparent, + BorderThickness = new Thickness(NativeTokens.MarkWidth, 0, 0, 0), Child = grid, Cursor = new Cursor(StandardCursorType.Hand), }; @@ -395,14 +402,14 @@ private void Select(int index, bool reveal) if (_selected >= 0 && _selected < _entryRows.Count) { - _entryRows[_selected].Background = Brushes.Transparent; + ModalParts.Mark(_entryRows[_selected], false, _colours); } _selected = index; if (index >= 0 && index < _entryRows.Count) { var row = _entryRows[index]; - row.Background = new SolidColorBrush(_colours.Selected); + ModalParts.Mark(row, true, _colours); if (reveal) { row.BringIntoView(); diff --git a/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs b/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs index bdcb410d..9c501f96 100644 --- a/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs +++ b/src/SharpMUTerm.Avalonia/ScriptConsoleView.cs @@ -303,7 +303,7 @@ private void Highlight() { for (var i = 0; i < _storeRows.Count; i++) { - _storeRows[i].Background = i == _selectedKey ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + ModalParts.Mark(_storeRows[i], i == _selectedKey, _colours); } _delete.IsEnabled = SelectedKey is not null; diff --git a/src/SharpMUTerm.Avalonia/SearchView.cs b/src/SharpMUTerm.Avalonia/SearchView.cs index 8cacff78..97368846 100644 --- a/src/SharpMUTerm.Avalonia/SearchView.cs +++ b/src/SharpMUTerm.Avalonia/SearchView.cs @@ -43,7 +43,7 @@ public SearchView(SearchSession session, NativeTokens colours, Action done) _done = done; _model = session.Model; - _box = ModalParts.SearchBox("Search the output…", "Search"); + _box = ModalParts.SearchBox("Search the output…", "Search", colours); _box.Text = _model.Query; SetDock(_box, Dock.Top); Children.Add(_box); @@ -310,7 +310,7 @@ private void Highlight() { for (var i = 0; i < _rows.Count; i++) { - _rows[i].Background = i == _selected ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + ModalParts.Mark(_rows[i], i == _selected, _colours); } if (_selected < _rows.Count) diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs index 9a577b8d..fa0d43b2 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs @@ -66,7 +66,9 @@ public async Task NoViewWritesALiteralFontSizeOrColour() [Test] public async Task TheDarkAndLightThemesResolveToThePalettesOwnCards() { - await Assert.That(NativeTokens.Dark.Card).IsEqualTo(Color.Parse("#1e1e25")); + await Assert.That(NativeTokens.Dark.Card).IsEqualTo(Color.Parse("#171b24")).Because("the mockup's panel plane"); + await Assert.That(NativeTokens.Dark.Well).IsEqualTo(Color.Parse("#10131a")).Because("the mockup's ground, which its inputs sit in"); + await Assert.That(NativeTokens.Dark.Selected).IsEqualTo(Color.Parse("#1f3a3a")).Because("the mockup's selected row"); await Assert.That(NativeTokens.Dark.Accent).IsEqualTo(Color.Parse("#00f5b7")).Because("the client's own teal, already legible on a dark card"); await Assert.That(NativeTokens.Light.Card).IsEqualTo(Colors.White); await Assert.That(NativeTokens.Dark.IsDark).IsTrue(); @@ -88,7 +90,7 @@ public async Task SolarizedGetsItsOwnHueNotTheDarkThemesGrey() public async Task EveryInkClearsTheTextFloorOnEveryPlaneItIsDrawnOn(string name) { var tokens = NativeTokens.For(ThemeLibrary.Get(name)); - Color[] planes = [tokens.Card, tokens.Selected, tokens.Raised]; + Color[] planes = [tokens.Card, tokens.Selected, tokens.Raised, tokens.Well]; var misses = new List(); foreach (var (ink, label) in new[] { From 3f4811b52e54d29b85fe5a1f87a7a5e41abf670e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 17:47:26 +0000 Subject: [PATCH 068/113] Wave 19 terminal audit: modal padding, freeze bar width, header brand, welcome band, notice and label duplicates, script gutter ink A sweep of every snapshot view at 80x24 and 120x32, Dark and Light: - a notice that already names its key no longer gets a second copy of it - the map edit label no longer says "Map: map:" - Browse worlds' failure text no longer repeats itself - the script editor's line numbers clear the floor on Light - the FROZEN bar's rule runs to the pane's edge, redrawn on resize - the import review stays above the command line at 80x24 - cell modals keep one cell between the frame and the words - the welcome's choice is a band across the list - the header spells SharpMUTerm where it fits, muterm where it does not Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 ++ CLAUDE.md | 8 +++ src/SharpMUTerm.Tui/ComposeOverlay.cs | 4 ++ src/SharpMUTerm.Tui/FreezeBarRenderer.cs | 15 +++- src/SharpMUTerm.Tui/GameDataOverlay.cs | 5 +- src/SharpMUTerm.Tui/HistorySurface.cs | 3 +- src/SharpMUTerm.Tui/ListOverlay.cs | 6 +- src/SharpMUTerm.Tui/MessageLogOverlay.cs | 5 +- .../Pointer/SharpMUTermApp.Notices.cs | 14 +++- src/SharpMUTerm.Tui/PrefixOverlay.cs | 1 + src/SharpMUTerm.Tui/QuitOverlay.cs | 1 + src/SharpMUTerm.Tui/SearchSurface.cs | 3 +- .../SharpMUTermApp.ChromeBars.cs | 12 ++++ src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs | 2 +- src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs | 5 ++ .../SharpMUTermApp.WorldBrowse.cs | 2 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 36 ++++++++-- src/SharpMUTerm.Tui/WelcomeSurface.cs | 5 +- tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs | 3 +- .../HostChromeLayoutTests.cs | 4 +- .../TerminalAuditWave19Tests.cs | 69 +++++++++++++++++++ 21 files changed, 186 insertions(+), 24 deletions(-) create mode 100644 tests/SharpMUTerm.Tui.Tests/TerminalAuditWave19Tests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 057cacdb..8d4bfa61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -454,6 +454,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Fixed +- Terminal polish from a sweep of every screen at 80×24 and 120×32: the header's brand reads `SharpMUTerm` where the row + has room; the welcome's chosen row is a band across the list; pop-ups keep a cell between their frame and their words; + a tall pop-up (the import review at 80×24) no longer covers the command line; the `❄ FROZEN` bar's rule runs to the + pane's edge instead of vanishing in a narrow pane or stopping short in a wide one; the script editor's line numbers are + legible on the Light theme; and the status row no longer says a key twice (`⌥R … connects it · ⌥R Reconnect`) or a + label twice (`Map: map: …`). + - The command palette no longer covers the command line on an 80×24 terminal. - A tab squeezed by a crowded strip keeps at least three letters of its name. - The build no longer warns about an ImageSharp advisory in a decoder SharpMUTerm never uses. diff --git a/CLAUDE.md b/CLAUDE.md index fe6c9950..519eea7e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -688,6 +688,14 @@ fallbacks) for inline images/maps. hints share one painted row — add a view there when it gains a key row. Settings screen headers go through it too (`ScreenChrome.Hints(…, room)`, `HeaderRoom`): `{F}/Esc close` and an edit's ⏎/Esc are `Keep`, the pane and select keys go first; `FooterFitTests.SettingsHeaders` fails on a `…` in any F2–F10 header at 80×24. +- **Wave 19's terminal sweep** (every `SnapshotViews.All` view at 80×24 and 120×32, Dark and Light; `TerminalAuditWave19Tests`). + Cell pop-ups take `WithPadding(1, 0, 0, 0)` (ListOverlay, quit, ⌃B, ⌃F, ⌃R, game data, messages; not ⌃P, whose `├` + headings join the frame): each already laid its lines out a cell or two narrower than its inside, so the padding spends + that slack, and ⌃F/⌃R grew one column where they had none. A `ListOverlay` with pinned keys (`footer:`) is at most `desktop − 4` + rows, so a centred one never covers the command line; one without keeps `desktop − 2`, since its keys are its last rows. The `❄ FROZEN` bar is sized to its pane like every other bar (`_freezeBars`, redrawn + in `SyncChromeBarWidths` and on a theme switch). The header's brand is `SharpMUTerm` unless the row would then not fit, + where it is `muterm` (`BrandWord`/`ShortBrandWord`). A notice whose words already name its action's way gets no + `· ⌥R Reconnect` after them (`NamesWay`). - **The status row names the keys of the mode you are in** (`ModeHints`/`StatusMode`, Client; `SharpMUTermApp.ModeHints.cs`). Composer armed > search bar in the focused window > frozen > split > scrolled back; while one holds, its hints replace `FocusHints` (`End returns · ⌥F freezes`, `⌥F thaws`, `⌥G next hit · ⌃F searches diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 09c974ae..36226d2c 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -267,6 +267,10 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool FocusedForegroundColor = _scheme.Colour(ScreenPalette.Value), SelectionBackgroundColor = _scheme.Colour(ScreenPalette.CursorBg), SelectionForegroundColor = _scheme.Colour(ScreenPalette.Value), + + // The script gutter's numbers in the screens' label ink, held to the floor on the well; the control's + // default grey was 2.7:1 on a light theme's well. + LineNumberColor = _scheme.Colour(ScreenPalette.Label), }; if (!_spellingOpened) diff --git a/src/SharpMUTerm.Tui/FreezeBarRenderer.cs b/src/SharpMUTerm.Tui/FreezeBarRenderer.cs index a7d61492..cc06aa46 100644 --- a/src/SharpMUTerm.Tui/FreezeBarRenderer.cs +++ b/src/SharpMUTerm.Tui/FreezeBarRenderer.cs @@ -8,13 +8,22 @@ namespace SharpMUTerm.Tui; /// internal static class FreezeBarRenderer { - /// Builds the frozen-split bar markup from an already-resolved #rrggbb accent. - public static string Bar(string accentHex) + /// The label's cells, the space after it included. + private const int LabelCells = 12; + + /// + /// Builds the frozen-split bar markup from an already-resolved #rrggbb accent, its rule running to the edge + /// of a pane cells wide ('s rule: 0 is not arranged yet, and draws + /// the old 48 cells). A fixed 48 wrapped in every pane narrower than 61 cells, and the bar's one row then showed + /// no rule at all; in a wide pane it stopped short. + /// + public static string Bar(string accentHex, int width = 0) { ArgumentException.ThrowIfNullOrEmpty(accentHex); // A single line that is both the label and the divider border between pinned scrollback and the // live tail: the accented "❄ FROZEN ⌥F" label followed by a dim rule. - return $"[{accentHex}]{Glyphs.Freeze} FROZEN ⌥F[/] [dim]{new string('─', 48)}[/]"; + var rule = width > 0 ? Math.Max(0, width - LabelCells) : BarRule.Fallback; + return $"[{accentHex}]{Glyphs.Freeze} FROZEN ⌥F[/] [dim]{BarRule.Rule(rule)}[/]"; } } diff --git a/src/SharpMUTerm.Tui/GameDataOverlay.cs b/src/SharpMUTerm.Tui/GameDataOverlay.cs index 006d1a6d..fa6a05ba 100644 --- a/src/SharpMUTerm.Tui/GameDataOverlay.cs +++ b/src/SharpMUTerm.Tui/GameDataOverlay.cs @@ -57,7 +57,7 @@ public void Toggle(GameDataStore data, string owner) var desktop = _system.DesktopDimensions; var width = Math.Max(44, desktop.Width - 8); var height = Math.Max(10, desktop.Height - 4); - _content = new MarkupControl(Scheme.Lines(Lines(width - 3, height - 2), ScreenPalette.MenuBg)); + _content = new MarkupControl(Scheme.Lines(Lines(width - 4, height - 2), ScreenPalette.MenuBg)); // Centered() after WithSize(), for CommandPalette's reason. _window = new WindowBuilder(_system) @@ -67,6 +67,7 @@ public void Toggle(GameDataStore data, string owner) .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) + .WithPadding(new SharpConsoleUI.Layout.Padding(1, 0, 0, 0)) // a cell between the frame and the words .WithSize(width, height) .Centered() .AddControl(_content) @@ -144,7 +145,7 @@ private void Repaint() { if (_window is { } window) { - _content?.SetContent(Scheme.Lines(Lines(Math.Max(20, window.Width - 3), Math.Max(6, window.Height - 2)), ScreenPalette.MenuBg)); + _content?.SetContent(Scheme.Lines(Lines(Math.Max(20, window.Width - 4), Math.Max(6, window.Height - 2)), ScreenPalette.MenuBg)); } } diff --git a/src/SharpMUTerm.Tui/HistorySurface.cs b/src/SharpMUTerm.Tui/HistorySurface.cs index 129fa1ed..f67919f6 100644 --- a/src/SharpMUTerm.Tui/HistorySurface.cs +++ b/src/SharpMUTerm.Tui/HistorySurface.cs @@ -170,7 +170,7 @@ private void Open() // instead of leaning on it, and the selected row's bar stops there too. _contentWidth = Math.Clamp( HistorySearchPrompt.MaxWidth(initial) + 2, MinimumWidth, Math.Max(MinimumWidth, desktop.Width - 6)); - var width = _contentWidth + 2; // + the 1-cell left/right border + var width = _contentWidth + 3; // + the 1-cell left/right border and the cell of padding on the left var height = Math.Min(_listRows + ChromeRows + 2, Math.Max(ChromeRows + 3, desktop.Height - 2)); _body = new MarkupControl(new List()); @@ -185,6 +185,7 @@ private void Open() .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) + .WithPadding(new SharpConsoleUI.Layout.Padding(1, 0, 0, 0)) // a cell between the frame and the words .WithSize(width, height) .Centered() .AddControl(_body) diff --git a/src/SharpMUTerm.Tui/ListOverlay.cs b/src/SharpMUTerm.Tui/ListOverlay.cs index d6e3d960..776ed4d0 100644 --- a/src/SharpMUTerm.Tui/ListOverlay.cs +++ b/src/SharpMUTerm.Tui/ListOverlay.cs @@ -102,7 +102,10 @@ public void Open( var outer = width is { } asked ? Math.Clamp(asked + 4, 24, widest) : widest; var lines = render(outer - 4); var footerLines = footer?.Invoke(outer - 4) ?? []; - var height = Math.Clamp(Rows(lines, outer - 3) + footerLines.Count + 2, 8, Math.Max(8, desktop.Height - 2)); + // A modal whose body scrolls under pinned keys is at most four rows short of the desktop, so centred it leaves the + // header, the command line and the status row in view (two short, the import review at 80×24 sat on the command + // line). One without scrolling keeps the two: its last rows are its keys, and they must not be cut off. + var height = Math.Clamp(Rows(lines, outer - 3) + footerLines.Count + 2, 8, Math.Max(8, desktop.Height - (footer is null ? 2 : 4))); _content = new MarkupControl(_scheme.Lines(lines, ScreenPalette.MenuBg)); _content.LinkClicked += (_, e) => _link?.Invoke(e.Url); IWindowControl body = _content; @@ -136,6 +139,7 @@ public void Open( .WithBackgroundColor(_scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) + .WithPadding(new SharpConsoleUI.Layout.Padding(1, 0, 0, 0)) // a cell between the frame and the words .WithSize(outer, height) .Centered() .AddControl(body) diff --git a/src/SharpMUTerm.Tui/MessageLogOverlay.cs b/src/SharpMUTerm.Tui/MessageLogOverlay.cs index 10289014..0f3e4ece 100644 --- a/src/SharpMUTerm.Tui/MessageLogOverlay.cs +++ b/src/SharpMUTerm.Tui/MessageLogOverlay.cs @@ -61,7 +61,7 @@ public void Toggle() var width = Math.Clamp(ClientMessageRenderer.MaxWidth(entries) + 3, 44, Math.Max(44, desktop.Width - 6)); var height = Math.Clamp(entries.Count + 4, 8, Math.Max(8, desktop.Height - 2)); - _content = new MarkupControl(Scheme.Lines(Lines(width - 3), ScreenPalette.MenuBg)); + _content = new MarkupControl(Scheme.Lines(Lines(width - 4), ScreenPalette.MenuBg)); // Centered() after WithSize(): the builder reads the bounds set so far and falls back to 80x25, // so centring first places the window as if it were that size (see CommandPalette). @@ -72,6 +72,7 @@ public void Toggle() .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) + .WithPadding(new SharpConsoleUI.Layout.Padding(1, 0, 0, 0)) // a cell between the frame and the words .WithSize(width, height) .Centered() .AddControl(_content) @@ -102,7 +103,7 @@ internal void StepLevel(int delta) var index = Array.IndexOf(Levels, _diagnostics.MinimumLevel); index = index < 0 ? Array.IndexOf(Levels, LogLevel.Information) : index; _diagnostics.MinimumLevel = Levels[Math.Clamp(index + delta, 0, Levels.Length - 1)]; - _content?.SetContent(Scheme.Lines(Lines(_window is { } window ? Math.Max(20, window.Width - 3) : 80), ScreenPalette.MenuBg)); + _content?.SetContent(Scheme.Lines(Lines(_window is { } window ? Math.Max(20, window.Width - 4) : 80), ScreenPalette.MenuBg)); } private static string Level(LogLevel level) => level.ToString().ToLowerInvariant(); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs index 7f06e925..cf056f13 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs @@ -60,7 +60,9 @@ internal string NoticeMarkup(NoticeModel notice) // The toast offers the action as a button; the row names the way to it, where it fits whole — never by cutting // the notice's own words, and never wrapping the row (FitStatusRow). - if (NoticeActionHints(notice.Action).FirstOrDefault(h => MarkupWidth(row) + 3 + h.Length <= HeaderWidth()) is { } hint) + // A notice whose own words already name the way (`offline — ⌥R (⌃P ▸ Reconnect) connects it`) gets no second + // copy: the row read `… connects it · ⌥R Reconnect`. + if (NoticeActionHints(notice.Action).FirstOrDefault(h => !NamesWay(notice.Text, h) && MarkupWidth(row) + 3 + h.Length <= HeaderWidth()) is { } hint) { row += $"[{label}] · {Escape(hint)}[/]"; } @@ -97,6 +99,16 @@ internal IReadOnlyList NoticeActionHints(NoticeAction? action) : [$"⌃P ▸ {entry.Title}", $"⌃P ▸ {action.Label}"]; } + /// + /// Whether already says 's way to the action: its chord (⌥R of + /// ⌥R Reconnect), or the whole ⌃P ▸ … path. + /// + internal static bool NamesWay(string text, string hint) + { + var way = hint.StartsWith("⌃P ▸ ", StringComparison.Ordinal) ? hint : hint.Split(' ')[0]; + return text.Contains(way, StringComparison.Ordinal); + } + /// A colour held to on : notice text is small text. private static string HeldOn(string hex, Rgb plane) => TryParseRgb(hex, out var rgb) ? Hex(Contrast.Legible(rgb, plane, WorkspacePalette.HeaderTextFloor)) : hex; diff --git a/src/SharpMUTerm.Tui/PrefixOverlay.cs b/src/SharpMUTerm.Tui/PrefixOverlay.cs index f66d7cb2..0b1de5ca 100644 --- a/src/SharpMUTerm.Tui/PrefixOverlay.cs +++ b/src/SharpMUTerm.Tui/PrefixOverlay.cs @@ -108,6 +108,7 @@ public void Open() .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) + .WithPadding(new SharpConsoleUI.Layout.Padding(1, 0, 0, 0)) // a cell between the frame and the words .WithSize(width, height) .Centered() .AddControl(new MarkupControl(Scheme.Lines(lines, ScreenPalette.MenuBg))) diff --git a/src/SharpMUTerm.Tui/QuitOverlay.cs b/src/SharpMUTerm.Tui/QuitOverlay.cs index 4f5ae4b6..5a0d02e7 100644 --- a/src/SharpMUTerm.Tui/QuitOverlay.cs +++ b/src/SharpMUTerm.Tui/QuitOverlay.cs @@ -107,6 +107,7 @@ private void Open() .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) + .WithPadding(new SharpConsoleUI.Layout.Padding(1, 0, 0, 0)) // a cell between the frame and the words .WithSize(width, height) .Centered() .AddControl(_body) diff --git a/src/SharpMUTerm.Tui/SearchSurface.cs b/src/SharpMUTerm.Tui/SearchSurface.cs index 82f9a448..0853eecc 100644 --- a/src/SharpMUTerm.Tui/SearchSurface.cs +++ b/src/SharpMUTerm.Tui/SearchSurface.cs @@ -204,7 +204,7 @@ private void Open() _listRows = Math.Max(3, desktop.Height - ChromeRows - 6); _contentWidth = Math.Max(MinimumWidth, desktop.Width - 6); - var width = _contentWidth + 2; // + the 1-cell left/right border + var width = _contentWidth + 3; // + the 1-cell left/right border and the cell of padding on the left var height = Math.Min(_listRows + ChromeRows + 2, Math.Max(ChromeRows + 3, desktop.Height - 2)); _body = new MarkupControl(new List()); @@ -217,6 +217,7 @@ private void Open() .WithBackgroundColor(Scheme.Colour(ScreenPalette.MenuBg)) .HideTitleButtons() .Resizable(false) + .WithPadding(new SharpConsoleUI.Layout.Padding(1, 0, 0, 0)) // a cell between the frame and the words .WithSize(width, height) .Centered() .AddControl(_body) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ChromeBars.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ChromeBars.cs index 1c6ebe24..4273ee8b 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ChromeBars.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ChromeBars.cs @@ -53,5 +53,17 @@ private void SyncChromeBarWidths() RepaintPane(windowId, keepSelection: true); } } + + // The freeze bar is a control of its own between a frozen pane's halves, not a buffer row. + foreach (var (windowId, (control, drawn)) in _freezeBars.ToArray()) + { + var width = BarWidth(windowId); + if (width > 0 && width != drawn) + { + accent ??= FrozenAccentHex(); + control.SetContent(new List { FreezeBarRenderer.Bar(accent, width) }); + _freezeBars[windowId] = (control, width); + } + } } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs index 16034d37..a5275238 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MapEdit.cs @@ -131,7 +131,7 @@ internal void SelectMapRoom(string windowId, long? room) if (entering) { // Not toasted: the window's map inspector shows these as buttons; the status row says them for the cells. - Notice("map: ←↑→↓ select · r rename · l lock · Del delete · u undo · Esc done", MessageSeverity.Info, source: NoticeModel.Sources.Map, toast: false); + Notice("←↑→↓ select · r rename · l lock · Del delete · u undo · Esc done", MessageSeverity.Info, source: NoticeModel.Sources.Map, toast: false); } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs index b871d4bd..836fbf93 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Theme.cs @@ -128,6 +128,11 @@ private void ApplyTheme(Theme theme) internal void RestylePaneLines() { var accent = FrozenAccentHex(); + foreach (var (windowId, (control, width)) in _freezeBars.ToArray()) + { + control.SetContent(new List { FreezeBarRenderer.Bar(accent, width) }); + } + foreach (var buffer in _lines.Values) { for (var i = 0; i < buffer.Count; i++) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs index e540b100..f36ebbba 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs @@ -301,7 +301,7 @@ void Deliver(byte[]? bytes, string? problem) { if (generation == _worldGeneration) { - then(bytes, bytes is null ? problem ?? "it did not answer, or the answer was too large" : null); + then(bytes, bytes is null ? problem ?? "the request failed, or the answer was too large" : null); } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 3959d4cc..8b56c7fa 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -90,6 +90,9 @@ internal sealed partial class SharpMUTermApp : IAsyncDisposable /// the pinned half is precisely the half a reader scrolls through. /// private readonly Dictionary _frozenPanes = new(StringComparer.Ordinal); + + /// Each frozen window's ❄ FROZEN bar and the pane width its rule was drawn for (SyncChromeBarWidths). + private readonly Dictionary _freezeBars = new(StringComparer.Ordinal); private readonly DraftStore _drafts; private readonly InputBarVisibility _secondBars; @@ -11712,7 +11715,9 @@ private IWindowControl BuildFrozenContent(string windowId, string title) var frozen = FrozenContentFor(windowId); FeedRange(frozen, buffer, 0, split); - var bar = new MarkupControl(new List { FreezeBarRenderer.Bar(FrozenAccentHex()) }); + var barWidth = BarWidth(windowId); + var bar = new MarkupControl(new List { FreezeBarRenderer.Bar(FrozenAccentHex(), barWidth) }); + _freezeBars[windowId] = (bar, barWidth); var live = PaneContentFor(windowId, title); FeedRange(live, buffer, split, buffer.Count - split); @@ -13377,6 +13382,7 @@ private void CloseWindow(string id) _paneScrolls.Remove(id); // and its scroll position: a reopened window starts live _paneScrolls.Remove(FrozenRegionKey(id)); _frozenPanes.Remove(id); + _freezeBars.Remove(id); ForgetScrollSplit(id); _drafts.Forget(id); // both bars: a closed window keeps neither of its two drafts _pendingGrabs.Remove(id); @@ -14281,7 +14287,7 @@ private string HeaderMarkup(HeaderModel model) // legible is the text *on* it, so each segment's ink is measured against the fill it lands on. var brandBg = FillHex(AccentPalette[2]); // violet var sb = new System.Text.StringBuilder(); - sb.Append($"[link={HeaderModel.PaletteTarget}][bold {SegmentInk(brandBg)} on {brandBg}] {caret} muterm [/][/]"); + sb.Append($"[link={HeaderModel.PaletteTarget}][bold {SegmentInk(brandBg)} on {brandBg}] {caret} {BrandWord} [/][/]"); var tail = brandBg; if (model.World is { } active) @@ -14304,6 +14310,15 @@ private string HeaderMarkup(HeaderModel model) sb.Append($"[{tail} on {headerBg}]{Glyphs.PowerRight}[/]"); var leftBar = sb.ToString(); + var right = HeaderRight(model); + + // The product's name where the row has room for it beside the ribbon and the right-hand cluster (the mockups' + // `≡ SharpMUTerm`); the short `muterm` it always was where it has not, because an overlong header wraps. + if (MarkupWidth(leftBar) + MarkupWidth(right) + 3 > HeaderWidth()) + { + var at = leftBar.IndexOf($" {BrandWord} ", StringComparison.Ordinal); + leftBar = string.Concat(leftBar.AsSpan(0, at), $" {ShortBrandWord} ", leftBar.AsSpan(at + BrandWord.Length + 2)); + } // The ⌃B prefix indicator shows only while armed, and it is the *terse* half of the which-key // pair: the keys immediately, the panel a few hundred milliseconds later if nothing was pressed. @@ -14328,6 +14343,17 @@ private string HeaderMarkup(HeaderModel model) // test that says so, and anything added here has to keep it passing. // The quiet half of the row is held to the header's floor on its band rather than left to the framework's // fixed [dim] grey, which is 3.4:1 on Dark's band and less on Light's. + // Right-align the status cluster to the far edge so the menu bar spans the whole console. + var gap = Math.Max(3, HeaderWidth() - MarkupWidth(leftBar) - MarkupWidth(right)); + return $"{leftBar}{new string(' ', gap)}{right}"; + } + + /// The product's name on the header's brand button, and the short form a narrow row falls back to. + private const string BrandWord = "SharpMUTerm", ShortBrandWord = "muterm"; + + /// The header's right-hand cluster: the connected fraction and the log cell. + private string HeaderRight(HeaderModel model) + { var muted = WorkspacePalette.HeaderMuted(_theme).ToHex(); var conn = model.HasWorlds ? $"{model.ConnectedText} " : string.Empty; var log = model.Log == LogFormat.None @@ -14339,11 +14365,7 @@ private string HeaderMarkup(HeaderModel model) // "*** SharpMUTerm — theme '…', graphics: …" when it opens, and the not-connected status line // repeats it. A startup fact belongs where startup facts are read, not in the row that has to // fit an identity ribbon and a live count at eighty columns. - var right = $"[{muted}]{conn}[/]{log} "; - - // Right-align the status cluster to the far edge so the menu bar spans the whole console. - var gap = Math.Max(3, HeaderWidth() - MarkupWidth(leftBar) - MarkupWidth(right)); - return $"{leftBar}{new string(' ', gap)}{right}"; + return $"[{muted}]{conn}[/]{log} "; } /// diff --git a/src/SharpMUTerm.Tui/WelcomeSurface.cs b/src/SharpMUTerm.Tui/WelcomeSurface.cs index d0370c06..3dfb9705 100644 --- a/src/SharpMUTerm.Tui/WelcomeSurface.cs +++ b/src/SharpMUTerm.Tui/WelcomeSurface.cs @@ -379,7 +379,10 @@ private static List RenderMenu(WelcomeModel model, int width) var selected = choice == model.Selected; var (title, detail) = model.Describe(choice); var marker = selected ? $"[bold {ScreenPalette.Accent}]▸[/]" : " "; - lines.Add($"{marker} {Pad(Value(title, selected), 20)} {Label(detail)}"); + var row = $"{marker} {Pad(Value(title, selected), 20)} {(selected ? $"[{ScreenPalette.Muted}]{Escape(detail)}[/]" : Label(detail))}"; + + // The choice ⏎ takes is a band across the list, the menus' selected row (the mockup's), not a marker alone. + lines.Add(selected ? $"[on {ScreenPalette.MenuSelectedBg}]{Pad(row, width)}[/]" : row); } lines.Add(model.Problem is null ? string.Empty : $" [{ScreenPalette.Caution}]{Escape(model.Problem)}[/]"); diff --git a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs index e3a0ac73..7bdb4c98 100644 --- a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs @@ -121,7 +121,8 @@ public async Task TheImportReviewScrollsItsBodyUnderAPinnedFooter() { var app = App(); var first = FrameGrid.Decode(app.RenderSnapshot("import-review"), Width, Height); - await Assert.That(first.Any(r => r.Contains("LEFT OUT", StringComparison.Ordinal) && !r.Contains("password", StringComparison.Ordinal))).IsTrue(); + await Assert.That(first.Any(r => r.Contains("WHAT IT ADDS", StringComparison.Ordinal))).IsTrue(); + await Assert.That(first.Any(r => r.Contains("Your health is", StringComparison.Ordinal))).IsFalse().Because("the end of the list is below the fold"); app.SimulateImportKey(new ConsoleKeyInfo('\0', ConsoleKey.End, false, false, false)); var scrolled = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); diff --git a/tests/SharpMUTerm.Tui.Tests/HostChromeLayoutTests.cs b/tests/SharpMUTerm.Tui.Tests/HostChromeLayoutTests.cs index 4ff70b81..57bab9bb 100644 --- a/tests/SharpMUTerm.Tui.Tests/HostChromeLayoutTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/HostChromeLayoutTests.cs @@ -84,8 +84,8 @@ public async Task AHostThatDrawsTheHeaderGetsNoHeaderRowAndTheWorkspaceTakesIt() await Assert.That(native.LaidOutRows.Workspace).IsEqualTo(cells.LaidOutRows.Workspace + 1); // The ribbon's brand is on the terminal's first row and on no row of the window's cells. - await Assert.That(FrameGrid.Decode(cellFrame, Width, Height)[0]).Contains("muterm"); - await Assert.That(FrameGrid.Decode(nativeFrame, Width, Height).Any(row => row.Contains("muterm", StringComparison.Ordinal))).IsFalse(); + await Assert.That(FrameGrid.Decode(cellFrame, Width, Height)[0]).Contains("MUTerm"); + await Assert.That(FrameGrid.Decode(nativeFrame, Width, Height).Any(row => row.Contains("MUTerm", StringComparison.Ordinal) || row.Contains("muterm", StringComparison.Ordinal))).IsFalse(); // The bands still fill the grid exactly: nothing promised to a header that is not there. var rows = native.LaidOutRows; diff --git a/tests/SharpMUTerm.Tui.Tests/TerminalAuditWave19Tests.cs b/tests/SharpMUTerm.Tui.Tests/TerminalAuditWave19Tests.cs new file mode 100644 index 00000000..56c7251d --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/TerminalAuditWave19Tests.cs @@ -0,0 +1,69 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Client.Modals; +using SharpMUTerm.Core.Diagnostics; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Graphics; + +namespace SharpMUTerm.Tui.Tests; + +/// Wave 19's terminal audit: the cell defects found by sweeping every snapshot view at 80×24 and 120×32. +[NotInParallel] +public class TerminalAuditWave19Tests +{ + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(int width, int height) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = "Dark"; + config.Theme = ThemeLibrary.Get("Dark"); + return new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); + } + + [Test] + public async Task ANoticeThatAlreadyNamesItsKeyIsNotFollowedByASecondCopy() + { + await using var app = App(120, 32); + app.SimulateNotice("switched to Corvid · offline — ⌥R (⌃P ▸ Reconnect) connects it", MessageSeverity.Info, null, + new NoticeAction("world:reconnect", "Reconnect")); + var row = MarkupText.Plain(app.StatusMarkup); + await Assert.That(row).DoesNotContain("· ⌥R Reconnect"); + await Assert.That(row.Split("⌥R").Length - 1).IsEqualTo(1); + } + + [Test] + public async Task TheFreezeBarsRuleRunsToThePanesEdge() + { + foreach (var width in new[] { 30, 72, 140 }) + { + await Assert.That(MarkupText.Plain(FreezeBarRenderer.Bar("#c678dd", width)).Length).IsEqualTo(width); + } + + await Assert.That(MarkupText.Plain(FreezeBarRenderer.Bar("#c678dd")).Length).IsEqualTo(12 + BarRule.Fallback); + } + + [Test] + public async Task TheHeaderSpellsTheProductsNameWhereItFitsAndNeverWraps() + { + await using var wide = App(120, 32); + await Assert.That(MarkupText.Plain(wide.HeaderText)).Contains(" SharpMUTerm "); + + await using var narrow = App(44, 16); + var plain = MarkupText.Plain(narrow.HeaderText); + await Assert.That(plain).Contains(" muterm "); + await Assert.That(plain.Length).IsLessThanOrEqualTo(44); + } + + [Test] + public async Task TheWelcomesChoiceIsABandAcrossTheList() + { + var model = new WelcomeSurface(null).Model; + var lines = WelcomeSurface.Render(model, 60); + var band = lines.Single(l => l.Contains($"[on {ScreenPalette.MenuSelectedBg}]", StringComparison.Ordinal)); + await Assert.That(MarkupText.Plain(band)).Contains(model.Describe(model.Selected).Title); + await Assert.That(MarkupText.Plain(band).Length).IsEqualTo(60); + } +} From c3f33886c99d1e1bf5976c13fa203ddf653643ac Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 17:53:45 +0000 Subject: [PATCH 069/113] Welcome: choose a world's address in the Find a world card The welcome's embedded world list builds its WorldBrowseSession with the address-choice callbacks (ChooseWorldEndpoint, LeaveWorldChoice), which fixes the merged build. While the model is Choosing, the card lists the addresses as Browse worlds does (host:port, TLS/plain, stale, not connectable, charset note), Up/Down/Enter choose, Esc or Back returns to the worlds. Choosing clears the choice before the welcome reopens with the form filled in, so the reopened list shows the worlds again. Declared as the welcome surface's address/leave actions, with a parity probe: welcome find, add Aetherfall, choose address 2 equals the cells' Browse pick and choice. Cross-slice fixes: the existing welcome add probe picks a one-address world (Aetherfall now opens the choice), and NativeTabStripTests compares the desktop arrangement with and without native tabs, since HostChrome.Native now also takes the status row and command line out of the cells. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 3 +- src/SharpMUTerm.Avalonia/WelcomeView.cs | 189 +++++++++++++++++- .../Surfaces/SurfaceCatalog.cs | 5 + .../SharpMUTermApp.WorldBrowse.cs | 4 + .../SurfaceParityTests.cs | 28 ++- .../NativeTabStripTests.cs | 3 +- 6 files changed, 226 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cef7e25..48aaec46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,8 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] - The docked composer in the window has its escaping on a chip you can click, a paragraph and word count, and Preview and Send buttons; Preview opens the full-screen composer with the as-sent band. - The window's welcome is one page: find a world from mu*index and add it, connect directly (with the `/connect` line - it stands for), and pick a starting layout from two cards. Nothing is fetched until you ask for the list. + it stands for), and pick a starting layout from two cards. Nothing is fetched until you ask for the list. A world + listed at several addresses lets you choose one right in the Find a world card (Esc goes back to the worlds). - The desktop window's status line is now a footer under the whole window, in the window's own type, with keys in words. Clicking "Ctrl+P palette" opens the palette, and clicking a notice's action (Reconnect, Open F5…) runs it. - The desktop window draws the command line as a rounded field with the prompt in its own type and a hint at the right diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index 8365700f..42932243 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -46,9 +46,13 @@ internal sealed class WelcomeView : DockPanel, IModalView private readonly TextBlock _layoutReason; private readonly List<(WelcomeLayout Layout, Border Card)> _layoutCards = []; private readonly List _worldRows = []; + private readonly List _addressRows = []; + private readonly TextBlock _footer; private WelcomeModel _model; private WorldBrowseSession? _worlds; private WelcomeModel? _filledFrom; + private WorldGame? _choiceDrawn; + private int _address; public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) { @@ -200,7 +204,7 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) others.Children.Add(ModalParts.Button("Import…", null, colours, () => Choose(WelcomeChoice.Import))); page.Children.Add(others); - var footer = ModalParts.Footer("Tab moves · Enter connects, or searches · Esc closes", colours); + var footer = _footer = ModalParts.Footer(PageKeys, colours); SetDock(footer, Dock.Bottom); Children.Add(footer); Children.Add(new ScrollViewer @@ -248,6 +252,15 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) /// The world rows the find card shows now, for a test. public IReadOnlyList WorldRows => _worldRows; + /// The address rows the find card shows while a picked world's addresses are chosen from, for a test. + public IReadOnlyList AddressRows => _addressRows; + + /// Whether the find card lists a picked world's addresses in place of the worlds, for a test. + public bool ChoosingAddress => _worlds?.Model.Choosing is not null; + + /// The address Enter would choose, for a test. + public int SelectedAddress => _address; + /// The /connect line under the form as drawn, for a test. public string CommandLine => string.Concat(_command.Inlines?.OfType().Select(r => r.Text) ?? []); @@ -304,7 +317,19 @@ public void Connect() /// A row's Add: Browse worlds' pick of row of the list's rows. public void Add(int index) => _worlds?.Pick(index); - private static FontFamily Mono => new("JetBrains Mono, DejaVu Sans Mono, Consolas, Menlo, monospace"); + /// + /// An address row, or Enter on the selected one, while a picked world's addresses are listed: Browse worlds' own + /// choice, which reopens the welcome with the form filled in from it. + /// + public void ChooseAddress(int index) => _worlds?.Choose(index); + + /// Back, or Esc, while the addresses are listed: the worlds again, as Browse worlds' Esc does. + public void LeaveAddresses() => _worlds?.Back(); + + /// The page's keys, spelt in words. + private const string PageKeys = "Tab moves · Enter connects, or searches · Esc closes"; + + private static FontFamily Mono => NativeTokens.MonoFont; private void OnChanged(WelcomeModel model) => Dispatcher.UIThread.Post(() => { @@ -402,6 +427,8 @@ private void DrawFind() { _findBody.Children.Clear(); _worldRows.Clear(); + _addressRows.Clear(); + _search.IsVisible = true; if (!_session.CanFindWorlds) { // No directory set (or a host that cannot list in place): the model's reason, and Browse worlds as a choice. @@ -435,7 +462,23 @@ private void DrawRows() _findBody.Children.Clear(); _worldRows.Clear(); + _addressRows.Clear(); var model = worlds.Model; + if (model.Choosing is { } game) + { + DrawChoice(model, game); + return; + } + + var choosingWasDrawn = _choiceDrawn is not null; + _choiceDrawn = null; + _search.IsVisible = true; + _footer.Text = PageKeys; + if (choosingWasDrawn) + { + _search.Focus(); + } + var query = _search.Text ?? string.Empty; var shown = model.View(query, WorldDirectorySort.Players); var list = new StackPanel { Spacing = 8 }; @@ -473,6 +516,124 @@ private void DrawRows() _findNote.Foreground = _colours.Brush(model.State is WorldBrowseState.Failed || (model.Problem is not null && model.State == WorldBrowseState.Ready) ? _colours.Warn : _colours.Dim); } + /// + /// A picked world's addresses in the find card, in place of the worlds: Browse worlds' choice, with its words — whose + /// addresses and how many, the charset, then a row per address (host:port, TLS or plain, its state) — and Back. + /// + private void DrawChoice(WorldBrowseModel model, WorldGame game) + { + if (!ReferenceEquals(_choiceDrawn, game)) + { + _address = Math.Max(0, game.FirstConnectable); + } + + var fresh = _choiceDrawn is null; + _choiceDrawn = game; + _search.IsVisible = false; + _footer.Text = NativeKeys.Words(string.Join(" · ", WorldBrowseModel.ChoiceKeys.Select(k => $"{k.Key} {k.Label}"))); + _findBody.Children.Add(new TextBlock + { + Text = model.ChoiceLine, + FontSize = NativeTokens.Title, + FontWeight = FontWeight.SemiBold, + Foreground = _colours.Brush(_colours.Text), + TextWrapping = TextWrapping.Wrap, + }); + _findBody.Children.Add(new TextBlock + { + Text = model.CharsetLine, + FontSize = NativeTokens.Body, + Foreground = _colours.Brush(_colours.Dim), + TextWrapping = TextWrapping.Wrap, + }); + + var list = new StackPanel { Spacing = 2 }; + _address = Math.Clamp(_address, 0, game.Endpoints.Count - 1); + for (var i = 0; i < game.Endpoints.Count; i++) + { + var endpoint = game.Endpoints[i]; + var (address, security, state) = WorldBrowseModel.Endpoint(endpoint); + var index = i; + var line = new DockPanel(); + var host = new TextBlock + { + Text = address, + FontFamily = Mono, + FontSize = NativeTokens.Body + 1, + Foreground = _colours.Brush(_colours.Text), + Width = 210, + Margin = new Thickness(0, 0, 10, 0), + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }; + DockPanel.SetDock(host, Dock.Left); + line.Children.Add(host); + var kind = new TextBlock + { + Text = security, + FontSize = NativeTokens.Body, + FontWeight = endpoint.Tls ? FontWeight.SemiBold : FontWeight.Normal, + Foreground = _colours.Brush(endpoint.Tls ? _colours.Accent : _colours.Dim), + Width = 44, + VerticalAlignment = VerticalAlignment.Center, + }; + DockPanel.SetDock(kind, Dock.Left); + line.Children.Add(kind); + line.Children.Add(new TextBlock + { + Text = state, + FontSize = NativeTokens.Body, + Foreground = _colours.Brush(endpoint.Stale || !endpoint.Connectable ? _colours.Warn : _colours.Dim), + TextTrimming = TextTrimming.CharacterEllipsis, + VerticalAlignment = VerticalAlignment.Center, + }); + var row = ModalParts.Row(line, address, () => SelectAddress(index), () => ChooseAddress(index)); + ToolTip.SetTip(row, WorldBrowseModel.EndpointText(endpoint)); + _addressRows.Add(row); + list.Children.Add(row); + } + + _findBody.Children.Add(new ScrollViewer + { + Content = list, + MaxHeight = ShownRows * 40, + HorizontalScrollBarVisibility = global::Avalonia.Controls.Primitives.ScrollBarVisibility.Disabled, + VerticalScrollBarVisibility = global::Avalonia.Controls.Primitives.ScrollBarVisibility.Auto, + }); + + var back = ModalParts.Button("Back to the worlds", "Esc", _colours, LeaveAddresses); + back.Name = "BackToWorlds"; + back.HorizontalAlignment = HorizontalAlignment.Left; + _findBody.Children.Add(back); + + _findNote.Text = NativeKeys.Words(model.Problem ?? WorldBrowseModel.ChoiceNote); + _findNote.Foreground = _colours.Brush(model.Problem is null ? _colours.Dim : _colours.Warn); + HighlightAddress(); + + // The Add pressed to get here has left the page; the keys stay with the choice. + if (fresh) + { + back.Focus(); + } + } + + private void SelectAddress(int index) + { + if (index != _address) + { + _address = index; + HighlightAddress(); + } + } + + private void HighlightAddress() + { + for (var i = 0; i < _addressRows.Count; i++) + { + _addressRows[i].Background = i == _address ? _colours.Brush(_colours.Selected) : Brushes.Transparent; + } + } + private static int IndexOf(WorldBrowseModel model, WorldListing world) { for (var i = 0; i < model.Rows.Count; i++) @@ -624,6 +785,26 @@ private void OnKey(object? sender, KeyEventArgs e) return; } + if (_worlds?.Model.Choosing is { } game) + { + switch (e.Key) + { + case Key.Escape: + e.Handled = true; + LeaveAddresses(); + return; + case Key.Up when !IsWithinForm(e.Source): + case Key.Down when !IsWithinForm(e.Source): + e.Handled = true; + SelectAddress(ModalParts.Step(_address, e.Key == Key.Up ? -1 : 1, game.Endpoints.Count)); + return; + case Key.Enter when !IsWithinForm(e.Source): + e.Handled = true; + ChooseAddress(_address); + return; + } + } + if (e.Key == Key.Escape) { e.Handled = true; @@ -648,6 +829,10 @@ private void OnKey(object? sender, KeyEventArgs e) } } + /// Whether a key came from the connect card's fields, where Enter connects whatever the find card shows. + private bool IsWithinForm(object? source) => + source is Visual v && new Visual[] { _host, _port, _character, _tls, _passwordLater }.Any(f => IsWithin(v, f)); + private static bool IsWithin(Visual visual, Visual ancestor) { for (Visual? at = visual; at is not null; at = at.GetVisualParent()) diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index 5759247b..e463761f 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -530,6 +530,11 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), // Add is Browse worlds' own pick. The cells reach both through the Browse row. new(SurfaceActionKind.Modal, "find", "FindWorldsInWelcome"), new(SurfaceActionKind.Modal, "add", "PickWorld"), + + // A world added from there that answers at several addresses is chosen from in the card, as in Browse + // worlds, and the choice fills in the form; Esc goes back to the worlds. + new(SurfaceActionKind.Modal, "address", "ChooseWorldEndpoint"), + new(SurfaceActionKind.Modal, "leave", "LeaveWorldChoice"), ], NativeModal, "SharpMUTerm.Tui.WelcomeSurface.Render", diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs index c4b31959..baf50a87 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.WorldBrowse.cs @@ -280,6 +280,8 @@ internal void ChooseWorldEndpoint(WorldBrowseModel model, int index) return; } + // The choice is over, so a list shown again (the welcome's find card, reopened filled in) lists the worlds again. + _worldModel = _worldModel with { Choosing = null, Problem = null }; OpenWorldForm(game.Address(index)); } @@ -380,6 +382,8 @@ private void AttachWelcomeWorlds(WelcomeSession welcome) ThemeIsDark(), index => OnUiThread(() => PickWorld(worlds!.Model, index)), words => OnUiThread(() => AskWorldDirectory(words)), + endpoint => OnUiThread(() => ChooseWorldEndpoint(worlds!.Model, endpoint)), + () => OnUiThread(LeaveWorldChoice), () => { }) { Theme = _theme.Clone(), diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index f2127117..253fa5e2 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -864,20 +864,44 @@ await SameModal("welcome: layout and browse", "welcome", app.SimulateWelcomeKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); app.SimulateWelcomeKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); }); - // The welcome's Find a world card: Show worlds lists the directory in the page, Add on the first row is the - // browse list's pick — the same connect form, filled in, as the cells' Browse worlds row and ⏎. + // The welcome's Find a world card: Show worlds lists the directory in the page, Add on the second row (Lanternport, + // one address) is the browse list's pick — the same connect form, filled in, as the cells' Browse worlds row and ⏎. await SameModal("welcome: find a world and add it", "welcome", + (app, m) => + { + var welcome = (WelcomeSession)m.Open(SurfaceCatalog.Welcome)!; + welcome.FindWorlds(string.Empty); + welcome.Worlds!.Pick(1); + }, + app => + { + app.SimulateWelcomeKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + app.SimulateWelcomeKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + }); + // The demo's first world (Aetherfall) answers at several addresses, so Add lists them in the card; choosing the + // second (plain) fills in the form with it and the charset's encoding — as the cells' Browse pick and choice do. + await SameModal("welcome: add a world with several addresses, choose the second", "welcome", (app, m) => { var welcome = (WelcomeSession)m.Open(SurfaceCatalog.Welcome)!; welcome.FindWorlds(string.Empty); welcome.Worlds!.Pick(0); + if (welcome.Worlds.Model.Choosing is not { Endpoints.Count: > 1 }) + { + throw new InvalidOperationException("the demo's first world no longer answers at several addresses"); + } + + welcome.Worlds.Choose(1); }, app => { app.SimulateWelcomeKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); app.SimulateWelcomeKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); + app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\0', ConsoleKey.DownArrow, false, false, false)); + app.SimulateWorldBrowseKey(new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false)); }); probed.Add(SurfaceCatalog.Welcome); diff --git a/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs index 98030196..63d32e4d 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs @@ -56,7 +56,8 @@ private static SharpMUTermApp App(HostChrome chrome, out string frame, string? v [Test] public async Task TheStripRowStaysAndNothingMoves() { - await using var cells = App(HostChrome.HeaderAndRail, out _, "split"); + // The same arrangement with the strips left to the cells: drawing them natively is the only difference. + await using var cells = App(HostChrome.Native with { Tabs = false }, out _, "split"); await using var native = App(HostChrome.Native, out _, "split"); await Assert.That(native.PaneOutputRects()).IsEquivalentTo(cells.PaneOutputRects()); From aac28804fbf87ff82ce06524efd4a8cedf27d7c4 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 17:56:19 +0000 Subject: [PATCH 070/113] Wave 19 D: native settings window to the Desktop-Settings mockup Header with search (glass, match count) and the scoped section's subject as 'Applies to'; a nav column with the accent row; a footer; a page title with 'Showing settings that match ... Show all N'; one card per declared group with fields as rows (marked search words, Changed mark, Reset to default link). List and package pages in cards; meter table restyled with the received paths as a drop-down style panel. Planes come from new page tokens (NativeTokens.Page, the mockup's hexes on Dark, mirrored on Light, shifted for other themes, inks held to the floor). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 4 + CLAUDE.md | 11 + src/SharpMUTerm.Avalonia/ListEditorView.cs | 49 +- src/SharpMUTerm.Avalonia/NativeTokens.Page.cs | 177 +++++ src/SharpMUTerm.Avalonia/NativeTokens.cs | 2 +- src/SharpMUTerm.Avalonia/PackagePageView.cs | 21 +- src/SharpMUTerm.Avalonia/SettingsWindow.cs | 629 +++++++++++++----- src/SharpMUTerm.Avalonia/ThemeCardView.cs | 11 +- .../NativeTokenTests.cs | 34 +- .../SettingsWindowTests.cs | 2 +- 10 files changed, 737 insertions(+), 203 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/NativeTokens.Page.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 057cacdb..cd52dee8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -356,6 +356,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The desktop window's settings look like the rest of the redesigned app: a header with the search box and, for worlds + and characters, which one the settings apply to; the sections down a darker side column; each group of settings in a + card of its own, with what you searched for marked in the labels, a "Changed" mark and a "Reset to default" link; and + a footer saying changes apply as you make them. The meter table shows the paths received as a drop-down style panel. - The older-history page fits an 80×24 terminal: it sizes its page to the screen, keeps its keys on screen and no longer covers the command line. - Ctrl+F with older history says both counts on one line (`this window 3 of 39 · older 4 of 6,000`). Older matches say diff --git a/CLAUDE.md b/CLAUDE.md index fe6c9950..57f65c80 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2249,6 +2249,17 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] move), the tokens' card and edge, and a scrim over the main window (`SettingsPresenter.Scrim`; a press on it closes). Opened from the trigger builder (`SettingsForm.BesideOutput`) it is docked to the main window's right half with no scrim, so the line the rule came from stays in view. Still a separate OS window, not an overlay. + - **It is laid out as the Desktop-Settings mockup, on page tokens** (`NativeTokens.Page` → `PageTokens`, in + `NativeTokens.Page.cs`: ground, nav, card, rule, field, focus edge, button, popup, inks, link, search mark; the Dark + set is the mockup's hexes, Light mirrors it, other themes get the card's shift, every ink held to `TextFloor` on + every page plane; `PageTokens.Apply` lays them over `Apply` for Fluent). A 56 px header (title, search box with + glass and `N settings`, the scoped section's subject as *Applies to*, ✕), a 232 px nav (accent row for the section + in front, counts while searching, a note at its foot), a 36 px footer, and the page: a 20 px title, a line saying + what it shows (*Showing settings that match “x”. Show all N*, which clears the search; F5/F9's door is a link + there), then **one card per declared group** with its fields as rows (label in the label weight with search words + marked, `● Changed`, help under it; *Reset to default* link and the control on the right). A group whose name is its + only field's label draws no heading. List and package pages put both halves in cards. Still generated from the + declarations; nothing is placed by hand. Fonts are inherited (the window sets no UI family). - **Every native surface spells a key in words** (`NativeKeys.Words`, Avalonia: `KeyGlyphs.Words` plus the named keys `⏎` Enter, `⇥`/`↹` Tab, `⇤` Shift+Tab, `⌫` Backspace, `⌦` Delete, `⎋` Esc, `⇞`/`⇟` PgUp/PgDn; arrows stay arrows): `Ctrl+P`, `Alt+M`, `Ctrl+B b`, never `⌃P`/`⌥M`/`⏎`. The client writes keys in glyphs because the cells draw them diff --git a/src/SharpMUTerm.Avalonia/ListEditorView.cs b/src/SharpMUTerm.Avalonia/ListEditorView.cs index 8bdcf25b..03af45ad 100644 --- a/src/SharpMUTerm.Avalonia/ListEditorView.cs +++ b/src/SharpMUTerm.Avalonia/ListEditorView.cs @@ -54,7 +54,7 @@ public ListEditorView(SettingsForm form, SettingsSectionContribution section, Fu _visible = visible; _tokens = tokens; _accent = tokens.Brush(tokens.Accent); - ColumnDefinitions = new ColumnDefinitions("292,*"); + ColumnDefinitions = new ColumnDefinitions("316,*"); Margin = new Thickness(0, 10, 0, 0); AddButton = ToolButton("+ Add", $"Add a {_collection.Noun} to the selected set"); @@ -81,22 +81,22 @@ public ListEditorView(SettingsForm form, SettingsSectionContribution section, Fu _list.SelectionChanged += (_, _) => OnRowChosen(); _list.KeyDown += OnListKey; - var left = new DockPanel { LastChildFill = true, Margin = new Thickness(0, 0, 14, 0) }; + // Both halves are cards on the page, as the settings mockup draws its sections: the list with its tools over it, + // and the selected item's fields. + var page = tokens.Page; + var left = new DockPanel { LastChildFill = true }; DockPanel.SetDock(tools, Dock.Top); + tools.Margin = new Thickness(10, 10, 10, 4); left.Children.Add(tools); - left.Children.Add(new Border - { - Child = _list, - BorderThickness = new Thickness(1), - BorderBrush = Hairline, - CornerRadius = new CornerRadius(NativeTokens.RadiusM), - }); - Children.Add(left); + _list.Margin = new Thickness(4, 0, 4, 6); + left.Children.Add(_list); + Children.Add(PageCard(left, page, new Thickness(0), new Thickness(0, 0, 16, 0))); - _detail = new StackPanel { Spacing = 2, Margin = new Thickness(4, 0, 4, 16) }; + _detail = new StackPanel { Spacing = 2, Margin = new Thickness(20, 16, 20, 18) }; var scroller = new ScrollViewer { Content = _detail, HorizontalScrollBarVisibility = global::Avalonia.Controls.Primitives.ScrollBarVisibility.Disabled }; - SetColumn(scroller, 1); - Children.Add(scroller); + var detailCard = PageCard(scroller, page, new Thickness(0), new Thickness(0)); + SetColumn(detailCard, 1); + Children.Add(detailCard); // The item this section had selected last (switched away from, or the window closed) wins over the first — // unless the form opened on an item of this list (the trigger builder's new rule). @@ -196,14 +196,27 @@ public void Refresh() // ── the list ───────────────────────────────────────────────────────────────────────────────── - private IBrush Hairline => _tokens.Brush(_tokens.Edge); + private IBrush Hairline => _tokens.Page.Brush(_tokens.Page.Rule); + + /// A card on the settings page: the card plane, a hairline edge, the card radius. + internal static Border PageCard(Control child, PageTokens page, Thickness padding, Thickness margin) => new() + { + Child = child, + Background = page.Brush(page.Card), + BorderBrush = page.Brush(page.Rule), + BorderThickness = new Thickness(1), + CornerRadius = new CornerRadius(NativeTokens.RadiusCard), + Padding = padding, + Margin = margin, + ClipToBounds = true, + }; /// A quiet line's ink, held to the floor (an opacity would not be). - private IBrush DimInk => _tokens.Brush(_tokens.Dim); + private IBrush DimInk => _tokens.Page.Brush(_tokens.Page.Dim); private static Button ToolButton(string text, string tip) { - var button = new Button { Content = text, Padding = new Thickness(8, 3), MinWidth = 32, HorizontalContentAlignment = HorizontalAlignment.Center }; + var button = new Button { Content = text, Padding = new Thickness(10, 4), MinWidth = 32, FontSize = NativeTokens.Label, HorizontalContentAlignment = HorizontalAlignment.Center }; ToolTip.SetTip(button, NativeKeys.Words(tip)); AutomationProperties.SetName(button, tip); return button; @@ -445,7 +458,7 @@ private void BuildDetail() } var title = _collection.TitleOf(item); - _detail.Children.Add(new TextBlock { Text = title.Length == 0 ? "(unnamed)" : NativeKeys.Words(title), FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold, TextTrimming = TextTrimming.CharacterEllipsis }); + _detail.Children.Add(new TextBlock { Text = title.Length == 0 ? "(unnamed)" : NativeKeys.Words(title), FontSize = NativeTokens.PageTitle - 2, FontWeight = FontWeight.SemiBold, TextTrimming = TextTrimming.CharacterEllipsis }); if (group.ReadOnly) { var banner = new DockPanel { LastChildFill = true, Margin = new Thickness(0, 6, 0, 4) }; @@ -521,7 +534,7 @@ private static Grid Row(SettingsField field, Control control) { var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("118,*"), Margin = new Thickness(0, 3), MinHeight = 34 }; var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 12, 0) }; - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Title, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Label, FontWeight = FontWeight.SemiBold, TextWrapping = TextWrapping.Wrap }); if (field.Help is { } help) { ToolTip.SetTip(words, NativeKeys.Words(Capitalise(help))); diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.Page.cs b/src/SharpMUTerm.Avalonia/NativeTokens.Page.cs new file mode 100644 index 00000000..6cfedc24 --- /dev/null +++ b/src/SharpMUTerm.Avalonia/NativeTokens.Page.cs @@ -0,0 +1,177 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Media; +using SharpMUTerm.Core.Text; + +namespace SharpMUTerm.Avalonia; + +/// +/// The page tokens: the planes a full page is built from (the settings window), as against a surface floating over the +/// cells (the palette, a modal). The settings mockup lays a page out on three planes — a ground, a navigation column a +/// step above it and cards a step above that — with hairline rules, inputs sunk into the ground and a yellow mark for a +/// search match. The Dark set is the mockup's own; the Light set mirrors it; any other theme gets the same shift of its +/// background the canonical card gets, and every ink is held to on every page plane. +/// +internal sealed partial record NativeTokens +{ + /// A page's own heading (the settings section's title). + public const double PageTitle = 20; + + /// A card's heading on a page (a settings group). + public const double CardTitle = 15; + + /// A field's label on a page. + public const double Label = 13; + + /// Corner radius of an input, a button or a navigation row on a page. + public const double RadiusControl = 6; + + /// Corner radius of a card on a page. + public const double RadiusCard = 10; + + /// The page planes and inks for this theme. + public PageTokens Page => PageFor(this); + + private sealed record PageCanon( + Rgb Ground, Rgb Nav, Rgb Card, Rgb Rule, Rgb Field, Rgb FieldEdge, Rgb FocusEdge, Rgb Button, Rgb Popup, + Rgb PopupSelected, Rgb Text, Rgb Dim, Rgb Mark, Rgb MarkInk); + + /// The settings mockup's dark page. + private static readonly PageCanon DarkPage = new( + new Rgb(0x10, 0x13, 0x1a), + new Rgb(0x14, 0x18, 0x22), + new Rgb(0x17, 0x1b, 0x24), + new Rgb(0x2c, 0x34, 0x47), + new Rgb(0x10, 0x13, 0x1a), + new Rgb(0x2c, 0x34, 0x47), + new Rgb(0x3a, 0x4f, 0x73), + new Rgb(0x1d, 0x23, 0x33), + new Rgb(0x1d, 0x23, 0x33), + new Rgb(0x23, 0x30, 0x49), + new Rgb(0xd7, 0xde, 0xec), + new Rgb(0x9a, 0xa4, 0xb8), + new Rgb(0x4a, 0x42, 0x20), + new Rgb(0xf5, 0xe6, 0x63)); + + /// The same page mirrored for a light theme. + private static readonly PageCanon LightPage = new( + new Rgb(0xf3, 0xf4, 0xf7), + new Rgb(0xec, 0xee, 0xf3), + new Rgb(0xff, 0xff, 0xff), + new Rgb(0xdd, 0xe1, 0xe8), + new Rgb(0xff, 0xff, 0xff), + new Rgb(0xc9, 0xcf, 0xda), + new Rgb(0x7d, 0x8f, 0xb0), + new Rgb(0xf4, 0xf5, 0xf8), + new Rgb(0xff, 0xff, 0xff), + new Rgb(0xe3, 0xea, 0xf5), + new Rgb(0x1d, 0x22, 0x2c), + new Rgb(0x5a, 0x63, 0x73), + new Rgb(0xfb, 0xea, 0xa0), + new Rgb(0x4a, 0x3c, 0x00)); + + private static PageTokens PageFor(NativeTokens tokens) + { + var canon = tokens.IsDark ? DarkCanon : LightCanon; + var page = tokens.IsDark ? DarkPage : LightPage; + + // The theme's shift off the canonical background, recovered from the card it was laid onto. + var shift = (tokens.Card.R - canon.Card.R, tokens.Card.G - canon.Card.G, tokens.Card.B - canon.Card.B); + var ground = Shift(page.Ground, shift); + var nav = Shift(page.Nav, shift); + var card = Shift(page.Card, shift); + var field = Shift(page.Field, shift); + var button = Shift(page.Button, shift); + var popup = Shift(page.Popup, shift); + var popupSelected = Shift(page.PopupSelected, shift); + Rgb[] planes = [ground, nav, card, field, button, popup, popupSelected]; + var accent = new Rgb(tokens.Accent.R, tokens.Accent.G, tokens.Accent.B); + var mark = Shift(page.Mark, shift); + + return new PageTokens( + Colour(ground), + Colour(nav), + Colour(card), + Colour(Shift(page.Rule, shift)), + Colour(field), + Colour(Shift(page.FieldEdge, shift)), + Colour(Shift(page.FocusEdge, shift)), + Colour(button), + Colour(popup), + Colour(popupSelected), + Colour(Held(page.Text, planes)), + Colour(Held(page.Dim, planes)), + Colour(Held(accent, planes)), + Colour(mark), + Colour(Held(page.MarkInk, [mark]))); + } +} + +/// A page's planes and inks (). +internal sealed record PageTokens( + Color Ground, + Color Nav, + Color Card, + Color Rule, + Color Field, + Color FieldEdge, + Color FocusEdge, + Color Button, + Color Popup, + Color PopupSelected, + Color Text, + Color Dim, + Color Link, + Color Mark, + Color MarkInk) +{ + /// A brush of . + public SolidColorBrush Brush(Color colour) => new(colour); + + /// + /// Lays the page planes over what handed Fluent: inputs sunk into the ground with a + /// hairline edge and the focus edge when focused, buttons on the raised button plane, drop-downs on the popup plane, + /// and the control radius the page uses. + /// + public void Apply(IResourceDictionary resources) + { + ArgumentNullException.ThrowIfNull(resources); + + void Set(Color colour, params string[] keys) + { + var brush = Brush(colour); + foreach (var key in keys) + { + resources[key] = brush; + } + } + + Set(Field, + "TextControlBackground", "TextControlBackgroundPointerOver", "TextControlBackgroundFocused", + "ComboBoxBackground", "ComboBoxBackgroundPointerOver", "ComboBoxBackgroundFocused"); + Set(FieldEdge, + "TextControlBorderBrush", "ComboBoxBorderBrush", + "ButtonBorderBrush", "RepeatButtonBorderBrush", "ToggleSwitchStrokeOff", + "CheckBoxCheckBackgroundStrokeUnchecked"); + Set(FocusEdge, + "TextControlBorderBrushFocused", "ComboBoxBorderBrushPointerOver", "ButtonBorderBrushPointerOver", + "TextControlBorderBrushPointerOver", "ComboBoxDropDownBorderBrush"); + Set(Button, "ButtonBackground", "RepeatButtonBackground", "ToggleSwitchFillOff", "ToggleSwitchFillOffPointerOver"); + Set(PopupSelected, + "ButtonBackgroundPointerOver", "ButtonBackgroundPressed", "RepeatButtonBackgroundPointerOver", + "ComboBoxItemBackgroundPointerOver", "ComboBoxItemBackgroundSelected", "ComboBoxItemBackgroundSelectedPointerOver", + "ListBoxItemBackgroundPointerOver", "ListBoxItemBackgroundSelected", "ListBoxItemBackgroundSelectedPointerOver", + "ListBoxItemBackgroundSelectedPressed", "SystemControlHighlightListAccentLowBrush", + "SystemControlHighlightListAccentMediumBrush", "SystemControlHighlightListAccentHighBrush"); + Set(Card, "TabItemHeaderBackgroundSelected"); + Set(Popup, "ComboBoxDropDownBackground", "FlyoutPresenterBackground", "MenuFlyoutPresenterBackground"); + Set(Text, + "TextControlForeground", "TextControlForegroundPointerOver", "TextControlForegroundFocused", "ButtonForeground", + "ButtonForegroundPointerOver", "ButtonForegroundPressed", "ComboBoxForeground", "ComboBoxItemForeground", + "ComboBoxItemForegroundSelected", "ListBoxItemForeground", "ListBoxItemForegroundPointerOver", + "ToggleSwitchContentForeground", "CheckBoxForegroundUnchecked", "CheckBoxForegroundChecked"); + Set(Dim, "TextControlPlaceholderForeground", "TextControlPlaceholderForegroundPointerOver", + "TextControlPlaceholderForegroundFocused"); + resources["ControlCornerRadius"] = new CornerRadius(NativeTokens.RadiusControl); + } +} diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.cs b/src/SharpMUTerm.Avalonia/NativeTokens.cs index 8c8bb89f..356363c8 100644 --- a/src/SharpMUTerm.Avalonia/NativeTokens.cs +++ b/src/SharpMUTerm.Avalonia/NativeTokens.cs @@ -25,7 +25,7 @@ namespace SharpMUTerm.Avalonia; /// their reasons. /// /// -internal sealed record NativeTokens( +internal sealed partial record NativeTokens( bool IsDark, Color Scrim, Color Card, diff --git a/src/SharpMUTerm.Avalonia/PackagePageView.cs b/src/SharpMUTerm.Avalonia/PackagePageView.cs index 235fa095..575db670 100644 --- a/src/SharpMUTerm.Avalonia/PackagePageView.cs +++ b/src/SharpMUTerm.Avalonia/PackagePageView.cs @@ -186,25 +186,20 @@ public void Refresh() private Grid MasterDetail(Control list, Control detail) { - var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("260,*"), Margin = new Thickness(0, 10, 0, 0) }; - grid.Children.Add(new Border - { - Child = list, - BorderThickness = new Thickness(1), - BorderBrush = Hairline, - CornerRadius = new CornerRadius(NativeTokens.RadiusM), - Margin = new Thickness(0, 0, 14, 0), - }); + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("260,*"), Margin = new Thickness(0, 12, 0, 0) }; + var page = _tokens.Page; + grid.Children.Add(ListEditorView.PageCard(list, page, new Thickness(4, 6), new Thickness(0, 0, 16, 0))); var scroller = new ScrollViewer { Content = detail, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }; - SetColumn(scroller, 1); - grid.Children.Add(scroller); + var card = ListEditorView.PageCard(scroller, page, new Thickness(16, 12, 4, 0), new Thickness(0)); + SetColumn(card, 1); + grid.Children.Add(card); return grid; } - private IBrush Hairline => _tokens.Brush(_tokens.Edge); + private IBrush Hairline => _tokens.Page.Brush(_tokens.Page.Rule); /// A quiet line's ink, held to the floor (an opacity would not be). - private IBrush DimInk => _tokens.Brush(_tokens.Dim); + private IBrush DimInk => _tokens.Page.Brush(_tokens.Page.Dim); private IBrush Warning => _tokens.Brush(_tokens.Warn); diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index e8ab8618..060a00e4 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -2,6 +2,7 @@ using Avalonia; using Avalonia.Automation; using Avalonia.Controls; +using Avalonia.Controls.Documents; using Avalonia.Controls.Primitives; using Avalonia.Controls.Shapes; using Avalonia.Input; @@ -44,6 +45,16 @@ internal sealed class SettingsWindow : Window private readonly List _themeCards = []; private readonly Border _frame; private readonly TextBlock _title; + private readonly Border _bar; + private readonly Border _searchFrame; + private readonly TextBlock _searchCount; + private readonly global::Avalonia.Controls.Shapes.Path _searchGlass; + private readonly ContentControl _scope; + private readonly Border _nav; + private readonly TextBlock _navNote; + private readonly Border _footer; + private readonly TextBlock _footerLeft; + private readonly TextBlock _footerRight; private SettingsForm _form; private NativeTokens _tokens; private IReadOnlyList _matches = []; @@ -53,7 +64,7 @@ internal sealed class SettingsWindow : Window private int _meterRows = -1; /// The size the window first opens at, before the player resizes it. - internal const double DefaultWidth = 960, DefaultHeight = 680; + internal const double DefaultWidth = 1120, DefaultHeight = 760; public SettingsWindow(SettingsForm form) { @@ -63,7 +74,7 @@ public SettingsWindow(SettingsForm form) Width = DefaultWidth; Height = DefaultHeight; MinWidth = 640; - MinHeight = 420; + MinHeight = 440; WindowStartupLocation = WindowStartupLocation.CenterOwner; // The palette's frame, not the platform's: the window draws its own title, close button and edge, so it reads @@ -71,19 +82,20 @@ public SettingsWindow(SettingsForm form) WindowDecorations = WindowDecorations.None; Styles.Add(new FluentTheme()); + // ── the header: title, search, the subject a scoped section is for, close ── _title = new TextBlock { Text = "Settings", - FontSize = NativeTokens.Title, + FontSize = NativeTokens.CardTitle + 1, FontWeight = FontWeight.SemiBold, VerticalAlignment = VerticalAlignment.Center, - Margin = new Thickness(16, 0, 0, 0), + Width = 212, }; CloseButton = new Button { Content = "✕", Padding = new Thickness(10, 4), - Margin = new Thickness(0, 0, 8, 0), + Margin = new Thickness(12, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center, Background = Brushes.Transparent, BorderThickness = new Thickness(0), @@ -91,35 +103,107 @@ public SettingsWindow(SettingsForm form) AutomationProperties.SetName(CloseButton, "Close settings"); ToolTip.SetTip(CloseButton, "Close (Esc)"); CloseButton.Click += (_, _) => Close(); - var bar = new DockPanel { Height = 40, LastChildFill = true, Background = Brushes.Transparent }; - DockPanel.SetDock(CloseButton, Dock.Right); - bar.Children.Add(CloseButton); - bar.Children.Add(_title); - bar.PointerPressed += (_, e) => - { - if (e.GetCurrentPoint(bar).Properties.IsLeftButtonPressed && !ReferenceEquals(e.Source, CloseButton)) - { - BeginMoveDrag(e); - } - }; - DockPanel.SetDock(bar, Dock.Top); _search = new TextBox { PlaceholderText = "Search settings", - Margin = new Thickness(16, 4, 16, 10), - FontSize = NativeTokens.Title, - Padding = new Thickness(12, 7), + FontSize = NativeTokens.Label, + Padding = new Thickness(0, 2), + MinHeight = 0, + BorderThickness = new Thickness(0), + Background = Brushes.Transparent, + VerticalAlignment = VerticalAlignment.Center, }; + foreach (var key in new[] + { + "TextControlBackground", "TextControlBackgroundPointerOver", "TextControlBackgroundFocused", + "TextControlBorderBrush", "TextControlBorderBrushPointerOver", "TextControlBorderBrushFocused", + }) + { + _search.Resources[key] = Brushes.Transparent; + } + AutomationProperties.SetName(_search, "Search settings"); _search.TextChanged += (_, _) => OnQuery(); - DockPanel.SetDock(_search, Dock.Top); - - _sections = new ListBox { Width = 250, Margin = new Thickness(8, 0, 0, 12), Background = Brushes.Transparent }; + _searchCount = new TextBlock { FontSize = NativeTokens.Body, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8, 0, 0, 0) }; + _searchGlass = new global::Avalonia.Controls.Shapes.Path + { + Data = Geometry.Parse("M6,0 A6,6 0 1 1 6,12 A6,6 0 1 1 6,0 M10.5,10.5 L14,14"), + StrokeThickness = 1.6, + Width = 14, + Height = 14, + Stretch = Stretch.Uniform, + VerticalAlignment = VerticalAlignment.Center, + Margin = new Thickness(0, 0, 8, 0), + }; + var searchRow = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto") }; + searchRow.Children.Add(_searchGlass); + Grid.SetColumn(_search, 1); + searchRow.Children.Add(_search); + Grid.SetColumn(_searchCount, 2); + searchRow.Children.Add(_searchCount); + _searchFrame = new Border + { + Child = searchRow, + BorderThickness = new Thickness(1), + CornerRadius = new CornerRadius(NativeTokens.RadiusM), + Padding = new Thickness(12, 6), + HorizontalAlignment = HorizontalAlignment.Stretch, + VerticalAlignment = VerticalAlignment.Center, + Cursor = new Cursor(StandardCursorType.Ibeam), + }; + _searchFrame.PointerPressed += (_, _) => _search.Focus(); + + _scope = new ContentControl { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(16, 0, 0, 0) }; + var header = new Grid { ColumnDefinitions = [new ColumnDefinition(GridLength.Auto), new ColumnDefinition(3, GridUnitType.Star) { MaxWidth = 480 }, new ColumnDefinition(GridLength.Star), new ColumnDefinition(GridLength.Auto), new ColumnDefinition(GridLength.Auto)], Margin = new Thickness(20, 0, 8, 0), Background = Brushes.Transparent }; + header.Children.Add(_title); + Grid.SetColumn(_searchFrame, 1); + header.Children.Add(_searchFrame); + Grid.SetColumn(_scope, 3); + header.Children.Add(_scope); + Grid.SetColumn(CloseButton, 4); + header.Children.Add(CloseButton); + _bar = new Border { Height = 56, BorderThickness = new Thickness(0, 0, 0, 1), Child = header }; + _bar.PointerPressed += (_, e) => + { + if (e.GetCurrentPoint(_bar).Properties.IsLeftButtonPressed + && (ReferenceEquals(e.Source, _bar) || ReferenceEquals(e.Source, header) || ReferenceEquals(e.Source, _title))) + { + BeginMoveDrag(e); + } + }; + DockPanel.SetDock(_bar, Dock.Top); + + // ── the footer ── + _footerLeft = new TextBlock { Text = "Changes apply to connected sessions as you make them.", FontSize = NativeTokens.Body, VerticalAlignment = VerticalAlignment.Center }; + _footerRight = new TextBlock { Text = "Ctrl+F searches · Esc closes", FontSize = NativeTokens.Body, VerticalAlignment = VerticalAlignment.Center }; + var footerRow = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), Margin = new Thickness(20, 0) }; + footerRow.Children.Add(_footerLeft); + Grid.SetColumn(_footerRight, 1); + footerRow.Children.Add(_footerRight); + _footer = new Border { Height = 36, BorderThickness = new Thickness(0, 1, 0, 0), Child = footerRow }; + DockPanel.SetDock(_footer, Dock.Bottom); + + // ── the section navigation ── + _sections = new ListBox { Background = Brushes.Transparent, Padding = new Thickness(0) }; _sections.SelectionChanged += (_, _) => OnSectionChosen(); - DockPanel.SetDock(_sections, Dock.Left); - - _page = new StackPanel { Margin = new Thickness(28, 4, 28, 28), Spacing = 2 }; + _navNote = new TextBlock + { + Text = "Every page here is drawn from the same declared settings the terminal's F-screens use.", + FontSize = NativeTokens.Body, + LineHeight = 18, + TextWrapping = TextWrapping.Wrap, + Margin = new Thickness(10, 8, 10, 4), + }; + var navDock = new DockPanel { LastChildFill = true }; + DockPanel.SetDock(_navNote, Dock.Bottom); + navDock.Children.Add(_navNote); + navDock.Children.Add(_sections); + _nav = new Border { Width = 232, BorderThickness = new Thickness(0, 0, 1, 0), Padding = new Thickness(10, 12), Child = navDock }; + DockPanel.SetDock(_nav, Dock.Left); + + // ── the page ── + _page = new StackPanel { Margin = new Thickness(40, 24, 40, 28), Spacing = 20 }; _scroller = new ScrollViewer { Content = _page, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }; // A list editor fills the page below its title rather than scrolling with it: its list and its detail scroll @@ -138,9 +222,9 @@ public SettingsWindow(SettingsForm form) }; var dock = new DockPanel { LastChildFill = true }; - dock.Children.Add(bar); - dock.Children.Add(_search); - dock.Children.Add(_sections); + dock.Children.Add(_bar); + dock.Children.Add(_footer); + dock.Children.Add(_nav); dock.Children.Add(_scroller); _frame = new Border { BorderThickness = new Thickness(1), Child = dock }; @@ -197,11 +281,39 @@ private void ApplyTokens(NativeTokens tokens) _tokens = tokens; RequestedThemeVariant = tokens.IsDark ? ThemeVariant.Dark : ThemeVariant.Light; tokens.Apply(Resources); - Background = tokens.Brush(tokens.Card); - Foreground = tokens.Brush(tokens.Text); - _frame.BorderBrush = tokens.Brush(tokens.Edge); - _title.Foreground = tokens.Brush(tokens.Text); - CloseButton.Foreground = tokens.Brush(tokens.Dim); + var page = tokens.Page; + page.Apply(Resources); + foreach (var key in new[] { "SystemControlHighlightListAccentLowBrush", "SystemControlHighlightListAccentMediumBrush", "SystemControlHighlightListAccentHighBrush" }) + { + _sections.Resources[key] = tokens.Brush(tokens.Accent); + } + + _sections.Resources["ListBoxItemBackgroundSelected"] = tokens.Brush(tokens.Accent); + _sections.Resources["ListBoxItemBackgroundSelectedPointerOver"] = tokens.Brush(tokens.Accent); + _sections.Resources["ListBoxItemBackgroundSelectedPressed"] = tokens.Brush(tokens.Accent); + _sections.Resources["ListBoxItemForegroundSelected"] = tokens.Brush(tokens.AccentInk); + _sections.Resources["ListBoxItemForegroundSelectedPointerOver"] = tokens.Brush(tokens.AccentInk); + _sections.Resources["ListBoxItemBackgroundPointerOver"] = page.Brush(page.Button); + _sections.Resources["ListBoxItemBackgroundPressed"] = page.Brush(page.PopupSelected); + Background = page.Brush(page.Ground); + Foreground = page.Brush(page.Text); + _frame.BorderBrush = page.Brush(page.Rule); + _frame.Background = page.Brush(page.Ground); + _bar.Background = page.Brush(page.Card); + _bar.BorderBrush = page.Brush(page.Rule); + _footer.Background = page.Brush(page.Card); + _footer.BorderBrush = page.Brush(page.Rule); + _footerLeft.Foreground = page.Brush(page.Dim); + _footerRight.Foreground = page.Brush(page.Dim); + _nav.Background = page.Brush(page.Nav); + _nav.BorderBrush = page.Brush(page.Rule); + _navNote.Foreground = page.Brush(page.Dim); + _searchFrame.Background = page.Brush(page.Ground); + _searchFrame.BorderBrush = page.Brush(page.FocusEdge); + _searchGlass.Stroke = page.Brush(page.Dim); + _searchCount.Foreground = page.Brush(page.Dim); + _title.Foreground = page.Brush(page.Text); + CloseButton.Foreground = page.Brush(page.Dim); } /// The ids of the fields drawn on the right, in order, for a test. @@ -211,7 +323,7 @@ private void ApplyTokens(NativeTokens tokens) public IReadOnlyDictionary FieldControls => _controls; /// The height a list editor takes: the page's viewport less the title above it. - private double ListEditorHeight() => Math.Max(360, _scroller.Bounds.Height - 96); + private double ListEditorHeight() => Math.Max(360, _scroller.Bounds.Height - 124); /// F10's package manager page, or null on any other page. internal PackagePageView? PackagePage { get; private set; } @@ -278,14 +390,22 @@ private void BuildSectionList() var items = new List(); foreach (var section in _form.Sections) { - var title = new TextBlock { Text = section.Title, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; - var badge = new TextBlock { Foreground = DimInk, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8, 0, 0, 0) }; + var title = new TextBlock { Text = section.Title, FontSize = NativeTokens.Label, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; + var badge = new TextBlock { FontSize = NativeTokens.Label, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8, 0, 0, 0) }; _badges[section.Id] = badge; var row = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; row.Children.Add(title); Grid.SetColumn(badge, 1); row.Children.Add(badge); - var item = new ListBoxItem { Content = row, Tag = section.Id, Padding = new Thickness(12, 9) }; + var item = new ListBoxItem + { + Content = row, + Tag = section.Id, + Padding = new Thickness(10, 8), + Margin = new Thickness(0, 0, 0, 2), + MinHeight = 0, + CornerRadius = new CornerRadius(NativeTokens.RadiusControl), + }; ToolTip.SetTip(item, SettingsForm.IsDeclared(section) ? section.Key : $"Opens the {section.Key} screen"); items.Add(item); } @@ -311,6 +431,30 @@ private void UpdateBadges() item.Opacity = searching && count == 0 ? 0.45 : 1; } } + + StyleNavigation(); + var total = _matches.Count(m => m.Field is not null); + _searchCount.Text = searching ? $"{total} setting{(total == 1 ? string.Empty : "s")}" : string.Empty; + } + + /// + /// The chosen section's row wears the accent with its ink and weight, as the mockup's does; the rest wear the page's + /// text, their counts quiet. (The row's fill is the list's own selected brush.) + /// + private void StyleNavigation() + { + var page = _tokens.Page; + foreach (var item in Items) + { + var chosen = Equals(item.Tag, _shown); + if (item.Content is Grid { Children: [TextBlock title, TextBlock badge] }) + { + title.FontWeight = chosen ? FontWeight.SemiBold : FontWeight.Normal; + title.Foreground = chosen ? _tokens.Brush(_tokens.AccentInk) : page.Brush(page.Text); + badge.FontWeight = title.FontWeight; + badge.Foreground = chosen ? _tokens.Brush(_tokens.AccentInk) : page.Brush(page.Dim); + } + } } private void OnSectionChosen() @@ -346,6 +490,7 @@ private void Select(string? id) _choosing = true; _sections.SelectedItem = Items.FirstOrDefault(i => Equals(i.Tag, id)); _choosing = false; + StyleNavigation(); } // ── search ─────────────────────────────────────────────────────────────────────────────────── @@ -390,15 +535,13 @@ private void BuildPage() _meterRows = -1; if (_shown is null || _form.Section(_shown) is not { } section) { + _scope.Content = null; ShownFields = []; return; } - _page.Children.Add(new TextBlock { Text = section.Title, FontSize = NativeTokens.Heading, FontWeight = FontWeight.SemiBold, Margin = new Thickness(0, 0, 0, 2) }); - if (section.Key is { } key) - { - _page.Children.Add(new TextBlock { Text = $"{key} in the client · changes apply as you make them", Foreground = DimInk, Margin = new Thickness(0, 0, 0, 6) }); - } + _scope.Content = section.Scope is SettingScope.World or SettingScope.Character ? SubjectRow(section) : null; + _page.Children.Add(PageHead(section)); if (section.Packages is not null) { @@ -455,14 +598,12 @@ private void BuildPage() return; } - if (section.Scope != SettingScope.App) + if (section.Scope != SettingScope.App && !_form.HasSubject(section)) { - _page.Children.Add(SubjectRow(section)); - if (!_form.HasSubject(section)) - { - ShownFields = []; - return; - } + var noun = section.Scope == SettingScope.World ? "world" : "character"; + _page.Children.Add(new TextBlock { Text = $"There is no {noun} yet. Add one on its own screen.", Foreground = DimInk }); + ShownFields = []; + return; } var visible = Searching @@ -473,24 +614,35 @@ private void BuildPage() _page.Children.Add(new TextBlock { Text = "No setting here matches the search.", Foreground = DimInk, Margin = new Thickness(0, 16, 0, 0) }); } + // A card per group, as the mockup draws its sections: the group's name heads it and its fields are rows inside, + // a hairline between them. + StackPanel? body = null; string? group = null; foreach (var field in visible) { - if (field.Group is { } heading && !string.Equals(heading, group, StringComparison.Ordinal)) + if (body is null || !string.Equals(field.Group, group, StringComparison.Ordinal)) { - group = heading; - _page.Children.Add(new TextBlock + group = field.Group; + body = new StackPanel(); + if (group is { } heading && !string.Equals(heading, field.Label, StringComparison.OrdinalIgnoreCase)) { - Text = heading.ToUpperInvariant(), - FontSize = NativeTokens.Small, - FontWeight = FontWeight.SemiBold, - LetterSpacing = 0.8, - Margin = new Thickness(0, 20, 0, 6), - Foreground = _tokens.Brush(_tokens.Header), - }); + body.Children.Add(new TextBlock + { + Text = heading, + FontSize = NativeTokens.CardTitle, + FontWeight = FontWeight.SemiBold, + Margin = new Thickness(0, 12, 0, 0), + }); + } + + _page.Children.Add(Card(body)); + } + else + { + body.Children.Add(new Border { Height = 1, Background = _tokens.Page.Brush(_tokens.Page.Rule) }); } - _page.Children.Add(field switch + body.Children.Add(field switch { ListField { Id: BuiltInSettings.MetersField } meters => MeterTable(meters), ThemeField theme => ThemePicker(theme), @@ -502,66 +654,134 @@ private void BuildPage() } /// - /// A scoped section's header row: which world or character its fields are for, picked from every one there is, and - /// the way to the section's own cell screen for what is not a field — the lists of characters and trigger sets, - /// adding and deleting. With nothing to edit yet it says so and offers only the screen. + /// The page's heading: the section's title and, under it, what the page is showing — the screen it is in the + /// terminal, or what the search matched with the way back to everything — and, for a scoped section, the way to its + /// own cell screen for what is not a field (the lists of characters and trigger sets, adding and deleting). /// - private StackPanel SubjectRow(SettingsSectionContribution section) + private StackPanel PageHead(SettingsSectionContribution section) { - var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, Margin = new Thickness(0, 6, 0, 2) }; - var subjects = _form.Subjects(section.Scope); - var noun = section.Scope == SettingScope.World ? "world" : "character"; - if (subjects.Count == 0) + var head = new StackPanel { Spacing = 6 }; + head.Children.Add(new TextBlock { Text = section.Title, FontSize = NativeTokens.PageTitle, FontWeight = FontWeight.SemiBold }); + var line = new WrapPanel { Orientation = Orientation.Horizontal }; + if (Searching) { - row.Children.Add(new TextBlock { Text = $"There is no {noun} yet.", VerticalAlignment = VerticalAlignment.Center, Foreground = DimInk }); + line.Children.Add(new TextBlock { Text = $"Showing settings that match “{_search.Text!.Trim()}”. ", FontSize = NativeTokens.Label, Foreground = DimInk, VerticalAlignment = VerticalAlignment.Center }); + var all = section.Fields.Count; + var clear = LinkButton(all > 0 ? $"Show all {all}" : "Show all"); + AutomationProperties.SetName(clear, "Clear the search"); + clear.Click += (_, _) => _search.Text = string.Empty; + line.Children.Add(clear); } - else + else if (section.Key is { } key) { - var labels = subjects.Select(s => s.Label).ToList(); - var current = _form.Subject(section.Scope); - var picker = new ComboBox { ItemsSource = labels, MinWidth = 240, SelectedItem = current?.Label }; - AutomationProperties.SetName(picker, $"The {noun} these settings are for"); - picker.SelectionChanged += (_, _) => - { - if (!_syncing && picker.SelectedIndex is >= 0 and var i && i < subjects.Count - && !string.Equals(subjects[i].Label, _form.Subject(section.Scope)?.Label, StringComparison.Ordinal)) - { - _form.Choose(subjects[i]); - var offset = _scroller.Offset; - BuildPage(); - _scroller.Offset = offset; - } - }; - SubjectPicker = picker; - row.Children.Add(new TextBlock { Text = section.Scope == SettingScope.World ? "World" : "Character", VerticalAlignment = VerticalAlignment.Center, FontWeight = FontWeight.SemiBold }); - row.Children.Add(picker); + line.Children.Add(new TextBlock { Text = $"{key} in the client · changes apply as you make them", FontSize = NativeTokens.Label, Foreground = DimInk, VerticalAlignment = VerticalAlignment.Center }); } - if (section.Key is { } key) + if (section.Scope is SettingScope.World or SettingScope.Character && section.Key is { } screen) { - var door = new Button { Content = $"Open the {key} screen ↗", VerticalAlignment = VerticalAlignment.Center }; + var door = LinkButton($"Open the {screen} screen ↗"); + door.Margin = new Thickness(line.Children.Count > 0 ? 12 : 0, 0, 0, 0); ToolTip.SetTip(door, section.Scope == SettingScope.World ? "Adding and deleting worlds, their characters and trigger sets are on the cell screen" : "Adding and deleting characters is on the cell screen"); - AutomationProperties.SetName(door, $"Open the {key} screen"); + AutomationProperties.SetName(door, $"Open the {screen} screen"); var id = section.Id; door.Click += (_, _) => _form.OpenScreen(id); ScreenDoor = door; - row.Children.Add(door); + line.Children.Add(door); } + if (line.Children.Count > 0) + { + head.Children.Add(line); + } + + return head; + } + + /// A card on the page: the card plane, a hairline edge, the card radius. + private Border Card(Control body) => new() + { + Child = body, + Background = _tokens.Page.Brush(_tokens.Page.Card), + BorderBrush = _tokens.Page.Brush(_tokens.Page.Rule), + BorderThickness = new Thickness(1), + CornerRadius = new CornerRadius(NativeTokens.RadiusCard), + Padding = new Thickness(20, 6), + }; + + /// A button drawn as a link in the accent, underlined, as the mockup's "Reset to default" and "Show all". + private Button LinkButton(string text) + { + var button = new Button + { + Content = new TextBlock { Text = text, TextDecorations = TextDecorations.Underline, FontSize = NativeTokens.Body }, + Background = Brushes.Transparent, + BorderThickness = new Thickness(0), + Padding = new Thickness(0), + MinHeight = 0, + VerticalAlignment = VerticalAlignment.Center, + Foreground = _tokens.Page.Brush(_tokens.Page.Link), + Cursor = new Cursor(StandardCursorType.Hand), + }; + foreach (var key in new[] { "ButtonBackgroundPointerOver", "ButtonBackgroundPressed", "ButtonBorderBrushPointerOver" }) + { + button.Resources[key] = Brushes.Transparent; + } + + foreach (var key in new[] { "ButtonForegroundPointerOver", "ButtonForegroundPressed" }) + { + button.Resources[key] = _tokens.Page.Brush(_tokens.Page.Link); + } + + return button; + } + + /// + /// A scoped section's subject, in the header as the mockup's "Applies to": which world or character the fields are + /// for, picked from every one there is. + /// + private Control SubjectRow(SettingsSectionContribution section) + { + var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8 }; + var subjects = _form.Subjects(section.Scope); + var noun = section.Scope == SettingScope.World ? "world" : "character"; + if (subjects.Count == 0) + { + row.Children.Add(new TextBlock { Text = $"No {noun} yet", VerticalAlignment = VerticalAlignment.Center, Foreground = DimInk, FontSize = NativeTokens.Label }); + return row; + } + + var labels = subjects.Select(s => s.Label).ToList(); + var current = _form.Subject(section.Scope); + var picker = new ComboBox { ItemsSource = labels, MinWidth = 180, MaxWidth = 280, SelectedItem = current?.Label, FontSize = NativeTokens.Label }; + AutomationProperties.SetName(picker, $"The {noun} these settings are for"); + picker.SelectionChanged += (_, _) => + { + if (!_syncing && picker.SelectedIndex is >= 0 and var i && i < subjects.Count + && !string.Equals(subjects[i].Label, _form.Subject(section.Scope)?.Label, StringComparison.Ordinal)) + { + _form.Choose(subjects[i]); + var offset = _scroller.Offset; + BuildPage(); + _scroller.Offset = offset; + } + }; + SubjectPicker = picker; + row.Children.Add(new TextBlock { Text = section.Scope == SettingScope.World ? "Applies to world" : "Applies to character", VerticalAlignment = VerticalAlignment.Center, Foreground = DimInk, FontSize = NativeTokens.Label }); + row.Children.Add(picker); return row; } /// The theme field: a card per theme, its preview drawn from the client's model; a click uses it. private StackPanel ThemePicker(ThemeField field) { - var outer = new StackPanel { Spacing = 6, Margin = new Thickness(0, 4, 0, 4) }; - var words = new StackPanel { Spacing = 1 }; - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Title }); + var outer = new StackPanel { Spacing = 6, Margin = new Thickness(0, 12, 0, 4) }; + var words = new StackPanel(); + words.Children.Add(LabelBlock(field.Label)); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(HelpBlock(help)); } outer.Children.Add(words); @@ -598,27 +818,88 @@ private StackPanel ThemePicker(ThemeField field) private string? CurrentTheme(ThemeField field) => field.Binding is SettingBinding binding ? _form.Get(binding) : null; - /// The accent the changed dot wears: the client's, as every native surface's. - private SolidColorBrush Accent => _tokens.Brush(_tokens.Accent); + /// The accent the changed dot wears: the client's, as every native surface's, held on the page's planes. + private SolidColorBrush Accent => _tokens.Page.Brush(_tokens.Page.Link); - /// A quiet line's ink, held to the floor (an opacity would not be). - private SolidColorBrush DimInk => _tokens.Brush(_tokens.Dim); + /// A quiet line's ink, held to the floor on the page's planes (an opacity would not be). + private SolidColorBrush DimInk => _tokens.Page.Brush(_tokens.Page.Dim); - /// One field: label and help on the left, its control, then the changed dot and the reset. - private Grid FieldRow(SettingsField field) + /// + /// A field's label, in the label weight, with every word of the search marked as the mockup marks "meter": the + /// page's mark plane behind it and the mark ink on it. + /// + private TextBlock LabelBlock(string label) { - var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto,Auto"), Margin = new Thickness(0, 4), MinHeight = 44 }; + var text = NativeKeys.Words(Capitalise(label)); + var block = new TextBlock { FontSize = NativeTokens.Label, FontWeight = FontWeight.SemiBold, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center }; + var words = Searching + ? _search.Text!.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) + : []; + var marks = new bool[text.Length]; + foreach (var word in words) + { + for (var at = text.IndexOf(word, StringComparison.OrdinalIgnoreCase); at >= 0; at = text.IndexOf(word, at + word.Length, StringComparison.OrdinalIgnoreCase)) + { + Array.Fill(marks, true, at, word.Length); + } + } + + if (!marks.Contains(true)) + { + block.Text = text; + return block; + } + + var page = _tokens.Page; + for (var i = 0; i < text.Length;) + { + var marked = marks[i]; + var j = i; + while (j < text.Length && marks[j] == marked) + { + j++; + } + + var run = new Run(text[i..j]); + if (marked) + { + run.Background = page.Brush(page.Mark); + run.Foreground = page.Brush(page.MarkInk); + } + + block.Inlines!.Add(run); + i = j; + } + + return block; + } - var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Spacing = 1, Margin = new Thickness(0, 0, 16, 0) }; - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Title, TextWrapping = TextWrapping.Wrap }); + /// A field's help line under its label: quiet, wrapped. + private TextBlock HelpBlock(string help) => + new() { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 0) }; + + /// + /// One field, as a row of its group's card: the label (with the changed mark beside it) and its help on the left; + /// the reset link and the control on the right. + /// + private Grid FieldRow(SettingsField field) + { + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto,Auto"), Margin = new Thickness(0, 12), MinHeight = 32 }; + + var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 16, 0) }; + var (changed, reset) = ChangedMark(field); + var top = new WrapPanel { Orientation = Orientation.Horizontal }; + top.Children.Add(LabelBlock(field.Label)); + top.Children.Add(changed); + words.Children.Add(top); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap }); + words.Children.Add(HelpBlock(help)); } // The note the cell F5 draws beside the value (join wraps' recommendation), from the same sentence, in the // cells' caution amber; gone once the field has been changed. - var note = new TextBlock { FontSize = NativeTokens.Body, Foreground = _tokens.Brush(_tokens.Notice), TextWrapping = TextWrapping.Wrap }; + var note = new TextBlock { FontSize = NativeTokens.Body, Foreground = _tokens.Brush(_tokens.Notice), TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 0) }; void ShowNote() { var text = _form.Note(field); @@ -633,43 +914,45 @@ void ShowNote() grid.Children.Add(words); + reset.Margin = new Thickness(0, 0, 16, 0); + Grid.SetColumn(reset, 1); + grid.Children.Add(reset); + var control = ControlFor(field); control.VerticalAlignment = VerticalAlignment.Center; AutomationProperties.SetName(control, field.Label); - Grid.SetColumn(control, 1); + Grid.SetColumn(control, 2); grid.Children.Add(control); _controls[field.Id] = control; - - grid.Children.Add(ChangedMark(field, column: 2)); return grid; } - /// The dot and reset button for , shown only while it differs from its default. - private StackPanel ChangedMark(SettingsField field, int column) + /// + /// The changed mark for — a dot and the word "Changed", beside the label — and its reset + /// link, both shown only while the field differs from its default. + /// + private (Control Changed, Button Reset) ChangedMark(SettingsField field) { - var dot = new Ellipse { Width = 8, Height = 8, Fill = Accent, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(14, 0, 8, 0) }; - ToolTip.SetTip(dot, "Changed from its default"); - var reset = new Button { Content = "Reset", Padding = new Thickness(10, 3), VerticalAlignment = VerticalAlignment.Center }; + var mark = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, Margin = new Thickness(10, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; + mark.Children.Add(new Ellipse { Width = 6, Height = 6, Fill = Accent, VerticalAlignment = VerticalAlignment.Center }); + mark.Children.Add(new TextBlock { Text = "Changed", FontSize = NativeTokens.Body, Foreground = DimInk, VerticalAlignment = VerticalAlignment.Center }); + ToolTip.SetTip(mark, "Changed from its default"); + var reset = LinkButton("Reset to default"); ToolTip.SetTip(reset, $"Back to the default: {SettingsForm.DefaultText(field)}"); AutomationProperties.SetName(reset, $"Reset {field.Label}"); reset.Click += (_, _) => _form.Reset(field); _resets[field.Id] = reset; - var panel = new StackPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center, MinWidth = 100 }; - panel.Children.Add(dot); - panel.Children.Add(reset); - Grid.SetColumn(panel, column); - void Refresh() { var changed = !_form.IsDefault(field); - dot.Opacity = changed ? 1 : 0; + mark.IsVisible = changed; reset.IsVisible = changed; } Refresh(); _refreshers.Add(Refresh); - return panel; + return (mark, reset); } /// The native control for a field's kind, wired to the form and refreshed from it. @@ -822,35 +1105,38 @@ private static StackPanel Swatch(string name) private StackPanel MeterTable(ListField field) { - var outer = new StackPanel { Spacing = 8, Margin = new Thickness(0, 4, 0, 4) }; + var outer = new StackPanel { Spacing = 10, Margin = new Thickness(0, 12, 0, 4) }; + var page = _tokens.Page; var top = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; - var words = new StackPanel { Spacing = 1 }; - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(field.Label)), FontSize = NativeTokens.Title }); + var (changed, reset) = ChangedMark(field); + var heading = new WrapPanel { Orientation = Orientation.Horizontal }; + heading.Children.Add(LabelBlock(field.Label)); + heading.Children.Add(changed); + top.Children.Add(heading); + Grid.SetColumn(reset, 1); + top.Children.Add(reset); + outer.Children.Add(top); if (field.Help is { } help) { - words.Children.Add(new TextBlock { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap }); + outer.Children.Add(HelpBlock(help)); } - top.Children.Add(words); - top.Children.Add(ChangedMark(field, column: 1)); - outer.Children.Add(top); - var received = _form.Received(); var paths = received.Select(r => r.Path).ToList(); var meters = _form.Meters(field); _meterRows = meters.Count; - var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("110,*,*,100,Auto"), ColumnSpacing = 8, RowSpacing = 6 }; + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("120,*,*,120,32"), ColumnSpacing = 8, RowSpacing = 8 }; MeterGrid = grid; _controls[field.Id] = grid; - string[] headings = ["Label", "Value path", "Maximum path", "Now"]; + string[] headings = ["Label", "Value path", "Maximum path", "Live value"]; grid.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); for (var c = 0; c < headings.Length; c++) { - var heading = new TextBlock { Text = headings[c], FontSize = NativeTokens.Body, FontWeight = FontWeight.SemiBold, Foreground = DimInk }; - Grid.SetColumn(heading, c); - grid.Children.Add(heading); + var title = new TextBlock { Text = headings[c], FontSize = NativeTokens.Body, Foreground = DimInk }; + Grid.SetColumn(title, c); + grid.Children.Add(title); } AutoCompleteBox? lastPath = null; @@ -862,7 +1148,7 @@ private StackPanel MeterTable(ListField field) var row = i + 1; grid.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); - var label = new TextBox { Text = meter.Label, MaxLength = StatusMeter.MaxLabelLength }; + var label = new TextBox { Text = meter.Label, MaxLength = StatusMeter.MaxLabelLength, FontSize = NativeTokens.Label }; AutomationProperties.SetName(label, $"meter {row} label"); label.LostFocus += (_, _) => { @@ -878,10 +1164,18 @@ private StackPanel MeterTable(ListField field) value.GotFocus += (_, _) => lastPath = value; max.GotFocus += (_, _) => lastPath = max; - var now = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontWeight = FontWeight.SemiBold }; + var now = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontFamily = Mono, FontSize = NativeTokens.Body }; _meterNow.Add((meter, now)); - var remove = new Button { Content = "✕", Padding = new Thickness(9, 3) }; + var remove = new Button + { + Content = "✕", + Padding = new Thickness(8, 3), + Background = Brushes.Transparent, + BorderThickness = new Thickness(0), + Foreground = DimInk, + HorizontalAlignment = HorizontalAlignment.Center, + }; ToolTip.SetTip(remove, $"Remove {meter.Label}"); AutomationProperties.SetName(remove, $"Remove meter {meter.Label}"); var index = i; @@ -902,37 +1196,29 @@ private StackPanel MeterTable(ListField field) outer.Children.Add(grid); - var add = new Button { Content = "+ Meter", HorizontalAlignment = HorizontalAlignment.Left }; - AutomationProperties.SetName(add, "Add a meter"); - add.Click += (_, _) => - { - meters.Add(new StatusMeter { Label = "new" }); - Commit(); - }; - outer.Children.Add(add); - - // What this connection has received, to pick a path from: a click puts it in the path box last used. - var box = new StackPanel { Spacing = 2 }; - box.Children.Add(new TextBlock { Text = "Received on this connection", FontSize = NativeTokens.Body, FontWeight = FontWeight.SemiBold, Foreground = DimInk, Margin = new Thickness(0, 2, 0, 2) }); + // What this connection has received, to pick a path from: a click puts it in the path box last used. Drawn as the + // mockup's drop-down panel, under the path columns. + var box = new StackPanel(); + box.Children.Add(new TextBlock { Text = "Paths this connection has received", FontSize = NativeTokens.Body, Foreground = DimInk, Margin = new Thickness(12, 4, 12, 4) }); if (received.Count == 0) { - box.Children.Add(new TextBlock { Text = "Nothing yet — a meter shows once its value arrives.", FontSize = NativeTokens.Body, Foreground = DimInk }); + box.Children.Add(new TextBlock { Text = "Nothing yet — a meter shows once its value arrives.", FontSize = NativeTokens.Body, Foreground = DimInk, Margin = new Thickness(12, 4, 12, 6) }); } foreach (var item in received.Take(40)) { - var line = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; - line.Children.Add(new TextBlock { Text = item.Path, FontFamily = FontFamily.Parse("monospace"), FontSize = NativeTokens.Body }); - var v = new TextBlock { Text = item.Value, FontSize = NativeTokens.Body, Foreground = DimInk, Margin = new Thickness(16, 0, 0, 0) }; - Grid.SetColumn(v, 1); - line.Children.Add(v); + var line = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Body, TextTrimming = TextTrimming.CharacterEllipsis }; + line.Inlines!.Add(new Run(item.Path) { Foreground = page.Brush(page.Text) }); + line.Inlines.Add(new Run($" = {item.Value}") { Foreground = DimInk }); var pick = new Button { Content = line, Background = Brushes.Transparent, - Padding = new Thickness(6, 2), + BorderThickness = new Thickness(0), + CornerRadius = new CornerRadius(0), + Padding = new Thickness(12, 6), HorizontalAlignment = HorizontalAlignment.Stretch, - HorizontalContentAlignment = HorizontalAlignment.Stretch, + HorizontalContentAlignment = HorizontalAlignment.Left, }; ToolTip.SetTip(pick, "Use this path in the path box you were last in"); pick.Click += (_, _) => @@ -949,23 +1235,40 @@ private StackPanel MeterTable(ListField field) outer.Children.Add(new Border { Child = box, + Background = page.Brush(page.Popup), BorderThickness = new Thickness(1), - BorderBrush = _tokens.Brush(_tokens.Edge), + BorderBrush = page.Brush(page.FocusEdge), CornerRadius = new CornerRadius(NativeTokens.RadiusM), - Padding = new Thickness(10, 6, 10, 8), - Margin = new Thickness(0, 4, 0, 0), + Padding = new Thickness(0, 8), + Margin = new Thickness(128, 0, 0, 0), + MaxWidth = 420, + HorizontalAlignment = HorizontalAlignment.Left, }); + var add = new Button { Content = "+ Add a meter", HorizontalAlignment = HorizontalAlignment.Left, Padding = new Thickness(12, 6), FontSize = NativeTokens.Label }; + AutomationProperties.SetName(add, "Add a meter"); + add.Click += (_, _) => + { + meters.Add(new StatusMeter { Label = "new" }); + Commit(); + }; + outer.Children.Add(add); + Tick(); return outer; } + /// The page's monospace face, for paths and values (the mockup's game-text face). + private static readonly FontFamily Mono = FontFamily.Parse("monospace"); + private static AutoCompleteBox PathBox(string? text, IReadOnlyList paths, string name, Action set, Action commit) { var box = new AutoCompleteBox { Text = text ?? string.Empty, ItemsSource = paths, + FontFamily = Mono, + FontSize = NativeTokens.Body, FilterMode = AutoCompleteFilterMode.ContainsOrdinal, MinimumPrefixLength = 0, HorizontalAlignment = HorizontalAlignment.Stretch, @@ -1001,7 +1304,7 @@ private void Tick() { var text = _form.Now(meter); now.Text = text ?? "waiting"; - now.Opacity = text is null ? 0.6 : 1; + now.Foreground = text is null ? DimInk : _tokens.Page.Brush(_tokens.Page.Text); } } diff --git a/src/SharpMUTerm.Avalonia/ThemeCardView.cs b/src/SharpMUTerm.Avalonia/ThemeCardView.cs index b8dc3162..7be55109 100644 --- a/src/SharpMUTerm.Avalonia/ThemeCardView.cs +++ b/src/SharpMUTerm.Avalonia/ThemeCardView.cs @@ -29,7 +29,7 @@ public ThemeCardView(ThemeCard card, bool inUse, NativeTokens tokens) BorderThickness = new Thickness(0); HorizontalContentAlignment = HorizontalAlignment.Stretch; Margin = new Thickness(0, 0, 14, 14); - Width = 300; + Width = 264; AutomationProperties.SetName(this, $"Use the {card.Name} theme"); ToolTip.SetTip(this, $"Use {card.Name}"); @@ -46,7 +46,7 @@ public ThemeCardView(ThemeCard card, bool inUse, NativeTokens tokens) _frame = new Border { Child = body, - CornerRadius = new CornerRadius(NativeTokens.RadiusM), + CornerRadius = new CornerRadius(NativeTokens.RadiusCard), ClipToBounds = true, BorderThickness = new Thickness(2), }; @@ -64,12 +64,13 @@ public ThemeCardView(ThemeCard card, bool inUse, NativeTokens tokens) public void SetInUse(bool inUse, NativeTokens tokens) { ArgumentNullException.ThrowIfNull(tokens); - _frame.Background = tokens.Brush(tokens.Raised); - _state.Foreground = tokens.Brush(tokens.Dim); + var page = tokens.Page; + _frame.Background = page.Brush(page.Button); + _state.Foreground = page.Brush(page.Dim); InUse = inUse; var kind = $"{(Card.IsDark ? "dark" : "light")} · {(Card.IsCustom ? "your own" : "built in")}"; _state.Text = inUse ? $"In use · {kind}" : kind; - _frame.BorderBrush = tokens.Brush(inUse ? tokens.Accent : tokens.Edge); + _frame.BorderBrush = inUse ? page.Brush(page.Link) : page.Brush(page.Rule); } private static readonly FontFamily Mono = FontFamily.Parse("monospace"); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs index 9a577b8d..87ece070 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs @@ -142,7 +142,7 @@ await Assert.That(Contrast.RelativeLuminance(backdrop)).IsGreaterThan(0.7) } /// - /// The settings window wears the tokens: its plane is the palette's card and Fluent's accent is the client's, not + /// The settings window wears the tokens: its plane is the page tokens' ground and Fluent's accent is the client's, not /// Fluent's own blue (#60cdff/#005fb8) — and it follows a Light theme the same way. /// [Test] @@ -172,11 +172,41 @@ public async Task TheSettingsWindowWearsTheTokens(string name) }, CancellationToken.None); var tokens = NativeTokens.For(theme); - await Assert.That(background).IsEqualTo(tokens.Card); + await Assert.That(background).IsEqualTo(tokens.Page.Ground).Because("a page stands on the page tokens' ground"); await Assert.That(accent).IsEqualTo(tokens.Accent); await Assert.That(close).IsTrue().Because("the frame has its own close button"); } + /// + /// The page tokens are the settings mockup's on Dark, and on every built-in theme each page ink clears the floor on + /// every page plane it can land on (and the search mark's ink on the mark). + /// + [Test] + [Arguments("Dark")] + [Arguments("Light")] + [Arguments("Solarized Dark")] + public async Task ThePageInksClearTheFloorOnEveryPagePlane(string name) + { + var page = NativeTokens.For(ThemeLibrary.Get(name)).Page; + static Rgb Of(Color c) => new(c.R, c.G, c.B); + foreach (var plane in new[] { page.Ground, page.Nav, page.Card, page.Field, page.Button, page.Popup, page.PopupSelected }) + { + foreach (var ink in new[] { page.Text, page.Dim, page.Link }) + { + await Assert.That(Contrast.Ratio(Of(ink), Of(plane))).IsGreaterThanOrEqualTo(NativeTokens.TextFloor) + .Because($"{name}: {ink} on {plane}"); + } + } + + await Assert.That(Contrast.Ratio(Of(page.MarkInk), Of(page.Mark))).IsGreaterThanOrEqualTo(NativeTokens.TextFloor); + if (name == "Dark") + { + await Assert.That(page.Ground).IsEqualTo(Color.Parse("#10131a")).Because("the mockup's ground"); + await Assert.That(page.Card).IsEqualTo(Color.Parse("#171b24")).Because("the mockup's card"); + await Assert.That(page.Rule).IsEqualTo(Color.Parse("#2c3447")).Because("the mockup's rule"); + } + } + /// /// The settings window is a modal over the main window: a scrim lies over it while it is open (a press on it closes /// the settings) and goes with it. Opened beside the output — the trigger builder — it is docked to the main window's diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs index 49ac7f1a..d69cb5c6 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -142,7 +142,7 @@ public async Task TheMeterTableHasARowPerMeterAndReadsNow() var rows = grid.RowDefinitions.Count; var now = grid.Children.OfType().Where(t => Grid.GetRow(t) == 1 && Grid.GetColumn(t) == 3).Select(t => t.Text).Single(); - var add = window.GetVisualDescendantsOf public static class PanelSizing { + /// + /// A vitals pane taking less than this fraction of the window's width (by the split weights above it) is a card + /// rather than a strip: a strip wants the width a card has no use for. + /// + public const double CardBelowWidthShare = 0.5; + + /// + /// The rows of content a vitals card takes for meters: its heading and a blank (the card + /// draws no tab strip, so it titles itself), two a meter (name and numbers, then the bar), a rule and two for the + /// target, which is reserved whether or not the game names one (a target arriving never reflows the column), and a + /// row under it. Twenty-pixel rows are what the window's stacked, headed gauges need for the same blocks. + /// + public static int VitalsCardRows(int meters) => (2 * Math.Max(0, meters)) + 6; + /// The rows of content a docked composer is never squeezed below: its header, four rows of post and its key hints. public const int ComposerMinRows = 6; @@ -35,8 +55,13 @@ public static class PanelSizing public static bool IsStrip(IReadOnlyList panels) => panels.Count > 0 && panels.All(p => FixedRows(p) is not null); - /// Whether a pane holding draws its tab strip: anything but a one-tab strip. - public static bool ShowsTabStrip(IReadOnlyList panels) => !(panels.Count == 1 && IsStrip(panels)); + /// + /// Whether a pane holding draws its tab strip: not when it holds one panel and nothing + /// else. Every panel titles itself (COMPOSE, HERE, the vitals heading, the map's room; a strip's row says what it + /// is), so a strip over it would say the same thing twice and cost a row; a pane holding windows, or several tabs, + /// keeps it. + /// + public static bool ShowsTabStrip(IReadOnlyList panels) => !(panels.Count == 1 && panels[0] is not null); /// /// Sets 's and from what it @@ -45,17 +70,28 @@ public static bool IsStrip(IReadOnlyList panels) => /// A strip is as tall as its tallest panel (plus the tab strip when it holds several); any other pane shares, /// with a floor from the tallest floor among its panels. /// - public static void Apply(PaneNode pane, Func panelOf, int tabStripRows) + /// The pane. + /// The panel each tab draws, or null. + /// The height of the tab strip the host draws. + /// + /// Non-null when a vitals tab here is drawn as a card of that many rows ( decides); null for + /// the one-row strip. + /// + public static void Apply(PaneNode pane, Func panelOf, int tabStripRows, int? vitalsCardRows = null) { ArgumentNullException.ThrowIfNull(pane); ArgumentNullException.ThrowIfNull(panelOf); var panels = pane.Tabs.Select(panelOf).ToList(); + int? Rows(string? panel) => + vitalsCardRows is { } card && string.Equals(panel, PanelIds.Vitals, StringComparison.Ordinal) ? card : FixedRows(panel); + + var strip = panels.Count > 0 && panels.All(p => Rows(p) is not null); var chrome = ShowsTabStrip(panels) ? Math.Max(0, tabStripRows) : 0; pane.DrawsHeader = chrome > 0; - if (IsStrip(panels)) + if (strip) { - pane.FixedRows = panels.Max(p => FixedRows(p)!.Value) + chrome; + pane.FixedRows = panels.Max(p => Rows(p)!.Value) + chrome; pane.MinRows = null; return; } @@ -64,4 +100,47 @@ public static void Apply(PaneNode pane, Func panelOf, int tabSt var floor = panels.Select(MinRows).Where(m => m is not null).Select(m => m!.Value).DefaultIfEmpty(0).Max(); pane.MinRows = floor > 0 ? floor + chrome : null; } + + /// + /// for every pane under , with each vitals pane's shape decided from its + /// share of the window's width (). is how many + /// meters the character behind a vitals window has, by window id. + /// + public static void ApplyAll(LayoutNode root, Func panelOf, int tabStripRows, Func vitalsMetersOf) + { + ArgumentNullException.ThrowIfNull(root); + ArgumentNullException.ThrowIfNull(vitalsMetersOf); + foreach (var (pane, share) in WidthShares(root, 1.0)) + { + int? card = null; + if (share < CardBelowWidthShare + && pane.Tabs.FirstOrDefault(t => string.Equals(panelOf(t), PanelIds.Vitals, StringComparison.Ordinal)) is { } vitals) + { + card = VitalsCardRows(vitalsMetersOf(vitals)); + } + + Apply(pane, panelOf, tabStripRows, card); + } + } + + /// Each pane with the fraction of the window's width its row splits give it. + public static IEnumerable<(PaneNode Pane, double Share)> WidthShares(LayoutNode node, double share) + { + if (node is PaneNode pane) + { + yield return (pane, share); + yield break; + } + + var split = (SplitNode)node; + var total = split.Sizes.Sum(s => Math.Max(0, s)); + for (var i = 0; i < split.Children.Count; i++) + { + var part = split.Direction == SplitDirection.Row && total > 0 ? Math.Max(0, split.Sizes[i]) / total : 1.0; + foreach (var inner in WidthShares(split.Children[i], share * part)) + { + yield return inner; + } + } + } } diff --git a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs index 25ec70ca..36625711 100644 --- a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs @@ -79,6 +79,93 @@ internal static string Render(VitalsModel vitals, int width, Ink ink) => width, ink); + /// + /// The card a tall vitals pane draws (): a heading, then per meter its title + /// and numbers on one row and a bar the width of the box under it, then a rule and the target the same way, its + /// rows held whether or not the game names one — the window's stacked gauges, block for block. A box too short + /// for that draws one row a meter, and one row or two draws the strip. + /// + internal static IReadOnlyList RenderCard(VitalsModel vitals, int width, int height, Ink ink) + { + width = Math.Max(1, width); + var blocks = vitals.Meters.Count; + if (height < 3 || vitals.IsEmpty) + { + return [Render(vitals, width, ink)]; + } + + var lines = new List(); + + // The card titles itself (a one-panel pane draws no tab strip): VITALS and where the numbers come from, as the + // window's heading says it — when there is a row for it beside the blocks. + if (height >= (2 * blocks) + 5) + { + var source = vitals.Source is { } from ? " [dim]" + Escape(Fit(from, Math.Max(1, width - 8))) + "[/]" : string.Empty; + lines.Add($"[bold {ink.Bar}]VITALS[/]{source}"); + lines.Add(string.Empty); + } + + if (height >= (2 * blocks) + 3) + { + foreach (var meter in vitals.Meters) + { + var colour = meter.Low ? ink.Low : ink.Bar; + var title = Escape(Fit(meter.Low ? $"{meter.Title} · {LowMark}" : meter.Title, width - 1)); + lines.Add(Spread(meter.Low ? $"[bold {colour}]{title}[/]" : $"[bold]{title}[/]", Numbers(meter), width)); + lines.Add(Bar(meter.HasMax ? meter.Share ?? 0 : 1, width, colour, ink)); + } + + lines.Add($"[{ink.Empty}]{new string('─', width)}[/]"); + if (vitals.Target is { } target) + { + var percent = target.Share is { } share ? StatusMeterRenderer.Percent(share) : string.Empty; + var name = Escape(Fit(target.Name, Math.Max(1, width - 8 - percent.Length))); + lines.Add(Spread("[dim]Target[/] " + (target.Low ? $"[{ink.Low}]{name}[/]" : name), percent, width)); + lines.Add(target.Share is { } s ? Bar(s, width, target.Low ? ink.Low : ink.Bar, ink) : string.Empty); + } + + return lines; + } + + // One row a meter: the label, a bar in what is left, the value. + foreach (var meter in vitals.Meters.Take(Math.Max(1, height - (vitals.Target is null ? 0 : 1)))) + { + var colour = meter.Low ? ink.Low : ink.Bar; + var value = Escape(StatusMeter.Fit(meter.Value, StatusMeterRenderer.ValueWidth)); + var label = Fit(meter.Label, 4).PadRight(4); + var bar = Math.Max(0, width - label.Length - VisibleLength(value) - 2); + var drawn = bar > 0 && meter.HasMax ? " " + Bar(meter.Share, bar, colour, ink) : new string(' ', bar + 1); + lines.Add($"[dim]{Escape(label)}[/]{drawn} " + (meter.Low ? $"[bold {colour}]{value}[/]" : $"[bold]{value}[/]")); + } + + if (vitals.Target is { } t && lines.Count < height) + { + var percent = t.Share is { } share ? StatusMeterRenderer.Percent(share) : string.Empty; + lines.Add(Spread("[dim]target[/] " + Escape(Fit(t.Name, Math.Max(1, width - 8 - percent.Length))), percent, width)); + } + + return lines; + } + + /// The numbers a card's meter row ends in: 412/500, or the value alone. + private static string Numbers(VitalsMeter meter) => meter.HasMax ? $"{meter.Value}/{meter.Max ?? "?"}" : meter.Value; + + /// markup at the start of a row of , text at its end. + private static string Spread(string left, string right, int width) + { + var room = width - VisibleLength(left) - right.Length; + if (room < 1) + { + return ElideVisible(left, Math.Max(1, width - right.Length - 1)) + " " + Escape(right); + } + + return left + new string(' ', room) + $"[bold]{Escape(right)}[/]"; + } + + /// cut to cells with an ellipsis. + private static string Fit(string text, int width) => + width <= 0 ? string.Empty : text.Length <= width ? text : text[..Math.Max(0, width - 1)] + "…"; + private static string Compose( IReadOnlyList meters, CombatTarget? target, Level level, int width, Ink ink) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs index 78d54701..9fc048e9 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -267,6 +267,8 @@ internal bool ApplyLayout(string key, LayoutDefinition layout, string? focusWind return false; } + layout = BuiltInLayouts.ForWidth(layout, IsNarrow()); // a built-in's narrow arrangement below 100 columns + if (CanFloatPanels && adoptFloating) { AdoptFloating(key, layout); @@ -351,7 +353,7 @@ internal void RefoldLayout() } var layout = Layouts.Find(live.LayoutId) ?? ResolveLayout(live.SessionKey).Layout; - var fold = LayoutFold.Fold(layout, LayoutAvailability(live.SessionKey)); + var fold = LayoutFold.Fold(BuiltInLayouts.ForWidth(layout, IsNarrow()), LayoutAvailability(live.SessionKey)); if (string.Equals(LayoutRealiser.FoldShape(fold), live.FoldShape, StringComparison.Ordinal)) { return; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs index 326afb16..7971116a 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Narrow.cs @@ -67,6 +67,9 @@ internal bool SyncNarrowLayout() } _narrowSeen = narrow; + + // A built-in layout owning the panes has a narrow arrangement; crossing the line re-folds into it (or out of it). + RefoldLayout(); if (_railCollapsed == narrow) { return false; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index 0ecc48a1..f5e6a5b3 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -171,15 +171,23 @@ private void OfferLook(string windowId, string sessionKey, string name) private IWindowControl NewVitalsPanel(TerminalPanelContext context) { - var view = NewPanelView(context, (width, _) => + var view = NewPanelView(context, (width, height) => { if (ReadVitals(context.SessionKey) is not { } vitals) { return ["[dim]No vitals: this character is not connected.[/]"]; } - var strip = VitalsStripRenderer.Render(Drawing(PanelIds.Vitals, context.WindowId, vitals), width, VitalsInk()); - return [strip.Length > 0 ? strip : "[dim]No vitals yet — the game has sent none of the meters F7 names.[/]"]; + var drawn = Drawing(PanelIds.Vitals, context.WindowId, vitals); + if (drawn.IsEmpty) + { + return ["[dim]No vitals yet — the game has sent none of the meters F7 names.[/]"]; + } + + // A pane in a side column is a card (PanelSizing.ApplyAll made it tall); a strip is one row. + return height >= 3 + ? [.. VitalsStripRenderer.RenderCard(drawn, width, height, VitalsInk())] + : [VitalsStripRenderer.Render(drawn, width, VitalsInk())]; }); if (context.Session is { } session) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 022e4c76..5c26c86c 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -10934,10 +10934,8 @@ private IWindowControl BuildWorkspaceRow() // Each pane's height claim, from what it holds: a strip panel is as tall as its content and an editor has a // floor. Derived here on every rebuild rather than stored, so a pane handed an ordinary window stops being a // strip at once. - foreach (var pane in _workspace.Layout.Root.Panes()) - { - Core.Layouts.PanelSizing.Apply(pane, PanelIdOfWindow, TabStripRows); - } + // A vitals pane in a side column is a card, its height from the character's meters. + Core.Layouts.PanelSizing.ApplyAll(_workspace.Layout.Root, PanelIdOfWindow, TabStripRows, VitalsMetersOfWindow); // When a pane is zoomed, render just that pane full-area; otherwise render the whole tree. var zoomed = _workspace.Layout.ZoomedPaneId is { } zid ? _workspace.Layout.FindPane(zid) : null; @@ -11580,6 +11578,10 @@ private IWindowControl BuildLayoutNode(SharpMUTerm.Core.Workspaces.LayoutNode no private static string? PanelIdOfWindow(string windowId) => TerminalPanels.TryParseWindowId(windowId, out var panelId, out _) ? panelId : null; + /// How many meters the character behind a vitals panel window draws: the height of its card. + private int VitalsMetersOfWindow(string windowId) => + TerminalPanels.TryParseWindowId(windowId, out _, out var sessionKey) ? PanelMeters(sessionKey).Count : 0; + /// Whether a pane is the one every workspace keystroke is aimed at. private bool IsFocusedPane(string paneId) => string.Equals(paneId, _workspace.Layout.FocusedPaneId, StringComparison.Ordinal); @@ -11668,10 +11670,9 @@ private IWindowControl BuildPaneTabs(PaneNode pane) PaintTabChips(tabs, PaneSurfaceTone(pane.Id)); - // A one-tab strip (the vitals meters, the quick bar) draws no tab strip: its row already says what it is, - // and a strip the height of its content has no row to spare. PaneOutputRects reads TabHeaderHeight, so the - // rectangle it reports follows. - tabs.ShowTabHeader = Core.Layouts.PanelSizing.ShowsTabStrip(pane.Tabs.Select(PanelIdOfWindow).ToList()); + // A pane holding one panel and nothing else draws no tab strip: the panel titles itself (PanelSizing.ShowsTabStrip, + // which ApplyAll has just applied). PaneOutputRects reads TabHeaderHeight, so the rectangle it reports follows. + tabs.ShowTabHeader = pane.DrawsHeader; var paneId = pane.Id; tabs.TabChanged += (_, e) => OnTabChanged(paneId, e.NewTab); diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutFoldAndAvailabilityTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutFoldAndAvailabilityTests.cs index f1013ea4..622a00f9 100644 --- a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutFoldAndAvailabilityTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutFoldAndAvailabilityTests.cs @@ -56,21 +56,22 @@ public async Task AvailabilityIsReadOffTheGameDataStore() } [Test] - public async Task RoleplayWithEverythingFoldsIntoOutputComposerAndASideColumnWithChatAsATab() + public async Task RoleplayWithEverythingFoldsIntoOutputWithChatBehindItAndAColumnOfComposerOverWhoHere() { var fold = LayoutFold.Fold(BuiltInLayouts.Roleplay); - // Row[ Column[ output, composer ], side ] + // Row[ output+chat, Column[ composer, who-here ] ] var root = (SplitNode)fold.Root!; await Assert.That(root.Direction).IsEqualTo(SplitDirection.Row); - await Assert.That(root.Sizes[1]).IsEqualTo(LayoutFold.DefaultShare(LayoutRegion.Side)).Within(1e-9); + await Assert.That(root.Sizes[1]).IsEqualTo(0.35).Within(1e-9); - var centre = (SplitNode)root.Children[0]; - await Assert.That(centre.Direction).IsEqualTo(SplitDirection.Column); - await Assert.That(centre.Panes().Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output", "panel:composer" }); + var main = (PaneNode)root.Children[0]; + await Assert.That(main.Tabs).IsEquivalentTo(new[] { PanelIds.Output, PanelIds.Chat }); - var side = (PaneNode)root.Children[1]; - await Assert.That(side.Tabs).IsEquivalentTo(new[] { PanelIds.WhoHere, PanelIds.Chat }); + var side = (SplitNode)root.Children[1]; + await Assert.That(side.Direction).IsEqualTo(SplitDirection.Column); + await Assert.That(side.Panes().Select(p => p.Id)).IsEquivalentTo(new[] { "panel:composer", "panel:who-here" }); + await Assert.That(side.Sizes[0]).IsGreaterThan(side.Sizes[1]); await Assert.That(fold.Collapsed).IsEmpty(); await Assert.That(fold.Waiting).IsEmpty(); } @@ -79,11 +80,22 @@ public async Task RoleplayWithEverythingFoldsIntoOutputComposerAndASideColumnWit public async Task ATabWhoseHostHasNoDataTakesAPaneOfItsOwn() { // A MUSH sends no Room.Players, but trigger rules have opened a channel window. - var fold = LayoutFold.Fold(BuiltInLayouts.Roleplay, new PanelAvailability(SpawnWindows: 1)); + var layout = new LayoutDefinition + { + Id = "x", + Name = "X", + Placements = + [ + new() { PanelId = PanelIds.Output }, + new() { PanelId = PanelIds.WhoHere, Region = LayoutRegion.Side, Order = 0 }, + new() { PanelId = PanelIds.Chat, Region = LayoutRegion.Side, Order = 1, TabOf = PanelIds.WhoHere }, + ], + }; + var fold = LayoutFold.Fold(layout, new PanelAvailability(SpawnWindows: 1)); var panes = fold.Root!.Panes().ToList(); - await Assert.That(panes.Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output", "panel:composer", "panel:chat" }); - await Assert.That(panes[2].Tabs).IsEquivalentTo(new[] { PanelIds.Chat }); + await Assert.That(panes.Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output", "panel:chat" }); + await Assert.That(panes[1].Tabs).IsEquivalentTo(new[] { PanelIds.Chat }); await Assert.That(fold.Waiting.Select(p => p.PanelId)).IsEquivalentTo(new[] { PanelIds.WhoHere }); } @@ -97,18 +109,59 @@ public async Task CombatWithNoDataYetIsOutputAndTheQuickBar() } [Test] - public async Task CombatWithEverythingHasAStripOnTopAndListsChatAsCollapsed() + public async Task CombatWithEverythingHasAColumnOfVitalsOverTheMapAndListsChatAsCollapsed() { var fold = LayoutFold.Fold(BuiltInLayouts.Combat); - // Column[ vitals, Row[ Column[ output, quick-bar ], map ] ] + // Row[ Column[ output, quick-bar ], Column[ vitals, map ] ] var root = (SplitNode)fold.Root!; + await Assert.That(root.Direction).IsEqualTo(SplitDirection.Row); + var side = (SplitNode)root.Children[1]; + await Assert.That(side.Direction).IsEqualTo(SplitDirection.Column); + await Assert.That(side.Panes().Select(p => p.Id)).IsEquivalentTo(new[] { "panel:vitals", "panel:map" }); + await Assert.That(root.Panes().Select(p => p.Id)) + .IsEquivalentTo(new[] { "panel:output", "panel:quick-bar", "panel:vitals", "panel:map" }); + await Assert.That(fold.Collapsed.Select(p => p.PanelId)).IsEquivalentTo(new[] { PanelIds.Chat }); + } + + [Test] + public async Task NarrowCombatPutsTheVitalsInAStripOnTop() + { + var narrow = BuiltInLayouts.ForWidth(BuiltInLayouts.Combat, narrow: true); + await Assert.That(narrow.Id).IsEqualTo(BuiltInLayouts.CombatId); + await Assert.That(narrow.IsBuiltIn).IsTrue(); + + // Column[ vitals, Row[ Column[ output, quick-bar ], map ] ] + var root = (SplitNode)LayoutFold.Fold(narrow).Root!; await Assert.That(root.Direction).IsEqualTo(SplitDirection.Column); await Assert.That(((PaneNode)root.Children[0]).Id).IsEqualTo("panel:vitals"); await Assert.That(root.Sizes[0]).IsEqualTo(LayoutFold.DefaultShare(LayoutRegion.TopStrip)).Within(1e-9); - await Assert.That(root.Panes().Select(p => p.Id)) - .IsEquivalentTo(new[] { "panel:vitals", "panel:output", "panel:quick-bar", "panel:map" }); - await Assert.That(fold.Collapsed.Select(p => p.PanelId)).IsEquivalentTo(new[] { PanelIds.Chat }); + } + + [Test] + public async Task NarrowRoleplayPutsTheComposerUnderTheOutput() + { + var narrow = BuiltInLayouts.ForWidth(BuiltInLayouts.Roleplay, narrow: true); + await Assert.That(narrow.Id).IsEqualTo(BuiltInLayouts.RoleplayId); + + // Row[ Column[ output+chat, composer ], who-here ] + var root = (SplitNode)LayoutFold.Fold(narrow).Root!; + await Assert.That(root.Direction).IsEqualTo(SplitDirection.Row); + await Assert.That(root.Children[0].Panes().Select(p => p.Id)).IsEquivalentTo(new[] { "panel:output", "panel:composer" }); + await Assert.That(((PaneNode)root.Children[1]).Id).IsEqualTo("panel:who-here"); + } + + [Test] + public async Task OnlyABuiltInHasANarrowArrangement() + { + await Assert.That(BuiltInLayouts.ForWidth(BuiltInLayouts.Combat, narrow: false)).IsSameReferenceAs(BuiltInLayouts.Combat); + + // A saved copy of a built-in is the player's, even under the built-in's id (a hand-edited file). + var copy = BuiltInLayouts.Combat with { IsBuiltIn = false }; + await Assert.That(BuiltInLayouts.ForWidth(copy, narrow: true)).IsSameReferenceAs(copy); + var library = new LayoutLibrary([]); + var saved = library.SaveAsNew("Mine", BuiltInLayouts.Combat.Placements); + await Assert.That(BuiltInLayouts.ForWidth(saved, narrow: true)).IsSameReferenceAs(saved); } [Test] diff --git a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutRealiserTests.cs b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutRealiserTests.cs index a0a44db7..f81c89af 100644 --- a/tests/SharpMUTerm.Core.Tests/Layouts/LayoutRealiserTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Layouts/LayoutRealiserTests.cs @@ -92,7 +92,8 @@ public async Task CapturingTheCombatArrangementGivesBackItsRegions() var byId = captured.Placements.ToDictionary(p => p.PanelId); await Assert.That(byId[PanelIds.Output].Region).IsEqualTo(LayoutRegion.Main); await Assert.That(byId[PanelIds.Map].Region).IsEqualTo(LayoutRegion.Side); - await Assert.That(byId[PanelIds.Vitals].Region).IsEqualTo(LayoutRegion.TopStrip); + await Assert.That(byId[PanelIds.Vitals].Region).IsEqualTo(LayoutRegion.Side); + await Assert.That(byId[PanelIds.Vitals].Order).IsLessThan(byId[PanelIds.Map].Order); await Assert.That(byId[PanelIds.Chat].TabOf).IsEqualTo(PanelIds.Map); // Not on screen (no window draws it), so it keeps the placement the layout gave it. await Assert.That(byId[PanelIds.QuickBar].Region).IsEqualTo(LayoutRegion.Bottom); diff --git a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs index 4b10a5e2..f7590ec9 100644 --- a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs @@ -263,6 +263,33 @@ public async Task TwoStripPanelsInOnePaneAddTheTabStripTheyThenNeed() await Assert.That(PanelSizing.ShowsTabStrip(pane.Tabs.Select(PanelOf).ToList())).IsTrue(); } + [Test] + public async Task AVitalsPaneInASideColumnIsACardAndAFullWidthOneIsAStrip() + { + // Row[ Column[ output, quick bar ], Column[ vitals, map ] ] with the side column at 30%. + var side = new PaneNode("side", ["panel:vitals:W.C"]); + var top = new PaneNode("top", ["panel:vitals:W.C"]); + var root = new SplitNode(SplitDirection.Column, + [ + top, + new SplitNode(SplitDirection.Row, [new PaneNode("output", ["main"]), new SplitNode(SplitDirection.Column, [side, new PaneNode("map", ["map:W.C"])])], [0.7, 0.3]), + ], [0.1, 0.9]); + + PanelSizing.ApplyAll(root, PanelOf, tabStripRows: 1, _ => 3); + + await Assert.That(side.FixedRows).IsEqualTo(PanelSizing.VitalsCardRows(3)); + await Assert.That(side.DrawsHeader).IsFalse(); + await Assert.That(top.FixedRows).IsEqualTo(1); + await Assert.That(top.DrawsHeader).IsFalse(); + } + + [Test] + public async Task AVitalsCardHoldsTwoRowsAMeterAndTheTargetsRowsWhetherOrNotThereIsOne() + { + await Assert.That(PanelSizing.VitalsCardRows(3)).IsEqualTo(12); + await Assert.That(PanelSizing.VitalsCardRows(0)).IsEqualTo(6); + } + [Test] public async Task AStripHandedAnOrdinaryWindowStopsBeingAStrip() { @@ -275,13 +302,20 @@ public async Task AStripHandedAnOrdinaryWindowStopsBeingAStrip() } [Test] - public async Task AComposerPaneHasAFloorOfItsEditorAndItsTabStrip() + public async Task AComposerPaneHasAFloorOfItsEditorAndNoTabStripUntilItHoldsAWindowToo() { var pane = new PaneNode("p", ["panel:composer:W.C"]); PanelSizing.Apply(pane, PanelOf, tabStripRows: 1); + // Alone, the composer titles itself (COMPOSE): no tab strip over it. await Assert.That(pane.FixedRows).IsNull(); + await Assert.That(pane.DrawsHeader).IsFalse(); + await Assert.That(pane.MinRows).IsEqualTo(PanelSizing.ComposerMinRows); + + pane.Tabs.Add("main"); + PanelSizing.Apply(pane, PanelOf, tabStripRows: 1); + await Assert.That(pane.DrawsHeader).IsTrue(); await Assert.That(pane.MinRows).IsEqualTo(PanelSizing.ComposerMinRows + 1); } diff --git a/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs b/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs index fab2698b..81690751 100644 --- a/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/LayoutStripTests.cs @@ -42,11 +42,10 @@ private static ConsoleKeyInfo Letter(char c) => private static ConsoleKeyInfo Typed(char c) => char.IsLetter(c) ? Letter(c) : new(c, ConsoleKey.Spacebar, false, false, false); [Test] - [Arguments(120, 32)] - [Arguments(80, 24)] - public async Task CombatsVitalsAndQuickBarAreOneRowEachWithNoTabStrip(int width, int height) + public async Task NarrowCombatsVitalsAndQuickBarAreOneRowEachWithNoTabStrip() { - await using var app = Demo(width: width, height: height); + const int height = 24; + await using var app = Demo(width: 80, height: height); app.RenderSnapshot("layout-combat"); var output = app.PaneOutputRects(); @@ -57,12 +56,38 @@ public async Task CombatsVitalsAndQuickBarAreOneRowEachWithNoTabStrip(int width, // No tab strip: the pane is its content, so its whole rectangle is that one row too. await Assert.That(whole["panel:vitals"].Height).IsEqualTo(1); await Assert.That(whole["panel:quick-bar"].Height).IsEqualTo(1); + await Assert.That(whole["panel:vitals"].Width).IsGreaterThan(whole["panel:output"].Width); // The output pane keeps its tab strip, and everything the strips did not take. await Assert.That(whole["panel:output"].Height - output["panel:output"].Height).IsEqualTo(1); await Assert.That(output["panel:output"].Height).IsGreaterThan(height / 2); } + [Test] + public async Task WideCombatsVitalsAreACardOverTheMapWithItsOwnTitle() + { + await using var app = Demo(width: 120, height: 32); + app.RenderSnapshot("layout-combat"); + + var output = app.PaneOutputRects(); + var whole = app.PaneSnapshot().Rects; + var vitals = whole["panel:vitals"]; + var map = whole["panel:map"]; + + // A card of its heading, the demo's three meters and the target's reserved rows, with no tab strip, flush above the map. + await Assert.That(output["panel:vitals"].Height).IsEqualTo(PanelSizing.VitalsCardRows(3)); + await Assert.That(vitals.Height).IsEqualTo(PanelSizing.VitalsCardRows(3)); + await Assert.That(map.Y).IsEqualTo(vitals.Y + vitals.Height); + await Assert.That(map.X).IsEqualTo(vitals.X); + await Assert.That(output["panel:quick-bar"].Height).IsEqualTo(1); + + var card = string.Join("\n", app.PanelMarkup(TerminalPanels.WindowId(PanelIds.Vitals, DemoScene.ActiveSessionKey))); + await Assert.That(card).Contains("VITALS"); + await Assert.That(card).Contains("Health"); + await Assert.That(card).Contains("412/500"); + await Assert.That(app.VitalsStripShowing()).IsTrue(); + } + [Test] public async Task TheStatusRowLeavesOutTheMetersWhileTheVitalsStripShowsThem() { diff --git a/tests/SharpMUTerm.Tui.Tests/NarrowLayoutTests.cs b/tests/SharpMUTerm.Tui.Tests/NarrowLayoutTests.cs index 40410aea..d6e68298 100644 --- a/tests/SharpMUTerm.Tui.Tests/NarrowLayoutTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NarrowLayoutTests.cs @@ -154,6 +154,28 @@ public async Task ANewlineInTheOneRowBarShowsBothRows() await Assert.That(rows.Count(r => r.Contains("say hello there", StringComparison.Ordinal))).IsEqualTo(1); } + /// + /// A built-in layout owning the panes re-folds when the width crosses the line: Combat's vitals card in the side + /// column becomes a one-row strip across the top below 100 columns, and comes back when the window widens. + /// + [Test] + public async Task CrossingTheLineFoldsABuiltInIntoItsNarrowArrangementAndBack() + { + var window = new WindowPresenter { Columns = 120 }; + await using var app = App(120, 32, HostChrome.None, window, "layout-combat"); + await Assert.That(app.PaneOutputRects()["panel:vitals"].Height).IsGreaterThan(1); + + window.Columns = 90; + app.SyncNarrowLayout(); + app.RenderNextFrame(); + await Assert.That(app.PaneOutputRects()["panel:vitals"].Height).IsEqualTo(1); + + window.Columns = 120; + app.SyncNarrowLayout(); + app.RenderNextFrame(); + await Assert.That(app.PaneOutputRects()["panel:vitals"].Height).IsGreaterThan(1); + } + /// /// ⌃B b (or ⌃P, or the window's fold button) wins over the automatic fold until the width crosses the line again: /// a resize that stays on one side changes nothing the player chose. diff --git a/tests/SharpMUTerm.Tui.Tests/StackedDividerTests.cs b/tests/SharpMUTerm.Tui.Tests/StackedDividerTests.cs index f622fa2f..ab24c66f 100644 --- a/tests/SharpMUTerm.Tui.Tests/StackedDividerTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/StackedDividerTests.cs @@ -21,13 +21,13 @@ public class StackedDividerTests private static readonly TerminalCapabilities Headless = new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); - private static SharpMUTermApp App(string view, string theme = "Dark") + private static SharpMUTermApp App(string view, string theme = "Dark", int width = Width, int height = Height) { Console.SetIn(TextReader.Null); var config = DemoScene.Build(); config.ThemeName = theme; config.Theme = ThemeLibrary.Get(theme); - var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(Width, Height)); + var app = new SharpMUTermApp(config, Headless, new HeadlessConsoleDriver(width, height)); app.RenderSnapshot(view); app.RenderNextFrame(); return app; @@ -60,7 +60,7 @@ public async Task ASideBySideSplitKeepsItsDividerColumn() /// /// The vitals strip sits flush on the panes under it and is told apart from them by its plane, on every theme /// and whether or not the pane beside it holds the focus: an unfocused strip is recessed a step, so it is never - /// the same plane as an unfocused pane. + /// the same plane as an unfocused pane. Narrow, where Combat draws its vitals as a strip across the top. /// [Test] [Arguments("Dark")] @@ -68,7 +68,7 @@ public async Task ASideBySideSplitKeepsItsDividerColumn() [Arguments("Solarized Dark")] public async Task AStripSitsFlushAndIsToldApartByItsPlane(string theme) { - var app = App("layout-combat", theme); + var app = App("layout-combat", theme, 80, 24); foreach (var moved in new[] { false, true }) { if (moved) From 4e43c5ac02fa57bac8843b976ad63357f80e3340 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 18:41:47 +0000 Subject: [PATCH 073/113] =?UTF-8?q?Wave=2020=20B:=20model-first=20cleanups?= =?UTF-8?q?=20=E2=80=94=20status=20model,=20toast=20card,=20body=2013,=20p?= =?UTF-8?q?inned=20package=20review,=20sized=20palette?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The status row is a StatusModel first: StatusBarRow, NotConnectedRow, NoticeSegment and the move/drag prompts build role-tagged segments, the cells are written from the model (StatusRowMarkup, StatusModel.Fit) and the native footer draws the same instance. Terminal frames are byte-identical; the markup parser is gone. - Toasts are drawn on NativeTokens.Card with edge colours held to the floor on it. - NativeTokens.Body is 13. - The package review pins its keys under a scrolling body (ListOverlay footer) and stays clear of the command line at 80x24. - The cell command palette shrinks to its matching rows (at least 10) and keeps its top edge. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 + CLAUDE.md | 24 +- src/SharpMUTerm.Avalonia/NativeFooter.cs | 9 +- src/SharpMUTerm.Avalonia/NativeTokens.cs | 2 +- src/SharpMUTerm.Avalonia/NoticeToasts.cs | 46 ++- src/SharpMUTerm.Client/Chrome/StatusModel.cs | 264 +++++++++++------- src/SharpMUTerm.Tui/CommandPalette.cs | 35 +++ src/SharpMUTerm.Tui/PackageScreen.cs | 27 +- .../Pointer/SharpMUTermApp.Footer.cs | 111 ++++---- .../Pointer/SharpMUTermApp.Notices.cs | 43 ++- .../SharpMUTermApp.ModeHints.cs | 23 +- src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs | 7 +- .../SharpMUTermApp.Packages.cs | 4 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 229 +++++++-------- src/SharpMUTerm.Tui/StatusMeterRenderer.cs | 46 +-- .../NativeFooterTests.cs | 11 +- .../NoticeToastTests.cs | 28 ++ .../StatusModelTests.cs | 65 +++-- tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs | 42 +++ tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs | 11 +- 20 files changed, 664 insertions(+), 368 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b591f8b2..bb53ddf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- The package review keeps ⏎ install and Esc cancel on screen at 80×24: the review scrolls (↑↓ PgUp PgDn Home End) + under its keys and stops above the command line. - Browse worlds: a world listed at several addresses (TLS and plain, another port, an old one) now lets you choose which before the connect form opens; the form takes that address's TLS setting, and the world is saved with the game's character set when mu*index names one other than UTF-8. `/browse N M` says address M in `--plain`. @@ -384,6 +386,9 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The command palette in the terminal shrinks to the rows a search matches instead of filling the screen with blank. +- In the window, notices are drawn on the same card colour as the palette and dialogs, and body text is a size larger + (13 px) across the window's own views. - The built-in layouts follow the new designs: Roleplay puts the composer in the side column above who is here, with the chat windows as tabs behind the output; Combat puts the vitals in the side column above the map as a card, one meter over another. Below 100 columns they fall back to what fits: Roleplay's composer goes under the output and diff --git a/CLAUDE.md b/CLAUDE.md index 993878aa..913f49d7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -259,7 +259,9 @@ fallbacks) for inline images/maps. - **A consent screen's keys are pinned, not scrolled** (`ListOverlay.Open(footer:, scrollKeys:)`): the body goes in a `ScrollablePanelControl` and the footer rows are a sticky-bottom control, so a body taller than 80×24 scrolls under them (↑↓ PgUp PgDn Home End, answered before the caller's key handler). The import review uses it (`ImportReview.Footer`: - passwords question + keys); `Lines` is body then footer. + passwords question + keys); `Lines` is body then footer. So does the package review (`PackageScreen.ReviewFooter`: a rule, + then ⏎ install · ↑↓ scroll · Esc cancel laddered, the "nothing is written" note only where it fits); a modal with a + footer stops 4 rows short of the desktop, so the command line stays in view at 80×24. - **The index** (`PackageIndex`; ⌃P ▸ *Browse packages*, `b` on F10) is `{"packages":[…]}`, each entry a manifest plus an https `url` and a `sha256`, at `AppConfiguration.PackageIndexUrl`. **It is fetched only when the player opens it, never at start.** An entry that breaks a rule is dropped and counted, not @@ -329,6 +331,9 @@ fallbacks) for inline images/maps. for the pointer menu and the tests that read it. Keys are shown through `KeyGlyphs.Normalize`, so the host's `Alt+⏎`/`Ctrl+⏎` read `⌥⏎`/`⌃⏎` in the column while `--help` keeps the words. The key column is right-aligned at the widest key; a narrow surface drops the detail, then elides the title, never the key. + - **The cell palette is as tall as what it lists** (`CommandPalette.FitHeight`): the whole catalog's height (capped above + the command line) while the query is empty, the matching rows' once something is typed, at least `FilteredMinHeight` (10) + and never taller than it opened; the top edge stays put, so the prompt does not move. - **Clashes come from `MacroKeys`, never a second table** (`KeyClashes`, Tui). `ClaimedBy` (a global shortcut: the client wins, `Verdict` already says Taken) and `YieldedBy` (what the main window does with a chord only after `DispatchMacro` declined it: the binding wins, a warning). `YieldedBy`'s list mirrors the @@ -1675,13 +1680,14 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw the same door is ⌃P (`CellsVia: term:messages`). Three notices carry one so far: the layout suggestion (*Change layout*), "switched to … · offline" (*Reconnect*) and the orphan trigger-set notice (*Open F5*). - **Severity is mapped from `MessageSeverity`**: Info → info, Error → warning (a failure), Warning → refusal - (the default voice of `Notice`). Edge colours are the accent, `ScreenPalette.Warn` and the notice ink, held to - 4.5:1 on the status plane because they also ink the key chip and the action line. + (the default voice of `Notice`). The card is `NativeTokens.Card` (rule `Edge`, text `Text`) of the theme the overlay + carries (`NoticeOverlay.Theme`); the edge colours — accent, `ScreenPalette.Warn`, the notice ink — are held to + `TextFloor` on that card, because they also ink the key chip and the action line (`NoticeToasts.ColoursOf`). - The message log (⌃P ▸ *Show client messages*) stays the history; a toast keeps nothing. - **A notice said again while it is still on the row is said once** (`Notice` compares text, key, severity and action with `_noticeShown`): the timer restarts, nothing is logged, announced or published twice. That was the audit's "notices show twice" — the row-plus-toast pair is the design above, the repeat was not. - - **The row is elided to its width in both hosts** (`FitStatusRow` in `PaintStatus`), so no notice can wrap it + - **The row is elided to its width in both hosts** (`StatusModel.Fit` in `PaintStatus`), so no notice can wrap it (`NoticeFitTests`, 80×24 down to 40×12). - **Toasts stay off what is being used and are hidden under a modal.** Besides the map's legend, `SyncToasts` avoids the native quick bars and docked composers; `DesktopLayer.ToastsHidden` (set by `MainWindow`: settings window, ⌃P, a @@ -1690,9 +1696,11 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw - **The window draws the status row and the command line's field too** (`HostChrome.Status`/`Input`, `HostChrome.Desktop` = all four, the window's default; `SharpMUTermApp.Footer.cs`; Client `StatusModel`; Avalonia `NativeFooter`, `TerminalView`'s field; surface `status`). Decisions not to relitigate: - - **The footer says what the cells would**: `BuildStatusModel` parses the very markup `PaintStatus` writes with the - framework's `MarkupParser` into runs, split at the widest gap; the palette hint and a showing notice's action hints are - marked as targets. `IPointerPresenter.Status`, published from `PaintStatus` and `PostBufferPaint`, only on change. + - **The model comes first and the cells are drawn from it**: `StatusBarRow`, `NotConnectedRow`, `NoticeSegment` and the + move/drag prompts build a `StatusModel` (left and right `StatusSegment`s with a `StatusRole`, each a list of + `StatusRun`s; a null ink is the row's own, so the cells write no tag for it), `PaintStatus` records it (`Drawing`) and + writes `StatusRowMarkup(model.Fit(width))`, and the footer draws the same instance. Terminal frames are byte for byte + what the markup-first row wrote; there is no markup parser. The palette hint and a notice's action hints carry targets. `IPointerPresenter.Status`, published from `PaintStatus` and `PostBufferPaint`, only on change. A click is `ActivateStatusTarget`: refused unless offered, the palette through `OpenMenu`, an action through `RunNoticeAction`. With `Status` the row is `Visible = false` and `ChromeRows` counts none. Toasts sit above it. - **The command line stays the cell editor; the host draws the field around it.** The bars get `HostFieldPad` (3) @@ -2336,7 +2344,7 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] - Screenshots from a real window under Xvfb, driven with XTest (`ux-wave8/modals-*.png`). - **The window has one design language: `NativeTokens`** (Avalonia). Planes (card, raised, selected, scrim), edge and rule, inks (text, dim, header, accent, warn, notice, accent and key inks), radii `RadiusS/M/L` 4/8/12 and - the type ramp `Small/Body/Title/Heading` 11/12/14/18 (`Miniature` 9 only for a theme card's preview). Derived + the type ramp `Small/Body/Title/Heading` 11/13/14/18 (`Miniature` 9 only for a theme card's preview). Derived from the client's `Theme` the `ScreenTheme` way: a canonical Dark (the mockup's: `#171b24` card) and Light (white) set, the theme background's hue shift added, every ink held to `TextFloor` 4.5:1 on each plane it is drawn on; the accent is the client's teal, never Fluent's blue. `Apply` sets the Fluent keys on a scope and `ApplySimple` diff --git a/src/SharpMUTerm.Avalonia/NativeFooter.cs b/src/SharpMUTerm.Avalonia/NativeFooter.cs index 62f06603..8bf8ddae 100644 --- a/src/SharpMUTerm.Avalonia/NativeFooter.cs +++ b/src/SharpMUTerm.Avalonia/NativeFooter.cs @@ -117,7 +117,7 @@ private double Draw(DrawingContext context, StatusRun run, double x, double midd _hits.Add((area, target)); if (_hover == target && Overlay is { Interactive: true }) { - var colour = NativeChromeView.Parse(run.Ink); + var colour = InkOf(run); context.FillRectangle(new SolidColorBrush(colour), new Rect(x, top + formatted.Baseline + 2, width, 1)); } } @@ -126,19 +126,22 @@ private double Draw(DrawingContext context, StatusRun run, double x, double midd } /// A run as text in the UI face: keys in words, padding runs of spaces shortened to a gap. - private static FormattedText Format(StatusRun run, Color plane) => new( + private FormattedText Format(StatusRun run, Color plane) => new( Gaps.Replace(NativeKeys.Words(run.Text), " "), CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(NativeTokens.UiFont, FontStyle.Normal, run.Bold ? FontWeight.SemiBold : FontWeight.Normal), NativeTokens.Body, - new SolidColorBrush(NativeChromeView.Parse(run.Ink))) + new SolidColorBrush(InkOf(run))) { MaxLineCount = 1, }; private static readonly Regex Gaps = new(" {3,}", RegexOptions.CultureInvariant); + /// A run's ink: its own, else the row's (a run the cells write with no colour). + private Color InkOf(StatusRun run) => NativeChromeView.Parse(run.Ink ?? Overlay?.Model.Ink); + private static string HexOf(SkiaSharp.SKColor colour) => $"#{colour.Red:x2}{colour.Green:x2}{colour.Blue:x2}"; private string? TargetAt(Point point) => _hits.FirstOrDefault(h => h.Area.Contains(point)).Target; diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.cs b/src/SharpMUTerm.Avalonia/NativeTokens.cs index 7a509cb1..db7d9d20 100644 --- a/src/SharpMUTerm.Avalonia/NativeTokens.cs +++ b/src/SharpMUTerm.Avalonia/NativeTokens.cs @@ -50,7 +50,7 @@ internal sealed partial record NativeTokens( public const double Small = 11; /// The type ramp: body text, help, rows. - public const double Body = 12; + public const double Body = 13; /// The type ramp: a field's label, a list item's name, a search box. public const double Title = 14; diff --git a/src/SharpMUTerm.Avalonia/NoticeToasts.cs b/src/SharpMUTerm.Avalonia/NoticeToasts.cs index 839cb137..59f643d5 100644 --- a/src/SharpMUTerm.Avalonia/NoticeToasts.cs +++ b/src/SharpMUTerm.Avalonia/NoticeToasts.cs @@ -326,17 +326,17 @@ private List FrozenLayout(Dictionary frozen) private Placed? Measure(Toast toast, double width, double bottom) { var x = Bounds.Width - Inset - width; - var palette = toast.Overlay.Palette; - var ink = PanelText.Parse(palette.Text); + var colours = ColoursOf(toast); + var ink = colours.Text; var inner = width - EdgeWidth - (2 * Padding); - var chip = ChipText(toast) is { } key ? Format(key, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var chip = ChipText(toast) is { } key ? Format(key, ChipSize, colours.Edge, bold: true, inner) : null; var textWidth = inner - (chip is null ? 0 : chip.Width + 8); var text = Format(BodyText(toast), TextSize, ink, bold: false, Math.Max(40, textWidth), lines: 3); - var action = ActionText(toast) is { } a ? Format(a, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var action = ActionText(toast) is { } a ? Format(a, ChipSize, colours.Edge, bold: true, inner) : null; var second = action is not null && SecondText(toast) is { } b - ? Format(b, ChipSize, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, Math.Max(1, inner - action.Width - SecondGap)) + ? Format(b, ChipSize, colours.Edge, bold: true, Math.Max(1, inner - action.Width - SecondGap)) : null; - var source = SourceText(toast) is { } said ? Format(said.ToUpperInvariant(), ChipSize - 1, PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)), bold: true, inner) : null; + var source = SourceText(toast) is { } said ? Format(said.ToUpperInvariant(), ChipSize - 1, colours.Edge, bold: true, inner) : null; var height = (2 * Padding) + text.Height + (action is null ? 0 : action.Height + 6) + (source is null ? 0 : source.Height + 2); var top = bottom - height; return top < Inset ? null : new Placed(toast, new Rect(x, top, width, height), text, chip, action, source, second); @@ -421,18 +421,17 @@ public override void Render(DrawingContext context) foreach (var placed in Layout()) { var (toast, rect, text, chip, action, source, second) = placed; - var palette = toast.Overlay.Palette; - var plane = PanelText.Parse(palette.Plane); - var edge = PanelText.Parse(palette.Edge(toast.Overlay.Notice.Severity)); + var colours = ColoursOf(toast); + var (plane, edge) = (colours.Plane, colours.Edge); using var _ = context.PushOpacity(FadeOf(toast, now)); // The card on a soft shadow (NativeTokens' small one: it floats over the page, not over a scrim), a rule for // its edge, and the severity as a rounded bar down its left side. - var lift = toast == hovered ? 0.08 : 0; + var lift = toast == hovered ? 0.06 : 0; var card = new RoundedRect(rect, NativeTokens.RadiusM); context.DrawRectangle( - new SolidColorBrush(Mix(plane, PanelText.Parse(palette.Text), lift + 0.03)), - new Pen(new SolidColorBrush(Mix(plane, PanelText.Parse(palette.Text), 0.16)), 1), + new SolidColorBrush(Mix(plane, colours.Text, lift)), + new Pen(new SolidColorBrush(colours.Rule), 1), card, NativeTokens.ShadowSmall); context.DrawRectangle( @@ -469,6 +468,29 @@ public override void Render(DrawingContext context) } } + /// + /// A toast's colours: the tokens' card plane and its rule and text — the surface every other native card is — with + /// the severity's edge (which also inks the key chip, the source caption and the action line, all small text) held to + /// on that card. The client's palette says which edge; the window's tokens say + /// what it is drawn on. + /// + private static ToastColours ColoursOf(Toast toast) => ColoursOf(toast.Overlay); + + /// + internal static ToastColours ColoursOf(NoticeOverlay overlay) + { + var said = PanelText.Parse(overlay.Palette.Plane); + var tokens = NativeTokens.For(overlay.Theme, (0.299 * said.R) + (0.587 * said.G) + (0.114 * said.B) < 140); + var card = new SharpMUTerm.Core.Text.Rgb(tokens.Card.R, tokens.Card.G, tokens.Card.B); + var edge = PanelText.Parse(overlay.Palette.Edge(overlay.Notice.Severity)); + var held = SharpMUTerm.Core.Text.Contrast.Legible( + new SharpMUTerm.Core.Text.Rgb(edge.R, edge.G, edge.B), card, NativeTokens.TextFloor); + return new ToastColours(tokens.Card, tokens.Edge, tokens.Text, Color.FromRgb(held.R, held.G, held.B)); + } + + /// A toast's card, its rule, its text and its severity's edge. + internal readonly record struct ToastColours(Color Plane, Color Rule, Color Text, Color Edge); + private static Color Mix(Color from, Color to, double amount) => Color.FromRgb( (byte)(from.R + ((to.R - from.R) * amount)), (byte)(from.G + ((to.G - from.G) * amount)), diff --git a/src/SharpMUTerm.Client/Chrome/StatusModel.cs b/src/SharpMUTerm.Client/Chrome/StatusModel.cs index 2a1f523c..2737675e 100644 --- a/src/SharpMUTerm.Client/Chrome/StatusModel.cs +++ b/src/SharpMUTerm.Client/Chrome/StatusModel.cs @@ -1,164 +1,212 @@ +using System.Globalization; + namespace SharpMUTerm.Client.Chrome; /// One run of the status row: text in one ink and weight, and what a click on it does (null for nothing). /// The run's visible text, keys in the cells' glyphs (a native host spells them in words). -/// Its colour, #rrggbb, already held to the floor on the row's plane. +/// +/// Its colour, #rrggbb, already held to the floor on the row's plane; null for the row's own ink +/// (), which the cells draw by writing no colour at all. +/// /// Whether the cells draw it bold. /// /// What a click hands back: a target the client put here itself (the palette, a notice's action), never a command a /// host spelt. Null for text a click does nothing on. /// -public sealed record StatusRun(string Text, string Ink, bool Bold, string? Target = null); +public sealed record StatusRun(string Text, string? Ink, bool Bold, string? Target = null); -/// -/// The status row as data: what SharpMUTermApp.PaintStatus writes into the cells — the connection, the mode's -/// keys, meters, reconnect, ● REC, ♪ muted, the scrollback segment, or a notice laid over them — split -/// into the cluster read from the left and the one read from the right. The terminal draws the row in cells; the window -/// (HostChrome.Status) leaves no cell for it and draws this as its footer, so the two cannot say different things. -/// -/// The runs from the left edge. -/// The runs that end at the right edge. -/// The row's plane, #rrggbb. -public sealed record StatusModel(IReadOnlyList Left, IReadOnlyList Right, string Plane) +/// What a segment of the status row is, so a host can tell the parts apart without reading their words. +public enum StatusRole { - /// A status row with nothing on it. - public static StatusModel Empty { get; } = new([], [], "#000000"); + /// Words with no other role (the not-connected line). + Text, - /// Every target a click on this row may hand back. - public IEnumerable Targets() => - Left.Concat(Right).Select(r => r.Target).OfType().Distinct(StringComparer.Ordinal); + /// The connection: the world's dot, the character and its state (or the reconnect countdown). + Identity, - /// The row as plain text, the two clusters joined by a gap: what a test or a screen reader reads. - public string Text => - string.Concat(Left.Select(r => r.Text)).TrimEnd() - + (Right.Count > 0 ? " " + string.Concat(Right.Select(r => r.Text)).Trim() : string.Empty); + /// The game's meters (hp 450/500). + Meters, + + /// Where the map says the character is. + Room, + + /// What the MOO last put in its status line. + Moo, + + /// How far the focused pane is scrolled back, and the key back. + Scrollback, + + /// ● REC: a scene log is being recorded. + Recording, + + /// ♪ muted. + Muted, + + /// The encoding in force on the connection. + Encoding, + + /// How long the armed line is, or the history-recall hint in its place. + Count, + + /// The way to the command palette. + Palette, + + /// The keys of the mode the keyboard is in (scrolled back, frozen, a search bar, the composer). + ModeHint, + + /// The keys that move between panes, tabs and command lines. + FocusHint, + + /// A notice laid over the row (). + Notice, + + /// A mode prompt that displaces the row (moving or dragging a window). + Prompt, +} + +/// One part of the status row: its role and its runs. +/// What it is. +/// How it reads. +public sealed record StatusSegment(StatusRole Role, IReadOnlyList Runs) +{ + /// The segment's visible text. + public string Text => string.Concat(Runs.Select(r => r.Text)); + + /// The cells the segment takes, counting text elements. + public int Width => StatusModel.WidthOf(Text); /// - public bool Equals(StatusModel? other) => - other is not null && Plane == other.Plane && Left.SequenceEqual(other.Left) && Right.SequenceEqual(other.Right); + public bool Equals(StatusSegment? other) => other is not null && Role == other.Role && Runs.SequenceEqual(other.Runs); /// - public override int GetHashCode() => HashCode.Combine(Plane, Left.Count, Right.Count); + public override int GetHashCode() => HashCode.Combine(Role, Runs.Count); +} - /// - /// Splits one row of runs into its two clusters at the widest run of spaces — the padding the row's renderer puts - /// between what it reads from the left and what it right-aligns — when that gap is at least three wide; otherwise - /// the whole row reads from the left. Runs are split at the gap and the gap itself is dropped. - /// - public static StatusModel From(IReadOnlyList runs, string plane) - { - ArgumentNullException.ThrowIfNull(runs); - var text = string.Concat(runs.Select(r => r.Text)); - var (gapAt, gapLength) = (-1, 0); - for (var i = 0; i < text.Length;) - { - if (text[i] != ' ') - { - i++; - continue; - } +/// +/// The status row as data, built first by SharpMUTermApp.PaintStatus's callers — the connection, the mode's keys, +/// meters, reconnect, ● REC, ♪ muted, the scrollback segment, or a notice or prompt laid over them — as the +/// segments the row lays out from the left and the ones it right-aligns, already cut to what fits the row's width with +/// its reserved fields and drop order. The terminal's cells are rendered from this; the window +/// (HostChrome.Status) leaves no cell for the row and draws the same instance as its footer. +/// +/// The segments from the left edge, a apart. +/// The segments that end at the right edge, a apart. +/// The row's plane, #rrggbb. +/// The row's own ink, #rrggbb: the colour of a run whose is null. +public sealed record StatusModel( + IReadOnlyList LeftSegments, + IReadOnlyList RightSegments, + string Plane, + string Ink) +{ + /// What is written between two segments of one cluster. + public const string Separator = " "; - var start = i; - while (i < text.Length && text[i] == ' ') - { - i++; - } + /// The least space kept between the clusters. + public const int MinGap = 3; - // Only a gap with text on both sides divides the row; trailing padding is not a right cluster. - if (i < text.Length && start > 0 && i - start >= 3 && i - start > gapLength) - { - (gapAt, gapLength) = (start, i - start); - } - } + /// A status row with nothing on it. + public static StatusModel Empty { get; } = new([], [], "#000000", "#ffffff"); - if (gapAt < 0) - { - return new StatusModel(Trim(Slice(runs, 0, text.Length)), [], plane); - } + /// The cells the row was laid out in; the right cluster ends there. Zero when not known. + public int Width { get; init; } - return new StatusModel(Trim(Slice(runs, 0, gapAt)), Trim(Slice(runs, gapAt + gapLength, text.Length)), plane); - } + /// The notice laid over the row, when the row is one. + public NoticeModel? Notice { get; init; } - private static List Slice(IReadOnlyList runs, int from, int to) - { - var result = new List(); - var at = 0; - foreach (var run in runs) - { - var (start, end) = (Math.Max(from, at), Math.Min(to, at + run.Text.Length)); - if (end > start) - { - result.Add(run with { Text = run.Text[(start - at)..(end - at)] }); - } + /// The left cluster as runs, with a run of the row's ink between segments. + public IReadOnlyList Left => Flatten(LeftSegments); - at += run.Text.Length; - } + /// The right cluster as runs, with a run of the row's ink between segments. + public IReadOnlyList Right => Flatten(RightSegments); - return result; - } + /// The cells a cluster of segments takes, separators included. + public static int WidthOf(IReadOnlyCollection segments) => + segments.Count == 0 ? 0 : segments.Sum(s => s.Width) + (Separator.Length * (segments.Count - 1)); - private static List Trim(List runs) - { - while (runs.Count > 0 && string.IsNullOrWhiteSpace(runs[0].Text)) - { - runs.RemoveAt(0); - } + /// The cells a text takes, counting text elements. + public static int WidthOf(string text) => new StringInfo(text).LengthInTextElements; - while (runs.Count > 0 && string.IsNullOrWhiteSpace(runs[^1].Text)) - { - runs.RemoveAt(runs.Count - 1); - } + /// Every target a click on this row may hand back. + public IEnumerable Targets() => + Left.Concat(Right).Select(r => r.Target).OfType().Distinct(StringComparer.Ordinal); - if (runs.Count > 0) + /// The row as plain text, the two clusters joined by a gap: what a test or a screen reader reads. + public string Text => + string.Concat(Left.Select(r => r.Text)) + + (RightSegments.Count > 0 ? Separator + string.Concat(Right.Select(r => r.Text)) : string.Empty); + + /// + /// The row as the cells lay it out: the left cluster, then spaces to push the right cluster to + /// (at least ), as runs. Runs of the same ink and weight are not merged here; a renderer may. + /// + public IReadOnlyList Row() + { + var runs = new List(Left); + if (RightSegments.Count > 0) { - runs[0] = runs[0] with { Text = runs[0].Text.TrimStart() }; - runs[^1] = runs[^1] with { Text = runs[^1].Text.TrimEnd() }; + var gap = Math.Max(MinGap, Width - WidthOf(LeftSegments) - WidthOf(RightSegments)); + runs.Add(new StatusRun(new string(' ', gap), null, false)); + runs.AddRange(Right); } return runs; } /// - /// The runs with set on the characters of the last occurrence of , - /// splitting runs at its edges; unchanged when the text is not there. How the client marks a hint or a notice's - /// action as clickable after drawing it. + /// cut to cells, ending in … in the ink of the run it cut into; + /// unchanged when it fits or the width is not known. The row is one row in every host: a notice is a sentence, and a + /// row wider than its window wraps and takes a row off the command line. /// - public static IReadOnlyList Mark(IReadOnlyList runs, string text, string target) + public IReadOnlyList Fit(int width) { - ArgumentNullException.ThrowIfNull(runs); - var whole = string.Concat(runs.Select(r => r.Text)); - var at = string.IsNullOrEmpty(text) ? -1 : whole.LastIndexOf(text, StringComparison.Ordinal); - if (at < 0) + var runs = Row(); + if (width <= 0 || WidthOf(string.Concat(runs.Select(r => r.Text))) <= width) { return runs; } - var end = at + text.Length; + var budget = Math.Max(0, width - 1); var result = new List(); - var pos = 0; + var shown = 0; foreach (var run in runs) { - var (rs, re) = (pos, pos + run.Text.Length); - pos = re; - if (re <= at || rs >= end) + if (shown + run.Text.Length <= budget) { result.Add(run); + shown += run.Text.Length; continue; } - var (a, b) = (Math.Max(rs, at), Math.Min(re, end)); - if (a > rs) - { - result.Add(run with { Text = run.Text[..(a - rs)] }); - } + result.Add(run with { Text = run.Text[..(budget - shown)] + "…" }); + break; + } + + return result; + } + + /// + public bool Equals(StatusModel? other) => + other is not null && Plane == other.Plane && Ink == other.Ink && Width == other.Width + && Equals(Notice, other.Notice) + && LeftSegments.SequenceEqual(other.LeftSegments) && RightSegments.SequenceEqual(other.RightSegments); + + /// + public override int GetHashCode() => HashCode.Combine(Plane, Ink, Width, LeftSegments.Count, RightSegments.Count); - result.Add(run with { Text = run.Text[(a - rs)..(b - rs)], Target = target }); - if (re > b) + private static List Flatten(IReadOnlyList segments) + { + var runs = new List(); + for (var i = 0; i < segments.Count; i++) + { + if (i > 0) { - result.Add(run with { Text = run.Text[(b - rs)..] }); + runs.Add(new StatusRun(Separator, null, false)); } + + runs.AddRange(segments[i].Runs); } - return result; + return runs; } } diff --git a/src/SharpMUTerm.Tui/CommandPalette.cs b/src/SharpMUTerm.Tui/CommandPalette.cs index 8991c88a..c94b58ce 100644 --- a/src/SharpMUTerm.Tui/CommandPalette.cs +++ b/src/SharpMUTerm.Tui/CommandPalette.cs @@ -126,6 +126,7 @@ private void Open() var clear = Math.Clamp(KeepClearBelow?.Invoke() ?? 0, 0, Math.Max(0, desktop.Height - 8)); var above = desktop.Height - clear; var height = Math.Clamp(initial.Rows.Count + 1 + 3, 6, Math.Max(6, clear > 0 ? above - 1 : desktop.Height - 2)); + _fullHeight = height; _contentWidth = Math.Clamp( Math.Max(CommandSurfaceRenderer.NaturalWidth(initial), HeaderWidth(initial)) + 1, 32, @@ -174,8 +175,42 @@ private void Refresh(string query) _view = Build(query); _selected = _view.Entries.Count == 0 ? -1 : Math.Clamp(_selected, 0, _view.Entries.Count - 1); Paint(); + FitHeight(query); } + /// The height the palette opened at: the whole catalog's, capped above the command line. + private int _fullHeight; + + /// The least a filtered palette shrinks to, so a query matching one row or none is still a surface. + internal const int FilteredMinHeight = 10; + + /// + /// Sizes the palette to what it lists: the whole catalog's height while the query is empty, and the matching rows' + /// (at least , never past the height it opened at, which is held above the command + /// line) once something is typed — a filtered list in a full-height frame was a column of blank. The top edge stays + /// where it opened, so the prompt being typed into does not move. + /// + private void FitHeight(string query) + { + if (_window is not { } window || _fullHeight <= 0) + { + return; + } + + var height = query.Length == 0 + ? _fullHeight + : Math.Clamp(_view.Rows.Count + 1 + 3, Math.Min(FilteredMinHeight, _fullHeight), _fullHeight); + if (height != window.Height) + { + var at = new System.Drawing.Point(window.Left, window.Top); + window.SetSize(window.Width, height); + window.SetPosition(at); + } + } + + /// The palette window's height now, or 0 while closed; for a test. + internal int WindowHeight => _window?.Height ?? 0; + private void Paint() => _results?.SetContent(Scheme.Lines(CommandSurfaceRenderer.Render(_view, _selected, _context(), _contentWidth), ScreenPalette.MenuBg)); diff --git a/src/SharpMUTerm.Tui/PackageScreen.cs b/src/SharpMUTerm.Tui/PackageScreen.cs index c3f9b293..ba4eca7f 100644 --- a/src/SharpMUTerm.Tui/PackageScreen.cs +++ b/src/SharpMUTerm.Tui/PackageScreen.cs @@ -47,11 +47,34 @@ internal static List Review(PackageReviewModel model, int width) } } - lines.Add(string.Empty); - lines.Add($"[{ScreenPalette.Label}]⏎ install · Esc cancel — nothing is written until you press ⏎[/]"); return lines; } + /// + /// The rows pinned under the review, outside its scroll (the import review's shape): a rule, then the keys that answer + /// it and that nothing is written until ⏎. Pinned because this is a consent screen — at 80×24 the body filled the + /// screen down to the command line, and a longer package would have scrolled its way to accept out of sight. + /// + internal static List ReviewFooter(int width) + { + width = Math.Max(30, width); + var keys = new List + { + new("⏎", "install", Drop: LadderKey.Keep), + new("↑↓", "scroll", Drop: 1), + new("Esc", "cancel", Drop: LadderKey.Keep), + }; + var ladder = KeyLadder.Fit(keys, width - 1, k => $"[{ScreenPalette.Accent}]{Escape(k)}[/]", Label, " "); + var note = $"[{ScreenPalette.Label}]— nothing is written until you press ⏎[/]"; + return + [ + $"[{ScreenPalette.Rule}]{new string('─', width - 1)}[/]", + VisibleLength(ladder) + 3 + VisibleLength(note) <= width - 1 ? $"{ladder} {note}" : ladder, + ]; + } + + private static string Label(string text) => $"[{ScreenPalette.Label}]{Escape(text)}[/]"; + private static string ReviewRow(PackageReviewRow row, int width) { var ink = row.Tone switch diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs index 6be600e8..077fe3ec 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs @@ -10,9 +10,10 @@ namespace SharpMUTerm.Tui; /// The status row and the command line's field, for a host that draws them itself (, /// ; the window). /// -/// The status row is the markup writes, parsed by the framework's own parser into runs -/// () — so the footer says exactly what the cells would, notices, mode keys, meters, reconnect, -/// ● REC, ♪ muted and the scrollback segment included — and the row's cell is left out of the grid. A click +/// The status row is a built first — segments by role, laid out to the row's width — and +/// renders the cells from it (), so the footer says +/// exactly what the cells would, notices, mode keys, meters, reconnect, ● REC, ♪ muted and the scrollback +/// segment included — and the row's cell is left out of the grid. A click /// hands back a target the client put on a run: a notice's action (to , the toast's path) /// or the palette hint (to the palette, the header search box's path). Anything else is refused. /// @@ -57,71 +58,74 @@ internal StatusOverlay BuildStatusOverlay() return new StatusOverlay(BuildStatusModel(), MainWindowInFront(), _statusActivate); } + /// The status row's model, as last painted: the instance the cells were rendered from. Internal for tests. + internal StatusModel BuildStatusModel() => _statusModel ?? StatusRowModel([]); + + /// The model the status row was last rendered from. + private StatusModel? _statusModel; + + /// A status row laid out at the row's width now, on the row's plane, in the row's ink. + private StatusModel StatusRowModel( + IReadOnlyList left, + IReadOnlyList? right = null, + NoticeModel? notice = null) => + new(left, right ?? [], Hex(WorkspacePalette.Backdrop(_theme)), Hex(_theme.StatusForeground)) + { + Width = HeaderWidth(), + Notice = notice, + }; + /// - /// The row's markup as runs: the framework's parse of exactly what the cells are given, one run per change of ink - /// or weight, split into the left and right clusters, with the palette hint and a showing notice's action marked - /// clickable. + /// The status row's quiet ink: a grey held to 4.5:1 on the backdrop it is painted on, in place of the framework's + /// fixed [dim] #808080 — 3.4:1 on Light's status plane, and the row is small text a reader looks for + /// (UX audit wave 11, #2 and #7). /// - internal StatusModel BuildStatusModel() + private string StatusDim => Hex(WorkspacePalette.NoticeMuted(_theme, WorkspacePalette.Backdrop(_theme))); + + /// A run of the status row; a null ink is the row's own. + private static StatusRun Run(string text, string? ink = null, bool bold = false, string? target = null) => + new(text, ink, bold, target); + + /// A run in the row's quiet ink. + private StatusRun Dim(string text, string? target = null) => new(text, StatusDim, false, target); + + /// A segment of the status row. + private static StatusSegment Segment(StatusRole role, params StatusRun[] runs) => new(role, runs); + + /// + /// The cell renderer of the status row: each run in its ink, bold where it is, a run in the row's own ink written + /// with no colour (so it takes the control's, as unstyled text always did), neighbouring runs of one style merged. + /// + internal static string StatusRowMarkup(IReadOnlyList runs) { - var plane = WorkspacePalette.Backdrop(_theme); - var fg = ToColor(_theme.StatusForeground); - var bg = ToColor(plane); - var runs = new List(); - var text = new System.Text.StringBuilder(); - (string Ink, bool Bold)? style = null; - foreach (var cell in MarkupParser.Parse(_statusBar.Text, fg, bg)) + var markup = new System.Text.StringBuilder(); + for (var i = 0; i < runs.Count;) { - if (cell.IsWideContinuation) + var (ink, bold) = (runs[i].Ink, runs[i].Bold); + var text = new System.Text.StringBuilder(); + for (; i < runs.Count && runs[i].Ink == ink && runs[i].Bold == bold; i++) { - continue; + text.Append(runs[i].Text); } - var next = (ColourHex(cell.Foreground), cell.Decorations.HasFlag(TextDecoration.Bold)); - if (style is { } current && current != next) + if (text.Length == 0) { - runs.Add(new StatusRun(text.ToString(), current.Ink, current.Bold)); - text.Clear(); + continue; } - style = next; - text.Append(cell.Character.ToString()); + var escaped = MarkupText.Escape(text.ToString()); + var tag = (bold ? "bold " : string.Empty) + (ink ?? string.Empty); + markup.Append(tag.Length == 0 ? escaped : $"[{tag.TrimEnd()}]{escaped}[/]"); } - if (style is { } last && text.Length > 0) - { - runs.Add(new StatusRun(text.ToString(), last.Ink, last.Bold)); - } - - IReadOnlyList marked = runs; - if (_noticeShown?.Action is { } action && _notice is not null) - { - foreach (var hint in NoticeActionHints(action)) - { - marked = StatusModel.Mark(marked, hint, action.Command); - } - } - - marked = StatusModel.Mark(marked, PaletteHintText, HeaderModel.PaletteTarget); - return StatusModel.From(marked, Hex(plane)); + return markup.ToString(); } - /// - /// The model as cell markup: each run in its ink, bold where it was, the clusters a gap apart. The row the cells - /// paint is the markup this model was parsed from; this is the way back, and StatusFooterTests holds the two - /// to the same visible text. - /// - internal static string StatusRowMarkup(StatusModel model) - { - static string Run(StatusRun run) => - $"[{(run.Bold ? "bold " : string.Empty)}{run.Ink}]{MarkupText.Escape(run.Text)}[/]"; - - var left = string.Concat(model.Left.Select(Run)); - return model.Right.Count == 0 ? left : left + " " + string.Concat(model.Right.Select(Run)); - } + /// The status row's way to the palette, as the row writes it; the run a click opens ⌃P from. + private const string PaletteHintText = "⌃P palette"; - /// The status row's way to the palette, as the row writes it. - private static string PaletteHintText => $"{KeyGlyphs.Normalize("⌃P")} palette"; + /// The model as cell markup, laid out at its width: what the cells paint. Internal for tests. + internal static string StatusRowMarkup(StatusModel model) => StatusRowMarkup(model.Row()); /// /// A click on the host's status footer, by the target the client put on a run. Internal so a test can drive it the @@ -203,7 +207,6 @@ private void PublishInputBand() return new InputBand(top, rows, InputLayout.HostFieldPad, prompts, $"⏎ sends · {KeyGlyphs.Normalize(Host.Keys.Newline.Glyph)} new line"); } - private static string ColourHex(Color colour) => $"#{colour.R:x2}{colour.G:x2}{colour.B:x2}"; } /// The status row, for a host that draws it (). diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs index cf056f13..e1292b1a 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Notices.cs @@ -45,29 +45,45 @@ internal sealed partial class SharpMUTermApp /// failure in the raw red was 1.39:1 on Light, and the framework's fixed [dim] grey 2.4:1. The cell /// renderer of the notice surface. /// - internal string NoticeMarkup(NoticeModel notice) + internal string NoticeMarkup(NoticeModel notice) => StatusRowMarkup(NoticeSegment(notice).Runs); + + /// + /// The notice as the status row's segment: the key chip (or the source's label) in the notice ink, then the text — + /// in the warning red when something failed, otherwise a muted grey — then the way to its action, a click's target. + /// + private StatusSegment NoticeSegment(NoticeModel notice) { ArgumentNullException.ThrowIfNull(notice); var plane = WorkspacePalette.Backdrop(_theme); var ink = notice.Severity == NoticeSeverity.Warning ? HeldOn(ScreenPalette.Warn, plane) : Hex(WorkspacePalette.NoticeMuted(_theme, plane)); - var body = $"[{ink}]{Escape(notice.Text)}[/]"; var label = HeldOn(_ink.Notice, plane); + var runs = new List(); + // A source is a label (Sound:), a key a chord chip (⌃P): two shapes, so a word is never read as a key to press. - var row = notice.Source is { } source ? $"[{label}]{Escape(source)}:[/] {body}" - : notice.Key is null ? body : $"[{label}]{Escape(notice.Key)}[/] {body}"; + if (notice.Source is { } source) + { + runs.AddRange([Run($"{source}:", label), Run(" ")]); + } + else if (notice.Key is { } key) + { + runs.AddRange([Run(key, label), Run(" ")]); + } + + runs.Add(Run(notice.Text, ink)); // The toast offers the action as a button; the row names the way to it, where it fits whole — never by cutting - // the notice's own words, and never wrapping the row (FitStatusRow). + // the notice's own words, and never wrapping the row (StatusModel.Fit). // A notice whose own words already name the way (`offline — ⌥R (⌃P ▸ Reconnect) connects it`) gets no second // copy: the row read `… connects it · ⌥R Reconnect`. - if (NoticeActionHints(notice.Action).FirstOrDefault(h => !NamesWay(notice.Text, h) && MarkupWidth(row) + 3 + h.Length <= HeaderWidth()) is { } hint) + var width = StatusModel.WidthOf(string.Concat(runs.Select(r => r.Text))); + if (NoticeActionHints(notice.Action).FirstOrDefault(h => !NamesWay(notice.Text, h) && width + 3 + h.Length <= HeaderWidth()) is { } hint) { - row += $"[{label}] · {Escape(hint)}[/]"; + runs.AddRange([Run(" · ", label), Run(hint, label, target: notice.Action!.Command)]); } - return row; + return new StatusSegment(StatusRole.Notice, runs); } /// @@ -136,7 +152,7 @@ private void PublishNotice(NoticeModel notice) } _noticeRun ??= id => OnUiThread(() => RunNoticeAction(id)); - _pointer.Notice(new NoticeOverlay(notice, NoticeAboveRow(), NoticePalette(), _noticeRun)); + _pointer.Notice(new NoticeOverlay(notice, NoticeAboveRow(), NoticePalette(), _noticeRun) { Theme = _theme }); } /// @@ -221,7 +237,14 @@ internal void SimulateNotice(string text, MessageSeverity severity, string? key, /// Runs the notice's action by its command id, through the registry; a command no notice offered is refused. Safe to /// call from any thread. The same instance for the life of the client. /// -internal sealed record NoticeOverlay(NoticeModel Notice, int AboveRow, NoticePalette Palette, Action Run); +internal sealed record NoticeOverlay(NoticeModel Notice, int AboveRow, NoticePalette Palette, Action Run) +{ + /// + /// The client's theme, which the window derives its card plane from (NativeTokens): a toast is a native card + /// like the palette's, not a piece of the status row. Null when not said; the host then picks by the palette's plane. + /// + public Core.Theming.Theme? Theme { get; init; } +} /// A toast's colours as #rrggbb: its plane, its text, and its edge per severity. internal sealed record NoticePalette(string Plane, string Text, string Info, string Warning, string Refusal) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ModeHints.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ModeHints.cs index a12cd463..b58f9943 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ModeHints.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ModeHints.cs @@ -46,20 +46,31 @@ internal StatusMode CurrentStatusMode() } /// - /// The row's candidates for , longest first, as markup: each key in the client's notice - /// voice and what it does dimmed, so the way out reads at a glance. Every candidate is exactly as wide as the + /// The row's candidates for , longest first: each key in the client's notice voice and what + /// it does in the row's quiet ink, so the way out reads at a glance. Every candidate is exactly as wide as the /// plain text gives, which is what the row measures. /// - private List ModeHintMarkup(StatusMode mode) + private List ModeHintSegments(StatusMode mode) { var keys = HostKeyGlyphs(); var hints = ModeHints.For(mode) - .Select(h => $"[{_ink.Notice}]{MarkupText.Escape(Client.Palette.KeyGlyphs.Normalize(h.Key.Resolve(keys)))}[/] [dim]{MarkupText.Escape(h.Does)}[/]") + .Select(h => new[] { Run(Client.Palette.KeyGlyphs.Normalize(h.Key.Resolve(keys)), _ink.Notice), Run(" "), Dim(h.Does) }) .ToList(); - var candidates = new List(hints.Count); + var candidates = new List(hints.Count); for (var n = hints.Count; n > 0; n--) { - candidates.Add(string.Join("[dim] · [/]", hints.Take(n))); + var runs = new List(); + foreach (var hint in hints.Take(n)) + { + if (runs.Count > 0) + { + runs.Add(Dim(" · ")); + } + + runs.AddRange(hint); + } + + candidates.Add(new StatusSegment(StatusRole.ModeHint, runs)); } return candidates; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs index 42ab5d42..7eb8ae08 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MooEdit.cs @@ -75,7 +75,10 @@ async Task SaveAsync() } /// » status, elided and padded to . The text is the server's. - internal static string MooStatusCell(string status) + internal static string MooStatusCell(string status) => $"[dim]{Escape(MooStatusText(status))}[/]"; + + /// 's text: » status, elided and padded. + internal static string MooStatusText(string status) { var text = new string([.. status.Select(c => char.IsControl(c) ? ' ' : c)]).Trim(); var room = MooStatusCellWidth - 2; @@ -84,6 +87,6 @@ internal static string MooStatusCell(string status) text = text[..(room - 1)] + "…"; } - return $"[dim]» {Escape(text.PadRight(room))}[/]"; + return $"» {text.PadRight(room)}"; } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs index dda4127f..7dbcfdff 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Packages.cs @@ -236,7 +236,9 @@ internal void ReviewPackage(byte[] archive, PackageIndexEntry? listed = null) AcceptPackage(model); return false; - }); + }, + footer: PackageScreen.ReviewFooter, + scrollKeys: true); } /// diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 5c26c86c..66d52564 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -2693,7 +2693,8 @@ void Feed(string windowId, string ansiLine) // server agreed to UTF-8, which the row draws unqualified. A world that pinned an encoding // would read "utf-8 forced" and a server that never negotiated "utf-8 assumed". _demoEncoding = new SessionEncoding(Encoding.UTF8, EncodingSource.Negotiated); - _statusBar.SetContent(new List { StatusInk(StatusBarMarkup("Corvid", "connected")) }); + _statusModel = StatusBarRow("Corvid", "connected"); + _statusBar.SetContent(new List { StatusRowMarkup(_statusModel) }); RefreshHeader(); _input.SetAndNotify("say hello there"); RebuildPaneArea(); // realise the Chat spawn tab, then refresh badges @@ -7043,11 +7044,11 @@ private void SyncScrollbackState(string? windowId = null) /// sign that a pane is not showing its newest line, because the panes deliberately carry no /// scrollbar (see ), so it has to be right rather than decorative. /// - private string ScrollbackStatus() + private StatusSegment? ScrollbackStatus() { if (ScrollTarget() is not { CanScrollDown: true } panel) { - return string.Empty; + return null; } // Kept short on purpose. The row right-aligns a cluster of five segments and only guarantees a @@ -7064,7 +7065,7 @@ private string ScrollbackStatus() // segment is the same width whatever it says. var below = Math.Max(1, panel.TotalContentHeight - panel.ViewportHeight - panel.VerticalScrollOffset); var distance = UnreadBadge.Format(below).PadLeft(UnreadBadge.FieldWidth); - return $"[{_ink.Notice}]{Glyphs.Scrollback} scrollback[/] [dim]{distance} · ⌃End live[/]"; + return Segment(StatusRole.Scrollback, Run($"{Glyphs.Scrollback} scrollback", _ink.Notice), Run(" "), Dim($"{distance} · ⌃End live")); } /// @@ -7081,8 +7082,8 @@ private void RefreshStatusRow() } SetStatus(_statusIdentity is { } id - ? StatusBarMarkup(id.Character, id.State) - : NotConnectedMarkup()); + ? StatusBarRow(id.Character, id.State) + : NotConnectedRow()); } /// @@ -7275,7 +7276,7 @@ private void RefreshStatusBar() return; } - SetStatus(StatusBarMarkup(id.Character, id.State)); + SetStatus(StatusBarRow(id.Character, id.State)); } /// The world.character key of the character whose windows the rail expands. @@ -12834,7 +12835,7 @@ private void EnterMoveMode() } RebuildPaneArea(); - SetStatus(MovePromptMarkup(), displace: true); + SetStatus(MovePromptRow(), displace: true); } /// Handles a key while in move mode: pick pane (1–9), edge (arrows), commit (⏎), cancel (Esc). @@ -12862,7 +12863,7 @@ private void HandleMoveKey(KeyPressedEventArgs e) { _moveEdge = _moveEdge == edge ? null : edge; RebuildPaneArea(); - SetStatus(MovePromptMarkup(), displace: true); + SetStatus(MovePromptRow(), displace: true); return; } @@ -12874,7 +12875,7 @@ private void HandleMoveKey(KeyPressedEventArgs e) { _moveTargetPaneId = match.Key; RebuildPaneArea(); - SetStatus(MovePromptMarkup(), displace: true); + SetStatus(MovePromptRow(), displace: true); } } } @@ -12908,13 +12909,20 @@ private void ExitMoveMode(bool commit) } /// The move-mode status prompt. - private string MovePromptMarkup() + private StatusModel MovePromptRow() { - var name = _moveWindowId is { } id && _workspace.FindWindow(id) is { } w ? Escape(w.Title) : "window"; - return $"[{_ink.Notice}]MOVE[/] [bold]{name}[/] [dim]→[/] [{_ink.Accent}]{DropLabel(_moveTargetPaneId, _moveEdge)}[/]" - + " [dim]1–9 pane · ←↑↓→ edge · ⏎ commit · Esc cancel[/]"; + var name = _moveWindowId is { } id && _workspace.FindWindow(id) is { } w ? w.Title : "window"; + return StatusRowModel( + [ + DropPrompt("MOVE", name, DropLabel(_moveTargetPaneId, _moveEdge)), + Segment(StatusRole.ModeHint, Dim("1–9 pane · ←↑↓→ edge · ⏎ commit · Esc cancel")), + ]); } + /// The move and drag prompts' first segment: MOVE window → where. + private StatusSegment DropPrompt(string verb, string window, string where) => + Segment(StatusRole.Prompt, Run(verb, _ink.Notice), Run(" "), Run(window, bold: true), Run(" "), Dim("→"), Run(" "), Run(where, _ink.Accent)); + /// Human-readable description of a pending drop, for the move prompt and drag preview. private string DropLabel(string? paneId, Edge? edge) { @@ -13233,7 +13241,7 @@ private void ApplyDragResult(PaneDragResult result) _dragTargetPaneId = result.TargetPaneId; _dragEdge = result.Edge; RebuildPaneArea(); - SetStatus(DragPromptMarkup(result.WindowId, result.TargetPaneId, result.Edge), displace: true); + SetStatus(DragPromptRow(result.WindowId, result.TargetPaneId, result.Edge), displace: true); break; case PaneDragAction.Commit: @@ -13269,11 +13277,14 @@ private void EndDrag() } /// The status line shown while a pane drag is in flight. - private string DragPromptMarkup(string? windowId, string? targetPaneId, Edge? edge) + private StatusModel DragPromptRow(string? windowId, string? targetPaneId, Edge? edge) { - var name = windowId is { } id && _workspace.FindWindow(id) is { } window ? Escape(window.Title) : "window"; - return $"[{_ink.Notice}]DRAG[/] [bold]{name}[/] [dim]→[/] [{_ink.Accent}]{DropLabel(targetPaneId, edge)}[/]" - + " [dim]release to drop · Esc cancel[/]"; + var name = windowId is { } id && _workspace.FindWindow(id) is { } window ? window.Title : "window"; + return StatusRowModel( + [ + DropPrompt("DRAG", name, DropLabel(targetPaneId, edge)), + Segment(StatusRole.ModeHint, Dim("release to drop · Esc cancel")), + ]); } /// A pane rendered as a live drop target, sized from the drag's frozen geometry. @@ -14049,33 +14060,15 @@ private async Task AnnounceWindowSizeAsync(WorldSession session, int width, int /// took. Re-deriving here rather than in is what covers the notice case too. /// /// - private void PaintStatus(string markup) + private void PaintStatus(StatusModel model) { - _statusBar.SetContent(new List { StatusInk(FitStatusRow(markup, HeaderWidth())) }); + // The model first, the cells from it: cut to the width now (StatusModel.Fit), so a notice never wraps the row. + _statusModel = Drawing(SurfaceCatalog.Status, string.Empty, model); + _statusBar.SetContent(new List { StatusRowMarkup(model.Fit(HeaderWidth())) }); SyncInputHeights(_second.Visible); PublishStatus(); // a host's footer has no cell to repaint, so a change may paint no frame (RefreshHeader's reason) } - /// - /// The status row's quiet text in a grey held to 4.5:1 on the backdrop it is painted on, in place of the framework's - /// fixed [dim] #808080 — 3.4:1 on Light's status plane, and the row is small text a reader looks for - /// (UX audit wave 11, #2 and #7). Only the bare tag is replaced; the cells do not move. - /// - private string StatusInk(string markup) => - BareDim.Replace(markup, $"[{Hex(WorkspacePalette.NoticeMuted(_theme, WorkspacePalette.Backdrop(_theme)))}]"); - - /// A [dim] tag that is a tag, not the escaped text [[dim]]. - private static readonly System.Text.RegularExpressions.Regex BareDim = new(@"(? - /// The status row's markup cut to cells, ending in …. The row is one row in every - /// host: a notice is a sentence, and a window narrower than it wrapped the row onto a second line and took that row - /// off the command line (the D1 lesson, live in the window). Everything the resting row lays out already fits; this is - /// the floor under the notices and anything else that does not measure itself. Internal for tests. - /// - internal static string FitStatusRow(string markup, int width) => - width > 0 && MarkupWidth(markup) > width ? ElideVisible(markup, width) : markup; - /// /// Sets what the status row says at rest: the connection identity, a mode prompt, the /// not-connected line. Remembered as well as painted, so a laid over the top of @@ -14093,7 +14086,7 @@ internal static string FitStatusRow(string markup, int width) => /// True for a line that must be seen now — the move and drag prompts, which are a mode the /// user just entered rather than a background repaint. /// - private void SetStatus(string markup, bool displace = false) + private void SetStatus(StatusModel markup, bool displace = false) { _restingStatus = markup; if (displace) @@ -14108,7 +14101,7 @@ private void SetStatus(string markup, bool displace = false) } /// What the status row says with no notice over it. Kept in step by . - private string _restingStatus = "[dim]not connected[/]"; + private StatusModel? _restingStatus; /// /// How long a holds the status row. tmux's display-time is well under a @@ -14193,11 +14186,11 @@ private void Notice(string text, MessageSeverity severity = MessageSeverity.Warn { Second = action is null ? null : second, }); - var markup = NoticeMarkup(model); + var segment = NoticeSegment(model); - _notice = markup; + _notice = StatusRowMarkup(segment.Runs); _noticeShown = model; - PaintStatus(markup); + PaintStatus(StatusRowModel([segment], notice: model)); if (toast) { PublishNotice(model); @@ -14225,7 +14218,7 @@ private void ClearNotice() } ForgetNotice(); - PaintStatus(_restingStatus); + PaintStatus(_restingStatus ?? NotConnectedRow()); } /// Forgets the notice and disarms its timer, without painting — for callers about to paint. @@ -14236,22 +14229,30 @@ private void ForgetNotice() } /// The resting status row of a client with nothing connected. - private string NotConnectedMarkup() + private StatusModel NotConnectedRow() { - var scrollback = ScrollbackStatus(); - var suffix = scrollback.Length == 0 ? string.Empty : $" {scrollback}"; // No graphics readout: which protocol the probe chose is a startup fact (--help and the session's first line say it), and on a // first run it was the one technical word on the screen. - var row = $"[dim]not connected · ⌃P palette · ⌃Q quit[/]{suffix}"; + var row = new List + { + Segment(StatusRole.Text, Dim("not connected · "), Dim(PaletteHintText, HeaderModel.PaletteTarget), Dim(" · ⌃Q quit")), + }; + if (ScrollbackStatus() is { } scrollback) + { + row.Add(scrollback); + } // A client with nothing connected is still read back through, frozen and searched: the mode's keys go on // the end where they fit, the longest that does. var mode = CurrentStatusMode(); _statusModeShown = mode; - return mode != StatusMode.None - && ModeHintMarkup(mode).FirstOrDefault(h => MarkupWidth(row) + 3 + MarkupWidth(h) <= HeaderWidth()) is { } hint - ? $"{row} {hint}" - : row; + if (mode != StatusMode.None + && ModeHintSegments(mode).FirstOrDefault(h => StatusModel.WidthOf(row) + 3 + h.Width <= HeaderWidth()) is { } hint) + { + row.Add(hint); + } + + return StatusRowModel(row); } private void UpdateStatus() @@ -14262,7 +14263,7 @@ private void UpdateStatus() // Clear the identity too: leaving a stale one behind means the next RefreshStatusBar // repaints a connection that is no longer there. _statusIdentity = null; - SetStatus(NotConnectedMarkup()); + SetStatus(NotConnectedRow()); return; } @@ -14532,7 +14533,7 @@ private string HeaderRight(HeaderModel model) /// you are outlives everything. /// /// - private string[] FocusHints() + private StatusSegment[] FocusHints() { var panes = _workspace.Layout.Panes.Count > 1 && _workspace.Layout.ZoomedPaneId is null; var bars = _second.Visible; @@ -14556,10 +14557,10 @@ private string[] FocusHints() }; var segments = ordered.OfType<(string Text, int Rank)>().ToList(); - var candidates = new List(segments.Count); + var candidates = new List(segments.Count); while (segments.Count > 0) { - candidates.Add($"[dim]{string.Join(" · ", segments.Select(s => s.Text))}[/]"); + candidates.Add(Segment(StatusRole.FocusHint, Dim(string.Join(" · ", segments.Select(s => s.Text))))); segments.Remove(segments.MinBy(s => s.Rank)); } @@ -14585,11 +14586,11 @@ private string[] FocusHints() /// place. A function of the row and never of the room's name, so a walk still moves nothing: at 160 columns the /// cell read The Grand Plaza · Aetherf… with thirty cells free beside it. /// - private int RoomCellFor(string left, string rightBar, StatusMode mode) + private int RoomCellFor(int left, int rightBar, StatusMode mode) { - var hints = mode == StatusMode.None ? FocusHints().Select(h => MarkupWidth(h) + 3).DefaultIfEmpty(0).Max() : 0; + var hints = mode == StatusMode.None ? FocusHints().Select(h => h.Width + 3).DefaultIfEmpty(0).Max() : 0; var moo = _active?.McpStatus is null ? 0 : MooStatusCellWidth + 3; - var spare = HeaderWidth() - MarkupWidth(left) - 3 - MarkupWidth(rightBar) - MinStatusGap - MeterSlack - hints - moo; + var spare = HeaderWidth() - left - 3 - rightBar - MinStatusGap - MeterSlack - hints - moo; return Math.Clamp(spare, RoomCellWidth, RoomCellMaxWidth); } @@ -14599,7 +14600,11 @@ private int RoomCellFor(string left, string rightBar, StatusMode mode) /// ⌂ Room · Area, elided and padded to . The room leads: it is what /// changes, and it is what an elision should keep. - internal static string RoomCell(string name, string? area, int width = RoomCellWidth) + internal static string RoomCell(string name, string? area, int width = RoomCellWidth) => + $"[dim]{Escape(RoomCellText(name, area, width))}[/]"; + + /// 's text: ⌂ Room · Area, elided and padded. + internal static string RoomCellText(string name, string? area, int width = RoomCellWidth) { var text = string.IsNullOrWhiteSpace(area) ? name : $"{name} · {area}"; var room = Math.Max(RoomCellWidth, width) - 2; @@ -14608,7 +14613,7 @@ internal static string RoomCell(string name, string? area, int width = RoomCellW text = text[..(room - 1)] + "…"; } - return $"[dim]⌂ {Escape(text.PadRight(room))}[/]"; + return $"⌂ {text.PadRight(room)}"; } /// Whether the status row last left its meters out because the vitals strip was showing them. @@ -14648,24 +14653,37 @@ private void SyncStatusMeters() /// The cells the meters leave free for the typed-character count to grow into. private const int MeterSlack = 4; - private string StatusBarMarkup(string character, string state) + /// + /// The resting status row of a connected client, as a model: every segment by its role, laid out to the row's width + /// with the row's reserved fields and drop order. The cells are rendered from it (), and the + /// window's footer draws the same instance. + /// + private StatusModel StatusBarRow(string character, string state) { // A dropped connection waiting to dial again says when, in place of "faulted" (SharpMUTermApp.Reconnect.cs). state = ReconnectStatus(_active) ?? state; var accent = ActiveWorld() is { } world ? AccentHex(world.Accent) : _ink.Accent; - var left = $"[{accent}]●[/] [bold]{Escape(character)}[/] [dim]{Escape(state)}[/]"; + var left = new List + { + Segment(StatusRole.Identity, Run("●", accent), Run(" "), Run(character, bold: true), Run(" "), Dim(state)), + }; + int W(IReadOnlyCollection cluster) => StatusModel.WidthOf(cluster); + // The vitals strip already draws these meters for this character, larger; the row says them only while it // is not on screen. Nothing else on the row moves with it: every other cell is reserved or dropped by width. _statusMetersHidden = VitalsStripShowing(); - var meters = _statusMetersHidden - ? string.Empty - : StatusMeterRenderer.Render(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground)); + StatusSegment? MeterSegment(bool compact) => + StatusMeterRenderer.Runs(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground), StatusDim, compact) is { Count: > 0 } runs + ? new StatusSegment(StatusRole.Meters, runs) + : null; + var meters = _statusMetersHidden ? null : MeterSegment(compact: false); - var right = new List(); + var right = new List(); // Leftmost of the right cluster while it is there at all: a pane that is not showing its newest // line is the most important thing the row can say, because nothing else on screen says it. - if (ScrollbackStatus() is { Length: > 0 } scrollback) + var scrollback = ScrollbackStatus(); + if (scrollback is not null) { right.Add(scrollback); } @@ -14674,13 +14692,13 @@ private string StatusBarMarkup(string character, string state) // Only by a keystroke, like the mute cell below, so it needs no reserved width; and never given up for room. if (SceneRecording) { - right.Add($"[{HeldOn(ScreenPalette.Warn, WorkspacePalette.Backdrop(_theme))}]{RecordingCell}[/]"); + right.Add(Segment(StatusRole.Recording, Run(RecordingCell, HeldOn(ScreenPalette.Warn, WorkspacePalette.Backdrop(_theme))))); } // Only while muted, and only by a keystroke: nothing from the wire can make this cell appear. if (_muted) { - right.Add($"[{_ink.Notice}]{MutedCell}[/]"); + right.Add(Segment(StatusRole.Muted, Run(MutedCell, _ink.Notice))); } // No latency meter. There was one — a heartbeat glyph, a sparkline and a round-trip figure — and @@ -14705,10 +14723,10 @@ private string StatusBarMarkup(string character, string state) // "utf-8" means the server agreed, "utf-8 assumed" means nobody said, "iso-8859-1 forced" means // you did. With nothing connected there is no fact to report, and the cell is not drawn — the // same rule that took the address and the invented latency meter off this row. - string? encodingCell = null; + StatusSegment? encodingCell = null; if (EffectiveEncoding() is { } encoding) { - encodingCell = $"[dim]{Escape(encoding.Label)}[/]"; + encodingCell = Segment(StatusRole.Encoding, Dim(encoding.Label)); right.Add(encodingCell); } @@ -14716,10 +14734,10 @@ private string StatusBarMarkup(string character, string state) // history it becomes the "back to draft" hint instead. Both read the armed bar, so a count that // moves is always the line ⏎ would send. right.Add(HistoryFor(BarKind(ActiveBar())).IsRecalling - ? $"[{AccentHex(AccentPalette[0])}]history[/] [dim]· ↓ back to draft[/]" - : $"[dim]{ActiveBar().Text.Length} chars[/]"); + ? Segment(StatusRole.Count, Run("history", AccentHex(AccentPalette[0])), Run(" "), Dim("· ↓ back to draft")) + : Segment(StatusRole.Count, Dim($"{ActiveBar().Text.Length} chars"))); - const string paletteCell = "[dim]⌃P palette[/]"; + var paletteCell = Segment(StatusRole.Palette, Dim(PaletteHintText, HeaderModel.PaletteTarget)); right.Add(paletteCell); // The cluster above is built unconditionally, and at 80 columns a scrolled-back pane's segment @@ -14732,14 +14750,11 @@ private string StatusBarMarkup(string character, string state) // The meters count here too: on a narrow terminal they are worth more to someone in a fight than // either of those two cells, and they used to be the thing that lost — at 80 columns a world // publishing HP showed none of it. - var compactMeters = meters.Length > 0 - ? StatusMeterRenderer.Render(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground), compact: true) - : string.Empty; - var meterCost = compactMeters.Length > 0 ? 3 + MarkupWidth(compactMeters) + MeterSlack : 0; + var compactMeters = meters is not null ? MeterSegment(compact: true) : null; + var meterCost = compactMeters is not null ? 3 + compactMeters.Width + MeterSlack : 0; foreach (var droppable in new[] { encodingCell, paletteCell }) { - if (droppable is null - || MarkupWidth(left) + MinStatusGap + MarkupWidth(string.Join(" ", right)) + meterCost <= HeaderWidth()) + if (droppable is null || W(left) + MinStatusGap + W(right) + meterCost <= HeaderWidth()) { continue; } @@ -14747,8 +14762,7 @@ private string StatusBarMarkup(string character, string state) right.Remove(droppable); } - if (right.Count > 1 - && MarkupWidth(left) + MinStatusGap + MarkupWidth(string.Join(" ", right)) > HeaderWidth()) + if (right.Count > 1 && W(left) + MinStatusGap + W(right) > HeaderWidth()) { right.RemoveAt(right.Count - 1); } @@ -14759,22 +14773,19 @@ private string StatusBarMarkup(string character, string state) // exactly this reason). A hint that quietly costs a row of output on a 100-column terminal is a // worse trade than a hint that is only there when there is room for it, and this is the same // measurement the header already makes to right-align its own cluster. - var rightBar = string.Join(" ", right); // The meters sit beside the identity they describe, and only when the row has room for them with a // few cells to spare: the character count on the right grows as a line is typed, and a cluster that // came and went with it would be worse than one that is absent on a narrow terminal. - if (meters.Length > 0 - && MarkupWidth(left) + 3 + MarkupWidth(meters) + MarkupWidth(rightBar) + MinStatusGap + MeterSlack > HeaderWidth()) + if (meters is not null && W(left) + 3 + meters.Width + W(right) + MinStatusGap + MeterSlack > HeaderWidth()) { // Too narrow for value/max: the share alone, in a field just as fixed. - meters = StatusMeterRenderer.Render(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground), compact: true); + meters = MeterSegment(compact: true); } - if (meters.Length > 0 - && MarkupWidth(left) + 3 + MarkupWidth(meters) + MarkupWidth(rightBar) + MinStatusGap + MeterSlack <= HeaderWidth()) + if (meters is not null && W(left) + 3 + meters.Width + W(right) + MinStatusGap + MeterSlack <= HeaderWidth()) { - left = $"{left} {meters}"; + left.Add(meters); } // A mode's keys outrank the room and the MOO's status, and the encoding and the palette hint too: while the @@ -14786,11 +14797,11 @@ private string StatusBarMarkup(string character, string state) _statusModeShown = mode; if (mode != StatusMode.None) { - bool Fits(string hint, IEnumerable cluster) => - MarkupWidth(left) + 3 + MarkupWidth(hint) + MarkupWidth(string.Join(" ", cluster)) + MinStatusGap <= HeaderWidth(); + bool Fits(StatusSegment hint, IEnumerable cluster) => + W(left) + 3 + hint.Width + W(cluster.ToList()) + MinStatusGap <= HeaderWidth(); - var droppables = new[] { encodingCell, paletteCell }.OfType().Where(right.Contains).ToList(); - foreach (var hint in ModeHintMarkup(mode)) + var droppables = new[] { encodingCell, paletteCell }.OfType().Where(right.Contains).ToList(); + foreach (var hint in ModeHintSegments(mode)) { var given = 0; while (!Fits(hint, right.Except(droppables.Take(given))) && given < droppables.Count) @@ -14806,46 +14817,42 @@ bool Fits(string hint, IEnumerable cluster) => right.RemoveAll(c => droppables.Take(given).Contains(c)); // Leftmost of the cluster but for the scrollback segment, which states the mode the hint answers. - right.Insert(right.Count > 0 && ScrollbackStatus().Length > 0 ? 1 : 0, hint); + right.Insert(right.Count > 0 && scrollback is not null ? 1 : 0, hint); break; } - - rightBar = string.Join(" ", right); } // Where the character stands, once the map knows. A reserved width, so a walk does not move the right // cluster with every room name; a name too long for it is elided, never wrapped. if (StatusRoom() is { } here) { - var cell = RoomCell(here.Name, here.Area, RoomCellFor(left, rightBar, mode)); - if (MarkupWidth(left) + 3 + RoomCellWidth + MarkupWidth(rightBar) + MinStatusGap + MeterSlack <= HeaderWidth()) + var cell = Segment(StatusRole.Room, Dim(RoomCellText(here.Name, here.Area, RoomCellFor(W(left), W(right), mode)))); + if (W(left) + 3 + RoomCellWidth + W(right) + MinStatusGap + MeterSlack <= HeaderWidth()) { - left = $"{left} {cell}"; + left.Add(cell); } } // What the MOO last put in its status line, once it has put anything there this connection. Reserved // and elided like the room, for the same reason, and dropped first when the row is short. if (_active?.McpStatus is { } mooStatus - && MarkupWidth(left) + 3 + MooStatusCellWidth + MarkupWidth(rightBar) + MinStatusGap + MeterSlack <= HeaderWidth()) + && W(left) + 3 + MooStatusCellWidth + W(right) + MinStatusGap + MeterSlack <= HeaderWidth()) { - left = $"{left} {MooStatusCell(mooStatus)}"; + left.Add(Segment(StatusRole.Moo, Dim(MooStatusText(mooStatus)))); } - var room = HeaderWidth() - MarkupWidth(left) - MarkupWidth(rightBar) - MinStatusGap; + var room = HeaderWidth() - W(left) - W(right) - MinStatusGap; foreach (var focusHint in mode == StatusMode.None ? FocusHints() : []) { - if (MarkupWidth(focusHint) + 3 <= room) + if (focusHint.Width + 3 <= room) { right.Insert(right.Count - 1, focusHint); - rightBar = string.Join(" ", right); break; } } - // Right-align the cluster to the far edge; identity stays pinned left. - var gap = Math.Max(MinStatusGap, HeaderWidth() - MarkupWidth(left) - MarkupWidth(rightBar)); - return $"{left}{new string(' ', gap)}{rightBar}"; + // Right-aligned to the far edge by the model (StatusModel.Row); identity stays pinned left. + return StatusRowModel(left, right); } /// diff --git a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs index 53ffb13a..3d078e9f 100644 --- a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs +++ b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs @@ -35,34 +35,44 @@ internal static class StatusMeterRenderer /// -cell field, for a status row too narrow for value/max; a meter with no /// usable maximum is drawn as its value either way. /// - internal static string Render(IReadOnlyList meters, GameDataStore data, string lowInk, bool compact = false) + internal static string Render(IReadOnlyList meters, GameDataStore data, string lowInk, bool compact = false) => + string.Concat(Runs(meters, data, lowInk, DimMark, compact).Select(r => + r.Ink == DimMark ? $"[dim]{MarkupText.Escape(r.Text)}[/]" + : r.Bold ? $"[bold{(r.Ink is null ? string.Empty : " " + r.Ink)}]{MarkupText.Escape(r.Text)}[/]" + : MarkupText.Escape(r.Text))); + + /// The ink hands to stand for the framework's [dim]. + private const string DimMark = "dim"; + + /// + /// The meters that have a value, as status-row runs, or none when none does: each label in + /// , the value bold (in when low), the maximum in + /// , two cells between meters. is the same runs as markup. + /// + internal static List Runs( + IReadOnlyList meters, GameDataStore data, string lowInk, string dimInk, bool compact = false) { - var cells = new List(); + var runs = new List(); foreach (var reading in Read(meters, data)) { - var label = MarkupText.Escape(reading.Label); - if (compact && reading.Share is { } share) + if (runs.Count > 0) { - var percent = Percent(share).PadLeft(ShareWidth); - cells.Add(reading.Low - ? $"[dim]{label}[/] [bold {lowInk}]{percent}[/]" - : $"[dim]{label}[/] [bold]{percent}[/]"); - continue; + runs.Add(new(" ", null, false)); } - var shown = MarkupText.Escape(StatusMeter.Fit(reading.Value, ValueWidth).PadLeft(ValueWidth)); - var cell = reading.Low - ? $"[dim]{label}[/] [bold {lowInk}]{shown}[/]" - : $"[dim]{label}[/] [bold]{shown}[/]"; - if (reading.HasMax) + var value = compact && reading.Share is { } share + ? Percent(share).PadLeft(ShareWidth) + : StatusMeter.Fit(reading.Value, ValueWidth).PadLeft(ValueWidth); + runs.Add(new(reading.Label, dimInk, false)); + runs.Add(new(" ", null, false)); + runs.Add(new(value, reading.Low ? lowInk : null, true)); + if (!(compact && reading.Share is not null) && reading.HasMax) { - cell += $"[dim]/{MarkupText.Escape(StatusMeter.Fit(reading.Max ?? string.Empty, ValueWidth).PadRight(ValueWidth))}[/]"; + runs.Add(new($"/{StatusMeter.Fit(reading.Max ?? string.Empty, ValueWidth).PadRight(ValueWidth)}", dimInk, false)); } - - cells.Add(cell); } - return string.Join(" ", cells); + return runs; } /// diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs index 6b6dc600..e71bf418 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs @@ -42,9 +42,14 @@ public async Task TheBundledFacesResolveByNameOnEveryPlatform() public async Task TheFooterDrawsWhatTheClientSaidAndHandsBackOnlyItsTargets() { var activated = new List(); - var model = StatusModel.From( - StatusModel.Mark([new("Corvid · connected", "#cccccc", false), new(" ", "#cccccc", false), new("⌃P palette", "#cccccc", false)], "⌃P palette", HeaderModel.PaletteTarget), - "#101014"); + var model = new StatusModel( + [new StatusSegment(StatusRole.Identity, [new("Corvid · connected", null, false)])], + [new StatusSegment(StatusRole.Palette, [new("⌃P palette", "#cccccc", false, HeaderModel.PaletteTarget)])], + "#101014", + "#cccccc") + { + Width = 80, + }; var (visible, top, height, hits, text, clicked) = await Run((window, layer, driver) => { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs index 9754aebc..febd2654 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NoticeToastTests.cs @@ -24,6 +24,34 @@ public class NoticeToastTests private static NoticeOverlay Overlay(long sequence, string text, NoticeAction? action, Action run, int aboveRow = 8) => new(new NoticeModel(text, NoticeSeverity.Info, "⌥M", action, DateTimeOffset.UnixEpoch, sequence), aboveRow, Palette, run); + /// + /// A toast is a native card: the tokens' card plane, not the status row's, with every severity's edge (which inks its + /// chip and action line) held to the text floor on that card, in each built-in theme. + /// + [Test] + public async Task AToastIsDrawnOnTheTokensCardWithItsEdgesHeldToTheFloor() + { + foreach (var theme in SharpMUTerm.Core.Theming.ThemeLibrary.Names.Select(SharpMUTerm.Core.Theming.ThemeLibrary.Get)) + { + var tokens = NativeTokens.For(theme); + foreach (var severity in Enum.GetValues()) + { + var overlay = new NoticeOverlay(new NoticeModel("x", severity, null, null, DateTimeOffset.UnixEpoch, 1), 8, Palette, _ => { }) + { + Theme = theme, + }; + var colours = NoticeToasts.ColoursOf(overlay); + await Assert.That(colours.Plane).IsEqualTo(tokens.Card).Because(theme.Name); + var ratio = SharpMUTerm.Core.Text.Contrast.Ratio( + new SharpMUTerm.Core.Text.Rgb(colours.Edge.R, colours.Edge.G, colours.Edge.B), + new SharpMUTerm.Core.Text.Rgb(colours.Plane.R, colours.Plane.G, colours.Plane.B)); + await Assert.That(ratio).IsGreaterThanOrEqualTo(NativeTokens.TextFloor - 0.01).Because($"{theme.Name} {severity}"); + } + } + + await Assert.That(NativeTokens.Dark.Card).IsEqualTo(global::Avalonia.Media.Color.FromRgb(0x17, 0x1b, 0x24)).Because("the mockup's card"); + } + /// A notice's source is a caption on the toast, not a key chip: a word in a chip reads as a key to press. [Test] public async Task ASourceIsACaptionAndAKeyIsAChip() diff --git a/tests/SharpMUTerm.Client.Tests/StatusModelTests.cs b/tests/SharpMUTerm.Client.Tests/StatusModelTests.cs index 4495fffd..242eebf5 100644 --- a/tests/SharpMUTerm.Client.Tests/StatusModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/StatusModelTests.cs @@ -2,50 +2,63 @@ namespace SharpMUTerm.Client.Tests; -/// The status row as data: two clusters split at the renderer's padding, and runs a click can hand back. +/// The status row as data: segments by role, laid out to the row's width, and runs a click can hand back. public class StatusModelTests { - private const string Ink = "#cccccc"; + private const string Dim = "#888888"; + + private static StatusSegment Seg(StatusRole role, params StatusRun[] runs) => new(role, runs); + + private static StatusModel Row(int width) => new( + [Seg(StatusRole.Identity, new("Corvid", null, true), new(" ", null, false), new("connected", Dim, false))], + [Seg(StatusRole.Encoding, new StatusRun("utf-8", Dim, false)), Seg(StatusRole.Palette, new StatusRun("⌃P palette", Dim, false, HeaderModel.PaletteTarget))], + "#101010", + "#e0e0e0") + { + Width = width, + }; [Test] - public async Task TheRowSplitsAtItsWidestGapAndDropsTheGap() + public async Task TheClustersReadWithASeparatorBetweenSegments() { - var model = StatusModel.From( - [new("Corvid · connected ⌥F freezes", Ink, false), new(" ", Ink, false), new("UTF-8 · ⌃P palette ", Ink, true)], - "#101010"); - - await Assert.That(model.Left.Select(r => r.Text)).IsEquivalentTo(new[] { "Corvid · connected ⌥F freezes" }); - await Assert.That(model.Right.Select(r => r.Text)).IsEquivalentTo(new[] { "UTF-8 · ⌃P palette" }); - await Assert.That(model.Right.Single().Bold).IsTrue(); - await Assert.That(model.Text).IsEqualTo("Corvid · connected ⌥F freezes UTF-8 · ⌃P palette"); + var model = Row(60); + await Assert.That(model.Text).IsEqualTo("Corvid connected utf-8 ⌃P palette"); + await Assert.That(model.Right.Select(r => r.Text)).IsEquivalentTo(new[] { "utf-8", StatusModel.Separator, "⌃P palette" }); + await Assert.That(StatusModel.WidthOf(model.RightSegments)).IsEqualTo(18); } [Test] - public async Task ARowWithNoWideGapReadsFromTheLeft() + public async Task TheRowPushesTheRightClusterToItsWidth() { - var model = StatusModel.From([new(" a notice, said once ", Ink, false)], "#000000"); - await Assert.That(model.Right).IsEmpty(); - await Assert.That(model.Text).IsEqualTo("a notice, said once"); + var row = Row(60).Row(); + await Assert.That(string.Concat(row.Select(r => r.Text)).Length).IsEqualTo(60); + await Assert.That(row[^1].Target).IsEqualTo(HeaderModel.PaletteTarget); + + // Narrower than both clusters: the gap is never less than its minimum. + var tight = string.Concat(Row(10).Row().Select(r => r.Text)); + await Assert.That(tight).Contains("connected" + new string(' ', StatusModel.MinGap) + "utf-8"); } [Test] - public async Task MarkSetsTheTargetOnTheLastOccurrenceAndSplitsRuns() + public async Task FitCutsTheRowEndingInTheInkItCutInto() { - var runs = StatusModel.Mark([new("⌥R Reconnect · ⌥R Reconnect", Ink, false)], "⌥R Reconnect", "world:reconnect"); - - await Assert.That(runs.Select(r => r.Text)).IsEquivalentTo(new[] { "⌥R Reconnect · ", "⌥R Reconnect" }); - await Assert.That(runs[1].Target).IsEqualTo("world:reconnect"); - await Assert.That(StatusModel.From(runs, "#000000").Targets()).IsEquivalentTo(new[] { "world:reconnect" }); + var fit = Row(60).Fit(12); + await Assert.That(string.Concat(fit.Select(r => r.Text))).IsEqualTo("Corvid conn…"); + await Assert.That(fit[^1].Ink).IsEqualTo(Dim); + await Assert.That(Row(60).Fit(60)).IsEquivalentTo(Row(60).Row()); + } - var unchanged = StatusModel.Mark(runs, "not there", "x"); - await Assert.That(unchanged).IsSameReferenceAs(runs); + [Test] + public async Task TargetsAreWhatTheClientPutOnRuns() + { + await Assert.That(Row(60).Targets()).IsEquivalentTo(new[] { HeaderModel.PaletteTarget }); } [Test] public async Task TwoRowsThatSayTheSameAreEqual() { - StatusModel Make() => StatusModel.From([new("left", Ink, false), new(" right", Ink, false)], "#000000"); - await Assert.That(Make()).IsEqualTo(Make()); - await Assert.That(Make()).IsNotEqualTo(StatusModel.Empty); + await Assert.That(Row(60)).IsEqualTo(Row(60)); + await Assert.That(Row(60)).IsNotEqualTo(Row(61)); + await Assert.That(Row(60)).IsNotEqualTo(StatusModel.Empty); } } diff --git a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs index e2cd000a..bf044ca1 100644 --- a/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/FooterFitTests.cs @@ -136,6 +136,48 @@ await Assert.That(scrolled.Any(r => r.Contains("password", StringComparison.Ordi await Assert.That(app.ImportReviewLines.Count).IsGreaterThan(0).Because("the review is still open: End scrolled, it did not answer"); } + [Test] + public async Task ThePackageReviewScrollsItsBodyUnderAPinnedFooterClearOfTheCommandLine() + { + var app = App(); + var rows = FrameGrid.Decode(app.RenderSnapshot("package-review"), Width, Height); + var keys = rows.ToList().FindIndex(r => r.Contains("⏎ install", StringComparison.Ordinal) && r.Contains("Esc cancel", StringComparison.Ordinal)); + var line = rows.ToList().FindIndex(r => r.Contains("say hello there", StringComparison.Ordinal)); + await Assert.That(keys).IsGreaterThan(0).Because(string.Join('\n', rows)); + await Assert.That(line).IsGreaterThan(keys + 1).Because("the review's bottom edge is above the command line, which stays in view"); + await Assert.That(rows[keys - 1].Contains('─')).IsTrue().Because("a rule marks the pinned rows as the review's foot"); + + app.PackageView.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.End, false, false, false)); + var scrolled = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); + await Assert.That(scrolled.Any(r => r.Contains("characters", StringComparison.Ordinal) && r.Contains("Corvid", StringComparison.Ordinal))).IsTrue() + .Because("End scrolls to the last row:\n" + string.Join('\n', scrolled)); + await Assert.That(scrolled[keys]).Contains("⏎ install").Because("the keys stay where they were"); + await Assert.That(app.PackageView.IsOpen).IsTrue().Because("End scrolled, it did not answer"); + } + + [Test] + public async Task TheCellPaletteShrinksToItsRowsWhenFilteredAndNeverPastTheCommandLine() + { + var app = App(); + app.RenderSnapshot("menu"); + var full = app.Palette.WindowHeight; + var fullRows = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); + await Assert.That(full).IsGreaterThan(CommandPalette.FilteredMinHeight); + + app.SimulateCellPaletteQuery("freeze"); + var filtered = app.Palette.WindowHeight; + var rows = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); + await Assert.That(filtered).IsLessThan(full).Because("a few matches: not the whole catalog's height:\n" + string.Join('\n', rows)); + await Assert.That(filtered).IsGreaterThanOrEqualTo(CommandPalette.FilteredMinHeight).Because("never below the floor"); + await Assert.That(rows.Any(r => r.Contains("Freeze", StringComparison.Ordinal))).IsTrue(); + await Assert.That(rows.ToList().FindIndex(r => r.Contains("›freeze", StringComparison.Ordinal))) + .IsEqualTo(fullRows.ToList().FindIndex(r => r.Contains('›', StringComparison.Ordinal))).Because("the prompt does not move"); + await Assert.That(rows.Any(r => r.Contains("say hello there", StringComparison.Ordinal))).IsTrue().Because("the command line stays clear"); + + app.SimulateCellPaletteQuery(string.Empty); + await Assert.That(app.Palette.WindowHeight).IsEqualTo(full).Because("an emptied query lists the whole catalog again"); + } + private static SharpMUTermApp App() { Console.SetIn(TextReader.Null); diff --git a/tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs b/tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs index b8918770..b87c76a1 100644 --- a/tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NoticeFitTests.cs @@ -1,4 +1,5 @@ using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Chrome; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Diagnostics; using SharpMUTerm.Graphics; @@ -44,9 +45,13 @@ public async Task ALongNoticeIsElidedToTheRowAndTheRowStaysOneRow(int width, int [Test] public async Task FitStatusRowLeavesARowThatFitsAlone() { - await Assert.That(SharpMUTermApp.FitStatusRow("[dim]short[/]", 80)).IsEqualTo("[dim]short[/]"); - await Assert.That(SharpMUTermApp.MarkupWidth(SharpMUTermApp.FitStatusRow("[dim]" + new string('x', 100) + "[/]", 80))) - .IsLessThanOrEqualTo(80); + static StatusModel Row(string text) => + new([new StatusSegment(StatusRole.Text, [new(text, "#808080", false)])], [], "#000000", "#ffffff") { Width = 80 }; + + await Assert.That(SharpMUTermApp.StatusRowMarkup(Row("short").Fit(80))).IsEqualTo("[#808080]short[/]"); + var cut = SharpMUTermApp.StatusRowMarkup(Row(new string('x', 100)).Fit(80)); + await Assert.That(SharpMUTermApp.MarkupWidth(cut)).IsEqualTo(80); + await Assert.That(cut).EndsWith("x…[/]").Because("the mark takes the ink of the run it cut into"); } [Test] From d04dd7cf79dcddee37ead29a05994feb53dce620 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 19:10:22 +0000 Subject: [PATCH 074/113] =?UTF-8?q?Wave=2021=20A:=20window=20seams=20?= =?UTF-8?q?=E2=80=94=20hairline=20pane=20dividers,=20prompt-hugging=20comm?= =?UTF-8?q?and=20line,=20UI-face=20placeholder,=20deterministic=20fonts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The client publishes its pane dividers (IPointerPresenter.Dividers, PaneDividerOverlay) with each frame; the window draws each divider cell as the two panes' planes meeting at the tokens' 1 px rule (lit: the cells' RuleHover, 3 px). Cells, hit area and NAWS unchanged. - The command line's typed text is drawn shifted left to start a mono space after the UI-face prompt (TerminalView.BarsOf); the caret moves with it and a press maps back to the cell under it. - The docked composer's "Click to write a post" is a UI-face overlay instead of the editor's mono placeholder. - BundledFonts makes its eight faces once per process and never disposes them, so the per-test font manager of the headless suite no longer remakes and disposes them every test. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 3 + CLAUDE.md | 15 +- .../AvaloniaConsoleDriver.cs | 5 + src/SharpMUTerm.Avalonia/BundledFonts.cs | 45 +++- src/SharpMUTerm.Avalonia/CellGrid.cs | 12 +- src/SharpMUTerm.Avalonia/ComposerView.cs | 39 ++- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 1 + src/SharpMUTerm.Avalonia/TerminalView.cs | 249 ++++++++++++++++-- src/SharpMUTerm.Avalonia/WindowPointer.cs | 10 + src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 17 ++ .../Pointer/SharpMUTermApp.Pointer.cs | 49 ++++ src/SharpMUTerm.Tui/SharpMUTermApp.cs | 6 +- .../WindowSeamTests.cs | 143 ++++++++++ tests/SharpMUTerm.Tui.Tests/PointerTests.cs | 41 +++ 14 files changed, 605 insertions(+), 30 deletions(-) create mode 100644 tests/SharpMUTerm.Avalonia.Tests/WindowSeamTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index bb53ddf8..f1226070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -386,6 +386,9 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- In the desktop window, the line between two panes is a hairline where the panes meet instead of a grey band, and + lights up wider while you hover or drag it. In the command line, what you type starts right after the prompt. + The docked composer's "Click to write a post" is in the interface font. - The command palette in the terminal shrinks to the rows a search matches instead of filling the screen with blank. - In the window, notices are drawn on the same card colour as the palette and dialogs, and body text is a size larger (13 px) across the window's own views. diff --git a/CLAUDE.md b/CLAUDE.md index 913f49d7..9565101c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1711,6 +1711,16 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw over its cells and the newline hint over blank cells. The grid gives up `FieldReserve` px, never a row, so panes and NAWS are a terminal's told the same chrome. Null under a modal. Rebuilding it on a `TextBox` would fork every key rule above. + - **The typed text meets the prompt by drawing, not by cells** (`TerminalView.BarsOf`, `FieldBar`). The Inter prompt is + narrower than its cells, so each bar's text is drawn `Shift` px left (to one mono space after the measured prompt), the + caret with it, and `Cell` maps a press there back to the cell under it; the right padding the shift uncovers is the + field's fill. The gutter, the caret's cell and every key are unchanged, so parity needs nothing. +- **The window draws pane dividers as the panes meeting at a hairline** (`IPointerPresenter.Dividers`, + `PaneDividerOverlay`, `DividersNow`; `ScreenFrame.Dividers`; `TerminalView.FrameDraw.DrawDividers`). The client publishes + each divider control's cells and whether it is lit (never a tab strip standing in for one, nothing under a modal) on + `PostBufferPaint`, `Flush` keeps them with the frame, and the window paints each half of the cell in the plane beside it + (read off the frame) with `NativeTokens.Rule` 1 px in the middle; lit, the cells' own `RuleHover`, 3 px. The cells, the + hit area and NAWS are the terminal's. - `HostParityTests` draws every view under `none`, `header-rail` and `desktop`. - **The window bundles its faces** (`BundledFonts`, Avalonia; `Fonts/README.md`). Inter 4.1 (four static weights, 1.67 MB) and JetBrains Mono are registered as `fonts:SharpMUTerm`, Inter is Avalonia's default family and the bare names map onto @@ -1718,7 +1728,10 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw bundle lacks (emoji, CJK, neither bundled). One token each: `NativeTokens.UiFont`/`MonoFont`/`CellFace`. The cells default to the bundled JetBrains Mono at 10 pt unless `--font` names an installed family; `--line-height` (default 1.12) adds leading by making the cell taller and centring the glyph, so a row is still one cell. No F7 face picker: the cell face is - a launch option of the window, read before the client exists, and not a declared setting. + a launch option of the window, read before the client exists, and not a declared setting. **The eight faces are made + once per process** and every `BundledFonts` adds the same `GlyphTypeface`s, re-implementing `IDisposable` as a no-op: + the headless suite sets up an app (and a font manager that disposes its collections) per test, and remaking and + disposing the faces per test is what made a test now and then fail to find Inter. - **A pane narrower than its server's wrap is told about join wraps, once per world per run** (`SuggestJoinWraps`, `SharpMUTermApp.JoinWraps.cs`; `WorldSession.ServerWrapColumn`, now learnt whether or not the world joins). Checked on every pane-size report; the notice's action is `world:join-wraps:`. **Suggested, never on by default**: a false diff --git a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs index f57af288..45f4637e 100644 --- a/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs +++ b/src/SharpMUTerm.Avalonia/AvaloniaConsoleDriver.cs @@ -124,6 +124,11 @@ public void Flush() frame = frame.WithBand(band); } + if (Pointer.Dividers is { Count: > 0 } dividers) + { + frame = frame.WithDividers(dividers); + } + Volatile.Write(ref _frame, frame); Interlocked.Increment(ref _frames); FrameReady?.Invoke(); diff --git a/src/SharpMUTerm.Avalonia/BundledFonts.cs b/src/SharpMUTerm.Avalonia/BundledFonts.cs index a5c204e0..e3a59c38 100644 --- a/src/SharpMUTerm.Avalonia/BundledFonts.cs +++ b/src/SharpMUTerm.Avalonia/BundledFonts.cs @@ -15,8 +15,18 @@ namespace SharpMUTerm.Avalonia; /// "JetBrains Mono" or "Inter" gets the bundled face and an installed copy cannot replace it. /// /// -internal sealed class BundledFonts : FontCollectionBase +/// +/// The faces are made once per process and shared by every collection. A font manager disposes its collections, +/// and the base collection disposes every face it holds; the headless tests set up a fresh application, and so a fresh +/// font manager and collection, for every test, so the faces were read, made and disposed once per test, hundreds of +/// times a run, and now and then one test failed to find Inter. Shared and never disposed, the eight faces are made +/// once; the window has one font manager, so nothing changes there. +/// +internal sealed class BundledFonts : FontCollectionBase, IDisposable { + private static readonly object Gate = new(); + private static GlyphTypeface[]? s_faces; + /// The collection's key: families in it are named fonts:SharpMUTerm#Inter. public static readonly Uri CollectionKey = new("fonts:SharpMUTerm"); @@ -40,16 +50,43 @@ internal sealed class BundledFonts : FontCollectionBase public BundledFonts() { - foreach (var file in Files) + GlyphTypeface[] shared; + lock (Gate) { - using var stream = typeof(BundledFonts).Assembly.GetManifestResourceStream($"Fonts.{file}"); - if (stream is not null && TryAddGlyphTypeface(stream, out _)) + if (s_faces is null) + { + var faces = new List(); + foreach (var file in Files) + { + using var stream = typeof(BundledFonts).Assembly.GetManifestResourceStream($"Fonts.{file}"); + if (stream is not null && TryAddGlyphTypeface(stream, out var face)) + { + faces.Add(face); + } + } + + s_faces = [.. faces]; + Loaded = s_faces.Length; + return; + } + + shared = s_faces; + } + + foreach (var face in shared) + { + if (TryAddGlyphTypeface(face)) { Loaded++; } } } + /// The shared faces outlive any one font manager, so a manager disposing this collection disposes none of them. + void IDisposable.Dispose() + { + } + /// /// Inter as the default family (what resolves to, so every view that names none /// is Inter), and the bare names mapped onto the bundle. diff --git a/src/SharpMUTerm.Avalonia/CellGrid.cs b/src/SharpMUTerm.Avalonia/CellGrid.cs index ef90d5b3..082574cf 100644 --- a/src/SharpMUTerm.Avalonia/CellGrid.cs +++ b/src/SharpMUTerm.Avalonia/CellGrid.cs @@ -39,10 +39,20 @@ internal sealed class ScreenFrame(int width, int height, GridCell[] cells, Caret /// public SharpMUTerm.Tui.InputBand? Band { get; init; } + /// + /// The pane dividers as the client said they were when this frame was painted: the window draws their cells as the + /// two panes' planes meeting at a hairline rather than as a band of the rule's colour. + /// + public IReadOnlyList Dividers { get; init; } = []; + public GridCell this[int x, int y] => cells[(y * Width) + x]; /// This frame carrying : the same cells, not copied. - public ScreenFrame WithBand(SharpMUTerm.Tui.InputBand band) => new(Width, Height, cells, Caret) { Band = band }; + public ScreenFrame WithBand(SharpMUTerm.Tui.InputBand band) => new(Width, Height, cells, Caret) { Band = band, Dividers = Dividers }; + + /// This frame carrying : the same cells, not copied. + public ScreenFrame WithDividers(IReadOnlyList dividers) => + new(Width, Height, cells, Caret) { Band = Band, Dividers = dividers }; public static ScreenFrame Empty(int width, int height) => new(width, height, Enumerable.Repeat(GridCell.Blank, width * height).ToArray(), default); diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 2f6e2fa6..658b0e21 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -40,6 +40,14 @@ internal sealed class ComposerView : Border private readonly LineGutter _gutter; private readonly Border _header; private readonly TextBlock _title; + + /// + /// "Click to write a post", in the UI face over the empty idle editor. The editor's own placeholder would be in the + /// editor's face, the post's monospace; a hint is the panel speaking, not the post. Never hit: a click goes to the editor. + /// + private readonly TextBlock _placeholder; + + private bool _placeholderWanted; private readonly TextBlock _target; private readonly StackPanel _chips; private readonly TextBlock _count; @@ -137,8 +145,18 @@ public ComposerView(TerminalView view, bool fullScreen) // The armed rule down the docked editor's left edge: the cell composer's ▌ marker, in the accent. _rule = new Border { Width = 3, HorizontalAlignment = HorizontalAlignment.Left }; + _placeholder = new TextBlock + { + Text = ComposerModel.ClickToWrite, + FontFamily = NativeTokens.UiFont, + IsHitTestVisible = false, + IsVisible = false, + Margin = _editor.Padding + new Thickness(1), + }; + var text = new Panel(); text.Children.Add(_editor); + text.Children.Add(_placeholder); text.Children.Add(_marks); text.Children.Add(_rule); @@ -516,8 +534,7 @@ private void Label(ComposerModel model) // A docked composer too short for its footer keeps the editor and drops the footer: the heading, the footer // and an editor of two lines need about 136 px, and below that the footer would squeeze the well shut. _footer.IsVisible = Bounds.Height is 0 or >= 136; - _editor.PlaceholderText = !model.Armed ? ComposerModel.ClickToWrite : null; - _editor.PlaceholderForeground = new SolidColorBrush(Dim); + ShowPlaceholder(!model.Armed); return; } @@ -550,10 +567,23 @@ private void Label(ComposerModel model) // A docked composer too short for its key row keeps the editor and drops the row. _footer.IsVisible = _fullScreen || Bounds.Height is 0 or >= 64; - _editor.PlaceholderText = placeholder ? ComposerModel.ClickToWrite : null; - _editor.PlaceholderForeground = new SolidColorBrush(Dim); + ShowPlaceholder(placeholder); + } + + /// The UI-face placeholder (): wanted while idle, shown while the editor is empty. + private void ShowPlaceholder(bool wanted) + { + _placeholderWanted = wanted; + _placeholder.Foreground = new SolidColorBrush(Dim); + _placeholder.FontSize = Math.Max(NativeTokens.Body, _editor.FontSize - 1); + SyncPlaceholder(); } + private void SyncPlaceholder() => _placeholder.IsVisible = _placeholderWanted && string.IsNullOrEmpty(_editor.Text); + + /// What the idle editor says while empty, or null. Internal for tests. + internal string? Placeholder => _placeholder.IsVisible ? _placeholder.Text : null; + private Border Chip(string words, Color ink, double size) => new() { Background = new SolidColorBrush(Mix(_plane, ink, 0.14)), @@ -638,6 +668,7 @@ private void SyncLength() private void OnTextChanged() { SyncLength(); + SyncPlaceholder(); var text = _editor.Text ?? string.Empty; if (_session is { } session) { diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index c961f349..d8a256f2 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -208,6 +208,7 @@ private void SyncPaneChrome(Size cell) } tokens = _paneTokens.Value.Tokens; + _view.DividerRule = new SKColor(tokens.Rule.R, tokens.Rule.G, tokens.Rule.B); } var origin = CellOrigin; diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index da69a47d..58c40aa8 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -129,6 +129,12 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba /// The plane the field's strip is painted on: the backdrop the status row and the sidebar sit on. internal SKColor? FooterPlane { get; set; } + /// + /// The hairline a pane divider is drawn as (): the native tokens' rule, set with the + /// pane chrome. Null until then, when it is a faint step off the cells' background. + /// + internal SKColor? DividerRule { get; set; } + /// The vertical pixels the field takes beside the rows it frames: none unless the view draws it. private double FieldReserve => DrawsInputField ? NativeLayout.FieldReserve : 0; @@ -180,16 +186,83 @@ public override void Render(DrawingContext context) { var frame = _driver.Frame; var band = DrawsInputField ? frame.Band : null; - context.Custom(new FrameDraw(new Rect(Bounds.Size), frame, _driver.Pictures, _renderer, _scale, band, FooterPlane ?? Darker(_renderer.DefaultBackground))); + IReadOnlyList bars = band is null ? [] : BarsOf(frame, band); + _fieldBars = bars; + var rule = DividerRule ?? Mix(_renderer.DefaultBackground, _renderer.DefaultForeground, 0.12f); + context.Custom(new FrameDraw( + new Rect(Bounds.Size), frame, _driver.Pictures, _renderer, _scale, band, FooterPlane ?? Darker(_renderer.DefaultBackground), bars, rule)); if (band is not null) { - DrawFieldText(context, frame, band); + DrawFieldText(context, frame, band, bars); } DrawHover(context); DrawScrollbars(context); } + /// + /// One command line inside the field: its screen rows, the column its typed text starts at (past the prompt's cells), + /// and how far that text is drawn to the left (, logical units) so it starts a mono space after + /// the prompt drawn in the UI face, which is narrower than the cells it covers. The cells do not move: only the drawing, + /// the caret drawn with it, and the pointer's mapping back to a cell () are shifted. + /// + internal readonly record struct FieldBar(int Top, int End, int TextStart, double PromptWidth, double Shift); + + /// The bars as last drawn, for mapping the pointer: the same shifts the paint used. + private IReadOnlyList _fieldBars = []; + + private (string Text, double Width) _promptMeasure = ("", 0); + + /// The prompt's width in the UI face it is drawn in, in logical units; the last one is remembered. + private double PromptWidth(string text) + { + if (_promptMeasure.Text == text) + { + return _promptMeasure.Width; + } + + var width = PromptText(text, SKColors.White, double.PositiveInfinity).WidthIncludingTrailingWhitespace; + _promptMeasure = (text, width); + return width; + } + + private static FormattedText PromptText(string text, SKColor ink, double maxWidth) => + new(text, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, + new Typeface(NativeTokens.UiFont, FontStyle.Normal, FontWeight.SemiBold), NativeTokens.Input, Brush(ink)) + { + MaxTextWidth = maxWidth, + MaxLineCount = 1, + Trimming = TextTrimming.CharacterEllipsis, + }; + + /// + /// Each bar in : from its prompt's row to the next prompt's (or the band's end), its text a + /// mono space after the prompt as the UI face draws it. Internal for tests. + /// + internal IReadOnlyList BarsOf(ScreenFrame frame, InputBand band) + { + var cell = CellSize; + var end = Math.Min(frame.Height, band.Top + band.Rows); + var prompts = band.Prompts.Where(p => p.Row >= band.Top && p.Row < end).OrderBy(p => p.Row).ToList(); + var bars = new List(prompts.Count); + for (var i = 0; i < prompts.Count; i++) + { + var prompt = prompts[i]; + var to = i + 1 < prompts.Count ? prompts[i + 1].Row : end; + var start = Math.Min(frame.Width, band.Pad + prompt.Text.Length); + var trimmed = prompt.Text.TrimEnd(); + var width = trimmed.Length == 0 ? 0 : PromptWidth(trimmed); + var room = (start - band.Pad) * cell.Width; + var shift = trimmed.Length == 0 ? 0 : Math.Max(0, room - width - cell.Width); + + // Whole device pixels, so the glyphs land on the pixel grid the unshifted ones would. + shift = Math.Round(shift * _scale) / _scale; + bars.Add(new FieldBar(prompt.Row, to, start, width, shift)); + } + + return bars; + } + /// /// A faint plate under whatever a click acts on — a link, a tab, a sidebar row — so it reads as a control /// before it is clicked. Drawn over the cells, never in them, so the frame is the terminal's frame. @@ -745,6 +818,15 @@ private System.Drawing.Point Cell(Point position) { var inside = (position.Y - (band.Top * size.Height) - NativeLayout.FieldTop) / size.Height; y = Math.Clamp(band.Top + (int)Math.Floor(inside), band.Top, Math.Min(frame.Height, band.Top + band.Rows) - 1); + + // The typed text is drawn shifted left to meet the prompt; a press on it is a press on the cell drawn there. + foreach (var bar in _fieldBars) + { + if (y >= bar.Top && y < bar.End && bar.Shift > 0 && position.X >= (bar.TextStart * size.Width) - bar.Shift) + { + x = Math.Clamp((int)((position.X + bar.Shift) / size.Width), Math.Min(bar.TextStart, frame.Width - 1), Math.Max(0, frame.Width - 1)); + } + } } return new System.Drawing.Point(x, y); @@ -756,7 +838,9 @@ private static PointerModifiers Modifiers(KeyModifiers keys) => | ((keys & KeyModifiers.Control) != 0 ? PointerModifiers.Ctrl : 0); /// One frame, drawn straight onto the compositor's Skia canvas. - private sealed class FrameDraw(Rect bounds, ScreenFrame frame, PictureStore pictures, CellRenderer renderer, double scale, InputBand? band, SKColor plane) + private sealed class FrameDraw( + Rect bounds, ScreenFrame frame, PictureStore pictures, CellRenderer renderer, double scale, InputBand? band, SKColor plane, + IReadOnlyList bars, SKColor rule) : ICustomDrawOperation { public Rect Bounds { get; } = bounds; @@ -764,7 +848,12 @@ private sealed class FrameDraw(Rect bounds, ScreenFrame frame, PictureStore pict public bool HitTest(Point p) => Bounds.Contains(p); public bool Equals(ICustomDrawOperation? other) => - other is FrameDraw draw && ReferenceEquals(draw.Frame, Frame) && draw.Bounds == Bounds && draw.Plane == Plane; + other is FrameDraw draw && ReferenceEquals(draw.Frame, Frame) && draw.Bounds == Bounds && draw.Plane == Plane + && draw.Rule == Rule && draw.Bars.SequenceEqual(Bars); + + private SKColor Rule => rule; + + private IReadOnlyList Bars => bars; private SKColor Plane => plane; @@ -791,9 +880,110 @@ public void Render(ImmediateDrawingContext context) RenderWithField(canvas, band); } + DrawDividers(canvas); canvas.Restore(); } + /// + /// Each pane divider's cells as the two panes' planes meeting, read off the cells beside it, with the tokens' + /// hairline centred where they meet; a lit divider (hovered or dragged) keeps the cells' own hover colour, wider. + /// The cells themselves, and so the divider's hit area, are the client's as in any host. Device pixels. + /// + private void DrawDividers(SKCanvas canvas) + { + var dividers = frame.Dividers; + if (dividers.Count == 0) + { + return; + } + + var cw = renderer.Fonts.CellWidth; + var ch = renderer.Fonts.CellHeight; + var s = (float)scale; + var hair = Math.Max(1f, MathF.Round(s)); + var wide = Math.Max(2f, MathF.Round(3 * s)); + using var paint = new SKPaint { IsAntialias = false, Style = SKPaintStyle.Fill }; + foreach (var divider in dividers) + { + var x0 = Math.Max(0, divider.Area.X); + var y0 = Math.Max(0, divider.Area.Y); + var x1 = Math.Min(frame.Width, divider.Area.X + divider.Area.Width); + var y1 = Math.Min(frame.Height, divider.Area.Y + divider.Area.Height); + if (band is { } field) + { + y1 = Math.Min(y1, field.Top); + } + + if (x1 <= x0 || y1 <= y0) + { + continue; + } + + var w = divider.Lit ? wide : hair; + var colour = divider.Lit ? renderer.Background(frame[x0, y0]) : rule; + if (divider.Vertical) + { + float left = x0 * cw, right = x1 * cw; + var at = MathF.Round(left + ((right - left - w) / 2)); + for (var y = y0; y < y1; y++) + { + paint.Color = PlaneBeside(x0 - 1, y, -1, 0); + canvas.DrawRect(left, y * ch, at - left, ch, paint); + paint.Color = PlaneBeside(x1, y, 1, 0); + canvas.DrawRect(at + w, y * ch, right - at - w, ch, paint); + } + + paint.Color = colour; + canvas.DrawRect(at, y0 * ch, w, (y1 - y0) * ch, paint); + } + else + { + float top = y0 * ch, bottom = y1 * ch; + var at = MathF.Round(top + ((bottom - top - w) / 2)); + for (var x = x0; x < x1; x++) + { + paint.Color = PlaneBeside(x, y0 - 1, 0, -1); + canvas.DrawRect(x * cw, top, cw, at - top, paint); + paint.Color = PlaneBeside(x, y1, 0, 1); + canvas.DrawRect(x * cw, at + w, cw, bottom - at - w, paint); + } + + paint.Color = colour; + canvas.DrawRect(x0 * cw, at, (x1 - x0) * cw, w, paint); + } + } + } + + /// + /// The plane of the pane beside a divider at (, ), stepping along another + /// divider that crosses there (along it, not across it) so a junction takes a pane's plane, not a rule's. + /// + private SKColor PlaneBeside(int x, int y, int dx, int dy) + { + for (var step = 0; step < 4; step++) + { + x = Math.Clamp(x, 0, frame.Width - 1); + y = Math.Clamp(y, 0, frame.Height - 1); + var cx = x; + var cy = y; + if (!frame.Dividers.Any(d => cx >= d.Area.X && cx < d.Area.X + d.Area.Width && cy >= d.Area.Y && cy < d.Area.Y + d.Area.Height)) + { + break; + } + + if (dx != 0) + { + y = y > 0 ? y - 1 : y + 1; + } + else + { + x = x > 0 ? x - 1 : x + 1; + } + } + + return renderer.Background(frame[Math.Clamp(x, 0, frame.Width - 1), Math.Clamp(y, 0, frame.Height - 1)]); + } + /// /// The panes as they are, then the field: the strip across the bottom on the backdrop, the rounded field in the /// bars' own band colour (read off the cells, so armed, idle and a character's tint are the cells' own), the @@ -831,8 +1021,34 @@ private void RenderWithField(SKCanvas canvas, InputBand band) canvas.Translate(0, (float)(NativeLayout.FieldTop * scale)); // The bars' rows only, and not the client's right padding, whose colour is the margin's rather than the band's. - canvas.ClipRect(new SKRect(0, top, (frame.Width - band.Pad) * cw, (band.Top + band.Rows) * ch)); - renderer.Render(canvas, frame, pictures); + var textRight = (frame.Width - band.Pad) * cw; + if (bars.Count == 0) + { + canvas.ClipRect(new SKRect(0, top, textRight, (band.Top + band.Rows) * ch)); + renderer.Render(canvas, frame, pictures); + } + else + { + // Each bar in two parts: the prompt's cells as they are (the UI-face prompt is drawn over them), then the + // typed text drawn its shift to the left, to start a mono space after the prompt. + foreach (var bar in bars) + { + var shift = (float)(bar.Shift * scale); + var meet = (bar.TextStart * cw) - shift; + canvas.Save(); + canvas.ClipRect(new SKRect(0, bar.Top * ch, meet, bar.End * ch)); + renderer.Render(canvas, frame, pictures); + canvas.Restore(); + + canvas.Save(); + // Short of the right padding by the shift, so what comes in from the right is the field's fill. + canvas.ClipRect(new SKRect(meet, bar.Top * ch, textRight - shift, bar.End * ch)); + canvas.Translate(-shift, 0); + renderer.Render(canvas, frame, pictures); + canvas.Restore(); + } + } + canvas.Restore(); paint.Style = SKPaintStyle.Stroke; @@ -864,7 +1080,7 @@ internal static SKRect FieldRect(InputBand band, int cw, int ch, int columns, fl /// The prompt in the UI face, semibold, over the prompt's own cells; and the newline hint at the right of the first /// row while the cells under it are blank — it stands down the moment the typed text reaches it. /// - private void DrawFieldText(DrawingContext context, ScreenFrame frame, InputBand band) + private void DrawFieldText(DrawingContext context, ScreenFrame frame, InputBand band, IReadOnlyList bars) { var cell = CellSize; foreach (var prompt in band.Prompts) @@ -877,18 +1093,15 @@ private void DrawFieldText(DrawingContext context, ScreenFrame frame, InputBand var first = frame[band.Pad, prompt.Row]; var ink = Ink(frame, band.Pad, prompt.Row, text.Length); - var plate = new Rect(band.Pad * cell.Width, RowTop(prompt.Row), Math.Min(text.Length, frame.Width - band.Pad) * cell.Width, cell.Height); + // The plate hides the prompt's mono cells up to where the shifted text begins (BarsOf), never over that text. + var cells = Math.Min(text.Length, frame.Width - band.Pad) * cell.Width; + var room = Math.Min(prompt.Text.Length, frame.Width - band.Pad) * cell.Width; + var shift = bars.FirstOrDefault(b => b.Top == prompt.Row).Shift; + var plate = new Rect(band.Pad * cell.Width, RowTop(prompt.Row), Math.Max(0, room - shift), cell.Height); context.FillRectangle(Brush(_renderer.Background(first.Background)), plate); - var formatted = new FormattedText( - text, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, - new Typeface(NativeTokens.UiFont, FontStyle.Normal, FontWeight.SemiBold), NativeTokens.Input, Brush(ink)) - { - MaxTextWidth = plate.Width + (2 * cell.Width), - MaxLineCount = 1, - Trimming = TextTrimming.CharacterEllipsis, - }; - // At the field's inner padding, as the mockup sets it: the UI face is narrower than the cells it covers, and - // what it leaves over reads as the space before the line being typed rather than a hole in front of the prompt. + var formatted = PromptText(text, ink, cells + (2 * cell.Width)); + + // At the field's inner padding, as the mockup sets it, and the typed text a mono space after it (BarsOf). context.DrawText(formatted, new Point(Math.Round(plate.X), plate.Y + ((cell.Height - formatted.Height) / 2))); } diff --git a/src/SharpMUTerm.Avalonia/WindowPointer.cs b/src/SharpMUTerm.Avalonia/WindowPointer.cs index d0897341..7b36cc14 100644 --- a/src/SharpMUTerm.Avalonia/WindowPointer.cs +++ b/src/SharpMUTerm.Avalonia/WindowPointer.cs @@ -156,6 +156,16 @@ void IPointerPresenter.Status(StatusOverlay status) void IPointerPresenter.InputBand(InputBand? band) => Volatile.Write(ref _band, band); + private IReadOnlyList _dividers = []; + + /// + /// The pane dividers as of the client's last word: read by the driver when it flushes a frame, so each frame carries + /// the dividers it was painted with (). + /// + public IReadOnlyList Dividers => Volatile.Read(ref _dividers); + + void IPointerPresenter.Dividers(IReadOnlyList dividers) => Volatile.Write(ref _dividers, dividers); + void IPointerPresenter.Notice(NoticeOverlay notice) { var next = Notices.Append(notice).TakeLast(NoticesKept).ToList(); diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 680ca6b7..6a9c1b9b 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -202,8 +202,25 @@ void Status(StatusOverlay status) void InputBand(InputBand? band) { } + + /// + /// The pane dividers on screen, where they are and whether one is lit, or an empty list while another of the client's + /// windows or a cell modal is in front of the panes. Said on the client's thread while the main window paints, before + /// the frame it describes is flushed, so a host may keep it with that frame and draw those cells its own way (the + /// window: the two panes' planes meeting at a hairline). The cells are drawn as in any host; a host that draws them as + /// cells ignores this (the default). + /// + void Dividers(IReadOnlyList dividers) + { + } } +/// One pane divider, for a host that draws it rather than its cells. +/// Its cells, in desktop cells: one column between panes side by side, one row between stacked ones. +/// Whether it is a column (the panes are side by side). +/// Whether it is under the pointer or being dragged: its cells are then WorkspacePalette.RuleHover. +internal sealed record PaneDividerOverlay(PaneRect Area, bool Vertical, bool Lit); + /// /// One panel on screen, for a host that draws it natively over its pane rather than in cells: where it is and what /// it shows. The cells under it are drawn as in any host, so a host that draws nothing loses nothing, and the diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index 0e725c29..0fe54d42 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -160,6 +160,55 @@ private List HeaderDividerCells() => private void PublishHeaderDividers() => Volatile.Write(ref _headerDividerSlots, _dividers.Where(slot => slot.HeaderPaneId is not null).ToArray()); + private IReadOnlyList _dividersSaid = []; + + /// + /// Tells the host where the drawn dividers are (), on every paint of the main + /// window, before the frame is flushed; said only on change. + /// + private void PublishDividers() + { + if (_pointer is null || _window is null) + { + return; + } + + var now = DividersNow(); + if (now.SequenceEqual(_dividersSaid)) + { + return; + } + + _dividersSaid = now; + _pointer.Dividers(now); + } + + /// + /// The dividers drawn as cells (a tab strip standing in for one is the host's strip, not a divider), or none while + /// anything is drawn over the panes. Internal for tests. + /// + internal IReadOnlyList DividersNow() + { + if (!MainWindowInFront() || AnyOverlayOpen) + { + return []; + } + + var list = new List(); + foreach (var slot in _dividers) + { + if (slot.Control is null || AreaOf(slot) is not { Width: > 0, Height: > 0 } area) + { + continue; + } + + var lit = _litDivider is { } key && key.Equals(new DividerKey(slot.Split, slot.Index)); + list.Add(new PaneDividerOverlay(area, slot.Split.Direction == SplitDirection.Row, lit)); + } + + return list; + } + /// Where a divider's handle is, in desktop cells: its control's cells, or the empty run of a tab strip. private PaneRect? AreaOf(DividerSlot slot) => slot.Control is { } control ? BoundsOf(control) : slot.HeaderPaneId is { } paneId ? HeaderFill(paneId) : null; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 66d52564..23c9f1e8 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1043,6 +1043,7 @@ public SharpMUTermApp( PublishFloating(); PublishChrome(); PublishInputBand(); + PublishDividers(); PublishStatus(); SyncMapSizes(); SyncPanelSizes(); @@ -1058,6 +1059,7 @@ public SharpMUTermApp( { PublishPanels(); PublishInputBand(); + PublishDividers(); PublishPaneChrome(); }; if (_sixel is not null) @@ -1069,8 +1071,8 @@ public SharpMUTermApp( } // The native chrome stands down while another window is in front, and that window repaints, not this one. - _window.Activated += (_, _) => { PublishChrome(); PublishInputBand(); PublishStatus(); }; - _window.Deactivated += (_, _) => { PublishChrome(); PublishInputBand(); PublishStatus(); }; + _window.Activated += (_, _) => { PublishChrome(); PublishInputBand(); PublishDividers(); PublishStatus(); }; + _window.Deactivated += (_, _) => { PublishChrome(); PublishInputBand(); PublishDividers(); PublishStatus(); }; // Pane drag-and-drop listens at the driver, not at a control: SharpConsoleUI delivers mouse // frames to the control that was pressed (it captures on Button1Pressed), so a control-level diff --git a/tests/SharpMUTerm.Avalonia.Tests/WindowSeamTests.cs b/tests/SharpMUTerm.Avalonia.Tests/WindowSeamTests.cs new file mode 100644 index 00000000..5b36c707 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/WindowSeamTests.cs @@ -0,0 +1,143 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Media; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; +using SkiaSharp; +using CellColour = SharpConsoleUI.Color; +using Window = Avalonia.Controls.Window; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// Where the window's drawing meets the cells: a pane divider is drawn as the two panes' planes meeting at the tokens' +/// hairline (lit, the cells' own hover colour, wider); the typed text in the command line starts a mono space after the +/// UI-face prompt and a press there is a press on the cell drawn under it; and the bundled faces are made once, so a font +/// manager disposing its collection cannot take a face from under the next. +/// +public class WindowSeamTests +{ + private const int Columns = 40; + private const int Rows = 10; + + private static readonly SKColor Back = new(0x10, 0x13, 0x1a); + private static readonly CellColour Left = new(0x20, 0x30, 0x40); + private static readonly CellColour Right = new(0x40, 0x30, 0x20); + private static readonly CellColour RuleCells = new(0x80, 0x80, 0x80); + private static readonly SKColor Hairline = new(0x2c, 0x34, 0x47); + + [Test] + [Arguments(false)] + [Arguments(true)] + public async Task ADividerIsThePanesMeetingAtAHairline(bool lit) + { + var (left, right, centre, edge) = await Run((window, view, driver) => + { + driver.FillCells(0, 0, 19, ' ', CellColour.Default, Left); + driver.FillCells(19, 0, 1, ' ', CellColour.Default, RuleCells); + driver.FillCells(20, 0, 20, ' ', CellColour.Default, Right); + ((IPointerPresenter)driver.Pointer).Dividers([new PaneDividerOverlay(new PaneRect(19, 0, 1, 1), Vertical: true, lit)]); + driver.Flush(); + Drain(); + using var frame = window.CaptureRenderedFrame()!; + var cw = (double)view.Renderer.Fonts.CellWidth; + var ch = (double)view.Renderer.Fonts.CellHeight; + var x = 19 * cw; + var middle = Math.Round(x + ((cw - (lit ? 3 : 1)) / 2)); + return (Pixel(frame, x + 0.5, ch / 2), Pixel(frame, x + cw - 0.5, ch / 2), Pixel(frame, middle, ch / 2), Pixel(frame, middle + (lit ? 2 : 0), ch / 2)); + }); + + await Assert.That(left).IsEqualTo(Color.FromRgb(Left.R, Left.G, Left.B)).Because("the left pane's plane runs up to the rule"); + await Assert.That(right).IsEqualTo(Color.FromRgb(Right.R, Right.G, Right.B)).Because("and the right pane's from it"); + var expected = lit ? Color.FromRgb(RuleCells.R, RuleCells.G, RuleCells.B) : Color.FromRgb(Hairline.Red, Hairline.Green, Hairline.Blue); + await Assert.That(centre).IsEqualTo(expected).Because(lit ? "a lit divider keeps the cells' hover colour" : "the tokens' hairline"); + await Assert.That(edge).IsEqualTo(expected).Because(lit ? "three pixels wide, so it reads as a handle" : "one pixel"); + } + + [Test] + public async Task TheTypedTextStartsAMonoSpaceAfterThePromptAndAPressThereIsItsCell() + { + const string prompt = "Corvid · Aetherfall › "; + var (bar, cellWidth, pressed) = await Run((window, view, driver) => + { + var band = new InputBand(Rows - 1, 1, InputLayout.HostFieldPad, [new InputPrompt(Rows - 1, prompt)], ""); + ((IPointerPresenter)driver.Pointer).InputBand(band); + driver.Flush(); + Drain(); + using (window.CaptureRenderedFrame()) + { + } + + var bars = view.BarsOf(driver.Frame, band); + var seen = new List(); + driver.MouseEvent += (_, _, c) => seen.Add(c); + var scale = view.Renderer.Fonts.CellWidth / view.SizeFor(1, 1).Width; + var cw = view.Renderer.Fonts.CellWidth / scale; + var ch = view.Renderer.Fonts.CellHeight / scale; + var bar = bars.Single(); + var at = new Point((bar.TextStart * cw) - bar.Shift + (cw / 2), ((Rows - 1) * ch) + NativeLayout.FieldTop + (ch / 2)); + window.MouseDown(at, global::Avalonia.Input.MouseButton.Left); + window.MouseUp(at, global::Avalonia.Input.MouseButton.Left); + return (bar, view.Renderer.Fonts.CellWidth, seen.FirstOrDefault()); + }, field: true); + + await Assert.That(bar.TextStart).IsEqualTo(InputLayout.HostFieldPad + prompt.Length); + await Assert.That(bar.Shift).IsGreaterThan(cellWidth).Because("the UI face is narrower than the cells under it"); + var gap = ((bar.TextStart - InputLayout.HostFieldPad) * (double)cellWidth) - bar.Shift - bar.PromptWidth; + await Assert.That(gap).IsBetween(cellWidth - 1.0, cellWidth + 1.0).Because("a mono space between the prompt and the text"); + await Assert.That(pressed).IsEqualTo(new System.Drawing.Point(bar.TextStart, Rows - 1)).Because("a press on the first typed character is its cell"); + } + + [Test] + public async Task TheBundledFacesAreMadeOnceAndOutliveAManagerDisposingThem() + { + var (first, second, glyph) = await TerminalViewTests.Session.Dispatch(() => + { + var a = new BundledFonts(); + a.TryGetGlyphTypeface("Inter", FontStyle.Normal, FontWeight.Normal, FontStretch.Normal, out var one); + ((IDisposable)a).Dispose(); + var b = new BundledFonts(); + b.TryGetGlyphTypeface("Inter", FontStyle.Normal, FontWeight.Normal, FontStretch.Normal, out var two); + two!.CharacterToGlyphMap.TryGetGlyph('A', out var index); + return (one, two, index); + }, CancellationToken.None); + + await Assert.That(ReferenceEquals(first, second)).IsTrue().Because("one face per process, shared by every collection"); + await Assert.That((int)glyph).IsGreaterThan(0).Because("and still usable after a collection holding it was disposed"); + } + + private static void Drain() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); + + private static Task Run(Func body, bool field = false) => + TerminalViewTests.Session.Dispatch(() => + { + var driver = new AvaloniaConsoleDriver(Columns, Rows); + var view = new TerminalView(driver, SKColors.White, Back, 16, null) { DividerRule = Hairline, DrawsInputField = field }; + var window = new Window { Content = view }; + var size = view.SizeFor(Columns, Rows); + window.Width = size.Width; + window.Height = size.Height; + window.Show(); + try + { + return body(window, view, driver); + } + finally + { + window.Close(); + driver.Dispose(); + } + }, CancellationToken.None); + + private static Color Pixel(global::Avalonia.Media.Imaging.WriteableBitmap bitmap, double x, double y) + { + using var buffer = bitmap.Lock(); + var bytes = new byte[buffer.RowBytes * buffer.Size.Height]; + System.Runtime.InteropServices.Marshal.Copy(buffer.Address, bytes, 0, bytes.Length); + var i = ((int)y * buffer.RowBytes) + ((int)x * 4); + return buffer.Format == global::Avalonia.Platform.PixelFormat.Rgba8888 + ? Color.FromRgb(bytes[i], bytes[i + 1], bytes[i + 2]) + : Color.FromRgb(bytes[i + 2], bytes[i + 1], bytes[i]); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/PointerTests.cs b/tests/SharpMUTerm.Tui.Tests/PointerTests.cs index d6ec71f4..836839f2 100644 --- a/tests/SharpMUTerm.Tui.Tests/PointerTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PointerTests.cs @@ -30,6 +30,10 @@ private sealed class RecordingPresenter : IPointerPresenter public bool DrawsMenus => true; public void Scrollbars(IReadOnlyList bars) => Bars = bars; + + public IReadOnlyList Dividers { get; private set; } = []; + + void IPointerPresenter.Dividers(IReadOnlyList dividers) => Dividers = dividers; } private static (SharpMUTermApp App, RecordingPresenter Pointer) App(string view, int width = 120, int height = 34) @@ -79,6 +83,43 @@ public async Task TheLineBetweenTwoPanesIsADividerThatResizesColumns() await Assert.That(divider[0].Target.Tooltip).Contains("Drag to resize"); } + /// + /// The host is told where the divider cells are, so the window can draw them as the panes meeting at a hairline: the + /// column between the panes, the whole height, lit while hovered; and nothing while a modal is drawn over the panes. + /// + [Test] + public async Task TheHostIsToldWhereTheDividersAreAndWhichIsLit() + { + var (app, pointer) = App("split"); + var rects = app.PaneSnapshot().Rects.Values.OrderBy(r => r.X).ToArray(); + var said = pointer.Dividers.Single(); + + await Assert.That(said.Vertical).IsTrue(); + await Assert.That(said.Lit).IsFalse(); + await Assert.That(said.Area.X).IsEqualTo(rects[0].X + rects[0].Width); + await Assert.That(said.Area.Width).IsEqualTo(1); + await Assert.That(said.Area.Height).IsEqualTo(rects[0].Height); + await Assert.That(app.DividersNow()).IsEquivalentTo(pointer.Dividers); + + app.SimulatePointer(DividerCell(app), MouseFlags.ReportMousePosition); + app.RenderNextFrame(); + await Assert.That(pointer.Dividers.Single().Lit).IsTrue(); + + app.SimulateKey(new ConsoleKeyInfo('\u0010', ConsoleKey.P, shift: false, alt: false, control: true)); + app.RenderNextFrame(); + await Assert.That(app.MenuIsOpen).IsTrue(); + await Assert.That(app.DividersNow()).IsEmpty().Because("⌃P is drawn over the panes, and the host must not draw over it"); + } + + /// A stacked split whose lower pane draws its strip has no divider row, and so tells the host of none. + [Test] + public async Task AStripStandingInForADividerIsNotADividerToDraw() + { + var (app, pointer) = App("split-stacked"); + + await Assert.That(pointer.Dividers).IsEmpty(); + } + [Test] public async Task HoveringADividerLightsItAndMovesNoPane() { From 27a757223296b76736fe80063fd3011cda0e5cbd Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 19:21:41 +0000 Subject: [PATCH 075/113] Wave 21 B: one spacing scale and device-pixel rules in the window - NativeTokens.Spacing: Hairline, Space2..Space32, PanelInset/ModalInset/PageInset, ControlHeight/ControlHeightSmall/FieldHeight, and Snap/HorizontalRule/StrokeRect/HairlinePen so a 1 px rule lands on one device row at 100/125/150/200%. - Every Thickness and Spacing in the window reads the scale; NativeTokenTests forbids literals outside an allow-list with reasons, and checks the chrome sizes are whole device pixels. - Header 44 px; sidebar text, brand and Add button on the 16 px inset, child rows indented, only the active character filled; panel headings 44 px with rows and footers on their inset; command-line field 20 px from the grid where the pad allows; buttons and fields one height. - The window's pane gutter is two columns and a row above output (PaneOutputRects and NAWS follow). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 6 + CLAUDE.md | 28 +++- src/SharpMUTerm.Avalonia/ComposerEditor.cs | 2 +- src/SharpMUTerm.Avalonia/ComposerView.cs | 53 ++++--- src/SharpMUTerm.Avalonia/DesktopLayer.cs | 34 +++-- .../DictionaryOfferView.cs | 8 +- src/SharpMUTerm.Avalonia/FloatingPanels.cs | 4 +- src/SharpMUTerm.Avalonia/HelpView.cs | 16 +- src/SharpMUTerm.Avalonia/HistoryView.cs | 4 +- src/SharpMUTerm.Avalonia/ImportReviewView.cs | 12 +- src/SharpMUTerm.Avalonia/LayoutsView.cs | 16 +- src/SharpMUTerm.Avalonia/ListEditorView.cs | 58 +++---- src/SharpMUTerm.Avalonia/MapCanvas.cs | 2 +- src/SharpMUTerm.Avalonia/MapInspector.cs | 14 +- src/SharpMUTerm.Avalonia/ModalOverlay.cs | 4 +- src/SharpMUTerm.Avalonia/ModalParts.cs | 37 ++--- src/SharpMUTerm.Avalonia/NativeChrome.cs | 77 ++++++---- src/SharpMUTerm.Avalonia/NativeMenu.cs | 10 +- .../NativeTokens.Spacing.cs | 141 ++++++++++++++++++ src/SharpMUTerm.Avalonia/PackagePageView.cs | 84 +++++------ src/SharpMUTerm.Avalonia/PaletteOverlay.cs | 30 ++-- src/SharpMUTerm.Avalonia/PaneChromeViews.cs | 28 ++-- src/SharpMUTerm.Avalonia/PanelText.cs | 20 ++- src/SharpMUTerm.Avalonia/QuickBarButtons.cs | 17 ++- src/SharpMUTerm.Avalonia/QuitView.cs | 10 +- src/SharpMUTerm.Avalonia/ScriptConsoleView.cs | 20 +-- src/SharpMUTerm.Avalonia/ScrollbackView.cs | 12 +- src/SharpMUTerm.Avalonia/SearchView.cs | 16 +- src/SharpMUTerm.Avalonia/SettingsWindow.cs | 97 ++++++------ src/SharpMUTerm.Avalonia/TerminalView.cs | 8 +- src/SharpMUTerm.Avalonia/ThemeCardView.cs | 18 +-- src/SharpMUTerm.Avalonia/VitalsGauges.cs | 4 +- src/SharpMUTerm.Avalonia/WelcomeView.cs | 59 ++++---- src/SharpMUTerm.Avalonia/WhoHereList.cs | 10 +- src/SharpMUTerm.Avalonia/WorldBrowseView.cs | 18 +-- src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 7 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 26 +++- .../DesktopLayerTests.cs | 2 +- .../NativeChromeTests.cs | 2 +- .../NativeFooterTests.cs | 10 +- .../NativePanelTests.cs | 4 +- .../NativeTokenTests.cs | 68 +++++++++ .../NativeTabStripTests.cs | 7 +- 43 files changed, 716 insertions(+), 387 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/NativeTokens.Spacing.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index f1226070..91e3c37d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -386,6 +386,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The desktop window lines up: one spacing scale for every native view, the header at the mockup's 44 px, output + starting about 20 px in from its pane's edges with a row of space under the tab strip, the sidebar's names, the brand + and every panel's heading, rows and buttons on one 16 px edge, the "+ Add a world or connect" button left-aligned, + equal-height buttons and fields, and every panel heading the same height. Rules and borders are one crisp pixel at + 125% and 150% display scaling instead of a blurred two. + - In the desktop window, the line between two panes is a hairline where the panes meet instead of a grey band, and lights up wider while you hover or drag it. In the command line, what you type starts right after the prompt. The docked composer's "Click to write a post" is in the interface font. diff --git a/CLAUDE.md b/CLAUDE.md index 9565101c..d06a8f9c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1394,8 +1394,10 @@ fallbacks) for inline images/maps. and the native strip lies on them. **Under `Tabs` a strip is two rows** (`TabHeaderStyle.Separator`, `TabStripRows`), the mockup's ~40 px with 14 px labels centred in the tabs; `PaneOutputRects` reads `TabHeaderHeight`, so NAWS is the pane less two rows, never a native view over a row of output. The band needs no blanking: its cells stay under it. - - **`HostChrome.PaneGutter` (the window) gives every pane a blank column either side** (`tabs.Margin`, - `PaneGutterColumns`), in the pane's plane (the surface grid behind it), so output is not flush with the pane's edge. + - **`HostChrome.PaneGutter` (the window) gives every pane two blank columns either side** (`tabs.Margin`, + `PaneGutterColumns`) **and a blank row above an output window's first line** (the content's `Margin`, + `PaneGutterRowsFor`; none for a panel or a map, drawn natively over the whole pane), in the pane's plane, so output + starts the mockup's ~20 px in from the pane's edges rather than one cell's 8. The columns are lost by the pane: `PaneOutputRects` subtracts the margin and NAWS follows. A native panel is published over its output rectangle *and* the gutter (`PublishPanels`), since those cells hold nothing and the panel pads itself. The terminal has no gutter. `NativeTabStripTests.TheStripTakesTwoRows…` pins both against the cells. @@ -2390,6 +2392,28 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] marked, `● Changed`, help under it; *Reset to default* link and the control on the right). A group whose name is its only field's label draws no heading. List and package pages put both halves in cards. Still generated from the declarations; nothing is placed by hand. Fonts are inherited (the window sets no UI family). +- **The window lays out on one spacing scale and on device pixels** (`NativeTokens.Spacing.cs`; wave 21B). Insets are + `Space2…Space32` (a 4 px grid plus the mockups' 6/10/14 control half-steps; nothing odd, an odd logical pixel is half a + device pixel at 150%), `PanelInset` (16: the header's brand, the sidebar's title, world names and foot button, every + panel's heading, rows and footer, the quick bar's first button), `ModalInset`, `PageInset`; heights `ControlHeight` 32, + `ControlHeightSmall` 28, `FieldHeight` 38 (the command line's field and the welcome's inputs and Connect). Decisions: + - **Chrome sizes are multiples of 4** (`NativeLayout`: header 44, sidebar 232 + 8, footer 28, the field's strip 40 + + rows), because 4 logical pixels are whole device pixels at 100/125/150/200%: the cells start on a device pixel at + every Windows scale, so a view placed from `CellOrigin` meets them with no blended row. The old 42 px header put + every rule below it on a half pixel at 125%. + - **A drawn hairline is one device pixel, filled**: `NativeTokens.HorizontalRule`/`VerticalRule`/`StrokeRect`/ + `HairlinePen` read the visual's `RenderScaling`; the header's rule, the tab strips, the scroll band, panel headings + (`PanelText.Heading(rule:)`), the search box, key caps and the quick bar's plates use them. `Border` hairlines are + already rounded by layout rounding (on by default) and need nothing. + - **Every panel heading is 44 px** (`PanelText.PanelHeadingHeight`, the docked composer's `Border` too), whatever the + cell height, so the side column's rules line up. Only the character in front wears the sidebar's selected plate; + its window in front is the accent mark. The field sits `NativeLayout.FieldSide` (20) in from the grid as far as the + prompt's padding columns allow (`FieldRect`, edges rounded to device pixels). + - `NativeTokenTests.NoViewWritesALiteralMarginPaddingOrSpacing` fails on a number in a `new Thickness(…)` or a + `Spacing =` outside the tokens (allow-list: the tokens, `TerminalView`, the footer, the toasts, with reasons); + `TheSpacingScaleAndTheChromeSizesAreWholeDevicePixels…` pins the multiples of 4. Not done: the quick bar is still one + cell row (the mockup's is a 56 px strip of 34 px buttons), and panel internals' font sizes are not on the scale. + - **Every native surface spells a key in words** (`NativeKeys.Words`, Avalonia: `KeyGlyphs.Words` plus the named keys `⏎` Enter, `⇥`/`↹` Tab, `⇤` Shift+Tab, `⌫` Backspace, `⌦` Delete, `⎋` Esc, `⇞`/`⇟` PgUp/PgDn; arrows stay arrows): `Ctrl+P`, `Alt+M`, `Ctrl+B b`, never `⌃P`/`⌥M`/`⏎`. The client writes keys in glyphs because the cells draw them diff --git a/src/SharpMUTerm.Avalonia/ComposerEditor.cs b/src/SharpMUTerm.Avalonia/ComposerEditor.cs index ba56a895..ab1f2457 100644 --- a/src/SharpMUTerm.Avalonia/ComposerEditor.cs +++ b/src/SharpMUTerm.Avalonia/ComposerEditor.cs @@ -30,7 +30,7 @@ public ComposerEditor() TextWrapping = TextWrapping.Wrap; NewLine = "\n"; BorderThickness = new Thickness(0); - Padding = new Thickness(12, 10); + Padding = new Thickness(NativeTokens.Space12, NativeTokens.Space10); MinHeight = 0; ClipToBounds = true; } diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 658b0e21..72b94fd5 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -84,7 +84,7 @@ public ComposerView(TerminalView view, bool fullScreen) _editor = new ComposerEditor { Background = Brushes.Transparent, - Padding = fullScreen ? new Thickness(22, 14) : new Thickness(10, 8), + Padding = fullScreen ? new Thickness(NativeTokens.Space24, NativeTokens.Space14) : new Thickness(NativeTokens.Space10, NativeTokens.Space8), }; AutomationProperties.SetName(_editor, fullScreen ? "Compose a post" : "Docked composer"); _editor.TextChanged += (_, _) => OnTextChanged(); @@ -95,10 +95,10 @@ public ComposerView(TerminalView view, bool fullScreen) _marks = new MarkLayer(_editor); _gutter = new LineGutter(_editor) { IsVisible = false }; - _title = new TextBlock { FontWeight = fullScreen ? FontWeight.Bold : FontWeight.SemiBold, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, fullScreen ? 10 : 8, 0) }; + _title = new TextBlock { FontWeight = fullScreen ? FontWeight.Bold : FontWeight.SemiBold, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, fullScreen ? NativeTokens.Space10 : NativeTokens.Space8, 0) }; _target = new TextBlock { VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; - _chips = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, VerticalAlignment = VerticalAlignment.Center }; - _count = new TextBlock { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(10, 0, 0, 0) }; + _chips = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space6, VerticalAlignment = VerticalAlignment.Center }; + _count = new TextBlock { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(NativeTokens.Space10, 0, 0, 0) }; var headerRow = new DockPanel { LastChildFill = true }; DockPanel.SetDock(_title, Dock.Left); DockPanel.SetDock(_count, Dock.Right); @@ -109,7 +109,13 @@ public ComposerView(TerminalView view, bool fullScreen) headerRow.Children.Add(_target); // The docked panel's heading is every panel's (PanelText.Heading): 16 px in, a rule under it, the pop-out button // clear at the right. - _header = new Border { Child = headerRow, Padding = fullScreen ? new Thickness(22, 10) : new Thickness(PanelText.Pad, 10, 30, 10) }; + _header = new Border { Child = headerRow, Padding = fullScreen ? new Thickness(NativeTokens.Space24, NativeTokens.Space10) : new Thickness(PanelText.Pad, 0, NativeTokens.Space32, 0) }; + if (!fullScreen) + { + // Every panel's heading height, so the composer's rule meets the one beside it (who is here, the map). + _header.Height = PanelText.PanelHeadingHeight; + headerRow.VerticalAlignment = VerticalAlignment.Center; + } _keys = new WrapPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center }; @@ -121,29 +127,29 @@ public ComposerView(TerminalView view, bool fullScreen) var dockedFooter = new DockPanel { LastChildFill = true }; DockPanel.SetDock(_sendButton, Dock.Right); DockPanel.SetDock(_previewButton, Dock.Right); - _previewButton.Margin = new Thickness(8, 0, 8, 0); + _previewButton.Margin = new Thickness(NativeTokens.Space8, 0, NativeTokens.Space8, 0); dockedFooter.Children.Add(_sendButton); dockedFooter.Children.Add(_previewButton); dockedFooter.Children.Add(_summary); _footer = new Border { Child = fullScreen ? _keys : dockedFooter, - Padding = fullScreen ? new Thickness(22, 8) : new Thickness(PanelText.Pad, 10, PanelText.Pad, 12), + Padding = fullScreen ? new Thickness(NativeTokens.Space24, NativeTokens.Space8) : new Thickness(PanelText.Pad, NativeTokens.Space10, PanelText.Pad, NativeTokens.Space14), }; // F1's as-sent preview (⌥P): the one command ⌃S sends, in the editor's face, under the editor. - _previewHeading = new TextBlock { Text = "AS SENT", FontWeight = FontWeight.Bold, Margin = new Thickness(0, 0, 0, 4) }; + _previewHeading = new TextBlock { Text = "AS SENT", FontWeight = FontWeight.Bold, Margin = new Thickness(0, 0, 0, NativeTokens.Space4) }; _previewText = new TextBlock { TextWrapping = TextWrapping.Wrap, MaxLines = 4, TextTrimming = TextTrimming.CharacterEllipsis }; _preview = new Border { Child = new StackPanel { Children = { _previewHeading, _previewText } }, - Padding = new Thickness(22, 8), + Padding = new Thickness(NativeTokens.Space24, NativeTokens.Space8), IsVisible = false, }; AutomationProperties.SetName(_preview, "As sent"); // The armed rule down the docked editor's left edge: the cell composer's ▌ marker, in the accent. - _rule = new Border { Width = 3, HorizontalAlignment = HorizontalAlignment.Left }; + _rule = new Border { Width = NativeTokens.MarkWidth, HorizontalAlignment = HorizontalAlignment.Left }; _placeholder = new TextBlock { @@ -151,7 +157,7 @@ public ComposerView(TerminalView view, bool fullScreen) FontFamily = NativeTokens.UiFont, IsHitTestVisible = false, IsVisible = false, - Margin = _editor.Padding + new Thickness(1), + Margin = _editor.Padding + new Thickness(NativeTokens.Hairline), }; var text = new Panel(); @@ -169,9 +175,9 @@ public ComposerView(TerminalView view, bool fullScreen) _well = new Border { Child = text, - Margin = new Thickness(PanelText.Pad, 12, PanelText.Pad, 0), - CornerRadius = new CornerRadius(NativeTokens.RadiusS + 2), - BorderThickness = new Thickness(1), + Margin = new Thickness(PanelText.Pad, NativeTokens.Space12, PanelText.Pad, 0), + CornerRadius = new CornerRadius(NativeTokens.RadiusControl), + BorderThickness = new Thickness(NativeTokens.Hairline), ClipToBounds = true, }; page = _well; @@ -374,9 +380,9 @@ private void Paint() _header.Background = new SolidColorBrush(_fullScreen ? Band : _plane); _footer.Background = new SolidColorBrush(_fullScreen ? Band : _plane); _header.BorderBrush = new SolidColorBrush(_fullScreen ? Mix(_plane, _text, 0.12) : PanelText.Rule(_text, _plane)); - _header.BorderThickness = new Thickness(0, 0, 0, 1); + _header.BorderThickness = new Thickness(0, 0, 0, NativeTokens.Hairline); _footer.BorderBrush = _header.BorderBrush; - _footer.BorderThickness = _fullScreen ? new Thickness(0, 1, 0, 0) : default; + _footer.BorderThickness = _fullScreen ? new Thickness(0, NativeTokens.Hairline, 0, 0) : default; if (_well is not null) { _well.Background = new SolidColorBrush(Well); @@ -402,7 +408,7 @@ private void Paint() _count.Foreground = new SolidColorBrush(Dim); _preview.Background = new SolidColorBrush(Band); _preview.BorderBrush = _header.BorderBrush; - _preview.BorderThickness = new Thickness(0, 1, 0, 0); + _preview.BorderThickness = new Thickness(0, NativeTokens.Hairline, 0, 0); _previewHeading.Foreground = new SolidColorBrush(Accent); _previewText.Foreground = new SolidColorBrush(_text); _marks.InvalidateVisual(); @@ -549,7 +555,7 @@ private void Label(ComposerModel model) continue; } - var item = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, Margin = new Thickness(0, 1, 14, 1) }; + var item = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space4, Margin = new Thickness(0, NativeTokens.Hairline, NativeTokens.Space14, NativeTokens.Hairline) }; if (key.Key.Length > 0) { item.Children.Add(Chip(NativeKeys.Words(key.Key), Accent, ui - 1.5)); @@ -588,9 +594,9 @@ private void ShowPlaceholder(bool wanted) { Background = new SolidColorBrush(Mix(_plane, ink, 0.14)), BorderBrush = new SolidColorBrush(Mix(_plane, ink, 0.32)), - BorderThickness = new Thickness(1), + BorderThickness = new Thickness(NativeTokens.Hairline), CornerRadius = new CornerRadius(NativeTokens.RadiusS), - Padding = new Thickness(6, 0, 6, 1), + Padding = new Thickness(NativeTokens.Space6, 0, NativeTokens.Space6, NativeTokens.Hairline), VerticalAlignment = VerticalAlignment.Center, Child = new TextBlock { Text = words, FontSize = Math.Max(9, size), Foreground = new SolidColorBrush(ink) }, }; @@ -932,9 +938,10 @@ private static Border ActionButton(string words, string tip, Action click) var button = new Border { Child = new TextBlock { Text = words, VerticalAlignment = VerticalAlignment.Center }, - Padding = new Thickness(10, 5), - CornerRadius = new CornerRadius(NativeTokens.RadiusS + 2), - BorderThickness = new Thickness(1), + Padding = new Thickness(NativeTokens.Space10, 0), + Height = NativeTokens.ControlHeightSmall, + CornerRadius = new CornerRadius(NativeTokens.RadiusControl), + BorderThickness = new Thickness(NativeTokens.Hairline), Cursor = new Cursor(StandardCursorType.Hand), VerticalAlignment = VerticalAlignment.Center, }; diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index d8a256f2..51d83de0 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -753,8 +753,11 @@ public override void Render(DrawingContext context) /// internal static class NativeLayout { - /// The header band's height. - public const double HeaderHeight = 42; + /// + /// The header band's height: the mockup's 44, a multiple of 4 like every chrome size here, so the cells below it + /// start on a whole device pixel at 125% and 150% (' spacing scale). + /// + public const double HeaderHeight = 44; /// The sidebar's width, open. public const double SidebarWidth = 232; @@ -766,34 +769,43 @@ internal static class NativeLayout /// The sidebar's breathing room before the panes: its own plane carried a few pixels on, so a pane's first column /// of text does not sit hard against the sidebar's edge. Part of the sidebar, never of a pane, so it costs no cell. /// - public const double SidebarGutter = 8; + public const double SidebarGutter = NativeTokens.Space8; /// The status footer's height (). public const double StatusHeight = 28; /// The footer's text inset from the window's edges. - public const double FooterPadX = 16; + public const double FooterPadX = NativeTokens.PanelInset; /// The command line's strip: the padding above the field and below it (). - public const double FieldOuter = 10; + public const double FieldOuter = NativeTokens.Space10; - /// The field's own padding above its first row and below its last. - public const double FieldInner = 9; + /// The field's own padding above its first row and below its last: the mockup's 9 px and its border. + public const double FieldInner = NativeTokens.Space10; /// How far the field's edge sits outside the client's padding columns, horizontally. - public const double FieldInsetX = 12; + public const double FieldInsetX = NativeTokens.Space12; + + /// + /// The field's edge from the grid's left and right edges: the mockup's 20 px, as far as the client's padding columns + /// leave room for the field's own inner padding ( at least) before the prompt. + /// + public const double FieldSide = NativeTokens.Space20; + + /// The pixels the strip adds around its rows: its padding and the field's, above and below. + public const double FieldStrip = 2 * (FieldOuter + FieldInner); /// How much lower the bars' rows are drawn than their cells: the strip's padding and the field's. public const double FieldTop = FieldOuter + FieldInner; /// The vertical pixels the field adds around the rows it frames, which the grid gives up. - public const double FieldReserve = 2 * FieldTop; + public const double FieldReserve = FieldStrip; /// A header button's side. - public const double ButtonSize = 30; + public const double ButtonSize = NativeTokens.ControlHeightSmall; /// The gap between two header buttons. - public const double ButtonGap = 6; + public const double ButtonGap = NativeTokens.Space8; /// The cells' margin in the window: the space the native header and sidebar take. public static Thickness Insets(HostChrome chrome, bool collapsed) => new( diff --git a/src/SharpMUTerm.Avalonia/DictionaryOfferView.cs b/src/SharpMUTerm.Avalonia/DictionaryOfferView.cs index 4da48954..719ccd66 100644 --- a/src/SharpMUTerm.Avalonia/DictionaryOfferView.cs +++ b/src/SharpMUTerm.Avalonia/DictionaryOfferView.cs @@ -27,11 +27,11 @@ public DictionaryOfferView(DictionaryOfferSession session, NativeTokens colours, var model = session.Model; var heading = ModalParts.Heading(model.Question, colours); - heading.Margin = new Thickness(22, 18, 22, 8); + heading.Margin = new Thickness(NativeTokens.Space24, NativeTokens.Space16, NativeTokens.Space24, NativeTokens.Space8); SetDock(heading, Dock.Top); Children.Add(heading); - var facts = new StackPanel { Margin = new Thickness(22, 2, 22, 4), Spacing = 6 }; + var facts = new StackPanel { Margin = new Thickness(NativeTokens.Space24, NativeTokens.Space2, NativeTokens.Space24, NativeTokens.Space4), Spacing = NativeTokens.Space6 }; foreach (var line in model.Lines) { facts.Children.Add(new TextBlock @@ -56,8 +56,8 @@ public DictionaryOfferView(DictionaryOfferSession session, NativeTokens colours, { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right, - Spacing = 10, - Margin = new Thickness(22, 14, 22, 0), + Spacing = NativeTokens.Space10, + Margin = new Thickness(NativeTokens.Space24, NativeTokens.Space14, NativeTokens.Space24, 0), }; buttons.Children.Add(_download); buttons.Children.Add(_later); diff --git a/src/SharpMUTerm.Avalonia/FloatingPanels.cs b/src/SharpMUTerm.Avalonia/FloatingPanels.cs index df1a5f5c..24afb4e2 100644 --- a/src/SharpMUTerm.Avalonia/FloatingPanels.cs +++ b/src/SharpMUTerm.Avalonia/FloatingPanels.cs @@ -213,8 +213,8 @@ public FloatingPanelWindow(FloatingPanel panel, TerminalView view) }; _content.Focusable = false; - _title = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontSize = NativeTokens.Body, Margin = new Thickness(10, 0, 0, 0) }; - _dock = new FrameButton("Dock") { Width = 52, Height = 20, Margin = new Thickness(0, 0, 6, 0), VerticalAlignment = VerticalAlignment.Center }; + _title = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontSize = NativeTokens.Body, Margin = new Thickness(NativeTokens.Space10, 0, 0, 0) }; + _dock = new FrameButton("Dock") { Width = 52, Height = 20, Margin = new Thickness(0, 0, NativeTokens.Space6, 0), VerticalAlignment = VerticalAlignment.Center }; _dock.Click += () => Panel.Dock(); AutomationProperties.SetName(_dock, "Dock back into the layout"); ToolTip.SetTip(_dock, "Dock back into its place in the layout"); diff --git a/src/SharpMUTerm.Avalonia/HelpView.cs b/src/SharpMUTerm.Avalonia/HelpView.cs index a209de02..73518354 100644 --- a/src/SharpMUTerm.Avalonia/HelpView.cs +++ b/src/SharpMUTerm.Avalonia/HelpView.cs @@ -59,7 +59,7 @@ public HelpView(HelpSession session, NativeTokens colours, Action done) frame.MinHeight = 160; panel.Children.Add(frame); - _pageText = new StackPanel { Margin = new Thickness(22, 4, 22, 12), Spacing = 8 }; + _pageText = new StackPanel { Margin = new Thickness(NativeTokens.Space24, NativeTokens.Space4, NativeTokens.Space24, NativeTokens.Space12), Spacing = NativeTokens.Space8 }; _page = new ScrollViewer { Content = _pageText, IsVisible = false, MinHeight = 160 }; panel.Children.Add(_page); Children.Add(panel); @@ -210,7 +210,7 @@ private void ShowPage(HelpTopic topic) FontSize = NativeTokens.Title, FontWeight = FontWeight.SemiBold, Foreground = _colours.Brush(_colours.Header), - Margin = new Thickness(0, previous is null ? 4 : 8, 0, -4), + Margin = new Thickness(0, previous is null ? NativeTokens.Space4 : NativeTokens.Space8, 0, -NativeTokens.Space4), }); } @@ -220,8 +220,8 @@ private void ShowPage(HelpTopic topic) Foreground = _colours.Brush(_colours.Text), TextWrapping = block.Preformatted ? TextWrapping.NoWrap : TextWrapping.Wrap, LineHeight = (NativeTokens.Body + 1) * 1.45, - Margin = block.Preformatted && previous is { Preformatted: true } ? new Thickness(12, -6, 0, 0) - : block.Preformatted ? new Thickness(12, 0, 0, 0) : default, + Margin = block.Preformatted && previous is { Preformatted: true } ? new Thickness(NativeTokens.Space12, -NativeTokens.Space6, 0, 0) + : block.Preformatted ? new Thickness(NativeTokens.Space12, 0, 0, 0) : default, }; if (block.Preformatted) { @@ -247,7 +247,7 @@ private void ShowPage(HelpTopic topic) var back = ModalParts.Button("Back to help", "Esc", _colours, Back); back.HorizontalAlignment = HorizontalAlignment.Left; - back.Margin = new Thickness(0, 10, 0, 0); + back.Margin = new Thickness(0, NativeTokens.Space10, 0, 0); _pageText.Children.Add(back); _page.Offset = default; _footer.Text = "Up and Down scroll · Esc back to the list"; @@ -272,7 +272,7 @@ private void ShowList() { Text = NativeKeys.Words(HelpModel.NoMatches), Foreground = _colours.Brush(_colours.Dim), - Margin = new Thickness(12, 10), + Margin = new Thickness(NativeTokens.Space12, NativeTokens.Space10), TextWrapping = TextWrapping.Wrap, }); return; @@ -293,7 +293,7 @@ private void ShowList() if (entry.Key.Length > 0) { var chip = ModalParts.Key(entry.Key, _colours); - chip.Margin = new Thickness(10, 0, 0, 0); + chip.Margin = new Thickness(NativeTokens.Space10, 0, 0, 0); SetDock(chip, Dock.Right); line.Children.Add(chip); } @@ -304,7 +304,7 @@ private void ShowList() Foreground = _colours.Brush(_colours.Text), FontSize = NativeTokens.Title, Width = 240, - Margin = new Thickness(0, 0, 14, 0), + Margin = new Thickness(0, 0, NativeTokens.Space14, 0), TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center, }; diff --git a/src/SharpMUTerm.Avalonia/HistoryView.cs b/src/SharpMUTerm.Avalonia/HistoryView.cs index d6f06dda..43b4643a 100644 --- a/src/SharpMUTerm.Avalonia/HistoryView.cs +++ b/src/SharpMUTerm.Avalonia/HistoryView.cs @@ -38,7 +38,7 @@ public HistoryView(HistorySession session, NativeTokens colours, Action done) SetDock(_box, Dock.Top); Children.Add(_box); - var header = new DockPanel { Margin = new Thickness(20, 0, 20, 6) }; + var header = new DockPanel { Margin = new Thickness(NativeTokens.Space20, 0, NativeTokens.Space20, NativeTokens.Space6) }; var whose = new TextBlock { Text = model.BarLabel, FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim) }; _count = new TextBlock { FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), HorizontalAlignment = global::Avalonia.Layout.HorizontalAlignment.Right }; SetDock(whose, Dock.Left); @@ -112,7 +112,7 @@ private void Draw() { Text = model.Entries.Count == 0 ? HistoryModel.NothingEntered : HistoryModel.NoMatches, Foreground = _colours.Brush(_colours.Dim), - Margin = new Thickness(12, 10), + Margin = new Thickness(NativeTokens.Space12, NativeTokens.Space10), TextWrapping = TextWrapping.Wrap, }); return; diff --git a/src/SharpMUTerm.Avalonia/ImportReviewView.cs b/src/SharpMUTerm.Avalonia/ImportReviewView.cs index f6330061..341f7dbc 100644 --- a/src/SharpMUTerm.Avalonia/ImportReviewView.cs +++ b/src/SharpMUTerm.Avalonia/ImportReviewView.cs @@ -20,7 +20,7 @@ internal sealed class ImportReviewView : DockPanel, IModalView private readonly ImportReviewSession _session; private readonly NativeTokens _colours; private readonly Action _done; - private readonly StackPanel _body = new() { Spacing = 4, Margin = new Thickness(20, 2, 20, 4) }; + private readonly StackPanel _body = new() { Spacing = NativeTokens.Space4, Margin = new Thickness(NativeTokens.Space20, NativeTokens.Space2, NativeTokens.Space20, NativeTokens.Space4) }; private readonly Button _import; private readonly Button _cancel; private readonly CheckBox _passwords; @@ -64,10 +64,10 @@ public ImportReviewView(ImportReviewSession session, NativeTokens colours, Actio } }; - var buttons = new DockPanel { Margin = new Thickness(20, 12, 20, 0), LastChildFill = false }; + var buttons = new DockPanel { Margin = new Thickness(NativeTokens.Space20, NativeTokens.Space12, NativeTokens.Space20, 0), LastChildFill = false }; DockPanel.SetDock(_passwords, Dock.Left); buttons.Children.Add(_passwords); - var right = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10 }; + var right = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space10 }; right.Children.Add(_import); right.Children.Add(_cancel); DockPanel.SetDock(right, Dock.Right); @@ -182,7 +182,7 @@ private void Draw() if (_model.PasswordLine is { } passwords) { var line = Line(passwords, _model.StorePasswords ? _colours.Text : _colours.Warn); - line.Margin = new Thickness(12, 12, 12, 0); + line.Margin = new Thickness(NativeTokens.Space12, NativeTokens.Space12, NativeTokens.Space12, 0); _body.Children.Add(line); } } @@ -193,7 +193,7 @@ private void Draw() Foreground = _colours.Brush(colour), FontSize = NativeTokens.Body, TextWrapping = TextWrapping.Wrap, - Margin = new Thickness(12, 1, 12, 1), + Margin = new Thickness(NativeTokens.Space12, NativeTokens.Hairline, NativeTokens.Space12, NativeTokens.Hairline), }; private TextBlock Row(ImportReviewRow row, Color detail) @@ -202,7 +202,7 @@ private TextBlock Row(ImportReviewRow row, Color detail) { FontSize = NativeTokens.Body, TextWrapping = TextWrapping.Wrap, - Margin = new Thickness(12, 2, 12, 2), + Margin = new Thickness(NativeTokens.Space12, NativeTokens.Space2, NativeTokens.Space12, NativeTokens.Space2), }; block.Inlines ??= new global::Avalonia.Controls.Documents.InlineCollection(); block.Inlines.Add(new global::Avalonia.Controls.Documents.Run(row.Kind + " ") { Foreground = _colours.Brush(_colours.Accent) }); diff --git a/src/SharpMUTerm.Avalonia/LayoutsView.cs b/src/SharpMUTerm.Avalonia/LayoutsView.cs index 0eeebdb7..9a3cf115 100644 --- a/src/SharpMUTerm.Avalonia/LayoutsView.cs +++ b/src/SharpMUTerm.Avalonia/LayoutsView.cs @@ -49,8 +49,8 @@ public LayoutsView(LayoutsSession session, NativeTokens colours, Action done) _rename = new TextBox { - Margin = new Thickness(14, 4, 14, 4), - Padding = new Thickness(10, 6), + Margin = new Thickness(NativeTokens.Space14, NativeTokens.Space4, NativeTokens.Space14, NativeTokens.Space4), + Padding = new Thickness(NativeTokens.Space10, NativeTokens.Space6), CornerRadius = new CornerRadius(NativeTokens.RadiusM), IsVisible = false, PlaceholderText = "New name", @@ -61,11 +61,11 @@ public LayoutsView(LayoutsSession session, NativeTokens colours, Action done) SetDock(footer, Dock.Bottom); Children.Add(footer); - _buttons = new WrapPanel { Margin = new Thickness(14, 8, 14, 0), HorizontalAlignment = HorizontalAlignment.Right }; + _buttons = new WrapPanel { Margin = new Thickness(NativeTokens.Space14, NativeTokens.Space8, NativeTokens.Space14, 0), HorizontalAlignment = HorizontalAlignment.Right }; SetDock(_buttons, Dock.Bottom); Children.Add(_buttons); - _status = ModalParts.Dim(string.Empty, colours, new Thickness(20, 8, 20, 0)); + _status = ModalParts.Dim(string.Empty, colours, new Thickness(NativeTokens.Space20, NativeTokens.Space8, NativeTokens.Space20, 0)); SetDock(_status, Dock.Bottom); Children.Add(_status); @@ -159,7 +159,7 @@ private void Draw() if (own == 0) { - _list.Children.Add(ModalParts.Dim("None yet — Save as new keeps the panes as they are now.", _colours, new Thickness(12, 2, 12, 6))); + _list.Children.Add(ModalParts.Dim("None yet — Save as new keeps the panes as they are now.", _colours, new Thickness(NativeTokens.Space12, NativeTokens.Space2, NativeTokens.Space12, NativeTokens.Space6))); } _status.Text = _confirming && _model.Current is { } doomed @@ -176,7 +176,7 @@ private void AddRow(int index) { var layout = _model.Rows[index]; var line = new DockPanel(); - var tags = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, VerticalAlignment = VerticalAlignment.Center }; + var tags = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space6, VerticalAlignment = VerticalAlignment.Center }; if (layout.InUse) { tags.Children.Add(Chip("in use")); @@ -213,7 +213,7 @@ private void AddRow(int index) { Background = _colours.Brush(_colours.Selected), CornerRadius = new CornerRadius(NativeTokens.RadiusM), - Padding = new Thickness(8, 1), + Padding = new Thickness(NativeTokens.Space8, NativeTokens.Hairline), Child = new TextBlock { Text = text, FontSize = NativeTokens.Small, Foreground = _colours.Brush(_colours.Accent) }, }; @@ -228,7 +228,7 @@ private void DrawButtons() void Add(string label, string key, Action click, bool accent = false) { var button = ModalParts.Button(label, key, _colours, click, accent); - button.Margin = new Thickness(6, 0, 0, 6); + button.Margin = new Thickness(NativeTokens.Space6, 0, 0, NativeTokens.Space6); button.Focusable = false; _buttons.Children.Add(button); } diff --git a/src/SharpMUTerm.Avalonia/ListEditorView.cs b/src/SharpMUTerm.Avalonia/ListEditorView.cs index 50667840..a4a2e70f 100644 --- a/src/SharpMUTerm.Avalonia/ListEditorView.cs +++ b/src/SharpMUTerm.Avalonia/ListEditorView.cs @@ -41,7 +41,7 @@ internal sealed class ListEditorView : Grid private readonly Dictionary _controls = new(StringComparer.Ordinal); private readonly List<(object Item, ListBoxItem Row, CheckBox Enabled)> _rows = []; private readonly List internal sealed class SettingsWindow : Window { + /// How far the meter table's received-paths box sits in: under the path columns, past the label column. + private const double MeterPathsIndent = 128; + private readonly TextBox _search; private readonly ListBox _sections; private readonly StackPanel _page; @@ -94,8 +97,8 @@ public SettingsWindow(SettingsForm form) CloseButton = new Button { Content = "✕", - Padding = new Thickness(10, 4), - Margin = new Thickness(12, 0, 0, 0), + Padding = new Thickness(NativeTokens.Space10, NativeTokens.Space4), + Margin = new Thickness(NativeTokens.Space12, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center, Background = Brushes.Transparent, BorderThickness = new Thickness(0), @@ -108,7 +111,7 @@ public SettingsWindow(SettingsForm form) { PlaceholderText = "Search settings", FontSize = NativeTokens.Label, - Padding = new Thickness(0, 2), + Padding = new Thickness(0, NativeTokens.Space2), MinHeight = 0, BorderThickness = new Thickness(0), Background = Brushes.Transparent, @@ -125,7 +128,7 @@ public SettingsWindow(SettingsForm form) AutomationProperties.SetName(_search, "Search settings"); _search.TextChanged += (_, _) => OnQuery(); - _searchCount = new TextBlock { FontSize = NativeTokens.Body, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8, 0, 0, 0) }; + _searchCount = new TextBlock { FontSize = NativeTokens.Body, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(NativeTokens.Space8, 0, 0, 0) }; _searchGlass = new global::Avalonia.Controls.Shapes.Path { Data = Geometry.Parse("M6,0 A6,6 0 1 1 6,12 A6,6 0 1 1 6,0 M10.5,10.5 L14,14"), @@ -134,7 +137,7 @@ public SettingsWindow(SettingsForm form) Height = 14, Stretch = Stretch.Uniform, VerticalAlignment = VerticalAlignment.Center, - Margin = new Thickness(0, 0, 8, 0), + Margin = new Thickness(0, 0, NativeTokens.Space8, 0), }; var searchRow = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto") }; searchRow.Children.Add(_searchGlass); @@ -145,17 +148,17 @@ public SettingsWindow(SettingsForm form) _searchFrame = new Border { Child = searchRow, - BorderThickness = new Thickness(1), + BorderThickness = new Thickness(NativeTokens.Hairline), CornerRadius = new CornerRadius(NativeTokens.RadiusM), - Padding = new Thickness(12, 6), + Padding = new Thickness(NativeTokens.Space12, NativeTokens.Space6), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Cursor = new Cursor(StandardCursorType.Ibeam), }; _searchFrame.PointerPressed += (_, _) => _search.Focus(); - _scope = new ContentControl { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(16, 0, 0, 0) }; - var header = new Grid { ColumnDefinitions = [new ColumnDefinition(GridLength.Auto), new ColumnDefinition(3, GridUnitType.Star) { MaxWidth = 480 }, new ColumnDefinition(GridLength.Star), new ColumnDefinition(GridLength.Auto), new ColumnDefinition(GridLength.Auto)], Margin = new Thickness(20, 0, 8, 0), Background = Brushes.Transparent }; + _scope = new ContentControl { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(NativeTokens.Space16, 0, 0, 0) }; + var header = new Grid { ColumnDefinitions = [new ColumnDefinition(GridLength.Auto), new ColumnDefinition(3, GridUnitType.Star) { MaxWidth = 480 }, new ColumnDefinition(GridLength.Star), new ColumnDefinition(GridLength.Auto), new ColumnDefinition(GridLength.Auto)], Margin = new Thickness(NativeTokens.Space20, 0, NativeTokens.Space8, 0), Background = Brushes.Transparent }; header.Children.Add(_title); Grid.SetColumn(_searchFrame, 1); header.Children.Add(_searchFrame); @@ -163,7 +166,7 @@ public SettingsWindow(SettingsForm form) header.Children.Add(_scope); Grid.SetColumn(CloseButton, 4); header.Children.Add(CloseButton); - _bar = new Border { Height = 56, BorderThickness = new Thickness(0, 0, 0, 1), Child = header }; + _bar = new Border { Height = 56, BorderThickness = new Thickness(0, 0, 0, NativeTokens.Hairline), Child = header }; _bar.PointerPressed += (_, e) => { if (e.GetCurrentPoint(_bar).Properties.IsLeftButtonPressed @@ -177,11 +180,11 @@ public SettingsWindow(SettingsForm form) // ── the footer ── _footerLeft = new TextBlock { Text = "Changes apply to connected sessions as you make them.", FontSize = NativeTokens.Body, VerticalAlignment = VerticalAlignment.Center }; _footerRight = new TextBlock { Text = "Ctrl+F searches · Esc closes", FontSize = NativeTokens.Body, VerticalAlignment = VerticalAlignment.Center }; - var footerRow = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), Margin = new Thickness(20, 0) }; + var footerRow = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), Margin = new Thickness(NativeTokens.Space20, 0) }; footerRow.Children.Add(_footerLeft); Grid.SetColumn(_footerRight, 1); footerRow.Children.Add(_footerRight); - _footer = new Border { Height = 36, BorderThickness = new Thickness(0, 1, 0, 0), Child = footerRow }; + _footer = new Border { Height = 36, BorderThickness = new Thickness(0, NativeTokens.Hairline, 0, 0), Child = footerRow }; DockPanel.SetDock(_footer, Dock.Bottom); // ── the section navigation ── @@ -193,17 +196,17 @@ public SettingsWindow(SettingsForm form) FontSize = NativeTokens.Body, LineHeight = 18, TextWrapping = TextWrapping.Wrap, - Margin = new Thickness(10, 8, 10, 4), + Margin = new Thickness(NativeTokens.Space10, NativeTokens.Space8, NativeTokens.Space10, NativeTokens.Space4), }; var navDock = new DockPanel { LastChildFill = true }; DockPanel.SetDock(_navNote, Dock.Bottom); navDock.Children.Add(_navNote); navDock.Children.Add(_sections); - _nav = new Border { Width = 232, BorderThickness = new Thickness(0, 0, 1, 0), Padding = new Thickness(10, 12), Child = navDock }; + _nav = new Border { Width = 232, BorderThickness = new Thickness(0, 0, NativeTokens.Hairline, 0), Padding = new Thickness(NativeTokens.Space10, NativeTokens.Space12), Child = navDock }; DockPanel.SetDock(_nav, Dock.Left); // ── the page ── - _page = new StackPanel { Margin = new Thickness(40, 24, 40, 28), Spacing = 20 }; + _page = new StackPanel { Margin = new Thickness(NativeTokens.PageInset, NativeTokens.Space24, NativeTokens.PageInset, NativeTokens.Space28), Spacing = NativeTokens.Space20 }; _scroller = new ScrollViewer { Content = _page, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }; // A list editor fills the page below its title rather than scrolling with it: its list and its detail scroll @@ -226,7 +229,7 @@ public SettingsWindow(SettingsForm form) dock.Children.Add(_footer); dock.Children.Add(_nav); dock.Children.Add(_scroller); - _frame = new Border { BorderThickness = new Thickness(1), Child = dock }; + _frame = new Border { BorderThickness = new Thickness(NativeTokens.Hairline), Child = dock }; // The frame is ours, so the resize border is too: a band along each edge, as the borderless main window has. CanResize = true; @@ -391,7 +394,7 @@ private void BuildSectionList() foreach (var section in _form.Sections) { var title = new TextBlock { Text = section.Title, FontSize = NativeTokens.Label, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; - var badge = new TextBlock { FontSize = NativeTokens.Label, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8, 0, 0, 0) }; + var badge = new TextBlock { FontSize = NativeTokens.Label, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(NativeTokens.Space8, 0, 0, 0) }; _badges[section.Id] = badge; var row = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; row.Children.Add(title); @@ -401,8 +404,8 @@ private void BuildSectionList() { Content = row, Tag = section.Id, - Padding = new Thickness(10, 8), - Margin = new Thickness(0, 0, 0, 2), + Padding = new Thickness(NativeTokens.Space10, NativeTokens.Space8), + Margin = new Thickness(0, 0, 0, NativeTokens.Space2), MinHeight = 0, CornerRadius = new CornerRadius(NativeTokens.RadiusControl), }; @@ -547,7 +550,7 @@ private void BuildPage() { if (_form.Packages is not { } manager) { - _page.Children.Add(new TextBlock { Text = "This client offers no packages.", Foreground = DimInk, Margin = new Thickness(0, 16, 0, 0) }); + _page.Children.Add(new TextBlock { Text = "This client offers no packages.", Foreground = DimInk, Margin = new Thickness(0, NativeTokens.Space16, 0, 0) }); ShownFields = []; return; } @@ -574,7 +577,7 @@ private void BuildPage() _tokens) { Height = ListEditorHeight(), - Margin = new Thickness(0, 8, 0, 0), + Margin = new Thickness(0, NativeTokens.Space8, 0, 0), }; ListEditor = editor; _page.Children.Add(editor); @@ -611,7 +614,7 @@ private void BuildPage() : section.Fields.ToList(); if (visible.Count == 0) { - _page.Children.Add(new TextBlock { Text = "No setting here matches the search.", Foreground = DimInk, Margin = new Thickness(0, 16, 0, 0) }); + _page.Children.Add(new TextBlock { Text = "No setting here matches the search.", Foreground = DimInk, Margin = new Thickness(0, NativeTokens.Space16, 0, 0) }); } // A card per group, as the mockup draws its sections: the group's name heads it and its fields are rows inside, @@ -631,7 +634,7 @@ private void BuildPage() Text = heading, FontSize = NativeTokens.CardTitle, FontWeight = FontWeight.SemiBold, - Margin = new Thickness(0, 12, 0, 0), + Margin = new Thickness(0, NativeTokens.Space12, 0, 0), }); } @@ -639,7 +642,7 @@ private void BuildPage() } else { - body.Children.Add(new Border { Height = 1, Background = _tokens.Page.Brush(_tokens.Page.Rule) }); + body.Children.Add(new Border { Height = NativeTokens.Hairline, Background = _tokens.Page.Brush(_tokens.Page.Rule) }); } body.Children.Add(field switch @@ -660,7 +663,7 @@ private void BuildPage() /// private StackPanel PageHead(SettingsSectionContribution section) { - var head = new StackPanel { Spacing = 6 }; + var head = new StackPanel { Spacing = NativeTokens.Space6 }; head.Children.Add(new TextBlock { Text = section.Title, FontSize = NativeTokens.PageTitle, FontWeight = FontWeight.SemiBold }); var line = new WrapPanel { Orientation = Orientation.Horizontal }; if (Searching) @@ -680,7 +683,7 @@ private StackPanel PageHead(SettingsSectionContribution section) if (section.Scope is SettingScope.World or SettingScope.Character && section.Key is { } screen) { var door = LinkButton($"Open the {screen} screen ↗"); - door.Margin = new Thickness(line.Children.Count > 0 ? 12 : 0, 0, 0, 0); + door.Margin = new Thickness(line.Children.Count > 0 ? NativeTokens.Space12 : 0, 0, 0, 0); ToolTip.SetTip(door, section.Scope == SettingScope.World ? "Adding and deleting worlds, their characters and trigger sets are on the cell screen" : "Adding and deleting characters is on the cell screen"); @@ -705,9 +708,9 @@ private StackPanel PageHead(SettingsSectionContribution section) Child = body, Background = _tokens.Page.Brush(_tokens.Page.Card), BorderBrush = _tokens.Page.Brush(_tokens.Page.Rule), - BorderThickness = new Thickness(1), + BorderThickness = new Thickness(NativeTokens.Hairline), CornerRadius = new CornerRadius(NativeTokens.RadiusCard), - Padding = new Thickness(20, 6), + Padding = new Thickness(NativeTokens.Space20, NativeTokens.Space6), }; /// A button drawn as a link in the accent, underlined, as the mockup's "Reset to default" and "Show all". @@ -743,7 +746,7 @@ private Button LinkButton(string text) /// private Control SubjectRow(SettingsSectionContribution section) { - var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8 }; + var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space8 }; var subjects = _form.Subjects(section.Scope); var noun = section.Scope == SettingScope.World ? "world" : "character"; if (subjects.Count == 0) @@ -776,7 +779,7 @@ private Control SubjectRow(SettingsSectionContribution section) /// The theme field: a card per theme, its preview drawn from the client's model; a click uses it. private StackPanel ThemePicker(ThemeField field) { - var outer = new StackPanel { Spacing = 6, Margin = new Thickness(0, 12, 0, 4) }; + var outer = new StackPanel { Spacing = NativeTokens.Space6, Margin = new Thickness(0, NativeTokens.Space12, 0, NativeTokens.Space4) }; var words = new StackPanel(); words.Children.Add(LabelBlock(field.Label)); if (field.Help is { } help) @@ -786,7 +789,7 @@ private StackPanel ThemePicker(ThemeField field) outer.Children.Add(words); - var wrap = new WrapPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 6, 0, 0) }; + var wrap = new WrapPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, NativeTokens.Space6, 0, 0) }; var inUse = CurrentTheme(field); foreach (var card in _form.Themes()) { @@ -876,7 +879,7 @@ private TextBlock LabelBlock(string label) /// A field's help line under its label: quiet, wrapped. private TextBlock HelpBlock(string help) => - new() { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 0) }; + new() { Text = NativeKeys.Words(Capitalise(help)), FontSize = NativeTokens.Body, Foreground = DimInk, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, NativeTokens.Space2, 0, 0) }; /// /// One field, as a row of its group's card: the label (with the changed mark beside it) and its help on the left; @@ -884,9 +887,9 @@ private TextBlock HelpBlock(string help) => /// private Grid FieldRow(SettingsField field) { - var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto,Auto"), Margin = new Thickness(0, 12), MinHeight = 32 }; + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto,Auto"), Margin = new Thickness(0, NativeTokens.Space12), MinHeight = 32 }; - var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 16, 0) }; + var words = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, NativeTokens.Space16, 0) }; var (changed, reset) = ChangedMark(field); var top = new WrapPanel { Orientation = Orientation.Horizontal }; top.Children.Add(LabelBlock(field.Label)); @@ -899,7 +902,7 @@ private Grid FieldRow(SettingsField field) // The note the cell F5 draws beside the value (join wraps' recommendation), from the same sentence, in the // cells' caution amber; gone once the field has been changed. - var note = new TextBlock { FontSize = NativeTokens.Body, Foreground = _tokens.Brush(_tokens.Notice), TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 0) }; + var note = new TextBlock { FontSize = NativeTokens.Body, Foreground = _tokens.Brush(_tokens.Notice), TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, NativeTokens.Space2, 0, 0) }; void ShowNote() { var text = _form.Note(field); @@ -914,7 +917,7 @@ void ShowNote() grid.Children.Add(words); - reset.Margin = new Thickness(0, 0, 16, 0); + reset.Margin = new Thickness(0, 0, NativeTokens.Space16, 0); Grid.SetColumn(reset, 1); grid.Children.Add(reset); @@ -933,7 +936,7 @@ void ShowNote() /// private (Control Changed, Button Reset) ChangedMark(SettingsField field) { - var mark = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, Margin = new Thickness(10, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; + var mark = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space6, Margin = new Thickness(NativeTokens.Space10, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }; mark.Children.Add(new Ellipse { Width = 6, Height = 6, Fill = Accent, VerticalAlignment = VerticalAlignment.Center }); mark.Children.Add(new TextBlock { Text = "Changed", FontSize = NativeTokens.Body, Foreground = DimInk, VerticalAlignment = VerticalAlignment.Center }); ToolTip.SetTip(mark, "Changed from its default"); @@ -1091,7 +1094,7 @@ void Commit() private static StackPanel Swatch(string name) { - var panel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Tag = name }; + var panel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space8, Tag = name }; if (Color.TryParse(name, out var colour)) { panel.Children.Add(new Border { Width = 14, Height = 14, CornerRadius = new CornerRadius(NativeTokens.RadiusS), Background = new SolidColorBrush(colour) }); @@ -1105,7 +1108,7 @@ private static StackPanel Swatch(string name) private StackPanel MeterTable(ListField field) { - var outer = new StackPanel { Spacing = 10, Margin = new Thickness(0, 12, 0, 4) }; + var outer = new StackPanel { Spacing = NativeTokens.Space10, Margin = new Thickness(0, NativeTokens.Space12, 0, NativeTokens.Space4) }; var page = _tokens.Page; var top = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; @@ -1170,7 +1173,7 @@ private StackPanel MeterTable(ListField field) var remove = new Button { Content = "✕", - Padding = new Thickness(8, 3), + Padding = new Thickness(NativeTokens.Space8, NativeTokens.Space4), Background = Brushes.Transparent, BorderThickness = new Thickness(0), Foreground = DimInk, @@ -1199,10 +1202,10 @@ private StackPanel MeterTable(ListField field) // What this connection has received, to pick a path from: a click puts it in the path box last used. Drawn as the // mockup's drop-down panel, under the path columns. var box = new StackPanel(); - box.Children.Add(new TextBlock { Text = "Paths this connection has received", FontSize = NativeTokens.Body, Foreground = DimInk, Margin = new Thickness(12, 4, 12, 4) }); + box.Children.Add(new TextBlock { Text = "Paths this connection has received", FontSize = NativeTokens.Body, Foreground = DimInk, Margin = new Thickness(NativeTokens.Space12, NativeTokens.Space4, NativeTokens.Space12, NativeTokens.Space4) }); if (received.Count == 0) { - box.Children.Add(new TextBlock { Text = "Nothing yet — a meter shows once its value arrives.", FontSize = NativeTokens.Body, Foreground = DimInk, Margin = new Thickness(12, 4, 12, 6) }); + box.Children.Add(new TextBlock { Text = "Nothing yet — a meter shows once its value arrives.", FontSize = NativeTokens.Body, Foreground = DimInk, Margin = new Thickness(NativeTokens.Space12, NativeTokens.Space4, NativeTokens.Space12, NativeTokens.Space6) }); } foreach (var item in received.Take(40)) @@ -1216,7 +1219,7 @@ private StackPanel MeterTable(ListField field) Background = Brushes.Transparent, BorderThickness = new Thickness(0), CornerRadius = new CornerRadius(0), - Padding = new Thickness(12, 6), + Padding = new Thickness(NativeTokens.Space12, NativeTokens.Space6), HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Left, }; @@ -1236,16 +1239,16 @@ private StackPanel MeterTable(ListField field) { Child = box, Background = page.Brush(page.Popup), - BorderThickness = new Thickness(1), + BorderThickness = new Thickness(NativeTokens.Hairline), BorderBrush = page.Brush(page.FocusEdge), CornerRadius = new CornerRadius(NativeTokens.RadiusM), - Padding = new Thickness(0, 8), - Margin = new Thickness(128, 0, 0, 0), + Padding = new Thickness(0, NativeTokens.Space8), + Margin = new Thickness(MeterPathsIndent, 0, 0, 0), MaxWidth = 420, HorizontalAlignment = HorizontalAlignment.Left, }); - var add = new Button { Content = "+ Add a meter", HorizontalAlignment = HorizontalAlignment.Left, Padding = new Thickness(12, 6), FontSize = NativeTokens.Label }; + var add = new Button { Content = "+ Add a meter", HorizontalAlignment = HorizontalAlignment.Left, Padding = new Thickness(NativeTokens.Space12, NativeTokens.Space6), FontSize = NativeTokens.Label }; AutomationProperties.SetName(add, "Add a meter"); add.Click += (_, _) => { diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index 58c40aa8..e02d1e75 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -1070,9 +1070,11 @@ public void Dispose() /// internal static SKRect FieldRect(InputBand band, int cw, int ch, int columns, float scale) { - var inset = Math.Max(4 * scale, (band.Pad * cw) - (float)(NativeLayout.FieldInsetX * scale)); - var top = (band.Top * ch) + (float)(NativeLayout.FieldOuter * scale); - var bottom = ((band.Top + band.Rows) * ch) + (float)((NativeLayout.FieldTop + NativeLayout.FieldInner) * scale); + // The mockup's 20 px from the grid's edge, as far as the padding columns leave the field its inner padding; every + // edge on a whole device pixel, so the field's 1 px border is one crisp pixel at 125% and 150%. + var inset = MathF.Round(Math.Max(4 * scale, Math.Min((float)(NativeLayout.FieldSide * scale), (band.Pad * cw) - (float)(NativeTokens.Space8 * scale)))); + var top = (band.Top * ch) + MathF.Round((float)(NativeLayout.FieldOuter * scale)); + var bottom = ((band.Top + band.Rows) * ch) + MathF.Round((float)((NativeLayout.FieldTop + NativeLayout.FieldInner) * scale)); return new SKRect(inset, top, (columns * cw) - inset, bottom); } diff --git a/src/SharpMUTerm.Avalonia/ThemeCardView.cs b/src/SharpMUTerm.Avalonia/ThemeCardView.cs index 462e226a..75ab6610 100644 --- a/src/SharpMUTerm.Avalonia/ThemeCardView.cs +++ b/src/SharpMUTerm.Avalonia/ThemeCardView.cs @@ -28,14 +28,14 @@ public ThemeCardView(ThemeCard card, bool inUse, NativeTokens tokens) Background = Brushes.Transparent; BorderThickness = new Thickness(0); HorizontalContentAlignment = HorizontalAlignment.Stretch; - Margin = new Thickness(0, 0, 14, 14); + Margin = new Thickness(0, 0, NativeTokens.Space14, NativeTokens.Space14); Width = 264; AutomationProperties.SetName(this, $"Use the {card.Name} theme"); ToolTip.SetTip(this, $"Use {card.Name}"); var name = new TextBlock { Text = card.Name, FontSize = NativeTokens.Title, FontWeight = FontWeight.SemiBold }; _state = new TextBlock { FontSize = NativeTokens.Body }; - var words = new StackPanel { Margin = new Thickness(10, 8, 10, 8), Spacing = 1 }; + var words = new StackPanel { Margin = new Thickness(NativeTokens.Space10, NativeTokens.Space8, NativeTokens.Space10, NativeTokens.Space8), Spacing = NativeTokens.Hairline }; words.Children.Add(name); words.Children.Add(_state); @@ -48,7 +48,7 @@ public ThemeCardView(ThemeCard card, bool inUse, NativeTokens tokens) Child = body, CornerRadius = new CornerRadius(NativeTokens.RadiusCard), ClipToBounds = true, - BorderThickness = new Thickness(2), + BorderThickness = new Thickness(NativeTokens.BorderStrong), }; Content = _frame; SetInUse(inUse, tokens); @@ -90,23 +90,23 @@ private static Border Preview(ThemePreview preview) } var line = preview.CommandLine; - var command = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Miniature, Padding = new Thickness(4, 2), TextTrimming = TextTrimming.CharacterEllipsis }; + var command = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Miniature, Padding = new Thickness(NativeTokens.Space4, NativeTokens.Space2), TextTrimming = TextTrimming.CharacterEllipsis }; command.Inlines!.Add(new Run(line.Prompt + " ") { Foreground = Brush(line.PromptInk), FontWeight = FontWeight.Bold }); command.Inlines.Add(new Run(line.Text) { Foreground = Brush(line.Ink) }); - var stack = new StackPanel { Spacing = 3 }; + var stack = new StackPanel { Spacing = NativeTokens.Space4 }; stack.Children.Add(panes); stack.Children.Add(new Border { Background = Brush(line.Band), Child = command }); - return new Border { Background = Brush(preview.Backdrop), Padding = new Thickness(3), Child = stack }; + return new Border { Background = Brush(preview.Backdrop), Padding = new Thickness(NativeTokens.Space4), Child = stack }; } private static Border Pane(PreviewPane pane) { - var tabs = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 1 }; + var tabs = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Hairline }; foreach (var tab in pane.Tabs) { - var title = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Miniature, Padding = new Thickness(3, 1) }; + var title = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Miniature, Padding = new Thickness(NativeTokens.Space4, NativeTokens.Hairline) }; title.Inlines!.Add(new Run(tab.Title) { Foreground = Brush(tab.Ink), FontWeight = tab.Selected ? FontWeight.Bold : FontWeight.Normal }); if (tab.Badge is { } badge) { @@ -116,7 +116,7 @@ private static Border Pane(PreviewPane pane) tabs.Children.Add(new Border { Background = Brush(tab.Chip), Child = title }); } - var lines = new StackPanel { Margin = new Thickness(4, 3, 4, 4) }; + var lines = new StackPanel { Margin = new Thickness(NativeTokens.Space4, NativeTokens.Space4, NativeTokens.Space4, NativeTokens.Space4) }; foreach (var runs in pane.Lines) { var text = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Miniature, TextTrimming = TextTrimming.CharacterEllipsis }; diff --git a/src/SharpMUTerm.Avalonia/VitalsGauges.cs b/src/SharpMUTerm.Avalonia/VitalsGauges.cs index a6664235..16dbff45 100644 --- a/src/SharpMUTerm.Avalonia/VitalsGauges.cs +++ b/src/SharpMUTerm.Avalonia/VitalsGauges.cs @@ -119,7 +119,7 @@ private void RenderStacked(DrawingContext context, Rect bounds) var barHeight = BarHeight(_cellHeight); var size = Math.Min(PanelText.Size - 1, Math.Max(10, _cellHeight * 0.68)); var top = HeadedFor(bounds.Height, _model) - ? PanelText.Heading(context, PanelHeading.For(_model), bounds.Width, _cellHeight, _plane, _text, right: 20) + 12 + ? PanelText.Heading(context, PanelHeading.For(_model), bounds.Width, _cellHeight, _plane, _text, right: NativeTokens.Space20, rule: NativeTokens.DevicePixel(this)) + 12 : 8; var inner = new Rect(PanelText.Pad, top, Math.Max(1, bounds.Width - (PanelText.Pad * 2)), Math.Max(1, bounds.Height - top)); var dim = PanelText.Dim(_text, _plane); @@ -158,7 +158,7 @@ private void RenderRow(DrawingContext context, Rect bounds) { var size = Math.Clamp(_cellHeight * 0.62, 9, 14); var barHeight = Math.Clamp(bounds.Height * 0.32, 4, 9); - var inner = bounds.Deflate(new Thickness(10, 0, 30, 0)); + var inner = bounds.Deflate(new Thickness(PanelText.Pad, 0, NativeTokens.Space32, 0)); var gap = 18.0; var shares = _model.Meters.Count + (_model.Target is null ? 0 : 1.4); var unit = (inner.Width - (gap * Math.Max(0, Math.Ceiling(shares) - 1))) / shares; diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index 42932243..af5ac914 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -40,7 +40,7 @@ internal sealed class WelcomeView : DockPanel, IModalView private readonly TextBlock _command; private readonly TextBlock _problem; private readonly TextBox _search; - private readonly StackPanel _findBody = new() { Spacing = 8 }; + private readonly StackPanel _findBody = new() { Spacing = NativeTokens.Space8 }; private readonly TextBlock _findNote; private readonly TextBlock _layoutTag; private readonly TextBlock _layoutReason; @@ -61,7 +61,7 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) _done = done; _model = session.Model; - var page = new StackPanel { Margin = new Thickness(32, 28, 32, 24), Spacing = 0 }; + var page = new StackPanel { Margin = new Thickness(NativeTokens.Space32, NativeTokens.Space28, NativeTokens.Space32, NativeTokens.Space24), Spacing = 0 }; page.Children.Add(new TextBlock { Text = WelcomeModel.Heading, @@ -75,7 +75,7 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) FontSize = NativeTokens.Title, Foreground = colours.Brush(colours.Dim), TextWrapping = TextWrapping.Wrap, - Margin = new Thickness(0, 6, 0, 22), + Margin = new Thickness(0, NativeTokens.Space6, 0, NativeTokens.Space24), }); // ── Find a world ─────────────────────────────────────────────────────────────────────── @@ -83,14 +83,16 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) { PlaceholderText = WelcomeModel.FindPlaceholder, FontSize = NativeTokens.Title, - Padding = new Thickness(12, 8), + Padding = new Thickness(NativeTokens.Space12, 0), + Height = NativeTokens.FieldHeight, + VerticalContentAlignment = VerticalAlignment.Center, CornerRadius = new CornerRadius(NativeTokens.RadiusM), MaxLength = WorldDirectory.MaxQuery, }; global::Avalonia.Automation.AutomationProperties.SetName(_search, WelcomeModel.FindHeading); _search.TextChanged += (_, _) => DrawRows(); _findNote = new TextBlock { FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), TextWrapping = TextWrapping.Wrap }; - var find = new StackPanel { Spacing = 12 }; + var find = new StackPanel { Spacing = NativeTokens.Space12 }; find.Children.Add(CardTitle(WelcomeModel.FindHeading)); find.Children.Add(_search); find.Children.Add(_findBody); @@ -124,10 +126,11 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) var connectButton = ModalParts.Button("Connect", null, colours, Connect, accent: true); connectButton.HorizontalAlignment = HorizontalAlignment.Stretch; connectButton.HorizontalContentAlignment = HorizontalAlignment.Center; - connectButton.Padding = new Thickness(14, 8); + connectButton.Padding = new Thickness(NativeTokens.Space14, 0); + connectButton.Height = NativeTokens.FieldHeight; // the fields' height above it, as the mockup's primary button connectButton.Name = "Connect"; - var connect = new StackPanel { Spacing = 10 }; + var connect = new StackPanel { Spacing = NativeTokens.Space10 }; connect.Children.Add(CardTitle(WelcomeModel.ConnectHeading)); connect.Children.Add(Labelled(WelcomeModel.FieldLabel(WelcomeField.Host), _host)); connect.Children.Add(portAndName); @@ -147,7 +150,7 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) page.Children.Add(cards); // ── Starting layout ──────────────────────────────────────────────────────────────────── - var layoutHeading = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, Margin = new Thickness(0, 26, 0, 10) }; + var layoutHeading = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space10, Margin = new Thickness(0, NativeTokens.Space24, 0, NativeTokens.Space10) }; layoutHeading.Children.Add(new TextBlock { Text = WelcomeModel.LayoutsHeading, @@ -184,22 +187,22 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), TextWrapping = TextWrapping.Wrap, - Margin = new Thickness(0, 10, 0, 0), + Margin = new Thickness(0, NativeTokens.Space10, 0, 0), }; page.Children.Add(_layoutReason); // ── The other ways in ───────────────────────────────────────────────────────────────── - var others = new WrapPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 18, 0, 0) }; + var others = new WrapPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, NativeTokens.Space16, 0, 0) }; others.Children.Add(new TextBlock { Text = WelcomeModel.OtherWays, FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), VerticalAlignment = VerticalAlignment.Center, - Margin = new Thickness(0, 0, 10, 0), + Margin = new Thickness(0, 0, NativeTokens.Space10, 0), }); var settings = ModalParts.Button("Open settings", "F5", colours, () => Choose(WelcomeChoice.Settings)); - settings.Margin = new Thickness(0, 0, 8, 0); + settings.Margin = new Thickness(0, 0, NativeTokens.Space8, 0); others.Children.Add(settings); others.Children.Add(ModalParts.Button("Import…", null, colours, () => Choose(WelcomeChoice.Import))); page.Children.Add(others); @@ -400,8 +403,10 @@ private void Fill(WelcomeModel model) { var chosen = layout == model.Layout; card.BorderBrush = _colours.Brush(chosen ? _colours.Accent : _colours.Edge); - card.BorderThickness = new Thickness(chosen ? 2 : 1); - card.Padding = chosen ? new Thickness(17, 13) : new Thickness(18, 14); + card.BorderThickness = new Thickness(chosen ? NativeTokens.BorderStrong : NativeTokens.Hairline); + card.Padding = chosen + ? new Thickness(NativeTokens.Space16 - NativeTokens.Hairline, NativeTokens.Space12 - NativeTokens.Hairline) + : new Thickness(NativeTokens.Space16, NativeTokens.Space12); card.Background = _colours.Brush(chosen ? _colours.Selected : _colours.Card); } @@ -481,7 +486,7 @@ private void DrawRows() var query = _search.Text ?? string.Empty; var shown = model.View(query, WorldDirectorySort.Players); - var list = new StackPanel { Spacing = 8 }; + var list = new StackPanel { Spacing = NativeTokens.Space8 }; foreach (var world in shown) { var index = IndexOf(model, world); @@ -547,7 +552,7 @@ private void DrawChoice(WorldBrowseModel model, WorldGame game) TextWrapping = TextWrapping.Wrap, }); - var list = new StackPanel { Spacing = 2 }; + var list = new StackPanel { Spacing = NativeTokens.Space2 }; _address = Math.Clamp(_address, 0, game.Endpoints.Count - 1); for (var i = 0; i < game.Endpoints.Count; i++) { @@ -562,7 +567,7 @@ private void DrawChoice(WorldBrowseModel model, WorldGame game) FontSize = NativeTokens.Body + 1, Foreground = _colours.Brush(_colours.Text), Width = 210, - Margin = new Thickness(0, 0, 10, 0), + Margin = new Thickness(0, 0, NativeTokens.Space10, 0), TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center, }; @@ -675,21 +680,21 @@ private Border WorldRow(WorldListing world, int index, bool enabled) var add = ModalParts.Button(WelcomeModel.AddButton, null, _colours, () => Add(index), accent: index == 0); add.IsEnabled = enabled; - add.Padding = new Thickness(14, 4); + add.Padding = new Thickness(NativeTokens.Space14, NativeTokens.Space4); add.VerticalAlignment = VerticalAlignment.Center; global::Avalonia.Automation.AutomationProperties.SetName(add, $"{WelcomeModel.AddButton} {world.Name}"); var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") }; Grid.SetColumn(add, 1); - add.Margin = new Thickness(12, 0, 0, 0); + add.Margin = new Thickness(NativeTokens.Space12, 0, 0, 0); grid.Children.Add(words); grid.Children.Add(add); var row = new Border { Child = grid, - Padding = new Thickness(14, 9), + Padding = new Thickness(NativeTokens.Space14, NativeTokens.Space8), CornerRadius = new CornerRadius(NativeTokens.RadiusM), - BorderThickness = new Thickness(1), + BorderThickness = new Thickness(NativeTokens.Hairline), BorderBrush = _colours.Brush(_colours.Edge), Background = _colours.Brush(index == 0 ? _colours.Selected : _colours.Card), }; @@ -700,7 +705,7 @@ private Border WorldRow(WorldListing world, int index, bool enabled) private Border LayoutCard(WelcomeLayout layout) { - var words = new StackPanel { Spacing = 4 }; + var words = new StackPanel { Spacing = NativeTokens.Space4 }; words.Children.Add(new TextBlock { Text = layout.ToString(), @@ -749,16 +754,16 @@ public void PickLayout(WelcomeLayout layout) => private Border Card(Control content) => new() { Child = content, - Padding = new Thickness(22, 20), + Padding = new Thickness(NativeTokens.Space24, NativeTokens.Space20), CornerRadius = new CornerRadius(NativeTokens.RadiusL), - BorderThickness = new Thickness(1), + BorderThickness = new Thickness(NativeTokens.Hairline), BorderBrush = _colours.Brush(_colours.Edge), Background = _colours.Brush(_colours.Raised), }; private StackPanel Labelled(string label, Control field) { - var column = new StackPanel { Spacing = 4 }; + var column = new StackPanel { Spacing = NativeTokens.Space4 }; column.Children.Add(new TextBlock { Text = label, FontSize = NativeTokens.Body + 1, Foreground = _colours.Brush(_colours.Dim) }); column.Children.Add(field); return column; @@ -771,7 +776,9 @@ private static TextBox Field(string name, string placeholder, int max) PlaceholderText = placeholder, MaxLength = max, FontSize = NativeTokens.Title, - Padding = new Thickness(10, 7), + Padding = new Thickness(NativeTokens.Space10, 0), + Height = NativeTokens.FieldHeight, + VerticalContentAlignment = VerticalAlignment.Center, CornerRadius = new CornerRadius(NativeTokens.RadiusM), }; global::Avalonia.Automation.AutomationProperties.SetName(box, name); diff --git a/src/SharpMUTerm.Avalonia/WhoHereList.cs b/src/SharpMUTerm.Avalonia/WhoHereList.cs index 9def950d..1e0548ec 100644 --- a/src/SharpMUTerm.Avalonia/WhoHereList.cs +++ b/src/SharpMUTerm.Avalonia/WhoHereList.cs @@ -102,13 +102,13 @@ public void Show(WhoHereModel model, PanelInk ink, Color plane, Color text, doub private double HeaderHeight => PanelText.HeadingHeight(_cellHeight); - private double RowHeight => Math.Max(24, _cellHeight * 1.6); + private double RowHeight => Math.Round(Math.Max(NativeTokens.Space24, _cellHeight * 1.6)); /// The footnote's line, under the rows when there is room left for it. private double NoteHeight => Math.Max(20, _cellHeight * 1.3); /// How far the rows' hover plates are set in from the edges; the text inside sits on the heading's padding. - private const double Pad = 8; + private const double Pad = NativeTokens.Space8; /// Which rows fit, and where, for a size. Every row is the same height, so it is arithmetic. private void Layout(Size size) @@ -128,7 +128,7 @@ private void Layout(Size size) return; } - var top = HeaderHeight + 4; + var top = HeaderHeight + NativeTokens.Space8; var room = Math.Max(0, (int)((size.Height - top - 4) / RowHeight)); var fits = count <= room ? count : Math.Max(0, room - 1); for (var i = 0; i < fits; i++) @@ -259,7 +259,7 @@ public override void Render(DrawingContext context) var right = bounds.Width - PanelText.Pad; // Here The Grand Plaza · 4, kept clear of the pop-out button in the corner. - var top = PanelText.Heading(context, PanelHeading.For(_model), bounds.Width, _cellHeight, _plane, _text, right: 20); + var top = PanelText.Heading(context, PanelHeading.For(_model), bounds.Width, _cellHeight, _plane, _text, right: NativeTokens.Space20, rule: NativeTokens.DevicePixel(this)); if (!_model.Known) { PanelText.Draw(context, WhoHereModel.UnknownText, left, top + (RowHeight / 2), size, dim, false, right - left); @@ -280,7 +280,7 @@ public override void Render(DrawingContext context) if (index == _hovered || index == _pressed) { var plate = PanelText.Mix(_plane, _text, index == _pressed ? 0.16 : 0.08); - context.DrawRectangle(new SolidColorBrush(plate), null, rect, NativeTokens.RadiusS + 2, NativeTokens.RadiusS + 2); + context.DrawRectangle(new SolidColorBrush(plate), null, rect, NativeTokens.RadiusControl, NativeTokens.RadiusControl); } // The dot says what the game says: a creature grey, an idle player in the warning ink, an active one in the diff --git a/src/SharpMUTerm.Avalonia/WorldBrowseView.cs b/src/SharpMUTerm.Avalonia/WorldBrowseView.cs index 555c21c4..3bd8b4f1 100644 --- a/src/SharpMUTerm.Avalonia/WorldBrowseView.cs +++ b/src/SharpMUTerm.Avalonia/WorldBrowseView.cs @@ -56,7 +56,7 @@ public WorldBrowseView(WorldBrowseSession session, NativeTokens colours, Action SetDock(_box, Dock.Top); Children.Add(_box); - var bar = _bar = new DockPanel { Margin = new Thickness(20, 0, 14, 4) }; + var bar = _bar = new DockPanel { Margin = new Thickness(NativeTokens.Space20, 0, NativeTokens.Space14, NativeTokens.Space4) }; _sort = ModalParts.Button(SortLabel(), "Tab", colours, ToggleSort); SetDock(_sort, Dock.Right); bar.Children.Add(_sort); @@ -70,7 +70,7 @@ public WorldBrowseView(WorldBrowseSession session, NativeTokens colours, Action SetDock(footer, Dock.Bottom); Children.Add(footer); - _note = ModalParts.Dim(string.Empty, colours, new Thickness(20, 6, 20, 0)); + _note = ModalParts.Dim(string.Empty, colours, new Thickness(NativeTokens.Space20, NativeTokens.Space6, NativeTokens.Space20, 0)); SetDock(_note, Dock.Bottom); Children.Add(_note); @@ -208,7 +208,7 @@ private void ShowChoice(WorldGame game) Foreground = _colours.Brush(_colours.Text), FontSize = NativeTokens.Title, FontWeight = FontWeight.SemiBold, - Margin = new Thickness(12, 8, 12, 2), + Margin = new Thickness(NativeTokens.Space12, NativeTokens.Space8, NativeTokens.Space12, NativeTokens.Space2), TextWrapping = TextWrapping.Wrap, }); _list.Children.Add(new TextBlock @@ -216,7 +216,7 @@ private void ShowChoice(WorldGame game) Text = _model.CharsetLine, Foreground = _colours.Brush(_colours.Dim), FontSize = NativeTokens.Body, - Margin = new Thickness(12, 0, 12, 8), + Margin = new Thickness(NativeTokens.Space12, 0, NativeTokens.Space12, NativeTokens.Space8), TextWrapping = TextWrapping.Wrap, }); _selected = Math.Clamp(_selected, 0, game.Endpoints.Count - 1); @@ -232,7 +232,7 @@ private void ShowChoice(WorldGame game) Foreground = _colours.Brush(_colours.Text), FontSize = NativeTokens.Title, Width = 300, - Margin = new Thickness(0, 0, 12, 0), + Margin = new Thickness(0, 0, NativeTokens.Space12, 0), TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center, }; @@ -298,7 +298,7 @@ _model.Opening is not null ? _model.OpeningLine Text = NativeKeys.Words(empty), Foreground = _colours.Brush(_model.State is WorldBrowseState.Failed or WorldBrowseState.Unavailable ? _colours.Warn : _colours.Dim), FontSize = NativeTokens.Body, - Margin = new Thickness(12, 10), + Margin = new Thickness(NativeTokens.Space12, NativeTokens.Space10), TextWrapping = TextWrapping.Wrap, }); return; @@ -317,7 +317,7 @@ _model.Opening is not null ? _model.OpeningLine FontWeight = FontWeight.SemiBold, Width = 48, TextAlignment = TextAlignment.Right, - Margin = new Thickness(0, 0, 14, 0), + Margin = new Thickness(0, 0, NativeTokens.Space14, 0), VerticalAlignment = VerticalAlignment.Center, }; SetDock(players, Dock.Left); @@ -329,7 +329,7 @@ _model.Opening is not null ? _model.OpeningLine Foreground = _colours.Brush(_colours.Text), FontSize = NativeTokens.Title, Width = 220, - Margin = new Thickness(0, 0, 12, 0), + Margin = new Thickness(0, 0, NativeTokens.Space12, 0), TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center, }; @@ -342,7 +342,7 @@ _model.Opening is not null ? _model.OpeningLine Foreground = _colours.Brush(_colours.Dim), FontSize = NativeTokens.Small, Width = 96, - Margin = new Thickness(0, 0, 12, 0), + Margin = new Thickness(0, 0, NativeTokens.Space12, 0), TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center, }; diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 37982c3f..5f07cce8 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -326,9 +326,10 @@ internal static ClientHost HarnessTerminal( /// host has the depth a desktop tab wants; the pane rectangles, and so NAWS, are the panes less those two rows. /// /// -/// The client leaves one blank column of the pane's own plane either side of every pane's content (the tab control's -/// margin), so output does not run flush against the pane's edge. The columns are cells the pane really loses: the -/// output rectangles, and so NAWS, are the narrower ones. +/// The client leaves two blank columns of the pane's own plane either side of every pane's content (the tab control's +/// margin) and a blank row above an output window's first line (not above a panel or a map, which the host draws over +/// the whole pane), so output starts the mockup's ~20 px in from the pane's edges. The cells are ones the pane really +/// loses: the output rectangles, and so NAWS, are the smaller ones. /// internal sealed record HostChrome(bool Header, bool Rail, bool Status = false, bool Input = false, bool Tabs = false, bool PaneGutter = false) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 23c9f1e8..65a5e984 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -11574,8 +11574,18 @@ private IWindowControl BuildLayoutNode(SharpMUTerm.Core.Workspaces.LayoutNode no /// private int TabStripRows => Host.Chrome.Tabs ? 2 : 1; - /// The blank columns either side of a pane's content where the host asks for a gutter (). - private const int PaneGutterColumns = 1; + /// + /// The blank columns either side of a pane's content where the host asks for a gutter (): + /// two, so output starts the mockup's ~20 px in from the pane's edge rather than one cell's 8. + /// + private const int PaneGutterColumns = 2; + + /// + /// The blank row above an output window's first line where the host asks for a gutter: the mockup's padding under the + /// tab strip. None for a layout panel or a map, which the host draws natively over the whole pane. + /// + private int PaneGutterRowsFor(string? windowId) => + Host.Chrome.PaneGutter && windowId is not null && PanelIdOfWindow(windowId) is null && !IsMapWindow(windowId) ? 1 : 0; /// The layout panel a window draws, or null for an ordinary window. private static string? PanelIdOfWindow(string windowId) => @@ -11639,7 +11649,15 @@ private IWindowControl BuildPaneTabs(PaneNode pane) for (var i = 0; i < strip.Tabs.Count; i++) { var windowId = strip.Tabs[i].WindowId; - builder.AddTab(titles[i], BuildTabContent(pane, windowId, _workspace.FindWindow(windowId)!)); + var content = BuildTabContent(pane, windowId, _workspace.FindWindow(windowId)!); + if (Host.Chrome.PaneGutter) + { + // The gutter's row under the strip, for output only: a panel or a map is drawn natively over its pane and + // pads itself. Set every time, because a window's control is kept and re-parented across rebuilds. + content.Margin = new Margin(0, PaneGutterRowsFor(windowId), 0, 0); + } + + builder.AddTab(titles[i], content); ids.Add(windowId); } @@ -13208,7 +13226,7 @@ internal IReadOnlyDictionary PaneOutputRects() foreach (var (paneId, tabs, rect) in RealisedPanes()) { var margin = tabs.Margin; - var top = margin.Top + tabs.TabHeaderHeight; + var top = margin.Top + tabs.TabHeaderHeight + PaneGutterRowsFor(_workspace.Layout.FindPane(paneId)?.ActiveTab); rects[paneId] = new PaneRect( rect.X + margin.Left, rect.Y + top, diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs index 7425aae7..f3e192d5 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -42,7 +42,7 @@ public async Task TheClientPublishesTheVitalsPaneWithTheModelItsCellStripIsDrawn var panel = driver.Pointer.Panels.SingleOrDefault(p => p.PanelId == PanelIds.Vitals); await Assert.That(panel).IsNotNull(); var pane = app.PaneOutputRects().Single(r => app.PaneWindows().GetValueOrDefault(r.Key) == panel!.WindowId); - await Assert.That(panel!.Rect).IsEqualTo(pane.Value with { X = pane.Value.X - 1, Width = pane.Value.Width + 2 }).Because("the overlay goes exactly where the strip's cells are, and over the gutter either side"); + await Assert.That(panel!.Rect).IsEqualTo(pane.Value with { X = pane.Value.X - 2, Width = pane.Value.Width + 4 }).Because("the overlay goes exactly where the strip's cells are, and over the two-column gutter either side"); await Assert.That(panel.Vitals).IsEqualTo(app.ReadVitals(DemoScene.ActiveSessionKey)); await Assert.That(panel.Vitals!.Meters.Count).IsGreaterThan(0); await Assert.That(driver.Pointer.Actions.Select(a => a.Id)).Contains(HeaderAction.LayoutsId); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs index 2be79adf..4dcebd91 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeChromeTests.cs @@ -400,7 +400,7 @@ public async Task TheLiveClientDrawsNoChromeCellAndLaysThePanesOutAsATerminalTol await Assert.That(Enumerable.Range(0, 32).Any(y => driver.Frame.RowText(y).Contains("muterm", StringComparison.Ordinal))).IsFalse() .Because("the cell header is not drawn when the window draws its own"); var rects = window.PaneOutputRects(); - await Assert.That(rects.Values.Min(r => r.X)).IsEqualTo(1).Because("no rail column comes before the panes, only the pane's one-column gutter"); + await Assert.That(rects.Values.Min(r => r.X)).IsEqualTo(2).Because("no rail column comes before the panes, only the pane's two-column gutter"); await Assert.That(rects.OrderBy(r => r.Key).ToArray()).IsEquivalentTo(terminal.PaneOutputRects().OrderBy(r => r.Key).ToArray()); } diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs index e71bf418..ab6ddf0c 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs @@ -84,8 +84,14 @@ public async Task TheFieldIsInsetFromTheGridAndFramesTheBarsRows() var band = new InputBand(20, 2, InputLayout.HostFieldPad, [new InputPrompt(20, "Corvid ›")], "⏎ sends"); var rect = TerminalView.FieldRect(band, 10, 20, 80, 1f); - await Assert.That((double)rect.Left).IsEqualTo((3 * 10) - NativeLayout.FieldInsetX); - await Assert.That((double)rect.Right).IsEqualTo(800 - ((3 * 10) - NativeLayout.FieldInsetX)); + // The mockup's 20 px from the grid's edge, leaving the field its 8 px inner padding before the prompt's column. + await Assert.That((double)rect.Left).IsEqualTo(NativeLayout.FieldSide); + await Assert.That((double)rect.Right).IsEqualTo(800 - NativeLayout.FieldSide); + var tight = TerminalView.FieldRect(band, 8, 20, 80, 1f); + await Assert.That((double)tight.Left).IsEqualTo((3 * 8) - NativeTokens.Space8).Because("narrow cells keep the inner padding"); + var scaled = TerminalView.FieldRect(band, 13, 25, 80, 1.25f); + await Assert.That(scaled.Left % 1).IsEqualTo(0f).Because("a field edge on a whole device pixel at 125%"); + await Assert.That(scaled.Top % 1).IsEqualTo(0f); await Assert.That((double)rect.Top).IsEqualTo((20 * 20) + NativeLayout.FieldOuter); await Assert.That((double)rect.Bottom).IsEqualTo((22 * 20) + NativeLayout.FieldTop + NativeLayout.FieldInner); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs index ad728020..fe3d639f 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativePanelTests.cs @@ -52,7 +52,7 @@ public async Task TheClientPublishesWhoHereWithTheModelItsCellRowsAreDrawnFrom() var panel = driver.Pointer.Panels.SingleOrDefault(p => p.PanelId == PanelIds.WhoHere); await Assert.That(panel).IsNotNull(); var pane = app.PaneOutputRects().Single(r => app.PaneWindows().GetValueOrDefault(r.Key) == panel!.WindowId); - await Assert.That(panel!.Rect).IsEqualTo(pane.Value with { X = pane.Value.X - 1, Width = pane.Value.Width + 2 }).Because("a panel lies over its pane's output and the gutter either side"); + await Assert.That(panel!.Rect).IsEqualTo(pane.Value with { X = pane.Value.X - 2, Width = pane.Value.Width + 4 }).Because("a panel lies over its pane's output and the two-column gutter either side"); await Assert.That(panel.WhoHere).IsEqualTo(app.ReadWhoHere(DemoScene.ActiveSessionKey)); await Assert.That(panel.WhoHere!.Rows.Count).IsGreaterThan(0); await Assert.That(panel.Pick).IsNotNull(); @@ -76,7 +76,7 @@ public async Task TheClientPublishesTheQuickBarWithTheModelItsCellRowIsDrawnFrom var panel = driver.Pointer.Panels.SingleOrDefault(p => p.PanelId == PanelIds.QuickBar); await Assert.That(panel).IsNotNull(); var pane = app.PaneOutputRects().Single(r => app.PaneWindows().GetValueOrDefault(r.Key) == panel!.WindowId); - await Assert.That(panel!.Rect).IsEqualTo(pane.Value with { X = pane.Value.X - 1, Width = pane.Value.Width + 2 }).Because("a panel lies over its pane's output and the gutter either side"); + await Assert.That(panel!.Rect).IsEqualTo(pane.Value with { X = pane.Value.X - 2, Width = pane.Value.Width + 4 }).Because("a panel lies over its pane's output and the two-column gutter either side"); await Assert.That(panel.QuickBar).IsEqualTo(app.QuickBarEntries(DemoScene.ActiveSessionKey)); await Assert.That(panel.QuickBar!.Items.Select(i => i.Key).Take(2)).IsEquivalentTo(new[] { "F11", "F12" }); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs index 8b0e6b7e..ed759838 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeTokenTests.cs @@ -63,6 +63,74 @@ public async Task NoViewWritesALiteralFontSizeOrColour() await Assert.That(offenders).IsEmpty().Because(string.Join("\n", offenders)); } + /// + /// Files allowed a literal margin, padding or spacing, and why. Everything else takes its insets from the scale + /// (NativeTokens.Space*, PanelInset, ModalInset), so the native views share one set of insets. + /// + private static readonly Dictionary SpacingAllowed = new(StringComparer.Ordinal) + { + ["NativeTokens.cs"] = "the tokens themselves", + ["NativeTokens.Page.cs"] = "the tokens themselves", + ["NativeTokens.Spacing.cs"] = "the scale itself", + ["TerminalView.cs"] = "the cells' own view: its few insets are the grid's and the field's (NativeLayout), not a view's", + ["NativeFooter.cs"] = "the status footer, laid out from NativeLayout's footer constants in its own pass", + ["NoticeToasts.cs"] = "the toasts, laid out from their own card constants in their own pass", + }; + + [Test] + public async Task NoViewWritesALiteralMarginPaddingOrSpacing() + { + var root = Path.Combine(RepositoryRoot(), "src", "SharpMUTerm.Avalonia"); + var thickness = new Regex(@"new Thickness\(([^()]*)\)", RegexOptions.Compiled); + var literal = new Regex(@"(?(); + foreach (var file in Directory.EnumerateFiles(root, "*.cs", SearchOption.TopDirectoryOnly)) + { + if (SpacingAllowed.ContainsKey(Path.GetFileName(file))) + { + continue; + } + + var lines = File.ReadAllLines(file); + for (var i = 0; i < lines.Length; i++) + { + var line = lines[i].Trim(); + if (line.StartsWith("//", StringComparison.Ordinal)) + { + continue; + } + + if (spacing.IsMatch(line) || thickness.Matches(line).Any(m => literal.IsMatch(m.Groups[1].Value))) + { + offenders.Add($"{Path.GetFileName(file)}:{i + 1}: {line}"); + } + } + } + + await Assert.That(offenders).IsEmpty().Because(string.Join("\n", offenders)); + } + + [Test] + public async Task TheSpacingScaleAndTheChromeSizesAreWholeDevicePixelsAtWindowsScales() + { + // 4 logical pixels are whole device pixels at 100, 125, 150 and 200%, so a chrome size on that grid puts the cells + // on a device pixel at every scale Windows offers, and nothing placed from a cell origin lands on a blended row. + double[] chrome = [NativeLayout.HeaderHeight, NativeLayout.SidebarWidth, NativeLayout.SidebarSlim, NativeLayout.SidebarGutter, + NativeLayout.StatusHeight, NativeLayout.FieldStrip]; + foreach (var size in chrome) + { + await Assert.That(size % 4).IsEqualTo(0).Because($"{size} must be a multiple of 4"); + } + + double[] scale = [NativeTokens.Space2, NativeTokens.Space4, NativeTokens.Space6, NativeTokens.Space8, NativeTokens.Space10, + NativeTokens.Space12, NativeTokens.Space14, NativeTokens.Space16, NativeTokens.Space20, NativeTokens.Space24]; + foreach (var step in scale) + { + await Assert.That(step % 2).IsEqualTo(0).Because("no odd step: an odd logical pixel is half a device pixel at 150%"); + } + } + [Test] public async Task TheDarkAndLightThemesResolveToThePalettesOwnCards() { diff --git a/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs index 803e4ad2..b8cc9be4 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeTabStripTests.cs @@ -55,15 +55,16 @@ private static SharpMUTermApp App(HostChrome chrome, out string frame, string? v } [Test] - public async Task TheStripTakesTwoRowsAndTheGutterAColumnEachSideAndThePanesSayso() + public async Task TheStripTakesTwoRowsAndTheGutterTwoColumnsEachSideAndARowAndThePanesSayso() { // The same arrangement with the strips and the gutter left to the cells: a native strip is two rows where a cell - // strip is one, and the gutter is a column either side, and the output rectangles (NAWS) lose exactly those. + // strip is one, and the gutter is two columns either side and a row above output, and the output rectangles + // (NAWS) lose exactly those. await using var cells = App(HostChrome.Native with { Tabs = false, PaneGutter = false }, out _, "split"); await using var native = App(HostChrome.Native, out _, "split"); var expected = cells.PaneOutputRects().ToDictionary( - p => p.Key, p => new PaneRect(p.Value.X + 1, p.Value.Y + 1, p.Value.Width - 2, p.Value.Height - 1)); + p => p.Key, p => new PaneRect(p.Value.X + 2, p.Value.Y + 2, p.Value.Width - 4, p.Value.Height - 2)); await Assert.That(native.PaneOutputRects()).IsEquivalentTo(expected); await Assert.That(native.PaneChromePublished?.Strips.All(s => s.Row.Height == 2) ?? true).IsTrue(); } From 553d23050d0e764f74c78b157f7843e2153e69a6 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 19:30:54 +0000 Subject: [PATCH 076/113] Wave 21 C: the Dark theme is the mockups' navy; one selected sidebar row; plain tab names in a one-owner strip - ThemeLibrary.Dark retuned (background #222835, status #13161e, border #495573, prompt #3f61a3, ink #c8d0e0/#d7deec) so the derived planes land on the mockup in both hosts: pane #151921, focused #212835, backdrop #10131a, header #13161e, armed command line #233049, rules #2c3446. Light and Solarized Dark unchanged. - Dark's tints are laid over the old grey's hue (WorkspacePalette.TintGround) so tinted planes and the colour-vision floors are as before; ScreenTheme/NativeTokens treat Dark's background as their hue reference (nothing moved there). - Window: the command-line field's edge is the fill x1.6 on a dark fill (#3a4f73 on #233049); dark canon Rule is #2c3447. - SidebarModel.Plated / RailWindow.Own: one sidebar row wears a teal plate (the character while main is in front). - TabStripModel.OneOwner: a strip of one character's tabs drops the owner prefix (both hosts). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 8 +++ CLAUDE.md | 15 +++++ src/SharpMUTerm.Avalonia/NativeChrome.cs | 28 +++++++-- src/SharpMUTerm.Avalonia/NativeTokens.cs | 5 +- src/SharpMUTerm.Avalonia/TerminalView.cs | 19 +++++- src/SharpMUTerm.Client/Chrome/SidebarModel.cs | 18 ++++++ .../Chrome/TabStripModel.cs | 17 ++++++ src/SharpMUTerm.Core/Theming/ThemeLibrary.cs | 20 +++--- src/SharpMUTerm.Core/Workspaces/RailModel.cs | 3 +- src/SharpMUTerm.Tui/ScreenTheme.cs | 16 ++++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 5 +- src/SharpMUTerm.Tui/WorkspacePalette.cs | 28 +++++++-- .../SelectionAndTabNameTests.cs | 61 +++++++++++++++++++ .../WorkspacePaletteTests.cs | 13 ++-- 14 files changed, 226 insertions(+), 30 deletions(-) create mode 100644 tests/SharpMUTerm.Client.Tests/SelectionAndTabNameTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 91e3c37d..4fb56dc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -386,6 +386,14 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- The Dark theme is navy, as the mockups are, in the terminal and the window alike: deep blue panes with the focused + one a step lighter, the sidebar and status row on the darkest ground, a dark header with a hairline under it, a + command line on `#233049` with a blue edge, blue-grey rules and text. Light and Solarized Dark are unchanged, and + pane tints look as they did. +- The window's sidebar marks one row as selected, with a teal plate: the character, while their main window is in + front, or the other window that is. +- A tab strip whose tabs all belong to one character names them plainly (`Corvid`, `Chat 2`); the owner is still + written in a strip holding two characters' windows, and on a capture alone in its pane. - The desktop window lines up: one spacing scale for every native view, the header at the mockup's 44 px, output starting about 20 px in from its pane's edges with a row of space under the tab strip, the sidebar's names, the brand and every panel's heading, rows and buttons on one 16 px edge, the "+ Add a world or connect" button left-aligned, diff --git a/CLAUDE.md b/CLAUDE.md index d06a8f9c..f38e07fc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2828,6 +2828,21 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] used to be `#222226`. A light theme is left alone: darkening it makes a grey theme, and its focus step clamps at white either way. The cost is the pane-over-backdrop step, a ratio, which is fewer L* points a range lower (Dark 4.0 → 2.8); `EveryThemeGetsARaisedSurfaceOverARecessedBackdrop` now measures L*. + - **The built-in Dark theme is the mockups' navy, and its values were solved for, not picked** (`ThemeLibrary.Dark`, + wave 21C). Background `#222835`, StatusBackground `#13161e`, Border `#495573`, Prompt `#3f61a3`, so the derived planes + land on the mockup: pane `#151921`, focused `#212835`, backdrop `#10131a` (the ground), header `#13161e`, armed band + `#233049` (Prompt is whatever lean lands it there), idle band a step below, rule `#2c3446`. Three constraints bound the + choice and each is a test: the armed−idle luma step > 28 (`TheNewStepIsMoreThanTwice…`, which is why the header is so + dark), pane-over-backdrop > 2.5 L* (why the pane is not the mockup's darker `#12161f`), and the colour-vision floors + (why it is not bluer: a bluer untinted plane meets Azure under protanopia, a greyer one meets Rose under deuteranopia). + **Dark's tints are laid over the old grey's hue** (`WorkspacePalette.TintGround`, `#18181b`): the anchors were + searched against it, and a navy residual pulled Moss/Ochre and Teal/Jade under the floor; every other theme, and the + command line's hue-only tint, still uses its own plane. The settings screens and `NativeTokens` were already navy, so + their hue shift treats the Dark background as the reference (`ScreenTheme.ShiftedBackground`) and nothing moved there. + The window's field edge is its fill ×1.6 on a dark fill (`TerminalView.FieldEdge`: `#3a4f73` on `#233049`); the dark + canon's `Rule` is the mockup's `#2c3447`, which the pane hairlines read. A selected sidebar row is one row + (`SidebarModel.Plated`: the character while its own `main` is in front, else that window; `RailWindow.Own`), on a teal + plate. A strip whose tabs share one owner drops the owner prefix (`TabStripModel.OneOwner`, both hosts; a lone tab keeps it). - **A light theme's backdrop takes a shallower step** (`LightBackdropScale` 0.95, `Backdrop` only — `Recessed`, the chips' step, is unchanged): the dark ratio off a near-white surface put the rail and status row at mid-grey `#b7b7b9` (L* 75), which read as disabled. Light's backdrop is `#e6e6e9` now, about 4 L* under the panes. diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index 4a3af343..e5b3e900 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -234,6 +234,19 @@ protected Color Raised(double amount) return Color.FromRgb(Mix(Plane.R, target.R), Mix(Plane.G, target.G), Mix(Plane.B, target.B)); } + /// + /// The selection plate: the plane leaned toward the client's accent — about 14 % on a dark plane, the mockup's + /// #1f3a3a on #141822 — a little further while hovered. Ink on it is held to the floor by the caller's + /// own reads, and the lean is small enough that the plane's ink clears it. + /// + protected Color Plate(bool hovered) + { + var accent = Parse(Overlay?.Palette.Accent); + var amount = hovered ? 0.20 : 0.14; + byte Mix(byte a, byte b) => (byte)Math.Round(a + ((b - a) * amount)); + return Color.FromRgb(Mix(Plane.R, accent.R), Mix(Plane.G, accent.G), Mix(Plane.B, accent.B)); + } + /// The veil a modal in front lays over the chrome: drawn, readable, and plainly not the thing in use. protected void DrawVeil(DrawingContext context) { @@ -976,16 +989,21 @@ private void DrawRow(DrawingContext context, Row r, ChromeOverlay overlay, bool var middle = r.Area.Center.Y; var hovered = Hovered(r.Area.Intersect(_list)); - // Only the character in front wears the selected plate: its window in front is said by the accent mark beside - // the window's name, so the two rows do not read as two selections. - var selected = r.Kind == RailRowKind.Character && r.Character!.Active; + // One row wears the plate: the thing in front (SidebarModel.Plated), tinted with the client's accent as the + // mockup's selected row is (#1f3a3a on #141822). + var selected = r.Kind switch + { + RailRowKind.Character => overlay.Sidebar.Plated(r.Character!), + RailRowKind.Window => overlay.Sidebar.Plated(r.Window!), + _ => false, + }; if (focused) { context.DrawRectangle(new SolidColorBrush(Raised(0.14)), null, r.Area, 6, 6); } else if (selected || hovered) { - context.DrawRectangle(new SolidColorBrush(Raised(selected && hovered ? 0.16 : selected ? 0.11 : 0.07)), null, r.Area, 6, 6); + context.DrawRectangle(new SolidColorBrush(selected ? Plate(hovered) : Raised(0.07)), null, r.Area, 6, 6); } var accent = Accent(r.World.Accent); @@ -1006,7 +1024,7 @@ private void DrawRow(DrawingContext context, Row r, ChromeOverlay overlay, bool break; case RailRowKind.Window: - DrawWindow(context, r, r.Window!, accent, overlay.Sidebar.IsSelected(r.Window!), middle, right, size); + DrawWindow(context, r, r.Window!, accent, selected, middle, right, size); break; } } diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.cs b/src/SharpMUTerm.Avalonia/NativeTokens.cs index db7d9d20..91967511 100644 --- a/src/SharpMUTerm.Avalonia/NativeTokens.cs +++ b/src/SharpMUTerm.Avalonia/NativeTokens.cs @@ -149,7 +149,8 @@ public static NativeTokens For(Theme theme) var light = Contrast.RelativeLuminance(theme.Background) >= 0.18; var canon = light ? LightCanon : DarkCanon; var reference = light ? new Rgb(0xfa, 0xfa, 0xfa) : new Rgb(0x1e, 0x1e, 0x1e); - var shift = (theme.Background.R - reference.R, theme.Background.G - reference.G, theme.Background.B - reference.B); + var background = ScreenTheme.ShiftedBackground(theme); + var shift = (background.R - reference.R, background.G - reference.G, background.B - reference.B); var card = Shift(canon.Card, shift); var edge = Shift(canon.Edge, shift); @@ -309,7 +310,7 @@ private sealed record Canon( Color.FromArgb(0x73, 0, 0, 0), new Rgb(0x17, 0x1b, 0x24), new Rgb(0x2c, 0x34, 0x47), - new Rgb(0x26, 0x2d, 0x3d), + new Rgb(0x2c, 0x34, 0x47), new Rgb(0xd7, 0xde, 0xec), new Rgb(0x9a, 0xa4, 0xb8), new Rgb(0x8f, 0x99, 0xad), diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index e02d1e75..bed1147c 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -794,6 +794,23 @@ private static SolidColorBrush Brush(SKColor colour, byte alpha = 0xFF) => (byte)(from.Green + (to.Green - from.Green) * amount), (byte)(from.Blue + (to.Blue - from.Blue) * amount)); + /// + /// The command-line field's one-pixel edge for a field filled . On a dark fill it is the fill + /// lifted by the client's focus step (×1.6), which is how the mockup's #3a4f73 sits on its #233049 and + /// keeps a tinted band's hue; a light fill leans toward the ink instead, since a lift there clamps at white. + /// + internal static SKColor FieldEdge(SKColor fill, SKColor ink) + { + var luma = ((fill.Red * 299) + (fill.Green * 587) + (fill.Blue * 114)) / 1000; + if (luma >= 128) + { + return Mix(fill, ink, 0.22f); + } + + static byte Lift(byte c) => (byte)Math.Clamp(Math.Round(c * 1.6), 0, 255); + return new SKColor(Lift(fill.Red), Lift(fill.Green), Lift(fill.Blue)); + } + private void RepeatPress() { if (_mouse.Repeat() is { } repeat) @@ -1053,7 +1070,7 @@ private void RenderWithField(SKCanvas canvas, InputBand band) paint.Style = SKPaintStyle.Stroke; paint.StrokeWidth = Math.Max(1, s); - paint.Color = Mix(fill, renderer.DefaultForeground, 0.22f); + paint.Color = FieldEdge(fill, renderer.DefaultForeground); var edge = rounded; edge.Deflate(paint.StrokeWidth / 2, paint.StrokeWidth / 2); canvas.DrawRoundRect(edge, paint); diff --git a/src/SharpMUTerm.Client/Chrome/SidebarModel.cs b/src/SharpMUTerm.Client/Chrome/SidebarModel.cs index 8d464679..5388e27d 100644 --- a/src/SharpMUTerm.Client/Chrome/SidebarModel.cs +++ b/src/SharpMUTerm.Client/Chrome/SidebarModel.cs @@ -73,6 +73,24 @@ public IReadOnlyList NavigableRows() => /// Whether is the one in front of the focused pane. public bool IsSelected(RailWindow window) => string.Equals(window.Id, SelectedWindowId, StringComparison.Ordinal); + /// + /// Whether wears the selection plate — one row at most, the thing in front. While the active + /// character's own window (main) is in front that is the character's row, which already says it; any other + /// window in front wears it itself, and the character row then does not, so two rows never claim to be selected. + /// + public bool Plated(RailCharacter character) + { + ArgumentNullException.ThrowIfNull(character); + return character.Active && !character.Windows.Any(w => !w.Own && IsSelected(w)); + } + + /// + public bool Plated(RailWindow window) + { + ArgumentNullException.ThrowIfNull(window); + return !window.Own && IsSelected(window); + } + /// /// Every click target this model can emit, so a host's answer can be checked against what the client offered: a /// target that is not in this set did not come from the sidebar. diff --git a/src/SharpMUTerm.Client/Chrome/TabStripModel.cs b/src/SharpMUTerm.Client/Chrome/TabStripModel.cs index 79ad5ede..092a4e8a 100644 --- a/src/SharpMUTerm.Client/Chrome/TabStripModel.cs +++ b/src/SharpMUTerm.Client/Chrome/TabStripModel.cs @@ -50,6 +50,23 @@ public static TabChipModel From(WorkspaceWindow window, string? focusedCharacter /// public sealed record TabStripModel(string PaneId, bool Focused, IReadOnlyList Tabs) { + /// + /// A strip's tabs with the owner prefix dropped when every tab belongs to the same character: Corvid beside + /// Chat, as the mockup's strip reads, rather than Corvid · Chat, which says the owner the strip's other + /// tabs, its chip and its pane already say. A strip holding two characters' windows keeps the prefix on each, and so + /// does a capture alone in a pane (one tab), which is what keeps it traceable once dragged away from its character. + /// + public static IReadOnlyList OneOwner(IReadOnlyList tabs) + { + ArgumentNullException.ThrowIfNull(tabs); + if (tabs.Count < 2 || tabs[0].Owner is not { } owner || tabs.Any(t => !string.Equals(t.Owner, owner, StringComparison.Ordinal))) + { + return tabs; + } + + return [.. tabs.Select(t => t with { Name = t.Title })]; + } + /// The tab a click on names, or null when the strip does not hold it. public TabChipModel? Find(string windowId) => Tabs.FirstOrDefault(t => string.Equals(t.WindowId, windowId, StringComparison.Ordinal)); diff --git a/src/SharpMUTerm.Core/Theming/ThemeLibrary.cs b/src/SharpMUTerm.Core/Theming/ThemeLibrary.cs index 3359d4e6..4699e010 100644 --- a/src/SharpMUTerm.Core/Theming/ThemeLibrary.cs +++ b/src/SharpMUTerm.Core/Theming/ThemeLibrary.cs @@ -5,18 +5,24 @@ namespace SharpMUTerm.Core.Theming; /// Built-in themes and lookup by name (yazi-style named flavours). public static class ThemeLibrary { - /// The default dark theme. + /// + /// The default dark theme: the UX mockups' navy (ux-mockups/Main.dc.html). Its values are chosen so the planes + /// the workspace derives from them land on the mockup — a pane on #151921, focused #212835, the + /// backdrop #10131a (the ground), the header #13161e, the armed command line #233049, rules #2c3447, + /// ink #c8d0e0 and #d7deec. is the blue the armed band leans to, picked so + /// that lean lands on #233049. + /// public static Theme Dark() => new() { Name = "Dark", - Foreground = new Rgb(0xd0, 0xd0, 0xd0), - Background = new Rgb(0x1e, 0x1e, 0x1e), - StatusForeground = new Rgb(0xe0, 0xe0, 0xe0), - StatusBackground = new Rgb(0x2d, 0x2d, 0x3f), - Border = new Rgb(0x55, 0x55, 0x66), + Foreground = new Rgb(0xc8, 0xd0, 0xe0), + Background = new Rgb(0x22, 0x28, 0x35), + StatusForeground = new Rgb(0xd7, 0xde, 0xec), + StatusBackground = new Rgb(0x13, 0x16, 0x1e), + Border = new Rgb(0x49, 0x55, 0x73), SystemMessage = new Rgb(0x6a, 0x99, 0x55), LocalEcho = new Rgb(0xdc, 0xdc, 0xaa), - Prompt = new Rgb(0x56, 0x9c, 0xd6), + Prompt = new Rgb(0x3f, 0x61, 0xa3), }; /// A light theme for bright terminals. diff --git a/src/SharpMUTerm.Core/Workspaces/RailModel.cs b/src/SharpMUTerm.Core/Workspaces/RailModel.cs index c2d9c321..f0bd1fb8 100644 --- a/src/SharpMUTerm.Core/Workspaces/RailModel.cs +++ b/src/SharpMUTerm.Core/Workspaces/RailModel.cs @@ -90,7 +90,8 @@ public sealed record RailCharacter( /// that goes to that window, rather than to whatever else happens to share its pane. /// /// -public sealed record RailWindow(string Title, string Id, string? Chord, int Unread, bool HasUnsent, bool Closed); +/// Whether this is the character's own session window (the row labelled main). +public sealed record RailWindow(string Title, string Id, string? Chord, int Unread, bool HasUnsent, bool Closed, bool Own = false); /// /// Projects the worlds/characters/windows tree into a flat list of s for the diff --git a/src/SharpMUTerm.Tui/ScreenTheme.cs b/src/SharpMUTerm.Tui/ScreenTheme.cs index d2994382..c8c215ac 100644 --- a/src/SharpMUTerm.Tui/ScreenTheme.cs +++ b/src/SharpMUTerm.Tui/ScreenTheme.cs @@ -101,13 +101,27 @@ private ScreenTheme(IReadOnlyDictionary roles) private static readonly Rgb LightReference = new(0xfa, 0xfa, 0xfa); + /// + /// The background a theme's hue shift is measured from. The canonical sets (these roles, the window's + /// NativeTokens) are the mockups' navy and were laid onto a neutral #1e1e1e; the built-in Dark theme + /// is that navy now, so its own background counts as the reference and it shifts nothing, while every other + /// theme (Solarized Dark, a customised one) is shifted exactly as before. + /// + internal static Rgb ShiftedBackground(Theme theme) + { + ArgumentNullException.ThrowIfNull(theme); + return theme.Background == DarkBuiltIn ? DarkReference : theme.Background; + } + + private static readonly Rgb DarkBuiltIn = ThemeLibrary.Dark().Background; + /// The palette for . internal static ScreenTheme For(Theme theme) { ArgumentNullException.ThrowIfNull(theme); var light = Contrast.RelativeLuminance(theme.Background) >= LightPlaneLuminance; - var shift = Delta(theme.Background, light ? LightReference : DarkReference); + var shift = Delta(ShiftedBackground(theme), light ? LightReference : DarkReference); var roles = new Dictionary(StringComparer.OrdinalIgnoreCase); foreach (var plane in Planes) diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 65a5e984..d4ee5699 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -8514,7 +8514,8 @@ private IReadOnlyList BuildRailWindows( chords.GetValueOrDefault(window.Id), window.Unread, window.HasUnsentInput, - Closed: _workspace.Layout.FindWindow(window.Id) is null)); + Closed: _workspace.Layout.FindWindow(window.Id) is null, + Own: mine && window.Kind == WindowKind.Main)); } return windows; @@ -13795,7 +13796,7 @@ private TabStripModel StripModelFor(string paneId, IEnumerable windowIds } } - return new TabStripModel(paneId, IsFocusedPane(paneId), tabs); + return new TabStripModel(paneId, IsFocusedPane(paneId), TabStripModel.OneOwner(tabs)); } /// The plane each unselected tab of a pane is drawn on (), by its model. diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index f766d89c..62a3405b 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -113,26 +113,44 @@ internal static Rgb Surface(Theme theme) internal static Rgb Tint(Theme theme, PaneTint tint) { ArgumentNullException.ThrowIfNull(theme); - return Tinted(Surface(theme), tint, TintDepth); + return Tinted(Surface(theme), TintGround(theme), tint, TintDepth); } /// /// One plane wearing one character's colour: re-lit to of its own /// luminance, then mixed toward the tint's hue at that same luminance. The two callers pass /// different depths, which is the whole composition rule — a pane takes the step down, the command - /// line takes hue only. + /// line takes hue only. is the hue the tint is laid over + /// (); only its hue counts, since it is re-lit to the plane. /// - private static Rgb Tinted(Rgb plane, PaneTint tint, double depth) + private static Rgb Tinted(Rgb plane, Rgb? ground, PaneTint tint, double depth) { if (Anchor(tint) is not { } anchor) { return plane; } - var lit = AtLuma(plane, Luma(plane) * depth); + var lit = AtLuma(ground ?? plane, Luma(plane) * depth); return Mix(lit, AtLuma(anchor, Luma(lit)), TintStrength); } + /// + /// The hue a tint is laid over, when it is not the plane's own (null). The built-in Dark theme's planes are the + /// mockups' navy, and the ten anchors were picked against the near-neutral grey its surface used to be: laid over + /// navy, the residual blue drew the tints together for a dichromat (Moss and Ochre to 1.6 under protanopia, Teal + /// and Jade to 1.7 under deuteranopia, against a floor of 1.9). So on Dark a tinted plane keeps that grey's hue + /// (), at its own luminance as before — every tinted plane, and the step between them, + /// is what it was; only the untinted plane is navy. Every other theme lays its tints over its own plane, and so does + /// the command line on every theme: it takes hue only, and its band is not one of the ten-plus-one a reader compares. + /// + private static Rgb? TintGround(Theme theme) => + theme.Background == DarkBackground ? DarkTintGround : null; + + private static readonly Rgb DarkBackground = ThemeLibrary.Dark().Background; + + /// The Dark theme's surface before it was navy, whose hue its tints are laid over. + private static readonly Rgb DarkTintGround = new(0x18, 0x18, 0x1b); + /// /// How far below the untinted surface a tinted pane sits. Bounded from below by the focus step, /// arithmetically: a client may hold tinted and untinted characters at once, and a depth reaching @@ -227,7 +245,7 @@ private static Rgb AtLuma(Rgb rgb, double target) internal static Rgb IdleBand(Theme theme, PaneTint tint) { ArgumentNullException.ThrowIfNull(theme); - return Tinted(Scale(theme.StatusBackground, IdleBandScale), tint, depth: 1.0); + return Tinted(Scale(theme.StatusBackground, IdleBandScale), ground: null, tint, depth: 1.0); } /// diff --git a/tests/SharpMUTerm.Client.Tests/SelectionAndTabNameTests.cs b/tests/SharpMUTerm.Client.Tests/SelectionAndTabNameTests.cs new file mode 100644 index 00000000..d7c811cf --- /dev/null +++ b/tests/SharpMUTerm.Client.Tests/SelectionAndTabNameTests.cs @@ -0,0 +1,61 @@ +using SharpMUTerm.Client.Chrome; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Client.Tests; + +/// +/// One selected sidebar row (), and a strip of one character's tabs named +/// without the owner (). +/// +public class SelectionAndTabNameTests +{ + private static readonly RailWindow Main = new("main", "main:1", "⌥1", 0, false, false, Own: true); + private static readonly RailWindow Chat = new("Chat", "spawn:1", "⌥2", 2, false, false); + + private static (SidebarModel Model, RailCharacter Corvid) Sidebar(string selected) + { + var corvid = new RailCharacter("Corvid", "Aetherfall.Corvid", Connected: true, Active: true, Unread: 2, [Main, Chat]); + var world = new RailWorld("Aetherfall", "example", 4000, default, [corvid]); + return (new SidebarModel([world], selected, Collapsed: false), corvid); + } + + [Test] + public async Task WithTheMainWindowInFrontOnlyTheCharacterIsPlated() + { + var (model, corvid) = Sidebar(Main.Id); + + await Assert.That(model.Plated(corvid)).IsTrue(); + await Assert.That(model.Plated(Main)).IsFalse(); + await Assert.That(model.Plated(Chat)).IsFalse(); + } + + [Test] + public async Task WithAnotherWindowInFrontOnlyThatWindowIsPlated() + { + var (model, corvid) = Sidebar(Chat.Id); + + await Assert.That(model.Plated(corvid)).IsFalse(); + await Assert.That(model.Plated(Chat)).IsTrue(); + } + + private static TabChipModel Tab(string id, string name, string title, string? owner) => + new(id, name, title, Selected: false, Unread: 0, Draft: false, Foreign: false, Closable: false, owner); + + [Test] + public async Task OneOwnersStripDropsThePrefix() + { + var tabs = TabStripModel.OneOwner([Tab("m", "Corvid", "Corvid", "A.C"), Tab("c", "Corvid · Chat", "Chat", "A.C")]); + + await Assert.That(tabs.Select(t => t.Name)).IsEquivalentTo(["Corvid", "Chat"]); + } + + [Test] + public async Task TwoOwnersOrALoneTabKeepThePrefix() + { + var mixed = TabStripModel.OneOwner([Tab("c", "Corvid · Chat", "Chat", "A.C"), Tab("r", "Rookery · Chat", "Chat", "A.R")]); + var lone = TabStripModel.OneOwner([Tab("c", "Corvid · Chat", "Chat", "A.C")]); + + await Assert.That(mixed[0].Name).IsEqualTo("Corvid · Chat"); + await Assert.That(lone[0].Name).IsEqualTo("Corvid · Chat"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/WorkspacePaletteTests.cs b/tests/SharpMUTerm.Tui.Tests/WorkspacePaletteTests.cs index 85e1cc4f..e174e48b 100644 --- a/tests/SharpMUTerm.Tui.Tests/WorkspacePaletteTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/WorkspacePaletteTests.cs @@ -97,17 +97,18 @@ public async Task TheHairlineIsFoundAgainstBothPlanes(string themeName) [Test] public async Task TheSurfaceCarriesTheThemesOwnChromeTint() { - var theme = ThemeLibrary.Get("Dark"); // background #1e1e1e, status background #2d2d3f + var theme = ThemeLibrary.Get("Dark"); // background #222835, status background #13161e (the mockups' navy) var surface = WorkspacePalette.Surface(theme); // A quarter of the way from the text background toward the chrome the header and input bands // are already painted in — so the output plane belongs to this application, not to the terminal — - // and then darkened, which scales every channel and so keeps that hue. #222226 before the scale. - await Assert.That(surface.R).IsEqualTo((byte)0x18); - await Assert.That(surface.G).IsEqualTo((byte)0x18); - await Assert.That(surface.B).IsEqualTo((byte)0x1b); - await Assert.That(surface.B).IsGreaterThan(surface.R); // cooler than the plain background, which is neutral + // and then darkened, which scales every channel and so keeps that hue. #1e242f before the scale; + // #151921 after, the mockup's pane navy (Main.dc.html's #12161f, lifted to keep the tints apart). + await Assert.That(surface.R).IsEqualTo((byte)0x15); + await Assert.That(surface.G).IsEqualTo((byte)0x19); + await Assert.That(surface.B).IsEqualTo((byte)0x21); + await Assert.That(surface.B).IsGreaterThan(surface.R); // navy: bluer than it is red } [Test] From a419479b32f75402c5feec8cc2402fc66f139a05 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 19:38:12 +0000 Subject: [PATCH 077/113] Wave 21 D: the window's command line sits in the output's column HostChrome.InputInColumn (on in Desktop): the prompt row and both bars leave the window's sticky band and become Auto rows of a grid wrapped round one node of the pane tree (InputColumn.Target, anchored on the live layout's output pane, never focus), so the side column runs down to the status footer as in the mockups. InputBand carries Left/Columns; TerminalView draws the strip, field, row shift and press mapping only in those columns and carries panes and dividers beside it down through the field's padding. HostFieldPad 3 -> 4 for the mockup's 20 px inset. The terminal keeps the full-width band. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 3 + CLAUDE.md | 13 +- src/SharpMUTerm.Avalonia/TerminalView.cs | 110 +++++++++++----- src/SharpMUTerm.Core/Workspace/InputColumn.cs | 80 +++++++++++ src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 12 +- src/SharpMUTerm.Tui/InputLayout.cs | 2 +- .../Pointer/SharpMUTermApp.Footer.cs | 34 ++++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 124 +++++++++++++++--- .../NativeFooterTests.cs | 17 ++- .../Workspace/InputColumnTests.cs | 58 ++++++++ .../InputColumnLayoutTests.cs | 98 ++++++++++++++ 11 files changed, 491 insertions(+), 60 deletions(-) create mode 100644 src/SharpMUTerm.Core/Workspace/InputColumn.cs create mode 100644 tests/SharpMUTerm.Core.Tests/Workspace/InputColumnTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/InputColumnLayoutTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fb56dc6..2ea6a5a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -386,6 +386,9 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Changed +- In the desktop window the command line sits under the output column only, as wide as the text it sends to; the + side column (composer and who is here, or vitals and map) runs down to the status footer. The field is also a few + pixels further in from its edges, as the mockups draw it. The terminal is unchanged. - The Dark theme is navy, as the mockups are, in the terminal and the window alike: deep blue panes with the focused one a step lighter, the sidebar and status row on the darkest ground, a dark header with a hairline under it, a command line on `#233049` with a blue edge, blue-grey rules and text. Light and Solarized Dark are unchanged, and diff --git a/CLAUDE.md b/CLAUDE.md index f38e07fc..a4209e2e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1705,7 +1705,7 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw what the markup-first row wrote; there is no markup parser. The palette hint and a notice's action hints carry targets. `IPointerPresenter.Status`, published from `PaintStatus` and `PostBufferPaint`, only on change. A click is `ActivateStatusTarget`: refused unless offered, the palette through `OpenMenu`, an action through `RunNoticeAction`. With `Status` the row is `Visible = false` and `ChromeRows` counts none. Toasts sit above it. - - **The command line stays the cell editor; the host draws the field around it.** The bars get `HostFieldPad` (3) + - **The command line stays the cell editor; the host draws the field around it.** The bars get `HostFieldPad` (4) band-coloured columns either side (`InputBarControl.LeadingPad` + right margin), the client publishes an `InputBand` (rows, pad, prompts, hint) on `PostBufferPaint`, `Flush` snapshots it into the `ScreenFrame` it belongs to, and `TerminalView` draws the rows above it, the strip, a rounded field filled with the band colour read off the cells (so @@ -1717,6 +1717,17 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw narrower than its cells, so each bar's text is drawn `Shift` px left (to one mono space after the measured prompt), the caret with it, and `Cell` maps a press there back to the cell under it; the right padding the shift uncovers is the field's fill. The gutter, the caret's cell and every key are unchanged, so parity needs nothing. + - **In the window the command line is a row of the output's column** (`HostChrome.InputInColumn`, on in `Desktop`; + `InputColumn.Target`/`Anchor`, Core; `WithInputBars`/`DetachInputBars`). The prompt row and both bars leave the window's + sticky band and become Auto rows of a grid wrapped round one node of the pane tree, so the side column runs to the + status row as in the mockups. The node: from the root, into the anchor's child of a side-by-side split unless another + child holds a character's own window (two characters share the bars), into a stacked split only through its last child, + else that split (the output and its quick bar). The anchor is the live layout's output pane, else the first pane holding + a `Main` window — **never focus**, so moving the selection moves no pane (`InputColumnLayoutTests`). A rebuild takes the + bars out of the old grid before it is disposed. `InputBand` carries `Left`/`Columns`; the view draws the strip, the + field, the row shift and the press mapping only in those columns, and carries the panes and dividers beside it down + through the `FieldReserve` pixels. NAWS is the arranged rectangles. The terminal keeps the full-width band (`None`), + so its frames and the parity harness (which tells both hosts the same chrome) are unchanged. - **The window draws pane dividers as the panes meeting at a hairline** (`IPointerPresenter.Dividers`, `PaneDividerOverlay`, `DividersNow`; `ScreenFrame.Dividers`; `TerminalView.FrameDraw.DrawDividers`). The client publishes each divider control's cells and whether it is lit (never a tab strip standing in for one, nothing under a modal) on diff --git a/src/SharpMUTerm.Avalonia/TerminalView.cs b/src/SharpMUTerm.Avalonia/TerminalView.cs index bed1147c..8d239b21 100644 --- a/src/SharpMUTerm.Avalonia/TerminalView.cs +++ b/src/SharpMUTerm.Avalonia/TerminalView.cs @@ -138,11 +138,17 @@ public TerminalView(AvaloniaConsoleDriver driver, SKColor foreground, SKColor ba /// The vertical pixels the field takes beside the rows it frames: none unless the view draws it. private double FieldReserve => DrawsInputField ? NativeLayout.FieldReserve : 0; - /// The top of screen row in logical units: rows of a band sit lower by the field's top padding. - internal double RowTop(int row) + /// + /// The top of screen row at in logical units: rows of a band sit lower + /// by the field's top padding, in the columns the band spans (all of them, unless the bars are in the output's column). + /// + internal double RowTop(int row, int column) { var top = row * CellSize.Height; - return DrawsInputField && _driver.Frame.Band is { } band && row >= band.Top ? top + NativeLayout.FieldTop : top; + var frame = _driver.Frame; + return DrawsInputField && frame.Band is { } band && row >= band.Top && band.Spans(column, frame.Width) + ? top + NativeLayout.FieldTop + : top; } /// @@ -249,10 +255,10 @@ internal IReadOnlyList BarsOf(ScreenFrame frame, InputBand band) { var prompt = prompts[i]; var to = i + 1 < prompts.Count ? prompts[i + 1].Row : end; - var start = Math.Min(frame.Width, band.Pad + prompt.Text.Length); + var start = Math.Min(frame.Width, band.From + band.Pad + prompt.Text.Length); var trimmed = prompt.Text.TrimEnd(); var width = trimmed.Length == 0 ? 0 : PromptWidth(trimmed); - var room = (start - band.Pad) * cell.Width; + var room = (start - band.From - band.Pad) * cell.Width; var shift = trimmed.Length == 0 ? 0 : Math.Max(0, room - width - cell.Width); // Whole device pixels, so the glyphs land on the pixel grid the unshifted ones would. @@ -276,7 +282,7 @@ private void DrawHover(DrawingContext context) var cell = CellSize; var area = _target.Area; - var rect = new Rect(area.X * cell.Width, RowTop(area.Y), area.Width * cell.Width, area.Height * cell.Height); + var rect = new Rect(area.X * cell.Width, RowTop(area.Y, area.X), area.Width * cell.Width, area.Height * cell.Height); context.DrawRectangle(Brush(_renderer.DefaultForeground, 0x24), null, rect.Inflate(new Thickness(1, 0)), 2, 2); } @@ -831,7 +837,7 @@ private System.Drawing.Point Cell(Point position) var y = Math.Clamp((int)(position.Y / size.Height), 0, Math.Max(0, frame.Height - 1)); // Below the panes, the field: its padding is the band's first and last rows, and its rows sit lower. - if (DrawsInputField && frame.Band is { } band && position.Y >= band.Top * size.Height) + if (DrawsInputField && frame.Band is { } band && position.Y >= band.Top * size.Height && band.Spans(x, frame.Width)) { var inside = (position.Y - (band.Top * size.Height) - NativeLayout.FieldTop) / size.Height; y = Math.Clamp(band.Top + (int)Math.Floor(inside), band.Top, Math.Min(frame.Height, band.Top + band.Rows) - 1); @@ -926,7 +932,7 @@ private void DrawDividers(SKCanvas canvas) var y0 = Math.Max(0, divider.Area.Y); var x1 = Math.Min(frame.Width, divider.Area.X + divider.Area.Width); var y1 = Math.Min(frame.Height, divider.Area.Y + divider.Area.Height); - if (band is { } field) + if (band is { } field && field.Spans(x0, frame.Width)) { y1 = Math.Min(y1, field.Top); } @@ -942,16 +948,26 @@ private void DrawDividers(SKCanvas canvas) { float left = x0 * cw, right = x1 * cw; var at = MathF.Round(left + ((right - left - w) / 2)); + // Beside a band in the output's column the panes run on under the grid, through the field's padding. + var tail = band is { Columns: not null } inColumn && y1 == frame.Height && !inColumn.Spans(x0, frame.Width) + ? Math.Max(0, (float)(Bounds.Height * scale) - (y1 * ch)) + : 0; for (var y = y0; y < y1; y++) { - paint.Color = PlaneBeside(x0 - 1, y, -1, 0); - canvas.DrawRect(left, y * ch, at - left, ch, paint); - paint.Color = PlaneBeside(x1, y, 1, 0); - canvas.DrawRect(at + w, y * ch, right - at - w, ch, paint); + var h = y == y1 - 1 ? ch + tail : ch; + // A band's rows beside the divider are the field's strip, not the bar cells under it. + paint.Color = band is { } beside && y >= beside.Top && beside.Spans(x0 - 1, frame.Width) + ? plane + : PlaneBeside(x0 - 1, y, -1, 0); + canvas.DrawRect(left, y * ch, at - left, h, paint); + paint.Color = band is { } after && y >= after.Top && after.Spans(x1, frame.Width) + ? plane + : PlaneBeside(x1, y, 1, 0); + canvas.DrawRect(at + w, y * ch, right - at - w, h, paint); } paint.Color = colour; - canvas.DrawRect(at, y0 * ch, w, (y1 - y0) * ch, paint); + canvas.DrawRect(at, y0 * ch, w, ((y1 - y0) * ch) + tail, paint); } else { @@ -1015,18 +1031,38 @@ private void RenderWithField(SKCanvas canvas, InputBand band) var height = (float)(Bounds.Height * scale); var top = band.Top * ch; + // The band's columns: the whole grid, or the output's column when the bars are a row of it + // (HostChrome.InputInColumn), and then every pane beside it runs on down to the footer. + var left = band.From * cw; + var right = band.Columns is null ? width : band.To(frame.Width) * cw; + canvas.Save(); - canvas.ClipRect(new SKRect(0, 0, width, top)); + canvas.ClipRect(new SKRect(0, 0, width, height)); + canvas.ClipRect(new SKRect(left, top, right, height), SKClipOperation.Difference); renderer.Render(canvas, frame, pictures); canvas.Restore(); - var field = FieldRect(band, cw, ch, frame.Width, s); - var fill = renderer.Background(frame[Math.Min(frame.Width - 1, band.Pad), band.Top].Background); using var paint = new SKPaint { IsAntialias = true }; + if (band.Columns is not null && frame.Height > 0) + { + // Under the grid beside the band, the pixels the field's padding takes: the last row's own planes, carried down. + var gridBottom = frame.Height * ch; + for (var x = 0; x < frame.Width && gridBottom < height; x++) + { + if (!band.Spans(x, frame.Width)) + { + paint.Color = renderer.Background(frame[x, frame.Height - 1].Background); + canvas.DrawRect(x * cw, gridBottom, x == frame.Width - 1 ? width - (x * cw) : cw, height - gridBottom, paint); + } + } + } + + var field = FieldRect(band, cw, ch, frame.Width, s); + var fill = renderer.Background(frame[Math.Min(frame.Width - 1, band.From + band.Pad), band.Top].Background); paint.Color = plane; - canvas.DrawRect(0, top, width, height - top, paint); + canvas.DrawRect(left, top, right - left, height - top, paint); paint.Color = Mix(plane, renderer.DefaultForeground, 0.10f); - canvas.DrawRect(0, top, width, Math.Max(1, s), paint); + canvas.DrawRect(left, top, right - left, Math.Max(1, s), paint); var radius = (float)(NativeTokens.RadiusM * scale); var rounded = new SKRoundRect(field, radius); @@ -1038,10 +1074,10 @@ private void RenderWithField(SKCanvas canvas, InputBand band) canvas.Translate(0, (float)(NativeLayout.FieldTop * scale)); // The bars' rows only, and not the client's right padding, whose colour is the margin's rather than the band's. - var textRight = (frame.Width - band.Pad) * cw; + var textRight = (band.To(frame.Width) - band.Pad) * cw; if (bars.Count == 0) { - canvas.ClipRect(new SKRect(0, top, textRight, (band.Top + band.Rows) * ch)); + canvas.ClipRect(new SKRect(left, top, textRight, (band.Top + band.Rows) * ch)); renderer.Render(canvas, frame, pictures); } else @@ -1053,7 +1089,7 @@ private void RenderWithField(SKCanvas canvas, InputBand band) var shift = (float)(bar.Shift * scale); var meet = (bar.TextStart * cw) - shift; canvas.Save(); - canvas.ClipRect(new SKRect(0, bar.Top * ch, meet, bar.End * ch)); + canvas.ClipRect(new SKRect(left, bar.Top * ch, meet, bar.End * ch)); renderer.Render(canvas, frame, pictures); canvas.Restore(); @@ -1082,7 +1118,7 @@ public void Dispose() } /// - /// The field's rectangle in device pixels: inset from the grid's edges so the client's band-coloured padding columns + /// The field's rectangle in device pixels: inset from the band's edges so the client's band-coloured padding columns /// are its inner padding, from the strip's top padding to below the last row. /// internal static SKRect FieldRect(InputBand band, int cw, int ch, int columns, float scale) @@ -1092,7 +1128,7 @@ internal static SKRect FieldRect(InputBand band, int cw, int ch, int columns, fl var inset = MathF.Round(Math.Max(4 * scale, Math.Min((float)(NativeLayout.FieldSide * scale), (band.Pad * cw) - (float)(NativeTokens.Space8 * scale)))); var top = (band.Top * ch) + MathF.Round((float)(NativeLayout.FieldOuter * scale)); var bottom = ((band.Top + band.Rows) * ch) + MathF.Round((float)((NativeLayout.FieldTop + NativeLayout.FieldInner) * scale)); - return new SKRect(inset, top, (columns * cw) - inset, bottom); + return new SKRect((band.From * cw) + inset, top, (band.To(columns) * cw) - inset, bottom); } /// @@ -1102,21 +1138,25 @@ internal static SKRect FieldRect(InputBand band, int cw, int ch, int columns, fl private void DrawFieldText(DrawingContext context, ScreenFrame frame, InputBand band, IReadOnlyList bars) { var cell = CellSize; + + // The band's first column inside its padding, and one past its last: the whole grid, or the output's column. + var at = band.From + band.Pad; + var end = band.To(frame.Width); foreach (var prompt in band.Prompts) { var text = prompt.Text.TrimEnd(); - if (text.Length == 0 || prompt.Row < 0 || prompt.Row >= frame.Height || band.Pad >= frame.Width) + if (text.Length == 0 || prompt.Row < 0 || prompt.Row >= frame.Height || at >= end) { continue; } - var first = frame[band.Pad, prompt.Row]; - var ink = Ink(frame, band.Pad, prompt.Row, text.Length); + var first = frame[at, prompt.Row]; + var ink = Ink(frame, at, prompt.Row, text.Length); // The plate hides the prompt's mono cells up to where the shifted text begins (BarsOf), never over that text. - var cells = Math.Min(text.Length, frame.Width - band.Pad) * cell.Width; - var room = Math.Min(prompt.Text.Length, frame.Width - band.Pad) * cell.Width; + var cells = Math.Min(text.Length, end - at) * cell.Width; + var room = Math.Min(prompt.Text.Length, end - at) * cell.Width; var shift = bars.FirstOrDefault(b => b.Top == prompt.Row).Shift; - var plate = new Rect(band.Pad * cell.Width, RowTop(prompt.Row), Math.Max(0, room - shift), cell.Height); + var plate = new Rect(at * cell.Width, RowTop(prompt.Row, at), Math.Max(0, room - shift), cell.Height); context.FillRectangle(Brush(_renderer.Background(first.Background)), plate); var formatted = PromptText(text, ink, cells + (2 * cell.Width)); @@ -1124,7 +1164,7 @@ private void DrawFieldText(DrawingContext context, ScreenFrame frame, InputBand context.DrawText(formatted, new Point(Math.Round(plate.X), plate.Y + ((cell.Height - formatted.Height) / 2))); } - if (band.Hint.Length == 0 || band.Top >= frame.Height) + if (band.Hint.Length == 0 || band.Top >= frame.Height || at >= end) { return; } @@ -1132,15 +1172,15 @@ private void DrawFieldText(DrawingContext context, ScreenFrame frame, InputBand var hint = new FormattedText( NativeKeys.Words(band.Hint), System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(NativeTokens.UiFont), NativeTokens.Small, Brush(SKColors.White)); - var right = (frame.Width - band.Pad) * cell.Width; + var right = (end - band.Pad) * cell.Width; var from = Math.Max(0, (int)Math.Floor((right - hint.Width) / cell.Width) - 2); - var promptEnd = band.Pad + (band.Prompts.FirstOrDefault(p => p.Row == band.Top)?.Text.Length ?? 0); + var promptEnd = at + (band.Prompts.FirstOrDefault(p => p.Row == band.Top)?.Text.Length ?? 0); if (from <= promptEnd || frame.Caret is { Visible: true } caret && caret.Y == band.Top && caret.X >= from) { return; } - for (var x = from; x < frame.Width - band.Pad; x++) + for (var x = from; x < end - band.Pad; x++) { if (frame[x, band.Top].Rune.Value != ' ') { @@ -1148,9 +1188,9 @@ private void DrawFieldText(DrawingContext context, ScreenFrame frame, InputBand } } - var bandColour = _renderer.Background(frame[band.Pad, band.Top].Background); + var bandColour = _renderer.Background(frame[at, band.Top].Background); hint.SetForegroundBrush(Brush(Mix(bandColour, _renderer.DefaultForeground, 0.6f))); - context.DrawText(hint, new Point(right - hint.Width, RowTop(band.Top) + ((cell.Height - hint.Height) / 2))); + context.DrawText(hint, new Point(right - hint.Width, RowTop(band.Top, at) + ((cell.Height - hint.Height) / 2))); } /// The ink of the first non-blank cell of a run, the run's own colour. diff --git a/src/SharpMUTerm.Core/Workspace/InputColumn.cs b/src/SharpMUTerm.Core/Workspace/InputColumn.cs new file mode 100644 index 00000000..26880871 --- /dev/null +++ b/src/SharpMUTerm.Core/Workspace/InputColumn.cs @@ -0,0 +1,80 @@ +namespace SharpMUTerm.Core.Workspaces; + +/// +/// Which part of the pane tree the command line sits under, for a host that puts it in the output's column rather than +/// across the whole window (the desktop window, as its mockups draw it: the side column runs down to the footer and +/// the command line is as wide as the output above it). +/// +/// The answer is a node of the tree, and the bars go under it. It is found from an anchor pane — the pane +/// the output is in — by walking down from the root and stopping at the first node the bars cannot go further into +/// while still touching the bottom of the pane area: +/// +/// +/// a pane is the answer; +/// side by side (), every child reaches the bottom, so the walk goes into the +/// anchor's child — unless another child holds output too (two characters side by side), and then the bars span the +/// split, because neither column is the output column; +/// stacked (), only the last child reaches the bottom, so the walk goes into +/// it only when the anchor is there; otherwise the split is the answer (the output with a quick bar under it). +/// +/// +/// Nothing here reads focus. Moving the selection between panes must not move a pane rectangle — every connected +/// server would be told a new size — so the column is a property of the arrangement, not of where the keyboard is. +/// +/// +public static class InputColumn +{ + /// + /// The node the command line goes under: the root when there is no anchor in the tree. + /// + /// The pane tree. + /// The pane the output is in, or null. + /// Whether a pane holds output of its own (a character's window), as opposed to furniture. + public static LayoutNode Target(LayoutNode root, string? anchorPaneId, Func holdsOutput) + { + ArgumentNullException.ThrowIfNull(root); + ArgumentNullException.ThrowIfNull(holdsOutput); + if (anchorPaneId is null || !root.Panes().Any(p => p.Id == anchorPaneId)) + { + return root; + } + + var node = root; + while (node is SplitNode split) + { + var index = split.Children.FindIndex(c => c.Panes().Any(p => p.Id == anchorPaneId)); + if (split.Direction == SplitDirection.Row) + { + var sharing = split.Children.Where((c, i) => i != index && c.Panes().Any(holdsOutput)).Any(); + if (sharing) + { + return split; + } + } + else if (index != split.Children.Count - 1) + { + return split; + } + + node = split.Children[index]; + } + + return node; + } + + /// + /// The pane the command line is anchored to: (the live layout's output pane) when it is + /// in the tree, else the first pane in pane order that holds output, else none. + /// + public static string? Anchor(WorkspaceLayout layout, string? preferred, Func holdsOutput) + { + ArgumentNullException.ThrowIfNull(layout); + ArgumentNullException.ThrowIfNull(holdsOutput); + if (preferred is not null && layout.FindPane(preferred) is not null) + { + return preferred; + } + + return layout.Panes.FirstOrDefault(holdsOutput)?.Id; + } +} diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 5f07cce8..1144503c 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -331,7 +331,13 @@ internal static ClientHost HarnessTerminal( /// the whole pane), so output starts the mockup's ~20 px in from the pane's edges. The cells are ones the pane really /// loses: the output rectangles, and so NAWS, are the smaller ones. /// -internal sealed record HostChrome(bool Header, bool Rail, bool Status = false, bool Input = false, bool Tabs = false, bool PaneGutter = false) +/// +/// The command line (its prompt row and both bars) is a row of the output's column rather than a band across every pane: +/// as wide as the column the output is in (), with the panes beside +/// it running down to the status row. Only cells move; the pane rectangles, and so NAWS, are what is arranged. +/// +internal sealed record HostChrome( + bool Header, bool Rail, bool Status = false, bool Input = false, bool Tabs = false, bool PaneGutter = false, bool InputInColumn = false) { /// The client draws all of its chrome in cells: the terminal, the snapshot, the tests. public static HostChrome None { get; } = new(false, false); @@ -341,9 +347,9 @@ internal sealed record HostChrome(bool Header, bool Rail, bool Status = false, b /// /// The host draws the header, the rail, the status footer, the command line's field and every pane's tab strip, and - /// the client pads every pane with a gutter: the desktop window. + /// the client pads every pane with a gutter and puts the command line in the output's column: the desktop window. /// - public static HostChrome Desktop { get; } = new(true, true, true, true, true, true); + public static HostChrome Desktop { get; } = new(true, true, true, true, true, true, true); /// The same arrangement as ; the name the tab strip's tests use. public static HostChrome Native => Desktop; diff --git a/src/SharpMUTerm.Tui/InputLayout.cs b/src/SharpMUTerm.Tui/InputLayout.cs index 5305580c..2d4eaf14 100644 --- a/src/SharpMUTerm.Tui/InputLayout.cs +++ b/src/SharpMUTerm.Tui/InputLayout.cs @@ -32,7 +32,7 @@ internal static class InputLayout /// The band-coloured columns a command line leaves at each end of its rows when the host draws its field /// (): the field's inner padding, inside the frame the host draws. /// - internal const int HostFieldPad = 3; + internal const int HostFieldPad = 4; /// /// Breaks into the rows it occupies at columns. diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs index 077fe3ec..641e4c69 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs @@ -193,6 +193,14 @@ private void PublishInputBand() var rows = _input.ActualHeight + (_second.Visible ? _second.ActualHeight : 0); var top = _system.ConsoleDriver.ScreenSize.Height - rows - (_statusBar.Visible ? Math.Max(0, _statusBar.ActualHeight) : 0); + int? left = null, columns = null; + + // In the output's column (HostChrome.InputInColumn) the bars are where they were arranged, not across the bottom. + if (Host.Chrome.InputInColumn && BoundsOf(_input) is { } box) + { + (top, left, columns) = (box.Y, box.X, box.Width); + } + if (top <= 0) { return null; @@ -204,7 +212,11 @@ private void PublishInputBand() prompts.Add(new InputPrompt(top + _input.ActualHeight, MarkupParser.Remove(_second.Prompt))); } - return new InputBand(top, rows, InputLayout.HostFieldPad, prompts, $"⏎ sends · {KeyGlyphs.Normalize(Host.Keys.Newline.Glyph)} new line"); + return new InputBand(top, rows, InputLayout.HostFieldPad, prompts, $"⏎ sends · {KeyGlyphs.Normalize(Host.Keys.Newline.Glyph)} new line") + { + Left = left, + Columns = columns, + }; } } @@ -229,10 +241,28 @@ internal sealed record InputPrompt(int Row, string Text); /// The newline hint, in the cells' glyphs, for the host to draw where the first row is blank. internal sealed record InputBand(int Top, int Rows, int Pad, IReadOnlyList Prompts, string Hint) { + /// + /// The first column of the bars, when they are a row of the output's column (); + /// null when they span the grid from column 0. + /// + public int? Left { get; init; } + + /// How many columns the bars span, or null for the whole grid's width. + public int? Columns { get; init; } + + /// The first column of the bars. + public int From => Left ?? 0; + + /// One past the bars' last column, in a grid wide. + public int To(int width) => Columns is { } columns ? Math.Min(width, From + columns) : width; + + /// Whether column is under the bars: from down, the rows are theirs there. + public bool Spans(int x, int width) => x >= From && x < To(width); + /// public bool Equals(InputBand? other) => other is not null && Top == other.Top && Rows == other.Rows && Pad == other.Pad && Hint == other.Hint - && Prompts.SequenceEqual(other.Prompts); + && Left == other.Left && Columns == other.Columns && Prompts.SequenceEqual(other.Prompts); /// public override int GetHashCode() => HashCode.Combine(Top, Rows, Pad, Hint); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index d4ee5699..0c0d38a3 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -869,9 +869,6 @@ public SharpMUTermApp( // The pane area renders the workspace's split tree (one TabControl per leaf pane). It's built // from the model and rebuilt whenever the layout changes; the initial row goes into the window. // A narrow terminal starts with the rail folded (SyncNarrowLayout), so the first row is built that way. - SyncNarrowLayout(); - _workspaceRow = BuildWorkspaceRow(); - // The input area is one or two bars pinned above the status line. Each paints its own full-width // band (see InputBarControl), so the row reads as solid from the prompt to the right edge with // no gap where a label ends. Draft-safe history is ours (InputHistory) and per bar. @@ -879,12 +876,6 @@ public SharpMUTermApp( SetUpBar(_second, InputBar.Secondary); _second.Visible = false; - _statusBar = Controls.Markup("[dim]not connected[/]").StickyBottom().Build(); - - // A host that draws the status row itself (the window's footer) gets no cell for it: a hidden sticky band takes - // no row, and ChromeRows counts none, so the bars and the panes have the row. - _statusBar.Visible = !host.Chrome.Status; - // Sticky-bottom, added ahead of the bars so it sits above them, and hidden until a prompt // arrives: most sessions never see one, and a permanently blank row would cost every pane a // row for nothing. @@ -892,6 +883,22 @@ public SharpMUTermApp( _promptRow.HorizontalAlignment = HorizontalAlignment.Stretch; _promptRow.Visible = false; + // A host that puts the command line in the output's column (the window) gets the prompt row and the bars as rows + // of the pane area instead (see WithInputBars), so they are built before it. + if (host.Chrome.InputInColumn) + { + _promptRow.StickyPosition = StickyPosition.None; + } + + SyncNarrowLayout(); + _workspaceRow = BuildWorkspaceRow(); + + _statusBar = Controls.Markup("[dim]not connected[/]").StickyBottom().Build(); + + // A host that draws the status row itself (the window's footer) gets no cell for it: a hidden sticky band takes + // no row, and ChromeRows counts none, so the bars and the panes have the row. + _statusBar.Visible = !host.Chrome.Status; + // The window paints the backdrop, not the text background: everything that is not a pane — the // connection rail, the status line, the gaps a split leaves — sits on it, so the panes read as // raised surfaces and an empty one is still a visible rectangle. See WorkspacePalette. @@ -920,12 +927,19 @@ public SharpMUTermApp( .WithColors(fg, bg) .AddControl(_header) .AddControl(_workspaceRow) - .AddControl(_promptRow) - .AddControl(_input) - .AddControl(_second) - .AddControl(_statusBar) .Build(); + // The bars are the window's sticky band across every pane, unless the host puts them in the output's column, where + // the pane area holds them (WithInputBars). The status row is sticky either way. + if (!host.Chrome.InputInColumn) + { + _window.AddControl(_promptRow); + _window.AddControl(_input); + _window.AddControl(_second); + } + + _window.AddControl(_statusBar); + // Nothing in this window scrolls as a window — every pane scrolls inside its own viewport — and a // frameless scrollable window reserves a scrollbar column whenever its content is taller than it is. // A shrinking terminal (or a desktop window coming back from maximised) passes through exactly that @@ -6002,7 +6016,8 @@ private bool AnyBarHasText() => /// private void SetUpBar(InputBarControl bar, InputBar kind) { - bar.StickyPosition = StickyPosition.Bottom; + // A row of the output's column where the host puts the bars there (WithInputBars), else the window's sticky band. + bar.StickyPosition = Host.Chrome.InputInColumn ? StickyPosition.None : StickyPosition.Bottom; bar.HorizontalAlignment = HorizontalAlignment.Stretch; // Both bands come from the theme through WorkspacePalette, so the armed bar is lit by the very // same tone as the focused pane and the idle one sits on the same recessed plane as the rest of @@ -10943,8 +10958,12 @@ private IWindowControl BuildWorkspaceRow() // When a pane is zoomed, render just that pane full-area; otherwise render the whole tree. var zoomed = _workspace.Layout.ZoomedPaneId is { } zid ? _workspace.Layout.FindPane(zid) : null; + DetachInputBars(); + _inputTarget = Host.Chrome.InputInColumn + ? zoomed ?? InputColumn.Target(_workspace.Layout.Root, InputAnchorPane(), HoldsOutput) + : null; var paneArea = zoomed is not null - ? OnSurface(BuildPaneTabs(zoomed), zoomed.Id) + ? WithInputBars(OnSurface(BuildPaneTabs(zoomed), zoomed.Id), zoomed) : BuildLayoutNode(_workspace.Layout.Root); PublishHeaderDividers(); @@ -11494,7 +11513,80 @@ internal static int MarkupWidth(string markup) /// becomes a proportional grid (columns for a row split, rows for a /// column split) with a draggable splitter between children. /// - private IWindowControl BuildLayoutNode(SharpMUTerm.Core.Workspaces.LayoutNode node) + private IWindowControl BuildLayoutNode(SharpMUTerm.Core.Workspaces.LayoutNode node) => + WithInputBars(BuildLayoutNodeAlone(node), node); + + /// + /// The node the command line sits under, for a host that puts it in the output's column + /// (); null for one that keeps it across the window. Set on every rebuild. + /// + private SharpMUTerm.Core.Workspaces.LayoutNode? _inputTarget; + + /// The grid holding the bars under , so a rebuild can take them out before it is disposed. + private GridControl? _inputColumn; + + /// + /// The pane the output is in: the live layout's output pane while it owns the panes, else the first pane holding a + /// character's own window. Read by , never focus, so moving the selection moves no pane. + /// + private string? InputAnchorPane() => + InputColumn.Anchor( + _workspace.Layout, + _liveLayout?.PanelPanes.GetValueOrDefault(SharpMUTerm.Core.Layouts.PanelIds.Output), + HoldsOutput); + + /// Whether a pane holds a character's own window: output, as opposed to a panel, the map or a capture. + private bool HoldsOutput(PaneNode pane) => + pane.Tabs.Any(id => _workspace.FindWindow(id) is { Kind: WindowKind.Main }); + + /// + /// , with the prompt row and the command lines as rows under it when + /// is : the output's column ends in the bars, and every pane beside it runs down to the + /// status row. The rows are the bars' own measure (Auto), so a bar growing as it wraps takes rows from this column + /// only, and the pane rectangles — and so NAWS — are what is arranged. + /// + private IWindowControl WithInputBars(IWindowControl control, SharpMUTerm.Core.Workspaces.LayoutNode node) + { + if (_inputTarget is null || !ReferenceEquals(node, _inputTarget)) + { + return control; + } + + var grid = Controls.Grid() + .WithAlignment(HorizontalAlignment.Stretch) + .WithVerticalAlignment(VerticalAlignment.Fill) + .Rows(GridLength.Star(1), GridLength.Auto(), GridLength.Auto(), GridLength.Auto()) + .Columns(GridLength.Star(1)); + grid.Place(control, 0, 0, 1, 1); + grid.Place(_promptRow, 1, 0, 1, 1); + grid.Place(_input, 2, 0, 1, 1); + grid.Place(_second, 3, 0, 1, 1); + var built = grid.Build(); + built.BackgroundColor = BackdropColor(); + _inputColumn = built; + return built; + } + + /// + /// Takes the prompt row and the bars out of the grid that held them, ahead of a rebuild: the old pane area is disposed + /// once it is swapped out, and the bars live for the life of the app. + /// + private void DetachInputBars() + { + if (_inputColumn is not { } grid) + { + return; + } + + foreach (var control in new IWindowControl[] { _promptRow, _input, _second }) + { + grid.RemoveControl(control); + } + + _inputColumn = null; + } + + private IWindowControl BuildLayoutNodeAlone(SharpMUTerm.Core.Workspaces.LayoutNode node) { if (node is PaneNode pane) { diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs index ab6ddf0c..71253fe7 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeFooterTests.cs @@ -78,6 +78,19 @@ [new StatusSegment(StatusRole.Palette, [new("⌃P palette", "#cccccc", false, He await Assert.That(clicked.First()).IsEqualTo(HeaderModel.PaletteTarget); } + [Test] + public async Task InTheOutputsColumnTheFieldIsAsWideAsTheColumn() + { + var band = new InputBand(20, 1, InputLayout.HostFieldPad, [new InputPrompt(20, "Corvid ›")], "⏎ sends") { Left = 10, Columns = 50 }; + var rect = TerminalView.FieldRect(band, 10, 20, 80, 1f); + + await Assert.That((double)rect.Left).IsEqualTo(100 + NativeLayout.FieldSide); + await Assert.That((double)rect.Right).IsEqualTo(600 - NativeLayout.FieldSide); + await Assert.That(band.Spans(9, 80)).IsFalse(); + await Assert.That(band.Spans(10, 80)).IsTrue(); + await Assert.That(band.Spans(60, 80)).IsFalse(); + } + [Test] public async Task TheFieldIsInsetFromTheGridAndFramesTheBarsRows() { @@ -87,8 +100,8 @@ public async Task TheFieldIsInsetFromTheGridAndFramesTheBarsRows() // The mockup's 20 px from the grid's edge, leaving the field its 8 px inner padding before the prompt's column. await Assert.That((double)rect.Left).IsEqualTo(NativeLayout.FieldSide); await Assert.That((double)rect.Right).IsEqualTo(800 - NativeLayout.FieldSide); - var tight = TerminalView.FieldRect(band, 8, 20, 80, 1f); - await Assert.That((double)tight.Left).IsEqualTo((3 * 8) - NativeTokens.Space8).Because("narrow cells keep the inner padding"); + var tight = TerminalView.FieldRect(band, 6, 20, 80, 1f); + await Assert.That((double)tight.Left).IsEqualTo((InputLayout.HostFieldPad * 6) - NativeTokens.Space8).Because("narrow cells keep the inner padding"); var scaled = TerminalView.FieldRect(band, 13, 25, 80, 1.25f); await Assert.That(scaled.Left % 1).IsEqualTo(0f).Because("a field edge on a whole device pixel at 125%"); await Assert.That(scaled.Top % 1).IsEqualTo(0f); diff --git a/tests/SharpMUTerm.Core.Tests/Workspace/InputColumnTests.cs b/tests/SharpMUTerm.Core.Tests/Workspace/InputColumnTests.cs new file mode 100644 index 00000000..77784137 --- /dev/null +++ b/tests/SharpMUTerm.Core.Tests/Workspace/InputColumnTests.cs @@ -0,0 +1,58 @@ +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Core.Tests.Workspaces; + +/// Where the command line goes when a host puts it in the output's column (). +public class InputColumnTests +{ + private static bool Output(PaneNode pane) => pane.Tabs.Any(t => t.StartsWith("main", StringComparison.Ordinal)); + + [Test] + public async Task ASideColumnOfFurnitureRunsDownBesideTheBars() + { + // Roleplay: the output (with Chat behind it) beside a column of composer over who is here. + var output = new PaneNode("out", ["main", "chat"]); + var side = new SplitNode(SplitDirection.Column, [new PaneNode("compose", ["panel:composer"]), new PaneNode("who", ["panel:who"])]); + var root = new SplitNode(SplitDirection.Row, [output, side]); + + await Assert.That(InputColumn.Target(root, "out", Output)).IsSameReferenceAs(output); + } + + [Test] + public async Task AStripUnderTheOutputIsInsideTheColumn() + { + // Combat: the output over a quick bar, beside the vitals over the map with Chat behind it — a capture is not output. + var column = new SplitNode(SplitDirection.Column, [new PaneNode("out", ["main"]), new PaneNode("quick", ["panel:quick"])]); + var side = new SplitNode(SplitDirection.Column, [new PaneNode("vitals", ["panel:vitals"]), new PaneNode("map", ["map:x", "chat"])]); + var root = new SplitNode(SplitDirection.Row, [column, side]); + + await Assert.That(InputColumn.Target(root, "out", Output)).IsSameReferenceAs(column); + } + + [Test] + public async Task AStripAcrossTheTopIsPassedThrough() + { + var output = new PaneNode("out", ["main"]); + var row = new SplitNode(SplitDirection.Row, [output, new PaneNode("map", ["map:x"])]); + var root = new SplitNode(SplitDirection.Column, [new PaneNode("vitals", ["panel:vitals"]), row]); + + await Assert.That(InputColumn.Target(root, "out", Output)).IsSameReferenceAs(output); + } + + [Test] + public async Task TwoCharactersSideBySideShareTheBars() + { + var root = new SplitNode(SplitDirection.Row, [new PaneNode("a", ["main:a"]), new PaneNode("b", ["main:b"])]); + + await Assert.That(InputColumn.Target(root, "a", Output)).IsSameReferenceAs(root); + } + + [Test] + public async Task NoAnchorMeansTheWholeArea() + { + var root = new SplitNode(SplitDirection.Row, [new PaneNode("a", ["main"]), new PaneNode("b", ["panel:who"])]); + + await Assert.That(InputColumn.Target(root, null, Output)).IsSameReferenceAs(root); + await Assert.That(InputColumn.Target(root, "gone", Output)).IsSameReferenceAs(root); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/InputColumnLayoutTests.cs b/tests/SharpMUTerm.Tui.Tests/InputColumnLayoutTests.cs new file mode 100644 index 00000000..0baf326e --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/InputColumnLayoutTests.cs @@ -0,0 +1,98 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A host that puts the command line in the output's column (, the window) gets +/// the bars as wide as the output above them, the side column running down to the status row, and NAWS following the +/// pane rectangles that are really arranged; moving the selection between panes still moves none of them. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class InputColumnLayoutTests +{ + private const int Width = 120; + private const int Height = 32; + + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static readonly HostChrome InColumn = HostChrome.None with { Input = true, InputInColumn = true }; + + private static SharpMUTermApp App(HostChrome chrome, string view) + { + Console.SetIn(TextReader.Null); + var host = ClientHost.Headless(new HeadlessConsoleDriver(Width, Height), Caps) with { Chrome = chrome }; + var app = new SharpMUTermApp(DemoScene.Build(), host); + app.RenderSnapshot(view); + app.RenderNextFrame(); + return app; + } + + private static ConsoleKeyInfo Ctrl(ConsoleKey key) => new('\0', key, false, false, true); + + [Test] + [Arguments("layout-roleplay")] + [Arguments("layout-combat")] + public async Task TheBarsAreAsWideAsTheOutputColumnAndTheSideColumnRunsToTheStatusRow(string view) + { + await using var app = App(InColumn, view); + var band = app.InputBandNow(); + await Assert.That(band).IsNotNull(); + await Assert.That(band!.Left).IsNotNull(); + await Assert.That(band.Columns!.Value).IsLessThan(Width - 20); + + var rects = app.PaneOutputRects(); + var bottom = Height - app.LaidOutRows.Status; + + // The output pane sits above the bars, inside their columns. + var output = rects.Values.Where(r => r.X >= band.From && r.X < band.To(Width)).ToList(); + await Assert.That(output).IsNotEmpty(); + await Assert.That(output.All(r => r.Y + r.Height <= band.Top)).IsTrue(); + + // Every pane beside the bars reaches further down than they start: the side column runs past them. + var beside = rects.Values.Where(r => r.X >= band.To(Width)).ToList(); + await Assert.That(beside).IsNotEmpty(); + await Assert.That(beside.Max(r => r.Y + r.Height)).IsGreaterThan(band.Top); + await Assert.That(band.Top + band.Rows).IsEqualTo(bottom); + + // The caret is on the bar, inside its columns. + var caret = app.CaretOnScreen(); + await Assert.That(caret.Visible).IsTrue(); + await Assert.That(caret.Y).IsEqualTo(band.Top); + await Assert.That(caret.X).IsGreaterThanOrEqualTo(band.From).And.IsLessThan(band.To(Width)); + } + + [Test] + public async Task MovingTheSelectionMovesNoPaneRectangle() + { + await using var app = App(InColumn, "layout-roleplay"); + var before = app.PaneOutputRects().ToDictionary(p => p.Key, p => p.Value, StringComparer.Ordinal); + var band = app.InputBandNow(); + var first = app.FocusedPaneId; + + app.SimulateKey(Ctrl(ConsoleKey.RightArrow)); + app.RenderNextFrame(); + + await Assert.That(app.FocusedPaneId).IsNotEqualTo(first); + var after = app.PaneOutputRects(); + foreach (var (paneId, rect) in before) + { + await Assert.That(after[paneId]).IsEqualTo(rect); + } + + await Assert.That(app.InputBandNow()?.Left).IsEqualTo(band?.Left); + } + + [Test] + public async Task TheTerminalKeepsTheBarsAcrossEveryPane() + { + await using var cells = App(HostChrome.None with { Input = true }, "layout-roleplay"); + var band = cells.InputBandNow(); + await Assert.That(band).IsNotNull(); + await Assert.That(band!.Left).IsNull(); + await Assert.That(band.Columns).IsNull(); + } +} From bfdd3aa4d9dccdaedadf381166e7f66b5742e518 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 20:05:45 +0000 Subject: [PATCH 078/113] Wave 22 C: the window's map, header and status row as the mockups draw them The native map: dark rooms outlined in a rule, exits as rules, the current room an accent ring with @, look buttons at the small control height, the legend a strip at the foot above MapViewModel.Hint, and the fit keeps every room clear of both. The native header drops the counts and sinks its search box; the footer draws the status row's compact form (StatusOverlay.Compact: connection, UTF-8, Log off, and one hint such as "2 new in Chat"), the full row while a notice holds it. Terminal frames are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 + CLAUDE.md | 17 ++ src/SharpMUTerm.Avalonia/MapCanvas.cs | 257 ++++++++++++------ src/SharpMUTerm.Avalonia/NativeChrome.cs | 39 ++- src/SharpMUTerm.Avalonia/NativeFooter.cs | 16 +- src/SharpMUTerm.Client/Chrome/StatusModel.cs | 6 + src/SharpMUTerm.Client/Panels/MapViewModel.cs | 12 + .../Pointer/SharpMUTermApp.Footer.cs | 112 +++++++- .../NativeMapViewTests.cs | 39 +++ .../SurfaceParityTests.cs | 28 ++ .../PanelModelTests.cs | 6 + 11 files changed, 423 insertions(+), 116 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea6a5a2..fba49bb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- In the desktop window, the map is drawn the way the mockups draw it: dark rooms outlined in a rule, exits as thin lines, + your room ringed in the accent with an `@`, Up/Down/Areas as proper buttons, and the legend in a strip at the foot with + "Click a room to walk there" under it, so it never covers a room. +- In the desktop window, the header shows only the search box and your character, and the status bar reads + "Corvid connected · UTF-8 · Log off" with a short hint on the right such as "2 new in Chat" (or the keys of the mode + you are in). Notices still take the whole bar while they show. + - The package review keeps ⏎ install and Esc cancel on screen at 80×24: the review scrolls (↑↓ PgUp PgDn Home End) under its keys and stops above the command line. - Browse worlds: a world listed at several addresses (TLS and plain, another port, an old one) now lets you choose diff --git a/CLAUDE.md b/CLAUDE.md index a4209e2e..975bc9b9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1728,6 +1728,23 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw field, the row shift and the press mapping only in those columns, and carries the panes and dividers beside it down through the `FieldReserve` pixels. NAWS is the arranged rectangles. The terminal keeps the full-width band (`None`), so its frames and the parity harness (which tells both hosts the same chrome) are unchanged. + - **At rest the footer draws the row's compact form** (wave 22; `StatusOverlay.Compact`/`Shown`, `CompactStatus`): left the + identity segment (the cell row's instance), `UTF-8` (`CompactEncoding`) and `Log off`/`Log html` (`HeaderLogFormat`, + `StatusRole.Log`); right scrolled back (not in a split, whose native band says it), `● REC`, `♪ muted`, then one hint — + the mode's keys (not `SplitScrollback`) else `2 new in Chat` (`UnreadHint`, `StatusRole.Activity`, the active + character's windows by unread). A notice or a move/drag prompt sets it null and the footer draws `Model` whole. The cells + keep the full row (meters, room, count, focus keys): the window draws those as panels, tabs and its search box. `Model` + is still what `Drawing` recorded; parity probes compare it, `TheFootersCompactRowIsTheRowsFactsInTheMockupsWords` pins + the compact one. **The native header draws no counts** (`1/3 characters · LOG off`): the brand, the sunk search box + (`NativeChromeView.Sunk`) and the character pill, as the mockups; `HeaderModel` still carries them for the cell ribbon. +- **The native map is the mockup's** (wave 22, `MapCanvas`). Rooms are the pane's plane a step lighter (`Mix(plane, text, + 0.07)`) with a rule round them (`RuleColour`, 0.24), half a step wide; exits are that rule; the character's room is the + accent at 20% with a 2 px accent ring and `@` (`YouGlyph`) in mono when the game gives no symbol. The area colour is the + heading's mark, the legend and the spurs only. The look buttons are `ControlHeightSmall` with `RadiusControl`. The + legend is a wrapped strip at the foot above `MapViewModel.Hint` (`WalkHint`/`EditHint`, Client, null while walking or with + one room), and the fit reserves both and the buttons (`TopReserve`/`BottomReserve`), so nothing covers a fitted room + (`TheFittedRoomsAreClearOfTheButtonsTheLegendAndTheHint`). The current-room line under the heading is gone (its name is + under its box). The cell map is unchanged. - **The window draws pane dividers as the panes meeting at a hairline** (`IPointerPresenter.Dividers`, `PaneDividerOverlay`, `DividersNow`; `ScreenFrame.Dividers`; `TerminalView.FrameDraw.DrawDividers`). The client publishes each divider control's cells and whether it is lit (never a tab strip standing in for one, nothing under a modal) on diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index 3c57e57a..8cdc1167 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -78,6 +78,7 @@ internal sealed class MapCanvas : Control private Vector _panAtPress; private bool _dragging; private long? _hovered; + private string? _buttonHovered; public MapCanvas(TerminalView view) { @@ -182,7 +183,11 @@ private Point Middle } } - private double RoomSize => Math.Max(5, Spacing * Zoom * 0.56); + /// + /// A room's side: about half the step between rooms (the mockup draws 32 px rooms 90 px apart; names under them need the room), so the exits read + /// as lines between boxes rather than boxes touching. + /// + private double RoomSize => Math.Max(5, Spacing * Zoom * 0.48); /// /// Fits the area to the canvas: the rooms within steps of the character's, centred in the open @@ -217,12 +222,16 @@ private void Fit() var minY = near.Min(r => r.Y - anchor.Y); var maxY = near.Max(r => r.Y - anchor.Y); var open = Middle.X * 2; - const double top = 44; // the corner label and the walk or room line under it + + // The rooms are fitted between what is drawn above them (the heading, a walk line, the look buttons) and below + // them (the legend and the hint), so neither ever covers a room of the fitted view. + var top = TopReserve(); + var bottom = BottomReserve(Bounds.Size); var across = Math.Max(1, open - 24) / ((maxX - minX + 1.6) * Spacing); - var down = Math.Max(1, Bounds.Height - top - 16) / ((maxY - minY + 1.6) * Spacing); + var down = Math.Max(1, Bounds.Height - top - bottom) / ((maxY - minY + 1.6) * Spacing); _zoom = Math.Clamp(Math.Min(across, down), MinZoom, FitMaxZoom); var step = Spacing * _zoom; - _fit = new Vector(-(minX + maxX) / 2.0 * step, (top / 2) - ((minY + maxY) / 2.0 * step)); + _fit = new Vector(-(minX + maxX) / 2.0 * step, ((top - bottom) / 2) - ((minY + maxY) / 2.0 * step)); } /// The player took the view: the fit stops following, and stays where it was. @@ -348,6 +357,19 @@ protected override void OnPointerMoved(PointerEventArgs e) return; } + var button = LookButtonAt(position); + if (button?.Id != _buttonHovered) + { + _buttonHovered = button?.Id; + Cursor = new Cursor(button is { Enabled: true } ? StandardCursorType.Hand : StandardCursorType.Arrow); + InvalidateVisual(); + } + + if (button is not null) + { + return; + } + var room = RoomAt(position); if (room?.Id != _hovered) { @@ -472,13 +494,12 @@ internal IReadOnlyList LookButtons() } var x = PanelText.Pad; - var heading = PanelText.HeadingHeight(CellHeight); - var y = _model.Walking is not null || _model.Current is not null ? heading + 26 : heading + 8; + var y = UnderHeading(); void Add(string id, string label, bool enabled) { - var width = PanelText.Measure(label, ButtonSize, bold: false) + 14; - buttons.Add(new LookButton(id, new Rect(x, y, width, 20), label, enabled)); - x += width + 4; + var width = PanelText.Measure(label, ButtonSize, bold: false) + (2 * NativeTokens.Space10); + buttons.Add(new LookButton(id, new Rect(x, y, width, ButtonHeight), label, enabled)); + x += width + NativeTokens.Space6; } if (_model.Levels.Count > 1) @@ -500,7 +521,23 @@ void Add(string id, string label, bool enabled) return buttons; } - private const double ButtonSize = 11; + /// The look buttons' type and height: the window's small controls (). + private const double ButtonSize = NativeTokens.Body, ButtonHeight = NativeTokens.ControlHeightSmall; + + /// The first row under the panel heading: the walk line while one is under way, else the look buttons. + private double UnderHeading() => + PanelText.HeadingHeight(CellHeight) + NativeTokens.Space10 + (_model.Walking is not null ? NativeTokens.Space20 : 0); + + /// What is drawn above the rooms: the heading, a walk line, and the look buttons while there are any. + private double TopReserve() + { + var top = UnderHeading(); + return LookButtons().Count > 0 ? top + ButtonHeight + NativeTokens.Space8 : top; + } + + /// What is drawn below the rooms: the legend and the hint, with a gap above them. + private double BottomReserve(Size size) => + (LegendRect(size) is { } legend ? size.Height - legend.Top : HintBand()) + NativeTokens.Space12; /// The cell height the panel sits on, which sizes its heading as every panel's. private double CellHeight => _view.CellExtent.Height > 0 ? _view.CellExtent.Height : 17; @@ -558,14 +595,14 @@ internal void RunAreaVerb(MapViewModel view, string verb) } var entries = LegendEntries(); - var row = (int)Math.Floor((point.Y - plate.Y - LegendPad) / LegendRow); - if (row < 0 || row >= entries.Count) + var hit = LegendLayout(Bounds.Size).FirstOrDefault(e => e.Area.Contains(point)); + if (hit.Area.Width <= 0) { return null; } var first = entries.Count - _model.Areas.Count; - return row >= first && !_model.Areas[row - first].Drawn ? _model.Areas[row - first].Name : null; + return hit.Index >= first && !_model.Areas[hit.Index - first].Drawn ? _model.Areas[hit.Index - first].Name : null; } /// @@ -649,7 +686,7 @@ internal Color AreaColourOf(MapViewRoom room) => var entries = new List<(string, Color)> { ("you", Parse(_ink.Bar)) }; if (_model.Rooms.Any(r => r.Up || r.Down)) { - entries.Add(("stairs up / down", Faded(0.85))); + entries.Add((StairsLabel, DimInk)); } if (_model.Rooms.Any(r => r.Ahead)) @@ -671,8 +708,12 @@ public override void Render(DrawingContext context) return; } + // The mockup's map: rooms a step off the pane's plane with a rule round them, exits as rules between them, the + // character's room ringed in the accent. Every shade is a mix of the pane's own plane and ink, so it is the same + // drawing on every theme; only the accent, the walk and the areas' marks are colours. + var rule = RuleColour; var byId = _model.Rooms.ToDictionary(r => r.Id); - var exitPen = new Pen(new SolidColorBrush(Faded(0.42)), Math.Clamp(1.6 * Zoom, 1, 2.5), lineCap: PenLineCap.Round); + var exitPen = new Pen(new SolidColorBrush(rule), Math.Clamp(Spacing * Zoom / 45, 1, 2), lineCap: PenLineCap.Round); foreach (var exit in _model.Exits) { if (byId.TryGetValue(exit.From, out var a) && byId.TryGetValue(exit.To, out var b)) @@ -684,8 +725,9 @@ public override void Render(DrawingContext context) var size = RoomSize; var accent = Parse(_ink.Bar); var path = Parse(_ink.Low); - var radius = size * 0.22; + var radius = size * 0.19; var names = NamesShown; + var edge = new Pen(new SolidColorBrush(rule), Math.Clamp(size / 22, 1, 1.5)); foreach (var room in _model.Rooms) { var c = CentreOf(room); @@ -698,36 +740,41 @@ public override void Render(DrawingContext context) // A way into another area: a short spur off the room's corner, in that area's colour. if (ElsewhereColourOf(room) is { } elsewhere) { - var spur = new Pen(new SolidColorBrush(elsewhere), Math.Clamp(2 * Zoom, 1.5, 3), lineCap: PenLineCap.Round); - context.DrawLine(spur, rect.BottomRight - new Vector(size * 0.1, size * 0.1), rect.BottomRight + new Vector(size * 0.32, size * 0.32)); - context.DrawEllipse(new SolidColorBrush(elsewhere), null, rect.BottomRight + new Vector(size * 0.36, size * 0.36), size * 0.12, size * 0.12); + var spur = new Pen(new SolidColorBrush(elsewhere), Math.Clamp(1.6 * Zoom, 1.25, 2.5), lineCap: PenLineCap.Round); + context.DrawLine(spur, rect.BottomRight - new Vector(size * 0.1, size * 0.1), rect.BottomRight + new Vector(size * 0.3, size * 0.3)); + var dot = Math.Max(2, size * 0.11); + context.DrawEllipse(new SolidColorBrush(elsewhere), null, rect.BottomRight + new Vector(size * 0.34, size * 0.34), dot, dot); } - var area = AreaColourOf(room); if (room.Current) { - // A soft halo and a ring, then the room in the accent: the one thing the eye should find first. - context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0x38, accent.R, accent.G, accent.B)), null, rect.Inflate(size * 0.34), radius * 2, radius * 2); - context.DrawRectangle(null, new Pen(new SolidColorBrush(Color.FromArgb(0xB0, accent.R, accent.G, accent.B)), 1.5), rect.Inflate(size * 0.2), radius * 1.6, radius * 1.6); - context.DrawRectangle(new SolidColorBrush(accent), new Pen(new SolidColorBrush(Mix(accent, Colors.White, 0.35)), 1.5), rect, radius, radius); + // The accent at a fifth over the plane, a two-pixel ring of it, a touch larger than its neighbours: the one + // thing the eye should find first, without a solid block of colour. + var ring = rect.Inflate(size * 0.06); + context.DrawRectangle( + new SolidColorBrush(Mix(_plane, accent, 0.2)), new Pen(new SolidColorBrush(accent), NativeTokens.BorderStrong), ring, radius * 1.15, radius * 1.15); } else { - var fill = new SolidColorBrush(Mix(_plane, area, room.Id == _hovered ? 0.55 : 0.3)); - var edge = room.Ahead ? new Pen(new SolidColorBrush(path), 2.2) : new Pen(new SolidColorBrush(area), 1.4); - context.DrawRectangle(fill, edge, rect, radius, radius); + var fill = new SolidColorBrush(Mix(_plane, _text, room.Id == _hovered ? 0.13 : 0.07)); + context.DrawRectangle(fill, room.Ahead ? new Pen(new SolidColorBrush(path), NativeTokens.BorderStrong) : edge, rect, radius, radius); if (room.Locked) { - var lockPen = new Pen(new SolidColorBrush(Faded(0.7)), 1.2); + var lockPen = new Pen(new SolidColorBrush(Faded(0.6)), 1.2); context.DrawLine(lockPen, rect.TopLeft + new Vector(size * 0.25, size * 0.25), rect.BottomRight - new Vector(size * 0.25, size * 0.25)); } } - DrawStairs(context, room, rect, room.Current ? Contrasting(accent) : _text); - if (room.Symbol is { } symbol && !room.Up && !room.Down) + DrawStairs(context, room, rect, room.Current ? _text : DimInk); + var mark = room.Symbol ?? (room.Current ? YouGlyph : null); + if (mark is not null && !room.Up && !room.Down && size >= 10) { - var mark = PanelText.Format(symbol, Math.Max(8, size * 0.5), room.Current ? Contrasting(accent) : _text, bold: true, size); - context.DrawText(mark, new Point(c.X - (mark.Width / 2), c.Y - (mark.Height / 2))); + var glyph = new FormattedText( + mark, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(NativeTokens.MonoFont), Math.Max(8, size * 0.42), new SolidColorBrush(_text)) + { + MaxLineCount = 1, + }; + context.DrawText(glyph, new Point(c.X - (glyph.Width / 2), c.Y - (glyph.Height / 2))); } if (room.Noted) @@ -737,9 +784,9 @@ public override void Render(DrawingContext context) if (room.Selected) { - // The room being edited: a ring in the draft colour, outside any halo, so it reads on the current room too. + // The room being edited: a ring in the draft colour, outside the room's own, so it reads on the current room too. var ring = new Pen(new SolidColorBrush(path), 2, new DashStyle([2, 1.5], 0)); - context.DrawRectangle(null, ring, rect.Inflate(size * 0.42), radius * 2.2, radius * 2.2); + context.DrawRectangle(null, ring, rect.Inflate(size * 0.3), radius * 2, radius * 2); } if ((names || room.Current) && room.Id != _hovered) @@ -755,21 +802,16 @@ public override void Render(DrawingContext context) } // What and where: the panel heading (Map, the area and level) with the area's colour as a mark before its name's - // line, then the room the character is in, or a walk under way, under it. + // line, then a walk under way, under it. The character's room is named under its own box. var heading = PanelText.Heading(context, PanelHeading.For(_model), bounds.Width, CellHeight, _plane, _text, right: NativeTokens.Space20, rule: NativeTokens.DevicePixel(this)); if (_model.AreaColour is { } areaHex) { context.DrawRectangle(new SolidColorBrush(Parse(areaHex)), null, new Rect(PanelText.Pad - 9, (heading / 2) - 5, 3, 10), 1.5, 1.5); } - var under = heading + 6; if (_model.Walking is { } walking) { - DrawText(context, walking, new Point(PanelText.Pad, under), 12, path); - } - else if (_model.Current is { } here) - { - DrawText(context, here.Name, new Point(PanelText.Pad, under), 12, accent); + DrawText(context, walking, new Point(PanelText.Pad, heading + NativeTokens.Space8), NativeTokens.Body, path); } if (_dragRoom is { } moving && byId.TryGetValue(moving.Id, out var shown)) @@ -786,45 +828,56 @@ public override void Render(DrawingContext context) DrawLookButtons(context); DrawLegend(context, bounds); + DrawHint(context, bounds); } + /// The mark in the character's room when the game gives it none: the roguelike's "you". + internal const string YouGlyph = "@"; + + /// The map's rule: a room's outline and an exit, the pane's ink a quarter of the way over its plane. + private Color RuleColour => Mix(_plane, _text, 0.24); + + /// The map's secondary ink (names, the legend, the hint): opaque, so it reads the same over a rule. + private Color DimInk => Mix(_plane, _text, 0.62); + private void DrawLookButtons(DrawingContext context) { foreach (var button in LookButtons()) { - var alpha = button.Enabled ? 1.0 : 0.4; + var hovered = button.Enabled && _buttonHovered == button.Id; context.DrawRectangle( - new SolidColorBrush(Mix(_plane, _text, 0.1)), - new Pen(new SolidColorBrush(Faded(0.35 * alpha)), 1), - button.Rect, - 4, - 4); - var label = PanelText.Format(button.Label, ButtonSize, Faded(0.9 * alpha), bold: false, button.Rect.Width); - context.DrawText(label, new Point(button.Rect.X + 7, button.Rect.Y + ((button.Rect.Height - label.Height) / 2))); + new SolidColorBrush(Mix(_plane, _text, hovered ? 0.13 : 0.07)), + new Pen(new SolidColorBrush(RuleColour), NativeTokens.DevicePixel(this)), + NativeTokens.StrokeRect(this, button.Rect), + NativeTokens.RadiusControl, + NativeTokens.RadiusControl); + var ink = button.Enabled ? _text : Mix(_plane, _text, 0.4); + var label = PanelText.Format(button.Label, ButtonSize, ink, bold: false, button.Rect.Width); + context.DrawText(label, new Point(Math.Round(button.Rect.X + NativeTokens.Space10), Math.Round(button.Rect.Y + ((button.Rect.Height - label.Height) / 2)))); } } /// Up and down marks: a small triangle at the top of the room for a way up, at the bottom for a way down. - private void DrawStairs(DrawingContext context, MapViewRoom room, Rect rect, Color ink) + private static void DrawStairs(DrawingContext context, MapViewRoom room, Rect rect, Color ink) { if (!room.Up && !room.Down) { return; } - var brush = new SolidColorBrush(Color.FromArgb(0xE0, ink.R, ink.G, ink.B)); - var w = rect.Width * 0.26; - var h = rect.Height * 0.2; + var brush = new SolidColorBrush(ink); + var w = rect.Width * 0.22; + var h = rect.Height * 0.18; var mid = rect.Center.X; if (room.Up) { - var top = rect.Y + (rect.Height * 0.16); + var top = rect.Y + (rect.Height * 0.18); context.DrawGeometry(brush, null, Triangle(new Point(mid, top), new Point(mid - w, top + h), new Point(mid + w, top + h))); } if (room.Down) { - var bottom = rect.Bottom - (rect.Height * 0.16); + var bottom = rect.Bottom - (rect.Height * 0.18); context.DrawGeometry(brush, null, Triangle(new Point(mid, bottom), new Point(mid - w, bottom - h), new Point(mid + w, bottom - h))); } } @@ -844,62 +897,86 @@ private static StreamGeometry Triangle(Point a, Point b, Point c) private void DrawName(DrawingContext context, string name, Point centre, double size, bool plate) { var maxWidth = plate ? 280 : Math.Max(30, (Spacing * Zoom) - 4); - var text = PanelText.Format(name, 11, plate ? _text : Faded(0.8), bold: plate, maxWidth); - var at = new Point(centre.X - (text.Width / 2), centre.Y + (size / 2) + 3); + var text = PanelText.Format(name, NativeTokens.Small, plate ? _text : DimInk, bold: plate, maxWidth); + var at = new Point(Math.Round(centre.X - (text.Width / 2)), Math.Round(centre.Y + (size / 2) + NativeTokens.Space4)); if (plate) { var back = new Rect(at.X - 6, at.Y - 2, text.Width + 12, text.Height + 4); - context.DrawRectangle(new SolidColorBrush(Mix(_plane, _text, 0.12)), new Pen(new SolidColorBrush(Faded(0.35)), 1), back, 4, 4); + context.DrawRectangle(new SolidColorBrush(Mix(_plane, _text, 0.1)), new Pen(new SolidColorBrush(RuleColour), 1), back, NativeTokens.RadiusS, NativeTokens.RadiusS); } else { // The pane's own plane behind the words, so an exit line passing under a room does not strike them out. - context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0xD0, _plane.R, _plane.G, _plane.B)), null, new Rect(at.X - 2, at.Y, text.Width + 4, text.Height), 2, 2); + context.DrawRectangle(new SolidColorBrush(_plane), null, new Rect(at.X - 2, at.Y, text.Width + 4, text.Height), 2, 2); } context.DrawText(text, at); } /// - /// The legend, in the bottom-left corner on a plate: you, the stairs, a walk, and each area in its colour. Drawn only - /// where it fits, and it never takes the pointer from a room under it (the canvas hit-tests rooms only). + /// The legend, a strip along the foot of the map above the hint: you, the stairs, a walk, and each area in its colour, + /// laid left to right and wrapped. The fit keeps the rooms above it (), so it covers none. /// - private const double LegendSize = 11, LegendRow = 16, LegendPad = 8, LegendSwatch = 9; + private const double LegendSize = NativeTokens.Small, LegendRow = 18, LegendSwatch = 8, LegendGap = NativeTokens.Space14; + + /// The hint's band at the foot of the canvas, its gaps included; a small margin when there is no hint. + private double HintBand() => _model.Hint is null ? NativeTokens.Space8 : NativeTokens.Space12 + NativeTokens.Space20; + + /// Each legend entry's place in a canvas of , by its index in . + private List<(Rect Area, int Index)> LegendLayout(Size size) + { + var entries = LegendEntries(); + var placed = new List<(Rect, int)>(); + var x = PanelText.Pad; + var row = 0; + var right = size.Width - PanelText.Pad; + for (var i = 0; i < entries.Count; i++) + { + var width = LegendSwatch + NativeTokens.Space6 + PanelText.Measure(entries[i].Label, LegendSize, bold: false); + if (x > PanelText.Pad && x + width > right) + { + x = PanelText.Pad; + row++; + } + + placed.Add((new Rect(x, row * LegendRow, Math.Max(1, Math.Min(width, right - x)), LegendRow), i)); + x += width + LegendGap; + } + + // Laid out from the top of the strip, then moved down so its last row ends above the hint. + var top = size.Height - HintBand() - ((row + 1) * LegendRow); + return placed.Select(p => (p.Item1.Translate(new Vector(0, top)), p.Item2)).ToList(); + } /// - /// Where the legend's plate is drawn in a canvas of , in the canvas's coordinates; null when - /// none is drawn (no rooms, or it would not fit). The window keeps its toasts off it (). + /// Where the legend is drawn in a canvas of , in the canvas's coordinates; null when none is + /// drawn (no rooms, or it would take more than a third of the height). The window keeps its toasts off it + /// (). /// internal Rect? LegendRect(Size size) { - if (_model.Rooms.Count == 0) + if (_model.Rooms.Count == 0 || size.Width <= 0) { return null; } - var entries = LegendEntries(); - var widest = entries.Max(e => PanelText.Measure(e.Label, LegendSize, bold: false)); - var width = LegendPad + LegendSwatch + 6 + widest + LegendPad; - var height = (LegendPad * 2) + (entries.Count * LegendRow) - (LegendRow - LegendSize - 3); - return width > size.Width * 0.6 || height > size.Height * 0.6 ? null : new Rect(10, size.Height - height - 10, width, height); + var area = LegendLayout(size).Select(e => e.Area).Aggregate((a, b) => a.Union(b)); + return area.Height > size.Height / 3 ? null : area.Inflate(new Thickness(NativeTokens.Space4, 0)); } private void DrawLegend(DrawingContext context, Rect bounds) { - if (LegendRect(bounds.Size) is not { } plate) + if (LegendRect(bounds.Size) is null) { return; } var entries = LegendEntries(); - const double size = LegendSize, row = LegendRow, pad = LegendPad, swatch = LegendSwatch; - var widest = entries.Max(e => PanelText.Measure(e.Label, size, bold: false)); - context.DrawRectangle(new SolidColorBrush(Color.FromArgb(0xE6, _plane.R, _plane.G, _plane.B)), new Pen(new SolidColorBrush(Faded(0.25)), 1), plate, 5, 5); - var y = plate.Y + pad; - foreach (var (label, colour) in entries) - { - var mark = new Rect(plate.X + pad, y + 2, swatch, swatch); - if (label == "stairs up / down") + foreach (var (area, index) in LegendLayout(bounds.Size)) + { + var (label, colour) = entries[index]; + var mark = new Rect(area.X, area.Y + ((area.Height - LegendSwatch) / 2), LegendSwatch, LegendSwatch); + if (label == StairsLabel) { var brush = new SolidColorBrush(colour); context.DrawGeometry(brush, null, Triangle(new Point(mark.Center.X, mark.Y), new Point(mark.X, mark.Center.Y - 0.5), new Point(mark.Right, mark.Center.Y - 0.5))); @@ -910,18 +987,28 @@ private void DrawLegend(DrawingContext context, Rect bounds) context.DrawRectangle(new SolidColorBrush(colour), null, mark, 2, 2); } - context.DrawText(PanelText.Format(label, size, Faded(0.85), bold: false, widest + 1), new Point(mark.Right + 6, y)); - y += row; + PanelText.Draw(context, label, mark.Right + NativeTokens.Space6, area.Center.Y, LegendSize, DimInk, bold: false, area.Right - mark.Right - NativeTokens.Space6 + 1); } } - /// Black or white, whichever reads on : the stairs marks on the accent room. - private static Color Contrasting(Color fill) => - (0.299 * fill.R) + (0.587 * fill.G) + (0.114 * fill.B) > 140 ? Color.FromRgb(0x10, 0x10, 0x14) : Colors.White; + /// The model's hint, centred at the foot of the map: what a click on a room does. + private void DrawHint(DrawingContext context, Rect bounds) + { + if (_model.Hint is not { } hint) + { + return; + } + + var text = PanelText.Format(hint, NativeTokens.Small, DimInk, bold: false, bounds.Width - (2 * PanelText.Pad)); + context.DrawText(text, new Point(Math.Round((bounds.Width - text.Width) / 2), Math.Round(bounds.Height - NativeTokens.Space12 - text.Height))); + } + + /// The legend's label for the stairs marks. + internal const string StairsLabel = "stairs up / down"; private static void DrawText(DrawingContext context, string text, Point at, double size, Color colour) => context.DrawText( - new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Typeface.Default, size, new SolidColorBrush(colour)) + new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(NativeTokens.UiFont), size, new SolidColorBrush(colour)) { MaxLineCount = 1, }, diff --git a/src/SharpMUTerm.Avalonia/NativeChrome.cs b/src/SharpMUTerm.Avalonia/NativeChrome.cs index e5b3e900..b9d2e9c0 100644 --- a/src/SharpMUTerm.Avalonia/NativeChrome.cs +++ b/src/SharpMUTerm.Avalonia/NativeChrome.cs @@ -234,6 +234,18 @@ protected Color Raised(double amount) return Color.FromRgb(Mix(Plane.R, target.R), Mix(Plane.G, target.G), Mix(Plane.B, target.B)); } + /// + /// The plane sunk by : darker on a dark theme, lighter on a light one — the well an input sits + /// in (the mockups' #10131a search box on the #171b24 header is about 0.3). + /// + protected Color Sunk(double amount) + { + var luma = (0.2126 * Plane.R) + (0.7152 * Plane.G) + (0.0722 * Plane.B); + var target = luma < 128 ? Colors.Black : Colors.White; + byte Mix(byte a, byte b) => (byte)Math.Round(a + ((b - a) * amount)); + return Color.FromRgb(Mix(Plane.R, target.R), Mix(Plane.G, target.G), Mix(Plane.B, target.B)); + } + /// /// The selection plate: the plane leaned toward the client's accent — about 14 % on a dark plane, the mockup's /// #1f3a3a on #141822 — a little further while hovered. Ink on it is held to the floor by the caller's @@ -379,7 +391,6 @@ internal sealed class NativeHeader(TerminalView view) : NativeChromeView(view) private Rect _brand; private Rect _search; private Rect _pill; - private Rect _counts; private Rect _prefix; private readonly List<(Rect Area, HeaderPrefixKey Key)> _keys = []; private Rect _exit; @@ -391,7 +402,7 @@ internal sealed class NativeHeader(TerminalView view) : NativeChromeView(view) protected override void Layout(ChromeOverlay overlay, List<(Rect Area, string Target, string Tip)> hits) { - _brand = _search = _pill = _counts = _prefix = _exit = default; + _brand = _search = _pill = _prefix = _exit = default; _keys.Clear(); var model = overlay.HeaderModel; const double size = FontSize; @@ -423,17 +434,10 @@ protected override void Layout(ChromeOverlay overlay, List<(Rect Area, string Ta return; } - var counts = CountsText(model); - var countsWidth = Measure(counts, size - 1); + // No counts beside the search box: the mockups' header is the brand, the search and the character. How many are + // connected is the sidebar's dots, the log and the recording mark are the footer's (StatusOverlay.Compact). var keyWidth = Measure(KeyGlyphs.Words(HeaderModel.PaletteKey), size - 1.5) + 12; var searchFloor = 18 + Measure("Search", size) + keyWidth + (pad * 3); - if (right - countsWidth - 20 - start >= searchFloor) - { - // The counts go to the left of the search box, which keeps its place beside the pill. - var searchWidth = Math.Min(360, right - countsWidth - 20 - start); - _counts = new Rect(right - searchWidth - 20 - countsWidth, 0, countsWidth, h); - } - if (right - start >= searchFloor) { // Beside the character's pill at the right, as the mockup sets it, rather than against the brand. @@ -475,10 +479,6 @@ private void LayoutPrefix(HeaderPrefix prefix, double start, double right, doubl } } - private static string CountsText(HeaderModel model) => - (model.Recording ? $"{HeaderModel.RecordingText} · " : string.Empty) - + (model.HasWorlds ? $"{model.ConnectedText} · {model.LogText}" : model.LogText); - protected override void PressedEmpty(PointerPressedEventArgs e) => View.WindowGestureFromChrome(e); public override void Render(DrawingContext context) @@ -512,11 +512,6 @@ public override void Render(DrawingContext context) DrawSearch(context, middle, radius); } - if (_counts.Width > 0) - { - Text(context, CountsText(model), _counts.X, middle, size - 1, Parse(overlay.Palette.HeaderMuted)); - } - if (model.Prefix is { } prefix) { DrawPrefix(context, prefix, overlay, middle); @@ -545,8 +540,8 @@ public override void Render(DrawingContext context) private void DrawSearch(DrawingContext context, double middle, double radius) { const double size = FontSize; - var fill = Hovered(_search) ? Raised(0.13) : Raised(0.07); - context.DrawRectangle(new SolidColorBrush(fill), NativeTokens.HairlinePen(this, Faint(0x30)), NativeTokens.StrokeRect(this, _search), radius, radius); + var fill = Hovered(_search) ? Raised(0.04) : Sunk(0.3); + context.DrawRectangle(new SolidColorBrush(fill), NativeTokens.HairlinePen(this, Faint(Hovered(_search) ? (byte)0x50 : (byte)0x30)), NativeTokens.StrokeRect(this, _search), radius, radius); // A magnifier: a ring and its handle. const double ring = 5; diff --git a/src/SharpMUTerm.Avalonia/NativeFooter.cs b/src/SharpMUTerm.Avalonia/NativeFooter.cs index 8bf8ddae..d81f1301 100644 --- a/src/SharpMUTerm.Avalonia/NativeFooter.cs +++ b/src/SharpMUTerm.Avalonia/NativeFooter.cs @@ -13,7 +13,9 @@ namespace SharpMUTerm.Avalonia; /// The window's status footer, across the bottom of the window under the cells and the sidebar (): /// the status row the client would have drawn in its last row, from the same — the connection, /// the mode's keys, meters, reconnect, ● REC, ♪ muted, the scrollback segment, a notice — in the UI face, -/// keys in words. The left cluster reads from the left edge and the right one ends at the right edge. +/// keys in words. The left cluster reads from the left edge and the right one ends at the right edge. At rest it draws the +/// row's compact form (: the connection, encoding and log, and one short hint, the +/// mockups' row), and the whole row while a notice or a mode prompt holds it. /// /// A run the client marked (a notice's action, the palette hint) is a link: a click hands its target back through /// , which runs the client's own method or refuses. Never focusable; every pointer @@ -41,7 +43,7 @@ public NativeFooter(TerminalView view) internal IReadOnlyList<(Rect Area, string Target)> Hits => _hits; /// The footer's text as drawn, keys in words. Internal for tests. - internal string Text => Overlay is { } o ? NativeKeys.Words(o.Model.Text) : string.Empty; + internal string Text => Overlay is { } o ? NativeKeys.Words(o.Shown.Text) : string.Empty; /// Takes what the client said and redraws. public void Show(StatusOverlay? overlay) @@ -66,7 +68,7 @@ internal void Click(string target) public override void Render(DrawingContext context) { - var plane = NativeChromeView.Parse(Overlay?.Model.Plane ?? HexOf(_view.Renderer.DefaultBackground)); + var plane = NativeChromeView.Parse(Overlay?.Shown.Plane ?? HexOf(_view.Renderer.DefaultBackground)); var bounds = new Rect(Bounds.Size); context.FillRectangle(new SolidColorBrush(plane), bounds); var ink = _view.Renderer.DefaultForeground; @@ -79,15 +81,15 @@ public override void Render(DrawingContext context) var middle = bounds.Height / 2; var right = bounds.Width - NativeLayout.FooterPadX - WindowChrome.EdgeBand; - var rightWidth = overlay.Model.Right.Sum(r => Format(r, plane).WidthIncludingTrailingWhitespace); + var rightWidth = overlay.Shown.Right.Sum(r => Format(r, plane).WidthIncludingTrailingWhitespace); var x = NativeLayout.FooterPadX; - foreach (var run in overlay.Model.Left) + foreach (var run in overlay.Shown.Left) { x += Draw(context, run, x, middle, plane, Math.Max(0, right - rightWidth - 16 - x)); } x = Math.Max(x + 16, right - rightWidth); - foreach (var run in overlay.Model.Right) + foreach (var run in overlay.Shown.Right) { x += Draw(context, run, x, middle, plane, Math.Max(0, right - x)); } @@ -140,7 +142,7 @@ private double Draw(DrawingContext context, StatusRun run, double x, double midd private static readonly Regex Gaps = new(" {3,}", RegexOptions.CultureInvariant); /// A run's ink: its own, else the row's (a run the cells write with no colour). - private Color InkOf(StatusRun run) => NativeChromeView.Parse(run.Ink ?? Overlay?.Model.Ink); + private Color InkOf(StatusRun run) => NativeChromeView.Parse(run.Ink ?? Overlay?.Shown.Ink); private static string HexOf(SkiaSharp.SKColor colour) => $"#{colour.Red:x2}{colour.Green:x2}{colour.Blue:x2}"; diff --git a/src/SharpMUTerm.Client/Chrome/StatusModel.cs b/src/SharpMUTerm.Client/Chrome/StatusModel.cs index 2737675e..278f47eb 100644 --- a/src/SharpMUTerm.Client/Chrome/StatusModel.cs +++ b/src/SharpMUTerm.Client/Chrome/StatusModel.cs @@ -62,6 +62,12 @@ public enum StatusRole /// A mode prompt that displaces the row (moving or dragging a window). Prompt, + + /// Whether the character in front is being logged (Log off, Log html): the compact row's. + Log, + + /// Where unread lines are waiting (2 new in Chat): the compact row's. + Activity, } /// One part of the status row: its role and its runs. diff --git a/src/SharpMUTerm.Client/Panels/MapViewModel.cs b/src/SharpMUTerm.Client/Panels/MapViewModel.cs index 94645457..c88e0456 100644 --- a/src/SharpMUTerm.Client/Panels/MapViewModel.cs +++ b/src/SharpMUTerm.Client/Panels/MapViewModel.cs @@ -135,6 +135,18 @@ public sealed record MapViewModel(string? Area, int Level, IReadOnlyListWhat an undo would take back, or null when nothing would. public string? UndoLabel { get; init; } + /// What a click on a room does, as a host words it under the map; null when no click would do anything. + public string? Hint => + Editing ? EditHint + : Walking is not null || Rooms.Count < 2 ? null + : WalkHint; + + /// The map's hint while a click walks. + public const string WalkHint = "Click a room to walk there"; + + /// The map's hint while a click picks the room to edit. + public const string EditHint = "Click a room to edit it"; + /// The colour of the area the view draws, or null when that area has no name. public string? AreaColour => Areas.FirstOrDefault(a => a.Drawn)?.Colour; diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs index 641e4c69..4f042ea9 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Footer.cs @@ -3,6 +3,8 @@ using SharpMUTerm.Client.Chrome; using SharpMUTerm.Client.Palette; using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Workspaces; namespace SharpMUTerm.Tui; @@ -55,7 +57,103 @@ private void PublishStatus() internal StatusOverlay BuildStatusOverlay() { _statusActivate ??= target => OnUiThread(() => ActivateStatusTarget(target)); - return new StatusOverlay(BuildStatusModel(), MainWindowInFront(), _statusActivate); + var model = BuildStatusModel(); + return new StatusOverlay(model, MainWindowInFront(), _statusActivate) { Compact = CompactStatus(model) }; + } + + /// + /// The status row as a host with a header and tab badges of its own words it (the window's footer, the mockups' row): + /// on the left the connection, the encoding in force and the log; on the right the state the row alone says + /// (scrolled back, ● REC, ♪ muted) and one short hint — the mode's keys while a mode holds that nothing + /// else on screen names, else where unread lines are waiting (2 new in Chat). Built from the same facts as + /// ; null while a notice or a mode prompt is on the row, which the footer then draws whole. + /// The meters, the room, the typed count and the focus keys stay the cells': the window draws the first two as + /// panels, and its command line, tabs and header search say the rest. Internal for tests. + /// + internal StatusModel? CompactStatus(StatusModel row) + { + if (row.Notice is not null || row.LeftSegments.Concat(row.RightSegments).Any(s => s.Role == StatusRole.Prompt)) + { + return null; + } + + var left = new List(); + var identity = row.LeftSegments.FirstOrDefault(s => s.Role == StatusRole.Identity); + if (identity is not null) + { + left.Add(identity); + if (EffectiveEncoding() is { } encoding) + { + left.Add(Segment(StatusRole.Encoding, Dim(CompactEncoding(encoding.Label)))); + } + + var log = HeaderLogFormat(); + left.Add(Segment(StatusRole.Log, Dim(log == LogFormat.None ? "Log off" : $"Log {log.ToString().ToLowerInvariant()}"))); + } + else + { + left.Add(Segment(StatusRole.Text, Dim("Not connected"))); + } + + // A split pane's band says how far back it is and its own way back in the window, with a button; every other + // mode is said here. + var mode = CurrentStatusMode(); + var right = row.RightSegments + .Where(s => s.Role is StatusRole.Recording or StatusRole.Muted + || (s.Role == StatusRole.Scrollback && mode != StatusMode.SplitScrollback)) + .ToList(); + + if (mode is not StatusMode.None and not StatusMode.SplitScrollback && ModeHintSegments(mode).FirstOrDefault() is { } hint) + { + right.Add(hint); + } + else if (UnreadHint() is { } unread) + { + right.Add(unread); + } + + if (identity is null) + { + right.Add(Segment(StatusRole.Palette, Dim(PaletteHintText, HeaderModel.PaletteTarget))); + } + + return new StatusModel(left, right, row.Plane, row.Ink) { Width = row.Width }; + } + + /// utf-8 assumed as the mockups write a charset: the name in capitals, its qualifier as it was. + internal static string CompactEncoding(string label) + { + var space = label.IndexOf(' ', StringComparison.Ordinal); + return space < 0 ? label.ToUpperInvariant() : label[..space].ToUpperInvariant() + label[space..]; + } + + /// + /// Where the character in front has unread lines, as the compact row says it: 2 new in Chat, the window with + /// most first, · 1 in Pages for a second, · +2 more past that; null when nothing is waiting. + /// + private StatusSegment? UnreadHint() + { + var waiting = _workspace.WindowsFor(ActiveCharacterKey()) + .Where(w => w.Unread > 0) + .OrderByDescending(w => w.Unread) + .ToList(); + if (waiting.Count == 0) + { + return null; + } + + var text = $"{UnreadBadge.Format(waiting[0].Unread)} new in {Snippet(RailWindowLabel(waiting[0], waiting[0].Kind == WindowKind.Main))}"; + if (waiting.Count > 1) + { + text += $" · {UnreadBadge.Format(waiting[1].Unread)} in {Snippet(RailWindowLabel(waiting[1], waiting[1].Kind == WindowKind.Main))}"; + } + + if (waiting.Count > 2) + { + text += $" · +{waiting.Count - 2} more"; + } + + return Segment(StatusRole.Activity, Dim(text)); } /// The status row's model, as last painted: the instance the cells were rendered from. Internal for tests. @@ -225,7 +323,17 @@ private void PublishInputBand() /// What the row says. /// Whether the main window is in front; while a modal is, the footer takes no click. /// Acts on a run's target; safe from any thread, and the same instance for the life of the app. -internal sealed record StatusOverlay(StatusModel Model, bool Interactive, Action Activate); +internal sealed record StatusOverlay(StatusModel Model, bool Interactive, Action Activate) +{ + /// + /// The row as the window's footer words it (), from the same facts as + /// ; null while a notice or a mode prompt holds the row, when the footer draws . + /// + public StatusModel? Compact { get; init; } + + /// What the footer draws: the compact row, else the row. + public StatusModel Shown => Compact ?? Model; +} /// A command line's prompt, by the screen row its first line is on, as plain text. internal sealed record InputPrompt(int Row, string Text); diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeMapViewTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeMapViewTests.cs index 797df068..10672969 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeMapViewTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeMapViewTests.cs @@ -155,5 +155,44 @@ public async Task TheRoomMenuOffersResetOnlyForARoomEditedByHand() await Assert.That(MapEditing.Menu(model.Rooms[0], null).Entries.Select(e => e.Command)).DoesNotContain(MapEditing.ResetVerb); } + /// + /// The mockup's map (wave 22): the fit keeps every room clear of what is drawn above it (the look buttons, sized to the + /// window's small controls) and below it (the legend strip and the model's hint), so the legend covers no room. + /// + [Test] + public async Task TheFittedRoomsAreClearOfTheButtonsTheLegendAndTheHint() + { + var (rooms, legend, buttons, height, hint) = await DesktopLayerTests.Run((window, view, layer, driver) => + { + var model = Model(editing: false) with + { + Rooms = + [ + new MapViewRoom(1, "Plaza", 0, 0, Current: true, Ahead: false, Locked: false), + new MapViewRoom(2, "North Road", 0, -1, Current: false, Ahead: false, Locked: false), + new MapViewRoom(3, "South Road", 0, 2, Current: false, Ahead: false, Locked: false), + new MapViewRoom(4, "Gate", 2, 2, Current: false, Ahead: false, Locked: false, Elsewhere: "Docks"), + ], + }; + Publish(driver, model); + Dispatcher(); + window.UpdateLayout(); + var canvas = layer.Maps.Values.Single(); + var size = canvas.Bounds.Size; + var rooms = canvas.Model.Rooms.Select(r => canvas.CentreOf(r)).ToList(); + return (rooms, canvas.LegendRect(size)!.Value, canvas.LookButtons().Select(b => b.Rect).ToList(), canvas.Bounds.Height, canvas.Model.Hint); + }, columns: 60, rows: 24); + + await Assert.That(hint).IsEqualTo(MapViewModel.WalkHint); + await Assert.That(buttons.All(b => b.Height == NativeTokens.ControlHeightSmall)).IsTrue(); + foreach (var centre in rooms) + { + await Assert.That(centre.Y).IsLessThan(legend.Top).Because("no room under the legend"); + await Assert.That(centre.Y).IsGreaterThan(buttons.Max(b => b.Bottom)).Because("no room under the look buttons"); + } + + await Assert.That(legend.Bottom).IsLessThan(height - NativeTokens.Space20).Because("the hint has its own line under the legend"); + } + private static void Dispatcher() => global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); } diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 253fa5e2..ade00e3d 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -1497,6 +1497,34 @@ public async Task TheQuickBarReadsTheHostsKeys() await Assert.That(free.Fires).IsTrue(); } + /// + /// The footer's compact row (wave 22): at rest the window draws the connection, the encoding and the log on the left + /// and where unread lines wait on the right — the mockups' row — built from the facts the cell row was built from, the + /// identity segment the same instance's; a notice puts the whole row back. + /// + [Test] + public async Task TheFootersCompactRowIsTheRowsFactsInTheMockupsWords() + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot(null); + var status = driver.Pointer.Status!; + var compact = status.Compact!; + await Assert.That(compact).IsNotNull(); + await Assert.That(compact.LeftSegments.Select(s => s.Role)).IsEquivalentTo( + new[] { StatusRole.Identity, StatusRole.Encoding, StatusRole.Log }, TUnit.Assertions.Enums.CollectionOrdering.Matching); + await Assert.That((object)compact.LeftSegments[0]).IsEqualTo(status.Model.LeftSegments.Single(s => s.Role == StatusRole.Identity)); + await Assert.That(compact.LeftSegments[1].Text).IsEqualTo("UTF-8").Because("the charset in capitals, as the mockups write it"); + await Assert.That(compact.LeftSegments[2].Text).IsEqualTo("Log off").Because("a snapshot owns no log root"); + await Assert.That(compact.RightSegments.Single().Text).IsEqualTo("2 new in Chat"); + await Assert.That(status.Shown).IsSameReferenceAs(compact); + await Assert.That(SharpMUTermApp.CompactEncoding("iso-8859-1 forced")).IsEqualTo("ISO-8859-1 forced"); + + app.RenderSnapshot("notices"); + await Assert.That(driver.Pointer.Status!.Compact).IsNull().Because("a notice is drawn whole"); + await Assert.That((object)driver.Pointer.Status!.Shown).IsEqualTo(driver.Pointer.Status!.Model); + } + // ── helpers ────────────────────────────────────────────────────────────────────────────────── private static SharpMUTermApp App( diff --git a/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs b/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs index 3e76faf2..b1ee13aa 100644 --- a/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/PanelModelTests.cs @@ -36,6 +36,12 @@ public async Task TheMapViewIsTheCurrentLevelAndAreaWithEachExitOnce() await Assert.That(view.Current!.Name).IsEqualTo("Plaza"); await Assert.That(view.Rooms.Single(r => r.Id == 2).Ahead).IsTrue(); await Assert.That(MapViewModel.From(map, 1, [2], "walking, 1 to go")).IsEqualTo(view); + + // The hint a host writes under the map says what a click does: nothing while a walk is under way, walk otherwise. + await Assert.That(view.Hint).IsNull().Because("a walk is under way"); + await Assert.That(MapViewModel.From(map, 1, [], null).Hint).IsEqualTo(MapViewModel.WalkHint); + await Assert.That(MapViewModel.From(map, 1, [], null, selected: 2).Hint).IsEqualTo(MapViewModel.EditHint); + await Assert.That(MapViewModel.From(map, 4, [], null).Hint).IsNull().Because("a lone room has nowhere to walk"); } /// From f009b1c6db548fa453b176e520de6702eb92d570 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 20:08:01 +0000 Subject: [PATCH 079/113] Wave 22 B: the composer's Command and Text fields, in both hosts A post is now a command field and a text in one ComposerModel. The window's docked panel and F1 draw a Command box over the Text well; the cell docked composer and F1 draw a command row above the editor (Tab switches fields). What is sent is the command, unescaped, in front of the escaped, %r-joined text (ComposeMessage.Build(command, body, escaping)); a blank command sends the text as the whole command, as before. A MOO edit has no command field. The command is kept with the draft and after a send. SurfaceParityTests probe the split send and the kept command in both hosts. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 +- CLAUDE.md | 11 ++ src/SharpMUTerm.Avalonia/ComposerView.cs | 172 ++++++++++++++++-- .../Composer/ComposerModel.cs | 62 ++++++- .../Composer/ComposerSession.cs | 18 ++ .../Commands/ComposeMessage.cs | 48 +++++ src/SharpMUTerm.Tui/ComposeOverlay.cs | 102 +++++++++-- .../Panels/ComposerCommandRow.cs | 96 ++++++++++ src/SharpMUTerm.Tui/Panels/DockedComposer.cs | 93 ++++++++-- .../SharpMUTermApp.NativeComposer.cs | 26 ++- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 58 ++++-- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 35 +++- .../NativeComposerTests.cs | 49 +++++ .../SurfaceParityTests.cs | 68 ++++++- .../ComposerModelTests.cs | 47 ++++- .../Commands/ComposeMessageTests.cs | 34 ++++ .../NativeComposerRoutingTests.cs | 2 +- 17 files changed, 837 insertions(+), 91 deletions(-) create mode 100644 src/SharpMUTerm.Tui/Panels/ComposerCommandRow.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index fba49bb6..74e2d7bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,12 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] - In the desktop window, the header shows only the search box and your character, and the status bar reads "Corvid connected · UTF-8 · Log off" with a short hint on the right such as "2 new in Chat" (or the keys of the mode you are in). Notices still take the whole bar while they show. - +- The composer has a Command field above the text, in F1 and the docked panel, in the terminal and the desktop window: + put the verb there (`+pose`, `say`, `+bbpost 3=`) and write the post below it. ⇥ moves between the two (⏎ in the + command moves on to the text); the command is sent in front of the text unescaped, joined by a space (none after + `=` or a one-character shorthand like `:`), and it stays after a send for the next post. Leave it empty to write the + whole command in the text as before. The window's docked panel now reads as the design: Command and Text fields, the + Literal/As typed chip, `2 paragraphs · 31 words`, Preview and Send. - The package review keeps ⏎ install and Esc cancel on screen at 80×24: the review scrolls (↑↓ PgUp PgDn Home End) under its keys and stops above the command line. - Browse worlds: a world listed at several addresses (TLS and plain, another port, an old one) now lets you choose diff --git a/CLAUDE.md b/CLAUDE.md index 975bc9b9..416d0ca8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1776,6 +1776,17 @@ draws ⌃P natively (`INativePalette`, null for the cell popup), whether it draw over the tail of a tab the framework drew, name or `×`, and the framework (subscribed later, inside `Run()`) would select or close it on the same click. The button flags are struck from the shared list, leaving a movement; the chip rects are a snapshot array published per frame. Both hosts go through that handler (`AClickOnTheChipDoesNotAlso…`). +- **A post is a command field and a text, in one model** (`ComposerModel.Verb`, `HasCommandField`, `HeadingVerb`; + `ComposeMessage.Build(command, body, escaping)`/`Join`/`CleanCommand`, Core; Tui `ComposerCommandRow`, a one-row + editor F1 and `DockedComposer` place above the text; `ComposeResult.Verb`; `ComposerSession.EditedCommand`; Avalonia + `ComposerView`'s command box). The body is built exactly as before and the command is put in front **unescaped**, one + space between (none after `=` or a lone punctuation shorthand); a blank command is the old single buffer, so a text + starting with its verb still sends as it did. ⇥/⇧⇥ move between the fields and ⏎ in the command moves to the text + (`DockedComposer.InCommand`/`Focused`, which the focus pin and `HandleComposerKey` follow; where the caret is is never + in the model). The command survives a send (`ForgetComposeText`), so a verb-only draft is kept and the quit prompt + does not count it. An edit has no command field. The window's docked panel is the mockup's: Command over its box, + Text over the well (both shown from 232 px), summary without the chars (in its tooltip). `SurfaceParityTests` sends + the same post from both hosts' two fields. - **The composer says how long the post is as sent, and ⌥P shows it** (`ComposerModel.Characters`/`SentLength`, the escaped and `%r`-joined command; a MOO edit counts its text). F1 and the docked panel carry the `N chars` cell in both hosts; ⌥P toggles an *as sent* band under F1 (`ComposeOverlay.Preview`, run-wide, shared with the native editor via diff --git a/src/SharpMUTerm.Avalonia/ComposerView.cs b/src/SharpMUTerm.Avalonia/ComposerView.cs index 72b94fd5..cc816991 100644 --- a/src/SharpMUTerm.Avalonia/ComposerView.cs +++ b/src/SharpMUTerm.Avalonia/ComposerView.cs @@ -58,6 +58,13 @@ internal sealed class ComposerView : Border private readonly WrapPanel _keys; private readonly Border _rule; + // The command field above the text (ComposerModel.Verb): a one-line box, its label, and the text's label. + private readonly TextBox _command; + private readonly Border _commandWell; + private readonly TextBlock _commandLabel; + private readonly TextBlock _textLabel; + private readonly Control _commandRow; + // The docked panel's own parts: the editor's framed well, and the footer's summary, Preview and Send. private readonly Border? _well; private readonly TextBlock _summary = new() { VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; @@ -92,6 +99,52 @@ public ComposerView(TerminalView view, bool fullScreen) _editor.AddHandler(PointerPressedEvent, (_, _) => AskToArm(), RoutingStrategies.Tunnel, handledEventsToo: true); _editor.GotFocus += (_, _) => AskToArm(); _editor.ContextRequested += OnContextRequested; + _command = new TextBox + { + AcceptsReturn = false, + AcceptsTab = false, + Background = Brushes.Transparent, + BorderThickness = default, + Padding = new Thickness(NativeTokens.Space10, NativeTokens.Space6), + MinHeight = 0, + VerticalContentAlignment = VerticalAlignment.Center, + PlaceholderText = ComposerModel.CommandPlaceholder, + MaxLength = 200, + }; + AutomationProperties.SetName(_command, "Command"); + ToolTip.SetTip(_command, "The command the text is sent with: +pose, say, +bbpost 3= (Tab moves to the text)"); + _command.TextChanged += (_, _) => OnCommandChanged(); + _command.AddHandler(KeyDownEvent, OnCommandKeyDown, RoutingStrategies.Tunnel); + _command.AddHandler(PointerPressedEvent, (_, _) => AskToArm(), RoutingStrategies.Tunnel, handledEventsToo: true); + _command.GotFocus += (_, _) => AskToArm(); + _commandWell = new Border + { + Child = _command, + CornerRadius = new CornerRadius(NativeTokens.RadiusControl), + BorderThickness = new Thickness(NativeTokens.Hairline), + ClipToBounds = true, + }; + _commandLabel = new TextBlock { Text = ComposerModel.CommandLabel, VerticalAlignment = VerticalAlignment.Center }; + _textLabel = new TextBlock { Text = ComposerModel.TextLabel }; + if (fullScreen) + { + // F1: one row under the header, the label beside the box. + var row = new DockPanel { LastChildFill = true }; + _commandLabel.Margin = new Thickness(0, 0, NativeTokens.Space10, 0); + DockPanel.SetDock(_commandLabel, Dock.Left); + row.Children.Add(_commandLabel); + row.Children.Add(_commandWell); + _commandRow = new Border { Child = row, Padding = new Thickness(NativeTokens.Space24, NativeTokens.Space8) }; + } + else + { + // Docked, as the mockup's panel: Command over its box, then Text over the editor's well. + _commandLabel.Margin = new Thickness(PanelText.Pad, NativeTokens.Space12, PanelText.Pad, 0); + _commandWell.Margin = new Thickness(PanelText.Pad, NativeTokens.Space6, PanelText.Pad, 0); + _commandRow = new StackPanel { Children = { _commandLabel, _commandWell } }; + _textLabel.Margin = new Thickness(PanelText.Pad, NativeTokens.Space12, PanelText.Pad, 0); + } + _marks = new MarkLayer(_editor); _gutter = new LineGutter(_editor) { IsVisible = false }; @@ -175,7 +228,7 @@ public ComposerView(TerminalView view, bool fullScreen) _well = new Border { Child = text, - Margin = new Thickness(PanelText.Pad, NativeTokens.Space12, PanelText.Pad, 0), + Margin = new Thickness(PanelText.Pad, NativeTokens.Space6, PanelText.Pad, 0), CornerRadius = new CornerRadius(NativeTokens.RadiusControl), BorderThickness = new Thickness(NativeTokens.Hairline), ClipToBounds = true, @@ -188,12 +241,17 @@ public ComposerView(TerminalView view, bool fullScreen) body.Children.Add(_gutter); body.Children.Add(page); - var grid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto,Auto") }; + var grid = new Grid { RowDefinitions = new RowDefinitions("Auto,Auto,Auto,*,Auto,Auto") }; Grid.SetRow(_header, 0); - Grid.SetRow(body, 1); - Grid.SetRow(_preview, 2); - Grid.SetRow(_footer, 3); + Grid.SetRow(_commandRow, 1); + Grid.SetRow(_textLabel, 2); + Grid.SetRow(body, 3); + Grid.SetRow(_preview, 4); + Grid.SetRow(_footer, 5); + _textLabel.IsVisible = !fullScreen; grid.Children.Add(_header); + grid.Children.Add(_commandRow); + grid.Children.Add(_textLabel); grid.Children.Add(body); grid.Children.Add(_preview); grid.Children.Add(_footer); @@ -287,6 +345,20 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col if (model.Revision != _applied) { _applied = model.Revision; + if (!string.Equals(ComposeMessage.CleanCommand(_command.Text), model.Verb, StringComparison.Ordinal)) + { + _applying = true; + try + { + _command.Text = model.Verb; + _command.CaretIndex = model.Verb.Length; + } + finally + { + _applying = false; + } + } + if (!string.Equals(_editor.Text ?? string.Empty, model.Body, StringComparison.Ordinal)) { _applying = true; @@ -327,6 +399,7 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col } _rule.IsVisible = !_fullScreen && model.Armed; + if (_armed != model.Armed) { var was = _armed; @@ -338,7 +411,7 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col Dispatcher.UIThread.Post(() => _editor.Focus(), DispatcherPriority.Input); } } - else if (was == true && _editor.IsKeyboardFocusWithin) + else if (was == true && (_editor.IsKeyboardFocusWithin || _command.IsKeyboardFocusWithin)) { _view.Focus(); } @@ -348,6 +421,12 @@ public void Show(ComposerModel model, ComposerSession session, PanelInk ink, Col /// The gutter of line numbers, shown for a script. Internal for tests. internal LineGutter Gutter => _gutter; + /// The command field. Internal for tests. + internal TextBox CommandBox => _command; + + /// Whether the command field is shown (a post) and what it holds, for a test. + internal string? CommandText => _commandRow.IsVisible ? _command.Text ?? string.Empty : null; + /// The header's length cell as drawn. Internal for tests. internal string CountText => _count.Text ?? string.Empty; @@ -383,12 +462,24 @@ private void Paint() _header.BorderThickness = new Thickness(0, 0, 0, NativeTokens.Hairline); _footer.BorderBrush = _header.BorderBrush; _footer.BorderThickness = _fullScreen ? new Thickness(0, NativeTokens.Hairline, 0, 0) : default; + var tokens = NativeTokens.For(null, Luma(_plane) < 0.5); if (_well is not null) { + // The mockup's Text field: the well's ground, ringed in the focus edge, as the field the post is written in. _well.Background = new SolidColorBrush(Well); - _well.BorderBrush = new SolidColorBrush(Mix(_plane, _text, 0.2)); + _well.BorderBrush = new SolidColorBrush(tokens.Focus); } + // The Command field: the same ground, ringed in the quieter edge. + _commandWell.Background = new SolidColorBrush(_fullScreen ? Mix(_plane, _text, 0.05) : Well); + _commandWell.BorderBrush = new SolidColorBrush(tokens.Edge); + _command.Foreground = new SolidColorBrush(_text); + _command.CaretBrush = new SolidColorBrush(Accent); + _command.SelectionBrush = new SolidColorBrush(Color.FromArgb(0x70, Accent.R, Accent.G, Accent.B)); + _command.SelectionForegroundBrush = new SolidColorBrush(_text); + _commandLabel.Foreground = new SolidColorBrush(Dim); + _textLabel.Foreground = new SolidColorBrush(Dim); + _summary.Foreground = new SolidColorBrush(Dim); PaintButton(_previewButton, accent: false); PaintButton(_sendButton, accent: true); @@ -422,6 +513,10 @@ private void ApplyFont() _target.FontSize = _fullScreen ? ui : PanelText.Size; _count.FontSize = ui - 1; _summary.FontSize = PanelText.Size - 1; + _commandLabel.FontSize = _fullScreen ? ui - 1 : PanelText.Size - 1; + _textLabel.FontSize = PanelText.Size - 1; + _command.FontSize = Math.Clamp(cell * 0.8, 11, 18); + _command.FontFamily = NativeTokens.CellFace(_view.Renderer.Fonts.FamilyName); foreach (var button in new[] { _previewButton, _sendButton }) { if (button.Child is TextBlock words) @@ -532,6 +627,12 @@ private void Label(ComposerModel model) } _preview.IsVisible = _fullScreen && model.Preview && model.Edit is null; + + // The command field and the Text label: a post's, and in a docked pane only while there is room for them over an + // editor worth writing in — the heading, both labels, the field, two lines of text and the footer are about 232 px. + var roomForCommand = _fullScreen || Bounds.Height is 0 or >= 232; + _commandRow.IsVisible = model.HasCommandField && roomForCommand; + _textLabel.IsVisible = !_fullScreen && model.HasCommandField && roomForCommand; SyncLength(); _keys.Children.Clear(); @@ -655,18 +756,21 @@ private void SyncLength() } var text = _editor.Text ?? string.Empty; - _count.Text = ComposerModel.CharactersLabel(ComposerModel.SentLength(text, model.Escaping, model.Edit is not null)); + var verb = model.HasCommandField ? _command.Text : null; + _count.Text = ComposerModel.CharactersLabel(ComposerModel.SentLength(verb, text, model.Escaping, model.Edit is not null)); if (!_fullScreen) { - // 2 paragraphs · 31 words · 240 chars; before anything is written, the keys that move in and out of it. + // 2 paragraphs · 31 words, the mockup's footer, with the length as sent in its tooltip (the chars count would + // elide the words in a 380 px column); before anything is written, the keys that move in and out of it. var summary = ComposerModel.Summary(text); _summary.Text = summary.Length > 0 - ? $"{summary} · {_count.Text}" + ? summary : NativeKeys.Words(model.Armed ? "Esc command line · F1 full screen" : "F1 full screen"); + ToolTip.SetTip(_summary, summary.Length > 0 ? $"{_count.Text} as sent" : null); } if (_preview.IsVisible) { - var command = ComposeMessage.Build(text.Replace("\r\n", "\n", StringComparison.Ordinal), model.Escaping); + var command = ComposeMessage.Build(verb, text.Replace("\r\n", "\n", StringComparison.Ordinal), model.Escaping); _previewText.Text = command ?? "nothing yet"; } } @@ -686,6 +790,40 @@ private void OnTextChanged() } } + /// The command field changed: the length cell follows, and the client is told unless it wrote it. + private void OnCommandChanged() + { + SyncLength(); + if (_session is { } session && !_applying) + { + session.EditedCommand(_command.Text ?? string.Empty); + } + } + + /// + /// A key in the command field: ⏎ and ⇥ move on to the text (a command is one line), and every composer chord — ⌃S, + /// ⌥L, ⌥P, Esc, the keys a docked editor hands the client — means what it means in the text. + /// + private void OnCommandKeyDown(object? sender, KeyEventArgs e) + { + var mods = e.KeyModifiers & (KeyModifiers.Control | KeyModifiers.Alt | KeyModifiers.Shift); + if ((e.Key == Key.Enter && mods == KeyModifiers.None) || (e.Key == Key.Tab && mods == KeyModifiers.None)) + { + e.Handled = true; + _editor.Focus(); + return; + } + + if (e.Key == Key.W && mods == KeyModifiers.Alt) + { + // ⌥W is a word of the text; in the command field it does nothing. + e.Handled = true; + return; + } + + OnEditorKeyDown(sender, e); + } + private void AskToArm() { if (!_fullScreen && _model is { Armed: false } && _session is { } session) @@ -722,6 +860,18 @@ private void OnEditorKeyDown(object? sender, KeyEventArgs e) session.Send(text); return; + case (Key.Tab, KeyModifiers.Shift) when model.HasCommandField && ReferenceEquals(sender, _editor): + // ⇧⇥ from the text back to the command field; ⇥ from the command field is its own handler's. + e.Handled = true; + _command.Focus(); + return; + + case (Key.Tab, KeyModifiers.None) when model.HasCommandField && ReferenceEquals(sender, _editor): + e.Handled = true; + _command.Focus(); + _command.SelectAll(); + return; + case (Key.L, KeyModifiers.Alt): e.Handled = true; session.ToggleEscaping(); diff --git a/src/SharpMUTerm.Client/Composer/ComposerModel.cs b/src/SharpMUTerm.Client/Composer/ComposerModel.cs index 2424c668..a93d6c6f 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerModel.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerModel.cs @@ -83,8 +83,21 @@ public sealed record ComposerModel( IReadOnlyList Marks, IReadOnlyList Keys) { - /// What ⌃S sends for this draft: , or null for nothing (or an edit). - public string? Command => Edit is null ? ComposeMessage.Build(Body, Escaping) : null; + /// + /// The command field: the verb the text is sent with (+pose, +bbpost 12=), drawn above the text in both + /// hosts. Empty for none — then the text is the whole command, verb and all, as the single buffer always was — and + /// always empty for an edit, which has no command field. + /// + public string Verb { get; init; } = string.Empty; + + /// Whether the composer draws a command field: a post does; a MOO or script edit is its lines alone. + public bool HasCommandField => Edit is null; + + /// + /// What ⌃S sends for this draft: of the command and + /// the text, or null for nothing (or an edit). + /// + public string? Command => Edit is null ? ComposeMessage.Build(Verb, Body, Escaping) : null; /// /// Whether F1 shows the post as it will be sent (⌥P) — the %r-joined, escaped command — under the editor. The @@ -93,7 +106,7 @@ public sealed record ComposerModel( public bool Preview { get; init; } /// The header's length cell for this draft: . - public int Characters => SentLength(Body, Escaping, Edit is not null); + public int Characters => SentLength(Verb, Body, Escaping, Edit is not null); /// /// How long a draft is as the game will get it: the length of 's command, with its @@ -107,6 +120,17 @@ public static int SentLength(string body, ComposeEscaping escaping, bool edit) return edit ? body.TrimEnd('\n').Length : ComposeMessage.Build(body, escaping)?.Length ?? 0; } + /// + /// of a post written as a command and its text: the length of + /// the one line the two fields make. + /// + public static int SentLength(string? verb, string body, ComposeEscaping escaping, bool edit) + { + ArgumentNullException.ThrowIfNull(body); + body = body.Replace("\r\n", "\n", StringComparison.Ordinal); + return edit ? body.TrimEnd('\n').Length : ComposeMessage.Build(verb, body, escaping)?.Length ?? 0; + } + /// The length cell's words: 1 char, 240 chars. public static string CharactersLabel(int count) => count == 1 ? "1 char" : $"{count:N0} chars"; @@ -143,10 +167,27 @@ public static string Summary(string body) } /// - /// The verb the post starts with — +pose, say — for the docked header, so a reader can see what the - /// buffer will be sent as without reading it. Empty for an empty buffer. + /// What the docked header names the post by — +pose, say — so a reader can see what it will be sent as + /// without reading it: the command field, elided to sixteen characters, or with none the text's first word. Empty for + /// an empty post. /// - public string Verb => VerbOf(Body); + public string HeadingVerb + { + get + { + var verb = ComposeMessage.CleanCommand(Verb); + return verb.Length == 0 ? VerbOf(Body) : verb.Length <= 16 ? verb : verb[..15] + "…"; + } + } + + /// The command field's label in both hosts. + public const string CommandLabel = "Command"; + + /// The text field's label in both hosts. + public const string TextLabel = "Text"; + + /// What an empty command field says: what goes there, and that it may be left empty. + public const string CommandPlaceholder = "+pose, say, +bbpost 3= … or none"; /// /// The model for a composer's state. The keys are worked out here, so the cells and the window offer the same row: @@ -164,7 +205,8 @@ public static ComposerModel Create( bool canSend, bool armed, long revision, - bool preview = false) + bool preview = false, + string verb = "") { ArgumentNullException.ThrowIfNull(target); ArgumentNullException.ThrowIfNull(body); @@ -184,6 +226,7 @@ public static ComposerModel Create( KeysFor(place, edit is not null, checker is not null, canSend, armed, preview, edit)) { Preview = preview && place == ComposerPlace.FullScreen && edit is null, + Verb = edit is null ? (verb ?? string.Empty).Replace("\r\n", " ", StringComparison.Ordinal).Replace('\n', ' ') : string.Empty, }; } @@ -223,6 +266,9 @@ public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, docked.Add(new("F1", "full screen", "full")); docked.Add(new("Esc", "command line", "back")); + + // Last, so a narrow pane elides it before the way back. + docked.Add(new("⇥", "command ↔ text", "field")); return docked; } @@ -248,6 +294,7 @@ public static IReadOnlyList KeysFor(ComposerPlace place, bool edit, var keys = new List { new("⌃S", canSend ? "send" : "send (nothing connected)"), + new("⇥", "command ↔ text", "field"), new("⌥L", "escaping"), }; // With no dictionary, ⌥W is the way to one: the offer, never a download on its own. @@ -274,6 +321,7 @@ other is not null && Place == other.Place && Target == other.Target && Body == other.Body + && Verb == other.Verb && Escaping == other.Escaping && Equals(Edit, other.Edit) && Dictionary == other.Dictionary diff --git a/src/SharpMUTerm.Client/Composer/ComposerSession.cs b/src/SharpMUTerm.Client/Composer/ComposerSession.cs index 7667d212..b9f2e637 100644 --- a/src/SharpMUTerm.Client/Composer/ComposerSession.cs +++ b/src/SharpMUTerm.Client/Composer/ComposerSession.cs @@ -12,6 +12,12 @@ public sealed record ComposerCallbacks /// The writer changed the text: the whole buffer, lines broken by \n. public Action? Edited { get; init; } + /// + /// The writer changed the command field (): the whole field, one line. Null where the + /// composer has none to change. + /// + public Action? CommandEdited { get; init; } + /// ⌃S, with the buffer as it stands. public Action? Send { get; init; } @@ -120,6 +126,18 @@ public IReadOnlyList Suggestions(string word) => /// The host's: the writer changed the text. public void Edited(string body) => Pass(_callbacks.Edited, Normalise(body)); + /// + /// The host's: the writer changed the command field. Passed on one line (a pasted break is a space); nothing for an + /// edit, which has no command field. + /// + public void EditedCommand(string command) + { + if (Model.HasCommandField) + { + Pass(_callbacks.CommandEdited, Normalise(command).Replace('\n', ' ')); + } + } + /// The host's: ⌃S. public void Send(string body) => Pass(_callbacks.Send, Normalise(body)); diff --git a/src/SharpMUTerm.Core/Commands/ComposeMessage.cs b/src/SharpMUTerm.Core/Commands/ComposeMessage.cs index 6701adee..9fec8457 100644 --- a/src/SharpMUTerm.Core/Commands/ComposeMessage.cs +++ b/src/SharpMUTerm.Core/Commands/ComposeMessage.cs @@ -72,6 +72,54 @@ public static class ComposeMessage return sb.ToString(); } + /// + /// The one line to send for a post written as a (+pose, +bbpost 12=) and the + /// it carries — the composer's two fields — or null when there is nothing to send. + /// + /// The body is built exactly as builds a whole buffer (escaped first, + /// then joined with %r), and the command is put in front of it unescaped: it is the verb and its + /// switches, which the game must read. A blank command is the old single buffer, so a body that already starts with + /// its verb is sent as it always was. A body with nothing in it is nothing to send, whatever the command says. + /// + /// + /// One space joins them (), except after a command ending in = (+bbpost 12=Title, + /// page Bob=hi) or one that is a single punctuation character — MUSH's :, ; and " + /// shorthands are written against the text. + /// + /// + public static string? Build(string? command, string? body, ComposeEscaping escaping) + { + var text = Build(body, escaping); + return text is null ? null : Join(command, text); + } + + /// + /// (made one line and trimmed, ) in front of + /// , by 's rule; just + /// with no command. + /// + public static string Join(string? command, string text) + { + ArgumentNullException.ThrowIfNull(text); + var head = CleanCommand(command); + if (head.Length == 0) + { + return text; + } + + var tight = head[^1] == '=' || (head.Length == 1 && !char.IsLetterOrDigit(head[0])); + return tight ? head + text : head + " " + text; + } + + /// + /// The command field as it is sent: one line (a pasted break becomes a space) with no spaces at either end. Empty for + /// none. + /// + public static string CleanCommand(string? command) => + string.IsNullOrWhiteSpace(command) + ? string.Empty + : command.Replace("\r\n", " ", StringComparison.Ordinal).Replace('\n', ' ').Replace('\r', ' ').Trim(); + /// /// Splits a buffer into lines, treating CRLF, LF and a lone CR alike. The editor writes /// , a paste carries whatever the source had, and a body that diff --git a/src/SharpMUTerm.Tui/ComposeOverlay.cs b/src/SharpMUTerm.Tui/ComposeOverlay.cs index 36226d2c..e5350e55 100644 --- a/src/SharpMUTerm.Tui/ComposeOverlay.cs +++ b/src/SharpMUTerm.Tui/ComposeOverlay.cs @@ -15,7 +15,8 @@ namespace SharpMUTerm.Tui; /// The window's escaping mode when it happened. /// The MOO buffer this is an edit of, or null for a post. /// The script file this is an edit of, or null. -internal readonly record struct ComposeResult(string Body, ComposeEscaping Escaping, MooEdit? Edit = null, ScriptEdit? Script = null); +/// The command field (): empty for none, and for an edit. +internal readonly record struct ComposeResult(string Body, ComposeEscaping Escaping, MooEdit? Edit = null, ScriptEdit? Script = null, string Verb = ""); /// /// A script file open in the composer: its name under the scripts folder (or package:<id>/<file>), whose @@ -74,6 +75,10 @@ internal sealed class ComposeOverlay private Window? _window; private MultilineEditControl? _editor; + private Panels.ComposerCommandRow? _command; + + /// Whether the keyboard is in the command field (⇥ moves it); only while a post is open. + private bool _inCommand; private ComposeEscaping _escaping; private string _target = string.Empty; private bool _canSend; @@ -139,6 +144,12 @@ internal void ForgetSpelling() /// internal string Body => _editor?.GetContent().Replace("\r\n", "\n", StringComparison.Ordinal) ?? string.Empty; + /// The command field as it stands, one line; empty when shut, and for an edit, which has none. + internal string Verb => _command?.Text ?? string.Empty; + + /// Whether the keyboard is in the command field, for the tests. + internal bool InCommand => _command is not null && _inCommand; + /// The escaping mode as it stands — the window's own toggle, not a saved setting. internal ComposeEscaping Escaping => _escaping; @@ -171,7 +182,7 @@ internal void SetScriptStatus(string status) /// What the window draws, as the shared model a native composer draws: the target, the buffer as it stands, the /// mode, the edit, the dictionary and its marks, and the key row. /// - internal ComposerModel Model => ModelFor(_target, Body, _escaping, _edit, Spelling, _canSend, Preview, _script); + internal ComposerModel Model => ModelFor(_target, Body, _escaping, _edit, Spelling, _canSend, Preview, _script, Verb); /// /// Whether F1 shows the post as it will be sent (⌥P), under the editor. One fact for the run in both hosts — the @@ -187,7 +198,7 @@ internal void SetScriptStatus(string status) /// it, so the two say the same thing for the same draft. Revision 1: F1 opens on a draft and nothing replaces it /// while it is open. /// - internal static ComposerModel ModelFor(string target, string body, ComposeEscaping escaping, MooEdit? edit, SpellChecker? spelling, bool canSend, bool preview = false, ScriptEdit? script = null) => + internal static ComposerModel ModelFor(string target, string body, ComposeEscaping escaping, MooEdit? edit, SpellChecker? spelling, bool canSend, bool preview = false, ScriptEdit? script = null, string verb = "") => ComposerModel.Create( ComposerPlace.FullScreen, target, @@ -198,7 +209,8 @@ internal static ComposerModel ModelFor(string target, string body, ComposeEscapi canSend, armed: true, revision: 1, - preview: preview); + preview: preview, + verb: verb); /// /// Opens the composer on , or closes it when it is already open — the same @@ -214,7 +226,8 @@ internal static ComposerModel ModelFor(string target, string body, ComposeEscapi /// /// The MOO buffer this opens on, or null for a post. /// The script file this opens on, or null. - internal void Toggle(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null, ScriptEdit? script = null) + /// The command field the draft was left with; a post only. + internal void Toggle(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null, ScriptEdit? script = null, string verb = "") { if (_window is not null) { @@ -285,6 +298,15 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool } _editor.SetContent(draft); + _inCommand = false; + _command = null; + if (edit is null && script is null) + { + // A post has a command field above its text; an edit is its lines alone. + _command = new Panels.ComposerCommandRow(_scheme, ScreenPalette.FooterBg); + _command.Set(verb); + _command.Field.ContentChanged += (_, _) => RefreshBands(); + } if (script is { Line: > 0 } at) { _editor.GoToLine(at.Line); @@ -300,8 +322,13 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool .Maximized() .Frameless() .WithColors(_scheme.Colour(ScreenPalette.PanelFg), _scheme.Colour(ScreenPalette.PanelBg)) - .AddControl(HeaderBand()) - .AddControl(_editor); + .AddControl(HeaderBand()); + if (CommandControl() is { } row) + { + builder.AddControl(row); + } + + builder.AddControl(_editor); if (Model.Preview) { builder.AddControl(PreviewBand()); @@ -318,7 +345,36 @@ internal void Toggle(string target, string draft, ComposeEscaping escaping, bool // Nothing focuses a control for you in this framework, and an unfocused editor takes no // keystrokes at all — the window would open looking right and swallow everything typed into it. - _window.FocusManager.SetFocus(_editor, FocusReason.Programmatic); + _window.FocusManager.SetFocus(FocusedField, FocusReason.Programmatic); + } + + /// The field the keyboard is in: the command field after ⇥, else the text. + private MultilineEditControl FocusedField => _inCommand && _command is not null ? _command.Field : _editor!; + + /// The command row, sticky under the header, or null for an edit. + private IWindowControl? CommandControl() + { + if (_command is null) + { + return null; + } + + _command.Control.StickyPosition = StickyPosition.Top; + + return _command.Control; + } + + /// ⇥ / ⇧⇥ / ⏎ in the command field: the keyboard to the other field. + private void SwitchField(bool toCommand) + { + if (_window is null || _command is null) + { + return; + } + + _inCommand = toCommand; + _window.FocusManager.SetFocus(FocusedField, FocusReason.Programmatic); + _window.Invalidate(redrawAll: true); } /// @@ -361,7 +417,7 @@ internal bool SimulateKey(ConsoleKeyInfo key) return args.Handled; } - /// Types text into the editor, the way the framework's own key path would. + /// Types text into the field the keyboard is in, the way the framework's own key path would. internal void SimulateTyping(string text) { if (_editor is null) @@ -369,7 +425,8 @@ internal void SimulateTyping(string text) return; } - _editor.SetContent(_editor.GetContent() + text); + var field = FocusedField; + field.SetContent(field.GetContent() + text); RefreshBands(); } @@ -454,6 +511,16 @@ private void OnKey(object? sender, KeyPressedEventArgs e) return; } + // ⇥ and ⇧⇥ move between the command field and the text, and ⏎ in the command field moves on to the text: a + // command is one line, and a post's text has no use for a tab. An edit has one field and keeps its ⇥ (indent). + if (_command is not null && !ctrl && !alt + && (key.Key == ConsoleKey.Tab || (key.Key == ConsoleKey.Enter && _inCommand))) + { + e.Handled = true; + SwitchField(key.Key == ConsoleKey.Tab && !_inCommand && !key.Modifiers.HasFlag(ConsoleModifiers.Shift)); + return; + } + if (key.Key == ConsoleKey.Escape && !ctrl && !alt) { e.Handled = true; @@ -498,7 +565,7 @@ private void SendNow() // the close so the handler sees the buffer rather than an empty window — and Closed still // follows, so a send the host refuses (no connection) keeps the post rather than dropping it on // the floor. - Send?.Invoke(this, new ComposeResult(Body, _escaping, _edit, _script)); + Send?.Invoke(this, new ComposeResult(Body, _escaping, _edit, _script, Verb)); } /// Shuts the window, handing the buffer back for the host to keep. @@ -509,7 +576,7 @@ internal void Close() return; } - var result = new ComposeResult(Body, _escaping, _edit, _script); + var result = new ComposeResult(Body, _escaping, _edit, _script, Verb); _system.CloseModalWindow(window); Closed?.Invoke(this, result); } @@ -528,6 +595,11 @@ private void Redraw() window.ClearControls(); window.AddControl(HeaderBand()); + if (CommandControl() is { } row) + { + window.AddControl(row); + } + window.AddControl(_editor); if (Model.Preview) { @@ -541,7 +613,7 @@ private void Redraw() window.AddControl(FooterBand()); FitEditor(); window.Invalidate(redrawAll: true); - window.FocusManager.SetFocus(_editor, FocusReason.Programmatic); + window.FocusManager.SetFocus(FocusedField, FocusReason.Programmatic); } /// @@ -737,7 +809,7 @@ private void FitEditor() return; } - _editor.ViewportHeight = Math.Max(1, _system.ConsoleDriver.ScreenSize.Height - ChromeRows - (Model.Preview ? PreviewRows : 0)); + _editor.ViewportHeight = Math.Max(1, _system.ConsoleDriver.ScreenSize.Height - ChromeRows - (_command is null ? 0 : 1) - (Model.Preview ? PreviewRows : 0)); } /// The header and footer bands, which the editor's height is whatever is left over from. @@ -762,6 +834,8 @@ private void Reset() _system.ConsoleDriver.ScreenResized -= OnScreenResized; _window = null; _editor = null; + _command = null; + _inCommand = false; _edit = null; _script = null; _headerBand = null; diff --git a/src/SharpMUTerm.Tui/Panels/ComposerCommandRow.cs b/src/SharpMUTerm.Tui/Panels/ComposerCommandRow.cs new file mode 100644 index 00000000..91c79c58 --- /dev/null +++ b/src/SharpMUTerm.Tui/Panels/ComposerCommandRow.cs @@ -0,0 +1,96 @@ +using SharpConsoleUI; +using SharpConsoleUI.Builders; +using SharpConsoleUI.Controls; +using SharpConsoleUI.Layout; +using SharpMUTerm.Client.Composer; +using SharpMUTerm.Core.Commands; + +namespace SharpMUTerm.Tui.Panels; + +/// +/// The composer's command field in cells, one row above the text: command +pose. F1 and the docked panel both +/// draw it for a post (); a MOO or script edit has none. +/// +/// The field is a one-row editor, and its keys are the composer's to route. ⇥ and ⇧⇥ move between it and the +/// text, ⏎ in it moves to the text (a command is one line), and everything else is the editor's. Pasted line breaks +/// become spaces on the way out (), so whatever it holds is one line. +/// +/// +internal sealed class ComposerCommandRow +{ + /// The label column's width: command plus a cell. + internal const int LabelWidth = 10; + + private readonly MarkupControl _label; + + /// The settings screens' palette the composer is painted in. + /// + /// The row's plane under the label (a role), or null for the pane's own: the docked panel + /// sits on its pane's plane, as its header does. + /// + internal ComposerCommandRow(ScreenTheme scheme, string? plane) + { + Field = new MultilineEditControl + { + WrapMode = WrapMode.NoWrap, + ShowLineNumbers = false, + IsEditing = true, + ViewportHeight = 1, + MaxLength = 200, + HorizontalScrollbarVisibility = ScrollbarVisibility.Never, + VerticalScrollbarVisibility = ScrollbarVisibility.Never, + HorizontalAlignment = HorizontalAlignment.Stretch, + EscapeExitsEditMode = false, + PlaceholderText = ComposerModel.CommandPlaceholder, + }; + + _label = new MarkupControl(new List()) { HorizontalAlignment = HorizontalAlignment.Stretch }; + Paint(scheme, plane); + + var grid = Controls.Grid().WithAlignment(HorizontalAlignment.Stretch); + grid.Rows(GridLength.Cells(1)).Columns(GridLength.Cells(LabelWidth), GridLength.Star(1)); + grid.Place(_label, 0, 0, 1, 1); + grid.Place(Field, 0, 1, 1, 1); + Control = grid.Build(); + } + + /// The one-row editor holding the command. + internal MultilineEditControl Field { get; } + + /// What the composer lays out. + internal IWindowControl Control { get; } + + /// The command as it will be sent: one line, trimmed. + internal string Text => ComposeMessage.CleanCommand(Field.GetContent()); + + /// Re-colours the row: the label on , the field in the screens' field well. + internal void Paint(ScreenTheme scheme, string? plane) + { + if (plane is null) + { + _label.SetContent(new List { "[dim] command[/]" }); + } + else + { + _label.SetContent(new List { scheme.Paint($"[{ScreenPalette.Label}] command[/]", plane) }); + _label.BackgroundColor = scheme.Colour(plane); + } + + Field.BackgroundColor = scheme.Colour(ScreenPalette.FieldBg); + Field.FocusedBackgroundColor = scheme.Colour(ScreenPalette.CursorBg); + Field.ForegroundColor = scheme.Colour(ScreenPalette.Value); + Field.FocusedForegroundColor = scheme.Colour(ScreenPalette.Value); + Field.SelectionBackgroundColor = scheme.Colour(ScreenPalette.MenuSelectedBg); + Field.SelectionForegroundColor = scheme.Colour(ScreenPalette.Value); + } + + /// Replaces what the field holds, as one line. + internal void Set(string? command) + { + var text = ComposeMessage.CleanCommand(command); + if (!string.Equals(Field.GetContent(), text, StringComparison.Ordinal)) + { + Field.SetContent(text); + } + } +} diff --git a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs index abdc54ca..2f88386a 100644 --- a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs +++ b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs @@ -11,7 +11,8 @@ namespace SharpMUTerm.Tui.Panels; /// /// The composer as a pane: a header naming what is being written and how it will be escaped -/// (COMPOSE +pose literal), the F1 composer's editor, and a key row +/// (COMPOSE +pose literal), the command field (), the F1 composer's editor for +/// the text, and a key row /// (⌃S send · ⌥L literal · F1 full screen · Esc command line). /// /// The editor is the F1 composer's — a that inserts on ⏎, wraps words @@ -91,16 +92,32 @@ internal DockedComposer(string windowId, string sessionKey, ScreenTheme scheme, } }; + CommandRow = new ComposerCommandRow(scheme, plane: null); + CommandRow.Field.ContentChanged += (_, _) => + { + if (!_fromHost) + { + Revision++; + } + + if (!_quiet) + { + Redraw(); + Changed?.Invoke(this, EventArgs.Empty); + } + }; + _header = new MarkupControl(new List()) { HorizontalAlignment = HorizontalAlignment.Stretch }; _footer = new MarkupControl(new List()) { HorizontalAlignment = HorizontalAlignment.Stretch }; var grid = Controls.Grid() .WithAlignment(HorizontalAlignment.Stretch) .WithVerticalAlignment(VerticalAlignment.Fill); - grid.Rows(GridLength.Cells(1), GridLength.Star(1), GridLength.Cells(1)).Columns(GridLength.Star(1)); + grid.Rows(GridLength.Cells(1), GridLength.Cells(1), GridLength.Star(1), GridLength.Cells(1)).Columns(GridLength.Star(1)); grid.Place(_header, 0, 0, 1, 1); - grid.Place(Editor, 1, 0, 1, 1); - grid.Place(_footer, 2, 0, 1, 1); + grid.Place(CommandRow.Control, 1, 0, 1, 1); + grid.Place(Editor, 2, 0, 1, 1); + grid.Place(_footer, 3, 0, 1, 1); Control = grid.Build(); Redraw(); } @@ -117,6 +134,28 @@ internal DockedComposer(string windowId, string sessionKey, ScreenTheme scheme, /// The editor, which the host focuses and hands keys to while this is armed. internal MultilineEditControl Editor { get; } + /// The command field above the text. + internal ComposerCommandRow CommandRow { get; } + + /// The command field's text, one line (). + internal string Verb => CommandRow.Text; + + /// + /// Whether the keyboard is in the command field rather than the text: ⇥ moves it (), and a + /// click in either field puts it there. The composer's own state, never the model's: where a caret is is not a fact + /// the other host draws. + /// + internal bool InCommand { get; set; } + + /// The field the keyboard is in: the one the host focuses and hands keys to while this is armed. + internal MultilineEditControl Focused => InCommand ? CommandRow.Field : Editor; + + /// Whether is one of this composer's two fields. + internal bool Owns(object? control) => ReferenceEquals(control, Editor) || ReferenceEquals(control, CommandRow.Field); + + /// ⇥: the keyboard to the other field. + internal void ToggleField() => InCommand = !InCommand; + /// The escaping mode, toggled by ⌥L, as F1's is. internal ComposeEscaping Escaping { get; private set; } = ComposeEscaping.AsTyped; @@ -181,6 +220,25 @@ internal void SetFromHost(string body) } } + /// The command a native editor's command field now holds, written in as writes the text. + internal void SetCommandFromHost(string command) + { + if (string.Equals(Verb, ComposeMessage.CleanCommand(command), StringComparison.Ordinal)) + { + return; + } + + _fromHost = true; + try + { + CommandRow.Set(command); + } + finally + { + _fromHost = false; + } + } + /// Raised after the buffer or the mode changed by the writer's hand (never by ). internal event EventHandler? Changed; @@ -191,22 +249,27 @@ internal void SetFromHost(string body) internal string FooterMarkup => _footer.Text; /// Replaces the buffer and mode with a draft kept elsewhere (F1 closing), raising nothing. - internal void Load(string body, ComposeEscaping escaping) + internal void Load(string body, ComposeEscaping escaping, string? verb = null) { Escaping = escaping; Revision++; - if (!string.Equals(Body, body, StringComparison.Ordinal)) + _quiet = true; + try { - _quiet = true; - try + if (!string.Equals(Body, body, StringComparison.Ordinal)) { Editor.SetContent(body); } - finally + + if (verb is not null) { - _quiet = false; + CommandRow.Set(verb); } } + finally + { + _quiet = false; + } Redraw(); } @@ -222,7 +285,7 @@ internal void ToggleEscaping() /// Sizes the editor to the pane's box, less the header and key rows. internal void Fit(int width, int height) { - var rows = Math.Max(1, height - 2); + var rows = Math.Max(1, height - 3); if (Editor.ViewportHeight != rows) { Editor.ViewportHeight = rows; @@ -238,12 +301,6 @@ internal void Fit(int width, int height) /// The pane's width, which picks the key row's long or short form. private int _width; - /// - /// The verb the post starts with — +pose, say — for the header, so a reader can see what the - /// buffer will be sent as without reading it. Empty for an empty buffer. - /// - internal static string Verb(string body) => ComposerModel.VerbOf(body); - /// Re-describes the composer and draws the model. internal void Redraw() { @@ -259,7 +316,7 @@ internal void Redraw() /// internal void Render(ComposerModel model) { - var verb = model.Verb; + var verb = model.HeadingVerb; var mode = model.Escaping == ComposeEscaping.Literal ? $"[{_accent}]literal[/]" : "[dim]as typed[/]"; var marker = model.Armed ? $"[{_accent}]▌[/]" : " "; var title = $"{marker}[bold {_accent}]COMPOSE[/]" + (verb.Length > 0 ? $" {Escape(verb)}" : string.Empty) + $" {mode}"; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs index 1c8e1cba..fc0b9f5e 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.NativeComposer.cs @@ -96,7 +96,7 @@ private IEnumerable SpellingNames() /// Opens F1 on a draft: in the host's editor when it has one, else the cell window. Both are given the same draft /// and say the same thing about it (). /// - private void OpenComposer(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null, ScriptEdit? script = null) + private void OpenComposer(string target, string draft, ComposeEscaping escaping, bool canSend, MooEdit? edit = null, ScriptEdit? script = null, string verb = "") { // The names a game reports change between openings; the dictionary learns them each time F1 opens. if (_composerSpellingOpened) @@ -106,7 +106,7 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, if (NativeComposerHost is not { } native) { - _composer.Toggle(target, draft, escaping, canSend, edit, script); + _composer.Toggle(target, draft, escaping, canSend, edit, script, verb); return; } @@ -115,6 +115,7 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, Body = draft.Replace("\r\n", "\n", StringComparison.Ordinal), Escaping = escaping, Script = script, + Verb = edit is null && script is null ? ComposeMessage.CleanCommand(verb) : string.Empty, }; open.Session = new ComposerSession( NativeComposeModel(open), @@ -130,12 +131,20 @@ private void OpenComposer(string target, string draft, ComposeEscaping escaping, open.Session.Publish(NativeComposeModel(open)); } }), + CommandEdited = command => OnUiThread(() => + { + if (ReferenceEquals(_nativeCompose, open) && open.Edit is null && open.Script is null) + { + open.Verb = ComposeMessage.CleanCommand(command); + open.Session.Publish(NativeComposeModel(open)); + } + }), Send = body => OnUiThread(() => { if (ReferenceEquals(_nativeCompose, open)) { open.Body = body; - SendComposed(new ComposeResult(body, open.Escaping, open.Edit, open.Script)); + SendComposed(new ComposeResult(body, open.Escaping, open.Edit, open.Script, open.Verb)); } }), ToggleEscaping = () => OnUiThread(() => @@ -208,7 +217,7 @@ private Action ChooseComposerFace(string? sessionKey) => proportional => O /// The native F1's model for what it holds now; the cell window's for the same draft. private ComposerModel NativeComposeModel(NativeCompose open) => - ComposeOverlay.ModelFor(open.Target, open.Body, open.Escaping, open.Edit, open.Edit is null && open.Script is null ? ComposerSpelling() : null, open.CanSend, _composer.Preview, open.Script); + ComposeOverlay.ModelFor(open.Target, open.Body, open.Escaping, open.Edit, open.Edit is null && open.Script is null ? ComposerSpelling() : null, open.CanSend, _composer.Preview, open.Script, open.Verb); /// /// Closes F1, in whichever host it is open, keeping its buffer as the character's draft (or MOO edit) exactly as the @@ -225,7 +234,7 @@ private void CloseComposer() _nativeCompose = null; open.Session.End(); Host.NativeComposer?.Close(); - KeepComposeDraft(new ComposeResult(open.Body, open.Escaping, open.Edit, open.Script)); + KeepComposeDraft(new ComposeResult(open.Body, open.Escaping, open.Edit, open.Script, open.Verb)); PublishPanels(); PublishHostChrome(); } @@ -274,7 +283,8 @@ private ComposerModel DescribeDocked(DockedComposer composer) composer.Spelling, canSend: ComposerCanSend(session, composer.SessionKey), composer.Armed, - composer.Revision); + composer.Revision, + verb: composer.Verb); Drawing(PanelIds.Composer, composer.WindowId, model); if (_dockedSessions.TryGetValue(composer.WindowId, out var native)) { @@ -302,6 +312,7 @@ private ComposerSession DockedSessionFor(DockedComposer composer) new ComposerCallbacks { Edited = body => OnUiThread(() => composer.SetFromHost(body)), + CommandEdited = command => OnUiThread(() => composer.SetCommandFromHost(command)), Send = body => OnUiThread(() => { composer.SetFromHost(body); @@ -406,6 +417,9 @@ private sealed class NativeCompose(string target, bool canSend, MooEdit? edit) internal string Body { get; set; } = string.Empty; + /// The command field, one line; empty for an edit. + internal string Verb { get; set; } = string.Empty; + internal ComposeEscaping Escaping { get; set; } /// The script file this is an edit of, or null; its status moves with each save. diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index f5e6a5b3..a98d6f97 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -307,7 +307,7 @@ private IWindowControl NewDockedComposer(TerminalPanelContext context) var composer = new DockedComposer(context.WindowId, context.SessionKey, _screens, _ink.Accent, DescribeDocked); if (_composeDrafts.TryGetValue(context.SessionKey, out var draft)) { - composer.Load(draft.Body, draft.Escaping); + composer.Load(draft.Body, draft.Escaping, draft.Verb); } composer.Changed += (_, _) => KeepDockedDraft(composer); @@ -323,13 +323,13 @@ private IWindowControl NewDockedComposer(TerminalPanelContext context) /// private void KeepDockedDraft(DockedComposer composer) { - if (composer.Body.Trim().Length == 0) + if (composer.Body.Trim().Length == 0 && composer.Verb.Length == 0) { _composeDrafts.Remove(composer.SessionKey); return; } - _composeDrafts[composer.SessionKey] = new ComposeResult(composer.Body, composer.Escaping); + _composeDrafts[composer.SessionKey] = new ComposeResult(composer.Body, composer.Escaping, Verb: composer.Verb); } /// Puts a character's kept draft back into its docked composers, after F1 changed it. @@ -340,7 +340,7 @@ private void SyncDockedComposers(string? sessionKey) if (sessionKey is null || string.Equals(composer.SessionKey, sessionKey, StringComparison.Ordinal)) { var draft = _composeDrafts.GetValueOrDefault(composer.SessionKey); - composer.Load(draft.Body ?? string.Empty, draft.Body is null ? composer.Escaping : draft.Escaping); + composer.Load(draft.Body ?? string.Empty, draft.Body is null ? composer.Escaping : draft.Escaping, draft.Verb ?? string.Empty); } } } @@ -373,7 +373,7 @@ private void SyncDockedComposers(string? sessionKey) /// Whether the framework's focus is on a docked composer's editor. internal bool ComposerHasFocus => - _window.FocusManager.FocusedControl is { } focused && _dockedComposers.Values.Any(c => ReferenceEquals(c.Editor, focused)); + _window.FocusManager.FocusedControl is { } focused && _dockedComposers.Values.Any(c => c.Owns(focused)); /// /// Paints who holds the keyboard: the armed composer's header marker, and both command lines idle while a @@ -426,8 +426,14 @@ private void ReleaseComposer() private void ArmClickedComposer() { if (_pinningFocus || !_window.GetIsActive() || _window.FocusManager.FocusedControl is not { } focused - || _dockedComposers.Values.FirstOrDefault(c => ReferenceEquals(c.Editor, focused)) is not { } clicked - || ReferenceEquals(clicked, ArmedComposer())) + || _dockedComposers.Values.FirstOrDefault(c => c.Owns(focused)) is not { } clicked) + { + return; + } + + // A click in either field puts the keyboard in that field, armed or not. + clicked.InCommand = ReferenceEquals(focused, clicked.CommandRow.Field); + if (ReferenceEquals(clicked, ArmedComposer())) { return; } @@ -477,14 +483,15 @@ private void ArmClickedComposer() // Never the editor's own: its ⌃C/⌃X write to the system clipboard through a helper nothing can // substitute. Through the app's clipboard, as the command line's are. e.Handled = true; - if (!composer.Editor.HasSelection) + var field = composer.Focused; + if (!field.HasSelection) { CopySelection(); } - else if (ToClipboard(composer.Editor.GetSelectedText(), key.Key == ConsoleKey.X ? "cut" : "copied") + else if (ToClipboard(field.GetSelectedText(), key.Key == ConsoleKey.X ? "cut" : "copied") && key.Key == ConsoleKey.X) { - composer.Editor.ProcessKey(new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false)); + field.ProcessKey(new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false)); } return null; @@ -524,13 +531,26 @@ private void ArmClickedComposer() return null; } + // ⇥ / ⇧⇥ move between the command field and the text; ⏎ in the command field moves on to the text, a command + // being one line. F1's keys, handed here as every composer key is. + if ((key.Key == ConsoleKey.Tab && (key.Modifiers & ~ConsoleModifiers.Shift) == 0) + || (key.Key == ConsoleKey.Enter && key.Modifiers == 0 && composer.InCommand)) + { + e.Handled = true; + composer.InCommand = key.Key == ConsoleKey.Tab && !composer.InCommand && key.Modifiers == 0; + _window.FocusControl(composer.Focused); + composer.Redraw(); + return null; + } + e.Handled = true; - if (!composer.Editor.HasFocus) + var target = composer.Focused; + if (!target.HasFocus) { - _window.FocusControl(composer.Editor); + _window.FocusControl(target); } - composer.Editor.ProcessKey(key.Key == ConsoleKey.Enter ? new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false) : key); + target.ProcessKey(key.Key == ConsoleKey.Enter ? new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false) : key); return null; } @@ -569,14 +589,16 @@ private void SendDocked(DockedComposer composer) return; } - if (ComposeMessage.Build(composer.Body, composer.Escaping) is not { } line) + if (ComposeMessage.Build(composer.Verb, composer.Body, composer.Escaping) is not { } line) { RefuseCommand("nothing to send — the composer is empty"); return; } - composer.Load(string.Empty, composer.Escaping); - _composeDrafts.Remove(composer.SessionKey); + // The text goes; the command stays, for the next pose. + var verb = composer.Verb; + composer.Load(string.Empty, composer.Escaping, verb); + ForgetComposeText(composer.SessionKey, composer.Escaping, verb); HistoryFor(composer.SessionKey, BarKind(_input)).Add(line); _ = session.SendUserInputAsync(line); } @@ -588,6 +610,8 @@ internal void SimulateComposerTyping(string text) { SimulateKey(c == '\n' ? new ConsoleKeyInfo('\r', ConsoleKey.Enter, false, false, false) + : c == '\t' + ? new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false) : new ConsoleKeyInfo(c, char.IsAsciiLetter(c) ? (ConsoleKey)char.ToUpperInvariant(c) : ConsoleKey.NoName, char.IsUpper(c), false, false)); } } @@ -788,7 +812,7 @@ private void LoadDemoPanels(string view) RebuildPaneArea(); Activate(MainWindowId); Activate(composer); - SimulateComposerTyping("+pose Corvid sets the lantern down by the fountain\nand waits, 100% certain [someone] saw."); + SimulateComposerTyping("\t+pose\tCorvid sets the lantern down by the fountain\nand waits, 100% certain [someone] saw."); } break; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 0c0d38a3..4d55da29 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1286,13 +1286,14 @@ public string RenderSnapshot(string? view = null) _composer.Preview = string.Equals(view, "compose-preview", StringComparison.OrdinalIgnoreCase); OpenComposer( DemoScene.MainCharacterName, - "+bbpost 12=The Long Winter\n\nThe caravan reached the pass at dusk, 100% frozen and\n" + "The Long Winter\n\nThe caravan reached the pass at dusk, 100% frozen and\n" + "short two horses. [Nobody] said what everyone was thinking.\n\n" + " -- Corvid, scribe", !string.Equals(view, "compose", StringComparison.OrdinalIgnoreCase) ? ComposeEscaping.Literal : ComposeEscaping.AsTyped, - canSend: true); + canSend: true, + verb: "+bbpost 12="); } // The composer holding a MOO verb to edit: the header names it and its type, and the footer offers a @@ -5541,7 +5542,24 @@ private void ToggleComposer() draft.Body, draft.Escaping, canSend: ComposerCanSend(session, key), - draft.Edit); + draft.Edit, + verb: draft.Verb ?? string.Empty); + } + + /// + /// A post was sent: its text is forgotten and its command kept (with its escaping), so the next post from that + /// character starts on the same verb. A post with no command leaves no draft at all. + /// + private void ForgetComposeText(string key, ComposeEscaping escaping, string verb) + { + if (verb.Length == 0) + { + _composeDrafts.Remove(key); + } + else + { + _composeDrafts[key] = new ComposeResult(string.Empty, escaping, Verb: verb); + } } /// @@ -5606,7 +5624,7 @@ private void SendComposed(ComposeResult result) return; } - if (ComposeMessage.Build(result.Body, result.Escaping) is not { } line) + if (ComposeMessage.Build(result.Verb, result.Body, result.Escaping) is not { } line) { // An empty buffer is not a blank command to send: a MUSH answers a blank line, and some log // it. Said out loud rather than closing quietly, so ⌃S on an empty window is not mistaken @@ -5619,7 +5637,7 @@ private void SendComposed(ComposeResult result) // before it is undone by the very act of shutting the window — the post came back next time it // was opened, already sent. CloseComposer(); - _composeDrafts.Remove(session.SessionKey); + ForgetComposeText(session.SessionKey, result.Escaping, result.Verb ?? string.Empty); SyncDockedComposers(session.SessionKey); HistoryFor(BarKind(ActiveBar())).Add(line); _ = session.SendUserInputAsync(line); @@ -5650,7 +5668,7 @@ private void KeepComposeDraft(ComposeResult result) return; } - if (result.Body.Trim().Length == 0) + if (result.Body.Trim().Length == 0 && string.IsNullOrEmpty(result.Verb)) { _composeDrafts.Remove(key); } @@ -6084,7 +6102,7 @@ private void PinFocusToArmedBar() } // The armed composer, when one holds the keyboard, is what typing, paste and the caret follow instead. - IInteractiveControl bar = ArmedComposer()?.Editor ?? (IInteractiveControl)ActiveBar(); + IInteractiveControl bar = ArmedComposer()?.Focused ?? (IInteractiveControl)ActiveBar(); if (ReferenceEquals(_window.FocusManager.FocusedControl, bar)) { return; @@ -7614,7 +7632,8 @@ private QuitModel QuitFactsNow() // and F1 that post is in both places at once: the dictionary kept it on the way out and the // window is holding it again. Counting both said "2 unsent drafts" for one post. var openKey = ComposerOpen ? ComposeDraftKey(activeId) : null; - var posts = _composeDrafts.Count(d => d.Key != openKey) + // A command kept with no text (the verb a sent post leaves behind) is no unsent post. + var posts = _composeDrafts.Count(d => d.Key != openKey && d.Value.Body.Trim().Length > 0) + (ComposerOpen && ComposerBody.Trim().Length > 0 ? 1 : 0); var drafts = holding.Count(w => w.Id != activeId) + bars + posts; diff --git a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs index 69e688a0..656b1abe 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/NativeComposerTests.cs @@ -393,6 +393,55 @@ public async Task TypingInTheDockedEditorIsTheDraftAndCtrlSSendsIt() await Assert.That(after).IsEqualTo(string.Empty).Because("the client cleared the draft, and the editor takes the client's text"); } + /// + /// The docked command box (the mockup's Command field): what is typed there is the cell composer's command field, ⏎ in + /// it moves to the text, and ⌃S sends the command in front of the text as one line — and the command stays. + /// + [Test] + public async Task TheDockedCommandBoxIsTheCommandFieldAndCtrlSSendsItInFrontOfTheText() + { + var (verb, textFocused, sent, kept, boxAfter) = await Run(rig => + { + var composer = Dock(rig); + var windowId = rig.Layer.Composers.Keys.Single(); + composer.CommandBox.Focus(); + composer.CommandBox.RaiseEvent(new TextInputEventArgs { RoutedEvent = InputElement.TextInputEvent, Text = "+pose", Source = composer.CommandBox }); + Drain(); + composer.CommandBox.RaiseEvent(new KeyEventArgs { RoutedEvent = InputElement.KeyDownEvent, Key = Key.Enter, Source = composer.CommandBox }); + Drain(); + var verb = rig.App.DockedComposerIn(windowId)!.Verb; + var textFocused = composer.Editor.IsFocused; + Type(composer.Editor, "waves [twice]"); + Press(composer.Editor, Key.S, KeyModifiers.Control); + rig.App.RenderNextFrame(); + Drain(); + return (verb, textFocused, rig.Telnet.Lines.ToList(), rig.App.DockedComposerIn(windowId)!.Verb, rig.Layer.Composers.Values.Single().CommandText); + }); + + await Assert.That(verb).IsEqualTo("+pose"); + await Assert.That(textFocused).IsTrue().Because("⏎ in the command field moves on to the text"); + await Assert.That(sent).IsEquivalentTo(new[] { "+pose waves [twice]" }); + await Assert.That(kept).IsEqualTo("+pose").Because("the command stays for the next post"); + await Assert.That(boxAfter).IsEqualTo("+pose"); + } + + [Test] + public async Task F1HasACommandRowAndAMooEditHasNone() + { + var (post, edit) = await Run(rig => + { + var overlay = OpenF1(rig); + var post = overlay.Composer.CommandText; + Press(overlay.Composer.Editor, Key.Escape); + rig.Telnet.ReceiveMooEdit(Look); + Drain(); + return (post, rig.Driver.Composer.Overlay!.Composer.CommandText); + }); + + await Assert.That(post).IsEqualTo(string.Empty).Because("a post shows its command row, empty here"); + await Assert.That(edit).IsNull().Because("a MOO edit has no command field"); + } + [Test] public async Task EscReleasesToTheCellsAndAClickArmsAgain() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index ade00e3d..60e84a37 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -692,6 +692,30 @@ await Same("status: notice action", "layout-combat", await Assert.That(native.Outcome).IsEqualTo(cells.Outcome); } + // The command field: written in the window's command box and in the cells' (⇥ there and back), the same one + // line goes out — the command unescaped in front of the escaped text — and a close keeps it with the draft. + foreach (var (verb, draft, literal) in new[] + { + ("+pose", "waves [twice]\nand sits", true), + ("+bbpost 3=", "Title\n\n50% done", false), + (":", "grins.", false), + }) + { + var native = await ComposeOnTheWire(native: true, draft, literal, send: true, verb); + var cells = await ComposeOnTheWire(native: false, draft, literal, send: true, verb); + await Assert.That(native.Sent).IsEquivalentTo(new[] { ComposeMessage.Build(verb, draft, literal ? ComposeEscaping.Literal : ComposeEscaping.AsTyped)! }); + await Assert.That(native.Sent).IsEquivalentTo(cells.Sent).Because($"compose: send '{verb}' + '{draft}'"); + await Assert.That(native.Outcome).IsEqualTo(cells.Outcome).Because("compose: the command is kept after a send"); + await Assert.That(native.Outcome).Contains($"verb={verb}"); + } + + { + var native = await ComposeOnTheWire(native: false, "half a post", literal: false, send: false, "say"); + var cells = await ComposeOnTheWire(native: true, "half a post", literal: false, send: false, "say"); + await Assert.That(native.Outcome).IsEqualTo(cells.Outcome).Because("compose: close keeps the command with the draft"); + await Assert.That(native.Outcome).Contains("draft=half a post as typed verb=say"); + } + { var native = await ComposeOnTheWire(native: true, "half a post", literal: true, send: false); var cells = await ComposeOnTheWire(native: false, "half a post", literal: true, send: false); @@ -710,6 +734,14 @@ await Same("status: notice action", "layout-combat", await Assert.That(native.Sent).IsEquivalentTo(new[] { "+pose waves%rand sits" }); await Assert.That(native.Sent).IsEquivalentTo(cells.Sent).Because("composer: send"); await Assert.That(native.Outcome).IsEqualTo(cells.Outcome).Because("composer: release"); + + // The same post written in the two fields goes out as the same one line, and the command stays for the next. + var nativeSplit = await DockedOnTheWire(native: true, split: true); + var cellsSplit = await DockedOnTheWire(native: false, split: true); + await Assert.That(nativeSplit.Sent).IsEquivalentTo(new[] { "+pose waves%rand sits" }); + await Assert.That(nativeSplit.Sent).IsEquivalentTo(cellsSplit.Sent).Because("composer: send from the two fields"); + await Assert.That(nativeSplit.Outcome).IsEqualTo(cellsSplit.Outcome).Because("composer: the command is kept"); + await Assert.That(nativeSplit.Outcome).Contains("verb=+pose"); probed.Add(PanelIds.Composer); } @@ -1088,7 +1120,7 @@ await Same("scroll-band: jump to latest", "scrollback-split", /// A connected client writes in F1 — the window's editor through its session, or the cell /// window through its keys — and sends it with ⌃S or closes it with Esc. What reached the wire, and the state left. /// - private static async Task<(IReadOnlyList Sent, string Outcome)> ComposeOnTheWire(bool native, string draft, bool literal, bool send) + private static async Task<(IReadOnlyList Sent, string Outcome)> ComposeOnTheWire(bool native, string draft, bool literal, bool send, string verb = "") { using var driver = new AvaloniaConsoleDriver(140, 36); var composer = native ? new FakeComposer() : null; @@ -1098,6 +1130,11 @@ await Same("scroll-band: jump to latest", "scrollback-split", if (composer is not null) { var session = composer.Session!; + if (verb.Length > 0) + { + session.EditedCommand(verb); + } + session.Edited(draft); if (literal) { @@ -1115,6 +1152,14 @@ await Same("scroll-band: jump to latest", "scrollback-split", } else { + if (verb.Length > 0) + { + // ⇥ to the command field, the command, ⇥ back to the text. + app.Composer.SimulateKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false)); + app.Composer.SimulateTyping(verb); + app.Composer.SimulateKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false)); + } + app.Composer.SimulateTyping(draft); if (literal) { @@ -1129,8 +1174,8 @@ await Same("scroll-band: jump to latest", "scrollback-split", // Where the draft went: reopened, F1 says what it holds and in which mode. app.SimulateKey(new ConsoleKeyInfo('\0', ConsoleKey.F1, false, false, false)); var held = composer is not null - ? $"{composer.Session!.Model.Body} {(composer.Session.Model.Escaping == ComposeEscaping.Literal ? "literal" : "as typed")}" - : $"{app.Composer.Body} {(app.Composer.HeaderMarkup.Contains("literal", StringComparison.Ordinal) ? "literal" : "as typed")}"; + ? $"{composer.Session!.Model.Body} {(composer.Session.Model.Escaping == ComposeEscaping.Literal ? "literal" : "as typed")} verb={composer.Session.Model.Verb}" + : $"{app.Composer.Body} {(app.Composer.HeaderMarkup.Contains("literal", StringComparison.Ordinal) ? "literal" : "as typed")} verb={app.Composer.Verb}"; return (telnet.Lines.ToList(), Outcome(app) + " | draft=" + held); } @@ -1138,7 +1183,7 @@ await Same("scroll-band: jump to latest", "scrollback-split", /// A connected client docks its composer, types into it — the window's editor through its session, or the cells /// through the composer's keys — sends with ⌃S, types again and releases with Esc. /// - private static async Task<(IReadOnlyList Sent, string Outcome)> DockedOnTheWire(bool native) + private static async Task<(IReadOnlyList Sent, string Outcome)> DockedOnTheWire(bool native, bool split = false) { using var driver = new AvaloniaConsoleDriver(140, 36); var (app, telnet) = await Connected(driver, native ? new FakeComposer() : null); @@ -1147,7 +1192,15 @@ await Same("scroll-band: jump to latest", "scrollback-split", app.RenderNextFrame(); var windowId = TerminalPanels.WindowId(PanelIds.Composer, "Quiet.Ann"); var session = native ? driver.Pointer.Panels.Single(p => p.PanelId == PanelIds.Composer).ComposerSession! : null; - if (session is not null) + if (session is not null && split) + { + session.EditedCommand("+pose"); + session.Edited("waves\nand sits"); + session.Send("waves\nand sits"); + session.Edited("next"); + session.Release(); + } + else if (session is not null) { session.Edited("+pose waves\nand sits"); session.Send("+pose waves\nand sits"); @@ -1156,13 +1209,14 @@ await Same("scroll-band: jump to latest", "scrollback-split", } else { - app.SimulateComposerTyping("+pose waves\nand sits"); + app.SimulateComposerTyping(split ? "\t+pose\twaves\nand sits" : "+pose waves\nand sits"); app.SimulateKey(new ConsoleKeyInfo('\x13', ConsoleKey.S, false, false, true)); app.SimulateComposerTyping("next"); app.SimulateKey(new ConsoleKeyInfo('\x1b', ConsoleKey.Escape, false, false, false)); } - return (telnet.Lines.ToList(), $"{Outcome(app)} | armed={app.ComposerArmed} | docked={app.DockedComposerIn(windowId)!.Body}"); + var docked = app.DockedComposerIn(windowId)!; + return (telnet.Lines.ToList(), $"{Outcome(app)} | armed={app.ComposerArmed} | docked={docked.Body} verb={docked.Verb}"); } /// A connected client docks its composer, types a draft and asks for the preview; the F1 it opens, read back. diff --git a/tests/SharpMUTerm.Client.Tests/ComposerModelTests.cs b/tests/SharpMUTerm.Client.Tests/ComposerModelTests.cs index b5ef0d60..58708cc4 100644 --- a/tests/SharpMUTerm.Client.Tests/ComposerModelTests.cs +++ b/tests/SharpMUTerm.Client.Tests/ComposerModelTests.cs @@ -84,7 +84,7 @@ public async Task TheDockedKeyRowSaysWhatTheCellsSay() await Assert.That(ComposerModel.KeysFor(ComposerPlace.Docked, false, false, true, armed: false).Select(k => k.Label)) .IsEquivalentTo(new[] { "click here to write", "full screen" }); await Assert.That(ComposerModel.KeysFor(ComposerPlace.Docked, false, true, true, armed: true).Select(k => k.Key)) - .IsEquivalentTo(new[] { "⌃S", "⌥L", "⌥W", "F1", "Esc" }); + .IsEquivalentTo(new[] { "⌃S", "⌥L", "⌥W", "F1", "Esc", "⇥" }); } [Test] @@ -135,4 +135,49 @@ public async Task ASessionMarksWithTheClientsDictionaryOnlyOnceTheModelSaysOne() await Assert.That(some.CanAddWords).IsTrue(); await Assert.That(none.CanAddWords).IsFalse(); } + + /// + /// The command field: what ⌃S sends is the command in front of the built text, the length cell counts that line, the + /// docked header names the post by the command, and two models differing only in it are different models. + /// + [Test] + public async Task TheCommandFieldGoesInFrontOfTheTextAndIsPartOfTheModel() + { + var model = ComposerModel.Create(ComposerPlace.Docked, "Ann", "tips his hat [x]\n\nwaits", ComposeEscaping.Literal, null, null, + canSend: true, armed: true, revision: 1, verb: "+pose"); + + await Assert.That(model.Command).IsEqualTo(ComposeMessage.Build("+pose", "tips his hat [x]\n\nwaits", ComposeEscaping.Literal)); + await Assert.That(model.Command).StartsWith("+pose tips"); + await Assert.That(model.Characters).IsEqualTo(model.Command!.Length); + await Assert.That(model.HeadingVerb).IsEqualTo("+pose"); + await Assert.That(model.HasCommandField).IsTrue(); + await Assert.That(model.Equals(model with { Verb = "say" })).IsFalse(); + await Assert.That(Post("say hello").HeadingVerb).IsEqualTo("say").Because("with no command the text's first word names it"); + } + + [Test] + public async Task AnEditHasNoCommandField() + { + var model = ComposerModel.Create(ComposerPlace.FullScreen, "Ann", "return 1;", ComposeEscaping.AsTyped, + new ComposerEdit("Test:look", "moo-code"), null, canSend: true, armed: true, revision: 1, verb: "+pose"); + + await Assert.That(model.HasCommandField).IsFalse(); + await Assert.That(model.Verb).IsEmpty(); + } + + [Test] + public async Task ASessionPassesTheCommandFieldOnOneLineAndNotForAnEdit() + { + var commands = new List(); + var post = new ComposerSession(Post(string.Empty), null, new ComposerCallbacks { CommandEdited = commands.Add }); + post.EditedCommand("+bbpost\r\n3="); + + var edit = new ComposerSession( + ComposerModel.Create(ComposerPlace.FullScreen, "Ann", "x", ComposeEscaping.AsTyped, new ComposerEdit("a", "moo-code"), null, true, true, 1), + null, + new ComposerCallbacks { CommandEdited = commands.Add }); + edit.EditedCommand("say"); + + await Assert.That(commands).IsEquivalentTo(new[] { "+bbpost 3=" }); + } } diff --git a/tests/SharpMUTerm.Core.Tests/Commands/ComposeMessageTests.cs b/tests/SharpMUTerm.Core.Tests/Commands/ComposeMessageTests.cs index 150edfd0..4e3b2b97 100644 --- a/tests/SharpMUTerm.Core.Tests/Commands/ComposeMessageTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Commands/ComposeMessageTests.cs @@ -93,4 +93,38 @@ public async Task LiteralLeavesOrdinaryProseAlone() await Assert.That(ComposeMessage.Build(body, ComposeEscaping.Literal)).IsEqualTo(body); } + + /// + /// The composer's two fields: the command goes in front of the built text, never escaped, and the text is built as a + /// whole buffer is — escaped per line, then joined with %r. + /// + [Test] + public async Task TheCommandGoesInFrontOfTheBuiltTextUnescaped() + { + var line = ComposeMessage.Build("+pose [x]", "tips his hat; [nods]\n\nwaits", ComposeEscaping.Literal); + + await Assert.That(line).IsEqualTo("+pose [x] tips his hat\\; \\[nods\\]%r%rwaits"); + } + + [Test] + [Arguments("+bbpost 12=", "Title", "+bbpost 12=Title")] + [Arguments("page Bob=", "hi", "page Bob=hi")] + [Arguments(":", "waves.", ":waves.")] + [Arguments(" say ", "hello", "say hello")] + [Arguments("say\nloudly", "hello", "say loudly hello")] + public async Task OneSpaceJoinsThemExceptAfterAnEqualsOrAPunctuationShorthand(string command, string body, string expected) => + await Assert.That(ComposeMessage.Build(command, body, ComposeEscaping.AsTyped)).IsEqualTo(expected); + + /// A blank command is the single buffer it always was: the body is the whole command. + [Test] + [Arguments(null)] + [Arguments("")] + [Arguments(" ")] + public async Task ABlankCommandSendsTheBodyAsTheWholeCommand(string? command) => + await Assert.That(ComposeMessage.Build(command, "+bbpost 1=a\nb", ComposeEscaping.Literal)) + .IsEqualTo(ComposeMessage.Build("+bbpost 1=a\nb", ComposeEscaping.Literal)); + + [Test] + public async Task ACommandWithNoTextIsNothingToSend() => + await Assert.That(ComposeMessage.Build("+pose", " \n ", ComposeEscaping.AsTyped)).IsNull(); } diff --git a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs index 685ae6b4..85f15c9b 100644 --- a/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/NativeComposerRoutingTests.cs @@ -167,7 +167,7 @@ public async Task F1OpensTheHostsEditorAndNotTheCellModal() await Assert.That(model.Place).IsEqualTo(ComposerPlace.FullScreen); await Assert.That(model.Target).IsEqualTo("Ann"); await Assert.That(model.CanSend).IsTrue(); - await Assert.That(model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "⌥L", "⌥W", "⌥P", "Esc" }); + await Assert.That(model.Keys.Select(k => k.Key)).IsEquivalentTo(new[] { "⌃S", "⇥", "⌥L", "⌥W", "⌥P", "Esc" }); } [Test] From 8ab365bf749c312a1e674acdc7ab5ff5f999024a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 20:22:08 +0000 Subject: [PATCH 080/113] Wave 22 A: Combat's quick bar as a strip and the collapsed chat as a bar In the window (HostChrome.Strips): the quick bar takes three rows and draws 34 px buttons with a key cap; F4 gains a style field (danger), drawn in the warning red in both hosts; a collapsed layout panel gets a pane of its own drawn as a one-row bar at the foot of its column (surface collapsed-panel), expanded by a click or by activating a window in it. Vitals card spacing to the mockup. Terminal frames unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 4 + CLAUDE.md | 9 + src/SharpMUTerm.Avalonia/CollapsedBarView.cs | 132 ++++++++++ src/SharpMUTerm.Avalonia/DesktopLayer.cs | 27 +- src/SharpMUTerm.Avalonia/PanelText.cs | 12 +- src/SharpMUTerm.Avalonia/QuickBarButtons.cs | 46 ++-- src/SharpMUTerm.Avalonia/VitalsGauges.cs | 2 +- .../Panels/CollapsedPanelModel.cs | 24 ++ .../Panels/QuickBarModel.cs | 6 +- .../Settings/BuiltInLists.cs | 20 +- .../Surfaces/SurfaceCatalog.cs | 16 ++ src/SharpMUTerm.Core/Automation/Macro.cs | 6 + .../Layouts/LayoutRealiser.cs | 66 ++++- src/SharpMUTerm.Core/Layouts/PanelSizing.cs | 18 +- src/SharpMUTerm.Tui/Hosting/ClientHost.cs | 11 +- src/SharpMUTerm.Tui/KeypadScreenRenderer.cs | 24 +- .../Panels/CollapsedBarRenderer.cs | 26 ++ .../Panels/QuickBarRenderer.cs | 16 +- src/SharpMUTerm.Tui/Pointer/PointerTarget.cs | 4 +- .../Pointer/SharpMUTermApp.Desktop.cs | 8 +- .../SharpMUTermApp.CollapsedBars.cs | 233 ++++++++++++++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs | 8 +- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 9 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 16 +- .../SurfaceParityTests.cs | 17 ++ .../SurfaceCatalogTests.cs | 3 +- .../SharpMUTerm.Tui.Tests/CombatStripTests.cs | 101 ++++++++ .../MacroKeyCaptureTests.cs | 4 +- 28 files changed, 816 insertions(+), 52 deletions(-) create mode 100644 src/SharpMUTerm.Avalonia/CollapsedBarView.cs create mode 100644 src/SharpMUTerm.Client/Panels/CollapsedPanelModel.cs create mode 100644 src/SharpMUTerm.Tui/Panels/CollapsedBarRenderer.cs create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.CollapsedBars.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/CombatStripTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 74e2d7bc..bb4c5fc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] - In the desktop window, the header shows only the search box and your character, and the status bar reads "Corvid connected · UTF-8 · Log off" with a short hint on the right such as "2 new in Chat" (or the keys of the mode you are in). Notices still take the whole bar while they show. +- In the desktop window, Combat's quick bar is a proper strip of buttons, each key a key cap beside its name, and a + binding marked *danger* on F4 (new `style` field) is drawn in red there and in the terminal's quick bar. +- In the desktop window, a panel a layout collapses (Combat's chat) is a one-row bar at the foot of its column saying + how many new lines it holds; click it to open it as a pane. The terminal keeps it as a background tab. - The composer has a Command field above the text, in F1 and the docked panel, in the terminal and the desktop window: put the verb there (`+pose`, `say`, `+bbpost 3=`) and write the post below it. ⇥ moves between the two (⏎ in the command moves on to the text); the command is sent in front of the text unescaped, joined by a space (none after diff --git a/CLAUDE.md b/CLAUDE.md index 416d0ca8..f41fb5a5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1568,6 +1568,15 @@ fallbacks) for inline images/maps. In the window a pop-out button shows only while the pointer is over its panel (`DesktopLayer.SyncPopOutHover`), and a one-row strip gives the button its right end (`ReservesPopOut`: the native control is narrowed, the corner painted the pane's plane), so the button never sits on a strip's text. +- **Wave 22 combat strips (`HostChrome.Strips`, the window's `Desktop`; terminal frames unchanged).** The quick bar is + `PanelSizing.QuickBarStripRows` (3) rows there (`ApplyAll(…, quickBarRows)`), drawn as 34 px buttons (`QuickBarButtons.ButtonHeight`, + key cap in `KeyFace`, a rule on top). `Macro.Danger` (F4 `style`: normal/danger, presentation only; the engine never reads it) is + `QuickBarItem.Danger`, drawn in `ScreenPalette.Warn` held legible (`DangerInk`) in both hosts. A collapsed panel gets a pane of + its own (`LayoutRealiser.Realise(collapsedAsBars:)`, `collapsed:`, below its region's first pane) drawn as a bar + (`SharpMUTermApp.CollapsedBars.cs`, `CollapsedPanelModel`, `CollapsedBarRenderer`, `CollapsedBarView`; surface `collapsed-panel`): + `CollapsedBarRows` (1 under `Input`, else 2), no tab strip, its windows marked scrolled back so the unread reads `N new`. A click, + or `Activate` of a window in it, is `ExpandCollapsedBar` (for the run; an explicit apply clears it). `DesktopLayer.BelowGrid` + stretches a native view at the foot of a column over the field reserve where the band does not reach. - **Wave 19 panels and welcome (window only; the cells are unchanged).** Each docked native panel draws a heading from its model (`PanelHeading.For`, Client; `PanelText.Heading`); `VitalsModel.Source` names where the meters came from (`SourceOf`, set in `ReadVitals`), a mixture names nothing. The docked composer's footer (summary, Preview, Send) ends diff --git a/src/SharpMUTerm.Avalonia/CollapsedBarView.cs b/src/SharpMUTerm.Avalonia/CollapsedBarView.cs new file mode 100644 index 00000000..d9c0f9ea --- /dev/null +++ b/src/SharpMUTerm.Avalonia/CollapsedBarView.cs @@ -0,0 +1,132 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia; + +/// +/// A collapsed panel's bar, over the pane whose cells draw the same : a rule along its +/// top, the panel's name, its unread count in the accent, and the note at the right — the mockups' Chat 2 new ····· +/// collapsed in combat footer of a side column. A left click anywhere on it is , the +/// method the cell row's link ends in; the window builds no command. A right click is the client's, on the cell under it. +/// It never takes the keyboard. +/// +internal sealed class CollapsedBarView : Control +{ + private readonly TerminalView _view; + private CollapsedPanelModel _model = new(string.Empty, 0, string.Empty); + private Color _plane = Colors.Black; + private Color _text = Colors.White; + private Color _accent = Colors.Teal; + private Action? _expand; + private bool _hot; + + public CollapsedBarView(TerminalView view) + { + _view = view; + ClipToBounds = true; + Focusable = false; + Cursor = new Cursor(StandardCursorType.Hand); + ToolTip.SetTip(this, CollapsedPanelModel.ExpandHint); + } + + /// What it is showing. Internal for tests. + internal CollapsedPanelModel Model => _model; + + public void Show(CollapsedPanelModel model, PanelInk ink, Color plane, Color text, Action? expand) + { + _expand = expand; + var accent = PanelText.Parse(ink.Bar); + if (model == _model && plane == _plane && text == _text && accent == _accent) + { + return; + } + + _model = model; + _plane = plane; + _text = text; + _accent = accent; + InvalidateVisual(); + } + + /// Clicks the bar as a left press and release would. Internal for tests. + internal void PerformClick() => _expand?.Invoke(); + + protected override void OnPointerEntered(PointerEventArgs e) + { + base.OnPointerEntered(e); + _hot = true; + InvalidateVisual(); + } + + protected override void OnPointerExited(PointerEventArgs e) + { + base.OnPointerExited(e); + _hot = false; + InvalidateVisual(); + } + + protected override void OnPointerMoved(PointerEventArgs e) + { + base.OnPointerMoved(e); + e.Handled = true; + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + e.Handled = true; + if (e.GetCurrentPoint(this).Properties.IsRightButtonPressed) + { + _view.ForwardRightClick(e.GetPosition(_view), e.KeyModifiers); + } + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + base.OnPointerReleased(e); + e.Handled = true; + if (e.InitialPressMouseButton == MouseButton.Left && new Rect(Bounds.Size).Contains(e.GetPosition(this))) + { + _expand?.Invoke(); + } + } + + protected override void OnPointerWheelChanged(PointerWheelEventArgs e) + { + base.OnPointerWheelChanged(e); + e.Handled = true; + } + + public override void Render(DrawingContext context) + { + var bounds = new Rect(Bounds.Size); + var plane = _hot ? PanelText.Mix(_plane, _text, 0.05) : _plane; + context.FillRectangle(new SolidColorBrush(plane), bounds); + context.FillRectangle( + new SolidColorBrush(PanelText.Rule(_text, _plane)), + NativeTokens.HorizontalRule(this, 0, 0, bounds.Width)); + if (bounds.Width < 8) + { + return; + } + + var middle = bounds.Height / 2; + var size = PanelText.Size; + var x = PanelText.Pad; + var note = PanelText.Measure(_model.Note, NativeTokens.Small + 1, false); + var right = bounds.Width - PanelText.Pad; + var room = Math.Max(1, right - x - note - NativeTokens.Space16); + x += PanelText.Draw(context, _model.Title, x, middle, size, _text, true, room); + if (_model.UnreadText.Length > 0) + { + x += NativeTokens.Space8; + PanelText.Draw(context, _model.UnreadText, x, middle, size, _accent, true, Math.Max(1, right - x - note - NativeTokens.Space8)); + } + + PanelText.Draw(context, _model.Note, right, middle, NativeTokens.Small + 1, PanelText.Dim(_text, _plane), false, note + 1, alignRight: true); + } +} diff --git a/src/SharpMUTerm.Avalonia/DesktopLayer.cs b/src/SharpMUTerm.Avalonia/DesktopLayer.cs index 51d83de0..44d097c0 100644 --- a/src/SharpMUTerm.Avalonia/DesktopLayer.cs +++ b/src/SharpMUTerm.Avalonia/DesktopLayer.cs @@ -48,6 +48,7 @@ internal sealed class DesktopLayer : Canvas private readonly NativeFooter _footer; private readonly Dictionary _whoHere = new(StringComparer.Ordinal); private readonly Dictionary _quickBars = new(StringComparer.Ordinal); + private readonly Dictionary _collapsedBars = new(StringComparer.Ordinal); private readonly Dictionary _composers = new(StringComparer.Ordinal); private readonly NoticeToasts _toasts; private readonly Dictionary _strips = new(StringComparer.Ordinal); @@ -151,6 +152,9 @@ protected override void OnSizeChanged(SizeChangedEventArgs e) /// The native quick bars by window id. Internal for tests. internal IReadOnlyDictionary QuickBars => _quickBars; + /// The collapsed panels' bars, by window id. Internal for tests. + internal IReadOnlyDictionary CollapsedBars => _collapsedBars; + /// The native docked composers by window id. Internal for tests. internal IReadOnlyDictionary Composers => _composers; @@ -458,6 +462,15 @@ private void SyncPanels(ScreenFrame frame, Size cell) cell, (bar, panel, plane) => bar.Show(panel.QuickBar!, panel.Ink, plane, text, cell.Height, panel.Pick, panel.Dispatch)); + // A collapsed panel's bar, at the foot of its column (HostChrome.Strips). + Place( + _collapsedBars, + _pointer.Panels.Where(p => p.Collapsed is not null), + () => new CollapsedBarView(_view), + frame, + cell, + (bar, panel, plane) => bar.Show(panel.Collapsed!, panel.Ink, plane, text, panel.Expand)); + // The docked composer: a native editor over its pane, the cell editor still drawn (and still the draft) under it. Place( _composers, @@ -627,7 +640,7 @@ private void Place( // A one-row strip that can pop out leaves its right end to the button (ReservesPopOut), so the button never // lies over its text (`88 / 100`, `F4 edits keys`); the button paints the pane's plane over the cells there. control.Width = Math.Max(0, (rect.Width * cell.Width) - (ReservesPopOut(panel) ? PopOutReserve(cell) : 0)); - control.Height = rect.Height * cell.Height; + control.Height = (rect.Height * cell.Height) + BelowGrid(frame, rect); // The pane's own plane, read off the frame, so the native view sits on whatever the pane wears — its // character's tint, the focus lift — without the client having to say it twice. @@ -637,6 +650,18 @@ private void Place( } } + /// + /// The pixels under the grid a panel also covers: where the window draws the command line's field in the output's + /// column, the grid is shorter than the view and the columns beside the field + /// are filled with their last row's plane down to the footer. A panel whose pane ends on the grid's last row in such a + /// column (a collapsed panel's bar, the map) runs down over that filler, so it meets the footer as the mockups draw it. + /// + private double BelowGrid(ScreenFrame frame, SharpMUTerm.Core.Workspaces.PaneRect rect) => + _chrome.Input && frame.Band is { } band && rect.Y + rect.Height >= frame.Height && rect.Width > 0 + && !band.Spans(rect.X, frame.Width) && !band.Spans(rect.X + rect.Width - 1, frame.Width) + ? NativeLayout.FieldReserve + : 0; + /// The client builds the menu on its thread; it is opened here, under the button. private void OpenMenu(HeaderAction action, HeaderButton button) => action.Menu(model => Dispatcher.UIThread.Post(() => diff --git a/src/SharpMUTerm.Avalonia/PanelText.cs b/src/SharpMUTerm.Avalonia/PanelText.cs index f2cddc94..64a19cee 100644 --- a/src/SharpMUTerm.Avalonia/PanelText.cs +++ b/src/SharpMUTerm.Avalonia/PanelText.cs @@ -12,13 +12,13 @@ namespace SharpMUTerm.Avalonia; internal static class PanelText { /// One line of text, trimmed to with an ellipsis. - public static FormattedText Format(string text, double size, Color colour, bool bold, double maxWidth = double.PositiveInfinity) + public static FormattedText Format(string text, double size, Color colour, bool bold, double maxWidth = double.PositiveInfinity, FontFamily? face = null) { var formatted = new FormattedText( text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, - new Typeface(NativeTokens.UiFont, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), + new Typeface(face ?? NativeTokens.UiFont, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), size, new SolidColorBrush(colour)) { @@ -34,20 +34,22 @@ public static FormattedText Format(string text, double size, Color colour, bool } /// How wide a line is drawn, untrimmed. - public static double Measure(string text, double size, bool bold) => Format(text, size, Colors.White, bold).Width; + public static double Measure(string text, double size, bool bold, FontFamily? face = null) => Format(text, size, Colors.White, bold, face: face).Width; /// /// Draws a line with its left edge at (its right edge there when ), /// centred on , and returns the width it took. /// - public static double Draw(DrawingContext context, string text, double x, double middle, double size, Color colour, bool bold, double maxWidth, bool alignRight = false) + public static double Draw( + DrawingContext context, string text, double x, double middle, double size, Color colour, bool bold, double maxWidth, bool alignRight = false, + FontFamily? face = null) { if (maxWidth < 2 || text.Length == 0) { return 0; } - var formatted = Format(text, size, colour, bold, maxWidth); + var formatted = Format(text, size, colour, bold, maxWidth, face); var width = Math.Min(formatted.Width, maxWidth); context.DrawText(formatted, new Point(alignRight ? x - width : x, middle - (formatted.Height / 2))); return width; diff --git a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs index ff9ced8d..1caa8892 100644 --- a/src/SharpMUTerm.Avalonia/QuickBarButtons.cs +++ b/src/SharpMUTerm.Avalonia/QuickBarButtons.cs @@ -10,10 +10,11 @@ namespace SharpMUTerm.Avalonia; /// -/// The quick bar as native buttons, over the pane whose cells draw the same : one button -/// per binding (its key in the accent, then its name), a +N button holding the bindings that do not fit, and -/// F4 edits keys as a link at the right. Every button is drawn alike — the model marks no binding as special, -/// so neither does the window — except that a key this host cannot deliver is drawn dim, as the cells draw it. +/// The quick bar as native buttons, over the pane whose cells draw the same : the mockups' +/// strip (a rule along its top, -pixel buttons, the key as a monospace cap then the name), a +/// +N button holding the bindings that do not fit, and the dashed + Bind a key at the right. A binding F4 +/// flags dangerous () is drawn in the warning colour — a plate and edge leaned toward +/// it and its words in it — as the cells draw it; a key this host cannot deliver is drawn dim. /// /// It takes the pointer, as the map does, and never the keyboard. A click on a binding is /// with its index: the client runs that binding on the panel's own character through @@ -43,7 +44,10 @@ internal enum SlotKind /// The widest a binding's name is drawn before it is trimmed. internal const double MaxTitleWidth = 150; - private const double Gap = NativeTokens.Space8, PadX = NativeTokens.Space12; + private const double Gap = NativeTokens.Space8, PadX = NativeTokens.Space14; + + /// A button's height where the strip has the room (PanelSizing.QuickBarStripRows): the mockups' 34 px. + internal const double ButtonHeight = NativeTokens.ControlHeight + NativeTokens.Space2; /// The first button's left edge: the chrome's one text inset, as every panel's heading and the output are. private const double Lead = NativeTokens.PanelInset; @@ -128,13 +132,16 @@ public void Show(QuickBarModel model, PanelInk ink, Color plane, Color text, dou /// The key chip's size: a step under the label, as a caption. private double KeySize => Math.Max(8, FontSize - 2); + /// The key cap's face: the cells' mono, as every key chip in the window. + private static FontFamily KeyFace => NativeTokens.KeyFace; + private static string Trim(QuickBarItem item) => item.Title; private double ItemWidth(QuickBarItem item) { var size = FontSize; var title = Math.Min(MaxTitleWidth, PanelText.Measure(Trim(item), size, false)); - return PadX + PanelText.Measure(NativeKeys.Words(item.Key), KeySize, false) + 7 + title + PadX; + return PadX + PanelText.Measure(NativeKeys.Words(item.Key), KeySize, false, KeyFace) + NativeTokens.Space8 + title + PadX; } private double MoreWidth(int hidden) => PadX + PanelText.Measure($"+{hidden.ToString(CultureInfo.InvariantCulture)}", FontSize, true) + PadX; @@ -160,8 +167,8 @@ private void Layout(Size size) return; } - var height = Math.Max(4, size.Height - 4); - var top = (size.Height - height) / 2; + var height = Math.Max(4, Math.Min(ButtonHeight, size.Height - 4)); + var top = Math.Round((size.Height - height) / 2); var items = _model.Items; var widths = items.Select(ItemWidth).ToList(); foreach (var withEdit in new[] { true, false }) @@ -334,6 +341,12 @@ public override void Render(DrawingContext context) { var bounds = new Rect(Bounds.Size); context.FillRectangle(new SolidColorBrush(_plane), bounds); + if (bounds.Height > ButtonHeight) + { + // A strip tall enough for the buttons is a strip: a rule along its top, as the mockups draw it over the field. + context.FillRectangle(new SolidColorBrush(PanelText.Rule(_text, _plane)), NativeTokens.HorizontalRule(this, 0, 0, bounds.Width)); + } + Layout(bounds.Size); var size = FontSize; var accent = PanelText.Parse(_ink.Bar); @@ -357,11 +370,12 @@ public override void Render(DrawingContext context) { // The key as a caption, then the binding's name: a button per binding, as the mockups draw the bar. var item = _model.Items[slot.Index]; - Plate(context, rect, hot, down, dashed: false); - var keyInk = item.Fires ? dim : PanelText.Mix(dim, _plane, 0.35); - var titleInk = item.Fires ? _text : dim; + var danger = item.Danger ? PanelText.Parse(_ink.Low) : (Color?)null; + Plate(context, rect, hot, down, dashed: false, danger); + var keyInk = item.Fires ? danger is { } d ? PanelText.Mix(d, _text, 0.3) : dim : PanelText.Mix(dim, _plane, 0.35); + var titleInk = item.Fires ? danger is { } t ? PanelText.Mix(t, _text, 0.55) : _text : dim; var x = rect.Left + PadX; - x += PanelText.Draw(context, NativeKeys.Words(item.Key), x, middle, KeySize, keyInk, false, rect.Width) + 7; + x += PanelText.Draw(context, NativeKeys.Words(item.Key), x, middle, KeySize, keyInk, false, rect.Width, face: KeyFace) + NativeTokens.Space8; PanelText.Draw(context, Trim(item), x, middle, size, titleInk, false, rect.Right - PadX - x + 0.5); break; } @@ -384,11 +398,13 @@ public override void Render(DrawingContext context) /// A button's plate: a step off the plane with a rule-coloured edge, stronger under the pointer and while pressed; the /// bind button's edge is dashed and its plate empty until the pointer is on it. /// - private void Plate(DrawingContext context, Rect rect, bool hot, bool down, bool dashed) + private void Plate(DrawingContext context, Rect rect, bool hot, bool down, bool dashed, Color? danger = null) { - var fill = dashed && !hot && !down ? _plane : PanelText.Mix(_plane, _text, down ? 0.2 : hot ? 0.13 : 0.07); + var fill = dashed && !hot && !down ? _plane + : danger is { } warn ? PanelText.Mix(_plane, warn, down ? 0.3 : hot ? 0.24 : 0.17) + : PanelText.Mix(_plane, _text, down ? 0.2 : hot ? 0.13 : 0.07); var edge = new Pen( - new SolidColorBrush(PanelText.Mix(_plane, _text, dashed ? 0.3 : 0.18)), + new SolidColorBrush(danger is { } rim ? PanelText.Mix(_plane, rim, 0.42) : PanelText.Mix(_plane, _text, dashed ? 0.3 : 0.18)), NativeTokens.DevicePixel(this), dashed ? new DashStyle([4, 3], 0) : null); var radius = Math.Min(NativeTokens.RadiusM, rect.Height / 2); diff --git a/src/SharpMUTerm.Avalonia/VitalsGauges.cs b/src/SharpMUTerm.Avalonia/VitalsGauges.cs index 16dbff45..75ffb391 100644 --- a/src/SharpMUTerm.Avalonia/VitalsGauges.cs +++ b/src/SharpMUTerm.Avalonia/VitalsGauges.cs @@ -66,7 +66,7 @@ public void Show(VitalsModel model, PanelInk ink, Color plane, Color text, doubl private static double BarHeight(double cellHeight) => cellHeight >= 15 ? 10 : 8; /// Height one stacked block takes: a line of text, the bar under it, and the gap to the next. - private static double BlockHeight(double cellHeight) => LabelHeight(cellHeight) + 4 + BarHeight(cellHeight) + 10; + private static double BlockHeight(double cellHeight) => LabelHeight(cellHeight) + NativeTokens.Space4 + BarHeight(cellHeight) + NativeTokens.Space12; /// The height every stacked block takes, the target's rule included. private double BlocksHeight(VitalsModel model) => diff --git a/src/SharpMUTerm.Client/Panels/CollapsedPanelModel.cs b/src/SharpMUTerm.Client/Panels/CollapsedPanelModel.cs new file mode 100644 index 00000000..eedf1e9f --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/CollapsedPanelModel.cs @@ -0,0 +1,24 @@ +namespace SharpMUTerm.Client.Panels; + +/// +/// A panel the layout collapsed, as the one-line bar at the foot of its column: what it is (Chat), how many lines +/// have arrived in it unseen, and why it is folded away (collapsed in combat). The cells draw it as a row +/// (CollapsedBarRenderer) and the window as a native bar over that row; a click on either expands the panel into a +/// pane that shares its column. Only a host that draws strips (HostChrome.Strips) gives a collapsed panel a bar; +/// elsewhere it is a background tab, as it always was. +/// +/// The panel's name: its first window's title. +/// Lines that arrived in its windows while folded away. +/// Why it is folded: collapsed in combat, after the layout. +public sealed record CollapsedPanelModel(string Title, int Unread, string Note) +{ + /// The unread count in words, or empty when there is none: 2 new. + public string UnreadText => Unread > 0 ? $"{(Unread > 99 ? "99+" : Unread.ToString(System.Globalization.CultureInfo.InvariantCulture))} new" : string.Empty; + + /// The note for a panel collapsed by . + public static string NoteFor(string? layoutName) => + string.IsNullOrWhiteSpace(layoutName) ? "collapsed" : $"collapsed in {layoutName.Trim().ToLowerInvariant()}"; + + /// What a click on the bar does, for a tooltip and a screen reader. + public const string ExpandHint = "Click to show it in the column"; +} diff --git a/src/SharpMUTerm.Client/Panels/QuickBarModel.cs b/src/SharpMUTerm.Client/Panels/QuickBarModel.cs index 4dab8746..e0546f1c 100644 --- a/src/SharpMUTerm.Client/Panels/QuickBarModel.cs +++ b/src/SharpMUTerm.Client/Panels/QuickBarModel.cs @@ -8,13 +8,15 @@ namespace SharpMUTerm.Client.Panels; /// The binding's name, on one line. /// Whether pressing the key reaches the binding on this host; one that does not is still /// clickable and drawn dim. -public sealed record QuickBarItem(string Key, string Descriptor, string Title, bool Fires); +/// Whether the binding is flagged dangerous on F4 (Macro.Danger): every view draws it in the +/// warning colour. +public sealed record QuickBarItem(string Key, string Descriptor, string Title, bool Fires, bool Danger = false); /// /// The quick bar's content for one character: its function-key bindings in the order every view lists them, plain /// keys before modified ones and then by number. The terminal draws them as a row of cells (QuickBarRenderer); /// the window draws native buttons over that row from the same instance, so an item index names the same binding -/// in both. Nothing here marks a binding as dangerous: the configuration says no such thing, so no view may. +/// in both. A binding is dangerous only where F4 says so (); no view guesses it from a name. /// public sealed record QuickBarModel(IReadOnlyList Items) { diff --git a/src/SharpMUTerm.Client/Settings/BuiltInLists.cs b/src/SharpMUTerm.Client/Settings/BuiltInLists.cs index d3e31228..71bdfa3c 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInLists.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInLists.cs @@ -277,6 +277,15 @@ public static partial class BuiltInSettings }, }; + /// A binding's ordinary look, on F4's style. + public const string NormalStyle = "normal"; + + /// A binding drawn in the warning colour (). + public const string DangerStyle = "danger"; + + /// F4's style choices. + public static IReadOnlyList MacroStyles { get; } = [NormalStyle, DangerStyle]; + /// F4: the key bindings of every set. public static SettingsSectionContribution Keypad { get; } = new() { @@ -296,7 +305,7 @@ public static partial class BuiltInSettings is { } key ? new Macro { Name = NewBindingName, Key = key, Command = NewBindingCommand } : null, - Copy = m => new Macro { Name = m.Name, Key = m.Key, Enabled = m.Enabled, Command = m.Command, ScriptCallback = m.ScriptCallback }, + Copy = m => new Macro { Name = m.Name, Key = m.Key, Enabled = m.Enabled, Command = m.Command, Danger = m.Danger, ScriptCallback = m.ScriptCallback }, Name = m => m.Name, Rename = (m, v) => m.Name = v, Title = m => m.Key, @@ -316,6 +325,15 @@ public static partial class BuiltInSettings Binding = SettingBinding.ForItem((_, m) => m.Key, (_, m, v) => m.Key = v, NewMacro), }, OwnerField(s => s.Macros, NewMacro, () => Keypad!), + new ChoiceField("style", "style", MacroStyles, "how the quick bar draws it: danger is the warning colour") + { + Group = BehaviourGroup, + Keywords = "danger warning red colour quick bar", + Binding = SettingBinding.ForItem( + (_, m) => m.Danger ? DangerStyle : NormalStyle, + (_, m, v) => m.Danger = string.Equals(v, DangerStyle, StringComparison.Ordinal), + NewMacro), + }, ], }, }; diff --git a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs index e463761f..9ae42337 100644 --- a/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs +++ b/src/SharpMUTerm.Client/Surfaces/SurfaceCatalog.cs @@ -234,6 +234,12 @@ public static class SurfaceCatalog /// public const string FloatingPanel = "floating-panel"; + /// + /// A panel the layout collapsed, as a one-line bar at the foot of its column where the host draws strips + /// (HostChrome.Strips): a row of cells, and in the window a native bar over it. A click expands it. + /// + public const string CollapsedPanel = "collapsed-panel"; + /// /// Pop the panel out into a window of its own: the window's alone, offered by a button on the panel's native view, /// the pane's right-click menu and ⌃P (panel:popout:<window>), all ending in one client method. @@ -639,6 +645,16 @@ [.. PanelViews("MapCanvas"), "SharpMUTerm.Avalonia.MapInspector"]), NativeChrome, "SharpMUTerm.Tui.TabTitles.Strip", ["SharpMUTerm.Avalonia.NativeTabStrip"]), + new( + CollapsedPanel, + typeof(CollapsedPanelModel), + [ + // Expand: the cell row is one link to the same method, so the cells need no other door. + new(SurfaceActionKind.Target, "expand", "ExpandCollapsedBar"), + ], + CellsUnderNative, + "SharpMUTerm.Tui.Panels.CollapsedBarRenderer.Render", + ["SharpMUTerm.Avalonia.CollapsedBarView"]), new( ScrollBand, typeof(ScrollBandModel), diff --git a/src/SharpMUTerm.Core/Automation/Macro.cs b/src/SharpMUTerm.Core/Automation/Macro.cs index 6c2e5272..9f3e4d1b 100644 --- a/src/SharpMUTerm.Core/Automation/Macro.cs +++ b/src/SharpMUTerm.Core/Automation/Macro.cs @@ -38,6 +38,12 @@ public sealed class Macro /// public string Command { get; set; } = string.Empty; + /// + /// Whether the binding is drawn as a dangerous one (flee, quit): the quick bar gives it the warning + /// colour in both hosts. Presentation only; the engine never reads it. + /// + public bool Danger { get; set; } + /// Optional named script callback (resolved by the scripting layer). public string? ScriptCallback { get; init; } } diff --git a/src/SharpMUTerm.Core/Layouts/LayoutRealiser.cs b/src/SharpMUTerm.Core/Layouts/LayoutRealiser.cs index 19f92236..ad31f146 100644 --- a/src/SharpMUTerm.Core/Layouts/LayoutRealiser.cs +++ b/src/SharpMUTerm.Core/Layouts/LayoutRealiser.cs @@ -30,24 +30,41 @@ public sealed record RealisedLayout( /// and its split collapsed. /// A collapsed panel's windows are background tabs of the first pane in its region that is not a strip, else of the output pane: /// a title the player can open, which is what collapsed means in a pane tree. +/// Where the host draws collapsed panels as bars (collapsedAsBars), a collapsed panel's windows are a pane of +/// their own instead, under that pane in its column, with the id and the panel id: the +/// host draws it as a one-line bar that a click expands. /// Every window in keep that no panel placed survives — in the pane it asks for when that pane still /// exists, else in the output pane. Applying a layout never closes a window. /// /// public static class LayoutRealiser { + /// The id prefix of a collapsed panel's own pane (collapsedAsBars), followed by the panel id. + public const string CollapsedPanePrefix = "collapsed:"; + + /// The share a collapsed panel's pane is given beside the pane above it, for when it is expanded. + public const double CollapsedPaneShare = 0.5; + + /// The panel a collapsed panel's pane stands for, or null when is no such pane. + public static string? CollapsedPanelOf(string? paneId) => + paneId is not null && paneId.StartsWith(CollapsedPanePrefix, StringComparison.Ordinal) && paneId.Length > CollapsedPanePrefix.Length + ? paneId[CollapsedPanePrefix.Length..] + : null; + /// Realises , or returns null when it draws nothing. /// The layout folded, for the regions of collapsed panels. /// The fold. /// The windows that draw a panel, in tab order; empty when nothing does yet. /// The session's own window: focused, and where strays go. /// Windows to keep, each with the pane id it would like to stay in (or null). + /// Whether a collapsed panel gets a pane of its own under its region's pane (see above). public static RealisedLayout? Realise( LayoutDefinition layout, LayoutFoldResult fold, Func> windowsOf, string outputWindowId, - IEnumerable<(string WindowId, string? PaneId)>? keep = null) + IEnumerable<(string WindowId, string? PaneId)>? keep = null, + bool collapsedAsBars = false) { ArgumentNullException.ThrowIfNull(layout); ArgumentNullException.ThrowIfNull(fold); @@ -125,6 +142,14 @@ public static class LayoutRealiser && PanelSizing.FixedRows(first) is null && layout.PlacementOf(first)?.Region == collapsed.Region) ?? output; + if (collapsedAsBars) + { + var bar = new PaneNode(CollapsedPanePrefix + collapsed.PanelId, windows); + root = Below(root, target, bar); + panelPanes[collapsed.PanelId] = bar.Id; + continue; + } + target.Tabs.AddRange(windows); panelPanes[collapsed.PanelId] = target.Id; } @@ -145,6 +170,45 @@ public static class LayoutRealiser return new RealisedLayout(root, output.Id, panelPanes, FoldShape(fold)); } + /// + /// with under : beside it in its column when its + /// parent is one, else in a new column the two share (). + /// + private static LayoutNode Below(LayoutNode root, PaneNode target, PaneNode bar) + { + if (ReferenceEquals(root, target)) + { + return new SplitNode(SplitDirection.Column, [target, bar], [1, CollapsedPaneShare]); + } + + if (root is not SplitNode split) + { + return root; + } + + var children = new List(); + var sizes = new List(); + for (var i = 0; i < split.Children.Count; i++) + { + var child = split.Children[i]; + if (ReferenceEquals(child, target) && split.Direction == SplitDirection.Column) + { + children.Add(child); + sizes.Add(split.Sizes[i]); + children.Add(bar); + sizes.Add(split.Sizes[i] * CollapsedPaneShare); + continue; + } + + children.Add(ReferenceEquals(child, target) + ? new SplitNode(SplitDirection.Column, [target, bar], [1, CollapsedPaneShare]) + : Below(child, target, bar)); + sizes.Add(split.Sizes[i]); + } + + return new SplitNode(split.Direction, children, sizes); + } + /// /// What a fold draws and where, as a string: the tree of panes with their panel ids, then the collapsed panels. /// No sizes and no window ids, so it changes only when a panel appears, goes, or moves. diff --git a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs index df95cc5e..4279905b 100644 --- a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs +++ b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs @@ -29,6 +29,12 @@ public static class PanelSizing /// public static int VitalsCardRows(int meters) => (2 * Math.Max(0, meters)) + 6; + /// + /// The rows a quick bar takes where the host draws it as a strip of buttons (HostChrome.Strips, the window): + /// three twenty-pixel rows hold the mockups' 34-pixel buttons with their padding. Everywhere else it is one row. + /// + public const int QuickBarStripRows = 3; + /// The rows of content a docked composer is never squeezed below: its header, four rows of post and its key hints. public const int ComposerMinRows = 6; @@ -77,13 +83,16 @@ public static bool IsStrip(IReadOnlyList panels) => /// Non-null when a vitals tab here is drawn as a card of that many rows ( decides); null for /// the one-row strip. /// - public static void Apply(PaneNode pane, Func panelOf, int tabStripRows, int? vitalsCardRows = null) + /// The rows a quick bar takes: 1, or where the host draws buttons. + public static void Apply(PaneNode pane, Func panelOf, int tabStripRows, int? vitalsCardRows = null, int quickBarRows = 1) { ArgumentNullException.ThrowIfNull(pane); ArgumentNullException.ThrowIfNull(panelOf); var panels = pane.Tabs.Select(panelOf).ToList(); int? Rows(string? panel) => - vitalsCardRows is { } card && string.Equals(panel, PanelIds.Vitals, StringComparison.Ordinal) ? card : FixedRows(panel); + vitalsCardRows is { } card && string.Equals(panel, PanelIds.Vitals, StringComparison.Ordinal) ? card + : string.Equals(panel, PanelIds.QuickBar, StringComparison.Ordinal) ? Math.Max(1, quickBarRows) + : FixedRows(panel); var strip = panels.Count > 0 && panels.All(p => Rows(p) is not null); var chrome = ShowsTabStrip(panels) ? Math.Max(0, tabStripRows) : 0; @@ -106,7 +115,8 @@ public static void Apply(PaneNode pane, Func panelOf, int tabSt /// share of the window's width (). is how many /// meters the character behind a vitals window has, by window id. /// - public static void ApplyAll(LayoutNode root, Func panelOf, int tabStripRows, Func vitalsMetersOf) + /// The rows a quick bar takes (see ). + public static void ApplyAll(LayoutNode root, Func panelOf, int tabStripRows, Func vitalsMetersOf, int quickBarRows = 1) { ArgumentNullException.ThrowIfNull(root); ArgumentNullException.ThrowIfNull(vitalsMetersOf); @@ -119,7 +129,7 @@ public static void ApplyAll(LayoutNode root, Func panelOf, int card = VitalsCardRows(vitalsMetersOf(vitals)); } - Apply(pane, panelOf, tabStripRows, card); + Apply(pane, panelOf, tabStripRows, card, quickBarRows); } } diff --git a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs index 1144503c..8b20e383 100644 --- a/src/SharpMUTerm.Tui/Hosting/ClientHost.cs +++ b/src/SharpMUTerm.Tui/Hosting/ClientHost.cs @@ -336,8 +336,15 @@ internal static ClientHost HarnessTerminal( /// as wide as the column the output is in (), with the panes beside /// it running down to the status row. Only cells move; the pane rectangles, and so NAWS, are what is arranged. /// +/// +/// The host draws the strip panels as desktop strips: the quick bar gets PanelSizing.QuickBarStripRows rows for +/// its buttons, and a panel a layout collapses gets a pane of its own at the foot of its column, drawn as a one-line bar +/// (CollapsedPanelModel) a click expands, rather than a background tab of the pane above it. Rows only; the pane +/// rectangles, and so NAWS, are what is arranged. +/// internal sealed record HostChrome( - bool Header, bool Rail, bool Status = false, bool Input = false, bool Tabs = false, bool PaneGutter = false, bool InputInColumn = false) + bool Header, bool Rail, bool Status = false, bool Input = false, bool Tabs = false, bool PaneGutter = false, bool InputInColumn = false, + bool Strips = false) { /// The client draws all of its chrome in cells: the terminal, the snapshot, the tests. public static HostChrome None { get; } = new(false, false); @@ -349,7 +356,7 @@ internal sealed record HostChrome( /// The host draws the header, the rail, the status footer, the command line's field and every pane's tab strip, and /// the client pads every pane with a gutter and puts the command line in the output's column: the desktop window. /// - public static HostChrome Desktop { get; } = new(true, true, true, true, true, true, true); + public static HostChrome Desktop { get; } = new(true, true, true, true, true, true, true, true); /// The same arrangement as ; the name the tab strip's tests use. public static HostChrome Native => Desktop; diff --git a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs index 9e4ac9ef..5092f726 100644 --- a/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/KeypadScreenRenderer.cs @@ -94,6 +94,13 @@ internal static class KeypadScreenRenderer /// internal const int SetField = 3; + /// + /// The binding's style (: normal or danger), appended after the set for the + /// same reason, and like it present only when the screen knows the sets. It is drawn after the command only while + /// it says danger or is being edited, so an ordinary row is drawn as it always was. + /// + internal const int StyleField = 4; + /// The label the binding list's add button carries; it names the key it will claim. internal const string AddBindingLabel = "+ binding"; @@ -227,7 +234,7 @@ internal static string HeaderLine(int width, ScreenModel? model = null, ScreenFo internal static SettingsCollection Declared => BuiltInSettings.Keypad.Collection!; /// The binding row's fields by declared id, in ⇥ order; set only when the screen knows the sets. - internal static IReadOnlyList RowFieldOrder { get; } = ["name", "command", "key", "set"]; + internal static IReadOnlyList RowFieldOrder { get; } = ["name", "command", "key", "set", "style"]; internal static ScreenModel Model( HostKeys keys, @@ -249,7 +256,7 @@ private static ScreenRow BindingRow( { var target = new SettingTarget(DeclaredFields.Over(sets ?? Array.Empty()), Item: macro); var fields = RowFieldOrder - .Where(id => sets is not null || id != "set") + .Where(id => sets is not null || (id != "set" && id != "style")) .Select(id => DeclaredFields.Item( Declared.Field(id), target, @@ -486,7 +493,8 @@ internal static List HotkeysColumn( cursor.EditOn(0, i, NameField), cursor.EditOn(0, i, CommandField), cursor.EditOn(0, i, KeyField), - cursor.EditOn(0, i, SetField)), + cursor.EditOn(0, i, SetField), + cursor.EditOn(0, i, StyleField)), cursor.IsOn(0, i), width)); } @@ -560,7 +568,8 @@ private static string Hotkey( ScreenFieldEdit? name, ScreenFieldEdit? command, ScreenFieldEdit? key, - ScreenFieldEdit? set) + ScreenFieldEdit? set, + ScreenFieldEdit? style = null) { var verdict = MacroKeys.Verdict(keys, macro.Key); var clash = KeyClashes.For(keys, macro, macros); @@ -592,7 +601,12 @@ private static string Hotkey( : ScreenChrome.Field( PadVisible($"[{Value}]{Escape(Truncate(setName, SetColumnWidth))}[/]", SetColumnWidth), set) + " "; - return $"{tick} {bound} {named} {owner}→ {ScreenChrome.Field(Escape(macro.Command), command)}"; + // The style is said only when it is not the ordinary one, or while it is being changed: a danger binding reads + // "· danger" in the caution ink after its command, and every other row is the row it always was. + var styled = style is not null + ? " " + ScreenChrome.Field(macro.Danger ? BuiltInSettings.DangerStyle : BuiltInSettings.NormalStyle, style) + : macro.Danger ? $" [{Caution}]· {BuiltInSettings.DangerStyle}[/]" : string.Empty; + return $"{tick} {bound} {named} {owner}→ {ScreenChrome.Field(Escape(macro.Command), command)}{styled}"; } /// diff --git a/src/SharpMUTerm.Tui/Panels/CollapsedBarRenderer.cs b/src/SharpMUTerm.Tui/Panels/CollapsedBarRenderer.cs new file mode 100644 index 00000000..4d262cde --- /dev/null +++ b/src/SharpMUTerm.Tui/Panels/CollapsedBarRenderer.cs @@ -0,0 +1,26 @@ +using SharpMUTerm.Client.Panels; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui.Panels; + +/// +/// A collapsed panel's bar as a row of cells: ▸ Chat 2 new ······ collapsed in combat, the whole row one link +/// () the bar's own control answers by expanding the panel. Drawn from a +/// , the one the window's native bar is drawn from. Elided to the width, never wrapped. +/// +internal static class CollapsedBarRenderer +{ + /// The link the row carries; only the bar's own control answers it. + internal const string ExpandLink = "mux:collapsed:expand"; + + /// The row for cells. + internal static string Render(CollapsedPanelModel model, int width, string accent) + { + ArgumentNullException.ThrowIfNull(model); + width = Math.Max(1, width); + var left = $"▸ [bold]{Escape(model.Title)}[/]" + (model.Unread > 0 ? $" [bold {accent}]{Escape(model.UnreadText)}[/]" : string.Empty); + var right = $"[dim]{Escape(model.Note)}[/]"; + var row = VisibleLength(left) + VisibleLength(right) + 2 <= width ? SpreadLR(left, right, width) : ElideVisible(left, width); + return $"[link={ExpandLink}]{row}[/]"; + } +} diff --git a/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs b/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs index d6291aad..b1e48acc 100644 --- a/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/QuickBarRenderer.cs @@ -59,14 +59,18 @@ internal static QuickBarModel Entries(HostKeys keys, IEnumerable macros, var key = (parts.Ctrl ? "⌃" : string.Empty) + (parts.Alt ? "⌥" : string.Empty) + (parts.Shift ? "⇧" : string.Empty) + parts.Key; var modifiers = (parts.Ctrl ? 1 : 0) + (parts.Alt ? 2 : 0) + (parts.Shift ? 4 : 0); - entries.Add((new QuickBarItem(key, descriptor, Single(name), MacroKeys.Verdict(keys, descriptor).Fires), modifiers, number)); + entries.Add((new QuickBarItem(key, descriptor, Single(name), MacroKeys.Verdict(keys, descriptor).Fires, macro.Danger), modifiers, number)); } return new QuickBarModel(entries.OrderBy(e => e.Modifiers).ThenBy(e => e.Number).Select(e => e.Entry).ToList()); } /// The row for cells. Entries that do not fit are counted, never wrapped. - internal static string Render(QuickBarModel model, int width, string accent) + /// What to draw. + /// The row's width in cells. + /// The key's ink. + /// The ink a dangerous binding's key and name take; the accent when null. + internal static string Render(QuickBarModel model, int width, string accent, string? danger = null) { var entries = model.Items; width = Math.Max(1, width); @@ -76,7 +80,7 @@ internal static string Render(QuickBarModel model, int width, string accent) return ElideVisible($"[dim]{QuickBarModel.EmptyText} · [/]{hint}", width); } - var cells = entries.Select((e, i) => Cell(e, i, accent)).ToList(); + var cells = entries.Select((e, i) => Cell(e, i, accent, danger ?? accent)).ToList(); var hintWidth = VisibleLength(hint); foreach (var withHint in new[] { true, false }) { @@ -118,11 +122,13 @@ internal static string Render(QuickBarModel model, int width, string accent) return null; } - private static string Cell(QuickBarItem entry, int index, string accent) + private static string Cell(QuickBarItem entry, int index, string accent, string danger) { var name = entry.Title.Length <= MaxNameWidth ? entry.Title : entry.Title[..(MaxNameWidth - 1)] + "…"; var link = $"[link={LinkPrefix}{index.ToString(CultureInfo.InvariantCulture)}]"; - return entry.Fires + return entry.Fires && entry.Danger + ? $"{link}[bold {danger}]{Escape(entry.Key)}[/] [{danger}]{Escape(name)}[/][/]" + : entry.Fires ? $"{link}[bold {accent}]{Escape(entry.Key)}[/] {Escape(name)}[/]" : $"{link}[dim]{Escape(entry.Key)} {Escape(name)}[/][/]"; } diff --git a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs index 6a9c1b9b..267ba647 100644 --- a/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs +++ b/src/SharpMUTerm.Tui/Pointer/PointerTarget.cs @@ -292,7 +292,9 @@ internal sealed record PanelOverlay( Action? PopOut = null, Action? SelectRoom = null, Action? EditMap = null, - Action? LookMap = null); + Action? LookMap = null, + SharpMUTerm.Client.Panels.CollapsedPanelModel? Collapsed = null, + Action? Expand = null); /// A panel's colours as #rrggbb: a bar or fill, the warning, and the empty part of a bar. internal sealed record PanelInk(string Bar, string Low, string Track); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs index 0bb1fa64..2c42b431 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Desktop.cs @@ -211,7 +211,11 @@ private void PublishPanels() var over = Host.Chrome.PaneGutter ? new Core.Workspaces.PaneRect(rect.X - PaneGutterColumns, rect.Y, rect.Width + (2 * PaneGutterColumns), rect.Height) : rect; - if (_workspace.Layout.FindPane(paneId) is { ActiveTab: { } windowId } && OverlayFor(windowId, over, docked: true) is { } overlay) + if (CollapsedBarOverlay(paneId, over) is { } bar) + { + overlays.Add(bar); + } + else if (_workspace.Layout.FindPane(paneId) is { ActiveTab: { } windowId } && OverlayFor(windowId, over, docked: true) is { } overlay) { overlays.Add(overlay); } @@ -272,7 +276,7 @@ private void PublishPanels() if (panelId == PanelIds.QuickBar) { return new PanelOverlay( - panelId, windowId, rect, PanelListInk(), null, QuickBar: QuickBarEntries(key), Pick: PickerFor(windowId, key), + panelId, windowId, rect, PanelListInk() with { Low = DangerInk() }, null, QuickBar: QuickBarEntries(key), Pick: PickerFor(windowId, key), Dispatch: _panelDispatch ??= id => OnUiThread(() => DispatchCommand(id)), PopOut: popOut); } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.CollapsedBars.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.CollapsedBars.cs new file mode 100644 index 00000000..f3b7c8e9 --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.CollapsedBars.cs @@ -0,0 +1,233 @@ +using SharpConsoleUI; +using SharpConsoleUI.Builders; +using SharpConsoleUI.Controls; +using SharpConsoleUI.Layout; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Client.Surfaces; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui.Panels; + +namespace SharpMUTerm.Tui; + +/// +/// A collapsed panel drawn as a bar at the foot of its column (, the window): the layout's +/// realiser gives such a panel a pane of its own (), and while it is not +/// expanded that pane is rows of one , drawn by +/// in cells and by the window's native bar over them. A click on either is +/// : the pane shares its column like any other from then on, for the run, until a layout is +/// applied again. Activating a window the bar holds expands it too, so ⌥N never lands in a bar. A window in a bar is +/// marked scrolled back, so its lines are counted as unread, which is what the bar's 2 new reads. +/// +internal sealed partial class SharpMUTermApp +{ + /// + /// The rows a collapsed panel's bar takes: two, the mockups' ~40 px footer — or one where the host draws the command + /// line's field (), whose grid is shorter than its view by the field's padding and whose + /// bar at the foot of a column runs down over that too. + /// + internal int CollapsedBarRows => Host.Chrome.Input ? 1 : 2; + + /// Collapsed panes the player has expanded this run, by pane id. + private readonly HashSet _expandedBars = new(StringComparer.Ordinal); + + /// Each collapsed bar's control, by pane id, with what it last drew. + private readonly Dictionary _collapsedBarViews = + new(StringComparer.Ordinal); + + /// The expand callback per pane, one instance each so a published overlay compares equal frame to frame. + private readonly Dictionary _barExpanders = new(StringComparer.Ordinal); + + /// Whether is drawn as a collapsed panel's bar now. + private bool IsCollapsedBar(PaneNode? pane) => + pane is not null + && Host.Chrome.Strips + && LayoutRealiser.CollapsedPanelOf(pane.Id) is not null + && !_expandedBars.Contains(pane.Id) + && pane.Tabs.Count > 0 + && _workspace.Layout.ZoomedPaneId is null; + + /// The panes as the tree holds them. Internal for tests. + internal IReadOnlyList PaneNodes => _workspace.Layout.Root.Panes().ToList(); + + /// Whether a pane id is a collapsed bar now. Internal for tests. + internal bool IsCollapsedBarPane(string paneId) => IsCollapsedBar(_workspace.Layout.FindPane(paneId)); + + /// The model the bar in last drew, for the tests and the parity harness. + internal CollapsedPanelModel? CollapsedBarModel(string paneId) => DrawnModel(SurfaceCatalog.CollapsedPanel, paneId) as CollapsedPanelModel; + + /// A click on a link in the bar's cells, as the framework raises it. The test seam. + internal void SimulateCollapsedBarClick(string paneId, string url) + { + if (_collapsedBarViews.TryGetValue(paneId, out var view) && url == CollapsedBarRenderer.ExpandLink) + { + ExpandCollapsedBar(paneId); + } + } + + /// + /// After : every collapsed bar is rows with no tab + /// strip, and the windows in it count their lines as unread. + /// + private void ApplyCollapsedBars() + { + foreach (var pane in _workspace.Layout.Root.Panes()) + { + if (!IsCollapsedBar(pane)) + { + continue; + } + + pane.FixedRows = CollapsedBarRows; + pane.MinRows = null; + pane.DrawsHeader = false; + foreach (var windowId in pane.Tabs) + { + _workspace.SetScrolledBack(windowId, true); + } + } + } + + /// What the bar in says: its first window's title, the unread across its windows, why. + private CollapsedPanelModel CollapsedModelFor(PaneNode pane) + { + var windows = pane.Tabs.Select(_workspace.FindWindow).OfType().ToList(); + var title = windows.FirstOrDefault()?.Title ?? LayoutRealiser.CollapsedPanelOf(pane.Id) ?? string.Empty; + var layout = _liveLayout is { } live ? Layouts.Find(live.LayoutId)?.Name : null; + return new CollapsedPanelModel(Snippet(title), windows.Sum(w => w.Unread), CollapsedPanelModel.NoteFor(layout)); + } + + /// + /// The bar's cells: a tab control holding one tab (so the pane rectangle, the rail and every pane walk see a pane like + /// any other), its header hidden, its page the bar's row. The windows the pane holds keep their tabs in the model and + /// are drawn when it is expanded. + /// + private IWindowControl BuildCollapsedBar(PaneNode pane) + { + var paneId = pane.Id; + if (!_collapsedBarViews.TryGetValue(paneId, out var view)) + { + var control = new MarkupControl(new List()) + { + HorizontalAlignment = HorizontalAlignment.Stretch, + VerticalAlignment = VerticalAlignment.Fill, + }; + control.LinkClicked += (_, e) => + { + if (e.Url == CollapsedBarRenderer.ExpandLink) + { + ExpandCollapsedBar(paneId); + } + }; + view = (control, null, -1); + } + + _collapsedBarViews[paneId] = view with { Model = null, Width = -1 }; + var tabs = Controls.TabControl().AddTab(string.Empty, view.Control).Fill().WithAlignment(HorizontalAlignment.Stretch).Build(); + if (Host.Chrome.PaneGutter) + { + tabs.Margin = new Margin(PaneGutterColumns, 0, PaneGutterColumns, 0); + } + + tabs.TabPages[0].Tag = pane.ActiveTab; + tabs.TabPages[0].IsClosable = false; + tabs.ShowTabHeader = false; + lock (_paneTabsLock) + { + _paneTabs[paneId] = tabs; + } + + RefreshCollapsedBar(paneId); + return tabs; + } + + /// Redraws one bar when what it says or its width moved. + private void RefreshCollapsedBar(string paneId) + { + if (!_collapsedBarViews.TryGetValue(paneId, out var view) || _workspace.Layout.FindPane(paneId) is not { } pane || !IsCollapsedBar(pane)) + { + return; + } + + var width = PaneOutputRects().TryGetValue(paneId, out var rect) && rect.Width > 0 ? rect.Width : 40; + var model = Drawing(SurfaceCatalog.CollapsedPanel, paneId, CollapsedModelFor(pane)); + if (model == view.Model && width == view.Width) + { + return; + } + + view.Control.SetContent([CollapsedBarRenderer.Render(model, width, _ink.Accent)]); + _collapsedBarViews[paneId] = (view.Control, model, width); + } + + /// Every bar on screen, redrawn as its unread or width moves. Rides PostBufferPaint. + private void SyncCollapsedBars() + { + foreach (var paneId in _collapsedBarViews.Keys.ToList()) + { + if (_workspace.Layout.FindPane(paneId) is null) + { + _collapsedBarViews.Remove(paneId); + continue; + } + + RefreshCollapsedBar(paneId); + } + } + + /// What the host is told about the bar in , or null when it is no bar. + private PanelOverlay? CollapsedBarOverlay(string paneId, PaneRect rect) + { + if (_workspace.Layout.FindPane(paneId) is not { } pane || !IsCollapsedBar(pane) || pane.ActiveTab is not { } windowId) + { + return null; + } + + var expand = _barExpanders.TryGetValue(paneId, out var known) + ? known + : _barExpanders[paneId] = () => OnUiThread(() => ExpandCollapsedBar(paneId)); + var model = DrawnModel(SurfaceCatalog.CollapsedPanel, paneId) as CollapsedPanelModel ?? CollapsedModelFor(pane); + return new PanelOverlay( + LayoutRealiser.CollapsedPanelOf(paneId)!, windowId, rect, PanelListInk(), null, Collapsed: model, Expand: expand); + } + + /// + /// Expands the collapsed panel in : the pane shares its column from now on and its window comes + /// forward. What the cell row's link and the native bar's click both end in. + /// + internal void ExpandCollapsedBar(string paneId) + { + if (_workspace.Layout.FindPane(paneId) is not { } pane || !IsCollapsedBar(pane)) + { + return; + } + + _expandedBars.Add(paneId); + _collapsedBarViews.Remove(paneId); + RebuildPaneArea(); + if (pane.ActiveTab is { } windowId) + { + Activate(windowId); + _workspace.SetScrolledBack(windowId, false); + RefreshTabTitles(); + } + } + + /// Expands the bar holding , if one does: a window brought forward is never left in a bar. + private void ExpandBarHolding(string windowId) + { + if (!Host.Chrome.Strips || _workspace.Layout.FindWindow(windowId) is not { } pane || !IsCollapsedBar(pane)) + { + return; + } + + _expandedBars.Add(pane.Id); + _collapsedBarViews.Remove(pane.Id); + foreach (var id in pane.Tabs) + { + _workspace.SetScrolledBack(id, false); + } + + RebuildPaneArea(); + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs index 9fc048e9..8c39acfd 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Layouts.cs @@ -281,11 +281,17 @@ internal bool ApplyLayout(string key, LayoutDefinition layout, string? focusWind .SelectMany(p => p.Tabs.Select(t => (t, (string?)p.Id))) .Where(k => !FloatsHere(k.t)) .ToList(); - if (LayoutRealiser.Realise(layout, fold, panel => DockedWindows(key, panel), output, keep) is not { } realised) + if (LayoutRealiser.Realise(layout, fold, panel => DockedWindows(key, panel), output, keep, collapsedAsBars: Host.Chrome.Strips) + is not { } realised) { return false; } + if (adoptFloating) + { + _expandedBars.Clear(); // an explicit apply folds the collapsed panels away again + } + _workspace.Layout.ReplaceTree(realised.Root, realised.FocusedPaneId); _liveLayout = new LiveLayout( key, layout.Id, realised.Shape, LayoutRealiser.TreeShape(_workspace.Layout.Root), realised.PanelPanes); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index a98d6f97..e4cd53dd 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -235,6 +235,12 @@ private VitalsStripRenderer.Ink VitalsInk() => /// The low cue's ink on (), as markup. private string LowInk(Rgb plane) => WorkspacePalette.Low(_theme, ParseHex(_ink.Notice), plane).ToHex(); + /// + /// The ink a dangerous binding () is drawn in: the settings screens' warning red, held to the + /// floor on the panes' reading plane. + /// + private string DangerInk() => Contrast.Legible(ParseHex(ScreenPalette.Warn), _ink.Plane).ToHex(); + // --- Quick bar -------------------------------------------------------------------------------------------- private IWindowControl NewQuickBarPanel(TerminalPanelContext context) @@ -244,7 +250,7 @@ private IWindowControl NewQuickBarPanel(TerminalPanelContext context) { var model = Drawing(PanelIds.QuickBar, context.WindowId, QuickBarEntries(context.SessionKey)); drawn = model.Items; - return [QuickBarRenderer.Render(model, width, _ink.Accent)]; + return [QuickBarRenderer.Render(model, width, _ink.Accent, DangerInk())]; }); view.Click = url => { @@ -765,6 +771,7 @@ private void LoadDemoBindings() new Macro { Name = "bash", Key = "F12", Command = "bash" }, new Macro { Name = "cure light", Key = "Ctrl+F3", Command = "cast 'cure light'" }, new Macro { Name = "quaff mana", Key = "Ctrl+F4", Command = "quaff mana" }, + new Macro { Name = "flee", Key = "Ctrl+F12", Command = "flee", Danger = true }, }, }); FindCharacter(DemoScene.ActiveSessionKey)?.Character.TriggerSets.Add("Quick"); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 4d55da29..b9ac9c57 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -1061,6 +1061,7 @@ public SharpMUTermApp( PublishStatus(); SyncMapSizes(); SyncPanelSizes(); + SyncCollapsedBars(); SyncScrollSplitBars(); SyncChromeBarWidths(); SyncStatusMode(); @@ -10973,7 +10974,10 @@ private IWindowControl BuildWorkspaceRow() // floor. Derived here on every rebuild rather than stored, so a pane handed an ordinary window stops being a // strip at once. // A vitals pane in a side column is a card, its height from the character's meters. - Core.Layouts.PanelSizing.ApplyAll(_workspace.Layout.Root, PanelIdOfWindow, TabStripRows, VitalsMetersOfWindow); + Core.Layouts.PanelSizing.ApplyAll( + _workspace.Layout.Root, PanelIdOfWindow, TabStripRows, VitalsMetersOfWindow, + Host.Chrome.Strips ? Core.Layouts.PanelSizing.QuickBarStripRows : 1); + ApplyCollapsedBars(); // When a pane is zoomed, render just that pane full-area; otherwise render the whole tree. var zoomed = _workspace.Layout.ZoomedPaneId is { } zid ? _workspace.Layout.FindPane(zid) : null; @@ -11750,6 +11754,11 @@ private void PaintTabChips(TabControl tabs, Rgb surface) /// Builds a leaf pane's tab strip from its window ids, tracking it under its pane id. private IWindowControl BuildPaneTabs(PaneNode pane) { + if (IsCollapsedBar(pane)) + { + return BuildCollapsedBar(pane); + } + var builder = Controls.TabControl(); var ids = new List(); @@ -13338,7 +13347,8 @@ internal IReadOnlyDictionary PaneOutputRects() foreach (var (paneId, tabs, rect) in RealisedPanes()) { var margin = tabs.Margin; - var top = margin.Top + tabs.TabHeaderHeight + PaneGutterRowsFor(_workspace.Layout.FindPane(paneId)?.ActiveTab); + var pane = _workspace.Layout.FindPane(paneId); + var top = margin.Top + tabs.TabHeaderHeight + (IsCollapsedBar(pane) ? 0 : PaneGutterRowsFor(pane?.ActiveTab)); rects[paneId] = new PaneRect( rect.X + margin.Left, rect.Y + top, @@ -13630,6 +13640,8 @@ private bool Activate(string id) return false; } + ExpandBarHolding(id); // a window brought forward is never left in a collapsed panel's bar + // Selecting the tab below raises the framework's own TabChanged, which lands back in // OnTabChanged and so back here. The model call above is idempotent, so re-entering is harmless // — but doing the rest twice would recall the drafts twice and say anything it has to say twice. diff --git a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs index 60e84a37..a9fad513 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SurfaceParityTests.cs @@ -339,6 +339,17 @@ await Assert.That(Rows(palette.Session!.View(query))).IsEquivalentTo(Rows(drawn! covered.Add(SurfaceCatalog.FloatingPanel); } + // A collapsed panel's bar: the native bar is handed the model the cell bar drew in the same frame. + { + using var driver = new AvaloniaConsoleDriver(140, 36); + await using var app = App(driver, DemoScene.Build()); + app.RenderSnapshot("layout-combat"); + var bar = driver.Pointer.Panels.Single(p => p.Collapsed is not null); + var barPane = app.PaneNodes.Single(p => LayoutRealiser.CollapsedPanelOf(p.Id) == bar.PanelId).Id; + await Assert.That(app.DrawnModel(SurfaceCatalog.CollapsedPanel, barPane)).IsEqualTo((object)bar.Collapsed!).Because("collapsed-panel"); + covered.Add(SurfaceCatalog.CollapsedPanel); + } + // The tab overflow chip: the menu the window opens is the list the cells recorded for that strip in the same frame. { using var driver = new AvaloniaConsoleDriver(56, 20); @@ -592,6 +603,12 @@ await Same("quick-bar: edit", "layout-combat", (app, d) => app.SimulatePanelClick(Panel(d, PanelIds.QuickBar).WindowId, QuickBarRenderer.EditLink)); probed.Add(PanelIds.QuickBar); + // A collapsed panel's bar: the native bar's click, and the cell bar's link. + await Same("collapsed-panel: expand", "layout-combat", + (app, d) => d.Pointer.Panels.Single(p => p.Collapsed is not null).Expand!(), + (app, d) => app.SimulateCollapsedBarClick(app.PaneNodes.Single(p => LayoutRealiser.CollapsedPanelOf(p.Id) is not null).Id, CollapsedBarRenderer.ExpandLink)); + probed.Add(SurfaceCatalog.CollapsedPanel); + // Layouts: choosing Roleplay in the menu, and running the ⌥M list's command for it. await Same("layouts-menu: apply", "layout-combat", (app, d) => diff --git a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs index 2194f26c..48497127 100644 --- a/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs +++ b/tests/SharpMUTerm.Client.Tests/SurfaceCatalogTests.cs @@ -73,7 +73,8 @@ public async Task PanelSurfacesAreKnownPanels() var panels = SurfaceCatalog.All.Where(s => s.Id is not (SurfaceCatalog.Header or SurfaceCatalog.Sidebar or SurfaceCatalog.Settings or SurfaceCatalog.LayoutsMenu or SurfaceCatalog.Palette or SurfaceCatalog.Prefix or SurfaceCatalog.RailStrip or SurfaceCatalog.Notice or SurfaceCatalog.Compose - or SurfaceCatalog.FloatingPanel or SurfaceCatalog.TabOverflow or SurfaceCatalog.Status or SurfaceCatalog.TabStrip or SurfaceCatalog.ScrollBand) + or SurfaceCatalog.FloatingPanel or SurfaceCatalog.TabOverflow or SurfaceCatalog.Status or SurfaceCatalog.TabStrip or SurfaceCatalog.ScrollBand + or SurfaceCatalog.CollapsedPanel) && !SurfaceCatalog.Modals.Contains(s.Id)); foreach (var surface in panels) { diff --git a/tests/SharpMUTerm.Tui.Tests/CombatStripTests.cs b/tests/SharpMUTerm.Tui.Tests/CombatStripTests.cs new file mode 100644 index 00000000..d28e2eeb --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/CombatStripTests.cs @@ -0,0 +1,101 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui.Panels; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A host that draws strips (, the window) gives the Combat layout's quick bar the rows its +/// buttons need and draws a collapsed panel as a bar of its own at the foot of its column, which a click expands. The +/// terminal keeps the one-row bar and the background tab. Rows only: the pane rectangles are what is arranged. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class CombatStripTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(HostChrome chrome, out string frame) + { + Console.SetIn(TextReader.Null); + var host = ClientHost.Headless(new HeadlessConsoleDriver(140, 40), Caps) with { Chrome = chrome }; + var app = new SharpMUTermApp(DemoScene.Build(), host); + frame = app.RenderSnapshot("layout-combat"); + app.RenderNextFrame(); + return app; + } + + private static string? PaneHolding(SharpMUTermApp app, string panelId) => + app.PaneNodes.FirstOrDefault(p => p.Tabs.Any(t => t.StartsWith("panel:" + panelId + ":", StringComparison.Ordinal)))?.Id; + + [Test] + public async Task TheWindowsQuickBarIsAStripTallEnoughForButtonsAndTheTerminalsIsOneRow() + { + await using var window = App(HostChrome.Desktop, out _); + await using var terminal = App(HostChrome.None, out _); + var windowBar = PaneHolding(window, PanelIds.QuickBar)!; + var terminalBar = PaneHolding(terminal, PanelIds.QuickBar)!; + + await Assert.That(window.PaneOutputRects()[windowBar].Height).IsEqualTo(PanelSizing.QuickBarStripRows); + await Assert.That(terminal.PaneOutputRects()[terminalBar].Height).IsEqualTo(1); + } + + [Test] + public async Task ACollapsedPanelIsABarAtTheFootOfItsColumnInTheWindowAndATabInTheTerminal() + { + await using var window = App(HostChrome.Desktop, out _); + await using var terminal = App(HostChrome.None, out _); + + var bar = window.PaneNodes.Single(p => LayoutRealiser.CollapsedPanelOf(p.Id) == PanelIds.Chat); + await Assert.That(window.IsCollapsedBarPane(bar.Id)).IsTrue(); + await Assert.That(window.PaneOutputRects()[bar.Id].Height).IsEqualTo(window.CollapsedBarRows); + + // Its column runs down to the status row: nothing under the bar. + var map = window.PaneNodes.Single(p => p.Tabs.Any(t => t.StartsWith("map:", StringComparison.Ordinal))); + var rects = window.PaneOutputRects(); + await Assert.That(rects[bar.Id].Y).IsGreaterThan(rects[map.Id].Y); + await Assert.That(rects[bar.Id].X).IsEqualTo(rects[map.Id].X); + var bottom = 40; + await Assert.That(rects[bar.Id].Y + rects[bar.Id].Height).IsEqualTo(bottom).Because(string.Join("; ", rects.Select(r => $"{r.Key}={r.Value}"))); + + var model = window.CollapsedBarModel(bar.Id); + await Assert.That(model).IsNotNull(); + await Assert.That(model!.Title).IsEqualTo("Chat"); + await Assert.That(model.Note).IsEqualTo("collapsed in combat"); + + // The terminal: no such pane, the chat window a background tab of the map's pane as before. + await Assert.That(terminal.PaneNodes.Any(p => LayoutRealiser.CollapsedPanelOf(p.Id) is not null)).IsFalse(); + } + + [Test] + public async Task TheBarsLinkExpandsItIntoAPaneThatSharesItsColumn() + { + await using var window = App(HostChrome.Desktop, out _); + var bar = window.PaneNodes.Single(p => LayoutRealiser.CollapsedPanelOf(p.Id) is not null); + var markup = window.CollapsedBarModel(bar.Id)!; + await Assert.That(CollapsedBarRenderer.Render(markup, 40, "#00f5b7")).Contains(CollapsedBarRenderer.ExpandLink); + + window.ExpandCollapsedBar(bar.Id); + window.RenderNextFrame(); + + await Assert.That(window.IsCollapsedBarPane(bar.Id)).IsFalse(); + await Assert.That(window.PaneOutputRects()[bar.Id].Height).IsGreaterThan(window.CollapsedBarRows); + await Assert.That(window.FocusedPaneId).IsEqualTo(bar.Id); + } + + [Test] + public async Task ADangerBindingIsDrawnInTheWarningInkAndOthersInTheAccent() + { + var model = new QuickBarModel([ + new QuickBarItem("F1", "F1", "kick", true), + new QuickBarItem("⌃F12", "Ctrl+F12", "flee", true, Danger: true), + ]); + var row = QuickBarRenderer.Render(model, 80, "#00f5b7", "#ff6b6b"); + await Assert.That(row).Contains("[bold #00f5b7]F1[/] kick"); + await Assert.That(row).Contains("[bold #ff6b6b]⌃F12[/] [#ff6b6b]flee[/]"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs b/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs index 6f0ed8c7..d092011c 100644 --- a/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/MacroKeyCaptureTests.cs @@ -202,7 +202,7 @@ public async Task TheNumpadGridSaysThatNothingReachesIt() /// The key is the row's third field, appended after the name and the command so the two ordinals /// that were already addressed by the renderer, the tests and the snapshot scripts still mean what /// they meant. Opening it arms a capture rather than a buffer. The owning set was appended after it - /// on the same rule, so the key is still the third and the row is now four. + /// on the same rule, so the key is still the third; the quick bar's style came last, and the row is now five. /// [Test] public async Task TheBindingRowCarriesItsKeyAsACaptureField() @@ -211,7 +211,7 @@ public async Task TheBindingRowCarriesItsKeyAsACaptureField() var model = KeypadScreenRenderer.Model(HostKeys.Terminal, sets.SelectMany(s => s.Macros).ToList(), sets, 0); var row = model.RowAt(0, 0); - await Assert.That(row.FieldCount).IsEqualTo(4); + await Assert.That(row.FieldCount).IsEqualTo(5); await Assert.That(row.FieldAt(KeypadScreenRenderer.SetField)!.Value.Get()).IsEqualTo(sets[0].Name); await Assert.That(row.FieldAt(KeypadScreenRenderer.NameField)!.Value.Get()).IsEqualTo("Look"); await Assert.That(row.FieldAt(KeypadScreenRenderer.CommandField)!.Value.Get()).IsEqualTo("look"); From 281b82a5ea46c63930f06f8fb4a7478c8eff51a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 20:51:02 +0000 Subject: [PATCH 081/113] Wave 23 A: the window's map column uses its space The native map draws rooms at the mockup's 32 px wherever the step leaves a line between them (fit up to a 90 px step), and lays out room names: whole, wider than the room, at the first place covering no room and no other name (under, over or beside with exits clear, else across a line, else pulled aside), elided only where nothing fits. Where the host draws tab strips, a pane holding only the map window draws none (its heading names it); where it draws strips, the vitals card is as tall as its gauges (2 a meter + 4, +2 while a target is named) and re-lays when that changes. The terminal keeps its rules; NAWS follows the real rectangles. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 4 + CLAUDE.md | 16 +- src/SharpMUTerm.Avalonia/MapCanvas.cs | 224 +++++++++++++++++- src/SharpMUTerm.Core/Layouts/PanelSizing.cs | 18 +- .../SharpMUTermApp.MapColumn.cs | 84 +++++++ src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 12 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 4 +- .../MapNamesTests.cs | 90 +++++++ .../Workspace/PaneExtentTests.cs | 12 + tests/SharpMUTerm.Tui.Tests/MapColumnTests.cs | 80 +++++++ 10 files changed, 526 insertions(+), 18 deletions(-) create mode 100644 src/SharpMUTerm.Tui/SharpMUTermApp.MapColumn.cs create mode 100644 tests/SharpMUTerm.Avalonia.Tests/MapNamesTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/MapColumnTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index bb4c5fc6..10efde1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- In the desktop window, Combat's map uses its pane: rooms are drawn at full size, every room's name is written out in + full where it fits without covering another room or name (shortened only where it truly cannot fit), the map pane no + longer repeats a lone "Map" tab above its own heading, and the vitals card is only as tall as its gauges, so the map + gets the rows that used to stay empty under Movement. - In the desktop window, the map is drawn the way the mockups draw it: dark rooms outlined in a rule, exits as thin lines, your room ringed in the accent with an `@`, Up/Down/Areas as proper buttons, and the legend in a strip at the foot with "Click a room to walk there" under it, so it never covers a room. diff --git a/CLAUDE.md b/CLAUDE.md index f41fb5a5..56310b48 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -165,10 +165,14 @@ fallbacks) for inline images/maps. carries `Up`/`Down` (an up/down exit or stub, or an exit to a room on another level) and `Elsewhere` (the other area an exit leads to). The cells draw a one-line legend on the last row from 6 rows up — words go first, then names shorten, then areas are counted (`+2`); it never wraps. The window opens fitted (`MapCanvas.Fit`: the - rooms within 6 steps of the character's, up to zoom 2.4) and refits on a new model until the player zooms or pans - (`Fitted`; a double-click or another level or area fits again); it names rooms whenever a step is 40 px or more + rooms within 6 steps of the character's, up to a 90 px step, the mockup's) and refits on a new model until the player zooms or pans + (`Fitted`; a double-click or another level or area fits again); rooms are the mockup's 32 px (`RoomTarget`) wherever the + step leaves a line between boxes (`RoomSize`: at most 0.56 of a step). It names rooms whenever a step is 40 px or more (`NamesFromStep`), the current room always, plus the hovered name on a plate, stairs triangles, a halo on the - current room and a legend plate. + current room and a legend plate. **Names are laid out, not centred blindly** (`Labels`/`LayOutNames`, cached per view): + the character's room first, then nearest first, each whole (up to `NameMaxWidth`) at the first place covering no room, + no placed name and staying between the look buttons and the legend — under, over or beside with every exit clear, else + straight under/over across a line, else pulled aside — and elided only where none fits (under `NameMinWidth`: hover only). - **A speedwalk sends one step and waits for the map to say it arrived** (`Speedwalk`); it goes through `SendCommandAsync`, so the recorder sees the step. It stops off the path, on the world's `WalkFailurePattern`, after `StepTimeout` with no room, and on disconnect. @@ -1456,6 +1460,12 @@ fallbacks) for inline images/maps. (no tab strip, above), the cells draw name and numbers over a full-width bar (`VitalsStripRenderer.RenderCard`, chosen by box height ≥ 3), and at 20 px rows the window's gauges stack in it, headed. Decided from the tree on every rebuild, so a player's own layout gets it too; the terminal mockup's top strip is the narrow arrangement, not the wide one. + **Where the host draws strips (`HostChrome.Strips`, the window) the card is as tall as its gauges** + (`VitalsGaugeCardRows` = 2 a meter + 4, + 2 only while a target is named; `SharpMUTermApp.MapColumn.cs`), so the map + gets the rows; a target arriving or a meter appearing re-lays the pane area (`ResizeVitalsCard`, on the panel's game + data change, only when the rows differ). The column is beside the output, so no NAWS moves. The terminal keeps the + reserved card. **There too a pane holding the map window alone draws no tab strip** (`ApplyLoneMapPanes`, under + `HostChrome.Tabs`): the native map's heading names it. The terminal keeps its strip (the cell map's drag handle and ×). - **The status row leaves its meters out while the vitals strip shows them** (`VitalsStripShowing`: the status row's character's vitals window is the front tab of a drawn pane, zoom included). `SyncStatusMeters` repaints the row only when that flips (on a rebuild or an activation), so a notice is not displaced for nothing. The diff --git a/src/SharpMUTerm.Avalonia/MapCanvas.cs b/src/SharpMUTerm.Avalonia/MapCanvas.cs index 8cdc1167..840190a0 100644 --- a/src/SharpMUTerm.Avalonia/MapCanvas.cs +++ b/src/SharpMUTerm.Avalonia/MapCanvas.cs @@ -42,7 +42,7 @@ internal sealed class MapCanvas : Control private const double MinZoom = 0.35, MaxZoom = 3, DragThreshold = 4; /// The most the fit zooms in: past it a small area's rooms are boxes the size of buttons. - internal const double FitMaxZoom = 2.4; + internal const double FitMaxZoom = 90 / Spacing; /// How many grid steps from the character's room the fit takes in; a larger area is fitted around them. internal const int FitRadius = 6; @@ -183,11 +183,22 @@ private Point Middle } } + /// The side the mockup draws a room at (32 px, its rooms 90 px apart). + internal const double RoomTarget = 32; + /// - /// A room's side: about half the step between rooms (the mockup draws 32 px rooms 90 px apart; names under them need the room), so the exits read - /// as lines between boxes rather than boxes touching. + /// A room's side: the mockup's wherever the step leaves an exit between boxes (a little over half the + /// step at most), growing past it only once the player zooms in far, so the exits read as lines between boxes rather than + /// boxes touching. Internal for tests. /// - private double RoomSize => Math.Max(5, Spacing * Zoom * 0.48); + internal double RoomSize + { + get + { + var step = Spacing * Zoom; + return Math.Max(5, Math.Min(step * 0.56, Math.Max(step * 0.35, RoomTarget))); + } + } /// /// Fits the area to the canvas: the rooms within steps of the character's, centred in the open @@ -227,11 +238,13 @@ private void Fit() // them (the legend and the hint), so neither ever covers a room of the fitted view. var top = TopReserve(); var bottom = BottomReserve(Bounds.Size); - var across = Math.Max(1, open - 24) / ((maxX - minX + 1.6) * Spacing); - var down = Math.Max(1, Bounds.Height - top - bottom) / ((maxY - minY + 1.6) * Spacing); + // Down, the span of rows plus a room (up to 0.56 of a step) and a name under the lowest; across, the span plus a + // room and room for the outer names (labels.Fit keeps any name that would leave the canvas inside it). + var across = Math.Max(1, open - 24) / ((maxX - minX + 1.3) * Spacing); + var down = Math.Max(1, Bounds.Height - top - bottom - NameRow) / ((maxY - minY + 0.6) * Spacing); _zoom = Math.Clamp(Math.Min(across, down), MinZoom, FitMaxZoom); var step = Spacing * _zoom; - _fit = new Vector(-(minX + maxX) / 2.0 * step, ((top - bottom) / 2) - ((minY + maxY) / 2.0 * step)); + _fit = new Vector(-(minX + maxX) / 2.0 * step, ((top - bottom - NameRow) / 2) - ((minY + maxY) / 2.0 * step)); } /// The player took the view: the fit stops following, and stays where it was. @@ -726,7 +739,6 @@ public override void Render(DrawingContext context) var accent = Parse(_ink.Bar); var path = Parse(_ink.Low); var radius = size * 0.19; - var names = NamesShown; var edge = new Pen(new SolidColorBrush(rule), Math.Clamp(size / 22, 1, 1.5)); foreach (var room in _model.Rooms) { @@ -789,9 +801,15 @@ public override void Render(DrawingContext context) context.DrawRectangle(null, ring, rect.Inflate(size * 0.3), radius * 2, radius * 2); } - if ((names || room.Current) && room.Id != _hovered) + } + + // Names after every room, where the layout found them a place that covers no room and no other name. + foreach (var label in Labels(bounds)) + { + if (label.Room != _hovered) { - DrawName(context, room.Name, c, size, plate: false); + context.DrawRectangle(new SolidColorBrush(_plane), null, label.Rect.Inflate(new Thickness(NativeTokens.Space2, 0)), 2, 2); + context.DrawText(label.Text, label.Rect.TopLeft); } } @@ -893,6 +911,192 @@ private static StreamGeometry Triangle(Point a, Point b, Point c) return geometry; } + // ── Names: wider than the room, placed so that no two collide ────────────────────────────────── + + /// A room's name where the layout put it: the room, the box it takes, the words as drawn (elided only when cut). + internal sealed record PlacedName(long Room, Rect Rect, FormattedText Text, bool Elided); + + /// The height a name row takes under a room, its gap included: what the fit leaves under the lowest row. + private const double NameRow = NativeTokens.Space4 + 15; + + /// The widest a name is drawn before it is elided even with the room for it. + internal const double NameMaxWidth = 168; + + /// The narrowest an elided name is drawn: below it the name is left to the hover. + private const double NameMinWidth = 34; + + private (MapViewModel Model, double Zoom, Vector Offset, Size Size, Color Plane, Color Text)? _labelsFor; + private List _labels = []; + + /// + /// Where each room's name is drawn at the view shown. The character's room is placed first, then the others nearest it + /// first. A name goes where it covers no room and no name already placed, on the canvas: under its room, over it or + /// beside it with every exit line clear; else straight under or over it across a line; else pulled to one side, clear + /// of lines if it can be, else crossing fewest. Only a name that fits nowhere is elided, to the room + /// under or over its room; one that has not even then is left to the hover's plate. Below + /// only the character's room is named. Internal for tests. + /// + internal IReadOnlyList Labels(Rect bounds) + { + Fit(); + var key = (_model, _zoom, _fit + _pan, bounds.Size, _plane, _text); + if (_labelsFor is { } was && ReferenceEquals(was.Model, key._model) && was.Zoom == key._zoom && was.Offset == key.Item3 + && was.Size == key.Size && was.Plane == key._plane && was.Text == key._text) + { + return _labels; + } + + _labelsFor = (key._model, key._zoom, key.Item3, key.Size, key._plane, key._text); + _labels = LayOutNames(bounds); + return _labels; + } + + private List LayOutNames(Rect bounds) + { + var placed = new List(); + if (_model.Rooms.Count == 0) + { + return placed; + } + + var size = RoomSize; + // Between what is drawn above the rooms (the heading and the look buttons) and below them (the legend and the hint). + var top = TopReserve() - NativeTokens.Space4; + var bottom = bounds.Height - BottomReserve(bounds.Size) + NativeTokens.Space8; + var area = new Rect(bounds.X + 2, bounds.Y + top, Math.Max(0, bounds.Width - 4), Math.Max(0, bottom - top)); + var visible = _model.Rooms + .Select(r => (Room: r, Centre: CentreOf(r))) + .Where(r => bounds.Inflate(size).Contains(r.Centre)) + .ToList(); + var boxes = visible.Select(r => new Rect(r.Centre.X - (size / 2) - 2, r.Centre.Y - (size / 2) - 2, size + 4, size + 4)).ToList(); + var byId = visible.ToDictionary(r => r.Room.Id, r => r.Centre); + var lines = _model.Exits + .Where(e => byId.ContainsKey(e.From) && byId.ContainsKey(e.To)) + .Select(e => (byId[e.From], byId[e.To])) + .ToList(); + + var anchor = _model.Current ?? _model.Rooms[0]; + var order = visible + .Where(r => NamesShown || r.Room.Current) + .OrderBy(r => r.Room.Current ? 0 : 1) + .ThenBy(r => Math.Abs(r.Room.X - anchor.X) + Math.Abs(r.Room.Y - anchor.Y)) + .ThenBy(r => r.Room.Y) + .ThenBy(r => r.Room.X); + foreach (var (room, c) in order) + { + var full = PanelText.Format(room.Name, NativeTokens.Small, DimInk, bold: false, NameMaxWidth); + var w = full.Width; + var h = full.Height; + bool Free(Rect r, bool exits) => + area.Contains(r) + && !boxes.Any(b => b.Intersects(r)) + && !placed.Any(p => p.Rect.Inflate(new Thickness(NativeTokens.Space4, NativeTokens.Space2)).Intersects(r)) + && (!exits || !lines.Any(l => Crosses(l.Item1, l.Item2, r))); + + var below = c.Y + (size / 2) + NativeTokens.Space4; + var above = c.Y - (size / 2) - NativeTokens.Space4 - h; + var middle = c.Y - (h / 2); + Rect[] Places(double width) => + [ + new(c.X - (width / 2), below, width, h), + new(c.X - (width / 2), above, width, h), + new(c.X + (size / 2) + 6, middle, width, h), + new(c.X - (size / 2) - 6 - width, middle, width, h), + new(c.X - (size / 2), below, width, h), + new(c.X + (size / 2) - width, below, width, h), + new(c.X - (size / 2), above, width, h), + new(c.X + (size / 2) - width, above, width, h), + + // Clear of a line straight down or up out of the room: just to one side of its middle. + new(c.X + NativeTokens.Space4, below, width, h), + new(c.X - NativeTokens.Space4 - width, below, width, h), + new(c.X + NativeTokens.Space4, above, width, h), + new(c.X - NativeTokens.Space4 - width, above, width, h), + ]; + + var places = Places(w).Select(r => Inside(r, area)).ToArray(); + // Under, over or beside the room with every line clear; else straight under or over it across a line (its plate + // breaks the line, and the name still reads as the room's); only then pulled to one side. + var spot = places.Take(4).Cast().FirstOrDefault(r => Free(r!.Value, exits: true)) + ?? places.Take(2).Cast().FirstOrDefault(r => Free(r!.Value, exits: false)) + ?? places.Skip(4).Cast().FirstOrDefault(r => Free(r!.Value, exits: true)) + ?? places.Where(r => Free(r, exits: false)) + .Select(r => (Rect?)r) + .OrderBy(r => lines.Count(l => Crosses(l.Item1, l.Item2, r!.Value))) + .FirstOrDefault(); + if (spot is { } found) + { + placed.Add(new PlacedName(room.Id, Snap(found), full, Elided: false)); + continue; + } + + // Nowhere whole: the widest elision that fits under or over the room, centred on it. + for (var width = Math.Floor(w) - 6; width >= NameMinWidth; width -= 6) + { + var cut = PanelText.Format(room.Name, NativeTokens.Small, DimInk, bold: false, width); + var fits = new[] { new Rect(c.X - (cut.Width / 2), below, cut.Width, h), new Rect(c.X - (cut.Width / 2), above, cut.Width, h) } + .Select(r => Inside(r, area)) + .Cast() + .FirstOrDefault(r => Free(r!.Value, exits: false)); + if (fits is { } at) + { + placed.Add(new PlacedName(room.Id, Snap(at), cut, Elided: true)); + break; + } + } + } + + return placed; + } + + /// moved the least distance that puts it inside across (rows stay). + private static Rect Inside(Rect r, Rect area) + { + var x = Math.Min(Math.Max(r.X, area.X), Math.Max(area.X, area.Right - r.Width)); + return new Rect(x, r.Y, r.Width, r.Height); + } + + private static Rect Snap(Rect r) => new(Math.Round(r.X), Math.Round(r.Y), r.Width, r.Height); + + /// Whether the segment from to passes through (Liang–Barsky). + internal static bool Crosses(Point a, Point b, Rect r) + { + double t0 = 0, t1 = 1; + var dx = b.X - a.X; + var dy = b.Y - a.Y; + bool Clip(double p, double q) + { + if (Math.Abs(p) < 1e-9) + { + return q >= 0; + } + + var t = q / p; + if (p < 0) + { + if (t > t1) + { + return false; + } + + t0 = Math.Max(t0, t); + } + else + { + if (t < t0) + { + return false; + } + + t1 = Math.Min(t1, t); + } + + return true; + } + + return Clip(-dx, a.X - r.Left) && Clip(dx, r.Right - a.X) && Clip(-dy, a.Y - r.Top) && Clip(dy, r.Bottom - a.Y) && t0 <= t1; + } + /// A room's name centred under it; on a plate of the pane's own colour when . private void DrawName(DrawingContext context, string name, Point centre, double size, bool plate) { diff --git a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs index 4279905b..c9155d6d 100644 --- a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs +++ b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs @@ -29,6 +29,14 @@ public static class PanelSizing /// public static int VitalsCardRows(int meters) => (2 * Math.Max(0, meters)) + 6; + /// + /// The rows a vitals card takes where the host draws it as stacked gauges (HostChrome.Strips, the window): the + /// heading, two twenty-pixel rows a meter, and the target's two only while the game names one, so the card is as tall + /// as what it shows and the map under it has the rest. A target arriving re-lays the side column there, which costs + /// no output cell (the column is beside the output) and so no NAWS. + /// + public static int VitalsGaugeCardRows(int meters, bool target) => (2 * Math.Max(0, meters)) + (target ? 6 : 4); + /// /// The rows a quick bar takes where the host draws it as a strip of buttons (HostChrome.Strips, the window): /// three twenty-pixel rows hold the mockups' 34-pixel buttons with their padding. Everywhere else it is one row. @@ -116,7 +124,13 @@ public static void Apply(PaneNode pane, Func panelOf, int tabSt /// meters the character behind a vitals window has, by window id. /// /// The rows a quick bar takes (see ). - public static void ApplyAll(LayoutNode root, Func panelOf, int tabStripRows, Func vitalsMetersOf, int quickBarRows = 1) + /// + /// The rows a vitals card takes, by window id, where the host says (); null for + /// of . + /// + public static void ApplyAll( + LayoutNode root, Func panelOf, int tabStripRows, Func vitalsMetersOf, int quickBarRows = 1, + Func? cardRowsOf = null) { ArgumentNullException.ThrowIfNull(root); ArgumentNullException.ThrowIfNull(vitalsMetersOf); @@ -126,7 +140,7 @@ public static void ApplyAll(LayoutNode root, Func panelOf, int if (share < CardBelowWidthShare && pane.Tabs.FirstOrDefault(t => string.Equals(panelOf(t), PanelIds.Vitals, StringComparison.Ordinal)) is { } vitals) { - card = VitalsCardRows(vitalsMetersOf(vitals)); + card = cardRowsOf is not null ? cardRowsOf(vitals) : VitalsCardRows(vitalsMetersOf(vitals)); } Apply(pane, panelOf, tabStripRows, card, quickBarRows); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.MapColumn.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.MapColumn.cs new file mode 100644 index 00000000..7ffa644e --- /dev/null +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.MapColumn.cs @@ -0,0 +1,84 @@ +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Tui; + +/// +/// The side column a desktop host draws natively (, ): a vitals +/// card as tall as its gauges, and a map pane with no tab strip, so the map has the rows the window would otherwise leave +/// blank. Rows only; the pane rectangles, and so NAWS, are what is arranged. The terminal keeps the cell rules. +/// +internal sealed partial class SharpMUTermApp +{ + /// The card rows each vitals window was last laid out with, where the host draws gauges; see . + private readonly Dictionary _vitalsCardRows = new(StringComparer.Ordinal); + + /// The rows a pane claims (), as the last rebuild derived them. Internal for tests. + internal int? PaneFixedRows(string paneId) => _workspace.Layout.FindPane(paneId)?.FixedRows; + + /// The card rows a vitals window takes where the host draws gauges: its meters, and the target only while there is one. + private int VitalsGaugeRowsOfWindow(string windowId) + { + var vitals = TerminalPanels.TryParseWindowId(windowId, out _, out var sessionKey) ? ReadVitals(sessionKey) : null; + var meters = vitals is { } shown ? shown.Meters.Count : VitalsMetersOfWindow(windowId); + var rows = PanelSizing.VitalsGaugeCardRows(meters, vitals?.Target is not null); + _vitalsCardRows[windowId] = rows; + return rows; + } + + /// + /// 's card rule for this host: the gauges' height where the host draws strips, else + /// null for the cell card (whose target rows are held whether or not there is one). + /// + private Func? VitalsCardRowsRule() + { + if (!Host.Chrome.Strips) + { + return null; + } + + _vitalsCardRows.Clear(); + return VitalsGaugeRowsOfWindow; + } + + /// + /// Re-lays the pane area when a vitals card's gauges came to need other rows (a meter or the target arriving or going). + /// Only where the host draws gauges, and only for a card sized. + /// + private void ResizeVitalsCard(string windowId) + { + if (!Host.Chrome.Strips || !_vitalsCardRows.TryGetValue(windowId, out var applied)) + { + return; + } + + var vitals = TerminalPanels.TryParseWindowId(windowId, out _, out var sessionKey) ? ReadVitals(sessionKey) : null; + var meters = vitals is { } shown ? shown.Meters.Count : VitalsMetersOfWindow(windowId); + if (PanelSizing.VitalsGaugeCardRows(meters, vitals?.Target is not null) != applied) + { + RebuildPaneArea(); + } + } + + /// + /// After : where the host draws the tab strips, a pane holding the map window and + /// nothing else draws none, as a lone panel does — the map's own heading names it (Map, the area and the level), and the + /// two rows go to the rooms. The terminal keeps its strip: there it is the cell map's drag handle and its ×. + /// + private void ApplyLoneMapPanes() + { + if (!Host.Chrome.Tabs) + { + return; + } + + foreach (var pane in _workspace.Layout.Root.Panes()) + { + if (pane.Tabs.Count == 1 && IsMapWindow(pane.Tabs[0]) && pane.FixedRows is null) + { + pane.DrawsHeader = false; + pane.MinRows = null; + } + } + } +} diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index e4cd53dd..1e4e3253 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -192,8 +192,16 @@ private IWindowControl NewVitalsPanel(TerminalPanelContext context) if (context.Session is { } session) { - session.GameData.Changed += (_, _) => OnUiThread(view.Refresh); - session.MxpMetersChanged += (_, _) => OnUiThread(view.Refresh); + session.GameData.Changed += (_, _) => OnUiThread(() => + { + view.Refresh(); + ResizeVitalsCard(context.WindowId); + }); + session.MxpMetersChanged += (_, _) => OnUiThread(() => + { + view.Refresh(); + ResizeVitalsCard(context.WindowId); + }); } return view.Control; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index b9ac9c57..fbc4c600 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -10976,8 +10976,10 @@ private IWindowControl BuildWorkspaceRow() // A vitals pane in a side column is a card, its height from the character's meters. Core.Layouts.PanelSizing.ApplyAll( _workspace.Layout.Root, PanelIdOfWindow, TabStripRows, VitalsMetersOfWindow, - Host.Chrome.Strips ? Core.Layouts.PanelSizing.QuickBarStripRows : 1); + Host.Chrome.Strips ? Core.Layouts.PanelSizing.QuickBarStripRows : 1, + VitalsCardRowsRule()); ApplyCollapsedBars(); + ApplyLoneMapPanes(); // When a pane is zoomed, render just that pane full-area; otherwise render the whole tree. var zoomed = _workspace.Layout.ZoomedPaneId is { } zid ? _workspace.Layout.FindPane(zid) : null; diff --git a/tests/SharpMUTerm.Avalonia.Tests/MapNamesTests.cs b/tests/SharpMUTerm.Avalonia.Tests/MapNamesTests.cs new file mode 100644 index 00000000..093a83f7 --- /dev/null +++ b/tests/SharpMUTerm.Avalonia.Tests/MapNamesTests.cs @@ -0,0 +1,90 @@ +using Avalonia; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Avalonia.Tests; + +/// +/// The native map uses its pane: rooms toward the mockup's 32 px, names wider than their rooms placed where they cover no +/// room and no other name, and elided only where they would. +/// +public class MapNamesTests +{ + private static MapViewModel Plaza() => new( + "Town", + 0, + [ + new MapViewRoom(1, "The Grand Plaza", 0, 0, Current: true, Ahead: false, Locked: false), + new MapViewRoom(2, "Temple of the Tide", 0, -1, Current: false, Ahead: false, Locked: false), + new MapViewRoom(3, "Market Row", 1, 0, Current: false, Ahead: false, Locked: false), + new MapViewRoom(4, "Guildhall", -1, 0, Current: false, Ahead: false, Locked: false), + new MapViewRoom(5, "Lantern Street", 0, 1, Current: false, Ahead: false, Locked: false), + new MapViewRoom(6, "Spice Stall", 2, 0, Current: false, Ahead: false, Locked: false), + ], + [new MapViewExit(1, 2), new MapViewExit(1, 3), new MapViewExit(1, 4), new MapViewExit(1, 5), new MapViewExit(3, 6)], + null) + { + AnchorId = 1, + }; + + private static Task<(double Room, IReadOnlyList Names, List Rooms)> Fit(MapViewModel model, int columns, int rows) => + DesktopLayerTests.Run((window, view, layer, driver) => + { + ((IPointerPresenter)driver.Pointer).Panels( + [new PanelOverlay(PanelIds.Map, "map:demo", new PaneRect(0, 0, columns, rows), new PanelInk("#33ccff", "#ffaa33", "#555555"), null, model, _ => { })]); + DesktopLayerTests.Drain(); + window.UpdateLayout(); + var canvas = layer.Maps.Values.Single(); + var size = canvas.RoomSize; + var rooms = canvas.Model.Rooms.Select(r => canvas.CentreOf(r)).Select(c => new Rect(c.X - (size / 2), c.Y - (size / 2), size, size)).ToList(); + return (size, canvas.Labels(new Rect(canvas.Bounds.Size)), rooms); + }, columns: columns, rows: rows); + + [Test] + public async Task APaneWithRoomDrawsTheMockupsRoomsAndEveryNameWholeWithNoTwoTouching() + { + var (room, names, rooms) = await Fit(Plaza(), 60, 30); + + await Assert.That(room).IsEqualTo(MapCanvas.RoomTarget).Because("a pane this size fits the rooms at the mockup's size"); + await Assert.That(names.Count).IsEqualTo(6); + await Assert.That(names.Any(n => n.Elided)).IsFalse(); + await Assert.That(names.Any(n => n.Rect.Width > room)).IsTrue().Because("a name is drawn wider than its room"); + for (var i = 0; i < names.Count; i++) + { + await Assert.That(rooms.Any(r => r.Intersects(names[i].Rect))).IsFalse(); + for (var j = i + 1; j < names.Count; j++) + { + await Assert.That(names[i].Rect.Intersects(names[j].Rect)).IsFalse(); + } + } + } + + [Test] + public async Task ACrampedPaneStillLetsNoNameCoverAnother() + { + var (_, names, rooms) = await Fit(Plaza(), 26, 14); + + for (var i = 0; i < names.Count; i++) + { + await Assert.That(rooms.Any(r => r.Intersects(names[i].Rect))).IsFalse(); + for (var j = i + 1; j < names.Count; j++) + { + await Assert.That(names[i].Rect.Intersects(names[j].Rect)).IsFalse(); + } + } + + await Assert.That(names.Any(n => n.Room == 1)).IsTrue().Because("the character's room is named first"); + } + + [Test] + public async Task ASegmentCrossesOnlyTheRectanglesItPassesThrough() + { + var box = new Rect(10, 10, 10, 10); + await Assert.That(MapCanvas.Crosses(new Point(0, 15), new Point(30, 15), box)).IsTrue(); + await Assert.That(MapCanvas.Crosses(new Point(0, 0), new Point(30, 0), box)).IsFalse(); + await Assert.That(MapCanvas.Crosses(new Point(0, 0), new Point(30, 30), box)).IsTrue(); + await Assert.That(MapCanvas.Crosses(new Point(0, 30), new Point(5, 25), box)).IsFalse(); + } +} diff --git a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs index f7590ec9..39032f4f 100644 --- a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs @@ -290,6 +290,18 @@ public async Task AVitalsCardHoldsTwoRowsAMeterAndTheTargetsRowsWhetherOrNotTher await Assert.That(PanelSizing.VitalsCardRows(0)).IsEqualTo(6); } + [Test] + public async Task AGaugeCardHoldsTheTargetsRowsOnlyWhileThereIsOneAndTheHostsRuleSizesTheCard() + { + await Assert.That(PanelSizing.VitalsGaugeCardRows(3, target: false)).IsEqualTo(10); + await Assert.That(PanelSizing.VitalsGaugeCardRows(3, target: true)).IsEqualTo(12); + + var side = new PaneNode("side", ["panel:vitals:W.C"]); + var root = new SplitNode(SplitDirection.Row, [new PaneNode("output", ["main"]), side], [0.7, 0.3]); + PanelSizing.ApplyAll(root, PanelOf, tabStripRows: 1, _ => 3, cardRowsOf: _ => 9); + await Assert.That(side.FixedRows).IsEqualTo(9); + } + [Test] public async Task AStripHandedAnOrdinaryWindowStopsBeingAStrip() { diff --git a/tests/SharpMUTerm.Tui.Tests/MapColumnTests.cs b/tests/SharpMUTerm.Tui.Tests/MapColumnTests.cs new file mode 100644 index 00000000..20e35903 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/MapColumnTests.cs @@ -0,0 +1,80 @@ +using SharpConsoleUI.Drivers; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Combat's side column where the host draws it natively (): the vitals card is as tall as +/// its gauges and grows only when a target arrives, and the map's pane draws no tab strip. The terminal keeps its rules. +/// +/// Serialised: rendering redirects the process-global Console.Out. +[NotInParallel] +public class MapColumnTests +{ + private static readonly TerminalCapabilities Caps = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp Demo(HostChrome chrome) + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ScrollbackSpill.Enabled = false; + return new SharpMUTermApp(config, ClientHost.Headless(new HeadlessConsoleDriver(120, 36), Caps) with { Chrome = chrome }); + } + + [Test] + public async Task TheWindowsMapPaneDrawsNoTabStripAndItsVitalsCardIsAsTallAsItsGauges() + { + await using var app = Demo(HostChrome.Desktop); + app.RenderSnapshot("layout-combat"); + + var whole = app.PaneSnapshot().Rects; + var output = app.PaneOutputRects(); + await Assert.That(output["panel:map"].Height).IsEqualTo(whole["panel:map"].Height).Because("no tab strip over the map: its heading names it"); + await Assert.That(whole["panel:vitals"].Height).IsEqualTo(PanelSizing.VitalsGaugeCardRows(3, target: false)); + await Assert.That(whole["panel:map"].Y).IsEqualTo(whole["panel:vitals"].Y + whole["panel:vitals"].Height); + } + + [Test] + public async Task TheTerminalKeepsTheMapsTabStripAndTheReservedCard() + { + await using var app = Demo(HostChrome.None); + app.RenderSnapshot("layout-combat"); + + var whole = app.PaneSnapshot().Rects; + var output = app.PaneOutputRects(); + await Assert.That(output["panel:map"].Height).IsLessThan(whole["panel:map"].Height); + await Assert.That(whole["panel:vitals"].Height).IsEqualTo(PanelSizing.VitalsCardRows(3)); + } + + [Test] + public async Task ATargetArrivingGrowsTheWindowsCardByItsRows() + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ScrollbackSpill.Enabled = false; + config.LastSession = null; + config.Worlds[0].Layout = BuiltInLayouts.CombatId; + var time = new ManualTimeProvider(); + await using var app = new SharpMUTermApp( + config, ClientHost.Headless(new HeadlessConsoleDriver(120, 36), Caps) with { Chrome = HostChrome.Desktop }, time, autoLayout: true); + var session = app.BindWorldWithoutConnecting(config.Worlds[0]); + session.GameData.SetGmcp("Char.Vitals", """{"hp":"412","maxhp":"500","mp":"23","maxmp":"120"}"""); + time.Advance(SharpMUTermApp.LayoutRefoldDelay); + app.RenderNextFrame(); + + var meters = app.ReadVitals(session.SessionKey)!.Meters.Count; + int? Card() => app.PaneFixedRows("panel:vitals"); + await Assert.That(Card()).IsEqualTo(PanelSizing.VitalsGaugeCardRows(meters, target: false)); + + session.GameData.SetGmcp("Char.Status", """{"enemy":"a rotting ghoul","enemypct":"40"}"""); + app.RenderNextFrame(); + await Assert.That(Card()).IsEqualTo(PanelSizing.VitalsGaugeCardRows(meters, target: true)); + + var rebuilds = app.PaneAreaRebuilds; + session.GameData.SetGmcp("Char.Status", """{"enemy":"a rotting ghoul","enemypct":"30"}"""); + await Assert.That(app.PaneAreaRebuilds).IsEqualTo(rebuilds).Because("the same rows: no reflow"); + } +} From 2f4b6781aedbacc004936b29c040b89632a9fb3f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 20:51:26 +0000 Subject: [PATCH 082/113] Wave 23 C: the terminal's cells toward the terminal mockups Docked panel headings (HERE, COMPOSE, VITALS) are a filled band (HeadingBand, WorkspacePalette.HeadingBand/HeadingInk, held to 4.5:1); the scrolled-back divider is filled with the same band; modal frames are grey on Dark; the header's character sits on the band in the world's colour with no chip; the vitals card draws its rule only above a target; the welcome's /connect example is in the accent. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 5 ++ CLAUDE.md | 11 ++++- src/SharpMUTerm.Tui/Panels/DockedComposer.cs | 22 ++++++++- src/SharpMUTerm.Tui/Panels/HeadingBand.cs | 48 +++++++++++++++++++ .../Panels/VitalsStripRenderer.cs | 13 +++-- src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs | 11 +++-- src/SharpMUTerm.Tui/ScreenTheme.cs | 9 +++- src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs | 15 ++++-- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 6 +-- .../SharpMUTermApp.ScrollSplit.cs | 2 +- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 27 +++++------ src/SharpMUTerm.Tui/WelcomeSurface.cs | 2 +- src/SharpMUTerm.Tui/WorkspacePalette.cs | 33 ++++++------- 13 files changed, 152 insertions(+), 52 deletions(-) create mode 100644 src/SharpMUTerm.Tui/Panels/HeadingBand.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index bb4c5fc6..36738bce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- In the terminal, the who-is-here, composer and vitals panels head themselves with a filled band, the scrolled-back + divider is a filled band too, modal pop-ups have a quiet grey frame instead of a cyan one, the header shows your + character in the world's colour without a grey chip, the vitals card no longer draws a stray rule when nothing is + targeted, and the welcome's `/connect` example is highlighted — closer to the terminal mockups. + - In the desktop window, the map is drawn the way the mockups draw it: dark rooms outlined in a rule, exits as thin lines, your room ringed in the accent with an `@`, Up/Down/Areas as proper buttons, and the legend in a strip at the foot with "Click a room to walk there" under it, so it never covers a room. diff --git a/CLAUDE.md b/CLAUDE.md index f41fb5a5..5d10b140 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1101,7 +1101,8 @@ fallbacks) for inline images/maps. that happens to be `#00f5b7`); a foreground that is no role (a world's accent) is held to the floor on the plane it lands on, except on Dark, which stays as it was. - A bordered modal's title, border and unstyled text are the framework's cyan and `#eeeeee`, 1.4:1 on a - light backdrop; `ScreenTheme.Frame` recolours them off Dark. **The workspace popups follow it too** (⌃P, quit, ⌃B panel, + light backdrop; `ScreenTheme.Frame` recolours them off Dark, and on Dark gives the border and title the label/value + inks (the terminal mockups' grey frame, wave 23) while the text stays the framework's. **The workspace popups follow it too** (⌃P, quit, ⌃B panel, search, game data, message log, history): each has a `Scheme` the app sets in `SchemePopups()` (on `ApplyTheme`), paints its plane with `Scheme.Colour(MenuBg)`, its lines with `Scheme.Lines` and its frame with `Scheme.Frame`; ⌃P's prompt well takes `EditBg` off Dark. Dark is byte for byte unchanged. @@ -1577,6 +1578,14 @@ fallbacks) for inline images/maps. `CollapsedBarRows` (1 under `Input`, else 2), no tab strip, its windows marked scrolled back so the unread reads `N new`. A click, or `Activate` of a window in it, is `ExpandCollapsedBar` (for the run; an explicit apply clears it). `DesktopLayer.BelowGrid` stretches a native view at the foot of a column over the field reserve where the band does not reach. +- **Wave 23 terminal (cells only; the window's native views are unchanged).** A docked panel's heading is a band + across the panel (`HeadingBand.Row`, Tui `Panels/`; `WorkspacePalette.HeadingBand` = the rule leaned 0.2 toward + `Theme.Prompt`, `HeadingInk` and the accent held to 4.5:1 on it): `HERE`, `COMPOSE` (the armed `▌` in the band's first + cell) and the vitals card's `VITALS`. The renderers take the band as an optional `Ink` member, so a renderer test with + none still gets the bare accent label. The scrolled-back band is filled with the same band (`ScrollSplitBarRenderer.Bar(…, + fill)`): it divides two viewports rather than sitting in a buffer, unlike the freeze/away/NEW bars, which stay rules. + The header's character is ` ● Corvid` in the world's colour on the band, no chip (`HeaderChip` is gone). The vitals + card draws its rule only above a target. The welcome's `/connect` example is in the accent. - **Wave 19 panels and welcome (window only; the cells are unchanged).** Each docked native panel draws a heading from its model (`PanelHeading.For`, Client; `PanelText.Heading`); `VitalsModel.Source` names where the meters came from (`SourceOf`, set in `ReadVitals`), a mixture names nothing. The docked composer's footer (summary, Preview, Send) ends diff --git a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs index 2f88386a..c56f65d6 100644 --- a/src/SharpMUTerm.Tui/Panels/DockedComposer.cs +++ b/src/SharpMUTerm.Tui/Panels/DockedComposer.cs @@ -42,6 +42,7 @@ internal sealed class DockedComposer private readonly MarkupControl _header; private readonly MarkupControl _footer; private readonly string _accent; + private readonly HeadingBand.Ink? _heading; private readonly Func _describe; private bool _armed; private bool _quiet; @@ -50,11 +51,13 @@ internal sealed class DockedComposer /// /// The model for this composer's state, which the host also records as drawn and hands a native editor. /// - internal DockedComposer(string windowId, string sessionKey, ScreenTheme scheme, string accent, Func describe) + /// The heading's band (); null draws the bare accent label. + internal DockedComposer(string windowId, string sessionKey, ScreenTheme scheme, string accent, Func describe, HeadingBand.Ink? heading = null) { WindowId = windowId; SessionKey = sessionKey; _accent = accent; + _heading = heading; _describe = describe; Editor = new MultilineEditControl { @@ -317,6 +320,17 @@ internal void Redraw() internal void Render(ComposerModel model) { var verb = model.HeadingVerb; + if (_heading is { } band) + { + var bandMode = model.Escaping == ComposeEscaping.Literal ? $"[{band.Accent}]literal[/]" : "as typed"; + var rest = (verb.Length > 0 ? $" {Escape(verb)}" : string.Empty) + $" {bandMode}"; + var lead = model.Armed ? $"[{band.Accent}]▌[/]" : null; + var chars = ComposerModel.CharactersLabel(model.Characters); + _header.SetContent(new List { HeadingBand.Row("COMPOSE", rest, chars, _width > 0 ? _width : VisibleLength(rest) + 9, band, lead) }); + RenderFooter(model); + return; + } + var mode = model.Escaping == ComposeEscaping.Literal ? $"[{_accent}]literal[/]" : "[dim]as typed[/]"; var marker = model.Armed ? $"[{_accent}]▌[/]" : " "; var title = $"{marker}[bold {_accent}]COMPOSE[/]" + (verb.Length > 0 ? $" {Escape(verb)}" : string.Empty) + $" {mode}"; @@ -331,6 +345,12 @@ internal void Render(ComposerModel model) : ElideVisible(title, _width), }); + RenderFooter(model); + } + + /// The key row under the editor, in the long form or the short one when the pane is too narrow for it. + private void RenderFooter(ComposerModel model) + { var footer = KeyRow(model.Keys, shortForm: false); if (_width > 0 && VisibleLength(footer) > _width) { diff --git a/src/SharpMUTerm.Tui/Panels/HeadingBand.cs b/src/SharpMUTerm.Tui/Panels/HeadingBand.cs new file mode 100644 index 00000000..95c02d7a --- /dev/null +++ b/src/SharpMUTerm.Tui/Panels/HeadingBand.cs @@ -0,0 +1,48 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Text; +using SharpMUTerm.Core.Theming; +using static SharpMUTerm.Tui.MarkupText; + +namespace SharpMUTerm.Tui.Panels; + +/// +/// A docked panel's heading as the terminal mockups draw it: one row on a band the panel's whole width — +/// HERE The Grand Plaza · 4 — the label bold, everything in the band's own ink, a cell of margin at each end. +/// The band costs no row: it is the row the heading always took. Text on it is the band's ink or its accent, both held +/// to on it, because a heading's muted words would be a third ink measured +/// against nothing. +/// +internal static class HeadingBand +{ + /// The band and its two inks, as markup colours. + internal readonly record struct Ink(string Band, string Text, string Accent); + + /// The band and inks for , the accent held to the heading floor on the band. + internal static Ink For(Theme theme, string accent) + { + var band = WorkspacePalette.HeadingBand(theme); + return new Ink( + band.ToHex(), + WorkspacePalette.HeadingInk(theme).ToHex(), + Contrast.Legible(RgbJsonConverter.Parse(accent), band, WorkspacePalette.HeadingFloor).ToHex()); + } + + /// + /// The heading row for a panel cells wide: bold, then + /// (markup in the band's inks), and at the far end when both fit; + /// the right part goes first, then the rest is elided. Never wider than . The first cell is + /// the band's margin, or (one cell of markup: the docked composer's armed ▌) in it. + /// + internal static string Row(string label, string rest, string right, int width, Ink ink, string? lead = null) + { + width = Math.Max(1, width); + var left = $"[bold]{label}[/]{rest}"; + var inner = Math.Max(1, width - 2); + var body = right.Length > 0 && VisibleLength(left) + VisibleLength(right) + 2 <= inner + ? SpreadLR(left, right, inner) + : PadVisible(ElideVisible(left, inner), inner); + return width < 3 + ? $"[{ink.Text} on {ink.Band}]{ElideVisible(left, width)}[/]" + : $"[{ink.Text} on {ink.Band}]{lead ?? " "}{body} [/]"; + } +} diff --git a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs index 36625711..feffb890 100644 --- a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs @@ -23,8 +23,8 @@ internal static class VitalsStripRenderer /// The meter's mark when it is below . internal const string LowMark = "low"; - /// The panel's colours: the bars, the warning, and the empty part of a bar. - internal readonly record struct Ink(string Bar, string Low, string Empty); + /// The panel's colours: the bars, the warning, the empty part of a bar, and the card heading's band. + internal readonly record struct Ink(string Bar, string Low, string Empty, HeadingBand.Ink? Heading = null); /// The one-cell low mark the tighter levels use in place of . internal const string ShortLowMark = "!"; @@ -100,8 +100,10 @@ internal static IReadOnlyList RenderCard(VitalsModel vitals, int width, // window's heading says it — when there is a row for it beside the blocks. if (height >= (2 * blocks) + 5) { - var source = vitals.Source is { } from ? " [dim]" + Escape(Fit(from, Math.Max(1, width - 8))) + "[/]" : string.Empty; - lines.Add($"[bold {ink.Bar}]VITALS[/]{source}"); + var from = vitals.Source is { } named ? Escape(Fit(named, Math.Max(1, width - 8))) : null; + lines.Add(ink.Heading is { } band + ? HeadingBand.Row("VITALS", from is null ? string.Empty : " " + from, string.Empty, width, band) + : $"[bold {ink.Bar}]VITALS[/]" + (from is null ? string.Empty : $" [dim]{from}[/]")); lines.Add(string.Empty); } @@ -115,9 +117,10 @@ internal static IReadOnlyList RenderCard(VitalsModel vitals, int width, lines.Add(Bar(meter.HasMax ? meter.Share ?? 0 : 1, width, colour, ink)); } - lines.Add($"[{ink.Empty}]{new string('─', width)}[/]"); + // The rule parts the meters from the target; with no target there is nothing to part them from. if (vitals.Target is { } target) { + lines.Add($"[{ink.Empty}]{new string('─', width)}[/]"); var percent = target.Share is { } share ? StatusMeterRenderer.Percent(share) : string.Empty; var name = Escape(Fit(target.Name, Math.Max(1, width - 8 - percent.Length))); lines.Add(Spread("[dim]Target[/] " + (target.Low ? $"[{ink.Low}]{name}[/]" : name), percent, width)); diff --git a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs index 35cff02e..bab0ee07 100644 --- a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs @@ -28,8 +28,11 @@ internal static class WhoHereRenderer /// What the panel says in an empty room. internal const string EmptyText = WhoHereModel.EmptyText; - /// The panel's colours: the dot of an active player, and the plane they are measured on. - internal readonly record struct Ink(string Accent); + /// + /// The panel's colours: the dot of an active player, and the heading's band (); with no + /// band the heading is the bare accent label it was before the band. + /// + internal readonly record struct Ink(string Accent, HeadingBand.Ink? Heading = null); /// /// The panel's rows for a box by cells. Never wider than the @@ -54,7 +57,9 @@ internal static List Render(WhoHereModel model, int width, int height, I var count = $" · {rowsIn.Count.ToString(CultureInfo.InvariantCulture)}"; var title = model.Room is { } room ? " " + Escape(room) : string.Empty; - lines.Add(ElideVisible($"[bold {ink.Accent}]HERE[/]{title}[dim]{count}[/]", width)); + lines.Add(ink.Heading is { } band + ? HeadingBand.Row("HERE", title + count, string.Empty, width, band) + : ElideVisible($"[bold {ink.Accent}]HERE[/]{title}[dim]{count}[/]", width)); if (height == 1) { return lines; diff --git a/src/SharpMUTerm.Tui/ScreenTheme.cs b/src/SharpMUTerm.Tui/ScreenTheme.cs index c8c215ac..a45c9b04 100644 --- a/src/SharpMUTerm.Tui/ScreenTheme.cs +++ b/src/SharpMUTerm.Tui/ScreenTheme.cs @@ -164,14 +164,19 @@ internal static ScreenTheme For(Theme theme) /// /// Colours a bordered modal's frame, title and unstyled text. The framework's defaults (a cyan title /// and border, #eeeeee text) were chosen for a dark backdrop and fall to 1.4:1 on a light one, - /// so a theme that is not the constants' own draws them in its label and value inks; the Dark theme - /// keeps the framework's, unchanged. + /// so a theme that is not the constants' own draws them in its label and value inks. The Dark theme keeps the + /// framework's text but takes the same quiet border and title (the terminal mockups' grey frame): a cyan box around + /// every modal was the loudest thing on the screen and said nothing the modal's own heading does not. /// internal void Frame(Window window) { ArgumentNullException.ThrowIfNull(window); if (IsIdentity) { + window.ActiveTitleForegroundColor = Colour(ScreenPalette.Value); + window.InactiveTitleForegroundColor = Colour(ScreenPalette.Label); + window.ActiveBorderForegroundColor = Colour(ScreenPalette.Label); + window.InactiveBorderForegroundColor = Colour(ScreenPalette.Label); return; } diff --git a/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs b/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs index f76a0912..6d7189cd 100644 --- a/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs +++ b/src/SharpMUTerm.Tui/ScrollSplitBarRenderer.cs @@ -13,17 +13,22 @@ internal static class ScrollSplitBarRenderer /// (), so the label does not move as output arrives; the hints are dropped, last /// first, when the pane is too narrow for them, and the rule takes whatever is left. /// - public static string Bar(SharpMUTerm.Client.Chrome.ScrollBandModel band, int width, string accentHex) + /// + /// The band it is drawn on ('s inks: the label in the fill's accent, the rest in its + /// text). It is a divider between two viewports rather than a row of either, so the terminal mockup fills it; null + /// draws the bare rule the other boundary bars draw. + /// + public static string Bar(SharpMUTerm.Client.Chrome.ScrollBandModel band, int width, string accentHex, Panels.HeadingBand.Ink? fill = null) { ArgumentNullException.ThrowIfNull(band); - return Bar(band.RowsBack, width, accentHex); + return Bar(band.RowsBack, width, accentHex, fill); } /// The count a band shows for : capped, as the status row caps it. public static string Count(int rowsBack) => UnreadBadge.Format(Math.Max(1, rowsBack)); /// The bar for a count, as draws it. - public static string Bar(int rowsBack, int width, string accentHex) + public static string Bar(int rowsBack, int width, string accentHex, Panels.HeadingBand.Ink? fill = null) { ArgumentException.ThrowIfNullOrEmpty(accentHex); @@ -39,7 +44,9 @@ public static string Bar(int rowsBack, int width, string accentHex) if (used + 2 <= width || keep == 0) { var rule = new string('─', Math.Max(0, width - used)); - return $"[dim]{lead}[/][{accentHex}]{MarkupText.Escape(label)}[/][dim]{MarkupText.Escape(hint)} {rule}[/]"; + return fill is { } band + ? $"[{band.Text} on {band.Band}]{lead}[{band.Accent}]{MarkupText.Escape(label)}[/]{MarkupText.Escape(hint)} {rule}[/]" + : $"[dim]{lead}[/][{accentHex}]{MarkupText.Escape(label)}[/][dim]{MarkupText.Escape(hint)} {rule}[/]"; } } diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index e4cd53dd..e8132223 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -99,7 +99,7 @@ private IWindowControl NewWhoHerePanel(TerminalPanelContext context) { var model = Drawing(PanelIds.WhoHere, context.WindowId, ReadWhoHere(context.SessionKey)); drawn = model.Rows; - return WhoHereRenderer.Render(model, width, height, new WhoHereRenderer.Ink(_ink.Accent)); + return WhoHereRenderer.Render(model, width, height, new WhoHereRenderer.Ink(_ink.Accent, HeadingBand.For(_theme, _ink.Accent))); }); view.Click = url => { @@ -230,7 +230,7 @@ private IWindowControl NewVitalsPanel(TerminalPanelContext context) /// meaning, so they are lifted like text; the empty part of a bar is a grey that still reads as a track. /// private VitalsStripRenderer.Ink VitalsInk() => - new(_ink.Accent, LowInk(_ink.Plane), _ink.Lift(new Rgb(0x6a, 0x6a, 0x72))); + new(_ink.Accent, LowInk(_ink.Plane), _ink.Lift(new Rgb(0x6a, 0x6a, 0x72)), HeadingBand.For(_theme, _ink.Accent)); /// The low cue's ink on (), as markup. private string LowInk(Rgb plane) => WorkspacePalette.Low(_theme, ParseHex(_ink.Notice), plane).ToHex(); @@ -310,7 +310,7 @@ private void RunQuickMacro(string sessionKey, string descriptor) private IWindowControl NewDockedComposer(TerminalPanelContext context) { - var composer = new DockedComposer(context.WindowId, context.SessionKey, _screens, _ink.Accent, DescribeDocked); + var composer = new DockedComposer(context.WindowId, context.SessionKey, _screens, _ink.Accent, DescribeDocked, HeadingBand.For(_theme, _ink.Accent)); if (_composeDrafts.TryGetValue(context.SessionKey, out var draft)) { composer.Load(draft.Body, draft.Escaping, draft.Verb); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs index 9d6432f1..fbb54fbb 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.ScrollSplit.cs @@ -220,7 +220,7 @@ private bool RefreshScrollSplitBar(string windowId) var width = panel.ViewportWidth > 0 ? panel.ViewportWidth : 80; var below = panel.TotalContentHeight - panel.ViewportHeight - panel.VerticalScrollOffset; var band = Drawing(SurfaceCatalog.ScrollBand, windowId, new ScrollBandModel(windowId, below)); - var markup = ScrollSplitBarRenderer.Bar(band, width, _ink.Notice); + var markup = ScrollSplitBarRenderer.Bar(band, width, _ink.Notice, SharpMUTerm.Tui.Panels.HeadingBand.For(_theme, _ink.Notice)); if (!string.Equals(_scrollSplitBarText.GetValueOrDefault(windowId), markup, StringComparison.Ordinal)) { _scrollSplitBarText[windowId] = markup; diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index b9ac9c57..c0b0affc 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -14502,12 +14502,6 @@ private string HeaderMarkup(HeaderModel model) // identity cluster is a powerline ribbon — menu ▸ world ▸ character — flowing accent colours. var caret = model.MenuOpen ? "▾" : Glyphs.Menu; var headerBg = Hex(_theme.StatusBackground); - // The dim chrome the character segment sits on. Derived rather than the literal #3f4859 it was: - // the header is painted on the theme's own chrome band, and a fixed dark chip under a *light* - // theme is a plane nothing else on the row is measured against — which is how the world accent - // came to be drawn on it at 1.53:1. - var chipRgb = WorkspacePalette.HeaderChip(_theme); - var chip = chipRgb.ToHex(); // Build the ribbon by hand so only the brand "button" is a link (wrapping the whole bar makes // the driver's link highlight repaint every segment and flatten the flowing colours). @@ -14518,7 +14512,7 @@ private string HeaderMarkup(HeaderModel model) var sb = new System.Text.StringBuilder(); sb.Append($"[link={HeaderModel.PaletteTarget}][bold {SegmentInk(brandBg)} on {brandBg}] {caret} {BrandWord} [/][/]"); - var tail = brandBg; + string? tail = brandBg; if (model.World is { } active) { var worldAccent = FillHex(active.Accent); @@ -14527,17 +14521,20 @@ private string HeaderMarkup(HeaderModel model) tail = worldAccent; if (model.Character?.Name is { } name) { - sb.Append($"[{tail} on {chip}]{Glyphs.PowerRight}[/]"); - - // The ● wears the world's colour and is *text* here rather than a fill, so it is the one - // place on this row the accent has to clear the floor — against the chip, which is the - // plane it actually lands on. - sb.Append($"[{Contrast.Legible(ParseHex(worldAccent), chipRgb, WorkspacePalette.HeaderTextFloor).ToHex()} on {chip}] ● {Escape(name)} [/]"); - tail = chip; + // The character is the ribbon's last word and sits on the band itself, as the terminal mockups draw + // it (` ● Corvid ` in the world's colour, no chip): the ribbon ends at the world, and the ● and name + // wear the world's colour as *text*, so they are the one place on this row the accent has to clear + // the floor — against the band, which is the plane they actually land on. + sb.Append($"[{tail} on {headerBg}]{Glyphs.PowerRight}[/]"); + sb.Append($"[bold {Contrast.Legible(ParseHex(worldAccent), ParseHex(headerBg), WorkspacePalette.HeaderTextFloor).ToHex()} on {headerBg}] ● {Escape(name)} [/]"); + tail = null; } } - sb.Append($"[{tail} on {headerBg}]{Glyphs.PowerRight}[/]"); + if (tail is not null) + { + sb.Append($"[{tail} on {headerBg}]{Glyphs.PowerRight}[/]"); + } var leftBar = sb.ToString(); var right = HeaderRight(model); diff --git a/src/SharpMUTerm.Tui/WelcomeSurface.cs b/src/SharpMUTerm.Tui/WelcomeSurface.cs index 63ca0faf..c9714c58 100644 --- a/src/SharpMUTerm.Tui/WelcomeSurface.cs +++ b/src/SharpMUTerm.Tui/WelcomeSurface.cs @@ -395,7 +395,7 @@ private static List RenderMenu(WelcomeModel model, int width) lines.Add(model.Problem is null ? string.Empty : $" [{ScreenPalette.Caution}]{Escape(model.Problem)}[/]"); lines.Add(Label(WelcomeModel.ExampleLead)); - lines.Add(" " + Value(ExampleCommand)); + lines.Add($" [{ScreenPalette.Accent}]{Escape(ExampleCommand)}[/]"); lines.Add(string.Empty); lines.Add(Label(model.LayoutHeading)); var chips = string.Join(" ", Enum.GetValues().Select(layout => diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index 62a3405b..b0890482 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -318,20 +318,27 @@ internal static Rgb Recessed(Rgb plane) => internal static Rgb Rule(Theme theme) => Mix(Surface(theme), theme.Border, RuleLift); /// - /// A divider under the pointer, or being dragged: the hairline leaned toward the prompt colour, the anchor - /// the armed command line leans to. Enough to say "this moves" without reading as a second focus cue. + /// The band a docked panel's heading is drawn on (HERE, COMPOSE, VITALS), the terminal mockups' + /// heading bar, and the scrolled-back band between a split pane's two viewports: the rule leaned toward + /// , so it is past every pane plane, the focused one included (a step above on a dark theme, + /// below on a light one), and a hue apart from the divider rule it may sit beside. /// - internal static Rgb RuleHover(Theme theme) => Mix(Rule(theme), theme.Prompt, RuleHoverLean); + internal static Rgb HeadingBand(Theme theme) => Mix(Rule(theme), theme.Prompt, HeadingLean); + + /// How far leans from the rule toward the prompt colour. + private const double HeadingLean = 0.2; + + /// A heading's words: the theme's text, held to body-text contrast (4.5:1) on . + internal static Rgb HeadingInk(Theme theme) => Contrast.Legible(theme.Foreground, HeadingBand(theme), HeadingFloor); + + /// The floor a heading's words and accent are held to: small text, the status row's 4.5:1. + internal const double HeadingFloor = 4.5; /// - /// The chrome the header ribbon's character segment sits on — the chrome band lifted toward its own - /// foreground, so the segment reads as a chip against the band it ends on. + /// A divider under the pointer, or being dragged: the hairline leaned toward the prompt colour, the anchor + /// the armed command line leans to. Enough to say "this moves" without reading as a second focus cue. /// - internal static Rgb HeaderChip(Theme theme) - { - ArgumentNullException.ThrowIfNull(theme); - return Mix(theme.StatusBackground, theme.Foreground, ChipLift); - } + internal static Rgb RuleHover(Theme theme) => Mix(Rule(theme), theme.Prompt, RuleHoverLean); /// /// The floor the header's text is held to — WCAG AA for body text. The header is the one row every frame carries, @@ -403,12 +410,6 @@ internal static Rgb Low(Theme theme, Rgb notice, Rgb plane) /// How far the header's quiet text leans from its band toward its ink before the floor is applied. private const double MutedLean = 0.55; - /// - /// How far the header chip is lifted toward the theme's ink: enough that the wedge between the two - /// reads as a shape, no further, since this is a background for a name and not a highlight. - /// - private const double ChipLift = 0.22; - /// /// Every plane a pane's output can be painted on — the untinted surface and all ten tints, each /// focused and not. They form a band: every one is a theme background put through a darkening and a From 71804076d7dbbe8915484ca43f06bc969456b2e7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 20:59:05 +0000 Subject: [PATCH 083/113] Packages test waits for the review mode, not the window IsOpen is true before Mode is set (the window is added first), so the fetch-then-review test could read the mode in between on a slow runner. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs b/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs index b93dc74d..d898cda4 100644 --- a/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/PackagesAppTests.cs @@ -134,7 +134,7 @@ public async Task ALinkIsFetchedThenReviewed() rig.App.PackageFetch = (uri, _) => { asked = uri; return Task.FromResult(Archive()); }; Type(rig.App, "/package install https://packages.example/basics.zip"); - for (var i = 0; i < 1000 && !rig.App.PackageView.IsOpen; i++) + for (var i = 0; i < 1000 && rig.App.PackageView.Mode != "review"; i++) { await Task.Delay(10); } From 72aa798a3895e18c30498680aa7e2c0e81bdf4b3 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:02:27 +0000 Subject: [PATCH 084/113] Wave 23 B: the window's Light theme and the settings window toward the mockups - Native header on a light theme shares the backdrop with the rail and footer (no lavender third grey); quiet ink held on it. - Light native edge/rule mirror the dark set's step, so fields on light panels have an edge. - Welcome's search and form fields are sunk into their cards (magnifier in the search). - Settings: no greyed 0 counts while searching; 12 pt mono paths and live values; received paths scroll in their panel; list-editor combos stretch to line up; disabled buttons keep the button plane. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 7 +++++ CLAUDE.md | 8 ++++++ src/SharpMUTerm.Avalonia/ListEditorView.cs | 6 +++-- src/SharpMUTerm.Avalonia/NativeTokens.Page.cs | 10 ++++++- src/SharpMUTerm.Avalonia/NativeTokens.cs | 10 ++++--- src/SharpMUTerm.Avalonia/SettingsWindow.cs | 27 ++++++++++++------- src/SharpMUTerm.Avalonia/WelcomeView.cs | 8 ++++++ .../Pointer/SharpMUTermApp.Chrome.cs | 5 ++-- src/SharpMUTerm.Tui/WorkspacePalette.cs | 20 ++++++++++++-- .../SettingsWindowTests.cs | 2 +- 10 files changed, 83 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cce24ff4..40dcbb90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,13 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] divider is a filled band too, modal pop-ups have a quiet grey frame instead of a cyan one, the header shows your character in the world's colour without a grey chip, the vitals card no longer draws a stray rule when nothing is targeted, and the welcome's `/connect` example is highlighted — closer to the terminal mockups. +- In the desktop window's Light theme, the header sits on the same plane as the sidebar and status row instead of a + separate lavender grey, text fields in the composer, the welcome and the pop-ups have a visible edge, and the + welcome's fields are sunk into their cards (with a magnifier in the search box) in every theme. +- The settings window is closer to its mockup: while searching, a section with no match no longer shows a greyed `0`, + the meter table's paths and live values are in the 12-point monospace face, the list of received paths scrolls inside + its panel instead of pushing the page down, the list editors' drop-downs line up with the text boxes beside them, + and a disabled button no longer looks heavier than an enabled one. - In the desktop window, the map is drawn the way the mockups draw it: dark rooms outlined in a rule, exits as thin lines, your room ringed in the accent with an `@`, Up/Down/Areas as proper buttons, and the legend in a strip at the foot with diff --git a/CLAUDE.md b/CLAUDE.md index 419e3ba8..36169289 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2481,6 +2481,14 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/] `TheSpacingScaleAndTheChromeSizesAreWholeDevicePixels…` pins the multiples of 4. Not done: the quick bar is still one cell row (the mockup's is a 56 px strip of 34 px buttons), and panel internals' font sizes are not on the scale. +- **Wave 23 B (Light window, settings window).** The native header's plane is `WorkspacePalette.NativeHeaderPlane`: the + status band on a dark theme, the backdrop on a light one (Light's status band is a lavender that sat beside the neutral + rail and footer as a third grey); `HeaderMuted(theme, plane)` holds the quiet ink on it. Native only — the cell header + keeps its band. `LightCanon`'s `Edge`/`Rule` are `#c4c8d2`/`#dcdfe6`, the dark set's ~1.4:1 step mirrored, so a field on + Light's side column has an edge. The welcome's search and form fields are `ModalParts.Sunk` (Fluent's default text + background is `Raised`, the cards' own plane). Settings: a section with no match shows no count (not a greyed `0`); + page monospace is `NativeTokens.Code` (12); the received-paths panel scrolls past `MeterPathsMaxHeight`; list-editor + combos stretch like the text boxes; a disabled button keeps the button plane with a `Rule` edge. - **Every native surface spells a key in words** (`NativeKeys.Words`, Avalonia: `KeyGlyphs.Words` plus the named keys `⏎` Enter, `⇥`/`↹` Tab, `⇤` Shift+Tab, `⌫` Backspace, `⌦` Delete, `⎋` Esc, `⇞`/`⇟` PgUp/PgDn; arrows stay arrows): `Ctrl+P`, `Alt+M`, `Ctrl+B b`, never `⌃P`/`⌥M`/`⏎`. The client writes keys in glyphs because the cells draw them diff --git a/src/SharpMUTerm.Avalonia/ListEditorView.cs b/src/SharpMUTerm.Avalonia/ListEditorView.cs index a4a2e70f..f9a9f7a6 100644 --- a/src/SharpMUTerm.Avalonia/ListEditorView.cs +++ b/src/SharpMUTerm.Avalonia/ListEditorView.cs @@ -618,7 +618,9 @@ private Control ControlFor(SettingsField field) case ChoiceField choice when field.Binding is SettingBinding named: { - var combo = new ComboBox { ItemsSource = _form.Choices(choice), SelectedItem = _form.Get(named), MaxWidth = 280 }; + // Stretched as the text boxes are, so every control in the column shares both edges: a combo capped at 280 px was + // centred in a wider cell, 25 px in from the Name box above it. + var combo = new ComboBox { ItemsSource = _form.Choices(choice), SelectedItem = _form.Get(named), HorizontalAlignment = HorizontalAlignment.Stretch }; combo.SelectionChanged += (_, _) => { if (!_syncing && combo.SelectedItem is string value && value != _form.Get(named)) @@ -678,7 +680,7 @@ private Control ControlFor(SettingsField field) { ItemsSource = names, ItemTemplate = new FuncDataTemplate((name, _) => Swatch(name)), - MaxWidth = 280, + HorizontalAlignment = HorizontalAlignment.Stretch, }; void Pick() => combo.SelectedItem = names.FirstOrDefault(n => string.Equals(n, HighlightColours.Format(_form.Get(colour)), StringComparison.OrdinalIgnoreCase)); diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.Page.cs b/src/SharpMUTerm.Avalonia/NativeTokens.Page.cs index 6cfedc24..a63c7584 100644 --- a/src/SharpMUTerm.Avalonia/NativeTokens.Page.cs +++ b/src/SharpMUTerm.Avalonia/NativeTokens.Page.cs @@ -23,6 +23,9 @@ internal sealed partial record NativeTokens /// A field's label on a page. public const double Label = 13; + /// Monospace text on a page: a path, a live value (the mockup's 12 px JetBrains Mono). + public const double Code = 12; + /// Corner radius of an input, a button or a navigation row on a page. public const double RadiusControl = 6; @@ -156,7 +159,12 @@ void Set(Color colour, params string[] keys) Set(FocusEdge, "TextControlBorderBrushFocused", "ComboBoxBorderBrushPointerOver", "ButtonBorderBrushPointerOver", "TextControlBorderBrushPointerOver", "ComboBoxDropDownBorderBrush"); - Set(Button, "ButtonBackground", "RepeatButtonBackground", "ToggleSwitchFillOff", "ToggleSwitchFillOffPointerOver"); + Set(Button, "ButtonBackground", "RepeatButtonBackground", "ToggleSwitchFillOff", "ToggleSwitchFillOffPointerOver", + "ButtonBackgroundDisabled", "RepeatButtonBackgroundDisabled"); + + // A disabled button is the enabled one with its edge and ink quieter, never a darker fill: Fluent's own grey made + // the one button that does nothing (the list's ↑ at the top) the heaviest thing in its row on a light page. + Set(Rule, "ButtonBorderBrushDisabled", "RepeatButtonBorderBrushDisabled"); Set(PopupSelected, "ButtonBackgroundPointerOver", "ButtonBackgroundPressed", "RepeatButtonBackgroundPointerOver", "ComboBoxItemBackgroundPointerOver", "ComboBoxItemBackgroundSelected", "ComboBoxItemBackgroundSelectedPointerOver", diff --git a/src/SharpMUTerm.Avalonia/NativeTokens.cs b/src/SharpMUTerm.Avalonia/NativeTokens.cs index 91967511..6775bb2f 100644 --- a/src/SharpMUTerm.Avalonia/NativeTokens.cs +++ b/src/SharpMUTerm.Avalonia/NativeTokens.cs @@ -322,12 +322,16 @@ private sealed record Canon( new Rgb(0x10, 0x13, 0x1a), new Rgb(0x3a, 0x4f, 0x73)); - /// The palette's light card. + /// + /// The palette's light card: the dark set mirrored. Its edge and rule hold the dark set's step against the plane they + /// sit on (the mockup's #2c3447 on #141822 is about 1.4:1), so a field on a light panel keeps an edge + /// rather than the near-white hairline (1.1:1 on Light's #f2f2f5 side column) it had. + /// private static readonly Canon LightCanon = new( Color.FromArgb(0x4d, 0, 0, 0), new Rgb(0xff, 0xff, 0xff), - new Rgb(0xd4, 0xd4, 0xdd), - new Rgb(0xe6, 0xe6, 0xec), + new Rgb(0xc4, 0xc8, 0xd2), + new Rgb(0xdc, 0xdf, 0xe6), new Rgb(0x1d, 0x1d, 0x24), new Rgb(0x62, 0x62, 0x70), new Rgb(0x6a, 0x6a, 0x78), diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index d71e2f3d..6934080b 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -34,6 +34,9 @@ internal sealed class SettingsWindow : Window /// How far the meter table's received-paths box sits in: under the path columns, past the label column. private const double MeterPathsIndent = 128; + /// The received-paths panel's height before it scrolls: its heading and about six paths. + private const double MeterPathsMaxHeight = 200; + private readonly TextBox _search; private readonly ListBox _sections; private readonly StackPanel _page; @@ -426,13 +429,11 @@ private void UpdateBadges() foreach (var section in _form.Sections) { var count = counts.GetValueOrDefault(section.Id); + // While searching a section with matches says how many and one without says nothing (the mockup's rows): + // a column of greyed zeros read as a column of disabled sections. _badges[section.Id].Text = searching - ? count.ToString(CultureInfo.InvariantCulture) + ? count > 0 ? count.ToString(CultureInfo.InvariantCulture) : string.Empty : SettingsForm.IsDeclared(section) ? string.Empty : "↗"; - if (Items.FirstOrDefault(i => Equals(i.Tag, section.Id)) is { } item) - { - item.Opacity = searching && count == 0 ? 0.45 : 1; - } } StyleNavigation(); @@ -1167,7 +1168,7 @@ private StackPanel MeterTable(ListField field) value.GotFocus += (_, _) => lastPath = value; max.GotFocus += (_, _) => lastPath = max; - var now = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontFamily = Mono, FontSize = NativeTokens.Body }; + var now = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontFamily = Mono, FontSize = NativeTokens.Code }; _meterNow.Add((meter, now)); var remove = new Button @@ -1210,7 +1211,7 @@ private StackPanel MeterTable(ListField field) foreach (var item in received.Take(40)) { - var line = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Body, TextTrimming = TextTrimming.CharacterEllipsis }; + var line = new TextBlock { FontFamily = Mono, FontSize = NativeTokens.Code, TextTrimming = TextTrimming.CharacterEllipsis }; line.Inlines!.Add(new Run(item.Path) { Foreground = page.Brush(page.Text) }); line.Inlines.Add(new Run($" = {item.Value}") { Foreground = DimInk }); var pick = new Button @@ -1235,9 +1236,17 @@ private StackPanel MeterTable(ListField field) box.Children.Add(pick); } + // The mockup's drop-down shows a handful of rows; a connection that has sent sixty paths scrolls inside the panel + // rather than pushing "+ Add a meter" and the next card a screen down. + var list = new ScrollViewer + { + Content = box, + MaxHeight = MeterPathsMaxHeight, + HorizontalScrollBarVisibility = global::Avalonia.Controls.Primitives.ScrollBarVisibility.Disabled, + }; outer.Children.Add(new Border { - Child = box, + Child = list, Background = page.Brush(page.Popup), BorderThickness = new Thickness(NativeTokens.Hairline), BorderBrush = page.Brush(page.FocusEdge), @@ -1271,7 +1280,7 @@ private static AutoCompleteBox PathBox(string? text, IReadOnlyList paths Text = text ?? string.Empty, ItemsSource = paths, FontFamily = Mono, - FontSize = NativeTokens.Body, + FontSize = NativeTokens.Code, FilterMode = AutoCompleteFilterMode.ContainsOrdinal, MinimumPrefixLength = 0, HorizontalAlignment = HorizontalAlignment.Stretch, diff --git a/src/SharpMUTerm.Avalonia/WelcomeView.cs b/src/SharpMUTerm.Avalonia/WelcomeView.cs index af5ac914..7fe1a8d5 100644 --- a/src/SharpMUTerm.Avalonia/WelcomeView.cs +++ b/src/SharpMUTerm.Avalonia/WelcomeView.cs @@ -90,6 +90,9 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) MaxLength = WorldDirectory.MaxQuery, }; global::Avalonia.Automation.AutomationProperties.SetName(_search, WelcomeModel.FindHeading); + // Sunk into the ground with the mockup's magnifier, as every search box is: on the raised card a field on Fluent's + // default (the raised plane itself) had no plane of its own and on Light read as no field at all. + ModalParts.Sunk(_search, colours); _search.TextChanged += (_, _) => DrawRows(); _findNote = new TextBlock { FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), TextWrapping = TextWrapping.Wrap }; var find = new StackPanel { Spacing = NativeTokens.Space12 }; @@ -104,6 +107,11 @@ public WelcomeView(WelcomeSession session, NativeTokens colours, Action done) _port = Field(WelcomeModel.FieldLabel(WelcomeField.Port), "4000", 5); _port.FontFamily = Mono; _character = Field(WelcomeModel.FieldLabel(WelcomeField.Character), "Name", WelcomeModel.MaxCharacter); + foreach (var box in new[] { _host, _port, _character }) + { + ModalParts.Sunk(box, colours, magnifier: false); + } + _tls = new CheckBox { Content = "Encrypt the connection (TLS)", FontSize = NativeTokens.Title }; _passwordLater = new CheckBox { Content = NativeKeys.Words("Password: " + char.ToLowerInvariant(WelcomeModel.PasswordOn[0]) + WelcomeModel.PasswordOn[1..]), FontSize = NativeTokens.Body }; _command = new TextBlock { FontSize = NativeTokens.Body, Foreground = colours.Brush(colours.Dim), TextWrapping = TextWrapping.Wrap }; diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs index 1b6b908f..7d965e07 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Chrome.cs @@ -73,6 +73,7 @@ internal ChromeOverlay BuildChromeOverlay() _sidebarMenuRun ??= id => OnUiThread(() => RunSidebarMenuEntry(id)); var header = BuildHeaderModel(); var brand = FillHex(AccentPalette[2]); + var headerPlane = WorkspacePalette.NativeHeaderPlane(_theme); var palette = new ChromePalette( brand, header.World is { } world ? FillHex(world.Accent) : null, @@ -80,12 +81,12 @@ internal ChromeOverlay BuildChromeOverlay() _ink.Draft, UnreadBadge.TintFor(_ink), _ink.Notice, - Hex(_theme.StatusBackground), + Hex(headerPlane), Hex(WorkspacePalette.Backdrop(_theme)), Hex(_theme.Resolve(Core.Text.TerminalColor.Default, isBackground: false))) { BrandInk = WorkspacePalette.HeaderInk(_theme, ParseHex(brand)).ToHex(), - HeaderMuted = WorkspacePalette.HeaderMuted(_theme).ToHex(), + HeaderMuted = WorkspacePalette.HeaderMuted(_theme, headerPlane).ToHex(), }; return new ChromeOverlay( diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index b0890482..91df4faf 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -383,10 +383,26 @@ internal static Rgb NoticeMuted(Theme theme, Rgb plane) } /// The header's quiet text (the counts, the log state), held to on its band. - internal static Rgb HeaderMuted(Theme theme) + internal static Rgb HeaderMuted(Theme theme) => HeaderMuted(theme, theme?.StatusBackground ?? throw new ArgumentNullException(nameof(theme))); + + /// The header's quiet text held to on . + internal static Rgb HeaderMuted(Theme theme, Rgb plane) + { + ArgumentNullException.ThrowIfNull(theme); + return Contrast.Legible(Mix(plane, theme.StatusForeground, MutedLean), plane, HeaderTextFloor); + } + + /// + /// The plane a host draws its native header on. A dark theme keeps the status band (a step above the backdrop, the + /// mockup's header over its navigation). A light theme's status band is a tinted grey (Light's lavender + /// #dcdce6) that sat beside the neutral rail and footer as a third, unrelated grey; there the header shares the + /// backdrop with the rail and the footer, and the rule under it is the boundary. Native only: the cell header keeps + /// its band. + /// + internal static Rgb NativeHeaderPlane(Theme theme) { ArgumentNullException.ThrowIfNull(theme); - return Contrast.Legible(Mix(theme.StatusBackground, theme.StatusForeground, MutedLean), theme.StatusBackground, HeaderTextFloor); + return Contrast.RelativeLuminance(theme.Background) < LightPlaneLuminance ? theme.StatusBackground : Backdrop(theme); } /// diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs index d69cb5c6..5ecd76a4 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -128,7 +128,7 @@ public async Task TheSearchNarrowsThePageAndCountsEachSection() await Assert.That(section).IsEqualTo("text").Because("the section on show had nothing matching, so the first that has is shown"); await Assert.That(fields).IsEquivalentTo(expected.Where(m => m.Section.Id == "text").Select(m => m.Field!.Id).ToArray()); await Assert.That(badges["text"]).IsEqualTo(expected.Count(m => m.Section.Id == "text").ToString(System.Globalization.CultureInfo.InvariantCulture)); - await Assert.That(badges["input"]).IsEqualTo("0"); + await Assert.That(badges["input"]).IsEqualTo(string.Empty).Because("a section with no match says nothing, as the mockup's rows do"); } [Test] From 76df2de3aebf490314b8c2fb68f72a5a7394ff16 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:29:43 +0000 Subject: [PATCH 085/113] Wave 24 A: a panel's heading band is the stacked boundary; the rail's spacer column goes to the panes In the cells, a lone composer or who-here pane stands its heading band in for the divider row above it (PaneNode.DrawsHeading, counted by PaneExtent.HeaderPanes); the band's empty run, read off the paint, is the divider's hover/drag/double-click handle. The window keeps its divider row, since its native panels lie over that row. Who-here draws its band before the roster arrives. The rail-coloured spacer column after the rail's rule is given back to the panes (NAWS +1 column); the rule stays because an unfocused pane is only ~2.9 L* above the backdrop (RailEdgeTests). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 3 + CLAUDE.md | 15 +- src/SharpMUTerm.Core/Layouts/PanelSizing.cs | 9 ++ src/SharpMUTerm.Core/Workspace/LayoutNode.cs | 7 + src/SharpMUTerm.Core/Workspace/PaneExtent.cs | 10 +- src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs | 6 +- .../Pointer/SharpMUTermApp.HeadingDividers.cs | 111 ++++++++++++++ .../Pointer/SharpMUTermApp.Pointer.cs | 6 + .../SharpMUTermApp.CollapsedBars.cs | 1 + src/SharpMUTerm.Tui/SharpMUTermApp.cs | 16 +- .../Workspace/PaneExtentTests.cs | 24 +++ .../HeadingDividerTests.cs | 141 ++++++++++++++++++ tests/SharpMUTerm.Tui.Tests/RailEdgeTests.cs | 44 ++++++ .../RailWindowRowTests.cs | 12 +- 14 files changed, 385 insertions(+), 20 deletions(-) create mode 100644 src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.HeadingDividers.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/HeadingDividerTests.cs create mode 100644 tests/SharpMUTerm.Tui.Tests/RailEdgeTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 40dcbb90..f5acc6e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] ### Added +- In the terminal, a docked panel's heading band is the boundary between stacked panes: Roleplay's composer and the + who-is-here list no longer have a grey row between them (drag the HERE band's empty part to resize), and the panes + are one column wider, because the spare column between the sidebar's rule and the output is gone. - In the desktop window, Combat's map uses its pane: rooms are drawn at full size, every room's name is written out in full where it fits without covering another room or name (shortened only where it truly cannot fit), the map pane no longer repeats a lone "Map" tab above its own heading, and the vitals card is only as tall as its gauges, so the map diff --git a/CLAUDE.md b/CLAUDE.md index 36169289..ba2147c7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -675,7 +675,7 @@ fallbacks) for inline images/maps. **The window's native sidebar folds by the same rule** (verified under Xvfb at `--size 60x24` and on a live resize): at `--size 80x24` the window is ~102 columns wide with its sidebar, so it stays open and the pane is the 80 columns the rule protects. Decisions not to relitigate: - - **100 because of the server's wrap width**: the open rail, divider and spacer cost ~20 columns, so 100 still + - **100 because of the server's wrap width**: the open rail and its divider cost ~20 columns, so 100 still leaves the pane 80; below it a world's 80-column text orphans a word on every other row. 30 rows because above it the output keeps 24 rows with a three-row bar. Height never folds the rail. - **The automatic fold acts only on a crossing** (`_narrowSeen`) and once at start, never on a resize that stays on @@ -1235,6 +1235,17 @@ fallbacks) for inline images/maps. the deep grey a dark theme's step gives. Side by side, nothing changed. The freed row went to the panes, which is the point and a NAWS change; `StackedDividerTests` and the `split-stacked` view are the pins. + - **A panel's heading band is a boundary too, in the cells** (`PaneNode.DrawsHeading`, set by `ApplyHeadingPanes` + after `ApplyAll` for a lone composer or who-here pane, `PanelSizing.DrawsHeadingBand`; `HeaderPanes` counts it). + Roleplay's composer over who-here has no divider row; the HERE band's empty run is the handle (`HeadingFill`), + **read off the paint** (`MeasureHeadingRuns`, before `PaintHeaderDividers`: the longest blank run on the band's or + the lit rule's plane), because three renderers lay their headings out three ways. Who-here draws its band before + the roster arrives, so the boundary never comes and goes. **Not in the window** (`HostChrome.Strips`): its native + panels lie over that row and take its presses, so it keeps the divider row. `HeadingDividerTests`. + - **The rail is `rail │ panes`: the spacer column after the rule went to the panes in wave 24** (NAWS +1 column). + Measured, not preferred (`RailEdgeTests`): the mockup lets the planes carry the rail's edge (~6 L*), but here an + unfocused pane is 2.9 L* above the backdrop on Dark (a tinted one less) and the rule 15.9, so the rule stays and + the rail-coloured spacer beside it separated nothing. Pane text meets the rule as at any pane divider. - **The menu is the ⌃P catalog's own entries** (`AddCommands`), so it cannot offer an action the keyboard lacks, and each says its key (`ShortHint`). A right-click on a link or output focuses that pane first, and on a tab activates it, so the entries act on what was clicked. @@ -1326,7 +1337,7 @@ fallbacks) for inline images/maps. `NativeLayout`), and the client is only told the part is not its to draw. With `Header` the header control is `Visible = false` — a hidden sticky band takes no row — and `ChromeRows()` counts no header row, so the input-height veto (`SyncInputHeights`) and the layout agree. With `Rail` `BuildWorkspaceRow` builds the pane area - alone (no rail column, divider or spacer; `_railColumn` is null, so `ApplyRailWidth` does nothing). Everything + alone (no rail column or divider; `_railColumn` is null, so `ApplyRailWidth` does nothing). Everything else follows from arranged bounds: `PaneOutputRects` and so per-pane NAWS are the panes the cells really hold. `HostChromeLayoutTests` pins rows, rectangles, NAWS and the veto at 80×6. - **The window moves the cells out of the way; nothing native sits over a cell.** `DesktopLayer` spans the window diff --git a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs index c9155d6d..8f49e736 100644 --- a/src/SharpMUTerm.Core/Layouts/PanelSizing.cs +++ b/src/SharpMUTerm.Core/Layouts/PanelSizing.cs @@ -77,6 +77,15 @@ public static bool IsStrip(IReadOnlyList panels) => /// public static bool ShowsTabStrip(IReadOnlyList panels) => !(panels.Count == 1 && panels[0] is not null); + /// + /// Whether draws a filled heading band on its first row in the cells (COMPOSE, HERE), which a + /// host may take as the boundary above its pane (). The vitals card has one too, but + /// it is a fixed strip, which never has a divider row beside it. + /// + public static bool DrawsHeadingBand(string? panel) => + string.Equals(panel, PanelIds.Composer, StringComparison.Ordinal) + || string.Equals(panel, PanelIds.WhoHere, StringComparison.Ordinal); + /// /// Sets 's and from what it /// holds. names the panel each tab draws (null for an ordinary window), and diff --git a/src/SharpMUTerm.Core/Workspace/LayoutNode.cs b/src/SharpMUTerm.Core/Workspace/LayoutNode.cs index 4c360e57..82fcc6a8 100644 --- a/src/SharpMUTerm.Core/Workspace/LayoutNode.cs +++ b/src/SharpMUTerm.Core/Workspace/LayoutNode.cs @@ -118,6 +118,13 @@ public PaneNode( /// public bool DrawsHeader { get; set; } + /// + /// Whether the one panel this pane holds draws a filled heading band along its top row (the terminal's COMPOSE and + /// HERE). Like , that band is the boundary in a stacked split: no divider row is drawn above + /// the pane, and the host makes the band's empty run the divider's handle. Derived by the host and not persisted. + /// + public bool DrawsHeading { get; set; } + public override IEnumerable Panes() { yield return this; diff --git a/src/SharpMUTerm.Core/Workspace/PaneExtent.cs b/src/SharpMUTerm.Core/Workspace/PaneExtent.cs index 248d395e..16e8e306 100644 --- a/src/SharpMUTerm.Core/Workspace/PaneExtent.cs +++ b/src/SharpMUTerm.Core/Workspace/PaneExtent.cs @@ -63,8 +63,8 @@ public static int MinRows(LayoutNode node) /// /// none beside a fixed-height strip, which sits flush and is told apart by its own plane — it cannot be /// resized, so a row there would be a rule with nothing to drag; - /// none above a child whose top row is all tab strip (): that strip is the - /// boundary, and the host makes its empty run the divider's handle. + /// none above a child whose top row is all tab strip or panel heading band (): that + /// row is the boundary, and the host makes its empty run the divider's handle. /// /// public static int DividerRows(SplitNode split, int index) @@ -104,8 +104,8 @@ public static int Dividers(SplitNode split) } /// - /// The panes whose tab strips run along 's whole top edge, or an empty list when any part - /// of that edge is not a tab strip. A pane is its own answer; a stack is its first child's; a side-by-side row is + /// The panes whose tab strips or panel heading bands () run along + /// 's whole top edge, or an empty list when any part of that edge is neither. A pane is its own answer; a stack is its first child's; a side-by-side row is /// every child's, and only when each of them has one. /// public static IReadOnlyList HeaderPanes(LayoutNode node) @@ -113,7 +113,7 @@ public static IReadOnlyList HeaderPanes(LayoutNode node) ArgumentNullException.ThrowIfNull(node); if (node is PaneNode pane) { - return pane.DrawsHeader ? [pane] : []; + return pane.DrawsHeader || pane.DrawsHeading ? [pane] : []; } var split = (SplitNode)node; diff --git a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs index bab0ee07..2091aaf0 100644 --- a/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/WhoHereRenderer.cs @@ -47,7 +47,11 @@ internal static List Render(WhoHereModel model, int width, int height, I { if (!model.Known) { - return [$"[dim]{UnknownText}[/]"]; + // The band is drawn whatever the game has said: in a stack it is the boundary above this pane (no divider + // row is drawn there), so it must not come and go with the roster. + return ink.Heading is { } unknownBand && height > 1 + ? [HeadingBand.Row("HERE", string.Empty, string.Empty, Math.Max(8, width), unknownBand), $"[dim]{UnknownText}[/]"] + : [$"[dim]{UnknownText}[/]"]; } width = Math.Max(8, width); diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.HeadingDividers.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.HeadingDividers.cs new file mode 100644 index 00000000..077bc926 --- /dev/null +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.HeadingDividers.cs @@ -0,0 +1,111 @@ +using SharpConsoleUI.Controls; +using SharpConsoleUI.Layout; +using SharpMUTerm.Core.Layouts; +using SharpMUTerm.Core.Workspaces; + +namespace SharpMUTerm.Tui; + +/// +/// A docked panel's heading band as the boundary above its pane (): in a stack, the +/// composer's COMPOSE band and who-here's HERE band already mark where one pane ends and the next begins, so no divider +/// row is drawn over them and the band's empty run is the divider's handle — hover, drag, double-click, as a tab strip's +/// run is. Cells only: where the host draws the panels natively (, the window) a native +/// view lies over that row and takes its presses, so the window keeps its divider row. +/// +internal sealed partial class SharpMUTermApp +{ + /// Each heading pane's empty band run, as the last paint left it, in desktop cells; swapped whole, read off-thread. + private Dictionary _headingRuns = new(StringComparer.Ordinal); + + /// + /// After : a pane holding one panel that draws a heading band, and no tab strip, + /// stands its band in for the divider above it — in the cells only. + /// + private void ApplyHeadingPanes() + { + foreach (var pane in _workspace.Layout.Root.Panes()) + { + pane.DrawsHeading = !Host.Chrome.Strips + && !pane.DrawsHeader + && pane.FixedRows is null + && pane.Tabs.Count == 1 + && PanelSizing.DrawsHeadingBand(PanelIdOfWindow(pane.Tabs[0])); + } + } + + /// + /// The empty run of 's heading band, or null when the pane draws none or nothing has painted + /// it yet. + /// + private PaneRect? HeadingFill(string paneId) => + Volatile.Read(ref _headingRuns).TryGetValue(paneId, out var run) ? run : null; + + /// + /// Reads each heading pane's band off the frame just painted: the longest run of blank cells on the band's plane (or + /// the lit rule's, which leaves there) along the pane's top row. Read off the paint + /// because three renderers lay their headings out three ways (the composer's length sits at the far end), and a second + /// arithmetic for where their text ends would drift from what is drawn. + /// + private void MeasureHeadingRuns(CharacterBuffer buffer) + { + var runs = new Dictionary(StringComparer.Ordinal); + if (_window is not null) + { + var band = WorkspacePalette.HeadingBand(_theme); + var hover = WorkspacePalette.RuleHover(_theme); + var top = _window.Top + _system.DesktopUpperLeft.Y; + foreach (var slot in _dividers) + { + if (slot.HeaderPaneId is not { } paneId || _workspace.Layout.FindPane(paneId) is not { DrawsHeading: true }) + { + continue; + } + + TabControl? tabs; + lock (_paneTabsLock) + { + tabs = _paneTabs.GetValueOrDefault(paneId); + } + + if (tabs is null || BoundsOf(tabs) is not { Width: > 0, Height: > 0 } rect) + { + continue; + } + + var by = rect.Y - top; + int bestFrom = 0, bestLength = 0, from = -1; + for (var x = rect.X; x <= rect.X + rect.Width; x++) + { + var bx = x - _window.Left; + var blank = x < rect.X + rect.Width && by >= 0 && by < buffer.Height && bx >= 0 && bx < buffer.Width + && buffer.GetCell(bx, by) is var cell + && cell.Character.Value == ' ' + && (Same(cell.Background, band) || Same(cell.Background, hover)); + if (blank && from < 0) + { + from = x; + } + else if (!blank && from >= 0) + { + if (x - from > bestLength) + { + (bestFrom, bestLength) = (from, x - from); + } + + from = -1; + } + } + + if (bestLength > 0) + { + runs[paneId] = new PaneRect(bestFrom, rect.Y, bestLength, 1); + } + } + } + + Volatile.Write(ref _headingRuns, runs); + + static bool Same(SharpConsoleUI.Color colour, SharpMUTerm.Core.Text.Rgb rgb) => + colour.R == rgb.R && colour.G == rgb.G && colour.B == rgb.B; + } +} diff --git a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs index 0fe54d42..09b52759 100644 --- a/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs +++ b/src/SharpMUTerm.Tui/Pointer/SharpMUTermApp.Pointer.cs @@ -107,6 +107,12 @@ private void RegisterHeaderDivider(SplitNode split, int index) /// private PaneRect? HeaderFill(string paneId) { + // A panel's heading band standing in for the divider (HeadingDividers): its run as the last paint left it. + if (HeadingFill(paneId) is { } heading) + { + return heading; + } + TabControl? tabs; lock (_paneTabsLock) { diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.CollapsedBars.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.CollapsedBars.cs index f3b7c8e9..32901d8f 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.CollapsedBars.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.CollapsedBars.cs @@ -81,6 +81,7 @@ private void ApplyCollapsedBars() pane.FixedRows = CollapsedBarRows; pane.MinRows = null; pane.DrawsHeader = false; + pane.DrawsHeading = false; foreach (var windowId in pane.Tabs) { _workspace.SetScrolledBack(windowId, true); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index f371e059..375c3d31 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -195,7 +195,6 @@ private sealed class SizeReport /// private readonly MarkupControl _promptRow; private readonly MarkupControl _rail; - private readonly MarkupControl _railSpacer = new(new List()); private readonly Dictionary _paneTabs = new(StringComparer.Ordinal); /// @@ -1048,6 +1047,7 @@ public SharpMUTermApp( ReportPaneSizes(); SyncTabStripWidths(); SyncTransparentColours(); + MeasureHeadingRuns(buffer); PaintHeaderDividers(buffer); PaintTabOverflow(buffer); BlankNativeTabStrips(buffer); @@ -10980,6 +10980,7 @@ private IWindowControl BuildWorkspaceRow() VitalsCardRowsRule()); ApplyCollapsedBars(); ApplyLoneMapPanes(); + ApplyHeadingPanes(); // When a pane is zoomed, render just that pane full-area; otherwise render the whole tree. var zoomed = _workspace.Layout.ZoomedPaneId is { } zid ? _workspace.Layout.FindPane(zid) : null; @@ -10998,8 +10999,12 @@ private IWindowControl BuildWorkspaceRow() var railWidth = RailWidth(railLines); _railWidth = railWidth; - // rail │ thin divider │ 1-col spacer (breathing room) │ output — a solid 1-col bar in the - // border colour instead of the framework's double-line splitter, for a calmer single-line look. + // rail │ thin divider │ output — a solid 1-col bar in the border colour instead of the framework's double-line + // splitter, for a calmer single-line look. There used to be a rail-coloured spacer column after the bar; it was + // given back to the panes (wave 24). The bar stays: the rail is the backdrop, and an unfocused pane is only + // ~2.8 L* above it on Dark (a tinted one less still), so the plane step alone would not carry the edge + // (RailEdgeTests). The rail's own margin cell is the breathing room on its side; the pane's text meets the + // rule as it meets every divider between two panes. // Stretch (control default is Left) so the window arranges the whole row at the full console // width; without it the row floats at content width and the Flex pane column can't claim the // space to the right edge. (SharpConsoleUI docs/patterns.md — sidebar+content layouts.) @@ -11020,7 +11025,6 @@ private IWindowControl BuildWorkspaceRow() .WithVerticalAlignment(VerticalAlignment.Fill) .Column(c => c.Width(railWidth).Add(_rail)) .Column(c => c.Width(1).Add(Divider())) - .Column(c => c.Width(1).Add(_railSpacer)) .Column(c => c.Flex(1).Add(paneArea)) .Build(); @@ -11477,8 +11481,8 @@ private void ToggleRail() /// /// Breathing room between the widest row and the divider beside it. One cell, not two: the divider - /// column and the _railSpacer beside it (see ) already separate - /// the rail from the panes, so a second margin cell is a column taken off every pane to no effect. + /// column (see ) already separates the rail from the panes, so a second + /// margin cell is a column taken off every pane to no effect. /// private const int RailMargin = 1; diff --git a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs index 39032f4f..8cb0498e 100644 --- a/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs +++ b/tests/SharpMUTerm.Core.Tests/Workspace/PaneExtentTests.cs @@ -70,6 +70,30 @@ public async Task NoDividerRowIsDrawnAboveAPaneThatDrawsItsOwnTabStrip() await Assert.That(rects["below"]).IsEqualTo(new PaneRect(0, 15, 100, 15)); } + [Test] + public async Task NoDividerRowIsDrawnAboveAPaneWhosePanelDrawsAHeadingBand() + { + var below = Pane("below"); + below.DrawsHeading = true; + var root = new SplitNode(SplitDirection.Column, [Pane("top"), below]); + + var rects = LayoutSolver.Solve(root, Screen); + + await Assert.That(PaneExtent.DividerRows(root, 0)).IsEqualTo(0); + await Assert.That(PaneExtent.HeaderPanes(below).Select(p => p.Id)).IsEquivalentTo(["below"]); + await Assert.That(rects["below"].Y).IsEqualTo(rects["top"].Height); + } + + [Test] + public async Task OnlyTheComposerAndWhoHereDrawAHeadingBandAPaneCanStandOn() + { + await Assert.That(PanelSizing.DrawsHeadingBand(PanelIds.Composer)).IsTrue(); + await Assert.That(PanelSizing.DrawsHeadingBand(PanelIds.WhoHere)).IsTrue(); + await Assert.That(PanelSizing.DrawsHeadingBand(PanelIds.Vitals)).IsFalse(); + await Assert.That(PanelSizing.DrawsHeadingBand(PanelIds.Map)).IsFalse(); + await Assert.That(PanelSizing.DrawsHeadingBand(null)).IsFalse(); + } + [Test] public async Task APaneWithNoTabStripStillGetsItsDividerRow() { diff --git a/tests/SharpMUTerm.Tui.Tests/HeadingDividerTests.cs b/tests/SharpMUTerm.Tui.Tests/HeadingDividerTests.cs new file mode 100644 index 00000000..438763d7 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/HeadingDividerTests.cs @@ -0,0 +1,141 @@ +using System.Drawing; +using SharpConsoleUI.Drivers; +using SharpMUTerm.Client.Panels; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Core.Workspaces; +using SharpMUTerm.Graphics; +using SharpMUTerm.Tui; +using SharpMUTerm.Tui.Panels; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// A docked panel's heading band is the boundary above its pane, as a tab strip is: Roleplay's composer stacked over +/// who-here has no divider row between them, the HERE band's empty run is the divider (hover, drag, double-click), and +/// the band's text is not. The window, whose native panels lie over that row, keeps its divider row. +/// +/// Serialised: rendering a frame redirects the process-global Console.Out. +[NotInParallel] +public class HeadingDividerTests +{ + private const int Width = 120; + private const int Height = 34; + + private static readonly TerminalCapabilities Headless = + new(GraphicsProtocol.None, supportsTrueColor: true, supportsKittyGraphics: false, supportsSixel: false); + + private static SharpMUTermApp App(HostChrome? chrome = null, string theme = "Dark") + { + Console.SetIn(TextReader.Null); + var config = DemoScene.Build(); + config.ThemeName = theme; + config.Theme = ThemeLibrary.Get(theme); + var host = ClientHost.Headless(new HeadlessConsoleDriver(Width, Height), Headless) with { Chrome = chrome ?? HostChrome.None }; + var app = new SharpMUTermApp(config, host); + app.RenderSnapshot("layout-roleplay"); + app.RenderNextFrame(); + return app; + } + + /// The side column's two panes, composer over who-here, by their whole rectangles. + private static (PaneRect Composer, PaneRect Here) Column(SharpMUTermApp app) + { + var rects = app.PaneSnapshot().Rects.Values.Where(r => r.X > Width / 2).OrderBy(r => r.Y).ToArray(); + return (rects[0], rects[1]); + } + + /// What the pointer finds along the top row of (not the divider column beside it). + private static IEnumerable<(Point Cell, PointerTarget Target)> Row(SharpMUTermApp app, PaneRect pane) => + Enumerable.Range(pane.X, pane.Width).Select(x => (new Point(x, pane.Y), app.TargetAt(new Point(x, pane.Y)))); + + [Test] + public async Task NoDividerRowIsDrawnAboveAPanelsHeadingBand() + { + var app = App(); + var (composer, here) = Column(app); + + await Assert.That(here.Y).IsEqualTo(composer.Y + composer.Height).Because("the HERE band is the boundary"); + var text = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height); + await Assert.That(text[here.Y].Substring(here.X, here.Width)).Contains("HERE"); + } + + [Test] + public async Task TheBandsEmptyRunIsTheDividerAndItsWordsAreNot() + { + var app = App(); + var (_, here) = Column(app); + var text = FrameGrid.Decode(app.RenderWholeFrame(), Width, Height)[here.Y]; + + var divider = Row(app, here).Where(hit => hit.Target.Kind == PointerKind.Divider).ToArray(); + await Assert.That(divider).IsNotEmpty(); + await Assert.That(divider.All(hit => hit.Target.Shape == PointerShape.ResizeRows)).IsTrue(); + await Assert.That(divider[0].Target.Tooltip).Contains("above and below"); + await Assert.That(divider.All(hit => text[hit.Cell.X] == ' ')).IsTrue().Because("only blank band cells are the handle"); + await Assert.That(divider.Min(hit => hit.Cell.X)).IsGreaterThan(text.IndexOf("HERE", StringComparison.Ordinal)) + .Because("the run past the heading's words"); + await Assert.That(divider.Max(hit => hit.Cell.X)).IsEqualTo(here.X + here.Width - 1); + } + + [Test] + public async Task HoveringTheBandLightsOnlyItsEmptyRunAndMovesNoPane() + { + var app = App(); + var before = app.PaneOutputRects(); + var (_, here) = Column(app); + var cell = Row(app, here).First(hit => hit.Target.Kind == PointerKind.Divider).Cell; + var resting = FrameGrid.Backgrounds(app.RenderWholeFrame()); + + app.SimulatePointer(cell, MouseFlags.ReportMousePosition); + var lit = FrameGrid.Backgrounds(app.RenderWholeFrame()); + + await Assert.That(app.DividerLit).IsTrue(); + var changed = lit.Keys.Where(k => lit[k] != resting.GetValueOrDefault(k)).ToArray(); + await Assert.That(changed).IsNotEmpty(); + await Assert.That(changed.All(k => k.Row == here.Y && k.Column >= app.TargetAt(cell).Area.X)).IsTrue(); + await Assert.That(app.PaneOutputRects()).IsEquivalentTo(before); + + // Lit, the run is still found (it is read off the paint, where it now wears the hover colour). + await Assert.That(app.TargetAt(cell).Kind).IsEqualTo(PointerKind.Divider); + } + + [Test] + public async Task DraggingTheBandResizesTheStack() + { + var app = App(); + var (composer, here) = Column(app); + var cell = Row(app, here).First(hit => hit.Target.Kind == PointerKind.Divider).Cell; + + app.SimulatePointer(cell, MouseFlags.Button1Pressed); + app.SimulatePointer(cell with { Y = cell.Y + 3 }, MouseFlags.Button1Pressed, MouseFlags.Button1Dragged, MouseFlags.ReportMousePosition); + app.SimulatePointer(cell with { Y = cell.Y + 3 }, MouseFlags.Button1Released); + app.RenderNextFrame(); + + var (composerAfter, hereAfter) = Column(app); + await Assert.That(composerAfter.Height).IsEqualTo(composer.Height + 3); + await Assert.That(hereAfter.Y).IsEqualTo(here.Y + 3).Because("the band follows the pointer"); + } + + /// + /// The window draws who-here and the composer natively over their whole panes, heading row included, and those views + /// take the pointer, so the band's run could not be pressed there: the window keeps its divider row. + /// + [Test] + public async Task TheWindowKeepsItsDividerRowUnderTheNativePanels() + { + var app = App(HostChrome.Desktop); + var (composer, here) = Column(app); + + await Assert.That(here.Y).IsEqualTo(composer.Y + composer.Height + 1); + } + + /// The band does not wait for the roster: in a stack it is the boundary, and must not come and go. + [Test] + public async Task WhoHereDrawsItsBandBeforeTheGameHasSaidWhoIsThere() + { + var ink = new WhoHereRenderer.Ink("#00f5b7", HeadingBand.For(ThemeLibrary.Get("Dark"), "#00f5b7")); + var lines = WhoHereRenderer.Render(WhoHereModel.Unknown, 30, 6, ink); + + await Assert.That(FrameGrid.Visible(lines[0])).Contains("HERE"); + await Assert.That(FrameGrid.Visible(lines[1])).IsEqualTo(WhoHereRenderer.UnknownText); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/RailEdgeTests.cs b/tests/SharpMUTerm.Tui.Tests/RailEdgeTests.cs new file mode 100644 index 00000000..fdc5d4f8 --- /dev/null +++ b/tests/SharpMUTerm.Tui.Tests/RailEdgeTests.cs @@ -0,0 +1,44 @@ +using SharpMUTerm.Core.Configuration; +using SharpMUTerm.Core.Theming; +using SharpMUTerm.Tui; + +namespace SharpMUTerm.Tui.Tests; + +/// +/// Why the cell layout keeps a rule between the rail and the panes but no spacer beside it (wave 24). The Terminal-Main +/// mockup draws the rail straight against the output, the edge carried by the planes alone (#121216 against #1e1e24, +/// about 6 L*). Here the rail is the backdrop, and the planes beside it are not that far apart: an unfocused pane sits +/// one backdrop step above it and a tinted one sits lower still (TintDepth), so on every theme some pane meets +/// the rail at a step the eye cannot find on its own. The rule is what carries the edge there, and it is well clear of +/// the backdrop. The rail-coloured spacer that used to follow the rule separated nothing the rule had not, so that +/// column went to the panes (RailWindowRowTests.TheRailSpendsAtMostOneBlankColumnPastItsWidestRow). +/// +public class RailEdgeTests +{ + /// A step the eye finds on a terminal's worth of flat colour (WorkspacePaletteTests.Visible's figure, in L*). + private const double Visible = 8; + + private static double Lightness(SharpMUTerm.Core.Text.Rgb rgb) + { + var y = SharpMUTerm.Core.Text.Contrast.RelativeLuminance(rgb); + return y > 0.008856 ? (116 * Math.Cbrt(y)) - 16 : 903.3 * y; + } + + [Test] + [Arguments("Dark")] + [Arguments("Light")] + [Arguments("Solarized Dark")] + public async Task SomePaneMeetsTheRailAtAStepOnlyTheRuleCarries(string themeName) + { + var theme = ThemeLibrary.Get(themeName); + var rail = Lightness(WorkspacePalette.Backdrop(theme)); + var planes = Enum.GetValues() + .Select(tint => tint == PaneTint.None ? WorkspacePalette.Surface(theme) : WorkspacePalette.Tint(theme, tint)) + .ToList(); + var nearest = planes.Min(plane => Math.Abs(Lightness(plane) - rail)); + var rule = Math.Abs(Lightness(WorkspacePalette.Rule(theme)) - rail); + + await Assert.That(nearest).IsLessThan(Visible).Because("the planes alone would not show where the rail ends"); + await Assert.That(rule).IsGreaterThan(nearest).Because("the rule carries the edge the planes do not"); + } +} diff --git a/tests/SharpMUTerm.Tui.Tests/RailWindowRowTests.cs b/tests/SharpMUTerm.Tui.Tests/RailWindowRowTests.cs index 5e2331f6..684f68b6 100644 --- a/tests/SharpMUTerm.Tui.Tests/RailWindowRowTests.cs +++ b/tests/SharpMUTerm.Tui.Tests/RailWindowRowTests.cs @@ -244,9 +244,8 @@ public async Task ALabelLongerThanTheRailIsElidedRatherThanWrapped() /// /// The sidebar spends at most one blank column past its widest row. The other half of the width /// invariant: the rail must be wide enough for its rows (above) and no wider, because everything it - /// keeps is taken off the panes. One column and not two — a divider and a one-cell spacer already stand - /// between the rail's last cell and the first pane, so a second margin cell separates nothing from - /// nothing. Asserted on the demo, whose widest row is comfortably past RailMinWidth, so what is + /// keeps is taken off the panes. One column and not two — a divider already stands between the rail's + /// last cell and the first pane, so a second margin cell separates nothing from nothing. Asserted on the demo, whose widest row is comfortably past RailMinWidth, so what is /// being read is the margin rather than the floor. /// [Test] @@ -261,10 +260,11 @@ public async Task TheRailSpendsAtMostOneBlankColumnPastItsWidestRow() // And the layout spent exactly that. The line above is arithmetic over the rows and would still // pass if nothing applied the answer, so the claim is closed against the arranged pane rectangle: - // a pane starts past the rail, its divider and the one-cell spacer beside it - // (SharpMUTermApp.BuildWorkspaceRow), which is also the geometry per-pane NAWS is derived from. + // a pane starts just past the rail and its divider (SharpMUTermApp.BuildWorkspaceRow), which is also the + // geometry per-pane NAWS is derived from. It was + 2 until wave 24 gave the rail-coloured spacer column + // beside the divider back to the panes (RailEdgeTests says why the divider stayed and the spacer went). var rect = app.PaneOutputRects()[app.FocusedPaneId]; - await Assert.That(rect.X).IsEqualTo(app.RailColumnWidth + 2); + await Assert.That(rect.X).IsEqualTo(app.RailColumnWidth + 1); } /// From ac5d0c3948f16f3980c427d16ad6539f68686550 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:32:44 +0000 Subject: [PATCH 086/113] Wave 24 C: meters have colours, and a low one is the warning red Each meter carries an optional colour (StatusMeter.Colour; absent means its label's default: health green, mana blue, movement gold). Client MeterColours maps palette names to the mockups' meter shades; VitalsMeter/VitalsTarget carry it, and the status row's labels, the cell vitals strip and card and the window's native gauges draw it held to their planes' floors. Low is ScreenPalette.Warn held to 4.5:1 in every host and theme. F7's meter table gains a colour column in both hosts. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SPYixp6Cg4JDKRTwx --- CHANGELOG.md | 3 + CLAUDE.md | 8 ++ src/SharpMUTerm.Avalonia/SettingsWindow.cs | 63 ++++++++++- src/SharpMUTerm.Avalonia/VitalsGauges.cs | 33 +++++- src/SharpMUTerm.Client/Panels/MeterColours.cs | 103 ++++++++++++++++++ src/SharpMUTerm.Client/Panels/VitalsModel.cs | 9 +- .../Settings/BuiltInSettings.cs | 5 +- .../Settings/SettingsForm.cs | 4 +- .../Configuration/StatusMeter.cs | 43 +++++++- src/SharpMUTerm.Tui/OptionsScreenRenderer.cs | 42 ++++++- .../Panels/VitalsStripRenderer.cs | 38 ++++--- src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs | 17 ++- src/SharpMUTerm.Tui/SharpMUTermApp.cs | 2 +- src/SharpMUTerm.Tui/StatusMeterRenderer.cs | 19 +++- src/SharpMUTerm.Tui/WorkspacePalette.cs | 18 ++- .../DesktopLayerTests.cs | 19 ++++ .../SettingsWindowTests.cs | 22 +++- .../MeterColourTests.cs | 89 +++++++++++++++ tests/SharpMUTerm.Tui.Tests/GameDataTests.cs | 13 ++- .../TerminalPanelTests.cs | 57 ++++++++++ 20 files changed, 554 insertions(+), 53 deletions(-) create mode 100644 src/SharpMUTerm.Client/Panels/MeterColours.cs create mode 100644 tests/SharpMUTerm.Client.Tests/MeterColourTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index f5acc6e1..e5945bec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`] - In the terminal, a docked panel's heading band is the boundary between stacked panes: Roleplay's composer and the who-is-here list no longer have a grey row between them (drag the HERE band's empty part to resize), and the panes are one column wider, because the spare column between the sidebar's rule and the output is gone. +- Vitals have colours: health is green, mana blue and movement gold on the status row, the terminal's vitals strip and card, + and the desktop window's gauges, and the target's bar is orange. A low vital turns red everywhere. Pick any meter's + colour in F7's meter table (a new colour column; `auto` keeps the default for its name). - In the desktop window, Combat's map uses its pane: rooms are drawn at full size, every room's name is written out in full where it fits without covering another room or name (shortened only where it truly cannot fit), the map pane no longer repeats a lone "Map" tab above its own heading, and the vitals card is only as tall as its gauges, so the map diff --git a/CLAUDE.md b/CLAUDE.md index ba2147c7..fee220a3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -133,6 +133,14 @@ fallbacks) for inline images/maps. - **A meter is drawn only once its value has arrived, and from then its fields are reserved** (value and max five cells each, `StatusMeter.Fit` scales past that). A world with no game data costs the row nothing; one with it never reflows the row as numbers change. + - **Each meter has a colour** (`StatusMeter.Colour`, null = `DefaultColour(label)`: hp green, mp blue, mv gold, else the + accent; no schema bump, absent means default; the one-line form writes ` @name`). Client `MeterColours` turns a palette + name into a *meter shade* (the mockups' `#4cc38a`/`#5aa9e6`, not web green/blue), `VitalsMeter.Colour` and + `VitalsTarget.Colour` (`#ff8a65`) carry it, and each host holds it on its own plane: the cell strip and card + (`VitalsStripRenderer.Ink.For`/`Hold`) and the native gauges (`VitalsGauges.FillFor`) to 3:1 on the pane, the status row's + label (`StatusMeterInk`) to 4.5:1 on the row. **Low is the warning red in all three** (`WorkspacePalette.Low` = + `ScreenPalette.Warn` held to 4.5:1, every theme): it was the notice amber, which said nothing beside a gold movement bar. + F7's meter table has a colour column (`auto` + the highlight palette, typed `#rrggbb` too) in both hosts. - **Maps** (`Core/Mapping`: `WorldMap`, `MapRoom`, `PathFinder`, `MapStore`). Mudlet's room model (id, area, x/y/z, exits by direction and by command, room and exit weights, locks). `MapStore` keeps one file per **endpoint** under `maps/` (`MsspCache`'s reasoning), memory-only with no directory, never overwrites a diff --git a/src/SharpMUTerm.Avalonia/SettingsWindow.cs b/src/SharpMUTerm.Avalonia/SettingsWindow.cs index 6934080b..fbf17890 100644 --- a/src/SharpMUTerm.Avalonia/SettingsWindow.cs +++ b/src/SharpMUTerm.Avalonia/SettingsWindow.cs @@ -12,6 +12,7 @@ using Avalonia.Themes.Fluent; using Avalonia.Threading; using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Panels; using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Configuration; @@ -1131,10 +1132,10 @@ private StackPanel MeterTable(ListField field) var meters = _form.Meters(field); _meterRows = meters.Count; - var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("120,*,*,120,32"), ColumnSpacing = 8, RowSpacing = 8 }; + var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("120,*,*,130,120,32"), ColumnSpacing = 8, RowSpacing = 8 }; MeterGrid = grid; _controls[field.Id] = grid; - string[] headings = ["Label", "Value path", "Maximum path", "Live value"]; + string[] headings = ["Label", "Value path", "Maximum path", "Colour", "Live value"]; grid.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); for (var c = 0; c < headings.Length; c++) { @@ -1189,7 +1190,8 @@ private StackPanel MeterTable(ListField field) Commit(); }; - Control[] cells = [label, value, max, now, remove]; + var colour = MeterColourBox(meter, row, Commit); + Control[] cells = [label, value, max, colour, now, remove]; for (var c = 0; c < cells.Length; c++) { Grid.SetRow(cells[c], row); @@ -1270,6 +1272,61 @@ private StackPanel MeterTable(ListField field) return outer; } + /// + /// A meter's colour: auto (its label's default) or a highlight palette name, each item a swatch of the colour the + /// meter is drawn in and its name. A colour typed in the cells that no name covers (#rrggbb) is listed too, so + /// opening the page shows it. A choice is stored through , the funnel. + /// + private ComboBox MeterColourBox(StatusMeter meter, int row, Action commit) + { + var current = MeterColours.Label(meter); + var names = MeterColours.Choices.Contains(current, StringComparer.OrdinalIgnoreCase) + ? MeterColours.Choices.ToList() + : [.. MeterColours.Choices, current]; + var box = new ComboBox + { + ItemsSource = names.Select(n => MeterColourItem(n, meter)).ToList(), + SelectedIndex = Math.Max(0, names.FindIndex(n => string.Equals(n, current, StringComparison.OrdinalIgnoreCase))), + HorizontalAlignment = HorizontalAlignment.Stretch, + FontSize = NativeTokens.Label, + }; + AutomationProperties.SetName(box, $"meter {row} colour"); + box.SelectionChanged += (_, _) => + { + if (box.SelectedIndex < 0 || box.SelectedIndex >= names.Count) + { + return; + } + + var picked = names[box.SelectedIndex]; + if (!string.Equals(picked, current, StringComparison.OrdinalIgnoreCase)) + { + meter.Colour = MeterColours.TryNormalise(picked, out var stored) ? stored : null; + commit(); + } + }; + return box; + } + + /// One colour in the meter colour box: a swatch (auto's is the label's default) and the name. + private StackPanel MeterColourItem(string name, StatusMeter meter) + { + var hex = name == MeterColours.Auto ? MeterColours.Hex(StatusMeter.DefaultColour(meter.Label)) : MeterColours.Hex(name); + var panel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = NativeTokens.Space8 }; + panel.Children.Add(new Border + { + Width = 12, + Height = 12, + CornerRadius = new CornerRadius(NativeTokens.RadiusS), + Background = hex is not null && Color.TryParse(hex, out var colour) ? new SolidColorBrush(colour) : Brushes.Transparent, + BorderThickness = hex is null ? new Thickness(NativeTokens.Hairline) : default, + BorderBrush = DimInk, + VerticalAlignment = VerticalAlignment.Center, + }); + panel.Children.Add(new TextBlock { Text = name, VerticalAlignment = VerticalAlignment.Center, Foreground = _tokens.Page.Brush(_tokens.Page.Text) }); + return panel; + } + /// The page's monospace face, for paths and values (the mockup's game-text face). private static FontFamily Mono => NativeTokens.MonoFont; diff --git a/src/SharpMUTerm.Avalonia/VitalsGauges.cs b/src/SharpMUTerm.Avalonia/VitalsGauges.cs index 75ffb391..e6c6c40a 100644 --- a/src/SharpMUTerm.Avalonia/VitalsGauges.cs +++ b/src/SharpMUTerm.Avalonia/VitalsGauges.cs @@ -39,6 +39,27 @@ public VitalsGauges() /// Whether the meters are stacked (true) or side by side. Internal for tests. internal bool Stacked => StackedFor(Bounds.Height > 0 ? Bounds.Height : Height, _model); + /// + /// What a bar is filled with: the warning when low, else the meter's own colour () held + /// to the floor on the pane's plane — the cells' rule — else the panel's bar ink. Internal for tests. + /// + internal Color FillFor(string? colour, bool low) + { + if (low) + { + return Parse(_ink.Low); + } + + if (colour is null || !Color.TryParse(colour, out var own)) + { + return Parse(_ink.Bar); + } + + var held = SharpMUTerm.Core.Text.Contrast.Legible( + new SharpMUTerm.Core.Text.Rgb(own.R, own.G, own.B), new SharpMUTerm.Core.Text.Rgb(_plane.R, _plane.G, _plane.B)); + return Color.FromRgb(held.R, held.G, held.B); + } + /// The bars drawn on the last render, in order: each bar's track and filled part. Internal for tests. internal IReadOnlyList<(Rect Track, Rect Fill, bool Low)> DrawnBars => _drawn; @@ -132,7 +153,7 @@ private void RenderStacked(DrawingContext context, Rect bounds) var title = low ? $"{meter.Title} · low" : meter.Title; PanelText.Draw(context, title, inner.Left, middle, size, low ? warn : _text, low, inner.Width * 0.6); PanelText.Draw(context, Numbers(meter), inner.Right, middle, size, low ? warn : _text, false, inner.Width * 0.4, alignRight: true); - DrawBar(context, new Rect(inner.Left, y + label + 4, inner.Width, barHeight), meter.HasMax ? meter.Share ?? 0 : 1, low); + DrawBar(context, new Rect(inner.Left, y + label + 4, inner.Width, barHeight), meter.HasMax ? meter.Share ?? 0 : 1, low, meter.Colour); y += block; } @@ -146,7 +167,7 @@ private void RenderStacked(DrawingContext context, Rect bounds) if (target.Share is { } share) { PanelText.Draw(context, Percent(share), inner.Right, middle, size, _text, false, inner.Width * 0.25, alignRight: true); - DrawBar(context, new Rect(inner.Left, y + label + 4, inner.Width, Math.Max(4, barHeight - 4)), share, target.Low); + DrawBar(context, new Rect(inner.Left, y + label + 4, inner.Width, Math.Max(4, barHeight - 4)), share, target.Low, target.Colour); } } } @@ -195,7 +216,7 @@ private void RenderRow(DrawingContext context, Rect bounds) var barRight = x + unit - numbersWidth - 8; if (barRight - barLeft >= 8) { - DrawBar(context, new Rect(barLeft, middle - (barHeight / 2), barRight - barLeft, barHeight), meter.HasMax ? meter.Share ?? 0 : 1, low); + DrawBar(context, new Rect(barLeft, middle - (barHeight / 2), barRight - barLeft, barHeight), meter.HasMax ? meter.Share ?? 0 : 1, low, meter.Colour); } x += unit + gap; @@ -215,7 +236,7 @@ private void RenderRow(DrawingContext context, Rect bounds) var barRight = inner.Right - pctWidth - 8; if (barRight - barLeft >= 8) { - DrawBar(context, new Rect(barLeft, middle - (barHeight / 2), barRight - barLeft, barHeight), target.Share!.Value, target.Low); + DrawBar(context, new Rect(barLeft, middle - (barHeight / 2), barRight - barLeft, barHeight), target.Share!.Value, target.Low, target.Colour); } } } @@ -244,7 +265,7 @@ private static FormattedText Format(string text, double size, Color colour, bool return formatted; } - private void DrawBar(DrawingContext context, Rect track, double share, bool low) + private void DrawBar(DrawingContext context, Rect track, double share, bool low, string? colour) { // Flat fills on a track one step off the plane, rounded to the bar's height: the mockups' gauge. var radius = track.Height / 2; @@ -252,7 +273,7 @@ private void DrawBar(DrawingContext context, Rect track, double share, bool low) var fill = new Rect(track.X, track.Y, track.Width * Math.Clamp(share, 0, 1), track.Height); if (fill.Width > 0.5) { - context.DrawRectangle(new SolidColorBrush(Parse(low ? _ink.Low : _ink.Bar)), null, fill, radius, radius); + context.DrawRectangle(new SolidColorBrush(FillFor(colour, low)), null, fill, radius, radius); } _drawn.Add((track, fill, low)); diff --git a/src/SharpMUTerm.Client/Panels/MeterColours.cs b/src/SharpMUTerm.Client/Panels/MeterColours.cs new file mode 100644 index 00000000..a8d09983 --- /dev/null +++ b/src/SharpMUTerm.Client/Panels/MeterColours.cs @@ -0,0 +1,103 @@ +using SharpMUTerm.Client.Settings; +using SharpMUTerm.Core.Configuration; + +namespace SharpMUTerm.Client.Panels; + +/// +/// What colour a meter is drawn in, as #rrggbb before any host holds it to its plane's floor. A meter's colour is +/// written as F2's highlight colours are (: a palette name, #rrggbb, idx:N); +/// a palette name is drawn in a meter shade of that name rather than its web colour, because web green is +/// #008000 and web blue #0000ff, a mud and a hole on a dark pane. The shades are the mockups' gauges +/// (health #4cc38a, movement #5aa9e6, target #ff8a65) and their neighbours at the same weight. +/// +public static class MeterColours +{ + /// What a meter with no colour of its own reads as in a picker: its label's default (). + public const string Auto = "auto"; + + /// The names a meter's colour is picked from: , then the highlight palette's names. + public static IReadOnlyList Choices { get; } = [Auto, .. HighlightColours.NameColours]; + + /// What the target's bar is drawn in (the mockups' #ff8a65); a low target is the warning colour. + public const string Target = "#ff8a65"; + + private static readonly IReadOnlyDictionary Shades = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["red"] = "#ff6b6b", + ["orange"] = "#ff8a65", + ["gold"] = "#e8b84a", + ["yellow"] = "#f5e663", + ["lime"] = "#9be15d", + ["green"] = "#4cc38a", + ["cyan"] = "#4fd6e8", + ["teal"] = "#2ec4b6", + ["blue"] = "#5aa9e6", + ["magenta"] = "#e06bd8", + ["purple"] = "#a98bf0", + ["pink"] = "#f08ab8", + ["white"] = "#e8ecf4", + ["silver"] = "#b8c0cc", + ["grey"] = "#8a93a3", + ["black"] = "#3a4257", + }; + + /// The meter's colour (its own, else its label's default) as #rrggbb, or null for the client's accent. + public static string? For(StatusMeter meter) + { + ArgumentNullException.ThrowIfNull(meter); + return Hex(meter.EffectiveColour); + } + + /// A meter colour as written (green, #4cc38a, idx:2) as #rrggbb; null for none, auto or nonsense. + public static string? Hex(string? colour) + { + if (string.IsNullOrWhiteSpace(colour) || colour.Trim().Equals(Auto, StringComparison.OrdinalIgnoreCase)) + { + return null; + } + + var text = colour.Trim(); + if (Shades.TryGetValue(text, out var shade)) + { + return shade; + } + + return HighlightColours.TryParse(text, out var parsed) ? HighlightColours.Hex(parsed) : null; + } + + /// What a colour column shows for a meter: its own colour as written, else . + public static string Label(StatusMeter meter) + { + ArgumentNullException.ThrowIfNull(meter); + return string.IsNullOrWhiteSpace(meter.Colour) ? Auto : meter.Colour.Trim(); + } + + /// + /// A typed or picked colour as it is stored: null for or blank, a palette name lower-cased, anything + /// else reads kept as written. False (and nothing stored) for text that names no colour. + /// + public static bool TryNormalise(string? text, out string? stored) + { + stored = null; + if (string.IsNullOrWhiteSpace(text) || text.Trim().Equals(Auto, StringComparison.OrdinalIgnoreCase) + || text.Trim().Equals(HighlightColours.None, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + var trimmed = text.Trim(); + if (Shades.ContainsKey(trimmed)) + { + stored = trimmed.ToLowerInvariant(); + return true; + } + + if (HighlightColours.TryParse(trimmed, out var parsed) && parsed is not null) + { + stored = trimmed; + return true; + } + + return false; + } +} diff --git a/src/SharpMUTerm.Client/Panels/VitalsModel.cs b/src/SharpMUTerm.Client/Panels/VitalsModel.cs index 2500565d..3deae498 100644 --- a/src/SharpMUTerm.Client/Panels/VitalsModel.cs +++ b/src/SharpMUTerm.Client/Panels/VitalsModel.cs @@ -12,7 +12,11 @@ namespace SharpMUTerm.Client.Panels; /// Whether the meter is configured with a maximum at all, sent yet or not. /// Value over maximum, when both are numbers and the maximum is positive. /// Whether is under . -public sealed record VitalsMeter(string Label, string Value, string? Max, bool HasMax, double? Share, bool Low) +/// +/// The meter's colour as #rrggbb (), before any host holds it to its plane; null for +/// the client's accent. A low meter is drawn in the warning colour instead, in every view. +/// +public sealed record VitalsMeter(string Label, string Value, string? Max, bool HasMax, double? Share, bool Low, string? Colour = null) { /// /// The label spelt out where a view has the room: hp reads as Health, mp as Mana. @@ -24,7 +28,8 @@ public sealed record VitalsMeter(string Label, string Value, string? Max, bool H /// What the character is fighting, when the game says. /// The target's name, bounded by . /// Its health as a share of its maximum, when the game sends one. -public sealed record VitalsTarget(string Name, double? Share) +/// Its bar's colour as #rrggbb before the floor (); low is the warning colour. +public sealed record VitalsTarget(string Name, double? Share, string? Colour = MeterColours.Target) { /// Whether the target is below . public bool Low => Share < VitalsModel.LowShare; diff --git a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs index 4bcf44c8..53e76058 100644 --- a/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs +++ b/src/SharpMUTerm.Client/Settings/BuiltInSettings.cs @@ -107,11 +107,12 @@ public static partial class BuiltInSettings new TextField("label", "label", StatusMeter.MaxLabelLength), new TextField("value", "value path"), new TextField("max", "maximum path"), + new TextField("colour", "colour"), ], - "game data the status row shows, such as hp 412/500") + "game data the status row shows, such as hp 412/500, each in its own colour") { Group = MetersGroup, - Keywords = "gauge gmcp msdp vitals hp mana status", + Keywords = "gauge gmcp msdp vitals hp mana status colour color", Binding = new SettingBinding>( c => c.Text.StatusMeters, (c, v) => c.Text.StatusMeters = v, diff --git a/src/SharpMUTerm.Client/Settings/SettingsForm.cs b/src/SharpMUTerm.Client/Settings/SettingsForm.cs index eb22ddb9..02004d40 100644 --- a/src/SharpMUTerm.Client/Settings/SettingsForm.cs +++ b/src/SharpMUTerm.Client/Settings/SettingsForm.cs @@ -1,4 +1,5 @@ using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Panels; using SharpMUTerm.Core.Automation; using SharpMUTerm.Core.Configuration; @@ -599,6 +600,7 @@ public void SetMeters(ListField field, IEnumerable meters) Label = StatusMeter.Clip(m.Label.Trim()), Value = m.Value.Trim(), Max = string.IsNullOrWhiteSpace(m.Max) ? null : m.Max.Trim(), + Colour = MeterColours.TryNormalise(m.Colour, out var colour) ? colour : null, }).ToList(); Set(binding, list); } @@ -626,5 +628,5 @@ public void OpenScreen(string sectionId) /// Raises ; the client calls it once a committed change has landed. public void NotifyChanged() => Changed?.Invoke(); - private static StatusMeter Copy(StatusMeter m) => new() { Label = m.Label, Value = m.Value, Max = m.Max }; + private static StatusMeter Copy(StatusMeter m) => new() { Label = m.Label, Value = m.Value, Max = m.Max, Colour = m.Colour }; } diff --git a/src/SharpMUTerm.Core/Configuration/StatusMeter.cs b/src/SharpMUTerm.Core/Configuration/StatusMeter.cs index a102bd2f..573f0f22 100644 --- a/src/SharpMUTerm.Core/Configuration/StatusMeter.cs +++ b/src/SharpMUTerm.Core/Configuration/StatusMeter.cs @@ -20,6 +20,32 @@ public sealed class StatusMeter /// The maximum's path, or null for a meter with none (gold). public string? Max { get; set; } + /// + /// The colour the meter's bar and label are drawn in: a palette name (green) or #rrggbb, as F2's highlight + /// colours are written. Null (absent from a saved file) means the default for the label (), + /// so a configuration from before the field needs no migration. Every host holds it to the legibility floor on the + /// plane it lands on, and a low meter is drawn in the warning colour whatever this says. + /// + public string? Colour { get; set; } + + /// + /// The colour a meter with none of its own is drawn in, by the label every MUD shares: health green, mana blue, + /// movement gold; null (the client's accent) for anything else. + /// + public static string? DefaultColour(string? label) => (label ?? string.Empty).Trim().ToLowerInvariant() switch + { + "hp" or "health" => "green", + "mp" or "sp" or "mana" => "blue", + "mv" or "moves" or "move" or "movement" => "gold", + "ep" or "en" or "endurance" => "teal", + "wp" or "willpower" => "purple", + "st" or "sta" or "stamina" => "orange", + _ => null, + }; + + /// The colour this meter is drawn in: its own, else for its label. + public string? EffectiveColour => string.IsNullOrWhiteSpace(Colour) ? DefaultColour(Label) : Colour.Trim(); + /// The longest label the row draws. public const int MaxLabelLength = 8; @@ -81,7 +107,8 @@ public static IReadOnlyList MsdpVariables(IEnumerable meter .ToArray(); /// - /// Writes meters as the one-line form F7 edits: hp=Char.Vitals.hp/Char.Vitals.maxhp; gold=Char.Status.gold. + /// Writes meters as the one-line form F7 edits: hp=Char.Vitals.hp/Char.Vitals.maxhp; gold=Char.Status.gold, + /// a meter's own colour after an @ (hp=Char.Vitals.hp @lime). /// public static string Format(IEnumerable meters) { @@ -98,6 +125,11 @@ public static string Format(IEnumerable meters) { sb.Append('/').Append(meter.Max); } + + if (!string.IsNullOrWhiteSpace(meter.Colour)) + { + sb.Append(" @").Append(meter.Colour.Trim()); + } } return sb.ToString(); @@ -120,6 +152,14 @@ public static List Parse(string? text) var label = part[..eq].Trim(); var paths = part[(eq + 1)..]; + string? colour = null; + var at = paths.LastIndexOf(" @", StringComparison.Ordinal); + if (at >= 0) + { + colour = paths[(at + 2)..].Trim(); + paths = paths[..at]; + } + var slash = paths.IndexOf('/', StringComparison.Ordinal); var value = (slash < 0 ? paths : paths[..slash]).Trim(); var max = slash < 0 ? null : paths[(slash + 1)..].Trim(); @@ -133,6 +173,7 @@ public static List Parse(string? text) Label = label.Length > MaxLabelLength ? label[..MaxLabelLength] : label, Value = value, Max = string.IsNullOrEmpty(max) ? null : max, + Colour = string.IsNullOrEmpty(colour) ? null : colour, }); } diff --git a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs index 8558a02b..ae5f5f47 100644 --- a/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs +++ b/src/SharpMUTerm.Tui/OptionsScreenRenderer.cs @@ -1,9 +1,11 @@ using System.Globalization; using SharpMUTerm.Client.Contributions; +using SharpMUTerm.Client.Panels; using SharpMUTerm.Client.Settings; using SharpMUTerm.Core.Configuration; using SharpMUTerm.Core.Input; using SharpMUTerm.Core.Protocols; +using SharpMUTerm.Core.Text; using static SharpMUTerm.Tui.MarkupText; using static SharpMUTerm.Tui.ScreenPalette; @@ -691,6 +693,9 @@ private static OptionRow Row(SettingsField field, AppConfiguration config) /// The cells the meter table's label column takes (a label is at most eight). private const int MeterLabelWidth = StatusMeter.MaxLabelLength + 1; + /// The cells its colour column takes: magenta and a cell. + private const int MeterColourWidth = 8; + /// The cells its now column takes: 1000/1000 and a cell. private const int MeterNowWidth = 11; @@ -737,6 +742,7 @@ private static OptionRow Row(SettingsField field, AppConfiguration config) ScreenField.Text("label", () => meter.Label, v => meter.Label = StatusMeter.Clip(v)), PathField("value path", () => meter.Value, v => meter.Value = v ?? string.Empty, received, required: true), PathField("maximum path", () => meter.Max, v => meter.Max = v, received, required: false), + ColourField(() => MeterColours.Label(meter), v => meter.Colour = v), }; rows.Add(new OptionRow( meter.Label, null, null, @@ -802,10 +808,22 @@ private static ScreenField PathField( ChoiceCaption: ReceivedCaption); } + /// + /// A meter's colour: (its label's default) or a highlight palette name, stepped with + /// ↑↓ or typed — #rrggbb too, as F2's highlight takes it. Stored through . + /// + private static ScreenField ColourField(Func get, Action set) => + new( + "colour", + get, + value => MeterColours.TryNormalise(value, out _) ? null : $"{value.Trim()} is not a colour", + value => set(MeterColours.TryNormalise(value, out var stored) ? stored : null), + MeterColours.Choices); + /// How wide the table's two path columns are at . private static (int Value, int Max) PathWidths(int width) { - var room = (width > 0 ? width : 100) - AffordanceWidth - MeterLabelWidth - MeterNowWidth - (3 * MeterGap); + var room = (width > 0 ? width : 100) - AffordanceWidth - MeterLabelWidth - MeterColourWidth - MeterNowWidth - (4 * MeterGap); room = Math.Max(16, room); return (room / 2, room - (room / 2)); } @@ -818,6 +836,7 @@ private static string MeterHeading(int width, bool changed) + "label".PadRight(MeterLabelWidth) + gap + "value path".PadRight(value) + gap + "maximum path".PadRight(max) + gap + + "colour".PadRight(MeterColourWidth) + gap + "now"; return $"[dim]{line}[/]" + (changed ? Changed() : string.Empty); } @@ -831,7 +850,11 @@ private static string MeterRow(StatusMeter meter, GameDataStore? data, ScreenFie var (valueWidth, maxWidth) = PathWidths(width); var gap = new string(' ', MeterGap); var line = new System.Text.StringBuilder(new string(' ', AffordanceWidth)); - var cells = new[] { (meter.Label, MeterLabelWidth), (meter.Value, valueWidth), (meter.Max ?? string.Empty, maxWidth) }; + var cells = new[] + { + (meter.Label, MeterLabelWidth), (meter.Value, valueWidth), (meter.Max ?? string.Empty, maxWidth), + (MeterColours.Label(meter), MeterColourWidth), + }; for (var i = 0; i < cells.Length; i++) { var (text, cell) = cells[i]; @@ -844,13 +867,26 @@ private static string MeterRow(StatusMeter meter, GameDataStore? data, ScreenFie var shown = string.IsNullOrEmpty(text) ? "—" : text; var display = Escape(ElidePlain(shown, cell - 1).PadRight(cell - 1)); - line.Append(PadVisible(ScreenChrome.Field($"[{ScreenPalette.Value}]{display}[/]", null), cell)).Append(gap); + var ink = i == 3 ? MeterColourInk(meter) : ScreenPalette.Value; + line.Append(PadVisible(ScreenChrome.Field($"[{ink}]{display}[/]", null), cell)).Append(gap); } line.Append(Now(meter, data)); return line.ToString(); } + /// + /// The colour column's ink: the colour the meter is drawn in (its own, or auto's default), held to the floor on + /// the field's well, so the name is its own sample; the value ink for a meter that takes the accent. + /// + private static string MeterColourInk(StatusMeter meter) => + MeterColours.For(meter) is { } hex + ? Contrast.Legible(ToRgb(hex), ToRgb(ScreenPalette.FieldBg)).ToHex() + : ScreenPalette.Value; + + private static Core.Text.Rgb ToRgb(string hex) => new( + Convert.ToByte(hex.Substring(1, 2), 16), Convert.ToByte(hex.Substring(3, 2), 16), Convert.ToByte(hex.Substring(5, 2), 16)); + /// The now column: 412/500, 412 with no maximum, or . internal static string Now(StatusMeter meter, GameDataStore? data) => NowText(meter, data) is { } text diff --git a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs index feffb890..688350d5 100644 --- a/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs +++ b/src/SharpMUTerm.Tui/Panels/VitalsStripRenderer.cs @@ -23,8 +23,16 @@ internal static class VitalsStripRenderer /// The meter's mark when it is below . internal const string LowMark = "low"; - /// The panel's colours: the bars, the warning, the empty part of a bar, and the card heading's band. - internal readonly record struct Ink(string Bar, string Low, string Empty, HeadingBand.Ink? Heading = null); + /// + /// The panel's colours: the bars (a meter with no colour of its own), the warning, the empty part of a bar, the card + /// heading's band, and how a meter's own colour is held to the pane's floor (none: every bar is ). + /// + internal readonly record struct Ink(string Bar, string Low, string Empty, HeadingBand.Ink? Heading = null, Func? Hold = null) + { + /// What a bar is drawn in: the warning when low, else its own colour held to the floor, else . + public string For(string? colour, bool low) => + low ? Low : colour is not null && Hold is { } hold ? hold(colour) : Bar; + } /// The one-cell low mark the tighter levels use in place of . internal const string ShortLowMark = "!"; @@ -50,7 +58,8 @@ internal static class VitalsStripRenderer /// The strip for a box cells wide, or empty when no meter has a value and the game /// names no target. /// - internal static string Render(IReadOnlyList meters, CombatTarget? target, int width, Ink ink) + internal static string Render( + IReadOnlyList meters, CombatTarget? target, int width, Ink ink, string? targetColour = null) { if (meters.Count == 0 && target is null) { @@ -61,7 +70,7 @@ internal static string Render(IReadOnlyList me string? last = null; foreach (var level in Levels) { - last = Compose(meters, target, level, width, ink); + last = Compose(meters, target, level, width, ink, targetColour); if (VisibleLength(last) <= width) { return last; @@ -74,10 +83,11 @@ internal static string Render(IReadOnlyList me /// The strip for a : the same model the window's native gauges are drawn from. internal static string Render(VitalsModel vitals, int width, Ink ink) => Render( - [.. vitals.Meters.Select(m => new StatusMeterRenderer.MeterReading(m.Label, m.Value, m.Max, m.HasMax, m.Share, m.Low))], + [.. vitals.Meters.Select(m => new StatusMeterRenderer.MeterReading(m.Label, m.Value, m.Max, m.HasMax, m.Share, m.Low, m.Colour))], vitals.Target is { } target ? new CombatTarget(target.Name, target.Share) : null, width, - ink); + ink, + vitals.Target?.Colour); /// /// The card a tall vitals pane draws (): a heading, then per meter its title @@ -111,7 +121,7 @@ internal static IReadOnlyList RenderCard(VitalsModel vitals, int width, { foreach (var meter in vitals.Meters) { - var colour = meter.Low ? ink.Low : ink.Bar; + var colour = ink.For(meter.Colour, meter.Low); var title = Escape(Fit(meter.Low ? $"{meter.Title} · {LowMark}" : meter.Title, width - 1)); lines.Add(Spread(meter.Low ? $"[bold {colour}]{title}[/]" : $"[bold]{title}[/]", Numbers(meter), width)); lines.Add(Bar(meter.HasMax ? meter.Share ?? 0 : 1, width, colour, ink)); @@ -124,7 +134,7 @@ internal static IReadOnlyList RenderCard(VitalsModel vitals, int width, var percent = target.Share is { } share ? StatusMeterRenderer.Percent(share) : string.Empty; var name = Escape(Fit(target.Name, Math.Max(1, width - 8 - percent.Length))); lines.Add(Spread("[dim]Target[/] " + (target.Low ? $"[{ink.Low}]{name}[/]" : name), percent, width)); - lines.Add(target.Share is { } s ? Bar(s, width, target.Low ? ink.Low : ink.Bar, ink) : string.Empty); + lines.Add(target.Share is { } s ? Bar(s, width, ink.For(target.Colour, target.Low), ink) : string.Empty); } return lines; @@ -133,7 +143,7 @@ internal static IReadOnlyList RenderCard(VitalsModel vitals, int width, // One row a meter: the label, a bar in what is left, the value. foreach (var meter in vitals.Meters.Take(Math.Max(1, height - (vitals.Target is null ? 0 : 1)))) { - var colour = meter.Low ? ink.Low : ink.Bar; + var colour = ink.For(meter.Colour, meter.Low); var value = Escape(StatusMeter.Fit(meter.Value, StatusMeterRenderer.ValueWidth)); var label = Fit(meter.Label, 4).PadRight(4); var bar = Math.Max(0, width - label.Length - VisibleLength(value) - 2); @@ -170,7 +180,7 @@ private static string Fit(string text, int width) => width <= 0 ? string.Empty : text.Length <= width ? text : text[..Math.Max(0, width - 1)] + "…"; private static string Compose( - IReadOnlyList meters, CombatTarget? target, Level level, int width, Ink ink) + IReadOnlyList meters, CombatTarget? target, Level level, int width, Ink ink, string? targetColour) { var left = string.Join(new string(' ', level.Gap), meters.Select(m => Meter(m, level, ink))); if (target is null) @@ -178,7 +188,7 @@ private static string Compose( return left; } - var right = Target(target, level, ink); + var right = Target(target, level, ink, targetColour); var gap = width - VisibleLength(left) - VisibleLength(right); return left.Length == 0 ? new string(' ', Math.Max(0, gap)) + right @@ -189,7 +199,7 @@ private static string Meter(StatusMeterRenderer.MeterReading meter, Level level, { var sb = new StringBuilder(); sb.Append($"[dim]{Escape(meter.Label)}[/]"); - var colour = meter.Low ? ink.Low : ink.Bar; + var colour = ink.For(meter.Colour, meter.Low); if (!level.Values) { var text = meter.Share is { } share @@ -220,7 +230,7 @@ private static string Meter(StatusMeterRenderer.MeterReading meter, Level level, return sb.ToString(); } - private static string Target(CombatTarget target, Level level, Ink ink) + private static string Target(CombatTarget target, Level level, Ink ink, string? colour) { var name = target.Name.Length <= level.TargetName ? target.Name.PadRight(level.TargetName) @@ -231,7 +241,7 @@ private static string Target(CombatTarget target, Level level, Ink ink) var low = share < StatusMeterRenderer.LowShare; if (level.TargetBar > 0) { - sb.Append(' ').Append(Bar(share, level.TargetBar, low ? ink.Low : ink.Bar, ink)); + sb.Append(' ').Append(Bar(share, level.TargetBar, ink.For(colour, low), ink)); } sb.Append($" [bold]{StatusMeterRenderer.Percent(share).PadLeft(StatusMeterRenderer.ShareWidth)}[/]"); diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs index e2c1fcad..0d5080a3 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.Panels.cs @@ -220,7 +220,7 @@ private IWindowControl NewVitalsPanel(TerminalPanelContext context) var configured = PanelMeters(sessionKey); var meters = StatusMeterRenderer.Read(configured, data) - .Select(m => new VitalsMeter(m.Label, m.Value, m.Max, m.HasMax, m.Share, m.Low)) + .Select(m => new VitalsMeter(m.Label, m.Value, m.Max, m.HasMax, m.Share, m.Low, m.Colour)) .ToList(); // Where each value was found: the first of a meter's alternatives the game has sent, as the reading took it. @@ -238,10 +238,21 @@ private IWindowControl NewVitalsPanel(TerminalPanelContext context) /// meaning, so they are lifted like text; the empty part of a bar is a grey that still reads as a track. /// private VitalsStripRenderer.Ink VitalsInk() => - new(_ink.Accent, LowInk(_ink.Plane), _ink.Lift(new Rgb(0x6a, 0x6a, 0x72)), HeadingBand.For(_theme, _ink.Accent)); + new(_ink.Accent, LowInk(_ink.Plane), _ink.Lift(new Rgb(0x6a, 0x6a, 0x72)), HeadingBand.For(_theme, _ink.Accent), + colour => MeterInk(colour, _ink.Plane)); /// The low cue's ink on (), as markup. - private string LowInk(Rgb plane) => WorkspacePalette.Low(_theme, ParseHex(_ink.Notice), plane).ToHex(); + private string LowInk(Rgb plane) => WorkspacePalette.Low(_theme, plane).ToHex(); + + /// The plane the panels' inks are held against (the panes' reading plane). Internal for tests. + internal Rgb PanelPlane => _ink.Plane; + + /// A meter's colour () held to the floor on , as markup. + private static string MeterInk(string colour, Rgb plane) => Contrast.Legible(ParseHex(colour), plane).ToHex(); + + /// A meter's label on the status row: its colour held to the row's small-text floor on the row's plane. + private string StatusMeterInk(string colour) => + Contrast.Legible(ParseHex(colour), _theme.StatusBackground, WorkspacePalette.HeaderTextFloor).ToHex(); /// /// The ink a dangerous binding () is drawn in: the settings screens' warning red, held to the diff --git a/src/SharpMUTerm.Tui/SharpMUTermApp.cs b/src/SharpMUTerm.Tui/SharpMUTermApp.cs index 375c3d31..864da2b2 100644 --- a/src/SharpMUTerm.Tui/SharpMUTermApp.cs +++ b/src/SharpMUTerm.Tui/SharpMUTermApp.cs @@ -14820,7 +14820,7 @@ private StatusModel StatusBarRow(string character, string state) // is not on screen. Nothing else on the row moves with it: every other cell is reserved or dropped by width. _statusMetersHidden = VitalsStripShowing(); StatusSegment? MeterSegment(bool compact) => - StatusMeterRenderer.Runs(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground), StatusDim, compact) is { Count: > 0 } runs + StatusMeterRenderer.Runs(StatusMeters(), StatusData(), LowInk(_theme.StatusBackground), StatusDim, compact, StatusMeterInk) is { Count: > 0 } runs ? new StatusSegment(StatusRole.Meters, runs) : null; var meters = _statusMetersHidden ? null : MeterSegment(compact: false); diff --git a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs index 3d078e9f..46fb6342 100644 --- a/src/SharpMUTerm.Tui/StatusMeterRenderer.cs +++ b/src/SharpMUTerm.Tui/StatusMeterRenderer.cs @@ -48,9 +48,13 @@ internal static string Render(IReadOnlyList meters, GameDataStore d /// The meters that have a value, as status-row runs, or none when none does: each label in /// , the value bold (in when low), the maximum in /// , two cells between meters. is the same runs as markup. + /// With , a meter's label is drawn in its colour () as + /// holds it to the row's plane, and a low meter's label in with its + /// value: the colour costs no cell. /// internal static List Runs( - IReadOnlyList meters, GameDataStore data, string lowInk, string dimInk, bool compact = false) + IReadOnlyList meters, GameDataStore data, string lowInk, string dimInk, bool compact = false, + Func? hold = null) { var runs = new List(); foreach (var reading in Read(meters, data)) @@ -63,7 +67,11 @@ internal static string Render(IReadOnlyList meters, GameDataStore d var value = compact && reading.Share is { } share ? Percent(share).PadLeft(ShareWidth) : StatusMeter.Fit(reading.Value, ValueWidth).PadLeft(ValueWidth); - runs.Add(new(reading.Label, dimInk, false)); + var labelInk = hold is null ? dimInk + : reading.Low ? lowInk + : reading.Colour is { } colour ? hold(colour) + : dimInk; + runs.Add(new(reading.Label, labelInk, false)); runs.Add(new(" ", null, false)); runs.Add(new(value, reading.Low ? lowInk : null, true)); if (!(compact && reading.Share is not null) && reading.HasMax) @@ -85,7 +93,9 @@ internal static string Render(IReadOnlyList meters, GameDataStore d /// Whether the meter is configured with a maximum at all, sent yet or not. /// Value over maximum, when both are numbers and the maximum is positive. /// Whether is under . - internal readonly record struct MeterReading(string Label, string Value, string? Max, bool HasMax, double? Share, bool Low); + /// The meter's colour as #rrggbb before the floor (MeterColours.For), or null for the accent. + internal readonly record struct MeterReading( + string Label, string Value, string? Max, bool HasMax, double? Share, bool Low, string? Colour = null); /// The meters that have a value, in their configured order. A meter with nothing to read is left out. internal static IReadOnlyList Read(IReadOnlyList meters, GameDataStore data) @@ -100,7 +110,8 @@ internal static IReadOnlyList Read(IReadOnlyList mete var hasMax = !string.IsNullOrWhiteSpace(meter.Max); var max = hasMax ? StatusMeter.Read(data, meter.Max) : null; - readings.Add(new MeterReading(meter.Label, value, max, hasMax, Share(value, max), IsLow(value, max))); + readings.Add(new MeterReading( + meter.Label, value, max, hasMax, Share(value, max), IsLow(value, max), SharpMUTerm.Client.Panels.MeterColours.For(meter))); } return readings; diff --git a/src/SharpMUTerm.Tui/WorkspacePalette.cs b/src/SharpMUTerm.Tui/WorkspacePalette.cs index 91df4faf..a4e39ad2 100644 --- a/src/SharpMUTerm.Tui/WorkspacePalette.cs +++ b/src/SharpMUTerm.Tui/WorkspacePalette.cs @@ -407,21 +407,19 @@ internal static Rgb NativeHeaderPlane(Theme theme) /// /// The low cue on a meter (a vital below StatusMeterRenderer.LowShare): its bar, its value and its low - /// mark, in both hosts. A dark theme keeps the client's notice amber (), which reads as a - /// warning on a dark plane. A light theme gets a deep orange held to on - /// : the amber pushed down to a light plane's floor turns olive, and the cue then read as a - /// grey word over an olive bar — no warning at all (UX audit #29). + /// mark, in both hosts — the settings screens' warning red (, the mockups' low mana) + /// held to on . It was the notice amber on a dark theme until + /// meters had colours of their own: movement is gold, and an amber low cue said nothing beside it. A red pushed down + /// to a light plane's floor stays red, where the amber turned olive (UX audit #29). /// - internal static Rgb Low(Theme theme, Rgb notice, Rgb plane) + internal static Rgb Low(Theme theme, Rgb plane) { ArgumentNullException.ThrowIfNull(theme); - return Contrast.RelativeLuminance(theme.Background) < LightPlaneLuminance - ? notice - : Contrast.Legible(LowBase, plane, HeaderTextFloor); + return Contrast.Legible(LowBase, plane, HeaderTextFloor); } - /// The light themes' low cue before the plane has said how deep it must be: a warm, saturated orange. - private static readonly Rgb LowBase = new(0xe8, 0x59, 0x0c); + /// The low cue before the plane has said how deep it must be. + private static readonly Rgb LowBase = new(0xff, 0x6b, 0x6b); /// How far the header's quiet text leans from its band toward its ink before the floor is applied. private const double MutedLean = 0.55; diff --git a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs index f3e192d5..1fefbb86 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/DesktopLayerTests.cs @@ -164,6 +164,25 @@ public async Task TheButtonCoversOnlyBlankHeaderCellsAndStandsDownOverText() await Assert.That(overText).IsFalse(); } + [Test] + public async Task AGaugeIsFilledWithItsMetersColourHeldToThePlaneAndALowOneWithTheWarning() + { + var (own, low, none) = await Run((window, view, layer, driver) => + { + var gauges = new VitalsGauges(); + gauges.Show( + Vitals, new PanelInk("#00f5b7", "#c62828", "#3a3a40"), + global::Avalonia.Media.Color.FromRgb(0xf4, 0xf4, 0xf6), global::Avalonia.Media.Colors.Black, 16); + return (gauges.FillFor("#4cc38a", low: false), gauges.FillFor("#4cc38a", low: true), gauges.FillFor(null, low: false)); + }); + + var held = SharpMUTerm.Core.Text.Contrast.Legible(new(0x4c, 0xc3, 0x8a), new(0xf4, 0xf4, 0xf6)); + await Assert.That(own).IsEqualTo(global::Avalonia.Media.Color.FromRgb(held.R, held.G, held.B)) + .Because("health's green, darkened to the floor on a light pane, as the cells hold it"); + await Assert.That(low).IsEqualTo(global::Avalonia.Media.Color.FromRgb(0xc6, 0x28, 0x28)); + await Assert.That(none).IsEqualTo(global::Avalonia.Media.Color.FromRgb(0x00, 0xf5, 0xb7)).Because("no colour of its own: the panel's bar ink"); + } + [Test] public async Task VitalsGaugesAreDrawnOverTheirPaneAndThePointerStillReachesTheCells() { diff --git a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs index 5ecd76a4..38b77e87 100644 --- a/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs +++ b/tests/SharpMUTerm.Avalonia.Tests/SettingsWindowTests.cs @@ -140,7 +140,7 @@ public async Task TheMeterTableHasARowPerMeterAndReadsNow() { var grid = window.MeterGrid!; var rows = grid.RowDefinitions.Count; - var now = grid.Children.OfType().Where(t => Grid.GetRow(t) == 1 && Grid.GetColumn(t) == 3).Select(t => t.Text).Single(); + var now = grid.Children.OfType().Where(t => Grid.GetRow(t) == 1 && Grid.GetColumn(t) == 4).Select(t => t.Text).Single(); var add = window.GetVisualDescendantsOf