From 7a69e2bf868cc2d08d866c9df0b8684de5467473 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 24 Jan 2026 13:10:40 -0800 Subject: [PATCH] terminal: printCell writes with the current pen's content type --- src/terminal/Screen.zig | 4 ++++ src/terminal/Terminal.zig | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 45fe9dfc6..10d33a3a8 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -134,6 +134,10 @@ pub const Cursor = struct { /// because its most likely null. hyperlink: ?*hyperlink.Hyperlink = null, + /// The current semantic content type for the cursor that will be + /// applied to any newly written cells. + semantic_content: pagepkg.Cell.SemanticContent = .output, + /// The pointers into the page list where the cursor is currently /// located. This makes it faster to move the cursor. page_pin: *PageList.Pin, diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index a955cbcae..ac11ead3e 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -711,6 +711,7 @@ fn printCell( .style_id = self.screens.active.cursor.style_id, .wide = wide, .protected = self.screens.active.cursor.protected, + .semantic_content = self.screens.active.cursor.semantic_content, }; if (style_changed) { @@ -11236,6 +11237,7 @@ test "Terminal: fullReset with a non-empty pen" { try t.setAttribute(.{ .direct_color_fg = .{ .r = 0xFF, .g = 0, .b = 0x7F } }); try t.setAttribute(.{ .direct_color_bg = .{ .r = 0xFF, .g = 0, .b = 0x7F } }); + t.screens.active.cursor.semantic_content = .input; t.fullReset(); { @@ -11248,6 +11250,7 @@ test "Terminal: fullReset with a non-empty pen" { } try testing.expectEqual(@as(style.Id, 0), t.screens.active.cursor.style_id); + try testing.expectEqual(.output, t.screens.active.cursor.semantic_content); } test "Terminal: fullReset hyperlink" {