textmate-solarized icon indicating copy to clipboard operation
textmate-solarized copied to clipboard

Add distinct `Invalid` style

Open jasonmp85 opened this issue 13 years ago • 4 comments

As it stands, the styles do a poor job of rendering any section of text marked as Invalid.

For instance, in my Git Commit Message context, the first line of the message is marked as Invalid if it's over 51 characters (weird number, I know). In most TextMate themes, as soon as the line exceeds 51 characters the entire line is highlighted in red.

In the Solarized theme, there is a style defined for the Invalid scope, but it's either identical to or indistinguishable from regular body text. I'm proposing that it be changed to use one of the reds as a background with white text as the foreground in order to signal to the user that a section of text is malformed in an important, un-ignorable way.

jasonmp85 avatar Aug 30 '11 20:08 jasonmp85

Excellent idea, have you got some git commit text I can use a reference?

deplorableword avatar Aug 31 '11 08:08 deplorableword

Instead of a git COMMIT_EDITMSG file, here's an HTML file with a lot of invalid sections. I don't remember whether my git bundle is standard, but I can confirm the standard HTML bundle will add the invalid scope on many sections of this document in HTML mode:

<!DOC_TYPE HTML INVALID "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd>

<html>
  <head>
    <title> A terribly invalid document</title>
  </head>
  <body>
    <>Invalid Tag<>
    &invalid entity;
    <!- Invalid Comment ->

    <![INVALID_CDATA[
      Invalid line
    ]>
  </body>
</html>

If an invalid color is added to the Solarized bundle, it'll color these sections to stand out as "HEY THIS IS REALLY WRONG". I tried it locally but found the 'highlight current line' option interferes with the background color of the invalid scope if you have the caret on the invalid line, so if you can figure out how to override that then it'd be perfect.

jasonmp85 avatar Sep 05 '11 22:09 jasonmp85

That's really a great idea. I strongly suggest we implement this feature!

fbzhong avatar Dec 25 '11 04:12 fbzhong

This would also be totally amazing when used together with Whitespace.tmbundle in TextMate 2 -- it adds an invalid scope to trailing whitespace and mixed spaces/tabs. https://github.com/mads379/Whitespace.tmbundle

I've already added an invalid scope to my own textmate-solarized config, and it works brilliantly!

oesmith avatar Apr 04 '12 21:04 oesmith