This commit is contained in:
Pepper0ni 2025-04-18 17:25:01 +01:00
commit a0c5d73694

View file

@ -536,11 +536,16 @@ void CustomMessage::AutoFormatString(std::string& str) const {
// or move the lastNewline cursor to the next line if a '^' is encountered. // or move the lastNewline cursor to the next line if a '^' is encountered.
} else if (carrot < lastNewline + lineLength) { } else if (carrot < lastNewline + lineLength) {
lastNewline = carrot + 1; lastNewline = carrot + 1;
// some lines need to be split but don't have spaces, look for periods instead // some lines need to be split but don't have spaces, look for punctuation instead
} else if (lastSpace == std::string::npos) { } else if (lastSpace == std::string::npos) {
const size_t lastPeriod = str.rfind('.', lastNewline + lineLength); const size_t lastPunc = str.find_last_of('.,!', lastNewline + lineLength);
str.replace(lastPeriod, 1, ".^" + colorText); //if none exist, we just have to throw it down somewhere....
lastNewline = lastPeriod + 2; if (lastPunc != std::string::npos){
} else {
str.insert(lastPunc+1, "^" + colorText);
lastNewline = lastPunc + 2;
}
} else { } else {
str.replace(lastSpace, 1, "^" + colorText); str.replace(lastSpace, 1, "^" + colorText);
lastNewline = lastSpace + 1; lastNewline = lastSpace + 1;