From 8f423c6d8fce5b2e635566d29529ab89cda0cd62 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 20 Feb 2018 09:52:19 +0530 Subject: [PATCH] Fix padding color not tracking active window bg color --- kitty/boss.py | 9 +++++++++ kitty/tabs.py | 5 +++++ kitty/window.py | 6 +++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/kitty/boss.py b/kitty/boss.py index a9b9b2ac7..47cc3a689 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -320,6 +320,15 @@ class Boss: self.current_key_press_info = key, scancode, action, mods return self.dispatch_action(key_action) + def default_bg_changed_for(self, window_id): + w = self.window_id_map.get(window_id) + if w is not None: + tm = self.os_window_map.get(w.os_window_id) + if tm is not None: + t = tm.tab_for_id(w.tab_id) + if t is not None: + t.relayout_borders() + def dispatch_action(self, key_action): if key_action is not None: f = getattr(self, key_action.func, None) diff --git a/kitty/tabs.py b/kitty/tabs.py index 6117d378c..fd84a6750 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -426,6 +426,11 @@ class TabManager: # {{{ if t is not None: return t.active_window + def tab_for_id(self, tab_id): + for t in self.tabs: + if t.id == tab_id: + return t + def move_tab(self, delta=1): if len(self.tabs) > 1: idx = self.active_tab_idx diff --git a/kitty/window.py b/kitty/window.py index e1cc6139c..3a5d009d3 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -228,7 +228,7 @@ class Window: pass # TODO: Implement this def change_colors(self, changes): - dirtied = False + dirtied = default_bg_changed = False def item(raw): if raw is None: @@ -242,8 +242,12 @@ class Window: continue dirtied = True setattr(self.screen.color_profile, which.name, val) + if which.name == 'default_bg': + default_bg_changed = True if dirtied: self.screen.mark_as_dirty() + if default_bg_changed: + get_boss().default_bg_changed_for(self.id) def report_color(self, code, r, g, b): r |= r << 8