From a666b1770682c61332f2889d57c51794bbcd15db Mon Sep 17 00:00:00 2001 From: martin rudalics Date: Fri, 20 Apr 2012 10:49:24 +0200 Subject: [PATCH] Fix resizing of minibuffer windows (Bug#11276). * window.el (adjust-window-trailing-edge, enlarge-window) (shrink-window, window-resize): * mouse.el (mouse-drag-line): Fix resizing of minibuffer windows (Bug#11276). --- lisp/ChangeLog | 7 +++++++ lisp/mouse.el | 23 +++++++++++------------ lisp/window.el | 34 ++++++++++++++++++++++++++-------- 3 files changed, 44 insertions(+), 20 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 362298a39b8..bddece330e3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-04-20 Martin Rudalics + + * window.el (adjust-window-trailing-edge, enlarge-window) + (shrink-window, window-resize): + * mouse.el (mouse-drag-line): Fix resizing of minibuffer + windows (Bug#11276). + 2012-04-20 Dan Nicolaescu * battery.el (battery-echo-area-format): Display remaining time diff --git a/lisp/mouse.el b/lisp/mouse.el index 2e119483797..20a78e55651 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -404,13 +404,16 @@ must be one of the symbols header, mode, or vertical." (or mouse-1-click-in-non-selected-windows (eq window (selected-window))) (mouse-on-link-p start))) - (enlarge-minibuffer + (resize-minibuffer + ;; Resize the minibuffer window if it's on the same frame as + ;; and immediately below the position window and it's either + ;; active or `resize-mini-windows' is nil. (and (eq line 'mode) - (not resize-mini-windows) (eq (window-frame minibuffer-window) frame) - (not (one-window-p t frame)) (= (nth 1 (window-edges minibuffer-window)) - (nth 3 (window-edges window))))) + (nth 3 (window-edges window))) + (or (not resize-mini-windows) + (eq minibuffer-window (active-minibuffer-window))))) (which-side (and (eq line 'vertical) (or (cdr (assq 'vertical-scroll-bars (frame-parameters frame))) @@ -425,7 +428,7 @@ must be one of the symbols header, mode, or vertical." ((eq line 'mode) ;; Check whether mode-line can be dragged at all. (when (and (window-at-side-p window 'bottom) - (not enlarge-minibuffer)) + (not resize-minibuffer)) (setq done t))) ((eq line 'vertical) ;; Get the window to adjust for the vertical case. @@ -499,13 +502,9 @@ must be one of the symbols header, mode, or vertical." ;; Remember that we dragged. (setq dragged t)) - (cond - (enlarge-minibuffer - (adjust-window-trailing-edge window growth)) - ((eq line 'mode) - (adjust-window-trailing-edge window growth)) - (t - (adjust-window-trailing-edge window (- growth))))))) + (if (eq line 'mode) + (adjust-window-trailing-edge window growth) + (adjust-window-trailing-edge window (- growth)))))) ;; Presumably, if this was just a click, the last event should be ;; `mouse-1', whereas if this did move the mouse, it should be a diff --git a/lisp/window.el b/lisp/window.el index 28abec42680..9afc69d543d 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -1486,8 +1486,10 @@ instead." (cond ((eq window (frame-root-window frame)) (error "Cannot resize the root window of a frame")) - ((window-minibuffer-p window) - (window--resize-mini-window window delta)) + ((window-minibuffer-p window) + (if horizontal + (error "Cannot resize minibuffer window horizontally") + (window--resize-mini-window window delta))) ((window--resizable-p window delta horizontal ignore) (window--resize-reset frame horizontal) (window--resize-this-window window delta horizontal ignore t) @@ -2002,17 +2004,25 @@ right. If DELTA is less than zero, move the edge upwards or to the left. If the edge can't be moved by DELTA lines or columns, move it as far as possible in the desired direction." (setq window (window-normalize-window window)) - (let ((frame (window-frame window)) - (right window) - left this-delta min-delta max-delta) + (let* ((frame (window-frame window)) + (minibuffer-window (minibuffer-window frame)) + (right window) + left this-delta min-delta max-delta) ;; Find the edge we want to move. (while (and (or (not (window-combined-p right horizontal)) (not (window-right right))) (setq right (window-parent right)))) (cond - ((and (not right) (not horizontal) (not resize-mini-windows) - (eq (window-frame (minibuffer-window frame)) frame)) - (window--resize-mini-window (minibuffer-window frame) (- delta))) + ((and (not right) (not horizontal) + ;; Resize the minibuffer window if it's on the same frame as + ;; and immediately below WINDOW and it's either active or + ;; `resize-mini-windows' is nil. + (eq (window-frame minibuffer-window) frame) + (= (nth 1 (window-edges minibuffer-window)) + (nth 3 (window-edges window))) + (or (not resize-mini-windows) + (eq minibuffer-window (active-minibuffer-window)))) + (window--resize-mini-window minibuffer-window (- delta))) ((or (not (setq left right)) (not (setq right (window-right right)))) (if horizontal (error "No window on the right of this one") @@ -2113,6 +2123,10 @@ Return nil." ((zerop delta)) ((window-size-fixed-p nil horizontal) (error "Selected window has fixed size")) + ((window-minibuffer-p) + (if horizontal + (error "Cannot resize minibuffer window horizontally") + (window--resize-mini-window (selected-window) delta))) ((window--resizable-p nil delta horizontal) (window-resize nil delta horizontal)) (t @@ -2135,6 +2149,10 @@ Return nil." ((zerop delta)) ((window-size-fixed-p nil horizontal) (error "Selected window has fixed size")) + ((window-minibuffer-p) + (if horizontal + (error "Cannot resize minibuffer window horizontally") + (window--resize-mini-window (selected-window) (- delta)))) ((window--resizable-p nil (- delta) horizontal) (window-resize nil (- delta) horizontal)) (t -- 2.11.4.GIT