// set update flags
if (changed) {
- if (singlePar && !(cur.disp_.update() | Update::Force))
+ if (singlePar && !(cur.disp_.update() & Update::Force))
cur.updateFlags(cur.disp_.update() | Update::SinglePar);
else
cur.updateFlags(cur.disp_.update() | Update::Force);
dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
FuncRequest::KEYBOARD));
LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']");
- lyx_view_->updateCompletion(true, true);
}
} else {
dispatch(func);
if (!lyx_view_)
return;
- if (func.action == LFUN_CHAR_DELETE_BACKWARD)
- // backspace is not a self-insertion. But it
- // still should not hide the completion popup.
- // FIXME: more clever way to detect those movements
- lyx_view_->updateCompletion(false, true);
- else
- lyx_view_->updateCompletion(false, false);
}
if (lyx_view_)
view()->cursor().fixIfBroken();
}
+ // update completion. We do it here and not in
+ // processKeySym to avoid another redraw just for a
+ // changed inline completion
+ if (cmd.origin == FuncRequest::KEYBOARD) {
+ if (cmd.action == LFUN_SELF_INSERT)
+ lyx_view_->updateCompletion(view()->cursor(), true, true);
+ else if (cmd.action == LFUN_CHAR_DELETE_BACKWARD)
+ lyx_view_->updateCompletion(view()->cursor(), false, true);
+ else
+ lyx_view_->updateCompletion(view()->cursor(), false, false);
+ }
+
updateFlags = view()->cursor().result().update();
}
class Buffer;
class BufferView;
+class Cursor;
class FuncStatus;
class FuncRequest;
class Inset;
/// Update the completion popup and the inline completion state.
/// If \c start is true, then a new completion might be started.
/// If \c keep is true, an active completion will be kept active
- /// even though the cursor moved.
- virtual void updateCompletion(bool start, bool keep) = 0;
+ /// even though the cursor moved. The update flags of \c cur might
+ /// be changed.
+ virtual void updateCompletion(Cursor & cur, bool start, bool keep) = 0;
private:
/// noncopyable
}
-void GuiView::updateCompletion(bool start, bool keep)
+void GuiView::updateCompletion(Cursor & cur, bool start, bool keep)
{
if (d.current_work_area_)
- d.current_work_area_->completer().updateVisibility(start, keep);
+ d.current_work_area_->completer().updateVisibility(cur, start, keep);
}
namespace {