branch: elpa/evil
commit a58e44f6d67c881a146e233b0689edf329be2e70
Author: Tom Dalziel <tom...@hotmail.com>
Commit: Tom Dalziel <33435574+tomd...@users.noreply.github.com>

    Goto last window when C-w w arg is > number of windows
---
 evil-commands.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index 9ae1c2062f..0c6945d42c 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -4411,7 +4411,7 @@ top-left."
   (if (not count)
       (select-window (next-window))
     (evil-window-top-left)
-    (other-window (1- count))))
+    (other-window (1- (min count (length (window-list)))))))
 
 (evil-define-command evil-window-prev (count)
   "Move the cursor to the previous window in the cyclic order.
@@ -4422,7 +4422,7 @@ top-left."
   (if (not count)
       (select-window (previous-window))
     (evil-window-top-left)
-    (other-window (1- count))))
+    (other-window (1- (min count (length (window-list)))))))
 
 (evil-define-command evil-window-new (count file)
   "Splits the current window horizontally

Reply via email to