GNU bug report logs - #32002
24.4; Scroll bar start, end not correct

Previous Next

Package: emacs;

Reported by: Andrew Kurn <kurn <at> sfu.ca>

Date: Fri, 29 Jun 2018 07:37:02 UTC

Severity: wishlist

Tags: fixed

Fixed in version 24.4

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>, Mike Kupfer <mkupfer <at> alum.berkeley.edu>
Cc: 32002 <at> debbugs.gnu.org, kurn <at> sfu.ca
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))
      (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.

martin




This bug report was last modified 6 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.