From bbb27ee274e493565b3cd6fea1d5db18224a23cc Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Thu, 12 Oct 2023 14:39:43 +0200 Subject: [PATCH] slight refactors --- main.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 5abb1c3..4be72db 100644 --- a/main.js +++ b/main.js @@ -2137,11 +2137,8 @@ function applycolors(currentonly) console.log("redrawing all colored div"); var lines = md.value.split("\n"); var i = 0; - var line = null; for (; i < lines.length; i++) { - line = applycolorsonline(lines[i], i, options); - var linediv = document.getElementById("line" + i); if (!linediv) { @@ -2150,7 +2147,7 @@ function applycolors(currentonly) } linediv.setAttribute("id", "line" + i); linediv.setAttribute("tag", JSON.stringify(options)); - linediv.innerHTML = line || " "; + linediv.innerHTML = applycolorsonline(lines[i], i, options) || " "; }; // remove remanining @@ -2165,8 +2162,7 @@ function applycolors(currentonly) function editorinput() { - // criteria to improve - // or redraw only after? + // criteria to improve. Or redraw only after? var multiline = md.value.substring(md.selectionStart, md.selectionEnd).includes("\n"); applycolors(!multiline && event.data && (event.inputType == "insertText" || event.inputType == "deleteContentBackward" || event.inputType == "deleteContentForward")); datachanged();