fix: Korrigiere Texthervorhebung für Sonderzeichen wie < und >
Co-authored-by: aider (ollama_chat/qwen3-coder:30b) <aider@aider.chat>
This commit is contained in:
parent
604c4de290
commit
7fd02949ec
1 changed files with 9 additions and 12 deletions
|
|
@ -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 += '<span class="highlight-correct highlight-space">·</span>';
|
||||
} else if (displayText[i] === '\t') {
|
||||
} else if (originalText[i] === '\t') {
|
||||
highlightedText += '<span class="highlight-correct highlight-tab">→</span>';
|
||||
} else {
|
||||
highlightedText += `<span class="highlight-correct">${displayText[i]}</span>`;
|
||||
highlightedText += `<span class="highlight-correct">${originalText[i]}</span>`;
|
||||
}
|
||||
} else {
|
||||
highlightedText += `<span class="highlight-incorrect">${displayText[i]}</span>`;
|
||||
highlightedText += `<span class="highlight-incorrect">${originalText[i]}</span>`;
|
||||
}
|
||||
} else {
|
||||
// Für nicht eingegebene Zeichen: Einrückungen anzeigen
|
||||
if (displayText[i] === ' ') {
|
||||
if (originalText[i] === ' ') {
|
||||
highlightedText += '<span class="highlight-space">·</span>';
|
||||
} else if (displayText[i] === '\t') {
|
||||
} else if (originalText[i] === '\t') {
|
||||
highlightedText += '<span class="highlight-tab">→</span>';
|
||||
} else {
|
||||
highlightedText += displayText[i];
|
||||
highlightedText += originalText[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue