From d4b30757ab2f66e351a73f087b834d578d21ea15 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 8 Oct 2013 13:26:48 +0200 Subject: [PATCH] Fix broken text layout with ShowLineAndParagraphSeparators Before we add the current cluster we need to check if there's space for it. Calling checkFullOtherwiseExtend() also has the side effect of resetting the space data. We would add the cluster without checking for space when showing separators, causing broken behavior like we would count the space in the current item as trailing space, which would make us chop the end of the string. Task-number: QTBUG-28832 Change-Id: I8169662218ff6e645575d4e89a57f6b234f3c4cb Reviewed-by: Konstantin Ritt Reviewed-by: Simon Hausmann --- src/gui/text/qtextlayout.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index e10a7dbe10..dc8ae06868 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1788,6 +1788,9 @@ void QTextLine::layout_helper(int maxGlyphs) if (!line.length && !lbh.tmpData.length) line.setDefaultHeight(eng); if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators) { + if (lbh.checkFullOtherwiseExtend(line)) + goto found; + addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, current, lbh.logClusters, lbh.glyphs); } else {