[Mac] Text Suggestion Selection Replaces Trailing Whitespace

When the user selects a text suggestion from the
SuggestedTextTouchBar, the string returned by AppKit API has the
necessary trailing whitespace. Currently, when the current
editing word is replaced, AppKit's whitespace is added
alongside the existing trailing whitespace.

This change includes whitespace after a word or the current cursor
position into the editing word range. Then, when the editing word
is replaced, or the suggestion's text is placed at the cursor, the
existing trailing whitespace is also replaced with the suggestion's
trailing whitespace.

The EditingWordRangeTest in SuggestedTextTouchBarControllerUnitTests
was split into multiple tests. A test case was added,
WhitespaceEditingWordRangeTest, to test that
editingWordRangeFromText:cursorPosition: properly calculates the
editing word range as it moves through non-word characters. Existing
test cases were modified to reflect the new behavior with regards to
trailing whitespace characters.

Bug: 717553
Change-Id: Ie0116fc6802ede203dd2adeb691789fa1e4719f3
Reviewed-on: https://chromium-review.googlesource.com/1147335
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Sarah Chan <spqchan@chromium.org>
Commit-Queue: Tessa Nijssen <tnijssen@google.com>
Cr-Commit-Position: refs/heads/master@{#577658}
2 files changed