[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master c0809ff: Fix problem with 'scroll-bar-adjust-thumb-
From: |
Martin Rudalics |
Subject: |
[Emacs-diffs] master c0809ff: Fix problem with 'scroll-bar-adjust-thumb-portion' nil (Bug#32002) |
Date: |
Sat, 28 Jul 2018 03:09:23 -0400 (EDT) |
branch: master
commit c0809ff23d1c7080e00726bd55d1b5322391d63f
Author: Martin Rudalics <address@hidden>
Commit: Martin Rudalics <address@hidden>
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).
---
lisp/scroll-bar.el | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index 4d1ad03..7efbfc7 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."
(let* ((start-position (event-start event))
(window (nth 0 start-position))
(portion-whole (nth 2 start-position)))
- (save-excursion
- (with-current-buffer (window-buffer window)
- ;; Calculate position relative to the accessible part of the buffer.
- (goto-char (+ (point-min)
- (scroll-bar-scale portion-whole
- (- (point-max) (point-min)))))
- (vertical-motion 0 window)
- (set-window-start window (point))))))
+ ;; With 'scroll-bar-adjust-thumb-portion' nil and 'portion-whole'
+ ;; indicating that the buffer is fully visible, do not scroll the
+ ;; window since that might make it impossible to scroll it back
+ ;; with GTK's thumb (Bug#32002).
+ (when (or scroll-bar-adjust-thumb-portion
+ (not (numberp (car portion-whole)))
+ (not (numberp (cdr portion-whole)))
+ (/= (car portion-whole) (cdr portion-whole)))
+ (save-excursion
+ (with-current-buffer (window-buffer window)
+ ;; Calculate position relative to the accessible part of the buffer.
+ (goto-char (+ (point-min)
+ (scroll-bar-scale portion-whole
+ (- (point-max) (point-min)))))
+ (vertical-motion 0 window)
+ (set-window-start window (point)))))))
(defun scroll-bar-drag (event)
"Scroll the window by dragging the scroll bar slider.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master c0809ff: Fix problem with 'scroll-bar-adjust-thumb-portion' nil (Bug#32002),
Martin Rudalics <=