return;
}
+ inputContext()->reset();
+
+ FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
+ q_button_state(e->button()));
+ dispatch(cmd, q_key_state(e->modifiers()));
+
// Save the context menu on mouse press, because also the mouse
// cursor is set on mouse press. Afterwards, we can either release
// the mousebutton somewhere else, or the cursor might have moved
- // due to the DEPM.
+ // due to the DEPM. We need to do this after the mouse has been
+ // set in dispatch(), because the selection state might change.
if (e->button() == Qt::RightButton)
context_menu_name_ = buffer_view_->contextMenu(e->x(), e->y());
- inputContext()->reset();
-
- FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
- q_button_state(e->button()));
- dispatch(cmd, q_key_state(e->modifiers()));
e->accept();
}
{
//lyxerr << "## lfunMousePress: buttons: " << cmd.button() << endl;
BufferView & bv = cur.bv();
+ if (cmd.button() == mouse_button::button3) {
+ // Don't do anything if we right-click a
+ // selection, a context menu will popup.
+ if (bv.cursor().selection() && cur >= bv.cursor().selectionBegin()
+ && cur < bv.cursor().selectionEnd()) {
+ cur.noScreenUpdate();
+ return;
+ }
+ }
bool do_selection = cmd.button() == mouse_button::button1
&& cmd.argument() == "region-select";
bv.mouseSetCursor(cur, do_selection);