Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions packages/coding-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
24 changes: 24 additions & 0 deletions packages/coding-agent/test/custom-editor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading