Merge pull request #2109 from edmz/block_hollow

Config: cursor-style can bet set to block_hollow
This commit is contained in:
Mitchell Hashimoto
2024-08-18 15:08:08 -07:00
committed by GitHub
4 changed files with 18 additions and 1 deletions

View File

@ -325,6 +325,7 @@ palette: Palette = .{},
/// * `block` /// * `block`
/// * `bar` /// * `bar`
/// * `underline` /// * `underline`
/// * `block_hollow`
/// ///
@"cursor-style": terminal.CursorStyle = .block, @"cursor-style": terminal.CursorStyle = .block,

View File

@ -16,6 +16,7 @@ pub const Style = enum {
return switch (term) { return switch (term) {
.bar => .bar, .bar => .bar,
.block => .block, .block => .block,
.block_hollow => .block_hollow,
.underline => .underline, .underline => .underline,
}; };
} }

View File

@ -140,7 +140,18 @@ pub const Cursor = struct {
/// The visual style of the cursor. Whether or not it blinks /// The visual style of the cursor. Whether or not it blinks
/// is determined by mode 12 (modes.zig). This mode is synchronized /// is determined by mode 12 (modes.zig). This mode is synchronized
/// with CSI q, the same as xterm. /// 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. /// Saved cursor state.
pub const SavedCursor = struct { pub const SavedCursor = struct {

View File

@ -210,6 +210,10 @@ pub const StreamHandler = struct {
.block => if (blink) 1 else 2, .block => if (blink) 1 else 2,
.underline => if (blink) 3 else 4, .underline => if (blink) 3 else 4,
.bar => if (blink) 5 else 6, .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}); try writer.print("{d} q", .{style});
}, },