aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/pythoneditor
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2019-01-28 08:11:20 +0100
committerIvan Donchevskii <ivan.donchevskii@qt.io>2019-01-31 10:25:18 +0000
commit1dee275f58e9f9df2e2719325157cfdec42fe1cf (patch)
treeb5d3480d9484a9d0347de6d3d8219f31d70b602e /src/plugins/pythoneditor
parent80fb0178fdd9ee82acfb22aa512c7514868e89d1 (diff)
ClangFormat: Add cursor position to the indenter interface
Sometimes it's imnportant where the cursor currently is to properly format the code without affecting the current line. Change-Id: I8b1fb11d2303adb5f960c7cb80a0ed2e6e45010f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/plugins/pythoneditor')
-rw-r--r--src/plugins/pythoneditor/pythonindenter.cpp4
-rw-r--r--src/plugins/pythoneditor/pythonindenter.h4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/pythoneditor/pythonindenter.cpp b/src/plugins/pythoneditor/pythonindenter.cpp
index ee7813f3276..a6fb880dcdc 100644
--- a/src/plugins/pythoneditor/pythonindenter.cpp
+++ b/src/plugins/pythoneditor/pythonindenter.cpp
@@ -64,7 +64,9 @@ bool PythonIndenter::isElectricCharacter(const QChar &ch) const
return ch == ':';
}
-int PythonIndenter::indentFor(const QTextBlock &block, const TextEditor::TabSettings &tabSettings)
+int PythonIndenter::indentFor(const QTextBlock &block,
+ const TextEditor::TabSettings &tabSettings,
+ int /*cursorPositionInEditor*/)
{
QTextBlock previousBlock = block.previous();
if (!previousBlock.isValid())
diff --git a/src/plugins/pythoneditor/pythonindenter.h b/src/plugins/pythoneditor/pythonindenter.h
index 8ce10ba4fe9..ff9378e007d 100644
--- a/src/plugins/pythoneditor/pythonindenter.h
+++ b/src/plugins/pythoneditor/pythonindenter.h
@@ -35,7 +35,9 @@ public:
explicit PythonIndenter(QTextDocument *doc);
private:
bool isElectricCharacter(const QChar &ch) const override;
- int indentFor(const QTextBlock &block, const TextEditor::TabSettings &tabSettings) 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,