diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 3230daa46..484e9ebeb 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -213,6 +213,7 @@ class CommandDispatcher: def _tab_close(self, tab, prev=False, next_=False, opposite=False): """Helper function for tab_close be able to handle message.async. + Args: tab: Tab select to be closed. prev: Force selecting the tab before the current tab. @@ -240,6 +241,7 @@ class CommandDispatcher: @cmdutils.argument('count', count=True) def tab_close(self, prev=False, next_=False, opposite=False, count=None): """Close the current/[count]th tab. + Args: prev: Force selecting the tab before the current tab. next_: Force selecting the tab after the current tab. @@ -251,7 +253,7 @@ class CommandDispatcher: if tab is None: return close = functools.partial(self._tab_close, tab, prev, - next_, opposite) + next_, opposite) if tab.data.pinned: message.confirm_async(title='Pinned Tab', @@ -284,7 +286,8 @@ class CommandDispatcher: index = self._count() if index is None else int(index) self.tab_move(index) - self._tabbed_browser.set_tab_pinned(self._current_index(), tab.data.pinned) + self._tabbed_browser.set_tab_pinned(self._current_index(), + tab.data.pinned) @cmdutils.register(instance='command-dispatcher', name='open', maxsplit=0, scope='window') diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 484cd8b5d..f89a0f5c6 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -185,11 +185,6 @@ class TabWidget(QTabWidget): for idx in range(self.count()): self.update_tab_title(idx) - @config.change_filter('tabs', 'pinned-width') - def update_tab_pinned_width(self): - """Refresh bar""" - self.tabBar().refresh() - def tabInserted(self, idx): """Update titles when a tab was inserted.""" super().tabInserted(idx) @@ -500,14 +495,15 @@ class TabBar(QTabBar): return size # If we *do* have enough space, tabs should occupy the whole window - # width. Also taken in consideration the reduced space necessary for - # the pinned tabs. - #WORKAROUND: During shutdown the self.count goes down, but the self.pinned not - #this generates some odd bahavior. + # width. Also taken in consideration the reduced space necessary + #for the pinned tabs. + #WORKAROUND: During shutdown the self.count goes down, + #but the self.pinned not this generates some odd bahavior. #To avoid this we compare self.count against self.pinned. if self.pinned > 0 and self.count() > self.pinned: pinned_width = tab_width_pinned_conf * self.pinned - width = (self.width() - pinned_width) / (self.count() - self.pinned) + no_pinned_width = self.width() - pinned_width + width = no_pinned_width / (self.count() - self.pinned) else: width = self.width() / self.count() diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index b9a95c810..4329f12db 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -46,6 +46,8 @@ class TestTabWidget: 'indicator-width': 3, 'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4), 'title-format': '{index}: {title}', + 'title-format-pinned': '{index}', + 'pinned-width': 43, 'title-alignment': Qt.AlignLeft, }, 'colors': {