From 37bbfb11d3c4289f275c8d7faa19763507e6ee63 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Nov 2019 15:39:38 +0530 Subject: [PATCH] Fix location=neighbor causing a hang on a new tab --- kitty/layout.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/layout.py b/kitty/layout.py index 99c201483..e3fe2e8a3 100644 --- a/kitty/layout.py +++ b/kitty/layout.py @@ -279,8 +279,8 @@ class Layout: # {{{ all_windows[i] = window active_window_idx = i elif location is not None: - if location == 'neighbor' and current_active_window_idx is not None: - active_window_idx = current_active_window_idx + 1 + if location == 'neighbor' and current_active_window_idx is not None and len(all_windows) > 1: + active_window_idx = min(current_active_window_idx + 1, len(all_windows)) elif location == 'first': active_window_idx = 0 if active_window_idx is not None: