mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-21 18:26:09 +00:00
fix(tui): exit composer picker with up arrow (#37601)
This commit is contained in:
@@ -22,6 +22,7 @@ interface Tab {
|
||||
const ComposerContext = createContext<{
|
||||
register: (tab: Tab) => () => void
|
||||
active: (id: string) => boolean
|
||||
close: () => void
|
||||
}>()
|
||||
|
||||
export function useComposerTab() {
|
||||
@@ -73,6 +74,7 @@ export function Composer(props: ComposerProps) {
|
||||
active(id: string) {
|
||||
return props.open && store.active === id
|
||||
},
|
||||
close,
|
||||
}
|
||||
|
||||
const keymap = Keymap.use()
|
||||
|
||||
@@ -59,9 +59,11 @@ export function ShellTab(props: { sessionID: string }) {
|
||||
group: "Composer",
|
||||
bind: "up",
|
||||
run() {
|
||||
const list = entries()
|
||||
if (list.length === 0) return
|
||||
setStore("selected", (prev) => (prev - 1 + list.length) % list.length)
|
||||
if (store.selected === 0) {
|
||||
composer.close()
|
||||
return
|
||||
}
|
||||
setStore("selected", (prev) => prev - 1)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -160,9 +160,11 @@ export function SubagentsTab(props: { sessionID: string }) {
|
||||
group: "Composer",
|
||||
bind: "up",
|
||||
run() {
|
||||
const list = entries()
|
||||
if (list.length === 0) return
|
||||
moveTo((store.selected - 1 + list.length) % list.length, true)
|
||||
if (store.selected === 0) {
|
||||
composer.close()
|
||||
return
|
||||
}
|
||||
moveTo(store.selected - 1, true)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user