From 6770e3bf0a9d74b90213bf5a79e6009e097b8480 Mon Sep 17 00:00:00 2001 From: kami Date: Tue, 26 May 2026 13:13:57 +0400 Subject: [PATCH] fix(tui): Enter on selected session now enters session view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KeyResolver was swallowing Enter in IDLE state when input text was blank, so SubmitInput never reached RootReducer to set sessionEntered=true. Now Enter always dispatches SubmitInput in IDLE — RootReducer handles blank text by entering the selected session, non-blank by starting a new session (as before). IN_SESSION and FILTER mode unchanged (blank Enter still returns null there). --- .../src/main/kotlin/com/correx/apps/tui/input/KeyResolver.kt | 2 +- .../test/kotlin/com/correx/apps/tui/input/KeyResolverTest.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/tui/src/main/kotlin/com/correx/apps/tui/input/KeyResolver.kt b/apps/tui/src/main/kotlin/com/correx/apps/tui/input/KeyResolver.kt index c7e56418..7f0c4082 100644 --- a/apps/tui/src/main/kotlin/com/correx/apps/tui/input/KeyResolver.kt +++ b/apps/tui/src/main/kotlin/com/correx/apps/tui/input/KeyResolver.kt @@ -40,7 +40,7 @@ object KeyResolver { DisplayState.IDLE -> when (key) { KeyEvent.NavUp -> Action.NavigateUp KeyEvent.NavDown -> Action.NavigateDown - KeyEvent.Enter -> if (inputText.isBlank()) null else Action.SubmitInput + KeyEvent.Enter -> Action.SubmitInput KeyEvent.Tab -> Action.CycleMode KeyEvent.Backspace -> Action.Backspace KeyEvent.NewSession -> Action.OpenNewSessionPrompt diff --git a/apps/tui/src/test/kotlin/com/correx/apps/tui/input/KeyResolverTest.kt b/apps/tui/src/test/kotlin/com/correx/apps/tui/input/KeyResolverTest.kt index 8abde7f3..ed0742c1 100644 --- a/apps/tui/src/test/kotlin/com/correx/apps/tui/input/KeyResolverTest.kt +++ b/apps/tui/src/test/kotlin/com/correx/apps/tui/input/KeyResolverTest.kt @@ -94,8 +94,8 @@ class KeyResolverTest { } @Test - fun `Enter in IDLE on blank input resolves to null`() { - assertNull(resolve(KeyEvent.Enter, DisplayState.IDLE)) + fun `Enter in IDLE on blank input resolves to SubmitInput`() { + assertEquals(Action.SubmitInput, resolve(KeyEvent.Enter, DisplayState.IDLE)) } @Test