Skip to content

Commit

Permalink
Adding Ignore White Space Setting
Browse files Browse the repository at this point in the history
Added a setting for whether or not each line gets trimmed of white space, before checking for duplicates.
  • Loading branch information
LordBrom authored Oct 10, 2017
1 parent 076dc20 commit 482b174
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion highlight_duplicates.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"highlight_duplicates_color" : "invalid",

// By default plugin is enabled or disabled (true|false)
"highlight_duplicates_enabled" : true
"highlight_duplicates_enabled" : true,

// If true, whitespace gets trimmed off each line before checking for matching lines
"ignore_white_space" : true
}
5 changes: 4 additions & 1 deletion hightlight_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def count_lines(lines, view):
'''
counts = defaultdict(list)
for line in lines:
string = view.substr(line).strip()
if bool(settings.get('ignore_white_space', DEFAULT_IS_ENABLED)):
string = view.substr(line).strip()
else:
string = view.substr(line)
if is_candidate(string):
counts[string].append(line)
return counts
Expand Down

0 comments on commit 482b174

Please sign in to comment.