Finally fixed line wraps with color properly
This commit is contained in:
parent
5312071d1c
commit
efdd8bcb34
13
src/main.ino
13
src/main.ino
@ -558,13 +558,17 @@ int calculateLinesRequired(String message) {
|
|||||||
for (unsigned int i = 0; i < message.length(); i++) {
|
for (unsigned int i = 0; i < message.length(); i++) {
|
||||||
char c = message[i];
|
char c = message[i];
|
||||||
if (c == '\x03') {
|
if (c == '\x03') {
|
||||||
// Skip color code sequences from calculate instead of render to solve nick overlay issue
|
// Check for foreground color
|
||||||
while (i < message.length() && (isdigit(message[i + 1]) || message[i + 1] == ',')) {
|
if (i + 1 < message.length() && isdigit(message[i + 1])) {
|
||||||
i++;
|
i++;
|
||||||
if (isdigit(message[i + 1])) {
|
if (i + 1 < message.length() && isdigit(message[i + 1])) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (message[i] == ',' && isdigit(message[i + 1])) {
|
}
|
||||||
|
// Check for background color
|
||||||
|
if (i + 1 < message.length() && message[i + 1] == ',' && isdigit(message[i + 2])) {
|
||||||
|
i += 2; // Skip the comma
|
||||||
|
if (i + 1 < message.length() && isdigit(message[i + 1])) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -580,6 +584,7 @@ int calculateLinesRequired(String message) {
|
|||||||
return linesRequired;
|
return linesRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void displayCenteredText(String text) {
|
void displayCenteredText(String text) {
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
tft.setTextDatum(MC_DATUM);
|
tft.setTextDatum(MC_DATUM);
|
||||||
|
Loading…
Reference in New Issue
Block a user