Fixed spoiler width for thin characters.

This commit is contained in:
23rd 2021-12-30 03:23:39 +03:00
parent a3b3745d7c
commit e961883914

View file

@ -2032,10 +2032,15 @@ private:
const auto elideOffset = (_indexOfElidedBlock == currentBlockIndex) const auto elideOffset = (_indexOfElidedBlock == currentBlockIndex)
? (_elideRemoveFromEnd + _f->elidew) ? (_elideRemoveFromEnd + _f->elidew)
: 0; : 0;
const auto &cache = _background.inFront
? _t->_spoilerCache
: _t->_spoilerShownCache;
const auto cornerWidth = cache.corners[0].width()
/ style::DevicePixelRatio();
const auto rect = QRect( const auto rect = QRect(
x.toInt(), x.toInt(),
_y + _yDelta, _y + _yDelta,
width.toInt() - elideOffset, std::max(width.toInt() - elideOffset, cornerWidth * 2),
_fontHeight); _fontHeight);
if (!rect.isValid()) { if (!rect.isValid()) {
return; return;
@ -2055,9 +2060,6 @@ private:
| ((now != will) ? (RectPart::FullRight) : RectPart::None); | ((now != will) ? (RectPart::FullRight) : RectPart::None);
}(); }();
const auto &cache = _background.inFront
? _t->_spoilerCache
: _t->_spoilerShownCache;
if (parts != RectPart::None) { if (parts != RectPart::None) {
DrawRoundedRect( DrawRoundedRect(
*_p, *_p,
@ -2068,8 +2070,6 @@ private:
} }
const auto hasLeft = (parts & RectPart::Left) != 0; const auto hasLeft = (parts & RectPart::Left) != 0;
const auto hasRight = (parts & RectPart::Right) != 0; const auto hasRight = (parts & RectPart::Right) != 0;
const auto cornerWidth = cache.corners[0].width()
/ style::DevicePixelRatio();
_p->fillRect( _p->fillRect(
rect.left() + (hasLeft ? cornerWidth : 0), rect.left() + (hasLeft ? cornerWidth : 0),
rect.top(), rect.top(),