forked from qt-creator/qt-creator
TextEditor: avoid autoIndent when using default TextIndenter
Most programming languages use indentation to group stuff. So if we have no special language support for a text file it is useful to start a newline on the same indent depth as the previous line. But if we trigger an explicit reindent (default ctrl+i) we usually don't want to change the indentation if we don't know exactly where it should end up. This also applies to refactoring changes, for example from the lsp. Change-Id: I8268dc88cbceddfc7112757fd7d2fef940ab9a39 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -51,6 +51,15 @@ int TextIndenter::indentFor(const QTextBlock &block,
|
|||||||
return tabSettings.indentationColumn(previousText);
|
return tabSettings.indentationColumn(previousText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextIndenter::autoIndent(const QTextCursor &cursor,
|
||||||
|
const TabSettings &tabSettings,
|
||||||
|
int cursorPositionInEditor)
|
||||||
|
{
|
||||||
|
Q_UNUSED(cursor);
|
||||||
|
Q_UNUSED(tabSettings);
|
||||||
|
Q_UNUSED(cursorPositionInEditor);
|
||||||
|
}
|
||||||
|
|
||||||
IndentationForBlock TextIndenter::indentationForBlocks(const QVector<QTextBlock> &blocks,
|
IndentationForBlock TextIndenter::indentationForBlocks(const QVector<QTextBlock> &blocks,
|
||||||
const TabSettings &tabSettings,
|
const TabSettings &tabSettings,
|
||||||
int /*cursorPositionInEditor*/)
|
int /*cursorPositionInEditor*/)
|
||||||
|
@@ -26,6 +26,10 @@ public:
|
|||||||
const TabSettings &tabSettings,
|
const TabSettings &tabSettings,
|
||||||
int cursorPositionInEditor = -1) override;
|
int cursorPositionInEditor = -1) override;
|
||||||
|
|
||||||
|
void autoIndent(const QTextCursor &cursor,
|
||||||
|
const TabSettings &tabSettings,
|
||||||
|
int cursorPositionInEditor = -1) override;
|
||||||
|
|
||||||
IndentationForBlock indentationForBlocks(const QVector<QTextBlock> &blocks,
|
IndentationForBlock indentationForBlocks(const QVector<QTextBlock> &blocks,
|
||||||
const TabSettings &tabSettings,
|
const TabSettings &tabSettings,
|
||||||
int cursorPositionInEditor = -1) override;
|
int cursorPositionInEditor = -1) override;
|
||||||
|
Reference in New Issue
Block a user