aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/windmove.el31
1 files changed, 15 insertions, 16 deletions
diff --git a/lisp/windmove.el b/lisp/windmove.el
index fc5e864391c..d6dd84e5b19 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -321,14 +321,15 @@ of the frame; (X-MAX, Y-MAX) is the zero-based coordinate of the
321bottom-right corner of the frame. 321bottom-right corner of the frame.
322For example, if a frame has 76 rows and 181 columns, the return value 322For example, if a frame has 76 rows and 181 columns, the return value
323from `windmove-frame-edges' will be the list (0 0 180 75)." 323from `windmove-frame-edges' will be the list (0 0 180 75)."
324 (let ((frame (if window 324 (let* ((frame (if window
325 (window-frame window) 325 (window-frame window)
326 (selected-frame)))) 326 (selected-frame)))
327 (let ((x-min 0) 327 (top-left (window-inside-edges (frame-first-window frame)))
328 (y-min 0) 328 (x-min (nth 0 top-left))
329 (x-max (1- (frame-width frame))) ; 1- for last row & col here 329 (y-min (nth 1 top-left))
330 (y-max (1- (frame-height frame)))) 330 (x-max (+ x-min (frame-width frame) -1)) ; 1- for last row & col
331 (list x-min y-min x-max y-max)))) 331 (y-max (+ x-max (frame-height frame) -1)))
332 (list x-min y-min x-max y-max)))
332 333
333;; it turns out that constraining is always a good thing, even when 334;; it turns out that constraining is always a good thing, even when
334;; wrapping is going to happen. this is because: 335;; wrapping is going to happen. this is because:
@@ -453,15 +454,13 @@ currently-selected window, or WINDOW if supplied; otherwise, it is the
453top-left or bottom-right corner of the selected window, or WINDOW if 454top-left or bottom-right corner of the selected window, or WINDOW if
454supplied, if ARG is greater or smaller than zero, respectively." 455supplied, if ARG is greater or smaller than zero, respectively."
455 (let ((effective-arg (if (null arg) 0 (prefix-numeric-value arg))) 456 (let ((effective-arg (if (null arg) 0 (prefix-numeric-value arg)))
456 (edges (window-edges window))) 457 (edges (window-inside-edges window)))
457 (let ((top-left (cons (nth 0 edges) 458 (let ((top-left (cons (nth 0 edges)
458 (nth 1 edges))) 459 (nth 1 edges)))
459 ;; if 1-'s are not there, windows actually extend too far. 460 ;; Subtracting 1 converts the edge to the last column or line
460 ;; actually, -2 is necessary for bottom: (nth 3 edges) is 461 ;; within the window.
461 ;; the height of the window; -1 because we want 0-based max,
462 ;; -1 to get rid of mode line
463 (bottom-right (cons (- (nth 2 edges) 1) 462 (bottom-right (cons (- (nth 2 edges) 1)
464 (- (nth 3 edges) 2)))) 463 (- (nth 3 edges) 1))))
465 (cond 464 (cond
466 ((> effective-arg 0) 465 ((> effective-arg 0)
467 top-left) 466 top-left)
@@ -531,10 +530,10 @@ DIR, ARG, and WINDOW are handled as by `windmove-other-window-loc'.
531If no window is at direction DIR, an error is signaled." 530If no window is at direction DIR, an error is signaled."
532 (let ((other-window (windmove-find-other-window dir arg window))) 531 (let ((other-window (windmove-find-other-window dir arg window)))
533 (cond ((null other-window) 532 (cond ((null other-window)
534 (error "No window at %s" dir)) 533 (error "No window %s from selected window" dir))
535 ((and (window-minibuffer-p other-window) 534 ((and (window-minibuffer-p other-window)
536 (not (minibuffer-window-active-p other-window))) 535 (not (minibuffer-window-active-p other-window)))
537 (error "Can't move to inactive minibuffer")) 536 (error "Minibuffer is inactive"))
538 (t 537 (t
539 (select-window other-window))))) 538 (select-window other-window)))))
540 539