fix: preserve Ctrl+J newlines in Ghostty

This commit is contained in:
Seppe Gadeyne 2026-05-27 11:31:47 +02:00 committed by Teknium
parent 1386a7e478
commit cf8862cfa3
5 changed files with 82 additions and 8 deletions

View file

@ -1,11 +1,27 @@
import { describe, expect, it } from 'vitest'
import { shouldPassThroughToGlobalHandler } from '../components/textInput.js'
import { shouldPassThroughToGlobalHandler, shouldPreserveCtrlJNewline } from '../components/textInput.js'
import { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } from '../lib/platform.js'
const key = (overrides: Record<string, unknown> = {}) =>
({ ctrl: false, meta: false, ...overrides }) as any
describe('shouldPreserveCtrlJNewline', () => {
it('preserves Ctrl+J as newline in Ghostty even when tmux masks TERM/TERM_PROGRAM', () => {
expect(
shouldPreserveCtrlJNewline({
GHOSTTY_RESOURCES_DIR: '/usr/share/ghostty',
TERM: 'tmux-256color',
TERM_PROGRAM: 'tmux'
})
).toBe(true)
})
it('keeps bare local POSIX LF-compatible prompts submitting on Ctrl+J', () => {
expect(shouldPreserveCtrlJNewline({ TERM: 'xterm-256color' })).toBe(false)
})
})
describe('shouldPassThroughToGlobalHandler', () => {
it('passes through the configured voice shortcut while composer is focused', () => {
expect(