// 310
LFUN_GRAPHICS_GROUPS_UNIFY,
LFUN_SET_GRAPHICS_GROUP,
// 310
LFUN_GRAPHICS_GROUPS_UNIFY,
LFUN_SET_GRAPHICS_GROUP,
+ LFUN_COMPLETION_CANCEL,
LFUN_LASTACTION // end of the table
};
LFUN_LASTACTION // end of the table
};
/*!
* \var lyx::FuncCode lyx::LFUN_COMPLETION_COMPLETE
* \li Action: Try to complete the word or command at the cursor position.
/*!
* \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 Origin: sts, Feb 19 2008
* \endvar
*/
{ LFUN_COMPLETION_COMPLETE, "complete", SingleParUpdate, Edit },
* \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
/*!
* \var lyx::FuncCode lyx::LFUN_BRANCH_ACTIVATE
* \li Action: Activate the branch
+ case LFUN_COMPLETION_CANCEL:
+ if (!d.current_work_area_
+ || (!d.current_work_area_->completer().popupVisible()
+ && !d.current_work_area_->completer().inlineVisible()))
+ enable = false;
+ break;
+
d.current_work_area_->completer().tab();
break;
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;
default:
dispatched = false;
break;
-
- // 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)
// do nothing if there are other events
// (the auto repeated events come too fast)