A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
fix(coding-agent): keep Shift+Enter newline working where it sends a raw \n (#1522)
Sebastian Müller8ee310c5d551
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.mdindex 379b4ced95..73fdf74faa 100644--- a/packages/coding-agent/CHANGELOG.md+++ b/packages/coding-agent/CHANGELOG.md@@ -2,6 +2,7 @@## [Unreleased]+- Fixed Shift+Enter no longer inserting a newline in terminals that send a literal `\n` (for example a Ghostty `shift+enter=text:\n` mapping): the byte decoded as `ctrl+j` and triggered the new edit-diff toggle instead of the editor newline.- Removed a system prompt paragraph referring to an async `bash()` kernel helper and managed jobs that do not exist in the runtime.- Changed RLM guidance to orchestrate independent workers in parallel, use available async shell helpers safely, end the turn instead of sleeping, polling, or blocking on long awaits, provide proactive outcome-focused progress updates from root agents, and use simplified technical English for user-facing prose.- Fixed new top-level daemon sessions inheriting an RLM child depth from the supervisor process.diff --git a/packages/coding-agent/src/modes/interactive/components/custom-editor.ts b/packages/coding-agent/src/modes/interactive/components/custom-editor.tsindex 9e36e95ca8..058e4076be 100644--- a/packages/coding-agent/src/modes/interactive/components/custom-editor.ts+++ b/packages/coding-agent/src/modes/interactive/components/custom-editor.ts@@ -198,9 +198,11 @@ export class CustomEditor extends Editor {// Fall through to editor handling for delete-char-forward when not empty}- // Check all other app actions+ // Check all other app actions. A raw "\n" is Shift+Enter's newline in some+ // terminals, so it goes to the editor even though it decodes as ctrl+j.for (const [action, handler] of this.actionHandlers) {if (+ data !== "\n" &&action !== "app.input.clear" &&action !== "app.exit" &&(action !== "app.shortcuts" || this.getText().length === 0) &&diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.tsindex 02c64a8d4d..15f4f79e09 100644--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts@@ -5900,7 +5900,8 @@ export class InteractiveMode {this.toggleAgentMessageExpansion();return;}- if (this.keybindings.matches(data, "app.edits.expand")) {+ // A raw "\n" is a newline for the editor, not ctrl+j.+ if (data !== "\n" && this.keybindings.matches(data, "app.edits.expand")) {this.toggleEditDiffExpansion();return;}diff --git a/packages/coding-agent/test/custom-editor.test.ts b/packages/coding-agent/test/custom-editor.test.tsindex bef6fc798a..ef3336e3ce 100644--- a/packages/coding-agent/test/custom-editor.test.ts+++ b/packages/coding-agent/test/custom-editor.test.ts@@ -78,6 +78,30 @@ describe("CustomEditor", () => {expect(editor.getText()).toBe("/");});+ it("inserts a newline for a raw \\n byte instead of firing the ctrl+j edit-diff action", () => {+ const editor = new CustomEditor(fakeTui, editorTheme, new KeybindingsManager());+ const toggleEditDiffs = vi.fn();+ editor.onAction("app.edits.expand", toggleEditDiffs);++ editor.handleInput("a");+ editor.handleInput("\n");+ editor.handleInput("b");++ expect(toggleEditDiffs).not.toHaveBeenCalled();+ expect(editor.getText()).toBe("a\nb");+ });++ it("still fires the edit-diff action for kitty CSI-u ctrl+j", () => {+ const editor = new CustomEditor(fakeTui, editorTheme, new KeybindingsManager());+ const toggleEditDiffs = vi.fn();+ editor.onAction("app.edits.expand", toggleEditDiffs);++ editor.handleInput("\x1b[106;5u");++ expect(toggleEditDiffs).toHaveBeenCalledOnce();+ expect(editor.getText()).toBe("");+ });+it("routes Escape through its handler while dismissing autocomplete", async () => {const editor = new CustomEditor(fakeTui, editorTheme, new KeybindingsManager());const handler = vi.fn();