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

@ -51,8 +51,20 @@ def test_windows_terminal_session_preserves_newline():
assert cli_mod._preserve_ctrl_enter_newline() is True
def test_ghostty_tmux_session_preserves_ctrl_j_newline():
"""Ghostty-inherited env survives tmux even when TERM_PROGRAM becomes tmux."""
import cli as cli_mod
with patch.object(sys, "platform", "linux"):
with patch.dict(
os.environ,
{"TERM": "tmux-256color", "TERM_PROGRAM": "tmux", "GHOSTTY_RESOURCES_DIR": "/usr/share/ghostty"},
clear=True,
):
assert cli_mod._preserve_ctrl_enter_newline() is True
def test_pure_local_linux_does_not_preserve():
"""A bare local Linux TTY (no SSH/WSL/WT) keeps c-j → submit so docker exec
"""A bare local Linux TTY (no SSH/WSL/WT/Ghostty) keeps c-j → submit so docker exec
style Enter-as-LF stays usable."""
import cli as cli_mod
# Stub out /proc reads — those are the WSL fallback signal.