]> git.lyx.org Git - features.git/commit
Fix bad cursor positioning when entering an inset
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 8 Jun 2017 09:35:05 +0000 (11:35 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 8 Jun 2017 11:48:51 +0000 (13:48 +0200)
commit7ca7873112314963c3a43987f32484749ec3af58
treeba7e2de519cabf4272071ab0c02cfb0cc60f5171
parent6fc72a1a1ffc6abb321ce1b7921eed5655302b40
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.
src/TextMetrics.cpp