You are viewing a plain text version of this content. The canonical link for it is here.
Posted to odf-dev@incubator.apache.org by "Svante Schubert (JIRA)" <ji...@apache.org> on 2016/07/06 17:07:11 UTC
[jira] [Assigned] (ODFTOOLKIT-435) the call of
TextSelection.createSpanElement() adds invalide line-breaks
[ https://issues.apache.org/jira/browse/ODFTOOLKIT-435?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Svante Schubert reassigned ODFTOOLKIT-435:
------------------------------------------
Assignee: Svante Schubert
Reviewing patch and building & testing on Ubuntu & Windows.
> the call of TextSelection.createSpanElement() adds invalide line-breaks
> -----------------------------------------------------------------------
>
> Key: ODFTOOLKIT-435
> URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-435
> Project: ODF Toolkit
> Issue Type: Bug
> Components: simple api
> Reporter: Georg Füchsle
> Assignee: Svante Schubert
> Attachments: linebreaksInCreateTextSpan.diff
>
>
> The call of TextSelection.createSpanElement() adds invalide line-breaks to the father paragraph if the paragraph has line-breaks included.
> For example:
> We use a Paragraph "para" that correspondes to following xml:
> {{<text\:p text:style-name="a4cb5f8">before lb<text:line-break></text:line-break>after lb</text\:p>}}
> {{Paragraph para = ...}}
> {{TextSelection tSel = TextSelection.newTextSelection(null,}}
> {{para.getTextContent().replaceAll("\r\n","\n"),}}
> {{para.getOdfElement(), 0);}}
> {{TextSpanElement tspan = tSel.createSpanElement();}}
> After the call " tSel.createSpanElement()" the text is wrapped into a span but the span is followed by an additional line-break:
> {{<text\:p text:style-name="a4cb5f8"><text:span>before lb<text:line-break></text:line-break>after lb</text:span>{color:red}<text:line-break></text:line-break>{color}</text\:p>}}
> In our opinion the reason is in the function:
> {{private void TextSection.delete(int fromIndex, int leftLength, Node pNode)}}
> Here the text is deleted from the paragraph but the line-breaks will remain. After the call of delete() the text is reentered into the new span. In this way the line-break exits twice: Once inside the span once after the span.
> I attach a path-file including a JUnit test (SpanTest.testCreateSpanElement) that demonstrates this behavior.
> The path also includes a manipulated function
> {{TextSelection.createSpanElementInclLineBreak()}}
> that itself calls again a manipulated function
> {{TextSelection.deleteInclLineBreak(int fromIndex, int leftLength, Node pNode)}}
> instead of TextSelection.delete (...). With this function the test will succeed.
> What I do not have in track:
> 1. May the function delete(...) be replaced in everey circumstances?
> 2. Should also other tags than 'line-break' be considered as well? (for example 'tab') ?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)