fix(tui): Enter on selected session now enters session view
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).
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user