[Terminal] Cursor shape escape sequences not working #861

Closed
opened 2026-01-30 22:06:58 +00:00 by claunia · 4 comments
Owner

Originally created by @caksoylar on GitHub (May 8, 2019).

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    Microsoft Windows [Version 10.0.18362.86]

  • What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots)
    Using DECSCUSR escape sequences do not change the cursor shape, which is fixed to what it is set in profiles.json.

  • What's wrong / what should be happening instead:
    Cursor shape changes like it does in conhost, see conhost above and Terminal below:
    decscusr

AFAICT all sequences here are supported in conhost, and larger values (e.g. echo -e -n "\x1b[\x37 q") changes it to the "legacy underscore" version. Also related https://github.com/microsoft/Terminal/issues/68.

Originally created by @caksoylar on GitHub (May 8, 2019). * Your Windows build number: (Type `ver` at a Windows Command Prompt) Microsoft Windows [Version 10.0.18362.86] * What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots) Using [DECSCUSR](https://vt100.net/docs/vt510-rm/DECSCUSR.html) escape sequences do not change the cursor shape, which is fixed to what it is set in `profiles.json`. * What's wrong / what should be happening instead: Cursor shape changes like it does in `conhost`, see conhost above and Terminal below: ![decscusr](https://user-images.githubusercontent.com/7876996/57409245-a646b780-719c-11e9-9418-87387c67e9a7.png) AFAICT all sequences [here](https://stackoverflow.com/a/17100535) are supported in conhost, and larger values (e.g. `echo -e -n "\x1b[\x37 q"`) changes it to the "legacy underscore" version. Also related https://github.com/microsoft/Terminal/issues/68.
claunia added the Resolution-Fix-CommittedIssue-BugArea-VTProduct-Terminal labels 2026-01-30 22:06:58 +00:00
Author
Owner

@zadjii-msft commented on GitHub (May 8, 2019):

Yep that's correct, the cursor sequences aren't hooked up quite yet for the terminal.

If someone wants to take their chances at implementing this themselves, I'd take a look at Terminal.h/cpp, TerminalApi.cpp, TerminalDispatch.cpp.

I believe these two are the methods that need to be Implemented in TerminalDispatch:

    // From TermDispatch.hpp
    virtual bool SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle) = 0; // DECSCUSR
    virtual bool SetCursorColor(const COLORREF Color) = 0; // OSCSetCursorColor, OSCResetCursorColor
@zadjii-msft commented on GitHub (May 8, 2019): Yep that's correct, the cursor sequences aren't hooked up quite yet for the terminal. If someone wants to take their chances at implementing this themselves, I'd take a look at Terminal.h/cpp, TerminalApi.cpp, TerminalDispatch.cpp. I believe these two are the methods that need to be Implemented in TerminalDispatch: ``` c++ // From TermDispatch.hpp virtual bool SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle) = 0; // DECSCUSR virtual bool SetCursorColor(const COLORREF Color) = 0; // OSCSetCursorColor, OSCResetCursorColor ```
Author
Owner

@anirudhrb commented on GitHub (May 22, 2019):

Hi! Is anybody working on this? I would like to take a stab at it!

@anirudhrb commented on GitHub (May 22, 2019): Hi! Is anybody working on this? I would like to take a stab at it!
Author
Owner

@simlei commented on GitHub (Oct 7, 2019):

In my version -- latest released to date, and with Powershell Core -- the cursor still does not change shape in vim on WSL.

@simlei commented on GitHub (Oct 7, 2019): In my version -- latest released to date, and with Powershell Core -- the cursor still does not change shape in vim on WSL.
Author
Owner

@aaronbieber commented on GitHub (Apr 19, 2022):

I deleted a previous comment asserting that this is not fixed, which was incorrect.

However, it is true that neither Vim nor Emacs seem to be able to detect (or detect reliably and/or accurately) the capabilities of the terminal to enable the cursor behavior that one would expect after using the GUI versions of those programs.

I'm leaving this note for anyone who stumbles on this thread, as I did. You will likely need to amend your Vim or Emacs configuration to make cursor shape change as you expect.

If you use Emacs, you may try the evil-terminal-cursor-changer package (available in Melpa), though note that as of this time, that package will not correctly identify Windows Terminal as an xterm-compatible terminal, so you should set the XTERM_VERSION environment variable to any value (I did that from within my Emacs config), to force it to use the xterm escape sequences.

@aaronbieber commented on GitHub (Apr 19, 2022): I deleted a previous comment asserting that this is not fixed, which was incorrect. However, it is true that neither Vim nor Emacs seem to be able to detect (or detect reliably and/or accurately) the capabilities of the terminal to enable the cursor behavior that one would expect after using the GUI versions of those programs. I'm leaving this note for anyone who stumbles on this thread, as I did. You will likely need to amend your Vim or Emacs configuration to make cursor shape change as you expect. If you use Emacs, you may try the `evil-terminal-cursor-changer` package (available in Melpa), though note that as of this time, that package will not correctly identify Windows Terminal as an xterm-compatible terminal, so you should set the `XTERM_VERSION` environment variable to any value (I did that from within my Emacs config), to force it to use the xterm escape sequences.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#861