Editors: Refactor auto-complete code out of the editors for better reusability.

Reviewed-by: Thorbjorn Lindeijer
This commit is contained in:
Leandro Melo
2010-11-08 16:11:26 +01:00
parent 11f0208caf
commit 36fa1de4c6
16 changed files with 759 additions and 388 deletions

View File

@@ -69,6 +69,7 @@ class CompletionSettings;
class DisplaySettings;
class StorageSettings;
class Indenter;
class AutoCompleter;
class TEXTEDITOR_EXPORT BaseTextEditorAnimator : public QObject
{
@@ -225,6 +226,9 @@ public:
void setIndenter(Indenter *indenter);
void setAutoCompleter(AutoCompleter *autoCompleter);
AutoCompleter *autoCompleter() const;
public slots:
void setDisplayName(const QString &title);
@@ -429,17 +433,6 @@ public:
// Reindent at cursor. Selection will be adjusted according to the indentation change of the first block
virtual void reindent(QTextDocument *doc, const QTextCursor &cursor);
virtual bool contextAllowsAutoParentheses(const QTextCursor &cursor, const QString &textToInsert = QString()) const;
virtual bool contextAllowsElectricCharacters(const QTextCursor &cursor) const;
// Returns true if the cursor is inside a comment.
virtual bool isInComment(const QTextCursor &cursor) const;
virtual QString insertMatchingBrace(const QTextCursor &tc, const QString &text, QChar la, int *skippedChars) const;
// Returns the text that needs to be inserted
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
protected:
static void countBracket(QChar open, QChar close, QChar c, int *errors, int *stillopen);