commit 3b6919217b86a4177a0997f4c92cbc59b293f07b
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Sun Mar 6 15:29:25 2016 +0100
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).
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 05e1c97..e930350 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -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;