mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-26 09:01:44 +00:00
Big Cursor State Refactor
This makes a few major changes:
- cursor style on terminal is single source of stylistic truth
- cursor style is split between style and style request
- cursor blinking is handled by the renderer thread
- cursor style/visibility is no longer stored as persistent state on
renderers
- cursor style computation is extracted to be shared by all renderers
- mode 12 "cursor_blinking" is now source of truth on whether blinking
is enabled or not
- CSI q and mode 12 are synced like xterm
This commit is contained in:
@@ -106,7 +106,7 @@ pub const Config = struct {
|
||||
/// 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": CursorStyle = .bar,
|
||||
@"cursor-style": terminal.Cursor.Style = .bar,
|
||||
|
||||
/// Whether the cursor shall blink
|
||||
@"cursor-style-blink": bool = true,
|
||||
@@ -1475,22 +1475,6 @@ pub const ShellIntegration = enum {
|
||||
zsh,
|
||||
};
|
||||
|
||||
/// Available options for `cursor-style`. Blinking is configured with
|
||||
/// the `cursor-style-blink` option.
|
||||
pub const CursorStyle = enum {
|
||||
bar,
|
||||
block,
|
||||
underline,
|
||||
|
||||
pub fn toTerminalCursorStyle(self: CursorStyle, blinks: bool) terminal.CursorStyle {
|
||||
return switch (self) {
|
||||
.bar => if (blinks) .blinking_bar else .steady_bar,
|
||||
.block => if (blinks) .blinking_block else .steady_block,
|
||||
.underline => if (blinks) .blinking_underline else .steady_underline,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// Wasm API.
|
||||
pub const Wasm = if (!builtin.target.isWasm()) struct {} else struct {
|
||||
const wasm = @import("os/wasm.zig");
|
||||
|
||||
Reference in New Issue
Block a user