fix(tui): exit composer picker with up arrow (#37601)

This commit is contained in:
Aiden Cline 2026-07-17 22:22:00 -05:00 committed by GitHub
commit 08a7080e11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 6 deletions

View file

@ -22,6 +22,7 @@ interface Tab {
const ComposerContext = createContext<{ const ComposerContext = createContext<{
register: (tab: Tab) => () => void register: (tab: Tab) => () => void
active: (id: string) => boolean active: (id: string) => boolean
close: () => void
}>() }>()
export function useComposerTab() { export function useComposerTab() {
@ -73,6 +74,7 @@ export function Composer(props: ComposerProps) {
active(id: string) { active(id: string) {
return props.open && store.active === id return props.open && store.active === id
}, },
close,
} }
const keymap = Keymap.use() const keymap = Keymap.use()

View file

@ -59,9 +59,11 @@ export function ShellTab(props: { sessionID: string }) {
group: "Composer", group: "Composer",
bind: "up", bind: "up",
run() { run() {
const list = entries() if (store.selected === 0) {
if (list.length === 0) return composer.close()
setStore("selected", (prev) => (prev - 1 + list.length) % list.length) return
}
setStore("selected", (prev) => prev - 1)
}, },
}, },
{ {

View file

@ -160,9 +160,11 @@ export function SubagentsTab(props: { sessionID: string }) {
group: "Composer", group: "Composer",
bind: "up", bind: "up",
run() { run() {
const list = entries() if (store.selected === 0) {
if (list.length === 0) return composer.close()
moveTo((store.selected - 1 + list.length) % list.length, true) return
}
moveTo(store.selected - 1, true)
}, },
}, },
{ {