This patch has been backported from the lyx-unstable branch
https://gitlab.com/gadmm/lyx-unstable/-/commit/
9d7ed42389ba
Actual author is Guillaume Munch.
Fixes bug #8951.
bool clickable_inset_;
/// shape of the caret
frontend::CaretGeometry caret_geometry_;
+ ///
+ bool mouse_selecting_ = false;
};
}
+bool BufferView::mouseSelecting() const
+{
+ return d->mouse_selecting_;
+}
+
+
void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
{
//lyxerr << "[ cmd0 " << cmd0 << "]" << endl;
d->mouse_position_cache_.x_ = cmd.x();
d->mouse_position_cache_.y_ = cmd.y();
+ d->mouse_selecting_ =
+ cmd.action() == LFUN_MOUSE_MOTION && cmd.button() == mouse_button::button1;
+
if (cmd.action() == LFUN_MOUSE_MOTION && cmd.button() == mouse_button::none) {
updateHoveredInset();
return;
bool clickableInset() const;
///
void makeDocumentClass();
+ /// Are we currently performing a selection with the mouse?
+ bool mouseSelecting() const;
private:
/// noncopyable
// Skip these when selecting
// FIXME: let GuiView take care of those.
- if (cmd.action() != LFUN_MOUSE_MOTION) {
+ if (notJustMovingTheMouse && !buffer_view_->mouseSelecting()) {
completer_->updateVisibility(false, false);
lyx_view_->updateDialogs();
lyx_view_->updateStatusBar();
bool Inset::editing(BufferView const * bv) const
{
- return bv->cursor().isInside(this);
+ if (bv->mouseSelecting())
+ // Avoid flicker when selecting with the mouse: when so, do not make
+ // decisions about metrics based on the mouse location.
+ return bv->cursor().realAnchor().isInside(this);
+ else
+ return bv->cursor().isInside(this);
}
bool InsetMathMacro::editMode(BufferView const * bv) const {
// find this in cursor trace
- Cursor const & cur = bv->cursor();
+ DocIterator const & cur =
+ // Do not move the reference while selecting with the mouse to avoid
+ // flicker due to changing metrics
+ bv->mouseSelecting() ? bv->cursor().realAnchor() : bv->cursor();
for (size_t i = 0; i != cur.depth(); ++i)
if (&cur[i].inset() == this) {
// look if there is no other macro in edit mode above