Fix soft-keyboard level advance behavior

- Keep terminal focus without explicitly reopening the software keyboard after command field recreation.
- Preserve submitted-command IME echo suppression when advancing to the next level.
- Recreate the terminal input field when loading a level so stale editor state is discarded.
This commit is contained in:
Joe Tretter
2026-05-13 15:05:02 -05:00
parent e8bcf660d9
commit 61951408de
3 changed files with 13 additions and 13 deletions

View File

@@ -211,13 +211,19 @@ fun GitHugApp() {
applyRecommendedPaneWeights(persist = false)
}
fun loadLevel(index: Int, message: List<String> = listOf("Loaded level: ${levels[index].title}")) {
fun loadLevel(
index: Int,
message: List<String> = listOf("Loaded level: ${levels[index].title}"),
keepSuppressedImeEcho: Boolean = false,
) {
AppLog.d("GitHugApp", "Loading level index=$index id=${levels[index].id} title=${levels[index].title}")
currentLevelIndex = index
repo = runtime.prepareLevel(levels[index])
output = message
clearCommandInput()
suppressedImeEcho = null
clearCommandInput(recreateField = true)
if (!keepSuppressedImeEcho) {
suppressedImeEcho = null
}
hintIndex = 0
activeExerciseDetail = null
visibleHint = null
@@ -327,7 +333,7 @@ fun GitHugApp() {
"Level solved ${levelForResult.id}; advancing to next incomplete index=$nextLevelIndex id=$nextLevelId",
)
scope.launch { persistProgress(updatedCompletedLevels, nextLevelId) }
loadLevel(nextLevelIndex, message = emptyList())
loadLevel(nextLevelIndex, message = emptyList(), keepSuppressedImeEcho = true)
} else {
AppLog.d("GitHugApp", "All levels completed")
scope.launch { persistProgress(updatedCompletedLevels, levels.lastOrNull()?.id) }