Moved indentation utility method from CPPEditor into BaseTextEditor.

Reviewed-by: Roberto Raggi
This commit is contained in:
Erik Verbruggen
2010-02-03 16:34:54 +01:00
parent 85ff8c2259
commit 62705df65f
4 changed files with 8 additions and 7 deletions

View File

@@ -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,

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;