aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <nyamatongwe@gmail.com>2011-09-23 14:47:12 +1000
committernyamatongwe <nyamatongwe@gmail.com>2011-09-23 14:47:12 +1000
commit4d565849231de130f0605b966ebc75e3a4e89217 (patch)
tree67c6c6b962a4a478940f5be067782d4fa0bd08b4
parent9472c27c87971bbf5fa2a3333b145c725fafab2a (diff)
downloadscintilla-mirror-4d565849231de130f0605b966ebc75e3a4e89217.tar.gz
Optimize scrolling a long way by not invalidating fold margin if going
to invalidate everything.
-rw-r--r--src/Editor.cxx8
-rw-r--r--src/Editor.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index a1c88cc20..de0afdf49 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -193,6 +193,7 @@ Editor::Editor() {
theEdge = 0;
paintState = notPainting;
+ willRedrawAll = false;
modEventMask = SC_MODEVENTMASKALL;
@@ -984,6 +985,8 @@ void Editor::ScrollTo(int line, bool moveThumb) {
// Try to optimise small scrolls
#ifndef UNDER_CE
int linesToMove = topLine - topLineNew;
+ bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting);
+ willRedrawAll = !performBlit;
#endif
SetTopLine(topLineNew);
// Optimize by styling the view as this will invalidate any needed area
@@ -991,11 +994,12 @@ void Editor::ScrollTo(int line, bool moveThumb) {
StyleToPositionInView(PositionAfterArea(GetClientRectangle()));
#ifndef UNDER_CE
// Perform redraw rather than scroll if many lines would be redrawn anyway.
- if ((abs(linesToMove) <= 10) && (paintState == notPainting)) {
+ if (performBlit) {
ScrollText(linesToMove);
} else {
Redraw();
}
+ willRedrawAll = false;
#else
Redraw();
#endif
@@ -4649,7 +4653,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
}
if ((mh.modificationType & SC_MOD_CHANGEMARKER) || (mh.modificationType & SC_MOD_CHANGEMARGIN)) {
- if ((paintState == notPainting) || !PaintContainsMargin()) {
+ if ((!willRedrawAll) && ((paintState == notPainting) || !PaintContainsMargin())) {
if (mh.modificationType & SC_MOD_CHANGEFOLD) {
// Fold changes can affect the drawing of following lines so redraw whole margin
RedrawSelMargin(mh.line-1, true);
diff --git a/src/Editor.h b/src/Editor.h
index f1a500b74..cd5695c09 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -226,6 +226,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
enum { notPainting, painting, paintAbandoned } paintState;
PRectangle rcPaint;
bool paintingAllText;
+ bool willRedrawAll;
StyleNeeded styleNeeded;
int modEventMask;