[LyX/master] Advanced F&R: Improve code on Return key
Juergen Spitzmueller
spitz at lyx.org
Wed Feb 17 08:47:55 UTC 2021
commit 50783d94a8ce24a7817867540d61a394f6dae0f8
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Wed Feb 17 09:51:09 2021 +0100
Advanced F&R: Improve code on Return key
---
src/frontends/qt/FindAndReplace.cpp | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/frontends/qt/FindAndReplace.cpp b/src/frontends/qt/FindAndReplace.cpp
index 9cfdfcf..300c291 100644
--- a/src/frontends/qt/FindAndReplace.cpp
+++ b/src/frontends/qt/FindAndReplace.cpp
@@ -102,17 +102,13 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
case Qt::Key_Enter:
case Qt::Key_Return: {
- // with shift we (temporarily) change search/replace direction
- bool const searchback = searchbackCB->isChecked();
- if (e->modifiers() == Qt::ShiftModifier && !searchback)
- searchbackCB->setChecked(true);
-
- if (obj == find_work_area_)
- on_findNextPB_clicked();
+ bool const searchback = (e->modifiers() == Qt::ShiftModifier);
+ bool const replace = (obj == replace_work_area_);
+ findAndReplace(searchback, replace);
+ if (replace)
+ replace_work_area_->setFocus();
else
- on_replacePB_clicked();
- // back to how it was
- searchbackCB->setChecked(searchback);
+ find_work_area_->setFocus();
return true;
}
More information about the lyx-cvs
mailing list