From 2a5b314f670e066c9f01690cf53ea88af3aae857 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 May 2018 17:20:09 +0530 Subject: [PATCH] Simplify grid layout code --- kitty/layout.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kitty/layout.py b/kitty/layout.py index 8c3aa0d61..65fe2b9f0 100644 --- a/kitty/layout.py +++ b/kitty/layout.py @@ -473,16 +473,16 @@ class Fat(Tall): self.blank_rects.append(Rect(windows[0].geometry.left, windows[0].geometry.bottom, windows[-1].geometry.right, central.bottom + 1)) -class Grid(Tall): +class Grid(Layout): name = 'grid' def do_layout(self, windows, active_window_idx): n = len(windows) - if n < 4: - return Tall.do_layout(self, windows, active_window_idx) + if n == 1: + return self.layout_single_window(windows[0]) if n <= 5: - ncols = 2 + ncols = 1 if n == 1 else 2 else: for ncols in range(3, (n // 2) + 1): if ncols * ncols >= n: