Don't hardcode help text: Zones Manager #79286
Merged
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.
Summary
SUMMARY: Interface "Don't hardcode help text: Zones Manager"
Purpose of change
Help text should not be hardcoded as, if end user changes their keybinds, it will cause discrepancies in the UI.
This PR targets the Zone Manager window and partially addresses #78986
Describe the solution
Rewrite
zones_manager_shortcuts
to pull the currently set keybind for each command, and display the help text in window using a simple loop.Describe alternatives you've considered
I've found in the codebase many bespoke approaches to displaying help text... I ended up using the Crafting window as a reference, because it can place the key inside the name of the help text. It also wraps nicely. I simplified and cleaned up the code when implementing it for Zone Manager window.
Currently
Show all / Hide distant
is the help text forSHOW_ALL_ZONES
, and it highlights the respective text in yellow for the toggle. Too convoluted for what it's worth, in my opinion, when the game can communicate this information using just one extra line of code.Testing
Game compiles and loads.
Open Zone Manager window, all help text appear correctly in the help text area.
Toggle
SHOW_ALL_ZONES
and observe that the help text automatically updates to text to showShowing all zones
orHiding distant zones
, respectively.Change keybind for
ADD_ZONE
and observe that the help text automatically updates the text.Additional context
There is a minor bug in which
MOVE_ZONE_UP
andMOVE_ZONE_DOWN
is reversed. i.e., Pressing the key to move a zone down, will instead move it up, and vice versa. While this is a bit out of scope, I fixed it.The Zone Manager window is always the same width, regardless of terminal size, so creating solution and testing was relatively simple.
Screenshots
The zones are far right now, so they aren't appearing in the list
After pressing
s
to toggleSHOW_ALL_ZONES
. The zones now appear and the help text updated accordingly.After I changed the keybind for "Add" to
o