fix(menu): a text field keeps the keyboard's Insert, so Shift+Insert pastes and Insert does not close the menu #3139

Merged
HumanBean merged 2 commits from cuecuemoar/Longshot:fix/insert-menu-text-field into main 2026-12-04 01:10:31 +00:00
Contributor

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.cpp menu_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 onto 309af878f applied 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. On main a98cf28a2 (the same code here as 6318f4056) 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 on main (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/main on this head: 60 passed, 0 failed, 12 skipped.
  • Linux (WSL, Ubuntu 22.04) on this head 0e7b3e227 against 309af878f: scripts/check_host_compile.py 83 units, 0 failed both; the checks that read vk_menu.cpp 63/0 both; the whole suite --strict 834 passed, 44 failed, 12 skipped on both, the same 44 files (they fail on main in this WSL).
  • A cold review by a second agent (the diff and the test): nothing blocking; its point about the queued path's cases is in the test.

Still to test:

  • A pad with back buttons (GL/GR): Controller menu button at Back left, typing in Custom output size, press GL, expecting the menu to close (by hand; nobody here has such a pad. GL/GR set the same press as Home, which closed it).

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

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01VxeaZhJagFoksx8Zpm38Wc

## 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.cpp` `menu_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 onto 309af878f applied 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. On `main` a98cf28a2 (the same code here as 6318f4056) 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 on `main` (`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/main` on this head: 60 passed, 0 failed, 12 skipped. - Linux (WSL, Ubuntu 22.04) on this head 0e7b3e227 against 309af878f: `scripts/check_host_compile.py` 83 units, 0 failed both; the checks that read `vk_menu.cpp` 63/0 both; the whole suite `--strict` 834 passed, 44 failed, 12 skipped on both, the same 44 files (they fail on `main` in this WSL). - A cold review by a second agent (the diff and the test): nothing blocking; its point about the queued path's cases is in the test. **Still to test:** - A pad with back buttons (GL/GR): Controller menu button at Back left, typing in Custom output size, press GL, expecting the menu to close (by hand; nobody here has such a pad. GL/GR set the same press as Home, which closed it). ## 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 - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. πŸ€– Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VxeaZhJagFoksx8Zpm38Wc
Co-Authored-By: Claude Opus 5.5 <[email protected]>

Claude-Session: https://claude.ai/code/session_01VxeaZhJagFoksx8Zpm38Wc
fix(menu): a text field keeps the keyboard's Insert, so Shift+Insert pastes and Insert does not close the menu (#3129)
Some checks are pending
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 5s
0e7b3e227c
Co-Authored-By: Claude Opus 5.5 <[email protected]>

Claude-Session: https://claude.ai/code/session_01VxeaZhJagFoksx8Zpm38Wc
Author
Contributor

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 a98cf28a2 at the same spot Insert and Shift+Insert closed the menu.

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 a98cf28a2 at the same spot Insert and Shift+Insert closed the menu.
Member

Possibly related, for context:

  • PR #3134 WIP: feat(menu): Steam's on-screen keyboard for text fields on a Steam Deck and in Big Picture β€” Nearby text-field keyboard ownership work may overlap the same menu input path.
Possibly related, for context: - PR #3134 WIP: feat(menu): Steam's on-screen keyboard for text fields on a Steam Deck and in Big Picture β€” Nearby text-field keyboard ownership work may overlap the same menu input path.
cuecuemoar changed title from WIP: fix(menu): a text field keeps the keyboard's Insert, so Shift+Insert pastes and Insert does not close the menu to fix(menu): a text field keeps the keyboard's Insert, so Shift+Insert pastes and Insert does not close the menu 2026-12-04 00:44:56 +00:00
Owner
@review
BeanBot left a comment

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: 0e7b3e227c against 309af878f1: 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:

  • The queued Insert is consumed before the guard, and controller menu presses are added afterward.
  • The added test exercises the guard on queued and polled paths and checks the other menu shortcuts.
  • Both commits include AI assistance trailers; no generated or game-derived files are changed.

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.

**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. <details> <summary>More: does it help, other systems, switches, what was read</summary> **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:** 0e7b3e227cdf against 309af878f162: 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:** - The queued Insert is consumed before the guard, and controller menu presses are added afterward. - The added test exercises the guard on queued and polled paths and checks the other menu shortcuts. - Both commits include AI assistance trailers; no generated or game-derived files are changed. **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. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch fix/insert-menu-text-field 2026-12-04 01:10:32 +00:00
Some checks are pending
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 5s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3139
No description provided.