Remove whitespace-only entities added in merge_entities.
GitOrigin-RevId: 8b2dbe05d0758639c4447fbfec038b8350dfda9a
This commit is contained in:
parent
379bff13cb
commit
06e74cfba9
@ -3818,6 +3818,9 @@ Status fix_formatted_text(string &text, vector<MessageEntity> &entities, bool al
|
||||
merge_new_entities(entities, find_entities(text, skip_bot_commands));
|
||||
}
|
||||
|
||||
// new whitespace-only entities could be added after splitting of entities
|
||||
remove_invalid_entities(text, entities);
|
||||
|
||||
// TODO MAX_MESSAGE_LENGTH and MAX_CAPTION_LENGTH
|
||||
|
||||
return Status::OK();
|
||||
|
@ -815,6 +815,11 @@ TEST(MessageEntities, fix_formatted_text) {
|
||||
"abc", {{td::MessageEntity::Type::Italic, 0, 2}, {td::MessageEntity::Type::Bold, 2, 1}});
|
||||
check_fix_formatted_text("abc", {{td::MessageEntity::Type::Italic, 0, 1}, {td::MessageEntity::Type::Bold, 2, 1}},
|
||||
"abc", {{td::MessageEntity::Type::Italic, 0, 1}, {td::MessageEntity::Type::Bold, 2, 1}});
|
||||
check_fix_formatted_text("@tests @tests", {{td::MessageEntity::Type::Italic, 0, 13}}, "@tests @tests",
|
||||
{{td::MessageEntity::Type::Mention, 0, 6},
|
||||
{td::MessageEntity::Type::Italic, 0, 6},
|
||||
{td::MessageEntity::Type::Mention, 7, 6},
|
||||
{td::MessageEntity::Type::Italic, 7, 6}});
|
||||
|
||||
// _a*b*_
|
||||
check_fix_formatted_text(
|
||||
|
Reference in New Issue
Block a user