aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.h
diff options
context:
space:
mode:
authorMarko Njezic <devnull@localhost>2011-07-02 13:41:25 +0200
committerMarko Njezic <devnull@localhost>2011-07-02 13:41:25 +0200
commitf650e7fd9d5596e6c165e02ca5defdb4afc90131 (patch)
tree7c7d85628f2e6f4bf4d57df30f28e5534ca9d1cc /src/Document.h
parent5b3778ece55a12878d505bc4c5bf687206cc2713 (diff)
downloadscintilla-mirror-f650e7fd9d5596e6c165e02ca5defdb4afc90131.tar.gz
Folding related fixes. Initiated by bug #3323805.
Make fold highlighting follow closely the actual folding implementation. Introduce a concept of fold headers with a tail to accommodate certain fold highlighting situations. Optimize PaintSelMargin(), so it doesn't waste time with fold markers, unless really necessary. Make EnsureLineVisible() find right parent, when called on whitespace line. Fix wrong fold tail marker when needWhiteClosure is true.
Diffstat (limited to 'src/Document.h')
-rw-r--r--src/Document.h37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/Document.h b/src/Document.h
index 7858db727..e8dfbabc8 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -117,42 +117,41 @@ struct StyledText {
class HighlightDelimiter {
public:
- HighlightDelimiter() {
+ HighlightDelimiter() : isEnabled(false) {
+ Clear();
+ }
+
+ void Clear() {
beginFoldBlock = -1;
endFoldBlock = -1;
- beginMarginCorrectlyDrawnZone = -1;
- endMarginCorrectlyDrawnZone = -1;
- isEnabled = false;
+ firstChangeableLineBefore = -1;
+ firstChangeableLineAfter = -1;
}
bool NeedsDrawing(int line) {
- return isEnabled && (line <= beginMarginCorrectlyDrawnZone || endMarginCorrectlyDrawnZone <= line);
+ return isEnabled && (line <= firstChangeableLineBefore || line >= firstChangeableLineAfter);
}
- bool isCurrentBlockHighlight(int line) {
+ bool IsFoldBlockHighlighted(int line) {
return isEnabled && beginFoldBlock != -1 && beginFoldBlock <= line && line <= endFoldBlock;
}
- bool isHeadBlockFold(int line) {
+ bool IsHeadOfFoldBlock(int line) {
return beginFoldBlock == line && line < endFoldBlock;
}
- bool isBodyBlockFold(int line) {
+ bool IsBodyOfFoldBlock(int line) {
return beginFoldBlock != -1 && beginFoldBlock < line && line < endFoldBlock;
}
- bool isTailBlockFold(int line) {
+ bool IsTailOfFoldBlock(int line) {
return beginFoldBlock != -1 && beginFoldBlock < line && line == endFoldBlock;
}
- // beginFoldBlock : Begin of current fold block.
- // endStartBlock : End of current fold block.
- // beginMarginCorrectlyDrawnZone : Begin of zone where margin is correctly drawn.
- // endMarginCorrectlyDrawnZone : End of zone where margin is correctly drawn.
- int beginFoldBlock;
- int endFoldBlock;
- int beginMarginCorrectlyDrawnZone;
- int endMarginCorrectlyDrawnZone;
+ int beginFoldBlock; // Begin of current fold block
+ int endFoldBlock; // End of current fold block
+ int firstChangeableLineBefore; // First line that triggers repaint before starting line that determined current fold block
+ int firstChangeableLineAfter; // First line that triggers repaint after starting line that determined current fold block
bool isEnabled;
};
@@ -339,9 +338,9 @@ public:
int SCI_METHOD SetLevel(int line, int level);
int SCI_METHOD GetLevel(int line) const;
void ClearLevels();
- int GetLastChild(int lineParent, int level=-1);
+ int GetLastChild(int lineParent, int level=-1, int lastLine=-1);
int GetFoldParent(int line);
- void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int topLine, int bottomLine);
+ void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine);
void Indent(bool forwards);
int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false);