From 44e4b56ced64265452737f101f4ef253ff03570b Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Wed, 22 Jun 2022 11:52:00 +0200 Subject: [PATCH 1/2] Only send wheel mouse event when scrolling a line or more --- src/browser/Terminal.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/browser/Terminal.ts b/src/browser/Terminal.ts index 1f436c8c10..ebda38338d 100644 --- a/src/browser/Terminal.ts +++ b/src/browser/Terminal.ts @@ -703,10 +703,13 @@ export class Terminal extends CoreTerminal implements ITerminal { but = ev.button < 3 ? ev.button : CoreMouseButton.NONE; break; case 'wheel': - // only UP/DOWN wheel events are respected - if ((ev as WheelEvent).deltaY !== 0) { - action = (ev as WheelEvent).deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN; + const amount = self.viewport!.getLinesScrolled(ev as WheelEvent) + + if (amount === 0) { + return false } + + action = (ev as WheelEvent).deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN; but = CoreMouseButton.WHEEL; break; default: From 783722c2f37212f9472452c5947f79d19014ca40 Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Wed, 22 Jun 2022 11:58:32 +0200 Subject: [PATCH 2/2] Add missing semicolons --- src/browser/Terminal.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/browser/Terminal.ts b/src/browser/Terminal.ts index ebda38338d..017633b4f6 100644 --- a/src/browser/Terminal.ts +++ b/src/browser/Terminal.ts @@ -703,10 +703,10 @@ export class Terminal extends CoreTerminal implements ITerminal { but = ev.button < 3 ? ev.button : CoreMouseButton.NONE; break; case 'wheel': - const amount = self.viewport!.getLinesScrolled(ev as WheelEvent) + const amount = self.viewport!.getLinesScrolled(ev as WheelEvent); if (amount === 0) { - return false + return false; } action = (ev as WheelEvent).deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN;