diff --git a/ui/effects/radial_animation.h b/ui/effects/radial_animation.h index 2581372..54a34de 100644 --- a/ui/effects/radial_animation.h +++ b/ui/effects/radial_animation.h @@ -72,7 +72,7 @@ public: Callback &&callback, const style::InfiniteRadialAnimation &st); - bool animating() const { + [[nodiscard]] bool animating() const { return _animation.animating(); } @@ -89,7 +89,7 @@ public: QSize size, int outerWidth); - RadialState computeState(); + [[nodiscard]] RadialState computeState(); private: const style::InfiniteRadialAnimation &_st; diff --git a/ui/text/text.cpp b/ui/text/text.cpp index 724000b..e984353 100644 --- a/ui/text/text.cpp +++ b/ui/text/text.cpp @@ -3214,6 +3214,17 @@ TextForMimeData String::toText( if (composeExpanded) { result.expanded.reserve(_text.size()); } + const auto insertEntity = [&](EntityInText &&entity) { + auto i = result.rich.entities.end(); + while (i != result.rich.entities.begin()) { + auto j = i; + if ((--j)->offset() <= entity.offset()) { + break; + } + i = j; + } + result.rich.entities.insert(i, std::move(entity)); + }; auto linkStart = 0; auto markdownTrackers = composeEntities ? std::vector{ @@ -3231,7 +3242,7 @@ TextForMimeData String::toText( for (auto &tracker : markdownTrackers) { const auto flag = tracker.flag; if ((oldFlags & flag) && !(newFlags & flag)) { - result.rich.entities.push_back({ + insertEntity({ tracker.type, tracker.start, result.rich.text.size() - tracker.start }); @@ -3264,7 +3275,7 @@ TextForMimeData String::toText( } } if (composeEntities) { - result.rich.entities.push_back({ + insertEntity({ entity.type, linkStart, full.size(),