Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Ampersands are unreadable when out of focus #28

Open
ghost opened this issue May 28, 2015 · 2 comments
Open

Ampersands are unreadable when out of focus #28

ghost opened this issue May 28, 2015 · 2 comments
Milestone

Comments

@ghost
Copy link

ghost commented May 28, 2015

Using the dark theme. And by "Out of focus" I mean the cursor is not on the ampersand.

Out of focus
screen shot 2

In focus
screen shot 3

@ghost ghost added this to the v1.1.7 milestone Jun 17, 2015
@ghost ghost added the enhancement label Jun 17, 2015
@meaganewaller
Copy link

I took a look at this and noticed that this styling of the orange background with the pink foreground is reserved just to indicate invalid/illegal characters. Here is where that's defined:

Image of color settings

I replicated this behavior with an HTML file, and the problem isn't ampersand specific, it's because of the encoding error with double ampersands, see this message. Here's a good post about ambiguous ampersands
Image of Encoding Error Message,

That's not to say that the orange background with the hot pink foreground is necessarily the most ideal way to display it either. However, if this is intentional it could be because if there are invalid/illegal characters in a file it's likely to cause an error that breaks things, web browsers just handle most unencoded ampersands/ambiguous ampersands gracefully, so maybe making the invalid characters look like that makes them standout because it's impossible to scan over so it makes the user click on it to see what's happening and then potentially fix the invalid characters.

To stop this from happening I recommend encoding your ampersands, &. I use the HTML5 Sublime Package, there are lots of great tab completions for characters that should be encoded, so just typing the ampersand followed by a tab creates the encoded & and avoids the invalid/illegal syntax highlighting.

I'm sorry if you already knew all of this, but this was driving me up a wall so I figured if anyone else searches for the problem it might be handy to have it documented here. ✨

@ghost
Copy link
Author

ghost commented Jun 21, 2015

I ran into this issue when coding an and operator (e.g., if 1 == 1 && 2 == 2 ). In such a situation, using & is not possible.

@jrappen jrappen mentioned this issue Aug 17, 2016
7 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant