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) {
|
DisplayState.IDLE -> when (key) {
|
||||||
KeyEvent.NavUp -> Action.NavigateUp
|
KeyEvent.NavUp -> Action.NavigateUp
|
||||||
KeyEvent.NavDown -> Action.NavigateDown
|
KeyEvent.NavDown -> Action.NavigateDown
|
||||||
KeyEvent.Enter -> if (inputText.isBlank()) null else Action.SubmitInput
|
KeyEvent.Enter -> Action.SubmitInput
|
||||||
KeyEvent.Tab -> Action.CycleMode
|
KeyEvent.Tab -> Action.CycleMode
|
||||||
KeyEvent.Backspace -> Action.Backspace
|
KeyEvent.Backspace -> Action.Backspace
|
||||||
KeyEvent.NewSession -> Action.OpenNewSessionPrompt
|
KeyEvent.NewSession -> Action.OpenNewSessionPrompt
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ class KeyResolverTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Enter in IDLE on blank input resolves to null`() {
|
fun `Enter in IDLE on blank input resolves to SubmitInput`() {
|
||||||
assertNull(resolve(KeyEvent.Enter, DisplayState.IDLE))
|
assertEquals(Action.SubmitInput, resolve(KeyEvent.Enter, DisplayState.IDLE))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user