Commit 62705df6 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Moved indentation utility method from CPPEditor into BaseTextEditor.

Reviewed-by: Roberto Raggi
parent 85ff8c22
...@@ -1561,11 +1561,6 @@ bool CPPEditor::isInComment(const QTextCursor &cursor) const ...@@ -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: ...@@ -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 ...@@ -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: ...@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment