Skip to content

feat(window): add configurable default cursor_style#72

Open
roramirez wants to merge 1 commit into
mainfrom
feat/config-cursor-style
Open

feat(window): add configurable default cursor_style#72
roramirez wants to merge 1 commit into
mainfrom
feat/config-cursor-style

Conversation

@roramirez

Copy link
Copy Markdown
Owner

Summary

Adds a window.cursor_style config option that sets the default cursor shape (block, beam, or underline). The value seeds the initial DECSCUSR cursor shape for every new pane and is restored whenever the terminal resets — full reset (RIS), entering the alternate screen, and CSI 0 SP q ("reset cursor to default"). Programs can still override the live shape via DECSCUSR (CSI 1..6 SP q) as before.

Changes

  • config: new WindowConfig.cursor_style: String (serde default "block"); added to assets/config.toml, README, and SPEC.
  • terminal/grid: new Grid.default_cursor_shape field; reset sites now restore it instead of hardcoding Block; added reusable cursor_shape_from_str() helper (case-insensitive, warns and falls back to Block on unknown input).
  • terminal/parser: CSI 0 SP q now resets to the grid's configured default shape; 1..6 unchanged.
  • pane_ops: seeds both default_cursor_shape and cursor_shape from the config when spawning a pane.
  • config/tui_config: new "Cursor Style" Select field; generalized cycle_select so only the Theme field emits a live PreviewTheme (other Select fields no longer fire a spurious theme preview).
  • Tests: parser CSI 0 SP q reset, grid reset/alt-screen restore-to-default, cursor_shape_from_str variants, config round-trip, and tui_config field-count/index/round-trip/cycle assertions.
  • Docs: CHANGELOG, SPEC configuration table, README [window] block.

How to test

  • cargo test — all pass (parser, grid, config, tui_config coverage).
  • cargo clippy --locked -- -D warnings — clean.
  • Manual: set cursor_style = "beam" under [window] in ~/.config/mmterm/config.toml, launch mmterm, confirm the cursor starts as a beam; run printf '\e[2 q' (block) then printf '\e[0 q' and confirm it returns to a beam.

Introduce a window.cursor_style config option (block | beam | underline)
that seeds the initial DECSCUSR cursor shape and is restored on reset and
on `CSI 0 SP q`. Grid gains a default_cursor_shape field, the parser
resets to it on param 0, and the config panel exposes a Select field whose
cycling no longer fires a spurious theme preview.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant