Uploaded image for project: 'Pivot'
  1. Pivot
  2. PIVOT-992

"getSelectedText" in TextPane always gets a trailing newline regardless of whether the end of line is selected or not

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.4, 2.1
    • Fix Version/s: 2.1, 2.0.5
    • Component/s: wtk
    • Labels:
      None

      Description

      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.

      1. 992a.diffs
        12 kB
        Roger Whitcomb

        Issue Links

          Activity

          Hide
          rwhitcomb Roger Whitcomb added a comment -

          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.

          Show
          rwhitcomb Roger Whitcomb added a comment - 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.
          Hide
          rwhitcomb Roger Whitcomb added a comment -

          Final merge to "branches/2.0.x":
          Sending .
          Sending wtk\src\org\apache\pivot\wtk\TextPane.java
          Transmitting file data .done
          Committing transaction...
          Committed revision 1783448.

          Show
          rwhitcomb Roger Whitcomb added a comment - Final merge to "branches/2.0.x": Sending . Sending wtk\src\org\apache\pivot\wtk\TextPane.java Transmitting file data .done Committing transaction... Committed revision 1783448.
          Hide
          rwhitcomb Roger Whitcomb added a comment -

          Oops! There were a lot of changes to TextPane in 2.1 and just merging this one change won't work because the "getText(start, finish)" method doesn't exist in 2.0.x.

          And the changes to make that method work also depend on a lot of other changes to supporting methods....

          Working on trying to reconcile things.

          Show
          rwhitcomb Roger Whitcomb added a comment - Oops! There were a lot of changes to TextPane in 2.1 and just merging this one change won't work because the "getText(start, finish)" method doesn't exist in 2.0.x. And the changes to make that method work also depend on a lot of other changes to supporting methods.... Working on trying to reconcile things.
          Hide
          rwhitcomb Roger Whitcomb added a comment -

          File 992a.diffs shows the ancillary changes that needed to be merged (somewhat piecemeal) from "trunk" to "branches/2.0.x" so that these latest TextPane changes would compile.

          Show
          rwhitcomb Roger Whitcomb added a comment - File 992a.diffs shows the ancillary changes that needed to be merged (somewhat piecemeal) from "trunk" to "branches/2.0.x" so that these latest TextPane changes would compile.
          Hide
          rwhitcomb Roger Whitcomb added a comment -

          Committed the ancillary changes merged piecemeal from "trunk":
          Sending wtk\src\org\apache\pivot\wtk\Span.java
          Sending wtk\src\org\apache\pivot\wtk\TextPane.java
          Sending wtk\src\org\apache\pivot\wtk\text\ComponentNode.java
          Sending wtk\src\org\apache\pivot\wtk\text\Node.java
          Sending wtk\src\org\apache\pivot\wtk\text\TextNode.java
          Transmitting file data .....done
          Committing transaction...
          Committed revision 1783453.

          Show
          rwhitcomb Roger Whitcomb added a comment - Committed the ancillary changes merged piecemeal from "trunk": Sending wtk\src\org\apache\pivot\wtk\Span.java Sending wtk\src\org\apache\pivot\wtk\TextPane.java Sending wtk\src\org\apache\pivot\wtk\text\ComponentNode.java Sending wtk\src\org\apache\pivot\wtk\text\Node.java Sending wtk\src\org\apache\pivot\wtk\text\TextNode.java Transmitting file data .....done Committing transaction... Committed revision 1783453.

            People

            • Assignee:
              rwhitcomb Roger Whitcomb
              Reporter:
              rwhitcomb Roger Whitcomb
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development