Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a65a63b5 authored by Kåre Särs's avatar Kåre Särs

S&R: Rework the replacing code and add \L & \U support

Unify the replace code to one place and use moving-ranges to keep
track of the positions of the matches after a replace.
parent bc400164
This diff is collapsed.
......@@ -140,7 +140,7 @@ private Q_SLOTS:
void matchFound(const QString &url, const QString &fileName,
const QString &lineContent, int matchLen, int startLine, int startColumn, int endLine, int endColumn);
void addMatchMark(KTextEditor::Document* doc, int line, int column, int endLine, int endColumn);
void addMatchMark(KTextEditor::Document* doc, QTreeWidgetItem *item);
void searchDone();
void searchWhileTypingDone();
......
This diff is collapsed.
......@@ -36,20 +36,23 @@ public:
enum MatchData {
FileUrlRole = Qt::UserRole,
FileNameRole,
LineRole,
ColumnRole,
StartLineRole,
StartColumnRole,
EndLineRole,
EndColumnRole,
MatchLenRole,
PreMatchRole,
MatchRole,
PostMatchRole,
EndLineRole,
EndColumnRole,
ReplacedRole,
ReplacedTextRole,
};
ReplaceMatches(QObject *parent = nullptr);
void setDocumentManager(KTextEditor::Application *manager);
bool replaceMatch(KTextEditor::Document *doc, QTreeWidgetItem *item, const KTextEditor::Range &range, const QRegularExpression &regExp, const QString &replaceTxt);
bool replaceSingleMatch(KTextEditor::Document *doc, QTreeWidgetItem *item, const QRegularExpression &regExp, const QString &replaceTxt);
void replaceChecked(QTreeWidget *tree, const QRegularExpression &regexp, const QString &replace);
KTextEditor::Document *findNamed(const QString &name);
......@@ -62,7 +65,7 @@ private Q_SLOTS:
Q_SIGNALS:
void replaceNextMatch();
void matchReplaced(KTextEditor::Document* doc, int line, int column, int endLine, int endColumn);
void matchReplaced(KTextEditor::Document* doc, QTreeWidgetItem *item);
void replaceStatus(const QUrl &url);
void replaceDone();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment