This repository was archived by the owner on Apr 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd/tui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,10 +41,10 @@ function init() {
4141 } )
4242
4343 const result = {
44- trigger ( name : string ) {
44+ trigger ( name : string , source ?: "prompt" ) {
4545 for ( const option of options ( ) ) {
4646 if ( option . value === name ) {
47- option . onSelect ?.( dialog )
47+ option . onSelect ?.( dialog , source )
4848 return
4949 }
5050 }
Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ export function Autocomplete(props: {
263263 {
264264 display : "/editor" ,
265265 description : "open editor" ,
266- onSelect : ( ) => command . trigger ( "prompt.editor" ) ,
266+ onSelect : ( ) => command . trigger ( "prompt.editor" , "prompt" ) ,
267267 } ,
268268 {
269269 display : "/help" ,
Original file line number Diff line number Diff line change @@ -98,14 +98,9 @@ export function Prompt(props: PromptProps) {
9898 category : "Session" ,
9999 keybind : "editor_open" ,
100100 value : "prompt.editor" ,
101- onSelect : async ( dialog ) => {
101+ onSelect : async ( dialog , trigger ) => {
102102 dialog . clear ( )
103- const value = input . plainText
104- input . clear ( )
105- setStore ( "prompt" , {
106- input : "" ,
107- parts : [ ] ,
108- } )
103+ const value = trigger === "prompt" ? "" : input . plainText
109104 const content = await Editor . open ( { value, renderer } )
110105 if ( content ) {
111106 input . setText ( content , { history : false } )
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export interface DialogSelectOption<T = any> {
3535 category ?: string
3636 disabled ?: boolean
3737 bg ?: RGBA
38- onSelect ?: ( ctx : DialogContext ) => void
38+ onSelect ?: ( ctx : DialogContext , trigger ?: "prompt" ) => void
3939}
4040
4141export type DialogSelectRef < T > = {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export namespace Editor {
2424 } )
2525 await proc . exited
2626 const content = await Bun . file ( filepath ) . text ( )
27+ opts . renderer . currentRenderBuffer . clear ( )
2728 opts . renderer . resume ( )
2829 opts . renderer . requestRender ( )
2930 return content || undefined
You can’t perform that action at this time.
0 commit comments