mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 22:33:43 -07:00
WIP
This commit is contained in:
parent
29af294b0c
commit
a0c5d73694
1 changed files with 9 additions and 4 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue