Reputation: 809
It intermittently happens than when I move back to the text editor window, either from another editor tab or from an external program, that when I just roll the mouse scroll wheel by one click, the window jumps to the bottom of the file, no matter where in the file the cursor is at that moment. It's only the window scroll that jumps, not the cursor. This happens maybe every 1/15 times when changing between tabs. Once I'm editing again after this glitch, everything behaves as normal.
It goes without saying that this is quite frustrating.
I'm hoping someone here knows how to fix this, or at least debug it. Is there a log recorded by VS Code so that I can look at the log when I notice the glitch happening again, or can I enable such a log?
System info: Version: 1.58.0, Commit: 2d23c42a936db1c7b3b06f918cde29561cc47cd6, Date: 2021-07-08T06:53:55.113Z, Electron: 12.0.13, Chrome: 89.0.4389.128, Node.js: 14.16.0, V8: 8.9.255.25-electron.0, OS: Linux x64 4.15.0-147-generic
Upvotes: 20
Views: 3771
Reputation: 51129
I'm going to wager a guess that this is Editor: scroll jumps randomly (related to Chrome, Electron, xinput) #28795. There's some elaboration on the cause in this comment:
This is caused by a missing or broken workaround for an X11/XInput 2.1 protocol design issue https://who-t.blogspot.com/2012/06/xi-21-protocol-design-issues.html [...] 'm now seeing this with Fedora 37 (using Xorg, not Wayland) but not on Fedora 35 or Ubuntu 20.04 (also Xorg) so it is possible for this to work "correctly" under the right conditions (as of VSCodium 1.77.3).
Also apparently related is https://bugs.chromium.org/p/chromium/issues/detail?id=608246 and https://issues.chromium.org/issues/41251816#comment79.
Some workarounds are listed in the issue thread's opening comment:
- imwheel - not suitable for all users
- wayland - not suitable for all users
Some users find that imwheel works well for them, and others report that it doesn't, or that it introduces other problems. Your mileage may vary.
Since apparently this only happens when you use alt+tab, you can work around the issue by switching between applications using other means, such as the mouse pointer, or other keyboard shortcuts like win+<number>
lucasresck wrote a GNOME extension that apparently fixes the issue (the workarounds didn't work for them): https://extensions.gnome.org/extension/5282/alttab-scroll-workaround/ (I have no affiliation with this extension).
See also How to solve a scrolling misbehavior after doing Alt+Tab?
Upvotes: 3
Reputation: 320
This is a known issue (since 2017): https://github.com/microsoft/vscode/issues/28795
Upvotes: 5
Reputation: 502
There is a workaround to solve this issue: Alt+Tab Scroll Workaround GNOME extension
Upvotes: 9
Reputation: 93
imwheel solved this issue for me
imwheel
is a utility for Linux systems, including Ubuntu, designed to enhance and customize mouse wheel behavior, particularly for adjusting the scroll speed and mapping mouse wheel input to keyboard input. It's particularly useful when the default system settings do not provide the necessary options to adjust the mouse wheel's behavior to the user's preference.
To install imwheel
on Ubuntu, you can use the following command in the terminal:
sudo apt install imwheel
This command installs imwheel
from the official Ubuntu repositories.
After installing imwheel
, you need to create a configuration file named .imwheelrc
in your home directory to specify your preferences for the mouse wheel behavior. You can use a text editor to create and edit this file. Here's an example of how to set it up:
gedit ~/.imwheelrc
".*"
None, Up, Button4, 3
None, Down, Button5, 3
Control_L, Up, Control_LButton4
Control_L, Down, Control_LButton5
Shift_L, Up, Shift_LButton4
Shift_L, Down, Shift_LButton5
The numbers 3
at the end of the Button4
and Button5
lines represent the scroll speed. You can adjust these numbers to increase or decrease the scroll speed according to your preference.
imwheel
To apply the settings and start imwheel
, use the following command in the terminal:
imwheel --kill --buttons "4 5"
The --kill
option ensures that any previous instances of imwheel
are terminated before starting a new one, and --buttons "4 5"
specifies that only the scroll wheel (buttons 4 and 5) are affected, allowing other mouse buttons to function normally[9].
imwheel
Start AutomaticallyTo ensure imwheel
starts automatically with your system, you can add it to your startup applications. This process may vary depending on your desktop environment, but generally, you can find an option to add startup applications in the system settings or control center. Use the command imwheel --kill --buttons "4 5"
as the command to run at startup.
Upvotes: 5