commit b70f2eff4965c16de8b1fe9e53a9fe78167886ee
Author: Georg Baum <[email protected]>
Date: Sat Oct 17 18:13:18 2015 +0200
Fix regression of 359aef92f87
The context menu did no longer work for some insets, since it requires the
cursor to be in front, and editXY() is also used to determine the inset for
the context menu. Now the cursor is corrected if needed.
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index b07eb2b..24be162 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2249,6 +2249,15 @@ void BufferView::mouseEventDispatch(FuncRequest const &
cmd0)
// Build temporary cursor.
Inset * inset = d->text_metrics_[&buffer_.text()].editXY(cur, cmd.x(),
cmd.y());
+ if (inset) {
+ // If inset is not editable, cur.pos() might point behind the
+ // inset (depending on cmd.x(), cmd.y()). This is needed for
+ // editing to fix bug 9628, but e.g. the context menu needs a
+ // cursor in front of the inset.
+ if (inset->hasSettings() &&
+ cur.nextInset() != inset && cur.prevInset() == inset)
+ cur.backwardPos();
+ }
// Put anchor at the same position.
cur.resetAnchor();