forked from qt-creator/qt-creator
Python: Move highlighter and indenter class definitions to .cpp
Change-Id: Ib71d520977034ca66bd84c9188ffed5fe74e1ba0 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -28,9 +28,23 @@ static QTextBlock previousNonEmptyBlock(const QTextBlock &block)
|
||||
return result;
|
||||
}
|
||||
|
||||
PythonIndenter::PythonIndenter(QTextDocument *doc)
|
||||
: TextEditor::TextIndenter(doc)
|
||||
{}
|
||||
class PythonIndenter : public TextEditor::TextIndenter
|
||||
{
|
||||
public:
|
||||
explicit PythonIndenter(QTextDocument *doc)
|
||||
: TextEditor::TextIndenter(doc)
|
||||
{}
|
||||
|
||||
private:
|
||||
bool isElectricCharacter(const QChar &ch) const override;
|
||||
int indentFor(const QTextBlock &block,
|
||||
const TextEditor::TabSettings &tabSettings,
|
||||
int cursorPositionInEditor = -1) override;
|
||||
|
||||
bool isElectricLine(const QString &line) const;
|
||||
int getIndentDiff(const QString &previousLine,
|
||||
const TextEditor::TabSettings &tabSettings) const;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Does given character change indentation level?
|
||||
@@ -102,4 +116,9 @@ int PythonIndenter::getIndentDiff(const QString &previousLine,
|
||||
return 0;
|
||||
}
|
||||
|
||||
TextEditor::TextIndenter *createPythonIndenter(QTextDocument *doc)
|
||||
{
|
||||
return new PythonIndenter(doc);
|
||||
}
|
||||
|
||||
} // namespace Python
|
||||
|
||||
Reference in New Issue
Block a user