(Am Samstag, dem 01.11.2025 um 15:13 +0900 schrieb Yokota K.:
> I’m currently checking if GuiInputMethod::setAbsolutePosition() is
> related. It seems occurring within the line
> >     ParagraphList paras = cur.buffer()->paragraphs();
> that is meant just to get all main text paragraphs (btw, paras should
> be a reference to refrain a copy). Do I misunderstand anything or can
> there be a problem in called functions?

I don't know whether this fixes anything, but I would code this
function as in the attached patch.

-- 
Jürgen
diff --git a/src/frontends/qt/GuiInputMethod.cpp b/src/frontends/qt/GuiInputMethod.cpp
index d08f46211a..447e05dcaa 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -1443,10 +1443,11 @@ QLocale & GuiInputMethod::locale() const
 void GuiInputMethod::setAbsolutePosition(Cursor & cur) const
 {
 	d->abs_pos_ = 0;
-	ParagraphList paras = cur.buffer()->paragraphs();
-	for (int i=0; i < (int)paras.size(); ++i) {
-		if (i >= cur.pit()) break;
-		d->abs_pos_ += paras[i].size();
+
+	for (auto const & p : cur.buffer()->paragraphs()) {
+		if (p.id() == cur.paragraph().id())
+			break;
+		d->abs_pos_ += p.size();
 	}
 	d->abs_pos_ += cur.pos();
 }
-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to