From 27d2903b3cb01691775f26d75b2086f940458b51 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 10 Mar 2024 15:40:18 -0700 Subject: [PATCH] terminal: don't insert newline across page boundaries --- src/terminal/PageList.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/terminal/PageList.zig b/src/terminal/PageList.zig index 4166d3fb8..866ce7f44 100644 --- a/src/terminal/PageList.zig +++ b/src/terminal/PageList.zig @@ -805,7 +805,13 @@ fn reflowPage( // then we completed it and we can exit the loop. if (started_completing_wrap and !src_completing_wrap) break; - const prev_wrap = src_cursor.page_row.wrap; + // We are previously wrapped if we're not on the first row and + // the previous row was wrapped OR if we're on the first row + // but we're not on our initial node it means the last row of + // our previous page was wrapped. + const prev_wrap = + (src_y > 0 and src_cursor.page_row.wrap) or + (src_y == 0 and src_node != initial_node); src_cursor.cursorAbsolute(0, @intCast(src_y)); // Trim trailing empty cells if the row is not wrapped. If the