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({
|
const content = await Editor.open({
|
||||||
value,
|
value,
|
||||||
renderer,
|
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
|
if (!content) return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -968,7 +968,12 @@ export function Session() {
|
||||||
await Editor.open({
|
await Editor.open({
|
||||||
value: transcript,
|
value: transcript,
|
||||||
renderer,
|
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 {
|
} else {
|
||||||
const exportDir = process.cwd()
|
const exportDir = process.cwd()
|
||||||
|
|
@ -981,7 +986,12 @@ export function Session() {
|
||||||
const result = await Editor.open({
|
const result = await Editor.open({
|
||||||
value: transcript,
|
value: transcript,
|
||||||
renderer,
|
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) {
|
if (result !== undefined) {
|
||||||
await Filesystem.write(filepath, result)
|
await Filesystem.write(filepath, result)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue