It’s a problem with the way the test case is set up. You will never have a case where HTML markup is pasted so the test case is kind of contrived. When markup is converted to a TextFlow, it has a line return at the end. Unless you do something to get rid of that, the line return will get pasted. If you look at the code for copied text, you will see there’s a special property to indicate the TextScrap should get merged in (without the line return).
In short, I think it’s expected behavior. FWIW, in my opinion, line returns is the weakest part of TLF. All line returns are virtual because FTE does not really process them. To deal with this, TLF jumps through lots of hoops. On Oct 21, 2015, at 12:42 PM, Mihai Chira <mihai.ch...@gmail.com> wrote: > Harbs, in relation to FLEX-34807, I don't understand the change you > made to FLEX_34807_Test.as: why is it expected that a new line will be > added when pasting text? Or is it something to do with the exporting > to plain text that requires it? Otherwise I'd see it as a bug, not as > expected behaviour. > > On 12 October 2015 at 22:40, <ha...@apache.org> wrote: >> Repository: flex-tlf >> Updated Branches: >> refs/heads/develop 4a01f5708 -> 5eff80ef7 >> >> >> FLEX-34876 >> Added/fixed tests >> >> >> Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo >> Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/5eff80ef >> Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/5eff80ef >> Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/5eff80ef >> >> Branch: refs/heads/develop >> Commit: 5eff80ef7cb67e8385cb3b2519070bad38e9d1f2 >> Parents: 4a01f57 >> Author: Harbs <ha...@in-tools.com> >> Authored: Mon Oct 12 23:39:43 2015 +0300 >> Committer: Harbs <ha...@in-tools.com> >> Committed: Mon Oct 12 23:39:43 2015 +0300 >> >> ---------------------------------------------------------------------- >> automation_tests/src/AllTestsSuite.as | 4 +++- >> automation_tests/src/UnitTest/Tests/FLEX_34807_Test.as | 2 +- >> textLayout/src/flashx/textLayout/edit/TextFlowEdit.as | 2 +- >> 3 files changed, 5 insertions(+), 3 deletions(-) >> ---------------------------------------------------------------------- >> >> >> http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/5eff80ef/automation_tests/src/AllTestsSuite.as >> ---------------------------------------------------------------------- >> diff --git a/automation_tests/src/AllTestsSuite.as >> b/automation_tests/src/AllTestsSuite.as >> index 0cd93e9..62f2f45 100644 >> --- a/automation_tests/src/AllTestsSuite.as >> +++ b/automation_tests/src/AllTestsSuite.as >> @@ -33,6 +33,7 @@ package >> import UnitTest.Tests.CrossContainerTest; >> import UnitTest.Tests.ElementOperationTest; >> import UnitTest.Tests.EventOverrideTest; >> + import UnitTest.Tests.FLEX_34807_Test; >> import UnitTest.Tests.FactoryImportTest; >> import UnitTest.Tests.FloatTest; >> import UnitTest.Tests.FlowModelTest; >> @@ -111,7 +112,8 @@ package >> public var measurementTest:MeasurementTest; >> public var leadingTest:LeadingTest; >> public var scrollToRangeTest:ScrollToRangeTest; >> - //public var >> pasteWithMultiParagraph:PasteWithMutliParagraph_FLEX_34876_Test; >> + public var >> pasteWithMultiParagraph:PasteWithMutliParagraph_FLEX_34876_Test; >> + public var flex_34807:FLEX_34807_Test; >> } >> >> } >> >> http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/5eff80ef/automation_tests/src/UnitTest/Tests/FLEX_34807_Test.as >> ---------------------------------------------------------------------- >> diff --git a/automation_tests/src/UnitTest/Tests/FLEX_34807_Test.as >> b/automation_tests/src/UnitTest/Tests/FLEX_34807_Test.as >> index 872250a..ff03a97 100644 >> --- a/automation_tests/src/UnitTest/Tests/FLEX_34807_Test.as >> +++ b/automation_tests/src/UnitTest/Tests/FLEX_34807_Test.as >> @@ -243,7 +243,7 @@ package UnitTest.Tests >> private function >> assertTextPastedCorrectlyAndExistingTextNotChanged(pastePosition:int):void >> { >> const currentSourceAsPlainText:String = >> TextConverter.export(testApp.getTextFlow(), TextConverter.PLAIN_TEXT_FORMAT, >> ConversionType.STRING_TYPE) as String; >> - assertEquals("Not all the pasted content appears in the new >> TextFlow!", sourceAsPlainText.substr(0, pastePosition) + PASTED_TEXT + >> sourceAsPlainText.substr(pastePosition), currentSourceAsPlainText); >> + assertEquals("Not all the pasted content appears in the new >> TextFlow!", sourceAsPlainText.substr(0, pastePosition) + PASTED_TEXT + "\n" >> + sourceAsPlainText.substr(pastePosition), currentSourceAsPlainText); >> } >> } >> } >> \ No newline at end of file >> >> http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/5eff80ef/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as >> ---------------------------------------------------------------------- >> diff --git a/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as >> b/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as >> index 5908353..491994c 100644 >> --- a/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as >> +++ b/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as >> @@ -251,7 +251,7 @@ package flashx.textLayout.edit >> } >> else >> { >> - if (applyFormat && firstParagraph) >> + if (applyFormat) >> { >> destinationElement = >> destinationLeaf ? findLowestPossibleParent(destinationLeaf.parent, >> scrapElement) : findLowestPossibleParent(destinationElement, scrapElement); >> var currentIndex:int = >> destinationElement.findChildIndexAtPosition(insertPosition - >> destinationElement.getAbsoluteStart()); >>