(scroll-bar-drag-1):
authorRichard M. Stallman <rms@gnu.org>
Sat, 5 Jun 1993 20:58:47 +0000 (20:58 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 5 Jun 1993 20:58:47 +0000 (20:58 +0000)
Calculate position relative to the accessible part of the buffer.

lisp/scroll-bar.el

index cddce3e..fa7e4a6 100644 (file)
@@ -103,7 +103,10 @@ EVENT should be a scroll bar click or drag event."
         (portion-whole (nth 2 start-position)))
     (save-excursion
       (set-buffer (window-buffer window))
-      (goto-char (scroll-bar-scale portion-whole (buffer-size)))
+      ;; Calculate position relative to the accessible part of the buffer.
+      (goto-char (+ (point-min)
+                   (scroll-bar-scale portion-whole
+                                     (- (point-max) (point-min)))))
       (beginning-of-line)
       (set-window-start window (point)))))