diff --git a/src/js/codemirror/ubo-static-filtering.js b/src/js/codemirror/ubo-static-filtering.js index 655caa462..bc71dfc30 100644 --- a/src/js/codemirror/ubo-static-filtering.js +++ b/src/js/codemirror/ubo-static-filtering.js @@ -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(' \\') ); } diff --git a/src/js/storage.js b/src/js/storage.js index 7130ee28a..8ccac6240 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -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(); } diff --git a/src/js/utils.js b/src/js/utils.js index 7a4765d1a..fada05f59 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -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); }