mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
* LFUNs complete and complete-cancel. No key interception anymore. For now you have to bind the two LFUNs yourself.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26330 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d0bb35a626
commit
f6084eaaa9
@ -404,6 +404,7 @@ enum FuncCode
|
||||
// 310
|
||||
LFUN_GRAPHICS_GROUPS_UNIFY,
|
||||
LFUN_SET_GRAPHICS_GROUP,
|
||||
LFUN_COMPLETION_CANCEL,
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
||||
|
@ -2997,11 +2997,21 @@ void LyXAction::init()
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_COMPLETION_COMPLETE
|
||||
* \li Action: Try to complete the word or command at the cursor position.
|
||||
* \li Syntax: completion-complete
|
||||
* \li Syntax: complete
|
||||
* \li Origin: sts, Feb 19 2008
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_COMPLETION_COMPLETE, "complete", SingleParUpdate, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_COMPLETION_CANCEL
|
||||
* \li Action: Try to cancel completion, either the popup or the inline completion
|
||||
* \li Syntax: completion-escape
|
||||
* \li Origin: sts, Sep 07 2008
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_COMPLETION_CANCEL, "completion-cancel", SingleParUpdate, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_BRANCH_ACTIVATE
|
||||
* \li Action: Activate the branch
|
||||
|
@ -1212,6 +1212,13 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
enable = false;
|
||||
break;
|
||||
|
||||
case LFUN_COMPLETION_CANCEL:
|
||||
if (!d.current_work_area_
|
||||
|| (!d.current_work_area_->completer().popupVisible()
|
||||
&& !d.current_work_area_->completer().inlineVisible()))
|
||||
enable = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -2006,6 +2013,15 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
||||
d.current_work_area_->completer().tab();
|
||||
break;
|
||||
|
||||
case LFUN_COMPLETION_CANCEL:
|
||||
if (d.current_work_area_) {
|
||||
if (d.current_work_area_->completer().popupVisible())
|
||||
d.current_work_area_->completer().hidePopup();
|
||||
else
|
||||
d.current_work_area_->completer().hideInline();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
dispatched = false;
|
||||
break;
|
||||
|
@ -846,26 +846,6 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
|
||||
}
|
||||
}
|
||||
|
||||
// intercept keys for the completion
|
||||
if ((completer_->popupVisible() || completer_->inlineVisible())
|
||||
&& ev->key() == Qt::Key_Tab) {
|
||||
completer_->tab();
|
||||
ev->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
if (completer_->popupVisible() && ev->key() == Qt::Key_Escape) {
|
||||
completer_->hidePopup();
|
||||
ev->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
if (completer_->inlineVisible() && ev->key() == Qt::Key_Escape) {
|
||||
completer_->hideInline();
|
||||
ev->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
// do nothing if there are other events
|
||||
// (the auto repeated events come too fast)
|
||||
// \todo FIXME: remove hard coded Qt keys, process the key binding
|
||||
|
Loading…
x
Reference in New Issue
Block a user