[LyX/master] Fixup 907f0207: another place where pm.ascent() is wrong

Jean-Marc Lasgouttes lasgouttes at lyx.org
Mon Aug 24 14:48:16 UTC 2020


commit 2a6f1d2b58a58f61c168ac0a6d7e6ac655511da8
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Mon Aug 24 17:10:06 2020 +0200

    Fixup 907f0207: another place where pm.ascent() is wrong
    
    Fix bug where selecting in first paragraph gave an end of selection on
    wrong row.
    
    Since pm.ascent() may contain the top margin, it makes sense in
    setCursorFromCoordinates() to use the ascent of the front row instead,
    like was none in907f0207 for getPitAndRowNearY().
---
 src/TextMetrics.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 88ea655..b393c1d 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -1439,7 +1439,7 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const
 
 	ParagraphMetrics const & pm = par_metrics_[pit];
 
-	int yy = pm.position() - pm.ascent();
+	int yy = pm.position() - pm.rows().front().ascent();
 	LYXERR(Debug::DEBUG, "x: " << x << " y: " << y <<
 		" pit: " << pit << " yy: " << yy);
 


More information about the lyx-cvs mailing list