Closed vmfhrmfoaj closed 3 years ago
I think you need to consider the margin of window. Here is my sample code:
(defun golden-ratio--custom-resize-window (dimensions &optional window) (with-selected-window (or window (selected-window)) (let* ((m (window-margins)) (nrow (floor (- (car dimensions) (window-height)))) (ncol (floor (- (cadr dimensions) (+ (window-width) (or (car m) 0) (or (cdr m) 0)))))) (when (window-resizable-p (selected-window) nrow) (enlarge-window nrow)) (when (window-resizable-p (selected-window) ncol t) (enlarge-window ncol t))))) (advice-add #'golden-ratio--resize-window :override #'golden-ratio--custom-resize-window)
I think you need to consider the margin of window. Here is my sample code: