dynamic cursorShape for shell vi mode #6636

Closed
opened 2026-01-31 00:43:36 +00:00 by claunia · 4 comments
Owner

Originally created by @mpgarate on GitHub (Feb 27, 2020).

Hello Terminal team 👋

Description of the new feature/enhancement

When normal mode is active in vim or shell vi mode, the cursor stays in the same style ("bar"). On mac and linux terminals the cursor would typically change to something like the "emptyBox" shape for normal mode and "bar" for insert mode.

To reproduce this behavior, we can use Windows Terminal to run cygwin or access a linux machine via ssh and run the following:

set -o vi

Then, pressing escape will enter normal mode where we might expect to see a box highlighting the current letter. Instead we still see the "bar" style, moved one character back. The "box" appearance is helpful to see which character is selected and as a visual aid to know when insert or normal mode is active.

I found a few workarounds for vim using vimrc (i.e. in issue #68) but have not yet seen a suggestion for shell vi mode.

Originally created by @mpgarate on GitHub (Feb 27, 2020). Hello Terminal team 👋 # Description of the new feature/enhancement When normal mode is active in vim or shell vi mode, the cursor stays in the same style ("bar"). On mac and linux terminals the cursor would typically change to something like the "emptyBox" shape for normal mode and "bar" for insert mode. To reproduce this behavior, we can use Windows Terminal to run cygwin or access a linux machine via ssh and run the following: ```sh set -o vi ``` Then, pressing escape will enter normal mode where we might expect to see a box highlighting the current letter. Instead we still see the "bar" style, moved one character back. The "box" appearance is helpful to see which character is selected and as a visual aid to know when insert or normal mode is active. I found a few workarounds for vim using vimrc (i.e. in issue #68) but have not yet seen a suggestion for shell vi mode.
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 00:43:36 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Feb 27, 2020):

Maybe some combo of #4106, #1604 - I could have sworn there was a more specific dupe...

@zadjii-msft commented on GitHub (Feb 27, 2020): Maybe some combo of #4106, #1604 - I could have sworn there was a more specific dupe...
Author
Owner

@jdebp commented on GitHub (Feb 27, 2020):

Windows Terminal already supports the DECSCUSR control sequence with parameters from 1 to 8. There's nothing else that Windows Terminal has to do, here, pace the bug about it not taking effect until flushed. The rest is all at the host end.

The rest is a matter of having the Ss and Se capabilities in your terminfo database records, and a shell that understands those (relatively new, as they were invented in 2011) terminal capabilities. It is almost certainly terminal type and terminfo that is your problem here.

@jdebp commented on GitHub (Feb 27, 2020): Windows Terminal already supports the DECSCUSR control sequence with parameters from 1 to 8. There's nothing else that Windows Terminal has to do, here, pace the bug about it not taking effect until flushed. The rest is all at the host end. The rest is a matter of having the `Ss` and `Se` capabilities in your terminfo database records, and a shell that understands those (relatively new, as they were invented in 2011) terminal capabilities. It is almost certainly terminal type and terminfo that is your problem here.
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 27, 2020):

Indeed! Thanks @jdebp.

In addition, somebody's put together a solution for versions of readline that do not take Ss and Se into account: https://stackoverflow.com./a/48449104

@DHowett-MSFT commented on GitHub (Feb 27, 2020): Indeed! Thanks @jdebp. In addition, somebody's put together a solution for versions of readline that do not take `Ss` and `Se` into account: https://stackoverflow.com./a/48449104
Author
Owner

@mpgarate commented on GitHub (Feb 28, 2020):

Thank you for the responses. In my case, cygwin with bash 4.4.12 did not work with show-mode-in-prompt, and (as expected) this did not work in an older linux bash 4.2.46 I had available for testing. It will take some more investigation on my part to troubleshoot.

@mpgarate commented on GitHub (Feb 28, 2020): Thank you for the responses. In my case, cygwin with bash 4.4.12 did not work with `show-mode-in-prompt`, and (as expected) this did not work in an older linux bash 4.2.46 I had available for testing. It will take some more investigation on my part to troubleshoot.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6636