Le 10/04/2023 à 21:39, Pavel Sanda a écrit :
Hi,

this is in current master:
1. create new file & insert new graphics
2. move cursor in front of the graphics
3. only small bottom part of the cursor is visible, the rest is hidden behind 
the image
    (in other words the cursor is actually not in front of the image)

Is this patch better? Note that graphics insets margins are much tighter in 2.4 than 2.3; feel free to complain about it.

JMarc

From 6edae9dfd415493d4f3d49832a498933da474561 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Thu, 13 Apr 2023 23:44:53 +0200
Subject: [PATCH] Make caret visible around graphics inset

Two changes :
1/ add a one pixel margin to the left
2/ when the file is not displayed fix the width of the bounging rectangle.
---
 src/insets/InsetGraphics.h   | 2 +-
 src/insets/RenderGraphic.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h
index 2f0156dfc9..135cfd81d9 100644
--- a/src/insets/InsetGraphics.h
+++ b/src/insets/InsetGraphics.h
@@ -97,7 +97,7 @@ public:
 	///
 	int bottomOffset(BufferView const *) const override { return 0; }
 	///
-	int leftOffset(BufferView const *) const override { return 0; }
+	int leftOffset(BufferView const *) const override { return 1; }
 	///
 	int rightOffset(BufferView const *) const override { return 0; }
 
diff --git a/src/insets/RenderGraphic.cpp b/src/insets/RenderGraphic.cpp
index 318f8aab0d..2e1693db07 100644
--- a/src/insets/RenderGraphic.cpp
+++ b/src/insets/RenderGraphic.cpp
@@ -201,7 +201,7 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y, bool const darkmode) co
 
 	else {
 		Color c = pi.change.changed() ? pi.change.color() : Color_foreground;
-		pi.pain.rectangle(x1, y1, w, h, c);
+		pi.pain.rectangle(x1, y1, w - 1, h, c);
 
 		// Print the file name.
 		FontInfo msgFont = pi.base.font;
-- 
2.37.2

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to