-
-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure TextInfo.getTextInChunks does not freeze, and provide new frie…
…ndly compareable TextInfo endpoint properties (#12253) TextInfo.getTextInChunks could sometimes end up in an infinit loop when dealing with particular TextInfo implementations such as ITextDocument where setting start to the end of the document results in the start never quite getting there. To work around this specific freeze, getTextInChunks now double checks that the start has really moved to the end of the last chunk. If not, we break out of the loop. However, for a long time now we have wanted to make these TextInfo comparisons much more readable, which can aide in finding logic errors much easier. To that end, TextInfo objects now have start and end properties, which can be compared mathematically, and also set from another, removing the need to use compareEndPoints or setEndPoint. Some examples: Setting a's end to b's start Original code: a.setEndPoint(b, "endToStart") New code: a.end = b.start Is a's start at or past b's end? Original code: a.compareEndPoints(b, "startToEnd") >= 0 New code: a.start >= b.end TextInfo.getTextInChunks has been rewritten to use these new properties.
- Loading branch information
1 parent
ebe1ab5
commit 0efeee4
Showing
3 changed files
with
157 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters