diff --git a/trailing_spaces.py b/trailing_spaces.py index 003c2de..41ee2fc 100644 --- a/trailing_spaces.py +++ b/trailing_spaces.py @@ -32,7 +32,9 @@ trailing_spaces_enabled = bool(ts_settings.get('trailing_spaces_enabled', # Return an array of regions matching trailing spaces. 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 diff --git a/trailing_spaces.sublime-settings b/trailing_spaces.sublime-settings index 1db0b4e..ece3eda 100644 --- a/trailing_spaces.sublime-settings +++ b/trailing_spaces.sublime-settings @@ -1,10 +1,13 @@ { // Color is determined by scope - "trailing_spaces_highlight_color" : "invalid", + "trailing_spaces_highlight_color" : "invalid", // 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) - "trailing_spaces_enabled" : true + "trailing_spaces_enabled" : true, + + // By default empty lines are cleared + "trailing_spaces_include_empty_lines" : true }