Repository navigation
Description
Summary
Since 1.3.18 (PR #943), macOS streaming insertion sends newlines as Shift+Return. In Terminal.app running a TUI agent (OpenAI Codex CLI, Claude Code, …) that keystroke is indistinguishable from a plain Return, so every paragraph break submits the message. One dictated passage that the polisher formats into three paragraphs gets sent as three separate messages; only the last paragraph stays in the input box. 1.3.16 (which sent U+000A) behaved correctly in the same setup.
Environment
- macOS 26 (Darwin 25.6.0), Apple Silicon
- OpenLess v1.3.18-tauri (upgraded from 1.3.16 by the in-app updater on 08-21)
- Streaming insert = on (default);
macosNewlineModeuntouched (defaultshiftReturn) - Frontmost app:
com.apple.Terminalrunning OpenAI Codex CLI v0.149.0 (same for Claude Code)
Steps to reproduce
- macOS, Terminal.app, start
codex(orclaude) so the composer has focus. - Keep streaming insert on, structured style (anything that makes the polisher produce
\n\nparagraph breaks). - Dictate a long passage that gets polished into 2–3 paragraphs.
Expected: the whole text lands in the composer; the user presses Enter when they want to send (1.3.16 behaviour).
Actual: each \n is received as Return → the paragraph typed so far is submitted; only the final paragraph remains in the box.
Log excerpt (1.3.18, content stripped):
[coord] polish dispatch: translation=false mode=Structured streaming_eligible=true
[coord] streaming_insert path ENTER (raw_chars=327)
[llm] polish stream done; total deltas=142 chars=289
[coord] streaming_insert: typer drained, typed 289 chars
[coord] streaming_insert SUCCESS: polished_chars=289 typed_chars=289 typer_err=None
[coord] insertion skipped: 289 chars already streamed via unicode_keystroke (polish_error=None)
The matching history entry has two \n\n in finalText, insertStatus=inserted, appBundleId=com.apple.Terminal.
Root cause
#943 changed '\n' handling in unicode_keystroke.rs (classify_mac_keystroke → send_shift_return) from posting U+000A via CGEventKeyboardSetUnicodeString to posting kVK_Return with the Shift flag. The PR assumed "in editors / terminals / web textareas it's just a normal newline". That does not hold for Terminal.app + TUI agents:
- Terminal.app does not implement the kitty keyboard protocol / CSI u, so Shift+Return and Return both emit
\r— the program inside cannot tell them apart. - Codex TUI (crossterm, raw mode) parses
\rasKeyCode::Enter, and the default keymap hassubmit = Enter(codex-rs/tui/src/keymap.rs:submit: default_bindings![plain(KeyCode::Enter)]). - 1.3.16 sent U+000A; Terminal.app forwards the raw 0x0A byte, crossterm in raw mode parses 0x0A as Ctrl+J, and Codex's
editor.insert_newlinedefaults includectrl(Char('j'))(next to shift+Enter / alt+Enter). Claude Code also treats Ctrl+J as "newline". So the old behaviour happened to be a soft newline in terminals; the new one is "send".
#943 itself noted "the newline fix has not been hit on a real machine yet" — this is that report.
Suggestions
Any of these (or a combination):
- A. Add a third
MacosNewlineModevalue,lineFeed, that sends U+000A (the 1.3.16 behaviour). Settings copy: "terminal / CLI agents (Codex, Claude Code): pick this". Smallest change, gives users an escape hatch. - B. Pick automatically from the frontmost bundle id: for terminal apps (
com.apple.Terminal,com.googlecode.iterm2,net.kovidgoyal.kitty,com.mitchellh.ghostty,com.github.wez.wezterm,dev.warp.Warp,org.alacritty, …) send LF; otherwise keepshiftReturn. The frontmost-app info already exists for [feature] 根据焦点窗口进程自动切换风格 #596 (per-app style switching). - C. At minimum, fix the settings copy (
macosNewlineModeDesc): say that Terminal.app cannot distinguish Shift+Return from Return, so users don't assume Shift+Return is safe in terminals.
Workaround for anyone hitting this
Terminal.app → Settings → Profiles → Keyboard → "+": Key = Return, Modifier = Shift, Action = Send Text \012. OpenLess's Shift+Return then reaches Codex / Claude Code as LF (soft newline), and manual Shift+Enter starts working too. Alternatively turn off streaming insert and fall back to the one-shot Cmd+V paste.
中文摘要:1.3.18(#943)把 macOS 逐字上屏的换行改发 Shift+Return;Terminal.app 分不清 Shift+Return 和 Return,Codex / Claude Code 收到的是普通回车=提交,所以一段话被按段劈成多条消息发出去。1.3.16 发 U+000A → 终端转成 Ctrl+J → 正好是这些 TUI 的「插入换行」键,所以以前正常。建议加 lineFeed 档,或按前台终端类 App 自动选 LF,至少改设置文案。
Activity
HKLHaoBin commentedon Aug 22, 2026
macOS 不清楚。
H-Chris233 commentedon Aug 22, 2026
会加可选项(虽然我记得有加的?...)
H-Chris233 commentedon Aug 23, 2026
啊
可选项没有U+000A
我现在加
H-Chris233 commentedon Aug 23, 2026
哎呀加选项怎么够
我直接一个Auto
等着
H-Chris233 commentedon Aug 23, 2026
OK完事