mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
Fix last newline not being automatically appended
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/657
This commit is contained in:
parent
9d1913a16e
commit
47a5caef54
@ -152,8 +152,10 @@ const rulesToDoc = function(clearHistory) {
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/593
|
||||
// Ensure the text content always ends with an empty line to avoid
|
||||
// spurious diff entries.
|
||||
let beforeText = doc.getValue().trim();
|
||||
if ( beforeText !== '' ) { beforeText += '\n'; }
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/657
|
||||
// Diff against unmodified beforeText so that the last newline can
|
||||
// be reported in the diff and thus appended if needed.
|
||||
let beforeText = doc.getValue();
|
||||
let afterText = rules.join('\n').trim();
|
||||
if ( afterText !== '' ) { afterText += '\n'; }
|
||||
const diffs = differ.diff_main(beforeText, afterText);
|
||||
|
Loading…
Reference in New Issue
Block a user