mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bad cursor positioning when entering an inset
The test added at 359aef92
was incorrect. Actually, Inset::editXY
returns the inset when it is edited and also when it is not, which
can be confusing. So if we are unlucky and the slices positions in the
text area and in the inner inset match, the code below triggers and
many bad things can happen.
editXY() should probably have a documented way to indicate whether the
cursor has entered the inset, although the test used right now is
probably OK. The inset value is useful mainly for context menus or
tasks that need to know which inset the (x, y) coordinates
point to.
Note finally that the documentation of TextMetrics::editXY is
incorrect concerning the return value. It will return a non-null value
if the cursor is on a not editable inset.
Fixes #10691.
This commit is contained in:
parent
6fc72a1a1f
commit
7ca7873112
@ -1379,7 +1379,9 @@ Inset * TextMetrics::editXY(Cursor & cur, int x, int y,
|
||||
|
||||
// Try to descend recursively inside the inset.
|
||||
Inset * edited = inset->editXY(cur, x, y);
|
||||
if (edited == inset && cur.pos() == it->pos) {
|
||||
// FIXME: it is not clear that the test on position is needed
|
||||
// Remove it if/when semantics of editXY is clarified
|
||||
if (cur.text() == text_ && cur.pos() == it->pos) {
|
||||
// non-editable inset, set cursor after the inset if x is
|
||||
// nearer to that position (bug 9628)
|
||||
bool bound = false; // is modified by getPosNearX
|
||||
|
Loading…
Reference in New Issue
Block a user