[Libreoffice-commits] core.git: vcl/source

Caolán McNamara caolanm at redhat.com
Thu Apr 2 08:31:14 PDT 2015


 vcl/source/gdi/sallayout.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit b1030f75d3e47719ca63ec518f1da75196bead1a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 2 16:29:53 2015 +0100

    Resolves: tdf#86399 don't clobber cluster start caret pos
    
    with other cluster element bounds
    
    Change-Id: I2cc976eb6a0ef42a2678be80637c7220e2247921

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 15883f4..f3481cf 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1300,18 +1300,19 @@ void GenericSalLayout::KashidaJustify( long nKashidaIndex, int nKashidaWidth )
 void GenericSalLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) const
 {
     // initialize result array
-    long nXPos = -1;
-    int i;
-    for( i = 0; i < nMaxIndex; ++i )
-        pCaretXArray[ i ] = nXPos;
+    for (int i = 0; i < nMaxIndex; ++i)
+        pCaretXArray[i] = -1;
 
     // calculate caret positions using glyph array
     for( GlyphVector::const_iterator pGlyphIter = m_GlyphItems.begin(), pGlyphIterEnd = m_GlyphItems.end(); pGlyphIter != pGlyphIterEnd; ++pGlyphIter )
     {
-        nXPos = pGlyphIter->maLinearPos.X();
+        long nXPos = pGlyphIter->maLinearPos.X();
         long nXRight = nXPos + pGlyphIter->mnOrigWidth;
         int n = pGlyphIter->mnCharPos;
         int nCurrIdx = 2 * (n - mnMinCharPos);
+        // tdf#86399 if this is not the start of a cluster, don't overwrite the caret bounds of the cluster start
+        if (!pGlyphIter->IsClusterStart() && pCaretXArray[nCurrIdx] != -1)
+            continue;
         if( !pGlyphIter->IsRTLGlyph() )
         {
             // normal positions for LTR case


More information about the Libreoffice-commits mailing list