Game: Insert and Shift+Insert close the Insert menu while a text field is edited #3129

Closed
opened 2026-12-03 22:37:13 +00:00 by cuecuemoar · 1 comment
Contributor

What happened

While one of the Insert menu's text fields is being typed in (for example Graphics → Custom output size), pressing the keyboard's Insert closes the menu, and Shift+Insert closes the menu instead of pasting. Esc ends the edit and leaves the menu open, as it should.

Seen in the game on main a98cf28a2 (the files below are unchanged up to 6318f4056), Windows 10, keyboard.

Why

Before the mod API merge (d984fd704), menu_tick kept Insert for the field while one was edited:

if (editing && press[0] && !(pad(HOS_PAD_GUIDE) || chord_now)) press[0] = false;   // (Insert is the field's: Shift+Insert pastes)

The merge moved text fields to the Rust UI and took this line out with the old editing code. Now press[0] closes the menu at gpu/vk/vk_menu.cpp:1632-1634 whatever is focused. The paste itself still works end to end (host/display.c:803 Shift+Insert/Ctrl+V → hos_text_paste → vk_ui.cpp take_text → the field), so only the menu's close is in the way. Nothing in the merge's description or comments says the change was meant.

A likely fix

Clear the keyboard's press[0] while ui_owns_text() (gpu/vk/vk_ui.cpp:539, true while a field has the text), still letting F1, Select + Start and the Controller menu button close the menu (that keeps #3028 fixed), with a case in tests/test_menu_keys.py or tests/test_menu_text_field.py.

### What happened While one of the Insert menu's text fields is being typed in (for example **Graphics → Custom output size**), pressing the keyboard's **Insert** closes the menu, and **Shift+Insert** closes the menu instead of pasting. Esc ends the edit and leaves the menu open, as it should. Seen in the game on main a98cf28a2 (the files below are unchanged up to 6318f4056), Windows 10, keyboard. ### Why Before the mod API merge (d984fd704), `menu_tick` kept Insert for the field while one was edited: ```cpp if (editing && press[0] && !(pad(HOS_PAD_GUIDE) || chord_now)) press[0] = false; // (Insert is the field's: Shift+Insert pastes) ``` The merge moved text fields to the Rust UI and took this line out with the old editing code. Now `press[0]` closes the menu at `gpu/vk/vk_menu.cpp:1632-1634` whatever is focused. The paste itself still works end to end (`host/display.c:803` Shift+Insert/Ctrl+V → `hos_text_paste` → `vk_ui.cpp` `take_text` → the field), so only the menu's close is in the way. Nothing in the merge's description or comments says the change was meant. ### A likely fix Clear the keyboard's `press[0]` while `ui_owns_text()` (`gpu/vk/vk_ui.cpp:539`, true while a field has the text), still letting F1, Select + Start and the Controller menu button close the menu (that keeps #3028 fixed), with a case in `tests/test_menu_keys.py` or `tests/test_menu_text_field.py`.
Member

Checked: this looks like a valid bug, and its cause is visible in the code.

With the Insert shortcut enabled, the menu handles Insert as a close request even while a text field owns input. On Windows, Shift+Insert also queues a paste, but the same key press can close the menu. The previous editing-time exemption was removed in the mod API merge. I did not run the game or verify the reported Esc behavior.


For maintainers

Issue #3028's history explicitly describes the mod API merge removing the editing-time Insert exemption and identifies keyboard Insert as a separate interaction. Current main code search shows ui_owns_text() in gpu/vk/vk_menu.cpp text-taking logic and its definition in gpu/vk/vk_ui.cpp:539; this report supplies the target close logic at gpu/vk/vk_menu.cpp:1632-1634.

The likely regression is the removal of the editing-time exemption in d984fd704. Preserve the controller close paths when handling keyboard Insert; both currently share press[0]. The paste path is conditional on the keyboard input policy.

Seen in the code:

  • gpu/vk/vk_menu.cpp:1436 — Insert is keys[0]; lines 1457–1469 record its press when the shortcut is enabled.
  • gpu/vk/vk_menu.cpp:1630 — Except when a close is held or the comparison view intercepts it, press[0] toggles the menu without checking text ownership.
  • host/display.c:790 — Windows queues Insert as a menu key; lines 806–809 also send Shift+Insert to clipboard paste when a text field has focus and keyboard input counts.
  • gpu/vk/vk_ui.cpp:539 — ui_owns_text() reports the UI text-ownership flag; lines 701–710 take text for the field.
  • gpu/vk/vk_menu.cpp:1501 — The controller menu button and Select+Start also set press[0], so they must be distinguished from keyboard Insert.
  • gpu/vk/vk_menu.cpp:1564 — Commit d984fd704 removed the old editing-time Insert exemption at this point, as shown by git show; there are no changes to the three relevant files between a98cf28a2 and HEAD.

Possibly related, for context:

  • issue #3028 Game: with Controller menu button at GL or GR, the back button does not close the menu while a text field is edited — Related text-field/menu close-key interaction; this report concerns keyboard Insert and paste instead of controller back buttons.

Automated triage by BeanBot (gpt-6-luna). Nothing was run; a maintainer decides.

**Checked: this looks like a valid bug**, and its cause is visible in the code. With the Insert shortcut enabled, the menu handles Insert as a close request even while a text field owns input. On Windows, Shift+Insert also queues a paste, but the same key press can close the menu. The previous editing-time exemption was removed in the mod API merge. I did not run the game or verify the reported Esc behavior. --- **For maintainers** Issue #3028's history explicitly describes the mod API merge removing the editing-time Insert exemption and identifies keyboard Insert as a separate interaction. Current main code search shows `ui_owns_text()` in `gpu/vk/vk_menu.cpp` text-taking logic and its definition in `gpu/vk/vk_ui.cpp:539`; this report supplies the target close logic at `gpu/vk/vk_menu.cpp:1632-1634`. The likely regression is the removal of the editing-time exemption in d984fd704. Preserve the controller close paths when handling keyboard Insert; both currently share `press[0]`. The paste path is conditional on the keyboard input policy. Seen in the code: - gpu/vk/vk_menu.cpp:1436 — Insert is `keys[0]`; lines 1457–1469 record its press when the shortcut is enabled. - gpu/vk/vk_menu.cpp:1630 — Except when a close is held or the comparison view intercepts it, `press[0]` toggles the menu without checking text ownership. - host/display.c:790 — Windows queues Insert as a menu key; lines 806–809 also send Shift+Insert to clipboard paste when a text field has focus and keyboard input counts. - gpu/vk/vk_ui.cpp:539 — `ui_owns_text()` reports the UI text-ownership flag; lines 701–710 take text for the field. - gpu/vk/vk_menu.cpp:1501 — The controller menu button and Select+Start also set `press[0]`, so they must be distinguished from keyboard Insert. - gpu/vk/vk_menu.cpp:1564 — Commit d984fd704 removed the old editing-time Insert exemption at this point, as shown by `git show`; there are no changes to the three relevant files between a98cf28a2 and HEAD. --- Possibly related, for context: - issue #3028 Game: with Controller menu button at GL or GR, the back button does not close the menu while a text field is edited — Related text-field/menu close-key interaction; this report concerns keyboard Insert and paste instead of controller back buttons. --- <sub>Automated triage by BeanBot (gpt-6-luna). Nothing was run; a maintainer decides.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
2 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#3129
No description provided.