mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Fix crash in recent actions with spoilers.
This commit is contained in:
parent
0e6c899cee
commit
6cb01998cc
4 changed files with 48 additions and 17 deletions
|
@ -247,7 +247,17 @@ void Game::draw(Painter &p, const PaintContext &context) const {
|
||||||
endskip = _parent->skipBlockWidth();
|
endskip = _parent->skipBlockWidth();
|
||||||
}
|
}
|
||||||
_parent->prepareCustomEmojiPaint(p, context, _description);
|
_parent->prepareCustomEmojiPaint(p, context, _description);
|
||||||
_description.drawLeftElided(p, padding.left(), tshift, paintw, width(), _descriptionLines, style::al_left, 0, -1, endskip, false, toDescriptionSelection(context.selection));
|
_description.draw(p, {
|
||||||
|
.position = { padding.left(), tshift },
|
||||||
|
.outerWidth = width(),
|
||||||
|
.availableWidth = paintw,
|
||||||
|
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||||
|
.now = context.now,
|
||||||
|
.paused = context.paused,
|
||||||
|
.selection = toDescriptionSelection(context.selection),
|
||||||
|
.elisionLines = _descriptionLines,
|
||||||
|
.elisionRemoveFromEnd = endskip,
|
||||||
|
});
|
||||||
tshift += _descriptionLines * lineHeight;
|
tshift += _descriptionLines * lineHeight;
|
||||||
}
|
}
|
||||||
if (_attach) {
|
if (_attach) {
|
||||||
|
|
|
@ -228,7 +228,16 @@ void Invoice::draw(Painter &p, const PaintContext &context) const {
|
||||||
}
|
}
|
||||||
if (_descriptionHeight) {
|
if (_descriptionHeight) {
|
||||||
p.setPen(stm->historyTextFg);
|
p.setPen(stm->historyTextFg);
|
||||||
_description.drawLeft(p, padding.left(), tshift, paintw, width(), style::al_left, 0, -1, toDescriptionSelection(context.selection));
|
_parent->prepareCustomEmojiPaint(p, context, _description);
|
||||||
|
_description.draw(p, {
|
||||||
|
.position = { padding.left(), tshift },
|
||||||
|
.outerWidth = width(),
|
||||||
|
.availableWidth = paintw,
|
||||||
|
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||||
|
.now = context.now,
|
||||||
|
.paused = context.paused,
|
||||||
|
.selection = toDescriptionSelection(context.selection),
|
||||||
|
});
|
||||||
tshift += _descriptionHeight;
|
tshift += _descriptionHeight;
|
||||||
}
|
}
|
||||||
if (_attach) {
|
if (_attach) {
|
||||||
|
@ -353,6 +362,17 @@ void Invoice::clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Invoice::hasHeavyPart() const {
|
||||||
|
return _attach ? _attach->hasHeavyPart() : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Invoice::unloadHeavyPart() {
|
||||||
|
if (_attach) {
|
||||||
|
_attach->unloadHeavyPart();
|
||||||
|
}
|
||||||
|
_description.unloadPersistentAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
TextForMimeData Invoice::selectedText(TextSelection selection) const {
|
TextForMimeData Invoice::selectedText(TextSelection selection) const {
|
||||||
auto titleResult = _title.toTextForMimeData(selection);
|
auto titleResult = _title.toTextForMimeData(selection);
|
||||||
auto descriptionResult = _description.toTextForMimeData(
|
auto descriptionResult = _description.toTextForMimeData(
|
||||||
|
|
|
@ -70,14 +70,8 @@ public:
|
||||||
return _attach.get();
|
return _attach.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasHeavyPart() const override {
|
bool hasHeavyPart() const override;
|
||||||
return _attach ? _attach->hasHeavyPart() : false;
|
void unloadHeavyPart() override;
|
||||||
}
|
|
||||||
void unloadHeavyPart() override {
|
|
||||||
if (_attach) {
|
|
||||||
_attach->unloadHeavyPart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSize countOptimalSize() override;
|
QSize countOptimalSize() override;
|
||||||
|
|
|
@ -568,13 +568,20 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
||||||
endskip = _parent->skipBlockWidth();
|
endskip = _parent->skipBlockWidth();
|
||||||
}
|
}
|
||||||
_parent->prepareCustomEmojiPaint(p, context, _description);
|
_parent->prepareCustomEmojiPaint(p, context, _description);
|
||||||
if (_descriptionLines > 0) {
|
_description.draw(p, {
|
||||||
_description.drawLeftElided(p, padding.left(), tshift, paintw, width(), _descriptionLines, style::al_left, 0, -1, endskip, false, toDescriptionSelection(context.selection));
|
.position = { padding.left(), tshift },
|
||||||
tshift += _descriptionLines * lineHeight;
|
.outerWidth = width(),
|
||||||
} else {
|
.availableWidth = paintw,
|
||||||
_description.drawLeft(p, padding.left(), tshift, paintw, width(), style::al_left, 0, -1, toDescriptionSelection(context.selection));
|
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||||
tshift += _description.countHeight(paintw);
|
.now = context.now,
|
||||||
}
|
.paused = context.paused,
|
||||||
|
.selection = toDescriptionSelection(context.selection),
|
||||||
|
.elisionLines = std::max(_descriptionLines, 0),
|
||||||
|
.elisionRemoveFromEnd = (_descriptionLines > 0) ? endskip : 0,
|
||||||
|
});
|
||||||
|
tshift += (_descriptionLines > 0)
|
||||||
|
? (_descriptionLines * lineHeight)
|
||||||
|
: _description.countHeight(paintw);
|
||||||
}
|
}
|
||||||
if (_attach) {
|
if (_attach) {
|
||||||
auto attachAtTop = !_siteNameLines && !_titleLines && !_descriptionLines;
|
auto attachAtTop = !_siteNameLines && !_titleLines && !_descriptionLines;
|
||||||
|
|
Loading…
Add table
Reference in a new issue