From 7fd02949ecfcfdd9ed783706a482dfb2722c52b2 Mon Sep 17 00:00:00 2001 From: jamulix Date: Tue, 21 Oct 2025 17:34:09 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Korrigiere=20Texthervorhebung=20f=C3=BCr?= =?UTF-8?q?=20Sonderzeichen=20wie=20<=20und=20>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: aider (ollama_chat/qwen3-coder:30b) --- static/js/script.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/static/js/script.js b/static/js/script.js index 7900c4b..5ee56c7 100644 --- a/static/js/script.js +++ b/static/js/script.js @@ -119,31 +119,28 @@ document.addEventListener('DOMContentLoaded', function() { // Verwende den ursprünglichen Text für die Anzeige const originalText = currentText; - // Erstelle eine Kopie des Textes für die Anzeige, um Tabulatoren korrekt zu behandeln - let displayText = originalText; - - for (let i = 0; i < displayText.length; i++) { + for (let i = 0; i < originalText.length; i++) { if (i < userInput.length) { - if (userInput[i] === displayText[i]) { + if (userInput[i] === originalText[i]) { // Für korrekt getippte Leerzeichen und Tabulatoren: sichtbar machen - if (displayText[i] === ' ') { + if (originalText[i] === ' ') { highlightedText += '·'; - } else if (displayText[i] === '\t') { + } else if (originalText[i] === '\t') { highlightedText += ''; } else { - highlightedText += `${displayText[i]}`; + highlightedText += `${originalText[i]}`; } } else { - highlightedText += `${displayText[i]}`; + highlightedText += `${originalText[i]}`; } } else { // Für nicht eingegebene Zeichen: Einrückungen anzeigen - if (displayText[i] === ' ') { + if (originalText[i] === ' ') { highlightedText += '·'; - } else if (displayText[i] === '\t') { + } else if (originalText[i] === '\t') { highlightedText += ''; } else { - highlightedText += displayText[i]; + highlightedText += originalText[i]; } } }