}
+void GuiCompleter::hidePopup()
+{
+ Cursor cur = gui_->bufferView().cursor();
+ cur.updateFlags(Update::None);
+
+ hidePopup(cur);
+
+ // redraw if needed
+ if (cur.disp_.update())
+ gui_->bufferView().processUpdateFlags(cur.disp_.update());
+}
+
+
+void GuiCompleter::hideInline()
+{
+ Cursor cur = gui_->bufferView().cursor();
+ cur.updateFlags(Update::None);
+
+ hideInline(cur);
+
+ // redraw if needed
+ if (cur.disp_.update())
+ gui_->bufferView().processUpdateFlags(cur.disp_.update());
+}
+
+
void GuiCompleter::activate()
{
if (!popupVisible() && !inlineVisible())
/// Show the inline completion.
void showInline();
+ /// Hide the popup.
+ void hidePopup();
+ /// Hide the inline completion.
+ void hideInline();
+
private Q_SLOTS:
///
void popupActivated(const QString & completion);
}
}
- // intercept tab for inline completion
+ // intercept keys for the completion
if (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