commit 5e4daba5b87ad858501d0a0e084345f5eaa05699
Author: Koji Yokota <[email protected]>
Date:   Sun Aug 16 13:43:14 2026 +0900

    Fix #13318 (correct context menu in equations)
---
 src/frontends/qt/GuiWorkArea.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index b4b4b7e401..d3f23901a2 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -753,25 +753,26 @@ void GuiWorkArea::contextMenuEvent(QContextMenuEvent * e)
                // the menu name is set on mouse press
                name = d->context_menu_name_;
        else {
-               QPoint pos = e->pos();
                Cursor const & cur = d->buffer_view_->cursor();
+               int x, y;
+               cur.getPos(x, y);
                if (e->reason() == QContextMenuEvent::Keyboard && 
cur.inTexted()) {
                        // Do not access the context menu of math right in 
front of before
                        // the cursor. This does not work when the cursor is in 
text.
                        Inset * inset = cur.paragraph().getInset(cur.pos());
                        if (inset && inset->asInsetMath())
-                               --pos.rx();
+                               --x;
                        else if (cur.pos() > 0) {
                                inset = cur.paragraph().getInset(cur.pos() - 1);
                                if (inset)
-                                       ++pos.rx();
+                                       ++x;
                        }
                }
                if (e->reason() == QContextMenuEvent::Keyboard)
                        // Subtract the top margin, see #12811
-                       pos.setY(pos.y() - d->buffer_view_->topMargin());
+                       y -= d->buffer_view_->topMargin();
 
-               name = d->buffer_view_->contextMenu(pos.x(), pos.y());
+               name = d->buffer_view_->contextMenu(x, y);
        }
 
        if (name.empty()) {
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to