Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.17k stars 416 forks source link

Mouse-based scrolling in the editor does not work as expected (CodeMirror) #2036

Open 2Abendsegler opened 4 months ago

2Abendsegler commented 4 months ago

The mouse-based scrolling of the code up or down in the editor does not start in the top or bottom line, but a few lines before. For example, if you want to select code with the mouse in the area from the third or fourth line from the top, it will scroll up. And if you click in this area, it scrolls up in a short jerk. The same applies to the lower area.

The implications are quite significant. I do a lot of work on a small laptop that displays 22 lines of code. If I can't use three to four of them at the top and bottom, then there are only 14 to 16 lines of code left to work on.

Probably has something to do with "CodeMirror" with "Enable enhanced editor" activated.

The problem occurs with latest Tampermonkey 5.1.0 in Windows 10 with the latest Firefox and with the latest Chrome. In the older Tampermonkey 4.18, the problem didn't exist.

It would be very nice, if you could fix this.

Here an example: First, select code with the mouse. Second, click on the code. TampenMonkey Scrolling 5 1 0

Winsane commented 1 month ago

I narrowed it down to "cursorScrollMargin: 60" in extension.js It is probably related to "Ensure editor search results are scrolled into view" in the 4.19.0 changelog.

Removing the line or setting it to 0 instead of 60 makes the editor usable again.

derjanb commented 1 month ago

Should be fixed at 5.3.6205 (crx|xpi in review)

Please download the crx file linked above and drag and drop it to the extensions page chrome://extensions (after you've enabled 'Developer Mode').

For a quick fix please export your settings and scripts as zip or (JSON) file at the "Utilities" tab and import it back at the fixed BETA version.