[LyX/master] Improve test in Geometry::covers

Jean-Marc Lasgouttes lasgouttes at lyx.org
Mon Jun 14 15:49:03 UTC 2021


commit a9c6fb0c19f5a3eb884262bd37f7efdac035a20b
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Wed Jun 9 15:59:28 2021 +0200

    Improve test in Geometry::covers
    
    Horizontally, the old code would count an extra pixel on the right.
    
    The vertical test is not changed, and should be eventually audited.
    
    Fixes bug #10468.
---
 src/CoordCache.h |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/CoordCache.h b/src/CoordCache.h
index 38842be..d1c0fa3 100644
--- a/src/CoordCache.h
+++ b/src/CoordCache.h
@@ -31,10 +31,8 @@ struct Geometry {
 
 	bool covers(int x, int y) const
 	{
-		return x >= pos.x_
-			&& x <= pos.x_ + dim.wid
-			&& y >= pos.y_ - dim.asc
-			&& y <= pos.y_ + dim.des;
+		return x >= pos.x_ && x < pos.x_ + dim.wid
+		       && y >= pos.y_ - dim.asc && y <= pos.y_ + dim.des;
 	}
 
 	int squareDistance(int x, int y) const


More information about the lyx-cvs mailing list