mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 09:39:38 +02:00
Add indentation requirement for line continuation
Related commit: - https://github.com/gorhill/uBlock/commit/703c525b01aa This adds an indentation requirement for line continuation to take place. The conditions are now as follow: - Current line ends with ` \`: ASCII space + backslash - Next line starts with ` `: four ASCII spaces
This commit is contained in:
parent
703c525b01
commit
ca80d2826b
@ -121,6 +121,7 @@ CodeMirror.defineMode("ubo-static-filtering", function() {
|
||||
if ( line.endsWith(' \\') ) {
|
||||
do {
|
||||
line = stream.lookAhead(lines.length);
|
||||
if ( line.startsWith(' ') === false ) { break; }
|
||||
lines.push(line);
|
||||
} while ( line.endsWith(' \\') );
|
||||
}
|
||||
|
@ -808,6 +808,7 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
|
||||
if ( line.length === 0 ) { continue; }
|
||||
|
||||
while ( line.endsWith(' \\') ) {
|
||||
if ( lineIter.peek(4) !== ' ' ) { break; }
|
||||
line = line.slice(0, -2).trim() + lineIter.next().trim();
|
||||
}
|
||||
|
||||
|
@ -242,6 +242,10 @@
|
||||
this.offset = lineEnd + 1;
|
||||
return line;
|
||||
}
|
||||
peek(n) {
|
||||
const offset = this.offset;
|
||||
return this.text.slice(offset, offset + n);
|
||||
}
|
||||
charCodeAt(offset) {
|
||||
return this.text.charCodeAt(this.offset + offset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user