Skip to content
Closed
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
5 changes: 5 additions & 0 deletions frontends/tui_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,12 @@ def has(*needles: str) -> bool:
return any(n in a for a in aliases for n in needles)

# Enter submits; Ctrl+J / Shift+Enter insert newline when PTK can distinguish.
# Windows terminals send \r for both Enter/Shift+Enter — detect Shift physically.
if has('controlm', 'c-m') or key_s in ('\r', '\n'):
if _IS_WINDOWS:
import ctypes
if ctypes.windll.user32.GetAsyncKeyState(0x10) & 0x8000:
return b'\n'
return b'\r'
if has('controlj', 'c-j', 's-enter', 'shift-enter'):
return b'\n'
Expand Down