terminal: printCell writes with the current pen's content type

This commit is contained in:
Mitchell Hashimoto
2026-01-24 13:10:40 -08:00
parent 487b84da0e
commit 7a69e2bf86
2 changed files with 7 additions and 0 deletions

View File

@@ -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,

View File

@@ -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" {