Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back ballistic scroll for mouse events #5123

Open
Tyriar opened this issue Aug 8, 2024 · 1 comment
Open

Bring back ballistic scroll for mouse events #5123

Tyriar opened this issue Aug 8, 2024 · 1 comment
Labels

Comments

@Tyriar
Copy link
Member

Tyriar commented Aug 8, 2024

In 721d483 after the new viewport was added I made mouse wheel events a single up or down sequence as the lines scroll logic was no longer in the codebase. We should bring it back such that ballistic scroll works in the alt buffer.

Old lines scrolled code:

public getLinesScrolled(ev: WheelEvent): number {
// Do nothing if it's not a vertical scroll event
if (ev.deltaY === 0 || ev.shiftKey) {
return 0;
}
// Fallback to WheelEvent.DOM_DELTA_LINE
let amount = this._applyScrollModifier(ev.deltaY, ev);
if (ev.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
amount /= this._currentRowHeight + 0.0; // Prevent integer division
this._wheelPartialScroll += amount;
amount = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1);
this._wheelPartialScroll %= 1;
} else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {
amount *= this._bufferService.rows;
}
return amount;
}

@eddyb
Copy link

eddyb commented Aug 8, 2024

Thanks! If this does get resolved, care should be taken to re-open (or at least check if the problem comes back):

(My best understanding of what happened in 1.92.0 is that on certain setups this change can be e.g. 7x slower to scroll, which accidentally hides other potential effects of real-time scrolling)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants