Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IME]CursorColour does not work with specific BackgroundColour #548

Closed
experimentlain opened this issue May 6, 2016 · 5 comments
Closed

Comments

@experimentlain
Copy link

experimentlain commented May 6, 2016

When I enable IME, the cursor color does not change with the configuration below:

BackgroundColour=  7,  54,  66
IMECursorColour=   0, 138,   0

but it works with this config:

BackgroundColour=  7,  54,  66
IMECursorColour=   0, 139,   0

I attached .minttyrc to reproduce the problem.
I am using mintty 2.3.6 x86_64-pc-cygwin on Windows 7 x64 and MS Office IME 2010.
minttyrc.txt

@mintty
Copy link
Owner

mintty commented May 6, 2016

Did it work with any earlier version of mintty?
How can the problem be reproduced? (Advice on IME download/activation, please)

@experimentlain
Copy link
Author

experimentlain commented May 6, 2016

I tried 2.1.5 and it does not work.
About IME, I do not know handy one, but Google IME (https://www.google.com/ime/) may be easy to install.

I glanced over mintty code, and probably I found the reason. In win_text() function in wintext.c:

bool too_close = colour_dist(cursor_colour, bg) < 32768;

if (too_close)
  cursor_colour = fg;

this code corrects the cursor color to the foreground color, if the cursor color is "too close" to the background color. I tried commenting out this code, and my .minttyrc worked well.

This behavior may be an intended one, but I think this is too strict at least. I do not think colors (7, 54, 66) and (0, 138, 0) are "too close". About the color-contrast problem, I think it is the most simple to leave it to the users.

Edit: this problem applies also to CursorColour. so you do not need to install IME. I put another .minttyrc to reproduce the problem.
minttyrc.txt

@mintty mintty changed the title IMECursorColour does not work with specific BackgroundColour [IME]CursorColour does not work with specific BackgroundColour May 26, 2016
@mintty
Copy link
Owner

mintty commented May 26, 2016

I have significantly reduced the minimum distance that triggers this behaviour. That restriction could arguably be removed at all, but the code has been in place for so long already...

@mintty
Copy link
Owner

mintty commented May 27, 2016

Tweaked previous patch. Minimum trigger raised again (although lower than before) but "brightening" the cursor colour rather than just changing it (algorithm was already in use for brightened ANSI colours).

@mintty
Copy link
Owner

mintty commented Jul 7, 2016

Released in 2.4.0.

@mintty mintty closed this as completed Jul 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants