From 9324902376a7f856829644a640a7824a9be4c475 Mon Sep 17 00:00:00 2001 From: Mario Fritschen Date: Sun, 21 Mar 2021 13:50:13 +0100 Subject: [PATCH] fix: removeHost only splice changed lines Fixes a problem on removeHost all non token lines like comments or formatting newlines get lost --- src/SimpleHosts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SimpleHosts.ts b/src/SimpleHosts.ts index da9bca2..9eee6ff 100644 --- a/src/SimpleHosts.ts +++ b/src/SimpleHosts.ts @@ -141,7 +141,7 @@ export class SimpleHosts { changed = true; } } - if (tokens.length < 2) { + if (changed && tokens.length < 2) { lines.splice(i, 1); } else if (changed) { lines[i] = tokens.join('\t');