Added support for in/excluding empty lines from being matched as trailing whitespace

This commit is contained in:
Ben Truyman 2012-04-30 21:38:29 -05:00
parent a790a620e5
commit c355e75eca
2 changed files with 9 additions and 4 deletions

View File

@ -32,7 +32,9 @@ trailing_spaces_enabled = bool(ts_settings.get('trailing_spaces_enabled',
# Return an array of regions matching trailing spaces. # Return an array of regions matching trailing spaces.
def find_trailing_spaces(view): def find_trailing_spaces(view):
return view.find_all('[ \t]+$') include_empty_lines = bool(ts_settings.get('trailing_spaces_include_empty_lines',
DEFAULT_IS_ENABLED))
return view.find_all('[ \t]+$' if include_empty_lines else '(?<=\S)[\t ]+$')
# Highlight trailing spaces # Highlight trailing spaces

View File

@ -1,10 +1,13 @@
{ {
// Color is determined by scope // Color is determined by scope
"trailing_spaces_highlight_color" : "invalid", "trailing_spaces_highlight_color" : "invalid",
// Max file size to search // Max file size to search
"trailing_spaces_file_max_size" : 1048576, "trailing_spaces_file_max_size" : 1048576,
// By default plugin is enabled or disabled (true|false) // By default plugin is enabled or disabled (true|false)
"trailing_spaces_enabled" : true "trailing_spaces_enabled" : true,
// By default empty lines are cleared
"trailing_spaces_include_empty_lines" : true
} }