diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index 3255ac511a..e9829d267e 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -919,6 +919,24 @@ void gDC::exec(const gOpcode *o) } para->setBlend(flags & gPainter::RT_BLEND); + + // For RT_HALIGN_RIGHT, precisely expand the DC clip to prevent the last + // glyph's right-side bearing from being clipped by the render area boundary. + gRegion savedClip; + bool clipExpanded = false; + if (flags & gPainter::RT_HALIGN_RIGHT) + { + const eRect &bbox = para->getBoundBox(); + int areaRight = o->parm.renderText->area.right() + offset.x(); + int overflow = bbox.right() + offset.x() - areaRight; + if (overflow > 0) + { + savedClip = m_current_clip; + clipExpanded = true; + m_current_clip |= gRegion(eRect(areaRight, o->parm.renderText->area.top() + offset.y(), + overflow + 1, o->parm.renderText->area.height())); + } + } if (o->parm.renderText->border) { @@ -929,6 +947,8 @@ void gDC::exec(const gOpcode *o) { para->blit(*this, offset, m_background_color_rgb, m_foreground_color_rgb); } + if (clipExpanded) + m_current_clip = savedClip; delete o->parm.renderText; break; } diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index 9183890205..b25f20addc 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -733,11 +733,22 @@ void eListbox::updateScrollBar() } else { - if (m_orientation == orVertical) - m_content->setSize(eSize(width, m_itemheight)); - else if (m_orientation == orHorizontal) - m_content->setSize(eSize(m_itemwidth, height)); - else + // showOnDemand with no scrollbar needed: still reserve scrollbar space + // so item width stays constant if scrollbar later appears (avoids + // clipping fixed-position template content when scrollbar toggles). + if (m_orientation == orVertical) { + if (m_scrollbar_mode == showOnDemand) { + m_content->setSize(eSize(width-m_scrollbar_width-5, m_itemheight)); + } else { + m_content->setSize(eSize(width, m_itemheight)); + } + } else if (m_orientation == orHorizontal) { + if (m_scrollbar_mode == showOnDemand) { + m_content->setSize(eSize(m_itemwidth, height-m_scrollbar_height-5)); + } else { + m_content->setSize(eSize(m_itemwidth, height)); + } + } else m_content->setSize(eSize(m_itemwidth, m_itemwidth)); m_scrollbar->hide();