]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix control buffer window height in 'ediff-setup-control-buffer' (Bug#49277)
authorMartin Rudalics <rudalics@gmx.at>
Wed, 15 Dec 2021 17:53:49 +0000 (18:53 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Wed, 15 Dec 2021 17:53:49 +0000 (18:53 +0100)
* lisp/vc/ediff-util.el (ediff-setup-control-buffer): Emulate
original 'shrink-window-if-larger-than-buffer' call by calling
'fit-window-to-buffer' with an appropriate maximum height
argument (Bug#49277).

lisp/vc/ediff-util.el

index 7c36291eea19c37977f60283fe7ffd6378200b6d..c12de02e49f549085a1f477dd304d225ff60b769 100644 (file)
@@ -521,7 +521,25 @@ to invocation.")
     (erase-buffer)
     (ediff-set-help-message)
     (insert ediff-help-message)
-    (shrink-window-if-larger-than-buffer)
+    ;; With the fix for Bug#49277 and an 'ediff-setup-windows-plain'
+    ;; layout, the window of the control buffer we want to adjust here
+    ;; is no longer the lower of two windows on their frame both showing
+    ;; that control buffer but rather the bottom-most window in the
+    ;; established ediff layout for that frame.  As a consequence,
+    ;; 'shrink-window-if-larger-than-buffer' will fail to show the whole
+    ;; buffer with 'ediff-toggle-help' because that window's maximum
+    ;; height is not half the height of its frame but the height of the
+    ;; control buffer's window in the established layout (Bug#52504).
+    ;;
+    ;; The form below is an attempt to emulate the behavior of Emacs 27
+    ;; as faithfully as possible in this regard (the use of 'ceiling'
+    ;; mimics the behavior of 'split-window' giving the lower window the
+    ;; residue line when the window to split has an uneven number of
+    ;; lines).
+    (when (and (window-combined-p)
+              (pos-visible-in-window-p (point-min)))
+      (fit-window-to-buffer
+       nil (ceiling (/ (window-total-height (frame-root-window)) 2.0))))
     (or (ediff-multiframe-setup-p)
        (ediff-indent-help-message))
     (ediff-set-help-overlays)