mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 21:06:57 +00:00
Fixes #46942: Cover case when the mouse target is the view line and the line is empty and has an inline decoration
This commit is contained in:
parent
150b85b2cd
commit
936d5d8a06
1 changed files with 17 additions and 0 deletions
|
@ -174,6 +174,14 @@ class ElementPath {
|
|||
);
|
||||
}
|
||||
|
||||
public static isStrictChildOfViewLines(path: Uint8Array): boolean {
|
||||
return (
|
||||
path.length > 4
|
||||
&& path[0] === PartFingerprint.OverflowGuard
|
||||
&& path[3] === PartFingerprint.ViewLines
|
||||
);
|
||||
}
|
||||
|
||||
public static isChildOfScrollableElement(path: Uint8Array): boolean {
|
||||
return (
|
||||
path.length >= 2
|
||||
|
@ -621,6 +629,15 @@ export class MouseTargetFactory {
|
|||
}
|
||||
|
||||
if (domHitTestExecuted) {
|
||||
// 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)) {
|
||||
const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
|
||||
if (ctx.model.getLineLength(lineNumber) === 0) {
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineNumber, 1), void 0, EMPTY_CONTENT_IN_LINES);
|
||||
}
|
||||
}
|
||||
|
||||
// We have already executed hit test...
|
||||
return request.fulfill(MouseTargetType.UNKNOWN);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue