In the RTL case, when text is inserted or removed in the middle of a bidi paragraph,
the character index of line info is not updated,
so there is a problem that the line info is damaged in reorders.
This patch updates the index of line info based on the bidi paragraph info updated in SetBidirectionalInfo.
Change-Id: Ifc1ddfa5f15ce89be967ce57241a093030be323d
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
lineBreakInfo,
0u,
characterCount,
- bidirectionalInfo);
+ bidirectionalInfo,
+ logicalModel->mBidirectionalLineInfo);
// Create the paragraph info.
logicalModel->CreateParagraphInfo(0u,
logicalModel->mLineBreakInfo,
data.startIndex,
data.numberOfCharacters,
- bidirectionalInfo);
+ bidirectionalInfo,
+ logicalModel->mBidirectionalLineInfo);
// 4) Compare with the expected results.
if(data.numberOfParagraphs != bidirectionalInfo.Count())
DALI_TEST_EQUALS("Hello\nworld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
// For coverage
+ editor.SetProperty(TextEditor::Property::TEXT, "الاخيرالسطر1\nالاخيرالسطر2\nالاخيرالسطر3\nالاخيرالسطر4");
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("d", "", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.ProcessEvent(GenerateKey("d", "", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ኢ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+
application.ProcessEvent(GenerateKey("", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
application.SendNotification();
application.Render();
lineBreakInfo,
0u,
numberOfCharacters,
- bidirectionalInfo);
+ bidirectionalInfo,
+ textModel->mLogicalModel->mBidirectionalLineInfo);
const bool hasBidirectionalText = 0u != bidirectionalInfo.Count();
if(hasBidirectionalText)
free(bidiLineInfo.visualToLogicalMap);
bidiLineInfo.visualToLogicalMap = NULL;
+
+ free(bidiLineInfo.visualToLogicalMapSecondHalf);
+ bidiLineInfo.visualToLogicalMapSecondHalf = NULL;
}
mTextModel->mLogicalModel->mBidirectionalLineInfo.Clear();
0u,
numberOfCharacters,
bidirectionalInfo,
+ mTextModel->mLogicalModel->mBidirectionalLineInfo,
(mTextModel->mMatchLayoutDirection != DevelText::MatchLayoutDirection::CONTENTS),
parameters.layoutDirection);
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ Vector<BidirectionalLineInfoRun>& lineInfoRuns,
bool matchLayoutDirection,
Dali::LayoutDirection::Type layoutDirection)
{
}
}
+ // Find the first bidi line index to update.
+ bool updateLineInfoRuns = false;
+ BidirectionalLineRunIndex updateLineInfoIndex = 0u;
+
// Update indices of the bidi runs.
for(Vector<BidirectionalParagraphInfoRun>::Iterator it = bidirectionalInfo.Begin() + bidiInfoIndex,
endIt = bidirectionalInfo.End();
{
BidirectionalParagraphInfoRun& run = *it;
+ if(!updateLineInfoRuns)
+ {
+ updateLineInfoRuns = true;
+ updateLineInfoIndex = run.characterRun.characterIndex;
+ }
+
run.characterRun.characterIndex += numberOfCharacters;
}
+
+ // Update indices of the bidi line runs.
+ if(updateLineInfoRuns)
+ {
+ bool firstLineFound = false;
+ for(auto& lineInfoRun : lineInfoRuns)
+ {
+ if(lineInfoRun.characterRun.characterIndex == updateLineInfoIndex)
+ {
+ firstLineFound = true;
+ }
+ if(firstLineFound)
+ {
+ lineInfoRun.characterRun.characterIndex += numberOfCharacters;
+ }
+ }
+ }
}
void ReorderLine(TextAbstraction::BidirectionalSupport& bidirectionalSupport,
* @param[in] startIndex The character from where the bidirectional info is set.
* @param[in] numberOfCharacters The number of characters.
* @param[out] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
+ * @param[out] lineInfoRuns Line runs with the visual to logical conversion maps.
* @param[in] matchLayoutDirection Whether match for layout direction or not.
* @param[in] layoutDirection The direction of the layout.
*/
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ Vector<BidirectionalLineInfoRun>& lineInfoRuns,
bool matchLayoutDirection = false,
Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT);
free(bidiLineInfo.visualToLogicalMap);
bidiLineInfo.visualToLogicalMap = NULL;
+
+ free(bidiLineInfo.visualToLogicalMapSecondHalf);
+ bidiLineInfo.visualToLogicalMapSecondHalf = NULL;
}
model->mLogicalModel->mBidirectionalLineInfo.Clear();
}
free(bidiLineInfo.visualToLogicalMap);
bidiLineInfo.visualToLogicalMap = NULL;
+
+ free(bidiLineInfo.visualToLogicalMapSecondHalf);
+ bidiLineInfo.visualToLogicalMapSecondHalf = NULL;
}
model->mLogicalModel->mBidirectionalLineInfo.Erase(bidirectionalLineInfoBuffer + startRemoveIndex,
startIndex,
requestedNumberOfCharacters,
bidirectionalInfo,
+ impl.mModel->mLogicalModel->mBidirectionalLineInfo,
(impl.mModel->mMatchLayoutDirection != DevelText::MatchLayoutDirection::CONTENTS),
impl.mLayoutDirection);