summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2011-06-07 10:32:16 +0000
committerXhmikosR <xhmikosr@users.sourceforge.net>2011-06-07 10:32:16 +0000
commitb31125852fffe836099aa3fd319c0a57d7771bca (patch)
treea4b66c67d22780fd1e6619b2f8b3c2fa29bc2211
parentb55b7831b8b4cb5c388692bc88c8c7338f835ea8 (diff)
downloadnotepad2-mod-b31125852fffe836099aa3fd319c0a57d7771bca.zip
notepad2-mod-b31125852fffe836099aa3fd319c0a57d7771bca.tar.gz
notepad2-mod-b31125852fffe836099aa3fd319c0a57d7771bca.tar.bz2
update scintilla
git-svn-id: https://notepad2-mod.googlecode.com/svn/trunk@530 28bd50df-7adb-d945-0439-6e466c6a13cc
-rw-r--r--scintilla/include/Platform.h3
-rw-r--r--scintilla/src/ContractionState.cxx8
-rw-r--r--scintilla/src/ContractionState.h1
-rw-r--r--scintilla/src/Decoration.cxx2
-rw-r--r--scintilla/src/Editor.cxx2
-rw-r--r--scintilla/src/RunStyles.cxx34
-rw-r--r--scintilla/src/RunStyles.h8
-rw-r--r--scintilla/src/Style.cxx3
8 files changed, 56 insertions, 5 deletions
diff --git a/scintilla/include/Platform.h b/scintilla/include/Platform.h
index b5f95f9..6e05864 100644
--- a/scintilla/include/Platform.h
+++ b/scintilla/include/Platform.h
@@ -301,6 +301,9 @@ public:
FontID GetID() { return fid; }
// Alias another font - caller guarantees not to Release
void SetID(FontID fid_) { fid = fid_; }
+#if PLAT_WX
+ void SetAscent(int ascent_) { ascent = ascent_; }
+#endif
friend class Surface;
friend class SurfaceImpl;
};
diff --git a/scintilla/src/ContractionState.cxx b/scintilla/src/ContractionState.cxx
index 9be9c50..788015f 100644
--- a/scintilla/src/ContractionState.cxx
+++ b/scintilla/src/ContractionState.cxx
@@ -168,6 +168,14 @@ bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible
}
}
+bool ContractionState::HiddenLines() const {
+ if (OneToOne()) {
+ return false;
+ } else {
+ return !visible->AllSameAs(1);
+ }
+}
+
bool ContractionState::GetExpanded(int lineDoc) const {
if (OneToOne()) {
return true;
diff --git a/scintilla/src/ContractionState.h b/scintilla/src/ContractionState.h
index fa1ab6b..445dd45 100644
--- a/scintilla/src/ContractionState.h
+++ b/scintilla/src/ContractionState.h
@@ -48,6 +48,7 @@ public:
bool GetVisible(int lineDoc) const;
bool SetVisible(int lineDocStart, int lineDocEnd, bool visible);
+ bool HiddenLines() const;
bool GetExpanded(int lineDoc) const;
bool SetExpanded(int lineDoc, bool expanded);
diff --git a/scintilla/src/Decoration.cxx b/scintilla/src/Decoration.cxx
index cb84e26..4408d5e 100644
--- a/scintilla/src/Decoration.cxx
+++ b/scintilla/src/Decoration.cxx
@@ -28,7 +28,7 @@ Decoration::~Decoration() {
}
bool Decoration::Empty() {
- return rs.starts->Partitions() == 1;
+ return rs.Runs() == 1;
}
DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0),
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx
index 7fab1a8..872eec2 100644
--- a/scintilla/src/Editor.cxx
+++ b/scintilla/src/Editor.cxx
@@ -4538,7 +4538,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
}
- if (cs.LinesDisplayed() < cs.LinesInDoc()) {
+ if (cs.HiddenLines()) {
// Some lines are hidden so may need shown.
// TODO: check if the modified area is hidden.
if (mh.modificationType & SC_MOD_BEFOREINSERT) {
diff --git a/scintilla/src/RunStyles.cxx b/scintilla/src/RunStyles.cxx
index eb9b2e8..c50a38d 100644
--- a/scintilla/src/RunStyles.cxx
+++ b/scintilla/src/RunStyles.cxx
@@ -21,7 +21,7 @@ using namespace Scintilla;
#endif
// Find the first run at a position
-int RunStyles::RunFromPosition(int position) {
+int RunStyles::RunFromPosition(int position) const {
int run = starts->PartitionFromPosition(position);
// Go to first element with this position
while ((run > 0) && (position == starts->PositionFromPartition(run-1))) {
@@ -147,6 +147,8 @@ bool RunStyles::FillRange(int &position, int value, int &fillLength) {
runEnd = RunFromPosition(end);
RemoveRunIfSameAsPrevious(runEnd);
RemoveRunIfSameAsPrevious(runStart);
+ runEnd = RunFromPosition(end);
+ RemoveRunIfEmpty(runEnd);
return true;
} else {
return false;
@@ -216,3 +218,33 @@ void RunStyles::DeleteRange(int position, int deleteLength) {
}
}
+int RunStyles::Runs() const {
+ return starts->Partitions();
+}
+
+bool RunStyles::AllSame() const {
+ for (int run = 1; run < starts->Partitions(); run++) {
+ if (styles->ValueAt(run) != styles->ValueAt(run - 1))
+ return false;
+ }
+ return true;
+}
+
+bool RunStyles::AllSameAs(int value) const {
+ return AllSame() && (styles->ValueAt(0) == value);
+}
+
+int RunStyles::Find(int value, int start) const {
+ if (start < Length()) {
+ int run = start ? RunFromPosition(start) : 0;
+ if (styles->ValueAt(run) == value)
+ return start;
+ run++;
+ while (run < starts->Partitions()) {
+ if (styles->ValueAt(run) == value)
+ return starts->PositionFromPartition(run);
+ run++;
+ }
+ }
+ return -1;
+}
diff --git a/scintilla/src/RunStyles.h b/scintilla/src/RunStyles.h
index ca01e4d..c94ca3c 100644
--- a/scintilla/src/RunStyles.h
+++ b/scintilla/src/RunStyles.h
@@ -15,10 +15,10 @@ namespace Scintilla {
#endif
class RunStyles {
-public:
+private:
Partitioning *starts;
SplitVector<int> *styles;
- int RunFromPosition(int position);
+ int RunFromPosition(int position) const;
int SplitRun(int position);
void RemoveRun(int run);
void RemoveRunIfEmpty(int run);
@@ -37,6 +37,10 @@ public:
void InsertSpace(int position, int insertLength);
void DeleteAll();
void DeleteRange(int position, int deleteLength);
+ int Runs() const;
+ bool AllSame() const;
+ bool AllSameAs(int value) const;
+ int Find(int value, int start) const;
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/Style.cxx b/scintilla/src/Style.cxx
index f767685..9405c53 100644
--- a/scintilla/src/Style.cxx
+++ b/scintilla/src/Style.cxx
@@ -142,5 +142,8 @@ void Style::ClearTo(const Style &source) {
void Style::Copy(Font &font_, const FontMeasurements &fm_) {
font.MakeAlias(font_);
+#if PLAT_WX
+ font.SetAscent(fm_.ascent);
+#endif
(FontMeasurements &)(*this) = fm_;
}