mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Allow timestamp links under spoilers.
This commit is contained in:
parent
828ecabc78
commit
1038baf467
1 changed files with 8 additions and 2 deletions
|
@ -156,17 +156,23 @@ TextWithEntities AddTimestampLinks(
|
||||||
}
|
}
|
||||||
|
|
||||||
auto &entities = text.entities;
|
auto &entities = text.entities;
|
||||||
const auto i = ranges::lower_bound(
|
auto i = ranges::lower_bound(
|
||||||
entities,
|
entities,
|
||||||
from,
|
from,
|
||||||
std::less<>(),
|
std::less<>(),
|
||||||
&EntityInText::offset);
|
&EntityInText::offset);
|
||||||
|
while (i != entities.end()
|
||||||
|
&& i->offset() < till
|
||||||
|
&& i->type() == EntityType::Spoiler) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
if (i != entities.end() && i->offset() < till) {
|
if (i != entities.end() && i->offset() < till) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto intersects = [&](const EntityInText &entity) {
|
const auto intersects = [&](const EntityInText &entity) {
|
||||||
return entity.offset() + entity.length() > from;
|
return (entity.offset() + entity.length() > from)
|
||||||
|
&& (entity.type() != EntityType::Spoiler);
|
||||||
};
|
};
|
||||||
auto j = std::make_reverse_iterator(i);
|
auto j = std::make_reverse_iterator(i);
|
||||||
const auto e = std::make_reverse_iterator(entities.begin());
|
const auto e = std::make_reverse_iterator(entities.begin());
|
||||||
|
|
Loading…
Add table
Reference in a new issue