aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMook <marky@activestate.com>2013-02-25 15:20:58 -0800
committerMook <marky@activestate.com>2013-02-25 15:20:58 -0800
commit124b2f79616f21eb4189a45bead308c628b56242 (patch)
tree68f3bd9a2d1eca34f8bd3e411a4baf2a43a032e6
parentc73567a8b582af6150c24cf54aa731e2ff8cbf96 (diff)
downloadscintilla-mirror-124b2f79616f21eb4189a45bead308c628b56242.tar.gz
Editor: SCI_LINESCROLL: treat columns as signed
-rw-r--r--src/Editor.cxx2
-rw-r--r--test/simpleTests.py10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index e5c997cf4..8ad36ef33 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -7414,7 +7414,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_LINESCROLL:
ScrollTo(topLine + lParam);
- HorizontalScrollTo(xOffset + wParam * vs.spaceWidth);
+ HorizontalScrollTo(xOffset + static_cast<int>(wParam) * vs.spaceWidth);
return 1;
case SCI_SETXOFFSET:
diff --git a/test/simpleTests.py b/test/simpleTests.py
index 4d397261a..53afee1bd 100644
--- a/test/simpleTests.py
+++ b/test/simpleTests.py
@@ -973,7 +973,7 @@ class TestScrolling(unittest.TestCase):
self.ed.ClearAll()
self.ed.EmptyUndoBuffer()
# 150 should be enough lines
- self.ed.InsertText(0, b"a\n" * 150)
+ self.ed.InsertText(0, b"a" * 150 + b"\n" * 150)
def testTop(self):
self.ed.GotoLine(0)
@@ -983,6 +983,14 @@ class TestScrolling(unittest.TestCase):
self.ed.GotoLine(0)
self.ed.LineScroll(0, 3)
self.assertEquals(self.ed.FirstVisibleLine, 3)
+ self.ed.LineScroll(0, -2)
+ self.assertEquals(self.ed.FirstVisibleLine, 1)
+ self.assertEquals(self.ed.XOffset, 0)
+ self.ed.LineScroll(10, 0)
+ self.assertGreater(self.ed.XOffset, 0)
+ scroll_width = float(self.ed.XOffset) / 10
+ self.ed.LineScroll(-2, 0)
+ self.assertEquals(self.ed.XOffset, scroll_width * 8)
def testVisibleLine(self):
self.ed.FirstVisibleLine = 7