Console Terminal "Cursor Shape" gets reset when opening "Options" propsheet #1618

Closed
opened 2026-01-30 22:32:09 +00:00 by claunia · 2 comments
Owner

Originally created by @zadjii-msft on GitHub (Jun 12, 2019).

Originally assigned to: @zadjii-msft on GitHub.

Moved from MSFT:21001042

  1. go to properties / terminal

  2. select vertical bar

  3. click ok

at this point everything is good.

  1. go to properties / terminal

  2. go to option tab

  3. go to terminal tab

at this point you'll see that the cursor shape is reset to "legacy style". this only happens if you go to the "options tab". i think this happens because the options page as the "cursor size" option that is interfering -- just a guess.

Originally created by @zadjii-msft on GitHub (Jun 12, 2019). Originally assigned to: @zadjii-msft on GitHub. Moved from MSFT:21001042 1) go to properties / terminal 2) select vertical bar 3) click ok at this point everything is good. 1) go to properties / terminal 2) go to option tab 3) go to terminal tab at this point you'll see that the cursor shape is reset to "legacy style". this only happens if you go to the "options tab". i think this happens because the options page as the "cursor size" option that is interfering -- just a guess.
Author
Owner

@zadjii-msft commented on GitHub (Sep 4, 2019):

So this is more painful than I thought it was going to be.

You'd think it'd be easy enough to just not select a radio button from the group of legacy cursor sizes when the cursor style is set to something other than "legacy". Unfortunately, I don't think ComCtl lets you have a group of radio buttons where one isn't selected.

When you open the "options" page, the options page gets a WM_COMMAND. This WM_COMMAND is a BN_CLICKED sent to the selected[1] radio button from that group[2]. Unfortunately, this BN_CLICKED is indistinguishable from a real click. So we can't really ignore that message. We also however can't handle that message, because our handling of a click on IDD_CURSOR_SMALL means setting the cursor style back to Legacy.

I tried ignoring the first BN_CLICKED sent to the cursor size radio buttons, but that wouldn't work if you switched tabs. There's probably a workaround I haven't thought of here. My comctl-fu is definitely not passable, so I might be able to research more and find something. Maybe I can add a fake 0 height radio button as part of the group, as a placeholder for "non-legacy"

Technically, what we're doing here is a real anti-pattern. We shouldn't have one group of radio buttons that are affected by another group like this. We especially shouldn't have them on different pages. If we wanted to re-arrange that dialog, we'd almost certainly need to wait until the next (post-20H1) release to do that, to account for localization changes.

[1]: presumably the last selected. It might also just be sent to the first button for the case where a group has no buttons selected.
[2]: Apparently this is documented behavior

@zadjii-msft commented on GitHub (Sep 4, 2019): So this is more painful than I thought it was going to be. You'd think it'd be easy enough to just _not select_ a radio button from the group of legacy cursor sizes when the cursor style is set to something other than "legacy". Unfortunately, I don't think ComCtl lets you have a group of radio buttons where one _isn't_ selected. When you open the "options" page, the options page gets a `WM_COMMAND`. This `WM_COMMAND` is a `BN_CLICKED` sent to the selected<sup>[1]</sup> radio button from that group<sup>[2]</sup>. Unfortunately, this `BN_CLICKED` is indistinguishable from a real click. So we can't really ignore that message. We also however can't _handle_ that message, because our handling of a click on `IDD_CURSOR_SMALL` means setting the cursor style back to Legacy. I tried ignoring the first `BN_CLICKED` sent to the cursor size radio buttons, but that wouldn't work if you switched tabs. There's probably a workaround I haven't thought of here. My comctl-fu is definitely not passable, so I might be able to research more and find something. Maybe I can add a fake 0 height radio button as part of the group, as a placeholder for "non-legacy" Technically, what we're doing here is a real anti-pattern. We shouldn't have one group of radio buttons that are affected by another group like this. We especially shouldn't have them on different pages. If we wanted to re-arrange that dialog, we'd almost certainly need to wait until the next (post-20H1) release to do that, to account for localization changes. [1]: presumably the last selected. It might also just be sent to the first button for the case where a group has _no_ buttons selected. [2]: Apparently this is [documented behavior](https://microsoft.public.win32.programmer.ui.narkive.com/54Prl4Mj/repeated-wm-command-bn-clicked-messages-for-the-first-radio-control#post2)
Author
Owner

@ExE-Boss commented on GitHub (Sep 9, 2019):

Now all we need is for https://github.com/PowerShell/PSReadLine/issues/903 to be resolved.

@ExE-Boss commented on GitHub (Sep 9, 2019): Now all we need is for https://github.com/PowerShell/PSReadLine/issues/903 to be resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1618