Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

fix(eve): insert a newline on LF so Shift+Enter works in Warp (#4419)

roboeve[bot]b9470fef1065
diff --git a/.changeset/tui-newline-keys.md b/.changeset/tui-newline-keys.md
new file mode 100644
index 000000000..a1adbd1db
--- /dev/null
+++ b/.changeset/tui-newline-keys.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+`Shift+Enter` now inserts a newline in the `eve dev` prompt in Warp, which sends a bare line feed for it. `Ctrl+J` inserts a newline too, instead of sending the message.
diff --git a/packages/eve/src/cli/dev/tui/stream-format.test.ts b/packages/eve/src/cli/dev/tui/stream-format.test.ts
index 10be0e86f..6a77223be 100644
--- a/packages/eve/src/cli/dev/tui/stream-format.test.ts
+++ b/packages/eve/src/cli/dev/tui/stream-format.test.ts
@@ -152,6 +152,7 @@ describe("nextKey", () => {
it("decodes Shift+Enter as a newline while a bare Enter still submits", () => {
expect(nextKey("\x1b[27;2;13~")).toEqual({ key: { type: "newline" }, consumed: 10 });
expect(nextKey("\x1b[13;2u")).toEqual({ key: { type: "newline" }, consumed: 7 });
+ expect(nextKey("\n")).toEqual({ key: { type: "newline" }, consumed: 1 });
expect(nextKey("\r")).toEqual({ key: { type: "enter" }, consumed: 1 });
});
diff --git a/packages/eve/src/cli/dev/tui/stream-format.ts b/packages/eve/src/cli/dev/tui/stream-format.ts
index c12c84907..df78fc793 100644
--- a/packages/eve/src/cli/dev/tui/stream-format.ts
+++ b/packages/eve/src/cli/dev/tui/stream-format.ts
@@ -272,10 +272,11 @@ export function parseKey(chunk: Buffer): TerminalKey {
case "\u0003":
return { type: "ctrl-c" };
case "\r":
- case "\n":
return { type: "enter" };
// Shift+Enter inserts a newline instead of submitting. Terminals report it
- // as xterm modifyOtherKeys (`CSI 27 ; 2 ; 13 ~`) or the kitty/CSI-u form.
+ // as xterm modifyOtherKeys (`CSI 27 ; 2 ; 13 ~`), the kitty/CSI-u form, or
+ // LF (Warp). Raw-mode Enter is CR, so LF is otherwise only Ctrl+J.
+ case "\n":
case "\x1b[27;2;13~":
case "\x1b[13;2u":
return { type: "newline" };
diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
index ab2eca73e..fed0f3bf9 100644
--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
@@ -439,9 +439,11 @@ describe("TerminalRenderer (inline scrollback)", () => {
input.type("line one");
input.send("\x1b[27;2;13~"); // Shift+Enter (xterm modifyOtherKeys)
input.type("line two");
+ input.send("\n"); // Shift+Enter in Warp, or Ctrl+J (#4404)
+ input.type("line three");
input.enter();
- expect(await prompt).toBe("line one\nline two");
+ expect(await prompt).toBe("line one\nline two\nline three");
renderer.shutdown();
});