tg_cli: support new lines in formatted text.

This commit is contained in:
levlam 2023-11-16 11:58:54 +03:00
parent 3e189cd8d1
commit aefbf0327f

View File

@ -1654,7 +1654,13 @@ class CliClient final : public Actor {
if (entities.empty() && !text.empty()) { if (entities.empty() && !text.empty()) {
Slice unused_reserved_characters("#+-={}.!"); Slice unused_reserved_characters("#+-={}.!");
string new_text; string new_text;
for (auto c : text) { for (size_t i = 0; i < text.size(); i++) {
auto c = text[i];
if (c == '\\' && text[i + 1] == 'n') {
new_text += '\n';
i++;
continue;
}
if (unused_reserved_characters.find(c) != Slice::npos) { if (unused_reserved_characters.find(c) != Slice::npos) {
new_text += '\\'; new_text += '\\';
} }