diff options
author | David Schulz <david.schulz@qt.io> | 2024-01-18 09:12:40 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2024-01-18 12:01:35 +0000 |
commit | ec6732511f0a7737520a2bdde5d2d9833910b7a0 (patch) | |
tree | eeb7bac1185865c9873b9ba6b124ec63e82d1429 /src/plugins/texteditor/textindenter.cpp | |
parent | 1cb58e80d82310994cabadb95d4637569092ae4e (diff) |
TextEditor: fix autoIndent
e70b99c7da49c27b519f2fcacb4e06974ef1f6ad broke the auto indent for all
indenters because those indenters are all based on the text indenter.
Add a fallback indenter that is used if no other indenter is configured
for a document, and avoid the auto indentation only if that fallback
indenter is used.
Change-Id: I00e04a07ab14c5fc433a71d1b9826f8e4cc5c0a0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/plugins/texteditor/textindenter.cpp')
-rw-r--r-- | src/plugins/texteditor/textindenter.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/plugins/texteditor/textindenter.cpp b/src/plugins/texteditor/textindenter.cpp index 8ffbca4534..0026c184f0 100644 --- a/src/plugins/texteditor/textindenter.cpp +++ b/src/plugins/texteditor/textindenter.cpp @@ -6,7 +6,7 @@ #include <QTextDocument> #include <QTextCursor> -using namespace TextEditor; +namespace TextEditor { TextIndenter::TextIndenter(QTextDocument *doc) : Indenter(doc) @@ -51,15 +51,6 @@ int TextIndenter::indentFor(const QTextBlock &block, 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, const TabSettings &tabSettings, int /*cursorPositionInEditor*/) @@ -135,3 +126,14 @@ std::optional<TabSettings> TextIndenter::tabSettings() const { return std::optional<TabSettings>(); } + +void PlainTextIndenter::autoIndent(const QTextCursor &cursor, + const TabSettings &tabSettings, + int cursorPositionInEditor) +{ + Q_UNUSED(cursor); + Q_UNUSED(tabSettings); + Q_UNUSED(cursorPositionInEditor); +} + +} // namespace TextEditor |