Restored option to allow highlight on single space, but set as false by default

This commit is contained in:
Harjeet Singh 2013-10-21 19:14:30 +05:30
parent 1067d50461
commit 1df06d1ada

View File

@ -14,6 +14,7 @@ Config summary (see README.md for details):
"highlight_whitespaces_enabled": true, "highlight_whitespaces_enabled": true,
"highlight_whitespaces_check_spaces": true, "highlight_whitespaces_check_spaces": true,
"highlight_whitespaces_check_tabs": true, "highlight_whitespaces_check_tabs": true,
"highlight_whitespaces_single_space": false,
"highlight_last_whitespace": true "highlight_last_whitespace": true
} }
@ -31,6 +32,7 @@ DEFAULT_MAX_FILE_SIZE = 1048576
DEFAULT_COLOR_SCOPE_NAME = "invalid" DEFAULT_COLOR_SCOPE_NAME = "invalid"
DEFAULT_IS_ENABLED = True DEFAULT_IS_ENABLED = True
DEFAULT_CHECK_SPACES = True DEFAULT_CHECK_SPACES = True
DEFAULT_SINGLE_SPACE = False
DEFAULT_CHECK_TABS = True DEFAULT_CHECK_TABS = True
DEFAULT_LAST_WHITESPACE = False DEFAULT_LAST_WHITESPACE = False
@ -51,7 +53,11 @@ def is_find_results(view):
def find_whitespaces_spaces(view): def find_whitespaces_spaces(view):
hws_settings = get_settings() hws_settings = get_settings()
last_whitespace = bool(hws_settings.get('highlight_last_whitespace',DEFAULT_LAST_WHITESPACE)) last_whitespace = bool(hws_settings.get('highlight_last_whitespace',DEFAULT_LAST_WHITESPACE))
regex = ' {1,}|\t | \t' single_space = bool(hws_settings.get('highlight_whitespaces_single_space',DEFAULT_SINGLE_SPACE))
if single_space:
regex = ' +'
else:
regex = ' {2,}|\t | \t'
if last_whitespace: if last_whitespace:
regex += '| {1,}$' regex += '| {1,}$'