Skip to content

Add option to disable cursor blinking - #20929

Open
Mike Griese (zadjii-msft) wants to merge 3 commits into
mainfrom
dev/migrie/b/disable-cursor-blinking
Open

Mike Griese (zadjii-msft) wants to merge 3 commits into
mainfrom
dev/migrie/b/disable-cursor-blinking

Conversation

@zadjii-msft

Copy link
Copy Markdown
Member

This PR adds support for a new per-profile core setting, compatibility.allowCursorBlinking
$profile.compatibility.allowCursorBlinking: bool, default true.

  • When enabled, CLI client apps can change if the cursor blinks.
  • When disabled, client apps can't change if the cursor blinks. They can still change if it's visible/hidden.

Following j4james' advice in #20815 (comment), this is implemented down in adaptDispatch. That way, VT queries for the cursor state also show if cursor blinking is enabled or not.

When paired with default-cursor-blinking in #20928, we can get all of the following states:

compatibility.allowCursorBlinking cursorBlinking: true cursorBlinking: false
true Initially blinking; apps can change blinking. Initially solid; apps can change blinking.
false Always blinking; apps cannot change blinking. Always solid; apps cannot change blinking.

Supersedes #20815
Closes #1379 (in tandem with #20928)

Add a resettable profile compatibility.allowCursorBlinking option. When disabled, enforce a steady cursor in the VT adapter across application requests, resets, buffer switches, and settings reloads while preserving shape and visibility controls.
@microsoft-github-policy-service microsoft-github-policy-service Bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-Settings Issues related to settings and customizability, for console or terminal Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Priority-2 A description (P2) Product-Terminal The new Windows Terminal. labels Nov 17, 2026
},
"compatibility.allowCursorBlinking": {
"default": true,
"description": "Allows cursor blinking. When false, cursor blinking is forced off, including when applications request blinking with mode ?12 or DECSCUSR. Applications can still change the cursor shape or show and hide it.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even fewer words would be OK. Whole last sentence could go.

Comment on lines +550 to +551
<value>Allow the cursor to blink. When disabled, cursor blinking is forced off, even if applications request it. Applications can still change the cursor shape or show and hide it.</value>
<comment>Description for the cursor blinking compatibility toggle.</comment>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<value>Allow the cursor to blink. When disabled, cursor blinking is forced off, even if applications request it. Applications can still change the cursor shape or show and hide it.</value>
<comment>Description for the cursor blinking compatibility toggle.</comment>
<value>Allow the cursor to blink. When disabled, cursor blinking is suppressed even if applications request it.</value>
<comment>Description for the cursor blinking compatibility toggle.</comment>

Even fewer words would be OK. Whole last sentence could go.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i am fond of suppressed, take or leave

break;
case DispatchTypes::ModeParams::ATT610_StartCursorBlink:
_pages.ActivePage().Cursor().SetIsBlinking(enable);
_pages.ActivePage().Cursor().SetIsBlinking(enable && _optionalFeatures.test(OptionalFeature::CursorBlinking));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I'm misunderstanding this, but this seems wrong to me. If the CursorBlinking feature is false, that just means it can't be changed, not that it must be off. If the default is on, and you try and turn it on (while CursorBlinking is false), this code would assumedly turn it off! I would have expected something like:

if (optionalFeatures.test(OptionalFeature::CursorBlinking))
  _pages.ActivePage().Cursor().SetIsBlinking(enable);

Comment on lines +1982 to +1984
state = _optionalFeatures.test(OptionalFeature::CursorBlinking) ?
mapTemp(_pages.ActivePage().Cursor().IsBlinking()) :
mapPerm(false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be something you can't do until #20928 is merged, but I'm assuming the mapPerm(false) should actually be reporting whatever the user's default preference is. Although in theory that could also just be _pages.ActivePage().Cursor().IsBlinking() (if it can't be changed it should already be set to the default).


// Restore cursor blinking mode.
_pages.ActivePage().Cursor().SetIsBlinking(true);
_pages.ActivePage().Cursor().SetIsBlinking(_optionalFeatures.test(OptionalFeature::CursorBlinking));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again this should assumedly be the user's default preference (what you've got in #20928).

auto& cursor = _pages.ActivePage().Cursor();
cursor.SetType(actualType);
cursor.SetIsBlinking(fEnableBlinking);
cursor.SetIsBlinking(fEnableBlinking && _optionalFeatures.test(OptionalFeature::CursorBlinking));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the ATT610_StartCursorBlink case, I think this needs to be an if, so it's left unchanged if the feature is disabled.

Comment on lines +4913 to +4914
_pages.ActivePage().Cursor().SetIsBlinking(false);
_pages.VisiblePage().Cursor().SetIsBlinking(false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing these would need to be _api.GetUserDefaultCursorStyle().second once #20928 is merged?

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Nov 17, 2026
Comment on lines +1757 to +1761
// Re-entering the alternate buffer can copy an older state from the main buffer.
if (!_optionalFeatures.test(OptionalFeature::CursorBlinking))
{
_pages.ActivePage().Cursor().SetIsBlinking(false);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but I think this should also be the user default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Settings Issues related to settings and customizability, for console or terminal Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Priority-2 A description (P2) Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for turning off cursor blink

3 participants