From aee2725408d7918461e1697a5ab0aa724ae5358e Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Fri, 1 Nov 2024 09:53:09 +0100 Subject: [PATCH] [LVGL] Backslash is not handled properly in Text property #589 --- packages/project-editor/lvgl/widget-common.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/project-editor/lvgl/widget-common.tsx b/packages/project-editor/lvgl/widget-common.tsx index f16450d3..44393f1e 100644 --- a/packages/project-editor/lvgl/widget-common.tsx +++ b/packages/project-editor/lvgl/widget-common.tsx @@ -106,6 +106,15 @@ export function escapeCString(unescaped: string) { result += "\\r"; } else if (ch == "\t") { result += "\\t"; + } else if ( + ch == "\\" && + (i == unescaped.length - 1 || + (unescaped[i + 1] != "n" && + unescaped[i + 1] != "r" && + unescaped[i + 1] != "t" && + unescaped[i + 1] != "u")) + ) { + result += "\\\\"; } else { result += ch; }