[LyX/2.5.x] Fix #13318 (correct context menu in equations)

Koji Yokota <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 023ee18b7a7d3926a0cdbd327a7050c8317ab634
Author: Koji Yokota <[email protected]>
Date:   Sun Aug 16 13:49:08 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 0e0f194820..e122cb6f63 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -671,25 +671,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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.