diff options
| author | Martin Rudalics | 2018-07-28 09:08:30 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2018-07-28 09:08:30 +0200 |
| commit | c0809ff23d1c7080e00726bd55d1b5322391d63f (patch) | |
| tree | eaf08c798eb959abba5b97a556d7071b824087c3 | |
| parent | 506ed5fd5e0daf0d60be789606021f3361794322 (diff) | |
| download | emacs-c0809ff23d1c7080e00726bd55d1b5322391d63f.tar.gz emacs-c0809ff23d1c7080e00726bd55d1b5322391d63f.zip | |
Fix problem with 'scroll-bar-adjust-thumb-portion' nil (Bug#32002)
* lisp/scroll-bar.el (scroll-bar-drag-1): Do not scroll window
when its buffer is fully visible and
'scroll-bar-adjust-thumb-portion' is nil (Bug#32002).
| -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. |