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:
Mitchell Hashimoto
2023-09-09 20:17:55 -07:00
parent 7fd8dde933
commit d9cfd00e9f
10 changed files with 159 additions and 133 deletions

View File

@@ -11,9 +11,6 @@ const renderer = @import("../renderer.zig");
/// state (i.e. the terminal, devmode, etc. values).
mutex: *std.Thread.Mutex,
/// Cursor configuration for rendering
cursor: Cursor,
/// The terminal data.
terminal: *terminal.Terminal,
@@ -23,17 +20,6 @@ terminal: *terminal.Terminal,
/// a future exercise.
preedit: ?Preedit = null,
pub const Cursor = struct {
/// Current cursor style. This can be set by escape sequences. To get
/// the default style, the config has to be referenced.
style: terminal.CursorStyle = .default,
/// Whether the cursor is visible at all. This should not be used for
/// "blink" settings, see "blink" for that. This is used to turn the
/// cursor ON or OFF.
visible: bool = true,
};
/// The pre-edit state. See Surface.preeditCallback for more information.
pub const Preedit = struct {
/// The codepoint to render as preedit text. We only support single