Do not set cursor to the right of newline with mouse

When a row is broken by for example a display math inset, it is
possible to put the cursor at the end of the previous line using the
boundary setting of cursor.

For newline insets and separator insets, we want to force the cursor
to be before this inset. Also, in the other cases, do not force
boundary property (effectively reverts part of f29e7803).
This commit is contained in:
Jean-Marc Lasgouttes 2016-03-06 15:29:25 +01:00
parent fdab91be63
commit 3b6919217b

View File

@ -1156,9 +1156,14 @@ pos_type TextMetrics::getPosNearX(Row const & row, int & x,
* row is larger than the end of its last element.
*/
if (!row.empty() && pos == row.back().endpos
&& row.back().endpos == row.endpos())
boundary = true;
&& row.back().endpos == row.endpos()) {
Inset const * inset = row.back().inset;
if (inset && (inset->lyxCode() == NEWLINE_CODE
|| inset->lyxCode() == SEPARATOR_CODE))
pos = row.back().pos;
else
boundary = row.right_boundary();
}
x += xo;
//LYXERR0("getPosNearX ==> pos=" << pos << ", boundary=" << boundary);
return pos;