From 2875bb77d0ffd388fd82c712504024f59ae8f323 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 3 Apr 2017 02:19:43 +0300 Subject: [PATCH] moz-import: trim empty lines at section start/end --- edit.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/edit.js b/edit.js index 14557a53..dbaca5ba 100644 --- a/edit.js +++ b/edit.js @@ -1497,15 +1497,20 @@ function fromMozillaFormat() { } } function doAddSection(section) { + section.code = section.code.trim(); + // don't add empty sections + if (!section.code + && !section.urls + && !section.urlPrefixes + && !section.domains + && !section.regexps) { + return; + } if (!firstAddedCM) { if (!initFirstSection(section)) { return; } } - // don't add empty sections - if (!(section.code || section.urls || section.urlPrefixes || section.domains || section.regexps)) { - return; - } setCleanItem(addSection(null, section), false); firstAddedCM = firstAddedCM || editors.last; }