diff options
author | Jay Kamat <jaygkamat@gmail.com> | 2017-07-19 23:11:39 -0700 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2017-09-10 01:52:55 +0200 |
commit | ccf3cb6d7c5775dab9fe7671e8ddadecccc8e92f (patch) | |
tree | cb4f5824085dfae78e67edb470d05b6b4f929f72 | |
parent | fcd8be5b688ed421d3f30e7e8bc7f667da2da883 (diff) | |
download | qutebrowser-ccf3cb6d7c5775dab9fe7671e8ddadecccc8e92f.tar.gz qutebrowser-ccf3cb6d7c5775dab9fe7671e8ddadecccc8e92f.zip |
Restructure minimum tab size behavior
-rw-r--r-- | qutebrowser/mainwindow/tabwidget.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index eeee223aa..7719743f2 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -503,10 +503,6 @@ class TabBar(QTabBar): # We return it directly rather than setting `size' because we don't # want to ensure it's valid in this special case. return QSize() - elif self.count() * minimum_size.width() > self.width(): - # If we don't have enough space, we return the minimum size so we - # get scroll buttons as soon as needed. - size = minimum_size else: tab_width_pinned_conf = config.get('tabs', 'pinned-width') @@ -523,13 +519,13 @@ class TabBar(QTabBar): width = tab_width_pinned_conf else: - # If we *do* have enough space, tabs should occupy the whole - # window width. If there are pinned tabs their size will be - # subtracted from the total window width. - # During shutdown the self.count goes down, - # but the self.pinned_count not - this generates some odd + # Tabs should attempt to occupy the whole window width. If + # there are pinned tabs their size will be subtracted from the + # total window width. During shutdown the self.count goes + # down, but the self.pinned_count not - this generates some odd # behavior. To avoid this we compare self.count against - # self.pinned_count. + # self.pinned_count. If we end up having too little space, we + # set the minimum size below. if self.pinned_count > 0 and no_pinned_count > 0: width = no_pinned_width / no_pinned_count else: @@ -541,6 +537,10 @@ class TabBar(QTabBar): index < no_pinned_width % no_pinned_count): width += 1 + # If we don't have enough space, we return the minimum size so we + # get scroll buttons as soon as needed. + width = max(width, minimum_size.width()) + size = QSize(width, height) qtutils.ensure_valid(size) return size |