nashamri / spacemacs-theme

Light and dark theme for spacemacs that supports GUI and terminal
GNU General Public License v3.0
604 stars 114 forks source link

Highlighting inside of new parenthesis blocks highlighting of selection #25

Closed rpls closed 8 years ago

rpls commented 9 years ago

When creating a parenthesis with smartparens, the insides will be highlighted until the cursor exits. This highlighting overlays the selection face background. See example below (made in c-mode, but other modes have this problem as well).

2015-10-09-120757_4160x1440_scrot

The corresponding face is sp-pair-overlay-face. Is there a way to fix this? Or is this intentional?

nashamri commented 9 years ago

Thanks @rpls for reporting this. This needs fixing, and not intentional. I'll try to fix this later today, hopefully :smile:

rpls commented 9 years ago

Nice, thanks. But this is a weird issue. When I change the face, e.g. by setting a lighter background color, the issue doesn't go away. If I clear all the face settings, the issue still doesn't go away. And pretty much all the themes I tested have this problem. This might have something to do with how smartparens highlights this. But maybe there is a special face setup which works correctly...

nashamri commented 9 years ago

It could be something in smartparens or it could be the way emacs merges multiple faces. I need to investigate this to see what's going on here :smile:

nashamri commented 9 years ago

@rpls Just messed a little bit with it and it looks like there's some sort of conflict between sp-pair-overlay-face and the region face. When you select something emacs applies the region face to the selected region. And sp-pair-overlay-face takes precedence and applies its background instead of the region's background. So this issue might be resolvable upstream in the smartparens mode.

I encountered many cases where I wanted to control which face should be applied when something like this is happening, but couldn't find a good solution.

Here's the a reference for how emacs deals with conflicting faces: http://www.gnu.org/software/emacs/manual/html_node/elisp/Displaying-Faces.html

nashamri commented 8 years ago

@rpls This issues seems outside the scope of the theme. I've tested many famous themes and they all exhibit the same issue. So it could be a smartparen issue and need to be reported upstream. https://github.com/Fuco1/smartparens

rpls commented 8 years ago

Thanks for looking into it. I couldn't find any related issue in their tracker, so I opened one.

Fuco1 commented 8 years ago

I don't understand the issue here. This is a feature of smartparens to highlight "active" blocks, you can disable it if you don't want that, there's a setting for it.

What exactly should I fix?

rpls commented 8 years ago

@Fuco1 The highlighting of the active codeblock blocks the highlighting of a selection. E.g. if i'm still in an active block and select something, all visual feedback concerning the selection/region is not visible. See for example the screen shot in the initial issue the word "Something" is selected, but this isn't visible at all. I don't know enough about faces in emacs, but as @nashamri describes it, sp-pair-overlay-face takes precedence over the normal region face. So I guess a fix could be to let region take precesence over sp-pair-overlay-face?

Fuco1 commented 8 years ago

Well that's not possible. Overlays take precedence.

What is weird is that you see the SP highlight even when you do action other than insertion. Probably some misconfiguration somewhere.

rpls commented 8 years ago

Maybe it's a weird side effect of evil?

nashamri commented 8 years ago

Maybe this info will help.

I've noticed that the solarized-light theme does show the selected lines differently. selected-not

However, when I do list-faces-display and look for the faces that smartparens use, I don't see that bold face. It might not be even an issue with smartparens. list-faces

nashamri commented 8 years ago

Highlighting within a block works well now on spacemacs since this commit https://github.com/syl20bnr/spacemacs/commit/653da2a.

Maybe this issue https://github.com/Fuco1/smartparens/issues/547 could be resolved by doing something similar.