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:
@@ -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) }
|
||||
|
||||
Reference in New Issue
Block a user