Kate
katetextfolding.cpp
Go to the documentation of this file.
27 TextFolding::FoldingRange::FoldingRange (TextBuffer &buffer, const KTextEditor::Range &range, FoldingRangeFlags _flags)
225 FoldingRange::Vector &parentVector = range->parent ? range->parent->nestedRanges : m_foldingRanges;
292 FoldingRange::Vector::const_iterator upperBound = qUpperBound (m_foldedFoldingRanges.begin(), m_foldedFoldingRanges.end(), line, compareRangeByStartWithLine);
299 const bool hidden = (((*upperBound)->end->line() >= line) && (line > (*upperBound)->start->line()));
476 QVector<QPair<qint64, TextFolding::FoldingRangeFlags> > TextFolding::foldingRangesStartingOnLine (int line) const
494 void TextFolding::foldingRangesStartingOnLine (QVector<QPair<qint64, FoldingRangeFlags> > &results, const TextFolding::FoldingRange::Vector &ranges, int line) const
505 FoldingRange::Vector::const_iterator lowerBound = qLowerBound (ranges.begin(), ranges.end(), line, compareRangeByLineWithStart);
510 FoldingRange::Vector::const_iterator upperBound = qUpperBound (ranges.begin(), ranges.end(), line, compareRangeByStartWithLine);
540 return QString ("tree %1 - folded %2").arg (debugDump (m_foldingRanges, true)).arg(debugDump (m_foldedFoldingRanges, false));
559 dump += QString ("[%1:%2 %3%4 ").arg (range->start->line()).arg(range->start->column()).arg((range->flags & Persistent) ? "p" : "").arg((range->flags & Folded) ? "f" : "");
575 bool TextFolding::insertNewFoldingRange (FoldingRange *parent, FoldingRange::Vector &existingRanges, FoldingRange *newRange)
585 FoldingRange::Vector::iterator lowerBound = qLowerBound (existingRanges.begin(), existingRanges.end(), newRange, compareRangeByStart);
590 FoldingRange::Vector::iterator upperBound = qUpperBound (existingRanges.begin(), existingRanges.end(), newRange, compareRangeByEnd);
595 if ((lowerBound != existingRanges.begin()) && ((*(lowerBound-1))->end->toCursor() > newRange->start->toCursor()))
606 if ((lowerBound == existingRanges.end()) || (newRange->start->toCursor() >= (*lowerBound)->end->toCursor()) || (newRange->end->toCursor() <= (*lowerBound)->start->toCursor())) {
623 if ((newRange->start->toCursor() >= (*lowerBound)->start->toCursor()) && (newRange->end->toCursor() <= (*lowerBound)->end->toCursor()))
654 if (!((newRange->start->toCursor() <= (*it)->start->toCursor()) && (newRange->end->toCursor() >= (*it)->end->toCursor())))
751 if ((newRange->start->toCursor() <= range->start->toCursor()) && (newRange->end->toCursor() >= range->end->toCursor()))
853 void TextFolding::appendFoldedRanges (TextFolding::FoldingRange::Vector &newFoldedFoldingRanges, const TextFolding::FoldingRange::Vector &ranges) const
881 void TextFolding::exportFoldingRanges (const TextFolding::FoldingRange::Vector &ranges, QVariantList &folds)
TextFolding(TextBuffer &buffer)
Create folding object for given buffer.
Definition: katetextfolding.cpp:47
virtual bool isValid() const
int visibleLineToLine(int visibleLine) const
Convert a visible line number to a line number in the text buffer.
Definition: katetextfolding.cpp:422
bool unfoldRange(qint64 id, bool remove=false)
Unfold the given range.
Definition: katetextfolding.cpp:191
QVector< QPair< qint64, FoldingRangeFlags > > foldingRangesStartingOnLine(int line) const
Queries which folding ranges start at the given line and returns the id + flags for all of them...
Definition: katetextfolding.cpp:476
static Range invalid()
KTextEditor::Range foldingRange(qint64 id) const
Returns the folding range associated with id.
Definition: katetextfolding.cpp:159
void foldingRangesChanged()
If the folding state of existing ranges changes or ranges are added/removed, this signal is emitted...
int lineToVisibleLine(int line) const
Convert a text buffer line to a visible line number.
Definition: katetextfolding.cpp:366
QString debugDump() const
Dump folding state as string, for unit testing and debugging.
Definition: katetextfolding.cpp:535
bool isLineVisible(int line, qint64 *foldedRangeId=0) const
Query if a given line is visible.
Definition: katetextfolding.cpp:281
void ensureLineIsVisible(int line)
Ensure that a given line will be visible.
Definition: katetextfolding.cpp:313
qint64 newFoldingRange(const KTextEditor::Range &range, FoldingRangeFlags flags=FoldingRangeFlags())
Create a new folding range.
Definition: katetextfolding.cpp:99
void debugPrint(const QString &title) const
Print state to stdout for testing.
Definition: katetextfolding.cpp:543
bool isEmpty() const
void importFoldingRanges(const QVariantList &folds)
Import the folding ranges given as a QVariantList like read from configs.
Definition: katetextfolding.cpp:905
const KShortcut & end()
QVariantList exportFoldingRanges() const
Return the current known folding ranges a QVariantList to store in configs.
Definition: katetextfolding.cpp:874
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.