Hello Jean-Marc,

>      * Recompute inset positions before checking row left edge, by 
> painting the row insets with drawing disabled.
> 
> Corresponding change is:
> 
> +       // Force the recomputation of inset positions
> +       bool const drawing = pi.pain.isDrawingEnabled();
> +       pi.pain.setDrawingEnabled(false);
> +       // No need to care about vertical position.
> +       RowPainter rp(pi, bv.buffer().text(), cur.bottom().pit(), row, 
> bidi, 0, 0);
> +       rp.paintOnlyInsets();
> +       pi.pain.setDrawingEnabled(drawing);

As I can understand here you have declared a new RowPainter and with the
disabled drawing tries to pain only the insets. It is assumed that this will
force the re-computation of the positions of the insets.

>       * Makes sure that BufferView::draw gets involved when Update flags 
> is just FitCursor (see BufferView::processUpdateFlags)
> 
> Corresponding change is:
> 
> -               // no screen update is needed.
> +               // no screen update is needed in principle, but this
> +               // could change if cursor row needs scrolling.
>                  d->update_strategy_ = NoScreenUpdate;
> +               buffer_.changed(false);

I did not get the role of 'buffer_.changed(false);'

>       * Change update strategy when left edge has changed. This allows 
> to redraw the row when no drawing was scheduled. Something similar needs 
> to be done when the row left by the cursor had a non-zero left edge.
> 
> Corresponding change is:
> 
> +       if (cur.getLeftEdge() != left_edge
> +           && strategy == NoScreenUpdate) {
> +               ScreenUpdateStrategy const oldstrat = strategy;
> +               strategy = SingleParUpdate;
> +               LYXERR0("leftEdge: " << cur.getLeftEdge() << " => " << 
> left_edge
> +                       << ", Update strategy " << oldstrat << " => " << 
> strategy);
> +       }

> I let you pick the work from there. Please keep me informed as often as 
> possible, even to say that you are blocked. We are late in this project 
> so I would expect to hear from you daily or at least see reports on the 
> wiki page. Unfortunately I cannot promise to answer immediately, but I 
> will do my best.

I committed this to patch to git. And also did some debugging to see why
this does not work for the remaining problems. 
In that particular case, (where I have sent an video to show what goes wrong
in my other message) both cur.getLeftEdge() and left_edge become '0' just
after entering the Math inset. So above strategy change will not be executed
as cur.getLeftEdge() = left_edge. 
Also, when normally the text cursor is in the Math inset, the strategy that
is used is DecorationUpdate (stragegy=3), and when this particular situation
occurs that changes to FullScreenUpdate (stragegy=2).

By the way, I do not see any relationship between the case numbers in the
switch under BufferView::draw and the numbers I am getting for strategies. I
think that is nothing to worry about.

Here is a set of data I got from debugging. 
1- indicates values before calculating left edge
2- indicates values before calculating left edge
cur means - cur_x

//It is near to the right edge (demonstrating from the document I use)

// before last '.' in math inset
BufferView.cpp (2860): 1 cur 2490 leftedge 1935
BufferView.cpp (2900): 2 cur 2490 leftedge 1946

//before '}'
BufferView.cpp (2860): 1 cur 2501 leftedge 1946
BufferView.cpp (2900): 2 cur 2501 leftedge 1957

//after passing '}' but still inside the math inset 
BufferView.cpp (2860): 1 cur 2510 leftedge 1957
BufferView.cpp (2900): 2 cur 2510 leftedge 1966

//just after getting out of the math equation using rigth arrow
BufferView.cpp (2860): 1 cur 2511 leftedge 1966
BufferView.cpp (2900): 2 cur 2511 leftedge 1967
BufferView.cpp (2860): 1 cur 2511 leftedge 1967
BufferView.cpp (2900): 2 cur 2511 leftedge 1967

//just after getting into math inset using left arrow. 
//Note that cur_x changes to 10 (unexpected). 
//Because of that left edge becomes 0.
BufferView.cpp (2860): 1 cur 10 leftedge 1967
BufferView.cpp (2900): 2 cur 10 leftedge 0
BufferView.cpp (2860): 1 cur 10 leftedge 0
BufferView.cpp (2900): 2 cur 10 leftedge 0

//when we move the mouse pointer over the math inset
BufferView.cpp (2860): 1 cur 2510 leftedge 0
BufferView.cpp (2900): 2 cur 2510 leftedge 1966
BufferView.cpp (2860): 1 cur 2510 leftedge 1966
BufferView.cpp (2900): 2 cur 2510 leftedge 1966


Thank you
Hashini

Reply via email to