Merge pull request #230004 from microsoft/tyriar/229965

Get correct mouse cursor y regardless of MouseEvent.target
This commit is contained in:
Daniel Imms 2024-09-28 06:48:25 -07:00 committed by GitHub
commit 7308a15d5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,7 +80,7 @@ class TerminalCommandGuideContribution extends Disposable implements ITerminalCo
if (!rect) {
return;
}
const mouseCursorY = Math.floor(e.offsetY / (rect.height / xterm.raw.rows));
const mouseCursorY = Math.floor((e.clientY - rect.top) / (rect.height / xterm.raw.rows));
const command = this._instance.capabilities.get(TerminalCapability.CommandDetection)?.getCommandForLine(xterm.raw.buffer.active.viewportY + mouseCursorY);
if (command && 'getOutput' in command) {
xterm.markTracker.showCommandGuide(command);