mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-19 06:39:55 +01:00
Fixes #20011: Explicit check if the view cursor is hit
This commit is contained in:
@@ -475,6 +475,19 @@ export class MouseTargetFactory {
|
||||
|
||||
private static _hitTestViewCursor(ctx: HitTestContext, request: HitTestRequest): MouseTarget {
|
||||
|
||||
if (request.target) {
|
||||
// Check if we've hit a painted cursor
|
||||
const lastViewCursorsRenderData = ctx.lastViewCursorsRenderData;
|
||||
|
||||
for (let i = 0, len = lastViewCursorsRenderData.length; i < len; i++) {
|
||||
const d = lastViewCursorsRenderData[i];
|
||||
|
||||
if (request.target === d.domNode) {
|
||||
return request.fulfill(MouseTargetType.CONTENT_TEXT, d.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (request.isInContentArea) {
|
||||
// Edge has a bug when hit-testing the exact position of a cursor,
|
||||
// instead of returning the correct dom node, it returns the
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import { IRenderingContext, IRestrictedRenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
|
||||
export interface IViewCursorRenderData {
|
||||
domNode: HTMLElement;
|
||||
position: Position;
|
||||
contentTop: number;
|
||||
contentLeft: number;
|
||||
@@ -190,6 +191,7 @@ export class ViewCursor {
|
||||
this._domNode.setHeight(this._lineHeight);
|
||||
|
||||
return {
|
||||
domNode: this._domNode.domNode,
|
||||
position: this._position,
|
||||
contentTop: top,
|
||||
contentLeft: this._renderData.left,
|
||||
|
||||
Reference in New Issue
Block a user