summaryrefslogtreecommitdiff
path: root/editeng/source/editeng
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-08-11 18:52:17 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-08-14 21:11:15 +0200
commit72e56537d4bb9411229346da977d1d669ccfca9a (patch)
tree2d278306c50f35bac6963229f47b25504f462e02 /editeng/source/editeng
parent640a2bc1cd093875b701bb958b6156d5752c0fac (diff)
tdf#139627: Don’t set Kashida insertion position after combining marks
We were skipping the marks when checking for previous char, but not when setting the index to previous char. Fixes also the second part of tdf#106653. Change-Id: I73436ba9df6ccf104ea6d4dfbd76a59c86040a44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138154 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng/source/editeng')
-rw-r--r--editeng/source/editeng/impedit3.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index d7129999dfa5..6195b0e8e606 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2339,10 +2339,9 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I
// restore selection for proper iteration at the end of the function
aWordSel.Max().SetIndex( nSavPos );
- sal_Int32 nIdx = 0;
+ sal_Int32 nIdx = 0, nPrevIdx = 0;
sal_Int32 nKashidaPos = -1;
- sal_Unicode cCh;
- sal_Unicode cPrevCh = 0;
+ sal_Unicode cCh, cPrevCh = 0;
int nPriorityLevel = 7; // 0..6 = level found
// 7 not found
@@ -2390,7 +2389,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I
// check if character is connectable to previous character,
if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
{
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+ nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
nPriorityLevel = 2;
}
}
@@ -2411,7 +2410,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I
// check if character is connectable to previous character,
if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
{
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+ nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
nPriorityLevel = 3;
}
}
@@ -2431,7 +2430,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I
// check if character is connectable to previous character,
if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
{
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+ nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
nPriorityLevel = 4;
}
}
@@ -2453,7 +2452,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I
// check if character is connectable to previous character,
if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
{
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+ nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
nPriorityLevel = 5;
}
}
@@ -2469,7 +2468,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I
// check if character is connectable to previous character,
if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
{
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+ nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
nPriorityLevel = 6;
}
}
@@ -2478,7 +2477,10 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I
// Do not consider vowel marks when checking if a character
// can be connected to previous character.
if ( !isTransparentChar ( cCh) )
+ {
cPrevCh = cCh;
+ nPrevIdx = nIdx;
+ }
++nIdx;
} // end of current word