aboutsummaryrefslogtreecommitdiff
path: root/src/scintilla_backports/6158_47fa874827a5.patch
diff options
context:
space:
mode:
Diffstat (limited to 'src/scintilla_backports/6158_47fa874827a5.patch')
-rw-r--r--src/scintilla_backports/6158_47fa874827a5.patch280
1 files changed, 280 insertions, 0 deletions
diff --git a/src/scintilla_backports/6158_47fa874827a5.patch b/src/scintilla_backports/6158_47fa874827a5.patch
new file mode 100644
index 00000000..6a88ed94
--- /dev/null
+++ b/src/scintilla_backports/6158_47fa874827a5.patch
@@ -0,0 +1,280 @@
+# HG changeset patch
+# User Neil <nyamatongwe@gmail.com>
+# Date 1491012984 -39600
+# Node ID 47fa874827a53ca2595aab2df1efa17834f24e06
+# Parent 35d652a3344bede120f1c59d9dc0b453a11c736b
+More encapsulation for Decoration and DecorationList.
+
+diff -r 35d652a3344b -r 47fa874827a5 src/Decoration.cxx
+--- a/src/Decoration.cxx Sat Apr 01 10:43:59 2017 +1100
++++ b/src/Decoration.cxx Sat Apr 01 13:16:24 2017 +1100
+@@ -26,7 +26,7 @@
+ using namespace Scintilla;
+ #endif
+
+-Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) {
++Decoration::Decoration(int indicator_) : indicator(indicator_), next(0) {
+ }
+
+ Decoration::~Decoration() {
+@@ -43,7 +43,7 @@
+ DecorationList::~DecorationList() {
+ Decoration *deco = root;
+ while (deco) {
+- Decoration *decoNext = deco->next;
++ Decoration *decoNext = deco->Next();
+ delete deco;
+ deco = decoNext;
+ }
+@@ -52,8 +52,8 @@
+ }
+
+ Decoration *DecorationList::DecorationFromIndicator(int indicator) {
+- for (Decoration *deco=root; deco; deco = deco->next) {
+- if (deco->indicator == indicator) {
++ for (Decoration *deco=root; deco; deco = deco->Next()) {
++ if (deco->Indicator() == indicator) {
+ return deco;
+ }
+ }
+@@ -68,9 +68,9 @@
+ Decoration *decoPrev = 0;
+ Decoration *deco = root;
+
+- while (deco && (deco->indicator < indicator)) {
++ while (deco && (deco->Indicator() < indicator)) {
+ decoPrev = deco;
+- deco = deco->next;
++ deco = deco->Next();
+ }
+ if (decoPrev == 0) {
+ decoNew->next = root;
+@@ -85,17 +85,17 @@
+ void DecorationList::Delete(int indicator) {
+ Decoration *decoToDelete = 0;
+ if (root) {
+- if (root->indicator == indicator) {
++ if (root->Indicator() == indicator) {
+ decoToDelete = root;
+- root = root->next;
++ root = root->Next();
+ } else {
+ Decoration *deco=root;
+- while (deco->next && !decoToDelete) {
+- if (deco->next && deco->next->indicator == indicator) {
+- decoToDelete = deco->next;
+- deco->next = decoToDelete->next;
++ while (deco->Next() && !decoToDelete) {
++ if (deco->Next() && deco->Next()->Indicator() == indicator) {
++ decoToDelete = deco->Next();
++ deco->next = decoToDelete->Next();
+ } else {
+- deco = deco->next;
++ deco = deco->Next();
+ }
+ }
+ }
+@@ -133,7 +133,7 @@
+ void DecorationList::InsertSpace(int position, int insertLength) {
+ const bool atEnd = position == lengthDocument;
+ lengthDocument += insertLength;
+- for (Decoration *deco=root; deco; deco = deco->next) {
++ for (Decoration *deco=root; deco; deco = deco->Next()) {
+ deco->rs.InsertSpace(position, insertLength);
+ if (atEnd) {
+ deco->rs.FillRange(position, 0, insertLength);
+@@ -144,7 +144,7 @@
+ void DecorationList::DeleteRange(int position, int deleteLength) {
+ lengthDocument -= deleteLength;
+ Decoration *deco;
+- for (deco=root; deco; deco = deco->next) {
++ for (deco=root; deco; deco = deco->Next()) {
+ deco->rs.DeleteRange(position, deleteLength);
+ }
+ DeleteAnyEmpty();
+@@ -154,20 +154,20 @@
+ Decoration *deco = root;
+ while (deco) {
+ if ((lengthDocument == 0) || deco->Empty()) {
+- Delete(deco->indicator);
++ Delete(deco->Indicator());
+ deco = root;
+ } else {
+- deco = deco->next;
++ deco = deco->Next();
+ }
+ }
+ }
+
+ int DecorationList::AllOnFor(int position) const {
+ int mask = 0;
+- for (Decoration *deco=root; deco; deco = deco->next) {
++ for (Decoration *deco=root; deco; deco = deco->Next()) {
+ if (deco->rs.ValueAt(position)) {
+- if (deco->indicator < INDIC_IME) {
+- mask |= 1 << deco->indicator;
++ if (deco->Indicator() < INDIC_IME) {
++ mask |= 1 << deco->Indicator();
+ }
+ }
+ }
+diff -r 35d652a3344b -r 47fa874827a5 src/Decoration.h
+--- a/src/Decoration.h Sat Apr 01 10:43:59 2017 +1100
++++ b/src/Decoration.h Sat Apr 01 13:16:24 2017 +1100
+@@ -12,15 +12,21 @@
+ #endif
+
+ class Decoration {
++ int indicator;
+ public:
+ Decoration *next;
+ RunStyles rs;
+- int indicator;
+
+ explicit Decoration(int indicator_);
+ ~Decoration();
+
+ bool Empty() const;
++ Decoration *Next() const {
++ return next;
++ }
++ int Indicator() const {
++ return indicator;
++ }
+ };
+
+ class DecorationList {
+@@ -32,13 +38,17 @@
+ Decoration *Create(int indicator, int length);
+ void Delete(int indicator);
+ void DeleteAnyEmpty();
+-public:
+ Decoration *root;
+ bool clickNotified;
++public:
+
+ DecorationList();
+ ~DecorationList();
+
++ Decoration *Root() const {
++ return root;
++ }
++
+ void SetCurrentIndicator(int indicator);
+ int GetCurrentIndicator() const { return currentIndicator; }
+
+@@ -55,6 +65,13 @@
+ int ValueAt(int indicator, int position);
+ int Start(int indicator, int position);
+ int End(int indicator, int position);
++
++ virtual bool ClickNotified() const {
++ return clickNotified;
++ }
++ virtual void SetClickNotified(bool notified) {
++ clickNotified = notified;
++ }
+ };
+
+ #ifdef SCI_NAMESPACE
+diff -r 35d652a3344b -r 47fa874827a5 src/EditView.cxx
+--- a/src/EditView.cxx Sat Apr 01 10:43:59 2017 +1100
++++ b/src/EditView.cxx Sat Apr 01 13:16:24 2017 +1100
+@@ -1015,8 +1015,8 @@
+ const Sci::Position lineStart = ll->LineStart(subLine);
+ const Sci::Position posLineEnd = posLineStart + lineEnd;
+
+- for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) {
+- if (under == vsDraw.indicators[deco->indicator].under) {
++ for (Decoration *deco = model.pdoc->decorations.Root(); deco; deco = deco->Next()) {
++ if (under == vsDraw.indicators[deco->Indicator()].under) {
+ Sci::Position startPos = posLineStart + lineStart;
+ if (!deco->rs.ValueAt(startPos)) {
+ startPos = deco->rs.EndRun(startPos);
+@@ -1024,12 +1024,12 @@
+ while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) {
+ const Range rangeRun(deco->rs.StartRun(startPos), deco->rs.EndRun(startPos));
+ const Sci::Position endPos = std::min(rangeRun.end, posLineEnd);
+- const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() &&
++ const bool hover = vsDraw.indicators[deco->Indicator()].IsDynamic() &&
+ rangeRun.ContainsCharacter(hoverIndicatorPos);
+ const int value = deco->rs.ValueAt(startPos);
+ Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal;
+ const Sci::Position posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1);
+- DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart,
++ DrawIndicator(deco->Indicator(), startPos - posLineStart, endPos - posLineStart,
+ surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, drawState, value);
+ startPos = endPos;
+ if (!deco->rs.ValueAt(startPos)) {
+@@ -1619,10 +1619,10 @@
+ }
+ if (vsDraw.indicatorsSetFore > 0) {
+ // At least one indicator sets the text colour so see if it applies to this segment
+- for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) {
++ for (Decoration *deco = model.pdoc->decorations.Root(); deco; deco = deco->Next()) {
+ const int indicatorValue = deco->rs.ValueAt(ts.start + posLineStart);
+ if (indicatorValue) {
+- const Indicator &indicator = vsDraw.indicators[deco->indicator];
++ const Indicator &indicator = vsDraw.indicators[deco->Indicator()];
+ const bool hover = indicator.IsDynamic() &&
+ ((model.hoverIndicatorPos >= ts.start + posLineStart) &&
+ (model.hoverIndicatorPos <= ts.end() + posLineStart));
+diff -r 35d652a3344b -r 47fa874827a5 src/Editor.cxx
+--- a/src/Editor.cxx Sat Apr 01 10:43:59 2017 +1100
++++ b/src/Editor.cxx Sat Apr 01 13:16:24 2017 +1100
+@@ -2097,12 +2097,12 @@
+ }
+
+ void Editor::ClearDocumentStyle() {
+- Decoration *deco = pdoc->decorations.root;
++ Decoration *deco = pdoc->decorations.Root();
+ while (deco) {
+ // Save next in case deco deleted
+- Decoration *decoNext = deco->next;
+- if (deco->indicator < INDIC_CONTAINER) {
+- pdoc->DecorationSetCurrentIndicator(deco->indicator);
++ Decoration *decoNext = deco->Next();
++ if (deco->Indicator() < INDIC_CONTAINER) {
++ pdoc->DecorationSetCurrentIndicator(deco->Indicator());
+ pdoc->DecorationFillRange(0, 0, pdoc->Length());
+ }
+ deco = decoNext;
+@@ -2407,9 +2407,9 @@
+
+ void Editor::NotifyIndicatorClick(bool click, Sci::Position position, int modifiers) {
+ int mask = pdoc->decorations.AllOnFor(position);
+- if ((click && mask) || pdoc->decorations.clickNotified) {
++ if ((click && mask) || pdoc->decorations.ClickNotified()) {
+ SCNotification scn = {};
+- pdoc->decorations.clickNotified = click;
++ pdoc->decorations.SetClickNotified(click);
+ scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE;
+ scn.modifiers = modifiers;
+ scn.position = position;
+@@ -4622,9 +4622,9 @@
+ if (vs.indicatorsDynamic == 0)
+ return;
+ if (position != INVALID_POSITION) {
+- for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) {
+- if (vs.indicators[deco->indicator].IsDynamic()) {
+- if (pdoc->decorations.ValueAt(deco->indicator, position)) {
++ for (Decoration *deco = pdoc->decorations.Root(); deco; deco = deco->Next()) {
++ if (vs.indicators[deco->Indicator()].IsDynamic()) {
++ if (pdoc->decorations.ValueAt(deco->Indicator(), position)) {
+ hoverIndicatorPos = position;
+ }
+ }
+diff -r 35d652a3344b -r 47fa874827a5 src/PositionCache.cxx
+--- a/src/PositionCache.cxx Sat Apr 01 10:43:59 2017 +1100
++++ b/src/PositionCache.cxx Sat Apr 01 13:16:24 2017 +1100
+@@ -483,8 +483,8 @@
+ }
+ }
+ if (pvsDraw && pvsDraw->indicatorsSetFore > 0) {
+- for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) {
+- if (pvsDraw->indicators[deco->indicator].OverridesTextFore()) {
++ for (Decoration *deco = pdoc->decorations.Root(); deco; deco = deco->Next()) {
++ if (pvsDraw->indicators[deco->Indicator()].OverridesTextFore()) {
+ Sci::Position startPos = deco->rs.EndRun(posLineStart);
+ while (startPos < (posLineStart + lineRange.end)) {
+ Insert(startPos - posLineStart);