bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Eli Zaretskii
Subject: bug#32002: 24.4; Scroll bar start, end not correct
Date: Sat, 21 Jul 2018 16:50:39 +0300

> Date: Sat, 14 Jul 2018 10:01:09 +0200
> From: martin rudalics <address@hidden>
> CC: address@hidden, address@hidden
> 
> 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))
>        (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)))))))
> 
> 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
> one.

Not sure I follow: for the problem to be resolved, we need to set
window-start to some position that is not point-max.  So who does that
setting in the case in point, with your change in effect?

Or did you mean to disable scrolling-up in this case, and thus remove
the need for scrolling down?  Hmm... maybe that's the only solution to
this conundrum, but in that case I think it would be safer to add
scroll-bar-adjust-thumb-portion to your condition about portion-whole.





reply via email to

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