feat: add cursor-style-unfocused configuration option
#9630
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #2818, implementing the unfocused cursor style
configuration in the way suggested in the review there.
Behaviour
cursor-style-unfocusedterminal.CursorStyleblock_hollow, which preserves the current behaviour forunfocused windows
the configured
cursor-style-unfocused.still follows
cursor-style, DECSCUSR, shell integration, etc.This aims to be the simplest possible version of the feature: no extra
runtime controls, and no optional/unset semantics yet (as discussed in
the review of #2818).
Implementation
This follows the previous review feedback from #2818:
cursor-style-unfocusedtoConfig.zigwith defaultblock_hollow.renderer.Renderer.DerivedConfigwithcursor_style_unfocused: terminal.CursorStyleand initializes it fromconfig.@"cursor-style-unfocused".renderer.cursorStyle/cursor.styleto take the unfocusedstyle as a parameter instead of reading from terminal state, and uses
it when
focused == false.The unfocused cursor style is treated purely as a renderer
configuration detail, as requested in the earlier review.
Tests
cursor-style-unfocusedwhenthe window is unfocused.
extend for this specific renderer behaviour, but I can add one if
desired.
References: #2818
AI Assistance Disclosure: Used ChatGPT to navigate the codebase and better understand where I could find what I wanted to change and or add. I also used ChatGPT to write the description of this PR. I wrote the code myself. I also build it locally to test if my changes produced what expected. I added this disclaimer later because of course I didn't read the contributing guide.