From 7d5b2b8d307cdd90eafd54d6390d26690f3f34ee Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:19:25 +0100 Subject: [PATCH] Remove manual line break from page's title Solves #1367 --- nspanel_esphome_core.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nspanel_esphome_core.yaml b/nspanel_esphome_core.yaml index a1d4bc2..538c60f 100644 --- a/nspanel_esphome_core.yaml +++ b/nspanel_esphome_core.yaml @@ -226,6 +226,9 @@ api: // Alarm page - Header update_alarm_icon->execute("icon_state", state.c_str()); + if (page_title.find("\\r") != std::string::npos) { + page_title = page_title.replace(page_title.find("\\r"), 2, " "); + } disp1->set_component_text_printf("page_label", "%s", page_title.c_str()); disp1->set_component_text_printf("code_format", "%s", code_format.c_str()); if (code_arm_required) disp1->set_component_text_printf("code_arm_req", "1"); else disp1->set_component_text_printf("code_arm_req", "0"); @@ -432,6 +435,9 @@ api: detailed_entity->publish_state(entity); std::string cmd_page = std::string("page ") + page.c_str(); disp1->send_command_printf(cmd_page.c_str()); + if (page_label.find("\\r") != std::string::npos) { + page_label = page_label.replace(page_label.find("\\r"), 2, " "); + } disp1->set_component_text_printf("page_label", "%s", page_label.c_str()); disp1->set_component_text_printf("back_page", "%s", back_page.c_str()); if (page == "climate")