Hello Jean-Marc, > I tried to fix this and found that this happens because cur_x variable do > mot get updates as expected. I save bv.getPos(cur).x_ to cur_x, as I > discussed with you earlier. But my previous observation seems to be wrong > when compared to cur.targetX(). I tried with cur.targetX() too. But that > also did not solve the problem. > > *Here I am talking about the left corner of Math equation. > What is happening normally is for each key stroke, this cur_x gets updated > once. (If I do not move the mouse pointer) > But just after I enter Math (going from left to right) this gives two 10s; > which should have been one 13. > When I came to the same position (going from right to left) it gives one 13; > which is correct. > Next when I just got out from the Math (going from right to left) it gives > two 10s; which should have been one 10. > * My algorithm is not working properly only because of the misbehaviour of > moving from left to right at this point. (How many times this value get > update do not affect the algorithm) > > *If consider about the right corner of the math equation; what is happening is; > When I inside Math at right corner it gives 2510 and when I press right > arrow once gives two 2511; which should have been one 2511. > Then when I try to get back into Math; it gives two 10s; which should have > been one 2510. That is why the whole row gets slid to the left most edge at > this moment. But when I proceed fro there; the cur_x gives correct values. > > *So it is clear that when the cur_x does not get the correct value, when the > cursor just enter the Math inset. (Either from left corner or right corner). > Is this done purposely? > Isn't there single variable that gives the absolute text cursor position all > the time?
When I test further, figured out that the cur_x only gives the correct position in pixels just after entering a Math inset; from the next row. That is the next row consider in the for loop in drawParagraph() method. The line responsible for updating this bv.getPos(cur).x_ for the current text row is "rp.paintText()". I do not know how this happens. But when I check bv.getPos(cur).x_ before this line, it gives the old value for the current row, and when I check bv.getPos(cur).x_ value after this line, it gives the new value. Could you help to understand what I am missing? http://git.lyx.org/?p=gsoc.git;a=commitdiff;h=5ffa26e6e05c5c76463e1637afb1e2d744595c7d Thanks Hashini