molokai icon indicating copy to clipboard operation
molokai copied to clipboard

revert MatchParen color changes

Open shime opened this issue 9 years ago • 20 comments

They make matched parens look exactly the same as the cursor. This is very confusing, so revert that change.

shime avatar Jan 23 '15 10:01 shime

Why would this only affect the terminal version? What color is the cursor in the GUI version?

The matched parens are orange. I do not see the cursor being set to orange anywhere in this plugin, can you point to it?

justinmk avatar Jan 23 '15 23:01 justinmk

The changes is better.

blindlf avatar Apr 28 '15 13:04 blindlf

I also believe that the current colors on MatchParen are a little disorienting. To demonstrate:

hi MatchParen      ctermfg=233  ctermbg=208 cterm=bold

previous

hi MatchParen      ctermfg=208 ctermbg=233 cterm=bold 

after

If we go vertically the problem becomes even more apparent. It feels as if the cursor suddenly jumps away despite moving steadily up or down.

hi MatchParen      ctermfg=233  ctermbg=208 cterm=bold

js-previous

hi MatchParen      ctermfg=208 ctermbg=233 cterm=bold 

js-after

These were taken on Ubuntu 14.04 (vbox), using vim and tmux in gnome-terminal.

Relevant configuration files:

.vimrc

   if $COLORTERM == 'gnome-terminal'                                              
        set t_Co=256                                                           
   endif                                                                          

   colorscheme molokai   

.bashrc

export TERM=screen-256color

.tmux.conf

set -g default-terminal "screen-256color" 

nstratos avatar May 22 '15 12:05 nstratos

@justinmk sorry but I didn't find time to provide any additional info, the gifs @nstratos provided wonderfully display what was happening to me. thanks @nstratos!

shime avatar May 22 '15 15:05 shime

It feels as if the cursor suddenly jumps away despite moving steadily up or down.

Then set noshowmatch or fix it locally. Don't change the upstream colorscheme to suit your showmatch preferences.

justinmk avatar May 22 '15 17:05 justinmk

@shime Always happy to help!

@justinmk Indeed, we have not approached the issue correctly. It seems that the issue is caused by the fact that the cursor seems to be "disappearing" when it goes on a parenthesis or a bracket but only on the terminal version.

vim terminal version (cursor "disappears" on brackets and parentheses) js-previous

gvim (works great!) gvim

Unfortunately I am not able to pinpoint why that happens. Any ideas?

nstratos avatar May 22 '15 20:05 nstratos

Doesn't happen in my terminal. Note that I have my terminal cursor set to not blink. At any rate this is not a colorscheme issue.

justinmk avatar May 22 '15 20:05 justinmk

@justinmk I set my cursor to not blink as well but it still "disappears". I assumed that it might be a color scheme issue (only for terminals) since it seems that the cursor becomes the same color as the background when it goes to a bracket or parenthesis (and when using the default color scheme I do not have that issue). Ideally both the cursor and the matched parenthesis should remain visible. But since that doesn't happen on your terminal maybe it's a problem that just me and @shime have, or maybe platform specific (Ubuntu, gnome-terminal for me).

nstratos avatar May 24 '15 13:05 nstratos

yup, I'm using gnome-terminal too.

shime avatar May 24 '15 14:05 shime

+1 I jus to apply this patch to my own molokai fork and now I can look to my brakets and parentesis without stress :D

jsenin avatar Jan 28 '16 15:01 jsenin

I was also able to replicate the issue using termite. It seems to be an incompatibility with libvte, which both termite and gnome-terminal are based on.

I don't know enough about VTE to comment, but it seems like this could be something wrapped in a colorscheme-level option.

brandonio21 avatar Jan 30 '17 19:01 brandonio21

VTE's cursor is, by default, a full rectangle which reverses the colors underneath. Moreover, if blinking is enabled, (as clearly seen on the gifs above before the problem occurs) blinking restarts with a complete "on" phase after each cursor movement.

I suspect that this color scheme highlights both parentheses, that is, both the one under the cursor and its counterpart. Hence at the cursor's cell a double reverse make it look like it wasn't changed.

I think it'd be a better approach for the color scheme to highlight the counterpart only, and not the one under the cursor.

In GNOME Terminal's Profile Preferences you can change the cursor shape to I-Beam or Underline (see https://bugzilla.gnome.org/show_bug.cgi?id=772134 for how make them wider) (I personally use I-Beam which works wonderfully in every app except vim which has an IMO crazy braindamaged legacy idea about the cursor, being one of the reasons I don't use vim), and you can also specify a concrete foreground+background color pair for the cursor. Either of these could mitigate the problem.

egmontkob avatar Jan 30 '17 23:01 egmontkob

Ah yes. Thank you very much for the input @egmontkob .

I really don't know much about the subject (obviously), but here's what I've gathered so far:

  • VTE Draws a full rectangle as the cursor, the color of the cursor is the color of the foreground below it (ie the color of the text it's selecting), and the text color is inverted so that it can be seen through the cursor. Essentially, whatever color the text is, VTE's cursor becomes that.

  • The change introduced in https://github.com/tomasr/molokai/pull/34 turns the foreground of parenthesis pair to 233 (#121212), which is the same color that molokai uses for its background.

  • Therefore, when VTE terminals encounter a matched parenthesis, the foreground changes to the same color as the molokai background, VTE's cursor becomes that color and disappears. Meanwhile, the background has changed to orange (#FF8700), so when the cursor blinks off, the orange background shows up.

In this case, VTE's method of cursor-coloring does not seem like a "special snowflake" and this definitely seems like an issue with the colorscheme.

But I'm also now seeing https://github.com/tomasr/molokai/commit/e7bcec757319cbfe23b40452f70dad8ad98d021e ... there's just no easy way to solve this problem.

brandonio21 avatar Jan 31 '17 04:01 brandonio21

I think it'd be a better approach for the color scheme to highlight the counterpart only, and not the one under the cursor.

That behavior change would need to be made in Vim's matchparen plugin, rather than the colorscheme.

justinmk avatar Jan 31 '17 11:01 justinmk

I guess it might be worth to file a feature request. Your call.

egmontkob avatar Jan 31 '17 15:01 egmontkob

I had the same problem and changed the color on line 180 like this:

  hi MatchParen      ctermfg=cyan ctermbg=208 cterm=bold

I had put cyan because I don't know how the 3 digits translate into colors and it is very easily visible.

Also, this seems to only affect the terminal.

zbg2-7

ddaza avatar Feb 04 '17 03:02 ddaza

@ddaza For the colors see https://commons.wikimedia.org/wiki/File:Xterm_256color_chart.svg .

egmontkob avatar Feb 04 '17 22:02 egmontkob

thanks @egmontkob

cyan === 014

 hi MatchParen      ctermfg=014 ctermbg=208 cterm=bold

This totally works I dunno how peeps feel about this change.

ddaza avatar Feb 04 '17 23:02 ddaza

@ddaza - I think that's a great solution. It may not look the prettiest, but it does what it needs to do and will probably work nicely in both terminal and GUI.

Do you think it would be a good idea to use color 081 (#5fd7ff) instead, since that color is already used in the colorscheme? I don't think cyan is used anywhere.

brandonio21 avatar Feb 05 '17 02:02 brandonio21

I think reverting the colors as suggested before looks even better. It only affects the terminal version anyways.

gopherfortress avatar Feb 05 '17 07:02 gopherfortress