You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Roger Whitcomb (JIRA)" <ji...@apache.org> on 2017/02/17 18:35:41 UTC

[jira] [Commented] (PIVOT-992) "getSelectedText" in TextPane always gets a trailing newline regardless of whether the end of line is selected or not

    [ https://issues.apache.org/jira/browse/PIVOT-992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15872269#comment-15872269 ] 

Roger Whitcomb commented on PIVOT-992:
--------------------------------------

Committed a fix to "trunk":
Sending        wtk\src\org\apache\pivot\wtk\TextPane.java
Transmitting file data .done
Committing transaction...
Committed revision 1783447.

Tested in our application where the Find/Replace operations weren't working because the selection included an extra newline that made the search text actually not found in the complete document text.


> "getSelectedText" in TextPane always gets a trailing newline regardless of whether the end of line is selected or not
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-992
>                 URL: https://issues.apache.org/jira/browse/PIVOT-992
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0.4, 2.1
>            Reporter: Roger Whitcomb
>            Assignee: Roger Whitcomb
>            Priority: Minor
>             Fix For: 2.1, 2.0.5
>
>
> Because of the way the "getSelectedText()" method is implemented it will construct a separate document containing an enclosing paragraph and then put the selected range of stuff into that document.  But for simple text, that enclosing paragraph causes the PlainTextSerializer to output a line break.  Thus the selected text result will always end in a newline even if the selection does not encompass the end of the line.  This differs from the result of "getText(...)" using the selection bounds.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)