mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
* escape hides the completion
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23258 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7f39b79d55
commit
eb86fb460e
@ -498,6 +498,32 @@ void GuiCompleter::showInline()
|
||||
}
|
||||
|
||||
|
||||
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())
|
||||
|
@ -74,6 +74,11 @@ public Q_SLOTS:
|
||||
/// 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);
|
||||
|
@ -743,13 +743,25 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user