Detached lines in Notepad++

The default text style in Notepad++ v6.6 and its past versions (as far as I remember) adds an inconspicuous amount of white space between each line, preventing the block characters in each line to connect to the ones on the top or bottom. This problem also appears with two of the other themes, namely “Hello Kitty” and “Viberant Ink” but not in any other theme.

This slideshow requires JavaScript.


I normally wouldn’t care for a slight amount of space as I am not a consumer of ASCII art and don’t use table characters in my source codes either. But as with any other curious human, I wanted to know why, just out of curiousity and not because of practical need. So, I set out to investigate.

Cause

Notepad++ is an advanced plain text and source code editor. One of its features is syntax highlighting; when the user is editing a source code, written in one of the programming/scripting/markup languages that it knows of, it automatically shows keywords, variables, values, parameters and comments in different colors, sizes, font weights, font styles or typefaces. For example, it is possible to display known keywords in bold black 10pt font and braces in red 12pt font. (“Points” or “pt” for short is a measure of font size, equal to 1/72 inches.)

So, in the example above, what happens if both known keywords and braces are in one line? Naturally, Notepad++ must adjust the line height to accomodate a 12pt font. But what if there is only a keyword in one line (whose character sizes are 10pt)? What if the line is entirely blank?

The answer is: The line would still be 12pt tall. Notepad++ uses a fixed line height equal to the tallest character that can be on that line. How did I discover this? Well, I started comparing height-related elements between “Ruby Blue” and “Default” theme and discovered that “Default” has set the font size to 12pt for “Brace highlight style” while “Ruby Blue” has not set a font size for this value.

Step-by-step fix

Notepad++: Style Configurator

Notepad++: Style Configurator

  1. Open Notepad++
  2. Open “Settings” menu and click on “Style Configurator…”
  3. At the top of the dialog box, select the theme that you’d like to fix from “Select theme” drop-down box. (“Default”, “Hello Kitty” or “Viberant Ink”.)
  4. In the leftmost list, titled “Language”, make sure “Global Styles” is selected.
  5. From the list to its immediate right, titled “Style”, select “Brace highlight style”.
  6. From the right side of the dialog box, open the “Font size” drop-down box and clear the font size. (Select the first item on the list, which is empty.)
  7. Press “Save & Close” button.

Repeat these steps for other themes if you wish.

Bonus material

In the Style Configurator dialog box, you can specifiy which programming language is associated with which filename extension. By default, “XML” language is associated with xml, xsml, xsl, xsd, kml and wsdl extensions. But if you like, you can add svg to the list too. SVG files are written in XML language.

Advertisements

Posted on 1 June 2014, in Software Review and tagged , , , , , , , , . Bookmark the permalink. Leave a comment.

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: