Inverse cursor color logic is (sometimes) broken #5106

Open
opened 2026-01-31 00:05:11 +00:00 by claunia · 0 comments
Owner

Originally created by @alabuzhev on GitHub (Nov 21, 2019).

Environment

Windows build number:
Microsoft Windows [Version 10.0.18362.449]

Windows Terminal version (if applicable):
No.

Any other software?
No.

Steps to reproduce

  1. Open cmd.exe.
  2. Go to window properties, "Colors" page.
  3. 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:

image

Originally created by @alabuzhev on GitHub (Nov 21, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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: Microsoft Windows [Version 10.0.18362.449] Windows Terminal version (if applicable): No. Any other software? No. ``` # Steps to reproduce 1. Open cmd.exe. 1. Go to window properties, "Colors" page. 2. Set "Screen Background" value to exactly `128 128 128`. <!-- A description of how to trigger this bug. --> # Expected behavior Cursor is visible no matter what background color is. <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior Now you see it, now you don't. <!-- What's actually happening? --> # 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: ![image](https://user-images.githubusercontent.com/11453922/69289150-871cee00-0bf3-11ea-8893-219d107a5ca5.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5106