Normalize start position at the beginning of ExpandToEnclosingUnit
ExpandToEnclosingUnit for format units will call CreatePreviousFormatStartPosition on the starting position. That method will begin its search from the start of the node to which the position is currently anchored. But if that position happens to be at MaxTextOffset for its anchor, that should be treated as equivalent to offset 0 for the next text anchor. The result is that we would incorrectly expand the range backward if the node happened to be at a format boundary. The fix is to normalize the start position before doing any expansion. I also ensured that the unit test for ExpandToEnclosingUnit covers each of the cases enumerated in MSDN. Bug: 928948 Change-Id: I0eda71990b69800d5464560e1a08b8f5c387b907 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1970587 Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com> Reviewed-by:Kurt Catti-Schmidt <kschmi@microsoft.com> Cr-Commit-Position: refs/heads/master@{#728741}
Showing
This diff is collapsed.
Please register or sign in to comment