[LyX/master] Remove one use of cursorPos
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Mon Jul 13 09:03:51 UTC 2026
commit ad5f19d23cc8fc646fa28ffbb770ec7be2081b1a
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Sun Jul 12 18:14:42 2026 +0200
Remove one use of cursorPos
bruteFind actually wants the absolute position of cursor, so that
getPos is the right thing to use.
---
src/Cursor.cpp | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index fa79971e81..5b4ffd047a 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -77,26 +77,17 @@ DocIterator bruteFind(Cursor const & c, int x, int y)
DocIterator et = c;
et.pos() = et.lastpos();
for (size_t i = 0;; ++i) {
- int xo;
- int yo;
- Inset const * inset = &it.inset();
- CoordCache::Insets const & insetCache = c.bv().coordCache().insets();
-
// FIXME: in the case where the inset is not in the cache, this
// means that no part of it is visible on screen. In this case
// we don't do elaborate search and we just return the forwarded
// DocIterator at its beginning.
- if (!insetCache.has(inset)) {
+ if (!c.bv().hasPosition(it)) {
it.top().pos() = 0;
return it;
}
- Point const o = insetCache.xy(inset);
- inset->cursorPos(c.bv(), it.top(), c.boundary(), xo, yo);
- // Convert to absolute
- xo += o.x;
- yo += o.y;
- double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
+ Point p = c.bv().getPos(it);
+ double d = (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y);
// '<=' in order to take the last possible position
// this is important for clicking behind \sum in e.g. '\sum_i a'
LYXERR(Debug::DEBUG, "i: " << i << " d: " << d
More information about the lyx-cvs
mailing list