Commit 9df6987f authored by Victor Yacovlev's avatar Victor Yacovlev

Implemented #kumir2-1901

parent 2a370ff5
......@@ -102,6 +102,13 @@ void FindReplace::showFind()
ui->btnMore->setChecked(false);
updateLayout(false);
ui->find->clear();
if (editor_->cursor()->hasSelection()) {
const QString selection = editor_->cursor()->selectedText();
if (!selection.contains("\n")) {
ui->find->setText(selection.trimmed());
ui->find->setSelection(0, ui->find->text().length());
}
}
ui->find->setFocus();
show();
}
......@@ -110,10 +117,19 @@ void FindReplace::showReplace()
{
ui->btnMore->setChecked(true);
updateLayout(true);
if (ui->find->text().isEmpty())
if (ui->find->text().isEmpty()) {
if (editor_->cursor()->hasSelection()) {
const QString selection = editor_->cursor()->selectedText();
if (!selection.contains("\n")) {
ui->find->setText(selection.trimmed());
ui->find->setSelection(0, ui->find->text().length());
}
}
ui->find->setFocus();
else
}
else {
ui->replace->setFocus();
}
show();
}
......
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