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

@ -6,5 +6,8 @@
"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
} }