summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar Linde <oskar.linde@gmail.com>2014-02-02 01:09:09 (GMT)
committerMarius Kintel <marius@kintel.net>2014-02-06 05:46:47 (GMT)
commit86d25f04b7da2c520b963f041542b88fd644d1a0 (patch)
tree87ae0ac667fe1bcfeefd4e7f69f5e8b13f1b4a90
parentb124c4efd82a653e22d4eb898a0f22bc9e47d453 (diff)
Editor: Fix bug where replaceAll could enter an infinite loop
-rw-r--r--src/mainwin.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc
index 6c63fc8..742b380 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -1162,9 +1162,14 @@ void MainWindow::replace() {
}
void MainWindow::replaceAll() {
- while (findOperation()) {
+ QTextCursor old_cursor = editor->textCursor();
+ QTextCursor tmp_cursor = old_cursor;
+ tmp_cursor.movePosition(QTextCursor::Start);
+ editor->setTextCursor(tmp_cursor);
+ while (editor->find(findInputField->text())) {
editor->textCursor().insertText(replaceInputField->text());
}
+ editor->setTextCursor(old_cursor);
}
void MainWindow::findNext()
contact: Jan Huwald // Impressum