fetch a window even if its index is larger than window-count

The index of a window in window-vector can be greater than the number of live
windows if its number was assigned by winum-assign-func.

also partly fixes #4
This commit is contained in:
Alexander M 2017-04-15 16:13:11 +02:00 committed by deb0ch
parent 4bee4987bc
commit 66c598a4e6

View file

@ -314,8 +314,9 @@ PREFIX must be a key sequence, like the ones returned by `kbd'."
;;;###autoload
(defun winum-get-window-by-number (n)
"Return window numbered N if exists, nil otherwise."
(when (and (>= n 0) (< n (1+ winum--window-count)))
(aref (winum--get-window-vector) n)))
(let ((window-vector (winum--get-window-vector)))
(when (and (>= n 0) (< n (length window-vector)))
(aref window-vector n))))
;;;###autoload
(defun winum-get-number-string (&optional window)