From 3b6919217b86a4177a0997f4c92cbc59b293f07b Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sun, 6 Mar 2016 15:29:25 +0100 Subject: [PATCH] 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). --- src/TextMetrics.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 05e1c97b2a..e9303503a7 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; -- 2.39.5