Commit 08060b17 authored by donnd's avatar donnd Committed by Commit Bot

[TTS] Fix expanding selection at end of some lines

Fixes a bug where the resolved term isn't always selected in the text.
The case fixed is due to the selection including a trailing space
when at the end of a line.  It's unclear why the trailing space is
included in the selection.  We simply trim the trailing space.

BUG=726767

Review-Url: https://codereview.chromium.org/2910713002
Cr-Commit-Position: refs/heads/master@{#476506}
parent 49c3b865
......@@ -727,8 +727,9 @@ public class ContextualSearchManager implements ContextualSearchManagementDelega
if ((selectionStartAdjust != 0 || selectionEndAdjust != 0)
&& mSelectionController.getSelectionType() == SelectionType.TAP) {
String originalSelection = mContext == null ? null : mContext.getInitialSelectedWord();
if (originalSelection != null
&& originalSelection.equals(mSelectionController.getSelectedText())) {
String currentSelection = mSelectionController.getSelectedText();
if (currentSelection != null) currentSelection = currentSelection.trim();
if (originalSelection != null && originalSelection.trim().equals(currentSelection)) {
mSelectionController.adjustSelection(selectionStartAdjust, selectionEndAdjust);
mContext.onSelectionAdjusted(selectionStartAdjust, selectionEndAdjust);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment