1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

Minor code review

This commit is contained in:
Raymond Hill 2020-01-23 12:06:40 -05:00
parent 9637ab56a9
commit 2e0a8951b8
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -83,19 +83,19 @@ const renderAdvancedSettings = async function(first) {
});
beforeHash = hashFromAdvancedSettings(raw);
let pretty = [],
whitespaces = ' ',
lines = raw.split('\n'),
max = 0;
for ( let line of lines ) {
let pos = line.indexOf(' ');
const pretty = [];
const lines = raw.split('\n');
let max = 0;
for ( const line of lines ) {
const pos = line.indexOf(' ');
if ( pos > max ) { max = pos; }
}
for ( let line of lines ) {
let pos = line.indexOf(' ');
pretty.push(whitespaces.slice(0, max - pos) + line);
for ( const line of lines ) {
const pos = line.indexOf(' ');
pretty.push(' '.repeat(max - pos) + line);
}
cmEditor.setValue(pretty.join('\n') + '\n');
pretty.push('');
cmEditor.setValue(pretty.join('\n'));
if ( first ) {
cmEditor.clearHistory();
}