summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-04-02 16:29:53 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2015-04-08 11:40:43 +0000
commit784ff3f0765eb94d025ef789f15ef10f51b8cc15 (patch)
tree2c0f37b30a580943f08de5a5f4cfbcaeb96fcb40
parent233d3efda5523921b80ad8ebaf2b2e7175169e0e (diff)
Resolves: tdf#86399 don't clobber cluster start caret pos
with other cluster element bounds (cherry picked from commit b1030f75d3e47719ca63ec518f1da75196bead1a) Conflicts: vcl/source/gdi/sallayout.cxx Change-Id: I2cc976eb6a0ef42a2678be80637c7220e2247921 Reviewed-on: https://gerrit.libreoffice.org/15119 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--vcl/source/gdi/sallayout.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index c30a99af01fb..87df81f002bb 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1250,19 +1250,20 @@ 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 pG = m_GlyphItems.begin(), pGEnd = m_GlyphItems.end(); pG != pGEnd; ++pG )
{
- nXPos = pG->maLinearPos.X();
+ long nXPos = pG->maLinearPos.X();
long nXRight = nXPos + pG->mnOrigWidth;
int n = pG->mnCharPos;
int nCurrIdx = 2 * (n - mnMinCharPos);
- if( !pG->IsRTLGlyph() )
+ // tdf#86399 if this is not the start of a cluster, don't overwrite the caret bounds of the cluster start
+ if (!pG->IsClusterStart() && pCaretXArray[nCurrIdx] != -1)
+ continue;
+ if (!pG->IsRTLGlyph())
{
// normal positions for LTR case
pCaretXArray[ nCurrIdx ] = nXPos;