Editor: replace Utils::Text::Replacement with Utils::ChangeSet::EditOp for formatting

Removes the last usage of Utils::Text::Replacement with a more commonly used pattern.

Change-Id: I0912bf61388a58ddaba424380ec139f9aa15fc4c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2023-07-04 10:05:33 +02:00
parent 81e8c67686
commit 4743724d4c
11 changed files with 74 additions and 69 deletions

View File

@@ -31,8 +31,8 @@ public:
void autoIndent(const QTextCursor &cursor,
const TextEditor::TabSettings &tabSettings,
int cursorPositionInEditor = -1) override;
Utils::Text::Replacements format(const TextEditor::RangesInLines &rangesInLines,
FormattingMode mode = FormattingMode::Forced) override;
Utils::EditOperations format(const TextEditor::RangesInLines &rangesInLines,
FormattingMode mode = FormattingMode::Forced) override;
void indentBlock(const QTextBlock &block,
const QChar &typedChar,
@@ -60,18 +60,18 @@ private:
const QTextBlock &endBlock,
const QChar &typedChar,
int cursorPositionInEditor);
Utils::Text::Replacements indentsFor(QTextBlock startBlock,
const QTextBlock &endBlock,
const QChar &typedChar,
int cursorPositionInEditor,
bool trimTrailingWhitespace = true);
Utils::Text::Replacements replacements(QByteArray buffer,
const QTextBlock &startBlock,
const QTextBlock &endBlock,
int cursorPositionInEditor,
ReplacementsToKeep replacementsToKeep,
const QChar &typedChar = QChar::Null,
bool secondTry = false) const;
Utils::ChangeSet indentsFor(QTextBlock startBlock,
const QTextBlock &endBlock,
const QChar &typedChar,
int cursorPositionInEditor,
bool trimTrailingWhitespace = true);
Utils::ChangeSet replacements(QByteArray buffer,
const QTextBlock &startBlock,
const QTextBlock &endBlock,
int cursorPositionInEditor,
ReplacementsToKeep replacementsToKeep,
const QChar &typedChar = QChar::Null,
bool secondTry = false) const;
struct CachedStyle {
clang::format::FormatStyle style = clang::format::getNoStyle();