sw/source/core/text/inftxt.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
New commits: commit b5a22fceed57f05eb43a5fb0817afbc141610c5e Author: Justin Luth <jl...@mail.com> AuthorDate: Fri May 12 14:47:54 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Sat May 13 02:21:51 2023 +0200 tdf#130363 sw layout: MS Word compatibility trailing blanks option part 4 There are also margins to be considered. Granted, the previous approach DID seem to get the right width, since MS Word doesn't paint the left border spacing either. However, since the existing situation doesn't cover that case, just remove the excess amount. Although not perfect (and this whole thing is a total hack, so perfection can hardly be expected) it is better than before. Change-Id: I9dd1e801d8fe0000de020d59c7463138e2ad9f6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151716 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index dcb1657d2801..dd436e0358c6 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1259,11 +1259,10 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const if (GetText()[i] != CH_BLANK) { const sal_uInt16 nOldWidth = rPor.Width(); - const sal_uInt16 nNewWidth - = GetTextSize(m_pOut, nullptr, GetText(), GetIdx(), - TextFrameIndex(i + 1) - GetIdx()).Width(); - - const_cast<SwLinePortion&>(rPor).Width( nNewWidth ); + const sal_uInt16 nExcessWidth + = GetTextSize(m_pOut, nullptr, GetText(), TextFrameIndex(i + 1), + TextFrameIndex(nLastPos - i)).Width(); + const_cast<SwLinePortion&>(rPor).Width(nOldWidth - nExcessWidth); CalcRect( rPor, nullptr, &aIntersect, true ); const_cast<SwLinePortion&>(rPor).Width( nOldWidth );