diff --git a/kitty/tabs.py b/kitty/tabs.py index 4f9b5f0bc..eae562067 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -2098,7 +2098,10 @@ class TabManager: # {{{ tab_id = target.tab_id if target is not None else 0 # Highlight the "+" button only when appending, elsewhere the insertion marker is enough self._set_drag_target_tab(-1 if before == 0 else tab_id) - self._update_drag_hover(tab_id, window_id, source_is_window=True) + # Tab drags clear the window preview before updating the tab preview on + # every drag event. Keep an existing tab hover timer across those events. + if tab_id or self.drag_hover is None or self.drag_hover.source_is_window: + self._update_drag_hover(tab_id, window_id, source_is_window=True) def _clear_force_show_title_bars(self) -> None: boss = get_boss() diff --git a/kitty_tests/tab_drop.py b/kitty_tests/tab_drop.py index 581bc060b..94f4112b4 100644 --- a/kitty_tests/tab_drop.py +++ b/kitty_tests/tab_drop.py @@ -593,6 +593,15 @@ class TestWindowDropTabs(BaseTest): self.hover() self.ae(self.add_timer.call_count, 1) + def test_clearing_window_preview_preserves_tab_hover(self): + self.tm._update_drag_hover(2, 9, source_is_window=False) + hover = self.tm.drag_hover + for _ in range(3): + self.tm._set_window_drop_tab_target() + self.assertIs(self.tm.drag_hover, hover) + self.add_timer.assert_called_once() + self.remove_timer.assert_not_called() + def test_changing_targets_restarts_hover_and_ignores_stale_timer(self): self.hover() first_callback = self.add_timer.call_args.args[0]