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

revert MatchParen color changes #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

shime
Copy link

@shime shime commented Jan 23, 2015

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

This reverts commit db8ce13, reversing
changes made to d675583.
@justinmk
Copy link
Contributor

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?

@blindlf
Copy link

blindlf commented Apr 28, 2015

The changes is better.

@nstratos
Copy link

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" 

@shime
Copy link
Author

shime commented May 22, 2015

@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!

@justinmk
Copy link
Contributor

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.

@nstratos
Copy link

@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?

@justinmk
Copy link
Contributor

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.

@nstratos
Copy link

@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).

@shime
Copy link
Author

shime commented May 24, 2015

yup, I'm using gnome-terminal too.

@jsenin
Copy link

jsenin commented Jan 28, 2016

+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 pushed a commit to jsenin/molokai that referenced this pull request Jan 28, 2016
@brandonio21
Copy link

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.

@egmontkob
Copy link

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.

@brandonio21
Copy link

brandonio21 commented Jan 31, 2017

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 Fix terminal MatchParen colors #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 e7bcec7 ... there's just no easy way to solve this problem.

@justinmk
Copy link
Contributor

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.

@egmontkob
Copy link

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

@ddaza
Copy link

ddaza commented Feb 4, 2017

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

@egmontkob
Copy link

@ddaza
Copy link

ddaza commented Feb 4, 2017

thanks @egmontkob

cyan === 014

 hi MatchParen      ctermfg=014 ctermbg=208 cterm=bold

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

@brandonio21
Copy link

@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.

@gopherfortress
Copy link

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

piersy added a commit to piersy/molokai that referenced this pull request Feb 24, 2020
The original molokai highlighting made it look like the cursor was
jumping to the far bracket which was very disconcerting.

There is a discussion and example on the pull here - tomasr#44

In that pull the colors are simply reversed, I've tweaked them slightly
so that the far cursor is a bit easier to spot by having a lightened
background.
commiyou pushed a commit to commiyou/molokai that referenced this pull request Apr 27, 2022
commiyou pushed a commit to commiyou/molokai that referenced this pull request Apr 27, 2022
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

Successfully merging this pull request may close these issues.

9 participants