From 67fd07a92aa1a137e96854e560d42ffb3833c345 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Oct 2021 09:57:35 +0530 Subject: [PATCH] ... --- kitty/tab_bar.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index f5870bf6b..1197bd765 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -561,7 +561,8 @@ class TabBar: del self.screen def tab_at(self, x: int) -> Optional[int]: - x = (x - self.window_geometry.left) // self.cell_width - for i, (a, b) in enumerate(self.cell_ranges): - if a <= x <= b: - return i + if self.laid_out_once: + x = (x - self.window_geometry.left) // self.cell_width + for i, (a, b) in enumerate(self.cell_ranges): + if a <= x <= b: + return i