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.3k stars 424 forks source link

[BUG] Selecting text with the mouse near the top or bottom of the editor #2129

Closed Winsane closed 4 weeks ago

Winsane commented 4 months ago

Expected Behavior

Using the mouse cursor to select text within 60 pixels of the top or bottom of the editor shouldn't make it continuously try to scroll the line cursor "into view".

Actual Behavior

Because cursorScrollMargin is set to 60, selecting text with the mouse cursor within 60 pixels of the top or bottom of the editor is essentially impossible. When you click on one of the lines near the top or bottom, the editor tries to keep the line cursor at least 60 pixels away from the margins by scrolling it into view. This moves what you're trying to select away from the mouse cursor, which makes you select what was scrolled in, which moves the line cursor, and so on.

I believe this is related to the 4.19.0 update note "Ensure editor search results are scrolled into view"

It can be fixed by removing "cursorScrollMargin: 60" from extension.js If there is enough reason to keep cursorScrollMargin set to 60, I believe a mousedown/mouseup event listener can be used to set it to 0 temporarily. Or perhaps checking if left click is held in the "scrollIntoView" function would work better.

derjanb commented 3 months 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.

Winsane commented 3 months ago

I installed the 5.3.6205 beta, and both text selection and findNext/findPrev seems to work perfectly 👍