Improve BTConsolePrint action

- Make generated name less verbose
- Escape new line and tab characters
This commit is contained in:
Serhii Snitsaruk 2023-08-07 14:37:27 +02:00
parent 34e70d48ce
commit c8ec35c798
1 changed files with 5 additions and 2 deletions

View File

@ -22,10 +22,13 @@ String BTConsolePrint::_generate_name() const {
tx = text.substr(0, 30) + "..."; tx = text.substr(0, 30) + "...";
} }
tx = tx.replace("\"", "\\\""); tx = tx.replace("\"", "\\\"");
tx = tx.replace("\r", "\\r");
tx = tx.replace("\t", "\\t");
tx = tx.replace("\n", "\\n");
if (bb_format_parameters.size() > 0) { 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) { int BTConsolePrint::_tick(double p_delta) {