const words = content.split(/\s+/).filter(Boolean); const lines: string[] = [];
let current = "";
let prefix = firstPrefix;
let available = firstWidth;
for (const word of words) { if (!current) { if (visibleWidth(word) > available) { if (isCopySensitiveToken(word)) {
current = word; continue;
}
pushWrappedWordSegments({
word,
available,
firstPrefix: prefix,
continuationPrefix: nextPrefix,
lines,
});
prefix = nextPrefix;
available = nextWidth; continue;
}
current = word; continue;
}
const candidate = `${current} ${word}`; if (visibleWidth(candidate) <= available) {
current = candidate; continue;
}
lines.push(prefix + current);
prefix = nextPrefix;
available = nextWidth;
if (visibleWidth(word) > available) { if (isCopySensitiveToken(word)) {
current = word; continue;
}
pushWrappedWordSegments({
word,
available,
firstPrefix: prefix,
continuationPrefix: prefix,
lines,
});
current = ""; continue;
}
current = word;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.