diff --git a/src/config/Config.zig b/src/config/Config.zig index a5d1c1e68..681c0523e 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -325,6 +325,7 @@ palette: Palette = .{}, /// * `block` /// * `bar` /// * `underline` +/// * `block_hollow` /// @"cursor-style": terminal.CursorStyle = .block, diff --git a/src/renderer/cursor.zig b/src/renderer/cursor.zig index 468c25465..d05acf9e9 100644 --- a/src/renderer/cursor.zig +++ b/src/renderer/cursor.zig @@ -16,6 +16,7 @@ pub const Style = enum { return switch (term) { .bar => .bar, .block => .block, + .block_hollow => .block_hollow, .underline => .underline, }; } diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 54feb3c69..f7c531b47 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -140,7 +140,18 @@ pub const Cursor = struct { /// The visual style of the cursor. Whether or not it blinks /// is determined by mode 12 (modes.zig). This mode is synchronized /// with CSI q, the same as xterm. -pub const CursorStyle = enum { bar, block, underline }; +pub const CursorStyle = enum { + bar, // DECSCUSR 5, 6 + block, // DECSCUSR 1, 2 + underline, // DECSCUSR 3, 4 + + /// The cursor styles below aren't known by DESCUSR and are custom + /// implemented in Ghostty. They are reported as some standard style + /// if requested, though. + /// Hollow block cursor. This is a block cursor with the center empty. + /// Reported as DECSCUSR 1 or 2 (block). + block_hollow, +}; /// Saved cursor state. pub const SavedCursor = struct { diff --git a/src/termio/stream_handler.zig b/src/termio/stream_handler.zig index 648efb6fb..7daf2b7a2 100644 --- a/src/termio/stream_handler.zig +++ b/src/termio/stream_handler.zig @@ -210,6 +210,10 @@ pub const StreamHandler = struct { .block => if (blink) 1 else 2, .underline => if (blink) 3 else 4, .bar => if (blink) 5 else 6, + + // Below here, the cursor styles aren't represented by + // DECSCUSR so we map it to some other style. + .block_hollow => if (blink) 1 else 2, }; try writer.print("{d} q", .{style}); },