From a95af7f4c60aeaa536b58d0bbd1c935711b6cef2 Mon Sep 17 00:00:00 2001 From: "Tommy D. Rossi" Date: Thu, 27 Nov 2025 15:35:36 +0100 Subject: [PATCH 1/2] Enable linefeed mode so newline moves cursor to column 0 Without linefeed mode enabled, \n only moves the cursor down without returning to column 0. This causes text to display in a staggered pattern instead of properly aligned at the left margin. This fix sets the linefeed terminal mode to true when creating a new terminal instance, making \n behave as expected (LF + CR). --- patches/ghostty-wasm-api.patch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/patches/ghostty-wasm-api.patch b/patches/ghostty-wasm-api.patch index 1e2ce5b..5f6820d 100644 --- a/patches/ghostty-wasm-api.patch +++ b/patches/ghostty-wasm-api.patch @@ -817,6 +817,10 @@ index 000000000..e79702488 + // Initialize the persistent VT stream (must be done after terminal is set) + wrapper.stream = wrapper.terminal.vtStream(); + ++ // Enable linefeed mode so \n performs carriage return (moves cursor to column 0) ++ // Without this, \n only moves down without returning to column 0, causing staggered text ++ wrapper.terminal.modes.set(.linefeed, true); ++ + return @ptrCast(wrapper); +} + From 87a4c256ff6f5f9d41d4cffb5e4a2bfebd50d05d Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 1 Dec 2025 19:13:09 +0000 Subject: [PATCH 2/2] fix: update patch header line count from 638 to 642 --- patches/ghostty-wasm-api.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/ghostty-wasm-api.patch b/patches/ghostty-wasm-api.patch index 5f6820d..266652e 100644 --- a/patches/ghostty-wasm-api.patch +++ b/patches/ghostty-wasm-api.patch @@ -622,7 +622,7 @@ new file mode 100644 index 000000000..e79702488 --- /dev/null +++ b/src/terminal/c/terminal.zig -@@ -0,0 +1,638 @@ +@@ -0,0 +1,642 @@ +//! C API wrapper for Terminal +//! +//! This provides a C-compatible interface to Ghostty's Terminal for WASM export.