@@ -105,6 +105,7 @@ packages:
|
|||||||
- Fix climate page not updating properly
|
- Fix climate page not updating properly
|
||||||
- 4.1.4 patch:
|
- 4.1.4 patch:
|
||||||
- Supports new `weather.get_forecasts` introduced by Home Assistant 2023.12.0
|
- Supports new `weather.get_forecasts` introduced by Home Assistant 2023.12.0
|
||||||
|
- Manual line break on multiline text with `\r`
|
||||||
|
|
||||||
|
|
||||||
## Details of noteworthy changes
|
## Details of noteworthy changes
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
substitutions:
|
substitutions:
|
||||||
##### DON'T CHANGE THIS #####
|
##### DON'T CHANGE THIS #####
|
||||||
version: "4.1.3"
|
version: "4.1.4"
|
||||||
#############################
|
#############################
|
||||||
|
|
||||||
#external_components:
|
#external_components:
|
||||||
@@ -2094,23 +2094,27 @@ script:
|
|||||||
int startPos = 0;
|
int startPos = 0;
|
||||||
int endPos = 0;
|
int endPos = 0;
|
||||||
std::string wrappedText = "";
|
std::string wrappedText = "";
|
||||||
while (startPos < text_to_display.length()) {
|
if (text_to_display.find("\\r") != std::string::npos) {
|
||||||
while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; }
|
wrappedText = text_to_display;
|
||||||
int endPos = startPos + line_length_limit;
|
} else {
|
||||||
if (endPos >= text_to_display.length()) endPos = text_to_display.length();
|
while (startPos < text_to_display.length()) {
|
||||||
else
|
while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; }
|
||||||
{
|
int endPos = startPos + line_length_limit;
|
||||||
while (endPos > startPos && text_to_display[endPos] != ' ') { endPos--; }
|
if (endPos >= text_to_display.length()) endPos = text_to_display.length();
|
||||||
if (endPos == startPos) endPos = startPos + line_length_limit; // Handle case of long word
|
else
|
||||||
}
|
{
|
||||||
wrappedText += text_to_display.substr(startPos, endPos-startPos);
|
while (endPos > startPos && text_to_display[endPos] != ' ') { endPos--; }
|
||||||
if (endPos < text_to_display.length())
|
if (endPos == startPos) endPos = startPos + line_length_limit; // Handle case of long word
|
||||||
{
|
}
|
||||||
while (text_to_display[endPos] == ' ') { endPos--; }
|
wrappedText += text_to_display.substr(startPos, endPos-startPos);
|
||||||
if (endPos >= startPos) wrappedText += "\\r";
|
if (endPos < text_to_display.length())
|
||||||
}
|
{
|
||||||
startPos = endPos + 1; // Skip the space
|
while (text_to_display[endPos] == ' ') { endPos--; }
|
||||||
while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; }
|
if (endPos >= startPos) wrappedText += "\\r";
|
||||||
|
}
|
||||||
|
startPos = endPos + 1; // Skip the space
|
||||||
|
while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
disp1->set_component_text_printf(component.c_str(), "%s", wrappedText.c_str());
|
disp1->set_component_text_printf(component.c_str(), "%s", wrappedText.c_str());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user