mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
Do not override (Back)Tab in Adv F&R when it is useful
In Advanced Find and Replace, Tab can be used to move the focus from Search field to the replace field. This is inconvenient when Tab has another use, like completion. To fix this, check that the function bound to Tab is disabled before switching focus. The same is done for BackTab. Fixes bug #11114.
This commit is contained in:
parent
3305b9301e
commit
2b24c03e8b
@ -21,6 +21,9 @@
|
||||
#include "BufferView.h"
|
||||
#include "Cursor.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "KeyMap.h"
|
||||
#include "KeySequence.h"
|
||||
#include "Language.h"
|
||||
#include "LyX.h"
|
||||
#include "lyxfind.h"
|
||||
@ -113,8 +116,11 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
|
||||
}
|
||||
|
||||
case Qt::Key_Tab:
|
||||
if (e->modifiers() == Qt::NoModifier) {
|
||||
if (obj == find_work_area_){
|
||||
if (e->modifiers() == Qt::NoModifier && obj == find_work_area_){
|
||||
KeySequence seq;
|
||||
seq.parse("Tab");
|
||||
FuncRequest func = theTopLevelKeymap().getBinding(seq);
|
||||
if (!getStatus(func).enabled()) {
|
||||
LYXERR(Debug::FINDVERBOSE, "Focusing replace WA");
|
||||
replace_work_area_->setFocus();
|
||||
LYXERR(Debug::FINDVERBOSE, "Selecting entire replace buffer");
|
||||
@ -127,12 +133,17 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
|
||||
|
||||
case Qt::Key_Backtab:
|
||||
if (obj == replace_work_area_) {
|
||||
LYXERR(Debug::FINDVERBOSE, "Focusing find WA");
|
||||
find_work_area_->setFocus();
|
||||
LYXERR(Debug::FINDVERBOSE, "Selecting entire find buffer");
|
||||
dispatch(FuncRequest(LFUN_BUFFER_BEGIN));
|
||||
dispatch(FuncRequest(LFUN_BUFFER_END_SELECT));
|
||||
return true;
|
||||
KeySequence seq;
|
||||
seq.parse("~S-BackTab");
|
||||
FuncRequest func = theTopLevelKeymap().getBinding(seq);
|
||||
if (!getStatus(func).enabled()) {
|
||||
LYXERR(Debug::FINDVERBOSE, "Focusing find WA");
|
||||
find_work_area_->setFocus();
|
||||
LYXERR(Debug::FINDVERBOSE, "Selecting entire find buffer");
|
||||
dispatch(FuncRequest(LFUN_BUFFER_BEGIN));
|
||||
dispatch(FuncRequest(LFUN_BUFFER_END_SELECT));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user