diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 9a8fdbc64..165052e78 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -225,8 +225,8 @@ class TabWidget(QTabWidget): non-visible. To avoid flickering, disable repaint updates whlie we work. """ - toggle = self.count() > 10 bar = self.tabBar() + toggle = self.count() > 10 and bar.isVisible() if toggle: bar.setUpdatesEnabled(False) bar.setVisible(False) diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index 24acb6d87..5213e4f65 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -134,6 +134,14 @@ class TestTabWidget: config_stub.val.tabs.max_width = max_size assert widget.tabBar().tabRect(0).width() == max_size + def test_tab_stays_hidden(self, widget, fake_web_tab, config_stub): + assert widget.tabBar().isVisible() + config_stub.val.tabs.show = "never" + assert not widget.tabBar().isVisible() + for i in range(12): + widget.addTab(fake_web_tab(), 'foobar' + str(i)) + assert not widget.tabBar().isVisible() + @pytest.mark.parametrize("num_tabs", [4, 100]) @pytest.mark.parametrize("rev", [True, False]) def test_add_remove_tab_benchmark(self, benchmark, widget,