diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/scroll-bar.el | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el index 4d1ad03fa5f..7efbfc77742 100644 --- a/lisp/scroll-bar.el +++ b/lisp/scroll-bar.el | |||
| @@ -254,14 +254,22 @@ EVENT should be a scroll bar click or drag event." | |||
| 254 | (let* ((start-position (event-start event)) | 254 | (let* ((start-position (event-start event)) |
| 255 | (window (nth 0 start-position)) | 255 | (window (nth 0 start-position)) |
| 256 | (portion-whole (nth 2 start-position))) | 256 | (portion-whole (nth 2 start-position))) |
| 257 | (save-excursion | 257 | ;; With 'scroll-bar-adjust-thumb-portion' nil and 'portion-whole' |
| 258 | (with-current-buffer (window-buffer window) | 258 | ;; indicating that the buffer is fully visible, do not scroll the |
| 259 | ;; Calculate position relative to the accessible part of the buffer. | 259 | ;; window since that might make it impossible to scroll it back |
| 260 | (goto-char (+ (point-min) | 260 | ;; with GTK's thumb (Bug#32002). |
| 261 | (scroll-bar-scale portion-whole | 261 | (when (or scroll-bar-adjust-thumb-portion |
| 262 | (- (point-max) (point-min))))) | 262 | (not (numberp (car portion-whole))) |
| 263 | (vertical-motion 0 window) | 263 | (not (numberp (cdr portion-whole))) |
| 264 | (set-window-start window (point)))))) | 264 | (/= (car portion-whole) (cdr portion-whole))) |
| 265 | (save-excursion | ||
| 266 | (with-current-buffer (window-buffer window) | ||
| 267 | ;; Calculate position relative to the accessible part of the buffer. | ||
| 268 | (goto-char (+ (point-min) | ||
| 269 | (scroll-bar-scale portion-whole | ||
| 270 | (- (point-max) (point-min))))) | ||
| 271 | (vertical-motion 0 window) | ||
| 272 | (set-window-start window (point))))))) | ||
| 265 | 273 | ||
| 266 | (defun scroll-bar-drag (event) | 274 | (defun scroll-bar-drag (event) |
| 267 | "Scroll the window by dragging the scroll bar slider. | 275 | "Scroll the window by dragging the scroll bar slider. |