Skip to content

Commit 7f97dfd

Browse files
ignore clicks outside active region
1 parent ecacf2b commit 7f97dfd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cascadia/TerminalControl/ControlInteractivity.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
182182
}
183183
else if (_canSendVTMouseInput(modifiers))
184184
{
185-
auto adjustment = 0;
186-
if (_core->ScrollOffset() > 0)
185+
const auto adjustment = _core->ScrollOffset() > 0 ? _core->BufferHeight() - _core->ScrollOffset() - _core->ViewHeight() : 0;
186+
// If the click happened outside the active region, just don't send any mouse event
187+
if (const auto adjustedY = terminalPosition.y() - adjustment >= 0)
187188
{
188-
adjustment = _core->BufferHeight() - _core->ScrollOffset() - _core->ViewHeight();
189+
_core->SendMouseEvent({ terminalPosition.x(), adjustedY }, pointerUpdateKind, modifiers, 0, buttonState);
189190
}
190-
_core->SendMouseEvent({ terminalPosition.x(), terminalPosition.y() - adjustment }, pointerUpdateKind, modifiers, 0, buttonState);
191191
}
192192
else if (buttonState.isLeftButtonDown)
193193
{

0 commit comments

Comments
 (0)