terminal: Inverse cursor color logic is (sometimes) broken
Environment
Windows build number:
Microsoft Windows [Version 10.0.18362.449]
Windows Terminal version (if applicable):
No.
Any other software?
No.
Steps to reproduce
- Open cmd.exe.
- Go to window properties, “Colors” page.
- Set “Screen Background” value to exactly
128 128 128.
Expected behavior
Cursor is visible no matter what background color is.
Actual behavior
Now you see it, now you don’t.
Current “inverse” logic is too straightforward - it literally takes the inverse of the background, and for 128 128 128 the inverse is… 127 127 127, which is basically the same thing. Oops.
Note: Legacy console handles this corner case properly, as well as all Windows versions prior to 10.
Also, legacy console inversion algorithm is not exactly “inverse” - the colors are slightly different (and subjectively more pleasant). Is it possible to get this classic inversion in the modern console please?
This issue affects a text editor app that uses console color 8 (128 128 128 in classic color scheme) to highlight various parts of text (e.g. current line). Sudden cursor disappearing is confusing and annoying.
Example:

About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 15 (14 by maintainers)
Commits related to this issue
- Make sure the inverted cursor is always readable (#3647) — committed to alabuzhev/terminal by alabuzhev 2 years ago
- Make sure the inverted cursor is always readable (#3647) — committed to alabuzhev/terminal by alabuzhev 2 years ago
- Make sure the inverted cursor is always readable (#3647) (#13748) Currently "Inverse Cursor" is actually simply bitwise inversed. It works fine, except when it does not, namely in the middle of the ... — committed to microsoft/terminal by alabuzhev 2 years ago
If you’d like to submit a PR for this - go for it!