emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/golden-ratio 3d93baf3c0 94/95: Merge pull request #92 from


From: ELPA Syncer
Subject: [nongnu] elpa/golden-ratio 3d93baf3c0 94/95: Merge pull request #92 from shouya/minimal-change
Date: Thu, 7 Sep 2023 22:02:16 -0400 (EDT)

branch: elpa/golden-ratio
commit 3d93baf3c01e8f1b72ddc8b7376db906a9c3e74e
Merge: 007911d8a4 656117e490
Author: Roman Gonzalez <roman@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #92 from shouya/minimal-change
    
    Support resizing only when the change is significant
---
 golden-ratio.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/golden-ratio.el b/golden-ratio.el
index 28a637d939..75572f0384 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -92,6 +92,16 @@ will prevent the window to be resized to the golden ratio."
   :type '(repeat string)
   :group 'golden-ratio)
 
+(defcustom golden-ratio-minimal-width-change 1
+  "Minimal width change needed to trigger actual window resizing."
+  :group 'golden-ratio
+  :type 'integer)
+
+(defcustom golden-ratio-minimal-height-change 1
+  "Minimal height change needed to trigger actual window resizing."
+  :group 'golden-ratio
+  :type 'integer)
+
 ;;; Compatibility
 ;;
 (unless (fboundp 'window-resizable-p)
@@ -129,9 +139,11 @@ will prevent the window to be resized to the golden ratio."
   (with-selected-window (or window (selected-window))
     (let ((nrow  (floor (- (first  dimensions) (window-height))))
           (ncol  (floor (- (second dimensions) (window-width)))))
-      (when (window-resizable-p (selected-window) nrow)
+      (when (and (> nrow golden-ratio-minimal-height-change)
+                 (window-resizable-p (selected-window) nrow))
         (enlarge-window nrow))
-      (when (window-resizable-p (selected-window) ncol t)
+      (when (and (> ncol golden-ratio-minimal-width-change)
+                 (window-resizable-p (selected-window) ncol t))
         (enlarge-window ncol t)))))
 
 (defun golden-ratio-exclude-major-mode-p ()



reply via email to

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