Skip to content

Always prefix digit shortcuts in Read-Menu#15

Merged
bryanroscoe merged 1 commit into
mainfrom
fix/menu-digit-shortcut-prefix
May 8, 2026
Merged

Always prefix digit shortcuts in Read-Menu#15
bryanroscoe merged 1 commit into
mainfrom
fix/menu-digit-shortcut-prefix

Conversation

@bryanroscoe
Copy link
Copy Markdown
Owner

Fixes a visual inconsistency in the device-list menu (and any other menu using digit shortcuts) where the keystroke indicator could land inside an IP octet.

For row N with shortcut digit `N`, the previous logic searched the option text for the first occurrence of `N` and bracketed it inline. For an IP like `192.168.42.196` with shortcut `2`, that produced `19[2].168.42.196` — bracketing an arbitrary octet character. If the digit didn't appear at all (e.g. shortcut `3` against `192.168.42.25`), the code fell back to a clean `[3] ` prefix, so different rows of the same menu rendered inconsistently.

This change skips the inline search whenever the shortcut is a digit and always uses the prefix form. Letter shortcuts (`[S]can`, `[C]onnect`, etc.) keep the inline behavior since callers pick those characters to line up with meaningful content.

Side effects

  • AT4K Launcher option (shortcut `4`) goes from `AT[4]K Launcher` to `[4] AT4K Launcher`.
  • Process-limit options (`At Most 1`, `At Most 2`, …) go from `At Most [1]` to `[1] At Most 1`. Slightly redundant text, but consistent.

Verification

  • `make lint` — Syntax OK
  • `make test` — 97 passed / 4 skipped / 0 failed
  • Visual behavior on a real device not exercised; logic-only change to display string assembly.

Inlining a digit shortcut inside option text that contains other digits
(IP addresses being the obvious case) made it impossible to tell which
digit was the keystroke and which was content. The first matching digit
won — so a row with shortcut "2" and text "192.168.42.196" would render
as "19[2].168.42.196", highlighting an arbitrary octet character.

Skip the inline search entirely when the shortcut is a digit; fall
through to the existing "[N] <text>" prefix form. Letter shortcuts
keep the inline behavior since they're chosen to match meaningful
content (e.g. "[S]can Network").
@bryanroscoe bryanroscoe merged commit 10127c2 into main May 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant