From c8ec35c7987adefdc65fae69f3777ee747a02d6b Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 7 Aug 2023 14:37:27 +0200 Subject: [PATCH] Improve BTConsolePrint action - Make generated name less verbose - Escape new line and tab characters --- bt/actions/bt_console_print.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bt/actions/bt_console_print.cpp b/bt/actions/bt_console_print.cpp index 18b234f..3bc90ae 100644 --- a/bt/actions/bt_console_print.cpp +++ b/bt/actions/bt_console_print.cpp @@ -22,10 +22,13 @@ String BTConsolePrint::_generate_name() const { tx = text.substr(0, 30) + "..."; } tx = tx.replace("\"", "\\\""); + tx = tx.replace("\r", "\\r"); + tx = tx.replace("\t", "\\t"); + tx = tx.replace("\n", "\\n"); if (bb_format_parameters.size() > 0) { - return vformat("ConsolePrint text: \"%s\" format_parameters: %s", tx, bb_format_parameters); + return vformat("ConsolePrint text: \"%s\" params: %s", tx, bb_format_parameters); } - return vformat("ConsolePrint \"%s\"", tx); + return vformat("ConsolePrint text: \"%s\"", tx); } int BTConsolePrint::_tick(double p_delta) {