fix: make press-only widget actions reachable from mouse-button binds#8168
Open
Arcadiyyyyyyyy wants to merge 1 commit into
Open
fix: make press-only widget actions reachable from mouse-button binds#8168Arcadiyyyyyyyy wants to merge 1 commit into
Arcadiyyyyyyyy wants to merge 1 commit into
Conversation
Audit follow-up to beyond-all-reason#7952. Mouse-button binds dispatch through the text path (actionHandler:TextAction -> textActions), so actions registered press-only ("p") are silently dropped when bound to a mouse button. Convert 30 one-shot press actions across 14 widgets from "p" to "pt" so they are reachable from both keyboard and mouse-button binds. Hold-to- activate actions that pair a "p" press with an "r" release (e.g. buildsplit, selectbox, selectloop, stateprefs_record/clear) are left as "p" on purpose: a text/mouse bind cannot fire the release, which would leave their modifier stuck. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5 tasks
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.
Work done
Follow-up to #7952, which fixed the
chainaction and flipped itsregistration from
"p"to"pt"so it could be triggered from mouse-buttonbinds. Reviewer feedback on that PR asked for a separate PR to audit the
other cases where the same
"p"→"pt"change is appropriate. This is thataudit.
Background. Widget actions are registered with
actionHandler:AddAction(self, name, fn, data, types),where
typesselects the dispatch sets the action lives in:"p"(key-press) →keyPressActions, reached by keyboard binds viaactionHandler:KeyAction."t"(text) →textActions, reached by mouse-button binds and the console viaactionHandler:TextAction.An action registered
"p"-only is invisible to the text path, so binding it toa mouse button silently does nothing. On the text path the handler is invoked
exactly like a press (
isRepeat = false,release = nil), so making a one-shotpress action
"pt"is safe and simply extends it to mouse binds and the console.Change. Converted 30 one-shot press actions across 14 widgets from
"p"to
"pt":camera_flipcameraflipcmd_blueprintblueprint_create,blueprint_next,blueprint_prev,blueprint_delete,buildfacing,buildspacingcmd_commandq_managercommand_skip_current,command_cancel_lastcmd_comselectselectcommcmd_onoffonoffcmd_factoryqmanagerfactory_presetgui_attackrange_gl4cursor_range_toggle,attack_range_inc,attack_range_decgui_teamstatsteamstatus_closeminimap_rotation_managerminimap_rotategui_gridmenugridmenu_category,gridmenu_next_page,gridmenu_cycle_buildergui_pregame_buildstop,buildfacing,buildspacing,buildmenu_pregame_deselectunit_auto_groupadd_to_autogroup,remove_from_autogroup,remove_one_unit_from_group,load_autogroup_presetunit_key_selectselectunit_stateprefsstateprefs_clearunitDeliberately left as
"p"(hold-to-activate). Every action that registers a"p"press paired with an"r"release — the modifier is set true on press andfalse on release — is not converted. A mouse/text bind cannot fire the
release, so adding
"t"would leave the modifier stuck on. These are:buildsplit,commandinsert,factory_preset_show,reclaim_highlight,unit_stats,selectloop/selectloop_deselect/selectloop_add,selectbox/selectbox_<modifier>,stateprefs_record,stateprefs_clear.(Note
stateprefs_clearunitis converted — it is one-shot and has no pairedrelease, unlike its siblings.)
No handler logic changed; only the
typesstring on theAddActioncalls.Addresses Issue(s)
Test steps
1. Widget load / no errors (all conversions)
infolog.txt. All converted widgets that areenabled by default (CameraFlip, TeamStats, Attack Range GL4, Commander
Selector, Onoff, Minimap Rotation Manager, Grid menu, Auto Group, Blueprint,
Command Queue Manager, Pregame Queue, State Prefs V2) loaded cleanly with no
error following their load line. A bad
typesstring would throw duringwidget:Initialize()— none did. (cmd_factoryqmanagerandunit_key_selectare disabled by default and were not loaded; their change is inert until
enabled.)
2. Mouse-button bind now works (the fix)
/bind mouse5 cameraflipin the console, then press mouse5 → cameraflips 180°. On
masterthe identical bind does nothing. This before/afterdifference confirms the fix.
bind (e.g.
/bind mouse4 attack_range_inccycles the range display;/bind mouse5 minimap_rotatesteps minimap rotation) — all now respond to themouse button.
3. Keyboard binds still work (regression)
change — no double-dispatch, no change in keyboard behaviour.
4. Hold-to-activate actions untouched (regression)
buildsplit, kept"p") still activates onkeyboard hold and releases cleanly — no stuck modifier. Confirmed none of the
paired press/release actions were converted.
AI / LLM usage statement:
The audit and code changes were produced with Claude (Opus 4.8); the human
contribution was identifying the follow-up scope, reviewing each candidate, and
validating the fixes in-game.