Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for solid cursor blinking style #2892

Conversation

skyline75489
Copy link
Collaborator

Summary of the Pull Request

Added cursor blinking style. Mainly for solid cursor blinking style which simply disables binking.

References

PR Checklist

  • Closes Add support for turning off cursor blink #1379
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan.

Detailed Description of the Pull Request / Additional comments

The idea is from #1379 and VSCode. VSCode has several cursor blinking style, including blink, solid, and other animated styles.

Validation Steps Performed

Add configurationi to profile and see how it looks like:

{
    "cursorShape": "filledBox",
    "cursorBlinking": "solid",
}

@Kagami
Copy link

Kagami commented Sep 30, 2019

👍 cursor blinking is annoying

@miniksa
Copy link
Member

miniksa commented Oct 11, 2019

I'm not sure about this.

I would almost think what we'd do is instead let you set your own blink time as a setting. If it's null, we call GetCaretBlinkTime() and if it is a value, we use it instead. Then someone can set that value to INFINITE (or we can overload and parse the word 'infinite' and substitute in 0xFFFFFFFF). and just use the existing code.

I would want to hear what

  1. @zadjii-msft and @DHowett-MSFT think about having yet another way of modifying the way cursor blink state works
  2. @cinnamon-msft on what she thinks is the least confusing way to describe such a configuration option.

@skyline75489
Copy link
Collaborator Author

@miniksa Originally I had the exact idea just like what you described. Then I opened VSCode to see how it handles cursor options and it got me here. VSCode has Cursor Blinking(controls the cursor animation style) and Cursor Style(controls the cursor style), which is two different aspects that coordinate with each other. Even though WT may not need all those fancy cursor animation like VSCode, it provides flexibility to do it. I thought it was great and stole the idea to craft this PR.

@skyline75489
Copy link
Collaborator Author

A side note, VSCode doesn't seem to respect GetCaretBlinkTime() though. Reasonable to me as it is, after all, an editor instead of a terminal emulator.

@j4james
Copy link
Collaborator

j4james commented Oct 20, 2019

Another option to consider is just hooking into the Cursor::SetBlinkingAllowed method, the same way the cursorShape, cursorColor, and cursorHeight properties are forwarded to the Cursor::SetStyle method. That way the behavior of the various cursor properties is consistent, and you don't need to reimplement the whole mechanism for turning the blinking on and off - it should just work with the existing code.

Have a look at the way Terminal::UpdateSettings handles the cursor properties here:

_buffer->GetCursor().SetStyle(settings.CursorHeight(),
settings.CursorColor(),
cursorShape);

@qqkookie
Copy link

qqkookie commented Nov 14, 2019

Blinking is only binary on/off option, so how about merging cursor blinking attribute and cursor shape attribute into one attribute as "cursorStyle", like "filledbox" vs "static-filledbox", or "blinking-filledbox" vs "filledbox"?

The name "solid" for non-blinking cursor is confusing. Normally "solid box" means "filledbox". So "solid-emptybox" may be confusing. I prefer "static" as non-blinking attribute name.

The cursor name "filledbox" is rather strange too. I suggest to use name like "solidbox" or "fullbox" (Unicode name) for current "filledbox" attribute value name.

The cursor name "vintage" is also not intuitive. How about " quarterblock"?

Most people will use just one of "static-solidbox" or "blinking-bar". IMHO, default should be static and solidbox (filledbox). And if WT window lose input focus, cursor should stop blinking and turn into static-emptybox.

@qqkookie
Copy link

And there is feature request for width of vertical bar and height of filledbox (#3167). These are only applied or meaningful to specific shape of cursor. Having separate attributes for all these may be overly complicated. To prevent such proliferation of cursor attributes and their combinations, cursor style attribute should be limited to single attribute "cursorStyle". For example, "double-bar", "tall-solidbox" with limited variation of blinking and non-blinking.

ghost pushed a commit that referenced this pull request Mar 13, 2020
Adds support for setting the cursor visibility in Terminal. Visibility
is a property entirely independent from whether the cursor is "on" or
not. The cursor blinker _should_ change the "IsOn" property. It was
actually changing the "Visible" property, which was incorrect. This PR
additionally corrects the naming of the method used by the cursor
blinker, and makes it do the right thing.

I added a pair of tests, one taken straight from conhost. In
copy-pasting that test, I took it a step further and implemented
`^[[?12h`, `^[[?12l`, which enables/disables cursor blinking, for the
`TerminalCore`. THIS DOES NOT ADD SUPPORT FOR DISABLING BLINKING IN THE
APP. Conpty doesn't emit the blinking on/off sequences quite yet, but
when it _does_, the Terminal will be ready.

## References
* I'd bet this conflicts with #2892
* This isn't a solution for #1379
* There shockingly isn't an issue for cursor blink state via conpty...?

## PR Checklist
* [x] Closes #3093
* [x] Closes #3499
* [x] Closes #4644
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated
@carlos-zamora carlos-zamora added the Product-Terminal The new Windows Terminal. label May 28, 2020
@3dWrecker
Copy link

3dWrecker commented Jun 5, 2020

OK, What if the text and cursor colour are the same? I think we need an inverted colour option.
ezgif-3-36a078a58589
Or maybe as in Ubuntu:
Annotation 2020-06-05 160203
This exchanges the text colour and background colour in the "characterspace".

@skyline75489
Copy link
Collaborator Author

@3dWrecker Lucky you. That was fixed recently by #6337 . Well not exactly fixed, but it's way better now.

@skyline75489
Copy link
Collaborator Author

This PR is stale and no longer valid. Close it for now.

@mdtauk
Copy link

mdtauk commented Jun 5, 2020

Could there be an option to animate the blinking, by fading it in and out?

@skyline75489
Copy link
Collaborator Author

@mdtauk Let's take the discussion to #1379 where many ideas are shared by people. This PR is way too stale for any meaningful discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
9 participants