aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2002-01-09 12:01:59 +0000
committernyamatongwe <unknown>2002-01-09 12:01:59 +0000
commit17b6ad8a14d170c8950e5d86b99951823076a195 (patch)
treeffc195db7e99d1e83ae0f2f93ff3b55ec1f05c75
parentaa198fd4c72ac4ac7b89280d12e2ef8e6e0543cb (diff)
downloadscintilla-mirror-17b6ad8a14d170c8950e5d86b99951823076a195.tar.gz
Optimization that asks for the position of the scroll bar and does not set
it if it does not change. Using scroll bar APIs that allow larger 32 bit values.
-rw-r--r--win32/ScintillaWin.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 1293d0737..ccf7402a1 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -847,12 +847,25 @@ void ScintillaWin::ScrollText(int linesToMove) {
::UpdateWindow(MainHWND());
}
+// Change the scroll position but avoid repaint if changing to same value
+static void ChangeScrollPos(HWND w, int barType, int pos) {
+ SCROLLINFO sci = {
+ sizeof(sci),0,0,0,0,0,0
+ };
+ sci.fMask = SIF_POS;
+ ::GetScrollInfo(w, barType, &sci);
+ if (sci.nPos != pos) {
+ sci.nPos = pos;
+ ::SetScrollInfo(w, barType, &sci, TRUE);
+ }
+}
+
void ScintillaWin::SetVerticalScrollPos() {
- ::SetScrollPos(MainHWND(), SB_VERT, topLine, TRUE);
+ ChangeScrollPos(MainHWND(), SB_VERT, topLine);
}
void ScintillaWin::SetHorizontalScrollPos() {
- ::SetScrollPos(MainHWND(), SB_HORZ, xOffset, TRUE);
+ ChangeScrollPos(MainHWND(), SB_HORZ, xOffset);
}
bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) {