aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-01-26 07:17:31 +0000
committerRichard M. Stallman1995-01-26 07:17:31 +0000
commit8f37c4f3dfb99fe1d534eeb93d08979345ea8957 (patch)
treecda8479073088c5a3415aab654637d387a5a3798
parentbfbcf12e477d634d42a8d739b403ebfd536ddfb8 (diff)
downloademacs-8f37c4f3dfb99fe1d534eeb93d08979345ea8957.tar.gz
emacs-8f37c4f3dfb99fe1d534eeb93d08979345ea8957.zip
(scroll-bar-drag-1): Set point-before-scroll properly.
(scroll-bar-scroll-down, scroll-bar-scroll-up): Likewise.
-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."
133If you click outside the slider, the window scrolls to bring the slider there." 133If you click outside the slider, the window scrolls to bring the slider there."
134 (interactive "e") 134 (interactive "e")
135 (let* (done) 135 (let* (done)
136 (or point-before-scroll
137 (setq point-before-scroll (point)))
136 (scroll-bar-drag-1 event) 138 (scroll-bar-drag-1 event)
137 (track-mouse 139 (let (point-before-scroll)
138 (while (not done) 140 (track-mouse
139 (setq event (read-event)) 141 (while (not done)
140 (if (eq (car-safe event) 'mouse-movement) 142 (setq event (read-event))
141 (setq event (read-event))) 143 (if (eq (car-safe event) 'mouse-movement)
142 (cond ((eq (car-safe event) 'scroll-bar-movement) 144 (setq event (read-event)))
143 (scroll-bar-drag-1 event)) 145 (cond ((eq (car-safe event) 'scroll-bar-movement)
144 (t 146 (scroll-bar-drag-1 event))
145 ;; Exit when we get the drag event; ignore that event. 147 (t
146 (setq done t))))))) 148 ;; Exit when we get the drag event; ignore that event.
149 (setq done t))))))))
147 150
148(defun scroll-bar-scroll-down (event) 151(defun scroll-bar-scroll-down (event)
149 "Scroll the window's top line down to the location of the scroll bar click. 152 "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."
155 (let* ((end-position (event-end event)) 158 (let* ((end-position (event-end event))
156 (window (nth 0 end-position)) 159 (window (nth 0 end-position))
157 (portion-whole (nth 2 end-position))) 160 (portion-whole (nth 2 end-position)))
158 (select-window window) 161 (let (point-before-scroll)
159 (scroll-down 162 (select-window window))
160 (scroll-bar-scale portion-whole (1- (window-height)))))) 163 (or point-before-scroll
164 (setq point-before-scroll (point)))
165 (let (point-before-scroll)
166 (scroll-down
167 (scroll-bar-scale portion-whole (1- (window-height)))))))
161 (select-window old-selected-window)))) 168 (select-window old-selected-window))))
162 169
163(defun scroll-bar-scroll-up (event) 170(defun scroll-bar-scroll-up (event)
@@ -170,9 +177,13 @@ EVENT should be a scroll bar click."
170 (let* ((end-position (event-end event)) 177 (let* ((end-position (event-end event))
171 (window (nth 0 end-position)) 178 (window (nth 0 end-position))
172 (portion-whole (nth 2 end-position))) 179 (portion-whole (nth 2 end-position)))
173 (select-window window) 180 (let (point-before-scroll)
174 (scroll-up 181 (select-window window))
175 (scroll-bar-scale portion-whole (1- (window-height)))))) 182 (or point-before-scroll
183 (setq point-before-scroll (point)))
184 (let (point-before-scroll)
185 (scroll-up
186 (scroll-bar-scale portion-whole (1- (window-height)))))))
176 (select-window old-selected-window)))) 187 (select-window old-selected-window))))
177 188
178 189