mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
* factored out hidePopup and hideInline
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23248 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
eb2e971f6a
commit
924ed25c61
@ -262,28 +262,12 @@ void GuiCompleter::updateVisibility(Cursor & cur, bool start, bool keep, bool cu
|
||||
bool possibleInlineState = inlinePossible(cur) && cursorInView;
|
||||
|
||||
// we moved or popup state is not ok for popup?
|
||||
if ((moved && !keep) || !possiblePopupState) {
|
||||
// stop an old completion timer
|
||||
if (popup_timer_.isActive())
|
||||
popup_timer_.stop();
|
||||
|
||||
// hide old popup
|
||||
if (popupVisible())
|
||||
popup()->hide();
|
||||
}
|
||||
if ((moved && !keep) || !possiblePopupState)
|
||||
hidePopup(cur);
|
||||
|
||||
// we moved or inline state is not ok for inline completion?
|
||||
if ((moved && !keep) || !possibleInlineState) {
|
||||
// stop an old completion timer
|
||||
if (inline_timer_.isActive())
|
||||
inline_timer_.stop();
|
||||
|
||||
// hide old inline completion
|
||||
if (inlineVisible()) {
|
||||
gui_->bufferView().setInlineCompletion(cur, DocIterator(), docstring());
|
||||
inlineVisible_ = false;
|
||||
}
|
||||
}
|
||||
if ((moved && !keep) || !possibleInlineState)
|
||||
hideInline(cur);
|
||||
|
||||
// we inserted something and are in a possible popup state?
|
||||
if (!popupVisible() && possiblePopupState && start
|
||||
@ -464,6 +448,14 @@ void GuiCompleter::showPopup(Cursor & cur)
|
||||
}
|
||||
|
||||
|
||||
void GuiCompleter::hidePopup(Cursor & cur)
|
||||
{
|
||||
popup()->hide();
|
||||
if (popup_timer_.isActive())
|
||||
popup_timer_.stop();
|
||||
}
|
||||
|
||||
|
||||
void GuiCompleter::showInline(Cursor & cur)
|
||||
{
|
||||
if (!inlinePossible(cur))
|
||||
@ -473,6 +465,13 @@ void GuiCompleter::showInline(Cursor & cur)
|
||||
}
|
||||
|
||||
|
||||
void GuiCompleter::hideInline(Cursor & cur)
|
||||
{
|
||||
gui_->bufferView().setInlineCompletion(cur, DocIterator(), docstring());
|
||||
inlineVisible_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GuiCompleter::showPopup()
|
||||
{
|
||||
Cursor cur = gui_->bufferView().cursor();
|
||||
@ -504,10 +503,7 @@ void GuiCompleter::activate()
|
||||
if (!popupVisible() && !inlineVisible())
|
||||
return;
|
||||
|
||||
// Complete with current selection in the popup.
|
||||
QString s = currentCompletion();
|
||||
popup()->hide();
|
||||
popupActivated(s);
|
||||
popupActivated(currentCompletion());
|
||||
}
|
||||
|
||||
|
||||
@ -548,9 +544,8 @@ void GuiCompleter::tab()
|
||||
cur.inset().insertCompletion(cur, docstring(), true);
|
||||
|
||||
// hide popup and inline completion
|
||||
popup()->hide();
|
||||
gui_->bufferView().setInlineCompletion(cur, DocIterator(), docstring());
|
||||
inlineVisible_ = false;
|
||||
hidePopup(cur);
|
||||
hideInline(cur);
|
||||
updateVisibility(false, false);
|
||||
return;
|
||||
}
|
||||
@ -730,7 +725,8 @@ void GuiCompleter::popupActivated(const QString & completion)
|
||||
docstring prefix = cur.inset().completionPrefix(cur);
|
||||
docstring postfix = from_utf8(fromqstr(completion.mid(prefix.length())));
|
||||
cur.inset().insertCompletion(cur, postfix, true);
|
||||
updateVisibility(cur, false);
|
||||
hidePopup(cur);
|
||||
hideInline(cur);
|
||||
|
||||
if (cur.disp_.update())
|
||||
gui_->bufferView().processUpdateFlags(cur.disp_.update());
|
||||
|
@ -88,6 +88,10 @@ private:
|
||||
///
|
||||
void showInline(Cursor & cur);
|
||||
///
|
||||
void hidePopup(Cursor & cur);
|
||||
///
|
||||
void hideInline(Cursor & cur);
|
||||
///
|
||||
void updatePopup(Cursor & cur);
|
||||
///
|
||||
void updateInline(Cursor & cur, QString const & completion);
|
||||
|
Loading…
Reference in New Issue
Block a user