Remove wrong check from remove_invalid_entities.
GitOrigin-RevId: 843dea6a6668de87287a23532d95e9c6712c5b09
This commit is contained in:
parent
b2a175463f
commit
718067e218
@ -3319,9 +3319,10 @@ static Result<string> clean_input_string_with_entities(const string &text, vecto
|
||||
}
|
||||
|
||||
// removes entities containing whitespaces only
|
||||
// entities must be sorted by offset and length, but not necessary by type
|
||||
// returns {last_non_whitespace_pos, last_non_whitespace_utf16_offset}
|
||||
static std::pair<size_t, int32> remove_invalid_entities(const string &text, vector<MessageEntity> &entities) {
|
||||
check_is_sorted(entities);
|
||||
// check_is_sorted(entities);
|
||||
vector<MessageEntity *> nested_entities_stack;
|
||||
size_t current_entity = 0;
|
||||
|
||||
|
@ -783,6 +783,16 @@ TEST(MessageEntities, fix_formatted_text) {
|
||||
}
|
||||
}
|
||||
|
||||
check_fix_formatted_text("a\rbc\r",
|
||||
{{td::MessageEntity::Type::Italic, 0, 1},
|
||||
{td::MessageEntity::Type::Bold, 0, 2},
|
||||
{td::MessageEntity::Type::Italic, 3, 2},
|
||||
{td::MessageEntity::Type::Bold, 3, 1}},
|
||||
"abc",
|
||||
{{td::MessageEntity::Type::Bold, 0, 1},
|
||||
{td::MessageEntity::Type::Italic, 0, 1},
|
||||
{td::MessageEntity::Type::Bold, 2, 1},
|
||||
{td::MessageEntity::Type::Italic, 2, 1}});
|
||||
check_fix_formatted_text("abc", {{td::MessageEntity::Type::Italic, 1, 1}, {td::MessageEntity::Type::Italic, 0, 1}},
|
||||
"abc", {{td::MessageEntity::Type::Italic, 0, 2}});
|
||||
check_fix_formatted_text("abc", {{td::MessageEntity::Type::Italic, 1, 1}, {td::MessageEntity::Type::Italic, 1, 1}},
|
||||
|
Reference in New Issue
Block a user