Fix bugs in window resizing code

* lisp/window.el (adjust-window-trailing-edge): Fix mismatched
parenthesis.
(shrink-window, enlarge-window): Fix bug#22723 where windows
with preserved size would not get resized.  Also now signal an
error when the window cannot be shrunk or enlarged as requested.
This commit is contained in:
Martin Rudalics 2016-02-18 11:25:07 +01:00
parent 289d5c6e97
commit 3722a694fa

View file

@ -3241,9 +3241,9 @@ move it as far as possible in the desired direction."
(setq ignore 'preserved)
(setq right first-right)
(while (and right
(or (window-size-fixed-p right horizontal 'preserved))
(<= (window-size right horizontal t)
(window-min-size right horizontal 'preserved t)))
(or (window-size-fixed-p right horizontal 'preserved)
(<= (window-size right horizontal t)
(window-min-size right horizontal 'preserved t))))
(setq right
(or (window-right right)
(progn
@ -3352,12 +3352,12 @@ negative, shrink selected window by -DELTA lines or columns."
(window--resize-mini-window minibuffer-window (- delta)))
((window--resizable-p nil delta horizontal)
(window-resize nil delta horizontal))
((window--resizable-p nil delta horizontal 'preserved)
(window-resize nil delta horizontal 'preserved))
((eq this-command 'enlarge-window)
(user-error "Cannot enlarge selected window"))
(t
(window-resize
nil (if (> delta 0)
(window-max-delta nil horizontal)
(- (window-min-delta nil horizontal)))
horizontal)))))
(error "Cannot enlarge selected window")))))
(defun shrink-window (delta &optional horizontal)
"Make the selected window DELTA lines smaller.
@ -3387,12 +3387,12 @@ Also see the `window-min-height' variable."
(window--resize-mini-window minibuffer-window delta))
((window--resizable-p nil (- delta) horizontal)
(window-resize nil (- delta) horizontal))
((window--resizable-p nil (- delta) horizontal 'preserved)
(window-resize nil (- delta) horizontal 'preserved))
((eq this-command 'shrink-window)
(user-error "Cannot shrink selected window"))
(t
(window-resize
nil (if (> delta 0)
(- (window-min-delta nil horizontal))
(window-max-delta nil horizontal))
horizontal)))))
(error "Cannot shrink selected window")))))
(defun maximize-window (&optional window)
"Maximize WINDOW.