
When the text selection exists within one line in diff-view, the derivation of the selected text from the diff object using substring() mutated the text and caused some selections to be artificially long. Swapping the calls so that the end of the string is trimmed off first fixes this. This change also includes a regression test for this issue. Bug: Issue 4794 Change-Id: I19dbab1cddd2e522cc6495011e8ef49f8ffe55b2