aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cocoa/ScintillaCocoa.mm2
1 files changed, 2 insertions, 0 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index fb584b9c5..64981d9d6 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -1536,6 +1536,8 @@ void ScintillaCocoa::SetHorizontalScrollPos()
// Convert absolute coordinate into the range [0..1]. Keep in mind that the visible area
// does *not* belong to the scroll range.
int maxXOffset = scrollWidth - textRect.Width();
+ if (maxXOffset < 0)
+ maxXOffset = 0;
if (xOffset > maxXOffset)
xOffset = maxXOffset;
float relativePosition = (float) xOffset / maxXOffset;