Change:
Issue Type: <bBug</bOn macOS. I have the option that you can change fontsize on the fly with the command key, a nice feature of Visual Studio Code. Open a file with many lines so you can see the problem. About ~1000 lines. Use trackpad to "push" scroll to any direction (up or down). The file will start scrolling and you can feel the "inertia" effect: the scrolling will last even if your hand is not touching the trackpad. Nice effect for me. Repeat the operation, but when the file is in middle of the inertia-scrolling press the command key. The fontsize will change because it thinks you are changing it via the command key. Is somebit tedious because in macOs you must use command-tab to change between applications, and is common that you want to scroll the file, then rapid-change between applications for something. In all that moments you are "scrolling" and press the command key the fontsize will change and you must to re-adjust it. best regards VS Code version: Code 1.46.1 (, 2020-06-17T21:17:14.222Z) OS version: Darwin x64 19.5.0 <details<summarySystem Info</summary </details<!-- generated by issue reporter --
What setting are you using to change font size with scroll?
This one.
This is exactly the reason why this setting is not on by default. We basically cannot distinguish in the incoming events if the scrolling happened via a physical mouse wheel or via the touchpad. So, on laptops, people hit this accidentally super often. So that is why the setting is off by default.
I don't know the technical workings but how do other apps handle this? For example, in Chrome or FF, if I scroll and let the inertia keep scrolling, even if I press CTRL it won't zoom. Yet if I do it in VS Code then it will zoom.
I'm not sure, perhaps the OS gives more properties to the event but those properties are not present in the event that the browser creates? For example, the low level event could indicate if the scroll is part of inertia or not or that a single event is part of a larger animation. I think in this particular case, on our side we would get individual events like the following: event with : event with : event for event with : event with : I don't think there is a property on the events to let us know that the last two wheel events need to be ignored because they are part of inertia. We could add something like if you press , then ignore the next wheel events for 50ms, but what if the next event is a legitimate one where you first start with and then do the . Also, what would be a good time? Maybe different OSes have different animation times. Also maybe this time can be user-configurable. I am open to ideas / PRs to improve this.
It must be present since Chrome/Firefox handle it fine. I will see if I can research this more. Thanks!

Discussion:
return (score <= 0.5); } <ins> public acceptStandardWheelEvent(e: StandardWheelEvent): void { const osZoomFactor = window.devicePixelRatio / getZoomFactor(); if (platform.isWindows || platform.isLinux) { // On Windows and Linux, the incoming delta events are multiplied with the OS zoom factor. // The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account. this.accept(Date.now(), e.deltaX / osZoomFactor, e.deltaY / osZoomFactor); } else { this.accept(Date.now(), e.deltaX, e.deltaY); } } </ins> public accept(timestamp: number, deltaX: number, deltaY: number): void { const item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY); item.score = this._computeScore(item);

const classifier = MouseWheelClassifier.INSTANCE; if (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) { <del> const osZoomFactor = window.devicePixelRatio / getZoomFactor(); if (platform.isWindows || platform.isLinux) { // On Windows and Linux, the incoming delta events are multiplied with the OS zoom factor. // The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account. classifier.accept(Date.now(), e.deltaX / osZoomFactor, e.deltaY / osZoomFactor); } else { classifier.accept(Date.now(), e.deltaX, e.deltaY); } </del> <ins> classifier.acceptStandardWheelEvent(e); </ins> } // console.log(`${Date.now()}, ${e.deltaY}, ${e.deltaX}`);

import { ViewEventHandler } from 'vs/editor/common/viewEventHandler'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; import { NavigationCommandRevealType } from 'vs/editor/browser/coreCommands'; <ins> import { MouseWheelClassifier } from 'vs/base/browser/ui/scrollbar/scrollableElement'; </ins> export interface IPointerHandlerHelper { viewDomNode: HTMLElement;

this._mouseDownOperation.onPointerUp(); })); this._register(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e, capturePointerId))); <ins> this._setupMouseWheelZoomListener(); this._context.addEventHandler(this); } private _setupMouseWheelZoomListener(): void { const classifier = MouseWheelClassifier.INSTANCE; let prevMouseWheelTime = 0; let gestureStartZoomLevel = EditorZoom.getZoomLevel(); let gestureHasZoomModifiers = false; let gestureAccumulatedDelta = 0; </ins> const onMouseWheel = (browserEvent: IMouseWheelEvent) => { this.viewController.emitMouseWheel(browserEvent);

if (!this._context.configuration.options.get(EditorOption.mouseWheelZoom)) { return; } const e = new StandardWheelEvent(browserEvent); <del> const doMouseWheelZoom = ( </del> <ins> classifier.acceptStandardWheelEvent(e); if (classifier.isPhysicalMouseWheel()) { if (hasMouseWheelZoomModifiers(browserEvent)) { const zoomLevel: number = EditorZoom.getZoomLevel(); const delta = e.deltaY > 0 ? 1 : -1; EditorZoom.setZoomLevel(zoomLevel + delta); e.preventDefault(); e.stopPropagation(); } } else { // we consider mousewheel events that occur within 50ms of each other to be part of the same gesture // we don't want to consider mouse wheel events where ctrl/cmd is pressed during the inertia phase // we also want to accumulate deltaY values from the same gesture and use that to set the zoom level if (Date.now() - prevMouseWheelTime > 50) { // reset if more than 50ms have passed gestureStartZoomLevel = EditorZoom.getZoomLevel(); gestureHasZoomModifiers = hasMouseWheelZoomModifiers(browserEvent); gestureAccumulatedDelta = 0; } prevMouseWheelTime = Date.now(); gestureAccumulatedDelta += e.deltaY; if (gestureHasZoomModifiers) { EditorZoom.setZoomLevel(gestureStartZoomLevel + gestureAccumulatedDelta / 5); e.preventDefault(); e.stopPropagation(); } } }; this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false })); function hasMouseWheelZoomModifiers(browserEvent: IMouseWheelEvent): boolean { return ( </ins> platform.isMacintosh // on macOS we support cmd + two fingers scroll (`metaKey` set) // and also the two fingers pinch gesture (`ctrKey` set) ? ((browserEvent.metaKey || browserEvent.ctrlKey) && !browserEvent.shiftKey && !browserEvent.altKey) : (browserEvent.ctrlKey && !browserEvent.metaKey && !browserEvent.shiftKey && !browserEvent.altKey) ); <del> if (doMouseWheelZoom) { const zoomLevel: number = EditorZoom.getZoomLevel(); const delta = e.deltaY > 0 ? 1 : -1; EditorZoom.setZoomLevel(zoomLevel + delta); e.preventDefault(); e.stopPropagation(); } }; this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false })); this._context.addEventHandler(this); </del> <ins> } </ins> } public override dispose(): void {