summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-01-26 07:17:31 +0000
committerRichard M. Stallman <rms@gnu.org>1995-01-26 07:17:31 +0000
commit7f8d50abc627f09186d6a61f59a71873aeda8545 (patch)
tree0ac21b611f0b0a1fa9e37aee556d1c0ec171a614 /lisp
parent1b0754210d8a0441a062bec3e6851a6d0c22ba89 (diff)
downloademacs-7f8d50abc627f09186d6a61f59a71873aeda8545.tar.gz
(scroll-bar-drag-1): Set point-before-scroll properly.
(scroll-bar-scroll-down, scroll-bar-scroll-up): Likewise.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/scroll-bar.el43
1 files changed, 27 insertions, 16 deletions
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index 25b0a80d89f..ad1e07abcdb 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -133,17 +133,20 @@ EVENT should be a scroll bar click or drag event."
If you click outside the slider, the window scrolls to bring the slider there."
(interactive "e")
(let* (done)
+ (or point-before-scroll
+ (setq point-before-scroll (point)))
(scroll-bar-drag-1 event)
- (track-mouse
- (while (not done)
- (setq event (read-event))
- (if (eq (car-safe event) 'mouse-movement)
- (setq event (read-event)))
- (cond ((eq (car-safe event) 'scroll-bar-movement)
- (scroll-bar-drag-1 event))
- (t
- ;; Exit when we get the drag event; ignore that event.
- (setq done t)))))))
+ (let (point-before-scroll)
+ (track-mouse
+ (while (not done)
+ (setq event (read-event))
+ (if (eq (car-safe event) 'mouse-movement)
+ (setq event (read-event)))
+ (cond ((eq (car-safe event) 'scroll-bar-movement)
+ (scroll-bar-drag-1 event))
+ (t
+ ;; Exit when we get the drag event; ignore that event.
+ (setq done t))))))))
(defun scroll-bar-scroll-down (event)
"Scroll the window's top line down to the location of the scroll bar click.
@@ -155,9 +158,13 @@ EVENT should be a scroll bar click."
(let* ((end-position (event-end event))
(window (nth 0 end-position))
(portion-whole (nth 2 end-position)))
- (select-window window)
- (scroll-down
- (scroll-bar-scale portion-whole (1- (window-height))))))
+ (let (point-before-scroll)
+ (select-window window))
+ (or point-before-scroll
+ (setq point-before-scroll (point)))
+ (let (point-before-scroll)
+ (scroll-down
+ (scroll-bar-scale portion-whole (1- (window-height)))))))
(select-window old-selected-window))))
(defun scroll-bar-scroll-up (event)
@@ -170,9 +177,13 @@ EVENT should be a scroll bar click."
(let* ((end-position (event-end event))
(window (nth 0 end-position))
(portion-whole (nth 2 end-position)))
- (select-window window)
- (scroll-up
- (scroll-bar-scale portion-whole (1- (window-height))))))
+ (let (point-before-scroll)
+ (select-window window))
+ (or point-before-scroll
+ (setq point-before-scroll (point)))
+ (let (point-before-scroll)
+ (scroll-up
+ (scroll-bar-scale portion-whole (1- (window-height)))))))
(select-window old-selected-window))))