[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32002: 24.4; Scroll bar start, end not correct

From: martin rudalics
Subject: bug#32002: 24.4; Scroll bar start, end not correct
Date: Sat, 14 Jul 2018 10:01:09 +0200

>     ((eq part 'handle)
>      (scroll-bar-drag-1 event))))
> My guess is the latter, in which case I think the problem is in
> scroll-bar-drag-1.  Can you spot it?  I think it calculates the new
> starting point of the window incorrectly, because it doesn't take into
> account the special situation with scroll-bar-adjust-thumb-portion in
> this particular case.

Right, presumably.  What happens here is that in 'scroll-bar-drag-1'
we go to 'point-max' since 'portion-whole' is (1 . 1) and
'scroll-bar-scale' returns WHOLE in that case and set the start
position of that window to 'point-max'.  If, in that case, we do
nothing as in

(defun scroll-bar-drag-1 (event)
  (let* ((start-position (event-start event))
         (window (nth 0 start-position))
         (portion-whole (nth 2 start-position)))
    (unless (= (car portion-whole) (cdr portion-whole))
        (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)))))))

the problem is resolved.  But I'm afraid that I understand too little
about overscrolling and the portion/whole stuff to confidently
recommend such a solution.  Hopefully, you will come up with a better


reply via email to

[Prev in Thread] Current Thread [Next in Thread]