From 1e8f1f8cc6c0e5e1944acfe643f20fbe785f9515 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 31 May 2019 17:51:56 +0530 Subject: [PATCH] Ensure trailing space is drawn around tab separator when title is too long to fit Fix #1668 --- kitty/tab_bar.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index 29a78d428..9db6a5785 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -45,12 +45,14 @@ def draw_tab_with_separator(draw_data, screen, tab, before, max_title_length, in if draw_data.leading_spaces: screen.draw(' ' * draw_data.leading_spaces) draw_title(draw_data, screen, tab, index) - if draw_data.trailing_spaces: - screen.draw(' ' * draw_data.trailing_spaces) + trailing_spaces = min(max_title_length - 1, draw_data.trailing_spaces) + max_title_length -= trailing_spaces extra = screen.cursor.x - before - max_title_length if extra > 0: screen.cursor.x -= extra + 1 screen.draw('…') + if trailing_spaces: + screen.draw(' ' * trailing_spaces) end = screen.cursor.x screen.cursor.bold = screen.cursor.italic = False screen.cursor.fg = screen.cursor.bg = 0