Le 10/03/2016 21:35, Scott Kostyshak a écrit :
On Thu, Mar 10, 2016 at 09:32:36PM +0100, Jean-Marc Lasgouttes wrote:
Thanks. So it's me after all. I'll handle it.

It seems like a minor issue (that no one reported in 2 years of testing
on master), so if you think it's better to wait, then I think that would
be fine. Your call.

What about this new version?

JMarc



>From 5cab866b48be3699f81347147690c3eb2f90c816 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
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 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;
-- 
1.7.9.5

Reply via email to