Skip to content

Commit

Permalink
Merge from 5.x: PR #21624
Browse files Browse the repository at this point in the history
Fixes #21600
  • Loading branch information
ccordoba12 committed Dec 18, 2023
2 parents 8149cca + f5467da commit 3979b8e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions spyder/plugins/editor/panels/scrollflag.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,19 @@ def paintEvent(self, event):
"""
# The area in which the slider handle of the scrollbar may move.
groove_rect = self.get_scrollbar_groove_rect()
# The scrollbar's scale factor ratio between pixel span height and
# value span height
scale_factor = groove_rect.height() / self.get_scrollbar_value_height()

# This is necessary to catch a possible error when the scrollbar
# has zero height.
# Fixes spyder-ide/spyder#21600
try:
# The scrollbar's scale factor ratio between pixel span height and
# value span height
scale_factor = (
groove_rect.height() / self.get_scrollbar_value_height()
)
except ZeroDivisionError:
scale_factor = 1

# The vertical offset of the scroll flag area relative to the
# top of the text editor.
offset = groove_rect.y()
Expand Down

0 comments on commit 3979b8e

Please sign in to comment.