zk-phi / sublimity

Smooth-scrolling and minimap like sublime editor
492 stars 27 forks source link

Code to disable trackpad scroll? #42

Closed henrymazza closed 7 years ago

henrymazza commented 7 years ago

Please, how do I disable sublimity smooth scroll when there’s a trackpad scroll? It’s really great when paging up/down, but it’s blocking scroll altogether when it happens with siblimity-mode one.

zk-phi commented 7 years ago

Which commands are invoked when scrolling with trackpads (to find out, <f1> k then scroll with trackpads) ? sublimity has option sublimity-handle-scroll-criteria, which defines when to handle scroll within sublimity and when not to. If you want to disable sublimity when scrolling with foo command, for example, set sublimity-handle-scroll-criteria as follows:

(setq sublimity-handle-scroll-criteria
      '((eq sublimity--prev-buf (current-buffer))
        (eq sublimity--prev-wnd (selected-window))
        (or (not (boundp 'cua--rectangle)) (not cua--rectangle))
        (or (not (boundp 'multiple-cursors-mode)) (not multiple-cursors-mode))
        (not (eq major-mode 'shell-mode))
        (not (memq this-command '(scroll-bar-drag
                                  scroll-bar-toolkit-scroll
                                  scroll-bar-scroll-up
                                  scroll-bar-scroll-down
                                  foo   ; !! ADDED !!
                                  )))))
henrymazza commented 7 years ago

mac-mwheel-scroll where you indicated did the trick. Thank you!

zk-phi commented 7 years ago

https://github.com/zk-phi/sublimity/commit/444ab282cbff75058fce8208a46883c5d7885e8f

I've just made a commit which implements much more intuitive interface to ignore some commands :)