When changing cursor shape using DECSCUSR escape sequences, the cursor shape doesn't change until the cursor is moved #5762

Open
opened 2026-01-31 00:21:03 +00:00 by claunia · 0 comments
Owner

Originally created by @daxian-dbw on GitHub (Jan 3, 2020).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: 10.0.18363.0
Windows Terminal version (if applicable): 0.7.3451.0

Any other software?
`pwsh + PSReadLine`

Steps to reproduce

I tried to fix https://github.com/PowerShell/PSReadLine/issues/1233 in PSReadLine by always applying the standard escape sequences, so the cursor shape can be changed when switching between Insert and Command modes in the VI edit mode.

A quick fix looks like this: d29dad9842
It works fine in the terminals on Linux and macOS.
However, in Windows Terminal and VS Code terminal, the cursor shape doesn't changed immediately after writing out the escape sequences. The change happens only after the cursor is moved.

Expected behavior

The behavior should be the same as on Linux.

  1. type Esc to switch from insert mode to command mode. Cursor shape is changed to steady block.
  2. type i to switch from command mode to insert mode. Cursor shape is changed to blinking bar.
  3. type a to insert the character a.

linux

Actual behavior

This is what happens in Windows Terminal.

  1. type Esc to switch from insert mode to command mode. Cursor shape is changed to steady block.
  2. type i to switch from command mode to insert mode. Cursor shape doesn't change.
  3. type a to insert the character a. Cursor shape is changed to blinking bar. Moving the cursor with LeftArrow or RightArrow will also trigger the cursor shape change.

winterminal

Originally created by @daxian-dbw on GitHub (Jan 3, 2020). Originally assigned to: @zadjii-msft on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18363.0 Windows Terminal version (if applicable): 0.7.3451.0 Any other software? `pwsh + PSReadLine` ``` # Steps to reproduce I tried to fix https://github.com/PowerShell/PSReadLine/issues/1233 in PSReadLine by always applying the standard escape sequences, so the cursor shape can be changed when switching between Insert and Command modes in the VI edit mode. A quick fix looks like this: https://github.com/daxian-dbw/PSReadLine/commit/d29dad98426992c2d9f3b92cebedd7d85c4a0fac It works fine in the terminals on Linux and macOS. However, in Windows Terminal and VS Code terminal, the cursor shape doesn't changed immediately after writing out the escape sequences. The change happens only after the cursor is moved. # Expected behavior The behavior should be the same as on Linux. 1. type <kbd>Esc</kbd> to switch from insert mode to command mode. Cursor shape is changed to steady block. 2. type <kbd>i</kbd> to switch from command mode to insert mode. Cursor shape is changed to blinking bar. 3. type <kbd>a</kbd> to insert the character `a`. ![linux](https://user-images.githubusercontent.com/127450/71749029-3111ac00-2e29-11ea-9c42-e9bf2fe0febd.gif) # Actual behavior This is what happens in Windows Terminal. 1. type <kbd>Esc</kbd> to switch from insert mode to command mode. Cursor shape is changed to steady block. 2. type <kbd>i</kbd> to switch from command mode to insert mode. Cursor shape doesn't change. 3. type <kbd>a</kbd> to insert the character `a`. Cursor shape is changed to blinking bar. Moving the cursor with <kbd>LeftArrow</kbd> or <kbd>RightArrow</kbd> will also trigger the cursor shape change. ![winterminal](https://user-images.githubusercontent.com/127450/71749201-9bc2e780-2e29-11ea-84ba-02804f4be95a.gif)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5762