From 055316b2daca2226068e8b2bbb36e1f5ebdc425a Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 13 Oct 2012 22:26:55 +1100 Subject: Limit horizontal scroll value so that it does not go negative when swiping touchpad with a small scroll width. --- cocoa/ScintillaCocoa.mm | 2 ++ 1 file changed, 2 insertions(+) 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; -- cgit v1.2.3