fix(menu): a text field keeps the keyboard's Insert, so Shift+Insert pastes and Insert does not close the menu #3139
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3139
Loadingβ¦
Reference in a new issue
No description provided.
Delete branch "cuecuemoar/Longshot:fix/insert-menu-text-field"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
While one of the Insert menu's text fields is being typed in (Graphics β Custom output size, for example), the keyboard's Insert closes the menu, and Shift+Insert closes it instead of pasting. On
main: open the menu, start typing in Custom output size, press Insert: the menu closes.The mod API merge (
d984fd704) moved the text fields to the Rust UI and took out, with the old editing code,menu_tick's line that kept Insert for the field. This puts that rule back for the new fields: while a UI text field has the keyboard (ui_owns_text()), the keyboard's Insert neither opens nor closes the menu, so Shift+Insert pastes. F1, the Controller menu button (Home, GL, GR), Select + Start and the touchpad still close the menu while a field is typed in, so #3028 stays fixed.Read first:
gpu/vk/vk_menu.cppmenu_tick, the one guard after the keyboard poll (:1470-1474). The refused press is still drained from the queue, so it does not fire when the edit ends.Fixes #3129
Testing
Tested: Windows 10, RTX 4090, driver 617.42, keyboard and an Xbox-style pad, a runtime of 4d2e9e307 (the same game code as this head
0e7b3e227: since then only the guard's comment and the test changed, and the rebase onto309af878fapplied both commits unchanged, with main's code around the guard byte-identical). Controller menu button at Home, typing in Graphics β Custom output size: Insert leaves the menu open and the text as typed; Shift+Insert pastes; Guide closes the menu; with no field edited, Insert opens and closes the menu as before. Onmaina98cf28a2(the same code here as6318f4056) Insert and Shift+Insert closed the menu at the same spot.Checks:
tests/test_keyboard_menu_option.py, new cases (polled and queued paths; Insert, Shift+Insert, F1, Home/GL/GR, Select + Start, Insert with no field): fails onmain(FAIL: the keyboard's Insert closed the menu while a text field had the keyboard (45)) and passes here, with g++ and clang++. With the guard removed, or guarding every key on the queued path, it fails again.tests/run_all.py --changed origin/mainon this head: 60 passed, 0 failed, 12 skipped.0e7b3e227against309af878f:scripts/check_host_compile.py83 units, 0 failed both; the checks that readvk_menu.cpp63/0 both; the whole suite--strict834 passed, 44 failed, 12 skipped on both, the same 44 files (they fail onmainin this WSL).Still to test:
Measurements
Nothing to measure: one comparison per menu tick on a key press, no frame-time path.
Risks
Insert no longer opens the menu while a mod window's or the in-play debug page's text field has the keyboard (
ui_owns_text()covers every UI field); F1 and the pad still do. A revert is enough. Nothing changes in saves or settings.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.π€ Generated with Claude Code
https://claude.ai/code/session_01VxeaZhJagFoksx8Zpm38Wc
Tested in game: Windows 10, RTX 4090, driver 617.42, keyboard + Xbox-style pad, runtime of 4d2e9e307 (same game code as this head). Insert menu, Graphics > Custom output size, typing in its field: Insert leaves the menu open with the text as typed; Shift+Insert pastes; Guide (Controller menu button at Home) closes the menu; with no field edited, Insert opens and closes the menu as before. On main
a98cf28a2at the same spot Insert and Shift+Insert closed the menu.Possibly related, for context:
WIP: fix(menu): a text field keeps the keyboard's Insert, so Shift+Insert pastes and Insert does not close the menuto fix(menu): a text field keeps the keyboard's Insert, so Shift+Insert pastes and Insert does not close the menu@review
Recommendation: Approve. The reported Windows run shows that Insert and Shift+Insert now behave correctly in the tested field, and the guard leaves controller presses on their existing path. The head CI checks are still pending. Nothing blocking is left. Recommend approval; not approved on the forge.
The change keeps keyboard Insert from toggling the menu while a UI text field owns text input, allowing Shift+Insert to paste. It adds a small guard and extends the existing game-free input test.
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes: the author reports that Insert and Shift+Insert closed the menu on main, while on the tested Windows runtime Insert left it open and Shift+Insert pasted. This is a correctness fix, not a performance change.
Other systems: The guard also applies to mod windows and the in-play debug page, where Insert cannot open the menu while a field owns text; the description names that tradeoff. F1 and controller presses are added separately after the guard. Windows paste was tested in game; Linux and controller back buttons have code and fixture coverage but no reported in-game run.
Switches: None added, changed, or removed.
Reviewed:
0e7b3e227cagainst309af878f1: Read the diff, commit messages, repository rules, PR template, test_keyboard_menu_option.py, menu_tick and the relevant UI input and host paste paths. Skimmed the remainder of vk_menu.cpp and the existing text-field test. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run, as requested. The author reports a successful Windows in-game comparison and game-free checks; all listed head CI checks are still running.
Overlaps and merge order: Not checked; the network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.