forked from qt-creator/qt-creator
Editors: Move auto-completion code out of the editor
This is basically a continuation of the commits which refactor code out of the base text editor. For instance,36fa1de4c6and3a684586fa. Also removed the doXXXX() forwarding methods.
This commit is contained in:
@@ -143,8 +143,8 @@ AutoCompleter::AutoCompleter()
|
||||
AutoCompleter::~AutoCompleter()
|
||||
{}
|
||||
|
||||
bool AutoCompleter::doContextAllowsAutoParentheses(const QTextCursor &cursor,
|
||||
const QString &textToInsert) const
|
||||
bool AutoCompleter::contextAllowsAutoParentheses(const QTextCursor &cursor,
|
||||
const QString &textToInsert) const
|
||||
{
|
||||
QChar ch;
|
||||
|
||||
@@ -200,7 +200,7 @@ bool AutoCompleter::doContextAllowsAutoParentheses(const QTextCursor &cursor,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AutoCompleter::doContextAllowsElectricCharacters(const QTextCursor &cursor) const
|
||||
bool AutoCompleter::contextAllowsElectricCharacters(const QTextCursor &cursor) const
|
||||
{
|
||||
Token token = tokenUnderCursor(cursor);
|
||||
switch (token.kind) {
|
||||
@@ -212,15 +212,15 @@ bool AutoCompleter::doContextAllowsElectricCharacters(const QTextCursor &cursor)
|
||||
}
|
||||
}
|
||||
|
||||
bool AutoCompleter::doIsInComment(const QTextCursor &cursor) const
|
||||
bool AutoCompleter::isInComment(const QTextCursor &cursor) const
|
||||
{
|
||||
return tokenUnderCursor(cursor).is(Token::Comment);
|
||||
}
|
||||
|
||||
QString AutoCompleter::doInsertMatchingBrace(const QTextCursor &cursor,
|
||||
const QString &text,
|
||||
QChar,
|
||||
int *skippedChars) const
|
||||
QString AutoCompleter::insertMatchingBrace(const QTextCursor &cursor,
|
||||
const QString &text,
|
||||
QChar,
|
||||
int *skippedChars) const
|
||||
{
|
||||
if (text.length() != 1)
|
||||
return QString();
|
||||
@@ -268,7 +268,7 @@ QString AutoCompleter::doInsertMatchingBrace(const QTextCursor &cursor,
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString AutoCompleter::doInsertParagraphSeparator(const QTextCursor &cursor) const
|
||||
QString AutoCompleter::insertParagraphSeparator(const QTextCursor &cursor) const
|
||||
{
|
||||
if (shouldInsertNewline(cursor)) {
|
||||
QTextCursor cursor = cursor;
|
||||
|
||||
@@ -41,16 +41,15 @@ public:
|
||||
AutoCompleter();
|
||||
virtual ~AutoCompleter();
|
||||
|
||||
private:
|
||||
virtual bool doContextAllowsAutoParentheses(const QTextCursor &cursor,
|
||||
const QString &textToInsert = QString()) const;
|
||||
virtual bool doContextAllowsElectricCharacters(const QTextCursor &cursor) const;
|
||||
virtual bool doIsInComment(const QTextCursor &cursor) const;
|
||||
virtual QString doInsertMatchingBrace(const QTextCursor &tc,
|
||||
virtual bool contextAllowsAutoParentheses(const QTextCursor &cursor,
|
||||
const QString &textToInsert = QString()) const;
|
||||
virtual bool contextAllowsElectricCharacters(const QTextCursor &cursor) const;
|
||||
virtual bool isInComment(const QTextCursor &cursor) const;
|
||||
virtual QString insertMatchingBrace(const QTextCursor &tc,
|
||||
const QString &text,
|
||||
QChar la,
|
||||
int *skippedChars) const;
|
||||
virtual QString doInsertParagraphSeparator(const QTextCursor &tc) const;
|
||||
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
||||
@@ -47,7 +47,7 @@ Indenter::Indenter()
|
||||
Indenter::~Indenter()
|
||||
{}
|
||||
|
||||
bool Indenter::doIsElectricalCharacter(const QChar &ch) const
|
||||
bool Indenter::isElectricCharacter(const QChar &ch) const
|
||||
{
|
||||
if (ch == QLatin1Char('}')
|
||||
|| ch == QLatin1Char(']')
|
||||
@@ -56,10 +56,10 @@ bool Indenter::doIsElectricalCharacter(const QChar &ch) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void Indenter::doIndentBlock(QTextDocument *doc,
|
||||
const QTextBlock &block,
|
||||
const QChar &typedChar,
|
||||
TextEditor::BaseTextEditor *editor)
|
||||
void Indenter::indentBlock(QTextDocument *doc,
|
||||
const QTextBlock &block,
|
||||
const QChar &typedChar,
|
||||
TextEditor::BaseTextEditor *editor)
|
||||
{
|
||||
Q_UNUSED(doc)
|
||||
Q_UNUSED(typedChar)
|
||||
|
||||
@@ -41,12 +41,11 @@ public:
|
||||
Indenter();
|
||||
virtual ~Indenter();
|
||||
|
||||
private:
|
||||
virtual bool doIsElectricalCharacter(const QChar &ch) const;
|
||||
virtual void doIndentBlock(QTextDocument *doc,
|
||||
const QTextBlock &block,
|
||||
const QChar &typedChar,
|
||||
TextEditor::BaseTextEditor *editor);
|
||||
virtual bool isElectricCharacter(const QChar &ch) const;
|
||||
virtual void indentBlock(QTextDocument *doc,
|
||||
const QTextBlock &block,
|
||||
const QChar &typedChar,
|
||||
TextEditor::BaseTextEditor *editor);
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
||||
Reference in New Issue
Block a user