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
commitc6d4cd5d9f42251c20cfc9c80ac80389a39abfbe (patch)
tree617539076499c039e0504bf5c264ab4c067728a4
parente6e91e20e83079fc3ccc14277b6c93dcb7fd30d6 (diff)
downloadscintilla-mirror-c6d4cd5d9f42251c20cfc9c80ac80389a39abfbe.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