aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <nyamatongwe@gmail.com>2012-10-13 22:26:55 +1100
committernyamatongwe <nyamatongwe@gmail.com>2012-10-13 22:26:55 +1100
commit055316b2daca2226068e8b2bbb36e1f5ebdc425a (patch)
tree7d37d5acfd93af500438ae0cb4afc7babb84f122
parent73670133c01e08a032a8c0bf45be405e740b6283 (diff)
downloadscintilla-mirror-055316b2daca2226068e8b2bbb36e1f5ebdc425a.tar.gz
Limit horizontal scroll value so that it does not go negative when swiping
touchpad with a small scroll width.
-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;