aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2026-07-06 15:14:52 +0300
committerlevlam <levlam@telegram.org>2026-07-06 15:14:52 +0300
commit35876f580f3a0c10bf7f464c5a3cf622cba4e2b9 (patch)
treec3bf665ae9a26f7eaf1b332b175c5613ff46fc1c
parentba2215f65ecbf284431a5000f4897d5fba2d14c4 (diff)
Use text_length.
-rw-r--r--td/telegram/MessageEntity.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp
index 7925e8d40..e50cdea43 100644
--- a/td/telegram/MessageEntity.cpp
+++ b/td/telegram/MessageEntity.cpp
@@ -1909,7 +1909,7 @@ bool is_visible_url(const FormattedText &text, const string &url) {
return false;
}
- auto url_size = static_cast<int32>(utf8_utf16_length(url));
+ auto url_size = text_length(url);
auto cur_offset = 0;
Slice left_text = text.text;
for (auto &entity : text.entities) {
@@ -4633,7 +4633,7 @@ void truncate_formatted_text(FormattedText &text, size_t length) {
return;
}
text.text.resize(result_size);
- auto utf16_length = narrow_cast<int32>(utf8_utf16_length(text.text));
+ auto utf16_length = text_length(text.text);
for (auto &entity : text.entities) {
if (entity.offset + entity.length > utf16_length) {
if (entity.offset >= utf16_length || is_continuous_entity(entity.type)) {