forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -48,7 +48,8 @@ bool JavaIndenter::isElectricCharacter(const QChar &ch) const
|
||||
|
||||
void JavaIndenter::indentBlock(const QTextBlock &block,
|
||||
const QChar &typedChar,
|
||||
const TextEditor::TabSettings &tabSettings)
|
||||
const TextEditor::TabSettings &tabSettings,
|
||||
int /*cursorPositionInEditor*/)
|
||||
{
|
||||
int indent = indentFor(block, tabSettings);
|
||||
if (typedChar == QLatin1Char('}'))
|
||||
@@ -56,7 +57,9 @@ void JavaIndenter::indentBlock(const QTextBlock &block,
|
||||
tabSettings.indentLine(block, qMax(0, indent));
|
||||
}
|
||||
|
||||
int JavaIndenter::indentFor(const QTextBlock &block, const TextEditor::TabSettings &tabSettings)
|
||||
int JavaIndenter::indentFor(const QTextBlock &block,
|
||||
const TextEditor::TabSettings &tabSettings,
|
||||
int /*cursorPositionInEditor*/)
|
||||
{
|
||||
QTextBlock previous = block.previous();
|
||||
if (!previous.isValid())
|
||||
|
||||
Reference in New Issue
Block a user