andre-r / centered-cursor-mode.el

An emacs minor mode for smooth scrolling
GNU General Public License v2.0
60 stars 12 forks source link

Inhibit recentering when selecting text with the mouse on OS X #5

Closed kqr closed 5 years ago

kqr commented 5 years ago

I am not sure whether this is an issue on other platforms already, but it appears as though ignored commands are not sufficient.

andre-r commented 5 years ago

Sorry for taking so long. I tested your commit and I don't think it behaves like it should. When I click the mouse on another line, it recenters immediately. When selecting text per dragging, too. I tested with GNU Emacs 27.0.50.

kqr commented 5 years ago

Huh, interesting. I definitely think it should recenter when clicking a line. I also think it makes sense if it recenters on the initial click when dragging to select, but does it still keep recentering when you drag-to-select after the initial click? (I.e. when you hold the button down?)

kqr commented 5 years ago

I can imagine preference being different on the "recenter on first click" issue – I could add a setting for that.

But the reason I prefer it not to recenter while having the mouse held down is because it becomes nearly impossible to properly drag-select when what's under the mouse continuously varies. Is this not an issue for you? I could make that a setting as well – but I have trouble imagining anyone preferring the other thing, in this case.

andre-r commented 5 years ago

Hi, well the point of ccm-ignored-commands was so it doesn't recenters after a click. But I think I see now what your intend was. I tried again and it does not recenter when dragging the mouse. (And of course it should not recenter when dragging the mouse, there is an item in the todo list.)

From your code I initially thought that also a mouse click inhibits recentering. Doesn't the line below mean don't recenter when either a mouse-movement happend or this-command is one of ccm-ignored-commands?

(unless (memq t (mapcar #'funcall ccm-inhibit-centering-when)) ...

Recentering on the first click should definitely customizable as it has a few drawbacks like these:

Maybe a workaround is conceivable in some of theses cases with a delay, where recentering starts after double-click-time after the last click.

andre-r commented 5 years ago

Please test the latest commit to your pull request on OS X.

kqr commented 5 years ago

I tested and it seems to work well.

kqr commented 5 years ago

I rebased onto the latest master for a cleaner merge. Hope that was okay. The old commit was a361ba4c8e966a1d71c261183b312c5b1c1bf3e3 if you want to revert to it, or diff with it, or whatever. :)