Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ui-tui/src/__tests__/textInputPassThrough.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ describe('shouldPreserveCtrlJNewline', () => {
).toBe(true)
})

it('keeps bare local POSIX LF-compatible prompts submitting on Ctrl+J', () => {
it('preserves Ctrl+J as newline in VTE terminals like GNOME Console/Terminal', () => {
expect(shouldPreserveCtrlJNewline({ TERM: 'xterm-256color', VTE_VERSION: '8400' })).toBe(true)
})

it('keeps bare local POSIX LF-compatible prompts submitting when no terminal fingerprint is available', () => {
expect(shouldPreserveCtrlJNewline({ TERM: 'xterm-256color' })).toBe(false)
})
})
Expand Down
4 changes: 4 additions & 0 deletions ui-tui/src/components/textInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ export function applyPrintableInsert(
export const shouldRouteMultiCharInputAsPaste = (text: string): boolean => text.includes('\n')

export function shouldPreserveCtrlJNewline(env: MinimalEnv = process.env): boolean {
if (env.VTE_VERSION) {
return true
}

if (env.WT_SESSION) {
return true
}
Expand Down