mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Avoid doing a hit test if the line is empty or if the mouse is after the line width (also fixes #208262)
This commit is contained in:
parent
27eb6dfa41
commit
4284fcd37f
|
@ -737,20 +737,6 @@ export class MouseTargetFactory {
|
|||
return request.fulfillContentEmpty(new Position(lineCount, maxLineColumn), EMPTY_CONTENT_AFTER_LINES);
|
||||
}
|
||||
|
||||
// Do the hit test (if not already done)
|
||||
const hitTestResult = request.hitTestResult.value;
|
||||
|
||||
if (hitTestResult.type === HitTestResultType.Content) {
|
||||
return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.spanNode, hitTestResult.position, hitTestResult.injectedText);
|
||||
}
|
||||
|
||||
// We didn't hit content...
|
||||
if (request.wouldBenefitFromHitTestTargetSwitch) {
|
||||
// We actually hit something different... Give it one last change by trying again with this new target
|
||||
request.switchToHitTestTarget();
|
||||
return this._createMouseTarget(ctx, request);
|
||||
}
|
||||
|
||||
// Check if we are hitting a view-line (can happen in the case of inline decorations on empty lines)
|
||||
// See https://github.com/microsoft/vscode/issues/46942
|
||||
if (ElementPath.isStrictChildOfViewLines(request.targetPath)) {
|
||||
|
@ -770,6 +756,20 @@ export class MouseTargetFactory {
|
|||
}
|
||||
}
|
||||
|
||||
// Do the hit test (if not already done)
|
||||
const hitTestResult = request.hitTestResult.value;
|
||||
|
||||
if (hitTestResult.type === HitTestResultType.Content) {
|
||||
return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.spanNode, hitTestResult.position, hitTestResult.injectedText);
|
||||
}
|
||||
|
||||
// We didn't hit content...
|
||||
if (request.wouldBenefitFromHitTestTargetSwitch) {
|
||||
// We actually hit something different... Give it one last change by trying again with this new target
|
||||
request.switchToHitTestTarget();
|
||||
return this._createMouseTarget(ctx, request);
|
||||
}
|
||||
|
||||
// We have tried everything...
|
||||
return request.fulfillUnknown();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue