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
commit5cea9c55549a91c6f9cf08555396ce4a90ceb5c7 (patch)
treee0737c665d5677531df7f58096a99d9d441c0e88
parent53908be0d1a58079425419ddb214dd8b20b81a4e (diff)
downloadscintilla-mirror-5cea9c55549a91c6f9cf08555396ce4a90ceb5c7.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;