8 Commits
1.0.0 ... 1.1.2

Author SHA1 Message Date
Kemal Hadimli
148ad95966 Hunt for spaces after tabs or tabs after spaces as well 2013-08-27 12:09:58 +03:00
Kemal Hadimli
dc3c860a25 remove the only tab character in the file 2013-08-27 12:09:00 +03:00
Kemal Hadimli
551cf1e378 Update commented file settings in .py head 2013-08-27 12:03:12 +03:00
Kemal Hadimli
e9d8a6dd6e Merge branch 'master' of git://github.com/ebergama/HighlightWhitespaces into ebergama-master
Conflicts:
	highlight_whitespaces.py
	highlight_whitespaces.sublime-settings
2013-08-27 12:00:04 +03:00
Peter Conerly
87141119fa added option to disable spaces or tabs 2013-08-27 11:55:33 +03:00
Ezequiel Bergamaschi
17ca7f2616 last whitespace property enabled 2013-08-20 22:05:50 -03:00
Kemal Hadimli
04b88f15bd update README to reflect ST3 support. 2013-05-03 14:57:42 +03:00
Kemal Hadimli
36f90560f4 ST3 support/bugfix (close #1) 2013-05-03 14:48:58 +03:00
3 changed files with 40 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
## Synopsis
This is a [Sublime Text 2](http://www.sublimetext.com/2) plugin.
This is a plugin for [Sublime Text 2](http://www.sublimetext.com/2) and [3](http://www.sublimetext.com/3).
**Highlight whitespaces in documents**
@@ -21,6 +21,8 @@ Then clone this repository:
That's it!
Note for ST3 users: For Sublime Text 3, replace "2" with "3" in path names. (`%APPDATA%\Sublime Text 3` and so on)
## Options
Several options are available to customize the plugin look 'n feel. The

View File

@@ -11,7 +11,10 @@ Config summary (see README.md for details):
"highlight_whitespaces_space_highlight_scope_name": "invalid",
"highlight_whitespaces_tab_highlight_scope_name": "invalid",
"highlight_whitespaces_file_max_size": 1048576,
"highlight_whitespaces_enabled": true
"highlight_whitespaces_enabled": true,
"highlight_whitespaces_check_spaces": true,
"highlight_whitespaces_check_tabs": true,
"highlight_last_whitespace": true
}
Forked from https://github.com/SublimeText/TrailingSpaces/ by Jean-Denis Vauguet <jd@vauguet.fr>, Oktay Acikalin <ok@ryotic.de>
@@ -27,6 +30,9 @@ import sublime_plugin
DEFAULT_MAX_FILE_SIZE = 1048576
DEFAULT_COLOR_SCOPE_NAME = "invalid"
DEFAULT_IS_ENABLED = True
DEFAULT_CHECK_SPACES = True
DEFAULT_CHECK_TABS = True
DEFAULT_LAST_WHITESPACE = False
#Set whether the plugin is on or off
hws_settings = sublime.load_settings('highlight_whitespaces.sublime-settings')
@@ -39,7 +45,12 @@ def is_find_results(view):
# Return an array of regions matching whitespaces.
def find_whitespaces_spaces(view):
return view.find_all(' {2,}')
last_whitespace = bool(hws_settings.get('highlight_last_whitespace',DEFAULT_LAST_WHITESPACE))
regex = ' {2,}|\t | \t'
if last_whitespace:
regex += '| {1,}$'
return view.find_all(regex)
def find_whitespaces_tabs(view):
return view.find_all('\t+')
@@ -54,13 +65,15 @@ def highlight_whitespaces(view):
tab_scope_name = hws_settings.get('highlight_whitespaces_tab_highlight_scope_name',
DEFAULT_COLOR_SCOPE_NAME)
if view.size() <= max_size and not is_find_results(view):
if hws_settings.get('highlight_whitespaces_check_spaces', DEFAULT_CHECK_SPACES):
space_regions = find_whitespaces_spaces(view)
view.add_regions('WhitespacesHighlightListener',
space_regions, space_scope_name,
space_regions, space_scope_name, '',
sublime.DRAW_EMPTY)
if hws_settings.get('highlight_whitespaces_check_tabs', DEFAULT_CHECK_TABS):
tab_regions = find_whitespaces_tabs(view)
view.add_regions('WhitespacesHighlightListener2',
tab_regions, tab_scope_name,
tab_regions, tab_scope_name, '',
sublime.DRAW_EMPTY)

View File

@@ -1,13 +1,22 @@
{
// Spaces color is determined by scope (default, "invalid")
// Spaces color is determined by scope (default, "invalid")
// "highlight_whitespaces_space_highlight_scope_name": "Whitespaces.space.highlight",
// Tabs color is determined by scope (default, "invalid")
// Tabs color is determined by scope (default, "invalid")
// "highlight_whitespaces_tab_highlight_scope_name": "Whitespaces.tab.highlight",
// Max file size to search
// Max file size to search
"highlight_whitespaces_file_max_size": 1048576,
// By default plugin is enabled or disabled (true|false)
"highlight_whitespaces_enabled": true
// By default plugin is enabled or disabled (true|false)
"highlight_whitespaces_enabled": true,
// Whether to check for spaces
"highlight_whitespaces_check_spaces": true,
// Whether to check for tabs
"highlight_whitespaces_check_tabs": true,
// Allow the highlighting of the last whitespace, one or more time
"highlight_last_whitespace": true
}