mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 08:45:56 +01:00
Fixes #137225. The range of the active bracket pair must now strictly contain the cursor position.
This commit is contained in:
@@ -100,6 +100,23 @@ export class Range {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if `position` is in `range`. If the position is at the edges, will return false.
|
||||
* @internal
|
||||
*/
|
||||
public static strictContainsPosition(range: IRange, position: IPosition): boolean {
|
||||
if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {
|
||||
return false;
|
||||
}
|
||||
if (position.lineNumber === range.startLineNumber && position.column <= range.startColumn) {
|
||||
return false;
|
||||
}
|
||||
if (position.lineNumber === range.endLineNumber && position.column >= range.endColumn) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if range is in this range. If the range is equal to this range, will return true.
|
||||
*/
|
||||
|
||||
@@ -2457,7 +2457,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
|
||||
const bracketsContainingActivePosition =
|
||||
(startLineNumber <= activePosition.lineNumber && activePosition.lineNumber <= endLineNumber)
|
||||
// Does active position intersect with the view port? -> Intersect bracket pairs with activePosition
|
||||
? bracketPairs.filter(bp => bp.range.containsPosition(activePosition))
|
||||
? bracketPairs.filter(bp => Range.strictContainsPosition(bp.range, activePosition))
|
||||
: this._bracketPairColorizer.getBracketPairsInRange(
|
||||
Range.fromPositions(activePosition)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user