mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-31 13:31:39 +00:00
fix(tui): handle non-git project paths when opening editor (#29180)
This commit is contained in:
parent
cec5a752bb
commit
aa9956d46d
2 changed files with 18 additions and 3 deletions
|
|
@ -512,7 +512,12 @@ export function Prompt(props: PromptProps) {
|
|||
const content = await Editor.open({
|
||||
value,
|
||||
renderer,
|
||||
cwd: project.instance.path().worktree || project.instance.directory() || process.cwd(),
|
||||
cwd:
|
||||
(project.instance.path().worktree === "/"
|
||||
? undefined
|
||||
: project.instance.path().worktree) ||
|
||||
project.instance.directory() ||
|
||||
process.cwd(),
|
||||
})
|
||||
if (!content) return
|
||||
|
||||
|
|
|
|||
|
|
@ -968,7 +968,12 @@ export function Session() {
|
|||
await Editor.open({
|
||||
value: transcript,
|
||||
renderer,
|
||||
cwd: project.instance.path().worktree || project.instance.directory() || process.cwd(),
|
||||
cwd:
|
||||
(project.instance.path().worktree === "/"
|
||||
? undefined
|
||||
: project.instance.path().worktree) ||
|
||||
project.instance.directory() ||
|
||||
process.cwd(),
|
||||
})
|
||||
} else {
|
||||
const exportDir = process.cwd()
|
||||
|
|
@ -981,7 +986,12 @@ export function Session() {
|
|||
const result = await Editor.open({
|
||||
value: transcript,
|
||||
renderer,
|
||||
cwd: project.instance.path().worktree || project.instance.directory() || process.cwd(),
|
||||
cwd:
|
||||
(project.instance.path().worktree === "/"
|
||||
? undefined
|
||||
: project.instance.path().worktree) ||
|
||||
project.instance.directory() ||
|
||||
process.cwd(),
|
||||
})
|
||||
if (result !== undefined) {
|
||||
await Filesystem.write(filepath, result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue