mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
tui: let users exit shell mode with escape key in addition to backspace at position 0
This commit is contained in:
parent
2c16a77862
commit
b42d1022a7
1 changed files with 7 additions and 4 deletions
|
|
@ -110,6 +110,7 @@ export function Prompt(props: PromptProps) {
|
|||
command: input,
|
||||
},
|
||||
})
|
||||
setStore("mode", "normal")
|
||||
} else if (input.startsWith("/")) {
|
||||
const [command, ...args] = input.split(" ")
|
||||
sdk.session.command({
|
||||
|
|
@ -230,10 +231,12 @@ export function Prompt(props: PromptProps) {
|
|||
e.preventDefault()
|
||||
return
|
||||
}
|
||||
if (e.name === "backspace" && input.cursorPosition === 0 && store.mode === "shell") {
|
||||
setStore("mode", "normal")
|
||||
e.preventDefault()
|
||||
return
|
||||
if (store.mode === "shell") {
|
||||
if ((e.name === "backspace" && input.cursorPosition === 0) || e.name === "escape") {
|
||||
setStore("mode", "normal")
|
||||
e.preventDefault()
|
||||
return
|
||||
}
|
||||
}
|
||||
if (store.mode === "normal") autocomplete.onKeyDown(e)
|
||||
if (!autocomplete.visible) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue