microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.43k stars 8.3k forks source link

Make certain that the cursor can invert/not-occlude/display the character under it #9610

Closed DHowett closed 1 year ago

DHowett commented 3 years ago

I've been using WSL for a while and it's been great, but using nvim with this issue still pending is at times unusable. Other terminals are not having this issue (see ConEmu or Hyper for example). I hope this issue gets re-opened.

Originally posted by @n1ghtmare in https://github.com/microsoft/terminal/issues/1203#issuecomment-801461436

I'm with @n1ghtmare on this one. Most syntax highlighting colors in Vim have a wide array of colors that very much clash with the cursor color when the cursor color isn't able to be swapped to a contrasted color dynamically. This has been demonstrated in the few screenshots I uploaded before. It affects everyone using terminal Vim or another terminal based text editor.

I know @pianocomposer321 said to pick a better color for the cursor but this doesn't make a difference in the end. If he adjusted his screenshot to be over a comment instead of the keyword then the comment's character under the cursor would be invisible. Also in his current screenshot the contrast is very low, it would certainly not be good enough for a video recording or giving a talk.

As good as the MS terminal is, I still tend to use wsltty (which dynamically sets its cursor color based on contrast calculations) in my day to day because having a block cursor in terminal Vim is much better than the vintage cursor in the MS terminal. Not just from a legibility POV, but it allows you to configure Vim so that your cursor shape changes from the block cursor to a line cursor depending on if you're in normal or insert mode.

Originally posted by @nickjj in https://github.com/microsoft/terminal/issues/1203#issuecomment-801475389

Subscribers, thumbs-uppers from that comment: @krage, @saurik, @krage

3N4N commented 1 year ago

I hope to soon use block cursor like god intended (I'm currently using vintage shape because of this indistinguishable-character issue).

You could try god's intended cursors right now, if you're curious. 😏 Here is a preview build based on that PR.

Awesome! Been using for a few hours. Works great! Thanks a bunch.

avih commented 1 year ago

IMHO, if you insist on choosing the FG color yourself and not letting the user specify it, then just pick either black or white - whichever has the better contrast to the chosen cursor BG color.

IMO it would pretty much gurante to look better than any attempt to preserve the underlaying FG color but still modifying it so that it has some contrast to the BG.

Just see how many failed atempts there were at that, to realise that it's not as simple as you think to do what the user prefer automatically.

nickjj commented 1 year ago

I think if we stick with setting it manually then we're not going to address the root issue where characters are invisible based on syntax highlighting in terminal based editors such as Vim. You're going to have a wide range of dark and light text based on any variant of color themes.

habamax commented 1 year ago

I think if we stick with setting it manually then we're not going to address the root issue where characters are invisible based on syntax highlighting in terminal based editors such as Vim. You're going to have a wide range of dark and light text based on any variant of color themes.

I have used vim for a long time in different terminals that allow setting bg and fg for a cursor -- never had an issue with syntax highlighting and cursor. If your terminal background is black, set cursor colors to white and black, do the opposite if terminal background is light/white. It always worked, it would have worked in windows terminal too.

But anyway, if that new implementation would let us distinguish what is under cursor, I am all for it.

nickjj commented 1 year ago

I have used vim for a long time in different terminals that allow setting bg and fg for a cursor -- never had an issue with syntax highlighting and cursor.

@habamax This issue has multiple screenshots showing how it would be an issue with a statically configured cursor color.

Here's a screenshot you posted a while back: image

Your screenshot is also a near-best case scenario because you have pretty bright colors and there's only a few colors shown at once.

habamax commented 1 year ago

@nickjj it is about other terminals that allow setup of cursor background AND FOREGROUND colors. Like gnome-terminal, for example: image

gaoqiangks commented 1 year ago

So, what's the solution? Many issues are closed but I still cann't find a solution.

lhecker commented 1 year ago

Did you try Windows Terminal Preview 1.18 yet? If that doesn’t work for you it’d be great if you could open a new issue with a screenshot showing the problem and I‘ll try to fix it ASAP. 🙂

If you’re asking about setting individual foreground and background colors for the cursor, I don’t think we have an issue tracking specifically that yet, but I‘ve already made it my goal to implement that for 1.19 anyways.

gaoqiangks commented 1 year ago

WT Preview 1.18 is much better. Thank you!

weibeld commented 1 year ago

This is now being discusses in #15766.