[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/topspace 8fcd11d4a5 113/181: Fix mwheel mouse scrolling
From: |
ELPA Syncer |
Subject: |
[elpa] externals/topspace 8fcd11d4a5 113/181: Fix mwheel mouse scrolling down bug causes by #11 |
Date: |
Tue, 23 Aug 2022 12:58:39 -0400 (EDT) |
branch: externals/topspace
commit 8fcd11d4a5adddf4b0b60658bfe9b04106bf155b
Author: Trevor Pogue <poguete@mcmaster.ca>
Commit: Trevor Pogue <poguete@mcmaster.ca>
Fix mwheel mouse scrolling down bug causes by #11
- #11 caused a bug with mouse scrolling - when scrolling down
it would move buffer suddenly all the way to the bottom
in some cases. This resolves that issue.
---
topspace.el | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/topspace.el b/topspace.el
index f41b0867ae..343370af62 100644
--- a/topspace.el
+++ b/topspace.el
@@ -96,6 +96,9 @@ This flag signals to wait until then to display top space.")
(defvar topspace--advice-added nil "Keep track if `advice-add` done already.")
+(defvar-local topspace--previous-mwheel-scroll-down-function nil
+ "Previous mwheel function that does the job of scrolling downward.")
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Customization
@@ -213,6 +216,18 @@ TOTAL-LINES is used in the same way as in `scroll-down'."
(- total-lines (- new-topspace-height old-topspace-height)))
(if (display-graphic-p) total-lines (round total-lines))))
+(defun topspace--mwheel-scroll-down-function (&optional total-lines)
+ "Run instead of `mwheel-scroll-down-function' for scrolling down.
+For some reason this function only works if it is different from
+`scroll-down' in the sense that
+it does nothing in the case that TOTAL-LINES is nil.
+TODO: figure out exactly why this is the case."
+ (cond
+ ((not (topspace--enabled))
+ (scroll-down total-lines))
+ (total-lines
+ (scroll-down total-lines))))
+
(defun topspace--filter-args-scroll-down (&optional total-lines)
"Run before `scroll-down' for scrolling above the top line.
TOTAL-LINES is used in the same way as in `scroll-down'."
@@ -580,11 +595,17 @@ Topspace will not be enabled for:
(advice-add #'scroll-up :after #'topspace--after-scroll)
(advice-add #'scroll-down :after #'topspace--after-scroll)
(advice-add #'recenter :after #'topspace--after-recenter))
+ (setq topspace--previous-mwheel-scroll-down-function
+ mwheel-scroll-down-function)
+ (setq mwheel-scroll-down-function
+ #'topspace--mwheel-scroll-down-function)
(dolist (window (get-buffer-window-list))
(with-selected-window window (topspace--draw)))))
(defun topspace--disable ()
"Disable `topspace-mode' and do mode cleanup."
+ (setq mwheel-scroll-down-function
+ topspace--previous-mwheel-scroll-down-function)
(remove-overlays 1 1 'topspace--remove-from-buffer-tag t)
(topspace--remove-hooks))
- [elpa] externals/topspace c1e4621a11 067/181: Update description in topspace.el and readme.md, (continued)
- [elpa] externals/topspace c1e4621a11 067/181: Update description in topspace.el and readme.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace ac2e2c2cdb 072/181: Mention to follow Elisp style guides, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace a0aa7b9b07 066/181: Remove checkdoc warnings, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace b305bb56be 078/181: Add HISTORY.md containing legacy changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 270b4ace51 069/181: Update changelog for v0.1.2, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 9d3125c0ec 081/181: Test automatic changelog generation action, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 45b44cf17c 084/181: Add automatic changelog generation action, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 8309cd98ab 096/181: Private refactoring & minor improvements, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace d4615f82f8 098/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 3fa532a343 100/181: Fix terminal bug from PR #10, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 8fcd11d4a5 113/181: Fix mwheel mouse scrolling down bug causes by #11,
ELPA Syncer <=
- [elpa] externals/topspace c5b424788f 116/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 9760a3ab5e 123/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 2c8440f5de 124/181: Add support for `smooth-scrolling` package (#14), ELPA Syncer, 2022/08/23
- [elpa] externals/topspace d346f7b5e0 131/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 2f35223b78 132/181: Fix unexpected top space height change when echo area height changes (#18), ELPA Syncer, 2022/08/23
- [elpa] externals/topspace ca7eb6b94a 133/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 1bfa4d1b28 135/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace e7df37fd99 139/181: Add section links to readme, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 15ac6c969a 141/181: Internal optimizations and refactoring, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 7741d88dca 140/181: Increase test coverage, ELPA Syncer, 2022/08/23