Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and a release's notes are its section. The procedure is in [`docs/RELEASING.md`]

## [Unreleased]

### Added

- In the window, Ctrl+1 to Ctrl+9 and Ctrl+0 go straight to the main window of the first ten characters you have open,
in the order the sidebar lists them; the sidebar, the character menu and Ctrl+P show each character's key. A key with
no character behind it says so and opens nothing. Terminals cannot send Ctrl with a digit (Ctrl+3 arrives as Escape,
Ctrl+8 as Backspace), so there Alt+J and Alt+K still move between characters, and Alt+1 to Alt+9 still go to the
character's own windows.

### Changed

- In the window, the zoom reset is Ctrl+Numpad 0 (and the output's right-click menu and Ctrl+P), since Ctrl+0 now goes
to the tenth character.

## [0.3.9] - 2026-11-24

### Changed
Expand Down
11 changes: 10 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3073,7 +3073,16 @@ markup (`[bold #rrggbb on #rrggbb]…[/]`, `[[`/`]]` escaping, `[link=url]…[/]
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 — 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
- **⌃1–⌃9 and ⌃0 go to the first ten open characters' main windows, and only in a host that reports Ctrl+digit whole**
(`SharpMUTermApp.CharacterJumps.cs`, `MacroKeys.CharacterJumpNumber`, `CommandIds.CharacterJumpDigits`;
`HostKeys.ReportsChordsWhole`, so the window). Asked for by players. Same order as the cycle
(`CommandCatalog.CharacterCycle`, open characters only, so a digit never dials). **Not in `MacroKeys.AppShortcuts`**:
that list is every host's, and a terminal writes these as a bare digit or another key's byte (`DigitBytes`), so
`Verdict` reports them taken only where they arrive; registered by `RegisterCharacterJumps`. Where they exist the
sidebar's character rows, the character menu and ⌃P's *Switch to* entries carry `⌃N` instead of ⌥J/⌥K
(`CommandContext.CharacterJumps`). **⌃0 is the tenth character, so the window's zoom reset is ⌃Numpad 0**, the
right-click menu and ⌃P (`WindowHost.Zoom`). The terminal has no digit chord for characters: ⌥J/⌥K and ⌃P.
- **⌃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
prompts say `pane 2`, the ⌃P entry says `Go to pane 2`, and ⌃O counts in it. It also refuses on a
Expand Down
8 changes: 5 additions & 3 deletions src/SharpMUTerm.Avalonia/TerminalView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ internal IReadOnlyList<PointerMenuItem> ZoomItems
[
new($"Zoom in ({SharpMUTerm.Core.Configuration.ZoomLevels.Label(SharpMUTerm.Core.Configuration.ZoomLevels.Next(zoom))})", "Ctrl+=", () => RequestZoom(1), zoom < SharpMUTerm.Core.Configuration.ZoomLevels.Maximum),
new($"Zoom out ({SharpMUTerm.Core.Configuration.ZoomLevels.Label(SharpMUTerm.Core.Configuration.ZoomLevels.Previous(zoom))})", "Ctrl+-", () => RequestZoom(-1), zoom > SharpMUTerm.Core.Configuration.ZoomLevels.Minimum),
new($"Reset zoom ({SharpMUTerm.Core.Configuration.ZoomLevels.Label(zoom)})", "Ctrl+0", () => RequestZoom(0), zoom != 100),
new($"Reset zoom ({SharpMUTerm.Core.Configuration.ZoomLevels.Label(zoom)})", "Ctrl+Num 0", () => RequestZoom(0), zoom != 100),
];
}
}
Expand Down Expand Up @@ -511,7 +511,7 @@ internal void AttachZoomKeys(InputElement root)
(Key.OemPlus, KeyModifiers.Control or (KeyModifiers.Control | KeyModifiers.Shift)) => 1,
(Key.Add, KeyModifiers.Control) => 1,
(Key.OemMinus or Key.Subtract, KeyModifiers.Control) => -1,
(Key.D0 or Key.NumPad0, KeyModifiers.Control) => 0,
(Key.NumPad0, KeyModifiers.Control) => 0, // Ctrl+0 is the tenth character (WindowHost.Zoom)
_ => null,
};

Expand Down Expand Up @@ -550,7 +550,7 @@ internal void HandleKeyDown(KeyEventArgs e)
RequestZoom(zoom);
_swallowText = e.Key switch
{
Key.D0 or Key.NumPad0 => '0',
Key.NumPad0 => '0',
Key.OemMinus or Key.Subtract => '-',
Key.Add => '+',
_ => e.KeyModifiers.HasFlag(KeyModifiers.Shift) ? '+' : '=',
Expand Down Expand Up @@ -588,7 +588,9 @@ internal void HandleKeyDown(KeyEventArgs e)
{
// An Alt chord can be followed by a TextInput for the same letter on some platforms.
// So is a numpad digit, which KeyMapper has already sent with its digit.
// A Ctrl+digit (⌃1–⌃0, the character chords) can be followed by a TextInput for the digit as well.
_swallowText = (key.Modifiers.HasFlag(ConsoleModifiers.Alt) && !key.Modifiers.HasFlag(ConsoleModifiers.Control))
|| (key.Modifiers == ConsoleModifiers.Control && key.Key is >= ConsoleKey.D0 and <= ConsoleKey.D9)
|| key.Key is >= ConsoleKey.NumPad0 and <= ConsoleKey.NumPad9
? key.KeyChar
: null;
Expand Down
5 changes: 4 additions & 1 deletion src/SharpMUTerm.Avalonia/WindowHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ internal static class WindowHost
public static ReservedChord WindowedFullScreen { get; } = new(
new HostChord(ConsoleKey.F11, ConsoleModifiers.Shift, "Shift+F11", "Shift+F11"), "goes in and out of windowed full screen");

/// <summary>
/// The window's zoom chords. Ctrl+0 is not one of them: ⌃1–⌃9 and ⌃0 go to the open characters
/// (<c>SharpMUTermApp.JumpToCharacter</c>), so the reset is Ctrl+Numpad 0, the output's right-click menu and ⌃P.
/// </summary>
public static IReadOnlyList<ReservedChord> Zoom { get; } =
[
new(new HostChord(ConsoleKey.OemPlus, ConsoleModifiers.Control, "Ctrl+=", "Ctrl+="), "zooms in"),
new(new HostChord(ConsoleKey.OemPlus, ConsoleModifiers.Control | ConsoleModifiers.Shift, "Ctrl++", "Ctrl++"), "zooms in"),
new(new HostChord(ConsoleKey.Add, ConsoleModifiers.Control, "Ctrl+Add", "Ctrl+Add"), "zooms in"),
new(new HostChord(ConsoleKey.OemMinus, ConsoleModifiers.Control, "Ctrl+-", "Ctrl+-"), "zooms out"),
new(new HostChord(ConsoleKey.Subtract, ConsoleModifiers.Control, "Ctrl+Subtract", "Ctrl+Subtract"), "zooms out"),
new(new HostChord(ConsoleKey.D0, ConsoleModifiers.Control, "Ctrl+0", "Ctrl+0"), "resets terminal zoom"),
new(new HostChord(ConsoleKey.NumPad0, ConsoleModifiers.Control, "Ctrl+NumPad0", "Ctrl+NumPad0"), "resets terminal zoom"),
];

Expand Down
21 changes: 13 additions & 8 deletions src/SharpMUTerm.Client/Commands/BuiltInCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static class BuiltInCommands
/// <summary>Zooms the window out a step (Ctrl+- in the window).</summary>
public const string ZoomOutCommand = "window:zoom-out";

/// <summary>Puts the window's zoom back to 100% (Ctrl+0 in the window).</summary>
/// <summary>Puts the window's zoom back to 100% (Ctrl+Numpad 0 in the window; Ctrl+0 is the tenth character).</summary>
public const string ZoomResetCommand = "window:zoom-reset";

/// <summary>Opens the Text size &amp; zoom page (the window only).</summary>
Expand Down Expand Up @@ -297,7 +297,7 @@ void Family(string id, string prefix, Func<ICommandContext, IEnumerable<CommandI
Add(ZoomOutCommand, CommandGroup.Layout, "Zoom out", "⌃-", "make everything in the window smaller",
when: c => c.State.TextZoom is { } zoom && zoom > Core.Configuration.ZoomLevels.Minimum,
titleFor: c => "Zoom out to " + Core.Configuration.ZoomLevels.Label(Core.Configuration.ZoomLevels.Previous(c.State.TextZoom ?? 100)));
Add(ZoomResetCommand, CommandGroup.Layout, "Reset zoom", "⌃0", "back to 100% · sizes by area are on the Text size page",
Add(ZoomResetCommand, CommandGroup.Layout, "Reset zoom", "⌃Num0", "back to 100% · sizes by area are on the Text size page",
when: c => c.State.TextZoom is { } zoom && zoom != 100,
titleFor: c => "Reset zoom (" + Core.Configuration.ZoomLevels.Label(c.State.TextZoom ?? 100) + ")");
Add(TextSizeCommand, CommandGroup.Settings, "Text size & zoom…", detail: "font sizes for the output, composer, panels and menus",
Expand Down Expand Up @@ -470,11 +470,12 @@ public static IReadOnlyList<CommandItem> Catalog(
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.
// In a terminal 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. A terminal has 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 there,
// which was measured rather than assumed. A host that reports Ctrl+digit whole (the window) has one:
// ⌃1–⌃9 and ⌃0 name the first ten open characters, in the cycle's order, and every such row carries its own.
private static IEnumerable<CommandItem> Characters(ICommandContext context)
{
var characters = context.Characters;
Expand All @@ -486,6 +487,7 @@ private static IEnumerable<CommandItem> Characters(ICommandContext context)
? cycle[(here - 1 + cycle.Count) % cycle.Count].SessionKey
: null;

var jumps = context.State.CharacterJumps;
foreach (var character in characters)
{
if (character.SessionKey == focusedSessionKey)
Expand All @@ -494,7 +496,10 @@ private static IEnumerable<CommandItem> Characters(ICommandContext context)
}

var state = character.Connected ? "connected" : "offline";
var chord = character.SessionKey == next ? "⌥J · "
var number = cycle.FindIndex(c => c.SessionKey == character.SessionKey) + 1;
var chord = jumps
? number is > 0 and <= CommandIds.CharacterJumpDigits ? CommandIds.CharacterJumpChord(number) + " · " : string.Empty
: character.SessionKey == next ? "⌥J · "
: character.SessionKey == previous ? "⌥K · "
: string.Empty;
yield return new CommandItem(
Expand Down
18 changes: 15 additions & 3 deletions src/SharpMUTerm.Client/Help/HelpTopics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ namespace SharpMUTerm.Client.Help;
/// </summary>
public static class HelpTopics
{
/// <summary>The pages, with <paramref name="newline"/> (the host's newline chord) where a page names it.</summary>
public static IReadOnlyList<HelpTopic> For(string newline) =>
/// <summary>
/// The pages, with <paramref name="newline"/> (the host's newline chord) where a page names it, and the character
/// chords where the host has them (<paramref name="characterJumps"/>: ⌃1–⌃9 and ⌃0, the window).
/// </summary>
public static IReadOnlyList<HelpTopic> For(string newline, bool characterJumps = false) =>
[
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",
Expand Down Expand Up @@ -45,7 +48,7 @@ public static IReadOnlyList<HelpTopic> For(string newline) =>
"Copy: drag across output, then ⌃C.",
]),
new("text-size", "Text size", "make the text bigger or smaller", [
"In the window: ⌃= zooms in, ⌃- zooms out and ⌃0 goes back to 100%, as in a browser; so does ⌃ with",
"In the window: ⌃= zooms in, ⌃- zooms out and ⌃ with numpad 0 goes back to 100%; so does ⌃ with",
"the wheel, and the output's right-click menu. The zoom covers the whole window and is kept between runs.",
"⌃P ▸ Text size & zoom sets the output's size in points, and the composer, the header and sidebar,",
"the panels, and menus and dialogs each on their own.",
Expand Down Expand Up @@ -94,6 +97,7 @@ public static IReadOnlyList<HelpTopic> For(string newline) =>
"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.",
.. CharacterJumpLines(characterJumps),
"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,",
Expand Down Expand Up @@ -129,4 +133,12 @@ private static IEnumerable<string> MapKeyRows()
yield return " " + string.Concat(keys.Skip(i).Take(3).Select(k => (k.Key.PadRight(10) + k.Word).PadRight(26))).TrimEnd();
}
}

/// <summary>The keys page's line for ⌃1–⌃0, only where the host delivers them.</summary>
private static string[] CharacterJumpLines(bool characterJumps) => characterJumps
? [
" ⌃1 to ⌃9 and ⌃0 go straight to the main window of the first ten characters you have open, in",
" the order the sidebar lists them (it prints each one's key).",
]
: [];
}
6 changes: 4 additions & 2 deletions src/SharpMUTerm.Client/Modals/HelpModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ private bool Mentions(HelpEntry entry, string word)
/// <param name="catalog">The command registry's entries for this host and state.</param>
/// <param name="newline">The host's newline chord, in glyphs (<c>⌥⏎</c>, <c>⌃⏎</c>).</param>
/// <param name="hostKeeps">The chords the host keeps for itself, with what each does there.</param>
/// <param name="characterJumps">Whether the host has ⌃1–⌃9 and ⌃0 for the open characters (the window).</param>
public static HelpModel Build(
IReadOnlyList<CommandItem> catalog,
string newline,
IReadOnlyList<(string Chord, string Action)> hostKeeps)
IReadOnlyList<(string Chord, string Action)> hostKeeps,
bool characterJumps = false)
{
ArgumentNullException.ThrowIfNull(catalog);
ArgumentNullException.ThrowIfNull(hostKeeps);
var topics = HelpTopics.For(KeyGlyphs.Normalize(newline));
var topics = HelpTopics.For(KeyGlyphs.Normalize(newline), characterJumps);
var entries = new List<HelpEntry>();
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)));
Expand Down
4 changes: 2 additions & 2 deletions src/SharpMUTerm.Client/Settings/BuiltInSettings.TextSize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static partial class BuiltInSettings
public static IReadOnlyList<string> AreaChoices { get; } = [.. ZoomLevels.AreaSteps.Select(ZoomLevels.Label)];

/// <summary>
/// The desktop window's text sizes: a zoom over the whole window (Ctrl+= / Ctrl+- / Ctrl+0, Ctrl+wheel), the
/// The desktop window's text sizes: a zoom over the whole window (Ctrl+= / Ctrl+- / Ctrl+Numpad 0, Ctrl+wheel), the
/// output's size in points, and the composer, interface, panels and dialogs each as a percentage. Not in
/// <see cref="All"/> and on no F-key, like <see cref="Window"/>: a host registers it only when it draws its own text
/// (the window), so a terminal, whose font size is its emulator's, never lists a choice that does nothing there.
Expand All @@ -34,7 +34,7 @@ public static partial class BuiltInSettings
Fields =
[
new ChoiceField("zoom", "zoom", ZoomChoices,
"everything in the window, as a browser zooms; Ctrl+= and Ctrl+- step it, Ctrl+0 resets, Ctrl+wheel too")
"everything in the window, as a browser zooms; Ctrl+= and Ctrl+- step it, Ctrl+Numpad 0 resets, Ctrl+wheel too")
{
Group = ZoomGroup,
Keywords = "zoom scale magnify bigger smaller font size text size accessibility dpi",
Expand Down
7 changes: 6 additions & 1 deletion src/SharpMUTerm.Core/Commands/CommandCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public sealed record CharacterRef(
/// </param>
/// <param name="Update">Where this copy's update stands; null in a host that cannot update itself.</param>
/// <param name="TextSizePage">Whether the host has the Text size &amp; zoom page (the window, not <c>--emulated</c>).</param>
/// <param name="CharacterJumps">
/// Whether the host delivers Ctrl+digit as itself, so ⌃1–⌃9 and ⌃0 go to the open characters in the cycle's order (the
/// window). False in a terminal, where those chords are bytes other keys own.
/// </param>
/// <param name="TextZoom">
/// The desktop window's zoom, a percentage, so ⌃P offers zooming in, out and back; null in a host that draws no text of
/// its own (the terminal, whose font size is its emulator's).
Expand Down Expand Up @@ -119,7 +123,8 @@ public sealed record CommandContext(
Configuration.WindowMode? WindowMode = null,
UpdateState? Update = null,
int? TextZoom = null,
bool TextSizePage = false);
bool TextSizePage = false,
bool CharacterJumps = false);

/// <summary>
/// Where this copy's update stands, for ⌃P's update entries: null when the host cannot update itself at all (a build
Expand Down
10 changes: 10 additions & 0 deletions src/SharpMUTerm.Core/Commands/CommandIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ public static class CommandIds
/// </summary>
public const int WindowJumpDigits = 9;

/// <summary>
/// How many open characters have a chord of their own where the host delivers Ctrl+digit as itself (the window):
/// ⌃1–⌃9 and ⌃0 for the tenth, counting <see cref="CommandCatalog.CharacterCycle"/>. A terminal writes Ctrl+digit
/// as a bare digit or a byte another key already owns, so there the cycle (⌥J/⌥K) and ⌃P are the way.
/// </summary>
public const int CharacterJumpDigits = 10;

/// <summary>The chord, in glyphs, that goes to open character <paramref name="number"/> (1-based): ⌃1…⌃9, ⌃0.</summary>
public static string CharacterJumpChord(int number) => number == 10 ? "⌃0" : "⌃" + number;

/// <summary>Prefix of a "go to this numbered pane" id; the remainder is the pane's 1-based number.</summary>
public const string PanePrefix = "layout:pane-";

Expand Down
2 changes: 1 addition & 1 deletion src/SharpMUTerm.Core/Configuration/AppConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public sealed class AppConfiguration
public WindowPlacement? Window { get; set; }

/// <summary>
/// The desktop window's text sizes and zoom (the Text size settings page, Ctrl+= / Ctrl+- / Ctrl+0). Read by the
/// The desktop window's text sizes and zoom (the Text size settings page, Ctrl+= / Ctrl+- / Ctrl+Numpad 0). Read by the
/// window alone; a terminal's font size is its emulator's.
/// </summary>
public DisplaySettings Display { get; set; } = new();
Expand Down
2 changes: 1 addition & 1 deletion src/SharpMUTerm.Core/Configuration/DisplaySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace SharpMUTerm.Core.Configuration;
/// The output is in points, because a monospace console's size is a font size (Mudlet, Windows Terminal and kitty all
/// say it that way). Every other area is a percentage of its designed size, because each is a ramp of sizes (a heading,
/// a label, a caption) that has to move together. <see cref="Zoom"/> multiplies all of them, the way a browser's does,
/// and is what Ctrl+= / Ctrl+- / Ctrl+0 and Ctrl+wheel change.
/// and is what Ctrl+= / Ctrl+- / Ctrl+Numpad 0 and Ctrl+wheel change.
/// </para>
/// </summary>
public sealed class DisplaySettings
Expand Down
Loading
Loading