PSReadLine's -ViModeIndicator "Cursor" doesn't work correctly #17642

Closed
opened 2026-01-31 05:48:41 +00:00 by claunia · 6 comments
Owner

Originally created by @nlguerra2003 on GitHub (Jun 6, 2022).

Windows Terminal version

1.12.10983.0

Windows build number

10.0.22621.0

Other Software

PSReadLine

Steps to reproduce

  • Activate PSReadLine's Vi mode: Set-PSReadLineOption -EditMode Vi
  • Activate "Cursor" as mode indicator: Set-PSReadLineOption -ViModeIndicator Cursor
  • Since you start in INSERT mode, just type Esc to change to NORMAL.

Expected Behavior

Cursor should, as it happens in "pure" powershell, be a box in NORMAL mode, and the default one in INSERT (it doesn't matter what cursor you set up in WT).

Actual Behavior

Cursor won't change no matter what mode you select. It will always be the configured cursor.

Originally created by @nlguerra2003 on GitHub (Jun 6, 2022). ### Windows Terminal version 1.12.10983.0 ### Windows build number 10.0.22621.0 ### Other Software PSReadLine ### Steps to reproduce - Activate PSReadLine's Vi mode: `Set-PSReadLineOption -EditMode Vi` - Activate "Cursor" as mode indicator: `Set-PSReadLineOption -ViModeIndicator Cursor` - Since you start in INSERT mode, just type Esc to change to NORMAL. ### Expected Behavior Cursor should, as it happens in "pure" powershell, be a box in NORMAL mode, and the default one in INSERT (it doesn't matter what cursor you set up in WT). ### Actual Behavior Cursor won't change no matter what mode you select. It will always be the configured cursor.
claunia added the Issue-BugResolution-ExternalNeeds-Tag-Fix labels 2026-01-31 05:48:41 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jun 6, 2022):

Which version of PowerShell and PSReadline are you using/?

@zadjii-msft commented on GitHub (Jun 6, 2022): Which version of PowerShell and PSReadline are you using/?
Author
Owner

@nlguerra2003 commented on GitHub (Jun 6, 2022):

PS Version: 7.2.4
PSReadLine Version: 2.2.5
@nlguerra2003 commented on GitHub (Jun 6, 2022): ``` PS Version: 7.2.4 PSReadLine Version: 2.2.5 ```
Author
Owner

@juliekoubova commented on GitHub (Dec 26, 2022):

Happy holidays, folks! Any update on this?

@juliekoubova commented on GitHub (Dec 26, 2022): Happy holidays, folks! Any update on this?
Author
Owner

@j4james commented on GitHub (Dec 26, 2022):

The problem was that PSReadLine was originally using the .NET Console.CursorSize API to change the cursor size, and that relies on the Win32 SetConsoleCursorInfo API, which isn't supported in Windows Terminal (that's more or less tracked in issue #7382).

The good news is that PSReadLine recently merged a PR (https://github.com/PowerShell/PSReadLine/pull/3374) which updates the ViModeIndicator implementation to use escape sequences to change the cursor shape (switching between a block cursor and underscore cursor), and that should work in Windows Terminal.

Unfortunately it doesn't look like that fix has been released yet, but I'm guessing it will likely be included in the next PSReadLine release.

@j4james commented on GitHub (Dec 26, 2022): The problem was that PSReadLine was originally using the .NET `Console.CursorSize` API to change the cursor size, and that relies on the Win32 `SetConsoleCursorInfo` API, which isn't supported in Windows Terminal (that's more or less tracked in issue #7382). The good news is that PSReadLine recently merged a PR (https://github.com/PowerShell/PSReadLine/pull/3374) which updates the `ViModeIndicator` implementation to use escape sequences to change the cursor shape (switching between a block cursor and underscore cursor), and that should work in Windows Terminal. Unfortunately it doesn't look like that fix has been released yet, but I'm guessing it will likely be included in the next PSReadLine release.
Author
Owner

@zadjii-msft commented on GitHub (Jan 3, 2023):

Sorry, must've lost this in the backlog.

Yep, I'd reckon this is fixed by the aforementioned upstream PsReadline issue.

/dup https://github.com/PowerShell/PSReadLine/issues/3334

@zadjii-msft commented on GitHub (Jan 3, 2023): Sorry, must've lost this in the backlog. Yep, I'd reckon this is fixed by the aforementioned upstream PsReadline issue. /dup https://github.com/PowerShell/PSReadLine/issues/3334
Author
Owner

@ghost commented on GitHub (Jan 3, 2023):

Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report!

@ghost commented on GitHub (Jan 3, 2023): Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17642