ecere/gui/ScrollBar: (#1023) Fixed broken thumb dragging on large files
authorJerome St-Louis <jerome@ecere.com>
Wed, 9 Oct 2013 06:28:53 +0000 (02:28 -0400)
committerJerome St-Louis <jerome@ecere.com>
Wed, 9 Oct 2013 06:32:14 +0000 (02:32 -0400)
- int overflow on multiplication by range

ecere/src/gui/controls/ScrollBar.ec

index 490cfc7..8170a95 100644 (file)
@@ -220,7 +220,7 @@ private:
                }
                position = y - thumbClick.y + thumb.position.y;
                if(height)
-                  position = (position - SB_HEIGHT) * (range - 1) / height;
+                  position = (int)((int64)(position - SB_HEIGHT) * (range - 1) / height);
                if(guiApp.textMode)
                {
                   SNAPUP(position, textCellH);
@@ -235,7 +235,7 @@ private:
                }
                position = x - thumbClick.x + thumb.position.x;
                if(height)
-                  position = (position - upBtn.size.w) * (range - 1) / height;
+                  position = (int)((int64)(position - upBtn.size.w) * (range - 1) / height);
                if(guiApp.textMode)
                {
                   SNAPUP(position, textCellW);