Add new cursor types ‗ #9441

Closed
opened 2026-01-31 01:54:33 +00:00 by claunia · 5 comments
Owner

Originally created by @iricigor on GitHub (Jul 4, 2020).

Description of the new feature/enhancement

Currently in cmd.exe and windows terminal we have a couple of options to customize cursor shape. It might be interesting to add additional options there, and I would propose to start with double underline.

image

Image adjusted from MS devblogs.

This would give to WT a new unique feature, which I am not aware other terminals do have. 🥇

Proposed technical implementation details (optional)

I presume, for start, it would be needed to add new shape functionality to paint.cpp, something like:

case CursorType::DoubleUnderscore:
        line1 = line2 = rcBoundaries;
        RETURN_IF_FAILED(LongAdd(line1.bottom, -1, &line1.top));
        RETURN_IF_FAILED(LongAdd(line1.bottom, -3, &line1.top));
        cursorInvertRects.push_back(line1);
        cursorInvertRects.push_back(line2);
        break;

Of course, additional code and documentation changes would be needed, but I think that should not be hard to do. 😸

Originally created by @iricigor on GitHub (Jul 4, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> Currently in cmd.exe and windows terminal we have a couple of options to [customize cursor shape](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-settings#cursor-settings). It might be interesting to add additional options there, and I would propose to start with **double underline**. ![image](https://user-images.githubusercontent.com/15923171/86520436-882e2300-be44-11ea-9c08-9bbc0b527125.png) _Image adjusted from [MS devblogs](https://devblogs.microsoft.com/commandline/new-experimental-console-features/)._ This would give to WT a new unique feature, which I am not aware other terminals do have. 🥇 # Proposed technical implementation details (optional) I presume, for start, it would be needed to add new shape functionality to [paint.cpp](https://github.com/microsoft/terminal/blob/396cbbb151ccd6fc9ae0356771ce1a5af5623e48/src/renderer/gdi/paint.cpp#L569), something like: ```cpp case CursorType::DoubleUnderscore: line1 = line2 = rcBoundaries; RETURN_IF_FAILED(LongAdd(line1.bottom, -1, &line1.top)); RETURN_IF_FAILED(LongAdd(line1.bottom, -3, &line1.top)); cursorInvertRects.push_back(line1); cursorInvertRects.push_back(line2); break; ``` Of course, additional code and documentation changes would be needed, but I think that should not be hard to do. 😸 <!-- A clear and concise description of what you want to happen. -->
Author
Owner

@zadjii-msft commented on GitHub (Jul 16, 2020):

I'm okay with this. I believe the EmptyBox cursor is already one of the cursors that's not possible to set with VT, so we might as well have others.

@zadjii-msft commented on GitHub (Jul 16, 2020): I'm okay with this. I believe the EmptyBox cursor is already one of the cursors that's **not** possible to set with VT, so we might as well have others.
Author
Owner

@mdtauk commented on GitHub (Jul 16, 2020):

Are new cursors, something that could be added as extensions in the future? There could be some cool animated effects that would add a touch of flare to the experience.

  • Rainbow or Pride cursors;
  • Animated sprite running on the spot;
  • Animated gradients or glitter and sparkle effects;
  • Simple throbbing effect as the cursor "breathes" with a simple fade in and out;
    etc
@mdtauk commented on GitHub (Jul 16, 2020): Are new cursors, something that could be added as extensions in the future? There could be some cool animated effects that would add a touch of flare to the experience. - Rainbow or Pride cursors; - Animated sprite running on the spot; - Animated gradients or glitter and sparkle effects; - Simple throbbing effect as the cursor "breathes" with a simple fade in and out; etc
Author
Owner

@zadjii-msft commented on GitHub (Jul 16, 2020):

@mdtauk That's definitely something we'd want to consider for renderer extensions (over in #4000). If our goal is to make the retro terminal effect an extension one day, then cursor effects should be much easier than that 😆

@zadjii-msft commented on GitHub (Jul 16, 2020): @mdtauk That's definitely something we'd want to consider for renderer extensions (over in #4000). If our goal is to make the retro terminal effect an extension one day, then cursor effects should be _much_ easier than that 😆
Author
Owner

@rhorber commented on GitHub (Oct 2, 2020):

Hello
I would like to work on this, if it's okay.

I already fiddled a bit. Am I right that there is a GDI- and a DirectX-Renderer?
If my assumption is right, I got two questions:

  • How am I able to test the GDI renderer with Microsoft's Dev VM?
  • For the DirectX renderer: Would you prefer a stack/vector of rectangles or a new CursorPaintType (i.e. DoubleLine) in CustomTextRenderer::_drawCursor?

Thanks.

@rhorber commented on GitHub (Oct 2, 2020): Hello I would like to work on this, if it's okay. I already fiddled a bit. Am I right that there is a GDI- and a DirectX-Renderer? If my assumption is right, I got two questions: - How am I able to test the GDI renderer with Microsoft's Dev VM? - For the DirectX renderer: Would you prefer a stack/vector of rectangles or a new CursorPaintType (i.e. DoubleLine) in [CustomTextRenderer::_drawCursor](https://github.com/microsoft/terminal/blob/4a114971f966be4d85113bf160a9a4603a62fc02/src/renderer/dx/CustomTextRenderer.cpp#L241)? Thanks.
Author
Owner

@rhorber commented on GitHub (Oct 5, 2020):

As you see, I created a PR. I came up with a more generic approach than a CursorPaintType "DoubleLine". I created one named HorizontalOnly, IMHO turning the second question obsolete. This would allow the addition of more "horizontal only" cursors, i.e. just an overline and underline...

Let me know if I should perform more steps (i.e. add automated tests).

@rhorber commented on GitHub (Oct 5, 2020): As you see, I created a PR. I came up with a more generic approach than a `CursorPaintType` "DoubleLine". I created one named `HorizontalOnly`, IMHO turning the second question obsolete. This would allow the addition of more "horizontal only" cursors, i.e. just an overline and underline... Let me know if I should perform more steps (i.e. add automated tests).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9441