Auto stash before merge of "feature/terminal-game-engine" and "origin/feature/terminal-game-engine"
This commit is contained in:
parent
8fa11c4f00
commit
901f3e5cdc
3 changed files with 24 additions and 6 deletions
|
|
@ -16,6 +16,10 @@ class InputManager {
|
|||
this.keydownHandler = (e) => {
|
||||
if (this.mode !== "options") return;
|
||||
|
||||
// Check if terminal input has text - if so, let user submit commands like "quit"
|
||||
const terminalInput = document.getElementById("input");
|
||||
const hasInputText = terminalInput && terminalInput.value.trim().length > 0;
|
||||
|
||||
if (e.key === "ArrowUp") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
|
@ -25,10 +29,14 @@ class InputManager {
|
|||
e.stopPropagation();
|
||||
this._selectNext();
|
||||
} else if (e.key === "Enter") {
|
||||
// If user has typed something, let it through to submit the command
|
||||
if (hasInputText) return;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this._confirmSelection();
|
||||
} else if (/^[1-9]$/.test(e.key)) {
|
||||
// Only intercept if input is empty (user isn't typing a command)
|
||||
if (hasInputText) return;
|
||||
const index = parseInt(e.key) - 1;
|
||||
if (index < this.options.length) {
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -75,6 +75,11 @@ class SceneManager {
|
|||
await this._renderContent(scene.content);
|
||||
}
|
||||
|
||||
// Execute onAfterRender actions (after content, before options)
|
||||
if (scene.onAfterRender) {
|
||||
await this._executeActions(scene.onAfterRender);
|
||||
}
|
||||
|
||||
// Handle navigation
|
||||
if (scene.options) {
|
||||
await this._handleOptions(scene);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue