Always prefix digit shortcuts in Read-Menu#15
Merged
Conversation
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").
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Verification