mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
Merge pull request #347 from mitchellh/cursor-style
Add option for custom cursor style
This commit is contained in:
@ -97,6 +97,14 @@ pub const Config = struct {
|
|||||||
/// The color of the cursor. If this is not set, a default will be chosen.
|
/// The color of the cursor. If this is not set, a default will be chosen.
|
||||||
@"cursor-color": ?Color = null,
|
@"cursor-color": ?Color = null,
|
||||||
|
|
||||||
|
/// The style of the cursor.
|
||||||
|
///
|
||||||
|
/// Caveat: Shell integration currently defaults to always be a bar
|
||||||
|
/// In order to fix it, we probably would want to add something similar to Kitty's
|
||||||
|
/// shell integration options (no-cursor). For more information see:
|
||||||
|
/// https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.shell_integration
|
||||||
|
@"cursor-style": terminal.CursorStyle = .default,
|
||||||
|
|
||||||
/// The color of the text under the cursor. If this is not set, a default
|
/// The color of the text under the cursor. If this is not set, a default
|
||||||
/// will be chosen.
|
/// will be chosen.
|
||||||
@"cursor-text": ?Color = null,
|
@"cursor-text": ?Color = null,
|
||||||
|
@ -108,6 +108,7 @@ pub const DerivedConfig = struct {
|
|||||||
font_thicken: bool,
|
font_thicken: bool,
|
||||||
font_features: std.ArrayList([]const u8),
|
font_features: std.ArrayList([]const u8),
|
||||||
cursor_color: ?terminal.color.RGB,
|
cursor_color: ?terminal.color.RGB,
|
||||||
|
cursor_style: terminal.CursorStyle,
|
||||||
cursor_text: ?terminal.color.RGB,
|
cursor_text: ?terminal.color.RGB,
|
||||||
background: terminal.color.RGB,
|
background: terminal.color.RGB,
|
||||||
background_opacity: f64,
|
background_opacity: f64,
|
||||||
@ -136,6 +137,7 @@ pub const DerivedConfig = struct {
|
|||||||
else
|
else
|
||||||
null,
|
null,
|
||||||
|
|
||||||
|
.cursor_style = config.@"cursor-style",
|
||||||
.cursor_text = if (config.@"cursor-text") |txt|
|
.cursor_text = if (config.@"cursor-text") |txt|
|
||||||
txt.toTerminalRGB()
|
txt.toTerminalRGB()
|
||||||
else
|
else
|
||||||
@ -491,7 +493,9 @@ pub fn render(
|
|||||||
// If we aren't focused, we use a hollow box
|
// If we aren't focused, we use a hollow box
|
||||||
if (!self.focused) break :cursor_style .box_hollow;
|
if (!self.focused) break :cursor_style .box_hollow;
|
||||||
|
|
||||||
break :cursor_style renderer.CursorStyle.fromTerminal(state.cursor.style) orelse .box;
|
const selected_cursor_style = if (state.cursor.style == .default) self.config.cursor_style else state.cursor.style;
|
||||||
|
|
||||||
|
break :cursor_style renderer.CursorStyle.fromTerminal(selected_cursor_style) orelse .box;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,6 +237,7 @@ pub const DerivedConfig = struct {
|
|||||||
font_thicken: bool,
|
font_thicken: bool,
|
||||||
font_features: std.ArrayList([]const u8),
|
font_features: std.ArrayList([]const u8),
|
||||||
cursor_color: ?terminal.color.RGB,
|
cursor_color: ?terminal.color.RGB,
|
||||||
|
cursor_style: terminal.CursorStyle,
|
||||||
cursor_text: ?terminal.color.RGB,
|
cursor_text: ?terminal.color.RGB,
|
||||||
background: terminal.color.RGB,
|
background: terminal.color.RGB,
|
||||||
background_opacity: f64,
|
background_opacity: f64,
|
||||||
@ -265,6 +266,7 @@ pub const DerivedConfig = struct {
|
|||||||
else
|
else
|
||||||
null,
|
null,
|
||||||
|
|
||||||
|
.cursor_style = config.@"cursor-style",
|
||||||
.cursor_text = if (config.@"cursor-text") |txt|
|
.cursor_text = if (config.@"cursor-text") |txt|
|
||||||
txt.toTerminalRGB()
|
txt.toTerminalRGB()
|
||||||
else
|
else
|
||||||
@ -733,7 +735,9 @@ pub fn render(
|
|||||||
// If we aren't focused, we use a hollow box
|
// If we aren't focused, we use a hollow box
|
||||||
if (!self.focused) break :cursor_style .box_hollow;
|
if (!self.focused) break :cursor_style .box_hollow;
|
||||||
|
|
||||||
break :cursor_style renderer.CursorStyle.fromTerminal(state.cursor.style) orelse .box;
|
const selected_cursor_style = if (state.cursor.style == .default) self.config.cursor_style else state.cursor.style;
|
||||||
|
|
||||||
|
break :cursor_style renderer.CursorStyle.fromTerminal(selected_cursor_style) orelse .box;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user