Skip to content

Commit 0f5e85f

Browse files
authored
Merge pull request #57 from St0ff3l/codex/fix-initial-shell-prompt
[codex] 修复 SSH 首次连接后终端提示符被吞掉的问题
2 parents 94f3572 + 1c12b44 commit 0f5e85f

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

apps/desktop/src/main/services/sessions/shell-cwd-integration.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,10 @@ export function findSetupEchoEnd(text: string): { lineStart: number; payloadEnd:
8888
const cwd = parseOsc7Payload(match7[1] ?? '')
8989
const user = matchUser ? matchUser[1] : null
9090

91-
// Try to find the prompt printed after the command to suppress it as well
92-
const afterPayload = searchSlice.slice(payloadEnd - needleIndex)
93-
const promptMatch = /^\s*([^\r\n]*[#$%>]\s*)/.exec(afterPayload)
94-
95-
if (!promptMatch && text.length < 1024) {
96-
// Wait for the prompt to arrive in the buffer
97-
return null
98-
}
99-
100-
const finalPayloadEnd = payloadEnd + (promptMatch ? promptMatch[0].length : 0)
101-
102-
return { lineStart, payloadEnd: finalPayloadEnd, cwd, user }
91+
// Keep the real shell prompt visible. We only suppress the injected setup
92+
// command echo and its OSC payload, so the prompt printed after execution can
93+
// render naturally on first connect and later silent refreshes.
94+
return { lineStart, payloadEnd, cwd, user }
10395
}
10496

10597
function parseOsc7Payload(payload: string): string | null {

0 commit comments

Comments
 (0)