forked from qt-creator/qt-creator
Moved indentation utility method from CPPEditor into BaseTextEditor.
Reviewed-by: Roberto Raggi
This commit is contained in:
@@ -1561,11 +1561,6 @@ bool CPPEditor::isInComment(const QTextCursor &cursor) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditor::indentInsertedText(const QTextCursor &tc)
|
|
||||||
{
|
|
||||||
indent(tc.document(), tc, QChar::Null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Indent a code line based on previous
|
// Indent a code line based on previous
|
||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
static void indentCPPBlock(const CPPEditor::TabSettings &ts,
|
static void indentCPPBlock(const CPPEditor::TabSettings &ts,
|
||||||
|
|||||||
@@ -186,8 +186,6 @@ public:
|
|||||||
~CPPEditor();
|
~CPPEditor();
|
||||||
void unCommentSelection();
|
void unCommentSelection();
|
||||||
|
|
||||||
void indentInsertedText(const QTextCursor &tc);
|
|
||||||
|
|
||||||
unsigned editorRevision() const;
|
unsigned editorRevision() const;
|
||||||
bool isOutdated() const;
|
bool isOutdated() const;
|
||||||
SemanticInfo semanticInfo() const;
|
SemanticInfo semanticInfo() const;
|
||||||
|
|||||||
@@ -3803,6 +3803,11 @@ bool BaseTextEditor::isElectricCharacter(const QChar &) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseTextEditor::indentInsertedText(const QTextCursor &tc)
|
||||||
|
{
|
||||||
|
indent(tc.document(), tc, QChar::Null);
|
||||||
|
}
|
||||||
|
|
||||||
void BaseTextEditor::countBracket(QChar open, QChar close, QChar c, int *errors, int *stillopen)
|
void BaseTextEditor::countBracket(QChar open, QChar close, QChar c, int *errors, int *stillopen)
|
||||||
{
|
{
|
||||||
if (c == open)
|
if (c == open)
|
||||||
|
|||||||
@@ -533,6 +533,9 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// Returns true if key triggers an indent.
|
// Returns true if key triggers an indent.
|
||||||
virtual bool isElectricCharacter(const QChar &ch) const;
|
virtual bool isElectricCharacter(const QChar &ch) const;
|
||||||
|
|
||||||
|
void indentInsertedText(const QTextCursor &tc);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Returns the text to complete at the cursor position, or an empty string
|
// Returns the text to complete at the cursor position, or an empty string
|
||||||
virtual QString autoComplete(QTextCursor &cursor, const QString &text) const;
|
virtual QString autoComplete(QTextCursor &cursor, const QString &text) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user