Function: ediff-get-region-size-coefficient
ediff-get-region-size-coefficient is a byte-compiled function defined
in ediff-util.el.gz.
Signature
(ediff-get-region-size-coefficient BUF-TYPE OP &optional N CTL-BUF)
Source Code
;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
;; region size coefficient is a coefficient by which to adjust scrolling
;; up/down of the window displaying buffer of type BUFTYPE.
;; The purpose of this coefficient is to make the windows scroll in sync, so
;; that it won't happen that one diff region is scrolled off while the other is
;; still seen.
;;
;; If the difference region is invalid, the coefficient is 1
(defun ediff-get-region-size-coefficient (buf-type op &optional n ctl-buf)
(ediff-with-current-buffer (or ctl-buf ediff-control-buffer)
(if (ediff-valid-difference-p n)
(let* ((func (cond ((eq op 'scroll-down)
#'ediff-get-lines-to-region-start)
((eq op 'scroll-up)
#'ediff-get-lines-to-region-end)
(t (lambda (_a _b _c) 0))))
(max-lines (max (funcall func 'A n ctl-buf)
(funcall func 'B n ctl-buf)
(if (ediff-buffer-live-p ediff-buffer-C)
(funcall func 'C n ctl-buf)
0)
(if (and ediff-merge-with-ancestor-job
ediff-show-ancestor
(ediff-buffer-live-p ediff-ancestor-buffer))
(funcall func 'Ancestor n ctl-buf)
0))))
;; this covers the horizontal coefficient as well:
;; if max-lines = 0 then coef = 1
(if (> max-lines 0)
(/ (+ (funcall func buf-type n ctl-buf) 0.0)
(+ max-lines 0.0))
1))
1)))