diff options
author | XhmikosR <xhmikosr@gmail.com> | 2016-12-04 18:20:31 +0200 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2016-12-04 18:24:16 +0200 |
commit | 4b604e07bbbf07d3d5ad04e65f0cef56959e3807 (patch) | |
tree | 44a5924e0ef508167b285c8016e6394992153817 /scintilla/src/ContractionState.cxx | |
parent | a3ee58329361322b321ee2a708e793b1a5e5729a (diff) | |
download | notepad2-mod-master.zip notepad2-mod-master.tar.gz notepad2-mod-master.tar.bz2 |
Update Scintilla to v3.7.1.HEADorigin/masterorigin/HEADmaster
Diffstat (limited to 'scintilla/src/ContractionState.cxx')
-rw-r--r-- | scintilla/src/ContractionState.cxx | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/scintilla/src/ContractionState.cxx b/scintilla/src/ContractionState.cxx index bd2d120..289e669 100644 --- a/scintilla/src/ContractionState.cxx +++ b/scintilla/src/ContractionState.cxx @@ -6,6 +6,7 @@ // The License.txt file describes the conditions under which this software may be distributed.
#include <string.h>
+#include <assert.h>
#include <stdexcept>
#include <algorithm>
@@ -16,13 +17,14 @@ #include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
+#include "SparseVector.h"
#include "ContractionState.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
-ContractionState::ContractionState() : visible(0), expanded(0), heights(0), displayLines(0), linesInDocument(1) {
+ContractionState::ContractionState() : visible(0), expanded(0), heights(0), foldDisplayTexts(0), displayLines(0), linesInDocument(1) {
//InsertLine(0);
}
@@ -35,6 +37,7 @@ void ContractionState::EnsureData() { visible = new RunStyles();
expanded = new RunStyles();
heights = new RunStyles();
+ foldDisplayTexts = new SparseVector<const char *>();
displayLines = new Partitioning(4);
InsertLines(0, linesInDocument);
}
@@ -47,6 +50,8 @@ void ContractionState::Clear() { expanded = 0;
delete heights;
heights = 0;
+ delete foldDisplayTexts;
+ foldDisplayTexts = 0;
delete displayLines;
displayLines = 0;
linesInDocument = 1;
@@ -108,6 +113,8 @@ void ContractionState::InsertLine(int lineDoc) { expanded->SetValueAt(lineDoc, 1);
heights->InsertSpace(lineDoc, 1);
heights->SetValueAt(lineDoc, 1);
+ foldDisplayTexts->InsertSpace(lineDoc, 1);
+ foldDisplayTexts->SetValueAt(lineDoc, NULL);
int lineDisplay = DisplayFromDoc(lineDoc);
displayLines->InsertPartition(lineDoc, lineDisplay);
displayLines->InsertText(lineDoc, 1);
@@ -132,6 +139,7 @@ void ContractionState::DeleteLine(int lineDoc) { visible->DeleteRange(lineDoc, 1);
expanded->DeleteRange(lineDoc, 1);
heights->DeleteRange(lineDoc, 1);
+ foldDisplayTexts->DeletePosition(lineDoc);
}
}
@@ -184,6 +192,24 @@ bool ContractionState::HiddenLines() const { }
}
+const char *ContractionState::GetFoldDisplayText(int lineDoc) const {
+ Check();
+ return foldDisplayTexts->ValueAt(lineDoc);
+}
+
+bool ContractionState::SetFoldDisplayText(int lineDoc, const char *text) {
+ EnsureData();
+ const char *foldText = foldDisplayTexts->ValueAt(lineDoc);
+ if (!foldText || 0 != strcmp(text, foldText)) {
+ foldDisplayTexts->SetValueAt(lineDoc, text);
+ Check();
+ return true;
+ } else {
+ Check();
+ return false;
+ }
+}
+
bool ContractionState::GetExpanded(int lineDoc) const {
if (OneToOne()) {
return true;
@@ -209,6 +235,10 @@ bool ContractionState::SetExpanded(int lineDoc, bool isExpanded) { }
}
+bool ContractionState::GetFoldDisplayTextShown(int lineDoc) const {
+ return !GetExpanded(lineDoc) && GetFoldDisplayText(lineDoc);
+}
+
int ContractionState::ContractedNext(int lineDocStart) const {
if (OneToOne()) {
return -1;
|