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

Make sure that the replaced text also is highlighted.

parent e34370bc
......@@ -242,6 +242,9 @@ m_curResults(0)
connect(m_kateApp->documentManager(), SIGNAL(documentWillBeDeleted(KTextEditor::Document*)),
&m_replacer, SLOT(cancelReplace()));
connect(&m_replacer, SIGNAL(matchReplaced(KTextEditor::Document*,int,int,int)),
this, SLOT(addMatchMark(KTextEditor::Document*,int,int,int)));
// Hook into line edit context menus
connect(m_ui.searchCombo, SIGNAL(customContextMenuRequested(QPoint)), this,
......@@ -432,8 +435,12 @@ void KatePluginSearchView::addMatchMark(KTextEditor::Document* doc, int line, in
KTextEditor::MovingInterface* miface = qobject_cast<KTextEditor::MovingInterface*>(doc);
KTextEditor::Attribute::Ptr attr(new KTextEditor::Attribute());
if (sender() == &m_replacer) {
attr->setBackground(Qt::green); // TODO make this part of the color scheme
else {
attr->setBackground(Qt::yellow); // TODO make this part of the color scheme
KTextEditor::Range range(line, column, line, column+matchLen);
KTextEditor::MovingRange* mr = miface->newMovingRange(range);
......@@ -102,6 +102,9 @@ private Q_SLOTS:
void matchFound(const QString &fileName, int line, int column,
const QString &lineContent, int matchLen);
void addMatchMark(KTextEditor::Document* doc, int line, int column, int len);
void searchDone();
void itemSelected(QTreeWidgetItem *item);
......@@ -118,7 +121,6 @@ protected:
QTreeWidgetItem *rootFileItem(const QString &url);
void addMatchMark(KTextEditor::Document* doc, int line, int column, int len);
Ui::SearchDialog m_ui;
QWidget *m_toolView;
......@@ -120,7 +120,10 @@ void ReplaceMatches::doReplaceNextMatch()
for (int i=0; i<rVector.size(); i++) {
line = rVector[i]->start().line();
column = rVector[i]->start().column();
doc->replaceText(*rVector[i], m_replaceText);
emit matchReplaced(doc, line, column, m_replaceText.length());
......@@ -45,6 +45,7 @@ private Q_SLOTS:
void replaceNextMatch();
void matchReplaced(KTextEditor::Document* doc, int line, int column, int matchLen);
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