aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2003-11-05 10:54:52 +0000
committernyamatongwe <unknown>2003-11-05 10:54:52 +0000
commit13a33765368eb68820d650c3146888103ed1d3f0 (patch)
treed86b5f83bb92d180a3b327af5d06ab8a54dce320 /src
parent66e3c0277f2d7af7248488ee264942a4c85d7939 (diff)
downloadscintilla-mirror-13a33765368eb68820d650c3146888103ed1d3f0.tar.gz
Background wrapping during idle from Bruce Dodson.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx30
-rw-r--r--src/Editor.h1
2 files changed, 19 insertions, 12 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 422237f97..9cf3c31b3 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -380,6 +380,7 @@ Editor::Editor() {
wrapWidth = LineLayout::wrapWidthInfinite;
docLineLastWrapped = -1;
docLastLineToWrap = -1;
+ backgroundWrapEnabled = true;
hsStart = -1;
hsEnd = -1;
@@ -1426,11 +1427,12 @@ void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) {
// condition is called only from idler).
// Return true if wrapping occurred.
bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
- // If there are any pending wraps do them during idle.
+ // If there are any pending wraps, do them during idle if possible.
if (wrapState != eWrapNone) {
if (docLineLastWrapped < docLastLineToWrap) {
- if (!SetIdle(true)) {
- // If platform does not have Idle events, perform full wrap
+ if (!(backgroundWrapEnabled && SetIdle(true))) {
+ // Background wrapping is disabled, or idle processing
+ // not supported. A full wrap is required.
fullWrap = true;
}
}
@@ -1441,9 +1443,6 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
// No priority wrap pending
return false;
}
- } else {
- // If there is no wrap, disable the idle call.
- SetIdle(false);
}
int goodTopLine = topLine;
bool wrapOccurred = false;
@@ -5050,18 +5049,25 @@ void Editor::Tick() {
bool Editor::Idle() {
- bool idleDone = false;
- // Wrap lines during idle.
- WrapLines(false, -1);
- // No more wrapping
- if (docLineLastWrapped == docLastLineToWrap)
- idleDone = true;
+ bool idleDone;
+
+ bool wrappingDone = (wrapState == eWrapNone) || (!backgroundWrapEnabled);
+
+ if (!wrappingDone) {
+ // Wrap lines during idle.
+ WrapLines(false, -1);
+ // No more wrapping
+ if (docLineLastWrapped == docLastLineToWrap)
+ wrappingDone = true;
+ }
// Add more idle things to do here, but make sure idleDone is
// set correctly before the function returns. returning
// false will stop calling this idle funtion until SetIdle() is
// called again.
+ idleDone = wrappingDone; // && thatDone && theOtherThingDone...
+
return !idleDone;
}
diff --git a/src/Editor.h b/src/Editor.h
index b8c32ab64..6eccb50bd 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -287,6 +287,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
// Wrapping support
enum { eWrapNone, eWrapWord } wrapState;
+ bool backgroundWrapEnabled;
int wrapWidth;
int docLineLastWrapped;
int docLastLineToWrap;