Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
fix two minor bugs of the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jspenguin2017 committed Jan 22, 2018
1 parent b4f852a commit 4223518
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/js/nano-highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ ace.define('ace/mode/nano_filters_hr', function(require, exports, module) {
// Cosmetic
{
token: 'keyword.control',
regex: /#@?(?:\?|\$)?#\^?/,
regex: /#@?(?:\?|\$)?#\^?(?!$)/,
next: 'double_hash'
},
{
// Operator @ is at the wrong place
token: 'invalid.illegal',
regex: /#@?(?:\?|\$)?@#\^?/,
regex: /#@?(?:\?|\$)?@#\^?(?!$)/,
next: 'double_hash'
},
{
Expand Down
16 changes: 7 additions & 9 deletions src/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@
// https://github.com/gorhill/uBlock/issues/1022
// Be sure to end with an empty line.
content = content.trim();
if ( content !== '' ) { content += '\n'; }
if ( content !== '' ) {
content += '\n';
} else {
// Patch 2018-01-21: Reset linter when saving empty user filters
nano.filterLinter.clearResult();
}
this.assets.put(this.userFiltersPath, content, callback);
this.removeCompiledFilterList(this.userFiltersPath);
};
Expand Down Expand Up @@ -900,14 +905,7 @@
// applying 1st-party filters.

µBlock.applyCompiledFilters = function(rawText, firstparty) {
if ( rawText === '' ) {
// Patch 2017-12-28: Reset linter when applying empty user filters
if ( firstparty ) {
nano.filterLinter.clearResult();
}

return;
}
if ( rawText === '' ) { return; }
var reader = new this.CompiledLineReader(rawText);
this.staticNetFilteringEngine.fromCompiledContent(reader);
this.staticExtFilteringEngine.fromCompiledContent(reader, {
Expand Down

0 comments on commit 4223518

Please sign in to comment.