Sublime Forum

Highlight current line

#5

Not working for me.

0 Likes

#6

Hello, this works for me, but not when viewing PHP files with the Twilight theme. The PHP code seems to have an overlay colour for the background that prevents the line highlighting from working properly. I can see the highlight in the gutter next to line numbers, but not on the main text.

If I switch to a window with plain text or even a section of the page that is in HTML and not PHP I can see the highlight.

Anyone have a clue as to what’s happening and how to fix it? I was even searching for the background colour in the PHP code under the theme settings but it’s not even listed.

Thanks.

0 Likes

#7

This is also the case for the Cobalt theme. The embedded source (PHP code) has a different background color than HTML source, so that when you view a PHP file that contains both PHP and HTML, you can easily differentiate between the two. The problem is that the embedded source background color somehow overrides (or hides) the current line highlight.

I documented this bug/request here a while back:
sublimetext.userecho.com/topic/7 … alt-theme/

Is there a solution for this?

0 Likes

#8

You can easily edit the colorschemes. Just open up the .tmTheme and look for anything that has a scope of PHP. Anything that has the key “background” and the scope “PHP,” just remove it.

0 Likes

#9

I am having this same issue, but in all files, with he twilight theme. I am very new to sublime text (coming from vim, seeing if I can get it as close to my vim config as possible). Thought I was just doing something wrong, but sounds like this is a bug.

0 Likes

#10

@C0D312 - Thanks but I do not want to remove the background color for PHP code. It helps a lot when working with an HTML file that contains both HTML and PHP code. The specified background color for the PHP code helps to differentiate the PHP code from the HTML. Removing the background just to make the current line highlight come up is not an option for me. Would rather just see the bug fixed. Is there any other way to tweak the tmTheme to make this work?

In Cobalt.tmTheme I found the following

<dict> <key>name</key> <string>Embedded Source</string> <key>scope</key> <string>text source, string.unquoted.heredoc, source source</string> <key>settings</key> <dict> <key>background</key> <string>#223545</string> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#FFFFFF</string> </dict> </dict>

I tried adding something like this:

<key>lineHighlight</key> <string>#FF0000</string>

To the settings section, but it didn’t seem to have any effect at all. Is lineHighlight maybe not an acceptable setting to set for embedded sources?

Also I noticed this problem with other themes besides just Cobalt. Any theme that has a different background color defined for Embedded Sources, this problem occurs.

0 Likes

#11

Is there any word on this bug? Does anyone know how to fix the current syntax highlighting theme to fix this problem? Or is it a bug with ST itself?

0 Likes

#12

Any fix? :smile:

0 Likes

#13

Bump… Please fix.

0 Likes

#14

Casting my vote for this issue to be addressed… :smile:

0 Likes

#15

+1

0 Likes

#16

This is fixed in the latest Dev build 2170 :smiley: Awesome!

0 Likes

#17

Nice! I was waiting for this to be resolved too.

0 Likes

#18

Woo

0 Likes

#19

I’ve noticed that this bug isn’t fixed when in distraction free mode (which, ironically, is kinda distracting :wink: )

I believe the change that fixed this outside of distraction free mode was:
“Line highlights are drawn in front of text background highlights, and alpha channels are supported”

0 Likes

#20

Highlighting the current line appears to be broken in 2181. I’ve tried a lot of different themes, and either none of the themes support it, or the feature isn’t working at the moment. I’d edit the themes, but I can’t figure out where they’re all stored on the file system.

0 Likes

#21

Hi, I ended here looking for some themes to customize ST2 :smile:
For having line highlight (option I missed too and activated it) just add this line to your settings:

"highlight_line": true,
0 Likes

#22

##########
Workaround for the no current line highlighting
##########

I fought w/ this for awhile, and it appears that the current line highlighting only works if you have not disabled the gutter.
// Set to false to hide the gutter altogether
“gutter”: true,

Hope that helps track down the bug, since I would like to remove the gutter, personally.

0 Likes

#23

Hi

is it possible to only highlight the line for certain type of files ?

Thanks

0 Likes

#24

Yes. Open the file type you want line highlighting for (or just open aa new file and set the syntax manually). Then go to “Preferences > Settings - more > syntax-specific - user” and insert the highlight_line setting there.

0 Likes

Gutter Active Line Foreground Color