summaryrefslogtreecommitdiff
path: root/qutebrowser/mainwindow
diff options
context:
space:
mode:
authorNaleo Hyde <2079998+naleo@users.noreply.github.com>2021-07-03 07:29:28 -1000
committerGitHub <noreply@github.com>2021-07-03 07:29:28 -1000
commitf63359e25a340b7c1ba20528afbdc337a749b41d (patch)
tree0f4a13ff853de917649275ea11f092ebb83aea99 /qutebrowser/mainwindow
parent1e1216a34f78d87275c0b0d8dec0de34fabae5cb (diff)
downloadqutebrowser-f63359e25a340b7c1ba20528afbdc337a749b41d.tar.gz
qutebrowser-f63359e25a340b7c1ba20528afbdc337a749b41d.zip
Apply suggestions from code review
Co-authored-by: Florian Bruhin <me@the-compiler.org>
Diffstat (limited to 'qutebrowser/mainwindow')
-rw-r--r--qutebrowser/mainwindow/tabwidget.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py
index 4ac00f0ab..9c61e089e 100644
--- a/qutebrowser/mainwindow/tabwidget.py
+++ b/qutebrowser/mainwindow/tabwidget.py
@@ -709,12 +709,11 @@ class TabBar(QTabBar):
# WORKAROUND for this not being customizable until Qt 6:
# https://codereview.qt-project.org/c/qt/qtbase/+/327746
index = self.currentIndex()
- if index != -1:
- if e.angleDelta().y() > 0:
- index += -1
- else:
- index += 1
- if index >= 0 and index < self.count():
+ if index == -1:
+ return
+ offset = -1 if e.angleDelta().y() > 0 else 1
+ index += offset
+ if 0 <= index < self.count():
self.setCurrentIndex(index)
else:
super().wheelEvent(e)