31/08/2013 07:13, Hashini Senaratne:
Hello Jean-Marc,

Hope you returned safely.

Thanks. Sorry to answer so late, I had to cleanup the work that accumulated duing these weeks.

See my other message, you should be able to create another RowPainter
object.

I tried this but as you mentioned in the other method, but could not see nay
positive outcome. But I tried something else with your help, as mentioned below.

Please take a look at the attached patch. I do not remember of to test for this particular bug, so please test it for me. In informal testing, it is not worse than before :)

I also debugged the code and finally came to BufferView::draw. I believe
that this update_strategy is affecting the problem that we have (unintended
sliding of row when entering Math inset from the right side).

First of all I tried draw again after all the cases of the switch statement
by calling
tm.draw(pi, 0, y); again.
This gave an positive outcome.

Unfortunately, this code exists to avoid painting too much stuff, so we have to cope with it. We cannot afford to repaint the whole screen every time the user moves the cursor, it can be really horrible, especially on Mac OS X. I will try to post a patch tomorrow illustrating the way I propose to tackle the problem.

Something that bothers me a bit, though is why we do not do updates with home/end, but we do some updates when moving cursor letter by letter. But this is an unrelated problem.


>From c14a4c238b1ca7967bda4124b7560528da5699a3 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Tue, 3 Sep 2013 18:14:27 +0200
Subject: [PATCH] Recompute inset positions before checking row left edge

---
 src/TextMetrics.cpp |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 2142b25..2127690 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -2122,11 +2122,13 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
 		bool const inside = (y + row.descent() >= 0
 			&& y - row.ascent() < ww);
 
-		// It is not needed to draw on screen if we are not inside.
-		pi.pain.setDrawingEnabled(inside && original_drawing_state);
-
 		// Check for too wide insets to handle horizontal sliding
    		if (cur.getCurrentRow() == &row) {
+			// Force the recomputation of inset positions
+			pi.pain.setDrawingEnabled(false);
+			RowPainter rp(pi, *text_, pit, row, bidi, x, y);
+			rp.paintOnlyInsets();
+
 			// Current x position of the cursor in pixels
 			int const cur_x = bv_->getPos(cur).x_;
  
@@ -2146,6 +2148,9 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
 			cur.setLeftEdge(left_edge);
 		}
 
+		// It is not needed to draw on screen if we are not inside.
+		pi.pain.setDrawingEnabled(inside && original_drawing_state);
+
 		RowPainter rp(pi, *text_, pit, row, bidi, x, y);
 
 		if (selection)
-- 
1.7.0.4

Reply via email to