Integrated terminal does not preserve Shift+Enter for child TUI applications
When running a TUI application such as OpenCode inside Fresh's integrated terminal, Shift+Enter is forwarded as a regular Enter.
Fresh itself receives and identifies the key correctly. :debug-keys shows Shift+Enter, but an application running inside Fresh's terminal cannot distinguish it from Enter.
The same application running directly in the parent terminal receives Shift+Enter correctly.
Environment
- OS: Windows 11
- Shell/environment: WSL Ubuntu
- Fresh: 0.5.1
- Parent terminal: Windows Terminal Canary
- Application used for testing: OpenCode
- TERM:
xterm-256color - Windows Terminal Canary supports the Kitty keyboard protocol
Reproduction
1. Directly in Windows Terminal Canary
Run OpenCode directly from WSL.
Press:
Shift+Enter
OpenCode correctly detects it as Shift+Enter and performs the corresponding action.
Ctrl+J also works correctly.
2. Check input received by Fresh
Start Fresh from the same WSL terminal and run:
:debug-keys
Press:
Shift+Enter
Fresh correctly reports:
Shift+Enter
So the key appears to be received correctly by Fresh from Windows Terminal.
3. Run OpenCode inside Fresh's integrated terminal
Open a terminal inside Fresh and start OpenCode.
Press:
Shift+Enter
OpenCode behaves as if a regular Enter was pressed.
Ctrl+J, however, is forwarded correctly and works as expected.
Observed input path
Direct:
Windows Terminal Canary
-> OpenCode
-> Shift+Enter worksThrough Fresh:
Windows Terminal Canary
-> Fresh
-> :debug-keys sees Shift+Enter correctly
-> Fresh integrated terminal
-> OpenCode sees regular EnterThis seems to indicate that the distinction is lost when Fresh forwards/encodes the key event to the PTY used by its integrated terminal.
Expected behavior
Applications running inside Fresh's integrated terminal should be able to distinguish Shift+Enter from Enter, particularly when the parent terminal supports an enhanced keyboard protocol such as Kitty/CSI-u.
Additional observations
I initially encountered some other keyboard issues involving Alt/AltGr and an international keyboard layout. Those turned out to be related to an older Windows Terminal Kitty implementation and are fixed in Windows Terminal Canary.
With Windows Terminal Canary:
AltandAltGrare distinguished correctly- international keyboard combinations work correctly
- Fresh
:debug-keysreportsShift+Entercorrectly - OpenCode directly under Windows Terminal receives
Shift+Entercorrectly
The remaining issue appears specifically when a child TUI application is running inside Fresh's integrated terminal.
I also tested Fresh's keyboard_report_alternate_keys setting, but changing it does not affect this behavior.
Source: sinelaw/fresh