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 @@ -509,7 +509,11 @@ export function Prompt(props: PromptProps) {
509509 const nonTextParts = store . prompt . parts . filter ( ( p ) => p . type !== "text" )
510510
511511 const value = text
512- const content = await Editor . open ( { value, renderer } )
512+ const content = await Editor . open ( {
513+ value,
514+ renderer,
515+ cwd : project . instance . path ( ) . worktree || project . instance . directory ( ) || process . cwd ( ) ,
516+ } )
513517 if ( ! content ) return
514518
515519 input . setText ( content )
Original file line number Diff line number Diff line change @@ -965,7 +965,11 @@ export function Session() {
965965
966966 if ( options . openWithoutSaving ) {
967967 // Just open in editor without saving
968- await Editor . open ( { value : transcript , renderer } )
968+ await Editor . open ( {
969+ value : transcript ,
970+ renderer,
971+ cwd : project . instance . path ( ) . worktree || project . instance . directory ( ) || process . cwd ( ) ,
972+ } )
969973 } else {
970974 const exportDir = process . cwd ( )
971975 const filename = options . filename . trim ( )
@@ -974,7 +978,11 @@ export function Session() {
974978 await Filesystem . write ( filepath , transcript )
975979
976980 // Open with EDITOR if available
977- const result = await Editor . open ( { value : transcript , renderer } )
981+ const result = await Editor . open ( {
982+ value : transcript ,
983+ renderer,
984+ cwd : project . instance . path ( ) . worktree || project . instance . directory ( ) || process . cwd ( ) ,
985+ } )
978986 if ( result !== undefined ) {
979987 await Filesystem . write ( filepath , result )
980988 }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { CliRenderer } from "@opentui/core"
66import { Filesystem } from "@/util/filesystem"
77import { Process } from "@/util/process"
88
9- export async function open ( opts : { value : string ; renderer : CliRenderer } ) : Promise < string | undefined > {
9+ export async function open ( opts : { value : string ; renderer : CliRenderer ; cwd ?: string } ) : Promise < string | undefined > {
1010 const editor = process . env [ "VISUAL" ] || process . env [ "EDITOR" ]
1111 if ( ! editor ) return
1212
@@ -19,6 +19,7 @@ export async function open(opts: { value: string; renderer: CliRenderer }): Prom
1919 try {
2020 const parts = editor . split ( " " )
2121 const proc = Process . spawn ( [ ...parts , filepath ] , {
22+ cwd : opts . cwd ,
2223 stdin : "inherit" ,
2324 stdout : "inherit" ,
2425 stderr : "inherit" ,
You can’t perform that action at this time.
0 commit comments